Manos Chorianopoulos

fix AnalysisItemViewCell

...@@ -54,21 +54,37 @@ extension AnalysisItemViewCell { ...@@ -54,21 +54,37 @@ extension AnalysisItemViewCell {
54 54
55 func configureCell(item: swiftApi.CouponItemModel) { 55 func configureCell(item: swiftApi.CouponItemModel) {
56 56
57 -// COUPONSET: desc, img_preview, name, terms 57 +// COUPONSET: desc, img_preview, name, terms, merchant_uuid
58 // COUPON: coupon, expiration, discount, status 58 // COUPON: coupon, expiration, discount, status
59 +// MERCHANT: _img_preview,_admin_name
59 60
61 + let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList()
60 let couponSetData: swiftApi.CouponSetItemModel? = item.couponset_data 62 let couponSetData: swiftApi.CouponSetItemModel? = item.couponset_data
61 63
64 + titleLabel.text = ""
65 +
66 + for merchant in merchantList {
67 + if (merchant._uuid == couponSetData?.merchant_uuid) {
68 + itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache())
69 + titleLabel.text = merchant._admin_name
70 + break;
71 + }
72 + }
73 +
62 dateLabel.text = item.expiration ?? "" // TODO: change 74 dateLabel.text = item.expiration ?? "" // TODO: change
63 - itemImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache()) 75 +// itemImage.load(link: couponSetData?.img_preview ?? "", placeholder: UIImage(), cache: URLCache())
64 - titleLabel.text = couponSetData?.name ?? "" 76 +// titleLabel.text = couponSetData?.name ?? ""
65 77
66 let priceFloat = Float(round(100 * (Float(item.discount ?? "") ?? 0.0)) / 100) 78 let priceFloat = Float(round(100 * (Float(item.discount ?? "") ?? 0.0)) / 100)
67 var priceString = "0" 79 var priceString = "0"
68 priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) 80 priceString = String(format: "%.2f", priceFloat).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
69 priceLabel.text = priceString + "€" 81 priceLabel.text = priceString + "€"
70 82
71 - subtitleLabel.text = couponSetData?.short_description ?? "" 83 + subtitleLabel.text = "Έκπτωτικό κουπόνι"
84 +// subtitleLabel.text = couponSetData?.short_description ?? ""
85 + // OR
86 +// let htmlText = couponSetData?.inner_text ?? ""
87 +// subtitleLabel.text = htmlText.htmlToString
72 88
73 } 89 }
74 } 90 }
......