Showing
2 changed files
with
33 additions
and
6 deletions
No preview for this file type
... | @@ -92,6 +92,15 @@ struct ImageView: View { | ... | @@ -92,6 +92,15 @@ struct ImageView: View { |
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | +struct VLine: Shape { | ||
96 | + func path(in rect: CGRect) -> Path { | ||
97 | + Path { path in | ||
98 | + path.move(to: CGPoint(x: rect.midX, y: rect.minY)) | ||
99 | + path.addLine(to: CGPoint(x: rect.midX, y: rect.maxY)) | ||
100 | + } | ||
101 | + } | ||
102 | +} | ||
103 | + | ||
95 | extension CouponsView { | 104 | extension CouponsView { |
96 | struct headerView: View { | 105 | struct headerView: View { |
97 | var goBack: () -> () | 106 | var goBack: () -> () |
... | @@ -104,13 +113,14 @@ extension CouponsView { | ... | @@ -104,13 +113,14 @@ extension CouponsView { |
104 | HStack { | 113 | HStack { |
105 | Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) | 114 | Image("ic_back", bundle: Bundle(for: MyEmptyClass.self)) |
106 | .resizable() | 115 | .resizable() |
107 | - .frame(width: self.uiscreen.height * 0.025, height: self.uiscreen.height * 0.02) | 116 | + .frame(width: self.uiscreen.height * 0.022, height: self.uiscreen.height * 0.02) |
108 | - .offset(y: self.uiscreen.height * 0.018) | 117 | + .offset(y: self.uiscreen.height * 0.015) |
109 | } | 118 | } |
110 | } | 119 | } |
111 | Text("Όλα τα κουπόνια μου") | 120 | Text("Όλα τα κουπόνια μου") |
112 | .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center) | 121 | .frame(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.025, alignment: .center) |
113 | .offset( y: self.uiscreen.height * 0.02) | 122 | .offset( y: self.uiscreen.height * 0.02) |
123 | + .font(.system(size: 15)) | ||
114 | } | 124 | } |
115 | .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.1) | 125 | .frame(width: self.uiscreen.width, height: self.uiscreen.height * 0.1) |
116 | } | 126 | } |
... | @@ -126,15 +136,31 @@ extension CouponsView { | ... | @@ -126,15 +136,31 @@ extension CouponsView { |
126 | return "\(parameter)" | 136 | return "\(parameter)" |
127 | } | 137 | } |
128 | 138 | ||
139 | + static func convertDateFormat(inputDate: String) -> String { | ||
140 | + let olDateFormatter = DateFormatter() | ||
141 | + olDateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss" | ||
142 | + | ||
143 | + let oldDate = olDateFormatter.date(from: inputDate) | ||
144 | + | ||
145 | + let convertDateFormatter = DateFormatter() | ||
146 | + convertDateFormatter.dateFormat = "dd/MM/yyyy" | ||
147 | + | ||
148 | + return convertDateFormatter.string(from: oldDate!) | ||
149 | + } | ||
150 | + | ||
129 | var body: some View { | 151 | var body: some View { |
130 | 152 | ||
153 | + | ||
131 | VStack(alignment: .leading) { | 154 | VStack(alignment: .leading) { |
132 | HStack(alignment: .center) { | 155 | HStack(alignment: .center) { |
133 | ImageView(withURL: result["img_preview"] as! String) | 156 | ImageView(withURL: result["img_preview"] as! String) |
134 | .frame(maxWidth: self.uiscreen.width * 0.15) | 157 | .frame(maxWidth: self.uiscreen.width * 0.15) |
135 | .padding(.leading , self.uiscreen.width * 0.04) | 158 | .padding(.leading , self.uiscreen.width * 0.04) |
136 | - Rectangle() | 159 | + VLine() |
137 | - .frame(width: 1, height: self.uiscreen.height * 0.1 * 0.93) | 160 | + .stroke(style: StrokeStyle(lineWidth: 1, dash: [5])) |
161 | + .foregroundColor(Color(red: 0.4392156862745098, green: 0.4392156862745098, blue: 0.4392156862745098)) | ||
162 | + .frame(width: 1) | ||
163 | + .padding(.leading, self.uiscreen.width * 0.01) | ||
138 | Spacer() | 164 | Spacer() |
139 | VStack { | 165 | VStack { |
140 | Text(CouponsView.couponView.localizedWithParameter(parameter: result["admin_name"] as? String ?? "")) | 166 | Text(CouponsView.couponView.localizedWithParameter(parameter: result["admin_name"] as? String ?? "")) |
... | @@ -143,7 +169,7 @@ extension CouponsView { | ... | @@ -143,7 +169,7 @@ extension CouponsView { |
143 | Text(CouponsView.couponView.localizedWithParameter(parameter: result["discount"] as? String ?? "")) | 169 | Text(CouponsView.couponView.localizedWithParameter(parameter: result["discount"] as? String ?? "")) |
144 | .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: self.uiscreen.height * 0.05, alignment: .leading) | 170 | .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: self.uiscreen.height * 0.05, alignment: .leading) |
145 | .font(.system(size: 47)) | 171 | .font(.system(size: 47)) |
146 | - Text(CouponsView.couponView.localizedWithParameter(parameter: "Ισχύει εώς " + (result["expiration"] as? String ?? "").components(separatedBy: [" "]).filter({!$0.isEmpty})[0])) | 172 | + Text(CouponsView.couponView.localizedWithParameter(parameter: "Ισχύει εώς " + CouponsView.couponView.convertDateFormat(inputDate: result["expiration"] as? String ?? ""))) |
147 | .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: .infinity, alignment: .leading) | 173 | .frame(maxWidth: self.uiscreen.width * 0.35, maxHeight: .infinity, alignment: .leading) |
148 | .font(.system(size: 10)) | 174 | .font(.system(size: 10)) |
149 | } | 175 | } |
... | @@ -164,7 +190,7 @@ extension CouponsView { | ... | @@ -164,7 +190,7 @@ extension CouponsView { |
164 | Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self)) | 190 | Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self)) |
165 | .resizable() | 191 | .resizable() |
166 | ) | 192 | ) |
167 | - .padding(.top, self.uiscreen.height * 0.05) | 193 | + .padding(.bottom, self.uiscreen.height * 0.04) |
168 | 194 | ||
169 | } | 195 | } |
170 | } | 196 | } |
... | @@ -198,6 +224,7 @@ struct CouponsView: View { | ... | @@ -198,6 +224,7 @@ struct CouponsView: View { |
198 | couponView(result: result, index: index) } | 224 | couponView(result: result, index: index) } |
199 | } | 225 | } |
200 | } | 226 | } |
227 | + .padding(.top, self.uiscreen.height * 0.05) | ||
201 | } | 228 | } |
202 | .frame(width:self.uiscreen.width, height:self.uiscreen.height * 0.9 ) | 229 | .frame(width:self.uiscreen.width, height:self.uiscreen.height * 0.9 ) |
203 | .background( | 230 | .background( | ... | ... |
-
Please register or login to post a comment