Manos Chorianopoulos

MyCoupons part2

...@@ -115,46 +115,90 @@ extension UIViewController { ...@@ -115,46 +115,90 @@ extension UIViewController {
115 // self.navigationController?.navigationBar.layoutIfNeeded() 115 // self.navigationController?.navigationBar.layoutIfNeeded()
116 // } 116 // }
117 117
118 - func setBackButton(_ icon:String = "ic_back_4") { 118 + func setBackButton(_ icon: String = "ic_back_4") {
119 self.navigationItem.setHidesBackButton(true, animated: false) 119 self.navigationItem.setHidesBackButton(true, animated: false)
120 120
121 let button = UIButton(type: .custom) 121 let button = UIButton(type: .custom)
122 - button.frame = CGRect(x: 0, y: 0, width: 24, height: 24) 122 + button.frame = CGRect(x: 0, y: 0, width: 15, height: 15)
123 button.imageView?.contentMode = .scaleAspectFit 123 button.imageView?.contentMode = .scaleAspectFit
124 - 124 +
125 if let img = UIImage(named: icon, in: Bundle.frameworkResourceBundle, compatibleWith: nil) { 125 if let img = UIImage(named: icon, in: Bundle.frameworkResourceBundle, compatibleWith: nil) {
126 - button.setImage(img, for: .normal) 126 + button.setImage(img.withRenderingMode(.alwaysOriginal), for: .normal)
127 } 127 }
128 +
128 button.addTarget(self, action: #selector(moveToBack(_:)), for: .touchUpInside) 129 button.addTarget(self, action: #selector(moveToBack(_:)), for: .touchUpInside)
129 130
130 - let leftBarButtonItem = UIBarButtonItem(customView: view ) 131 + let leftBarButtonItem = UIBarButtonItem(customView: button)
132 + NSLayoutConstraint.activate([
133 + leftBarButtonItem.customView!.widthAnchor.constraint(equalToConstant: 15),
134 + leftBarButtonItem.customView!.heightAnchor.constraint(equalToConstant: 15)
135 + ])
131 self.navigationItem.leftBarButtonItem = leftBarButtonItem 136 self.navigationItem.leftBarButtonItem = leftBarButtonItem
132 137
133 self.navigationItem.title = "" 138 self.navigationItem.title = ""
134 139
135 - // Add backgroundColor 140 + // Nav bar appearance — white background
136 if #available(iOS 15, *) { 141 if #available(iOS 15, *) {
137 let navigationBarAppearance = UINavigationBarAppearance() 142 let navigationBarAppearance = UINavigationBarAppearance()
138 navigationBarAppearance.configureWithDefaultBackground() 143 navigationBarAppearance.configureWithDefaultBackground()
144 + // navigationBarAppearance.configureWithTransparentBackground()
139 navigationBarAppearance.backgroundColor = .white 145 navigationBarAppearance.backgroundColor = .white
146 + navigationBarAppearance.shadowColor = .clear
140 147
141 navigationItem.standardAppearance = navigationBarAppearance 148 navigationItem.standardAppearance = navigationBarAppearance
142 navigationItem.compactAppearance = navigationBarAppearance 149 navigationItem.compactAppearance = navigationBarAppearance
143 navigationItem.scrollEdgeAppearance = navigationBarAppearance 150 navigationItem.scrollEdgeAppearance = navigationBarAppearance
144 } else { 151 } else {
145 - navigationController?.navigationBar.barTintColor = UIColor.white 152 + navigationController?.navigationBar.barTintColor = .white
146 - navigationController?.navigationBar.tintColor = UIColor.white 153 + navigationController?.navigationBar.tintColor = .white
147 - // navigationController?.navigationBar.isTranslucent = false
148 } 154 }
149 155
150 - // Remove navigationBar bottom border
151 - // self.navigationController?.navigationBar.hideBottomHairline()
152 self.navigationController?.hideHairline() 156 self.navigationController?.hideHairline()
153 - 157 + self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
154 - self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for:.default)
155 self.navigationController?.navigationBar.shadowImage = UIImage() 158 self.navigationController?.navigationBar.shadowImage = UIImage()
156 self.navigationController?.navigationBar.layoutIfNeeded() 159 self.navigationController?.navigationBar.layoutIfNeeded()
157 } 160 }
161 +
162 + // func setBackButton(_ icon:String = "ic_back_4") {
163 + // self.navigationItem.setHidesBackButton(true, animated: false)
164 +
165 + // let button = UIButton(type: .custom)
166 + // button.frame = CGRect(x: 0, y: 0, width: 24, height: 24)
167 + // button.imageView?.contentMode = .scaleAspectFit
168 +
169 + // if let img = UIImage(named: icon, in: Bundle.frameworkResourceBundle, compatibleWith: nil) {
170 + // button.setImage(img, for: .normal)
171 + // }
172 + // button.addTarget(self, action: #selector(moveToBack(_:)), for: .touchUpInside)
173 +
174 + // let leftBarButtonItem = UIBarButtonItem(customView: view )
175 + // self.navigationItem.leftBarButtonItem = leftBarButtonItem
176 +
177 + // self.navigationItem.title = ""
178 +
179 + // // Add backgroundColor
180 + // if #available(iOS 15, *) {
181 + // let navigationBarAppearance = UINavigationBarAppearance()
182 + // navigationBarAppearance.configureWithDefaultBackground()
183 + // navigationBarAppearance.backgroundColor = .white
184 +
185 + // navigationItem.standardAppearance = navigationBarAppearance
186 + // navigationItem.compactAppearance = navigationBarAppearance
187 + // navigationItem.scrollEdgeAppearance = navigationBarAppearance
188 + // } else {
189 + // navigationController?.navigationBar.barTintColor = UIColor.white
190 + // navigationController?.navigationBar.tintColor = UIColor.white
191 + // // navigationController?.navigationBar.isTranslucent = false
192 + // }
193 +
194 + // // Remove navigationBar bottom border
195 + // // self.navigationController?.navigationBar.hideBottomHairline()
196 + // self.navigationController?.hideHairline()
197 +
198 + // self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for:.default)
199 + // self.navigationController?.navigationBar.shadowImage = UIImage()
200 + // self.navigationController?.navigationBar.layoutIfNeeded()
201 + // }
158 202
159 203
160 @objc func moveToBack(_ sender:UIButton){ 204 @objc func moveToBack(_ sender:UIButton){
......
...@@ -13,7 +13,7 @@ protocol ProfileCouponFiltersTableViewCellDelegate: AnyObject { ...@@ -13,7 +13,7 @@ protocol ProfileCouponFiltersTableViewCellDelegate: AnyObject {
13 13
14 @objc(ProfileCouponFiltersTableViewCell) 14 @objc(ProfileCouponFiltersTableViewCell)
15 public class ProfileCouponFiltersTableViewCell: UITableViewCell { 15 public class ProfileCouponFiltersTableViewCell: UITableViewCell {
16 - @IBOutlet weak var titleLabel: UILabel! 16 + // @IBOutlet weak var titleLabel: UILabel!
17 @IBOutlet weak var collectionView: UICollectionView! 17 @IBOutlet weak var collectionView: UICollectionView!
18 18
19 weak var delegate: ProfileCouponFiltersTableViewCellDelegate? 19 weak var delegate: ProfileCouponFiltersTableViewCellDelegate?
...@@ -24,9 +24,9 @@ public class ProfileCouponFiltersTableViewCell: UITableViewCell { ...@@ -24,9 +24,9 @@ public class ProfileCouponFiltersTableViewCell: UITableViewCell {
24 public override func awakeFromNib() { 24 public override func awakeFromNib() {
25 super.awakeFromNib() 25 super.awakeFromNib()
26 26
27 - titleLabel.font = UIFont(name: "PingLCG-Bold", size: 18) 27 + // titleLabel.font = UIFont(name: "PingLCG-Bold", size: 18)
28 - titleLabel.textColor = UIColor(rgb: 0x000F1E) 28 + // titleLabel.textColor = UIColor(rgb: 0x000F1E)
29 - titleLabel.text = "Τα κουπόνια μου" 29 + // titleLabel.text = "Τα κουπόνια μου"
30 30
31 // UPDATED: Safe XIB registration for collection view cells 31 // UPDATED: Safe XIB registration for collection view cells
32 registerCollectionViewCells() 32 registerCollectionViewCells()
...@@ -62,9 +62,9 @@ public class ProfileCouponFiltersTableViewCell: UITableViewCell { ...@@ -62,9 +62,9 @@ public class ProfileCouponFiltersTableViewCell: UITableViewCell {
62 // Configure collection view layout 62 // Configure collection view layout
63 if let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout { 63 if let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout {
64 layout.scrollDirection = .horizontal 64 layout.scrollDirection = .horizontal
65 - layout.minimumLineSpacing = 15 65 + layout.minimumLineSpacing = 4
66 layout.minimumInteritemSpacing = 0 66 layout.minimumInteritemSpacing = 0
67 - layout.sectionInset = UIEdgeInsets(top: 8, left: 24, bottom: 8, right: 24) 67 + layout.sectionInset = UIEdgeInsets(top: 8, left: 18, bottom: 8, right: 18)
68 layout.estimatedItemSize = CGSize(width: 100, height: 43) 68 layout.estimatedItemSize = CGSize(width: 100, height: 43)
69 } 69 }
70 70
...@@ -101,7 +101,7 @@ extension ProfileCouponFiltersTableViewCell: UICollectionViewDataSource, UIColle ...@@ -101,7 +101,7 @@ extension ProfileCouponFiltersTableViewCell: UICollectionViewDataSource, UIColle
101 if let filter = self.data?[indexPath.row] { 101 if let filter = self.data?[indexPath.row] {
102 // let isSelected = self.data?[indexPath.row].title == "Ενεργά" 102 // let isSelected = self.data?[indexPath.row].title == "Ενεργά"
103 // let isSelected = self.data?[indexPath.row].title == self.couponFilterSelected.title 103 // let isSelected = self.data?[indexPath.row].title == self.couponFilterSelected.title
104 - let isSelected = self.data?[indexPath.row].title == self.couponFilterSelected?.title ?? "Ενεργά" 104 + let isSelected = self.data?[indexPath.row].title == self.couponFilterSelected?.title ?? "Valid"
105 cell.configureCell(data: filter, isSelected: isSelected) 105 cell.configureCell(data: filter, isSelected: isSelected)
106 } 106 }
107 return cell; 107 return cell;
...@@ -121,7 +121,7 @@ extension ProfileCouponFiltersTableViewCell: UICollectionViewDataSource, UIColle ...@@ -121,7 +121,7 @@ extension ProfileCouponFiltersTableViewCell: UICollectionViewDataSource, UIColle
121 121
122 // Calculate width based on text content 122 // Calculate width based on text content
123 let text = filter.title 123 let text = filter.title
124 - let font = UIFont(name: "PingLCG-Regular", size: 16) ?? UIFont.systemFont(ofSize: 16) 124 + let font = UIFont(name: "PingLCG-Regular", size: 14) ?? UIFont.systemFont(ofSize: 14)
125 let textSize = text.size(withAttributes: [.font: font]) 125 let textSize = text.size(withAttributes: [.font: font])
126 126
127 // Add padding for button design (16pt left + 16pt right = 32pt total) 127 // Add padding for button design (16pt left + 16pt right = 32pt total)
...@@ -133,7 +133,7 @@ extension ProfileCouponFiltersTableViewCell: UICollectionViewDataSource, UIColle ...@@ -133,7 +133,7 @@ extension ProfileCouponFiltersTableViewCell: UICollectionViewDataSource, UIColle
133 133
134 // Distance Between Item Cells 134 // Distance Between Item Cells
135 public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { 135 public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
136 - return 15 136 + return 4
137 } 137 }
138 138
139 public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { 139 public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
...@@ -142,6 +142,6 @@ extension ProfileCouponFiltersTableViewCell: UICollectionViewDataSource, UIColle ...@@ -142,6 +142,6 @@ extension ProfileCouponFiltersTableViewCell: UICollectionViewDataSource, UIColle
142 142
143 // Cell Margin 143 // Cell Margin
144 public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { 144 public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
145 - return UIEdgeInsets(top: 0, left: 24, bottom: 0, right: 24) 145 + return UIEdgeInsets(top: 0, left: 18, bottom: 0, right: 18)
146 } 146 }
147 } 147 }
......
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> 2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="24506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3 <device id="retina6_12" orientation="portrait" appearance="light"/> 3 <device id="retina6_12" orientation="portrait" appearance="light"/>
4 <dependencies> 4 <dependencies>
5 - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/> 5 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24504"/>
6 <capability name="Safe area layout guides" minToolsVersion="9.0"/> 6 <capability name="Safe area layout guides" minToolsVersion="9.0"/>
7 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> 7 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
8 </dependencies> 8 </dependencies>
...@@ -12,21 +12,15 @@ ...@@ -12,21 +12,15 @@
12 <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ProfileCouponFiltersTableViewCell" rowHeight="161" id="KGk-i7-Jjw" customClass="ProfileCouponFiltersTableViewCell"> 12 <tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="ProfileCouponFiltersTableViewCell" rowHeight="161" id="KGk-i7-Jjw" customClass="ProfileCouponFiltersTableViewCell">
13 <rect key="frame" x="0.0" y="0.0" width="320" height="161"/> 13 <rect key="frame" x="0.0" y="0.0" width="320" height="161"/>
14 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> 14 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
15 - <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM"> 15 + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" ambiguous="YES" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
16 <rect key="frame" x="0.0" y="0.0" width="320" height="161"/> 16 <rect key="frame" x="0.0" y="0.0" width="320" height="161"/>
17 <autoresizingMask key="autoresizingMask"/> 17 <autoresizingMask key="autoresizingMask"/>
18 <subviews> 18 <subviews>
19 - <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1kR-zd-duR" userLabel="ParentView"> 19 + <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1kR-zd-duR" userLabel="ParentView">
20 <rect key="frame" x="0.0" y="0.0" width="320" height="161"/> 20 <rect key="frame" x="0.0" y="0.0" width="320" height="161"/>
21 <subviews> 21 <subviews>
22 - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mga-ND-qoh">
23 - <rect key="frame" x="24" y="26" width="272" height="17"/>
24 - <fontDescription key="fontDescription" type="system" pointSize="17"/>
25 - <nil key="textColor"/>
26 - <nil key="highlightedColor"/>
27 - </label>
28 <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="Ddn-dN-xH1"> 22 <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="Ddn-dN-xH1">
29 - <rect key="frame" x="0.0" y="83" width="320" height="48"/> 23 + <rect key="frame" x="0.0" y="20" width="320" height="48"/>
30 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 24 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
31 <constraints> 25 <constraints>
32 <constraint firstAttribute="height" constant="48" id="5nG-1p-kic"/> 26 <constraint firstAttribute="height" constant="48" id="5nG-1p-kic"/>
...@@ -46,13 +40,10 @@ ...@@ -46,13 +40,10 @@
46 </subviews> 40 </subviews>
47 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 41 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
48 <constraints> 42 <constraints>
49 - <constraint firstItem="Ddn-dN-xH1" firstAttribute="top" secondItem="mga-ND-qoh" secondAttribute="bottom" constant="40" id="1gh-45-u6h"/>
50 <constraint firstItem="Ddn-dN-xH1" firstAttribute="leading" secondItem="1kR-zd-duR" secondAttribute="leading" id="3IU-v8-7cI"/> 43 <constraint firstItem="Ddn-dN-xH1" firstAttribute="leading" secondItem="1kR-zd-duR" secondAttribute="leading" id="3IU-v8-7cI"/>
51 - <constraint firstItem="mga-ND-qoh" firstAttribute="top" secondItem="1kR-zd-duR" secondAttribute="top" constant="26" id="J0I-v0-uwq"/> 44 + <constraint firstItem="Ddn-dN-xH1" firstAttribute="top" secondItem="1kR-zd-duR" secondAttribute="top" constant="20" id="Q1i-MS-acw"/>
52 - <constraint firstAttribute="trailing" secondItem="mga-ND-qoh" secondAttribute="trailing" constant="24" id="Ss1-zq-znd"/>
53 <constraint firstAttribute="bottom" secondItem="Ddn-dN-xH1" secondAttribute="bottom" constant="30" id="VdN-By-srg"/> 45 <constraint firstAttribute="bottom" secondItem="Ddn-dN-xH1" secondAttribute="bottom" constant="30" id="VdN-By-srg"/>
54 <constraint firstAttribute="trailing" secondItem="Ddn-dN-xH1" secondAttribute="trailing" id="W06-Yi-lzm"/> 46 <constraint firstAttribute="trailing" secondItem="Ddn-dN-xH1" secondAttribute="trailing" id="W06-Yi-lzm"/>
55 - <constraint firstItem="mga-ND-qoh" firstAttribute="leading" secondItem="1kR-zd-duR" secondAttribute="leading" constant="24" id="sEy-GV-Pjr"/>
56 </constraints> 47 </constraints>
57 </view> 48 </view>
58 </subviews> 49 </subviews>
...@@ -68,7 +59,6 @@ ...@@ -68,7 +59,6 @@
68 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 59 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
69 <connections> 60 <connections>
70 <outlet property="collectionView" destination="Ddn-dN-xH1" id="RzU-o5-6Dw"/> 61 <outlet property="collectionView" destination="Ddn-dN-xH1" id="RzU-o5-6Dw"/>
71 - <outlet property="titleLabel" destination="mga-ND-qoh" id="TxL-cQ-O1P"/>
72 </connections> 62 </connections>
73 <point key="canvasLocation" x="68.702290076335871" y="29.929577464788736"/> 63 <point key="canvasLocation" x="68.702290076335871" y="29.929577464788736"/>
74 </tableViewCell> 64 </tableViewCell>
......
...@@ -11,31 +11,47 @@ import UIKit ...@@ -11,31 +11,47 @@ import UIKit
11 public class ProfileFilterCollectionViewCell: UICollectionViewCell { 11 public class ProfileFilterCollectionViewCell: UICollectionViewCell {
12 @IBOutlet weak var parentView: UIView! 12 @IBOutlet weak var parentView: UIView!
13 @IBOutlet weak var titleLabel: UILabel! 13 @IBOutlet weak var titleLabel: UILabel!
14 + @IBOutlet weak var couponsCountView: UIView!
15 + @IBOutlet weak var couponsCountLabel: UILabel!
14 16
15 public override func awakeFromNib() { 17 public override func awakeFromNib() {
16 super.awakeFromNib() 18 super.awakeFromNib()
17 // Initialization code 19 // Initialization code
20 +
21 + self.couponsCountView.widthAnchor.constraint(greaterThanOrEqualToConstant: 18).isActive = true
22 + self.couponsCountView.layer.borderWidth = 1.0
23 + self.couponsCountView.layer.cornerRadius = 9
24 +
25 + self.couponsCountLabel.text = "0"
26 + self.couponsCountLabel.font = UIFont(name: "PingLCG-Regular", size: 12)
27 + self.couponsCountLabel.textAlignment = .center
18 } 28 }
19 29
20 func configureCell(data: CouponFilterModel, isSelected: Bool) { 30 func configureCell(data: CouponFilterModel, isSelected: Bool) {
21 if (isSelected) { 31 if (isSelected) {
22 - parentView.backgroundColor = UIColor(rgb: 0x000F1E) 32 + parentView.backgroundColor = UIColor(rgb: 0x002430)
23 - parentView.layer.cornerRadius = 4.0
24 - parentView.layer.borderWidth = 0
25 33
26 - titleLabel.font = UIFont(name: "PingLCG-Bold", size: 16) 34 + titleLabel.font = UIFont(name: "PingLCG-Regular", size: 14)
27 titleLabel.textColor = UIColor(rgb: 0xFFFFFF) 35 titleLabel.textColor = UIColor(rgb: 0xFFFFFF)
36 +
37 + self.couponsCountView.layer.borderColor = UIColor(rgb: 0xFFFFFF).cgColor
38 + self.couponsCountLabel.textColor = UIColor(rgb: 0xFFFFFF)
28 39
29 } else { 40 } else {
30 - parentView.backgroundColor = .clear 41 + parentView.backgroundColor = UIColor(rgb: 0xF1F2F4)
31 - parentView.layer.borderWidth = 2
32 - parentView.layer.borderColor = UIColor(rgb: 0x56586A).cgColor
33 - parentView.layer.cornerRadius = 4.0
34 42
35 - titleLabel.font = UIFont(name: "PingLCG-Bold", size: 16) 43 + titleLabel.font = UIFont(name: "PingLCG-Regular", size: 14)
36 - titleLabel.textColor = UIColor(rgb: 0x00111B) 44 + titleLabel.textColor = UIColor(rgb: 0x1D2023)
45 +
46 + self.couponsCountView.layer.borderColor = UIColor(rgb: 0x1D2023).cgColor
47 + self.couponsCountLabel.textColor = UIColor(rgb: 0x1D2023)
37 } 48 }
49 + parentView.layer.cornerRadius = parentView.bounds.height / 2
38 parentView.clipsToBounds = true 50 parentView.clipsToBounds = true
39 titleLabel.text = data.title 51 titleLabel.text = data.title
52 +
53 + self.couponsCountLabel.text = String(data.count)
54 + self.couponsCountLabel.frame.size.width = self.couponsCountLabel.intrinsicContentSize.width
55 + self.couponsCountLabel.frame.size.height = self.couponsCountLabel.intrinsicContentSize.height
40 } 56 }
41 } 57 }
......
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> 2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="24506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3 <device id="retina6_12" orientation="portrait" appearance="light"/> 3 <device id="retina6_12" orientation="portrait" appearance="light"/>
4 <dependencies> 4 <dependencies>
5 - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/> 5 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24504"/>
6 <capability name="Safe area layout guides" minToolsVersion="9.0"/> 6 <capability name="Safe area layout guides" minToolsVersion="9.0"/>
7 <capability name="System colors in document resources" minToolsVersion="11.0"/> 7 <capability name="System colors in document resources" minToolsVersion="11.0"/>
8 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> 8 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
...@@ -20,19 +20,39 @@ ...@@ -20,19 +20,39 @@
20 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NgU-Qp-M8l" userLabel="ParentView"> 20 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NgU-Qp-M8l" userLabel="ParentView">
21 <rect key="frame" x="0.0" y="0.0" width="145" height="43"/> 21 <rect key="frame" x="0.0" y="0.0" width="145" height="43"/>
22 <subviews> 22 <subviews>
23 - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xq0-AN-QT6"> 23 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xq0-AN-QT6">
24 - <rect key="frame" x="17" y="11.333333333333334" width="111" height="20.333333333333329"/> 24 + <rect key="frame" x="17" y="11.333333333333334" width="41.333333333333343" height="20.333333333333329"/>
25 <fontDescription key="fontDescription" type="system" pointSize="17"/> 25 <fontDescription key="fontDescription" type="system" pointSize="17"/>
26 <nil key="textColor"/> 26 <nil key="textColor"/>
27 <nil key="highlightedColor"/> 27 <nil key="highlightedColor"/>
28 </label> 28 </label>
29 + <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lpG-Ug-Up3" userLabel="CouponsCountView">
30 + <rect key="frame" x="29" y="12.666666666666664" width="96" height="18"/>
31 + <subviews>
32 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XeO-tG-bFk" userLabel="CouponsCountLabel">
33 + <rect key="frame" x="5" y="-1.6666666666666661" width="86" height="21"/>
34 + <fontDescription key="fontDescription" type="system" pointSize="17"/>
35 + <nil key="textColor"/>
36 + <nil key="highlightedColor"/>
37 + </label>
38 + </subviews>
39 + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
40 + <constraints>
41 + <constraint firstItem="XeO-tG-bFk" firstAttribute="leading" secondItem="lpG-Ug-Up3" secondAttribute="leading" constant="5" id="R5p-Hi-6u5"/>
42 + <constraint firstItem="XeO-tG-bFk" firstAttribute="centerY" secondItem="lpG-Ug-Up3" secondAttribute="centerY" id="fWU-dR-twV"/>
43 + <constraint firstAttribute="trailing" secondItem="XeO-tG-bFk" secondAttribute="trailing" constant="5" id="tje-zA-iZF"/>
44 + <constraint firstAttribute="height" constant="18" id="vHB-SL-xqZ"/>
45 + </constraints>
46 + </view>
29 </subviews> 47 </subviews>
30 <color key="backgroundColor" systemColor="systemBackgroundColor"/> 48 <color key="backgroundColor" systemColor="systemBackgroundColor"/>
31 <constraints> 49 <constraints>
50 + <constraint firstAttribute="trailing" secondItem="lpG-Ug-Up3" secondAttribute="trailing" constant="17" id="6zS-oa-YiB"/>
32 <constraint firstAttribute="height" constant="43" id="KOh-gz-4af"/> 51 <constraint firstAttribute="height" constant="43" id="KOh-gz-4af"/>
33 <constraint firstItem="Xq0-AN-QT6" firstAttribute="centerY" secondItem="NgU-Qp-M8l" secondAttribute="centerY" id="aI4-7F-CI7"/> 52 <constraint firstItem="Xq0-AN-QT6" firstAttribute="centerY" secondItem="NgU-Qp-M8l" secondAttribute="centerY" id="aI4-7F-CI7"/>
34 - <constraint firstAttribute="trailing" secondItem="Xq0-AN-QT6" secondAttribute="trailing" constant="17" id="hKh-jv-VQR"/> 53 + <constraint firstItem="lpG-Ug-Up3" firstAttribute="leading" secondItem="Xq0-AN-QT6" secondAttribute="trailing" constant="10" id="hKh-jv-VQR"/>
35 <constraint firstItem="Xq0-AN-QT6" firstAttribute="leading" secondItem="NgU-Qp-M8l" secondAttribute="leading" constant="17" id="na6-tV-KQZ"/> 54 <constraint firstItem="Xq0-AN-QT6" firstAttribute="leading" secondItem="NgU-Qp-M8l" secondAttribute="leading" constant="17" id="na6-tV-KQZ"/>
55 + <constraint firstItem="lpG-Ug-Up3" firstAttribute="centerY" secondItem="NgU-Qp-M8l" secondAttribute="centerY" id="plg-Ar-0Oy"/>
36 </constraints> 56 </constraints>
37 </view> 57 </view>
38 </subviews> 58 </subviews>
...@@ -47,6 +67,8 @@ ...@@ -47,6 +67,8 @@
47 </constraints> 67 </constraints>
48 <size key="customSize" width="145" height="43"/> 68 <size key="customSize" width="145" height="43"/>
49 <connections> 69 <connections>
70 + <outlet property="couponsCountLabel" destination="XeO-tG-bFk" id="6dD-pl-b5f"/>
71 + <outlet property="couponsCountView" destination="lpG-Ug-Up3" id="kgW-3I-uEK"/>
50 <outlet property="parentView" destination="NgU-Qp-M8l" id="qhP-z2-cWY"/> 72 <outlet property="parentView" destination="NgU-Qp-M8l" id="qhP-z2-cWY"/>
51 <outlet property="titleLabel" destination="Xq0-AN-QT6" id="Hft-IP-ITh"/> 73 <outlet property="titleLabel" destination="Xq0-AN-QT6" id="Hft-IP-ITh"/>
52 </connections> 74 </connections>
......
...@@ -9,5 +9,7 @@ ...@@ -9,5 +9,7 @@
9 import Foundation 9 import Foundation
10 10
11 struct CouponFilterModel { 11 struct CouponFilterModel {
12 + let id: String
12 let title: String 13 let title: String
14 + let count: Int
13 } 15 }
......
...@@ -30,18 +30,20 @@ import UIKit ...@@ -30,18 +30,20 @@ import UIKit
30 private var isLoading: Bool = true 30 private var isLoading: Bool = true
31 private var loadingIndicator: UIActivityIndicatorView? 31 private var loadingIndicator: UIActivityIndicatorView?
32 32
33 - let couponFilters: [CouponFilterModel] = [ 33 + var couponFilters: [CouponFilterModel] = [
34 - CouponFilterModel(title: "Ενεργά"), 34 + CouponFilterModel(id: "active", title: "Valid", count: 0),
35 - CouponFilterModel(title: "Αγαπημένα"), 35 + CouponFilterModel(id: "expired", title: "Expired", count: 0),
36 - CouponFilterModel(title: "Εξαργυρωμένα") 36 + // CouponFilterModel(title: "Favorites"),
37 + // CouponFilterModel(title: "Redeemed")
37 ] 38 ]
38 39
39 - var couponFilterSelected: CouponFilterModel = CouponFilterModel(title: "Ενεργά") 40 + var couponFilterSelected: CouponFilterModel = CouponFilterModel(id: "active", title: "Valid", count: 0)
40 41
41 var forYouOffersSection: SectionModel? 42 var forYouOffersSection: SectionModel?
42 var activeOffersSection: SectionModel? 43 var activeOffersSection: SectionModel?
43 var favoriteOffersSection: SectionModel? 44 var favoriteOffersSection: SectionModel?
44 var redeemedOffersSection: SectionModel? 45 var redeemedOffersSection: SectionModel?
46 + var expiredOffersSection: SectionModel?
45 var filteredOffersSection: SectionModel? 47 var filteredOffersSection: SectionModel?
46 48
47 public override func viewDidLoad() { 49 public override func viewDidLoad() {
...@@ -160,19 +162,19 @@ import UIKit ...@@ -160,19 +162,19 @@ import UIKit
160 162
161 func initializeSections() { 163 func initializeSections() {
162 // Προτάσεις για εσένα — empty for now 164 // Προτάσεις για εσένα — empty for now
163 - let forYouOffers: [CouponItemModel] = [] 165 + // let forYouOffers: [CouponItemModel] = []
164 - forYouOffersSection = SectionModel( 166 + // forYouOffersSection = SectionModel(
165 - sectionType: .myRewardsHorizontalCouponsets, 167 + // sectionType: .myRewardsHorizontalCouponsets,
166 - title: "Προτάσεις για εσένα", 168 + // title: "Προτάσεις για εσένα",
167 - items: forYouOffers, 169 + // items: forYouOffers,
168 - itemType: .coupons 170 + // itemType: .coupons
169 - ) 171 + // )
170 172
171 // Active Coupons — status == 1 173 // Active Coupons — status == 1
172 let activeCoupons = allCoupons.filter { $0.status == 1 } 174 let activeCoupons = allCoupons.filter { $0.status == 1 }
173 activeOffersSection = SectionModel( 175 activeOffersSection = SectionModel(
174 sectionType: .profileCoupon, 176 sectionType: .profileCoupon,
175 - title: "Ενεργά", 177 + title: "Valid",
176 items: activeCoupons, 178 items: activeCoupons,
177 itemType: .coupons 179 itemType: .coupons
178 ) 180 )
...@@ -198,6 +200,26 @@ import UIKit ...@@ -198,6 +200,26 @@ import UIKit
198 itemType: .coupons 200 itemType: .coupons
199 ) 201 )
200 202
203 + // expiredOffersSection Coupons — status == 0
204 + let expiredCoupons = allCoupons.filter { $0.status == -1 }
205 + expiredOffersSection = SectionModel(
206 + sectionType: .profileCoupon,
207 + title: "Expired",
208 + items: expiredCoupons,
209 + itemType: .coupons
210 + )
211 +
212 + // Update filter counts dynamically based on fetched coupons
213 + couponFilters = [
214 + CouponFilterModel(id: "active", title: "Valid", count: activeCoupons.count),
215 + CouponFilterModel(id: "expired", title: "Expired", count: expiredCoupons.count)
216 + ]
217 +
218 + // Sync couponFilterSelected with updated count
219 + if let updatedSelected = couponFilters.first(where: { $0.id == couponFilterSelected.id }) {
220 + couponFilterSelected = updatedSelected
221 + }
222 +
201 self.tableView.reloadData() 223 self.tableView.reloadData()
202 } 224 }
203 225
...@@ -209,13 +231,25 @@ import UIKit ...@@ -209,13 +231,25 @@ import UIKit
209 } 231 }
210 232
211 private func handleFilterPress(with filter: CouponFilterModel) { 233 private func handleFilterPress(with filter: CouponFilterModel) {
212 - switch (filter.title) { 234 + // switch (filter.title) {
213 - case "Ενεργά": 235 + // case "Ενεργά":
236 + // self.filteredOffersSection = activeOffersSection
237 + // case "Αγαπημένα":
238 + // self.filteredOffersSection = favoriteOffersSection
239 + // case "Εξαργυρωμένα":
240 + // self.filteredOffersSection = redeemedOffersSection
241 + // default:
242 + // self.filteredOffersSection = activeOffersSection
243 + // }
244 + switch (filter.id) {
245 + case "active":
214 self.filteredOffersSection = activeOffersSection 246 self.filteredOffersSection = activeOffersSection
215 - case "Αγαπημένα": 247 + case "expired":
216 - self.filteredOffersSection = favoriteOffersSection 248 + self.filteredOffersSection = expiredOffersSection
217 - case "Εξαργυρωμένα": 249 + // case "favorite":
218 - self.filteredOffersSection = redeemedOffersSection 250 + // self.filteredOffersSection = favoriteOffersSection
251 + // case "redeemed":
252 + // self.filteredOffersSection = redeemedOffersSection
219 default: 253 default:
220 self.filteredOffersSection = activeOffersSection 254 self.filteredOffersSection = activeOffersSection
221 } 255 }
...@@ -224,13 +258,25 @@ import UIKit ...@@ -224,13 +258,25 @@ import UIKit
224 // MARK: - Empty State Helper 258 // MARK: - Empty State Helper
225 259
226 private func getEmptyStateMessage() -> String { 260 private func getEmptyStateMessage() -> String {
227 - switch couponFilterSelected.title { 261 + // switch couponFilterSelected.title {
228 - case "Ενεργά": 262 + // case "Ενεργά":
263 + // return "Δεν υπάρχουν διαθέσιμα ενεργά κουπόνια"
264 + // case "Αγαπημένα":
265 + // return "Δεν υπάρχουν διαθέσιμα αγαπημένα κουπόνια"
266 + // case "Εξαργυρωμένα":
267 + // return "Δεν υπάρχουν διαθέσιμα εξαργυρωμένα κουπόνια"
268 + // default:
269 + // return "Δεν υπάρχουν διαθέσιμα κουπόνια"
270 + // }
271 + switch couponFilterSelected.id {
272 + case "active":
229 return "Δεν υπάρχουν διαθέσιμα ενεργά κουπόνια" 273 return "Δεν υπάρχουν διαθέσιμα ενεργά κουπόνια"
230 - case "Αγαπημένα": 274 + case "favorite":
231 return "Δεν υπάρχουν διαθέσιμα αγαπημένα κουπόνια" 275 return "Δεν υπάρχουν διαθέσιμα αγαπημένα κουπόνια"
232 - case "Εξαργυρωμένα": 276 + case "redeemed":
233 return "Δεν υπάρχουν διαθέσιμα εξαργυρωμένα κουπόνια" 277 return "Δεν υπάρχουν διαθέσιμα εξαργυρωμένα κουπόνια"
278 + case "expired":
279 + return "Δεν υπάρχουν διαθέσιμα ληγμένα κουπόνια"
234 default: 280 default:
235 return "Δεν υπάρχουν διαθέσιμα κουπόνια" 281 return "Δεν υπάρχουν διαθέσιμα κουπόνια"
236 } 282 }
...@@ -356,4 +402,4 @@ extension MyCouponsViewController: ProfileCouponFiltersTableViewCellDelegate { ...@@ -356,4 +402,4 @@ extension MyCouponsViewController: ProfileCouponFiltersTableViewCellDelegate {
356 handleFilterPress(with: filter) 402 handleFilterPress(with: filter)
357 self.tableView.reloadData() 403 self.tableView.reloadData()
358 } 404 }
359 -}
...\ No newline at end of file ...\ No newline at end of file
405 +}
......
...@@ -28,12 +28,12 @@ ...@@ -28,12 +28,12 @@
28 <color key="separatorColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 28 <color key="separatorColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
29 <color key="sectionIndexBackgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 29 <color key="sectionIndexBackgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
30 <connections> 30 <connections>
31 - <outlet property="dataSource" destination="-1" id="yKP-hs-r89"/> 31 + <outlet property="dataSource" destination="-1" id="bkg-UZ-tNq"/>
32 - <outlet property="delegate" destination="-1" id="hPq-MZ-iBl"/> 32 + <outlet property="delegate" destination="-1" id="3bZ-Xs-qXL"/>
33 </connections> 33 </connections>
34 </tableView> 34 </tableView>
35 </subviews> 35 </subviews>
36 - <color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/> 36 + <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
37 <constraints> 37 <constraints>
38 <constraint firstItem="5Lc-C5-PjX" firstAttribute="leading" secondItem="3MR-Lq-Ca1" secondAttribute="leading" id="E1N-Fh-MGi"/> 38 <constraint firstItem="5Lc-C5-PjX" firstAttribute="leading" secondItem="3MR-Lq-Ca1" secondAttribute="leading" id="E1N-Fh-MGi"/>
39 <constraint firstItem="5Lc-C5-PjX" firstAttribute="top" secondItem="3MR-Lq-Ca1" secondAttribute="top" id="oMH-QW-fBP"/> 39 <constraint firstItem="5Lc-C5-PjX" firstAttribute="top" secondItem="3MR-Lq-Ca1" secondAttribute="top" id="oMH-QW-fBP"/>
......