fixes : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-05-06 13:42:30 +05:30
parent 45764746d7
commit dd9358c134
6 changed files with 123 additions and 104 deletions

View File

@ -19,7 +19,7 @@
</mat-form-field>
<mat-form-field style="width:38%" appearance="outline">
<mat-label>Applicant</mat-label>
<mat-select placeholder="" formControlName="pd_co_applicant_id" required (selectionChange)="getMobileNo($event.target.value)">
<mat-select placeholder="" formControlName="pd_co_applicant_id" required (selectionChange)="toGetMobileNo($event.value)">
<mat-option *ngFor="let appt of applicantList" [value]="appt.pd_co_applicant_id">
{{appt.applicant_name | titlecase}}
</mat-option>

View File

@ -34,7 +34,7 @@ export class InitiateAdditionalPdComponent implements OnInit {
if(this.data.applicant_id){
this.additionalPDForm.controls['pd_co_applicant_id'].setValue(this.data.applicant_id);
this.getMobileNo(this.data.applicant_id);
this.toGetMobileNo(this.data.applicant_id);
// this.additionalPDForm.controls['pd_co_applicant_id'].disable();
}
// else { this.additionalPDForm.controls['pd_co_applicant_id'].enable(); }
@ -53,8 +53,8 @@ export class InitiateAdditionalPdComponent implements OnInit {
/** To Get City And Pincode Data For Address Form
* Param 'stateID' -> selected StateId
*/
getMobileNo(applicantID: string) {
let mobile = this.applicantList.filter(val=>val.pd_co_applicant_id == this.data.applicant_id).map(val=>val.mobile_no)[0]
toGetMobileNo(applicantID) {
let mobile = this.applicantList.filter(val=>val.pd_co_applicant_id == applicantID).map(val=>val.mobile_no)[0]
if(mobile != '' && mobile != null){
this.additionalPDForm.controls['mobile_no'].setValue(mobile);
}

View File

@ -364,7 +364,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
address_label: [''],
business_years: [''],
business_month: [''],
business_address_availability: [''],
business_address_availability: ['',Validators.compose([Validators.required])],
business_is_pd_visited: [''],
business_pd_visited_remark: [''],
// this.createBusinessAssetsForAddress()
@ -963,19 +963,40 @@ if(datas.business_name_of_the_owner !== null){
if (flag == 1) {
if (value == 'yes') {
item.controls.business_years.setValidators([Validators.required]);
item.controls.business_address_availability.setValidators([Validators.required]);
item.controls.business_is_pd_visited.setValidators([Validators.required]);
item.controls.business_pd_visited_remark.setValidators([Validators.required]);
item.controls.business_ownership_type.setValidators([Validators.required]);
}
else {
item.controls.business_years.setValue('');
item.controls.business_month.setValue('');
item.controls.business_is_pd_visited.setValue('');
item.controls.business_pd_visited_remark.setValue('');
item.controls.business_ownership_type.setValue('');
item.controls.business_years.clearValidators();
item.controls.business_address_availability.clearValidators();
item.controls.business_is_pd_visited.clearValidators();
item.controls.business_pd_visited_remark.clearValidators();
item.controls.business_ownership_type.clearValidators();
item.controls.business_monthly_rented_amt.setValue('');
item.controls.business_approximate_market_value.setValue('');
item.controls.business_name_of_the_owner.setValue('');
item.controls.business_name_of_the_other_owner.setValue('');
item.controls.business_vintage.setValue('');
item.controls.business_purchase_year.setValue('');
item.controls.business_emi.setValue('');
item.controls.business_month.updateValueAndValidity();
item.controls.business_monthly_rented_amt.updateValueAndValidity();
item.controls.business_approximate_market_value.updateValueAndValidity();
item.controls.business_name_of_the_owner.updateValueAndValidity();
item.controls.business_name_of_the_other_owner.updateValueAndValidity();
item.controls.business_vintage.updateValueAndValidity();
item.controls.business_purchase_year.updateValueAndValidity();
item.controls.business_emi.updateValueAndValidity();
}
item.controls.business_years.updateValueAndValidity();
item.controls.business_address_availability.updateValueAndValidity();

View File

@ -489,6 +489,7 @@
</mat-form-field>
<mat-form-field style="width:92%">
<mat-select placeholder="Is there Working Capital Facilities?" formControlName="is_there_working_capital_available">
<!-- (selectionChange)="selectedWorkingCptl($event.value)" -->
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>

View File

@ -125,7 +125,7 @@ export class FinancialInfoComponent implements OnInit {
ngOnInit() {
this.initstockForm();
const businessActivityControl = <FormArray>this.financialForm.controls['select_working_capital_facilities_availed'];
const workingCptlControl = <FormArray>this.financialForm.controls['select_working_capital_facilities_availed'];
let params: any = {};
params.parent_pdid = this.parent_pdid;
params.pd_id = this.pdid;
@ -138,30 +138,31 @@ export class FinancialInfoComponent implements OnInit {
if (value.status == 200) {
let retriveData = value.records;
let activityData = this.av.map(item => ({ name: item.name, id: item.id }))
let exist_activity_data: any = [];
let avData = this.av.map(item => ({ name: item.name, id: item.id }))
let exist_av_data: any = [];
if (retriveData.select_working_capital_facilities_availed) {
exist_activity_data = Object.keys(retriveData.select_working_capital_facilities_availed).map(function (key) {
exist_av_data = Object.keys(retriveData.select_working_capital_facilities_availed).map(function (key) {
return retriveData.select_working_capital_facilities_availed[key].id;
});
}
let actual_businees_activity = activityData.map(item => item.id);
let check_exist_businees_activity = actual_businees_activity.map((id, index) => {
if (exist_activity_data.indexOf(id) < 0) {
activityData[index].exist_status = 0;
return activityData[index];
let actual_av = avData.map(item => item.id);
let check_exist_av = actual_av.map((id, index) => {
if (exist_av_data.indexOf(id) < 0) {
avData[index].exist_status = 0;
return avData[index];
}
else {
activityData[index].exist_status = 1;
return activityData[index];
avData[index].exist_status = 1;
return avData[index];
}
}).filter(item => item != undefined);
if (check_exist_businees_activity.length > 0) {
check_exist_businees_activity.forEach(val => {
businessActivityControl.push(this.createEntityType(val));
if (check_exist_av.length > 0) {
check_exist_av.forEach(val => {
workingCptlControl.push(this.createEntityType(val));
if (val.exist_status == 1 && val.id == 2) {
this.financialForm.addControl('bank_guarantee', new FormControl('', Validators.required));
@ -187,8 +188,8 @@ export class FinancialInfoComponent implements OnInit {
}
console.log(val);
});
console.log('check_exist_businees_activity',check_exist_businees_activity);
retriveData.select_working_capital_facilities_availed = check_exist_businees_activity;
console.log('check_exist_businees_activity',check_exist_av);
retriveData.select_working_capital_facilities_availed = check_exist_av;
}
@ -239,7 +240,11 @@ export class FinancialInfoComponent implements OnInit {
});
retriveData.estimated_value = result_val;
} else {
estimated_val.push(this.createValue(''));
if(retriveData.is_financial_customer == 'no'){
estimated_val.push(this.createValue(''));
}
}
}
else
@ -249,35 +254,29 @@ export class FinancialInfoComponent implements OnInit {
retriveData.formid = this.form_id;
retriveData.company_id = this.company_id;
retriveData.fk_createdby = this.pdid;
this.financialForm.patchValue(retriveData);
this.financialForm.setValue(retriveData);
// this.financialForm.patchValue(retriveData);
} else {
let activityData = this.av.map(item => ({ name: item.name, id: item.id }))
let exist_activity_data: any = [];
// if (data.records.select_working_capital_facilities_availed) {
// exist_activity_data = Object.keys(data.records.select_working_capital_facilities_availed).map(function (key) {
// return data.records.select_working_capital_facilities_availed[key].id;
// });
// }
let actual_businees_activity = activityData.map(item => item.id);
let check_exist_businees_activity = actual_businees_activity.map((id, index) => {
if (exist_activity_data.indexOf(id) < 0) {
activityData[index].exist_status = 0;
return activityData[index];
let avData = this.av.map(item => ({ name: item.name, id: item.id }))
let exist_av_data: any = [];
let actual_av = avData.map(item => item.id);
let check_exist_av = actual_av.map((id, index) => {
if (exist_av_data.indexOf(id) < 0) {
avData[index].exist_status = 0;
return avData[index];
}
else {
activityData[index].exist_status = 1;
return activityData[index];
avData[index].exist_status = 1;
return avData[index];
}
}).filter(item => item != undefined);
if (check_exist_businees_activity.length > 0) {
check_exist_businees_activity.forEach(val => {
businessActivityControl.push(this.createEntityType(val));
if (check_exist_av.length > 0) {
check_exist_av.forEach(val => {
workingCptlControl.push(this.createEntityType(val));
});
// businessVal.select_working_capital_facilities_availed = check_exist_businees_activity;
}
//financial_date.push(this.createDate());
//estimated_val.push(this.createValue(''));
@ -539,6 +538,53 @@ export class FinancialInfoComponent implements OnInit {
}
}
selectedWorkkingCptl(e){
console.log(e);
const workingCptlControl = <FormArray>this.financialForm.controls['select_working_capital_facilities_availed'];
let CtrlLength = workingCptlControl.controls.length;
if (CtrlLength > 0) {
let cnt = 0;
while(cnt < CtrlLength){
let ChildCtrl : any = workingCptlControl.controls[cnt]
if(ChildCtrl.controls.exist_status.value == 1 && ChildCtrl.controls.id.value == 2){
ChildCtrl.controls['exist_status'].setValue(0);
ChildCtrl.controls['exist_status'].updateValueAndValidity();
this.financialForm.removeControl('bank_guarantee');
}
if(ChildCtrl.controls.exist_status.value == 1 && ChildCtrl.controls.id.value == 3){
ChildCtrl.controls['exist_status'].setValue(0);
ChildCtrl.controls['exist_status'].updateValueAndValidity();
this.financialForm.removeControl('cash_credit_limit');
}
if(ChildCtrl.controls.exist_status.value == 1 && ChildCtrl.controls.id.value == 4){
ChildCtrl.controls['exist_status'].setValue(0);
ChildCtrl.controls['exist_status'].updateValueAndValidity();
this.financialForm.removeControl('factoring');
}
if(ChildCtrl.controls.exist_status.value == 1 && ChildCtrl.controls.id.value == 5){
ChildCtrl.controls['exist_status'].setValue(0);
ChildCtrl.controls['exist_status'].updateValueAndValidity();
this.financialForm.removeControl('forfaiting');
}
if(ChildCtrl.controls.exist_status.value == 1 && ChildCtrl.controls.id.value == 6){
ChildCtrl.controls['exist_status'].setValue(0);
ChildCtrl.controls['exist_status'].updateValueAndValidity();
this.financialForm.removeControl('letter_of_credit');
}
if(ChildCtrl.controls.exist_status.value == 1 && ChildCtrl.controls.id.value == 7){
ChildCtrl.controls['exist_status'].setValue(0);
ChildCtrl.controls['exist_status'].updateValueAndValidity();
this.financialForm.removeControl('od_limit');
}
if(ChildCtrl.controls.exist_status.value == 1 && ChildCtrl.controls.id.value == 1){
ChildCtrl.controls['exist_status'].setValue(0);
ChildCtrl.controls['exist_status'].updateValueAndValidity();
this.financialForm.removeControl('other_reason_for_working_capital_facilities_availed');
this.financialForm.removeControl('reason_for_working_capital_facilities_availed');
}
}
}
}
/** For Auto-generating FinYear */
dynamicalFinYear(){
@ -1891,53 +1937,4 @@ export class FinancialInfoComponent implements OnInit {
}
});
}
/** To Convert Amount into Words */
// inWords(e,i,flag:number){
// switch(flag){
// case 1 :
// this.FY_annualSalesInwords[i] = this._pd.convertNumberToWords(e.target.value);
// // this.placeholderName[i] = 'Weekly Instalment Amount'; break;
// break;
// case 2 :
// this.FY_netProfitAmtInwords[i] = this._pd.convertNumberToWords(e.target.value);
// //alert('Fin net Profit'+this.FY_netProfitAmtInwords[i]);
// break;
// case 3 :
// this.FY_netLossAmtInwords[i] = this._pd.convertNumberToWords(e.target.value);
// // alert('Fin net Loss'+this.FY_netLossAmtInwords[i]);
// break;
// case 4 :
// this.AV_annualSalesInwords[i] = this._pd.convertNumberToWords(e.target.value);
// break;
// case 5 :
// this.AV_netProfitAmtInwords[i] = this._pd.convertNumberToWords(e.target.value);
// break;
// case 6 :
// this.AV_netLossAmtInwords[i] = this._pd.convertNumberToWords(e.target.value);
// break;
// case 7 :
// this.AV_netProfitAmtFrmInwords[i] = this._pd.convertNumberToWords(e.target.value);
// break;
// case 8 :
// this.AV_netProfitAmtToInwords[i] = this._pd.convertNumberToWords(e.target.value);
// break;
// case 9 :
// this.AV_netLossAmtFrmInwords[i] = this._pd.convertNumberToWords(e.target.value);
// break;
// case 10 :
// this.AV_netLossAmtToInwords[i] = this._pd.convertNumberToWords(e.target.value);
// break;
// case 11 :
// this.AV_SalesFrmInwords[i] = this._pd.convertNumberToWords(e.target.value);
// break;
// case 12 :
// this.AV_SalesToInwords[i] = this._pd.convertNumberToWords(e.target.value);
// break;
// default:
// break;
// }
// }
}
}

View File

@ -56,23 +56,23 @@
</mat-list-item>
<mat-list-item role="listitem" style="height:48px !important;">
<div fxFlex="row">
<div fxFlex="row wrap">
<div fxFlex="100">
<div fxFlex="50" align="left" style="color:#e00201;">
Loan Amount
</div>
<div fxFlex="50" align="right" *ngIf="master.loan_amount">
<i class="fa-1x fa fa-rupee"></i><small style="margin-left: 2%; font-size: inherit">{{master.loan_amount}}</small>
<i class="fa-1x fa fa-rupee"></i><small style="margin-left: 2%; font-size: inherit">{{master.loan_amount}}</small><br>
</div>
</div>
</div>
<div fxFlex="row" *ngIf="master.loan_amount">
<div fxFlex="100">
<div fxFlex="100" align="right">
<span *ngIf="master.loan_amount" style="font-size:0.9rem !important;">{{master.loan_amount | numberToWords}}</span>
</div>
</div>
</div>
</mat-list-item>
<mat-list-item role="listitem" *ngIf="master.loan_amount">
<div fxFlex="100" align="right">
<div style="font-size:0.9rem !important; height: -webkit-fill-available;">{{master.loan_amount | numberToWords}} Only</div>
<!-- <div style="font-size:0.9rem !important;">{{ 9999999999 | numberToWords}} Only</div> -->
</div>
</mat-list-item>
</mat-list>