Showing
3 changed files
with
28 additions
and
3 deletions
| ... | @@ -73,14 +73,20 @@ class MerchantTableViewCell: UITableViewCell { | ... | @@ -73,14 +73,20 @@ class MerchantTableViewCell: UITableViewCell { |
| 73 | contentView.frame = contentView.frame.inset(by: margins) | 73 | contentView.frame = contentView.frame.inset(by: margins) |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | - func configureCell(shop: swiftApi.ShopAvailabilityItemModel, buttonTitle: String, iconImage: String?) { | 76 | + func configureCell(shop: swiftApi.ShopAvailabilityItemModel, buttonTitle: String, iconImage: String?, showEshops: Bool?) { |
| 77 | 77 | ||
| 78 | + if (showEshops == true) { | ||
| 79 | + // TODO: add static image | ||
| 80 | +// self.merchantImage.image = image | ||
| 81 | + | ||
| 82 | + } else { | ||
| 78 | for merchant in merchantList { | 83 | for merchant in merchantList { |
| 79 | if (merchant._uuid == shop._merchant_uuid) { | 84 | if (merchant._uuid == shop._merchant_uuid) { |
| 80 | self.postImageURL = merchant._img_preview | 85 | self.postImageURL = merchant._img_preview |
| 81 | break; | 86 | break; |
| 82 | } | 87 | } |
| 83 | } | 88 | } |
| 89 | + } | ||
| 84 | 90 | ||
| 85 | buttonTitleLable.text = buttonTitle | 91 | buttonTitleLable.text = buttonTitle |
| 86 | 92 | ... | ... |
| ... | @@ -19,10 +19,15 @@ class PopupMerchantsViewController: UIViewController { | ... | @@ -19,10 +19,15 @@ class PopupMerchantsViewController: UIViewController { |
| 19 | public var buttonTitle: String? = "Βρες το" | 19 | public var buttonTitle: String? = "Βρες το" |
| 20 | public var buttonIcon: String? | 20 | public var buttonIcon: String? |
| 21 | public var footerText: String? = "Η διαθεσιμότητα ενδέχεται να διαφέρει ανάλογα με την τοποθεσία." | 21 | public var footerText: String? = "Η διαθεσιμότητα ενδέχεται να διαφέρει ανάλογα με την τοποθεσία." |
| 22 | + public var showEshops: Bool? = false | ||
| 22 | 23 | ||
| 23 | override func viewDidLoad() { | 24 | override func viewDidLoad() { |
| 24 | super.viewDidLoad() | 25 | super.viewDidLoad() |
| 25 | 26 | ||
| 27 | + if (showEshops == true) { | ||
| 28 | + setupEshopsData() | ||
| 29 | + } | ||
| 30 | + | ||
| 26 | tableView.delegate = self | 31 | tableView.delegate = self |
| 27 | tableView.dataSource = self | 32 | tableView.dataSource = self |
| 28 | 33 | ||
| ... | @@ -42,6 +47,19 @@ class PopupMerchantsViewController: UIViewController { | ... | @@ -42,6 +47,19 @@ class PopupMerchantsViewController: UIViewController { |
| 42 | headerLabel.textColor = UIColor(rgb: 0x000000) | 47 | headerLabel.textColor = UIColor(rgb: 0x000000) |
| 43 | } | 48 | } |
| 44 | 49 | ||
| 50 | + // MARK: - Functions | ||
| 51 | + func setupEshopsData() { | ||
| 52 | + let tempShop1: swiftApi.ShopAvailabilityItemModel = swiftApi.ShopAvailabilityItemModel() | ||
| 53 | + tempShop1._merchant_uuid = "ab" | ||
| 54 | + tempShop1._product_url = "https://www.ab.gr" | ||
| 55 | + availableShopsList.append(tempShop1) | ||
| 56 | + | ||
| 57 | + let tempShop2: swiftApi.ShopAvailabilityItemModel = swiftApi.ShopAvailabilityItemModel() | ||
| 58 | + tempShop2._merchant_uuid = "masoutis" | ||
| 59 | + tempShop2._product_url = "https://www.masoutis.gr" | ||
| 60 | + availableShopsList.append(tempShop2) | ||
| 61 | + } | ||
| 62 | + | ||
| 45 | // MARK: - UIButton Actions | 63 | // MARK: - UIButton Actions |
| 46 | @IBAction func closeButtonAction(_ sender: Any) { | 64 | @IBAction func closeButtonAction(_ sender: Any) { |
| 47 | self.dismiss(animated: true, completion: {}) | 65 | self.dismiss(animated: true, completion: {}) |
| ... | @@ -81,7 +99,7 @@ extension PopupMerchantsViewController: UITableViewDelegate, UITableViewDataSour | ... | @@ -81,7 +99,7 @@ extension PopupMerchantsViewController: UITableViewDelegate, UITableViewDataSour |
| 81 | public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | 99 | public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| 82 | if (indexPath.section == 0) { | 100 | if (indexPath.section == 0) { |
| 83 | let cell = tableView.dequeueReusableCell(withIdentifier: "MerchantTableViewCellId", for: indexPath) as! MerchantTableViewCell | 101 | let cell = tableView.dequeueReusableCell(withIdentifier: "MerchantTableViewCellId", for: indexPath) as! MerchantTableViewCell |
| 84 | - cell.configureCell(shop: availableShopsList[indexPath.row], buttonTitle: self.buttonTitle ?? "Βρες το", iconImage: buttonIcon) | 102 | + cell.configureCell(shop: availableShopsList[indexPath.row], buttonTitle: self.buttonTitle ?? "Βρες το", iconImage: self.buttonIcon, showEshops: self.showEshops) |
| 85 | 103 | ||
| 86 | // Set the delegate to self | 104 | // Set the delegate to self |
| 87 | cell.delegate = self | 105 | cell.delegate = self | ... | ... |
| ... | @@ -388,11 +388,12 @@ extension UnifiedCouponBarcodeViewController: PopupMerchantCategoriesViewControl | ... | @@ -388,11 +388,12 @@ extension UnifiedCouponBarcodeViewController: PopupMerchantCategoriesViewControl |
| 388 | if let popupVC = storyboard.instantiateViewController(withIdentifier: "PopupMerchantsViewController") as? SwiftWarplyFramework.PopupMerchantsViewController { | 388 | if let popupVC = storyboard.instantiateViewController(withIdentifier: "PopupMerchantsViewController") as? SwiftWarplyFramework.PopupMerchantsViewController { |
| 389 | popupVC.modalPresentationStyle = .overCurrentContext | 389 | popupVC.modalPresentationStyle = .overCurrentContext |
| 390 | popupVC.modalTransitionStyle = .crossDissolve | 390 | popupVC.modalTransitionStyle = .crossDissolve |
| 391 | -// popupVC.coupon = coupon | 391 | + popupVC.availableShopsList = [] |
| 392 | popupVC.headerText = "Δες τα eshop" | 392 | popupVC.headerText = "Δες τα eshop" |
| 393 | popupVC.buttonTitle = "Δες το eshop" | 393 | popupVC.buttonTitle = "Δες το eshop" |
| 394 | // popupVC.buttonIcon = "shopping_cart" | 394 | // popupVC.buttonIcon = "shopping_cart" |
| 395 | popupVC.footerText = "Η διαθεσιμότητα ενδέχεται να διαφέρει ανάλογα με την τοποθεσία." | 395 | popupVC.footerText = "Η διαθεσιμότητα ενδέχεται να διαφέρει ανάλογα με την τοποθεσία." |
| 396 | + popupVC.showEshops = true | ||
| 396 | 397 | ||
| 397 | self.present(popupVC, animated: true, completion: nil) | 398 | self.present(popupVC, animated: true, completion: nil) |
| 398 | } | 399 | } | ... | ... |
-
Please register or login to post a comment