address form : changes
This commit is contained in:
parent
cc46c619a8
commit
dc50a75373
@ -3,7 +3,8 @@
|
||||
|
||||
<h2 mat-dialog-title class="paragraph_change">
|
||||
<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>
|
||||
{{pageTitle}}
|
||||
</div>
|
||||
@ -19,210 +20,297 @@
|
||||
<mat-tab-group>
|
||||
<mat-tab label="Questions">
|
||||
<ng-template matTabContent>
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex="100">
|
||||
<mat-card style="min-height: 550px;">
|
||||
<div formArrayName="addresses">
|
||||
<div *ngFor="let item of addressForm.controls.addresses['controls']; let i=index">
|
||||
<mat-card-title>
|
||||
<p>Address Details {{i+1}}</p>
|
||||
</mat-card-title>
|
||||
<mat-card-content class="matcard" [formGroup]="item">
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex="100">
|
||||
<mat-card style="min-height: 550px;">
|
||||
<mat-card-title>
|
||||
<p>Address Details</p>
|
||||
</mat-card-title>
|
||||
<mat-card-content>
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex="100">
|
||||
<div formArrayName="addresses">
|
||||
<div
|
||||
*ngFor="let init_addr of addressForm.controls.addresses['controls']; let i=index">
|
||||
<div [formGroup]="init_addr">
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex="100">
|
||||
<!-- oninput="this.value = this.value.toUpperCase()" -->
|
||||
<mat-form-field style="width: 96%">
|
||||
<input matInput placeholder="Address at which PD was initiated" formControlName="address"
|
||||
[value]="item.get('address').value | titlecase"
|
||||
required
|
||||
autocomplete="off">
|
||||
<mat-error *ngIf="item.controls['address'].hasError('required')">Address Required</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<mat-form-field style="width: 96%">
|
||||
<input matInput
|
||||
placeholder="Address at which PD was initiated"
|
||||
formControlName="address"
|
||||
[value]="init_addr.get('address').value | titlecase"
|
||||
requiredrequired autocomplete="off">
|
||||
<mat-error
|
||||
*ngIf="init_addr.controls['address'].hasError('required')">
|
||||
Address Required</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div fxFlex="100" fxLayout="nowrap">
|
||||
<mat-form-field style="width: 32%">
|
||||
<mat-select placeholder="State" formControlName="state"
|
||||
(selectionChange)="getCityAndPincodeDetails($event.value,i,1)">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option *ngFor="let SL of stateData" [value]="SL.state_id">{{SL.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<div fxFlex="100" fxLayout="nowrap">
|
||||
<mat-form-field style="width: 32%">
|
||||
<mat-select placeholder="State" formControlName="state"
|
||||
(selectionChange)="getCityAndPincodeDetails($event.value,i,1)">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option *ngFor="let SL of stateData"
|
||||
[value]="SL.state_id">{{SL.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 32%">
|
||||
<mat-select placeholder="City" formControlName="city">
|
||||
<mat-option> Select </mat-option>
|
||||
<mat-option *ngFor="let CL of cityData[i]" [value]="CL.city_id">{{CL.city_name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 32%">
|
||||
<mat-select placeholder="City" formControlName="city">
|
||||
<mat-option> Select </mat-option>
|
||||
<mat-option *ngFor="let CL of cityData"
|
||||
[value]="CL.city_id">{{CL.city_name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 24%">
|
||||
<mat-select placeholder="Pincode" formControlName="pincode">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option *ngFor="let PL of pincodeData[i]" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 24%">
|
||||
<mat-select placeholder="Pincode" formControlName="pincode">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option *ngFor="let PL of pincodeData"
|
||||
[value]="PL.pincode_id">{{PL.pincode}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 24%" *ngIf="item.get('pincode').value == 1">
|
||||
<input matInput autocomplete="off" placeholder="Specify Pincode *"
|
||||
formControlName="pincode_others" OnlyNumber type="text">
|
||||
<mat-error *ngIf="item.controls['pincode_others'].hasError('required')">Pincode Required</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width: 24%"
|
||||
*ngIf="init_addr.get('pincode').value == 1">
|
||||
<input matInput autocomplete="off"
|
||||
placeholder="Specify Pincode *"
|
||||
formControlName="pincode_others" OnlyNumber type="text">
|
||||
<!-- <mat-error
|
||||
*ngIf="init_addr.controls['pincode_others'].hasError('required')">
|
||||
Pincode Required</mat-error> -->
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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)">
|
||||
Is This Address PD is being done ? <strong>( {{item.get('pd_is_done_on_initiated_address').value===true ? 'Yes' : 'No'}} )</strong>
|
||||
</mat-checkbox>
|
||||
<br>
|
||||
</div>
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex="100" align="left" style="margin: 0 0 2% 2%;">
|
||||
<mat-checkbox color="primary"
|
||||
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>
|
||||
<br>
|
||||
</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%">
|
||||
<input matInput placeholder="Is this the address where PD is done?" formControlName="alternative_address"
|
||||
[value]="item.get('alternative_address').value | titlecase" required autocomplete="off">
|
||||
<mat-error *ngIf="item.controls['alternative_address'].hasError('required')">Alternative Address Required</mat-error>
|
||||
<input matInput
|
||||
placeholder="Address at which PD Visit actually done"
|
||||
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>
|
||||
</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-select placeholder="State" formControlName="alternative_state"
|
||||
(selectionChange)="getCityAndPincodeDetails($event.value,i,2)">
|
||||
<mat-select placeholder="State"
|
||||
formControlName="alternative_state"
|
||||
(selectionChange)="getCityAndPincodeDetails($event.value,a,2)">
|
||||
<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-form-field>
|
||||
|
||||
<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 *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-form-field>
|
||||
|
||||
<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 *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-form-field>
|
||||
|
||||
<mat-form-field style="width: 24%" *ngIf="item.get('alternative_pincode').value == 1">
|
||||
<input matInput autocomplete="off" placeholder="Specify Pincode *" required
|
||||
formControlName="alternative_pincode_others" OnlyNumber type="text">
|
||||
<mat-error *ngIf="item.controls['alternative_pincode_others'].hasError('required')">Pincode Required</mat-error>
|
||||
<mat-form-field style="width: 24%"
|
||||
*ngIf="alter_addr.get('alternative_pincode').value == 1">
|
||||
<input matInput autocomplete="off"
|
||||
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>
|
||||
</div>
|
||||
|
||||
<div fxFlex="100" *ngIf="item.get('pd_is_done_on_initiated_address').value===false">
|
||||
</div>
|
||||
|
||||
<div fxFlex="100">
|
||||
|
||||
<mat-form-field style="width: 96%">
|
||||
<input matInput placeholder="Reason for change in PD visit address ?" formControlName="reason_for_alternative_address" required autocomplete="off">
|
||||
<mat-error *ngIf="item.controls['reason_for_alternative_address'].hasError('required')">Reason Required</mat-error>
|
||||
<input matInput
|
||||
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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div fxFlex="100">
|
||||
<mat-form-field style="width: 46%;">
|
||||
<mat-select placeholder="Address Type" formControlName="address_type"
|
||||
required (selectionChange)="selectedAddressType($event.source.triggerValue,i)">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="{{m_addressType.address_type_id}}"
|
||||
*ngFor="let m_addressType of addressData">{{m_addressType.address_type}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="item.controls['address_type'].hasError('required')">Address Type Required</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 46%;" *ngIf="item.get('address_type').value == 1">
|
||||
<input matInput placeholder="Specify Address Type *"
|
||||
formControlName="address_type_others" autocomplete="off"
|
||||
(change)="selectedAddressType($event.target.value,i)">
|
||||
<mat-error *ngIf="item.controls['address_type_others'].hasError('required')">Address Type Required</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div fxFlex="100">
|
||||
<mat-form-field style="width: 46%;">
|
||||
<mat-select placeholder="Locality" formControlName="locality"
|
||||
required>
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="{{m_locality.locality_id}}" *ngFor="let m_locality of localityData">{{m_locality.locality_name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="item.controls['locality'].hasError('required')">Locality Required</mat-error>
|
||||
</mat-form-field>
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex="100">
|
||||
<mat-form-field style="width: 46%;">
|
||||
<mat-select placeholder="Address Type" formControlName="address_type"
|
||||
required
|
||||
(selectionChange)="setOthers($event.value,'',3);selectedAddressType($event.source.triggerValue)">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="{{m_addressType.address_type_id}}"
|
||||
*ngFor="let m_addressType of addressData">
|
||||
{{m_addressType.address_type}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error
|
||||
*ngIf="addressForm.controls['address_type'].hasError('required')">
|
||||
Address Type Required</mat-error>
|
||||
|
||||
<mat-form-field style="width: 46%;" *ngIf="item.get('locality').value == 1">
|
||||
<input matInput placeholder="Specify Locality *"
|
||||
formControlName="locality_others" autocomplete="off">
|
||||
<!-- autofocus -->
|
||||
<!-- <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-form-field>
|
||||
</mat-form-field>
|
||||
|
||||
<!-- <mat-form-field style="width: 46%;" *ngIf="item.get('locality').value == 5">
|
||||
<mat-form-field style="width: 46%;"
|
||||
*ngIf="addressForm.controls['address_type'].value == 1">
|
||||
<input matInput placeholder="Specify Address Type " required
|
||||
formControlName="address_type_others" autocomplete="off"
|
||||
(change)="selectedAddressType($event.target.value)">
|
||||
<mat-error
|
||||
*ngIf="addressForm.controls['address_type_others'].hasError('required')">
|
||||
Address Type Required</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex="100">
|
||||
<mat-form-field style="width: 46%;">
|
||||
<mat-select placeholder="Locality" formControlName="locality" required
|
||||
(selectionChange)="setOthers($event.value,'',4)">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="{{m_locality.locality_id}}"
|
||||
*ngFor="let m_locality of localityData">
|
||||
{{m_locality.locality_name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error
|
||||
*ngIf="addressForm.controls['locality'].hasError('required')">
|
||||
Locality Required</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 46%;"
|
||||
*ngIf="addressForm.controls['locality'].value == 1">
|
||||
<input matInput placeholder="Specify Locality " required
|
||||
formControlName="locality_others" autocomplete="off">
|
||||
<!-- 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-form-field>
|
||||
|
||||
<!-- <mat-form-field style="width: 46%;" *ngIf="item.get('locality').value == 5">
|
||||
<input matInput placeholder="Specify the MixUse *"
|
||||
formControlName="locality_mixuse" autocomplete="off">
|
||||
!-- <mat-error *ngIf="!addressForm.controls['locality_mixuse'].hasError('required')">MixUse
|
||||
Required</mat-error> --
|
||||
</mat-form-field> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div fxFlex="100">
|
||||
<mat-form-field style="width: 46%;">
|
||||
<mat-select placeholder="Approach to PD Location"
|
||||
formControlName="pd_location" required>
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="{{data.pd_location_approach_id}}"
|
||||
*ngFor="let data of locationdata">{{data.description}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error
|
||||
*ngIf="addressForm.controls['pd_location'].hasError('required')">
|
||||
Approach to PD Location Required</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 46%;">
|
||||
<mat-select placeholder="Comment on Locality"
|
||||
formControlName="comment_locality" required>
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="{{data.comments_on_locality_id}}"
|
||||
*ngFor="let data of commentData">{{data.rating}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error
|
||||
*ngIf="addressForm.controls['comment_locality'].hasError('required')">
|
||||
Comment on Locality Required</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div fxFlex="100" fxLayout="nowrap">
|
||||
<mat-form-field style="width: 46%;">
|
||||
<input matInput
|
||||
[placeholder]=" placeholderName != '' ? placeholderName : 'Estimated area of the (Address Type)'"
|
||||
formControlName="estimated_area" OnlyNumber type="text">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 46%;">
|
||||
<mat-select placeholder="Unit of Measurement" formControlName="uom"
|
||||
(selectionChange)="setOthers($event.value,'',5)">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="{{uom.uom_id}}" *ngFor="let uom of uomData">
|
||||
{{uom.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 24%;"
|
||||
*ngIf="addressForm.controls['uom'].value == 1 ">
|
||||
<input matInput placeholder="Specify UOM *" formControlName="uom_others"
|
||||
autocomplete="off">
|
||||
<mat-error
|
||||
*ngIf="addressForm.controls['uom_others'].hasError('required')">
|
||||
UOM Required</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div fxFlex="100">
|
||||
<mat-form-field style="width: 46%;">
|
||||
<mat-select placeholder="Approach to PD Location"
|
||||
formControlName="pd_location" required>
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="{{data.pd_location_approach_id}}" *ngFor="let data of locationdata">{{data.description}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="item.controls['pd_location'].hasError('required')">Approach to PD Location Required</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 46%;">
|
||||
<mat-select placeholder="Comment on Locality" formControlName="comment_locality"
|
||||
required>
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="{{data.comments_on_locality_id}}" *ngFor="let data of commentData">{{data.rating}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="item.controls['comment_locality'].hasError('required')">Comment on Locality Required</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
|
||||
<div fxFlex="100" fxLayout="nowrap">
|
||||
<mat-form-field style="width: 46%;">
|
||||
<input matInput [placeholder]="placeholderName[i] ? placeholderName[i] : 'Estimated area of the (Address Type)'"
|
||||
formControlName="estimated_area" OnlyNumber type="text">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 46%;">
|
||||
<mat-select placeholder="Unit of Measurement" formControlName="uom">
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="{{uom.uom_id}}" *ngFor="let uom of uomData">{{uom.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 24%;" *ngIf="item.get('uom').value == 1 ">
|
||||
<input matInput placeholder="Specify UOM *" formControlName="uom_others"
|
||||
autocomplete="off">
|
||||
<mat-error *ngIf="item.controls['uom_others'].hasError('required') || item.controls['uom_others'].value != '' ">UOM Required</mat-error>
|
||||
<!-- <mat-error *ngIf="!addressForm.controls['uom_others'].hasError('required')">UOM
|
||||
Required</mat-error> -->
|
||||
</mat-form-field>
|
||||
</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()"
|
||||
color="primary" style="float: right;">
|
||||
<mat-icon>add</mat-icon>
|
||||
@ -232,51 +320,59 @@
|
||||
style="float: right;">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button> -->
|
||||
</mat-card-content>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
|
||||
<mat-tab label="Docs">
|
||||
<ng-template matTabContent>
|
||||
<div ngxViewer *ngIf="documentsAndFilesList.length>0; else noFiles">
|
||||
<div fxLayout="row wrap" style="padding:20px;">
|
||||
<div fxFlex="100">
|
||||
<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">
|
||||
<div class="top"> <img src="{{doc.document}}" alt="{{doc.document_name}}" style="width: 100%;height: 100%;">
|
||||
<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 ngxViewer *ngIf="documentsAndFilesList.length>0; else noFiles">
|
||||
<div fxLayout="row wrap" style="padding:20px;">
|
||||
<div fxFlex="100">
|
||||
<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">
|
||||
<div class="top"> <img src="{{doc.document}}" alt="{{doc.document_name}}"
|
||||
style="width: 100%;height: 100%;">
|
||||
<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 fxFlex="row">
|
||||
<div fxFlex="100" class="m-gap p-gap">
|
||||
<div fxLayout="row" fxLayoutWrap="wrap">
|
||||
<div *ngFor="let doc of documentsAndFilesList">
|
||||
<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';">
|
||||
<!-- <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>
|
||||
<span class="d-block">{{doc.document_title}}</span>
|
||||
<!-- </a> -->
|
||||
</div>
|
||||
<div fxFlex="row">
|
||||
<div fxFlex="100" class="m-gap p-gap">
|
||||
<div fxLayout="row" fxLayoutWrap="wrap">
|
||||
<div *ngFor="let doc of documentsAndFilesList">
|
||||
<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';">
|
||||
<!-- <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>
|
||||
<span class="d-block">{{doc.document_title}}</span>
|
||||
<!-- </a> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ng-template #noFiles>
|
||||
<mat-card-content>
|
||||
<p style="margin: 20px;">No Files</p>
|
||||
</mat-card-content>
|
||||
<mat-card-content>
|
||||
<p style="margin: 20px;">No Files</p>
|
||||
</mat-card-content>
|
||||
</ng-template>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
@ -294,8 +390,8 @@
|
||||
</div>
|
||||
<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" matTooltip="Save" matTooltipPosition="above"
|
||||
type="submit" (click)="onSubmit()" [disabled]="disableAfterSubmit===true">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save"
|
||||
matTooltipPosition="above" type="submit" (click)="onSubmit()" [disabled]="disableAfterSubmit===true">
|
||||
<mat-icon>save</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@ -38,15 +38,9 @@ export class AddressComponent implements OnInit {
|
||||
parent_pdid: string;
|
||||
pdid: number;
|
||||
form_id: number;
|
||||
// pdAddress: string;
|
||||
// pdState: any;
|
||||
// pdCity: any;
|
||||
// pdPincode: any;
|
||||
// pdOtherPincode: any;
|
||||
CustSegAbbr: any;
|
||||
|
||||
loadDataStatus: boolean = true;
|
||||
placeholderName: any = [];
|
||||
placeholderName: any = '';
|
||||
|
||||
/**Array declaration Of Dropdown */
|
||||
locationdata: any = [];
|
||||
@ -57,8 +51,8 @@ export class AddressComponent implements OnInit {
|
||||
pincodeData: any = [];
|
||||
cityData: any = [];
|
||||
uomData: any = [];
|
||||
alertnativeCityData:any=[];
|
||||
alertnativePincodeData:any=[];
|
||||
alertnativeCityData: any = [];
|
||||
alertnativePincodeData: any = [];
|
||||
|
||||
addressesList: any = [];
|
||||
documentsAndFilesList: any = [];
|
||||
@ -68,17 +62,6 @@ export class AddressComponent implements OnInit {
|
||||
private notifier: NotifierService;
|
||||
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(private el: ElementRef, notifier: NotifierService,
|
||||
private fb: FormBuilder,
|
||||
@ -86,9 +69,10 @@ export class AddressComponent implements OnInit {
|
||||
private router: Router,
|
||||
private _pd: PdTrigerService,
|
||||
private dialogRef: MatDialogRef<AddressComponent>,
|
||||
private titlecasePipe:TitleCasePipe,
|
||||
private titlecasePipe: TitleCasePipe,
|
||||
private dialog: MatDialog,
|
||||
private imageRef: MatDialogRef<ImageCropComponent>,
|
||||
|
||||
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
||||
// console.log('pd_all_details',pd_all_details);
|
||||
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);
|
||||
|
||||
let params: any = {};
|
||||
params.parent_pdid=this.parent_pdid;
|
||||
params.parent_pdid = this.parent_pdid;
|
||||
params.pd_id = this.pdid;
|
||||
params.pd_form_id = '5';
|
||||
|
||||
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 = [];
|
||||
}
|
||||
});
|
||||
this.setAddressFromDatas(params);
|
||||
}
|
||||
|
||||
loadPDAddressesDetails() {
|
||||
const control = <FormArray>this.addressForm.controls['addresses'];
|
||||
|
||||
this._pd.getAddressesDetails(this.pdid).subscribe(
|
||||
data => {
|
||||
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) {
|
||||
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 = {
|
||||
'address': this.transformName(val.addressline1),
|
||||
'address_type': '',
|
||||
'address_type_others': '',
|
||||
'state': val.fk_state,
|
||||
'city': val.fk_city,
|
||||
'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': ''
|
||||
'address': this.transformName(datas.addressline1),
|
||||
'state': datas.fk_state,
|
||||
'city': datas.fk_city,
|
||||
'pincode': datas.pincode_id,
|
||||
'pincode_others': datas.pincode_id == 1 ? datas.other_pincode :'',
|
||||
}
|
||||
this.getCityAndPincodeDetails(val.fk_state,index,1);
|
||||
this.getOtherPincode(val.pincode_id, index);
|
||||
this.getCityAndPincodeDetails(datas.fk_state, index, 1);
|
||||
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('');
|
||||
// else{
|
||||
// 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 */
|
||||
public initAddressForm(): void {
|
||||
this.addressForm = this.fb.group({
|
||||
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: ['']
|
||||
});
|
||||
// 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){
|
||||
// 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){
|
||||
pdf(fileURL) {
|
||||
window.open(fileURL);
|
||||
}
|
||||
|
||||
/** FOR Adress */
|
||||
/** FOR Form Field For Address Array */
|
||||
createAddresses(AddressDetails): FormGroup {
|
||||
console.log(AddressDetails);
|
||||
if (AddressDetails != null) {
|
||||
console.log(AddressDetails);
|
||||
return this.fb.group({
|
||||
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],
|
||||
city: [AddressDetails.city],
|
||||
citySearch:[''],
|
||||
stateSearch:[''],
|
||||
pinSearch:[''],
|
||||
pincode: [AddressDetails.pincode],/** ,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 {
|
||||
return this.fb.group({
|
||||
address: ['', Validators.compose([Validators.required])],
|
||||
address_type: ['', Validators.compose([Validators.required])],
|
||||
address_type_others: [''],
|
||||
state: [''],
|
||||
city: [''],
|
||||
citySearch:[''],
|
||||
stateSearch:[''],
|
||||
pinSearch:[''],
|
||||
pincode: [''],
|
||||
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])],
|
||||
comment_locality: ['', Validators.compose([Validators.required])],
|
||||
estimated_area: [''],
|
||||
uom: [''],
|
||||
uom_others: ['']
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** FOR Form Field For Alternative Address Array */
|
||||
createAlternativeAddresses(AddressDetails): FormGroup {
|
||||
if (AddressDetails != null) {
|
||||
console.log('not null');
|
||||
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,105 +298,127 @@ export class AddressComponent implements OnInit {
|
||||
/** To Get City And Pincode Data For Address Form
|
||||
* Param 'stateID' -> selected StateId
|
||||
*/
|
||||
getCityAndPincodeDetails(stateID: string, index,flag) {
|
||||
getCityAndPincodeDetails(stateID: string, index, flag) {
|
||||
|
||||
this._pd.getStateWiseCities(stateID).subscribe(data => {
|
||||
if (data.status == 200) {
|
||||
if(flag==1){
|
||||
this.cityData[index] = data.records.cities;
|
||||
this.pincodeData[index] = data.records.pincode;
|
||||
}else if(flag == 2){
|
||||
this.alertnativeCityData[index] = data.records.cities;
|
||||
this.alertnativePincodeData[index] = data.records.pincode;
|
||||
}
|
||||
this._pd.getStateWiseCities(stateID).subscribe(data => {
|
||||
if (data.status == 200) {
|
||||
if (flag == 1) {
|
||||
this.cityData = data.records.cities;
|
||||
this.pincodeData = data.records.pincode;
|
||||
} else if (flag == 2) {
|
||||
this.alertnativeCityData = data.records.cities;
|
||||
this.alertnativePincodeData = data.records.pincode;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getOtherPincode(e, i) { this.otherPincodeFlag[i] = e == 1 ? true : false; }
|
||||
transformName(vals){ return this.titlecasePipe.transform(vals); }
|
||||
// getOtherPincode(e, i) { this.otherPincodeFlag[i] = e == 1 ? true : false; }
|
||||
transformName(vals) { return this.titlecasePipe.transform(vals); }
|
||||
|
||||
alternativeAddress(e,i,flag){
|
||||
const control = <FormArray>this.addressForm.controls['addresses'];
|
||||
let ChildCtrl : any = control.controls[i];
|
||||
// Add and Remove The Alternative-Address Form-Array
|
||||
alternativeAddress(e) {
|
||||
|
||||
if(e==false){
|
||||
if(flag==1){
|
||||
ChildCtrl.addControl('alternative_address', new FormControl('', Validators.required));
|
||||
ChildCtrl.addControl('alternative_state', new FormControl(''));
|
||||
ChildCtrl.addControl('alternative_city', new FormControl(''));
|
||||
ChildCtrl.addControl('alternative_pincode', new FormControl(''));
|
||||
ChildCtrl.addControl('alternative_pincode_others', new FormControl('', Validators.required));
|
||||
ChildCtrl.addControl('reason_for_alternative_address', new FormControl('', Validators.required));
|
||||
}
|
||||
}
|
||||
else{
|
||||
ChildCtrl.removeControl('alternative_address');
|
||||
ChildCtrl.removeControl('alternative_state');
|
||||
ChildCtrl.removeControl('alternative_city');
|
||||
ChildCtrl.removeControl('alternative_pincode');
|
||||
ChildCtrl.removeControl('alternative_pincode_others');
|
||||
ChildCtrl.removeControl('reason_for_alternative_address');
|
||||
}
|
||||
}
|
||||
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'];
|
||||
let ChildCtrl: any = control.controls[i];
|
||||
e == 1 ? ChildCtrl.addControl('pincode_others', new FormControl('', Validators.required)) : ChildCtrl.removeControl('pincode_others');
|
||||
break;
|
||||
case 2:
|
||||
const alternative_address_control = <FormArray>this.addressForm.controls['alternative_addresses'];
|
||||
let AltChildCtrl: any = alternative_address_control.controls[i];
|
||||
e == 1 ? AltChildCtrl.addControl('alternative_pincode_others', new FormControl('', Validators.required)) : AltChildCtrl.removeControl('alternative_pincode_others');
|
||||
break;
|
||||
case 3:
|
||||
e == 1 ? this.addressForm.addControl('address_type_others', new FormControl('', Validators.required)) : this.addressForm.removeControl('address_type_others');
|
||||
break;
|
||||
case 4:
|
||||
e == 1 ? this.addressForm.addControl('locality_others', new FormControl('', Validators.required)) : this.addressForm.removeControl('locality_others');
|
||||
break;
|
||||
case 5:
|
||||
e == 1 ? this.addressForm.addControl('uom_others', new FormControl('', Validators.required)) : this.addressForm.removeControl('uom_others');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/** TO Save Address Forms Details*/
|
||||
onSubmit() {
|
||||
onSubmitOLD() {
|
||||
|
||||
const control = <FormArray>this.addressForm.controls['addresses'];
|
||||
let CtrlLength = control.controls.length;
|
||||
if (CtrlLength > 0) {
|
||||
let cnt = 0;
|
||||
while(cnt < CtrlLength){
|
||||
const control = <FormArray>this.addressForm.controls['addresses'];
|
||||
let CtrlLength = control.controls.length;
|
||||
if (CtrlLength > 0) {
|
||||
let cnt = 0;
|
||||
while (cnt < CtrlLength) {
|
||||
|
||||
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);
|
||||
console.log('ChildCtrl.controls.address.value',ChildCtrl.controls.address.value);
|
||||
if(ChildCtrl.controls.address_type.value == 1){
|
||||
ChildCtrl.controls['address_type_others'].setValidators([Validators.required]);}
|
||||
else{
|
||||
ChildCtrl.controls['address_type_others'].clearValidators();
|
||||
ChildCtrl.controls['address_type_others'].setValue('');
|
||||
}
|
||||
ChildCtrl.controls['address_type_others'].updateValueAndValidity();
|
||||
let ChildCtrl: any = control.controls[cnt]
|
||||
|
||||
if(ChildCtrl.controls.locality.value == 1){
|
||||
ChildCtrl.controls['locality_others'].setValidators([Validators.required]);}
|
||||
else{ ChildCtrl.controls['locality_others'].clearValidators();
|
||||
ChildCtrl.controls['locality_others'].setValue('');
|
||||
}
|
||||
ChildCtrl.controls['locality_others'].updateValueAndValidity();
|
||||
ChildCtrl.controls.address.value = this.transformName(ChildCtrl.controls.address.value);
|
||||
|
||||
if(ChildCtrl.controls.pincode.value == 1){
|
||||
ChildCtrl.controls['pincode_others'].setValidators([Validators.required]);}
|
||||
else{ ChildCtrl.controls['pincode_others'].clearValidators();
|
||||
ChildCtrl.controls['pincode_others'].setValue('');
|
||||
}
|
||||
ChildCtrl.controls['pincode_others'].updateValueAndValidity();
|
||||
if (ChildCtrl.controls.address_type.value == 1) {
|
||||
ChildCtrl.controls['address_type_others'].setValidators([Validators.required]);
|
||||
}
|
||||
else {
|
||||
ChildCtrl.controls['address_type_others'].clearValidators();
|
||||
ChildCtrl.controls['address_type_others'].setValue('');
|
||||
}
|
||||
ChildCtrl.controls['address_type_others'].updateValueAndValidity();
|
||||
|
||||
if(ChildCtrl.controls.alternative_pincode){
|
||||
if(ChildCtrl.controls.alternative_pincode.value != 1){
|
||||
ChildCtrl.removeControl('alternative_pincode_others');
|
||||
if (ChildCtrl.controls.locality.value == 1) {
|
||||
ChildCtrl.controls['locality_others'].setValidators([Validators.required]);
|
||||
}
|
||||
else {
|
||||
ChildCtrl.controls['locality_others'].clearValidators();
|
||||
ChildCtrl.controls['locality_others'].setValue('');
|
||||
}
|
||||
ChildCtrl.controls['locality_others'].updateValueAndValidity();
|
||||
|
||||
if (ChildCtrl.controls.pincode.value == 1) {
|
||||
ChildCtrl.controls['pincode_others'].setValidators([Validators.required]);
|
||||
}
|
||||
else {
|
||||
ChildCtrl.controls['pincode_others'].clearValidators();
|
||||
ChildCtrl.controls['pincode_others'].setValue('');
|
||||
}
|
||||
ChildCtrl.controls['pincode_others'].updateValueAndValidity();
|
||||
|
||||
if (ChildCtrl.controls.alternative_pincode) {
|
||||
if (ChildCtrl.controls.alternative_pincode.value != 1) {
|
||||
ChildCtrl.removeControl('alternative_pincode_others');
|
||||
}
|
||||
}
|
||||
|
||||
// data.controls.locality.value == 5
|
||||
// ? this.addressForm.controls['locality_mixuse'].setValidators([Validators.required])
|
||||
// : this.addressForm.controls['locality_mixuse'].clearValidators();
|
||||
// this.addressForm.controls['locality_mixuse'].updateValueAndValidity();
|
||||
|
||||
if (ChildCtrl.controls.uom.value == 1) {
|
||||
ChildCtrl.controls['uom_others'].setValidators([Validators.required]);
|
||||
}
|
||||
else {
|
||||
ChildCtrl.controls['uom_others'].clearValidators();
|
||||
ChildCtrl.controls['uom_others'].setValue('');
|
||||
}
|
||||
ChildCtrl.controls['uom_others'].updateValueAndValidity();
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
// data.controls.locality.value == 5
|
||||
// ? this.addressForm.controls['locality_mixuse'].setValidators([Validators.required])
|
||||
// : this.addressForm.controls['locality_mixuse'].clearValidators();
|
||||
// this.addressForm.controls['locality_mixuse'].updateValueAndValidity();
|
||||
|
||||
if(ChildCtrl.controls.uom.value == 1){
|
||||
ChildCtrl.controls['uom_others'].setValidators([Validators.required]);}
|
||||
else{
|
||||
ChildCtrl.controls['uom_others'].clearValidators();
|
||||
ChildCtrl.controls['uom_others'].setValue('');
|
||||
}
|
||||
ChildCtrl.controls['uom_others'].updateValueAndValidity();
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.addressForm.valid) {
|
||||
this.validateAllFormFields(this.addressForm);
|
||||
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||
@ -563,7 +438,7 @@ export class AddressComponent implements OnInit {
|
||||
this.addressForm.controls.addresses.value
|
||||
records.address_form_remark = this.addressForm.controls.address_form_remark.value;
|
||||
records.pdid = this.pdid;
|
||||
records.parent_pdid= this.parent_pdid;
|
||||
records.parent_pdid = this.parent_pdid;
|
||||
records.formid = '5';
|
||||
|
||||
// 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.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
|
||||
* selected AddressType is concate with label */
|
||||
selectedAddressType(e: any, i) {
|
||||
|
||||
this.placeholderName[i] = 'Estimated area of the ' + e;
|
||||
selectedAddressType(e: any) {
|
||||
this.placeholderName = 'Estimated area of the ' + e;
|
||||
}
|
||||
|
||||
|
||||
@ -607,7 +580,7 @@ export class AddressComponent implements OnInit {
|
||||
this.validateAllFormFields(control);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** For DOCS Tab */
|
||||
public viewerOptions: any = {
|
||||
@ -630,44 +603,186 @@ export class AddressComponent implements OnInit {
|
||||
}
|
||||
};
|
||||
|
||||
imageCrop(pic){
|
||||
imageCrop(pic) {
|
||||
// let arr = { 'pic_name':pic_name,'pic':pic,'from_id':this.form_id}
|
||||
const imageRef = this.dialog.open(ImageCropComponent, {
|
||||
data: pic,
|
||||
data: pic,
|
||||
});
|
||||
imageRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
console.log(dataresult);
|
||||
.subscribe(dataresult => {
|
||||
console.log(dataresult);
|
||||
});
|
||||
}
|
||||
|
||||
setAddressFromDatas(params){
|
||||
this._pd.retriveForm(params).subscribe(data => {
|
||||
|
||||
const control = <FormArray>this.addressForm.controls['addresses'];
|
||||
if (data.status == 200) {
|
||||
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);
|
||||
if (data.records.addresses.length == 0) {
|
||||
control.push(this.createAddresses(null));
|
||||
} else {
|
||||
data.records.addresses.forEach((datas, index) => {
|
||||
let obj = {
|
||||
'address': this.transformName(datas.address),
|
||||
'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 = [];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// addMoreIndividuals() {
|
||||
// const imageRef = this.dialog.open(OtherApplicantDetailsComponent, {
|
||||
// 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'];
|
||||
// element.pd_co_applicant_id = this.count;
|
||||
// this.count = this.count + 1;
|
||||
// element.individuals_order_id = individualsControl.controls.length + 1;
|
||||
// element.is_new = true;
|
||||
// element.is_active = true;
|
||||
// element.is_main_applicant = false;
|
||||
// individualsControl.push(this.createIndividulas(element));
|
||||
// let relationControl = <FormArray>this._generalForm.controls['persons_with_relationships'];
|
||||
// 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 };
|
||||
// relationControl.push(this.createPersonsWithRelationships(applicant_details,individualsControl.controls.length-1));
|
||||
// });
|
||||
|
||||
// }
|
||||
// });
|
||||
|
||||
// }
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user