Manos Chorianopoulos

add MarketAnalysisItemViewCell

...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> 7 <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>0</integer> 10 + <integer>1</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> 7 <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>1</integer> 10 + <integer>0</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
......
...@@ -14,7 +14,8 @@ class MarketAnalysisItemViewCell: UITableViewCell { ...@@ -14,7 +14,8 @@ class MarketAnalysisItemViewCell: UITableViewCell {
14 @IBOutlet weak var titleLabel: UILabel! 14 @IBOutlet weak var titleLabel: UILabel!
15 @IBOutlet weak var priceLabel: UILabel! 15 @IBOutlet weak var priceLabel: UILabel!
16 @IBOutlet weak var subtitleLabel: UILabel! 16 @IBOutlet weak var subtitleLabel: UILabel!
17 - 17 + @IBOutlet weak var productTitleLabel: UILabel!
18 +
18 var postImageURL: String? { 19 var postImageURL: String? {
19 didSet { 20 didSet {
20 if let url = postImageURL { 21 if let url = postImageURL {
...@@ -43,7 +44,7 @@ class MarketAnalysisItemViewCell: UITableViewCell { ...@@ -43,7 +44,7 @@ class MarketAnalysisItemViewCell: UITableViewCell {
43 44
44 // title 45 // title
45 titleLabel.textColor = UIColor(rgb: 0x212121) 46 titleLabel.textColor = UIColor(rgb: 0x212121)
46 - titleLabel.font = UIFont(name: "PeridotPE-Regular", size: 17.0) 47 + titleLabel.font = UIFont(name: "PeridotPE-SBold", size: 17.0)
47 48
48 // price 49 // price
49 priceLabel.textColor = UIColor(rgb: 0x212121) 50 priceLabel.textColor = UIColor(rgb: 0x212121)
...@@ -52,74 +53,15 @@ class MarketAnalysisItemViewCell: UITableViewCell { ...@@ -52,74 +53,15 @@ class MarketAnalysisItemViewCell: UITableViewCell {
52 // subtitle 53 // subtitle
53 // subtitleLabel.textColor = UIColor(rgb: 0x9D9D9C) 54 // subtitleLabel.textColor = UIColor(rgb: 0x9D9D9C)
54 subtitleLabel.textColor = UIColor(rgb: 0x212121) 55 subtitleLabel.textColor = UIColor(rgb: 0x212121)
55 - subtitleLabel.font = UIFont(name: "PeridotPE-Regular", size: 14.0) 56 + subtitleLabel.font = UIFont(name: "PeridotPE-SBold", size: 14.0)
57 +
58 + // productTitleLabel
59 + productTitleLabel.textColor = UIColor(rgb: 0x212121)
60 + productTitleLabel.font = UIFont(name: "PeridotPE-Regular", size: 14.0)
56 } 61 }
57 } 62 }
58 63
59 -extension AnalysisItemViewCell { 64 +extension MarketAnalysisItemViewCell {
60 - func configureCell(item: swiftApi.SharingCouponModel) {
61 -
62 - let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList()
63 -
64 - titleLabel.text = ""
65 -
66 - for merchant in merchantList {
67 - if (merchant._uuid == item._merchant_uuid) {
68 - // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache())
69 - self.postImageURL = merchant._img_preview
70 - titleLabel.text = merchant._admin_name
71 - break;
72 - }
73 - }
74 -
75 - dateLabel.text = item._date
76 - // titleLabel.text = item._name
77 -
78 - let priceFloat = Float(round(100 * (Float(item._final_price) )) / 100)
79 - var priceString = "0"
80 - priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
81 - priceLabel.text = priceString + "€"
82 -
83 - if ("sent" == item._sharing_type) {
84 - subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι προς " + item._receiver_msisdn)
85 - } else if ("received" == item._sharing_type) {
86 - subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι από " + item._sender_msisdn)
87 - }
88 - }
89 -
90 - func configureCell(item: swiftApi.SharingCouponModel, isMarket: Bool) {
91 -
92 - let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList()
93 - let couponSetData: swiftApi.CouponSetItemModel? = item._sm_couponset_data
94 -
95 - titleLabel.text = ""
96 -
97 - for merchant in merchantList {
98 - if (merchant._uuid == item._merchant_uuid) {
99 - // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache())
100 - self.postImageURL = merchant._img_preview
101 - titleLabel.text = merchant._admin_name
102 - break;
103 - }
104 - }
105 -
106 - dateLabel.text = item._date
107 - // titleLabel.text = item._name
108 -// titleLabel.text = couponSetData?.name ?? ""
109 -
110 -// let priceFloat = Float(round(100 * (Float(item._final_price) )) / 100)
111 - let priceFloat = Float(round(100 * (Float(couponSetData?.final_price ?? 0.0) )) / 100)
112 - var priceString = "0"
113 - priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
114 - priceLabel.text = priceString + "€"
115 -
116 - if ("sent" == item._sharing_type) {
117 - subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι προς " + item._receiver_msisdn)
118 - } else if ("received" == item._sharing_type) {
119 - subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι από " + item._sender_msisdn)
120 - }
121 - }
122 -
123 func configureCell(item: swiftApi.CouponItemModel) { 65 func configureCell(item: swiftApi.CouponItemModel) {
124 66
125 // COUPONSET: desc, img_preview, name, terms, merchant_uuid 67 // COUPONSET: desc, img_preview, name, terms, merchant_uuid
...@@ -154,12 +96,15 @@ extension AnalysisItemViewCell { ...@@ -154,12 +96,15 @@ extension AnalysisItemViewCell {
154 priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) 96 priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
155 priceLabel.text = priceString + "€" 97 priceLabel.text = priceString + "€"
156 98
157 - subtitleLabel.text = "Έκπτωτικό κουπόνι" 99 + subtitleLabel.text = "Έκπτωτικό κουπόνι" // TODO: FIX
158 // subtitleLabel.text = couponSetData?.short_description ?? "" 100 // subtitleLabel.text = couponSetData?.short_description ?? ""
159 // OR 101 // OR
160 // let htmlText = couponSetData?.inner_text ?? "" 102 // let htmlText = couponSetData?.inner_text ?? ""
161 // subtitleLabel.text = htmlText.htmlToString 103 // subtitleLabel.text = htmlText.htmlToString
162 104
105 + let htmlText = couponSetData?.inner_text ?? ""
106 + productTitleLabel.text = htmlText.htmlToString
107 +
163 } 108 }
164 109
165 func configureCell(item: swiftApi.CouponItemModel, isMarket: Bool) { 110 func configureCell(item: swiftApi.CouponItemModel, isMarket: Bool) {
......
...@@ -139,7 +139,7 @@ class MarketHistoryViewController: AnalysisChildViewController { ...@@ -139,7 +139,7 @@ class MarketHistoryViewController: AnalysisChildViewController {
139 return cell 139 return cell
140 } 140 }
141 141
142 - let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisItemViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisItemViewCell 142 + let cell = tableView.dequeueReusableCell(withIdentifier: "MarketAnalysisItemViewCell", for: indexPath) as! SwiftWarplyFramework.MarketAnalysisItemViewCell
143 // cell.configureCell(item: items[indexPath.row], isMarket: true) 143 // cell.configureCell(item: items[indexPath.row], isMarket: true)
144 cell.configureCell(item: items[indexPath.row]) 144 cell.configureCell(item: items[indexPath.row])
145 145
......