merg e: kms

This commit is contained in:
gandhimathi 2019-03-05 17:05:38 +05:30
parent aa555ba942
commit 438dc072d4
48 changed files with 2070 additions and 1243 deletions

View File

@ -131,7 +131,7 @@
<div formArrayName="addresses" *ngFor="let addresses of pdAddresses.controls; let i = index;">
<mat-card-content [formGroupName]="i">
<mat-form-field style="width: 96%">
<textarea matInput autocomplete="off" placeholder="Address at which PD is to be done" formControlName="addressline" style="text-transform: uppercase"></textarea>
<textarea matInput autocomplete="off" placeholder="Address at which PD is to be done" formControlName="addressline1" style="text-transform: uppercase"></textarea>
<!-- oninput="this.value = this.value.toUpperCase()" -->
<!-- <mat-error *ngIf="pdAddresses.addressline1.hasError('required')">Address1 required.</mat-error> -->
</mat-form-field>
@ -209,7 +209,7 @@
</mat-form-field>
<mat-form-field style="width: 38%">
<input matInput autocomplete="off" placeholder="Mobile Number" formControlName="mobile_no" type="text" (keypress)="keyPress($event)" maxlength="10">
<input matInput autocomplete="off" placeholder="Mobile Number" formControlName="mobile_no" type="text" (keypress)="keyPress($event)" maxlength="10" required>
<mat-error *ngIf="pdMain.mobile_no.hasError('maxlength') || pdMain.mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
@ -252,7 +252,7 @@
</mat-form-field> -->
<mat-form-field style="width: 38%">
<input matInput placeholder="Mobile" formControlName="coapplicant_mobile_no" type="text" (keypress)="keyPress($event)" required>
<input matInput placeholder="Mobile Number" formControlName="coapplicant_mobile_no" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="coDetails['controls'].coapplicant_mobile_no.hasError('maxlength') || coDetails['controls'].coapplicant_mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>

View File

@ -89,8 +89,8 @@ export class AddPdComponent implements OnInit, OnDestroy {
fk_customer_segment: [null],
loan_amount: [null, Validators.compose([Validators.pattern('^[0-9]*$')])],
applicant_title_name: [''],
applicant_name: [null],
mobile_no: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(10)])],
applicant_name: [null,Validators.compose([Validators.required])],
mobile_no: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(10),Validators.required])],
// landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])],
// email: [null],
applicant_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])],
@ -251,7 +251,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
label: ['Applicant'],
applicant_title_name:[null],
coapplicant_name: [null, Validators.compose([Validators.required])],
coapplicant_mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10),Validators.required])],
coapplicant_mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
coapplicant_stdcode:[null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])],
coapplicant_landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])],
company_name:[null],
@ -268,7 +268,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
get pdAddresses() { return this._PDtriggerForm.get('addresses') as FormArray; }
createAddresses(): FormGroup {
return this._fb.group({
addressline: [null],
addressline1: [null],
fk_city: [null],
fk_state: [null],
pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
@ -327,8 +327,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
this.lengthCheckToaddMore = 1;
}
}
getPincode(e,i){ this.pincodeflag[i] = e == 1 ? true : false;
}
getPincode(e,i){ this.pincodeflag[i] = e == 1 ? true : false;}
// save pd in draft
saveDraftPD(formValue: any, status: string) {
//alert('Inside The Draft PD');
@ -478,7 +477,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
"fk_pd_type": formValue.fk_pd_type,
"fk_customer_segment": formValue.fk_customer_segment,
"loan_amount": formValue.loan_amount,
"addressline1": formValue.addresses[0].addressline.toUpperCase(),
"addressline1": formValue.addresses[0].addressline1.toUpperCase(),
"fk_city": formValue.addresses[0].fk_city,
"fk_state": formValue.addresses[0].fk_state,
"pincode": formValue.addresses[0].pincode,

View File

@ -15,7 +15,7 @@
<mat-card>
<mat-card-header>
<mat-card-title>Main Applicant</mat-card-title>
<mat-card-title>Applicant 1</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-form-field style="width: 15%">
@ -51,9 +51,9 @@
</mat-card-content>
</mat-card>
<mat-card formArrayName="coApplicantItems" *ngFor="let coDetails of pdCoApplicant.controls; let i = index;">
<!-- <mat-card-header>
<mat-card-title>Co Applicant</mat-card-title>
</mat-card-header> -->
<mat-card-header>
<mat-card-title>Applicant {{i+2}}</mat-card-title>
</mat-card-header>
<mat-card-content [formGroupName]="i">
<mat-form-field style="width: 15%">
<mat-select placeholder="Title" formControlName="applicant_title_name">

View File

@ -87,7 +87,6 @@ export class EditPdApplicantComponent implements OnInit {
}
createItem(listData): FormGroup {
// console.log('listData',listData);
if(listData){
let stdcode;
let landline;
@ -181,8 +180,7 @@ export class EditPdApplicantComponent implements OnInit {
"isactive":1
}];
formValue.coApplicantItems.forEach((itemElement, itemIndex) => {
// console.log(itemElement.coapplicant_stdcode);
// console.log(itemElement.coapplicant_landline);
let concat_landline
if(itemElement.coapplicant_stdcode != null && itemElement.coapplicant_landline != null){
if(itemElement.coapplicant_stdcode == '' && itemElement.coapplicant_landline == ''){

View File

@ -5,187 +5,229 @@
{{pageTitle}}
</div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="right" mat-dialog-close><mat-icon>close</mat-icon></button>
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close"
matTooltipPosition="right" mat-dialog-close>
<mat-icon>close</mat-icon>
</button>
</div>
</h2>
<mat-dialog-content>
<mat-card>
<!-- <mat-card-header>
<mat-card-title>PD Details</mat-card-title>
</mat-card-header> -->
<mat-card-content>
<mat-form-field style="width: 29%">
<mat-select placeholder="Lender Name" formControlName="fk_lender_id">
<mat-option>
Select
</mat-option>
<!-- <mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" > -->
<mat-option (click)="selectedLender(LL)" *ngFor="let LL of lenderList" [value]="LL.entity_id" >
{{LL.full_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_lender_id.hasError('required')" class="mat-text-warn">Lender Name Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<input matInput placeholder=" Loan Application ID" formControlName="lender_applicant_id" type="text" required>
</mat-form-field>
<mat-form-field style="width: 29%">
<input matInput placeholder="Lender Contact Person" formControlName="pd_contact_person" type="text" required>
</mat-form-field>
<mat-form-field style="width: 29%">
<input matInput placeholder="Lender Mobile Number" formControlName="pd_contact_mobileno" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.pd_contact_mobileno.hasError('pattern') || pdMain.pd_contact_mobileno.hasError('maxlength') || pdMain.pd_contact_mobileno.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 10%">
<input matInput placeholder="STD Code" formControlName="lender_stdcode" type="text" (keypress)="keyPress($event)">
<!-- <span matPrefix>+91</span> -->
<mat-error *ngIf="pdMain.lender_stdcode.hasError('maxlength') || pdMain.lender_stdcode.hasError('minlength')">Enter Valid STD Code. </mat-error>
</mat-form-field> &nbsp;-&nbsp;
<mat-form-field style="width: 20%">
<input matInput placeholder="LandLine Number" formControlName="lender_landline" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.lender_landline.hasError('maxlength') || pdMain.lender_landline.hasError('minlength')">Enter Valid Landline Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 21.5%">
<mat-select placeholder="Branch" formControlName="pd_branch_id">
<!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" -->
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let LB of lenderBranchList" [value]="LB.entity_lender_branch_id" >
{{LB.branch_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="Product Name" formControlName="fk_product_id" (selectionChange)="getSubproductList(pdMain.fk_product_id.value)">
<mat-option>
<mat-form-field style="width: 29%">
<mat-select placeholder="Lender Name" formControlName="fk_lender_id">
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let PL of productList" [value]="PL.product_id" >
{{PL.product_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_product_id.hasError('required')">Product Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="Sub product Name" formControlName="fk_subproduct_id">
<mat-option>Select</mat-option>
<mat-option *ngFor="let SPL of subProductList" [value]="SPL.subproduct_id" >
{{SPL.subproduct_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_subproduct_id.hasError('required')">Sub Product Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="Customer Segment" formControlName="fk_customer_segment">
<mat-option>Select</mat-option>
<mat-option *ngFor="let CSL of customerSegmentList" [value]="CSL.customer_segment_id" >
<!-- {{CSL.customer_segment}} -->{{CSL.abbr}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer Segment Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="PD Type" formControlName="fk_pd_type">
<mat-option>Select</mat-option>
<mat-option *ngFor="let PDL of pdTypeList" [value]="PDL.pd_type_id" >
{{PDL.type_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD Type Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 62%">
<!-- <input matInput placeholder="Loan Amount" formControlName="loan_amount"> -->
<input matInput placeholder="Loan Amount" formControlName="loan_amount" (keypress)="keyPress($event)" (keyup)="inWords($event,1)" required autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="pdMain.loan_amount.value != ''">{{"&#8377;"}} {{loanAmtInWords}} Only</mat-hint>
<!-- <mat-error *ngIf="pdMain.loan_amount.hasError('required')">Amount Required.</mat-error> -->
<mat-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount. </mat-error>
</mat-form-field>
<mat-form-field style="width: 96%">
<textarea matInput placeholder="Address at which PD is to be done" formControlName="addressline1" style="text-transform: uppercase"></textarea>
<!-- <mat-error *ngIf="pdMain.addressline1.hasError('required')">Address1 required.</mat-error> -->
<!-- oninput="this.value = this.value.toUpperCase()" -->
</mat-form-field>
<mat-form-field style="width: 29%;">
<mat-select placeholder="State" formControlName="fk_state" (selectionChange)="getCityList(pdMain.fk_state.value)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_state.hasError('required')">State Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%;">
<mat-select placeholder="City" formControlName="fk_city">
<mat-option>Select</mat-option>
<mat-option *ngFor="let CL of cityList" [value]="CL.city_id">
{{CL.city_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_city.hasError('required')">City Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 24%;">
<!-- <input matInput placeholder="Pincode" formControlName="pincode" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.pincode.hasError('pattern') || pdMain.pincode.hasError('maxlength') || pdMain.pincode.hasError('minlength')">Enter Valid Pincode. </mat-error> -->
<mat-select placeholder="Pincode" formControlName="pincode" >
<mat-option>Select</mat-option>
<mat-option *ngFor="let PL of pincodeList" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
</mat-select>
</mat-form-field>
</mat-option>
<!-- <mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" > -->
<mat-option (click)="selectedLender(LL)" *ngFor="let LL of lenderList"
[value]="LL.entity_id">
{{LL.full_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_lender_id.hasError('required')" class="mat-text-warn">Lender Name Required.</mat-error> -->
<mat-form-field style="width: 24%" *ngIf="pdMain.pincode.value == 1" >
<input matInput autocomplete="off" placeholder="Specify Pincode" formControlName="other_pincode" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.other_pincode.hasError('pattern') || pdMain.other_pincode.hasError('maxlength') || pdMain.other_pincode.hasError('minlength')">Enter Valid Pincode. </mat-error>
</mat-form-field>
</mat-form-field>
<mat-form-field style="width: 29%">
<input matInput placeholder=" Loan Application ID" formControlName="lender_applicant_id"
type="text" required>
</mat-form-field>
<mat-form-field style="width: 29%">
<input matInput placeholder="Lender Contact Person" formControlName="pd_contact_person"
type="text" required>
</mat-form-field>
<mat-form-field style="width: 29%">
<input matInput placeholder="Lender Mobile Number" formControlName="pd_contact_mobileno"
type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.pd_contact_mobileno.hasError('pattern') || pdMain.pd_contact_mobileno.hasError('maxlength') || pdMain.pd_contact_mobileno.hasError('minlength')">Enter
Valid Mobile Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 10%">
<input matInput placeholder="STD Code" formControlName="lender_stdcode" type="text"
(keypress)="keyPress($event)">
<!-- <span matPrefix>+91</span> -->
<mat-error *ngIf="pdMain.lender_stdcode.hasError('maxlength') || pdMain.lender_stdcode.hasError('minlength')">Enter
Valid STD Code. </mat-error>
</mat-form-field> &nbsp;-&nbsp;
<mat-form-field style="width: 20%">
<input matInput placeholder="LandLine Number" formControlName="lender_landline"
type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.lender_landline.hasError('maxlength') || pdMain.lender_landline.hasError('minlength')">Enter
Valid Landline Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 21.5%">
<mat-select placeholder="Branch" formControlName="pd_branch_id">
<!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" -->
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let LB of lenderBranchList" [value]="LB.entity_lender_branch_id">
{{LB.branch_name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="Product Name" formControlName="fk_product_id"
(selectionChange)="getSubproductList(pdMain.fk_product_id.value)">
<mat-option>
Select
</mat-option>
<mat-option *ngFor="let PL of productList" [value]="PL.product_id">
{{PL.product_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_product_id.hasError('required')">Product Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="Sub product Name" formControlName="fk_subproduct_id">
<mat-option>Select</mat-option>
<mat-option *ngFor="let SPL of subProductList" [value]="SPL.subproduct_id">
{{SPL.subproduct_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_subproduct_id.hasError('required')">Sub Product Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="Customer Segment" formControlName="fk_customer_segment">
<mat-option>Select</mat-option>
<mat-option *ngFor="let CSL of customerSegmentList" [value]="CSL.customer_segment_id">
<!-- {{CSL.customer_segment}} -->{{CSL.abbr}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_customer_segment.hasError('required')">Customer Segment Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 29%">
<mat-select placeholder="PD Type" formControlName="fk_pd_type">
<mat-option>Select</mat-option>
<mat-option *ngFor="let PDL of pdTypeList" [value]="PDL.pd_type_id">
{{PDL.type_name}}
</mat-option>
</mat-select>
<!-- <mat-error *ngIf="pdMain.fk_pd_type.hasError('required')">PD Type Required.</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 62%">
<!-- <input matInput placeholder="Loan Amount" formControlName="loan_amount"> -->
<input matInput placeholder="Loan Amount" formControlName="loan_amount"
(keypress)="keyPress($event)" (keyup)="inWords($event,1)" required
autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="pdMain.loan_amount.value != ''">{{"&#8377;"}}
{{loanAmtInWords}} Only</mat-hint>
<!-- <mat-error *ngIf="pdMain.loan_amount.hasError('required')">Amount Required.</mat-error> -->
<mat-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount.
</mat-error>
</mat-form-field>
</mat-card-content>
</mat-card>
<div formArrayName="addresses" *ngFor="let addresses of pdAddresses.controls; let i = index; let last = last">
<mat-card [formGroupName]="i">
<mat-card-header>
<mat-card-title>Address Details #{{i+1}} <span *ngIf="!addressesDeactivited[i]" style="color: red;" align="end"><i> Deactivited </i></span> </mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-form-field style="width: 96%">
<textarea matInput autocomplete="off" placeholder="Address at which PD is to be done"
formControlName="addressline1" style="text-transform: uppercase"></textarea>
</mat-form-field>
<mat-form-field style="width: 32%">
<mat-select placeholder="State" formControlName="fk_state"
(selectionChange)="getCityList($event.value,i)">
<mat-option> Select </mat-option>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 32%">
<mat-select placeholder="City" formControlName="fk_city">
<mat-option> Select </mat-option>
<mat-option *ngFor="let CL of cityList[i]" [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"
(selectionChange)="getPincode($event.value,i)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let PL of pincodeList[i]" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 24%" *ngIf="pincodeflag[i]">
<!-- *ngIf="pdAddresses.pincode.value == 1" -->
<input matInput autocomplete="off" placeholder="Specify Pincode"
formControlName="other_pincode" (keypress)="keyPress($event)">
<!-- <mat-error *ngIf="pdAddresses.other_pincode.hasError('maxlength') || pdMain.other_pincode.hasError('minlength')">Enter Valid Pincode. </mat-error> -->
</mat-form-field>
</mat-card-content>
<mat-card-actions align="end">
<button mat-raised-button mat-icon-button matTooltip="Delete"
matTooltipPosition="above" (click)="removeAddresses(i,'Deactivited')"
type="button" *ngIf="pdAddresses.controls.length > 1 && addressesDeactivited[i]">
<mat-icon>delete</mat-icon>
</button>
<button type="button" mat-flat-button (click)="removeAddresses(i,'Activited')"
matTooltipPosition="above" color="primary" *ngIf="!addressesDeactivited[i]">
<strong>Deleted</strong>
</button>
&nbsp;&nbsp;
<button type="button" mat-raised-button mat-icon-button (click)="addAddresses(i)" *ngIf="last"
matTooltip="Add More Additional Addresses" matTooltipPosition="above"
class="mr-1 mb-1 hover-icon" color="primary" type="button">
<mat-icon>add</mat-icon>
</button>
</mat-card-actions>
</mat-card>
</div>
</mat-dialog-content>
<mat-dialog-actions>
<div fxFlex="70" class="pb-0 text-sm-left" align="left">
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="remarks"></textarea>
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="remarks"></textarea>
</mat-form-field>
</div>
<div fxFlex="30" align="end">
<!-- <button *ngIf="currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" (click)="saveDraftPD(this._EditPDtriggerForm.value,pdStatusCheck.DRAFT)" type="button" matTooltip="Save As Draft" matTooltipPosition="above"><mat-icon>insert_drive_file</mat-icon></button> -->
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Trigger PD" matTooltipPosition="above" type="button" (click)="triggerPD(_EditPDtriggerForm.value, pdStatusCheck.TRIGGERED)"><mat-icon>save</mat-icon></button> -->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save PD" matTooltipPosition="above" type="button" (click)="triggerPD(_EditPDtriggerForm.value,'')"><mat-icon>save</mat-icon></button>
</div>
</div>
<div fxFlex="30" align="end">
<!-- <button *ngIf="currentPDStatus==pdStatusCheck.DRAFT || currentPDStatus==pdStatusCheck.TRIGGERED" mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" (click)="saveDraftPD(this._EditPDtriggerForm.value,pdStatusCheck.DRAFT)" type="button" matTooltip="Save As Draft" matTooltipPosition="above"><mat-icon>insert_drive_file</mat-icon></button> -->
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Trigger PD" matTooltipPosition="above" type="button" (click)="triggerPD(_EditPDtriggerForm.value, pdStatusCheck.TRIGGERED)"><mat-icon>save</mat-icon></button> -->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save PD"
matTooltipPosition="above" type="button" (click)="triggerPD(_EditPDtriggerForm.value,'')">
<mat-icon>save</mat-icon>
</button>
</div>
</mat-dialog-actions>
</form>
<notifier-container></notifier-container>
</form>
<notifier-container></notifier-container>

View File

@ -12,25 +12,31 @@ import { PdTrigerService } from '../../../pd-service/pd-triger.service';
})
export class EditPdMasterComponent implements OnInit {
public pageTitle: string = "PD Details";
pdid: any;
errorMessage: any;
productList:any;
subProductList:any;
lenderList:any;
customerSegmentList:any;
stateList:any;
cityList:any;
cityList:any = [];
pdTypeList:any;
billingList:any;
lenderBranchList: any;
pincodeList: any = [];
addressesList : any = [];
addressesDeactivited : any = [];
applicantLength:number;
// draftStatus: string;
// PDTriggerStatus: string;
enablePDButton: boolean;
currentPDStatus: string;
loanAmtInWords : any;
pincodeflag : any = [];
public _EditPDtriggerForm:FormGroup;
public notifier: NotifierService;
addresses: FormArray;
// create values for status check
pdStatusCheck :any={
"DRAFT" :'DRAFT',
@ -46,6 +52,7 @@ export class EditPdMasterComponent implements OnInit {
@Inject(MAT_DIALOG_DATA) public data: any) {
this.notifier=notifier
this.currentPDStatus = data.records.pd_status;
this.pdid = data.records.pd_id;
if(this.data.records.loan_amount){ this.loanAmtInWords = this._pd.convertNumberToWords(this.data.records.loan_amount); }
}
@ -57,6 +64,7 @@ export class EditPdMasterComponent implements OnInit {
this.getCustomerSegmentList();
this.getStateCityList();
this.getPDTypeList();
this.getAddresses();
this.loadFormData();
this.applicantLength=this.data.applicantLength;
}
@ -74,13 +82,16 @@ export class EditPdMasterComponent implements OnInit {
}, error => this.errorMessage = <any> error);
}
selectedLender(lender){
// console.log(JSON.stringify(lender));
// alert(JSON.stringify(lender['branches ']));
this.lenderBranchList = lender['branches'];
// console.log(this.lenderBranchList);
this._EditPDtriggerForm.controls.pd_branch_id.setValue(null);
}
getAddresses(){
}
getProductsList(){
this._pd.getProductsDetails().subscribe(
data => {
@ -133,8 +144,6 @@ export class EditPdMasterComponent implements OnInit {
}
loadFormData() {
// console.log('this.data.record',this.data.records);
// console.log('this.reocrds',this.data.records.pincode_id);
let stdcode;
let landline;
if(this.data.records.pd_contact_landline){
@ -148,8 +157,8 @@ export class EditPdMasterComponent implements OnInit {
landline = '';
}
}
this.getCityList(this.data.records.fk_state);
// let getpincodeid = this.data.records.pincode != '' ? this.data.records.pincode != null ? (this.pincodeList.filter(data => data.pincode == this.data.records.pincode).pincode_id)
// : this.data.records.pincode
// : this.data.records.pincode;
@ -168,14 +177,46 @@ export class EditPdMasterComponent implements OnInit {
fk_pd_type: [this.data.records.fk_pd_type],
fk_customer_segment: [this.data.records.fk_customer_segment],
loan_amount: [this.data.records.loan_amount,Validators.compose([Validators.pattern('^[0-9]*$')])],
  addressline1: [this.data.records.addressline1.toUpperCase()],
fk_city: [this.data.records.fk_city],
fk_state: [this.data.records.fk_state],
  pincode : [this.data.records.pincode_id],
other_pincode:[this.data.records.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])],
addresses: this._fb.array([]),
//   addressline1: [this.data.records.addressline1.toUpperCase()],
// fk_city: [this.data.records.fk_city],
// fk_state: [this.data.records.fk_state],
//   pincode : [this.data.records.pincode_id],
// other_pincode:[this.data.records.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])],
remarks: [this.data.records.remarks],
});
}
});
const addressesArray = this._EditPDtriggerForm.get('addresses') as FormArray;
this._pd.getAddressesDetails(this.pdid).subscribe(
data => {
if (data.status == 200) {
this.addressesList = data.records.filter(item => item.isactive == 1);
if (this.addressesList.length > 0) {
this.addressesList.forEach((val,index)=>{
this.addressesDeactivited[index] = true;
let obj = {
pd_address_id:val.pd_address_id,
addressline1: val.addressline1.toUpperCase(),
fk_city: val.fk_city,
fk_state: val.fk_state,
  pincode: val.pincode_id,
other_pincode:val.other_pincode,
isactive:1,
}
this.getCityList(val.fk_state,index);
this.getPincode(val.pincode_id,index);
addressesArray.push(this.createAddresses(obj));
});
}
else{
addressesArray.push(this.createAddresses(null));
}
}
else{
addressesArray.push(this.createAddresses(null));
}
});
}
get pdMain() { return this._EditPDtriggerForm.controls; }
@ -192,17 +233,85 @@ export class EditPdMasterComponent implements OnInit {
// this.cityList=this.cityList[0].cities;
// }
//get city list details based on state id
getCityList(stateID:string){
// console.log('getCityList',stateID);
getCityList(stateID:string,i){
this._pd.getStateWiseCities(stateID).subscribe(data=>{
if (data.status == 200) {
// console.log(data);
this.cityList = data.records.cities;
this.pincodeList = data.records.pincode;
this.cityList[i] = data.records.cities;
this.pincodeList[i] = data.records.pincode;
}
});
}
get pdAddresses() { return this._EditPDtriggerForm.get('addresses') as FormArray; }
createAddresses(data): FormGroup {
if(data == null){
return this._fb.group({
fk_pd_id:[this.pdid],
pd_address_id:[null],
addressline1: [null],
fk_city: [null],
fk_state: [null],
pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
other_pincode: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
isactive:[1],
});
}
else{
return this._fb.group({
fk_pd_id:[this.pdid],
pd_address_id:[data.pd_address_id],
  addressline1: [data.addressline1.toUpperCase()],
fk_city: [data.fk_city],
fk_state: [data.fk_state],
  pincode : [data.pincode],
other_pincode:[data.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])],
isactive:[data.isactive],
});
}
};
addAddresses(index) {
console.log(index);
this.addressesDeactivited[index] = true;
console.log('this.addressesDeactivited[index]',this.addressesDeactivited[index]);
this.addresses = this._EditPDtriggerForm.get('addresses') as FormArray;
this.addresses.push(this.createAddresses(null));
}
removeAddresses(index: number,strflag : any) {
const address_control = <FormArray>this._EditPDtriggerForm.controls['addresses'];
if(strflag == 'Deactivited'){
address_control.controls[index]['controls'].isactive.setValue(0);
this.addressesDeactivited[index] = false;
}
else if(strflag == 'Activited'){
address_control.controls[index]['controls'].isactive.setValue(1);
this.addressesDeactivited[index] = true;
}
// console.log('address_control',address_control);
// console.log('address_control.controls[index]',address_control.controls[index]);
// console.log('address_control.controls[index][controls]',address_control.controls[index]['controls']);
// address_control.controls[index]['controls'].showHide();
// isactive.setValue(0);
// this.showHide = true;
// var div = document.getElementById('newpost');
// if (div.style.display !== 'none') {
// div.style.display = 'none';
// }
// else {
// div.style.display = 'block';
// }
// address_control.controls[index].disable();
// console.log('address_control',address_control);
// address_control.removeAt(index);
}
getPincode(e,i){ this.pincodeflag[i] = e == 1 ? true : false;}
// save pd in draft
saveDraftPD(formValue: any, status:string){
@ -211,7 +320,7 @@ export class EditPdMasterComponent implements OnInit {
}
//trigger pd
triggerPD(formValue: any, status:any){
// console.log('triggerPD',formValue);
// this._EditPDtriggerForm.controls['fk_lender_id'].setValidators([Validators.required]);
// this._EditPDtriggerForm.controls['fk_lender_id'].updateValueAndValidity();
@ -272,17 +381,17 @@ export class EditPdMasterComponent implements OnInit {
this._EditPDtriggerForm.controls['loan_amount'].clearValidators();
this._EditPDtriggerForm.controls['loan_amount'].updateValueAndValidity();
this._EditPDtriggerForm.controls['addressline1'].clearValidators();
this._EditPDtriggerForm.controls['addressline1'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['addressline1'].clearValidators();
// this._EditPDtriggerForm.controls['addressline1'].updateValueAndValidity();
this._EditPDtriggerForm.controls['fk_city'].clearValidators();
this._EditPDtriggerForm.controls['fk_city'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['fk_city'].clearValidators();
// this._EditPDtriggerForm.controls['fk_city'].updateValueAndValidity();
this._EditPDtriggerForm.controls['fk_state'].clearValidators();
this._EditPDtriggerForm.controls['fk_state'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['fk_state'].clearValidators();
// this._EditPDtriggerForm.controls['fk_state'].updateValueAndValidity();
this._EditPDtriggerForm.controls['pincode'].clearValidators();
this._EditPDtriggerForm.controls['pincode'].updateValueAndValidity();
// this._EditPDtriggerForm.controls['pincode'].clearValidators();
// this._EditPDtriggerForm.controls['pincode'].updateValueAndValidity();
this.validateAllFormFields(this._EditPDtriggerForm);
}
@ -290,7 +399,7 @@ export class EditPdMasterComponent implements OnInit {
submitPdDetails(formValue: any, status:any) {
// let updateStatus = this.currentPDStatus == this.pdStatusCheck.DRAFT ? status : this.currentPDStatus == this.pdStatusCheck.TRIGGERED ? status : this.currentPDStatus;
let updateStatus = this.currentPDStatus;
// console.log(this._EditPDtriggerForm.value);
if(status != 1){
if(this._EditPDtriggerForm.invalid) {
this.validateAllFormFields(this._EditPDtriggerForm);
@ -319,8 +428,8 @@ export class EditPdMasterComponent implements OnInit {
return;
}
else{
// console.log('my_array.addresses',my_array.addresses);
let filteredAddressesdata = my_array.addresses.filter(item => item.isactive == 1);
let lenderMasterArray = {
"pd_id": my_array.pd_id,
"fk_lender_id": my_array.fk_lender_id,
@ -334,15 +443,25 @@ export class EditPdMasterComponent implements OnInit {
"fk_pd_type": my_array.fk_pd_type,
"fk_customer_segment": my_array.fk_customer_segment,
"loan_amount": my_array.loan_amount,
  "addressline1": my_array.addressline1.toUpperCase(),
"fk_city": my_array.fk_city,
"fk_state": my_array.fk_state,
  "pincode": my_array.pincode,
"other_pincode":my_array.other_pincode,
  "addressline1": filteredAddressesdata[0].addressline1.toUpperCase(),
"fk_city": filteredAddressesdata[0].fk_city,
"fk_state": filteredAddressesdata[0].fk_state,
  "pincode": filteredAddressesdata[0].pincode,
"other_pincode":filteredAddressesdata[0].other_pincode,
"remarks": my_array.remarks,
}
// console.log(lenderMasterArray);
this._pd.updatePDAddress(my_array.addresses).subscribe(result => {
if (result.status == 200) {
this.notifier.notify('success', 'Address Updated.');
}
else {
this.notifier.notify('warning', 'Something Wents Wrong in Address Try Again.!');
}//else
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong in Address Try Again.!');
});
this._pd.editPdMasterDetails(lenderMasterArray, updateStatus).subscribe(result => {
if (result.status == 200) {
this.notifier.notify('success', 'PD Details Updated.');

View File

@ -21,138 +21,158 @@
<div fxLayout="row wrap">
<div fxFlex="100">
<mat-card style="min-height: 550px;">
<mat-card-content>
<div fxLayout="row wrap">
<div formArrayName="addresses">
<div *ngFor="let item of addressForm.controls.addresses['controls']; let i=index">
<mat-card-header>
<p>Address Details #{{i+1}}</p>
</mat-card-header>
<mat-card-content class="matcard" [formGroup]="item">
<div fxLayout="row wrap">
<div fxFlex="100">
<mat-form-field style="width: 96%">
<input matInput placeholder="Address" formControlName="address"
oninput="this.value = this.value.toUpperCase()" required
autocomplete="off">
</mat-form-field>
</div>
<div fxFlex="100">
<mat-form-field style="width: 96%">
<input matInput placeholder="Address" formControlName="address" oninput="this.value = this.value.toUpperCase()"
required autocomplete="off">
</mat-form-field>
</div>
<div fxFlex="100" fxLayout="nowrap">
<mat-form-field style="width: 32%">
<mat-select placeholder="State" formControlName="state"
(selectionChange)="getcityList($event.target.value,i)">
<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)="getcityList($event.target.value)">
<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" (keypress)="keyPress($event)">
<!-- <mat-error *ngIf="!addressForm.controls['pincode_others'].valid">Pincode
Required</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 24%" *ngIf="addressForm.controls['pincode'].value == 1">
<input matInput autocomplete="off" placeholder="Specify Pincode *"
formControlName="pincode_others" (keypress)="keyPress($event)">
<mat-error *ngIf="!addressForm.controls['pincode_others'].valid">Pincode
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-form-field>
<div fxFlex="100">
<mat-form-field style="width: 46%;">
<mat-select placeholder="Address Type" formControlName="address_type"
required (selectionChange)="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-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="!addressForm.controls['address_type_others'].valid">Address Type Required</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 46%;" *ngIf="addressForm.controls['address_type'].value == 1">
<input matInput placeholder="Specify Address Type *" formControlName="address_type_others"
autocomplete="off" (change)="selectedAddressType($event.target.value)">
<mat-error *ngIf="!addressForm.controls['address_type_others'].valid">Address Type Required</mat-error>
</mat-form-field>
</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-form-field>
<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-form-field>
<mat-form-field style="width: 46%;" *ngIf="addressForm.controls.locality.value == 1">
<input matInput placeholder="Specify Locality *" formControlName="locality_others"
autocomplete="off">
<!-- autofocus -->
<mat-error *ngIf="!addressForm.controls['locality_others'].valid">Locality Required</mat-error>
</mat-form-field>
<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'].valid">Locality Required</mat-error> -->
</mat-form-field>
<mat-form-field style="width: 46%;" *ngIf="addressForm.controls.locality.value == 5">
<input matInput placeholder="Specify the MixUse *" formControlName="locality_mixuse"
autocomplete="off">
<mat-error *ngIf="!addressForm.controls['locality_mixuse'].valid">MixUse
Required</mat-error>
</mat-form-field>
</div>
<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'].valid">MixUse
Required</mat-error> -->
</mat-form-field>
</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-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-form-field>
</div>
<div fxFlex="100" fxLayout="nowrap">
<mat-form-field style="width: 46%;">
<input matInput [placeholder]="placeholderName" formControlName="estimated_area"
(keypress)="keyPress($event)">
</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="addressForm.controls['uom'].value == 1 ">
<input matInput placeholder="Specify UOM *" formControlName="uom_others"
autocomplete="off">
<mat-error *ngIf="!addressForm.controls['uom_others'].valid">UOM
Required</mat-error>
</mat-form-field>
</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-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-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"
(keypress)="keyPress($event)">
</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="!addressForm.controls['uom_others'].valid">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"
(click)="addAddresses()"
color="primary" style="float: right;">
<mat-icon>add</mat-icon>
</button>
<button type="button" matTooltip="Delete" class="mr-1 mb-1 hover-icon" matTooltipPosition="above" mat-raised-button mat-icon-button *ngIf="i>0"
(click)="removeAddresses(i)"
style="float: right;">
<mat-icon>delete</mat-icon>
</button> -->
</mat-card-content>
</div>
</mat-card-content>
</div>
</mat-card>
</div>
</div>
@ -317,7 +337,7 @@
<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()">
type="submit" (click)="onSubmit()" [disabled]="disableAfterSubmit===true">
<mat-icon>save</mat-icon>
</button>
</div>

View File

@ -28,20 +28,20 @@ export class AddressComponent implements OnInit {
main_applicant: any;
pageTitle: string = "PD Address Details";
disableAfterSubmit : boolean = false;
/**Declaration of FormField Variables */
//@Input() pdid: number;
pdid: number;
form_id: number;
pdAddress: string;
pdState: any;
pdCity: any;
pdPincode: any;
pdOtherPincode: any;
// pdAddress: string;
// pdState: any;
// pdCity: any;
// pdPincode: any;
// pdOtherPincode: any;
CustSegAbbr: any;
loadDataStatus: boolean = true;
placeholderName: any = 'Estimated area of the (Address Type)';
placeholderName: any = [];
/**Array declaration Of Dropdown */
locationdata: any = [];
@ -53,21 +53,23 @@ export class AddressComponent implements OnInit {
cityData: any = [];
uomData: any = [];
addressesList: any = [];
otherPincodeFlag:any = [];
/**Declaration of FormField Variables */
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;
// 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,
@ -77,7 +79,7 @@ export class AddressComponent implements OnInit {
private _pd: PdTrigerService,
private dialogRef: MatDialogRef<AddressComponent>,
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
// console.log('pd_all_details',pd_all_details);
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
this.form_id = 5;
@ -85,26 +87,18 @@ export class AddressComponent implements OnInit {
this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id;
this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr;
this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr;
console.log('this.pd_all_details',this.pd_all_details);
let CSAbbrSearch = this.pd_all_details.pdmaster_details.customer_segment_abbr.search("-");
this.CustSegAbbr = this.pd_all_details.pdmaster_details.customer_segment_abbr.substr(0, CSAbbrSearch);
this.notifier = notifier;
this.pdAddress = this.pd_all_details.pdmaster_details.addressline1;
this.pdState = this.pd_all_details.pdmaster_details.fk_state;
this.getCityAndPincodeDetails(this.pdState);
this.pdCity = this.pd_all_details.pdmaster_details.fk_city;
this.pdPincode = this.pd_all_details.pdmaster_details.pincode_id;
console.log('this.pdPincode', this.pdPincode);
this.pdOtherPincode = this.pdPincode == 1 ? this.pd_all_details.pdmaster_details.other_pincode : '';
console.log('this.pdOtherPincode', this.pdOtherPincode);
}
/**Init Fns of the class */
ngOnInit() {
this.initAddressForm();
this.getMasterDetails('PDLOCATIONAPPROACH', 1);
this.getMasterDetails('COMMENTSONLOCALITY', 2);
this.getMasterDetails('UOM', 3);
@ -112,70 +106,151 @@ export class AddressComponent implements OnInit {
this.getMasterDetails('ADDRESSTYPE', 5);
this.getMasterDetails('STATE', 6);
this.initAddressForm();
let params: any = {};
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': datas.address,
'address_type': datas.address_type,
'address_type_others': datas.address_type_others,
'state': datas.state,
'city': datas.city,
'pincode': datas.pincode,
'pincode_others': datas.pincode_others,
'locality': datas.locality,
'locality_others': datas.locality_others,
'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);
this.getOtherPincode(datas.pincode,index);
let selectedAddressType = this.addressData.filter(element => element.address_type_id == datas.address_type)[0];
this.selectedAddressType(selectedAddressType.address_type,index);
if (datas.address_type == 1) {
this.selectedAddressType(datas.address_type_others,index);
}
control.push(this.createAddresses(obj));
});
}
this.addressForm.controls.address.setValue(data.records.address);
this.addressForm.controls.state.setValue(data.records.state);
// 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();
}
}
// 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);
// 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);
// 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);
}
// 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.comment_locality.setValue(data.records.comment_locality);
this.addressForm.controls.locality.setValue(data.records.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();
}
// 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.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));
// }
});
}
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.isactive == 1);
// console.log('this.addressesList',this.addressesList);
if (this.addressesList.length > 0) {
this.addressesList.forEach((val,index)=>{
let obj = {
'address': val.addressline1,
'address_type': '',
'address_type_others': '',
'state': val.fk_state,
'city': val.fk_city,
'pincode': val.pincode_id,
'pincode_others': val.other_pincode,
'locality': '',
'locality_others': '',
'locality_mixuse': '',
'pd_location': '',
'comment_locality': '',
'estimated_area': '',
'uom': '',
'uom_others': ''
}
this.getCityAndPincodeDetails(val.fk_state,index);
this.getOtherPincode(val.pincode_id,index);
control.push(this.createAddresses(obj));
});
}
// else{
// control.push(this.createAddresses(null));
// }
}
// else{
// control.push(this.createAddresses(null));
// }
});
}
// getM_Address_Type() {
// this._pd.getAllMasterDatas('ADDRESSTYPE').subscribe(
// data => {
@ -192,13 +267,52 @@ export class AddressComponent implements OnInit {
/** Address Form ELements */
public initAddressForm(): void {
this.addressForm = this.fb.group({
address: [this.pdAddress != '' ? this.pdAddress : '', Validators.compose([Validators.required])],
addresses: this.fb.array([]),
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'];
}
/** FOR Adress */
createAddresses(AddressDetails): FormGroup {
if(AddressDetails != null){
return this.fb.group({
address: [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],
pincode: [AddressDetails.pincode],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
pincode_others: [AddressDetails.pincode_others, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
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: [this.pdState != '' ? this.pdState : ''],
city: [this.pdCity != '' ? this.pdCity : ''],
pincode: [this.pdPincode != '' ? this.pdPincode : ''],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
pincode_others: [this.pdOtherPincode != '' ? this.pdOtherPincode : '', Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
state: [''],
city: [''],
pincode: [''],
pincode_others: ['', Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
locality: ['', Validators.compose([Validators.required])],
locality_others: [''],
locality_mixuse: [''],
@ -206,22 +320,20 @@ export class AddressComponent implements OnInit {
comment_locality: ['', Validators.compose([Validators.required])],
estimated_area: [''],
uom: [''],
uom_others: [''],
address_form_remark: ['']
//additional_premises: this.fb.array([])
uom_others: ['']
});
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'];
}
}
}
// addAddresses() {
// const address_control = <FormArray>this.addressForm.controls['addresses'];
// address_control.push(this.createAddresses(null));
// }
// removeAddresses(index: number) {
// const address_control = <FormArray>this.addressForm.controls['addresses'];
// address_control.removeAt(index);
// }
/** To Get Dropdown Data For Address Form */
getMasterDetails(table: string, type: number) {
@ -233,7 +345,7 @@ export class AddressComponent implements OnInit {
else if (type == 2 && val.isactive == 1) {
this.commentData.push(val);
}
else if (type == 3 && val.isactive == 1) {
else if (type == 3 && val.isactive == 1 && val.is_land_uom != 0) {
this.uomData.push(val);
}
else if (type == 4 && val.isactive == 1) {
@ -252,109 +364,145 @@ export class AddressComponent implements OnInit {
/** To Get City And Pincode Data For Address Form
* Param 'stateID' -> selected StateId
*/
getCityAndPincodeDetails(stateID: string) {
getCityAndPincodeDetails(stateID: string,index) {
this._pd.getStateWiseCities(stateID).subscribe(data => {
if (data.status == 200) {
this.cityData = data.records.cities;
this.pincodeData = data.records.pincode;
this.cityData[index] = data.records.cities;
this.pincodeData[index] = data.records.pincode;
}
});
}
getOtherPincode(e,i){ this.otherPincodeFlag[i] = e == 1 ? true : false;}
/** TO Save Address Forms Details*/
onSubmit() {
// let addressesArrayValues = this.addressForm.controls.addresses.value;
// console.log(this.addressForm.controls.addresses);
// return;
// addressesArrayValues.forEach(data => {
// data.address_type.value == 1
// ? this.addressForm.controls['address_type_others'].setValidators([Validators.required])
// : this.addressForm.controls['address_type_others'].clearValidators();
// this.addressForm.controls['address_type_others'].updateValueAndValidity();
this.addressForm.controls.address_type.value == 1
? this.addressForm.controls['address_type_others'].setValidators([Validators.required])
: this.addressForm.controls['address_type_others'].clearValidators();
this.addressForm.controls['address_type_others'].updateValueAndValidity();
// data.controls.locality.value == 1
// ? this.addressForm.controls['locality_others'].setValidators([Validators.required])
// : this.addressForm.controls['locality_others'].clearValidators();
// this.addressForm.controls['locality_others'].updateValueAndValidity();
this.addressForm.controls.locality.value == 1
? this.addressForm.controls['locality_others'].setValidators([Validators.required])
: this.addressForm.controls['locality_others'].clearValidators();
this.addressForm.controls['locality_others'].updateValueAndValidity();
// data.controls.pincode.value == 1
// ? this.addressForm.controls['pincode_others'].setValidators([Validators.required])
// : this.addressForm.controls['pincode_others'].clearValidators();
// this.addressForm.controls['pincode_others'].updateValueAndValidity();
this.addressForm.controls.pincode.value == 1
? this.addressForm.controls['pincode_others'].setValidators([Validators.required])
: this.addressForm.controls['pincode_others'].clearValidators();
this.addressForm.controls['pincode_others'].updateValueAndValidity();
// 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();
this.addressForm.controls.locality.value == 5
? this.addressForm.controls['locality_mixuse'].setValidators([Validators.required])
: this.addressForm.controls['locality_mixuse'].clearValidators();
this.addressForm.controls['locality_mixuse'].updateValueAndValidity();
// data.controls.uom.value == 1
// ? this.addressForm.controls['uom_others'].setValidators([Validators.required])
// : this.addressForm.controls['uom_others'].clearValidators();
// this.addressForm.controls['uom_others'].updateValueAndValidity();
// });
// this.addressForm.controls.address_type.value == 1
// ? this.addressForm.controls['address_type_others'].setValidators([Validators.required])
// : this.addressForm.controls['address_type_others'].clearValidators();
// this.addressForm.controls['address_type_others'].updateValueAndValidity();
this.addressForm.controls.uom.value == 1
? this.addressForm.controls['uom_others'].setValidators([Validators.required])
: this.addressForm.controls['uom_others'].clearValidators();
this.addressForm.controls['uom_others'].updateValueAndValidity();
// this.addressForm.controls.locality.value == 1
// ? this.addressForm.controls['locality_others'].setValidators([Validators.required])
// : this.addressForm.controls['locality_others'].clearValidators();
// this.addressForm.controls['locality_others'].updateValueAndValidity();
// this.addressForm.controls.pincode.value == 1
// ? this.addressForm.controls['pincode_others'].setValidators([Validators.required])
// : this.addressForm.controls['pincode_others'].clearValidators();
// this.addressForm.controls['pincode_others'].updateValueAndValidity();
// this.addressForm.controls.locality.value == 5
// ? this.addressForm.controls['locality_mixuse'].setValidators([Validators.required])
// : this.addressForm.controls['locality_mixuse'].clearValidators();
// this.addressForm.controls['locality_mixuse'].updateValueAndValidity();
// this.addressForm.controls.uom.value == 1
// ? this.addressForm.controls['uom_others'].setValidators([Validators.required])
// : this.addressForm.controls['uom_others'].clearValidators();
// this.addressForm.controls['uom_others'].updateValueAndValidity();
if (!this.addressForm.valid) {
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
this.disableAfterSubmit = false;
return;
}
// if(this.address.value.bussiness_activity_remark == ''){
// this.notifier.notify('warning', 'Fill Remark!');
// return;
// }
if(this.addressForm.value.bussiness_activity_remark == ''){
this.notifier.notify('warning', 'Fill Remark!');
this.disableAfterSubmit = false;
return;
}
this.disableAfterSubmit = true;
let records: any = {};
records.address = this.address.value;
records.state = this.state.value;
records.city = this.city.value;
records.address_type = this.addressType.value;
records.addresses = this.addressForm.controls.addresses.value;
// records.address = this.address.value;
// records.state = this.state.value;
// records.city = this.city.value;
// records.address_type = this.addressType.value;
records.address_type_others = this.addressType.value == 1 ?
this.addressForm.controls.address_type_others.value : '';
// records.address_type_others = this.addressType.value == 1 ?
// this.addressForm.controls.address_type_others.value : '';
records.locality = this.locality.value;
records.locality_others = this.locality.value == 1 ?
this.addressForm.controls.locality_others.value : '';
// records.locality = this.locality.value;
// records.locality_others = this.locality.value == 1 ?
// this.addressForm.controls.locality_others.value : '';
records.locality_mixuse = this.locality.value == 5 ?
this.addressForm.controls.locality_mixuse.value : '';
// records.locality_mixuse = this.locality.value == 5 ?
// this.addressForm.controls.locality_mixuse.value : '';
records.pincode = this.pincode.value;
records.pincode_others = this.pincode.value == 1 ?
this.addressForm.controls.pincode_others.value : '';
// records.pincode = this.pincode.value;
// records.pincode_others = this.pincode.value == 1 ?
// this.addressForm.controls.pincode_others.value : '';
records.pd_location = this.pdLocation.value;
records.comment_locality = this.commentLocality.value;
// records.pd_location = this.pdLocation.value;
// records.comment_locality = this.commentLocality.value;
records.address_form_remark = this.addressForm.controls.address_form_remark.value;
records.estimated_area = this.estArea.value;
// records.estimated_area = this.estArea.value;
records.uom = this.uom.value;
records.uom_others = records.uom == 1 ?
this.addressForm.controls.uom_others.value : '';
// records.uom = this.uom.value;
// records.uom_others = records.uom == 1 ?
// this.addressForm.controls.uom_others.value : '';
records.pdid = this.pdid;
records.formid = '5';
// records.fk_createdby = '250';
// console.log(JSON.stringify(records));
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.!');
this.disableAfterSubmit = false;
});
}
/** For PlaceHolder
* selected AddressType is concate with label */
selectedAddressType(e: any) {
console.log(e);
this.placeholderName = 'Estimated area of the ' + e;
selectedAddressType(e: any,i) {
this.placeholderName[i] = 'Estimated area of the ' + e;
}

View File

@ -21,6 +21,7 @@
</mat-form-field>
<mat-form-field style="width: 20%" *ngIf="data.margin_calculation_status===true">
<input matInput OnlyNumber type="text" placeholder="Margin Value" formControlName="margin_value" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="sales.get('margin_value').value != ''">{{"&#8377;"}} {{marginAmtInwords[s]}} Only</mat-hint>
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button (click)="removeProducts(s)" *ngIf="(salesItemForm.controls.sales_product.value | deleteRecordsCount)>1"
matTooltip="Remove" matTooltipPosition="above">

View File

@ -19,6 +19,7 @@ export class ManageDailySalesComponent implements OnInit {
salesItemForm:FormGroup;
UOMData: any[]=[];
frequencyData: any[]=[];
marginAmtInwords: any[]=[];
private notifier: NotifierService;
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<ManageDailySalesComponent>) {
this.pageTitle = this.data.manage_status==1 ? 'Add Daily Sales Item' : 'Update Daily Sales Item';
@ -38,10 +39,12 @@ export class ManageDailySalesComponent implements OnInit {
this.salesItemForm = this._fb.group({
sales_product: this._fb.array([this.createSalesItemWithData(this.data.editData)]),
});
this.inWords(this.data.editData.margin_value,0,2);
let control: any = <FormArray>this.salesItemForm.controls['sales_product'];
control = control.controls[0].get('child') as FormArray;
this.data.editData.values.forEach(elementVal => {
this.data.editData.values.forEach((elementVal,inx) => {
control.push(this.createDailySalesWithData(elementVal,this.data.editData.sim_id))
this.inWords(elementVal.sales_value,inx,1);
});
}
else{
@ -161,6 +164,7 @@ salesCalculation(indexVal: number,values: any): void {
let getTotalValueCounts = transformData.map(val=>val.sales_value)
.reduce((sum, curr) => parseInt(sum) + parseInt(curr));
control.controls[indexVal].controls['margin_value'].setValue(parseInt(getTotalValueCounts) * (parseInt(values.margin_per)/100) * (12 / parseInt(getUniqueMonthCounts.length)));
this.inWords(parseInt(getTotalValueCounts) * (parseInt(values.margin_per)/100) * (12 / parseInt(getUniqueMonthCounts.length)),indexVal,2);
}
else{
control.controls[indexVal].controls['margin_value'].setValue('');
@ -219,6 +223,10 @@ submitDetails(records) {
case 1 :
this.Value[c] = this._pd.convertNumberToWords(e);
break;
case 2 :
this.marginAmtInwords[c] = this._pd.convertNumberToWords(e);
break;
default : break;
}
}

View File

@ -14,7 +14,7 @@
<div fxLayout="row wrap" *ngFor="let item of businessIncomeItemForm.controls.busIncome['controls']; let s = index;" [formGroupName]="s">
<div fxFlex="100">
<mat-form-field style="width: 87%">
<mat-select placeholder="business Income" formControlName="business_income_id" required>
<mat-select placeholder="Business Income" formControlName="business_income_id" required>
<mat-option *ngFor="let income of businessIncomeData" [value]="income.business_income_id">{{income.business_income_item}}</mat-option>
</mat-select>
</mat-form-field>

View File

@ -23,8 +23,7 @@
</div>
<div class="item-margin" fxFlex="100">
<mat-form-field style="width: 25%">
<input OnlyNumber type="text" matInput placeholder="Sale Quantity" (keyup)="salesCalculation(s,sales.value);inWords($event.target.value,s,1)" formControlName="sales_qty" required>
<mat-hint align="start" style="font-size:90%" *ngIf="sales.get('sales_qty').value != ''">{{"&#8377;"}} {{Sale_Quantity[s]}} Only</mat-hint>
<input OnlyNumber type="text" matInput placeholder="Sale Quantity" (keyup)="salesCalculation(s,sales.value);" formControlName="sales_qty" required>
</mat-form-field>
<mat-form-field style="width: 25%">
<mat-select placeholder="UOM" formControlName="fk_uom_id" required>
@ -33,6 +32,7 @@
</mat-form-field>
<mat-form-field style="width: 25%">
<input OnlyNumber type="text" matInput placeholder="Rate/Unit of Sale" formControlName="rate_per_unit" (keyup)="salesCalculation(s,sales.value)" required>
<mat-hint align="start" style="font-size:90%" *ngIf="sales.get('rate_per_unit').value != ''">{{"&#8377;"}} {{ratePerUnitAmtInwords[s]}} Only</mat-hint>
</mat-form-field>
</div>
@ -42,8 +42,9 @@
<mat-option *ngFor="let frq of frequencyData" [value]="frq.frequency_id">{{frq.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 25%">
<mat-form-field style="width: 54%">
<input matInput OnlyNumber type="text" placeholder="Annual Sales" formControlName="annual_sale_value" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="sales.get('annual_sale_value').value != ''">{{"&#8377;"}} {{annualSaleAmtInwords[s]}} Only</mat-hint>
</mat-form-field>
</div>
<div class="item-margin" fxFlex="100" *ngIf="data.margin_calculation_status===true">
@ -51,10 +52,12 @@
<input matInput OnlyNumber type="text" placeholder="Margin Percentage %" formControlName="margin_per" (keyup)="salesMarginPerCalculation(s,sales.value)">
</mat-form-field>
<mat-form-field style="width: 25%">
<input matInput OnlyNumber type="text" placeholder="Margin Amount" formControlName="margin_per_uom" (keyup)="salesMarginAmtCalculation(s,sales.value)">
<input matInput OnlyNumber type="text" placeholder="Margin Per Unit" formControlName="margin_per_uom" (keyup)="salesMarginAmtCalculation(s,sales.value)">
<mat-hint align="start" style="font-size:90%" *ngIf="sales.get('margin_per_uom').value != ''">{{"&#8377;"}} {{marginAmtInwords[s]}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width: 25%">
<input matInput OnlyNumber type="text" placeholder="Final Value" formControlName="margin_final_value" readonly>
<input matInput OnlyNumber type="text" placeholder="Considered Margin Amount" formControlName="margin_final_value" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="sales.get('margin_final_value').value != ''">{{"&#8377;"}} {{marginFinalAmtInwords[s]}} Only</mat-hint>
</mat-form-field>
</div>

View File

@ -10,11 +10,18 @@ import { NotifierService } from 'angular-notifier';
styleUrls: ['./manage-sales.component.scss']
})
export class ManageSalesComponent implements OnInit {
Sale_Quantity: any[]=[];
pageTitle: string;
salesItemForm:FormGroup;
UOMData: any[]=[];
frequencyData: any[]=[];
//Declaration for Amout INwords.
annualSaleAmtInwords: any[]=[];
marginAmtInwords: any[]=[];
marginFinalAmtInwords: any[]=[];
ratePerUnitAmtInwords: any[]=[];
private notifier: NotifierService;
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<ManageSalesComponent>) {
this.UOMData=this.data.masterData.UOMList;
@ -27,7 +34,21 @@ export class ManageSalesComponent implements OnInit {
if(this.data.manage_status==2){
this.salesItemForm = this._fb.group({
salesCalItemwise: this._fb.array([this.createSalesItemWithData(this.data.editData)]),
});
});
let indexforedit = 0
this.inWords(this.data.editData.annual_sale_value,indexforedit,1);
this.inWords(this.data.editData.margin_per_uom,indexforedit,2);
this.inWords(this.data.editData.margin_final_value,indexforedit,3);
this.inWords(this.data.editData.rate_per_unit,indexforedit,4);
// this.data.editData.forEach((val,index) => {
// this.inWords(val.annual_sale_value,index,1);
// this.inWords(val.margin_per_uom,index,2);
// this.inWords(val.margin_final_value,index,3);
// this.inWords(val.rate_per_unit,index,4);
// });
}
else{
this.salesItemForm = this._fb.group({
@ -87,9 +108,14 @@ closeDialogue(){
salesCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
if(values.rate_per_unit!=''){
this.inWords(values.rate_per_unit,indexVal,4)
}
if(values.sales_qty!='' && values.rate_per_unit!='' && values.fk_frequency_id!='') {
let filterFrequencyValue: any = this.frequencyData.filter(val =>val.frequency_id==values.fk_frequency_id);
let AnnualSalesValue = parseInt(values.sales_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor)
control.controls[indexVal].controls['annual_sale_value'].setValue(parseInt(values.sales_qty) * parseInt(values.rate_per_unit) * parseInt(filterFrequencyValue[0].mutiple_factor));
this.inWords(AnnualSalesValue,indexVal,1)
}
else {
@ -104,6 +130,7 @@ salesMarginPerCalculation(indexVal: number,values: any): void {
control.controls[indexVal].controls['margin_per_uom'].setValue('');
if(values.margin_per!='' && values.annual_sale_value!='') {
control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.annual_sale_value) * (parseInt(values.margin_per)/100));
this.inWords(parseInt(values.annual_sale_value) * (parseInt(values.margin_per)/100),indexVal,3)
}
else {
control.controls[indexVal].controls['margin_final_value'].setValue('');
@ -112,8 +139,14 @@ salesMarginPerCalculation(indexVal: number,values: any): void {
salesMarginAmtCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
control.controls[indexVal].controls['margin_per'].setValue('');
if(values.margin_per_uom!=''){
this.inWords(values.margin_per_uom,indexVal,2)
}
if(values.margin_per_uom!='' && values.sales_qty!='') {
let MarginFinalValue = parseInt(values.sales_qty) * parseInt(values.margin_per_uom);
control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.sales_qty) * parseInt(values.margin_per_uom));
this.inWords(MarginFinalValue,indexVal,3)
}
else {
control.controls[indexVal].controls['margin_final_value'].setValue('');
@ -157,12 +190,20 @@ submitDetails(records) {
});
}
inWords(e,s,flag){
inWords(value,inx,flag){
switch(flag){
case 1 :
this.Sale_Quantity[s] = this._pd.convertNumberToWords(e);
this.annualSaleAmtInwords[inx] = this._pd.convertNumberToWords(value);
break;
}
case 2 :
this.marginAmtInwords[inx] = this._pd.convertNumberToWords(value);
break;
case 3 :
this.marginFinalAmtInwords[inx] = this._pd.convertNumberToWords(value);
break;
case 4 :
this.ratePerUnitAmtInwords[inx] = this._pd.convertNumberToWords(value);
break;
default:break;}
}
}

View File

@ -16,6 +16,13 @@
<mat-tab-group #matgroup>
<mat-tab label="Summary">
<ng-template matTabContent>
<div class="complete-button" align="end">
<!-- <button mat-raised-button type="button" matTooltip="Complete Assessed Income" matTooltipPosition="above" (click)="completeAI()" *ngIf="matgroup.selectedIndex == 0" ><strong>Complete</strong></button> -->
<button type="button" mat-flat-button (click)="completeAI()"
matTooltip="Complete Assessed Income" matTooltipPosition="above" color="primary">
<strong>Complete</strong>
</button>
</div>
<mat-card>
<mat-card-content>
<!-- this is for sales revenue -->
@ -302,11 +309,11 @@
<!-- end assessed income tabs control -->
</mat-dialog-content>
<mat-dialog-actions align="end">
<!-- <mat-dialog-actions align="end">
<button type="button" mat-flat-button (click)="completeAI()"
matTooltip="Complete Assessed Income" matTooltipPosition="above" color="primary">
<strong>Complete</strong>
</button>
</mat-dialog-actions>
</mat-dialog-actions> -->
<notifier-container></notifier-container>

View File

@ -12,6 +12,9 @@
color:#e00201 !important;
}
.complete-button button {
margin-top: 10px;
}
.paragraph_change {
color: #fff !important;

View File

@ -19,7 +19,7 @@
<mat-card-header>
<mat-card-title>
<small class="expan_table_header">{{expandDetails.salesItem}}</small>
<small class="expan_table_header" *ngIf="activateMariginCalculation===true">(Margin Percentage % : {{expandDetails.margin_per}} &nbsp;&nbsp;Margin Value : {{expandDetails.margin_value}})</small>
<small class="expan_table_header" *ngIf="activateMariginCalculation===true">&nbsp;( Margin Percentage : {{expandDetails.margin_per}} % &nbsp;&nbsp;Margin Value : {{expandDetails.margin_value}} )</small>
</mat-card-title>
<mat-card-subtitle *ngFor="let footer of expandDetails.footerMessage">

View File

@ -31,3 +31,7 @@ tr.mat-footer-row {
.delete-margin {
margin-left: 3%;
}
.mat-footer-cell {
font-weight: bold;
font-size: 1.2rem !important;
}

View File

@ -10,11 +10,11 @@
<mat-option *ngFor="let getData of check__purchse_type" [value]="getData.id">{{getData.name}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 30%" *ngIf="grossProfitForm.controls['mode'].value == 2">
<!-- <mat-form-field style="width: 30%" *ngIf="grossProfitForm.controls['mode'].value == 2">
<mat-select placeholder="Sales Type" formControlName="margin">
<mat-option *ngFor="let getSale of check_sales_type" [value]="getSale.id">{{getSale.name}}</mat-option>
</mat-select>
</mat-form-field>
</mat-form-field> -->
<button type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Save" matTooltipPosition="above" (click)="submitDetails(grossProfitForm.value)"><mat-icon>save</mat-icon>
</button>

View File

@ -24,7 +24,14 @@ export class GrossProfitCalculationComponent implements OnInit, OnChanges {
}
changeOptions(values: any){
// console.log('values',values);
this.grossProfitForm.controls['margin'].setValue('');
/** if Mode Value is 'No' -> margin value is setted as netmargin and its id - 2
* Refer => check_sales_type **/
if(values.mode == 2){
// console.log('2');
this.grossProfitForm.controls['margin'].setValue('2');
}
}
submitDetails(records: any){
if (this.grossProfitForm.invalid) {

View File

@ -15,7 +15,7 @@
<table mat-table [dataSource]="businessIncomeItemSource">
<ng-container matColumnDef="buiness_income" sticky>
<th mat-header-cell *matHeaderCellDef> business Income </th>
<th mat-header-cell *matHeaderCellDef> Business Income </th>
<td mat-cell *matCellDef="let element"> {{element.business_income_item}} </td>
<td mat-footer-cell *matFooterCellDef> Total of Income</td>

View File

@ -3,16 +3,19 @@
<mat-card>
<mat-card-header>
<mat-card-title>Sales Calculation</mat-card-title>
</mat-card-header>
</mat-card-header>{{activateMariginCalculation}}
<mat-card-content>
<mat-form-field style="width: 82%">
<input matInput OnlyNumber type="text" placeholder="Sales Declared by the Customer as the Annual Sales Actually Done" formControlName="sales_declared_by_customer" (keyup)="salesCalculation(salesCalculationForm.value)" required>
<mat-hint align="start" style="font-size:90%" *ngIf="salesCalculationForm.value.sales_declared_by_customer != ''">{{"&#8377;"}} {{SaleAmtInwords}} Only</mat-hint>
</mat-form-field>
<!-- {{salesCalculationForm.value.sales_declared_by_customer}} -->
<mat-form-field style="width: 40%" *ngIf="activateMariginCalculation">
<input matInput OnlyNumber type="text" placeholder="Margin Percentage %" formControlName="margin_per" (keyup)="salesCalculation(salesCalculationForm.value)" required>
</mat-form-field>
<mat-form-field style="width: 40%" *ngIf="activateMariginCalculation">
<input matInput OnlyNumber type="text" placeholder="Margin Value" formControlName="margin_value" readonly>
<mat-hint align="start" style="font-size:90%" *ngIf="salesCalculationForm.value.margin_value != ''">{{"&#8377;"}} {{marginAmtInwords}} Only</mat-hint>
</mat-form-field>
<button type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Save" matTooltipPosition="above" (click)="submitDetails(salesCalculationForm.value)"><mat-icon>save</mat-icon>
</button>

View File

@ -15,6 +15,8 @@ export class SalesCalculationComponent implements OnInit, OnChanges, DoCheck {
salesCalculationForm:FormGroup;
activateMariginCalculation: boolean;
private notifier: NotifierService;
SaleAmtInwords : any;
marginAmtInwords: any;
constructor(notifier:NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService) {
this.activateMariginCalculation=false;
this.notifier = notifier;
@ -23,9 +25,12 @@ export class SalesCalculationComponent implements OnInit, OnChanges, DoCheck {
ngOnInit() {
}
salesCalculation(values): void {
if(values.sales_declared_by_customer !=''){this.SaleAmtInwords = this._pd.convertNumberToWords(values.sales_declared_by_customer);}
if(values.margin_per !='' && values.sales_declared_by_customer !='')
{
this.salesCalculationForm.controls['margin_value'].setValue(values.sales_declared_by_customer * (values.margin_per/100));
this.marginAmtInwords = this._pd.convertNumberToWords(values.sales_declared_by_customer * (values.margin_per/100));
}
}
// save sales calculations details
@ -60,7 +65,9 @@ validateAllFormFields(formGroup: any) {
// do check component bases
ngDoCheck() {
// console.log('ngDoCheck this.activateMariginCalculation',this.activateMariginCalculation);
// console.log('ngDoCheck this.masterData.grossProfitTypeList',this.masterData.grossProfitTypeList);
// console.log('69',this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].margin);
if(this.masterData.grossProfitTypeList.length>0){
this.activateMariginCalculation = this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].margin==2 && this.masterData.grossProfitTypeList[this.masterData.grossProfitTypeList.length-1].mode==2 ? true : false;
}
@ -71,6 +78,9 @@ ngDoCheck() {
//detect chnges from parent
ngOnChanges(changes: SimpleChanges) {
// console.log('ngDoCheck this.activateMariginCalculation',this.activateMariginCalculation);
// console.log('ngDoCheck this.masterData.grossProfitTypeList',changes.masterData);
// console.log('82',changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].mode);
if(changes.masterData){
if(changes.masterData.currentValue.grossProfitTypeList.length>0){
this.activateMariginCalculation = changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].margin==2 && changes.masterData.currentValue.grossProfitTypeList[changes.masterData.currentValue.grossProfitTypeList.length-1].mode==2 ? true : false;
@ -78,6 +88,8 @@ ngOnChanges(changes: SimpleChanges) {
}
if(changes.parentData){
if(changes.parentData.currentValue.length>0){
this.SaleAmtInwords = this._pd.convertNumberToWords(changes.parentData.currentValue[changes.parentData.currentValue.length-1].sales_declared_by_customer);
this.marginAmtInwords = this._pd.convertNumberToWords(changes.parentData.currentValue[changes.parentData.currentValue.length-1].margin_value);
this.salesCalculationForm = this._fb.group({
sdc_id:[changes.parentData.currentValue[changes.parentData.currentValue.length-1].sdc_id],
sales_declared_by_customer:[changes.parentData.currentValue[changes.parentData.currentValue.length-1].sales_declared_by_customer, Validators.compose([Validators.required])],
@ -100,5 +112,4 @@ ngOnChanges(changes: SimpleChanges) {
}
}
}

View File

@ -42,7 +42,7 @@
<div [formGroupName]="s">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:45%">
<mat-select placeholder="Property Type" formControlName="property_type" (selectionChange)="setRequiredValidation($event.value,detail,1)">
<mat-select placeholder="Property Type" formControlName="property_type" (selectionChange)="setRequiredValidation($event.value,i,s,1)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let prop of m_propertyType" [value]="prop.id">{{ prop.name }}</mat-option>
</mat-select>
@ -51,6 +51,31 @@
<input matInput placeholder="Specify Other Property Type" formControlName="other_property_type" autocomplete="off">
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:45%" *ngIf="detail.get('property_type').value != ''">
<input matInput placeholder="Address of the Property" formControlName="address_of_the_property"
autocomplete="off">
</mat-form-field>
<mat-form-field style="width:45%" *ngIf="detail.get('property_type').value != ''">
<input matInput placeholder="Description of the Property" formControlName="describe_of_the_property_asset"
autocomplete="off">
</mat-form-field>
</div>
<div fxLayout="row nowrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:45%">
<input matInput placeholder="Area Covered" formControlName="area_covered_by_this_property"
autocomplete="off">
</mat-form-field>
<mat-form-field style="width:45%">
<mat-select placeholder="Unit of Measurement" formControlName="uom_of_the_property" (selectionChange)="setRequiredValidation($event.value,detail,6)">
<mat-option>Select</mat-option>
<mat-option *ngFor="let uom of m_uom_type" [value]="uom.uom_id">{{ uom.name }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="detail.get('uom_of_the_property').value == 1" style="width:45%">
<input matInput placeholder="Specify Unit of Measurement" formControlName="other_uom" autocomplete="off">
</mat-form-field>
</div>
</div>
</div>
</div>
@ -254,8 +279,8 @@
<!-- <mat-select placeholder="Name of the Owner" formControlName="name_of_the_owner" >
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name | titlecase}}</mat-option>
</mat-select> -->
<mat-select placeholder="Name of the Owner"
formControlName="name_of_the_owner" [compareWith]="compareObjects" required (selectionChange)="setRequiredValidation($event.value.id,sup,4)">
<mat-select multiple placeholder="Name of the Owner"
formControlName="name_of_the_owner" [compareWith]="compareObjects" required (selectionChange)="setRequiredValidation($event.value,i,'',4)">
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
@ -264,7 +289,7 @@
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="checkOthers(sup.get('name_of_the_owner').value)===true" style="width:45%">
<mat-form-field *ngIf="isOtherOwner[i]" style="width:45%">
<input matInput placeholder="Specify Owner Name"
formControlName="other_owner" autocomplete="off">
</mat-form-field>
@ -463,7 +488,7 @@
</div>
<div fxFlex="40" align="end">
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" (click)="onReset(); false"><mat-icon>settings_backup_restore</mat-icon></button> -->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><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" [disabled]="disableAfterSubmit===true" ><mat-icon>save</mat-icon></button>
</div>
</mat-dialog-actions>
</form>

View File

@ -45,6 +45,9 @@ export class AssetsInfoComponent implements OnInit {
public applicants: any;
otherEmiamtFlag : boolean = false;
businessEmiAmtFlag : boolean = false;
isOtherOwner:any = [];
disableAfterSubmit : boolean = false;
public m_any_asset_loan_type = [{'value': "yes",'viewValue': "Yes"},
{'value': "no",'viewValue': "No"},
{'value': "nan",'viewValue': "NA"}]
@ -70,6 +73,8 @@ export class AssetsInfoComponent implements OnInit {
public m_freqOfPurchase = [];
public m_vehicle_type = [];
public m_uom_type = [];
private notifier: NotifierService;
existCompanyList: any =[];
@ -117,30 +122,31 @@ export class AssetsInfoComponent implements OnInit {
// this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid,'').subscribe(data => {
// this.businessProfessionName = (data.status == 200) ? data.records.profession_name : '' ;
// });
this.pdTrigerService.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{
if(data.dataStatus){
this.existCompanyList = data.records.filter(val =>val.is_active===true && val.is_company_applicant===true);
if (data.dataStatus) {
this.existCompanyList = data.records.filter(val => val.is_active === true);
}
// get company list
let modifyCompanyList: any = [];
if (this.existCompanyList.length > 0) {
modifyCompanyList = this.existCompanyList.map(element => {
return { id: element.company_order_id.toString(), name: element.company_name, group_id: 1 };
});
this.mergeCompanyApplicant.push({ groupName: 'COMPANIES', groupValues: modifyCompanyList })
}
// get applicant list
let modifyApplicantList: any=[];
if(this.applicants.length > 0){
modifyApplicantList = this.applicants.map(element => {
return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2};
});
this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList})
let modifyCompanyList : any=[];
if(this.existCompanyList.length>0){
modifyCompanyList = this.existCompanyList.map(element => {
return {id:element.company_order_id.toString(),name:element.company_name,group_id:1};
});
this.mergeCompanyApplicant.push({groupName:'COMPANIES',groupValues:modifyCompanyList})
}
})
// get applicant list
let modifyApplicantList: any=[];
if(this.applicants.length > 0){
modifyApplicantList = this.applicants.map(element => {
return {id:element.pd_co_applicant_id,name:element.applicant_name,group_id:2};
});
this.mergeCompanyApplicant.push({groupName:'APPLICANTS',groupValues:modifyApplicantList})
}
}
})
this.getPdSupplierFormDetails();
this.getM_Assets_Type();
this.getM_PropertyType();
@ -149,6 +155,7 @@ export class AssetsInfoComponent implements OnInit {
//this.getM_Relation();
//this.getM_InsuranceType();
this.getM_Vehicle_Type();
this.getM_UOM_Type();
}
// ======================
@ -221,6 +228,15 @@ export class AssetsInfoComponent implements OnInit {
})
}
getM_UOM_Type() {
this.pdTrigerService.getAllMasterDatas('UOM').subscribe(
data => {
this.m_uom_type = data.records.filter(data => data.isactive == 1 && data. is_land_uom == 1 || data. is_land_uom == 2);
// console.log('this.m_uom_type',data.records,this.m_uom_type);
//
})
}
// getM_InsuranceType() {
// this.pdTrigerService.getAllMasterDatas('INSURANCETYPE').subscribe(
// data => {
@ -372,7 +388,12 @@ export class AssetsInfoComponent implements OnInit {
loadProperty() {
return this._formBuilder.group({
property_type: [''],
other_property_type: ['']
other_property_type: [''],
address_of_the_property :[''],
describe_of_the_property_asset :[''],
area_covered_by_this_property :[''],
uom_of_the_property:[''],
other_uom:['']
});
}
@ -452,7 +473,12 @@ export class AssetsInfoComponent implements OnInit {
loadPropertyWithData(data) {
return this._formBuilder.group({
property_type: [data.property_type],
other_property_type: [data.other_property_type]
other_property_type: [data.other_property_type],
address_of_the_property :[data.address_of_the_property],
describe_of_the_property_asset :[data.describe_of_the_property_asset],
area_covered_by_this_property :[data.area_covered_by_this_property],
uom_of_the_property:[data.uom_of_the_property],
other_uom : [data.other_uom]
//property_type:['']
});
}
@ -569,11 +595,7 @@ export class AssetsInfoComponent implements OnInit {
var result = Object.keys(supp_data).map(function (key) {
return supp_data[key];
});
result.forEach((datas,index) => {
this.OtherAppxMarketAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.approximate_market_value);
});
if (result.length > 0) {
for (let val of result) {
let vals = {
@ -588,9 +610,21 @@ export class AssetsInfoComponent implements OnInit {
emi: val.emi,
};
const control = <FormArray>this._assetsQuesFrom.controls['assets_details'];
// let Avaliablity = 1;
// val.name_of_the_owner.forEach(option => {
// if(option.id == 0 && option.group_id == 2){
// Avaliablity = option.id;
// }
// });
// this.isOtherOwner = Avaliablity == 0 ? true : false;
control.push(this.initDetailsWithdata(vals));
this.setAssetsDetailsWithData(vals.assets_mode, val.details, control.length - 1)
}
result.forEach((datas,index) => {
this.OtherAppxMarketAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.approximate_market_value);
this.setRequiredValidation(datas.name_of_the_owner,index,'',4);
});
}
this.loadDetails = true;
}
@ -626,7 +660,10 @@ export class AssetsInfoComponent implements OnInit {
case '2': {
let array_data : any;
data.forEach((datas,i) => {
array_data = { 'property_type':datas.property_type,'other_property_type':datas.other_property_type };
array_data = { 'property_type':datas.property_type,'other_property_type':datas.other_property_type,
'address_of_the_property' :datas.address_of_the_property,'describe_of_the_property_asset' :datas.describe_of_the_property_asset,
'uom_of_the_property':datas.uom_of_the_property,
'area_covered_by_this_property' :datas.area_covered_by_this_property,'other_uom':datas.other_uom };
});
const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.loadPropertyWithData(array_data));
@ -764,8 +801,10 @@ export class AssetsInfoComponent implements OnInit {
// stop here if form is invalid
if (this._assetsQuesFrom.invalid) {
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
this.disableAfterSubmit = false;
return;
} else {
this.disableAfterSubmit = true;
var answerFormValues = this._assetsQuesFrom.value;
//To Remove The "Null" With Key also
@ -777,13 +816,16 @@ export class AssetsInfoComponent implements OnInit {
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.!');
this.disableAfterSubmit = false;
// this.dialogRef.close();
});
//After Saving the BRANCH data then popup close
@ -829,38 +871,75 @@ export class AssetsInfoComponent implements OnInit {
// }
}
setRequiredValidation(value,item,flag) {
setRequiredValidation(value,ParInx,ChdInx,flag) {
// console.log('value',value,'ParInx',ParInx,'ChdInx',ChdInx,'flag',flag);
let ParCtrls = <FormArray>this._assetsQuesFrom.controls.assets_details;
// console.log('ParCtrls',ParCtrls);
let ChdCtrls:any = <FormArray>ParCtrls.controls[ParInx];
// console.log('ChdCtrls',ChdCtrls);
if(flag == 1){
value==1
? item.controls.other_property_type.setValidators([Validators.required])
: item.controls.other_property_type.clearValidators();
item.controls.other_property_type.updateValueAndValidity();
// ? controls2[ChdInx].controls.other_property_type.setValidators([Validators.required])
// : item.controls.other_property_type.clearValidators();
// item.controls.other_property_type.updateValueAndValidity();
}
if(flag == 2){
value==1
? item.controls.other_frequency_mode.setValidators([Validators.required])
: item.controls.other_frequency_mode.clearValidators();
item.controls.other_frequency_mode.updateValueAndValidity();
// if(flag == 2){
// value==1
// ? item.controls.other_frequency_mode.setValidators([Validators.required])
// : item.controls.other_frequency_mode.clearValidators();
// item.controls.other_frequency_mode.updateValueAndValidity();
// }
// if(flag == 3){
// value==1
// ? item.controls.other_investments_type.setValidators([Validators.required])
// : item.controls.other_investments_type.clearValidators();
// item.controls.other_investments_type.updateValueAndValidity();
// }
// if(flag == 4){
// value==0
// ? item.controls.other_owner.setValidators([Validators.required])
// : item.controls.other_owner.clearValidators();
// item.controls.other_owner.updateValueAndValidity();
// }
if (flag == 4) {
let Avaliablity = 1;
// console.log('val',value);
value.forEach(option => {
if(option.id == 0 && option.group_id == 2){
Avaliablity = option.id;
}
});
if(Avaliablity == 0){
// console.log('if Avaliablity',Avaliablity);
// console.log('if this.isOtherOwner[ParInx]',this.isOtherOwner[ParInx]);
ChdCtrls.controls.other_owner.setValidators([Validators.required]);
this.isOtherOwner[ParInx] = true;
// console.log('if this.isOtherOwner[ParInx]',this.isOtherOwner[ParInx]);
}else if(Avaliablity == 1){
// console.log('else Avaliablity',Avaliablity);
// console.log('esle this.isOtherOwner[ParInx]',this.isOtherOwner[ParInx]);
ChdCtrls.controls.other_owner.setValue('');
ChdCtrls.controls.other_owner.clearValidators();
this.isOtherOwner[ParInx] = false;
// console.log('else this.isOtherOwner[ParInx]',this.isOtherOwner[ParInx]);
}
ChdCtrls.controls.other_owner.updateValueAndValidity();
}
if(flag == 3){
value==1
? item.controls.other_investments_type.setValidators([Validators.required])
: item.controls.other_investments_type.clearValidators();
item.controls.other_investments_type.updateValueAndValidity();
}
if(flag == 4){
value==0
? item.controls.other_owner.setValidators([Validators.required])
: item.controls.other_owner.clearValidators();
item.controls.other_owner.updateValueAndValidity();
}
if(flag == 5){
value==1
? item.controls.other_vehicle_type.setValidators([Validators.required])
: item.controls.other_vehicle_type.clearValidators();
item.controls.other_vehicle_type.updateValueAndValidity();
}
// if(flag == 5){
// value==1
// ? item.controls.other_vehicle_type.setValidators([Validators.required])
// : item.controls.other_vehicle_type.clearValidators();
// item.controls.other_vehicle_type.updateValueAndValidity();
// }
// if(flag == 6){
// value==1
// ? item.controls.other_uom.setValidators([Validators.required])
// : item.controls.other_uom.clearValidators();
// item.controls.other_uom.updateValueAndValidity();
// }
}

View File

@ -15,147 +15,149 @@
<mat-tab-group>
<mat-tab label={{pageTitle}}>
<ng-template matTabContent>
<div fxLayout="row wrap">
<div fxFlex="100">
<mat-card>
<mat-card-header>
<mat-card-title>
<p>Address Details {{addressLabel | titlecase}}</p>
</mat-card-title>
</mat-card-header>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="100">
<div formArrayName="business_assets_for_address" fxFill>
<div *ngFor="let itemrow of _businessAssetsQuesFrom.controls.business_assets_for_address['controls']; let i=index; let last=last;">
<div [formGroupName]="i">
<mat-card>
<mat-card-header>
<mat-card-title>
<p>Address Details {{ " : " + itemrow.get('address_label').value | titlecase}}</p>
</mat-card-title>
</mat-card-header>
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
<mat-form-field style="width: 95%;">
<mat-select placeholder="is this the business address ? " (selectionChange)="setRequiredValidation($event.value,'',1);"
formControlName="business_address_availability" required>
<mat-option>Select</mat-option>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
<mat-form-field style="width: 95%;">
<mat-select placeholder="is this the business address ? " (selectionChange)="setRequiredValidation($event.value,itemrow,1);"
formControlName="business_address_availability" required>
<mat-option>Select</mat-option>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none" *ngIf=" _businessAssetsQuesFrom.controls['business_address_availability'].value == 'yes'">
<div style="width:95%">
<label style="padding-left:2%">How long has business been operated from this premise?</label>
<mat-form-field>
<input matInput autocomplete="off" placeholder="Year(s)" formControlName="business_years"
(change)="checkWithExistBusinessYear($event.target.value)" (keypress)="keyPress($event)">
<mat-hint style="color: red;">{{yearErrorMessage}}</mat-hint>
<mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_years'].value.valid">Year's
Required</mat-error>
</mat-form-field>
<mat-form-field>
<input matInput autocomplete="off" placeholder="Month(s)" formControlName="business_month"
(keypress)="keyPress($event)" (change)="ConvertMonthintoYear($event.target.value)">
<mat-hint style="color: red;">{{monthErrorMessage}}</mat-hint>
<!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_month'].value.valid">Month's
Required</mat-error> -->
</mat-form-field>
</div>
<mat-form-field style="width: 95%;">
<mat-select [placeholder]="placeholderName" formControlName="business_is_pd_visited">
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
<mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_is_pd_visited'].value.valid">Field
Required</mat-error>
</mat-form-field>
<mat-form-field *ngIf=" _businessAssetsQuesFrom.controls['business_is_pd_visited'].value != ''" style="width: 95%;">
<input matInput autocomplete="off" placeholder="Remarks" formControlName="business_pd_visited_remark">
<mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_pd_visited_remark'].value.valid">Remarks
Required</mat-error>
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none" *ngIf=" _businessAssetsQuesFrom.controls['business_address_availability'].value == 'yes'">
<div formArrayName="business_assets_for_address" fxFill>
<div *ngFor="let itemrow of _businessAssetsQuesFrom.controls.business_assets_for_address['controls']; let i=index; let last=last;">
<div [formGroupName]="i">
<mat-form-field style="width:45%">
<mat-select placeholder="Ownership Type" formControlName="business_ownership_type"
(selectionChange)="setRequiredValidation($event.value,itemrow,7)">
<!-- (selectionChange)="selectedPropertyOwnedType($event.value,s,i)" -->
<mat-option>Select</mat-option>
<mat-option value="owned">Owned</mat-option>
<mat-option value="rented">Rented</mat-option>
</mat-select>
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none" *ngIf=" itemrow.get('business_address_availability').value == 'yes'">
<div style="width:95%">
<label style="padding-left:2%">How long has business been operated from this premise?</label>
<mat-form-field>
<input matInput autocomplete="off" placeholder="Year(s)" formControlName="business_years"
(change)="checkWithExistBusinessYear($event.target.value,i)" (keypress)="keyPress($event)">
<mat-hint style="color: red;">{{yearErrorMessage[i]}}</mat-hint>
<!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_years'].value.valid">Year's
Required</mat-error> -->
</mat-form-field>
<mat-form-field style="width:45%" *ngIf="(itemrow.get('business_ownership_type').value == 'rented')">
<input matInput autocomplete="off" placeholder="Monthly Rent Amount" formControlName="business_monthly_rented_amt"
(keypress)="keyPress($event)" (keyup)="inWords($event,i,9)">
<mat-hint align="start" style="font-size:90%" *ngIf="itemrow.get('business_monthly_rented_amt').value != ''">{{"&#8377;"}}
{{RentAmtInwordsForAddress[i]}} Only</mat-hint>
<mat-error>Monthly Rent Amount Required</mat-error>
<mat-form-field>
<input matInput autocomplete="off" placeholder="Month(s)" formControlName="business_month"
(keypress)="keyPress($event)" (change)="ConvertMonthintoYear($event.target.value,i)">
<mat-hint style="color: red;">{{monthErrorMessage[i]}}</mat-hint>
<!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_month'].value.valid">Month's
Required</mat-error> -->
</mat-form-field>
</div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none" *ngIf="(itemrow.get('business_ownership_type').value == 'owned')">
<mat-form-field style="width:45%">
<input matInput placeholder="Approximate Market Value" formControlName="business_approximate_market_value"
(keypress)="keyPress($event)" autocomplete="off" (keyup)="inWords($event,i,10)">
<mat-hint align="start" style="font-size:90%" *ngIf="itemrow.get('business_approximate_market_value').value != ''">{{"&#8377;"}}
{{appxMarketAmtInwordsForAddress[i]}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:45%">
<mat-select multiple placeholder="Asset Owned by" formControlName="business_name_of_the_owner"
[compareWith]="compareObjects" (selectionChange)="setRequiredValidation($event.value,itemrow,8)">
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
</mat-option>
</mat-optgroup>
</mat-select>
<mat-error>Asset Owned by Required</mat-error>
</mat-form-field>
<mat-form-field style="width:45%" *ngIf="isOtherOwnerForAddress">
<input matInput placeholder="Specify Asset Owned Name" formControlName="business_name_of_the_other_owner"
autocomplete="off">
</mat-form-field>
<mat-form-field style="width:45%">
<mat-label>Approx Vintage</mat-label>
<input matInput autocomplete="off" placeholder="eg.999" formControlName="business_vintage"
minlength="1" maxlength="3" (keypress)="keyPress($event)" (keyup)="calculateVintagePurchase($event.target.value,i,3)">
<!-- <mat-error> Invalid format</mat-error> -->
</mat-form-field>
<mat-form-field style="width:45%">
<mat-label>Purchase Year</mat-label>
<input matInput autocomplete="off" placeholder="YYYY eg.2018" formControlName="business_purchase_year"
minlength="4" maxlength="4" (keypress)="keyPress($event)" (keyup)="calculateVintagePurchase($event.target.value,i,4)">
<!-- <mat-error> Invalid year format</mat-error> -->
</mat-form-field>
</div>
<mat-form-field style="width: 95%;">
<mat-select [placeholder]="placeholderName[i] ? placeholderName[i] :'Was any business activity seen at the Address Type during PD visit?'" formControlName="business_is_pd_visited">
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
<!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_is_pd_visited'].value.valid">Field
Required</mat-error> -->
</mat-form-field>
<span>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:95%" *ngIf="(itemrow.get('business_ownership_type').value == 'owned')">
<mat-select placeholder="Is There a Loan Existing Against This Asset?" formControlName="business_emi">
<mat-form-field *ngIf=" itemrow.get('business_is_pd_visited').value != ''" style="width: 95%;">
<input matInput autocomplete="off" placeholder="Remarks" formControlName="business_pd_visited_remark">
<!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_pd_visited_remark'].value.valid">Remarks
Required</mat-error> -->
</mat-form-field>
</div>
<div *ngIf="itemrow.get('business_address_availability').value == 'yes'">
<mat-form-field style="width:45%">
<mat-select placeholder="Ownership Type" formControlName="business_ownership_type"
(selectionChange)="setRequiredValidation($event.value,itemrow,7)">
<!-- (selectionChange)="selectedPropertyOwnedType($event.value,s,i)" -->
<mat-option>Select</mat-option>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
<mat-option value="owned">Owned</mat-option>
<mat-option value="rented">Rented</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:45%" *ngIf="(itemrow.get('business_ownership_type').value == 'rented')">
<input matInput autocomplete="off" placeholder="Monthly Rent Amount" formControlName="business_monthly_rented_amt"
(keypress)="keyPress($event)" (keyup)="inWords($event,i,9)">
<mat-hint align="start" style="font-size:90%" *ngIf="itemrow.get('business_monthly_rented_amt').value != ''">{{"&#8377;"}}
{{RentAmtInwordsForAddress[i]}} Only</mat-hint>
<mat-error>Monthly Rent Amount Required</mat-error>
</mat-form-field>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none" *ngIf="(itemrow.get('business_ownership_type').value == 'owned')">
<mat-form-field style="width:45%">
<input matInput placeholder="Approximate Market Value" formControlName="business_approximate_market_value"
(keypress)="keyPress($event)" autocomplete="off" (keyup)="inWords($event,i,10)">
<mat-hint align="start" style="font-size:90%" *ngIf="itemrow.get('business_approximate_market_value').value != ''">{{"&#8377;"}}
{{appxMarketAmtInwordsForAddress[i]}} Only</mat-hint>
</mat-form-field>
<mat-form-field style="width:45%">
<mat-select multiple placeholder="Asset Owned by" formControlName="business_name_of_the_owner"
[compareWith]="compareObjects" (selectionChange)="setRequiredValidation($event.value,itemrow,8)">
<mat-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}}
</mat-option>
</mat-optgroup>
</mat-select>
<mat-error>Asset Owned by Required</mat-error>
</mat-form-field>
<mat-form-field style="width:45%" *ngIf="isOtherOwnerForAddress[i]">
<input matInput placeholder="Specify Asset Owned Name" formControlName="business_name_of_the_other_owner"
autocomplete="off">
</mat-form-field>
<mat-form-field style="width:45%">
<mat-label>Approx Vintage</mat-label>
<input matInput autocomplete="off" placeholder="eg.999" formControlName="business_vintage"
minlength="1" maxlength="3" (keypress)="keyPress($event)" (keyup)="calculateVintagePurchase($event.target.value,i,3)">
<!-- <mat-error> Invalid format</mat-error> -->
</mat-form-field>
<mat-form-field style="width:45%">
<mat-label>Purchase Year</mat-label>
<input matInput autocomplete="off" placeholder="YYYY eg.2018" formControlName="business_purchase_year"
minlength="4" maxlength="4" (keypress)="keyPress($event)" (keyup)="calculateVintagePurchase($event.target.value,i,4)">
<!-- <mat-error> Invalid year format</mat-error> -->
</mat-form-field>
</div>
<span>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:95%" *ngIf="(itemrow.get('business_ownership_type').value == 'owned')">
<mat-select placeholder="Is There a Loan Existing Against This Asset?" formControlName="business_emi">
<mat-option>Select</mat-option>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
</div>
</span>
</div>
</span>
</mat-card>
</div>
</div>
</div>
</div>
</div>
</mat-card>
</div>
</div>
<div fxFlex="100">
<mat-card style="min-height: 550px;">
<mat-card-header>
@ -313,7 +315,7 @@
<mat-error>Asset Owned by Required</mat-error>
</mat-form-field>
<mat-form-field *ngIf="isOtherOwner" style="width:45%">
<mat-form-field *ngIf="isOtherOwner[i]" style="width:45%">
<input matInput placeholder="Specify Asset Owned Name" formControlName="business_name_of_the_other_owner"
autocomplete="off">
</mat-form-field>

View File

@ -28,21 +28,22 @@ export class BusinessAssetsInfoComponent implements OnInit {
/**Declaration of Form Fields Variables */
pdid: string;
company_id: any;
placeholderName: any = 'Was any business activity seen at the Address Type during PD visit?';
placeholderName: any = [];
// 'Was any business activity seen at the Address Type during PD visit?';
private notifier: NotifierService;
public _businessAssetsQuesFrom: FormGroup;
public submitted = false;
isOtherOwnerForAddress : boolean = false;
isOtherOwner: boolean = false;
isOtherOwnerForAddress : any = [];
isOtherOwner : any = [];
loadDetails: boolean;
CustSegAbbr: any;
generalExistBusinessYear: Number;
generalExistBusinessMonth: Number;
yearErrorMessage: any;
monthErrorMessage: any;
yearErrorMessage: any = [];
monthErrorMessage: any = [];
currentYear: any = new Date().getFullYear();
addressLabel: any;
addressLabel: any = [];
/**Declaration of Dropdown And Array */
public applicants: any;
@ -120,25 +121,6 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.getM_PropertyType();
this.getM_Address_Type();
this.getM_Vehicle_Type();
let params: any = {};
params.pd_id = this.pdid;
params.pd_form_id = '5';
this.pdTrigerService.retriveForm(params).subscribe(data => {
if (data.status == 200) {
this.addressLabel = '';
let selectedAddressType = this.m_address_type.filter(element => element.address_type_id == data.records.address_type)[0];
let address = data.records.address;
let addressType = data.records.address_type != 1 ? selectedAddressType.address_type : data.records.address_type_others;
this.placeholderName = 'Was any business activity seen at the ' + addressType + ' during PD visit?';
this.addressLabel = " : " + address + ' / ' + addressType;
}
});
}
/** Assets Type For Dropdown List */
@ -189,9 +171,9 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.pdTrigerService.getPDFormDetailsWithCompanyID(this.pdid, '22', this.company_id).subscribe(
data => {
if (data) {
console.log('data.records',data);
if (data.dataStatus) {
console.log('data.records',data.records);
this.formLoadData(data.records);
} else {
this.formLoadData(null);
@ -203,6 +185,79 @@ export class BusinessAssetsInfoComponent implements OnInit {
}
);
}
loadaddresses(){
// console.log('function inside loaded');
let params: any = {};
params.pd_id = this.pdid;
params.pd_form_id = '5';
this.pdTrigerService.retriveForm(params).subscribe(data => {
// console.log('response',data);
if (data.status == 200) {
let dataOfAddress = data.records.addresses.filter(item => item.isactive == 1);
// console.log(data.records);
// console.log(data.records.addresses);
// console.log(dataOfAddress);
// // const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
if(data.records.addresses.length > 0){
data.records.addresses.forEach((data,inx)=>{
// console.log(data);
this.addressLabel[inx] = '';
let selectedAddressType = this.m_address_type.filter(element => element.address_type_id == data.address_type)[0];
let address = data.address;
let addressType = data.address_type != 1 ? selectedAddressType.address_type : data.address_type_others;
this.placeholderName[inx] = 'Was any business activity seen at the ' + addressType + ' during PD visit?';
let addressLabel = address + ' / ' + addressType;
let vals = {
address_label:addressLabel,
business_years: '',
business_month: '',
business_address_availability: '',
business_is_pd_visited: '',
business_pd_visited_remark: '',
business_approximate_market_value: '',
business_ownership_type: '',
business_monthly_rented_amt: '',
business_name_of_the_owner: '',
business_name_of_the_other_owner: '',
business_vintage: '',
business_purchase_year: '',
business_emi: ''
}
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.initBusinessAddressDetailsWithdata(vals));
});
}
else{
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.initBusinessAddressDetails());
}
}
else{
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.initBusinessAddressDetails());
}
});
}
// business_years: [value.business_years],
// business_month: [value.business_month],
// business_address_availability: [value.business_address_availability],
// business_is_pd_visited: [value.business_is_pd_visited],
// business_pd_visited_remark: [value.business_pd_visited_remark],
// business_assets_for_address: this._formBuilder.array([]),
// business_years: [''],
// business_month: [''],
// business_address_availability: [''],
// business_is_pd_visited: [''],
// business_pd_visited_remark: [''],
// business_assets_for_address: this._formBuilder.array([ this.createBusinessAssetsForAddress() ]),
/** load Form Data */
formLoadData(val) {
@ -212,38 +267,31 @@ export class BusinessAssetsInfoComponent implements OnInit {
pdid: [this.pdid],
formid: ['22'],
company_id: [this.company_id],
business_years: [value.business_years],
business_month: [value.business_month],
business_address_availability: [value.business_address_availability],
business_is_pd_visited: [value.business_is_pd_visited],
business_pd_visited_remark: [value.business_pd_visited_remark],
// business_address_details: this._formBuilder.array([]),
business_assets_for_address: this._formBuilder.array([]),
business_assets_details: this._formBuilder.array([]),
business_assets_form_remark: [value.business_assets_form_remark || null]
});
if (value.business_address_availability == 'yes') {
console.log(value.business_assets_for_address);
this.addBusinessAssetsForAddress(value.business_assets_for_address);
}
else {
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.createBusinessAssetsForAddress());
}
// if (value.business_address_availability == 'yes') {
// this.addBusinessAssetsForAddress(value.business_assets_for_address);
// }
// else {
// const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
// control.push(this.createBusinessAssetsForAddress());
// }
this.addBusinessAddressAssetsDetailsWithData(value.business_assets_for_address);
this.addBusinessAssetsDetailsWithData(value.business_assets_details);
} else {
this._businessAssetsQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
formid: ['22'],
company_id: [this.company_id],
business_assets_for_address: this._formBuilder.array([]),
business_assets_details: this._formBuilder.array([ this.initBusinessDetails() ]),
business_years: [''],
business_month: [''],
business_address_availability: [''],
business_is_pd_visited: [''],
business_pd_visited_remark: [''],
business_assets_for_address: this._formBuilder.array([ this.createBusinessAssetsForAddress() ]),
business_assets_form_remark: ['']
});
this.loadaddresses();
}
this.loadDetails = true;
}
@ -267,19 +315,41 @@ export class BusinessAssetsInfoComponent implements OnInit {
business_emi: [''],
});
}
createBusinessAssetsForAddress(): FormGroup {
initBusinessAddressDetails() {
return this._formBuilder.group({
business_approximate_market_value: [''],
business_ownership_type: [''],
business_monthly_rented_amt: [''],
business_name_of_the_owner: [''],
business_name_of_the_other_owner: [''],
business_vintage: [''],
business_purchase_year: ['', Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
business_emi: ['']
address_label:[''],
business_years: [''],
business_month: [''],
business_address_availability: [''],
business_is_pd_visited: [''],
business_pd_visited_remark: [''],
// this.createBusinessAssetsForAddress()
// business_details: this._formBuilder.array([]),
business_approximate_market_value: [''],
business_ownership_type: [''],
business_monthly_rented_amt: [''],
business_name_of_the_owner: [''],
business_name_of_the_other_owner: [''],
business_vintage: [''],
business_purchase_year: ['', Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
business_emi: [''],
});
}
// createBusinessAssetsForAddress(): FormGroup {
// return this._formBuilder.group({
// business_approximate_market_value: [''],
// business_ownership_type: [''],
// business_monthly_rented_amt: [''],
// business_name_of_the_owner: [''],
// business_name_of_the_other_owner: [''],
// business_vintage: [''],
// business_purchase_year: ['', Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
// business_emi: ['']
// });
// }
selectedPropertyOwnedType(e, s, i) {
@ -387,18 +457,18 @@ export class BusinessAssetsInfoComponent implements OnInit {
}
createBusinessAssetsForAddressWithData(data): FormGroup {
return this._formBuilder.group({
business_approximate_market_value: [data.business_approximate_market_value],
business_ownership_type: [data.business_ownership_type],
business_monthly_rented_amt: [data.business_monthly_rented_amt],
business_name_of_the_owner: [data.business_name_of_the_owner],
business_name_of_the_other_owner: [data.business_name_of_the_other_owner],
business_vintage: [data.business_vintage],
business_purchase_year: [data.business_purchase_year, Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
business_emi: [data.business_emi]
});
}
// createBusinessAssetsForAddressWithData(data): FormGroup {
// return this._formBuilder.group({
// business_approximate_market_value: [data.business_approximate_market_value],
// business_ownership_type: [data.business_ownership_type],
// business_monthly_rented_amt: [data.business_monthly_rented_amt],
// business_name_of_the_owner: [data.business_name_of_the_owner],
// business_name_of_the_other_owner: [data.business_name_of_the_other_owner],
// business_vintage: [data.business_vintage],
// business_purchase_year: [data.business_purchase_year, Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
// business_emi: [data.business_emi]
// });
// }
initBusinessDetailsWithdata(data) {
@ -417,49 +487,116 @@ export class BusinessAssetsInfoComponent implements OnInit {
return formGroup;
}
addBusinessAssetsForAddress(data) {
console.log(data);
var result = Object.keys(data).map(function (key) {
return data[key];
initBusinessAddressDetailsWithdata(data) {
return this._formBuilder.group({
address_label:[data.address_label],
business_years: [data.business_years],
business_month: [data.business_month],
business_address_availability: [data.business_address_availability],
business_is_pd_visited: [data.business_is_pd_visited],
business_pd_visited_remark: [data.business_pd_visited_remark],
business_approximate_market_value: [data.business_approximate_market_value],
business_ownership_type: [data.business_ownership_type],
business_monthly_rented_amt: [data.business_monthly_rented_amt],
business_name_of_the_owner: [data.business_name_of_the_owner],
business_name_of_the_other_owner: [data.business_name_of_the_other_owner || ''],
business_vintage: [data.business_vintage],
business_purchase_year: [data.business_purchase_year, Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
business_emi: [data.business_emi || ''],
});
if (result.length > 0) {
result.forEach((datas, index) => {
this.RentAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_monthly_rented_amt);
this.appxMarketAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_approximate_market_value);
let Avaliablity = 1;
// console.log(datas.business_name_of_the_owner);
if(datas.business_name_of_the_owner.length > 0){
datas.business_name_of_the_owner.forEach(option => {
if(option.id == 0 && option.group_id == 2){
Avaliablity = option.id;
}
});
}
this.isOtherOwnerForAddress = Avaliablity == 0 ? true : false;
});
for (let val of result) {
let vals = {
business_approximate_market_value: val.business_approximate_market_value,
business_ownership_type: val.business_ownership_type,
business_monthly_rented_amt: val.business_monthly_rented_amt,
business_name_of_the_owner: val.business_name_of_the_owner,
business_name_of_the_other_owner: val.business_name_of_the_other_owner,
business_vintage: val.business_vintage,
business_purchase_year: val.business_purchase_year,
business_emi: val.business_emi
};
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.createBusinessAssetsForAddressWithData(vals));
}
} else {
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.createBusinessAssetsForAddress());
}
}
// addBusinessAssetsForAddress(data) {
// var result = Object.keys(data).map(function (key) {
// return data[key];
// });
// if (result.length > 0) {
// result.forEach((datas, index) => {
// this.RentAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_monthly_rented_amt);
// this.appxMarketAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_approximate_market_value);
// let Avaliablity = 1;
// if(datas.business_name_of_the_owner.length > 0){
// datas.business_name_of_the_owner.forEach(option => {
// if(option.id == 0 && option.group_id == 2){
// Avaliablity = option.id;
// }
// });
// }
// this.isOtherOwnerForAddress = Avaliablity == 0 ? true : false;
// });
// for (let val of result) {
// let vals = {
// business_approximate_market_value: val.business_approximate_market_value,
// business_ownership_type: val.business_ownership_type,
// business_monthly_rented_amt: val.business_monthly_rented_amt,
// business_name_of_the_owner: val.business_name_of_the_owner,
// business_name_of_the_other_owner: val.business_name_of_the_other_owner,
// business_vintage: val.business_vintage,
// business_purchase_year: val.business_purchase_year,
// business_emi: val.business_emi
// };
// const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
// control.push(this.createBusinessAssetsForAddressWithData(vals));
// }
// } else {
// const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
// control.push(this.createBusinessAssetsForAddress());
// }
// }
addBusinessAddressAssetsDetailsWithData(data) {
var result = Object.keys(data).map(function (key) {
return data[key];
});
if (result.length > 0) {
result.forEach((datas, index) => {
this.RentAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_monthly_rented_amt);
this.appxMarketAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_approximate_market_value);
let Avaliablity = 1;
if(datas.business_name_of_the_owner.length > 0){
datas.business_name_of_the_owner.forEach(option => {
if(option.id == 0 && option.group_id == 2){
Avaliablity = option.id;
}
});
}
this.isOtherOwnerForAddress[index] = Avaliablity == 0 ? true : false;
});
for (let val of result) {
let vals = {
address_label:val.address_label,
business_years: val.business_years,
business_month: val.business_month,
business_address_availability: val.business_address_availability,
business_is_pd_visited: val.business_is_pd_visited,
business_pd_visited_remark: val.business_pd_visited_remark,
business_approximate_market_value: val.business_approximate_market_value,
business_ownership_type: val.business_ownership_type,
business_monthly_rented_amt: val.business_monthly_rented_amt,
business_name_of_the_owner: val.business_name_of_the_owner,
business_name_of_the_other_owner: val.business_name_of_the_other_owner,
business_vintage: val.business_vintage,
business_purchase_year: val.business_purchase_year,
business_emi: val.business_emi
};
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.initBusinessAddressDetailsWithdata(vals));
// this.initBusinessDetailsWithdata(vals)
}
} else {
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.initBusinessAddressDetails());
}
}
addBusinessAssetsDetailsWithData(supp_data) {
var result = Object.keys(supp_data).map(function (key) {
@ -471,8 +608,13 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.appxMarketAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.business_approximate_market_value);
this.RentAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.business_monthly_rented_amt);
let Avaliablity = 1;
this.isOtherOwner = Avaliablity == 0 ? true : false;
datas.business_name_of_the_owner.forEach(option => {
if(option.id == 0 && option.group_id == 2){
Avaliablity = option.id;
}
});
this.isOtherOwner[index] = Avaliablity == 0 ? true : false;
});
@ -647,9 +789,20 @@ export class BusinessAssetsInfoComponent implements OnInit {
/** To Convert Month into Year */
ConvertMonthintoYear(e) {
ConvertMonthintoYear(e,i) {
// const address_control = <FormArray>this._EditPDtriggerForm.controls['addresses'];
// console.log(e);
// console.log(i);
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
// control.controls[i]['controls'].isactive.setValue(0);
// address_control.controls[index].disable();
// console.log(by);
// return;
let business_year = this._businessAssetsQuesFrom.controls.business_years.value;
// console.log('address_control',address_control);
let business_year = control.controls[i]['controls'].business_years.value;
let converted_month: number = e % 12;
let converted_year: number = e / 12;
@ -657,60 +810,115 @@ export class BusinessAssetsInfoComponent implements OnInit {
let Year = +business_year + +Math.floor(converted_year);
if (Year > this.generalExistBusinessYear) {
this.yearErrorMessage = "Higher than Business Vintage";
this._businessAssetsQuesFrom.controls.business_years.setValue('');
this._businessAssetsQuesFrom.controls.business_month.setValue('');
this.yearErrorMessage[i] = "Higher than Business Vintage";
// this._businessAssetsQuesFrom.controls.business_years.setValue('');
control.controls[i]['controls'].business_years.setValue('');
// this._businessAssetsQuesFrom.controls.business_month.setValue('');
control.controls[i]['controls'].business_month.setValue('');
}
else {
if (Year == this.generalExistBusinessYear && +converted_month > this.generalExistBusinessMonth) {
this.monthErrorMessage = "Higher than Business Vintage";
this._businessAssetsQuesFrom.controls.business_years.setValue('');
this._businessAssetsQuesFrom.controls.business_month.setValue('');
this.monthErrorMessage[i] = "Higher than Business Vintage";
// this._businessAssetsQuesFrom.controls.business_years.setValue('');
control.controls[i]['controls'].business_years.setValue('');
control.controls[i]['controls'].business_month.setValue('');
// this._businessAssetsQuesFrom.controls.business_month.setValue('');
} else {
this.monthErrorMessage = '';
this.yearErrorMessage = '';
this._businessAssetsQuesFrom.controls.business_years.setValue(+business_year + +Math.floor(converted_year));
this._businessAssetsQuesFrom.controls.business_month.setValue(Math.floor(converted_month));
this.monthErrorMessage[i] = '';
this.yearErrorMessage[i] = '';
// this._businessAssetsQuesFrom.controls.business_years.setValue(+business_year + +Math.floor(converted_year));
control.controls[i]['controls'].business_years.setValue(+business_year + +Math.floor(converted_year));
control.controls[i]['controls'].business_month.setValue(Math.floor(converted_month));
// this._businessAssetsQuesFrom.controls.business_month.setValue(Math.floor(converted_month));
}
}
}
checkWithExistBusinessYear(e) {
checkWithExistBusinessYear(e,i) {
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
if (+e > this.generalExistBusinessYear) {
this.yearErrorMessage = "Higher than Business Vintage";
this._businessAssetsQuesFrom.controls.business_years.setValue('');
this.yearErrorMessage[i] = "Higher than Business Vintage";
// this._businessAssetsQuesFrom.controls.business_years.setValue('');
control.controls[i]['controls'].business_years.setValue('');
}
else {
this.yearErrorMessage = '';
this.yearErrorMessage[i] = '';
}
}
setRequiredValidation2(value, ParInx,ChdInx, flag) {
if (flag == 4) {
let ParCtrls = <FormArray>this._businessAssetsQuesFrom.controls.assets_details;
let ChdCtrls:any = <FormArray>ParCtrls.controls[ParInx];
let Avaliablity = 1;
value.forEach(option => {
if(option.id == 0 && option.group_id == 2){
Avaliablity = option.id;
}
});
if(Avaliablity == 0){
ChdCtrls.controls.business_name_of_the_other_owner.setValidators([Validators.required]);
this.isOtherOwner[ParInx] = true;
}else{
ChdCtrls.controls.business_name_of_the_other_owner.setValue('');
ChdCtrls.controls.business_name_of_the_other_owner.clearValidators();
this.isOtherOwner[ParInx] = false;
}
ChdCtrls.controls.business_name_of_the_other_owner.updateValueAndValidity();
}
if(flag == 8){
let ParCtrls = <FormArray>this._businessAssetsQuesFrom.controls.business_assets_for_address;
let ChdCtrls:any = <FormArray>ParCtrls.controls[ParInx];
let Avaliablity = 1;
value.forEach(option => {
if(option.id == 0 && option.group_id == 2){
Avaliablity = option.id;
}
});
if(Avaliablity == 0){
ChdCtrls.controls.business_name_of_the_other_owner.setValidators([Validators.required]);
this.isOtherOwnerForAddress[ParInx] = true;
}else{
ChdCtrls.controls.business_name_of_the_other_owner.setValue('');
ChdCtrls.controls.business_name_of_the_other_owner.clearValidators();
this.isOtherOwnerForAddress[ParInx] = false;
}
ChdCtrls.controls.business_name_of_the_other_owner.updateValueAndValidity();
}
}
setRequiredValidation(value, item, flag) {
console.log('controls',item);
if (flag == 1) {
if (value == 'yes') {
this._businessAssetsQuesFrom.controls.business_years.setValidators([Validators.required]);
this._businessAssetsQuesFrom.controls.business_address_availability.setValidators([Validators.required]);
this._businessAssetsQuesFrom.controls.business_is_pd_visited.setValidators([Validators.required]);
this._businessAssetsQuesFrom.controls.business_pd_visited_remark.setValidators([Validators.required]);
item.controls.business_years.setValidators([Validators.required]);
item.controls.business_address_availability.setValidators([Validators.required]);
item.controls.business_is_pd_visited.setValidators([Validators.required]);
item.controls.business_pd_visited_remark.setValidators([Validators.required]);
}
else {
this._businessAssetsQuesFrom.controls.business_years.clearValidators();
this._businessAssetsQuesFrom.controls.business_address_availability.clearValidators();
this._businessAssetsQuesFrom.controls.business_is_pd_visited.clearValidators();
this._businessAssetsQuesFrom.controls.business_pd_visited_remark.clearValidators();
item.controls.business_years.clearValidators();
item.controls.business_address_availability.clearValidators();
item.controls.business_is_pd_visited.clearValidators();
item.controls.business_pd_visited_remark.clearValidators();
}
this._businessAssetsQuesFrom.controls.business_years.updateValueAndValidity();
this._businessAssetsQuesFrom.controls.business_address_availability.updateValueAndValidity();
this._businessAssetsQuesFrom.controls.business_is_pd_visited.updateValueAndValidity();
this._businessAssetsQuesFrom.controls.business_pd_visited_remark.updateValueAndValidity();
item.controls.business_years.updateValueAndValidity();
item.controls.business_address_availability.updateValueAndValidity();
item.controls.business_is_pd_visited.updateValueAndValidity();
item.controls.business_pd_visited_remark.updateValueAndValidity();
}
if (flag == 3) {
@ -725,27 +933,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
item.controls.business_monthly_rented_amt.updateValueAndValidity();
item.controls.business_name_of_the_owner.updateValueAndValidity();
}
if (flag == 4) {
let Avaliablity = 1;
value.forEach(option => {
if(option.id == 0 && option.group_id == 2){
Avaliablity = option.id;
}
});
if(Avaliablity == 0){
item.controls.business_name_of_the_other_owner.setValidators([Validators.required]);
this.isOtherOwner = true;
}else{
item.controls.business_name_of_the_other_owner.setValue('');
item.controls.business_name_of_the_other_owner.clearValidators();
this.isOtherOwner = false;
}
item.controls.business_name_of_the_other_owner.updateValueAndValidity();
}
if (flag == 5) {
value == 1
? item.controls.other_vehicle_type.setValidators([Validators.required])
@ -775,28 +963,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
item.controls.business_monthly_rented_amt.updateValueAndValidity();
item.controls.business_name_of_the_owner.updateValueAndValidity();
}
if(flag == 8){
let Avaliablity = 1;
value.forEach(option => {
if(option.id == 0 && option.group_id == 2){
Avaliablity = option.id;
}
});
if(Avaliablity == 0){
item.controls.business_name_of_the_other_owner.setValidators([Validators.required]);
this.isOtherOwnerForAddress = true;
}else{
item.controls.business_name_of_the_other_owner.setValue('');
item.controls.business_name_of_the_other_owner.clearValidators();
this.isOtherOwnerForAddress = false;
}
item.controls.business_name_of_the_other_owner.updateValueAndValidity();
}
}

View File

@ -189,6 +189,7 @@ export class ClientInfoComponent implements OnInit {
data => {
if (data.dataStatus) {
let dataForm = data.records;
// console.log(dataForm);
if (dataForm !== undefined) {
this._supplierQuesFrom = this._formBuilder.group({
pdid: [this.pdid],
@ -206,10 +207,15 @@ export class ClientInfoComponent implements OnInit {
// let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
// return dataForm.main_raw_materials[key];
// });
let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
this.initManufacturingProductsDetails(api_main_raw_materials);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null);
if(dataForm.manufacturing_details){
let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
this.initManufacturingProductsDetails(api_main_raw_materials);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null);
}
else{
this.initManufacturingProductsDetails(null);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null);
}
}
// Load form details for the wholeshale trading details
@ -218,10 +224,16 @@ export class ClientInfoComponent implements OnInit {
// let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
// return dataForm.trading_products[key];
// });
let api_trading_products = dataForm.trade_details[0].trading_products;
this.initTradingProductsDetails(api_trading_products);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null);
if(dataForm.trade_details){
let api_trading_products = dataForm.trade_details[0].trading_products;
this.initTradingProductsDetails(api_trading_products);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null);
}
else{
this.initTradingProductsDetails(null);-
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null);
}
}
// Load form details for the service provider prduct details
@ -230,9 +242,18 @@ export class ClientInfoComponent implements OnInit {
// let api_service_provider_products = Object.keys(dataForm.service_products).map(function (key) {
// return dataForm.service_products[key];
// });
let api_service_provider_products = dataForm.service_provider_details[0].service_products;
this.initServiceProviderProductsDetails(api_service_provider_products);
this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_provider_details[0].service_products_total_payments_percent_on_credit || null);
// let api_service_provider_products = dataForm.service_provider_details[0].service_products;
// this.initServiceProviderProductsDetails(api_service_provider_products);
// this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_provider_details[0].service_products_total_payments_percent_on_credit || null);
if(dataForm.service_provider_details){
let api_service_provider_products = dataForm.service_provider_details[0].service_products;
this.initServiceProviderProductsDetails(api_service_provider_products);
this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_provider_details[0].service_products_total_payments_percent_on_credit || null);
}
else{
this.initServiceProviderProductsDetails(null);
this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(null);
}
}
// Load form details for the retail trading details
let arr3 = record.filter(data => data.type_of_activity_id == 3);

View File

@ -136,12 +136,12 @@ export class CurrentLoanComponent implements OnInit {
const control = <FormArray>this.currentLoanForm.controls['loan_details'];
if (value.status == 200) {
console.log('value.records',value.records);
this.currentLoanForm.controls['existing_loan'].setValue(value.records.existing_loan);
this.currentLoanForm.controls['currentloan_remarks'].setValue(value.records.currentloan_remarks);
if (value.records.existing_loan == 'Yes') {
console.log('value.records.loan_details',);
let loandetails = value.records.loan_details
var result = Object.keys(loandetails).map(function (key) {
@ -157,7 +157,7 @@ export class CurrentLoanComponent implements OnInit {
//this.selectedLoanTakenBy(val.loan_taken_by,index);
let objs = {
'label': val.loan_amount,
'label': val.label,
'loan_amount': val.loan_amount,
'frequency':val.frequency,
'other_frequency':val.other_frequency,
@ -184,14 +184,24 @@ export class CurrentLoanComponent implements OnInit {
} else {
this._pd.getAssetsWithLoanFromBusiness(this.pdid).subscribe(data=>{
// console.log('data',data);
if(data.dataStatus == true){
// console.log('data',data.record);
// return;
let AssetData = data.record;
if(AssetData.business_address_asset.length>0){
AssetData.business_address_asset.map(element => {
this.dataFromAssets.push({mode:0,
mode_name:element.address_label,
details:[],
owner_name:element.business_name_of_the_owner,
form_type:'Data From Bussiness Address'})
});
}
if(AssetData.business_assets.length>0){
AssetData.business_assets.map(element => {
this.dataFromAssets.push({mode:element.business_assets_mode,
@ -224,7 +234,14 @@ export class CurrentLoanComponent implements OnInit {
let labelarray : any = [];
this.dataFromAssets.forEach((val,index) => {
if(val.mode == 0){
let owner = val.owner_name.map((e => {
return e.name.split(',')
}));
// labelarray[index] = ' : '+owner +' - '+ val.mode_name.split("/")[0] + ' ( ' + val.mode_name.split("/")[1] + ' )';
labelarray[index] = ' : '+owner +' - '+ val.mode_name;
}
if(val.mode == 1){
let data;
let owner

View File

@ -42,22 +42,25 @@
<mat-option *ngFor="let list of m_recommendationList" [value]="list.pdofficer_recommendation_id">{{ list.pdofficer_recommendation }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width:40%;" *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 3">
<input matInput autocomplete="off" placeholder="Specify Reason for Negative" formControlName="enter_reason_for_negative">
</mat-form-field>
<mat-form-field style="width:40%;" *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 1">
<input matInput autocomplete="off" placeholder="Specify PD Officers Recommendation" formControlName="others_pd_officers_recommendation">
<input matInput autocomplete="off" placeholder="Specify PD Officers Recommendation" formControlName="others_pd_officers_recommendation">
</mat-form-field>
<mat-form-field style="width:40%;" *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 2">
<input matInput autocomplete="off" placeholder="Reasons for marking PD status as Positive" formControlName="reason_for_positive">
</mat-form-field>
<mat-form-field style="width:40%;" *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 3">
<input matInput autocomplete="off" placeholder="Reasons for marking PD status as Negative" formControlName="reason_for_negative">
</mat-form-field>
<mat-form-field style="width:40%;" *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 4">
<input matInput autocomplete="off" placeholder="Specify Reason for Refer to Credit" formControlName="enter_reason_for_refer_to_credit">
<input matInput autocomplete="off" placeholder="Reasons for marking PD status as 'Refer to Credit" formControlName="reason_for_refer_to_credit">
</mat-form-field>
</mat-card>
</mat-dialog-content>
<mat-dialog-actions>
<div fxFlex="60" class="pb-0 text-sm-left" align="left">
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="final_form_remarks" required></textarea>
<mat-label>Other Remarks</mat-label>
<textarea matInput placeholder="Other Remarks" formControlName="final_form_remarks"></textarea>
</mat-form-field>
</div>
<div fxFlex="40" align="end">

View File

@ -69,9 +69,10 @@ export class FinalRemarksComponent implements OnInit {
is_service_provided: ['', Validators.required],
pd_officers_recommendation:['', Validators.required],
others_pd_officers_recommendation:[''],
enter_reason_for_negative:[''],
enter_reason_for_refer_to_credit:[''],
final_form_remarks: ['',Validators.required]
reason_for_positive:[''],
reason_for_negative:[''],
reason_for_refer_to_credit:[''],
final_form_remarks: ['']
});
this.getM_Type();
this.getM_Recommendation();
@ -106,8 +107,9 @@ export class FinalRemarksComponent implements OnInit {
this._finalRemarkForm.controls.final_other_customer_behaviour.setValue(data.records.final_other_customer_behaviour);
this._finalRemarkForm.controls.pd_officers_recommendation.setValue(data.records.pd_officers_recommendation);
this._finalRemarkForm.controls.others_pd_officers_recommendation.setValue(data.records.others_pd_officers_recommendation);
this._finalRemarkForm.controls.enter_reason_for_negative.setValue(data.records.enter_reason_for_negative);
this._finalRemarkForm.controls.enter_reason_for_refer_to_credit.setValue(data.records.enter_reason_for_refer_to_credit);
this._finalRemarkForm.controls.reason_for_positive.setValue(data.records.reason_for_positive);
this._finalRemarkForm.controls.reason_for_negative.setValue(data.records.reason_for_negative);
this._finalRemarkForm.controls.reason_for_refer_to_credit.setValue(data.records.reason_for_refer_to_credit);
this._finalRemarkForm.controls.is_service_provided.setValue(data.records.is_service_provided);
this._finalRemarkForm.controls.final_form_remarks.setValue(data.records.final_form_remarks);
@ -212,64 +214,68 @@ export class FinalRemarksComponent implements OnInit {
// if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 4){
// }
console.log('e',e);
if(e==1){
console.log('other only',e);
this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValidators([Validators.required]);
this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity();
this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValidators([Validators.required]);
this._finalRemarkForm.controls['enter_reason_for_negative'].clearValidators();
this._finalRemarkForm.controls['enter_reason_for_negative'].updateValueAndValidity();
this._finalRemarkForm.controls['enter_reason_for_negative'].setValue('');
this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators();
this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue('');
this._finalRemarkForm.controls['reason_for_positive'].clearValidators();
this._finalRemarkForm.controls['reason_for_positive'].setValue('');
this._finalRemarkForm.controls['reason_for_negative'].clearValidators();
this._finalRemarkForm.controls['reason_for_negative'].setValue('');
this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].clearValidators();
this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].updateValueAndValidity();
this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].setValue('');
}
if(e==2){
console.log('all Validation clear ',e);
this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators();
this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity();
this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue('');
this._finalRemarkForm.controls['enter_reason_for_negative'].clearValidators();
this._finalRemarkForm.controls['enter_reason_for_negative'].updateValueAndValidity();
this._finalRemarkForm.controls['enter_reason_for_negative'].setValue('');
this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators();
this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue('');
this._finalRemarkForm.controls['reason_for_positive'].setValidators([Validators.required]);
this._finalRemarkForm.controls['reason_for_negative'].clearValidators();
this._finalRemarkForm.controls['reason_for_negative'].setValue('');
this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].clearValidators();
this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].updateValueAndValidity();
this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].setValue('');
}
if(e==3){
console.log('negative only',e);
this._finalRemarkForm.controls['enter_reason_for_negative'].setValidators([Validators.required]);
this._finalRemarkForm.controls['enter_reason_for_negative'].updateValueAndValidity();
this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue('');
this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators();
this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity();
this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].setValue('');
this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].clearValidators();
this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].updateValueAndValidity();
this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue('');
this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators();
this._finalRemarkForm.controls['reason_for_positive'].clearValidators();
this._finalRemarkForm.controls['reason_for_positive'].setValue('');
this._finalRemarkForm.controls['reason_for_negative'].setValidators([Validators.required]);
}
if(e==4){
console.log('credit only',e);
this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].setValidators([Validators.required]);
this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].updateValueAndValidity();
this._finalRemarkForm.controls['others_pd_officers_recommendation'].setValue('');
this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators();
this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity();
this._finalRemarkForm.controls['enter_reason_for_negative'].setValue('');
this._finalRemarkForm.controls['enter_reason_for_negative'].clearValidators();
this._finalRemarkForm.controls['enter_reason_for_negative'].updateValueAndValidity();
this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValidators([Validators.required]);
this._finalRemarkForm.controls['reason_for_positive'].clearValidators();
this._finalRemarkForm.controls['reason_for_positive'].setValue('');
this._finalRemarkForm.controls['reason_for_negative'].setValue('');
this._finalRemarkForm.controls['reason_for_negative'].clearValidators();
}
this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity();
this._finalRemarkForm.controls['reason_for_refer_to_credit'].updateValueAndValidity();
this._finalRemarkForm.controls['reason_for_positive'].updateValueAndValidity();
this._finalRemarkForm.controls['reason_for_negative'].updateValueAndValidity();
}
}

View File

@ -64,7 +64,7 @@
<span *ngIf="i != 0">
<mat-form-field style="width:60%">
<input matInput autocomplete="off" placeholder="Sale Variation from Previous Year in %"
formControlName="financial_annualsales_variation"
formControlName="financial_annualsales_variation" [ngClass]="details.get('financial_annualsales_variation').value > 0 ? 'greenhighlight' : 'highlight'"
(keypress)="keyPress($event)" readonly>
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('financial_annualsales_variation').value != '' ">
<span *ngIf="details.get('financial_annualsales_variation').value == 0">
@ -137,12 +137,11 @@
</div>
<span *ngIf="i != 0">
<mat-form-field style="width:45%">
<input matInput autocomplete="off" [ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}"
<input matInput autocomplete="off" [ngClass]="details.controls['financial_variation'].value > 0 ? 'greenhighlight' : 'highlight'"
placeholder="Profit Variation from Previous Year in %"
formControlName="financial_variation" (keypress)="keyPress($event)"
readonly>
<mat-hint align="start" style="font-size:70%" *ngIf="i != 0 && details.get('financial_variation').value != '' "
[ngClass]="{'highlight': (details.controls['financial_variation'].value > 40) || (details.controls['financial_variation'].value < -40)}">
<mat-hint align="start" style="font-size:70%" *ngIf="i != 0 && details.get('financial_variation').value != '' ">
<span *ngIf="details.get('financial_variation').value == 0">
No difference in Profit in FY <i>
{{details.get('financial_year').value}} </i> over
@ -170,13 +169,13 @@
</span>
</mat-hint>
<!-- “Increase in Sales in FY 2017-2018 over sales in FY 2016-2017 is 11.11%” -->
<!-- [ngClass]="{'highlight': (details.controls['financial_profit_to_sale_variation'].value > 40) || (details.controls['financial_profit_to_sale_variation'].value < -40)}" -->
</mat-form-field>
<mat-form-field style="width:45%">
<input matInput autocomplete="off" [ngClass]="{'highlight': (details.controls['financial_profit_to_sale_variation'].value > 40) || (details.controls['financial_profit_to_sale_variation'].value < -40)}"
<input matInput autocomplete="off" [ngClass]="details.get('financial_profit_to_sale_variation').value > 0 ? 'greenhighlight' : 'highlight'"
placeholder="Variation of Profit % over sales" formControlName="financial_profit_to_sale_variation"
(keypress)="keyPress($event)" readonly>
<mat-hint align="start" style="font-size:70%" *ngIf="i != 0 && details.get('financial_profit_to_sale_variation').value != '' "
[ngClass]="{'highlight': (details.controls['financial_profit_to_sale_variation'].value > 40) || (details.controls['financial_profit_to_sale_variation'].value < -40)}">
<mat-hint align="start" style="font-size:70%" *ngIf="i != 0 && details.get('financial_profit_to_sale_variation').value != '' ">
<span *ngIf="details.get('financial_profit_to_sale_variation').value == 0">
No difference in Profit sales % in FY <i>
{{details.get('financial_year').value}} </i> over
@ -425,7 +424,7 @@
</mat-select>
</mat-form-field>
<mat-form-field style="width:42%;" *ngIf="financialForm.controls.is_there_working_capital_available.value == 'yes' && financialForm.controls.working_capital_facilities_availed.value != ''">
<input matInput autocomplete="off" placeholder="Specify The Reason"
<input matInput autocomplete="off" placeholder="Details of Facility"
formControlName="reason_for_working_capital_facilities_availed">
</mat-form-field>
</mat-card-content>

View File

@ -94,7 +94,7 @@ export class FinancialInfoComponent implements OnInit {
this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr;
let x = this.customer_segment_abbr.split("-");
this.CustSegAbbr = x[1];
console.log('this.CustSegAbbr',this.CustSegAbbr);
// console.log('this.CustSegAbbr',this.CustSegAbbr);
}
//ViewerOption For Docs Display
@ -135,6 +135,7 @@ export class FinancialInfoComponent implements OnInit {
let retriveData = value.records;
if(value.records.is_financial_statements == 'yes'){
this.isDisplay = true;
/** Backend Data of Asper Statement */
let result = Object.keys(value.records.date_per_financial).map(function(key) {
return value.records.date_per_financial[key];
@ -931,9 +932,9 @@ export class FinancialInfoComponent implements OnInit {
}
}
}
console.log('val.financial_margin_of_profit',val.financial_margin_of_profit);
console.log('profit_margin',profit_margin);
console.log('childArray.controls.financial_margin_of_loss',childArray.controls.financial_margin_of_loss.value);
// console.log('val.financial_margin_of_profit',val.financial_margin_of_profit);
// console.log('profit_margin',profit_margin);
// console.log('childArray.controls.financial_margin_of_loss',childArray.controls.financial_margin_of_loss.value);
// prev_profit_margin[index] = val.financial_margin_of_profit != '' ? val.financial_margin_of_profit: 0;
// prev_loss_margin[index] = val.financial_margin_of_loss !='' ? val.financial_margin_of_loss : 0 ;
prev_profit_margin[index] = profit_margin != '' ? profit_margin : 0;
@ -959,20 +960,20 @@ export class FinancialInfoComponent implements OnInit {
if ((profit_margin != '' || loss_margin != '') && index != 0) {
console.log('temp_prev_losses',prev_loss_margin);
console.log('temp_prev_profits',prev_profit_margin);
// console.log('temp_prev_losses',prev_loss_margin);
// console.log('temp_prev_profits',prev_profit_margin);
console.log('curr index',index);
// console.log('curr index',index);
loss_margin = loss_margin !== undefined ? loss_margin : 0;
profit_margin = profit_margin !== undefined ? profit_margin:0;
let temp_prev_loss_margin = prev_loss_margin[index-1] !== undefined ? prev_loss_margin[index-1] : 0 ;
let temp_prev_profit_margin = prev_profit_margin[index-1] !== undefined ? prev_profit_margin[index-1] : 0 ;
console.log('profit_margin',profit_margin);
console.log('pre year loss_margin',temp_prev_loss_margin);
console.log('loss_margin',loss_margin);
console.log('pre year profit_margin',temp_prev_profit_margin);
// console.log('profit_margin',profit_margin);
// console.log('pre year loss_margin',temp_prev_loss_margin);
// console.log('loss_margin',loss_margin);
// console.log('pre year profit_margin',temp_prev_profit_margin);
if(annual_sale != ''){

View File

@ -164,12 +164,12 @@
<!-- companies end -->
<!-- Person Relationship Starts Here -->
<mat-card>
<mat-card *ngIf="_generalForm.controls.persons_with_relationships['controls'].length>1">
<mat-card-header>
<mat-card-title> Relationship Between Individuals </mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-table [dataSource]="relationSource" *ngIf="_generalForm.controls.persons_with_relationships['controls'].length>0"
<mat-table [dataSource]="relationSource"
formArrayName="persons_with_relationships">
<ng-container matColumnDef="applicant_name">
<mat-header-cell *matHeaderCellDef> Name </mat-header-cell>
@ -377,7 +377,7 @@
</div>
<div fxFlex="40" align="end">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Save"
matTooltipPosition="above" (click)="submitGeneralForm(_generalForm.value)">
matTooltipPosition="above" [disabled]="disableAfterSubmit===true" (click)="submitGeneralForm(_generalForm.value)">
<mat-icon>save</mat-icon>
</button>
</div>

View File

@ -34,6 +34,8 @@ export class GeneralInfoComponent implements OnInit {
count: number = 1;
errorMessage: any;
maxDate: any;
disableAfterSubmit : boolean;
public pd_applicants_details: any;
public _generalForm: FormGroup;
@ -70,6 +72,7 @@ export class GeneralInfoComponent implements OnInit {
this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id;
this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr;
this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr;
this.disableAfterSubmit = false;
}
/********************** Constructor Section Ends Here ****************/
@ -587,7 +590,7 @@ export class GeneralInfoComponent implements OnInit {
// submit form details
submitGeneralForm(formData: any) {
if (this._generalForm.invalid) {
this.disableAfterSubmit = false;
this.validateAllFormFields(this._generalForm);
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
return;
@ -597,6 +600,7 @@ export class GeneralInfoComponent implements OnInit {
// this.notifier.notify('warning', 'Please Choose Name of Person Met.!');
// }
else {
this.disableAfterSubmit = true;
let saveRecords: any = {}
saveRecords.pdid = formData.pdid;
saveRecords.formid = formData.formid;
@ -613,15 +617,17 @@ export class GeneralInfoComponent implements OnInit {
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;
// this.errorMessage = "Some Thing Wents Wrong Try Again !";
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
this.disableAfterSubmit = false;
// this.errorMessage = "Something Wents Wrong Try Again !";
});
}

View File

@ -163,7 +163,7 @@
<div fxFlex="40" align="end">
<button type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Submit" matTooltipPosition="above" type="button" (click)="submitLRForm()"><mat-icon>save</mat-icon>
<button type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Submit" matTooltipPosition="above" type="button" [disabled]="disableAfterSubmit===true" (click)="submitLRForm()"><mat-icon>save</mat-icon>
</button>
</div>
</mat-dialog-actions>

View File

@ -30,7 +30,7 @@ export class LenderRepresentativeComponent implements OnInit {
pageTitle: string ="Lender Representative Details";
pdid: number;
form_id: number;
disableAfterSubmit : boolean = false;
//snack bar
@ -141,9 +141,11 @@ export class LenderRepresentativeComponent implements OnInit {
submitLRForm() {
if (!this.representativeForm.valid) {
this.validateAllFormFields(this.representativeForm);
this.disableAfterSubmit = false;
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
return;
}
this.disableAfterSubmit = true;
let records: any = {};
records.pdid = this.pdid;
records.formid = this.form_id;
@ -158,13 +160,16 @@ export class LenderRepresentativeComponent implements OnInit {
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.!');
this.disableAfterSubmit = false;
})
}
validateAllFormFields(formGroup: FormGroup) {

View File

@ -377,7 +377,7 @@
<div fxFlex="40" align="end">
<button type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Submit"
matTooltipPosition="above" (click)="submitLoanDetails()">
matTooltipPosition="above" (click)="submitLoanDetails()" [disabled]="disableAfterSubmit===true">
<mat-icon>save</mat-icon>
</button>
</div>

View File

@ -31,7 +31,7 @@ export class LoanDetailsComponent implements OnInit {
lender_applicant_id: any;
main_applicant: any;
pageTitle: string = "Loan Details";
disableAfterSubmit : boolean = false;
/**Declaration of formfields Variables */
private notifier: NotifierService;
@ -655,9 +655,10 @@ export class LoanDetailsComponent implements OnInit {
if (!this.loanDetailsForm.valid) {
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
this.disableAfterSubmit = false;
return;
}
this.disableAfterSubmit = true;
let records: any = {};
records.pdid = this.pdid;
records.formid = this.form_id;
@ -746,13 +747,16 @@ export class LoanDetailsComponent implements OnInit {
// this.dialogRef.close();
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.!');
this.disableAfterSubmit = false;
})
}

View File

@ -242,8 +242,6 @@ export class NeighbourHoodComponent implements OnInit {
const neighbourhoodControl : FormGroup = this._neighbourhoodForm.controls['neighbourhood_list'] as FormGroup;
if(formData.check_type==0){
console.log('neighbourhoodControl',neighbourhoodControl);
// neighbourhoodControl.contdols['neighbourhood_name'].setValidators([Validators.required]);
// neighbourhoodControl.controls['neighbourhood_name'].updateValueAndValidity();

View File

@ -56,6 +56,12 @@
formControlName="others_source">
</mat-form-field>
<mat-form-field style="width:45%" *ngIf="details.get('source').value == 5">
<input matInput autocomplete="off" placeholder="Address"
formControlName="address">
<!-- <mat-hint align="end"><i (click)="Toview()">Click Here To view Rental Info Form</i></mat-hint> -->
</mat-form-field>
<mat-form-field style="width:45%">
<mat-select placeholder="Income earned by"
formControlName="income_earned_by">

View File

@ -24,6 +24,8 @@ import {
import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
import {ActivatedRoute, Router} from '@angular/router';
import { RentalInfoComponent} from './../rental-info/rental-info.component';
@Component({
selector: 'app-other-income',
templateUrl: './other-income.component.html',
@ -58,6 +60,7 @@ export class OtherIncomeComponent implements OnInit {
private route: ActivatedRoute,
private router: Router,
private _pd: PdTrigerService,
private dialog: MatDialog,
private dialogRef: MatDialogRef<OtherIncomeComponent>,
@Inject(MAT_DIALOG_DATA) public pd_all_details: any)
{
@ -154,6 +157,7 @@ public viewerOptions: any = {
return this.fb.group({
source: [''],
others_source : [''],
address : [''],
income_earned_by:[''],
others_income_earned_by:[''],
amount: [''],
@ -246,5 +250,30 @@ public viewerOptions: any = {
inWords(e,i){
this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value);
}
Toview(){
alert('Rental Info ');
// const dialogRef = this.dialog.open(RentalInfoComponent, {
// data: {}
// });
// dialogRef.afterClosed()
// .subscribe(dataresult => {
// });
const dialogRef = this.dialog.open(RentalInfoComponent, {
data: this.pd_all_details,
maxWidth: '100vw',
maxHeight: '100vh',
height: '100%',
width: '100%',
disableClose: true
});
dialogRef.afterClosed()
.subscribe(dataresult => {
// this.getCompanyListForBusiness();
});
}
}

View File

@ -5,6 +5,7 @@
<span>{{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}} </span><br>
{{pageTitle}}
</div> -->
<div fxFlex="70" align="left" style="padding: 10px !important;"></div>
<div fxFlex="30" align="end" style="padding: 10px !important;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="button" matTooltip="Close" matTooltipPosition="right" mat-dialog-close><mat-icon>close</mat-icon></button>

View File

@ -138,16 +138,30 @@ export class StockComponent implements OnInit {
}
public initstockForms(record){
// console.log('record.from_business',record.from_business);
let api = Object.keys(record.from_business).map(function (key) {
return record.from_business[key];
});
// console.log(api);
let type2 = record.from_business.filter(data => data.type_of_activity_id == 2);
let type2length = type2[0].products ? type2[0].products.length : 0;
// console.log('type2[0].hasOwnProperty("products")',type2[0].hasOwnProperty("products"));
// console.log('type2',type2);
// console.log('type2 0 index',type2[0]);
// console.log('type2 product',type2[0].product);
// console.log('type2 length',type2[0].product.length);
let type2length = type2[0].hasOwnProperty("products") ? type2[0].products.length : 0;
let type3 = record.from_business.filter(data => data.type_of_activity_id == 3);
let type3length = type3[0].products ? type2[0].products.length : 0;
let type3length = type3[0].hasOwnProperty("products") ? type3[0].products.length : 0;
let type4 = record.from_business.filter(data => data.type_of_activity_id == 4);
let type4length = type4[0].products ? type2[0].products.length : 0;
let type4length = type4[0].hasOwnProperty("products") ? type4[0].products.length : 0;
// console.log(type2);
// console.log(type2length);
// console.log(type3);
// console.log(type3length);
// console.log(type4);
// console.log(type4length);
let rm_api = record.from_supplier;
@ -319,11 +333,14 @@ export class StockComponent implements OnInit {
manufacturingFormCreation(record) {
let arr = record.from_business.filter(data => data.type_of_activity_id == 2);
let arrlength = arr[0].hasOwnProperty("products") ? arr[0].products.length : 0;
let rm_arr = record.from_supplier;
// let rm_arr = 0;
this.manufacturingForm = true;
if(arr.length > 0){
// console.log('manu arr',arr);
// console.log('rm_arr',rm_arr);
// let rm_arr = 0;
if(arrlength > 0){
this.manufacturingForm = true;
return this.fb.group({
manufacturing_raw_materials: this.fb.array([]),
is_sufficiant_raw: [],
@ -331,9 +348,8 @@ export class StockComponent implements OnInit {
manufacturing_finished_goods: this.fb.array([]),
})
}
else {
return;
else {
return;
}
}

View File

@ -65,9 +65,9 @@ export class SupplierInfoComponent implements OnInit {
this.notifier = notifier;
this.pageTitle = this.pd_all_details.company_name + ' - ' +this.pageTitle ;
this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant;
this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id;
this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr;
this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr;
this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id;
this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr;
this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr;
}
public viewerOptions: any = {
@ -183,19 +183,33 @@ export class SupplierInfoComponent implements OnInit {
// let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
// return dataForm.main_raw_materials[key];
// });
let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
this.initManufacturingProductsDetails(api_main_raw_materials);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null);
if(dataForm.manufacturing_details[0] !== null){
let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
this.initManufacturingProductsDetails(api_main_raw_materials);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null);
}
else{
this.initManufacturingProductsDetails(null);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null);
}
}
let arr1 = record.filter(data => data.type_of_activity_id == 3 || data.type_of_activity_id ==4);
if(arr1.length > 0) {
if(dataForm.trade_details[0] !== null){
// let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
// return dataForm.trading_products[key];
// });
let api_trading_products = dataForm.trade_details[0].trading_products;
this.initTradingProductsDetails(api_trading_products);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null);
}
else{
this.initTradingProductsDetails(null);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null);
}
}
this.noRecordsFound = true;
} else {
@ -213,7 +227,7 @@ export class SupplierInfoComponent implements OnInit {
this.initManufacturingProductsDetails(null);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null);
}
let arr1 = record.filter(data => data.type_of_activity_id == 3 || data.type_of_activity_id == 4);
let arr1 = record.filter(data => data.type_of_activity_id == 3 || 4);
if(arr1.length > 0) {
this.initTradingProductsDetails(null);
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trading_products_total_payments_percent_on_credit || null);

View File

@ -92,17 +92,33 @@
</div>
</div>
</div>
<div fxLayout="row">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100" class="profile-center">
<div fxFlex="10" appPdLocatedMapView [value]="master">
<!-- <span><i class="fa-1x fa fa-map-marker" style="width: 37px;padding: 8px 9px 8px 9px;border-bottom: 2px solid red;"></i></span> -->
<span><i class="fa-1x fa fa-map-marker" style="width: 37px;padding: 8px 9px 8px 9px;border-bottom: 2px solid red;"></i></span>
</div>
<div fxFlex="90">
<span *ngIf="master.state_name" class="hover-icon"> {{master.addressline1}},<br> {{master.city_name}},<br>{{master.state_name}}-{{master.pincode_id == 1 ? master.other_pincode : master.pincode }} </span>
</div>
</div>
</div>
<!-- <div fxLayout="row">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100" class="profile-center">
<div fxFlex="10" appPdLocatedMapView [value]="master">
<span><i class="fa-1x fa fa-map-marker" style="width: 37px;padding: 8px 9px 8px 9px;border-bottom: 2px solid red;"></i></span>
</div>
<div fxFlex="90">
<span *ngIf="master.state_name" class="hover-icon"> {{master.addressline1}},<br> {{master.city_name}},<br>{{master.state_name}}-{{master.pincode_id == 1 ? master.other_pincode : master.pincode }} </span>
</div>
</div>
</div> -->
<div fxLayout="row">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100" class="profile-center">
<div *ngFor="let addresses of master.addresses">
<div fxFlex="10" appPdLocatedMapView [value]="addresses">
<!-- <span><i class="fa-1x fa fa-map-marker" style="width: 37px;padding: 8px 9px 8px 9px;border-bottom: 2px solid red;"></i></span> -->
<span><i class="fa-1x fa fa-map-marker" style="width: 37px;padding: 8px 9px 8px 9px;border-bottom: 2px solid red;"></i></span>
</div>
<div fxFlex="90">
<!-- <span *ngIf="addresses.state_name" class="hover-icon"> {{addresses.addressline}},<br> {{addresses.city_name}},<br>{{addresses.state_name}}-{{addresses.pincode == 1 ? addresses.other_pincode : addresses.pincode_display }} </span> -->
<span *ngIf="addresses.state_name" class="hover-icon"> {{addresses.addressline1}},<br> {{addresses.city_name}},<br>{{addresses.state_name}}-{{addresses.pincode_id == 1 ? addresses.other_pincode : addresses.pincode }} </span>
</div>
</div>
</div>
</div>
<!--<div fxLayout="row">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100" class="profile-center">
<span><i class="fa-1x fa fa-suitcase" style="width: 37px;padding: 8px 9px 8px 9px;border-bottom: 2px solid red;"></i>&nbsp; {{master.addressline1}}</span>
@ -279,9 +295,15 @@
<ng-template mat-tab-label>PD History</ng-template>
<div *ngIf="masterPdLogsData.length>0; else nohistory">
<mat-list class="m-gap p-gap" *ngFor="let master of masterPdLogsData">
<mat-list-item>
<mat-list-item [ngClass]="master.meta_data ? 'metaDataStyle' : '' ">
<span style="font-size:15px;"><span style="color:#908f8f">{{master.time}}&nbsp;</span>
<span style="color:#908f8f"> <i> {{master.user}} </i> </span><br> <span>{{master.log}}</span> </span>
<span style="color:#908f8f"> <i> {{master.user}} </i> </span><br> <span>{{master.log}}</span>
<div *ngIf="master.meta_data && master.meta_data.length>0">
<div *ngFor="let metadata of master.meta_data" style="color:#908f8f">
<i>{{metadata.display_name}} </i> : <span>{{metadata.display_value}}</span><br>
</div>
</div>
</span>
</mat-list-item>

View File

@ -10,6 +10,10 @@
padding: 0rem !important;
}
.metaDataStyle{
height:89px !important;
}
:host {
margin-left: -5px;

View File

@ -1,8 +1,8 @@
import { Component, OnInit,ViewEncapsulation, EventEmitter, Input, Output, OnDestroy, Pipe, PipeTransform } from '@angular/core';
import { Component, OnInit, ViewEncapsulation, EventEmitter, Input, Output, OnDestroy, Pipe, PipeTransform } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { MatDialog } from '@angular/material';
import {DatePipe } from '@angular/common';
import { MatDialog } from '@angular/material';
import { DatePipe } from '@angular/common';
import { NotifierService } from 'angular-notifier';
import { PdTrigerService } from '../../../pd-service/pd-triger.service';
import { PdAllocationComponent } from '../pd-allocation/pd-allocation.component';
@ -26,146 +26,117 @@ import Swal from 'sweetalert2';
})
export class ViewPdComponent implements OnInit, OnDestroy {
pipe = new DatePipe('en-US');
private notifier:NotifierService;
private notifier: NotifierService;
errorMessage: any;
pdMasterData: any=[];
pdApplicantData: any=[];
pdDocumentsData: any=[];
masterPdLogsData: any=[];
applicantPDLogsData: any=[];
pdAdditionalReqData: any=[];
FilteredFieldNames : any=[];
localcount :any;
localstring : any;
localMandatoryFields: any=
[ {'backEnd_FieldName':"fk_lender_id",'frontEnd_FieldName':"Lender Name"},
{'backEnd_FieldName':"lender_applicant_id",'frontEnd_FieldName':"Loan Applicant ID"},
{'backEnd_FieldName':"fk_product_id",'frontEnd_FieldName':"Product Name"},
{'backEnd_FieldName':"fk_subproduct_id",'frontEnd_FieldName':"Sub Product Name"},
{'backEnd_FieldName':"fk_pd_type",'frontEnd_FieldName':"PD Type"},
{'backEnd_FieldName':"fk_customer_segment",'frontEnd_FieldName':"Customer Segment"},
{'backEnd_FieldName':"loan_amount",'frontEnd_FieldName':"Loan Amount"},
{'backEnd_FieldName':"addressline1",'frontEnd_FieldName':"Address at which PD is to be done"},
{'backEnd_FieldName':"fk_city",'frontEnd_FieldName':"City"},
{'backEnd_FieldName':"fk_state",'frontEnd_FieldName':"State"},
{'backEnd_FieldName':"pincode",'frontEnd_FieldName':"Pincode"},
{'backEnd_FieldName':"pd_contact_person",'frontEnd_FieldName':"Lender Contact Person"},
{'backEnd_FieldName':"pd_contact_mobileno",'frontEnd_FieldName':"Lender's Mobile Number"},
{'backEnd_FieldName':"pd_branch_id",'frontEnd_FieldName':"Branch"},
{'backEnd_FieldName':"pd_contact_landline",'frontEnd_FieldName':"Lender's Landline Number"},
{'backEnd_FieldName':"main_applicant",'frontEnd_FieldName':"Applicant Master"}];
// localMandatoryFields: any=
// ['fk_lender_id',
// 'lender_applicant_id',
// 'fk_product_id',
// 'fk_subproduct_id',
// 'fk_pd_type',
// 'fk_customer_segment',
// 'loan_amount',
// 'addressline1',
// 'fk_city',
// 'fk_state',
// 'pincode',
// 'pd_contact_person',
// 'pd_contact_mobileno',
// 'pd_branch_id',
// 'pd_contact_landline'];
// localMandatoryFields2: any=
// [ "Lender Name",
// "Loan Applicant ID",
// "Product Name",
// "Sub Product Name",
// "PD Type",
// "Customer Segment",
// "Loan Amount",
// "Address at which PD is to be done",
// "City",
// "State",
// "Pincode",
// "Lender Contact Person",
// "Lender's Mobile Number",
// "Branch",
// "Lender's Landline Number"];
viewID:string;
viewParams:any;
destroyType:number=1;
currentPDStatus:string;
pdMasterData: any = [];
pdAddressesData: any = [];
pdApplicantData: any = [];
pdDocumentsData: any = [];
masterPdLogsData: any = [];
applicantPDLogsData: any = [];
pdAdditionalReqData: any = [];
FilteredFieldNames: any = [];
localcount: any;
localstring: any;
localMandatoryFields: any =
[{ 'backEnd_FieldName': "fk_lender_id", 'frontEnd_FieldName': "Lender Name" },
{ 'backEnd_FieldName': "lender_applicant_id", 'frontEnd_FieldName': "Loan Applicant ID" },
{ 'backEnd_FieldName': "fk_product_id", 'frontEnd_FieldName': "Product Name" },
{ 'backEnd_FieldName': "fk_subproduct_id", 'frontEnd_FieldName': "Sub Product Name" },
{ 'backEnd_FieldName': "fk_pd_type", 'frontEnd_FieldName': "PD Type" },
{ 'backEnd_FieldName': "fk_customer_segment", 'frontEnd_FieldName': "Customer Segment" },
{ 'backEnd_FieldName': "loan_amount", 'frontEnd_FieldName': "Loan Amount" },
{ 'backEnd_FieldName': "addressline1", 'frontEnd_FieldName': "Address at which PD is to be done" },
{ 'backEnd_FieldName': "fk_city", 'frontEnd_FieldName': "City" },
{ 'backEnd_FieldName': "fk_state", 'frontEnd_FieldName': "State" },
{ 'backEnd_FieldName': "pincode", 'frontEnd_FieldName': "Pincode" },
{ 'backEnd_FieldName': "pd_contact_person", 'frontEnd_FieldName': "Lender Contact Person" },
{ 'backEnd_FieldName': "pd_contact_mobileno", 'frontEnd_FieldName': "Lender's Mobile Number" },
{ 'backEnd_FieldName': "pd_branch_id", 'frontEnd_FieldName': "Branch" },
{ 'backEnd_FieldName': "pd_contact_landline", 'frontEnd_FieldName': "Lender's Landline Number" },
{ 'backEnd_FieldName': "main_applicant", 'frontEnd_FieldName': "Applicant Master" }];
viewID: string;
viewParams: any;
destroyType: number = 1;
currentPDStatus: string;
enableStartPD: boolean;
// create values for status check
pdStatusCheck :any={
"DRAFT" :'DRAFT',
"TRIGGERED" :'TRIGGERED',
"ALLOCATED" :'ALLOCATED',
"SCHEDULED" :'SCHEDULED',
"INPROGRESS" :'INPROGRESS',
"COMPLETED" :'COMPLETED',
"QC_COMPLETED" :'QC_COMPLETED',
pdStatusCheck: any = {
"DRAFT": 'DRAFT',
"TRIGGERED": 'TRIGGERED',
"ALLOCATED": 'ALLOCATED',
"SCHEDULED": 'SCHEDULED',
"INPROGRESS": 'INPROGRESS',
"COMPLETED": 'COMPLETED',
"QC_COMPLETED": 'QC_COMPLETED',
};
mandatoryFieldsValidations: any=[];
mandatoryFieldsValidations: any = [];
// @Input() childData: string;
// @Output() loadParent = new EventEmitter<string>();
public _EditPDtriggerForm:FormGroup;
constructor(notifier:NotifierService,private dialog: MatDialog,private _fb: FormBuilder,
private _pd: PdTrigerService,private route: ActivatedRoute,private router: Router, private ListPdComponent: ListPdComponent) {
this.notifier=notifier;
this.enableStartPD=false;
}
public _EditPDtriggerForm: FormGroup;
constructor(notifier: NotifierService, private dialog: MatDialog, private _fb: FormBuilder,
private _pd: PdTrigerService, private route: ActivatedRoute, private router: Router, private ListPdComponent: ListPdComponent) {
this.notifier = notifier;
this.enableStartPD = false;
}
ngOnInit() {
this.ListPdComponent.showListView(false);
this.route.params.subscribe(params => {
this.viewID = params['pdid'];
});
});
this.viewPdDetails(this.viewID);
}
pd_QC_Rating: Number;
viewPdDetails(editID:string){
this.pdMasterData = [];
this._pd.editPdDetails(editID).subscribe(
data => {
if (data.status == 200) {
let masterData: any = data.records.pd_master_details;
this.pdMasterData.push(masterData[0]);
this.mandatoryFieldsValidations = masterData[1].mandatory_fields;
this.pd_QC_Rating = Number(this.pdMasterData.qc_rating);
this.pdApplicantData= data.records.applicants_details;
this.pdApplicantData = this.pdApplicantData.filter(appt => appt.applicant_type != 2);
this.pdDocumentsData=data.records.pd_documnets;
this.masterPdLogsData=data.records.pd_logs.master;
//this.applicantPDLogsData= data.records.pd_logs.master;
this.currentPDStatus = data.records.pd_master_details[0].pd_status;
this.pdAdditionalReqData = data.records.pd_additional_requirements;
// enable pd start time
if(data.records.pd_master_details[0].scheduled_on_for_validation){
let courrentDateTime: string = this.pipe.transform(new Date(), 'yyyy-MM-dd HH:mm');
let scheduledDateTime: string=data.records.pd_master_details[0].scheduled_on_for_validation;
let diffInMs: number = Date.parse(courrentDateTime) - Date.parse(scheduledDateTime);
let diffInHours: number = Math.floor(diffInMs / 1000 / 60 / 60);
if(diffInHours>=-4){
this.enableStartPD=true;
}
else {
this.enableStartPD=false;
}
}
else {
this.enableStartPD=false;
}
}
}, error => this.errorMessage = <any> error);
viewPdDetails(editID: string) {
this.pdMasterData = [];
this._pd.editPdDetails(editID).subscribe(
data => {
if (data.status == 200) {
let masterData: any = data.records.pd_master_details;
this.pdMasterData.push(masterData[0]);
this.mandatoryFieldsValidations = masterData[1].mandatory_fields;
this.pd_QC_Rating = Number(this.pdMasterData.qc_rating);
this.pdApplicantData = data.records.applicants_details;
this.pdApplicantData = this.pdApplicantData.filter(appt => appt.applicant_type != 2);
this.pdDocumentsData = data.records.pd_documnets;
this.masterPdLogsData = Object.keys(data.records.pd_logs.master).map(function (key) {
return data.records.pd_logs.master[key];
});
// console.log('data.records.pd_addressdata', data.records.pd_addressdata);
this.pdMasterData[0].addresses = data.records.pd_address.filter(item => item.isactive == 1);
// console.log('this.pdMasterData[0].addresses', this.pdMasterData[0].addresses);
this.currentPDStatus = data.records.pd_master_details[0].pd_status;
this.pdAdditionalReqData = data.records.pd_additional_requirements;
// enable pd start time
if (data.records.pd_master_details[0].scheduled_on_for_validation) {
let courrentDateTime: string = this.pipe.transform(new Date(), 'yyyy-MM-dd HH:mm');
let scheduledDateTime: string = data.records.pd_master_details[0].scheduled_on_for_validation;
let diffInMs: number = Date.parse(courrentDateTime) - Date.parse(scheduledDateTime);
let diffInHours: number = Math.floor(diffInMs / 1000 / 60 / 60);
if (diffInHours >= -4) {
this.enableStartPD = true;
}
else {
this.enableStartPD = false;
}
}
else {
this.enableStartPD = false;
}
}
}, error => this.errorMessage = <any>error);
}
loadPdListCompoent() {
this.destroyType=2;
this.router.navigate([ '../../' ], { relativeTo: this.route });
this.destroyType = 2;
this.router.navigate(['../../'], { relativeTo: this.route });
this.ListPdComponent.pdListLoad(true);
}
@ -174,7 +145,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
// let ActiveDatas = isactive == 0
// ? { 'branch_id':id,'isactive': '1'}
// : { 'branch_id':id,'isactive': '0'}
// //if is active '1' have TO deactive So deactive messages
// if(isactive == 1){
// this.SwalButtonText = 'Yes, deactivate it!';
@ -184,7 +155,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
// this.SwalButtonText = 'Yes, activate it!';
// this.SwalMessage = 'Activated!';
// }
// Swal({
// title: 'Are you sure?',
// type: 'warning',
@ -210,173 +181,173 @@ export class ViewPdComponent implements OnInit, OnDestroy {
// }
// })
// }
Maponclick(master : any){
let url = "https://www.google.com/maps/place/"
let concat_url = url+master.addressline1+'/'+master.city_name+','+master.pincode+','+master.state_name;
window.open(concat_url,'_blank');
}
editPdMaster(masterData:any,flag){
// Maponclick(master: any) {
// let url = "https://www.google.com/maps/place/"
// let concat_url = url + master.addressline1 + '/' + master.city_name + ',' + master.pincode + ',' + master.state_name;
// window.open(concat_url, '_blank');
// }
editPdMaster(masterData: any, flag) {
let record = {
"records":masterData,
"records": masterData,
"applicantLength": this.pdApplicantData.length
}
const dialogPDMaster = this.dialog.open(EditPdMasterComponent, {
data: record,
position: { right: '0'},
position: { right: '0' },
width: '80%',
disableClose: true
});
dialogPDMaster.afterOpen()
.subscribe(dataresult => {
if(flag == 1){
let ffd : any = [];
if (flag == 1) {
let ffd: any = [];
this.FilteredFieldNames.forEach(field => {
ffd.push(field.frontEnd_FieldName);
});
// this.notifier.notify('info', 'Please Fill ' + ffd.join(' , ') + ' Fields.!');
Swal({
title:'Please complete the below details',
title: 'Please complete the below details',
confirmButtonColor: "red",
// html:true,
//text:'Please Fill' + ffd.forEach(data=>{ data }) + ' ! ',
text:ffd.join(' , ')
text: ffd.join(' , ')
});
// Swal({
// title: "HTML <small>Title</small>!",
// text: "...<div class='row my_tracking_swal'>" + flag + "</div>...",
// }) ;
// Swal({
// title: "HTML <small>Title</small>!",
// text: "...<div class='row my_tracking_swal'>" + flag + "</div>...",
// }) ;
}
});
dialogPDMaster.afterClosed().subscribe(dataresult => {
this.viewPdDetails(this.viewID)
});
}
editPdApplicant(applicantData:any){
editPdApplicant(applicantData: any) {
let setPdDetails = {
"pdID":this.viewID,
"records":applicantData
"pdID": this.viewID,
"records": applicantData
}
const dialogApplicant = this.dialog.open(EditPdApplicantComponent, {
data: setPdDetails,
position: { right: '0'},
position: { right: '0' },
width: '60%',
disableClose: true
});
dialogApplicant.afterClosed()
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
this.viewPdDetails(this.viewID)
});
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
this.viewPdDetails(this.viewID)
});
}
// edit pd addtional requirements
editAdditionalRequirement(requirementData:any){
editAdditionalRequirement(requirementData: any) {
let setPdDetails = {
"pdID":this.viewID,
"records":requirementData
"pdID": this.viewID,
"records": requirementData
}
const dialogRequirement = this.dialog.open(PdRequirementComponent, {
data: setPdDetails,
position: { right: '0'},
position: { right: '0' },
width: '60%',
disableClose: true
});
dialogRequirement.afterClosed()
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
this.viewPdDetails(this.viewID)
});
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
this.viewPdDetails(this.viewID)
});
}
// pd allocation to
pdAllocationTo(pdData:any) {
if(pdData.fk_pd_type == 1){
pdAllocationTo(pdData: any) {
if (pdData.fk_pd_type == 1) {
const dialogRef = this.dialog.open(PdAllocationComponent, {
data: pdData,
position: { right: '0'},
position: { right: '0' },
width: '80%',
disableClose: true
});
dialogRef.afterClosed()
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
this.viewPdDetails(this.viewID)
});
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
this.viewPdDetails(this.viewID)
});
}
else if(pdData.fk_pd_type == 2){
else if (pdData.fk_pd_type == 2) {
const dialogRef = this.dialog.open(SmartPdAllocationComponent, {
data: pdData,
position: { right: '0'},
position: { right: '0' },
width: '80%',
disableClose: true
});
dialogRef.afterClosed()
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
this.viewPdDetails(this.viewID)
});
this.viewPdDetails(this.viewID)
});
}
else if(pdData.fk_pd_type == 3){
else if (pdData.fk_pd_type == 3) {
const dialogRef = this.dialog.open(TelePdAllocationComponent, {
data: pdData,
position: { right: '0'},
position: { right: '0' },
width: '80%',
disableClose: true,
});
dialogRef.afterClosed()
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
this.viewPdDetails(this.viewID)
});
this.viewPdDetails(this.viewID)
});
}
}
// pd schedule details
scheduleDetails(pdData:any){
scheduleDetails(pdData: any) {
const dialogSchedule = this.dialog.open(SchedulePdComponent, {
data: pdData,
disableClose: true
});
dialogSchedule.afterClosed()
const dialogSchedule = this.dialog.open(SchedulePdComponent, {
data: pdData,
disableClose: true
});
dialogSchedule.afterClosed()
.subscribe(dataresult => {
// this.notifier.notify('success', 'Successfully allocated.!');
// this.notifier.notify('success', 'Successfully allocated.!');
this.viewPdDetails(this.viewID)
});
}
// start pd
getPDStart(pdID:any, status: string){
this.destroyType=3;
if(status==this.pdStatusCheck.SCHEDULED){
getPDStart(pdID: any, status: string) {
this.destroyType = 3;
if (status == this.pdStatusCheck.SCHEDULED) {
const dialogRef = this.dialog.open(PdStatusChangeDialogueComponent, {
data: { pdid: this.viewID, pd_status: this.pdStatusCheck.INPROGRESS },
disableClose: true,
minWidth:'30%',
maxWidth:'40%',
minWidth: '30%',
maxWidth: '40%',
});
dialogRef.afterClosed()
.subscribe(dataresult => {
if(dataresult.update_status==true){
this.router.navigate([ '../../startpd',pdID], { relativeTo: this.route });
}
if (dataresult.update_status == true) {
this.router.navigate(['../../startpd', pdID], { relativeTo: this.route });
}
});
}
else {
this.router.navigate([ '../../startpd',pdID], { relativeTo: this.route });
this.router.navigate(['../../startpd', pdID], { relativeTo: this.route });
}
}
getPDIDReport(pdID:any) {
this.destroyType=3;
this.router.navigate([ '../../pd_report',pdID], { relativeTo: this.route });
getPDIDReport(pdID: any) {
this.destroyType = 3;
this.router.navigate(['../../pd_report', pdID], { relativeTo: this.route });
}
// // direct trigger the pd
@ -409,34 +380,34 @@ export class ViewPdComponent implements OnInit, OnDestroy {
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
// });//error closed
// }
// }
// direct trigger the pd
directTriggerPD(data: any,masterdetail : any){
directTriggerPD(data: any, masterdetail: any) {
let pdid = masterdetail.pd_id;
let getValues = data.filter(val =>val).map(Val => Val);
this.FilteredFieldNames = getValues.map(x => {
let findIndex = this.localMandatoryFields.map(val => val.backEnd_FieldName).indexOf(x);
return this.localMandatoryFields[findIndex];
});
let pdid = masterdetail.pd_id;
let getValues = data.filter(val => val).map(Val => Val);
this.FilteredFieldNames = getValues.map(x => {
let findIndex = this.localMandatoryFields.map(val => val.backEnd_FieldName).indexOf(x);
return this.localMandatoryFields[findIndex];
});
if(data.length>0){
this.localcount = 1;
this.editPdMaster(masterdetail,this.localcount);
if (data.length > 0) {
this.localcount = 1;
this.editPdMaster(masterdetail, this.localcount);
}
else {
let lenderMasterArray = {"pd_id": pdid}
let lenderMasterArray = { "pd_id": pdid }
this._pd.editPdMasterDetails(lenderMasterArray, this.pdStatusCheck.TRIGGERED).subscribe(result => {
if (result.status == 200) {
this.notifier.notify('success', 'PD Status Updated.');
this.viewPdDetails(this.viewID);
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
if (result.status == 200) {
this.notifier.notify('success', 'PD Status Updated.');
this.viewPdDetails(this.viewID);
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
@ -445,24 +416,24 @@ export class ViewPdComponent implements OnInit, OnDestroy {
}
// updateViewComponent(editBack:string) {
// if(editBack=='1'){
// this.showEditMasterComponent=!this.showEditMasterComponent
// }
// else if(editBack=='2'){
// this.showEditApplicantComponent=!this.showEditApplicantComponent
// }
// else if(editBack=='3'){
// this.showEditMasterComponent=!this.showEditMasterComponent
// }
// this.viewPdDetails(this.childData);
// }
ngOnDestroy(): void {
if(this.destroyType==1){
this.ListPdComponent.pdListLoad(true);
}
// updateViewComponent(editBack:string) {
// if(editBack=='1'){
// this.showEditMasterComponent=!this.showEditMasterComponent
// }
// else if(editBack=='2'){
// this.showEditApplicantComponent=!this.showEditApplicantComponent
// }
// else if(editBack=='3'){
// this.showEditMasterComponent=!this.showEditMasterComponent
// }
// this.viewPdDetails(this.childData);
// }
ngOnDestroy(): void {
if (this.destroyType == 1) {
this.ListPdComponent.pdListLoad(true);
}
}
}
}

View File

@ -64,8 +64,25 @@ export class PdTrigerService {
)
}
//get product and subproduct master details
getProductsDetails(): Observable<any> {
/* To get addresses From T_PD_ADDRESS table.,
* Used In 1) edit pd trigger component
* 2) Address Form
*/
getAddressesDetails(pdID): Observable<any> {
return this._http.post<any>(this.apiUrl + 'getPDAddress', { "pd_id": pdID })
.pipe(
catchError(this.handleError('role', []))
)
}
updatePDAddress(editData: any): Observable<any> {
return this._http.post<any>(this.apiUrl + "updatePDAddress", { "records": editData })
.pipe(
catchError(this.handleError('operation', []))
)
}
getProductsDetails():Observable<any> {
return this._http.get<any>(this.apiUrl + 'getListOfProducts')
.pipe(
catchError(this.handleError('role', []))