address related hanges : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-06-21 18:34:06 +05:30
parent dc50a75373
commit c210529695
4 changed files with 493 additions and 302 deletions

View File

@ -65,7 +65,7 @@
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 24%"> <mat-form-field style="width: 24%">
<mat-select placeholder="Pincode" formControlName="pincode"> <mat-select placeholder="Pincode" formControlName="pincode" (selectionChange)="setOthers($event.value,i,1)">
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option *ngFor="let PL of pincodeData" <mat-option *ngFor="let PL of pincodeData"
[value]="PL.pincode_id">{{PL.pincode}}</mat-option> [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
@ -77,9 +77,9 @@
<input matInput autocomplete="off" <input matInput autocomplete="off"
placeholder="Specify Pincode *" placeholder="Specify Pincode *"
formControlName="pincode_others" OnlyNumber type="text"> formControlName="pincode_others" OnlyNumber type="text">
<!-- <mat-error <mat-error
*ngIf="init_addr.controls['pincode_others'].hasError('required')"> *ngIf="init_addr.controls['pincode_others'].hasError('required')">
Pincode Required</mat-error> --> Pincode Required</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
@ -146,7 +146,7 @@
<mat-form-field style="width: 24%"> <mat-form-field style="width: 24%">
<mat-select placeholder="Pincode" <mat-select placeholder="Pincode"
formControlName="alternative_pincode"> formControlName="alternative_pincode" (selectionChange)="setOthers($event.value,a,2)">
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option <mat-option
*ngFor="let PL of alertnativePincodeData" *ngFor="let PL of alertnativePincodeData"
@ -158,12 +158,12 @@
<mat-form-field style="width: 24%" <mat-form-field style="width: 24%"
*ngIf="alter_addr.get('alternative_pincode').value == 1"> *ngIf="alter_addr.get('alternative_pincode').value == 1">
<input matInput autocomplete="off" <input matInput autocomplete="off"
placeholder="Specify Pincode" placeholder="Specify Pincode "
formControlName="alternative_pincode_others" formControlName="alternative_pincode_others"
OnlyNumber type="text"> OnlyNumber type="text" required>
<!-- <mat-error <mat-error
*ngIf="alter_addr.controls['alternative_pincode_others'].hasError('required')"> *ngIf="alter_addr.controls['alternative_pincode_others'].hasError('required')">
Pincode Required</mat-error> --> Pincode Required</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
@ -298,8 +298,8 @@
<mat-form-field style="width: 24%;" <mat-form-field style="width: 24%;"
*ngIf="addressForm.controls['uom'].value == 1 "> *ngIf="addressForm.controls['uom'].value == 1 ">
<input matInput placeholder="Specify UOM *" formControlName="uom_others" <input matInput placeholder="Specify UOM" formControlName="uom_others"
autocomplete="off"> autocomplete="off" required>
<mat-error <mat-error
*ngIf="addressForm.controls['uom_others'].hasError('required')"> *ngIf="addressForm.controls['uom_others'].hasError('required')">
UOM Required</mat-error> UOM Required</mat-error>
@ -307,6 +307,21 @@
</div> </div>
</div> </div>
<!-- <div fxLayout="row wrap">
<div fxFlex="100">
<mat-form-field style="width: 96%">
<mat-select placeholder="Was the Company name board sighted ?" formControlName="was_the_company_name_board_sighted"
required>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
!-- <mat-option value="not applicable">Not Applicable</mat-option> --
</mat-select>
<mat-error *ngIf="addressForm.controls['was_the_company_name_board_sighted'].hasError('required')">Was the Company name board sighted ? Required</mat-error>
</mat-form-field>
</div>
</div> -->

View File

@ -130,15 +130,16 @@ export class AddressComponent implements OnInit {
'state': datas.fk_state, 'state': datas.fk_state,
'city': datas.fk_city, 'city': datas.fk_city,
'pincode': datas.pincode_id, 'pincode': datas.pincode_id,
'pincode_others': datas.pincode_id == 1 ? datas.other_pincode :'', // 'pincode_others': datas.pincode_id == 1 ? datas.other_pincode :'',
} }
this.getCityAndPincodeDetails(datas.fk_state, index, 1); this.getCityAndPincodeDetails(datas.fk_state, index, 1);
control.push(this.createAddresses(obj)); control.push(this.createAddresses(obj));
// if(datas.pincode == 1) { this.setOthers(+datas.pincode_id, index, 1);
// let ChildCtrl: any = control.controls[index]; if(datas.pincode == 1) {
// ChildCtrl.controls['pincode_others'].setValue(datas.pincode_others); let ChildCtrl: any = control.controls[index];
// ChildCtrl.controls['pincode_others'].updateValueAndValidity(); ChildCtrl.controls['pincode_others'].setValue(datas.other_pincode);
// } ChildCtrl.controls['pincode_others'].updateValueAndValidity();
}
this.addressForm.controls.pd_location.setValue(datas.pd_location ? datas.pd_location : ''); this.addressForm.controls.pd_location.setValue(datas.pd_location ? datas.pd_location : '');
@ -179,6 +180,7 @@ export class AddressComponent implements OnInit {
} }
let initiated_address_check =data.records.hasOwnProperty('is_pd_done_on_initiated_address') ? data.records.is_pd_done_on_initiated_address : true ; let initiated_address_check =data.records.hasOwnProperty('is_pd_done_on_initiated_address') ? data.records.is_pd_done_on_initiated_address : true ;
this.addressForm.controls.is_pd_done_on_initiated_address.setValue(initiated_address_check); this.addressForm.controls.is_pd_done_on_initiated_address.setValue(initiated_address_check);
// this.addressForm.controls.was_the_company_name_board_sighted.setValue('');
this.addressForm.controls.address_form_remark.setValue(''); this.addressForm.controls.address_form_remark.setValue('');
// else{ // else{
// control.push(this.createAddresses(null)); // control.push(this.createAddresses(null));
@ -203,6 +205,7 @@ export class AddressComponent implements OnInit {
comment_locality: ['', Validators.compose([Validators.required])], comment_locality: ['', Validators.compose([Validators.required])],
estimated_area: [''], estimated_area: [''],
uom: [''], uom: [''],
// was_the_company_name_board_sighted:['', Validators.compose([Validators.required])],
address_form_remark: [''] address_form_remark: ['']
}); });
} }
@ -236,7 +239,6 @@ export class AddressComponent implements OnInit {
/** FOR Form Field For Alternative Address Array */ /** FOR Form Field For Alternative Address Array */
createAlternativeAddresses(AddressDetails): FormGroup { createAlternativeAddresses(AddressDetails): FormGroup {
if (AddressDetails != null) { if (AddressDetails != null) {
console.log('not null');
return this.fb.group({ return this.fb.group({
alternative_address: [this.transformName(AddressDetails.alternative_address), Validators.compose([Validators.required])], alternative_address: [this.transformName(AddressDetails.alternative_address), Validators.compose([Validators.required])],
alternative_state: [AddressDetails.alternative_state], alternative_state: [AddressDetails.alternative_state],
@ -333,6 +335,7 @@ export class AddressComponent implements OnInit {
// Add and Remove The SpecifyOthers Field // Add and Remove The SpecifyOthers Field
setOthers(e, i, flag) { setOthers(e, i, flag) {
console.log(e,i,flag);
switch (flag) { switch (flag) {
case 1: case 1:
const control = <FormArray>this.addressForm.controls['addresses']; const control = <FormArray>this.addressForm.controls['addresses'];
@ -484,9 +487,6 @@ export class AddressComponent implements OnInit {
records.is_pd_done_on_initiated_address = this.addressForm.controls.is_pd_done_on_initiated_address.value records.is_pd_done_on_initiated_address = this.addressForm.controls.is_pd_done_on_initiated_address.value
if (this.addressForm.controls.is_pd_done_on_initiated_address.value == true) { if (this.addressForm.controls.is_pd_done_on_initiated_address.value == true) {
if(records.addresses[0].pincode != 1){
delete records.addresses[0].pincode_others
}
records.addresses[0].address_type = this.addressForm.controls.address_type.value; records.addresses[0].address_type = this.addressForm.controls.address_type.value;
if (this.addressForm.controls.address_type.value == 1) { if (this.addressForm.controls.address_type.value == 1) {
records.addresses[0].address_type_others = this.addressForm.controls.address_type_others.value; records.addresses[0].address_type_others = this.addressForm.controls.address_type_others.value;
@ -510,9 +510,6 @@ export class AddressComponent implements OnInit {
else if (this.addressForm.controls.is_pd_done_on_initiated_address.value == false) { else if (this.addressForm.controls.is_pd_done_on_initiated_address.value == false) {
records.alternative_addresses = this.addressForm.controls.alternative_addresses.value; records.alternative_addresses = this.addressForm.controls.alternative_addresses.value;
records.alternative_addresses[0].address_type = this.addressForm.controls.address_type.value; records.alternative_addresses[0].address_type = this.addressForm.controls.address_type.value;
if(records.addresses[0].alternative_pincode != 1){
delete records.addresses[0].alternative_pincode_others
}
if (this.addressForm.controls.address_type.value == 1) { if (this.addressForm.controls.address_type.value == 1) {
records.alternative_addresses[0].address_type_others = this.addressForm.controls.address_type_others.value; records.alternative_addresses[0].address_type_others = this.addressForm.controls.address_type_others.value;
} }
@ -532,6 +529,7 @@ export class AddressComponent implements OnInit {
records.alternative_addresses[0].uom_others = this.addressForm.controls.uom_others.value; records.alternative_addresses[0].uom_others = this.addressForm.controls.uom_others.value;
} }
} }
// records.was_the_company_name_board_sighted = this.addressForm.controls.was_the_company_name_board_sighted.value;
records.address_form_remark = this.addressForm.controls.address_form_remark.value; records.address_form_remark = this.addressForm.controls.address_form_remark.value;
records.pdid = this.pdid; records.pdid = this.pdid;
records.parent_pdid = this.parent_pdid; records.parent_pdid = this.parent_pdid;
@ -630,10 +628,16 @@ export class AddressComponent implements OnInit {
'state': datas.state, 'state': datas.state,
'city': datas.city, 'city': datas.city,
'pincode': datas.pincode, 'pincode': datas.pincode,
'pincode_others': datas.pincode ? datas.pincode_others : '' // 'pincode_others': datas.pincode ? datas.pincode_others : ''
} }
this.getCityAndPincodeDetails(datas.state, index, 1); this.getCityAndPincodeDetails(datas.state, index, 1);
control.push(this.createAddresses(obj)); control.push(this.createAddresses(obj));
this.setOthers(+datas.pincode, index, 1);
if(datas.pincode == 1) {
let Ctrl: any = control.controls[index];
Ctrl.controls['pincode_others'].setValue(datas.pincode_others);
Ctrl.controls['pincode_others'].updateValueAndValidity();
}
if (datas.address_type_others == "" || datas.address_type_others == null){ if (datas.address_type_others == "" || datas.address_type_others == null){
delete datas.address_type_others; delete datas.address_type_others;
@ -686,7 +690,7 @@ export class AddressComponent implements OnInit {
this.addressForm.controls.uom.setValue(datas.uom); this.addressForm.controls.uom.setValue(datas.uom);
this.setOthers(datas.uom, '', 5); this.setOthers(datas.uom, '', 5);
if (data.records.uom == 1) { if (datas.uom == 1) {
this.addressForm.controls.uom_others.setValue(datas.uom_others); this.addressForm.controls.uom_others.setValue(datas.uom_others);
} }
} }
@ -716,11 +720,17 @@ export class AddressComponent implements OnInit {
'alternative_state': datas.alternative_state, 'alternative_state': datas.alternative_state,
'alternative_city': datas.alternative_city, 'alternative_city': datas.alternative_city,
'alternative_pincode': datas.alternative_pincode, 'alternative_pincode': datas.alternative_pincode,
'alternative_pincode_others': datas.alternative_pincode == 1 ? datas.alternative_pincode_others : '', // 'alternative_pincode_others': datas.alternative_pincode == 1 ? datas.alternative_pincode_others : '',
'reason_for_alternative_address': datas.reason_for_alternative_address, 'reason_for_alternative_address': datas.reason_for_alternative_address,
} }
this.getCityAndPincodeDetails(datas.alternative_state, index, 2); this.getCityAndPincodeDetails(datas.alternative_state, index, 2);
alternative_address_control.push(this.createAlternativeAddresses(obj)); alternative_address_control.push(this.createAlternativeAddresses(obj));
this.setOthers(+datas.alternative_pincode, index, 2);
if(datas.alternative_pincode == 1) {
let AltCtrl: any = alternative_address_control.controls[index];
AltCtrl.controls['alternative_pincode_others'].setValue(datas.alternative_pincode_others);
AltCtrl.controls['alternative_pincode_others'].updateValueAndValidity();
}
this.addressForm.controls.pd_location.setValue(datas.pd_location); this.addressForm.controls.pd_location.setValue(datas.pd_location);
this.addressForm.controls.address_type.setValue(datas.address_type); this.addressForm.controls.address_type.setValue(datas.address_type);
@ -747,13 +757,14 @@ export class AddressComponent implements OnInit {
this.addressForm.controls.estimated_area.setValue(datas.estimated_area); this.addressForm.controls.estimated_area.setValue(datas.estimated_area);
this.addressForm.controls.uom.setValue(datas.uom); this.addressForm.controls.uom.setValue(datas.uom);
this.setOthers(datas.uom, '', 5); this.setOthers(datas.uom, '', 5);
if (data.records.uom == 1) { if (datas.uom == 1) {
this.addressForm.controls.uom_others.setValue(datas.uom_others); this.addressForm.controls.uom_others.setValue(datas.uom_others);
} }
}); });
} }
} }
// this.addressForm.controls.was_the_company_name_board_sighted.setValue(data.records.hasOwnProperty('was_the_company_name_board_sighted') ? data.records.was_the_company_name_board_sighted : '');
this.addressForm.controls.address_form_remark.setValue(data.records.address_form_remark); this.addressForm.controls.address_form_remark.setValue(data.records.address_form_remark);
} }
else { else {

View File

@ -19,7 +19,8 @@
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="100"> <div fxFlex="100">
<div formArrayName="business_assets_for_address" fxFill> <div formArrayName="business_assets_for_address" fxFill>
<div *ngFor="let itemrow of _businessAssetsQuesFrom.controls.business_assets_for_address['controls']; let i=index; let last=last;"> <div
*ngFor="let itemrow of _businessAssetsQuesFrom.controls.business_assets_for_address['controls']; let i=index; let last=last;">
<div [formGroupName]="i"> <div [formGroupName]="i">
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
@ -28,35 +29,40 @@
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
<mat-form-field style="width: 95%;"> <mat-form-field style="width: 95%;">
<mat-select placeholder="Is this the business address ? " (selectionChange)="setRequiredValidation($event.value,itemrow,1);" <mat-select placeholder="Is this the business address ? "
(selectionChange)="setRequiredValidation($event.value,itemrow,1);"
formControlName="business_address_availability" required> formControlName="business_address_availability" required>
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="itemrow.controls['business_address_availability'].hasError('required')">Business address Required</mat-error> <mat-error *ngIf="itemrow.controls['business_address_availability'].hasError('required')">
Business address Required</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none" *ngIf=" itemrow.get('business_address_availability').value == 'yes'"> <div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none"
*ngIf=" itemrow.get('business_address_availability').value == 'yes'">
<div style="width:95%"> <div style="width:95%">
<label style="padding-left:2%">How long has business been operated from this premise?</label> <label style="padding-left:2%">How long has business been operated from this premise?</label>
<mat-form-field> <mat-form-field>
<mat-label>Year</mat-label> <mat-label>Year</mat-label>
<input matInput placeholder="No of years (Eg. 10)" autocomplete="off" formControlName="business_years" <input matInput placeholder="No of years (Eg. 10)" autocomplete="off"
formControlName="business_years"
(change)="checkWithExistBusinessYear($event.target.value,i)" OnlyNumber type="text"> (change)="checkWithExistBusinessYear($event.target.value,i)" OnlyNumber type="text">
<mat-hint style="color: red;">{{yearErrorMessage[i]}}</mat-hint> <mat-hint style="color: red;">{{yearErrorMessage[i]}}</mat-hint>
<mat-error *ngIf="itemrow.controls['business_years'].hasError('required')">Year Required</mat-error> <mat-error *ngIf="itemrow.controls['business_years'].hasError('required')">Year Required
</mat-error>
<!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_years'].value.valid">Year's <!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_years'].value.valid">Year's
Required</mat-error> --> Required</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-label>Month</mat-label> <mat-label>Month</mat-label>
<input matInput placeholder="No of months (Eg. 6)" autocomplete="off" formControlName="business_month" <input matInput placeholder="No of months (Eg. 6)" autocomplete="off"
OnlyNumber type="text" (change)="ConvertMonthintoYear($event.target.value,i)"> formControlName="business_month" OnlyNumber type="text"
(change)="ConvertMonthintoYear($event.target.value,i)">
<mat-hint style="color: red;">{{monthErrorMessage[i]}}</mat-hint> <mat-hint style="color: red;">{{monthErrorMessage[i]}}</mat-hint>
<!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_month'].value.valid">Month's <!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_month'].value.valid">Month's
Required</mat-error> --> Required</mat-error> -->
@ -65,18 +71,21 @@
<mat-form-field style="width: 95%;"> <mat-form-field style="width: 95%;">
<mat-select [placeholder]="placeholderName[i] ? placeholderName[i] :'Was any business activity seen at the Address Type during PD visit?'" <mat-select
[placeholder]="placeholderName[i] ? placeholderName[i] :'Was any business activity seen at the Address Type during PD visit?'"
formControlName="business_is_pd_visited"> formControlName="business_is_pd_visited">
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="itemrow.controls['business_is_pd_visited'].hasError('required')">Business Activity <mat-error *ngIf="itemrow.controls['business_is_pd_visited'].hasError('required')">Business
Activity
Required</mat-error> Required</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf=" itemrow.get('business_is_pd_visited').value != ''" style="width: 95%;"> <mat-form-field *ngIf=" itemrow.get('business_is_pd_visited').value != ''" style="width: 95%;">
<input matInput autocomplete="off" placeholder="Remarks" formControlName="business_pd_visited_remark"> <input matInput autocomplete="off" placeholder="Remarks"
formControlName="business_pd_visited_remark">
<mat-error *ngIf="itemrow.controls['business_pd_visited_remark'].hasError('required')">Remarks <mat-error *ngIf="itemrow.controls['business_pd_visited_remark'].hasError('required')">Remarks
Required</mat-error> Required</mat-error>
</mat-form-field> </mat-form-field>
@ -92,54 +101,73 @@
<mat-option value="owned">Owned</mat-option> <mat-option value="owned">Owned</mat-option>
<mat-option value="rented">Rented</mat-option> <mat-option value="rented">Rented</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="itemrow.controls['business_ownership_type'].hasError('required')">Ownership Type Required</mat-error> <mat-error *ngIf="itemrow.controls['business_ownership_type'].hasError('required')">Ownership
Type Required</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width:45%" *ngIf="(itemrow.get('business_ownership_type').value == 'rented')"> <mat-form-field style="width:45%"
<input matInput autocomplete="off" [placeholder]= "'Monthly ' + address_type + ' Rent Amount'" formControlName="business_monthly_rented_amt" OnlyNumber type="text"> *ngIf="(itemrow.get('business_ownership_type').value == 'rented')">
<mat-hint align="start" style="font-size:90%" *ngIf="itemrow.get('business_monthly_rented_amt').value != ''">{{"&#8377;"}} {{itemrow.get('business_monthly_rented_amt').value | numberToWords}} Only</mat-hint> <input matInput autocomplete="off" [placeholder]="'Monthly ' + address_type + ' Rent Amount'"
formControlName="business_monthly_rented_amt" OnlyNumber type="text">
<mat-hint align="start" style="font-size:90%"
*ngIf="itemrow.get('business_monthly_rented_amt').value != ''">{{"&#8377;"}}
{{itemrow.get('business_monthly_rented_amt').value | numberToWords}} Only</mat-hint>
<mat-error>Monthly Rent Amount Required</mat-error> <mat-error>Monthly Rent Amount Required</mat-error>
</mat-form-field> </mat-form-field>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none" *ngIf="(itemrow.get('business_ownership_type').value == 'owned')"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"
*ngIf="(itemrow.get('business_ownership_type').value == 'owned')">
<mat-form-field style="width:45%"> <mat-form-field style="width:45%">
<input matInput placeholder="Approximate Market Value" formControlName="business_approximate_market_value" <input matInput placeholder="Approximate Market Value"
OnlyNumber type="text" autocomplete="off"> formControlName="business_approximate_market_value" OnlyNumber type="text"
<mat-hint align="start" style="font-size:90%" *ngIf="itemrow.get('business_approximate_market_value').value != ''">{{"&#8377;"}} {{itemrow.get('business_approximate_market_value').value | numberToWords}} Only</mat-hint> autocomplete="off">
<mat-error *ngIf="itemrow.controls['business_approximate_market_value'].hasError('required')">Approximate Market Value Required</mat-error> <mat-hint align="start" style="font-size:90%"
*ngIf="itemrow.get('business_approximate_market_value').value != ''">{{"&#8377;"}}
{{itemrow.get('business_approximate_market_value').value | numberToWords}} Only</mat-hint>
<mat-error
*ngIf="itemrow.controls['business_approximate_market_value'].hasError('required')">
Approximate Market Value Required</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width:45%"> <mat-form-field style="width:45%">
<mat-select multiple [placeholder]="address_type + ' Owned by'" formControlName="business_name_of_the_owner" <mat-select multiple [placeholder]="address_type + ' Owned by'"
[compareWith]="compareObjects" (selectionChange)="setOtherOwnerOfAddress($event.value,i)"> formControlName="business_name_of_the_owner" [compareWith]="compareObjects"
(selectionChange)="setOtherOwnerOfAddress($event.value,i)">
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName"> <mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val"> <mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.group_id != 2 ? val.name : val.name | titlecase}} {{val.group_id != 2 ? val.name : val.name | titlecase}}
</mat-option> </mat-option>
</mat-optgroup> </mat-optgroup>
</mat-select> </mat-select>
<mat-error *ngIf="itemrow.controls['business_name_of_the_owner'].hasError('required')">Asset Owned by Required</mat-error> <mat-error *ngIf="itemrow.controls['business_name_of_the_owner'].hasError('required')">Asset
Owned by Required</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width:45%" *ngIf="isOtherOwnerForAddress[i]"> <mat-form-field style="width:45%" *ngIf="isOtherOwnerForAddress[i]">
<input matInput placeholder="Specify Asset Owned Name" formControlName="business_name_of_the_other_owner" [value]="itemrow.get('business_name_of_the_other_owner').value | titlecase" <input matInput placeholder="Specify Asset Owned Name"
autocomplete="off" > formControlName="business_name_of_the_other_owner"
<mat-error *ngIf="itemrow.controls['business_name_of_the_other_owner'].hasError('required')">Asset Owned by Required</mat-error> [value]="itemrow.get('business_name_of_the_other_owner').value | titlecase"
autocomplete="off">
<mat-error
*ngIf="itemrow.controls['business_name_of_the_other_owner'].hasError('required')">Asset
Owned by Required</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width:45%"> <mat-form-field style="width:45%">
<mat-label>Age of Asset in Years</mat-label> <mat-label>Age of Asset in Years</mat-label>
<input matInput autocomplete="off" placeholder="eg.99" formControlName="business_vintage" <input matInput autocomplete="off" placeholder="eg.99" formControlName="business_vintage"
minlength="1" maxlength="2" OnlyNumber type="text" (keyup)="calculateVintagePurchase($event.target.value,i,3)"> minlength="1" maxlength="2" OnlyNumber type="text"
(keyup)="calculateVintagePurchase($event.target.value,i,3)">
<!-- <mat-error> Invalid format</mat-error> --> <!-- <mat-error> Invalid format</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field style="width:45%"> <mat-form-field style="width:45%">
<mat-label>Purchase Year</mat-label> <mat-label>Purchase Year</mat-label>
<input matInput autocomplete="off" placeholder="YYYY eg.2018" formControlName="business_purchase_year" <input matInput autocomplete="off" placeholder="YYYY eg.2018"
minlength="4" maxlength="4" OnlyNumber type="text" (keyup)="calculateVintagePurchase($event.target.value,i,4)"> formControlName="business_purchase_year" minlength="4" maxlength="4" OnlyNumber
type="text" (keyup)="calculateVintagePurchase($event.target.value,i,4)">
<!-- <mat-error> Invalid year format</mat-error> --> <!-- <mat-error> Invalid year format</mat-error> -->
</mat-form-field> </mat-form-field>
</div> </div>
@ -147,8 +175,10 @@
<span> <span>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:95%" *ngIf="(itemrow.get('business_ownership_type').value == 'owned')"> <mat-form-field style="width:95%"
<mat-select placeholder="Is There a Loan Existing Against This Asset?" formControlName="business_emi"> *ngIf="(itemrow.get('business_ownership_type').value == 'owned')">
<mat-select placeholder="Is There a Loan Existing Against This Asset?"
formControlName="business_emi">
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
@ -174,16 +204,19 @@
<mat-card-content> <mat-card-content>
<div fxLayout="row" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutAlign="start none">
<div formArrayName="business_assets_details" fxFill> <div formArrayName="business_assets_details" fxFill>
<div *ngFor="let sup of _businessAssetsQuesFrom.controls.business_assets_details['controls']; let i=index; let last=last;"> <div
*ngFor="let sup of _businessAssetsQuesFrom.controls.business_assets_details['controls']; let i=index; let last=last;">
<mat-card> <mat-card>
<mat-card-content> <mat-card-content>
<div [formGroupName]="i"> <div [formGroupName]="i">
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
<mat-form-field style="width:100%"> <mat-form-field style="width:100%">
<mat-select (selectionChange)="selectedAssetsType($event,i);setRequiredValidation($event.value,sup,2);" placeholder="Asset Type" <mat-select
formControlName="business_assets_mode" requried> (selectionChange)="selectedAssetsType($event,i);setRequiredValidation($event.value,sup,2);"
placeholder="Asset Type" formControlName="business_assets_mode" requried>
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option *ngFor="let asset of m_assets_type" [value]="asset.id" [disabled]="asset.flag!=1">{{ <mat-option *ngFor="let asset of m_assets_type" [value]="asset.id"
[disabled]="asset.flag!=1">{{
asset.name | titlecase }}</mat-option> asset.name | titlecase }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@ -193,7 +226,8 @@
<!--Property--> <!--Property-->
<div *ngIf="sup.get('business_assets_mode').value == 2"> <div *ngIf="sup.get('business_assets_mode').value == 2">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index"> <div
*ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s"> <div [formGroupName]="s">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
@ -201,20 +235,31 @@
<mat-select placeholder="Property Type" formControlName="property_type" <mat-select placeholder="Property Type" formControlName="property_type"
(selectionChange)="setRequiredValidation($event.value,detail,6)"> (selectionChange)="setRequiredValidation($event.value,detail,6)">
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option *ngFor="let m_address_type of m_address_type" [value]="m_address_type.address_type_id"> <mat-option *ngFor="let m_address_type of m_address_type"
[value]="m_address_type.address_type_id">
{{m_address_type.address_type}} </mat-option> {{m_address_type.address_type}} </mat-option>
<!-- <mat-option *ngFor="let prop of m_propertyType" [value]="prop.id">{{ prop.name | titlecase }}</mat-option> --> <!-- <mat-option *ngFor="let prop of m_propertyType" [value]="prop.id">{{ prop.name | titlecase }}</mat-option> -->
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width:45%" *ngIf="detail.get('property_type').value == 1"> <mat-form-field style="width:45%"
<input matInput placeholder="Specify Other Property Type" formControlName="other_property_type" *ngIf="detail.get('property_type').value == 1">
autocomplete="off"> <input matInput placeholder="Specify Other Property Type"
<mat-error *ngIf="detail.controls['other_property_type'].hasError('required')">Property Type Required</mat-error> formControlName="other_property_type" autocomplete="off">
<mat-error
*ngIf="detail.controls['other_property_type'].hasError('required')">Property
Type Required</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width:45%" *ngIf="detail.get('property_type').value != ''"> <mat-form-field style="width:45%"
<input matInput placeholder="Address of the Property" formControlName="address_of_the_property" *ngIf="detail.get('property_type').value != ''">
autocomplete="off"> <input matInput placeholder="Address of the Property"
<mat-error *ngIf="detail.controls['address_of_the_property'].hasError('required')">Address of the Property Required</mat-error> formControlName="address_of_the_property"
(change)="addOptionOnAutoComplete(detail.get('property_type').value,$event.target.value,i)"
[matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete">
<mat-option *ngFor="let address of addressList" [value]="address.value">
<span>{{address.value}}</span>
</mat-option>
</mat-autocomplete>
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -223,7 +268,8 @@
<!--vehicle--> <!--vehicle-->
<div *ngIf="sup.get('business_assets_mode').value == 3"> <div *ngIf="sup.get('business_assets_mode').value == 3">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index"> <div
*ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s"> <div [formGroupName]="s">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
@ -231,15 +277,17 @@
<mat-select placeholder="Type of Vehicle" formControlName="vehicle_type" <mat-select placeholder="Type of Vehicle" formControlName="vehicle_type"
(selectionChange)="setRequiredValidation($event.value,detail,5)"> (selectionChange)="setRequiredValidation($event.value,detail,5)">
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option *ngFor="let vehicle of m_vehicle_type" [value]="vehicle.vehicle_type_id">{{ <mat-option *ngFor="let vehicle of m_vehicle_type"
[value]="vehicle.vehicle_type_id">{{
vehicle.vehicle_type_name }}</mat-option> vehicle.vehicle_type_name }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width:45%" *ngIf="detail.get('vehicle_type').value == 1"> <mat-form-field style="width:45%" *ngIf="detail.get('vehicle_type').value == 1">
<input matInput placeholder=" Specify Vehicle" formControlName="other_vehicle_type" <input matInput placeholder=" Specify Vehicle"
autocomplete="off"> formControlName="other_vehicle_type" autocomplete="off">
<mat-error *ngIf="detail.controls['other_vehicle_type'].hasError('required')">Vehicle Required</mat-error> <mat-error *ngIf="detail.controls['other_vehicle_type'].hasError('required')">
Vehicle Required</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width:45%"> <mat-form-field style="width:45%">
@ -253,12 +301,14 @@
<!-- Eqipment Manufacturing --> <!-- Eqipment Manufacturing -->
<div *ngIf="sup.get('business_assets_mode').value == 4"> <div *ngIf="sup.get('business_assets_mode').value == 4">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index"> <div
*ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s"> <div [formGroupName]="s">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:95%"> <mat-form-field style="width:95%">
<input matInput placeholder="Description" formControlName="equipment_manufacturing_description"> <input matInput placeholder="Description"
formControlName="equipment_manufacturing_description">
</mat-form-field> </mat-form-field>
</div> </div>
@ -268,13 +318,15 @@
<!--other assets--> <!--other assets-->
<div *ngIf="sup.get('business_assets_mode').value == 1"> <div *ngIf="sup.get('business_assets_mode').value == 1">
<div *ngFor="let detail of sup['controls'].business_details['controls']; let s = index"> <div
*ngFor="let detail of sup['controls'].business_details['controls']; let s = index">
<div [formGroupName]="s"> <div [formGroupName]="s">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:95%"> <mat-form-field style="width:95%">
<input matInput placeholder="Description of the Assets" formControlName="any_other_assets" <input matInput placeholder="Description of the Assets"
autocomplete="off" required> formControlName="any_other_assets" autocomplete="off" required>
<mat-error *ngIf="detail.controls['any_other_assets'].hasError('required')">Asset's Description Required</mat-error> <mat-error *ngIf="detail.controls['any_other_assets'].hasError('required')">
Asset's Description Required</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
@ -292,60 +344,80 @@
<mat-option value="owned">Owned</mat-option> <mat-option value="owned">Owned</mat-option>
<mat-option value="rented">Rented</mat-option> <mat-option value="rented">Rented</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="sup.controls['business_ownership_type'].hasError('required')">Ownership Type Required</mat-error> <mat-error *ngIf="sup.controls['business_ownership_type'].hasError('required')">
Ownership Type Required</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width:45%" *ngIf="(sup.get('business_assets_mode').value != '' && sup.get('business_ownership_type').value == 'rented')"> <mat-form-field style="width:45%"
<input matInput placeholder="Monthly Rent Amount" formControlName="business_monthly_rented_amt" *ngIf="(sup.get('business_assets_mode').value != '' && sup.get('business_ownership_type').value == 'rented')">
OnlyNumber type="text"> <input matInput placeholder="Monthly Rent Amount"
<mat-hint align="start" style="font-size:90%" *ngIf="sup.get('business_monthly_rented_amt').value != ''">{{"&#8377;"}} {{sup.get('business_monthly_rented_amt').value | numberToWords}} Only</mat-hint> formControlName="business_monthly_rented_amt" OnlyNumber type="text">
<mat-error *ngIf="sup.controls['business_monthly_rented_amt'].hasError('required')">Monthly Rent Amount Required</mat-error> <mat-hint align="start" style="font-size:90%"
*ngIf="sup.get('business_monthly_rented_amt').value != ''">{{"&#8377;"}}
{{sup.get('business_monthly_rented_amt').value | numberToWords}} Only</mat-hint>
<mat-error *ngIf="sup.controls['business_monthly_rented_amt'].hasError('required')">
Monthly Rent Amount Required</mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none" *ngIf="sup.get('business_assets_mode').value != '' && sup.get('business_ownership_type').value == 'owned'"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"
*ngIf="sup.get('business_assets_mode').value != '' && sup.get('business_ownership_type').value == 'owned'">
<mat-form-field style="width:45%"> <mat-form-field style="width:45%">
<input matInput placeholder="Approximate Market Value" formControlName="business_approximate_market_value" <input matInput placeholder="Approximate Market Value"
OnlyNumber type="text" autocomplete="off"> formControlName="business_approximate_market_value" OnlyNumber type="text"
<mat-hint align="start" style="font-size:90%" *ngIf="sup.get('business_approximate_market_value').value != ''">{{"&#8377;"}} {{sup.get('business_approximate_market_value').value | numberToWords}} Only</mat-hint> autocomplete="off">
<mat-error *ngIf="sup.controls['business_approximate_market_value'].hasError('required')">Approximate Market Value Required</mat-error> <mat-hint align="start" style="font-size:90%"
*ngIf="sup.get('business_approximate_market_value').value != ''">{{"&#8377;"}}
{{sup.get('business_approximate_market_value').value | numberToWords}} Only
</mat-hint>
<mat-error
*ngIf="sup.controls['business_approximate_market_value'].hasError('required')">
Approximate Market Value Required</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width:45%"> <mat-form-field style="width:45%">
<mat-select multiple placeholder="Asset Owned by" formControlName="business_name_of_the_owner" <mat-select multiple placeholder="Asset Owned by"
[compareWith]="compareObjects" (selectionChange)="setOtherOwnerOfAsset($event.value,i)"> formControlName="business_name_of_the_owner" [compareWith]="compareObjects"
(selectionChange)="setOtherOwnerOfAsset($event.value,i)">
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName"> <mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val"> <mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.group_id != 2 ? val.name : val.name | titlecase}} {{val.group_id != 2 ? val.name : val.name | titlecase}}
</mat-option> </mat-option>
</mat-optgroup> </mat-optgroup>
</mat-select> </mat-select>
<mat-error *ngIf="sup.controls['business_name_of_the_owner'].hasError('required')">Asset Owned by is Required</mat-error> <mat-error *ngIf="sup.controls['business_name_of_the_owner'].hasError('required')">
Asset Owned by is Required</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="isOtherOwner[i]" style="width:45%"> <mat-form-field *ngIf="isOtherOwner[i]" style="width:45%">
<input matInput placeholder="Specify Asset Owned Name" formControlName="business_name_of_the_other_owner" <input matInput placeholder="Specify Asset Owned Name"
autocomplete="off" [value]="sup.get('business_name_of_the_other_owner').value | titlecase"> formControlName="business_name_of_the_other_owner" autocomplete="off"
<mat-error *ngIf="sup.controls['business_name_of_the_other_owner'].hasError('required')">Asset Owned by is Required</mat-error> [value]="sup.get('business_name_of_the_other_owner').value | titlecase">
<mat-error
*ngIf="sup.controls['business_name_of_the_other_owner'].hasError('required')">Asset
Owned by is Required</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width:45%"> <mat-form-field style="width:45%">
<mat-label>Age of Asset in Years</mat-label> <mat-label>Age of Asset in Years</mat-label>
<input matInput autocomplete="off" placeholder="eg.99" formControlName="business_vintage" <input matInput autocomplete="off" placeholder="eg.99"
minlength="1" maxlength="2" OnlyNumber type="text" (keyup)="calculateVintagePurchase($event.target.value,i,1)"> formControlName="business_vintage" minlength="1" maxlength="2" OnlyNumber
type="text" (keyup)="calculateVintagePurchase($event.target.value,i,1)">
<!-- <mat-error> Invalid format</mat-error> --> <!-- <mat-error> Invalid format</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field style="width:45%"> <mat-form-field style="width:45%">
<mat-label>Purchase Year</mat-label> <mat-label>Purchase Year</mat-label>
<input matInput autocomplete="off" placeholder="YYYY eg.2018" formControlName="business_purchase_year" <input matInput autocomplete="off" placeholder="YYYY eg.2018"
minlength="4" maxlength="4" OnlyNumber type="text" (keyup)="calculateVintagePurchase($event.target.value,i,2)"> formControlName="business_purchase_year" minlength="4" maxlength="4" OnlyNumber
type="text" (keyup)="calculateVintagePurchase($event.target.value,i,2)">
<!-- <mat-error> Invalid year format</mat-error> --> <!-- <mat-error> Invalid year format</mat-error> -->
</mat-form-field> </mat-form-field>
</div> </div>
<span *ngIf="(sup.get('business_assets_mode').value != '') && sup.get('business_ownership_type').value == 'owned'"> <span
*ngIf="(sup.get('business_assets_mode').value != '') && sup.get('business_ownership_type').value == 'owned'">
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:95%"> <mat-form-field style="width:95%">
<mat-select placeholder="Is There a Loan Existing Against This Asset?" <mat-select placeholder="Is There a Loan Existing Against This Asset?"
@ -361,15 +433,16 @@
</mat-card-content> </mat-card-content>
<mat-card-actions> <mat-card-actions>
<div align="right"> <div align="right">
<button type="button" mat-raised-button mat-icon-button *ngIf="_businessAssetsQuesFrom.controls.business_assets_details.controls.length > 1" <button type="button" mat-raised-button mat-icon-button
*ngIf="_businessAssetsQuesFrom.controls.business_assets_details.controls.length > 1"
(click)="removeAssetsDetails(i)" matTooltip="Delete Business Assets" (click)="removeAssetsDetails(i)" matTooltip="Delete Business Assets"
matTooltipPosition="above" class="mr-1 mb-1 hover-icon"> matTooltipPosition="above" class="mr-1 mb-1 hover-icon">
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
</button> </button>
</div> </div>
<div align="center"> <div align="center">
<button type="button" mat-flat-button (click)="addAssetDetails($event); false" matTooltip="Add More" <button type="button" mat-flat-button (click)="addAssetDetails($event); false"
matTooltipPosition="left" color="primary" *ngIf="last"> matTooltip="Add More" matTooltipPosition="left" color="primary" *ngIf="last">
<strong>Add More Business Asset </strong> <strong>Add More Business Asset </strong>
</button> </button>
</div> </div>
@ -392,8 +465,10 @@
<div fxFlex="20" class="m-gap p-gap" *ngFor="let doc of documentsAndFilesList"> <div fxFlex="20" class="m-gap p-gap" *ngFor="let doc of documentsAndFilesList">
<div class="p-list-main mb-2" style="width: 60%;height: auto;" *ngIf="doc.document_type != 'pdf'"> <div class="p-list-main mb-2" style="width: 60%;height: auto;" *ngIf="doc.document_type != 'pdf'">
<div class="p-list"> <div class="p-list">
<div class="top"> <img src="{{doc.document}}" alt="{{doc.document_name}}"style="width: 100%;height: 100%;"> <div class="top"> <img src="{{doc.document}}" alt="{{doc.document_name}}"
<label *ngIf="doc.document_title != ''" style="font-size: 0.85rem">{{doc.document_title}}</label></div> style="width: 100%;height: 100%;">
<label *ngIf="doc.document_title != ''"
style="font-size: 0.85rem">{{doc.document_title}}</label></div>
</div> </div>
</div> </div>
</div> </div>
@ -405,7 +480,8 @@
<div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20" <div class="text-center mb-2 hover-icon" fxFlex.xs="50" fxFlex.sm="50" fxFlex.md="20"
fxFlex.lg="20" fxFlex.xl="20" *ngIf="doc.document_type == 'pdf';"> fxFlex.lg="20" fxFlex.xl="20" *ngIf="doc.document_type == 'pdf';">
<!-- <a href="http://www.google.com" target="_blank"> --> <!-- <a href="http://www.google.com" target="_blank"> -->
<mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;" (click)="pdf(doc.document)">picture_as_pdf</mat-icon> <mat-icon style="color: #e00201;font-size: 60px !important;width:inherit !important;"
(click)="pdf(doc.document)">picture_as_pdf</mat-icon>
<span class="d-block">{{doc.document_title}}</span> <span class="d-block">{{doc.document_title}}</span>
<!-- </a> --> <!-- </a> -->
</div> </div>
@ -429,12 +505,13 @@
<div fxFlex="60" class="pb-0 text-sm-left" align="left"> <div fxFlex="60" class="pb-0 text-sm-left" align="left">
<mat-form-field appearance="outline" style="width: 100%"> <mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label> <mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="business_assets_form_remark" autocomplete="off"></textarea> <textarea matInput placeholder="Remarks" formControlName="business_assets_form_remark"
autocomplete="off"></textarea>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="40" align="end"> <div fxFlex="40" align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save"
type="submit"> matTooltipPosition="above" type="submit">
<mat-icon>save</mat-icon> <mat-icon>save</mat-icon>
</button> </button>
</div> </div>

View File

@ -44,12 +44,12 @@ export class BusinessAssetsInfoComponent implements OnInit {
yearErrorMessage: any = []; yearErrorMessage: any = [];
monthErrorMessage: any = []; monthErrorMessage: any = [];
currentYear: any = new Date().getFullYear(); currentYear: any = new Date().getFullYear();
addressLabel: any = []; // addressLabel: any = [];
addressList: any = [];
/**Declaration of Dropdown And Array */ /**Declaration of Dropdown And Array */
public applicants: any; public applicants: any;
public m_any_asset_loan_type = [{ 'value': "yes", 'viewValue': "Yes" }, public m_any_asset_loan_type = [{ 'value': "yes", 'viewValue': "Yes" }, { 'value': "no", 'viewValue': "No" }]
{ 'value': "no", 'viewValue': "No" }]
public m_assets_type = []; public m_assets_type = [];
public m_propertyType = []; public m_propertyType = [];
public m_address_type = []; public m_address_type = [];
@ -63,7 +63,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
existCompanyList: any = []; existCompanyList: any = [];
mergeCompanyApplicant: any = []; mergeCompanyApplicant: any = [];
endUserList = []; endUserList = [];
address_type : any ; address_type: any;
/**Constructor of the class */ /**Constructor of the class */
constructor( constructor(
notifier: NotifierService, notifier: NotifierService,
@ -89,6 +89,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
documentsAndFilesList: any = []; documentsAndFilesList: any = [];
/** init Function */ /** init Function */
ngOnInit() { ngOnInit() {
console.clear(); console.clear();
// this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid,'').subscribe(data => { // this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid,'').subscribe(data => {
// this.businessProfessionName = (data.status == 200) ? data.records.profession_name : '' ; // this.businessProfessionName = (data.status == 200) ? data.records.profession_name : '' ;
@ -114,7 +115,8 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.mergeCompanyApplicant.push({ groupName: 'APPLICANTS', groupValues: modifyApplicantList }) this.mergeCompanyApplicant.push({ groupName: 'APPLICANTS', groupValues: modifyApplicantList })
} }
}) });
this.getM_State_For_Address(); this.getM_State_For_Address();
this.getPdSupplierFormDetails(); this.getPdSupplierFormDetails();
this.getM_Assets_Type(); this.getM_Assets_Type();
@ -122,29 +124,32 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.getM_Address_Type(); this.getM_Address_Type();
this.getM_Vehicle_Type(); this.getM_Vehicle_Type();
this.getM_Address_Type(); this.getM_Address_Type();
this.pdTrigerService.retriveFile(this.pdid,'22',this.company_id).subscribe(data => {
this.pdTrigerService.retriveFile(this.pdid, '22', this.company_id).subscribe(data => {
if (data.status == 200) { if (data.status == 200) {
if(data.records.length>0){ if (data.records.length > 0) {
data.records.forEach((val, index) => { data.records.forEach((val, index) => {
let splitted = val.pd_document_name.split("."); let splitted = val.pd_document_name.split(".");
let DocumentsAndFiles = { let DocumentsAndFiles = {
'document_name': val.pd_document_name, 'document_name': val.pd_document_name,
'document_title': val.pd_document_title, 'document_title': val.pd_document_title,
'document': val.doc_url, 'document': val.doc_url,
'document_type' : splitted[1] == 'pdf'?'pdf':'image' 'document_type': splitted[1] == 'pdf' ? 'pdf' : 'image'
} }
this.documentsAndFilesList.push(DocumentsAndFiles); this.documentsAndFilesList.push(DocumentsAndFiles);
}); });
} }
} }
else{ else {
this.documentsAndFilesList = []; this.documentsAndFilesList = [];
} }
}); });
} }
/** init Function Ends Here */
getM_State_For_Address(){ /** State Master For Addresses */
getM_State_For_Address() {
this.pdTrigerService.getAllMasterDatas('STATE').subscribe( this.pdTrigerService.getAllMasterDatas('STATE').subscribe(
data => { data => {
this.m_state_for_address = data.records.filter(data => data.isactive == 1); this.m_state_for_address = data.records.filter(data => data.isactive == 1);
@ -195,6 +200,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
//Get Data Based on PDID and FORMID //Get Data Based on PDID and FORMID
apiLoadFinish: boolean = false; apiLoadFinish: boolean = false;
getPdSupplierFormDetails() { getPdSupplierFormDetails() {
let reqparams: any = {}; let reqparams: any = {};
reqparams.parent_pdid = this.parent_pdid; reqparams.parent_pdid = this.parent_pdid;
@ -214,10 +220,10 @@ export class BusinessAssetsInfoComponent implements OnInit {
} else { } else {
// this.noRecordFound = true; // this.noRecordFound = true;
} }
});
} }
);
} loadaddresses(flag) {
loadaddresses() {
let params: any = {}; let params: any = {};
params.parent_pdid = this.parent_pdid; params.parent_pdid = this.parent_pdid;
@ -227,14 +233,20 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.pdTrigerService.retriveForm(params).subscribe(data => { this.pdTrigerService.retriveForm(params).subscribe(data => {
if (data.status == 200) { if (data.status == 200) {
if(flag == 1){
let initiated_address_check = data.records.hasOwnProperty('is_pd_done_on_initiated_address') ? data.records.is_pd_done_on_initiated_address : true;
this.addressList.push({ key_name: 'initiate_address', value: data.records.addresses[0].address, description: 'Initiated Address' });
if (initiated_address_check == false ) {
this.addressList.push({ key_name: 'alternative_addresses', value: data.records.alternative_addresses[0].alternative_address, description: 'Alternative Address' });
}
}
else if(flag == 2){
let dataOfAddress = data.records.addresses.filter(item => item.isactive == 1); let dataOfAddress = data.records.addresses.filter(item => item.isactive == 1);
this.addressList.push({ key_name: 'initiate_address', value: data.records.addresses[0].address, description: 'Initiated Address' });
let initiated_address_check = data.records.hasOwnProperty('is_pd_done_on_initiated_address') ? data.records.is_pd_done_on_initiated_address : true;
// // const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address']; // // const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
if (initiated_address_check == true && data.records.addresses.length > 0) {
if (data.records.addresses.length > 0) {
data.records.addresses.forEach((dataValue, inx) => { data.records.addresses.forEach((dataValue, inx) => {
this.addressLabel[inx] = '';
this.pdTrigerService.getStateWiseCities(dataValue.state).subscribe(data => { this.pdTrigerService.getStateWiseCities(dataValue.state).subscribe(data => {
if (data.status == 200) { if (data.status == 200) {
@ -248,7 +260,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
let addressType = dataValue.address_type != 1 ? selectedAddressType.address_type : dataValue.address_type_others; let addressType = dataValue.address_type != 1 ? selectedAddressType.address_type : dataValue.address_type_others;
this.address_type = addressType; this.address_type = addressType;
let address = dataValue.address + ' , ' + selectedCity.city_name + ','+selectedState.name +'-' + (dataValue.pincode == 1 ? dataValue.pincode_others : selectedPincode.pincode); let address = dataValue.address + ' , ' + selectedCity.city_name + ',' + selectedState.name + '-' + (dataValue.pincode == 1 ? dataValue.pincode_others : selectedPincode.pincode);
this.placeholderName[inx] = 'Was any business activity seen at the ' + addressType + ' during PD visit?'; this.placeholderName[inx] = 'Was any business activity seen at the ' + addressType + ' during PD visit?';
let addressLabel = address + ' / ' + addressType; let addressLabel = address + ' / ' + addressType;
@ -273,25 +285,66 @@ export class BusinessAssetsInfoComponent implements OnInit {
} }
}); });
}); });
} else if (initiated_address_check == false && data.records.alternative_addresses.length > 0) {
this.addressList.push({ key_name: 'alternative_addresses', value: data.records.alternative_addresses[0].alternative_address, description: 'Alternative Address' });
data.records.alternative_addresses.forEach((dataValue, inx) => {
this.pdTrigerService.getStateWiseCities(dataValue.alternative_state).subscribe(data => {
if (data.status == 200) {
this.cityArr = data.records.cities;
this.pinArr = data.records.pincode;
let selectedAddressType = this.m_address_type.filter(element => element.address_type_id == dataValue.address_type)[0];
let selectedState = this.m_state_for_address.filter(element => element.state_id == dataValue.alternative_state)[0];
let selectedCity = this.cityArr.filter(element => element.city_id == dataValue.alternative_city)[0];
let selectedPincode = this.pinArr.filter(element => element.pincode_id == dataValue.alternative_pincode)[0];
let addressType = dataValue.address_type != 1 ? selectedAddressType.address_type : dataValue.address_type_others;
this.address_type = addressType;
let address = dataValue.alternative_address + ' , ' + selectedCity.city_name + ',' + selectedState.name + '-' + (dataValue.alternative_pincode == 1 ? dataValue.alternative_pincode_others : selectedPincode.pincode);
this.placeholderName[inx] = 'Was any business activity seen at the ' + addressType + ' during PD visit?';
let addressLabel = address + ' / ' + addressType;
let vals = {
address_label: addressLabel,
business_years: '',
business_month: '',
business_address_availability: '',
business_is_pd_visited: '',
business_pd_visited_remark: '',
business_approximate_market_value: '',
business_ownership_type: '',
business_monthly_rented_amt: '',
business_name_of_the_owner: '',
business_name_of_the_other_owner: '',
business_vintage: '',
business_purchase_year: '',
business_emi: ''
} }
else { const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.initBusinessAddressDetailsWithdata(vals));
}
});
});
} else {
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address']; const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.initBusinessAddressDetails()); control.push(this.initBusinessAddressDetails());
} }
} }}
else { else {
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address']; const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.initBusinessAddressDetails()); control.push(this.initBusinessAddressDetails());
} }
}); });
} }
// business_years: [value.business_years], // business_years: [value.business_years],
// business_month: [value.business_month], // business_month: [value.business_month],
// business_address_availability: [value.business_address_availability], // business_address_availability: [value.business_address_availability],
// business_is_pd_visited: [value.business_is_pd_visited], // business_is_pd_visited: [value.business_is_pd_visited],
// business_pd_visited_remark: [value.business_pd_visited_remark], // business_pd_visited_remark: [value.business_pd_visited_remark],
// business_assets_for_address: this._formBuilder.array([]), // business_assets_for_address: this._formBuilder.array([]),
// business_years: [''], // business_years: [''],
// business_month: [''], // business_month: [''],
// business_address_availability: [''], // business_address_availability: [''],
@ -303,6 +356,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
formLoadData(val) { formLoadData(val) {
if (val !== null) { if (val !== null) {
let value = val; let value = val;
this.loadaddresses(1);
this._businessAssetsQuesFrom = this._formBuilder.group({ this._businessAssetsQuesFrom = this._formBuilder.group({
parent_pdid: [this.parent_pdid], parent_pdid: [this.parent_pdid],
pdid: [this.pdid], pdid: [this.pdid],
@ -333,7 +387,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
business_assets_details: this._formBuilder.array([this.initBusinessDetails()]), business_assets_details: this._formBuilder.array([this.initBusinessDetails()]),
business_assets_form_remark: [''] business_assets_form_remark: ['']
}); });
this.loadaddresses(); this.loadaddresses(2);
} }
this.loadDetails = true; this.loadDetails = true;
} }
@ -364,7 +418,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
address_label: [''], address_label: [''],
business_years: [''], business_years: [''],
business_month: [''], business_month: [''],
business_address_availability: ['',Validators.compose([Validators.required])], business_address_availability: ['', Validators.compose([Validators.required])],
business_is_pd_visited: [''], business_is_pd_visited: [''],
business_pd_visited_remark: [''], business_pd_visited_remark: [''],
// this.createBusinessAssetsForAddress() // this.createBusinessAssetsForAddress()
@ -438,6 +492,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
break; break;
} }
} }
this.removeOptionOnAutoComplete(i);
} }
loadEquipmentManufacturingDescription() { loadEquipmentManufacturingDescription() {
@ -459,17 +514,15 @@ export class BusinessAssetsInfoComponent implements OnInit {
manufacturer_model_vehicle: [''], manufacturer_model_vehicle: [''],
vehicle_type: [''], vehicle_type: [''],
other_vehicle_type: [''] other_vehicle_type: ['']
}); });
} }
otherBusinessAssetsDescription() { otherBusinessAssetsDescription() {
return this._formBuilder.group({ return this._formBuilder.group({
any_other_assets: ['',Validators.compose([Validators.required])], any_other_assets: ['', Validators.compose([Validators.required])],
}); });
} }
loadPropertyWithData(data) { loadPropertyWithData(data) {
return this._formBuilder.group({ return this._formBuilder.group({
property_type: [data.property_type], property_type: [data.property_type],
@ -486,7 +539,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
otherBusinessAssetsDescriptionWithData(data) { otherBusinessAssetsDescriptionWithData(data) {
return this._formBuilder.group({ return this._formBuilder.group({
any_other_assets: [data.any_other_assets,Validators.compose([Validators.required])], any_other_assets: [data.any_other_assets, Validators.compose([Validators.required])],
}); });
} }
@ -595,6 +648,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
var result = Object.keys(data).map(function (key) { var result = Object.keys(data).map(function (key) {
return data[key]; return data[key];
}); });
if (result.length > 0) { if (result.length > 0) {
result.forEach((datas, index) => { result.forEach((datas, index) => {
@ -606,7 +660,8 @@ export class BusinessAssetsInfoComponent implements OnInit {
Avaliablity = option.id; Avaliablity = option.id;
} }
}); });
}} }
}
this.isOtherOwnerForAddress[index] = Avaliablity == 0 ? true : false; this.isOtherOwnerForAddress[index] = Avaliablity == 0 ? true : false;
}); });
@ -652,18 +707,17 @@ export class BusinessAssetsInfoComponent implements OnInit {
if (result.length > 0) { if (result.length > 0) {
result.forEach((datas, index) => { result.forEach((datas, index) => {
let Avaliablity = 1; let Avaliablity = 1;
if(datas.business_name_of_the_owner !== null){ if (datas.business_name_of_the_owner !== null) {
if (datas.business_name_of_the_owner.length > 0) { if (datas.business_name_of_the_owner.length > 0) {
datas.business_name_of_the_owner.forEach(option => { datas.business_name_of_the_owner.forEach(option => {
if (option.id == 0 && option.group_id == 2) { if (option.id == 0 && option.group_id == 2) {
Avaliablity = option.id; Avaliablity = option.id;
} }
}); });
}} }
}
this.isOtherOwner[index] = Avaliablity == 0 ? true : false; this.isOtherOwner[index] = Avaliablity == 0 ? true : false;
}); });
for (let val of result) { for (let val of result) {
@ -688,7 +742,6 @@ if(datas.business_name_of_the_owner !== null){
} }
setBusinessAssetsDetailsWithData(assets_details_mode: any, datas: any, i: any): void { setBusinessAssetsDetailsWithData(assets_details_mode: any, datas: any, i: any): void {
let val = i; let val = i;
let data = datas; let data = datas;
@ -709,6 +762,7 @@ if(datas.business_name_of_the_owner !== null){
let business_property_datas: any; let business_property_datas: any;
data.forEach((datas, i) => { data.forEach((datas, i) => {
business_property_datas = { 'property_type': datas.property_type, 'other_property_type': datas.other_property_type, 'address_of_the_property': datas.address_of_the_property }; business_property_datas = { 'property_type': datas.property_type, 'other_property_type': datas.other_property_type, 'address_of_the_property': datas.address_of_the_property };
this.addOptionOnAutoComplete(datas.property_type, datas.address_of_the_property, val);
}); });
const control = (<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray; const control = (<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(val).get('business_details') as FormArray;
control.push(this.loadPropertyWithData(business_property_datas)); control.push(this.loadPropertyWithData(business_property_datas));
@ -738,6 +792,39 @@ if(datas.business_name_of_the_owner !== null){
} }
} }
addOptionOnAutoComplete(property_id, event, i) {
if(event != ''){
let getList = this.addressList.map(dval => dval.value.replace(/\s/g, "").toLowerCase());
let getkeyname = this.addressList.map(dval => dval.key_name);
let findName = this.m_address_type.find(x => x.address_type_id == property_id);
// console.log(getkeyname.indexOf(i));
let evt = event.replace(/\s/g, "").toLowerCase();
let keyexist = this.addressList.find(ob => ob['key_name'] === i);
if (keyexist === undefined || keyexist === null && !getList.includes(evt)) {
console.log('push on this');
this.addressList.push({ key_name: i, value: event, description: findName.address_type + ' At Index ' + i });
}
else {
let Index = getkeyname.indexOf(i);
this.addressList[Index] = { key_name: i, value: event, description: findName.address_type + ' At Index ' + i }
console.log('update on this => Index', Index);
}
console.log('at Final add or update ', this.addressList);
}
}
removeOptionOnAutoComplete(i) {
let getkeyname = this.addressList.map(dval => dval.key_name);
let Index = getkeyname.indexOf(i);
if (Index !== -1) {
this.addressList.splice(Index, 1);
}
console.log('at Final remove', this.addressList);
}
/** Add More Asset using Flag Both "Other Asset" And "Business Asset" */ /** Add More Asset using Flag Both "Other Asset" And "Business Asset" */
addAssetDetails(e) { addAssetDetails(e) {
@ -892,7 +979,7 @@ if(datas.business_name_of_the_owner !== null){
let ChdCtrls: any = <FormArray>ParCtrls.controls[ParInx]; let ChdCtrls: any = <FormArray>ParCtrls.controls[ParInx];
let Avaliablity = 1; let Avaliablity = 1;
if (value !== null ) { if (value !== null) {
if (value.length > 0) { if (value.length > 0) {
value.forEach(option => { value.forEach(option => {
@ -931,7 +1018,7 @@ if(datas.business_name_of_the_owner !== null){
let Avaliablity = 1; let Avaliablity = 1;
if (value !== null ) { if (value !== null) {
if (value.length > 0) { if (value.length > 0) {
value.forEach(option => { value.forEach(option => {
@ -1006,12 +1093,14 @@ if(datas.business_name_of_the_owner !== null){
item.controls.business_ownership_type.updateValueAndValidity(); item.controls.business_ownership_type.updateValueAndValidity();
} }
if(flag == 2){ if (flag == 2) {
if(value != ''){ if (value != '') {
item.controls.business_ownership_type.setValidators([Validators.required]);} item.controls.business_ownership_type.setValidators([Validators.required]);
else{ }
else {
item.controls.business_ownership_type.setValue(''); item.controls.business_ownership_type.setValue('');
item.controls.business_ownership_type.clearValidators();} item.controls.business_ownership_type.clearValidators();
}
item.controls.business_ownership_type.updateValueAndValidity(); item.controls.business_ownership_type.updateValueAndValidity();
} }
if (flag == 3) { if (flag == 3) {
@ -1072,10 +1161,9 @@ if(datas.business_name_of_the_owner !== null){
selectedAddressType(e: any) { selectedAddressType(e: any) {
this.placeholderName = 'Was any business activity seen at the ' + e + ' during PD visit?'; this.placeholderName = 'Was any business activity seen at the ' + e + ' during PD visit?';
} }
pdf(fileURL){ pdf(fileURL) {
window.open(fileURL); window.open(fileURL);
} }
/** For Docs Tab */ /** For Docs Tab */
public viewerOptions: any = { public viewerOptions: any = {
navbar: false, navbar: false,