Showing
2 changed files
with
32 additions
and
4 deletions
... | @@ -27,9 +27,11 @@ import MapKit | ... | @@ -27,9 +27,11 @@ import MapKit |
27 | 27 | ||
28 | // public | 28 | // public |
29 | public var couponSet: swiftApi.CouponSetItemModel? | 29 | public var couponSet: swiftApi.CouponSetItemModel? |
30 | + public var isMarket: Bool? = false | ||
30 | var merchantsArray:Array<swiftApi.MerchantModel> = [] | 31 | var merchantsArray:Array<swiftApi.MerchantModel> = [] |
31 | var selectedMerchant: swiftApi.MerchantModel? | 32 | var selectedMerchant: swiftApi.MerchantModel? |
32 | var annotationGroup = [MKPointAnnotation]() | 33 | var annotationGroup = [MKPointAnnotation]() |
34 | + var parentMerchant: swiftApi.MerchantModel? | ||
33 | 35 | ||
34 | // | 36 | // |
35 | var loading: Bool = false | 37 | var loading: Bool = false |
... | @@ -126,7 +128,14 @@ import MapKit | ... | @@ -126,7 +128,14 @@ import MapKit |
126 | } | 128 | } |
127 | } else { | 129 | } else { |
128 | let appUuid = swiftApi().getAppUuid() | 130 | let appUuid = swiftApi().getAppUuid() |
129 | - let categoryUuids = appUuid == "0086a2088301440792091b9f814c2267" ? [""] : ["adcace6cab6049c7b7271bc85bc2b26d"] | 131 | + |
132 | + // 2a6adade35f1484994a3d4c8f006b909 category is for SM only | ||
133 | + var categoryUuids = [""] | ||
134 | + if (self.isMarket == true) { | ||
135 | + categoryUuids = appUuid == "0086a2088301440792091b9f814c2267" ? ["2a6adade35f1484994a3d4c8f006b909"] : ["adcace6cab6049c7b7271bc85bc2b26d"] | ||
136 | + } else { | ||
137 | + categoryUuids = appUuid == "0086a2088301440792091b9f814c2267" ? [""] : ["adcace6cab6049c7b7271bc85bc2b26d"] | ||
138 | + } | ||
130 | 139 | ||
131 | swiftApi().getMultilingualMerchantsAsync(categoryUuids, false, 0.0, [], "", 0, [], getMerchantsCallback) | 140 | swiftApi().getMultilingualMerchantsAsync(categoryUuids, false, 0.0, [], "", 0, [], getMerchantsCallback) |
132 | showContent() | 141 | showContent() |
... | @@ -138,10 +147,22 @@ import MapKit | ... | @@ -138,10 +147,22 @@ import MapKit |
138 | if (merchantsData != nil) { | 147 | if (merchantsData != nil) { |
139 | DispatchQueue.main.async { | 148 | DispatchQueue.main.async { |
140 | 149 | ||
141 | - self.merchantsArray = merchantsData ?? [] | 150 | + let filteredMerchants = (merchantsData ?? []).filter({ return (($0._latitude != 0.0) && ($0._longitude != 0.0)) }) |
151 | + | ||
152 | + if (self.isMarket == true) { | ||
153 | + self.merchantsArray = filteredMerchants | ||
154 | + | ||
155 | + if let parent = (merchantsData ?? []).first(where: {(($0._latitude == 0.0) && ($0._longitude == 0.0))}) { | ||
156 | + self.parentMerchant = parent | ||
157 | + } | ||
158 | + | ||
159 | + } else { | ||
160 | + self.merchantsArray = merchantsData ?? [] | ||
161 | + } | ||
162 | + | ||
142 | self.loadMapPins() | 163 | self.loadMapPins() |
143 | 164 | ||
144 | - let filteredMerchants = self.merchantsArray.filter({ return (($0._latitude != 0.0) && ($0._longitude != 0.0)) }) | 165 | +// let filteredMerchants = self.merchantsArray.filter({ return (($0._latitude != 0.0) && ($0._longitude != 0.0)) }) |
145 | if (filteredMerchants.count == 0) { | 166 | if (filteredMerchants.count == 0) { |
146 | self.showDialog("Καταστήματα συνεργάτη", "Ο συνεργάτης διαθέτει μόνο ηλεκτρονικό κατάστημα για ηλεκτρονικές παραγγελίες.") | 167 | self.showDialog("Καταστήματα συνεργάτη", "Ο συνεργάτης διαθέτει μόνο ηλεκτρονικό κατάστημα για ηλεκτρονικές παραγγελίες.") |
147 | } | 168 | } |
... | @@ -298,7 +319,13 @@ import MapKit | ... | @@ -298,7 +319,13 @@ import MapKit |
298 | self.selectedMerchant = annotation.model | 319 | self.selectedMerchant = annotation.model |
299 | 320 | ||
300 | self.titleView.text = self.selectedMerchant?._admin_name | 321 | self.titleView.text = self.selectedMerchant?._admin_name |
301 | - self.nameImageView.load(link: self.selectedMerchant?._img_preview ?? "", placeholder: UIImage(), cache: URLCache()) | 322 | + |
323 | + if (self.isMarket == true) { | ||
324 | + self.nameImageView.load(link: self.parentMerchant?._img_preview ?? "", placeholder: UIImage(), cache: URLCache()) | ||
325 | + } else { | ||
326 | + self.nameImageView.load(link: self.selectedMerchant?._img_preview ?? "", placeholder: UIImage(), cache: URLCache()) | ||
327 | + } | ||
328 | + | ||
302 | self.nameView.text = self.selectedMerchant?._name | 329 | self.nameView.text = self.selectedMerchant?._name |
303 | // TODO: Make dynamic | 330 | // TODO: Make dynamic |
304 | self.hoursView.text = "" | 331 | self.hoursView.text = "" | ... | ... |
... | @@ -82,6 +82,7 @@ import AVFoundation | ... | @@ -82,6 +82,7 @@ import AVFoundation |
82 | // | 82 | // |
83 | let vc = SwiftWarplyFramework.MapsViewController(nibName: "MapsViewController", bundle: Bundle(for: MyEmptyClass.self)) | 83 | let vc = SwiftWarplyFramework.MapsViewController(nibName: "MapsViewController", bundle: Bundle(for: MyEmptyClass.self)) |
84 | // vc.couponSet = coupon?.couponset_data | 84 | // vc.couponSet = coupon?.couponset_data |
85 | + vc.isMarket = true | ||
85 | self.navigationController?.pushViewController(vc, animated: true) | 86 | self.navigationController?.pushViewController(vc, animated: true) |
86 | 87 | ||
87 | // if (mapBtnVisible == true) { | 88 | // if (mapBtnVisible == true) { | ... | ... |
-
Please register or login to post a comment