Manos Chorianopoulos

add MarketAnalysisItemViewCell

......@@ -7,7 +7,7 @@
<key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
......
......@@ -7,7 +7,7 @@
<key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
......
......@@ -906,18 +906,18 @@
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="sectionIndexBackgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="none" indentationWidth="10" reuseIdentifier="AnalysisItemViewCell" id="rSM-8Z-ffM" customClass="AnalysisItemViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="55.5" width="414" height="94.5"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="none" indentationWidth="10" reuseIdentifier="MarketAnalysisItemViewCell" id="rSM-8Z-ffM" customClass="MarketAnalysisItemViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="55.5" width="414" height="113"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="rSM-8Z-ffM" id="fGo-Oz-RqO">
<rect key="frame" x="0.0" y="0.0" width="414" height="94.5"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="113"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5k6-t4-gFM" userLabel="Border View">
<rect key="frame" x="10" y="0.0" width="394" height="94.5"/>
<rect key="frame" x="10" y="0.0" width="394" height="113"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bUU-PS-edj" userLabel="Inner View">
<rect key="frame" x="1" y="0.0" width="392" height="94.5"/>
<rect key="frame" x="1" y="0.0" width="392" height="113"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="05/05/2022" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9VR-A0-cUn" userLabel="Date">
<rect key="frame" x="20" y="25" width="352" height="16"/>
......@@ -929,10 +929,10 @@
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ni8-Py-xEo">
<rect key="frame" x="20" y="51" width="352" height="43.5"/>
<rect key="frame" x="20" y="51" width="352" height="62"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="1Mu-3a-ZW1">
<rect key="frame" x="0.0" y="8" width="28" height="28"/>
<rect key="frame" x="0.0" y="17" width="28" height="28"/>
<constraints>
<constraint firstAttribute="width" constant="28" id="JMm-vz-JST"/>
<constraint firstAttribute="height" constant="28" id="y90-Bp-tpm"/>
......@@ -944,14 +944,20 @@
<color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="248" verticalHuggingPriority="251" text="Έκπτωτικό κουπόνι" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xeT-di-ZfP" userLabel="ProductTitle">
<rect key="frame" x="38" y="24" width="251.5" height="17.5"/>
<fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="14"/>
<color key="textColor" red="0.61568627450000002" green="0.61568627450000002" blue="0.61176470589999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="248" verticalHuggingPriority="251" text="Έκπτωτικό κουπόνι" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="y30-3S-677" userLabel="Subtitle">
<rect key="frame" x="38" y="26" width="251.5" height="17.5"/>
<rect key="frame" x="38" y="44.5" width="251.5" height="17.5"/>
<fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="14"/>
<color key="textColor" red="0.61568627450000002" green="0.61568627450000002" blue="0.61176470589999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="4,00€" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SS9-PI-ZUR" userLabel="Price">
<rect key="frame" x="299.5" y="12" width="52.5" height="20"/>
<rect key="frame" x="299.5" y="21" width="52.5" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="nNy-3a-Ztq"/>
</constraints>
......@@ -968,8 +974,10 @@
<constraint firstAttribute="bottom" secondItem="y30-3S-677" secondAttribute="bottom" id="K3k-Hd-w89"/>
<constraint firstItem="1Mu-3a-ZW1" firstAttribute="leading" secondItem="ni8-Py-xEo" secondAttribute="leading" id="NjH-Zm-4gS"/>
<constraint firstAttribute="trailing" secondItem="SS9-PI-ZUR" secondAttribute="trailing" id="RdF-lo-9QV"/>
<constraint firstItem="SS9-PI-ZUR" firstAttribute="leading" secondItem="xeT-di-ZfP" secondAttribute="trailing" constant="10" id="SVr-jL-XJd"/>
<constraint firstItem="SS9-PI-ZUR" firstAttribute="centerY" secondItem="ni8-Py-xEo" secondAttribute="centerY" id="XQe-fS-mjb"/>
<constraint firstItem="y30-3S-677" firstAttribute="top" secondItem="sSa-Y8-U8x" secondAttribute="bottom" constant="5" id="Ycx-MH-IOt"/>
<constraint firstItem="xeT-di-ZfP" firstAttribute="leading" secondItem="1Mu-3a-ZW1" secondAttribute="trailing" constant="10" id="Xcm-cI-8Ee"/>
<constraint firstItem="y30-3S-677" firstAttribute="top" secondItem="xeT-di-ZfP" secondAttribute="bottom" constant="3" id="Ycx-MH-IOt"/>
<constraint firstItem="SS9-PI-ZUR" firstAttribute="leading" secondItem="sSa-Y8-U8x" secondAttribute="trailing" constant="10" id="ZPe-i4-8pX"/>
<constraint firstItem="y30-3S-677" firstAttribute="leading" secondItem="1Mu-3a-ZW1" secondAttribute="trailing" constant="10" id="hPn-vC-hQV"/>
<constraint firstItem="SS9-PI-ZUR" firstAttribute="top" relation="greaterThanOrEqual" secondItem="ni8-Py-xEo" secondAttribute="top" constant="5" id="lVi-jg-DFs"/>
......@@ -977,6 +985,7 @@
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="SS9-PI-ZUR" secondAttribute="bottom" constant="5" id="pdM-NR-NSU"/>
<constraint firstItem="sSa-Y8-U8x" firstAttribute="top" secondItem="ni8-Py-xEo" secondAttribute="top" id="qpr-9J-aX9"/>
<constraint firstItem="1Mu-3a-ZW1" firstAttribute="centerY" secondItem="ni8-Py-xEo" secondAttribute="centerY" id="qxj-kQ-VYX"/>
<constraint firstItem="xeT-di-ZfP" firstAttribute="top" secondItem="sSa-Y8-U8x" secondAttribute="bottom" constant="3" id="tlX-DO-FVe"/>
</constraints>
</view>
</subviews>
......@@ -1014,12 +1023,13 @@
<outlet property="dateLabel" destination="9VR-A0-cUn" id="6Jp-5S-wEE"/>
<outlet property="itemImage" destination="1Mu-3a-ZW1" id="DpC-2M-R3z"/>
<outlet property="priceLabel" destination="SS9-PI-ZUR" id="aGY-2M-P2d"/>
<outlet property="productTitleLabel" destination="xeT-di-ZfP" id="Yw6-U0-LJP"/>
<outlet property="subtitleLabel" destination="y30-3S-677" id="fSw-ur-2th"/>
<outlet property="titleLabel" destination="sSa-Y8-U8x" id="1ab-Ow-o76"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="AnalysisHeaderViewCell" id="XvY-ms-M6u" customClass="AnalysisHeaderViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="150" width="414" height="183.5"/>
<rect key="frame" x="0.0" y="168.5" width="414" height="183.5"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="XvY-ms-M6u" id="Vyz-vd-NeA">
<rect key="frame" x="0.0" y="0.0" width="414" height="183.5"/>
......@@ -1062,7 +1072,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="AnalysisHeaderMessageViewCell" id="NZW-xW-f4G" customClass="AnalysisHeaderMessageViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="333.5" width="414" height="305.5"/>
<rect key="frame" x="0.0" y="352" width="414" height="305.5"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="NZW-xW-f4G" id="QSk-w7-BGe">
<rect key="frame" x="0.0" y="0.0" width="414" height="305.5"/>
......@@ -1147,7 +1157,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="AnalysisMoreViewCell" id="nmR-bx-rhS" customClass="AnalysisMoreViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="639" width="414" height="60"/>
<rect key="frame" x="0.0" y="657.5" width="414" height="60"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="nmR-bx-rhS" id="I5V-Yk-yS9">
<rect key="frame" x="0.0" y="0.0" width="414" height="60"/>
......
......@@ -14,6 +14,7 @@ class MarketAnalysisItemViewCell: UITableViewCell {
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var priceLabel: UILabel!
@IBOutlet weak var subtitleLabel: UILabel!
@IBOutlet weak var productTitleLabel: UILabel!
var postImageURL: String? {
didSet {
......@@ -43,7 +44,7 @@ class MarketAnalysisItemViewCell: UITableViewCell {
// title
titleLabel.textColor = UIColor(rgb: 0x212121)
titleLabel.font = UIFont(name: "PeridotPE-Regular", size: 17.0)
titleLabel.font = UIFont(name: "PeridotPE-SBold", size: 17.0)
// price
priceLabel.textColor = UIColor(rgb: 0x212121)
......@@ -52,74 +53,15 @@ class MarketAnalysisItemViewCell: UITableViewCell {
// subtitle
// subtitleLabel.textColor = UIColor(rgb: 0x9D9D9C)
subtitleLabel.textColor = UIColor(rgb: 0x212121)
subtitleLabel.font = UIFont(name: "PeridotPE-Regular", size: 14.0)
}
}
extension AnalysisItemViewCell {
func configureCell(item: swiftApi.SharingCouponModel) {
let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList()
subtitleLabel.font = UIFont(name: "PeridotPE-SBold", size: 14.0)
titleLabel.text = ""
for merchant in merchantList {
if (merchant._uuid == item._merchant_uuid) {
// itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache())
self.postImageURL = merchant._img_preview
titleLabel.text = merchant._admin_name
break;
}
}
dateLabel.text = item._date
// titleLabel.text = item._name
let priceFloat = Float(round(100 * (Float(item._final_price) )) / 100)
var priceString = "0"
priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
priceLabel.text = priceString + "€"
if ("sent" == item._sharing_type) {
subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι προς " + item._receiver_msisdn)
} else if ("received" == item._sharing_type) {
subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι από " + item._sender_msisdn)
}
}
func configureCell(item: swiftApi.SharingCouponModel, isMarket: Bool) {
let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList()
let couponSetData: swiftApi.CouponSetItemModel? = item._sm_couponset_data
titleLabel.text = ""
for merchant in merchantList {
if (merchant._uuid == item._merchant_uuid) {
// itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache())
self.postImageURL = merchant._img_preview
titleLabel.text = merchant._admin_name
break;
}
}
dateLabel.text = item._date
// titleLabel.text = item._name
// titleLabel.text = couponSetData?.name ?? ""
// let priceFloat = Float(round(100 * (Float(item._final_price) )) / 100)
let priceFloat = Float(round(100 * (Float(couponSetData?.final_price ?? 0.0) )) / 100)
var priceString = "0"
priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
priceLabel.text = priceString + "€"
if ("sent" == item._sharing_type) {
subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι προς " + item._receiver_msisdn)
} else if ("received" == item._sharing_type) {
subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι από " + item._sender_msisdn)
}
// productTitleLabel
productTitleLabel.textColor = UIColor(rgb: 0x212121)
productTitleLabel.font = UIFont(name: "PeridotPE-Regular", size: 14.0)
}
}
extension MarketAnalysisItemViewCell {
func configureCell(item: swiftApi.CouponItemModel) {
// COUPONSET: desc, img_preview, name, terms, merchant_uuid
......@@ -154,12 +96,15 @@ extension AnalysisItemViewCell {
priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
priceLabel.text = priceString + "€"
subtitleLabel.text = "Έκπτωτικό κουπόνι"
subtitleLabel.text = "Έκπτωτικό κουπόνι" // TODO: FIX
// subtitleLabel.text = couponSetData?.short_description ?? ""
// OR
// let htmlText = couponSetData?.inner_text ?? ""
// subtitleLabel.text = htmlText.htmlToString
let htmlText = couponSetData?.inner_text ?? ""
productTitleLabel.text = htmlText.htmlToString
}
func configureCell(item: swiftApi.CouponItemModel, isMarket: Bool) {
......
......@@ -139,7 +139,7 @@ class MarketHistoryViewController: AnalysisChildViewController {
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisItemViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisItemViewCell
let cell = tableView.dequeueReusableCell(withIdentifier: "MarketAnalysisItemViewCell", for: indexPath) as! SwiftWarplyFramework.MarketAnalysisItemViewCell
// cell.configureCell(item: items[indexPath.row], isMarket: true)
cell.configureCell(item: items[indexPath.row])
......