|
|
@ -7,6 +7,7 @@ import android.text.Editable |
|
|
|
import android.text.InputFilter |
|
|
|
import android.text.InputFilter.LengthFilter |
|
|
|
import android.text.TextWatcher |
|
|
|
import android.util.DisplayMetrics |
|
|
|
import android.util.Log |
|
|
|
import android.view.LayoutInflater |
|
|
|
import android.view.View |
|
|
@ -73,6 +74,8 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
private lateinit var bankListAdapter: BankListAdapter |
|
|
|
private lateinit var paymentModeAdapter: PaymentModeAdapter |
|
|
|
private lateinit var stateObject: DataObject |
|
|
|
private val listOfBanks: MutableList<ClientBanklist> = mutableListOf() |
|
|
|
|
|
|
|
|
|
|
|
override fun onCreateView( |
|
|
|
inflater: LayoutInflater, container: ViewGroup?, |
|
|
@ -522,7 +525,9 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
|
|
|
|
binding.btnAddBank.setOnClickListener { |
|
|
|
if (validateBank()) { |
|
|
|
/// as |
|
|
|
val fullName= binding.edtFirstName.text.toString().plus(" ").plus(binding.edtMiddleName.text.toString()).plus(" ").plus(binding.edtLastName.text.toString()) |
|
|
|
verifyAccountNo( |
|
|
|
binding.edtAccountNumber.text.toString(), binding.edtIFSC.text.toString(), fullName, binding.edtMobileNumber.text.toString(), 1) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -539,15 +544,18 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
binding.addBankDetail.setOnClickListener { |
|
|
|
if (binding.llBankDetails.visibility == View.GONE) { |
|
|
|
binding.llBankDetails.visibility = View.VISIBLE |
|
|
|
binding.addBankDetail.setCompoundDrawablesWithIntrinsicBounds(0,0,R.drawable.ic_minus,0) |
|
|
|
|
|
|
|
} else { |
|
|
|
binding.llBankDetails.visibility = View.GONE |
|
|
|
binding.addBankDetail.setCompoundDrawablesWithIntrinsicBounds(0,0,R.drawable.ic_add_icon,0) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
titleApi() |
|
|
|
|
|
|
|
setUpRecyclerView() |
|
|
|
setUpRecyclerView( |
|
|
|
(activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.ClientBanklist, |
|
|
|
(activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_ACCNO1) |
|
|
|
|
|
|
|
binding.tvPersonalDetails.setOnClickListener { |
|
|
|
if (binding.llPersonalDetail.visibility == View.VISIBLE) { |
|
|
@ -763,9 +771,8 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun ifscCodeCheckApi(ifsc: String) { |
|
|
|
if (ifsc.length >8) { |
|
|
|
if (ifsc.length ==11) { |
|
|
|
stepTwoBajajFDViewModel.ifscCodeApi(ifsc, activity as BajajFdMainActivity) |
|
|
|
stepTwoBajajFDViewModel.getIfscCodeCheckMutableData.observe(viewLifecycleOwner) { response -> |
|
|
|
when (response) { |
|
|
@ -884,6 +891,74 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private fun verifyAccountNo(bankAccount :String,Ifsc :String,name:String,phoneNumber:String,bankNo:Int) { |
|
|
|
|
|
|
|
val bankValidationApiRequest = BankValidationApiRequest() |
|
|
|
bankValidationApiRequest.BankAccountNo=bankAccount |
|
|
|
bankValidationApiRequest.IFSC=Ifsc |
|
|
|
bankValidationApiRequest.Name=name |
|
|
|
bankValidationApiRequest.PhoneNo=phoneNumber |
|
|
|
bankValidationApiRequest.RoleId=5 |
|
|
|
bankValidationApiRequest.BankNo=bankNo |
|
|
|
stepTwoBajajFDViewModel.bankValidationApi(bankValidationApiRequest, token, activity as BajajFdMainActivity) |
|
|
|
stepTwoBajajFDViewModel.bankValidationApiMutableData.observe(viewLifecycleOwner) { response -> |
|
|
|
when (response) { |
|
|
|
is Resource.Success -> { |
|
|
|
val getBankValidationApiResponse = |
|
|
|
Gson().fromJson( |
|
|
|
response.data?.toString(), |
|
|
|
BankValidationApiResponse::class.java |
|
|
|
) |
|
|
|
getBankValidationApiResponse.response.status_code.let { code -> |
|
|
|
if (binding.tvAcVerify.visibility == View.GONE) { |
|
|
|
binding.tvAcVerify.visibility = View.VISIBLE |
|
|
|
} |
|
|
|
|
|
|
|
when (code) { |
|
|
|
200 -> { |
|
|
|
if(getBankValidationApiResponse.Message=="Account verified") { |
|
|
|
val clientBankList =ClientBanklist() |
|
|
|
clientBankList.AccountNumber=bankAccount |
|
|
|
clientBankList.AccountType="sb" |
|
|
|
clientBankList.BankName=binding.edtBankName.text.toString() |
|
|
|
clientBankList.BranchName=binding.edtBankBranch.text.toString() |
|
|
|
clientBankList.IFSCCode=Ifsc |
|
|
|
clientBankList.IsValBank=1 |
|
|
|
(activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.ClientBanklist?.let { |
|
|
|
listOfBanks.addAll( |
|
|
|
it |
|
|
|
) |
|
|
|
} |
|
|
|
listOfBanks.add(clientBankList) |
|
|
|
setUpRecyclerView(listOfBanks , clientBankList.AccountNumber.toString()) |
|
|
|
} |
|
|
|
else { |
|
|
|
Common.showDialogValidation(activity as BajajFdMainActivity, getBankValidationApiResponse.Message) |
|
|
|
} |
|
|
|
} |
|
|
|
else -> { |
|
|
|
Common.showDialogValidation(activity as BajajFdMainActivity, getBankValidationApiResponse.Message) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
is Resource.Error -> { |
|
|
|
response.message?.let { message -> |
|
|
|
Common.showDialogValidation(activity as BajajFdMainActivity, message) |
|
|
|
} |
|
|
|
} |
|
|
|
is Resource.Loading -> { |
|
|
|
|
|
|
|
} |
|
|
|
is Resource.DataError -> { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private fun validateBank(): Boolean { |
|
|
|
return if (binding.edtIFSC.text.toString().isEmpty()) { // EditText |
|
|
|
commonErrorAutoCompleteMethod( |
|
|
@ -920,19 +995,19 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private fun setUpRecyclerView() { |
|
|
|
if ((activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.ClientBanklist?.isNotEmpty()!!) { |
|
|
|
binding.rvClientBankList.layoutManager = |
|
|
|
LinearLayoutManager(activity as BajajFdMainActivity) |
|
|
|
bankListAdapter = BankListAdapter( |
|
|
|
(activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.ClientBanklist, |
|
|
|
(activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_ACCNO1 |
|
|
|
) |
|
|
|
binding.rvClientBankList.adapter = bankListAdapter |
|
|
|
} |
|
|
|
private fun setUpRecyclerView( bankList: List<ClientBanklist>?, selectedAccount: String? = null) { |
|
|
|
val displayMetrics = DisplayMetrics() |
|
|
|
requireActivity().windowManager.defaultDisplay.getMetrics(displayMetrics) |
|
|
|
val width = displayMetrics.widthPixels.toDouble() |
|
|
|
binding.rvClientBankList.layoutManager = LinearLayoutManager( |
|
|
|
mActivity, |
|
|
|
LinearLayoutManager.HORIZONTAL, |
|
|
|
false |
|
|
|
) |
|
|
|
bankListAdapter = BankListAdapter(bankList, selectedAccount,width) |
|
|
|
binding.rvClientBankList.adapter = bankListAdapter |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun datePicker(edtDOB: TextInputEditText) { |
|
|
|
val year = cal.get(Calendar.YEAR) |
|
|
|
val month = cal.get(Calendar.MONTH) |
|
|
@ -942,7 +1017,6 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
if (monthOfYear.toString().length == 1) { |
|
|
|
"0".plus(monthOfYear) |
|
|
|
} |
|
|
|
// edtDOB.setText(getDate(dayOfMonth.toString() + "-" + (monthOfYear + 1) + "-" + years)) |
|
|
|
edtDOB.setText( |
|
|
|
years.toString().plus("-").plus(monthOfYear + 1).plus("-") |
|
|
|
.plus(dayOfMonth.toString()) |
|
|
@ -1162,7 +1236,6 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
binding.rvPaymentMode.adapter = paymentModeAdapter |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun genderApi() { |
|
|
|
val getCodeRequest = GetCodeRequest() |
|
|
|
getCodeRequest.ProductName = getString(R.string.bajajFD) |
|
|
|