Manos Chorianopoulos

PopupMerchantsViewController eshops fixes

......@@ -73,12 +73,18 @@ class MerchantTableViewCell: UITableViewCell {
contentView.frame = contentView.frame.inset(by: margins)
}
func configureCell(shop: swiftApi.ShopAvailabilityItemModel, buttonTitle: String, iconImage: String?) {
func configureCell(shop: swiftApi.ShopAvailabilityItemModel, buttonTitle: String, iconImage: String?, showEshops: Bool?) {
for merchant in merchantList {
if (merchant._uuid == shop._merchant_uuid) {
self.postImageURL = merchant._img_preview
break;
if (showEshops == true) {
// TODO: add static image
// self.merchantImage.image = image
} else {
for merchant in merchantList {
if (merchant._uuid == shop._merchant_uuid) {
self.postImageURL = merchant._img_preview
break;
}
}
}
......
......@@ -19,10 +19,15 @@ class PopupMerchantsViewController: UIViewController {
public var buttonTitle: String? = "Βρες το"
public var buttonIcon: String?
public var footerText: String? = "Η διαθεσιμότητα ενδέχεται να διαφέρει ανάλογα με την τοποθεσία."
public var showEshops: Bool? = false
override func viewDidLoad() {
super.viewDidLoad()
if (showEshops == true) {
setupEshopsData()
}
tableView.delegate = self
tableView.dataSource = self
......@@ -42,6 +47,19 @@ class PopupMerchantsViewController: UIViewController {
headerLabel.textColor = UIColor(rgb: 0x000000)
}
// MARK: - Functions
func setupEshopsData() {
let tempShop1: swiftApi.ShopAvailabilityItemModel = swiftApi.ShopAvailabilityItemModel()
tempShop1._merchant_uuid = "ab"
tempShop1._product_url = "https://www.ab.gr"
availableShopsList.append(tempShop1)
let tempShop2: swiftApi.ShopAvailabilityItemModel = swiftApi.ShopAvailabilityItemModel()
tempShop2._merchant_uuid = "masoutis"
tempShop2._product_url = "https://www.masoutis.gr"
availableShopsList.append(tempShop2)
}
// MARK: - UIButton Actions
@IBAction func closeButtonAction(_ sender: Any) {
self.dismiss(animated: true, completion: {})
......@@ -81,7 +99,7 @@ extension PopupMerchantsViewController: UITableViewDelegate, UITableViewDataSour
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if (indexPath.section == 0) {
let cell = tableView.dequeueReusableCell(withIdentifier: "MerchantTableViewCellId", for: indexPath) as! MerchantTableViewCell
cell.configureCell(shop: availableShopsList[indexPath.row], buttonTitle: self.buttonTitle ?? "Βρες το", iconImage: buttonIcon)
cell.configureCell(shop: availableShopsList[indexPath.row], buttonTitle: self.buttonTitle ?? "Βρες το", iconImage: self.buttonIcon, showEshops: self.showEshops)
// Set the delegate to self
cell.delegate = self
......
......@@ -388,11 +388,12 @@ extension UnifiedCouponBarcodeViewController: PopupMerchantCategoriesViewControl
if let popupVC = storyboard.instantiateViewController(withIdentifier: "PopupMerchantsViewController") as? SwiftWarplyFramework.PopupMerchantsViewController {
popupVC.modalPresentationStyle = .overCurrentContext
popupVC.modalTransitionStyle = .crossDissolve
// popupVC.coupon = coupon
popupVC.availableShopsList = []
popupVC.headerText = "Δες τα eshop"
popupVC.buttonTitle = "Δες το eshop"
// popupVC.buttonIcon = "shopping_cart"
popupVC.footerText = "Η διαθεσιμότητα ενδέχεται να διαφέρει ανάλογα με την τοποθεσία."
popupVC.showEshops = true
self.present(popupVC, animated: true, completion: nil)
}
......