Showing
1 changed file
with
10 additions
and
3 deletions
... | @@ -34,6 +34,7 @@ import MapKit | ... | @@ -34,6 +34,7 @@ import MapKit |
34 | var selectedMerchant: swiftApi.MerchantModel? | 34 | var selectedMerchant: swiftApi.MerchantModel? |
35 | var annotationGroup = [MKPointAnnotation]() | 35 | var annotationGroup = [MKPointAnnotation]() |
36 | var parentMerchant: swiftApi.MerchantModel? | 36 | var parentMerchant: swiftApi.MerchantModel? |
37 | + var parentMerchantsArray:Array<swiftApi.MerchantModel> = [] | ||
37 | 38 | ||
38 | // | 39 | // |
39 | var loading: Bool = false | 40 | var loading: Bool = false |
... | @@ -158,13 +159,15 @@ import MapKit | ... | @@ -158,13 +159,15 @@ import MapKit |
158 | DispatchQueue.main.async { | 159 | DispatchQueue.main.async { |
159 | 160 | ||
160 | let filteredMerchants = (merchantsData ?? []).filter({ return (($0._latitude != 0.0) && ($0._longitude != 0.0)) }) | 161 | let filteredMerchants = (merchantsData ?? []).filter({ return (($0._latitude != 0.0) && ($0._longitude != 0.0)) }) |
162 | + let parentMerchants = (merchantsData ?? []).filter({ return (($0._latitude == 0.0) && ($0._longitude == 0.0)) }) | ||
161 | 163 | ||
162 | // if (self.isMarket == true) { | 164 | // if (self.isMarket == true) { |
163 | self.merchantsArray = filteredMerchants | 165 | self.merchantsArray = filteredMerchants |
166 | + self.parentMerchantsArray = parentMerchants | ||
164 | 167 | ||
165 | - if let parent = (merchantsData ?? []).first(where: {(($0._latitude == 0.0) && ($0._longitude == 0.0))}) { | 168 | +// if let parent = (merchantsData ?? []).first(where: {(($0._latitude == 0.0) && ($0._longitude == 0.0))}) { |
166 | - self.parentMerchant = parent | 169 | +// self.parentMerchant = parent |
167 | - } | 170 | +// } |
168 | 171 | ||
169 | // } else { | 172 | // } else { |
170 | // self.merchantsArray = merchantsData ?? [] | 173 | // self.merchantsArray = merchantsData ?? [] |
... | @@ -328,6 +331,10 @@ import MapKit | ... | @@ -328,6 +331,10 @@ import MapKit |
328 | private func loadPinDetailsView(_ annotation: MerchantAnnotation) { | 331 | private func loadPinDetailsView(_ annotation: MerchantAnnotation) { |
329 | self.selectedMerchant = annotation.model | 332 | self.selectedMerchant = annotation.model |
330 | 333 | ||
334 | + if let parent = self.parentMerchantsArray.first(where: {($0._uuid == self.selectedMerchant?._parent)}) { | ||
335 | + self.parentMerchant = parent | ||
336 | + } | ||
337 | + | ||
331 | // self.titleView.text = self.selectedMerchant?._admin_name | 338 | // self.titleView.text = self.selectedMerchant?._admin_name |
332 | self.titleView.text = self.parentMerchant?._admin_name | 339 | self.titleView.text = self.parentMerchant?._admin_name |
333 | 340 | ... | ... |
-
Please register or login to post a comment