Showing
4 changed files
with
27 additions
and
3 deletions
No preview for this file type
This diff is collapsed. Click to expand it.
... | @@ -55,7 +55,7 @@ import AVFoundation | ... | @@ -55,7 +55,7 @@ import AVFoundation |
55 | couponImageHeight.constant = 255 //230 // 253 // self.uiscreen.height * 0.25 | 55 | couponImageHeight.constant = 255 //230 // 253 // self.uiscreen.height * 0.25 |
56 | 56 | ||
57 | nameLabel.text = "Εκπτωτικό κουπόνι COSMOTE SuperMarket Deals!" | 57 | nameLabel.text = "Εκπτωτικό κουπόνι COSMOTE SuperMarket Deals!" |
58 | - discriptionLabel.text = "Χρησιμοποίησε τον παρακάτω κωδικό και πάρε έκπτωση στα ενεργά κουπόνια προσφορών." | 58 | +// discriptionLabel.text = "Χρησιμοποίησε τον παρακάτω κωδικό και πάρε έκπτωση στα ενεργά κουπόνια προσφορών." |
59 | 59 | ||
60 | merchantDescrTextView.text = "" | 60 | merchantDescrTextView.text = "" |
61 | merchantDescrTextViewTopSpace.constant = CGFloat(0) | 61 | merchantDescrTextViewTopSpace.constant = CGFloat(0) |
... | @@ -126,6 +126,26 @@ import AVFoundation | ... | @@ -126,6 +126,26 @@ import AVFoundation |
126 | couponNumberLabel.text = coupon?._barcode ?? "" | 126 | couponNumberLabel.text = coupon?._barcode ?? "" |
127 | couponView.frame = CGRect(x: 0.0, y: 0.0, width: couponView.intrinsicContentSize.width, height: 55) | 127 | couponView.frame = CGRect(x: 0.0, y: 0.0, width: couponView.intrinsicContentSize.width, height: 55) |
128 | 128 | ||
129 | + | ||
130 | + let activeCoupons = coupon?._coupons.filter { $0.status == 1 } | ||
131 | + let activeCouponsDiscount = (activeCoupons?.reduce(0) { $0 + (Float($1.discount ?? "0") ?? 0) }) ?? 0 | ||
132 | + | ||
133 | +// discriptionLabel.text = "Χρησιμοποίησε τον παρακάτω κωδικό και πάρε έκπτωση στα ενεργά κουπόνια προσφορών αξίας " + String(activeCouponsDiscount) + "€." | ||
134 | + | ||
135 | + // ======== | ||
136 | + let discrNormalText1 = "Χρησιμοποίησε τον παρακάτω κωδικό και πάρε έκπτωση στα ενεργά κουπόνια προσφορών αξίας " | ||
137 | + let discrBoldText = String(activeCouponsDiscount) + "€." | ||
138 | + | ||
139 | + let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Regular", size: 16) ?? UIFont.systemFont(ofSize: 15), NSAttributedString.Key.foregroundColor: UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00)] | ||
140 | + let attrBold = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Bold", size: 16) ?? UIFont.boldSystemFont(ofSize: 15), NSAttributedString.Key.foregroundColor: UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00)] | ||
141 | + | ||
142 | + let sumAttributedString = NSMutableAttributedString(string:discrNormalText1, attributes:attrRegular) | ||
143 | + let sumBoldString = NSMutableAttributedString(string: discrBoldText, attributes:attrBold) | ||
144 | + | ||
145 | + sumAttributedString.append(sumBoldString) | ||
146 | + discriptionLabel.attributedText = sumAttributedString | ||
147 | + // ======== | ||
148 | + | ||
129 | // let barcodeString = constructBarcode(coupon: coupon) ?? "" | 149 | // let barcodeString = constructBarcode(coupon: coupon) ?? "" |
130 | let barcodeString = coupon?._barcode ?? "" | 150 | let barcodeString = coupon?._barcode ?? "" |
131 | barcodeLabel.text = barcodeString | 151 | barcodeLabel.text = barcodeString | ... | ... |
... | @@ -51,6 +51,7 @@ import UIKit | ... | @@ -51,6 +51,7 @@ import UIKit |
51 | func configureCell(coupon: swiftApi.UnifiedCouponModel) { | 51 | func configureCell(coupon: swiftApi.UnifiedCouponModel) { |
52 | let activeCoupons = coupon._coupons.filter { $0.status == 1 } | 52 | let activeCoupons = coupon._coupons.filter { $0.status == 1 } |
53 | let activeCouponsCount = activeCoupons.count | 53 | let activeCouponsCount = activeCoupons.count |
54 | + let activeCouponsDiscount = activeCoupons.reduce(0) { $0 + (Float($1.discount ?? "0") ?? 0) } | ||
54 | 55 | ||
55 | // var activeCouponsCount:Int = 0 | 56 | // var activeCouponsCount:Int = 0 |
56 | // for coupon in coupon._coupons { | 57 | // for coupon in coupon._coupons { |
... | @@ -62,8 +63,11 @@ import UIKit | ... | @@ -62,8 +63,11 @@ import UIKit |
62 | nameLabel.text = "COSMOTE SuperMarket Deals" | 63 | nameLabel.text = "COSMOTE SuperMarket Deals" |
63 | 64 | ||
64 | discriptionLabel.text = | 65 | discriptionLabel.text = |
65 | - activeCouponsCount == 1 ? "έχεις " + String(activeCouponsCount) + " ενεργό κουπόνι" | 66 | + "έχεις " + String(activeCouponsCount) + |
66 | - : "έχεις " + String(activeCouponsCount) + " ενεργά κουπόνια" | 67 | + ( |
68 | + activeCouponsCount == 1 ? " ενεργό κουπόνι" : " ενεργά κουπόνια" | ||
69 | + ) | ||
70 | + + " αξίας " + String(activeCouponsDiscount) + "€" | ||
67 | 71 | ||
68 | if let earliestExpiration = activeCoupons.min(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) { | 72 | if let earliestExpiration = activeCoupons.min(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) { |
69 | expirationLabel.text = "Ισχύει έως " + (earliestExpiration.expiration ?? "") | 73 | expirationLabel.text = "Ισχύει έως " + (earliestExpiration.expiration ?? "") | ... | ... |
-
Please register or login to post a comment