|
@ -84,8 +84,9 @@ class EditReciepientViewController: UIViewController { |
|
|
didSet { |
|
|
didSet { |
|
|
self.countryTextField.text = selectedCountry?.name |
|
|
self.countryTextField.text = selectedCountry?.name |
|
|
let shouldShowProvienceField = (selectedCountry?.proviencesRequired ?? "" ) == "true" |
|
|
let shouldShowProvienceField = (selectedCountry?.proviencesRequired ?? "" ) == "true" |
|
|
self.provienceStackView.isHidden = !shouldShowProvienceField |
|
|
|
|
|
self.districtStackView.isHidden = !shouldShowProvienceField |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.configureView(isHidden: !shouldShowProvienceField) |
|
|
|
|
|
|
|
|
self.reciepient?.countryId = self.selectedCountry?.id |
|
|
self.reciepient?.countryId = self.selectedCountry?.id |
|
|
self.reciepient?.country = self.selectedCountry?.name |
|
|
self.reciepient?.country = self.selectedCountry?.name |
|
|
} |
|
|
} |
|
@ -147,7 +148,7 @@ class EditReciepientViewController: UIViewController { |
|
|
private func setup() { |
|
|
private func setup() { |
|
|
// all setup should be done here |
|
|
// all setup should be done here |
|
|
self.setupNavigation() |
|
|
self.setupNavigation() |
|
|
self.configureView() |
|
|
|
|
|
|
|
|
self.configureView(isHidden: true) |
|
|
self.configureLanguage() |
|
|
self.configureLanguage() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -179,9 +180,9 @@ class EditReciepientViewController: UIViewController { |
|
|
self.transferReasonTextField.placeholder = StringConstants().transferPlaceholder |
|
|
self.transferReasonTextField.placeholder = StringConstants().transferPlaceholder |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private func configureView() { |
|
|
|
|
|
self.provienceStackView.isHidden = true |
|
|
|
|
|
self.districtStackView.isHidden = true |
|
|
|
|
|
|
|
|
private func configureView(isHidden: Bool) { |
|
|
|
|
|
self.provienceStackView.isHidden = isHidden |
|
|
|
|
|
self.districtStackView.isHidden = isHidden |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private func setupDelegates() { |
|
|
private func setupDelegates() { |
|
@ -221,22 +222,38 @@ class EditReciepientViewController: UIViewController { |
|
|
self.firstNameTextField.text = self.reciepient?.firstName |
|
|
self.firstNameTextField.text = self.reciepient?.firstName |
|
|
self.middleNameTextField.text = self.reciepient?.middleName |
|
|
self.middleNameTextField.text = self.reciepient?.middleName |
|
|
self.lastNameTextField.text = self.reciepient?.lastName |
|
|
self.lastNameTextField.text = self.reciepient?.lastName |
|
|
let country = self.countries?.filter({ |
|
|
|
|
|
$0.name == self.reciepient?.country |
|
|
|
|
|
}).first?.name |
|
|
|
|
|
self.countryTextField.text = country |
|
|
|
|
|
self.addressTextField.text = reciepient?.address |
|
|
|
|
|
|
|
|
|
|
|
let relation = self.relations?.filter({ |
|
|
let relation = self.relations?.filter({ |
|
|
$0.title == self.reciepient?.relation |
|
|
$0.title == self.reciepient?.relation |
|
|
}).first?.title |
|
|
}).first?.title |
|
|
|
|
|
|
|
|
self.relationTextField.text = relation |
|
|
self.relationTextField.text = relation |
|
|
self.mobileTextField.text = self.reciepient?.mobileNumber |
|
|
self.mobileTextField.text = self.reciepient?.mobileNumber |
|
|
self.emailTextField.text = self.reciepient?.email |
|
|
self.emailTextField.text = self.reciepient?.email |
|
|
|
|
|
|
|
|
let transferReason = self.transferReasons?.filter({ |
|
|
let transferReason = self.transferReasons?.filter({ |
|
|
$0.title == self.reciepient?.reason |
|
|
$0.title == self.reciepient?.reason |
|
|
}).first?.title |
|
|
}).first?.title |
|
|
|
|
|
|
|
|
self.transferReasonTextField.text = transferReason |
|
|
self.transferReasonTextField.text = transferReason |
|
|
|
|
|
|
|
|
|
|
|
self.addressTextField.text = reciepient?.address |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// For sync country in reciepient model |
|
|
|
|
|
self.selectedCountry = self.countries?.filter{ |
|
|
|
|
|
$0.name == self.reciepient?.country |
|
|
|
|
|
}.first |
|
|
|
|
|
|
|
|
|
|
|
// For sync provience in reciepient model |
|
|
|
|
|
self.selectedProvience = self.selectedCountry?.proviences?.filter{ |
|
|
|
|
|
$0.id == self.reciepient?.stateId |
|
|
|
|
|
}.first |
|
|
|
|
|
|
|
|
|
|
|
// For sync district in reciepient model |
|
|
|
|
|
self.selectedDistrict = self.selectedProvience?.districts?.filter{ |
|
|
|
|
|
$0.id == self.reciepient?.districtId |
|
|
|
|
|
}.first |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private func setupNavigation() { |
|
|
private func setupNavigation() { |
|
@ -325,6 +342,8 @@ class EditReciepientViewController: UIViewController { |
|
|
($0.name ?? "") == (provience.first ?? "") |
|
|
($0.name ?? "") == (provience.first ?? "") |
|
|
}) |
|
|
}) |
|
|
self.selectedProvience = _provience.first |
|
|
self.selectedProvience = _provience.first |
|
|
|
|
|
// according to selected province, clear district |
|
|
|
|
|
self.selectedDistrict = nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func countrySelected(models: [SendMoneyCountryViewModel]) { |
|
|
func countrySelected(models: [SendMoneyCountryViewModel]) { |
|
|