Manos Chorianopoulos

redesign UnifiedCouponBarcodeViewController

...@@ -100,14 +100,19 @@ import UIKit ...@@ -100,14 +100,19 @@ import UIKit
100 // COUPON: coupon, expiration, discount, status 100 // COUPON: coupon, expiration, discount, status
101 // MERCHANT: _img_preview,_admin_name 101 // MERCHANT: _img_preview,_admin_name
102 102
103 - if (coupon.status == 1) { 103 + expirationLabel.isHidden = true
104 + expirationRedView.isHidden = true
105 + expirationLabel.text = ""
106 + expirationRedLabel.text = ""
107 +
108 + if (coupon.status == 1) { // Active status 1
104 // Add shadow 109 // Add shadow
105 - self.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor 110 +// self.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor
106 - self.layer.shadowOffset = CGSize(width: 0.0, height: 0.0) 111 +// self.layer.shadowOffset = CGSize(width: 0.0, height: 0.0)
107 - self.layer.shadowOpacity = 1.0 112 +// self.layer.shadowOpacity = 1.0
108 - self.layer.shadowRadius = 6.0 113 +// self.layer.shadowRadius = 6.0
109 114
110 - couponBgImage.image = UIImage(named: "coupon_bg", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) 115 +// couponBgImage.image = UIImage(named: "coupon_bg", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
111 116
112 expirationLabel.isHidden = false 117 expirationLabel.isHidden = false
113 expirationRedView.isHidden = true 118 expirationRedView.isHidden = true
...@@ -132,15 +137,15 @@ import UIKit ...@@ -132,15 +137,15 @@ import UIKit
132 expirationLabel.isHidden = true 137 expirationLabel.isHidden = true
133 expirationRedView.isHidden = false 138 expirationRedView.isHidden = false
134 expirationRedView.layer.cornerRadius = 10.0 139 expirationRedView.layer.cornerRadius = 10.0
135 - expirationRedView.backgroundColor = UIColor(red: 0.94, green: 0.90, blue: 0.90, alpha: 1.00) 140 + expirationRedView.backgroundColor = UIColor(red: 0.72, green: 0.88, blue: 0.94, alpha: 1.00)
136 141
137 - expirationRedImage.image = UIImage(named: "ic_time_forward", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) 142 + expirationRedImage.image = UIImage(named: "ic_time_forward_blue", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
138 143
139 let normalText1 = "Ισχύει έως " 144 let normalText1 = "Ισχύει έως "
140 let redText = (coupon.expiration ?? "") 145 let redText = (coupon.expiration ?? "")
141 146
142 - let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PFSquareSansPro-Medium", size: 12) ?? UIFont.systemFont(ofSize: 11), NSAttributedString.Key.foregroundColor: UIColor(red: 0.38, green: 0.44, blue: 0.51, alpha: 1.00)] 147 + let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-SBold", size: 12) ?? UIFont.systemFont(ofSize: 11), NSAttributedString.Key.foregroundColor: UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00)]
143 - let attrRed = [NSAttributedString.Key.font : UIFont(name: "PFSquareSansPro-Medium", size: 12) ?? UIFont.systemFont(ofSize: 11), NSAttributedString.Key.foregroundColor: UIColor(red: 1.00, green: 0.42, blue: 0.42, alpha: 1.00)] 148 + let attrRed = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-SBold", size: 12) ?? UIFont.systemFont(ofSize: 11), NSAttributedString.Key.foregroundColor: UIColor(red: 0.00, green: 0.29, blue: 0.53, alpha: 1.00)]
144 149
145 let attributedString = NSMutableAttributedString(string:normalText1, attributes:attrRegular) 150 let attributedString = NSMutableAttributedString(string:normalText1, attributes:attrRegular)
146 let RedString = NSMutableAttributedString(string: redText, attributes:attrRed) 151 let RedString = NSMutableAttributedString(string: redText, attributes:attrRed)
...@@ -156,18 +161,30 @@ import UIKit ...@@ -156,18 +161,30 @@ import UIKit
156 } 161 }
157 } 162 }
158 163
159 - } else if (coupon.status == 0) { 164 + } else if (coupon.status == 0) { // Redeemed status 0
160 - couponBgImage.image = UIImage(named: "coupon_bg_grey", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) 165 +// couponBgImage.image = UIImage(named: "coupon_bg_grey", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
166 +
167 + expirationLabel.isHidden = false
168 + expirationRedView.isHidden = true
169 + expirationLabel.text = "Το κουπόνι έληξε"
170 +
171 + couponImage.layer.opacity = 0.29
172 + borderView.layer.opacity = 0.29
173 + nameLabel.layer.opacity = 0.29
174 + dicountLabel.layer.opacity = 0.29
175 + discriptionLabel.layer.opacity = 0.29
176 +
177 + } else { // Expired status -1
161 178
162 expirationLabel.isHidden = false 179 expirationLabel.isHidden = false
163 expirationRedView.isHidden = true 180 expirationRedView.isHidden = true
164 expirationLabel.text = "Το κουπόνι έληξε" 181 expirationLabel.text = "Το κουπόνι έληξε"
165 182
166 - couponImage.layer.opacity = 0.23 183 + couponImage.layer.opacity = 0.29
167 - borderView.layer.opacity = 0.15 184 + borderView.layer.opacity = 0.29
168 - nameLabel.layer.opacity = 0.15 185 + nameLabel.layer.opacity = 0.29
169 - dicountLabel.layer.opacity = 0.15 186 + dicountLabel.layer.opacity = 0.29
170 - discriptionLabel.layer.opacity = 0.15 187 + discriptionLabel.layer.opacity = 0.29
171 188
172 } 189 }
173 190
......
...@@ -24,13 +24,13 @@ import AVFoundation ...@@ -24,13 +24,13 @@ import AVFoundation
24 24
25 termsTextView.delegate = self 25 termsTextView.delegate = self
26 26
27 - mapButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 18) 27 + mapButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 17)
28 mapButton.setTitle("Δες τα supermarket", for: .normal) 28 mapButton.setTitle("Δες τα supermarket", for: .normal)
29 mapButton.setTitleColor(UIColor(red: 1.00, green: 1.00, blue: 1.00, alpha: 1.00), for: .normal) 29 mapButton.setTitleColor(UIColor(red: 1.00, green: 1.00, blue: 1.00, alpha: 1.00), for: .normal)
30 - mapButton.backgroundColor = UIColor(red: 0.47, green: 0.75, blue: 0.08, alpha: 1.00) 30 + mapButton.backgroundColor = UIColor(red: 0.05, green: 0.65, blue: 0.00, alpha: 1.00)
31 - mapButton.layer.cornerRadius = 8.0 31 + mapButton.layer.cornerRadius = 15.0
32 - mapButton.frame = CGRect(x: 0.0, y: 0.0, width: mapButton.intrinsicContentSize.width, height: 44) 32 + mapButton.frame = CGRect(x: 0.0, y: 0.0, width: mapButton.intrinsicContentSize.width, height: 55)
33 - mapButton.contentEdgeInsets = UIEdgeInsets(top: 1, left: 16, bottom: 0, right: 16) 33 + mapButton.contentEdgeInsets = UIEdgeInsets(top: 1, left: 28, bottom: 0, right: 28)
34 34
35 // mapButton.isHidden = true 35 // mapButton.isHidden = true
36 // mapButtonHeight.constant = 0 36 // mapButtonHeight.constant = 0
...@@ -79,22 +79,22 @@ import AVFoundation ...@@ -79,22 +79,22 @@ import AVFoundation
79 // mapButton.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.6).isActive = true 79 // mapButton.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.6).isActive = true
80 // } 80 // }
81 81
82 - termsButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Regular", size: 16) 82 + termsButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15)
83 // termsButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5) 83 // termsButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5)
84 termsButton.setTitle("Όροι χρήσης", for: .normal) 84 termsButton.setTitle("Όροι χρήσης", for: .normal)
85 - termsButton.setTitleColor(UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00), for: .normal) 85 + termsButton.setTitleColor(UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00), for: .normal)
86 termsButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) 86 termsButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal)
87 termsButton.semanticContentAttribute = .forceRightToLeft 87 termsButton.semanticContentAttribute = .forceRightToLeft
88 - termsButton.tintColor = UIColor(red: 0.21, green: 0.32, blue: 0.41, alpha: 1.00) 88 + termsButton.tintColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 1.00)
89 termsButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0); 89 termsButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0);
90 termsButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5); 90 termsButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5);
91 termsButton.imageView?.layer.transform = CATransform3DMakeScale(0.8, 0.8, 0.8) 91 termsButton.imageView?.layer.transform = CATransform3DMakeScale(0.8, 0.8, 0.8)
92 92
93 let termsText = "1. Το εκπτωτικό κουπόνι ισχύει έως την ημερομηνία που αναφέρεται παραπάνω\n2. To εκπτωτικό κουπόνι αφορά στα ενεργά κουπόνια προσφορών όπως αναφέρονται παραπάνω.\n3. Το εκπτωτικό κουπόνι μπορεί να χρησιμοποιηθεί σε μια μόνο συναλλαγή.\n4. Εάν δεν γίνει χρήση ενός επιμέρους κουπονιού προσφοράς από το εκπτωτικό κουπόνι, το κουπόνι προσφοράς επιστρέφει στο καλάθι στην ενότητα COSMOTE SuperMarket Deals" 93 let termsText = "1. Το εκπτωτικό κουπόνι ισχύει έως την ημερομηνία που αναφέρεται παραπάνω\n2. To εκπτωτικό κουπόνι αφορά στα ενεργά κουπόνια προσφορών όπως αναφέρονται παραπάνω.\n3. Το εκπτωτικό κουπόνι μπορεί να χρησιμοποιηθεί σε μια μόνο συναλλαγή.\n4. Εάν δεν γίνει χρήση ενός επιμέρους κουπονιού προσφοράς από το εκπτωτικό κουπόνι, το κουπόνι προσφοράς επιστρέφει στο καλάθι στην ενότητα COSMOTE SuperMarket Deals"
94 termsTextView.attributedText = NSAttributedString(string: termsText) 94 termsTextView.attributedText = NSAttributedString(string: termsText)
95 - termsTextView.font = UIFont(name: "PFSquareSansPro-Regular", size: 15) 95 + termsTextView.font = UIFont(name: "PeridotPE-Regular", size: 16)
96 - termsTextView.textColor = UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00) 96 + termsTextView.textColor = UIColor(red: 0.62, green: 0.62, blue: 0.61, alpha: 1.00)
97 - termsTextView.textAlignment = .center 97 + termsTextView.textAlignment = .left
98 termsTextView.isScrollEnabled = false 98 termsTextView.isScrollEnabled = false
99 99
100 termsTextView.isUserInteractionEnabled = true 100 termsTextView.isUserInteractionEnabled = true
......
...@@ -90,23 +90,23 @@ import AVFoundation ...@@ -90,23 +90,23 @@ import AVFoundation
90 // } 90 // }
91 91
92 92
93 - showBarcodeButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 16) 93 + showBarcodeButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15)
94 showBarcodeButton.setTitle("Εμφάνιση barcode", for: .normal) 94 showBarcodeButton.setTitle("Εμφάνιση barcode", for: .normal)
95 - showBarcodeButton.setTitleColor(UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00), for: .normal) 95 + showBarcodeButton.setTitleColor(UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00), for: .normal)
96 showBarcodeButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) 96 showBarcodeButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal)
97 showBarcodeButton.semanticContentAttribute = .forceRightToLeft 97 showBarcodeButton.semanticContentAttribute = .forceRightToLeft
98 - showBarcodeButton.tintColor = UIColor(red: 0.21, green: 0.32, blue: 0.41, alpha: 1.00) 98 + showBarcodeButton.tintColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 1.00)
99 showBarcodeButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0); 99 showBarcodeButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0);
100 showBarcodeButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5); 100 showBarcodeButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5);
101 showBarcodeButton.imageView?.layer.transform = CATransform3DMakeScale(0.8, 0.8, 0.8) 101 showBarcodeButton.imageView?.layer.transform = CATransform3DMakeScale(0.8, 0.8, 0.8)
102 102
103 - showCouponsButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Regular", size: 16) 103 + showCouponsButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15)
104 // termsButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5) 104 // termsButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5)
105 showCouponsButton.setTitle("Εμφάνιση κουπονιών", for: .normal) 105 showCouponsButton.setTitle("Εμφάνιση κουπονιών", for: .normal)
106 - showCouponsButton.setTitleColor(UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00), for: .normal) 106 + showCouponsButton.setTitleColor(UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00), for: .normal)
107 showCouponsButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) 107 showCouponsButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal)
108 showCouponsButton.semanticContentAttribute = .forceRightToLeft 108 showCouponsButton.semanticContentAttribute = .forceRightToLeft
109 - showCouponsButton.tintColor = UIColor(red: 0.21, green: 0.32, blue: 0.41, alpha: 1.00) 109 + showCouponsButton.tintColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 1.00)
110 showCouponsButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0); 110 showCouponsButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0);
111 showCouponsButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5); 111 showCouponsButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5);
112 showCouponsButton.imageView?.layer.transform = CATransform3DMakeScale(0.8, 0.8, 0.8) 112 showCouponsButton.imageView?.layer.transform = CATransform3DMakeScale(0.8, 0.8, 0.8)
...@@ -121,7 +121,7 @@ import AVFoundation ...@@ -121,7 +121,7 @@ import AVFoundation
121 121
122 func configureCell(coupon: swiftApi.UnifiedCouponModel?, couponsVisible: Bool) { 122 func configureCell(coupon: swiftApi.UnifiedCouponModel?, couponsVisible: Bool) {
123 123
124 - couponView.layer.cornerRadius = 8 124 + couponView.layer.cornerRadius = 16
125 // couponNumberLabel.text = ((coupon?._code != 0) ? String(coupon?._code ?? 0) : "") 125 // couponNumberLabel.text = ((coupon?._code != 0) ? String(coupon?._code ?? 0) : "")
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)
...@@ -145,6 +145,14 @@ import AVFoundation ...@@ -145,6 +145,14 @@ import AVFoundation
145 showBarcodeButton.isHidden = true 145 showBarcodeButton.isHidden = true
146 showBarcodeButtonHeight.constant = 0 146 showBarcodeButtonHeight.constant = 0
147 showBarcodeButtonTopSpace.constant = 0 147 showBarcodeButtonTopSpace.constant = 0
148 +
149 + borderViewHeight.constant = CGFloat(0)
150 + borderView2Height.constant = CGFloat(0)
151 +
152 + border1TopSpace.constant = CGFloat(0) // 20
153 + barcodeImageTopSpace.constant = CGFloat(0) // 10
154 + barcodeLabelTopSpace.constant = CGFloat(0) // 10
155 + border2TopSpace.constant = CGFloat(0) // 15
148 } 156 }
149 // === 157 // ===
150 158
......
...@@ -108,22 +108,22 @@ extension UITableView { ...@@ -108,22 +108,22 @@ extension UITableView {
108 // scrollView.layer.cornerRadius = 30 108 // scrollView.layer.cornerRadius = 30
109 // scrollView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius 109 // scrollView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius
110 110
111 - let image = UIImage(named: "top_border_line", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)! 111 +// let image = UIImage(named: "top_border_line", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)!
112 - var aspectR: CGFloat = 0.0 112 +// var aspectR: CGFloat = 0.0
113 - 113 +//
114 - aspectR = image.size.width/image.size.height 114 +// aspectR = image.size.width/image.size.height
115 - 115 +//
116 - topBorderLine.translatesAutoresizingMaskIntoConstraints = false 116 +// topBorderLine.translatesAutoresizingMaskIntoConstraints = false
117 - topBorderLine.image = image 117 +// topBorderLine.image = image
118 - topBorderLine.contentMode = .scaleAspectFill 118 +// topBorderLine.contentMode = .scaleAspectFill
119 - 119 +//
120 - NSLayoutConstraint.activate([ 120 +// NSLayoutConstraint.activate([
121 - topBorderLine.topAnchor.constraint(equalTo: mainView.topAnchor, constant: 0), 121 +// topBorderLine.topAnchor.constraint(equalTo: mainView.topAnchor, constant: 0),
122 - topBorderLine.leadingAnchor.constraint(equalTo: mainView.leadingAnchor, constant: 0), 122 +// topBorderLine.leadingAnchor.constraint(equalTo: mainView.leadingAnchor, constant: 0),
123 - topBorderLine.trailingAnchor.constraint(equalTo: mainView.trailingAnchor, constant: 0), 123 +// topBorderLine.trailingAnchor.constraint(equalTo: mainView.trailingAnchor, constant: 0),
124 - topBorderLine.widthAnchor.constraint(equalToConstant: UIScreen.main.bounds.width), 124 +// topBorderLine.widthAnchor.constraint(equalToConstant: UIScreen.main.bounds.width),
125 - topBorderLine.heightAnchor.constraint(equalTo: topBorderLine.widthAnchor, multiplier: 1/aspectR) 125 +// topBorderLine.heightAnchor.constraint(equalTo: topBorderLine.widthAnchor, multiplier: 1/aspectR)
126 - ]) 126 +// ])
127 127
128 // COUPONSET: desc, img_preview, name, terms 128 // COUPONSET: desc, img_preview, name, terms
129 // COUPON: coupon, expiration, discount, status 129 // COUPON: coupon, expiration, discount, status
...@@ -151,8 +151,8 @@ extension UITableView { ...@@ -151,8 +151,8 @@ extension UITableView {
151 // 151 //
152 // if (htmlMerchDescrText != "") { 152 // if (htmlMerchDescrText != "") {
153 // merchantDescrTextView.attributedText = htmlMerchDescrText.htmlToAttributedString 153 // merchantDescrTextView.attributedText = htmlMerchDescrText.htmlToAttributedString
154 -// merchantDescrTextView.font = UIFont(name: "PFSquareSansPro-Regular", size: 17) 154 +// merchantDescrTextView.font = UIFont(name: "PeridotPE-Regular", size: 16)
155 -// merchantDescrTextView.textColor = UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00) 155 +// merchantDescrTextView.textColor = UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00)
156 // merchantDescrTextView.textAlignment = .center 156 // merchantDescrTextView.textAlignment = .center
157 // merchantDescrTextView.isScrollEnabled = false 157 // merchantDescrTextView.isScrollEnabled = false
158 // merchantDescrTextView.isUserInteractionEnabled = true 158 // merchantDescrTextView.isUserInteractionEnabled = true
...@@ -170,7 +170,7 @@ extension UITableView { ...@@ -170,7 +170,7 @@ extension UITableView {
170 // } 170 // }
171 // } 171 // }
172 172
173 - couponView.layer.cornerRadius = 8 173 + couponView.layer.cornerRadius = 16
174 couponNumberLabel.text = ((coupon?._code != 0) ? String(coupon?._code ?? 0) : "") 174 couponNumberLabel.text = ((coupon?._code != 0) ? String(coupon?._code ?? 0) : "")
175 couponView.frame = CGRect(x: 0.0, y: 0.0, width: couponView.intrinsicContentSize.width, height: 55) 175 couponView.frame = CGRect(x: 0.0, y: 0.0, width: couponView.intrinsicContentSize.width, height: 55)
176 176
...@@ -214,7 +214,7 @@ extension UITableView { ...@@ -214,7 +214,7 @@ extension UITableView {
214 showBarcodeButtonTopSpace.constant = 0 214 showBarcodeButtonTopSpace.constant = 0
215 // === 215 // ===
216 216
217 - showBarcodeButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 16) 217 + showBarcodeButton.titleLabel?.font = UIFont(name: "PeridotPE-SBold", size: 16)
218 showBarcodeButton.setTitle("Εμφάνιση barcode", for: .normal) 218 showBarcodeButton.setTitle("Εμφάνιση barcode", for: .normal)
219 showBarcodeButton.setTitleColor(UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00), for: .normal) 219 showBarcodeButton.setTitleColor(UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00), for: .normal)
220 showBarcodeButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) 220 showBarcodeButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal)
...@@ -285,13 +285,13 @@ extension UITableView { ...@@ -285,13 +285,13 @@ extension UITableView {
285 // mapButton.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.6).isActive = true 285 // mapButton.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.6).isActive = true
286 // } 286 // }
287 287
288 - showCouponsButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Regular", size: 16) 288 + showCouponsButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15)
289 // termsButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5) 289 // termsButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5)
290 showCouponsButton.setTitle("Εμφάνιση κουπονιών", for: .normal) 290 showCouponsButton.setTitle("Εμφάνιση κουπονιών", for: .normal)
291 - showCouponsButton.setTitleColor(UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00), for: .normal) 291 + showCouponsButton.setTitleColor(UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00), for: .normal)
292 showCouponsButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) 292 showCouponsButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal)
293 showCouponsButton.semanticContentAttribute = .forceRightToLeft 293 showCouponsButton.semanticContentAttribute = .forceRightToLeft
294 - showCouponsButton.tintColor = UIColor(red: 0.21, green: 0.32, blue: 0.41, alpha: 1.00) 294 + showCouponsButton.tintColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 1.00)
295 showCouponsButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0); 295 showCouponsButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0);
296 showCouponsButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5); 296 showCouponsButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5);
297 showCouponsButton.imageView?.layer.transform = CATransform3DMakeScale(0.8, 0.8, 0.8) 297 showCouponsButton.imageView?.layer.transform = CATransform3DMakeScale(0.8, 0.8, 0.8)
...@@ -558,7 +558,7 @@ extension UnifiedCouponBarcodeViewController: UITableViewDelegate, UITableViewDa ...@@ -558,7 +558,7 @@ extension UnifiedCouponBarcodeViewController: UITableViewDelegate, UITableViewDa
558 return UITableView.automaticDimension 558 return UITableView.automaticDimension
559 } else if (indexPath.section == 1) { 559 } else if (indexPath.section == 1) {
560 if (couponsVisible == true) { 560 if (couponsVisible == true) {
561 - return 120.0 + 8.0 561 + return 130.0 + 8.0
562 } else { 562 } else {
563 return 0.0 563 return 0.0
564 } 564 }
...@@ -613,4 +613,74 @@ extension UnifiedCouponBarcodeViewController: UITableViewDelegate, UITableViewDa ...@@ -613,4 +613,74 @@ extension UnifiedCouponBarcodeViewController: UITableViewDelegate, UITableViewDa
613 // self.navigationController?.pushViewController(vc, animated: true) 613 // self.navigationController?.pushViewController(vc, animated: true)
614 } 614 }
615 615
616 + public func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
617 + if (section == 0){
618 + return nil
619 +
620 + } else if (section == 1) {
621 + if (couponsVisible == true) {
622 + let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 8))
623 + view.backgroundColor = UIColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1.00)
624 +
625 + return view
626 + } else {
627 + return nil
628 + }
629 +
630 + } else {
631 + return nil
632 + }
633 + }
634 +
635 + public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
636 + if (section == 0) {
637 + return 0.0
638 +
639 + } else if (section == 1) {
640 + if (couponsVisible == true) {
641 + return 8.0
642 + } else {
643 + return 0.0
644 + }
645 +
646 + } else {
647 + return 0.0
648 + }
649 + }
650 +
651 + public func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
652 + if (section == 0) {
653 + return 0.0
654 +
655 + } else if (section == 1) {
656 + if (couponsVisible == true) {
657 + return 8.0
658 + } else {
659 + return 0.0
660 + }
661 +
662 + } else {
663 + return 0.0
664 + }
665 + }
666 +
667 + public func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
668 + if (section == 0){
669 + return nil
670 +
671 + } else if (section == 1) {
672 + if (couponsVisible == true) {
673 + let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 8))
674 + view.backgroundColor = UIColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1.00)
675 +
676 + return view
677 + } else {
678 + return nil
679 + }
680 +
681 + } else {
682 + return nil
683 + }
684 + }
685 +
616 } 686 }
......
...@@ -43,12 +43,15 @@ import UIKit ...@@ -43,12 +43,15 @@ import UIKit
43 43
44 44
45 func configureCell(coupon: swiftApi.UnifiedCouponModel) { 45 func configureCell(coupon: swiftApi.UnifiedCouponModel) {
46 - var activeCouponsCount:Int = 0 46 + let activeCoupons = coupon._coupons.filter { $0.status == 1 }
47 - for coupon in coupon._coupons { 47 + let activeCouponsCount = activeCoupons.count
48 - if (coupon.status == 1) { 48 +
49 - activeCouponsCount += 1 49 +// var activeCouponsCount:Int = 0
50 - } 50 +// for coupon in coupon._coupons {
51 - } 51 +// if (coupon.status == 1) {
52 +// activeCouponsCount += 1
53 +// }
54 +// }
52 55
53 nameLabel.text = "COSMOTE SuperMarket Deals" 56 nameLabel.text = "COSMOTE SuperMarket Deals"
54 57
...@@ -56,7 +59,7 @@ import UIKit ...@@ -56,7 +59,7 @@ import UIKit
56 activeCouponsCount == 1 ? "έχεις " + String(activeCouponsCount) + " ενεργό κουπόνι" 59 activeCouponsCount == 1 ? "έχεις " + String(activeCouponsCount) + " ενεργό κουπόνι"
57 : "έχεις " + String(activeCouponsCount) + " ενεργά κουπόνια" 60 : "έχεις " + String(activeCouponsCount) + " ενεργά κουπόνια"
58 61
59 - if let earliestExpiration = coupon._coupons.min(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) { 62 + if let earliestExpiration = activeCoupons.min(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) {
60 expirationLabel.text = "Ισχύει έως " + (earliestExpiration.expiration ?? "") 63 expirationLabel.text = "Ισχύει έως " + (earliestExpiration.expiration ?? "")
61 } else { 64 } else {
62 expirationLabel.text = "" 65 expirationLabel.text = ""
......
...@@ -6816,12 +6816,14 @@ public class swiftApi { ...@@ -6816,12 +6816,14 @@ public class swiftApi {
6816 } 6816 }
6817 6817
6818 // Example "created":"Mon, 03 Apr 2023 15:05:14 GMT" 6818 // Example "created":"Mon, 03 Apr 2023 15:05:14 GMT"
6819 +// Example created = “2023-04-10 14:44:57.515402”;
6819 let dateString = dictionary["created"] as? String? ?? "" 6820 let dateString = dictionary["created"] as? String? ?? ""
6820 let dateFormatter = DateFormatter() 6821 let dateFormatter = DateFormatter()
6821 - dateFormatter.locale = Locale(identifier: "en_US_POSSIX") 6822 +// dateFormatter.locale = Locale(identifier: "en_US_POSSIX")
6822 - dateFormatter.dateFormat = "E, dd MMM yyyy HH:mm:ss 'GMT'" 6823 +// dateFormatter.dateFormat = "E, dd MMM yyyy HH:mm:ss 'GMT'"
6824 + dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSSSS"
6823 if let date = dateFormatter.date(from: dateString ?? "") { 6825 if let date = dateFormatter.date(from: dateString ?? "") {
6824 - dateFormatter.dateFormat = "dd/MM/yyyy" 6826 +// dateFormatter.dateFormat = "dd/MM/yyyy"
6825 let resultString = dateFormatter.string(from: date) 6827 let resultString = dateFormatter.string(from: date)
6826 self.created = resultString 6828 self.created = resultString
6827 } else { 6829 } else {
...@@ -6911,7 +6913,8 @@ public class swiftApi { ...@@ -6911,7 +6913,8 @@ public class swiftApi {
6911 6913
6912 // Sort by date 6914 // Sort by date
6913 let dateFormatter = DateFormatter() 6915 let dateFormatter = DateFormatter()
6914 - dateFormatter.dateFormat = "dd/MM/yyyy" 6916 +// dateFormatter.dateFormat = "dd/MM/yyyy"
6917 + dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSSSS"
6915 let sortedUnifiedCouponsArray = unifiedCouponsArray.sorted(by: { dateFormatter.date(from:$0._created)?.compare(dateFormatter.date(from:$1._created)!) == .orderedDescending }) 6918 let sortedUnifiedCouponsArray = unifiedCouponsArray.sorted(by: { dateFormatter.date(from:$0._created)?.compare(dateFormatter.date(from:$1._created)!) == .orderedDescending })
6916 6919
6917 swiftApi().setUnifiedCouponList(sortedUnifiedCouponsArray) 6920 swiftApi().setUnifiedCouponList(sortedUnifiedCouponsArray)
......