rental component merged :ps

This commit is contained in:
venbatechnologies@gmail.com 2019-03-11 19:59:48 +05:30
commit 5045832a78
2 changed files with 78 additions and 69 deletions

View File

@ -182,7 +182,7 @@
<mat-label>Type of Units as per Loan Applicants</mat-label> <mat-label>Type of Units as per Loan Applicants</mat-label>
<mat-select placeholder="" <mat-select placeholder=""
formControlName="unit_type" [compareWith]="compareObjects" required> formControlName="unit_type" [compareWith]="compareObjects" required>
<mat-optgroup *ngFor="let ugroup of unitTypeList" [label]="ugroup.groupName"> <mat-optgroup *ngFor="let ugroup of unitTypeList" [label]="ugroup.groupName" [disabled]="_rentalForm.value.nature_property.id>1 && _rentalForm.value.nature_property.id!=ugroup.groupID">
<mat-option *ngFor="let unit of ugroup.groupValues" [value]="unit"> <mat-option *ngFor="let unit of ugroup.groupValues" [value]="unit">
{{unit.name}} {{unit.name}}
</mat-option> </mat-option>
@ -517,7 +517,7 @@
</mat-card-content> </mat-card-content>
<mat-card-actions align="end"> <mat-card-actions align="end">
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeUnit(u)" *ngIf="_rentalForm.value.property_unit_details.length>0" <button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeUnit(u)" *ngIf="_rentalForm.value.property_unit_details.length>1"
matTooltip="Remove Unit" matTooltipPosition="above"> matTooltip="Remove Unit" matTooltipPosition="above">
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
</button> </button>

View File

@ -31,7 +31,7 @@ export class RentalVerificationComponent implements OnInit {
relationToList: any=[]; relationToList: any=[];
rentAmtInwords : String; rentAmtInwords : String;
paymentOptions: any=[{id:1,name:"Received in Cash"},{id:2,name:"Received through Banking Channel"},{id:3,name:"Combination of Cash & Bank"}]; paymentOptions: any=[{id:1,name:"Received in Cash"},{id:2,name:"Received through Banking Channel"},{id:3,name:"Combination of Cash & Bank"}];
propertyNature: any=[{id:2,name:"ResiDential Property"},{id:3,name:"Commercial Property"},{id:4,name:"Industrial Property"},{id:1,name:"Others (Please Specify)"}]; propertyNature: any=[{id:2,name:"Residential Property"},{id:3,name:"Commercial Property"},{id:4,name:"Industrial Property"},{id:1,name:"Others (Please Specify)"}];
unitTypeList: any=[]; unitTypeList: any=[];
stateList:any=[]; stateList:any=[];
cityList:any=[]; cityList:any=[];
@ -60,7 +60,6 @@ export class RentalVerificationComponent implements OnInit {
} }
}; };
constructor(notifier: NotifierService, private _pd: PdTrigerService ,private _fb: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: any,private dialogRef: MatDialogRef<RentalVerificationComponent>) { constructor(notifier: NotifierService, private _pd: PdTrigerService ,private _fb: FormBuilder, @Inject(MAT_DIALOG_DATA) public data: any,private dialogRef: MatDialogRef<RentalVerificationComponent>) {
this.pdid = this.data.pdmaster_details.pd_id; this.pdid = this.data.pdmaster_details.pd_id;
this.notifier = notifier; this.notifier = notifier;
this.form_id = 17; this.form_id = 17;
@ -87,9 +86,9 @@ export class RentalVerificationComponent implements OnInit {
let industrialProperty = [{id:2,name:'Factory',group_id:3},{id:3,name:'Industrial Shed',group_id:3},{id:1,name:'Other (Please Specify)',group_id:3}]; let industrialProperty = [{id:2,name:'Factory',group_id:3},{id:3,name:'Industrial Shed',group_id:3},{id:1,name:'Other (Please Specify)',group_id:3}];
this.unitTypeList.push({groupName:'Residential Property',groupValues:resiDentialProperty}); this.unitTypeList.push({groupID:2,groupName:'Residential Property',groupValues:resiDentialProperty});
this.unitTypeList.push({groupName:'Commercial Property',groupValues:commercialProperty}); this.unitTypeList.push({groupID:3,groupName:'Commercial Property',groupValues:commercialProperty});
this.unitTypeList.push({groupName:'Industrial Property',groupValues:industrialProperty}); this.unitTypeList.push({groupID:4,groupName:'Industrial Property',groupValues:industrialProperty});
} }
@ -260,6 +259,7 @@ loadFormData(){
params.pd_id = this.pdid; params.pd_id = this.pdid;
params.pd_form_id = this.form_id; params.pd_form_id = this.form_id;
this._pd.retriveForm(params).subscribe(data => { this._pd.retriveForm(params).subscribe(data => {
if(data.dataStatus){
let rentalVal = data.records; let rentalVal = data.records;
rentalVal.pdid = this.pdid; rentalVal.pdid = this.pdid;
rentalVal.formid = this.form_id; rentalVal.formid = this.form_id;
@ -290,7 +290,7 @@ loadFormData(){
element.agreement_date ? control.controls[index].addControl('agreement_date', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_date'); element.agreement_date ? control.controls[index].addControl('agreement_date', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_date');
element.agreement_no_months ? control.controls[index].addControl('agreement_no_months', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_no_months'); element.agreement_no_months ? control.controls[index].addControl('agreement_no_months', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_no_months');
element.agreement_expiring_date ? control.controls[index].addControl('agreement_expiring_date', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_expiring_date'); element.agreement_expiring_date ? control.controls[index].addControl('agreement_expiring_date', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_expiring_date');
element.rental_remaining_months ? control.controls[index].addControl('rental_remaining_months', new FormControl('', Validators.required)) : control.controls[index].removeControl('rental_remaining_months'); (element.rental_remaining_months=='' || element.rental_remaining_months>=0) ? control.controls[index].addControl('rental_remaining_months', new FormControl('', Validators.required)) : control.controls[index].removeControl('rental_remaining_months');
element.agreement_monthly_rent_amount ? control.controls[index].addControl('agreement_monthly_rent_amount', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_monthly_rent_amount'); element.agreement_monthly_rent_amount ? control.controls[index].addControl('agreement_monthly_rent_amount', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_monthly_rent_amount');
element.agreement_security_deposit_amount ? control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_security_deposit_amount'); element.agreement_security_deposit_amount ? control.controls[index].addControl('agreement_security_deposit_amount', new FormControl('', Validators.required)) : control.controls[index].removeControl('agreement_security_deposit_amount');
element.differences_loanapplicant_rentagreement ? control.controls[index].addControl('differences_loanapplicant_rentagreement', new FormControl('', Validators.required)) : control.controls[index].removeControl('differences_loanapplicant_rentagreement'); element.differences_loanapplicant_rentagreement ? control.controls[index].addControl('differences_loanapplicant_rentagreement', new FormControl('', Validators.required)) : control.controls[index].removeControl('differences_loanapplicant_rentagreement');
@ -320,11 +320,19 @@ loadFormData(){
element.amount_received_bank_per_met ? control.controls[index].addControl('amount_received_bank_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_bank_per_met'); element.amount_received_bank_per_met ? control.controls[index].addControl('amount_received_bank_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('amount_received_bank_per_met');
element.payment_received_reason_per_met ? control.controls[index].addControl('payment_received_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason_per_met'); element.payment_received_reason_per_met ? control.controls[index].addControl('payment_received_reason_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_received_reason_per_met');
element.payment_difference_per_met ? control.controls[index].addControl('payment_difference_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_difference_per_met'); element.payment_difference_per_met ? control.controls[index].addControl('payment_difference_per_met', new FormControl('', Validators.required)) : control.controls[index].removeControl('payment_difference_per_met');
console.log(control)
}); });
} }
} }
this._rentalForm.patchValue(rentalVal); this._rentalForm.patchValue(rentalVal);
}
else{
let control: any = <FormArray>this._rentalForm.controls['property_unit_details'];
control.push(this.createUnitDetails(''));
}
}); });
} }
@ -525,6 +533,7 @@ calculateExpiryDate(e: any,index){
let getEnteredMonth = control.value[index].agreement_no_months > 0 ? control.value[index].agreement_no_months : '0'; let getEnteredMonth = control.value[index].agreement_no_months > 0 ? control.value[index].agreement_no_months : '0';
if(getSeletedDate && getEnteredMonth>0){ if(getSeletedDate && getEnteredMonth>0){
let modifySeletedDate:any = new Date(new Date(getSeletedDate).setMonth(new Date(getSeletedDate).getMonth() + Number(getEnteredMonth))); let modifySeletedDate:any = new Date(new Date(getSeletedDate).setMonth(new Date(getSeletedDate).getMonth() + Number(getEnteredMonth)));
modifySeletedDate.setDate(modifySeletedDate.getDate() - 1);
let getExpiryDate=this.pipe.transform(modifySeletedDate, 'dd/MM/yyyy'); let getExpiryDate=this.pipe.transform(modifySeletedDate, 'dd/MM/yyyy');
control.controls[index].controls['agreement_expiring_date'].setValue(getExpiryDate); control.controls[index].controls['agreement_expiring_date'].setValue(getExpiryDate);
// calculate remaining month // calculate remaining month