|
|
@ -57,6 +57,10 @@ public class ExistingCustomerDetailFragment extends BaseFragment implements Exis |
|
|
|
@BindView(R.id.ed_employerName) |
|
|
|
EditText ed_employerName; |
|
|
|
|
|
|
|
@BindView(R.id.ed_occupation) |
|
|
|
EditText ed_occupation; |
|
|
|
|
|
|
|
|
|
|
|
@BindView(R.id.ed_sourceOfFund) |
|
|
|
EditText ed_sourceOfFund; |
|
|
|
|
|
|
@ -96,6 +100,7 @@ public class ExistingCustomerDetailFragment extends BaseFragment implements Exis |
|
|
|
Button btnSubmit1; |
|
|
|
|
|
|
|
|
|
|
|
private GenericTextListingDialog<ExistingIDTextDTO> occupationSelectionDialog; |
|
|
|
private GenericTextListingDialog<ExistingIDTextDTO> sourceOfFundSelectionDialog; |
|
|
|
private GenericTextListingDialog<ExistingIDTextDTO> monthlyIncomeSelectionDialog; |
|
|
|
private GenericTextListingDialog<ExistingIDTextDTO> busineessTypeSelectionDialog; |
|
|
@ -103,6 +108,7 @@ public class ExistingCustomerDetailFragment extends BaseFragment implements Exis |
|
|
|
private GenericTextListingDialog<ExistingIDTextDTO> idTypeSelectionDialog; |
|
|
|
private GenericTextListingDialog<ExistingIDTextDTO> visaStatusSelectionDialog; |
|
|
|
|
|
|
|
private PublishSubject<ExistingIDTextDTO> occupationSelectSubject; |
|
|
|
private PublishSubject<ExistingIDTextDTO> sourceOfFundSelectSubject; |
|
|
|
private PublishSubject<ExistingIDTextDTO> monthlyIncomeSelectSubject; |
|
|
|
private PublishSubject<ExistingIDTextDTO> businessTypeSelectSubject; |
|
|
@ -130,6 +136,7 @@ public class ExistingCustomerDetailFragment extends BaseFragment implements Exis |
|
|
|
|
|
|
|
private void init() { |
|
|
|
|
|
|
|
occupationSelectSubject = PublishSubject.create(); |
|
|
|
sourceOfFundSelectSubject = PublishSubject.create(); |
|
|
|
monthlyIncomeSelectSubject = PublishSubject.create(); |
|
|
|
businessTypeSelectSubject = PublishSubject.create(); |
|
|
@ -140,6 +147,7 @@ public class ExistingCustomerDetailFragment extends BaseFragment implements Exis |
|
|
|
|
|
|
|
customerDetailViewBinding = new ExistingCustomerDetailViewLiveData.CustomerDetailViewBinding( |
|
|
|
RxTextView.textChanges(ed_employerName).skipInitialValue(), |
|
|
|
occupationSelectSubject, |
|
|
|
sourceOfFundSelectSubject, |
|
|
|
monthlyIncomeSelectSubject, |
|
|
|
RxTextView.textChanges(ed_mobileNumber).skipInitialValue(), |
|
|
@ -164,12 +172,21 @@ public class ExistingCustomerDetailFragment extends BaseFragment implements Exis |
|
|
|
existingCustomerDetailViewLiveData.getMonthlyIncomeLiveData().observe(getViewLifecycleOwner(), this::onMonthlyIncomeSelected); |
|
|
|
existingCustomerDetailViewLiveData.getEmployerNameLiveData().observe(getViewLifecycleOwner(), this::onEmployerNameSelected); |
|
|
|
existingCustomerDetailViewLiveData.getSourceOfFundLiveData().observe(getViewLifecycleOwner(), this::onSourceOfFundSelected); |
|
|
|
existingCustomerDetailViewLiveData.getOccupationsLiveData().observe(getViewLifecycleOwner(), this::onOccupationSelected); |
|
|
|
existingCustomerDetailViewLiveData.getVisaStatusLiveData().observe(getViewLifecycleOwner(), this::onVisaStatusSelected); |
|
|
|
existingCustomerDetailViewLiveData.getAllFieldsValidLiveData().observe(getViewLifecycleOwner(), areAllFieldsValid -> btnSubmit1.setEnabled(areAllFieldsValid)); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void onOccupationSelected(FormInputStateDTO<ExistingIDTextDTO> data) { |
|
|
|
if (data.isValid()) { |
|
|
|
if (data.hasData()) { |
|
|
|
ed_occupation.setText(data.getData().getText()); |
|
|
|
occupationSelectSubject.onNext(data.getData()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
private void onSourceOfFundSelected(FormInputStateDTO<ExistingIDTextDTO> data) { |
|
|
|
if (data.isValid()) { |
|
|
|
if (data.hasData()) { |
|
|
@ -406,6 +423,26 @@ public class ExistingCustomerDetailFragment extends BaseFragment implements Exis |
|
|
|
if (!sourceOfFundSelectionDialog.isAdded()) |
|
|
|
sourceOfFundSelectionDialog.show(getActivity().getSupportFragmentManager(), "SOURCEOFFUNDTYPECHOOSER"); |
|
|
|
} |
|
|
|
@OnClick(R.id.ed_occupation) |
|
|
|
public void promptOccupation() { |
|
|
|
hideKeyBoard(); |
|
|
|
if (occupationSelectionDialog == null) |
|
|
|
occupationSelectionDialog = new GenericTextListingDialog<>(); |
|
|
|
|
|
|
|
|
|
|
|
occupationSelectionDialog.setData(kycv3ViewModel.getOccupationList()); |
|
|
|
occupationSelectionDialog.disableSearch(true); |
|
|
|
occupationSelectionDialog.setListener(occupation -> |
|
|
|
{ |
|
|
|
occupationSelectionDialog.dismiss(); |
|
|
|
ed_occupation.setText(occupation.toString()); |
|
|
|
occupationSelectSubject.onNext(occupation); |
|
|
|
}); |
|
|
|
|
|
|
|
occupationSelectionDialog.setHintAndTitle(getString(R.string.searchOccupation), getString(R.string.selectOccupation), getString(R.string.no_result_found_text)); |
|
|
|
if (!occupationSelectionDialog.isAdded()) |
|
|
|
occupationSelectionDialog.show(getActivity().getSupportFragmentManager(), "OCCUPATIONCHOOSER"); |
|
|
|
} |
|
|
|
|
|
|
|
@OnClick(R.id.ed_monthlyIncome) |
|
|
|
public void promptMonthlyIncome() { |
|
|
|