|
|
@ -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 |
|
|
@ -50,14 +51,11 @@ import java.util.* |
|
|
|
|
|
|
|
|
|
|
|
class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
|
|
|
|
private var _binding: FragmentBajajfdStepTwoBinding? = null |
|
|
|
private val binding get() = _binding!! |
|
|
|
|
|
|
|
private lateinit var rbBank: RadioButton |
|
|
|
private lateinit var rbPaymentMode: RadioButton |
|
|
|
private var cal = Calendar.getInstance() |
|
|
|
|
|
|
|
private lateinit var listOfTitle: List<GetCodes> |
|
|
|
private lateinit var listOfGender: List<GetCodes> |
|
|
|
private lateinit var listOfAnnualIncome: List<GetCodes> |
|
|
@ -69,10 +67,13 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
private lateinit var listOfCities: List<DataObjectX> |
|
|
|
private lateinit var listOfIFSC: MutableList<String> |
|
|
|
|
|
|
|
|
|
|
|
private lateinit var stepTwoBajajFDViewModel: StepTwoBajajFDViewModel |
|
|
|
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?, |
|
|
@ -523,6 +524,31 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
binding.btnAddBank.setOnClickListener { |
|
|
|
if (validateBank()) { |
|
|
|
/// as |
|
|
|
|
|
|
|
val selectedOption: Int = binding.rgBank!!.checkedRadioButtonId |
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// binding.radio.findViewById(selectedOption) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -532,6 +558,8 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
|
|
|
|
if ((activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.ClientBanklist?.isEmpty()!!) { |
|
|
|
binding.llBankDetails.visibility = View.VISIBLE |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
binding.llBankDetails.visibility = View.GONE |
|
|
|
} |
|
|
@ -539,15 +567,25 @@ 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() |
|
|
|
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) { |
|
|
@ -566,11 +604,12 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
binding.tvBankDetails.setOnClickListener { |
|
|
|
if (binding.llBankDetails.visibility == View.VISIBLE) { |
|
|
|
binding.llBankDetails.visibility = View.GONE |
|
|
|
|
|
|
|
} else { |
|
|
|
binding.llBankDetails.visibility = View.VISIBLE |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
binding.btnNext.setOnClickListener { |
|
|
|
if (validation()) { |
|
|
|
// Applicant Details |
|
|
@ -711,11 +750,14 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
createFDApi((activity as BajajFdMainActivity).createFDRequest) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
binding.btnBack.setOnClickListener { |
|
|
|
(activity as BajajFdMainActivity).binding.viewPager.currentItem = 0 |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private fun createFDApi(data: CreateFDRequest) { |
|
|
@ -765,7 +807,7 @@ 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 +926,100 @@ 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 +1056,35 @@ 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 |
|
|
|
private fun setUpRecyclerView( bankList: List<ClientBanklist>?, |
|
|
|
selectedAccount: String? = null) { |
|
|
|
|
|
|
|
|
|
|
|
// This code is used to get the screen dimensions of the user's device |
|
|
|
val displayMetrics = DisplayMetrics() |
|
|
|
requireActivity().windowManager.defaultDisplay.getMetrics(displayMetrics) |
|
|
|
val width = displayMetrics.widthPixels.toDouble() |
|
|
|
val height = displayMetrics.heightPixels |
|
|
|
|
|
|
|
|
|
|
|
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) |
|
|
@ -1893,6 +2045,23 @@ class StepTwoBajajFDFragment : BaseFragment() { |
|
|
|
super.onDestroyView() |
|
|
|
_binding = null |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// private fun showHideBankDetail() { |
|
|
|
// if (show_bank_details.getVisibility() == View.GONE) { |
|
|
|
// show_bank_details.setVisibility(View.VISIBLE) |
|
|
|
// addBankDetail.setCompoundDrawablesWithIntrinsicBounds( |
|
|
|
// 0, |
|
|
|
// 0, |
|
|
|
// R.drawable.ic_minus_circle, |
|
|
|
// 0 |
|
|
|
// ) |
|
|
|
// } else { |
|
|
|
// show_bank_details.setVisibility(View.GONE) |
|
|
|
// addBankDetail.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_add_icon, 0) |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|