|
|
@ -23,6 +23,7 @@ import com.google.android.material.textfield.TextInputEditText |
|
|
|
import com.google.gson.Gson |
|
|
|
import com.nivesh.production.bajajfd.R |
|
|
|
import com.nivesh.production.bajajfd.adapter.BankListAdapter |
|
|
|
import com.nivesh.production.bajajfd.adapter.PaymentModeAdapter |
|
|
|
import com.nivesh.production.bajajfd.adapter.RecommendedBankListAdapter |
|
|
|
import com.nivesh.production.bajajfd.databinding.FragmentBajajfdStepTwoBinding |
|
|
|
import com.nivesh.production.bajajfd.interfaces.BajajFDInterface |
|
|
@ -38,6 +39,7 @@ import com.nivesh.production.bajajfd.util.Common.Companion.isValidEmail |
|
|
|
import com.nivesh.production.bajajfd.util.Common.Companion.isValidName |
|
|
|
import com.nivesh.production.bajajfd.util.Common.Companion.isValidPan |
|
|
|
import com.nivesh.production.bajajfd.util.Common.Companion.removeError |
|
|
|
import com.nivesh.production.bajajfd.util.Constants |
|
|
|
import com.nivesh.production.bajajfd.util.Constants.Companion.token |
|
|
|
import com.nivesh.production.bajajfd.util.Resource |
|
|
|
import com.nivesh.production.bajajfd.viewModel.StepTwoBajajFDViewModel |
|
|
@ -60,6 +62,8 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
private lateinit var listOfRelationShip: List<GetCodes> |
|
|
|
private lateinit var listOfMaritalStatus: List<GetCodes> |
|
|
|
private lateinit var listOfOccupation: List<GetCodes> |
|
|
|
private lateinit var listOfPayMode: List<GetCodes> |
|
|
|
|
|
|
|
private lateinit var listOfStates: List<DataObject> |
|
|
|
private lateinit var listOfCities: List<DataObjectX> |
|
|
|
|
|
|
@ -67,6 +71,7 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
|
|
|
|
private lateinit var stepTwoBajajFDViewModel: StepTwoBajajFDViewModel |
|
|
|
private lateinit var bankListAdapter: BankListAdapter |
|
|
|
private lateinit var paymentModeAdapter: PaymentModeAdapter |
|
|
|
private lateinit var stateObject: DataObject |
|
|
|
|
|
|
|
companion object { |
|
|
@ -98,6 +103,7 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
listOfOccupation = ArrayList() |
|
|
|
listOfStates = ArrayList() |
|
|
|
listOfIFSC = ArrayList() |
|
|
|
listOfPayMode = ArrayList() |
|
|
|
|
|
|
|
stateObject = DataObject() |
|
|
|
|
|
|
@ -122,7 +128,7 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
} |
|
|
|
}) |
|
|
|
binding.edtMobileNumber.setText((activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.mobile) |
|
|
|
|
|
|
|
binding.edtMobileNumber.setSelection(binding.edtMobileNumber.text.toString().length) |
|
|
|
// create an OnDateSetListener |
|
|
|
if (!(activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_DOB.isNullOrEmpty()) { |
|
|
|
binding.edtDOB.setText(getDate((activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_DOB.toString())) |
|
|
@ -390,7 +396,11 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
datePicker(binding.edtNomineeDOB) |
|
|
|
} |
|
|
|
|
|
|
|
binding.spNomineeRelation.setText((activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.Nominees?.get(0)?.NomineeRelationship) |
|
|
|
binding.spNomineeRelation.setText( |
|
|
|
(activity as BajajFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.Nominees?.get( |
|
|
|
0 |
|
|
|
)?.NomineeRelationship |
|
|
|
) |
|
|
|
binding.spNomineeRelation.setOnItemClickListener { _, _, _, _ -> |
|
|
|
removeError(binding.tlNomineeRelation) |
|
|
|
} |
|
|
@ -522,11 +532,11 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
rbPaymentMode.text = getString(R.string.Upi) |
|
|
|
binding.rgPaymentMode.setOnCheckedChangeListener { group, checkedId -> |
|
|
|
rbPaymentMode = group.findViewById(checkedId) |
|
|
|
Log.e("paymentMode", "-->" + rbPaymentMode.text) |
|
|
|
} |
|
|
|
// rbPaymentMode.text = getString(R.string.Upi) |
|
|
|
// binding.rgPaymentMode.setOnCheckedChangeListener { group, checkedId -> |
|
|
|
// rbPaymentMode = group.findViewById(checkedId) |
|
|
|
// Log.e("paymentMode", "-->" + rbPaymentMode.text) |
|
|
|
// } |
|
|
|
|
|
|
|
binding.tvEligibleBankOption.setOnClickListener { |
|
|
|
apiForEligibleBankList() |
|
|
@ -610,8 +620,9 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
binding.edtAddressLine3.text.toString() |
|
|
|
(activity as BajajFdMainActivity).applicantDetails.ApplicantCity = |
|
|
|
binding.spCity.text.toString() |
|
|
|
// (activity as BajajFdMainActivity).applicantDetails.ApplicantState = binding.spState.text.toString() |
|
|
|
(activity as BajajFdMainActivity).applicantDetails.ApplicantState = stateObject.State_Code |
|
|
|
// (activity as BajajFdMainActivity).applicantDetails.ApplicantState = binding.spState.text.toString() |
|
|
|
(activity as BajajFdMainActivity).applicantDetails.ApplicantState = |
|
|
|
stateObject.State_Code |
|
|
|
(activity as BajajFdMainActivity).applicantDetails.ApplicantCountry = "India" |
|
|
|
(activity as BajajFdMainActivity).applicantDetails.ApplicantPincode = |
|
|
|
binding.edtPinCode.text.toString().toInt() |
|
|
@ -763,7 +774,8 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
else -> { |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
getIFSCCodeListResponse.Response.message) |
|
|
|
getIFSCCodeListResponse.Response.message |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -771,7 +783,10 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
|
|
|
|
is Resource.Error -> { |
|
|
|
response.message?.let { message -> |
|
|
|
Common.showDialogValidation(activity as BajajFdMainActivity, message) |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
message |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
is Resource.Loading -> { |
|
|
@ -804,7 +819,8 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
else -> { |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
getIFSCCodeResponse.Response.message) |
|
|
|
getIFSCCodeResponse.Response.message |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -871,6 +887,9 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun datePicker(edtDOB: TextInputEditText) { |
|
|
|
val year = cal.get(Calendar.YEAR) |
|
|
|
val month = cal.get(Calendar.MONTH) |
|
|
@ -1024,13 +1043,15 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
occupationApi() |
|
|
|
annualIncomeApi() |
|
|
|
stateListApi() |
|
|
|
paymentModeApi() |
|
|
|
|
|
|
|
} |
|
|
|
// 650 -> refreshToken() |
|
|
|
else -> { |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
getCodeResponse.Response.Errors[0].ErrorMessage) |
|
|
|
getCodeResponse.Response.Errors[0].ErrorMessage |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1050,6 +1071,65 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private fun paymentModeApi() { |
|
|
|
if (Common.isNetworkAvailable(activity as BajajFdMainActivity)) { |
|
|
|
val getCodeRequest = GetCodeRequest() |
|
|
|
getCodeRequest.ProductName = getString(R.string.bajajFD) |
|
|
|
getCodeRequest.Category = getString(R.string.paymentModeCategory) |
|
|
|
getCodeRequest.Language = getString(R.string.language) |
|
|
|
getCodeRequest.InputValue = "" |
|
|
|
stepTwoBajajFDViewModel.paymentModeApi(getCodeRequest, Constants.token) |
|
|
|
stepTwoBajajFDViewModel.getPaymentModeMutableData.observe(viewLifecycleOwner) { response -> |
|
|
|
when (response) { |
|
|
|
is Resource.Success -> { |
|
|
|
Log.e("response", "-->$response") |
|
|
|
val getCodeResponse: GetCodeResponse = |
|
|
|
Gson().fromJson(response.data?.toString(), GetCodeResponse::class.java) |
|
|
|
getCodeResponse.Response.StatusCode.let { code -> |
|
|
|
when (code) { |
|
|
|
200 -> { |
|
|
|
if (getCodeResponse.Response.GetCodesList.isNotEmpty()){ |
|
|
|
listOfPayMode = getCodeResponse.Response.GetCodesList |
|
|
|
setUpRecyclerViewPaymentMode(listOfPayMode) |
|
|
|
} |
|
|
|
} |
|
|
|
// 650 -> refreshToken() |
|
|
|
else -> { |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
getCodeResponse.Response.Errors[0].ErrorMessage |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
is Resource.Error -> { |
|
|
|
response.message?.let { message -> |
|
|
|
Common.showDialogValidation(activity as BajajFdMainActivity, message) |
|
|
|
} |
|
|
|
} |
|
|
|
is Resource.Loading -> { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private fun setUpRecyclerViewPaymentMode(listOfPayMode: List<GetCodes>) { |
|
|
|
|
|
|
|
binding.rvPaymentMode.layoutManager = |
|
|
|
LinearLayoutManager(activity as BajajFdMainActivity) |
|
|
|
paymentModeAdapter = PaymentModeAdapter( |
|
|
|
listOfPayMode, |
|
|
|
listOfPayMode[0].Value |
|
|
|
) |
|
|
|
binding.rvPaymentMode.adapter = paymentModeAdapter |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun genderApi() { |
|
|
|
if (Common.isNetworkAvailable(activity as BajajFdMainActivity)) { |
|
|
|
val getCodeRequest = GetCodeRequest() |
|
|
@ -1085,7 +1165,8 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
else -> { |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
getCodeResponse.Response.Errors[0].ErrorMessage) |
|
|
|
getCodeResponse.Response.Errors[0].ErrorMessage |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1148,7 +1229,8 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
else -> { |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
getCodeResponse.Response.Errors[0].ErrorMessage) |
|
|
|
getCodeResponse.Response.Errors[0].ErrorMessage |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1204,7 +1286,8 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
else -> { |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
getCodeResponse.Response.Errors[0].ErrorMessage) |
|
|
|
getCodeResponse.Response.Errors[0].ErrorMessage |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1260,7 +1343,8 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
else -> { |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
getCodeResponse.Response.Errors[0].ErrorMessage) |
|
|
|
getCodeResponse.Response.Errors[0].ErrorMessage |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1316,7 +1400,8 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
else -> { |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
getCodeResponse.Response.Errors[0].ErrorMessage) |
|
|
|
getCodeResponse.Response.Errors[0].ErrorMessage |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1370,14 +1455,14 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
cityListApi(adapter.getItem(0)?.State_Id) |
|
|
|
|
|
|
|
stateObject = adapter.getItem(0) as DataObject |
|
|
|
Log.e("if", " -->"+stateObject.State_Code) |
|
|
|
Log.e("if", " -->" + stateObject.State_Code) |
|
|
|
} else { |
|
|
|
for (title in listOfStates) { |
|
|
|
if (title.State_Code == newTitleText) { |
|
|
|
binding.spState.setText(title.State_Name, false) |
|
|
|
cityListApi(title.State_Id) |
|
|
|
stateObject = title |
|
|
|
Log.e("else", " -->"+stateObject.State_Code) |
|
|
|
stateObject = title |
|
|
|
Log.e("else", " -->" + stateObject.State_Code) |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
@ -1388,7 +1473,8 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
else -> { |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
stateListResponse.response.message) |
|
|
|
stateListResponse.response.message |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1464,7 +1550,8 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
else -> { |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
cityListResponse.response.message) |
|
|
|
cityListResponse.response.message |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1505,7 +1592,8 @@ class StepTwoBajajFDFragment : Fragment() { |
|
|
|
else -> { |
|
|
|
Common.showDialogValidation( |
|
|
|
activity as BajajFdMainActivity, |
|
|
|
getFDBankListResponse.Response.Errors[0].ErrorMessage) |
|
|
|
getFDBankListResponse.Response.Errors[0].ErrorMessage |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|