address form : changes

This commit is contained in:
venbatechnologies@gmail.com 2019-06-21 10:39:17 +05:30
parent cc46c619a8
commit dc50a75373
2 changed files with 787 additions and 576 deletions

View File

@ -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 fxFlex="100" fxLayout="nowrap" *ngIf="item.get('pd_is_done_on_initiated_address').value===false">
</div>
<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>
</div>
<div fxFlex="100" *ngIf="item.get('pd_is_done_on_initiated_address').value===false">
<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>
<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">
<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="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,52 +320,60 @@
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>
<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>
</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>
</ng-template>
<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>