Loan Details Component Code
Loan Details Component Code
emiamount = () => {
if (this.state.valueRateofInterest.value != '' &&
this.state.valueRateofInterest.value != null &&
this.state.valueRateofInterest.isValid) {
if (this.state.valuetR % 2) {
let aa = (parseFloat(this.state.valueaR))
// console.log("aa",aa);
// + (this.state.selectedSourceType2 === "Yes" ?
parseFloat(this.state.premiumAmount.value) : 0));
let a = (aa / 100) * parseFloat(this.state.valueRateofInterest.value);
let b = parseFloat(this.state.valuetR + 1) / 12;
let c = parseFloat(aa) + parseFloat(a * b);
emi = Math.ceil(emi);
return this.setState({ emi })
} else {
let aa = ((parseFloat(this.state.valueaR)))
// + (parseFloat(this.state.selectedSourceType2 === "Yes" ?
this.state.premiumAmount.value : 0)));
let a = (aa / 100) * (this.state.valueRateofInterest.value);
let b = this.state.valuetR / 12;
let c = parseFloat(aa) + parseFloat(a * b);
let emi = c / this.state.valuetR;
// console.log("a", a);
// console.log("b", b);
// console.log("c", c);
// console.log("aa", aa);
// when,48600+(((48600/100)*10) *(24/12)) / 24
// EMI=2439
emi = Math.ceil(emi);
return this.setState({ emi })
}
}
}
isNameNominee(text) {
let valid = false;
const customerRegex = /^[a-zA-Z ]*$/;
if (text != '' && text != null && customerRegex.test(text)) {
valid = true;
}
this.setState({
nameNominee: {
...this.state.nameNominee,
isValid: valid,
},
});
}
isRelation() {
if (this.state.selectedRelation.value == null) {
this.setState({ selectedRelation: { isValid: false } });
}
}
isDobValid() {
this.setState({ dobValid: this.state.dateOfIncorporationText !== '' ? true :
false })
}
isSelectedSourceValid() {
this.setState({ selectedSourceValid: false })
}
isSelectedSourceValid2() {
this.setState({ selectedSourceValid2: false })
}
isSelectedSourceValid3() {
this.setState({ selectedSourceValid3: false })
}
isSelectedSourceValid4() {
this.setState({ selectedSourceValid4: false })
}
isSelectedSourceValid5() {
this.setState({ selectedSourceValid5: false })
}
isValidAmount() {
this.setState({ validAmount: false })
}
isAddressNominee(text) {
let valid = false;
const addressRegex = /.*/;
if (text != "" && text != null && addressRegex.test(text)) {
valid = true;
}
this.setState({
addressNominee: {
...this.state.addressNominee,
isValid: valid,
}
});
}
isSelectedRelation() {
if (this.state.selectedRelation.value == null) {
this.setState({ selectedRelation: { isValid: false } });
}
}
isLoanVehicleDetails() {
if (this.state.loanVehicleDetails.value == null) {
this.setState({ loanVehicleDetails: { isValid: false } });
}
}
isDealerPayoutType() {
if (this?.state?.dealerPayout?.value == '') {
this.setState({ dealerPayoutType: { isValid: false } }, () => {
});
}
else if (this?.state?.dealerPayout?.value == null) {
this.setState({ dealerPayoutType: { isValid: false } }, () => {
});
}
}
isPFType() {
if (this.state.pfAmountType.value == null) {
this.setState({ pfAmountType: { isValid: false } });
}
}
isLoanVehicleBrand() {
if (this.state.loanVehicleBrand.value == null) {
this.setState({ loanVehicleBrand: { isValid: false } });
}
}
isLoanVehicleModel() {
if (this.state.loanVehicleModel.value == null) {
this.setState({ loanVehicleModel: { isValid: false } });
}
}
isLoanVehicleSubModel() {
if (this.state.loanVehicleSubModel.value == null) {
this.setState({ loanVehicleSubModel: { isValid: false } });
}
}
isSelectedDealer() {
if (this.state.selectedDealer.value == null) {
this.setState({ selectedDealer: { isValid: false } });
}
}
isSechemeCode() {
if (this.state.selectedSchemeCode.value == null) {
this.setState({ selectedSchemeCode: { isValid: false } });
}
}
isDealerCharges(text) {
let valid = false;
const pincodeRegex = /^\d+$/;
if (text != '' && text != null && pincodeRegex.test(text)) {
valid = true;
}
this.setState({
dealerCharges: {
...this.state.dealerCharges,
isValid: valid,
},
});
}
isProcessingFees(text) {
}
}
isInsuranceAmount(text) {
let valid = false;
const pincodeRegex = /^\d+$/;
if (text != '' && text != null && pincodeRegex.test(text)) {
valid = true;
}
this.setState({
insuranceAmount: {
...this.state.insuranceAmount,
isValid: valid,
},
});
}
isBureauCharges(text) {
let valid = false;
const pincodeRegex = /^\d+$/;
if (text != '' && text != null && pincodeRegex.test(text)) {
valid = true;
}
this.setState({
bureauCharges: {
...this.state.bureauCharges,
isValid: valid,
},
});
}
isStampDuty(text) {
let valid = false;
const pincodeRegex = /^\d+$/;
if (text != '' && text != null && pincodeRegex.test(text) && Number(text) >=
Number(this.state.stampDutyMaster)) {
valid = true;
}
this.setState({
stampDuty: {
...this.state.stampDuty,
isValid: valid,
},
});
}
isDealerPayout(text) {
let valid = false;
if (this.state.dealerPayoutType.value === 'Number') {
const pincodeRegex = /^\d+$/;
if (text != '' && text != null && pincodeRegex.test(text)) {
valid = true;
}
this.setState({
dealerPayout: {
...this.state.dealerPayout,
isValid: valid,
},
});
}
else if (this.state.dealerPayoutType.value === 'Percent') {
const pincodeRegex = /^(100|([0-9][0-9]?(\.[0-9]+)?))$/;
if (text != '' && text != null && text >= 1 && text <= 100 &&
pincodeRegex.test(text)) {
valid = true;
this.setState({
dealerPayout: {
...this.state.dealerPayout,
isValid: valid,
},
});
}
else {
valid = false;
this.setState({
dealerPayout: {
...this.state.dealerPayout,
isValid: valid,
},
});
}
}
else {
this.setState({
dealerPayout: {
...this.state.dealerPayout,
isValid: valid,
},
});
}
}
isPremiumAmount(text) {
let valid = false;
const pincodeRegex = /^\d+$/;
if (text != '' && text != null && pincodeRegex.test(text)) {
valid = true;
}
this.setState({
premiumAmount: {
...this.state.premiumAmount,
isValid: valid,
},
});
}
checkPremiumAmount(text){
this.setState({
defaultPremiumAmount: {
...this.state.defaultPremiumAmount,
isValid: false,
},
});
} else {
this.setState({
defaultPremiumAmount: {
...this.state.defaultPremiumAmount,
isValid: true,
},
});
}
isOtherCharges(text) {
let valid = false;
const pincodeRegex = /^\d+$/;
if (text != '' && text != null && pincodeRegex.test(text)) {
valid = true;
}
this.setState({
otherCharges: {
...this.state.otherCharges,
isValid: valid,
},
});
}
isDealerSubvention(text) {
let valid = false;
const pincodeRegex = /^\d+$/;
if (text == 0) {
valid = true
}
else if (text != '' && text != null && pincodeRegex.test(text)) {
valid = true;
}
this.setState({
dealerSubvention: {
...this.state.dealerSubvention,
isValid: valid,
},
});
}
isAdminFees(text) {
let valid = false;
const pincodeRegex = /^\d+$/;
if (text == 0) {
valid = true
}
else if (text != '' && text != null && pincodeRegex.test(text)) {
valid = true;
}
this.setState({
adminFees: {
...this.state.adminFees,
isValid: valid,
},
});
}
isInsurance(text) {
let valid = false;
const pincodeRegex = /^\d+$/;
if (text === 0) {
valid = true
}
else if (text != '' && text != null && pincodeRegex.test(text)) {
valid = true;
}
this.setState({
insurance: {
...this.state.insurance,
isValid: valid,
},
});
}
isOnRoadPrice(text) {
let valid = false;
const pincodeRegex = /^\d+$/;
if (text === 0) {
valid = true
}
else if (text != '' && text != null && pincodeRegex.test(text)) {
valid = true;
}
this.setState({
onRoadPrice: {
...this.state.onRoadPrice,
isValid: valid,
},
});
}
isUserInputEmi(text) {
let valid = false;
const pincodeRegex = /^\d+$/;
if (text === 0) {
valid = true
}
else if (text != '' && text != null && pincodeRegex.test(text)) {
valid = true;
}
this.setState({
userInputEmi: {
...this.state.userInputEmi,
isValid: valid,
},
});
}
isExShowRoomPrice(text) {
let valid = false;
const pincodeRegex = /^\d+$/;
if (text === 0) {
valid = true
}
else if (text != '' && text != null && pincodeRegex.test(text)) {
valid = true;
}
this.setState({
exShowroomPrice: {
...this.state.exShowroomPrice,
isValid: valid,
},
});
}
isNachCharges(text) {
let valid = false;
if (text === 0) {
valid = true
}
else if (text != '' && text != null && pincodeRegex.test(text) && Number(text)
>= Number(this.state.nachChargesMaster)) {
valid = true;
}
this.setState({
nachCharges: {
...this.state.nachCharges,
isValid: valid,
},
});
}
isPreEMI(text) {
let valid = false;
const pincodeRegex = /^\d+$/;
if (text == 0) {
valid = true
}
else if (text != '' && text != null && pincodeRegex.test(text)) {
valid = true;
}
this.setState({
preEMI: {
...this.state.preEMI,
isValid: valid,
},
});
}
isPodCharges(text) {
let valid = false;
const pincodeRegex = /^\d+$/;
if (text == 0) {
valid = true
}
else if (text != '' && text != null && pincodeRegex.test(text)) {
valid = true;
}
this.setState({
podCharges: {
...this.state.podCharges,
isValid: valid,
},
});
}
isConvenienceCharges(text) {
let valid = false;
const pincodeRegex = /^\d+$/;
if (text == '0') {
valid = true
}
else if (text != '' && text != null && pincodeRegex.test(text)) {
valid = true;
}
this.setState({
convenienceCharges: {
...this.state.convenienceCharges,
isValid: valid,
},
});
}
isValueRateofInterest(text) {
let valid = false;
//const roiRegex = /^(?!0+(?:\.0+)?$)\d?\d(?:\.\d\d?)?$/;
const roiRegex = /^(100|([0-9][0-9]?(\.[0-9]+)?))$/;
if (text == 0) {
valid = true
}
else if (text != '' && text != null && roiRegex.test(text)) {
valid = true;
}
this.setState({
valueRateofInterest: {
...this.state.valueRateofInterest,
isValid: valid,
},
});
}
selectRadioButton(value, index) {
value.title == 'No' ?
this.setState({
selectedSourceType: value.title,
premiumAmount: { value: '', isValid: true },
selectedSourceType2: '',
nameNominee: {
value: '',
isValid: true,
},
addressNominee: {
value: null,
isValid: true,
},
dobValid: true,
dateOfIncorporation: null,
dateOfIncorporationText: '',
selectedRelation: {
value: null,
isValid: true,
},
}, () => { this.emiamount() })
:
this.setState({
selectedSourceType: value.title,
// premiumAmount: {
// value: this.state.schemeDetails.klpiBracket,
// isValid: true,
// }
}, () => { this.emiamount() })
}
selectRadioButton2(value, index) {
this.setState({ selectedSourceType2: value.title }, () => this.emiamount());
}
selectRadioButton3(value, index) {
this.setState({ selectedSourceType3: value.title, selectedSourceType4:
value.title == "No" ? "No" : this.state.selectedSourceType4 }, () =>
this.emiamount());
}
selectRadioButton4(value, index) {
this.setState({ selectedSourceType4: value.title }, () => this.emiamount());
}
selectRadioButton5(value, index) {
this.setState({ selectedSourceType5: value.title }, () => this.emiamount());
}
selectOPDRadioButton(value, index) {
this.setState({ isOpdAddedInLoan: value.title }, () => this.emiamount());
}
selectRSARadioButton(value, index) {
this.setState({ isRsaAddedInLoan: value.title }, () => this.emiamount());
}
apiCall = () => {
this.props.getPlanDetails({
data: {
"module": "Sales"
},
callback: (response) => {
// console.log("reeeee", JSON.stringify(response, null, 4));
var PlanDetails = response.data
})
const dataToAPI = {
applicant_uniqueid: this.state.applicantUniqueId,
lead_code: this.state.leadCode,
roleId: this.props.userDataSelector.userData.data.roleId
};
this.props.getLoanSummary({
dataToAPI,
callback: (response) => {
this.setState({
isViewOnly:
// response?.mainapplicant?.loanSchemeFreeze ? true :
// response?.modelAccess[0]?.read ? true :
false,
branchName: response.branchName,
tenureMaxValue: response?.mainapplicant?.maxTenure,
fiWaiverStatus: response?.mainapplicant?.fiWaiverStatus
}, () => {
this.props.loanVehicleDETAILS({
data: { leadCode: this.state.leadCode },
callback: (response) => {
if (
this.props.userQDEDataSelector &&
this.props.userQDEDataSelector.loandetails
) {
const loanData =
this.props.userQDEDataSelector.loandetails;
console.log(loanData,"getqdeloanData");
if (loanData?.dealerPayouttype === 'Number' ||
loanData?.dealerPayouttype === 'number') {
this.setState({
dealerPayoutType: {
isValid: true,
label: "Number",
value: "Number"
},
})
}
else if (loanData?.dealerPayouttype === 'Percent' ||
loanData?.dealerPayouttype === 'percent') {
this.setState({
dealerPayoutType: {
isValid: true,
label: "Percent",
value: "Percent"
},
})
}
else {
this.setState({
dealerPayoutType: {
isValid: false,
// label: "Percent",
// value: "Percent"
},
})
}
// response.data[item].schemeCode ==
loanData.schemeCode ?
// temp = response.data[item].dealerName :
null
// })
// this.props.getSchemeDetails({
// data: {
// dealerName: temp,
// location: this.state.branchName,
// schemeCode: loanData.schemeCode,
// applicantUniqueId:
this.state.applicantUniqueId
// },
// callback: (response) => {
// this.setState({
// // stampDuty: {
// // value:
response?.data?.state.toLowerCase() == "maharashtra" ? this.state.valueaR >
100000 ? "200" : "100" : "100",
// // isValid: true,
// // },
// valueRateofInterest: {
// value:
response?.data?.rateOfInterest,
// isValid: false
// },
// convenienceCharges: {
// value:
response?.data?.convenienceCharges || "0",
// isValid: true,
// },
// premiumAmountFreez:
response?.data?.premiumAmountFreez,
// nachChargesMaster:
response?.data?.nachCharges,
// stampDutyMaster:
response?.data?.stampDuty,
// pfAmountMaster:
response?.data?.pfAmount,
// pfAmountTypeMaster:
response?.data?.pfAmountType,
// pfAmount1: response?.data?.pfAmount,
// premiumAmountFreez:
response?.data?.premiumAmountFreez,
// },
()=>{console.log("getSchemeDetails1",this.state.convenienceCharges);});
// },
// });
// },
// });
if (
this.state.loanVehicleDetails &&
this.state.loanVehicleDetails.value !== null
) {
this.props.loanVehicleBRAND({
data: {
leadCode: this.state.leadCode,
vehicleType:
this.state.loanVehicleDetails.label,
},
callback: (response) => {
const tempBrandArray = [];
for (const brand of response.data) {
tempBrandArray.push({
label: brand.vehiclebrand,
value: brand.vehiclebrand,
id: brand.id,
});
}
this.setState(
{
dropDownItemBrandofVehicle:
[...tempBrandArray] || [],
loanVehicleBrand: {
isValid: true,
value: loanData.brand_nm || null,
label: loanData.brand_nm || null,
},
},
() => {
if (this.state.loanVehicleBrand.label !==
null) {
this.props.loanVehicleMODEL({
data: {
leadCode: this.state.leadCode,
vehicleBrand:
this.state.loanVehicleBrand.label,
vehicleType:
this.state.loanVehicleDetails.label,
},
callback: (response) => {
const tempModelArray = [];
for (const model of response.data)
{
tempModelArray.push({
label: model.model,
value: model.model,
id: model.id,
});
}
//
console.log('loanVehicleMODEjjjjL1', tempModelArray, loanData.model);
this.setState(
{
dropDownItemModel:
[...tempModelArray] || [],
loanVehicleModel: {
isValid: true,
value: loanData.model ||
null,
label: loanData.model ||
null,
},
},
() => {
if (
this.props.loanVehicleSubMODEL({
data: {
leadCode:
this.state.leadCode,
model:
this.state.loanVehicleModel.label,
vehicleBrand:
this.state.loanVehicleBrand.label,
vehicleType:
this.state.loanVehicleDetails.label,
},
callback: (response) => {
const tempSubModelArray =
[];
for (const subModel of
response.data) {
tempSubModelArray.push({
label:
subModel.submodel,
value:
subModel.submodel,
id: subModel.id,
});
}
this.setState({
dropDownItemSubModel:
[...tempSubModelArray] || [],
loanVehicleSubModel: {
isValid: true,
value:
loanData?.submodel || null,
label:
loanData?.submodel || null,
},
},
() => {
this.props.getSchemeCode({
data: {
dealerName:
this.state.selectedDealer.value,
location:
this.state.branchName,
vehicleBrand:
this.state.loanVehicleBrand?.label,
},
callback:
(response) => {
console.log(response,"schemecoderesponse");
var temp = []
this.props.loanMaximumAmount({
data: {
leadCode:
this.state.leadCode,
submodel:
this.state.loanVehicleSubModel.label,
vehicletype:
this.state.loanVehicleDetails.label,
vehiclebrand:
this.state.loanVehicleBrand.label,
model:
this.state.loanVehicleModel.label,
location:
this.state.branchName,
exShowroom:
this.state.exShowroomPrice.value,
insurance:
this.state.insurance.value
},
callback:
(response) => {
this.setState({
//
approveAmount: Math.round(Number(response?.data?.maxamt) * Number(this?.state?.ltv)
/ 100),
maxAmount:
response?.data?.maxamt || this.state.maxAmount,
},
);
},
});
}
},
);
},
});
}
},
);
},
});
}
},
);
},
});
}
},
);
}
}
})
});
},
});
})
}
})
}
componentDidMount() {
this.apiCall()
// console.log("wwwwwwwww",
this.props.userDataSelector?.userData?.data?.employeeId);
renderDropDownVehicle() {
const {
viewDrop1,
separatorStyle,
textStyle,
textStyle1,
textStyleDrop,
errorLabel,
} = LoanDetailsStyles;
return (
<View style={viewDrop1}>
<Text style={textStyleDrop}>Vehicle Type*</Text>
<DropDownPicker
disabled={this.state.isViewOnly}
items={this.state.dropDownItemVehicle}
containerStyle={{ flex: 1 }}
style={{ backgroundColor: '#ffffff', borderWidth: 0 }}
itemStyle={{
justifyContent: 'flex-start',
marginLeft: 4,
}}
defaultValue={
this.state.loanVehicleDetails.value !== ''
? this.state.loanVehicleDetails.value
: LOANDETAILS_CONST.PLACEHOLDER_DROPDOWN_VEHICLE
}
dropDownStyle={{ backgroundColor: '#ffffff' }}
onChangeItem={(item) =>
this.setState(
{
loanVehicleDetails: { ...item, isValid: true },
loanVehicleBrand: { isValid: true },
loanVehicleModel: { isValid: true },
loanVehicleSubModel: { isValid: true },
dropDownItemModel: [],
dropDownItemSubModel: []
},
() => {
this.props.loanVehicleBRAND({
data: {
leadCode: this.state.leadCode,
vehicleType: this.state.loanVehicleDetails.label,
},
callback: (response) => {
const tempBrandArray = [];
for (const brand of response.data) {
tempBrandArray.push({
label: brand.vehiclebrand,
value: brand.vehiclebrand,
id: brand.id,
});
}
this.setState({
dropDownItemBrandofVehicle: [...tempBrandArray] || [],
loanVehicleBrand: { isValid: true },
loanVehicleModel: { isValid: true },
dropDownItemModel: [],
loanVehicleSubModel: { isValid: true },
dropDownItemSubModel: []
});
},
});
},
)
}
customArrowUp={() => <Image source={UP_ARROW} />}
customArrowDown={() => <Image source={DOWN_ARROW} />}
labelStyle={textStyle}
selectedLabelStyle={textStyle1}
/>
<View style={separatorStyle} />
{!this.state.loanVehicleDetails.isValid && (
<Text style={errorLabel}>Vehicle name is mandatory.</Text>
)}
</View>
);
}
renderDropDownBrandofVehicle() {
const {
viewDrop2,
separatorStyle,
textStyle,
textStyle1,
textStyleDrop,
errorLabel,
} = LoanDetailsStyles;
return (
<View style={viewDrop2}>
<Text style={textStyleDrop}>Brand of Vehicle*</Text>
<DropDownPicker
disabled={this.state.isViewOnly}
items={this.state.dropDownItemBrandofVehicle}
containerStyle={{ flex: 1 }}
style={{ backgroundColor: '#ffffff', borderWidth: 0 }}
itemStyle={{
justifyContent: 'flex-start',
marginLeft: 4,
}}
defaultValue={
this.state.loanVehicleBrand.value !== ''
? this.state.loanVehicleBrand.value
: LOANDETAILS_CONST.PLACEHOLDER_DROPDOWN_BRANDOFVEHICLE
}
dropDownStyle={{ backgroundColor: '#ffffff' }}
onChangeItem={(item) =>
this.setState({
loanVehicleBrand: { ...item, isValid: true },
loanVehicleModel: { isValid: true },
loanVehicleSubModel: { isValid: true },
dropDownItemSubModel: [],
}, () => {
this.props.loanVehicleMODEL({
data: {
leadCode: this.state.leadCode,
vehicleBrand: this.state.loanVehicleBrand.label,
vehicleType: this.state.loanVehicleDetails.label,
},
callback: (response) => {
const tempModelArray = [];
for (const model of response.data) {
tempModelArray.push({
label: model.model,
value: model.model,
id: model.id,
});
}
this.setState({
dropDownItemModel: [...tempModelArray] || [],
loanVehicleModel: { isValid: true },
loanVehicleSubModel: { isValid: true },
dropDownItemSubModel: [],
});
this.props.loanDEALER({
data: {
branch: this.state.branchName,
employeeId:
this.props.userDataSelector?.userData?.data?.employeeId,
brand: this.state.loanVehicleBrand.label,
},
callback: (response) => {
const tempDealerArray = [];
for (const dealer of response.data) {
tempDealerArray.push({
label: dealer.dealer_name,
value: dealer.dealer_name,
id: dealer.id,
});
}
this.setState({ dropDownItemDealer: [...tempDealerArray] ||
[] });
},
});
},
});
})
}
customArrowUp={() => <Image source={UP_ARROW} />}
customArrowDown={() => <Image source={DOWN_ARROW} />}
labelStyle={[textStyle, { color: colors.COLOR_BLACK }]}
selectedLabelStyle={[textStyle1, { color: colors.COLOR_BLACK }]}
/>
<View style={separatorStyle} />
{!this.state.loanVehicleBrand.isValid && (
<Text style={errorLabel}>Brand name is mandatory.</Text>
)}
</View>
);
}
renderDropDownModel() {
const {
viewDrop3,
separatorStyle,
textStyle,
textStyle1,
textStyleDrop,
errorLabel,
} = LoanDetailsStyles;
return (
<View style={viewDrop3}>
<Text style={textStyleDrop}>Model*</Text>
<DropDownPicker
disabled={this?.state?.isViewOnly}
items={this?.state?.dropDownItemModel}
containerStyle={{ flex: 1 }}
style={{ backgroundColor: '#ffffff', borderWidth: 0 }}
itemStyle={{
justifyContent: 'flex-start',
marginLeft: 4,
}}
defaultValue={
this.state.loanVehicleModel.value !== ''
? this.state.loanVehicleModel.value
: LOANDETAILS_CONST.PLACEHOLDER_DROPDOWN_MODEL
}
dropDownStyle={{ backgroundColor: '#ffffff' }}
onChangeItem={(item) =>
this.setState({
loanVehicleModel: { ...item, isValid: true },
loanVehicleSubModel: { isValid: true },
}, () => {
this.props.loanVehicleSubMODEL({
data: {
leadCode: this.state.leadCode,
model: this.state.loanVehicleModel.label,
vehicleBrand: this.state.loanVehicleBrand.label,
vehicleType: this.state.loanVehicleDetails.label,
},
callback: (response) => {
defaultValue={
this?.state?.loanVehicleSubModel?.value !== ''
? this?.state?.loanVehicleSubModel?.value
: LOANDETAILS_CONST.PLACEHOLDER_DROPDOWN_SUBMODEL
}
dropDownStyle={{ backgroundColor: '#ffffff' }}
onChangeItem={(item) =>
this.setState({
loanVehicleSubModel: { ...item, isValid: true }
}, () => {
this.props.loanMaximumAmount({
data: {
leadCode: this.state.leadCode,
submodel: this.state.loanVehicleSubModel.label,
vehicletype: this.state.loanVehicleDetails.label,
vehiclebrand: this.state.loanVehicleBrand.label,
model: this.state.loanVehicleModel.label,
location: this.state.branchName,
exShowroom: this.state.exShowroomPrice.value,
insurance: this.state.insurance.value
},
callback: (response) => {
this.setState({
// approveAmount: Math.round(Number(response?.data?.maxamt) *
Number(this?.state?.ltv) / 100),
maxAmount: response?.data?.maxamt || this.state.maxAmount,
});
},
});
})
}
customArrowUp={() => <Image source={UP_ARROW} />}
customArrowDown={() => <Image source={DOWN_ARROW} />}
labelStyle={textStyle}
selectedLabelStyle={textStyle1}
/>
<View style={separatorStyle} />
{!this.state.loanVehicleSubModel.isValid && (
<Text style={errorLabel}>Sub-Model name is mandatory.</Text>
)}
</View>
);
}
renderDropDownDealer() {
const {
viewDrop5,
separatorStyle,
textStyle,
textStyle1,
textStyleDrop,
errorLabel,
} = LoanDetailsStyles;
return (
<View style={[viewDrop5, { marginBottom: 20 }]}>
<Text style={textStyleDrop}>Dealer Name*</Text>
<DropDownPicker
disabled={this.state.isViewOnly}
items={this.state.dropDownItemDealer}
containerStyle={{ flex: 1 }}
style={{ backgroundColor: '#ffffff', borderWidth: 0 }}
itemStyle={{
justifyContent: 'flex-start',
marginLeft: 4,
}}
placeholder={
this.state.selectedDealer.value !== ''
? this.state.selectedDealer.value
: LOANDETAILS_CONST.PLACEHOLDER_DROPDOWN_DEALER
}
dropDownStyle={{ backgroundColor: '#ffffff' }}
onChangeItem={(item) =>
this.setState({ selectedDealer: { ...item, isValid: true } }, () => {
this.props.loanSubDEALER({
data: {
branch: this.state.branchName,
dealerName: this.state.selectedDealer.value
},
callback: (response) => {
console.log(response,"loanSubDEALER response");
const tempSubDealerArray = [];
for (const subDealer of response.data) {
tempSubDealerArray.push({
label: subDealer.subDealerName,
value: subDealer.subDealerName,
id: subDealer.id,
});
}
this.setState({ dropDownItemSubDealer: [...tempSubDealerArray] ||
[] }, () => {
this.props.getSchemeCode({
data: {
dealerName: this.state.selectedDealer.value,
location: this.state.branchName,
vehicleBrand: this.state.loanVehicleBrand?.label,
},
callback: (response) => {
console.log(response,"schemecoderesponse");
var temp = []
Object.keys(response.data).map((item, index) => {
temp.push({
label: response.data[item].schemeCode,
value: response.data[item].schemeCode,
id: response.data[item].id,
dealerName: response.data[item].dealerName,
schemeCode: response.data[item].schemeCode,
})
})
this.setState({
schemeCode: temp || [],
tenureMaxValue: response.maxTenure
});
},
});
});
}
})
})
}
customArrowUp={() => <Image source={UP_ARROW} />}
customArrowDown={() => <Image source={DOWN_ARROW} />}
labelStyle={textStyle}
selectedLabelStyle={textStyle1}
/>
<View style={separatorStyle} />
{!this.state.selectedDealer.isValid && (
<Text style={errorLabel}>Dealer name is mandatory.</Text>
)}
</View>
);
}
renderDropDownSchemeCode() {
const {
viewDrop5,
separatorStyle,
textStyle,
textStyle1,
textStyleDrop,
errorLabel,
inputStyle,
inputStyle1,
inputTextPasswordStyle
} = LoanDetailsStyles;
return (
<>
<View style={[viewDrop5, { marginBottom: 20 }]}>
<Text style={textStyleDrop}>Schemecode*</Text>
<DropDownPicker
disabled={this.state.isViewOnly}
items={this.state.schemeCode}
containerStyle={{ flex: 1 }}
style={{ backgroundColor: '#ffffff', borderWidth: 0 }}
itemStyle={{
justifyContent: 'flex-start',
marginLeft: 4,
}}
placeholder={
this?.state?.selectedSchemeCode?.value !== null
? this.state.selectedSchemeCode.value
: "Please select schemecode"
}
dropDownStyle={{ backgroundColor: '#ffffff' }}
onChangeItem={(item) =>
this.setState({ selectedSchemeCode: { ...item, isValid: true } }, ()
=> {
this.props.getSchemeDetails({
data: {
dealerName: this.state.selectedSchemeCode.dealerName,
location: this.state.branchName,
schemeCode: this.state.selectedSchemeCode.schemeCode,
applicantUniqueId: this.state.applicantUniqueId,
vehicleBrand: this.state.loanVehicleBrand.label,
},
callback: (response) => {
console.log(response,"getSchemeDetailsresponse");
this.setState({
schemeDetails: response?.data || [],
startDate: response?.data?.startDate,
endDate: response?.data?.endDate,
// rsaAmount: response?.data?.rsaAmount,
// opdAmount: response?.data?.opdCoverage,
schemeName: response?.data?.schemeName,
premiumAmount: {
value: response?.data?.klpiBracket,
isValid: true,
},
defaultPremiumAmount: {
value: response?.data?.klpiBracket,
isValid: true,
},
dealerPayout: {
value: response?.data?.dealerPayout,
isValid: true,
},
dealerPayoutType: {
isValid: true,
label: response?.data?.dealerPayouttype,
value: response?.data?.dealerPayouttype,
},
convenienceCharges: {
value: response?.data?.convenienceCharges || "0",
isValid: true,
},
premiumAmountFreez: response?.data?.premiumAmountFreez,
nachChargesMaster: response?.data?.nachCharges,
stampDutyMaster: response?.data?.stampDuty,
pfAmountMaster: response?.data?.pfAmount,
pfAmountTypeMaster: response?.data?.pfAmountType,
ltv: response?.data?.ltv,
// approveAmount: Math.round(this?.state?.maxAmount *
response?.data?.ltv / 100),
otherCharges: {
value: response?.data?.anyOtherCharges,
isValid: true,
},
bureauCharges: {
value: response?.data?.bureauCharges,
isValid: true,
},
dealerSubvention: {
value: response?.data?.dealerSubvention,
isValid: true,
},
nachCharges: {
value: response?.data?.nachCharges,
isValid: true,
},
podCharges: {
value: response?.data?.pdd,
isValid: true,
},
processingFees: {
value: response?.data?.pfAmount,
isValid: true,
},
pfAmount1: response?.data?.pfAmount,
preEMI: {
value: response?.data?.preEmiChanrges,
isValid: true,
},
valueRateofInterest: {
value: response?.data?.roi,
isValid: true,
},
stampDuty: {
value: response?.data?.stampDuty,
// .toLowerCase() == "maharashtra" ? this.state.valueaR >
100000 ? "200" : "100" : "100",
isValid: true,
},
pfAmountType: {
value: response?.data?.pfAmountType,
isValid: true
},
advanceEmi:response?.data?.advanceEmi,
ezpayoutSchemeId:response?.data?.ezpayoutSchemeId,
ezManagerSchemeId:response?.data?.ezManagerSchemeId
}, () => {
this.emiamount()
});
},
});
})
}
customArrowUp={() => <Image source={UP_ARROW} />}
customArrowDown={() => <Image source={DOWN_ARROW} />}
labelStyle={textStyle}
selectedLabelStyle={textStyle1}
/>
<View style={separatorStyle} />
{!this.state.selectedSchemeCode.isValid && (
<Text style={errorLabel}>Schemecode is mandatory.</Text>
)}
</View>
value={this.state.startDate || undefined}
customLabelStyles={{
colorFocused: colors.COLOR_BLUE,
colorBlurred: colors.COLOR_LIGHT_GREY,
fontSizeFocused: 15,
fontSizeBlurred: 15,
}}
inputStyles={inputTextPasswordStyle}
/>
<View style={separatorStyle} />
</View>
value={this.state.endDate || undefined}
customLabelStyles={{
colorFocused: colors.COLOR_BLUE,
colorBlurred: colors.COLOR_LIGHT_GREY,
fontSizeFocused: 15,
fontSizeBlurred: 15,
}}
inputStyles={inputTextPasswordStyle}
/>
<View style={separatorStyle} />
</View>
</View>
</>
);
}
renderDropDownSubDealer() {
const {
viewDrop,
separatorStyle,
textStyle,
textStyle1,
textStyleDrop,
errorLabel,
inputStyle,
inputTextPasswordStyle,
inputStyle1,
} = LoanDetailsStyles;
return (
<>
<View style={viewDrop}>
<Text style={textStyleDrop}>Sub-Dealer Name</Text>
<DropDownPicker
disabled={this.state.isViewOnly}
items={this.state.dropDownItemSubDealer}
containerStyle={{ flex: 1 }}
style={{ backgroundColor: '#ffffff', borderWidth: 0 }}
itemStyle={{
justifyContent: 'flex-start',
marginLeft: 4,
}}
placeholder={
this.state.selectedSubDealer.value !== ''
? this.state.selectedSubDealer.value
: LOANDETAILS_CONST.PLACEHOLDER_DROPDOWN_SUBDEALER
}
dropDownStyle={{ backgroundColor: '#ffffff' }}
onChangeItem={(item) =>
this.setState({ selectedSubDealer: { ...item, isValid: true } })
}
customArrowUp={() => <Image source={UP_ARROW} />}
customArrowDown={() => <Image source={DOWN_ARROW} />}
labelStyle={textStyle}
selectedLabelStyle={textStyle1}
/>
<View style={separatorStyle} />
</View>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<View style={{ width: '45%', marginTop: 15 }}>
{/* <NumberFormat thousandSeparator={true} thousandsGroupStyle="lakh"
value={'123456789'}/> */}
<FloatingLabelInput
editable={!this.state.isViewOnly}
label={LOANDETAILS_CONST.EXSHOWROOM}
containerStyles={inputStyle1}
maxLength={10}
keyboardType='numeric'
value={this.state.exShowroomPrice.value || undefined}
onChangeText={(text) => {
this.setState({
exShowroomPrice: {
...this.state.exShowroomPrice,
value: text,
}
}, () => {
this.isExShowRoomPrice(this.state.exShowroomPrice.value);
this.props.loanMaximumAmount({
data: {
leadCode: this.state.leadCode,
submodel: this.state.loanVehicleSubModel.label,
vehicletype: this.state.loanVehicleDetails.label,
vehiclebrand: this.state.loanVehicleBrand.label,
model: this.state.loanVehicleModel.label,
location: this.state.branchName,
exShowroom: this.state.exShowroomPrice.value,
insurance: this.state.insurance.value
},
callback: (response) => {
this.setState({
// approveAmount: Math.round(Number(response?.data?.maxamt)
* Number(this?.state?.ltv) / 100),
maxAmount: response?.data?.maxamt || this.state.maxAmount,
});
},
});
});
}}
customLabelStyles={{
colorFocused: colors.COLOR_BLUE,
colorBlurred: colors.COLOR_LIGHT_GREY,
fontSizeFocused: 15,
fontSizeBlurred: 15,
}}
inputStyles={inputTextPasswordStyle}
/>
<View style={separatorStyle} />
{!this.state.exShowroomPrice.isValid &&
<Text style={errorLabel}>
{(this.state.exShowroomPrice.value === "" ||
this.state.exShowroomPrice.value === null)
? LOANDETAILS_CONST.MANDATORY_EXSHOWROOM
: LOANDETAILS_CONST.VALID_EXSHOWROOM}</Text>}
</View>
<View style={{ width: '45%', marginTop: 15 }}>
<FloatingLabelInput
editable={!this.state.isViewOnly}
label={LOANDETAILS_CONST.INSURANCE}
containerStyles={inputStyle1}
maxLength={10}
keyboardType='numeric'
value={this.state.insurance.value || undefined}
onChangeText={(text) => {
this.setState({
insurance: {
...this.state.insurance,
value: text,
}
}, () => {
this.isInsurance(this.state.insurance.value);
this.props.loanMaximumAmount({
data: {
leadCode: this.state.leadCode,
submodel: this.state.loanVehicleSubModel.label,
vehicletype: this.state.loanVehicleDetails.label,
vehiclebrand: this.state.loanVehicleBrand.label,
model: this.state.loanVehicleModel.label,
location: this.state.branchName,
exShowroom: this.state.exShowroomPrice.value,
insurance: this.state.insurance.value
},
callback: (response) => {
this.setState({
// approveAmount: Math.round(Number(response?.data?.maxamt)
* Number(this?.state?.ltv) / 100),
maxAmount: response?.data?.maxamt || this.state.maxAmount,
});
},
});
});
}}
customLabelStyles={{
colorFocused: colors.COLOR_BLUE,
colorBlurred: colors.COLOR_LIGHT_GREY,
fontSizeFocused: 15,
fontSizeBlurred: 15,
}}
inputStyles={inputTextPasswordStyle}
/>
<View style={separatorStyle} />
{!this.state.insurance.isValid &&
<Text style={errorLabel}>
{(this.state.insurance.value === "" ||
this.state.insurance.value === null)
? LOANDETAILS_CONST.MANDATORY_INSURNCE
: LOANDETAILS_CONST.VALID_INSURNCE}</Text>}
</View>
</View>
<View style={{ flexDirection: 'row', justifyContent: 'space-
between',marginTop:5, marginBottom: 20 }}>
<View style={{ width: '45%', }}>
<FloatingLabelInput
editable={!this.state.isViewOnly}
label={'On Road Price*'}
containerStyles={inputStyle1}
maxLength={10}
keyboardType='numeric'
value={this.state.onRoadPrice.value || undefined}
onChangeText={(text) => {
this.setState({
onRoadPrice: {
...this.state.onRoadPrice,
value: text,
}
}, () => {
this.isOnRoadPrice(this.state.onRoadPrice.value);
// this.props.loanMaximumAmount({
// data: {
// leadCode: this.state.leadCode,
// submodel: this.state.loanVehicleSubModel.label,
// vehicletype: this.state.loanVehicleDetails.label,
// vehiclebrand: this.state.loanVehicleBrand.label,
// model: this.state.loanVehicleModel.label,
// location: this.state.branchName,
// exShowroom: this.state.exShowroomPrice.value,
// insurance: this.state.insurance.value
// },
// callback: (response) => {
// this.setState({
// // approveAmount:
Math.round(Number(response?.data?.maxamt) * Number(this?.state?.ltv) / 100),
// maxAmount: response?.data?.maxamt ||
this.state.maxAmount,
// });
// },
// });
});
}}
customLabelStyles={{
colorFocused: colors.COLOR_BLUE,
colorBlurred: colors.COLOR_LIGHT_GREY,
fontSizeFocused: 15,
fontSizeBlurred: 15,
}}
inputStyles={inputTextPasswordStyle}
/>
<View style={separatorStyle} />
{!this.state.onRoadPrice.isValid &&
<Text style={errorLabel}>
{(this.state.onRoadPrice.value === "" ||
this.state.onRoadPrice.value === null)
? LOANDETAILS_CONST.MANDATORY_ONROADPRICE
: LOANDETAILS_CONST.VALID_ONROADPRICE}</Text>}
</View>
<View style={{ width: '45%', }}>
<FloatingLabelInput
editable={!this.state.isViewOnly}
label={'Enter Monthly Emi*'}
containerStyles={inputStyle1}
maxLength={10}
keyboardType='numeric'
value={this.state.userInputEmi.value || undefined}
onChangeText={(text) => {
this.setState({
userInputEmi: {
...this.state.userInputEmi,
value: text,
}
}, () => {
this.isUserInputEmi(this.state.userInputEmi.value);
// this.props.loanMaximumAmount({
// data: {
// leadCode: this.state.leadCode,
// submodel: this.state.loanVehicleSubModel.label,
// vehicletype: this.state.loanVehicleDetails.label,
// vehiclebrand: this.state.loanVehicleBrand.label,
// model: this.state.loanVehicleModel.label,
// location: this.state.branchName,
// exShowroom: this.state.exShowroomPrice.value,
// insurance: this.state.insurance.value
// },
// callback: (response) => {
// this.setState({
// // approveAmount:
Math.round(Number(response?.data?.maxamt) * Number(this?.state?.ltv) / 100),
// maxAmount: response?.data?.maxamt ||
this.state.maxAmount,
// });
// },
// });
});
}}
customLabelStyles={{
colorFocused: colors.COLOR_BLUE,
colorBlurred: colors.COLOR_LIGHT_GREY,
fontSizeFocused: 15,
fontSizeBlurred: 15,
}}
inputStyles={inputTextPasswordStyle}
/>
<View style={separatorStyle} />
{!this.state.userInputEmi.isValid &&
<Text style={errorLabel}>
{(this.state.userInputEmi.value === "" ||
this.state.userInputEmi.value === null)
? LOANDETAILS_CONST.MANDATORY_USERINPUTEMI
: LOANDETAILS_CONST.VALID_USERINPUTEMI}</Text>}
</View>
</View>
</>
);
}
renderSlider() {
const {
inputStyle,
inputTextPasswordStyle,
separatorStyle,
errorLabel,
textStyle,
textStyle1,
textStyleDrop,
textEMI,
viewDrop,
textEMIRIGHT
} = LoanDetailsStyles;
return (
<TextInput
style={{ height: 40, width: "20%", marginTop: -10, borderBottomWidth:
0.6, textAlign: 'center' }}
keyboardType="numeric"
defaultValue={this?.state?.amountSelected?.toString()}
editable={!this.state.isViewOnly}
onChangeText={(text) => {
this.setState({ valueaR1: text, })
if (!isNaN(text)) {
if (text > 0 && text <= this.state.maxAmount) {
this.setState({
amountSelected: text
}, () => {
this.emiamount()
})
}
}
}}
/>
</View>
<Text style={errorLabel}>{this.state.valueaR1 <= this.state.maxAmount ==
false ? `Please select the amount between 20,000 to ${this.state.maxAmount}.` :
null}</Text>
<View style={{ justifyContent: 'center', alignItems: 'center',
marginVertical: 20 }}>
<Button
title={'Get Approved Loan \nAmount'}
customContainerStyle={{ width: '55%' }}
isDisabled={this.state.amountSelected == 0 || this.state.valueaR1 <=
this.state.maxAmount == false}
onPress={() => {
Keyboard.dismiss();
this.isLoanVehicleBrand();
this.isLoanVehicleDetails();
this.isLoanVehicleModel();
this.isLoanVehicleSubModel();
this.isSelectedDealer();
this.isSechemeCode();
this.isPFType();
// this.isValueRateofInterest(this.state.valueRateofInterest.value);
this.isDealerCharges(this.state.dealerCharges.value);
this.isProcessingFees(this.state.processingFees.value);
this.isDealerPayout(this.state.dealerPayout.value);
this.isInsurance(this.state.insurance.value);
this.isUserInputEmi(this.state.userInputEmi.value);
this.isExShowRoomPrice(this.state.exShowroomPrice.value);
this.isBureauCharges(this.state.bureauCharges.value);
this.isOtherCharges(this.state.otherCharges.value);
this.isSelectedSourceValid();
// uncomment opd
this.isSelectedSourceValid3(),
(this.state.selectedSourceType == 'Yes' ? (
this.isPremiumAmount(this.state.premiumAmount.value),
this.isSelectedSourceValid2()
)
: null)
this.isDealerSubvention(this.state.dealerSubvention.value);
this.isAdminFees(this.state.adminFees.value);
this.isNachCharges(this.state.nachCharges.value);
this.isPreEMI(this.state.preEMI.value);
this.isPodCharges(this.state.podCharges.value);
this.isConvenienceCharges(this.state.convenienceCharges.value);
this.isStampDuty(this.state.stampDuty.value);
// this.isDealerPayoutType();
if (this.state.valuetR < 6) {
handleError("Tenure is less than 6 month")
}
else if (this.state.valueTenure == 0) {
handleError("Tenure is less than 6 month")
}
else if (this.state.valuetR > this.state.tenureMaxValue) {
handleError(`Tenure is greater than ${this.state.tenureMaxValue}
month`)
}
else if (this.state.selectedSourceType5== "Yes" &&
this.state.planName.value == '') {
handleError(`please select RSA Plan`)
}
else if (this.state.selectedSourceType3 == 'Yes' &&
this.state.opdPlanName.value == '') {
handleError(`please select Hospicash Plan`)
}
else if (
this.state.loanVehicleDetails.value != null &&
this.state.loanVehicleDetails.value != '' &&
this.state.loanVehicleBrand.value != null &&
this.state.loanVehicleBrand.value != '' &&
this.state.loanVehicleModel.value != null &&
this.state.loanVehicleModel.value != '' &&
// this.state.valueRateofInterest.value != '' &&
// this.state.valueRateofInterest.value != null &&
// this.state.valueRateofInterest.isValid &&
this.state.loanVehicleSubModel.value != null &&
this.state.loanVehicleSubModel.value != '' &&
this.state.selectedDealer.value != null &&
this.state.selectedDealer.value != '' &&
this.state.selectedSchemeCode.value != null &&
this.state.selectedSchemeCode.value != '' &&
this.state.selectedDealer.value != null &&
this.state.selectedDealer.value != '' &&
this.state.dealerCharges.value != null &&
this.state.dealerCharges.value != "" &&
this.state.dealerSubvention.value != null &&
this.state.dealerSubvention.value != "" &&
this.state.adminFees.value != null &&
this.state.adminFees.value != "" &&
this.state.nachCharges.value != null &&
this.state.nachCharges.value != "" &&
this.state.nachCharges.isValid &&
this.state.preEMI.value != null &&
this.state.preEMI.value != "" &&
this.state.podCharges.value != null &&
this.state.podCharges.value != "" &&
this.state.convenienceCharges.value != null &&
this.state.convenienceCharges.value != "" &&
this.state.exShowroomPrice.value != null &&
this.state.exShowroomPrice.value != undefined &&
this.state.exShowroomPrice.value != "" &&
this.state.exShowroomPrice.isValid &&
this.state.insurance.value != null &&
this.state.insurance.value != undefined &&
this.state.insurance.value != "" &&
this.state.insurance.isValid &&
this.state.userInputEmi.value != null &&
this.state.userInputEmi.value != undefined &&
this.state.userInputEmi.value != "" &&
this.state.userInputEmi.isValid &&
this.state.stampDuty.value != null &&
this.state.stampDuty.value != "" &&
this.state.stampDuty.isValid &&
this.state.pfAmountType.value != null &&
this.state.pfAmountType.value != "" &&
this.state.pfAmountType.isValid &&
this.state.processingFees.value != null &&
this.state.processingFees.value != "" &&
this.state.processingFees.isValid &&
this.state.dealerPayout.value != null &&
this.state.dealerPayout.value != undefined &&
this.state.dealerPayout.value != "" &&
this.state.dealerPayout.isValid &&
this.state.dealerPayoutType.isValid &&
this.state.bureauCharges.value != null &&
this.state.bureauCharges.value != "" &&
this.state.otherCharges.value != null &&
this.state.otherCharges.value != "" &&
// uncomment opd
// this.state.selectedSourceType3 != "" &&
// this.state.selectedSourceType4 != "" &&
this.state.schemeNameValid &&
(this.state.selectedSourceType == 'Yes' ? (
this.state.selectedSourceType2 != "" &&
this.state.premiumAmount.value !== '' &&
this.state.premiumAmount.isValid &&
this.state.defaultPremiumAmount.isValid
)
: this.state.selectedSourceType != "")
) {
this.state.processingFees.isValid ?
this.props.getApprovedLoanAmount({
data: {
emi: this.state.emi,
schemeDealerName: this.state.selectedSchemeCode.dealerName,
schemeLocation: this.state.branchName,
opdPlanId: this.state.opdPlanName.opdCoveragePlanId,
isOpdCoverage: this.state.selectedSourceType3,
opdCoverage: this.state.opdAmount,
isRsa: this.state.selectedSourceType5,
rsaAmount: this.state.rsaAmount,
planId: this.state.planName.planId,
isRsaAddedInLoan: this.state.isRsaAddedInLoan,
isOpdAddedInLoan: this.state.isOpdAddedInLoan,
pfAmountTypeMaster: this.state.pfAmountTypeMaster,
nachChargesMaster: this.state.nachChargesMaster,
stampDutyMaster: this.state.stampDutyMaster,
pfAmountMaster: this.state.pfAmountMaster,
valueaR: Number(this.state.valueaR),
// this.state.selectedSourceType2 == 'Yes' ?
// Number(this.state.valueaR) +
Number(this.state.premiumAmount.value) : Number(this.state.valueaR),
valuetR: this.state.valuetR,
ltvGridPercentage: this.state.ltvGridPercentage,
ltvGridId: this.state.ltvGridId,
ltvGridRule: this.state.ltvGridRule,
premiumAmount: this.state.premiumAmount.value,
relationType: this.state.selectedRelation.value,
otherCharges: this.state.otherCharges.value,
processingFees: this.state.processingFees.value,
rateOfInterest: this.state.valueRateofInterest.value,
loanVehicleBrand: this.state.loanVehicleBrand.value,
isPremiumamount: this.state.selectedSourceType2,
applicantUniqueId: this.state.applicantUniqueId,
loanVehicleModel: this.state.loanVehicleModel.value,
id: this.state.idToEdit,
maxAmt: this.state.maxAmount,
startDate: this.state.startDate,
endDate: this.state.endDate,
schemeCode: this.state.selectedSchemeCode.value,
schemeName: this.state.schemeName,
ltv: this.state.ltv,
pfAmountType: this.state.pfAmountType.value,
pfAmountMaster: this.state.pfAmount1,
//insuranceAmount: this.state.insuranceAmount.value,
bureauCharges: this.state.bureauCharges.value,
address: this.state.addressNominee.value,
loanVehicleSubModel: this.state.loanVehicleSubModel.value,
loanVehicleDetails: this.state.loanVehicleDetails.value,
dateOfBirth: this.state.dateOfIncorporationText,
isguarantor: false,
leadCode: this.state.leadCode,
subDealerName: this.state.selectedSubDealer.value,
name: this.state.nameNominee.value,
selectedDealer: this.state.selectedDealer.value,
islifeInsurance: this.state.selectedSourceType === 'Yes' ?
true : false,
ismainapplicant: true,
dealerCharges: this.state.dealerCharges.value,
dealerSubvention: this.state.dealerSubvention.value,
adminFees: this.state.adminFees.value,
exShowroomPrice: this.state.exShowroomPrice.value,
insurance: this.state.insurance.value,
nachCharges: this.state.nachCharges.value,
preEmi: this.state.preEMI.value,
convenienceCharges: this.state.convenienceCharges.value,
pddCharges: this.state.podCharges.value,
dealerPayout: this.state.dealerPayout.value,
dealerPayouttype:
this?.state?.dealerPayoutType?.value?.toLowerCase(),
stampDuty: this.state.stampDuty.value,
amountSelected: this.state.amountSelected,
userInputEmi:this.state.userInputEmi.value,
advanceEmi:this.state.advanceEmi,
ezpayoutSchemeId:this.state.ezpayoutSchemeId,
ezManagerSchemeId:this.state.ezManagerSchemeId
},
callback: (response) => {
console.log("getApprovedLoanAmountresponse",response);
this.setState({
valueaR: response.data.amt_requested,
approveLoan: response.data.approveLoan,
ltvGridPercentage: response.data.ltvGridPercentage,
ltvGridId: response.data.ltvGridId,
ltvGridRule: response.data.ltvGridRule,
saveEnable: false,
premiumAmount: {
value: response?.data?.klpiBracket,
isValid: true,
},
defaultPremiumAmount: {
value: response?.data?.klpiBracket,
isValid: true,
},
valueRateofInterest: {
value: response?.data?.rateOfInterest,
isValid: true,
},
premiumAmountFreez: response?.data?.premiumAmountFreez,
convenienceCharges: {
value: response?.data?.convenienceCharges || "0",
isValid: true,
},
selectedSourceType2:response?.data?.isPremiumamount ? "Yes"
: "No"
}, () => {
this.emiamount()
})
},
})
: null
}
}}
/>
</View>
{this.state.valueaR != '' ?
<Text style={[textEMI, { fontSize: 16, marginTop: 15 }]}>{` ${`Approved
Loan Amount: ${'\u20B9'} ${Number(this.state.approveLoan)}`}`} </Text>
// <Text style={[textEMI, { fontSize: 16, marginTop: 15 }]}>{` $
{`Approved Loan Amount: ${'\u20B9'} ${this.state.selectedSourceType2 == 'Yes' ?
((Number(this.state.approveLoan) -
Number(this.state.premiumAmount.value)).toString().replace('-', '')) :
Number(this.state.approveLoan)}`}`} </Text>
: null}
{this.state.valueaR != '' ?
<Text style={[textEMI, { fontSize: 16, marginTop: 20 }]}>{` ${`Total Loan
Amount Approved: ${'\u20B9'} ${Number(this.state.valueaR)}`}`} </Text>
: null}
{this.state.valueaR != '' ?
<Text style={[textEMI, { fontSize: 16, marginTop: 20, padding: 5 }]}>{`To
increase LTV on above Approved Loan , add Ownership Proof`} </Text>
: null}
{/* <Text
style={{
marginLeft: 4,
color: 'black',
fontSize: 16,
}}>
Tenure Required*
</Text>
<Slider
style={{ width: '100%', height: 40 }}
disabled={this.state.isViewOnly}
value={parseFloat(this.state.valuetR || 0)}
onValueChange={(valuetR) => this.setState({ valuetR }, () =>
{ this.setState({ valueTenure: valuetR }) })}
minimumValue={6}
maximumValue={this.state.tenureMaxValue}
minimumTrackTintColor="#16244f"
maximumTrackTintColor="#4a4a4a"
step={1}
/>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-between',
marginBottom: 10,
marginTop: -10
}}>
<Text style={textEMI}>6 Months</Text>
<Text style={textEMIRIGHT}>{this.state.tenureMaxValue} Months</Text>
</View>
<View style={{ flexDirection: "row", justifyContent: 'center' }}>
<Text style={textEMI}>Tenure selected:</Text>
<TextInput style={{
height: 40,
width: "20%",
marginTop: -10,
borderBottomWidth: 0.6,
textAlign: 'center'
}}
// maxLength={2}
keyboardType="numeric"
editable={!this.state.isViewOnly}
value={this.state.valuetR > this.state.tenureMaxValue ? 0 :
this.state.valuetR.toString()}
onChangeText={(valuetR) => {
if (!isNaN(valuetR)) {
if ((valuetR > 0 && valuetR <= this.state.tenureMaxValue) ||
valuetR == '') {
this.setState({ valuetR: valuetR, valueTenure: valuetR }, () =>
this.emiamount())
}
else {
this.setState({ valuetR: '', valueTenure: '' }, () => {
this.emiamount()
})
}
}
}}
// defaultValue={this.state.valuetR.toString()}
/>
<Text style={textEMI}>Months</Text>
</View> */}
},
);
}}
customLabelStyles={{
colorFocused: colors.COLOR_BLUE,
colorBlurred: colors.COLOR_LIGHT_GREY,
fontSizeFocused: 15,
fontSizeBlurred: 15,
}}
inputStyles={inputTextPasswordStyle}
/>
renderCharges() {
const {
errorLabel,
inputStyle1,
inputTextPasswordStyle,
separatorStyle,
textStyle,
textStyle1,
textStyleDrop,
} = LoanDetailsStyles;
return (
<View>
<FloatingLabelInput
editable={false}
// {!this.state.isViewOnly}
label={LOANDETAILS_CONST.DEALERSUBVENTION}
containerStyles={inputStyle1}
maxLength={10}
keyboardType='numeric'
value={this.state.dealerSubvention.value || undefined}
onChangeText={(text) => {
this.setState({
dealerSubvention: {
...this.state.dealerSubvention,
value: text,
}
}, () => {
this.isDealerSubvention(this.state.dealerSubvention.value);
});
}}
customLabelStyles={{
colorFocused: colors.COLOR_BLUE,
colorBlurred: colors.COLOR_LIGHT_GREY,
fontSizeFocused: 15,
fontSizeBlurred: 15,
}}
inputStyles={inputTextPasswordStyle}
/>
<View style={separatorStyle} />
{!this.state.dealerSubvention.isValid &&
<Text style={errorLabel}>
{(this.state.dealerSubvention.value === "" ||
this.state.dealerSubvention.value === null)
? LOANDETAILS_CONST.MANDATORY_DEALERSUBVENTION
: LOANDETAILS_CONST.VALID_DEALERSUBVENTION}</Text>}
</View>
<View style={{ width: '45%', marginTop: 15 }}>
<FloatingLabelInput
// editable={!this.state.isViewOnly}
editable={false}
label={LOANDETAILS_CONST.ADMINFEES}
containerStyles={inputStyle1}
maxLength={10}
keyboardType='numeric'
value={this.state.adminFees.value || undefined}
onChangeText={(text) => {
this.setState({
adminFees: {
...this.state.adminFees,
value: text,
}
}, () => {
this.isAdminFees(this.state.adminFees.value);
});
}}
customLabelStyles={{
colorFocused: colors.COLOR_BLUE,
colorBlurred: colors.COLOR_LIGHT_GREY,
fontSizeFocused: 15,
fontSizeBlurred: 15,
}}
inputStyles={inputTextPasswordStyle}
/>
<View style={separatorStyle} />
{!this.state.adminFees.isValid &&
<Text style={errorLabel}>
{(this.state.adminFees.value === "" ||
this.state.adminFees.value === null)
? LOANDETAILS_CONST.MANDATORY_ADMIN
: LOANDETAILS_CONST.VALID_ADMIN}</Text>}
</View>
</View>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
<View style={{ width: '45%', marginTop: 15 }}>
<FloatingLabelInput
// editable={!this.state.isViewOnly}
editable={false}
label={LOANDETAILS_CONST.NACHCHARGES}
containerStyles={inputStyle1}
maxLength={10}
keyboardType='numeric'
value={this.state.nachCharges.value || undefined}
onChangeText={(text) => {
this.setState({
nachCharges: {
...this.state.nachCharges,
value: text,
}
}, () => {
this.isNachCharges(this.state.nachCharges.value);
});
}}
customLabelStyles={{
colorFocused: colors.COLOR_BLUE,
colorBlurred: colors.COLOR_LIGHT_GREY,
fontSizeFocused: 15,
fontSizeBlurred: 15,
}}
inputStyles={inputTextPasswordStyle}
/>
<View style={separatorStyle} />
{!this.state.nachCharges.isValid &&
<Text style={errorLabel}>
{(this.state.nachCharges.value === "" ||
this.state.nachCharges.value === null)
? LOANDETAILS_CONST.MANDATORY_NACH
: `Nach Charges must be greater than $
{this.state.nachChargesMaster}`}</Text>}
</View>
}
customArrowUp={() => <Image source={UP_ARROW} />}
customArrowDown={() => <Image source={DOWN_ARROW} />}
labelStyle={textStyle}
selectedLabelStyle={textStyle1}
/>
<View style={[separatorStyle]} />
{!this.state.pfAmountType.isValid && (
<Text style={errorLabel}>PF Amount Type is mandatory.</Text>
)}
</View>
<View style={{ width: '45%', flexDirection: 'row' }}>
<View style={{ width: this.state.pfAmountType.value == 'Number' ?
"100%" : '80%', marginTop: 14 }}>
<FloatingLabelInput
// editable={!this.state.isViewOnly}
editable={false}
label={LOANDETAILS_CONST.PROCESSINGFEES}
containerStyles={inputStyle1}
maxLength={10}
keyboardType='numeric'
value={this.state.processingFees.value || undefined}
onChangeText={(text) => {
this.setState({
processingFees: {
...this.state.processingFees,
value: text,
}
}, () => {
this.isProcessingFees(this.state.processingFees.value);
});
}}
customLabelStyles={{
colorFocused: colors.COLOR_LIGHT_NAVY_BLUE,
colorBlurred: colors.COLOR_LIGHT_GREY,
fontSizeFocused: 15,
fontSizeBlurred: 15,
}}
inputStyles={inputTextPasswordStyle}
/>
<View style={separatorStyle} />
{!this.state.processingFees.isValid &&
<Text style={errorLabel}>
{(this.state.processingFees.value === "" ||
this.state.processingFees.value === null)
? LOANDETAILS_CONST.MANDATORY_PROCESSINGFEES :
this.state.pfAmountType.value === 'Number' &&
(parseInt(this.state.processingFees.value) < parseInt(this.state.pfAmount1) ||
parseInt(this.state.processingFees.value) == parseInt(this.state.pfAmount1)) ?
`Amount cannot be lesser than ${this.state.pfAmount1} Rs` :
LOANDETAILS_CONST.VALID_PROCESSINGFEES}</Text>}
</View>
{
this.state.pfAmountType.value != 'Number' ?
<View style={{ width: '20%', marginTop: 45 }}>
<Text>%</Text>
</View>
: null
}
</View>
</View>
<View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
</View>
</View>
}, () => {
// this.isOtherCharges(this.state.otherCharges.value);
});
}}
customLabelStyles={{
colorFocused: colors.COLOR_LIGHT_NAVY_BLUE,
colorBlurred: colors.COLOR_LIGHT_GREY,
fontSizeFocused: 15,
fontSizeBlurred: 15,
}}
inputStyles={inputTextPasswordStyle}
/>
<View style={[separatorStyle, { marginBottom: 10 }]} />
{!this.state.otherCharges.isValid &&
<Text style={errorLabel}>
{(this.state.otherCharges.value === "" ||
this.state.otherCharges.value === null)
? LOANDETAILS_CONST.MANDATORY_OTHERCHARGES
: LOANDETAILS_CONST.VALID_OTHERCHARGES}</Text>}
</View> */}
</View>
</View>
renderRadio() {
return this.state.sourceType.map((value, index) => (
<View key={index}>
<RadioButton
title={value.title}
isSelected={
this.state.selectedSourceType.toLowerCase() ===
value.title.toLowerCase()
? true
: false
}
onPress={() => {
if (!this.state.isViewOnly && value.title == 'Yes') {
return this.selectRadioButton(value, index);
}
}}
/>
</View>
));
}
renderOPDRadio() {
return this.state.sourceType.map((value, index) => (
<View key={index}>
<RadioButton
title={value.title}
isSelected={
this.state.selectedSourceType3.toLowerCase() ===
value.title.toLowerCase()
? true
: false
}
onPress={() => {
if (!this.state.isViewOnly) {
return this.selectRadioButton3(value, index);
}
}}
/>
</View>
));
}
renderRSARadio() {
return this.state.sourceType.map((value, index) => (
<View key={index}>
<RadioButton
title={value.title}
isSelected={
this.state.selectedSourceType5.toLowerCase() ===
value.title.toLowerCase()
? true
: false
}
onPress={() => {
if (!this.state.isViewOnly) {
return this.selectRadioButton5(value, index);
}
}}
/>
</View>
));
}
renderRadioButton() {
return this.state.sourceType2.map((value, index) => (
<View key={index}>
<RadioButton
title={value.title}
isSelected={
this.state.selectedSourceType2.toLowerCase() ===
value.title.toLowerCase()
? true
: false
}
onPress={() => {
if (!this.state.isViewOnly) {
return this.selectRadioButton2(value, index);
}
}}
/>
</View>
));
}
renderRSARadioButton() {
return this.state.sourceType2.map((value, index) => (
<View key={index}>
<RadioButton
title={value.title}
isSelected={
this?.state?.isRsaAddedInLoan?.toLowerCase() ===
value.title.toLowerCase()
? true
: false
}
onPress={() => {
if (!this.state.isViewOnly) {
return this.selectRSARadioButton(value, index);
}
}}
/>
</View>
));
}
renderOPDRadioButton() {
return this.state.sourceType2.map((value, index) => (
<View key={index}>
<RadioButton
title={value.title}
isSelected={
this?.state?.isOpdAddedInLoan?.toLowerCase() ===
value.title.toLowerCase()
? true
: false
}
onPress={() => {
if (!this.state.isViewOnly) {
return this.selectOPDRadioButton(value, index);
}
}}
/>
</View>
));
}
renderOPDAmountRadioButton() {
return this.state.sourceType2.map((value, index) => (
<View key={index}>
<RadioButton
title={value.title}
isSelected={
this.state.selectedSourceType4.toLowerCase() ===
value.title.toLowerCase()
? true
: false
}
onPress={() => {
if (!this.state.isViewOnly) {
return this.selectRadioButton4(value, index);
}
}}
/>
</View>
));
}
renderOPDCoverage() {
const {
loanTextMain, radioContainer2, inputStyle, loanMainView, textStyle,
errorLabel, separatorStyle,
addressStyle, labelDateOfIncStyle, inputTextPasswordStyle,
calendarIconWithText, textForInputStyle
} = LoanDetailsStyles;
return (
<View style={loanMainView}>
{/* <Text style={[loanTextMain, { color:
colors.COLOR_LIGHT_NAVY_BLUE }]}>{'OPD Coverage'}</Text> */}
<View style={{ marginTop: 15, }}>
<Text style={[loanTextMain]}>Do you want to take RSA?*</Text>
<View style={radioContainer2}>{this.renderRSARadio()}</View>
</View>
<View style={[{ height: 1 }]} />
{!this.state.selectedSourceValid3 && (
<Text style={errorLabel}>{this.state.selectedSourceType5 === "" ? 'Please
Select an Option' : null}</Text>
)}
{this.state.selectedSourceType5 == 'Yes' &&
<>
<View style={{ marginTop: 15 }}>
<Text style={{
color: colors.COLOR_LIGHT_NAVY_BLUE,
fontFamily: APP_FONTS.NunitoRegular,
fontSize: 16,
marginLeft: 4
}}>
{'Plan Name*'}
</Text>
<DropDownPicker
disabled={this.state.isViewOnly}
controller={(instance) => (this.controller = instance)}
items={this.state.dropDownItem}
containerStyle={{ marginTop: 5, height: 30, width: '100%',
marginBottom: 15 }}
style={{ backgroundColor: '#ffffff', borderWidth: 0 }}
itemStyle={{
justifyContent: 'flex-start',
marginLeft: 4,
}}
placeholder={''}
defaultValue={this?.state?.planName?.value || ''}
dropDownStyle={{ backgroundColor: '#ffffff' }}
onChangeItem={(item) => {
this.setState({
planName: item,
rsaAmount: item.amount
});
}}
customArrowUp={() => <Image source={UP_ARROW} />}
customArrowDown={() => <Image source={DOWN_ARROW} />}
labelStyle={textStyle}
selectedLabelStyle={[textStyle, { color: colors.COLOR_BLACK }]}
/>
</View>
<View style={[separatorStyle, { height: 1, width: '100%' }]} />
</View>
)
}
renderLoanInsurance() {
const {
loanTextMain, loanMainView, radioContainer, errorLabel, separatorStyle
} = LoanDetailsStyles;
return (
<View style={loanMainView}>
<Text style={loanTextMain}>{LOANDETAILS_CONST.LOANPROTECT}</Text>
{/* <View style={{ flexDirection: "row", marginTop: 15 }}>
<Text style={[loanTextMain, { marginTop: 3, fontSize:
16 }]}>{LOANDETAILS_CONST.LIFE_INSURANCE}</Text>
<View style={radioContainer}>{this.renderRadio()}</View>
</View> */}
<View style={[{ height: 1 }]} />
{!this.state.selectedSourceValid && (
<Text style={errorLabel}>{this.state.selectedSourceType === "" ? 'Please
Select an Option' : null}</Text>
)}
</View>
)
}
renderNomineeDetails() {
const {
loanTextMain, addressStyle, labelDateOfIncStyle, errorLabel, inputStyle,
separatorStyle, textInputStyleNominee, radioContainer2, inputTextPasswordStyle,
calendarIconWithText, textForInputStyle
} = LoanDetailsStyles;
return (
<View>
<View style={{ marginTop: 15 }}>
<FloatingLabelInput
editable={this.state.isViewOnly ? false : true}
label={LOANDETAILS_CONST.PREMIUMAMOUT}
value={this.state.premiumAmount.value || undefined}
containerStyles={inputStyle}
maxLength={10}
keyboardType={'numeric'}
onChangeText={(text) => {
this.setState(
{
premiumAmount: {
...this.state.premiumAmount,
value: text,
},
}, () => {
this.checkPremiumAmount(this.state.premiumAmount.value);
this.isPremiumAmount(this.state.premiumAmount.value);
this.emiamount();
}
);
}}
onBlur={(text) => {
parseInt(this.state.premiumAmount.value) <
parseInt(this.state.defaultPremiumAmount.value) ? this.setState(
{
premiumAmount: {
...this.state.premiumAmount,
value: this.state.defaultPremiumAmount.value,
},
}, () => {
this.checkPremiumAmount(this.state.premiumAmount.value);
this.isPremiumAmount(this.state.premiumAmount.value);
this.emiamount();
}
) : null
}}
customLabelStyles={{
colorFocused: colors.COLOR_LIGHT_NAVY_BLUE,
colorBlurred: colors.COLOR_LIGHT_GREY,
fontSizeFocused: 15,
fontSizeBlurred: 15,
}}
inputStyles={inputTextPasswordStyle}
/>
</View>
<View style={[separatorStyle, { height: 1, width: '50%' }]} />
{this.state.defaultPremiumAmount.isValid ? !
this.state.premiumAmount.isValid &&
<Text style={errorLabel}>
{(this.state.premiumAmount.value === "" ||
this.state.premiumAmount.value === null)
? LOANDETAILS_CONST.MANDATORY_PREMIUMAMOUNT
: LOANDETAILS_CONST.VALID_PREMIUMAMOUNT}</Text> :
<Text style={errorLabel}>
Premium Amount cannot be smaller than 1500
</Text>}
</View>
)
}
renderRelationDropDown() {
const {
viewDrop5,
separatorStyle,
textStyle,
textStyle1,
textStyleDrop,
errorLabel,
} = LoanDetailsStyles;
return (
<View style={viewDrop5}>
<Text style={textStyleDrop}>Relationship*</Text>
<DropDownPicker
disabled={this.state.isViewOnly}
items={this.state.dropDownRelation}
containerStyle={{ flex: 1 }}
style={{ backgroundColor: '#ffffff', borderWidth: 0 }}
itemStyle={{
justifyContent: 'flex-start',
marginLeft: 4,
}}
placeholder={
this.state.selectedRelation.value !== ''
? this.state.selectedRelation.value
: ""
}
dropDownStyle={{ backgroundColor: '#ffffff' }}
onChangeItem={(item) =>
this.setState({ selectedRelation: { ...item, isValid: true } }, () => {
this.isRelation(this.state.selectedRelation.value);
})
}
customArrowUp={() => <Image source={UP_ARROW} />}
customArrowDown={() => <Image source={DOWN_ARROW} />}
labelStyle={textStyle}
selectedLabelStyle={textStyle1}
/>
<View style={[separatorStyle, { height: 1, marginBottom: 10 }]} />
{!this.state.selectedRelation.isValid && (
<Text style={errorLabel}>{LOANDETAILS_CONST.MANDATORY_RELATION}</Text>
)}
</View>
);
}
render() {
const {
mainContainer,
mainHeadingText,
buttonContainer,
cancelButtonStyle,
cancelButtonTitleStyle,
separatorStyle
} = LoanDetailsStyles;
return (
<WaveBackground>
<StatusBar
backgroundColor={colors.COLOR_WHITE}
barStyle={'dark-content'}
translucent={false}
hidden={false}
/>
<Header label={LOANDETAILS_CONST.HEADER} showLeftIcon={false} onPress={()
=> {
}
} />
<View style={{ alignContent: 'center' }}>
<View style={{}}>
<DottedProgressBar
totalSteps={this.state.indSelfSoleFlag ? [1, 2, 3, 4, 5] : [1, 2, 3,
4, 5, 6]}
currentIndex={this.state.indSelfSoleFlag ? 4 : 4} />
</View>
</View>
<View style={mainContainer}>
<Text style={mainHeadingText}>Loan Details</Text>
<ScrollView keyboardShouldPersistTaps="handled">
{this.renderDropDownVehicle()}
{this.renderDropDownBrandofVehicle()}
{this.renderDropDownModel()}
{this.renderDropDownSubModel()}
{this.renderDropDownDealer()}
{this.renderDropDownSubDealer()}
{this.renderDropDownSchemeCode()}
{this.renderCharges()}
{this.renderOPDCoverage()}
{this.renderLoanInsurance()}
{this.state.selectedSourceType === 'Yes' &&
this.renderNomineeDetails()}
{this.renderSlider()}
<View style={buttonContainer}>
<Button
title={this.state.cancelButtonTitle}
onPress={() => {
if (this.state.cancelButtonTitle.toLowerCase() === 'cancel') {
this.props.navigation.navigate('LeadList');
}
}}
customContainerStyle={cancelButtonStyle}
cutomTitleStyle={cancelButtonTitleStyle}
/>
<Button
title={LOANDETAILS_CONST.BUTTON_NEXT}
isDisabled={this.state.isViewOnly || this.state.saveEnable}
onPress={() => {
console.log(this.state.opdPlanName.value,this.state.planName.value,this.state.selec
tedSourceType5,"this.state.opdPlanName.value");
Keyboard.dismiss();
this.isLoanVehicleBrand();
this.isLoanVehicleDetails();
this.isLoanVehicleModel();
this.isLoanVehicleSubModel();
this.isSelectedDealer();
this.isSechemeCode();
this.isPFType();
this.isValueRateofInterest(this.state.valueRateofInterest.value);
this.isDealerCharges(this.state.dealerCharges.value);
this.isProcessingFees(this.state.processingFees.value);
this.isDealerPayout(this.state.dealerPayout.value);
this.isInsurance(this.state.insurance.value);
this.isOnRoadPrice(this.state.onRoadPrice.value);
this.isUserInputEmi(this.state.userInputEmi.value);
this.isExShowRoomPrice(this.state.exShowroomPrice.value)
this.isBureauCharges(this.state.bureauCharges.value);
this.isOtherCharges(this.state.otherCharges.value);
this.isSelectedSourceValid();
// uncomment opd
this.isSelectedSourceValid3(),
this.isSelectedSourceValid5(),
(this.state.selectedSourceType == 'Yes' ? (
this.isPremiumAmount(this.state.premiumAmount.value),
this.isSelectedSourceValid2()
)
: null)
this.isDealerSubvention(this.state.dealerSubvention.value);
this.isAdminFees(this.state.adminFees.value);
this.isNachCharges(this.state.nachCharges.value);
this.isPreEMI(this.state.preEMI.value);
this.isPodCharges(this.state.podCharges.value);
this.isConvenienceCharges(this.state.convenienceCharges.value);
this.isStampDuty(this.state.stampDuty.value);
// this.isDealerPayoutType();
if (this.state.valuetR < 6) {
handleError("Tenure is less than 6 month")
}
else if (this.state.valueTenure == 0) {
handleError("Tenure is less than 6 month")
}
else if (this.state.valuetR > this.state.tenureMaxValue) {
handleError(`Tenure is greater than $
{this.state.tenureMaxValue} month`)
}
else if (this.state.selectedSourceType5 == 'Yes' &&
this.state.planName.value == '') {
handleError(`please select RSA Plan`)
}
else if (this.state.selectedSourceType3 == 'Yes' &&
this.state.opdPlanName.value == '') {
handleError(`please select Hospicash Plan`)
}
else if (
this.state.loanVehicleDetails.value != null &&
this.state.loanVehicleDetails.value != '' &&
this.state.loanVehicleBrand.value != null &&
this.state.loanVehicleBrand.value != '' &&
this.state.loanVehicleModel.value != null &&
this.state.loanVehicleModel.value != '' &&
// this.state.valueRateofInterest.value != '' &&
this.state.valueRateofInterest.value != null &&
this.state.valueRateofInterest.isValid &&
this.state.loanVehicleSubModel.value != null &&
this.state.loanVehicleSubModel.value != '' &&
this.state.selectedDealer.value != null &&
this.state.selectedDealer.value != '' &&
this.state.selectedSchemeCode.value != null &&
this.state.selectedSchemeCode.value != '' &&
this.state.selectedDealer.value != null &&
this.state.selectedDealer.value != '' &&
this.state.dealerCharges.value != null &&
this.state.dealerCharges.value != "" &&
this.state.dealerSubvention.value != null &&
this.state.dealerSubvention.value != "" &&
this.state.adminFees.value != null &&
this.state.adminFees.value != "" &&
this.state.nachCharges.value != null &&
this.state.nachCharges.value != "" &&
this.state.nachCharges.isValid &&
this.state.preEMI.value != null &&
this.state.preEMI.value != "" &&
this.state.podCharges.value != null &&
this.state.podCharges.value != "" &&
this.state.convenienceCharges.value != null &&
this.state.convenienceCharges.value != "" &&
this.state.exShowroomPrice.value != null &&
this.state.exShowroomPrice.value != undefined &&
this.state.exShowroomPrice.value != "" &&
this.state.exShowroomPrice.isValid &&
this.state.insurance.value != null &&
this.state.insurance.value != undefined &&
this.state.insurance.value != "" &&
this.state.insurance.isValid &&
this.state.onRoadPrice.value != null &&
this.state.onRoadPrice.value != undefined &&
this.state.onRoadPrice.value != "" &&
this.state.onRoadPrice.isValid &&
this.state.userInputEmi.value != null &&
this.state.userInputEmi.value != undefined &&
this.state.userInputEmi.value != "" &&
this.state.userInputEmi.isValid &&
this.state.stampDuty.value != null &&
this.state.stampDuty.value != "" &&
this.state.stampDuty.isValid &&
this.state.pfAmountType.value != null &&
this.state.pfAmountType.value != "" &&
this.state.pfAmountType.isValid &&
this.state.processingFees.value != null &&
this.state.processingFees.value != "" &&
this.state.processingFees.isValid &&
this.state.dealerPayout.value != null &&
this.state.dealerPayout.value != undefined &&
this.state.dealerPayout.value != "" &&
this.state.dealerPayout.isValid &&
this.state.dealerPayoutType.isValid &&
this.state.bureauCharges.value != null &&
this.state.bureauCharges.value != "" &&
this.state.otherCharges.value != null &&
this.state.otherCharges.value != "" &&
// uncomment opd
this.state.selectedSourceType3 != "" &&
this.state.selectedSourceType5 != "" &&
this.state.schemeNameValid &&
(this.state.selectedSourceType == 'Yes' ? (
this.state.selectedSourceType2 != "" &&
this.state.premiumAmount.value !== '' &&
this.state.premiumAmount.isValid &&
this.state.defaultPremiumAmount.isValid
)
: this.state.selectedSourceType != "")
) {
this.state.processingFees.isValid ?
this.props.saveUpdateLoanINFO({
data: {
emi: this.state.emi,
schemeDealerName:
this.state.selectedSchemeCode.dealerName,
schemeLocation: this.state.branchName,
opdPlanId: this.state.opdPlanName.opdCoveragePlanId,
isOpdCoverage: this.state.selectedSourceType3,
opdCoverage: this.state.opdAmount,
isRsa: this.state.selectedSourceType5,
rsaAmount: this.state.rsaAmount,
planId: this.state.planName.planId,
isRsaAddedInLoan: this.state.isRsaAddedInLoan,
isOpdAddedInLoan: this.state.isOpdAddedInLoan,
pfAmountTypeMaster: this.state.pfAmountTypeMaster,
nachChargesMaster: this.state.nachChargesMaster,
stampDutyMaster: this.state.stampDutyMaster,
pfAmountMaster: this.state.pfAmountMaster,
valueaR: Number(this.state.valueaR),
// this.state.selectedSourceType2 == 'Yes' ?
// Number(this.state.valueaR) +
Number(this.state.premiumAmount.value) : Number(this.state.valueaR),
valuetR: this.state.valuetR,
ltvGridPercentage: this.state.ltvGridPercentage,
ltvGridId: this.state.ltvGridId,
ltvGridRule: this.state.ltvGridRule,
premiumAmount: this.state.premiumAmount.value,
relationType: this.state.selectedRelation.value,
otherCharges: this.state.otherCharges.value,
processingFees: this.state.processingFees.value,
rateOfInterest: this.state.valueRateofInterest.value,
loanVehicleBrand: this.state.loanVehicleBrand.value,
isPremiumamount: this.state.selectedSourceType2,
applicantUniqueId: this.state.applicantUniqueId,
loanVehicleModel: this.state.loanVehicleModel.value,
id: this.state.idToEdit,
maxAmt: this.state.maxAmount,
startDate: this.state.startDate,
endDate: this.state.endDate,
schemeCode: this.state.selectedSchemeCode.value,
schemeName: this.state.schemeName,
ltv: this.state.ltv,
pfAmountType: this.state.pfAmountType.value,
pfAmountMaster: this.state.pfAmount1,
//insuranceAmount: this.state.insuranceAmount.value,
bureauCharges: this.state.bureauCharges.value,
address: this.state.addressNominee.value,
loanVehicleSubModel:
this.state.loanVehicleSubModel.value,
loanVehicleDetails: this.state.loanVehicleDetails.value,
dateOfBirth: this.state.dateOfIncorporationText,
isguarantor: false,
leadCode: this.state.leadCode,
subDealerName: this.state.selectedSubDealer.value,
name: this.state.nameNominee.value,
selectedDealer: this.state.selectedDealer.value,
islifeInsurance: this.state.selectedSourceType ===
'Yes' ? true : false,
ismainapplicant: true,
dealerCharges: this.state.dealerCharges.value,
dealerSubvention: this.state.dealerSubvention.value,
adminFees: this.state.adminFees.value,
exShowroomPrice: this.state.exShowroomPrice.value,
insurance: this.state.insurance.value,
nachCharges: this.state.nachCharges.value,
preEmi: this.state.preEMI.value,
convenienceCharges: this.state.convenienceCharges.value,
pddCharges: this.state.podCharges.value,
dealerPayout: this.state.dealerPayout.value,
dealerPayouttype:
this?.state?.dealerPayoutType?.value?.toLowerCase(),
stampDuty: this.state.stampDuty.value,
amountSelected: this.state.amountSelected,
advanceEmi:this.state.advanceEmi,
dealerOrp:this.state.onRoadPrice.value,
userInputEmi:this.state.userInputEmi.value,
ezpayoutSchemeId:this.state.ezpayoutSchemeId,
ezManagerSchemeId:this.state.ezManagerSchemeId
},
callback: () => {
this.setState({
isDataSaved: true, saveEnable: true,
});
const dataToAPI = {
applicant_uniqueid: this.state.applicantUniqueId,
lead_code: this.state.leadCode,
roleId:
this.props.userDataSelector.userData.data.roleId
};
this.props.getLoanSummary({
dataToAPI,
callback: (response) => {
this.setState({
isViewOnly:
response?.mainapplicant?.loanSchemeFreeze ?
true :
response?.modelAccess[0]?.read ? true :
false,
// branchName: response.branchName,
// tenureMaxValue:
response?.mainapplicant?.maxTenure,
// fiWaiverStatus:
response?.mainapplicant?.fiWaiverStatus
})
}
});
this.apiCall()
},
})
: null
}
else {
}
}}
/>
</View>
<View style={buttonContainer}>
<Button
title={'Loan Summary'}
//isDisabled={!this.state.mainApplicantSummary === true}
onPress={() => {
this.props.navigation.navigate('LoanSummary', {
leadName: this.state.leadName,
applicantUniqueId: this.state.applicantUniqueId,
leadCode: this.state.leadCode,
mobileNumber: this.state.mobileNumberFromProps,
coapplicantUniqueId: this.state.coapplicantUniqueId,
ismainapplicant: this.state.ismainapplicant,
iscoapplicant: this.state.iscoapplicant,
isguarantor: this.state.isguarantor,
isViewOnly: this.state.isViewOnly || false,
});
}}
/>
<View style={{ flex: 1, marginLeft: 10 }}>
<Button
title={LOANDETAILS_CONST.BUTTON_TITLE_NEXT}
isDisabled={ this.state.isViewOnly ? true : !
this.state.isDataSaved }
onPress={() => {
this.props.navigation.navigate('LoanOffer', {
applicantUniqueId: this.state.applicantUniqueId,
redirection: 'qde',
offerType: 'tentative',
creditButtonFlag: this.state.creditButtonFlag,
leadName: this.state.leadName,
applicantUniqueId: this.state.applicantUniqueId,
leadCode: this.state.leadCode,
mobileNumber: this.state.mobileNumberFromProps,
coapplicantUniqueId: this.state.coapplicantUniqueId,
ismainapplicant: this.state.ismainapplicant,
iscoapplicant: this.state.iscoapplicant,
isguarantor: this.state.isguarantor,
index: this.props.navigation.state.params.index
});
// this.state.fiWaiverStatus ?
// this.props.navigation.navigate('OtherDetails', {
// leadName: this.state.leadName,
// applicantUniqueId: this.state.applicantUniqueId,
// leadCode: this.state.leadCodeFromProps,
// mobileNumber: this.state.mobileNumberFromProps,
// coapplicantUniqueId: this.state.coapplicantUniqueId,
// ismainapplicant: this.state.ismainapplicant,
// iscoapplicant: this.state.iscoapplicant,
// isguarantor: this.state.isguarantor,
// index: this.props.navigation.state.params.index
// })
// :
// this.props.navigation.navigate('FiWaiver', {
// leadCode: this.state.leadCode,
// leadName: this.state.leadName,
// applicantUniqueId: this.state.applicantUniqueId,
// iscoapplicant: this.state.iscoapplicant,
// isguarantor: this.state.isguarantor,
// ismainapplicant: this.state.ismainapplicant,
// coapplicantUniqueId: this.state.coapplicantUniqueId,
// });
}}
/>
</View>
</View>
</ScrollView>
</View>
</WaveBackground>
);
}
}
LoanDetails.propTypes = {
userDataSelector: PropTypes.object,
};