Manos Chorianopoulos

add mulitple parentMerchants at MapVC

......@@ -34,6 +34,7 @@ import MapKit
var selectedMerchant: swiftApi.MerchantModel?
var annotationGroup = [MKPointAnnotation]()
var parentMerchant: swiftApi.MerchantModel?
var parentMerchantsArray:Array<swiftApi.MerchantModel> = []
//
var loading: Bool = false
......@@ -158,13 +159,15 @@ import MapKit
DispatchQueue.main.async {
let filteredMerchants = (merchantsData ?? []).filter({ return (($0._latitude != 0.0) && ($0._longitude != 0.0)) })
let parentMerchants = (merchantsData ?? []).filter({ return (($0._latitude == 0.0) && ($0._longitude == 0.0)) })
// if (self.isMarket == true) {
self.merchantsArray = filteredMerchants
self.parentMerchantsArray = parentMerchants
if let parent = (merchantsData ?? []).first(where: {(($0._latitude == 0.0) && ($0._longitude == 0.0))}) {
self.parentMerchant = parent
}
// if let parent = (merchantsData ?? []).first(where: {(($0._latitude == 0.0) && ($0._longitude == 0.0))}) {
// self.parentMerchant = parent
// }
// } else {
// self.merchantsArray = merchantsData ?? []
......@@ -328,6 +331,10 @@ import MapKit
private func loadPinDetailsView(_ annotation: MerchantAnnotation) {
self.selectedMerchant = annotation.model
if let parent = self.parentMerchantsArray.first(where: {($0._uuid == self.selectedMerchant?._parent)}) {
self.parentMerchant = parent
}
// self.titleView.text = self.selectedMerchant?._admin_name
self.titleView.text = self.parentMerchant?._admin_name
......