address form : changes
This commit is contained in:
parent
cc46c619a8
commit
dc50a75373
@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
<h2 mat-dialog-title class="paragraph_change">
|
<h2 mat-dialog-title class="paragraph_change">
|
||||||
<div fxFlex="70" align="left" style="padding: 10px !important;">
|
<div fxFlex="70" align="left" style="padding: 10px !important;">
|
||||||
<span>{{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} <span *ngIf="subproduct_abbr">-
|
<span>{{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} <span
|
||||||
|
*ngIf="subproduct_abbr">-
|
||||||
{{subproduct_abbr}} </span></span><br>
|
{{subproduct_abbr}} </span></span><br>
|
||||||
{{pageTitle}}
|
{{pageTitle}}
|
||||||
</div>
|
</div>
|
||||||
@ -19,24 +20,29 @@
|
|||||||
<mat-tab-group>
|
<mat-tab-group>
|
||||||
<mat-tab label="Questions">
|
<mat-tab label="Questions">
|
||||||
<ng-template matTabContent>
|
<ng-template matTabContent>
|
||||||
|
<mat-card style="min-height: 550px;">
|
||||||
|
<mat-card-title>
|
||||||
|
<p>Address Details</p>
|
||||||
|
</mat-card-title>
|
||||||
|
<mat-card-content>
|
||||||
<div fxLayout="row wrap">
|
<div fxLayout="row wrap">
|
||||||
<div fxFlex="100">
|
<div fxFlex="100">
|
||||||
<mat-card style="min-height: 550px;">
|
|
||||||
<div formArrayName="addresses">
|
<div formArrayName="addresses">
|
||||||
<div *ngFor="let item of addressForm.controls.addresses['controls']; let i=index">
|
<div
|
||||||
<mat-card-title>
|
*ngFor="let init_addr of addressForm.controls.addresses['controls']; let i=index">
|
||||||
<p>Address Details {{i+1}}</p>
|
<div [formGroup]="init_addr">
|
||||||
</mat-card-title>
|
|
||||||
<mat-card-content class="matcard" [formGroup]="item">
|
|
||||||
<div fxLayout="row wrap">
|
<div fxLayout="row wrap">
|
||||||
<div fxFlex="100">
|
<div fxFlex="100">
|
||||||
<!-- oninput="this.value = this.value.toUpperCase()" -->
|
<!-- oninput="this.value = this.value.toUpperCase()" -->
|
||||||
<mat-form-field style="width: 96%">
|
<mat-form-field style="width: 96%">
|
||||||
<input matInput placeholder="Address at which PD was initiated" formControlName="address"
|
<input matInput
|
||||||
[value]="item.get('address').value | titlecase"
|
placeholder="Address at which PD was initiated"
|
||||||
required
|
formControlName="address"
|
||||||
autocomplete="off">
|
[value]="init_addr.get('address').value | titlecase"
|
||||||
<mat-error *ngIf="item.controls['address'].hasError('required')">Address Required</mat-error>
|
requiredrequired autocomplete="off">
|
||||||
|
<mat-error
|
||||||
|
*ngIf="init_addr.controls['address'].hasError('required')">
|
||||||
|
Address Required</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -45,123 +51,197 @@
|
|||||||
<mat-select placeholder="State" formControlName="state"
|
<mat-select placeholder="State" formControlName="state"
|
||||||
(selectionChange)="getCityAndPincodeDetails($event.value,i,1)">
|
(selectionChange)="getCityAndPincodeDetails($event.value,i,1)">
|
||||||
<mat-option>Select</mat-option>
|
<mat-option>Select</mat-option>
|
||||||
<mat-option *ngFor="let SL of stateData" [value]="SL.state_id">{{SL.name}}</mat-option>
|
<mat-option *ngFor="let SL of stateData"
|
||||||
|
[value]="SL.state_id">{{SL.name}}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field style="width: 32%">
|
<mat-form-field style="width: 32%">
|
||||||
<mat-select placeholder="City" formControlName="city">
|
<mat-select placeholder="City" formControlName="city">
|
||||||
<mat-option> Select </mat-option>
|
<mat-option> Select </mat-option>
|
||||||
<mat-option *ngFor="let CL of cityData[i]" [value]="CL.city_id">{{CL.city_name}}</mat-option>
|
<mat-option *ngFor="let CL of cityData"
|
||||||
|
[value]="CL.city_id">{{CL.city_name}}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</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">
|
||||||
<mat-option>Select</mat-option>
|
<mat-option>Select</mat-option>
|
||||||
<mat-option *ngFor="let PL of pincodeData[i]" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
|
<mat-option *ngFor="let PL of pincodeData"
|
||||||
|
[value]="PL.pincode_id">{{PL.pincode}}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field style="width: 24%" *ngIf="item.get('pincode').value == 1">
|
<mat-form-field style="width: 24%"
|
||||||
<input matInput autocomplete="off" placeholder="Specify Pincode *"
|
*ngIf="init_addr.get('pincode').value == 1">
|
||||||
|
<input matInput autocomplete="off"
|
||||||
|
placeholder="Specify Pincode *"
|
||||||
formControlName="pincode_others" OnlyNumber type="text">
|
formControlName="pincode_others" OnlyNumber type="text">
|
||||||
<mat-error *ngIf="item.controls['pincode_others'].hasError('required')">Pincode Required</mat-error>
|
<!-- <mat-error
|
||||||
|
*ngIf="init_addr.controls['pincode_others'].hasError('required')">
|
||||||
|
Pincode Required</mat-error> -->
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxLayout="row wrap">
|
||||||
<div fxFlex="100" align="left" style="margin: 0 0 2% 2%;">
|
<div fxFlex="100" align="left" style="margin: 0 0 2% 2%;">
|
||||||
<mat-checkbox color="primary" formControlName="pd_is_done_on_initiated_address" (change)="alternativeAddress($event.checked,i,1)">
|
<mat-checkbox color="primary"
|
||||||
Is This Address PD is being done ? <strong>( {{item.get('pd_is_done_on_initiated_address').value===true ? 'Yes' : 'No'}} )</strong>
|
formControlName="is_pd_done_on_initiated_address"
|
||||||
|
(change)="alternativeAddress($event.checked)">
|
||||||
|
Is this the address where PD is done ? <strong>(
|
||||||
|
{{addressForm.controls['is_pd_done_on_initiated_address'].value===true ? 'Yes' : 'No'}}
|
||||||
|
)</strong>
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
<br>
|
<br>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div *ngIf="addressForm.controls['is_pd_done_on_initiated_address'].value===false">
|
||||||
|
<div formArrayName="alternative_addresses">
|
||||||
|
<div
|
||||||
|
*ngFor="let alter_addr of addressForm.controls.alternative_addresses['controls']; let a=index">
|
||||||
|
<div [formGroup]="alter_addr">
|
||||||
|
<div fxLayout="row wrap">
|
||||||
|
<div fxFlex="100">
|
||||||
|
|
||||||
<div fxFlex="100" *ngIf="item.get('pd_is_done_on_initiated_address').value===false">
|
|
||||||
<!-- oninput="this.value = this.value.toUpperCase()" -->
|
|
||||||
<mat-form-field style="width: 96%">
|
<mat-form-field style="width: 96%">
|
||||||
<input matInput placeholder="Is this the address where PD is done?" formControlName="alternative_address"
|
<input matInput
|
||||||
[value]="item.get('alternative_address').value | titlecase" required autocomplete="off">
|
placeholder="Address at which PD Visit actually done"
|
||||||
<mat-error *ngIf="item.controls['alternative_address'].hasError('required')">Alternative Address Required</mat-error>
|
formControlName="alternative_address"
|
||||||
|
[value]="alter_addr.get('alternative_address').value | titlecase"
|
||||||
|
required autocomplete="off">
|
||||||
|
<mat-error
|
||||||
|
*ngIf="alter_addr.controls['alternative_address'].hasError('required')">
|
||||||
|
Alternative Address Required</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div fxFlex="100" fxLayout="nowrap" *ngIf="item.get('pd_is_done_on_initiated_address').value===false">
|
<div fxFlex="100" fxLayout="nowrap">
|
||||||
<mat-form-field style="width: 32%">
|
<mat-form-field style="width: 32%">
|
||||||
<mat-select placeholder="State" formControlName="alternative_state"
|
<mat-select placeholder="State"
|
||||||
(selectionChange)="getCityAndPincodeDetails($event.value,i,2)">
|
formControlName="alternative_state"
|
||||||
|
(selectionChange)="getCityAndPincodeDetails($event.value,a,2)">
|
||||||
<mat-option>Select</mat-option>
|
<mat-option>Select</mat-option>
|
||||||
<mat-option *ngFor="let SL of stateData" [value]="SL.state_id">{{SL.name}}</mat-option>
|
<mat-option *ngFor="let SL of stateData"
|
||||||
|
[value]="SL.state_id">{{SL.name}}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field style="width: 32%">
|
<mat-form-field style="width: 32%">
|
||||||
<mat-select placeholder="City" formControlName="alternative_city">
|
<mat-select placeholder="City"
|
||||||
|
formControlName="alternative_city">
|
||||||
<mat-option> Select </mat-option>
|
<mat-option> Select </mat-option>
|
||||||
<mat-option *ngFor="let CL of alertnativeCityData[i]" [value]="CL.city_id">{{CL.city_name}}</mat-option>
|
<mat-option *ngFor="let CL of alertnativeCityData"
|
||||||
|
[value]="CL.city_id">{{CL.city_name}}
|
||||||
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field style="width: 24%">
|
<mat-form-field style="width: 24%">
|
||||||
<mat-select placeholder="Pincode" formControlName="alternative_pincode">
|
<mat-select placeholder="Pincode"
|
||||||
|
formControlName="alternative_pincode">
|
||||||
<mat-option>Select</mat-option>
|
<mat-option>Select</mat-option>
|
||||||
<mat-option *ngFor="let PL of alertnativePincodeData[i]" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
|
<mat-option
|
||||||
|
*ngFor="let PL of alertnativePincodeData"
|
||||||
|
[value]="PL.pincode_id">{{PL.pincode}}
|
||||||
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field style="width: 24%" *ngIf="item.get('alternative_pincode').value == 1">
|
<mat-form-field style="width: 24%"
|
||||||
<input matInput autocomplete="off" placeholder="Specify Pincode *" required
|
*ngIf="alter_addr.get('alternative_pincode').value == 1">
|
||||||
formControlName="alternative_pincode_others" OnlyNumber type="text">
|
<input matInput autocomplete="off"
|
||||||
<mat-error *ngIf="item.controls['alternative_pincode_others'].hasError('required')">Pincode Required</mat-error>
|
placeholder="Specify Pincode"
|
||||||
|
formControlName="alternative_pincode_others"
|
||||||
|
OnlyNumber type="text">
|
||||||
|
<!-- <mat-error
|
||||||
|
*ngIf="alter_addr.controls['alternative_pincode_others'].hasError('required')">
|
||||||
|
Pincode Required</mat-error> -->
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div fxFlex="100" *ngIf="item.get('pd_is_done_on_initiated_address').value===false">
|
<div fxFlex="100">
|
||||||
|
|
||||||
<mat-form-field style="width: 96%">
|
<mat-form-field style="width: 96%">
|
||||||
<input matInput placeholder="Reason for change in PD visit address ?" formControlName="reason_for_alternative_address" required autocomplete="off">
|
<input matInput
|
||||||
<mat-error *ngIf="item.controls['reason_for_alternative_address'].hasError('required')">Reason Required</mat-error>
|
placeholder="Reason for change in PD visit address"
|
||||||
|
formControlName="reason_for_alternative_address"
|
||||||
|
required autocomplete="off">
|
||||||
|
<mat-error
|
||||||
|
*ngIf="alter_addr.controls['reason_for_alternative_address'].hasError('required')">
|
||||||
|
Reason Required</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxLayout="row wrap">
|
||||||
<div fxFlex="100">
|
<div fxFlex="100">
|
||||||
<mat-form-field style="width: 46%;">
|
<mat-form-field style="width: 46%;">
|
||||||
<mat-select placeholder="Address Type" formControlName="address_type"
|
<mat-select placeholder="Address Type" formControlName="address_type"
|
||||||
required (selectionChange)="selectedAddressType($event.source.triggerValue,i)">
|
required
|
||||||
|
(selectionChange)="setOthers($event.value,'',3);selectedAddressType($event.source.triggerValue)">
|
||||||
<mat-option>Select</mat-option>
|
<mat-option>Select</mat-option>
|
||||||
<mat-option value="{{m_addressType.address_type_id}}"
|
<mat-option value="{{m_addressType.address_type_id}}"
|
||||||
*ngFor="let m_addressType of addressData">{{m_addressType.address_type}}
|
*ngFor="let m_addressType of addressData">
|
||||||
|
{{m_addressType.address_type}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<mat-error *ngIf="item.controls['address_type'].hasError('required')">Address Type Required</mat-error>
|
<mat-error
|
||||||
|
*ngIf="addressForm.controls['address_type'].hasError('required')">
|
||||||
|
Address Type Required</mat-error>
|
||||||
|
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field style="width: 46%;" *ngIf="item.get('address_type').value == 1">
|
<mat-form-field style="width: 46%;"
|
||||||
<input matInput placeholder="Specify Address Type *"
|
*ngIf="addressForm.controls['address_type'].value == 1">
|
||||||
|
<input matInput placeholder="Specify Address Type " required
|
||||||
formControlName="address_type_others" autocomplete="off"
|
formControlName="address_type_others" autocomplete="off"
|
||||||
(change)="selectedAddressType($event.target.value,i)">
|
(change)="selectedAddressType($event.target.value)">
|
||||||
<mat-error *ngIf="item.controls['address_type_others'].hasError('required')">Address Type Required</mat-error>
|
<mat-error
|
||||||
|
*ngIf="addressForm.controls['address_type_others'].hasError('required')">
|
||||||
|
Address Type Required</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxLayout="row wrap">
|
||||||
<div fxFlex="100">
|
<div fxFlex="100">
|
||||||
<mat-form-field style="width: 46%;">
|
<mat-form-field style="width: 46%;">
|
||||||
<mat-select placeholder="Locality" formControlName="locality"
|
<mat-select placeholder="Locality" formControlName="locality" required
|
||||||
required>
|
(selectionChange)="setOthers($event.value,'',4)">
|
||||||
<mat-option>Select</mat-option>
|
<mat-option>Select</mat-option>
|
||||||
<mat-option value="{{m_locality.locality_id}}" *ngFor="let m_locality of localityData">{{m_locality.locality_name}}
|
<mat-option value="{{m_locality.locality_id}}"
|
||||||
|
*ngFor="let m_locality of localityData">
|
||||||
|
{{m_locality.locality_name}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<mat-error *ngIf="item.controls['locality'].hasError('required')">Locality Required</mat-error>
|
<mat-error
|
||||||
|
*ngIf="addressForm.controls['locality'].hasError('required')">
|
||||||
|
Locality Required</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field style="width: 46%;" *ngIf="item.get('locality').value == 1">
|
<mat-form-field style="width: 46%;"
|
||||||
<input matInput placeholder="Specify Locality *"
|
*ngIf="addressForm.controls['locality'].value == 1">
|
||||||
|
<input matInput placeholder="Specify Locality " required
|
||||||
formControlName="locality_others" autocomplete="off">
|
formControlName="locality_others" autocomplete="off">
|
||||||
<!-- autofocus -->
|
<!-- autofocus -->
|
||||||
<!-- <mat-error *ngIf="!addressForm.controls['locality_others'].hasError('required')">Locality Required</mat-error> -->
|
<!-- <mat-error *ngIf="!addressForm.controls['locality_others'].hasError('required')">Locality Required</mat-error> -->
|
||||||
<mat-error *ngIf="item.controls['locality_others'].hasError('required')">Locality Required</mat-error>
|
<mat-error
|
||||||
|
*ngIf="addressForm.controls['locality_others'].hasError('required')">
|
||||||
|
Locality Required</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<!-- <mat-form-field style="width: 46%;" *ngIf="item.get('locality').value == 5">
|
<!-- <mat-form-field style="width: 46%;" *ngIf="item.get('locality').value == 5">
|
||||||
@ -172,56 +252,64 @@
|
|||||||
</mat-form-field> -->
|
</mat-form-field> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div fxFlex="100">
|
<div fxFlex="100">
|
||||||
<mat-form-field style="width: 46%;">
|
<mat-form-field style="width: 46%;">
|
||||||
<mat-select placeholder="Approach to PD Location"
|
<mat-select placeholder="Approach to PD Location"
|
||||||
formControlName="pd_location" required>
|
formControlName="pd_location" required>
|
||||||
<mat-option>Select</mat-option>
|
<mat-option>Select</mat-option>
|
||||||
<mat-option value="{{data.pd_location_approach_id}}" *ngFor="let data of locationdata">{{data.description}}
|
<mat-option value="{{data.pd_location_approach_id}}"
|
||||||
|
*ngFor="let data of locationdata">{{data.description}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<mat-error *ngIf="item.controls['pd_location'].hasError('required')">Approach to PD Location Required</mat-error>
|
<mat-error
|
||||||
|
*ngIf="addressForm.controls['pd_location'].hasError('required')">
|
||||||
|
Approach to PD Location Required</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field style="width: 46%;">
|
<mat-form-field style="width: 46%;">
|
||||||
<mat-select placeholder="Comment on Locality" formControlName="comment_locality"
|
<mat-select placeholder="Comment on Locality"
|
||||||
required>
|
formControlName="comment_locality" required>
|
||||||
<mat-option>Select</mat-option>
|
<mat-option>Select</mat-option>
|
||||||
<mat-option value="{{data.comments_on_locality_id}}" *ngFor="let data of commentData">{{data.rating}}
|
<mat-option value="{{data.comments_on_locality_id}}"
|
||||||
|
*ngFor="let data of commentData">{{data.rating}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<mat-error *ngIf="item.controls['comment_locality'].hasError('required')">Comment on Locality Required</mat-error>
|
<mat-error
|
||||||
|
*ngIf="addressForm.controls['comment_locality'].hasError('required')">
|
||||||
|
Comment on Locality Required</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div fxFlex="100" fxLayout="nowrap">
|
<div fxFlex="100" fxLayout="nowrap">
|
||||||
<mat-form-field style="width: 46%;">
|
<mat-form-field style="width: 46%;">
|
||||||
<input matInput [placeholder]="placeholderName[i] ? placeholderName[i] : 'Estimated area of the (Address Type)'"
|
<input matInput
|
||||||
|
[placeholder]=" placeholderName != '' ? placeholderName : 'Estimated area of the (Address Type)'"
|
||||||
formControlName="estimated_area" OnlyNumber type="text">
|
formControlName="estimated_area" OnlyNumber type="text">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field style="width: 46%;">
|
<mat-form-field style="width: 46%;">
|
||||||
<mat-select placeholder="Unit of Measurement" formControlName="uom">
|
<mat-select placeholder="Unit of Measurement" formControlName="uom"
|
||||||
|
(selectionChange)="setOthers($event.value,'',5)">
|
||||||
<mat-option>Select</mat-option>
|
<mat-option>Select</mat-option>
|
||||||
<mat-option value="{{uom.uom_id}}" *ngFor="let uom of uomData">{{uom.name}}</mat-option>
|
<mat-option value="{{uom.uom_id}}" *ngFor="let uom of uomData">
|
||||||
|
{{uom.name}}</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field style="width: 24%;" *ngIf="item.get('uom').value == 1 ">
|
<mat-form-field style="width: 24%;"
|
||||||
|
*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">
|
||||||
<mat-error *ngIf="item.controls['uom_others'].hasError('required') || item.controls['uom_others'].value != '' ">UOM Required</mat-error>
|
<mat-error
|
||||||
<!-- <mat-error *ngIf="!addressForm.controls['uom_others'].hasError('required')">UOM
|
*ngIf="addressForm.controls['uom_others'].hasError('required')">
|
||||||
Required</mat-error> -->
|
UOM Required</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <button type="button" matTooltip="Add More Address Details" class="mr-1 mb-1 hover-icon" matTooltipPosition="above" mat-raised-button mat-icon-button *ngIf="i==0"
|
<!-- <button type="button" matTooltip="Add More Address Details" class="mr-1 mb-1 hover-icon" matTooltipPosition="above" mat-raised-button mat-icon-button *ngIf="i==0"
|
||||||
(click)="addAddresses()"
|
(click)="addAddresses()"
|
||||||
color="primary" style="float: right;">
|
color="primary" style="float: right;">
|
||||||
@ -232,12 +320,11 @@
|
|||||||
style="float: right;">
|
style="float: right;">
|
||||||
<mat-icon>delete</mat-icon>
|
<mat-icon>delete</mat-icon>
|
||||||
</button> -->
|
</button> -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</mat-card>
|
</mat-card>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
|
|
||||||
@ -249,9 +336,15 @@
|
|||||||
<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" *ngIf="doc.document_type != 'pdf'">
|
<div class="p-list-main mb-2" *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%;">
|
||||||
<button mat-button color="accent" (click)="imageCrop(doc)" class="mr-1 mb-1 hover-icon" matTooltip="Edit" matTooltipPosition="above" style=" text-align: center;"><mat-icon>edit</mat-icon></button>
|
<label *ngIf="doc.document_title != ''"
|
||||||
|
style="font-size: 0.85rem">{{doc.document_title}}</label></div>
|
||||||
|
<button mat-button color="accent" (click)="imageCrop(doc)"
|
||||||
|
class="mr-1 mb-1 hover-icon" matTooltip="Edit"
|
||||||
|
matTooltipPosition="above" style=" text-align: center;">
|
||||||
|
<mat-icon>edit</mat-icon>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -260,10 +353,13 @@
|
|||||||
<div fxFlex="100" class="m-gap p-gap">
|
<div fxFlex="100" class="m-gap p-gap">
|
||||||
<div fxLayout="row" fxLayoutWrap="wrap">
|
<div fxLayout="row" fxLayoutWrap="wrap">
|
||||||
<div *ngFor="let doc of documentsAndFilesList">
|
<div *ngFor="let doc of documentsAndFilesList">
|
||||||
<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.lg="20" fxFlex.xl="20" *ngIf="doc.document_type == 'pdf';">
|
fxFlex.md="20" 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>
|
||||||
@ -294,8 +390,8 @@
|
|||||||
</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" type="submit" matTooltip="Save" matTooltipPosition="above"><mat-icon>save</mat-icon></button> -->
|
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="submit" matTooltip="Save" matTooltipPosition="above"><mat-icon>save</mat-icon></button> -->
|
||||||
<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" (click)="onSubmit()" [disabled]="disableAfterSubmit===true">
|
matTooltipPosition="above" type="submit" (click)="onSubmit()" [disabled]="disableAfterSubmit===true">
|
||||||
<mat-icon>save</mat-icon>
|
<mat-icon>save</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -38,15 +38,9 @@ export class AddressComponent implements OnInit {
|
|||||||
parent_pdid: string;
|
parent_pdid: string;
|
||||||
pdid: number;
|
pdid: number;
|
||||||
form_id: number;
|
form_id: number;
|
||||||
// pdAddress: string;
|
|
||||||
// pdState: any;
|
|
||||||
// pdCity: any;
|
|
||||||
// pdPincode: any;
|
|
||||||
// pdOtherPincode: any;
|
|
||||||
CustSegAbbr: any;
|
CustSegAbbr: any;
|
||||||
|
|
||||||
loadDataStatus: boolean = true;
|
loadDataStatus: boolean = true;
|
||||||
placeholderName: any = [];
|
placeholderName: any = '';
|
||||||
|
|
||||||
/**Array declaration Of Dropdown */
|
/**Array declaration Of Dropdown */
|
||||||
locationdata: any = [];
|
locationdata: any = [];
|
||||||
@ -57,8 +51,8 @@ export class AddressComponent implements OnInit {
|
|||||||
pincodeData: any = [];
|
pincodeData: any = [];
|
||||||
cityData: any = [];
|
cityData: any = [];
|
||||||
uomData: any = [];
|
uomData: any = [];
|
||||||
alertnativeCityData:any=[];
|
alertnativeCityData: any = [];
|
||||||
alertnativePincodeData:any=[];
|
alertnativePincodeData: any = [];
|
||||||
|
|
||||||
addressesList: any = [];
|
addressesList: any = [];
|
||||||
documentsAndFilesList: any = [];
|
documentsAndFilesList: any = [];
|
||||||
@ -68,17 +62,6 @@ export class AddressComponent implements OnInit {
|
|||||||
private notifier: NotifierService;
|
private notifier: NotifierService;
|
||||||
public addressForm: FormGroup;
|
public addressForm: FormGroup;
|
||||||
|
|
||||||
// public address: AbstractControl;
|
|
||||||
// public addressType: AbstractControl;
|
|
||||||
// public state: AbstractControl;
|
|
||||||
// public city: AbstractControl;
|
|
||||||
// public pincode: AbstractControl;
|
|
||||||
// public locality: AbstractControl;
|
|
||||||
// public pdLocation: AbstractControl;
|
|
||||||
// public commentLocality: AbstractControl;
|
|
||||||
// public estArea: AbstractControl;
|
|
||||||
// public uom: AbstractControl;
|
|
||||||
|
|
||||||
/**Constructor of the class */
|
/**Constructor of the class */
|
||||||
constructor(private el: ElementRef, notifier: NotifierService,
|
constructor(private el: ElementRef, notifier: NotifierService,
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
@ -86,9 +69,10 @@ export class AddressComponent implements OnInit {
|
|||||||
private router: Router,
|
private router: Router,
|
||||||
private _pd: PdTrigerService,
|
private _pd: PdTrigerService,
|
||||||
private dialogRef: MatDialogRef<AddressComponent>,
|
private dialogRef: MatDialogRef<AddressComponent>,
|
||||||
private titlecasePipe:TitleCasePipe,
|
private titlecasePipe: TitleCasePipe,
|
||||||
private dialog: MatDialog,
|
private dialog: MatDialog,
|
||||||
private imageRef: MatDialogRef<ImageCropComponent>,
|
private imageRef: MatDialogRef<ImageCropComponent>,
|
||||||
|
|
||||||
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
||||||
// console.log('pd_all_details',pd_all_details);
|
// console.log('pd_all_details',pd_all_details);
|
||||||
this.parent_pdid = this.pd_all_details.pdmaster_details.parent_pd_id;
|
this.parent_pdid = this.pd_all_details.pdmaster_details.parent_pd_id;
|
||||||
@ -118,187 +102,83 @@ export class AddressComponent implements OnInit {
|
|||||||
this.getMasterDetails('STATE', 6);
|
this.getMasterDetails('STATE', 6);
|
||||||
|
|
||||||
let params: any = {};
|
let params: any = {};
|
||||||
params.parent_pdid=this.parent_pdid;
|
params.parent_pdid = this.parent_pdid;
|
||||||
params.pd_id = this.pdid;
|
params.pd_id = this.pdid;
|
||||||
params.pd_form_id = '5';
|
params.pd_form_id = '5';
|
||||||
|
this.setAddressFromDatas(params);
|
||||||
this._pd.retriveForm(params).subscribe(data => {
|
|
||||||
const control = <FormArray>this.addressForm.controls['addresses'];
|
|
||||||
if (data.status == 200) {
|
|
||||||
// console.log('data.records',data.records);
|
|
||||||
// console.log('data.records.addresses',data.records.addresses);
|
|
||||||
if (data.records.addresses.length == 0) {
|
|
||||||
control.push(this.createAddresses(null));
|
|
||||||
// this.loadPDAddressesDetails();
|
|
||||||
} else {
|
|
||||||
data.records.addresses.forEach((datas, index) => {
|
|
||||||
let obj = {
|
|
||||||
'address': this.transformName(datas.address),
|
|
||||||
'address_type': datas.address_type.toString(),
|
|
||||||
'address_type_others': datas.address_type_others,
|
|
||||||
'state': datas.state,
|
|
||||||
'city': datas.city,
|
|
||||||
'citySearch':'',
|
|
||||||
'stateSearch':'',
|
|
||||||
'pinSearch':'',
|
|
||||||
'pincode': datas.pincode,
|
|
||||||
'pincode_others': datas.pincode_others,
|
|
||||||
'locality': datas.locality,
|
|
||||||
'locality_others': datas.locality_others,
|
|
||||||
'pd_is_done_on_initiated_address':datas.pd_is_done_on_initiated_address !== null ? datas.pd_is_done_on_initiated_address : true,
|
|
||||||
// 'locality_mixuse': datas.locality_mixuse,
|
|
||||||
'pd_location': datas.pd_location,
|
|
||||||
'comment_locality': datas.comment_locality,
|
|
||||||
'estimated_area': datas.estimated_area,
|
|
||||||
'uom': datas.uom,
|
|
||||||
'uom_others': datas.uom_others
|
|
||||||
}
|
|
||||||
this.getCityAndPincodeDetails(datas.state,index,1);
|
|
||||||
this.getOtherPincode(datas.pincode, index);
|
|
||||||
// this.alternativeAddress(datas.pd_is_done_on_initiated_address,index,2);
|
|
||||||
let selectedAddressType = this.addressData.filter(element => element.address_type_id == datas.address_type)[0];
|
|
||||||
if(selectedAddressType){
|
|
||||||
this.selectedAddressType(selectedAddressType.address_type, index);
|
|
||||||
}
|
|
||||||
if (datas.address_type == 1) {
|
|
||||||
this.selectedAddressType(datas.address_type_others, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
control.push(this.createAddresses(obj));
|
|
||||||
|
|
||||||
if(datas.pd_is_done_on_initiated_address === false){
|
|
||||||
this.getCityAndPincodeDetails(datas.alternative_state,index,2);
|
|
||||||
console.log('datas.pd_is_done_on_initiated_address',datas.pd_is_done_on_initiated_address,index);
|
|
||||||
let ChildCtrl : any = control.controls[index];
|
|
||||||
ChildCtrl.addControl('alternative_address', new FormControl(datas.alternative_address, Validators.required));
|
|
||||||
ChildCtrl.addControl('alternative_state', new FormControl(datas.alternative_state));
|
|
||||||
ChildCtrl.addControl('alternative_city', new FormControl(datas.alternative_city));
|
|
||||||
ChildCtrl.addControl('alternative_pincode', new FormControl(datas.alternative_pincode));
|
|
||||||
ChildCtrl.addControl('alternative_pincode_others', new FormControl(datas.alternative_pincode_others, Validators.required));
|
|
||||||
// data.alternative_pincode == 1
|
|
||||||
// ? ChildCtrl.addControl('alternative_pincode_others', new FormControl(data.alternative_pincode_others))
|
|
||||||
// : ChildCtrl.removeControl('alternative_pincode_others');
|
|
||||||
ChildCtrl.addControl('reason_for_alternative_address', new FormControl(datas.reason_for_alternative_address, Validators.required));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// this.addressForm.controls.address.setValue(data.records.address);
|
|
||||||
// this.addressForm.controls.state.setValue(data.records.state);
|
|
||||||
|
|
||||||
// if (data.records.state != '') {
|
|
||||||
// this.getCityAndPincodeDetails(data.records.state);
|
|
||||||
// this.addressForm.controls.city.setValue(data.records.city);
|
|
||||||
// this.addressForm.controls.pincode.setValue(data.records.pincode);
|
|
||||||
// if (data.records.pincode == 1) {
|
|
||||||
// this.addressForm.controls.pincode_others.setValue(data.records.pincode_others);
|
|
||||||
// this.addressForm.controls.pincode_others.setValidators([Validators.required]);
|
|
||||||
// this.addressForm.controls.pincode_others.updateValueAndValidity();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// this.addressForm.controls.pd_location.setValue(data.records.pd_location);
|
|
||||||
// this.addressForm.controls.address_type.setValue(data.records.address_type);
|
|
||||||
|
|
||||||
// let selectedAddressType = this.addressData.filter(element => element.address_type_id == data.records.address_type)[0];
|
|
||||||
// this.selectedAddressType(selectedAddressType.address_type);
|
|
||||||
|
|
||||||
// if (data.records.address_type == 1) {
|
|
||||||
// this.addressForm.controls.address_type_others.setValue(data.records.address_type_others);
|
|
||||||
// this.addressForm.controls.address_type_others.setValidators([Validators.required]);
|
|
||||||
// this.addressForm.controls.address_type_others.updateValueAndValidity();
|
|
||||||
// this.selectedAddressType(data.records.address_type_others);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// this.addressForm.controls.comment_locality.setValue(data.records.comment_locality);
|
|
||||||
|
|
||||||
// this.addressForm.controls.locality.setValue(data.records.locality);
|
|
||||||
|
|
||||||
// if (data.records.locality == 1) {
|
|
||||||
// this.addressForm.controls.locality_others.setValue(data.records.locality_others);
|
|
||||||
// this.addressForm.controls.locality_others.setValidators([Validators.required]);
|
|
||||||
// this.addressForm.controls.locality_others.updateValueAndValidity();
|
|
||||||
// }
|
|
||||||
// if (data.records.locality == 5) {
|
|
||||||
// this.addressForm.controls.locality_mixuse.setValue(data.records.locality_mixuse);
|
|
||||||
// this.addressForm.controls.locality_mixuse.setValidators([Validators.required])
|
|
||||||
// this.addressForm.controls.locality_mixuse.updateValueAndValidity();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// this.addressForm.controls.estimated_area.setValue(data.records.estimated_area);
|
|
||||||
// this.addressForm.controls.uom.setValue(data.records.uom);
|
|
||||||
// if (data.records.uom == 1) {
|
|
||||||
// this.addressForm.controls.uom_others.setValue(data.records.uom_others);
|
|
||||||
// this.addressForm.controls.uom_others.setValidators([Validators.required])
|
|
||||||
// this.addressForm.controls.uom_others.updateValueAndValidity();
|
|
||||||
// }
|
|
||||||
|
|
||||||
this.addressForm.controls.address_form_remark.setValue(data.records.address_form_remark);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.loadPDAddressesDetails();
|
|
||||||
}
|
|
||||||
// else {
|
|
||||||
// control.push(this.createAddresses(null));
|
|
||||||
// }
|
|
||||||
});
|
|
||||||
|
|
||||||
this._pd.retriveFile(this.pdid,'5',null).subscribe(data => {
|
|
||||||
if (data.status == 200) {
|
|
||||||
if(data.records.length>0){
|
|
||||||
data.records.forEach((val, index) => {
|
|
||||||
let splitted = val.pd_document_name.split(".");
|
|
||||||
let DocumentsAndFiles = {
|
|
||||||
'document_name': val.pd_document_name,
|
|
||||||
'document_title': val.pd_document_title,
|
|
||||||
'document': val.doc_url,
|
|
||||||
'document_type' : splitted[1] == 'pdf'?'pdf':'image'
|
|
||||||
}
|
|
||||||
this.documentsAndFilesList.push(DocumentsAndFiles);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.documentsAndFilesList = [];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadPDAddressesDetails() {
|
loadPDAddressesDetails() {
|
||||||
const control = <FormArray>this.addressForm.controls['addresses'];
|
const control = <FormArray>this.addressForm.controls['addresses'];
|
||||||
|
|
||||||
this._pd.getAddressesDetails(this.pdid).subscribe(
|
this._pd.getAddressesDetails(this.pdid).subscribe(
|
||||||
data => {
|
data => {
|
||||||
if (data.status == 200) {
|
if (data.status == 200) {
|
||||||
this.addressesList = data.records.filter(item => item.assigned_pd==this.pdid && item.isactive == 1);
|
this.addressesList = data.records.filter(item => item.assigned_pd == this.pdid && item.isactive == 1);
|
||||||
if (this.addressesList.length > 0) {
|
if (this.addressesList.length > 0) {
|
||||||
this.addressesList.forEach((val, index) => {
|
this.addressesList.forEach((datas, index) => {
|
||||||
|
if (datas.address_type_others == "" || datas.address_type_others == null){ delete datas.address_type_others;}
|
||||||
|
if (datas.citySearch == "" || datas.citySearch == null){delete datas.citySearch;}
|
||||||
|
if (datas.locality_others == "" || datas.locality_others == null){delete datas.locality_others;}
|
||||||
|
if (datas.pinSearch == "" || datas.pinSearch == null){delete datas.pinSearch;}
|
||||||
|
if (datas.pincode_others == "" || datas.pincode_others == null){delete datas.pincode_others;}
|
||||||
|
if (datas.stateSearch == "" || datas.stateSearch == null){delete datas.stateSearch;}
|
||||||
|
if (datas.uom_others == "" || datas.uom_others == null){delete datas.uom_others;}
|
||||||
|
|
||||||
let obj = {
|
let obj = {
|
||||||
'address': this.transformName(val.addressline1),
|
'address': this.transformName(datas.addressline1),
|
||||||
'address_type': '',
|
'state': datas.fk_state,
|
||||||
'address_type_others': '',
|
'city': datas.fk_city,
|
||||||
'state': val.fk_state,
|
'pincode': datas.pincode_id,
|
||||||
'city': val.fk_city,
|
'pincode_others': datas.pincode_id == 1 ? datas.other_pincode :'',
|
||||||
'citySearch':'',
|
|
||||||
'stateSearch':'',
|
|
||||||
'pinSearch':'',
|
|
||||||
'pincode': val.pincode_id,
|
|
||||||
'pincode_others': val.other_pincode,
|
|
||||||
'pd_is_done_on_initiated_address':true,
|
|
||||||
'locality': '',
|
|
||||||
'locality_others': '',
|
|
||||||
// 'locality_mixuse': '',
|
|
||||||
'pd_location': '',
|
|
||||||
'comment_locality': '',
|
|
||||||
'estimated_area': '',
|
|
||||||
'uom': '',
|
|
||||||
'uom_others': ''
|
|
||||||
}
|
}
|
||||||
this.getCityAndPincodeDetails(val.fk_state,index,1);
|
this.getCityAndPincodeDetails(datas.fk_state, index, 1);
|
||||||
this.getOtherPincode(val.pincode_id, index);
|
|
||||||
control.push(this.createAddresses(obj));
|
control.push(this.createAddresses(obj));
|
||||||
|
// if(datas.pincode == 1) {
|
||||||
|
// let ChildCtrl: any = control.controls[index];
|
||||||
|
// ChildCtrl.controls['pincode_others'].setValue(datas.pincode_others);
|
||||||
|
// ChildCtrl.controls['pincode_others'].updateValueAndValidity();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
this.addressForm.controls.pd_location.setValue(datas.pd_location ? datas.pd_location : '');
|
||||||
|
this.addressForm.controls.address_type.setValue(datas.address_type ? datas.address_type : '');
|
||||||
|
if (datas.address_type) {
|
||||||
|
let selectedAddressType = this.addressData.filter(element => element.address_type_id == datas.address_type)[0];
|
||||||
|
this.selectedAddressType(selectedAddressType.address_type);
|
||||||
|
this.setOthers(datas.address_type, '', 3);
|
||||||
|
if (datas.address_type == 1) {
|
||||||
|
this.addressForm.controls.address_type_others.setValue(datas.address_type_others);
|
||||||
|
this.selectedAddressType(datas.address_type_others);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.addressForm.controls.comment_locality.setValue(datas.comment_locality ? datas.comment_locality : '');
|
||||||
|
this.addressForm.controls.locality.setValue(datas.locality ? datas.locality : '');
|
||||||
|
|
||||||
|
if (datas.locality) {
|
||||||
|
|
||||||
|
this.setOthers(datas.locality, '', 4);
|
||||||
|
|
||||||
|
if (datas.locality == 1) {
|
||||||
|
this.addressForm.controls.locality_others.setValue(datas.locality_others);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.addressForm.controls.estimated_area.setValue(datas.estimated_area ? datas.estimated_area : '');
|
||||||
|
this.addressForm.controls.uom.setValue(datas.uom);
|
||||||
|
if (datas.uom) {
|
||||||
|
this.setOthers(datas.uom, '', 5);
|
||||||
|
if (data.records.uom == 1) {
|
||||||
|
this.addressForm.controls.uom_others.setValue(datas.uom_others);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
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.address_form_remark.setValue('');
|
this.addressForm.controls.address_form_remark.setValue('');
|
||||||
// else{
|
// else{
|
||||||
// control.push(this.createAddresses(null));
|
// control.push(this.createAddresses(null));
|
||||||
@ -309,99 +189,72 @@ export class AddressComponent implements OnInit {
|
|||||||
// }
|
// }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// getM_Address_Type() {
|
|
||||||
// this._pd.getAllMasterDatas('ADDRESSTYPE').subscribe(
|
|
||||||
// data => {
|
|
||||||
// this.addressData = data.records.filter(data => data.isactive == 1);
|
|
||||||
// if(this.CustSegAbbr == 'SENP' || this.CustSegAbbr == 'SEP'){
|
|
||||||
// let index1 = this.addressData.map(data => data.address_type).indexOf("Residence");
|
|
||||||
// this.addressData.splice(index1, 1);
|
|
||||||
// let index2 = this.addressData.map(data => data.address_type).indexOf("Residence cum Office");
|
|
||||||
// this.addressData.splice(index2, 1);
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
/** Address Form ELements */
|
/** Address Form ELements */
|
||||||
public initAddressForm(): void {
|
public initAddressForm(): void {
|
||||||
this.addressForm = this.fb.group({
|
this.addressForm = this.fb.group({
|
||||||
addresses: this.fb.array([]),
|
addresses: this.fb.array([]),
|
||||||
|
is_pd_done_on_initiated_address: [true],
|
||||||
|
address_type: ['', Validators.compose([Validators.required])],
|
||||||
|
locality: ['', Validators.compose([Validators.required])],
|
||||||
|
locality_mixuse: [''],
|
||||||
|
pd_location: ['', Validators.compose([Validators.required])],
|
||||||
|
comment_locality: ['', Validators.compose([Validators.required])],
|
||||||
|
estimated_area: [''],
|
||||||
|
uom: [''],
|
||||||
address_form_remark: ['']
|
address_form_remark: ['']
|
||||||
});
|
});
|
||||||
// this.address = this.addressForm.controls['address'];
|
|
||||||
// this.state = this.addressForm.controls['state'];
|
|
||||||
// this.city = this.addressForm.controls['city'];
|
|
||||||
// this.pincode = this.addressForm.controls['pincode'];
|
|
||||||
// this.addressType = this.addressForm.controls['address_type'];
|
|
||||||
// this.locality = this.addressForm.controls['locality'];
|
|
||||||
// this.pdLocation = this.addressForm.controls['pd_location'];
|
|
||||||
// this.commentLocality = this.addressForm.controls['comment_locality'];
|
|
||||||
// this.estArea = this.addressForm.controls['estimated_area'];
|
|
||||||
// this.uom = this.addressForm.controls['uom'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// pdf(url){
|
pdf(fileURL) {
|
||||||
// this._pd.downloadPDF(url).subscribe(res => {
|
|
||||||
// const fileURL = URL.createObjectURL(res);
|
|
||||||
// window.open(fileURL, '_blank');
|
|
||||||
// });
|
|
||||||
// // this._pd.downloadPDF(url).subscribe(res => {
|
|
||||||
// // const fileURL = URL.createObjectURL(res);
|
|
||||||
// window.open(url, '_blank');
|
|
||||||
// // });
|
|
||||||
// }
|
|
||||||
pdf(fileURL){
|
|
||||||
window.open(fileURL);
|
window.open(fileURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** FOR Adress */
|
/** FOR Form Field For Address Array */
|
||||||
createAddresses(AddressDetails): FormGroup {
|
createAddresses(AddressDetails): FormGroup {
|
||||||
console.log(AddressDetails);
|
|
||||||
if (AddressDetails != null) {
|
if (AddressDetails != null) {
|
||||||
console.log(AddressDetails);
|
|
||||||
return this.fb.group({
|
return this.fb.group({
|
||||||
address: [this.transformName(AddressDetails.address), Validators.compose([Validators.required])],
|
address: [this.transformName(AddressDetails.address), Validators.compose([Validators.required])],
|
||||||
address_type: [AddressDetails.address_type || '', Validators.compose([Validators.required])],
|
|
||||||
address_type_others: [AddressDetails.address_type_others],
|
|
||||||
state: [AddressDetails.state],
|
state: [AddressDetails.state],
|
||||||
city: [AddressDetails.city],
|
city: [AddressDetails.city],
|
||||||
citySearch:[''],
|
|
||||||
stateSearch:[''],
|
|
||||||
pinSearch:[''],
|
|
||||||
pincode: [AddressDetails.pincode],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
|
pincode: [AddressDetails.pincode],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
|
||||||
pincode_others: [AddressDetails.pincode_others, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
|
pincode_others: [AddressDetails.pincode_others, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
|
||||||
pd_is_done_on_initiated_address:[AddressDetails.pd_is_done_on_initiated_address],
|
|
||||||
locality: [AddressDetails.locality, Validators.compose([Validators.required])],
|
|
||||||
locality_others: [AddressDetails.locality_others],
|
|
||||||
// locality_mixuse: [AddressDetails.locality_mixuse],
|
|
||||||
pd_location: [AddressDetails.pd_location, Validators.compose([Validators.required])],
|
|
||||||
comment_locality: [AddressDetails.comment_locality, Validators.compose([Validators.required])],
|
|
||||||
estimated_area: [AddressDetails.estimated_area],
|
|
||||||
uom: [AddressDetails.uom],
|
|
||||||
uom_others: [AddressDetails.uom_others]
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return this.fb.group({
|
return this.fb.group({
|
||||||
address: ['', Validators.compose([Validators.required])],
|
address: ['', Validators.compose([Validators.required])],
|
||||||
address_type: ['', Validators.compose([Validators.required])],
|
|
||||||
address_type_others: [''],
|
|
||||||
state: [''],
|
state: [''],
|
||||||
city: [''],
|
city: [''],
|
||||||
citySearch:[''],
|
|
||||||
stateSearch:[''],
|
|
||||||
pinSearch:[''],
|
|
||||||
pincode: [''],
|
pincode: [''],
|
||||||
pincode_others: ['', Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
|
pincode_others: ['', Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
|
||||||
pd_is_done_on_initiated_address:[true],
|
});
|
||||||
locality: ['', Validators.compose([Validators.required])],
|
}
|
||||||
locality_others: [''],
|
}
|
||||||
// locality_mixuse: [''],
|
|
||||||
pd_location: ['', Validators.compose([Validators.required])],
|
/** FOR Form Field For Alternative Address Array */
|
||||||
comment_locality: ['', Validators.compose([Validators.required])],
|
createAlternativeAddresses(AddressDetails): FormGroup {
|
||||||
estimated_area: [''],
|
if (AddressDetails != null) {
|
||||||
uom: [''],
|
console.log('not null');
|
||||||
uom_others: ['']
|
return this.fb.group({
|
||||||
|
alternative_address: [this.transformName(AddressDetails.alternative_address), Validators.compose([Validators.required])],
|
||||||
|
alternative_state: [AddressDetails.alternative_state],
|
||||||
|
alternative_city: [AddressDetails.alternative_city],
|
||||||
|
alternative_pincode: [AddressDetails.alternative_pincode],
|
||||||
|
alternative_pincode_others: [AddressDetails.alternative_pincode_others, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
|
||||||
|
reason_for_alternative_address: [AddressDetails.reason_for_alternative_address, Validators.compose([Validators.required])],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (AddressDetails == null) {
|
||||||
|
console.log('null');
|
||||||
|
return this.fb.group({
|
||||||
|
alternative_address: ['', Validators.compose([Validators.required])],
|
||||||
|
alternative_state: [''],
|
||||||
|
alternative_city: [''],
|
||||||
|
alternative_pincode: [''],
|
||||||
|
alternative_pincode_others:['', Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
|
||||||
|
reason_for_alternative_address: ['', Validators.compose([Validators.required])],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -445,85 +298,106 @@ export class AddressComponent implements OnInit {
|
|||||||
/** To Get City And Pincode Data For Address Form
|
/** To Get City And Pincode Data For Address Form
|
||||||
* Param 'stateID' -> selected StateId
|
* Param 'stateID' -> selected StateId
|
||||||
*/
|
*/
|
||||||
getCityAndPincodeDetails(stateID: string, index,flag) {
|
getCityAndPincodeDetails(stateID: string, index, flag) {
|
||||||
|
|
||||||
this._pd.getStateWiseCities(stateID).subscribe(data => {
|
this._pd.getStateWiseCities(stateID).subscribe(data => {
|
||||||
if (data.status == 200) {
|
if (data.status == 200) {
|
||||||
if(flag==1){
|
if (flag == 1) {
|
||||||
this.cityData[index] = data.records.cities;
|
this.cityData = data.records.cities;
|
||||||
this.pincodeData[index] = data.records.pincode;
|
this.pincodeData = data.records.pincode;
|
||||||
}else if(flag == 2){
|
} else if (flag == 2) {
|
||||||
this.alertnativeCityData[index] = data.records.cities;
|
this.alertnativeCityData = data.records.cities;
|
||||||
this.alertnativePincodeData[index] = data.records.pincode;
|
this.alertnativePincodeData = data.records.pincode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getOtherPincode(e, i) { this.otherPincodeFlag[i] = e == 1 ? true : false; }
|
// getOtherPincode(e, i) { this.otherPincodeFlag[i] = e == 1 ? true : false; }
|
||||||
transformName(vals){ return this.titlecasePipe.transform(vals); }
|
transformName(vals) { return this.titlecasePipe.transform(vals); }
|
||||||
|
|
||||||
alternativeAddress(e,i,flag){
|
// Add and Remove The Alternative-Address Form-Array
|
||||||
|
alternativeAddress(e) {
|
||||||
|
|
||||||
|
if (e === false) {
|
||||||
|
// console.log('alternativeAddress',e);
|
||||||
|
this.addressForm.addControl('alternative_addresses', this.fb.array([]));
|
||||||
|
const alternative_address_control = <FormArray>this.addressForm.controls['alternative_addresses'];
|
||||||
|
alternative_address_control.push(this.createAlternativeAddresses(null));
|
||||||
|
}
|
||||||
|
else if (e === true) {
|
||||||
|
// console.log('alternativeAddress',e);
|
||||||
|
this.addressForm.removeControl('alternative_addresses');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add and Remove The SpecifyOthers Field
|
||||||
|
setOthers(e, i, flag) {
|
||||||
|
switch (flag) {
|
||||||
|
case 1:
|
||||||
const control = <FormArray>this.addressForm.controls['addresses'];
|
const control = <FormArray>this.addressForm.controls['addresses'];
|
||||||
let ChildCtrl : any = control.controls[i];
|
let ChildCtrl: any = control.controls[i];
|
||||||
|
e == 1 ? ChildCtrl.addControl('pincode_others', new FormControl('', Validators.required)) : ChildCtrl.removeControl('pincode_others');
|
||||||
if(e==false){
|
break;
|
||||||
if(flag==1){
|
case 2:
|
||||||
ChildCtrl.addControl('alternative_address', new FormControl('', Validators.required));
|
const alternative_address_control = <FormArray>this.addressForm.controls['alternative_addresses'];
|
||||||
ChildCtrl.addControl('alternative_state', new FormControl(''));
|
let AltChildCtrl: any = alternative_address_control.controls[i];
|
||||||
ChildCtrl.addControl('alternative_city', new FormControl(''));
|
e == 1 ? AltChildCtrl.addControl('alternative_pincode_others', new FormControl('', Validators.required)) : AltChildCtrl.removeControl('alternative_pincode_others');
|
||||||
ChildCtrl.addControl('alternative_pincode', new FormControl(''));
|
break;
|
||||||
ChildCtrl.addControl('alternative_pincode_others', new FormControl('', Validators.required));
|
case 3:
|
||||||
ChildCtrl.addControl('reason_for_alternative_address', new FormControl('', Validators.required));
|
e == 1 ? this.addressForm.addControl('address_type_others', new FormControl('', Validators.required)) : this.addressForm.removeControl('address_type_others');
|
||||||
}
|
break;
|
||||||
}
|
case 4:
|
||||||
else{
|
e == 1 ? this.addressForm.addControl('locality_others', new FormControl('', Validators.required)) : this.addressForm.removeControl('locality_others');
|
||||||
ChildCtrl.removeControl('alternative_address');
|
break;
|
||||||
ChildCtrl.removeControl('alternative_state');
|
case 5:
|
||||||
ChildCtrl.removeControl('alternative_city');
|
e == 1 ? this.addressForm.addControl('uom_others', new FormControl('', Validators.required)) : this.addressForm.removeControl('uom_others');
|
||||||
ChildCtrl.removeControl('alternative_pincode');
|
break;
|
||||||
ChildCtrl.removeControl('alternative_pincode_others');
|
|
||||||
ChildCtrl.removeControl('reason_for_alternative_address');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** TO Save Address Forms Details*/
|
/** TO Save Address Forms Details*/
|
||||||
onSubmit() {
|
onSubmitOLD() {
|
||||||
|
|
||||||
const control = <FormArray>this.addressForm.controls['addresses'];
|
const control = <FormArray>this.addressForm.controls['addresses'];
|
||||||
let CtrlLength = control.controls.length;
|
let CtrlLength = control.controls.length;
|
||||||
if (CtrlLength > 0) {
|
if (CtrlLength > 0) {
|
||||||
let cnt = 0;
|
let cnt = 0;
|
||||||
while(cnt < CtrlLength){
|
while (cnt < CtrlLength) {
|
||||||
|
|
||||||
|
let ChildCtrl: any = control.controls[cnt]
|
||||||
|
|
||||||
let ChildCtrl : any = control.controls[cnt]
|
|
||||||
console.log('ChildCtrl.controls.address.value',ChildCtrl.controls.address.value);
|
|
||||||
ChildCtrl.controls.address.value = this.transformName(ChildCtrl.controls.address.value);
|
ChildCtrl.controls.address.value = this.transformName(ChildCtrl.controls.address.value);
|
||||||
console.log('ChildCtrl.controls.address.value',ChildCtrl.controls.address.value);
|
|
||||||
if(ChildCtrl.controls.address_type.value == 1){
|
if (ChildCtrl.controls.address_type.value == 1) {
|
||||||
ChildCtrl.controls['address_type_others'].setValidators([Validators.required]);}
|
ChildCtrl.controls['address_type_others'].setValidators([Validators.required]);
|
||||||
else{
|
}
|
||||||
|
else {
|
||||||
ChildCtrl.controls['address_type_others'].clearValidators();
|
ChildCtrl.controls['address_type_others'].clearValidators();
|
||||||
ChildCtrl.controls['address_type_others'].setValue('');
|
ChildCtrl.controls['address_type_others'].setValue('');
|
||||||
}
|
}
|
||||||
ChildCtrl.controls['address_type_others'].updateValueAndValidity();
|
ChildCtrl.controls['address_type_others'].updateValueAndValidity();
|
||||||
|
|
||||||
if(ChildCtrl.controls.locality.value == 1){
|
if (ChildCtrl.controls.locality.value == 1) {
|
||||||
ChildCtrl.controls['locality_others'].setValidators([Validators.required]);}
|
ChildCtrl.controls['locality_others'].setValidators([Validators.required]);
|
||||||
else{ ChildCtrl.controls['locality_others'].clearValidators();
|
}
|
||||||
|
else {
|
||||||
|
ChildCtrl.controls['locality_others'].clearValidators();
|
||||||
ChildCtrl.controls['locality_others'].setValue('');
|
ChildCtrl.controls['locality_others'].setValue('');
|
||||||
}
|
}
|
||||||
ChildCtrl.controls['locality_others'].updateValueAndValidity();
|
ChildCtrl.controls['locality_others'].updateValueAndValidity();
|
||||||
|
|
||||||
if(ChildCtrl.controls.pincode.value == 1){
|
if (ChildCtrl.controls.pincode.value == 1) {
|
||||||
ChildCtrl.controls['pincode_others'].setValidators([Validators.required]);}
|
ChildCtrl.controls['pincode_others'].setValidators([Validators.required]);
|
||||||
else{ ChildCtrl.controls['pincode_others'].clearValidators();
|
}
|
||||||
|
else {
|
||||||
|
ChildCtrl.controls['pincode_others'].clearValidators();
|
||||||
ChildCtrl.controls['pincode_others'].setValue('');
|
ChildCtrl.controls['pincode_others'].setValue('');
|
||||||
}
|
}
|
||||||
ChildCtrl.controls['pincode_others'].updateValueAndValidity();
|
ChildCtrl.controls['pincode_others'].updateValueAndValidity();
|
||||||
|
|
||||||
if(ChildCtrl.controls.alternative_pincode){
|
if (ChildCtrl.controls.alternative_pincode) {
|
||||||
if(ChildCtrl.controls.alternative_pincode.value != 1){
|
if (ChildCtrl.controls.alternative_pincode.value != 1) {
|
||||||
ChildCtrl.removeControl('alternative_pincode_others');
|
ChildCtrl.removeControl('alternative_pincode_others');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -533,9 +407,10 @@ export class AddressComponent implements OnInit {
|
|||||||
// : this.addressForm.controls['locality_mixuse'].clearValidators();
|
// : this.addressForm.controls['locality_mixuse'].clearValidators();
|
||||||
// this.addressForm.controls['locality_mixuse'].updateValueAndValidity();
|
// this.addressForm.controls['locality_mixuse'].updateValueAndValidity();
|
||||||
|
|
||||||
if(ChildCtrl.controls.uom.value == 1){
|
if (ChildCtrl.controls.uom.value == 1) {
|
||||||
ChildCtrl.controls['uom_others'].setValidators([Validators.required]);}
|
ChildCtrl.controls['uom_others'].setValidators([Validators.required]);
|
||||||
else{
|
}
|
||||||
|
else {
|
||||||
ChildCtrl.controls['uom_others'].clearValidators();
|
ChildCtrl.controls['uom_others'].clearValidators();
|
||||||
ChildCtrl.controls['uom_others'].setValue('');
|
ChildCtrl.controls['uom_others'].setValue('');
|
||||||
}
|
}
|
||||||
@ -563,7 +438,7 @@ export class AddressComponent implements OnInit {
|
|||||||
this.addressForm.controls.addresses.value
|
this.addressForm.controls.addresses.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;
|
||||||
records.formid = '5';
|
records.formid = '5';
|
||||||
|
|
||||||
// records.fk_createdby = '250';
|
// records.fk_createdby = '250';
|
||||||
@ -585,13 +460,111 @@ export class AddressComponent implements OnInit {
|
|||||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
||||||
this.disableAfterSubmit = false;
|
this.disableAfterSubmit = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
onSubmit() {
|
||||||
|
|
||||||
|
if (!this.addressForm.valid) {
|
||||||
|
this.validateAllFormFields(this.addressForm);
|
||||||
|
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||||
|
this.disableAfterSubmit = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// else if (this.addressForm.value.address_form_remark == '') {
|
||||||
|
// this.notifier.notify('warning', 'Fill Remark!');
|
||||||
|
// this.disableAfterSubmit = false;
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
else {
|
||||||
|
// console.log('this.addressForm.controls.addresses.value;', this.addressForm.value);
|
||||||
|
|
||||||
|
let records: any = {};
|
||||||
|
|
||||||
|
records.addresses = this.addressForm.controls.addresses.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(records.addresses[0].pincode != 1){
|
||||||
|
delete records.addresses[0].pincode_others
|
||||||
|
}
|
||||||
|
records.addresses[0].address_type = this.addressForm.controls.address_type.value;
|
||||||
|
if (this.addressForm.controls.address_type.value == 1) {
|
||||||
|
records.addresses[0].address_type_others = this.addressForm.controls.address_type_others.value;
|
||||||
|
}
|
||||||
|
records.addresses[0].locality = this.addressForm.controls.locality.value;
|
||||||
|
if (this.addressForm.controls.locality.value == 1) {
|
||||||
|
records.addresses[0].locality_others = this.addressForm.controls.locality_others.value;
|
||||||
|
}
|
||||||
|
records.addresses[0].locality_mixuse = this.addressForm.controls.locality_mixuse.value;
|
||||||
|
records.addresses[0].pd_location = this.addressForm.controls.pd_location.value;
|
||||||
|
records.addresses[0].comment_locality = this.addressForm.controls.comment_locality.value;
|
||||||
|
records.addresses[0].estimated_area = this.addressForm.controls.estimated_area.value;
|
||||||
|
records.addresses[0].uom = this.addressForm.controls.uom.value;
|
||||||
|
records.addresses[0].citySearch = '';
|
||||||
|
records.addresses[0].pinSearch = '';
|
||||||
|
records.addresses[0].stateSearch = '';
|
||||||
|
if (this.addressForm.controls.uom.value == 1) {
|
||||||
|
records.addresses[0].uom_others = this.addressForm.controls.uom_others.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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[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) {
|
||||||
|
records.alternative_addresses[0].address_type_others = this.addressForm.controls.address_type_others.value;
|
||||||
|
}
|
||||||
|
records.alternative_addresses[0].locality = this.addressForm.controls.locality.value;
|
||||||
|
if (this.addressForm.controls.locality.value == 1) {
|
||||||
|
records.alternative_addresses[0].locality_others = this.addressForm.controls.locality_others.value;
|
||||||
|
}
|
||||||
|
records.alternative_addresses[0].locality_mixuse = this.addressForm.controls.locality_mixuse.value;
|
||||||
|
records.alternative_addresses[0].pd_location = this.addressForm.controls.pd_location.value;
|
||||||
|
records.alternative_addresses[0].comment_locality = this.addressForm.controls.comment_locality.value;
|
||||||
|
records.alternative_addresses[0].estimated_area = this.addressForm.controls.estimated_area.value;
|
||||||
|
records.alternative_addresses[0].uom = this.addressForm.controls.uom.value;
|
||||||
|
records.alternative_addresses[0].citySearch = '';
|
||||||
|
records.alternative_addresses[0].pinSearch = '';
|
||||||
|
records.alternative_addresses[0].stateSearch = '';
|
||||||
|
if (this.addressForm.controls.uom.value == 1) {
|
||||||
|
records.alternative_addresses[0].uom_others = this.addressForm.controls.uom_others.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
records.address_form_remark = this.addressForm.controls.address_form_remark.value;
|
||||||
|
records.pdid = this.pdid;
|
||||||
|
records.parent_pdid = this.parent_pdid;
|
||||||
|
records.formid = '5';
|
||||||
|
|
||||||
|
// console.log('Final records', records);
|
||||||
|
|
||||||
|
this.disableAfterSubmit = true;
|
||||||
|
|
||||||
|
this._pd.saveForm(records).subscribe(data => {
|
||||||
|
if (data.status == 200) {
|
||||||
|
this.notifier.notify('success', 'Saved Successfully.');
|
||||||
|
setTimeout(() => {
|
||||||
|
this.dialogRef.close();
|
||||||
|
this.disableAfterSubmit = false;
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||||
|
this.disableAfterSubmit = false;
|
||||||
|
}
|
||||||
|
}, error => {
|
||||||
|
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!' + '-' + error.error_text + ' occur');
|
||||||
|
this.disableAfterSubmit = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** For PlaceHolder
|
/** For PlaceHolder
|
||||||
* selected AddressType is concate with label */
|
* selected AddressType is concate with label */
|
||||||
selectedAddressType(e: any, i) {
|
selectedAddressType(e: any) {
|
||||||
|
this.placeholderName = 'Estimated area of the ' + e;
|
||||||
this.placeholderName[i] = 'Estimated area of the ' + e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -630,7 +603,7 @@ export class AddressComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
imageCrop(pic){
|
imageCrop(pic) {
|
||||||
// let arr = { 'pic_name':pic_name,'pic':pic,'from_id':this.form_id}
|
// let arr = { 'pic_name':pic_name,'pic':pic,'from_id':this.form_id}
|
||||||
const imageRef = this.dialog.open(ImageCropComponent, {
|
const imageRef = this.dialog.open(ImageCropComponent, {
|
||||||
data: pic,
|
data: pic,
|
||||||
@ -641,33 +614,175 @@ export class AddressComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// addMoreIndividuals() {
|
setAddressFromDatas(params){
|
||||||
// const imageRef = this.dialog.open(OtherApplicantDetailsComponent, {
|
this._pd.retriveForm(params).subscribe(data => {
|
||||||
// data: '',
|
|
||||||
// width: '40%',
|
|
||||||
// disableClose: true
|
|
||||||
// });
|
|
||||||
// imageRef.afterClosed()
|
|
||||||
// .subscribe(dataresult => {
|
|
||||||
// if (dataresult.data.length > 0) {
|
|
||||||
// dataresult.data.forEach((element, index) => {
|
|
||||||
|
|
||||||
// let individualsControl = <FormArray>this._generalForm.controls['individuals'];
|
const control = <FormArray>this.addressForm.controls['addresses'];
|
||||||
// element.pd_co_applicant_id = this.count;
|
if (data.status == 200) {
|
||||||
// this.count = this.count + 1;
|
let initiated_address_check =data.records.hasOwnProperty('is_pd_done_on_initiated_address') ? data.records.is_pd_done_on_initiated_address : true ;
|
||||||
// element.individuals_order_id = individualsControl.controls.length + 1;
|
this.addressForm.controls.is_pd_done_on_initiated_address.setValue(initiated_address_check);
|
||||||
// element.is_new = true;
|
if (data.records.addresses.length == 0) {
|
||||||
// element.is_active = true;
|
control.push(this.createAddresses(null));
|
||||||
// element.is_main_applicant = false;
|
} else {
|
||||||
// individualsControl.push(this.createIndividulas(element));
|
data.records.addresses.forEach((datas, index) => {
|
||||||
// let relationControl = <FormArray>this._generalForm.controls['persons_with_relationships'];
|
let obj = {
|
||||||
// let applicant_details: any = { 'pd_co_applicant_id': element.pd_co_applicant_id, 'applicant_name': this.titleCase.transform(element.applicant_name), 'relationship': '', 'relation_to': '', 'individuals_order_id': element.individuals_order_id, 'is_active': element.is_active };
|
'address': this.transformName(datas.address),
|
||||||
// relationControl.push(this.createPersonsWithRelationships(applicant_details,individualsControl.controls.length-1));
|
'state': datas.state,
|
||||||
// });
|
'city': datas.city,
|
||||||
|
'pincode': datas.pincode,
|
||||||
|
'pincode_others': datas.pincode ? datas.pincode_others : ''
|
||||||
|
}
|
||||||
|
this.getCityAndPincodeDetails(datas.state, index, 1);
|
||||||
|
control.push(this.createAddresses(obj));
|
||||||
|
|
||||||
|
if (datas.address_type_others == "" || datas.address_type_others == null){
|
||||||
|
delete datas.address_type_others;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (datas.citySearch == "" || datas.citySearch == null){
|
||||||
|
delete datas.citySearch;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (datas.locality_others == "" || datas.locality_others == null){
|
||||||
|
delete datas.locality_others;
|
||||||
|
}
|
||||||
|
if (datas.pinSearch == "" || datas.pinSearch == null){
|
||||||
|
delete datas.pinSearch;
|
||||||
|
}
|
||||||
|
if (datas.pincode_others == "" || datas.pincode_others == null){
|
||||||
|
delete datas.pincode_others;
|
||||||
|
}
|
||||||
|
if (datas.stateSearch == "" || datas.stateSearch == null){
|
||||||
|
delete datas.stateSearch;
|
||||||
|
}
|
||||||
|
if (datas.uom_others == "" || datas.uom_others == null){
|
||||||
|
delete datas.uom_others;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (initiated_address_check === true) {
|
||||||
|
|
||||||
|
this.addressForm.controls.pd_location.setValue(datas.pd_location ? datas.pd_location : '');
|
||||||
|
this.addressForm.controls.address_type.setValue(datas.address_type ? datas.address_type : '');
|
||||||
|
|
||||||
|
let selectedAddressType = this.addressData.filter(element => element.address_type_id == datas.address_type)[0];
|
||||||
|
this.selectedAddressType(selectedAddressType.address_type);
|
||||||
|
this.setOthers(datas.address_type, '', 3);
|
||||||
|
|
||||||
|
if (datas.address_type == 1) {
|
||||||
|
this.addressForm.controls.address_type_others.setValue(datas.address_type_others);
|
||||||
|
this.selectedAddressType(datas.address_type_others);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.addressForm.controls.comment_locality.setValue(datas.comment_locality ? datas.comment_locality : '');
|
||||||
|
this.addressForm.controls.locality.setValue(datas.locality ? datas.locality : '');
|
||||||
|
|
||||||
|
this.setOthers(datas.locality, '', 4);
|
||||||
|
|
||||||
|
if (datas.locality == 1) {
|
||||||
|
this.addressForm.controls.locality_others.setValue(datas.locality_others);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.addressForm.controls.estimated_area.setValue(datas.estimated_area ? datas.estimated_area : '');
|
||||||
|
this.addressForm.controls.uom.setValue(datas.uom);
|
||||||
|
|
||||||
|
this.setOthers(datas.uom, '', 5);
|
||||||
|
if (data.records.uom == 1) {
|
||||||
|
this.addressForm.controls.uom_others.setValue(datas.uom_others);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (initiated_address_check == false) {
|
||||||
|
|
||||||
|
this.addressForm.addControl('alternative_addresses', this.fb.array([]));
|
||||||
|
const alternative_address_control = <FormArray>this.addressForm.controls['alternative_addresses'];
|
||||||
|
if (data.records.alternative_addresses.length > 0) {
|
||||||
|
|
||||||
|
data.records.alternative_addresses.forEach((datas, index) => {
|
||||||
|
|
||||||
|
if (datas.citySearch == "" || datas.citySearch == null){
|
||||||
|
delete datas.citySearch;
|
||||||
|
}
|
||||||
|
if (datas.pinSearch == "" || datas.pinSearch == null){
|
||||||
|
delete datas.pinSearch;
|
||||||
|
}
|
||||||
|
if (datas.stateSearch == "" || datas.stateSearch == null){
|
||||||
|
delete datas.stateSearch;
|
||||||
|
}
|
||||||
|
|
||||||
|
let obj = {
|
||||||
|
'alternative_address': this.transformName(datas.alternative_address),
|
||||||
|
'alternative_state': datas.alternative_state,
|
||||||
|
'alternative_city': datas.alternative_city,
|
||||||
|
'alternative_pincode': datas.alternative_pincode,
|
||||||
|
'alternative_pincode_others': datas.alternative_pincode == 1 ? datas.alternative_pincode_others : '',
|
||||||
|
'reason_for_alternative_address': datas.reason_for_alternative_address,
|
||||||
|
}
|
||||||
|
this.getCityAndPincodeDetails(datas.alternative_state, index, 2);
|
||||||
|
alternative_address_control.push(this.createAlternativeAddresses(obj));
|
||||||
|
|
||||||
|
this.addressForm.controls.pd_location.setValue(datas.pd_location);
|
||||||
|
this.addressForm.controls.address_type.setValue(datas.address_type);
|
||||||
|
|
||||||
|
let selectedAddressType = this.addressData.filter(element => element.address_type_id == datas.address_type)[0];
|
||||||
|
this.selectedAddressType(selectedAddressType.address_type);
|
||||||
|
|
||||||
|
this.setOthers(datas.address_type, '', 3);
|
||||||
|
|
||||||
|
if (datas.address_type == 1) {
|
||||||
|
this.addressForm.controls.address_type_others.setValue(datas.address_type_others);
|
||||||
|
this.selectedAddressType(datas.address_type_others);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.addressForm.controls.comment_locality.setValue(datas.comment_locality);
|
||||||
|
|
||||||
|
this.addressForm.controls.locality.setValue(datas.locality);
|
||||||
|
this.setOthers(datas.locality, '', 4);
|
||||||
|
|
||||||
|
if (datas.locality == 1) {
|
||||||
|
this.addressForm.controls.locality_others.setValue(datas.locality_others);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.addressForm.controls.estimated_area.setValue(datas.estimated_area);
|
||||||
|
this.addressForm.controls.uom.setValue(datas.uom);
|
||||||
|
this.setOthers(datas.uom, '', 5);
|
||||||
|
if (data.records.uom == 1) {
|
||||||
|
this.addressForm.controls.uom_others.setValue(datas.uom_others);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.addressForm.controls.address_form_remark.setValue(data.records.address_form_remark);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.loadPDAddressesDetails();
|
||||||
|
}
|
||||||
|
// else {
|
||||||
|
// control.push(this.createAddresses(null));
|
||||||
// }
|
// }
|
||||||
// });
|
});
|
||||||
|
|
||||||
// }
|
this._pd.retriveFile(this.pdid, '5', null).subscribe(data => {
|
||||||
|
if (data.status == 200) {
|
||||||
|
if (data.records.length > 0) {
|
||||||
|
data.records.forEach((val, index) => {
|
||||||
|
let splitted = val.pd_document_name.split(".");
|
||||||
|
let DocumentsAndFiles = {
|
||||||
|
'document_name': val.pd_document_name,
|
||||||
|
'document_title': val.pd_document_title,
|
||||||
|
'document': val.doc_url,
|
||||||
|
'document_type': splitted[1] == 'pdf' ? 'pdf' : 'image'
|
||||||
|
}
|
||||||
|
this.documentsAndFilesList.push(DocumentsAndFiles);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.documentsAndFilesList = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user