|
@ -56,6 +56,7 @@ class KycForm1ViewController: UIViewController { |
|
|
|
|
|
|
|
|
// MARK: IBOutlets |
|
|
// MARK: IBOutlets |
|
|
|
|
|
|
|
|
|
|
|
@IBOutlet weak var scrollView: UIScrollView! |
|
|
// validation labels |
|
|
// validation labels |
|
|
@IBOutlet weak var firstNameErrorLabel: UILabel! |
|
|
@IBOutlet weak var firstNameErrorLabel: UILabel! |
|
|
@IBOutlet weak var middleNameErrorLabel: UILabel! |
|
|
@IBOutlet weak var middleNameErrorLabel: UILabel! |
|
@ -207,7 +208,19 @@ class KycForm1ViewController: UIViewController { |
|
|
private func setupErrorTextFields() { |
|
|
private func setupErrorTextFields() { |
|
|
|
|
|
|
|
|
self.textfields = [firstNameTextField, lastNameTextField, middleNmaeTextField, genderTextField, dobTextField, mobileNumberTextField, emailTextField, nativeCountryTextField, countryTextField, provinceTextField, occupationTextField] |
|
|
self.textfields = [firstNameTextField, lastNameTextField, middleNmaeTextField, genderTextField, dobTextField, mobileNumberTextField, emailTextField, nativeCountryTextField, countryTextField, provinceTextField, occupationTextField] |
|
|
|
|
|
|
|
|
|
|
|
firstNameTextField.tag = 1 |
|
|
|
|
|
middleNmaeTextField.tag = 2 |
|
|
|
|
|
lastNameTextField.tag = 3 |
|
|
|
|
|
genderTextField.tag = 4 |
|
|
|
|
|
dobTextField.tag = 5 |
|
|
|
|
|
mobileNumberTextField.tag = 6 |
|
|
|
|
|
emailTextField.tag = 7 |
|
|
|
|
|
nativeCountryTextField.tag = 8 |
|
|
|
|
|
countryTextField.tag = 9 |
|
|
|
|
|
provinceTextField.tag = 10 |
|
|
|
|
|
occupationTextField.tag = 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.errorTextFieldDict = |
|
|
self.errorTextFieldDict = |
|
|
[ |
|
|
[ |
|
|
KycForm1FieldKeys.firstName: self.firstNameTextField, |
|
|
KycForm1FieldKeys.firstName: self.firstNameTextField, |
|
@ -232,6 +245,7 @@ class KycForm1ViewController: UIViewController { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private func show( error: String, label: UILabel?) { |
|
|
private func show( error: String, label: UILabel?) { |
|
|
|
|
|
// scroll to the top of the view |
|
|
guard let label = label else {return} |
|
|
guard let label = label else {return} |
|
|
label.textColor = Constants.stateRedColor |
|
|
label.textColor = Constants.stateRedColor |
|
|
label.isHidden = false |
|
|
label.isHidden = false |
|
@ -242,6 +256,7 @@ class KycForm1ViewController: UIViewController { |
|
|
// MARK: KycForm1ViewInterface |
|
|
// MARK: KycForm1ViewInterface |
|
|
extension KycForm1ViewController: KycForm1ViewInterface { |
|
|
extension KycForm1ViewController: KycForm1ViewInterface { |
|
|
func show(result: (doesNotSucks: Bool, errorsDick: [String : String])) { |
|
|
func show(result: (doesNotSucks: Bool, errorsDick: [String : String])) { |
|
|
|
|
|
var position = 11 |
|
|
if result.doesNotSucks { // if isValid |
|
|
if result.doesNotSucks { // if isValid |
|
|
// its is not valid, lets go to security page |
|
|
// its is not valid, lets go to security page |
|
|
self.delegate?._continue(model: self.kycModel) |
|
|
self.delegate?._continue(model: self.kycModel) |
|
@ -251,6 +266,15 @@ extension KycForm1ViewController: KycForm1ViewInterface { |
|
|
self.show(error: $0.value, label: label) |
|
|
self.show(error: $0.value, label: label) |
|
|
let textfield = errorTextFieldDict[$0.key] |
|
|
let textfield = errorTextFieldDict[$0.key] |
|
|
self.showBorder(textfield: textfield) |
|
|
self.showBorder(textfield: textfield) |
|
|
|
|
|
let tag = (textfield?.tag ?? 11) |
|
|
|
|
|
position = tag < position ? tag : position |
|
|
|
|
|
if let topMostTextField = self.textfields.filter({ |
|
|
|
|
|
$0.tag == tag |
|
|
|
|
|
}).first { |
|
|
|
|
|
|
|
|
|
|
|
// scroll to view here |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
@ -397,4 +421,3 @@ extension KycForm1ViewController { |
|
|
self.selectedOccupation = _occupation |
|
|
self.selectedOccupation = _occupation |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|