Manos Chorianopoulos

coupons changes

......@@ -124,8 +124,8 @@ extension CouponBarcodeView {
func constructBarcode() -> String? {
// EAN 13 barcode construction
// let couponData = coupon["coupon_data"] as? [String: Any] ?? ["":""]
let couponString = coupon["coupon"] as? String ?? ""
let couponData = coupon["coupon_data"] as? [String: Any] ?? ["":""]
let couponString = couponData["coupon"] as? String ?? ""
if (!couponString.isEmpty) {
var checkDigit = 0;
......@@ -158,6 +158,7 @@ extension CouponBarcodeView {
var body: some View {
let couponData = coupon["coupon_data"] as? [String: Any] ?? ["":""]
let barcodeString = constructBarcode() ?? ""
GeometryReader { geometry in
......@@ -194,7 +195,7 @@ extension CouponBarcodeView {
VStack(alignment: .center) {
VStack {
Text(coupon["coupon"] as? String ?? "")
Text(couponData["coupon"] as? String ?? "")
.fontWeight(.bold)
.font(.system(size: 27))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
......@@ -209,7 +210,7 @@ extension CouponBarcodeView {
}
.frame(maxWidth: .infinity)
if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: coupon["coupon"] as? String ?? ""))) {
if (CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: couponData["coupon"] as? String ?? ""))) {
VStack(alignment: .center) {
VStack {}
.frame(height: 1)
......@@ -284,7 +285,7 @@ extension CouponBarcodeView {
Text("Το κουπόνι ισχύει έως " + CouponBarcodeView.couponContainer.convertDateFormat(inputDate: coupon["expiration"] as? String ?? ""))
Text("Το κουπόνι ισχύει έως " + CouponBarcodeView.couponContainer.convertDateFormat(inputDate: couponData["expiration"] as? String ?? ""))
.fontWeight(.medium)
.font(.system(size: 14))
.foregroundColor(Color(red: 0.2549019607843137, green: 0.3333333333333333, blue: 0.39215686274509803))
......@@ -378,7 +379,7 @@ extension CouponBarcodeView {
// couponset = CouponSetItemModel(dictionary: coupon)
print("==================")
print(coupon["coupon"] as? String ?? "")
print(couponData["coupon"] as? String ?? "")
print("==================")
print("========constructBarcode()==========")
......