Manos Chorianopoulos

CouponBarcodeViewController description fix and error modal

...@@ -124,7 +124,7 @@ import AVFoundation ...@@ -124,7 +124,7 @@ import AVFoundation
124 124
125 // let couponSetData: swiftApi.CouponSetItemModel? = coupon?.couponset_data 125 // let couponSetData: swiftApi.CouponSetItemModel? = coupon?.couponset_data
126 var couponSetData: swiftApi.CouponSetItemModel? 126 var couponSetData: swiftApi.CouponSetItemModel?
127 - if (isMarket == true) { 127 + if (isMarket == true || isSMCoupon == true) {
128 for item in smCouponsetsList { 128 for item in smCouponsetsList {
129 if (item.uuid == coupon?.couponset_uuid) { 129 if (item.uuid == coupon?.couponset_uuid) {
130 couponSetData = item 130 couponSetData = item
...@@ -208,6 +208,13 @@ import AVFoundation ...@@ -208,6 +208,13 @@ import AVFoundation
208 208
209 // nameLabel.text = htmlName.htmlToString 209 // nameLabel.text = htmlName.htmlToString
210 discriptionLabel.text = htmlDiscription.htmlToString 210 discriptionLabel.text = htmlDiscription.htmlToString
211 +
212 + } else if (isSMCoupon == true) {
213 + couponImage.contentMode = .scaleAspectFill
214 + nameLabel.text = couponSetData?.name ?? ""
215 + let htmlDiscription = couponSetData?.description ?? ""
216 + discriptionLabel.text = htmlDiscription.htmlToString
217 +
211 } else { 218 } else {
212 couponImage.contentMode = .scaleAspectFill 219 couponImage.contentMode = .scaleAspectFill
213 nameLabel.text = couponSetData?.name ?? "" 220 nameLabel.text = couponSetData?.name ?? ""
...@@ -651,6 +658,25 @@ import AVFoundation ...@@ -651,6 +658,25 @@ import AVFoundation
651 return "" 658 return ""
652 } 659 }
653 660
661 + func showDialog(_ alertTitle: String, _ alertSubTitle: String) -> Void {
662 +
663 + let alert = UIAlertController(title: alertTitle, message: alertSubTitle, preferredStyle: .alert)
664 + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in
665 + switch action.style{
666 + case .default:
667 + print("default")
668 +
669 + case .cancel:
670 + print("cancel")
671 +
672 + case .destructive:
673 + print("destructive")
674 +
675 + }
676 + }))
677 + self.present(alert, animated: true, completion: nil)
678 + }
679 +
654 // MARK: - Actions 680 // MARK: - Actions
655 681
656 @IBAction func redeemButtomAction(_ sender: Any) { 682 @IBAction func redeemButtomAction(_ sender: Any) {
...@@ -680,7 +706,7 @@ import AVFoundation ...@@ -680,7 +706,7 @@ import AVFoundation
680 } 706 }
681 707
682 } else { 708 } else {
683 - // TODO: add error popup 709 + self.showDialog("Δεν υπάρχουν διαθέσιμα supermarkets","")
684 } 710 }
685 711
686 } else { 712 } else {
......