Browse Source

Back Button Added and Validation added in Send money

pull/7/head
yare 3 years ago
parent
commit
d16dfaa281
  1. 15
      GME Remit/Modules/RegisterModules/UserAuthentication/NewRegister/User Interface/View/NewRegisterViewController.swift
  2. 54
      GME Remit/Modules/RemittanceModules/OverseasModules/CDDIViewController/User Interface/View/CDDIViewControllerViewController.swift

15
GME Remit/Modules/RegisterModules/UserAuthentication/NewRegister/User Interface/View/NewRegisterViewController.swift

@ -58,7 +58,7 @@ class NewRegisterViewController: UIViewController {
title = "new_registration_title_text".localized() title = "new_registration_title_text".localized()
setupNormalNavigation() setupNormalNavigation()
navigationItem.setHidesBackButton(true, animated: true)
//navigationItem.setHidesBackButton(true, animated: true)
if self.presentingViewController != nil { if self.presentingViewController != nil {
let closeButton = UIBarButtonItem( let closeButton = UIBarButtonItem(
@ -68,6 +68,15 @@ class NewRegisterViewController: UIViewController {
action: #selector(close) action: #selector(close)
) )
navigationItem.leftBarButtonItem = closeButton
} else {
let closeButton = UIBarButtonItem(
image: UIImage(named: "ic_back_button"),
style: .plain,
target: self,
action: #selector(back)
)
navigationItem.leftBarButtonItem = closeButton navigationItem.leftBarButtonItem = closeButton
} }
@ -173,7 +182,9 @@ extension NewRegisterViewController {
@objc private func close() { @objc private func close() {
dismiss(animated: true, completion: nil) dismiss(animated: true, completion: nil)
} }
@objc private func back() {
self.navigationController?.popToRootViewController(animated: true)
}
func setMultilanguages() { func setMultilanguages() {
step1TitleLabel.text = "step1_sub_title_text".localized() step1TitleLabel.text = "step1_sub_title_text".localized()
step2TitleLabel.text = "documents_text".localized() step2TitleLabel.text = "documents_text".localized()

54
GME Remit/Modules/RemittanceModules/OverseasModules/CDDIViewController/User Interface/View/CDDIViewControllerViewController.swift

@ -44,8 +44,17 @@ class CDDIViewControllerViewController: UIViewController {
// MARK: IBActions // MARK: IBActions
@IBAction func continueButton(_ sender: UIButton) { @IBAction func continueButton(_ sender: UIButton) {
view.endEditing(true) view.endEditing(true)
let model = CDDIRequestData(sourceOfFund: fund, purposeOfRemittance: purpose)
actionDelegate?.continueToVerificationAction(model: model)
if self.sourceOfFund.text == "Others (please specify)" {
self.alert(message: "Please Enter Others Source of Fund")
}
if self.purposeOfRemit.text == "Other (please specify)" {
self.alert(message: "Please Enter Others Purpose of Remit")
}
else if self.sourceOfFund.text != "Others (please specify)" && self.purposeOfRemit.text != "Other (please specify)" {
let model = CDDIRequestData(sourceOfFund: fund, purposeOfRemittance: purpose)
actionDelegate?.continueToVerificationAction(model: model)
}
} }
// MARK: Other Functions // MARK: Other Functions
@ -76,11 +85,41 @@ class CDDIViewControllerViewController: UIViewController {
let alert = UIAlertController(title: "specifySourceOfFund_text".localized(), message: "", preferredStyle: .alert) let alert = UIAlertController(title: "specifySourceOfFund_text".localized(), message: "", preferredStyle: .alert)
alert.addTextField(configurationHandler: nil) alert.addTextField(configurationHandler: nil)
alert.addAction(UIAlertAction(title: "Submit", style: .default, handler: { [weak alert] (_) in alert.addAction(UIAlertAction(title: "Submit", style: .default, handler: { [weak alert] (_) in
guard let textField = alert?.textFields?.first else { return }
let setSourceOfFund = KeyValue(id: textField.text ?? "", value: textField.text ?? "")
self.sourceOfFund.didSelect(
item: setSourceOfFund
)
let textField = alert?.textFields?.first
//else { return }
if textField?.text == "" || textField?.text?.isEmpty ?? true {
self.alert(message: "Please Enter Others Source of Fund")
} else {
let setSourceOfFund = KeyValue(id: textField?.text ?? "", value: textField?.text ?? "")
self.sourceOfFund.didSelect(
item: setSourceOfFund
)
}
}))
self.present(alert, animated: true, completion: nil)
}
}
return $0 as? KeyValue
}.asDriverOnErrorJustComplete(),
purpose: purposeOfRemit.selectedItem.map {
if $0?.cellTitle == "Other (please specify)" {
DispatchQueue.main.async {
let alert = UIAlertController(title: "specifySourceOfFund_text".localized(), message: "", preferredStyle: .alert)
alert.addTextField(configurationHandler: nil)
alert.addAction(UIAlertAction(title: "Submit", style: .default, handler: { [weak alert] (_) in
let textField = alert?.textFields?.first
//else { return }
if textField?.text == "" || textField?.text?.isEmpty ?? true {
self.alert(message: "Please Enter Others Source of Fund")
} else {
let setSourceOfFund = KeyValue(id: textField?.text ?? "", value: textField?.text ?? "")
self.sourceOfFund.didSelect(
item: setSourceOfFund
)
}
})) }))
self.present(alert, animated: true, completion: nil) self.present(alert, animated: true, completion: nil)
} }
@ -88,7 +127,6 @@ class CDDIViewControllerViewController: UIViewController {
return $0 as? KeyValue return $0 as? KeyValue
}.asDriverOnErrorJustComplete(), }.asDriverOnErrorJustComplete(),
purpose: purposeOfRemit.selectedItem.map{$0 as? KeyValue}.asDriverOnErrorJustComplete(),
submit: continueButton.rx.tap.asDriverOnErrorJustComplete() submit: continueButton.rx.tap.asDriverOnErrorJustComplete()
) )

Loading…
Cancel
Save