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;"> <div formArrayName="addresses" *ngFor="let addresses of pdAddresses.controls; let i = index;">
<mat-card-content [formGroupName]="i"> <mat-card-content [formGroupName]="i">
<mat-form-field style="width: 96%"> <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()" --> <!-- oninput="this.value = this.value.toUpperCase()" -->
<!-- <mat-error *ngIf="pdAddresses.addressline1.hasError('required')">Address1 required.</mat-error> --> <!-- <mat-error *ngIf="pdAddresses.addressline1.hasError('required')">Address1 required.</mat-error> -->
</mat-form-field> </mat-form-field>
@ -209,7 +209,7 @@
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 38%"> <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-error *ngIf="pdMain.mobile_no.hasError('maxlength') || pdMain.mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field> </mat-form-field>
@ -252,7 +252,7 @@
</mat-form-field> --> </mat-form-field> -->
<mat-form-field style="width: 38%"> <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-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> </mat-form-field>

View File

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

View File

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

View File

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

View File

@ -5,7 +5,10 @@
{{pageTitle}} {{pageTitle}}
</div> </div>
<div fxFlex="30" align="end" style="padding: 10px !important;"> <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> </div>
</h2> </h2>
@ -23,7 +26,8 @@
Select Select
</mat-option> </mat-option>
<!-- <mat-option *ngFor="let LL of lenderList" [value]="LL.entity_id" > --> <!-- <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" > <mat-option (click)="selectedLender(LL)" *ngFor="let LL of lenderList"
[value]="LL.entity_id">
{{LL.full_name}} {{LL.full_name}}
</mat-option> </mat-option>
</mat-select> </mat-select>
@ -32,23 +36,31 @@
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 29%"> <mat-form-field style="width: 29%">
<input matInput placeholder=" Loan Application ID" formControlName="lender_applicant_id" type="text" required> <input matInput placeholder=" Loan Application ID" formControlName="lender_applicant_id"
type="text" required>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 29%"> <mat-form-field style="width: 29%">
<input matInput placeholder="Lender Contact Person" formControlName="pd_contact_person" type="text" required> <input matInput placeholder="Lender Contact Person" formControlName="pd_contact_person"
type="text" required>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 29%"> <mat-form-field style="width: 29%">
<input matInput placeholder="Lender Mobile Number" formControlName="pd_contact_mobileno" type="text" (keypress)="keyPress($event)"> <input matInput placeholder="Lender Mobile Number" formControlName="pd_contact_mobileno"
<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> 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>
<mat-form-field style="width: 10%"> <mat-form-field style="width: 10%">
<input matInput placeholder="STD Code" formControlName="lender_stdcode" type="text" (keypress)="keyPress($event)"> <input matInput placeholder="STD Code" formControlName="lender_stdcode" type="text"
(keypress)="keyPress($event)">
<!-- <span matPrefix>+91</span> --> <!-- <span matPrefix>+91</span> -->
<mat-error *ngIf="pdMain.lender_stdcode.hasError('maxlength') || pdMain.lender_stdcode.hasError('minlength')">Enter Valid STD Code. </mat-error> <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> &nbsp;-&nbsp;
<mat-form-field style="width: 20%"> <mat-form-field style="width: 20%">
<input matInput placeholder="LandLine Number" formControlName="lender_landline" type="text" (keypress)="keyPress($event)"> <input matInput placeholder="LandLine Number" formControlName="lender_landline"
<mat-error *ngIf="pdMain.lender_landline.hasError('maxlength') || pdMain.lender_landline.hasError('minlength')">Enter Valid Landline Number. </mat-error> 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>
<mat-form-field style="width: 21.5%"> <mat-form-field style="width: 21.5%">
<mat-select placeholder="Branch" formControlName="pd_branch_id"> <mat-select placeholder="Branch" formControlName="pd_branch_id">
@ -62,7 +74,8 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 29%"> <mat-form-field style="width: 29%">
<mat-select placeholder="Product Name" formControlName="fk_product_id" (selectionChange)="getSubproductList(pdMain.fk_product_id.value)"> <mat-select placeholder="Product Name" formControlName="fk_product_id"
(selectionChange)="getSubproductList(pdMain.fk_product_id.value)">
<mat-option> <mat-option>
Select Select
</mat-option> </mat-option>
@ -108,58 +121,95 @@
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 62%"> <mat-form-field style="width: 62%">
<!-- <input matInput placeholder="Loan Amount" formControlName="loan_amount"> --> <!-- <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"> <input matInput placeholder="Loan Amount" formControlName="loan_amount"
<mat-hint align="start" style="font-size:90%" *ngIf="pdMain.loan_amount.value != ''">{{"&#8377;"}} {{loanAmtInWords}} Only</mat-hint> (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('required')">Amount Required.</mat-error> -->
<mat-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount. </mat-error> <mat-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount.
</mat-error>
</mat-form-field> </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%"> <mat-form-field style="width: 96%">
<textarea matInput placeholder="Address at which PD is to be done" formControlName="addressline1" style="text-transform: uppercase"></textarea> <textarea matInput autocomplete="off" placeholder="Address at which PD is to be done"
<!-- <mat-error *ngIf="pdMain.addressline1.hasError('required')">Address1 required.</mat-error> --> formControlName="addressline1" style="text-transform: uppercase"></textarea>
<!-- oninput="this.value = this.value.toUpperCase()" -->
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 29%;">
<mat-select placeholder="State" formControlName="fk_state" (selectionChange)="getCityList(pdMain.fk_state.value)"> <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> Select </mat-option>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id"> <mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.name}} {{SL.name}}
</mat-option> </mat-option>
</mat-select> </mat-select>
<!-- <mat-error *ngIf="pdMain.fk_state.hasError('required')">State Required.</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 29%;">
<mat-form-field style="width: 32%">
<mat-select placeholder="City" formControlName="fk_city"> <mat-select placeholder="City" formControlName="fk_city">
<mat-option> Select </mat-option> <mat-option> Select </mat-option>
<mat-option *ngFor="let CL of cityList" [value]="CL.city_id"> <mat-option *ngFor="let CL of cityList[i]" [value]="CL.city_id">
{{CL.city_name}} {{CL.city_name}}
</mat-option> </mat-option>
</mat-select> </mat-select>
<!-- <mat-error *ngIf="pdMain.fk_city.hasError('required')">City Required.</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 24%">
<mat-form-field style="width: 24%;"> <mat-select placeholder="Pincode" formControlName="pincode"
<!-- <input matInput placeholder="Pincode" formControlName="pincode" (keypress)="keyPress($event)"> (selectionChange)="getPincode($event.value,i)">
<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>Select</mat-option>
<mat-option *ngFor="let PL of pincodeList" [value]="PL.pincode_id">{{PL.pincode}}</mat-option> <mat-option *ngFor="let PL of pincodeList[i]" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 24%" *ngIf="pdMain.pincode.value == 1" > <mat-form-field style="width: 24%" *ngIf="pincodeflag[i]">
<input matInput autocomplete="off" placeholder="Specify Pincode" formControlName="other_pincode" (keypress)="keyPress($event)"> <!-- *ngIf="pdAddresses.pincode.value == 1" -->
<mat-error *ngIf="pdMain.other_pincode.hasError('pattern') || pdMain.other_pincode.hasError('maxlength') || pdMain.other_pincode.hasError('minlength')">Enter Valid Pincode. </mat-error> <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-form-field>
</mat-card-content> </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> </mat-card>
</div>
</mat-dialog-content> </mat-dialog-content>
<mat-dialog-actions> <mat-dialog-actions>
@ -172,20 +222,12 @@
<div fxFlex="30" align="end"> <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 *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="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> <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>
</mat-dialog-actions> </mat-dialog-actions>
</form> </form>
<notifier-container></notifier-container> <notifier-container></notifier-container>

View File

@ -12,25 +12,31 @@ import { PdTrigerService } from '../../../pd-service/pd-triger.service';
}) })
export class EditPdMasterComponent implements OnInit { export class EditPdMasterComponent implements OnInit {
public pageTitle: string = "PD Details"; public pageTitle: string = "PD Details";
pdid: any;
errorMessage: any; errorMessage: any;
productList:any; productList:any;
subProductList:any; subProductList:any;
lenderList:any; lenderList:any;
customerSegmentList:any; customerSegmentList:any;
stateList:any; stateList:any;
cityList:any; cityList:any = [];
pdTypeList:any; pdTypeList:any;
billingList:any; billingList:any;
lenderBranchList: any; lenderBranchList: any;
pincodeList: any = []; pincodeList: any = [];
addressesList : any = [];
addressesDeactivited : any = [];
applicantLength:number; applicantLength:number;
// draftStatus: string; // draftStatus: string;
// PDTriggerStatus: string; // PDTriggerStatus: string;
enablePDButton: boolean; enablePDButton: boolean;
currentPDStatus: string; currentPDStatus: string;
loanAmtInWords : any; loanAmtInWords : any;
pincodeflag : any = [];
public _EditPDtriggerForm:FormGroup; public _EditPDtriggerForm:FormGroup;
public notifier: NotifierService; public notifier: NotifierService;
addresses: FormArray;
// create values for status check // create values for status check
pdStatusCheck :any={ pdStatusCheck :any={
"DRAFT" :'DRAFT', "DRAFT" :'DRAFT',
@ -46,6 +52,7 @@ export class EditPdMasterComponent implements OnInit {
@Inject(MAT_DIALOG_DATA) public data: any) { @Inject(MAT_DIALOG_DATA) public data: any) {
this.notifier=notifier this.notifier=notifier
this.currentPDStatus = data.records.pd_status; 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); } 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.getCustomerSegmentList();
this.getStateCityList(); this.getStateCityList();
this.getPDTypeList(); this.getPDTypeList();
this.getAddresses();
this.loadFormData(); this.loadFormData();
this.applicantLength=this.data.applicantLength; this.applicantLength=this.data.applicantLength;
} }
@ -74,13 +82,16 @@ export class EditPdMasterComponent implements OnInit {
}, error => this.errorMessage = <any> error); }, error => this.errorMessage = <any> error);
} }
selectedLender(lender){ selectedLender(lender){
// console.log(JSON.stringify(lender));
// alert(JSON.stringify(lender['branches '])); // alert(JSON.stringify(lender['branches ']));
this.lenderBranchList = lender['branches']; this.lenderBranchList = lender['branches'];
// console.log(this.lenderBranchList);
this._EditPDtriggerForm.controls.pd_branch_id.setValue(null); this._EditPDtriggerForm.controls.pd_branch_id.setValue(null);
} }
getAddresses(){
}
getProductsList(){ getProductsList(){
this._pd.getProductsDetails().subscribe( this._pd.getProductsDetails().subscribe(
data => { data => {
@ -133,8 +144,6 @@ export class EditPdMasterComponent implements OnInit {
} }
loadFormData() { loadFormData() {
// console.log('this.data.record',this.data.records);
// console.log('this.reocrds',this.data.records.pincode_id);
let stdcode; let stdcode;
let landline; let landline;
if(this.data.records.pd_contact_landline){ if(this.data.records.pd_contact_landline){
@ -149,7 +158,7 @@ export class EditPdMasterComponent implements OnInit {
} }
} }
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) // 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
// : this.data.records.pincode; // : this.data.records.pincode;
@ -168,13 +177,45 @@ export class EditPdMasterComponent implements OnInit {
fk_pd_type: [this.data.records.fk_pd_type], fk_pd_type: [this.data.records.fk_pd_type],
fk_customer_segment: [this.data.records.fk_customer_segment], fk_customer_segment: [this.data.records.fk_customer_segment],
loan_amount: [this.data.records.loan_amount,Validators.compose([Validators.pattern('^[0-9]*$')])], loan_amount: [this.data.records.loan_amount,Validators.compose([Validators.pattern('^[0-9]*$')])],
  addressline1: [this.data.records.addressline1.toUpperCase()], addresses: this._fb.array([]),
fk_city: [this.data.records.fk_city], //   addressline1: [this.data.records.addressline1.toUpperCase()],
fk_state: [this.data.records.fk_state], // fk_city: [this.data.records.fk_city],
  pincode : [this.data.records.pincode_id], // fk_state: [this.data.records.fk_state],
other_pincode:[this.data.records.other_pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])], //   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], 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; } get pdMain() { return this._EditPDtriggerForm.controls; }
@ -192,17 +233,85 @@ export class EditPdMasterComponent implements OnInit {
// this.cityList=this.cityList[0].cities; // this.cityList=this.cityList[0].cities;
// } // }
//get city list details based on state id //get city list details based on state id
getCityList(stateID:string){ getCityList(stateID:string,i){
// console.log('getCityList',stateID);
this._pd.getStateWiseCities(stateID).subscribe(data=>{ this._pd.getStateWiseCities(stateID).subscribe(data=>{
if (data.status == 200) { if (data.status == 200) {
// console.log(data);
this.cityList = data.records.cities; this.cityList[i] = data.records.cities;
this.pincodeList = data.records.pincode; 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 // save pd in draft
saveDraftPD(formValue: any, status:string){ saveDraftPD(formValue: any, status:string){
@ -211,7 +320,7 @@ export class EditPdMasterComponent implements OnInit {
} }
//trigger pd //trigger pd
triggerPD(formValue: any, status:any){ triggerPD(formValue: any, status:any){
// console.log('triggerPD',formValue);
// this._EditPDtriggerForm.controls['fk_lender_id'].setValidators([Validators.required]); // this._EditPDtriggerForm.controls['fk_lender_id'].setValidators([Validators.required]);
// this._EditPDtriggerForm.controls['fk_lender_id'].updateValueAndValidity(); // 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'].clearValidators();
this._EditPDtriggerForm.controls['loan_amount'].updateValueAndValidity(); this._EditPDtriggerForm.controls['loan_amount'].updateValueAndValidity();
this._EditPDtriggerForm.controls['addressline1'].clearValidators(); // this._EditPDtriggerForm.controls['addressline1'].clearValidators();
this._EditPDtriggerForm.controls['addressline1'].updateValueAndValidity(); // this._EditPDtriggerForm.controls['addressline1'].updateValueAndValidity();
this._EditPDtriggerForm.controls['fk_city'].clearValidators(); // this._EditPDtriggerForm.controls['fk_city'].clearValidators();
this._EditPDtriggerForm.controls['fk_city'].updateValueAndValidity(); // this._EditPDtriggerForm.controls['fk_city'].updateValueAndValidity();
this._EditPDtriggerForm.controls['fk_state'].clearValidators(); // this._EditPDtriggerForm.controls['fk_state'].clearValidators();
this._EditPDtriggerForm.controls['fk_state'].updateValueAndValidity(); // this._EditPDtriggerForm.controls['fk_state'].updateValueAndValidity();
this._EditPDtriggerForm.controls['pincode'].clearValidators(); // this._EditPDtriggerForm.controls['pincode'].clearValidators();
this._EditPDtriggerForm.controls['pincode'].updateValueAndValidity(); // this._EditPDtriggerForm.controls['pincode'].updateValueAndValidity();
this.validateAllFormFields(this._EditPDtriggerForm); this.validateAllFormFields(this._EditPDtriggerForm);
} }
@ -290,7 +399,7 @@ export class EditPdMasterComponent implements OnInit {
submitPdDetails(formValue: any, status:any) { 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 == this.pdStatusCheck.DRAFT ? status : this.currentPDStatus == this.pdStatusCheck.TRIGGERED ? status : this.currentPDStatus;
let updateStatus = this.currentPDStatus; let updateStatus = this.currentPDStatus;
// console.log(this._EditPDtriggerForm.value);
if(status != 1){ if(status != 1){
if(this._EditPDtriggerForm.invalid) { if(this._EditPDtriggerForm.invalid) {
this.validateAllFormFields(this._EditPDtriggerForm); this.validateAllFormFields(this._EditPDtriggerForm);
@ -319,8 +428,8 @@ export class EditPdMasterComponent implements OnInit {
return; return;
} }
else{ else{
// console.log('my_array.addresses',my_array.addresses);
let filteredAddressesdata = my_array.addresses.filter(item => item.isactive == 1);
let lenderMasterArray = { let lenderMasterArray = {
"pd_id": my_array.pd_id, "pd_id": my_array.pd_id,
"fk_lender_id": my_array.fk_lender_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_pd_type": my_array.fk_pd_type,
"fk_customer_segment": my_array.fk_customer_segment, "fk_customer_segment": my_array.fk_customer_segment,
"loan_amount": my_array.loan_amount, "loan_amount": my_array.loan_amount,
  "addressline1": my_array.addressline1.toUpperCase(),   "addressline1": filteredAddressesdata[0].addressline1.toUpperCase(),
"fk_city": my_array.fk_city, "fk_city": filteredAddressesdata[0].fk_city,
"fk_state": my_array.fk_state, "fk_state": filteredAddressesdata[0].fk_state,
  "pincode": my_array.pincode,   "pincode": filteredAddressesdata[0].pincode,
"other_pincode":my_array.other_pincode, "other_pincode":filteredAddressesdata[0].other_pincode,
"remarks": my_array.remarks, "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 => { this._pd.editPdMasterDetails(lenderMasterArray, updateStatus).subscribe(result => {
if (result.status == 200) { if (result.status == 200) {
this.notifier.notify('success', 'PD Details Updated.'); this.notifier.notify('success', 'PD Details Updated.');

View File

@ -21,20 +21,25 @@
<div fxLayout="row wrap"> <div fxLayout="row wrap">
<div fxFlex="100"> <div fxFlex="100">
<mat-card style="min-height: 550px;"> <mat-card style="min-height: 550px;">
<mat-card-content> <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 fxLayout="row wrap">
<div fxFlex="100"> <div fxFlex="100">
<mat-form-field style="width: 96%"> <mat-form-field style="width: 96%">
<input matInput placeholder="Address" formControlName="address" oninput="this.value = this.value.toUpperCase()" <input matInput placeholder="Address" formControlName="address"
required autocomplete="off"> oninput="this.value = this.value.toUpperCase()" required
autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="100" fxLayout="nowrap"> <div fxFlex="100" fxLayout="nowrap">
<mat-form-field style="width: 32%"> <mat-form-field style="width: 32%">
<mat-select placeholder="State" formControlName="state" <mat-select placeholder="State" formControlName="state"
(selectionChange)="getcityList($event.target.value)"> (selectionChange)="getcityList($event.target.value,i)">
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option *ngFor="let SL of stateData" [value]="SL.state_id">{{SL.name}}</mat-option> <mat-option *ngFor="let SL of stateData" [value]="SL.state_id">{{SL.name}}</mat-option>
</mat-select> </mat-select>
@ -43,22 +48,22 @@
<mat-form-field style="width: 32%"> <mat-form-field style="width: 32%">
<mat-select placeholder="City" formControlName="city"> <mat-select placeholder="City" formControlName="city">
<mat-option> Select </mat-option> <mat-option> Select </mat-option>
<mat-option *ngFor="let CL of cityData" [value]="CL.city_id">{{CL.city_name}}</mat-option> <mat-option *ngFor="let CL of cityData[i]" [value]="CL.city_id">{{CL.city_name}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 24%"> <mat-form-field style="width: 24%">
<mat-select placeholder="Pincode" formControlName="pincode"> <mat-select placeholder="Pincode" formControlName="pincode">
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option *ngFor="let PL of pincodeData" [value]="PL.pincode_id">{{PL.pincode}}</mat-option> <mat-option *ngFor="let PL of pincodeData[i]" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 24%" *ngIf="addressForm.controls['pincode'].value == 1"> <mat-form-field style="width: 24%" *ngIf="item.get('pincode').value == 1">
<input matInput autocomplete="off" placeholder="Specify Pincode *" <input matInput autocomplete="off" placeholder="Specify Pincode *"
formControlName="pincode_others" (keypress)="keyPress($event)"> formControlName="pincode_others" (keypress)="keyPress($event)">
<mat-error *ngIf="!addressForm.controls['pincode_others'].valid">Pincode <!-- <mat-error *ngIf="!addressForm.controls['pincode_others'].valid">Pincode
Required</mat-error> Required</mat-error> -->
</mat-form-field> </mat-form-field>
</div> </div>
@ -66,42 +71,45 @@
<div fxFlex="100"> <div fxFlex="100">
<mat-form-field style="width: 46%;"> <mat-form-field style="width: 46%;">
<mat-select placeholder="Address Type" formControlName="address_type" <mat-select placeholder="Address Type" formControlName="address_type"
required (selectionChange)="selectedAddressType($event.source.triggerValue)"> required (selectionChange)="selectedAddressType($event.source.triggerValue,i)">
<mat-option>Select</mat-option> <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 value="{{m_addressType.address_type_id}}"
*ngFor="let m_addressType of addressData">{{m_addressType.address_type}}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 46%;" *ngIf="addressForm.controls['address_type'].value == 1"> <mat-form-field style="width: 46%;" *ngIf="item.get('address_type').value == 1">
<input matInput placeholder="Specify Address Type *" formControlName="address_type_others" <input matInput placeholder="Specify Address Type *"
autocomplete="off" (change)="selectedAddressType($event.target.value)"> formControlName="address_type_others" autocomplete="off"
<mat-error *ngIf="!addressForm.controls['address_type_others'].valid">Address Type Required</mat-error> (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>
</div> </div>
<div fxFlex="100"> <div fxFlex="100">
<mat-form-field style="width: 46%;"> <mat-form-field style="width: 46%;">
<mat-select placeholder="Locality" formControlName="locality" required> <mat-select placeholder="Locality" formControlName="locality"
required>
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option value="{{m_locality.locality_id}}" *ngFor="let m_locality of localityData">{{m_locality.locality_name}} <mat-option value="{{m_locality.locality_id}}" *ngFor="let m_locality of localityData">{{m_locality.locality_name}}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 46%;" *ngIf="addressForm.controls.locality.value == 1"> <mat-form-field style="width: 46%;" *ngIf="item.get('locality').value == 1">
<input matInput placeholder="Specify Locality *" formControlName="locality_others" <input matInput placeholder="Specify Locality *"
autocomplete="off"> formControlName="locality_others" autocomplete="off">
<!-- autofocus --> <!-- autofocus -->
<mat-error *ngIf="!addressForm.controls['locality_others'].valid">Locality Required</mat-error> <!-- <mat-error *ngIf="!addressForm.controls['locality_others'].valid">Locality Required</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 46%;" *ngIf="addressForm.controls.locality.value == 5"> <mat-form-field style="width: 46%;" *ngIf="item.get('locality').value == 5">
<input matInput placeholder="Specify the MixUse *" formControlName="locality_mixuse" <input matInput placeholder="Specify the MixUse *"
autocomplete="off"> formControlName="locality_mixuse" autocomplete="off">
<mat-error *ngIf="!addressForm.controls['locality_mixuse'].valid">MixUse <!-- <mat-error *ngIf="!addressForm.controls['locality_mixuse'].valid">MixUse
Required</mat-error> Required</mat-error> -->
</mat-form-field> </mat-form-field>
</div> </div>
@ -109,8 +117,8 @@
<div fxFlex="100"> <div fxFlex="100">
<mat-form-field style="width: 46%;"> <mat-form-field style="width: 46%;">
<mat-select placeholder="Approach to PD Location" formControlName="pd_location" <mat-select placeholder="Approach to PD Location"
required> formControlName="pd_location" required>
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option value="{{data.pd_location_approach_id}}" *ngFor="let data of locationdata">{{data.description}} <mat-option value="{{data.pd_location_approach_id}}" *ngFor="let data of locationdata">{{data.description}}
</mat-option> </mat-option>
@ -130,7 +138,7 @@
<div fxFlex="100" fxLayout="nowrap"> <div fxFlex="100" fxLayout="nowrap">
<mat-form-field style="width: 46%;"> <mat-form-field style="width: 46%;">
<input matInput [placeholder]="placeholderName" formControlName="estimated_area" <input matInput [placeholder]="placeholderName[i] ? placeholderName[i] : 'Estimated area of the (Address Type)'" formControlName="estimated_area"
(keypress)="keyPress($event)"> (keypress)="keyPress($event)">
</mat-form-field> </mat-form-field>
@ -141,18 +149,30 @@
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 24%;" *ngIf="addressForm.controls['uom'].value == 1 "> <mat-form-field style="width: 24%;" *ngIf="item.get('uom').value == 1 ">
<input matInput placeholder="Specify UOM *" formControlName="uom_others" <input matInput placeholder="Specify UOM *" formControlName="uom_others"
autocomplete="off"> autocomplete="off">
<mat-error *ngIf="!addressForm.controls['uom_others'].valid">UOM <!-- <mat-error *ngIf="!addressForm.controls['uom_others'].valid">UOM
Required</mat-error> Required</mat-error> -->
</mat-form-field> </mat-form-field>
</div> </div>
</div> </div>
<!-- <button type="button" matTooltip="Add More Address Details" class="mr-1 mb-1 hover-icon" matTooltipPosition="above" mat-raised-button mat-icon-button *ngIf="i==0"
(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> </mat-card-content>
</div>
</div>
</mat-card> </mat-card>
</div> </div>
</div> </div>
@ -317,7 +337,7 @@
<div fxFlex="40" align="end"> <div fxFlex="40" align="end">
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="submit" matTooltip="Save" matTooltipPosition="above"><mat-icon>save</mat-icon></button> --> <!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" type="submit" matTooltip="Save" matTooltipPosition="above"><mat-icon>save</mat-icon></button> -->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above"
type="submit" (click)="onSubmit()"> type="submit" (click)="onSubmit()" [disabled]="disableAfterSubmit===true">
<mat-icon>save</mat-icon> <mat-icon>save</mat-icon>
</button> </button>
</div> </div>

View File

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

View File

@ -21,6 +21,7 @@
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 20%" *ngIf="data.margin_calculation_status===true"> <mat-form-field style="width: 20%" *ngIf="data.margin_calculation_status===true">
<input matInput OnlyNumber type="text" placeholder="Margin Value" formControlName="margin_value" readonly> <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> </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" <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"> matTooltip="Remove" matTooltipPosition="above">

View File

@ -19,6 +19,7 @@ export class ManageDailySalesComponent implements OnInit {
salesItemForm:FormGroup; salesItemForm:FormGroup;
UOMData: any[]=[]; UOMData: any[]=[];
frequencyData: any[]=[]; frequencyData: any[]=[];
marginAmtInwords: any[]=[];
private notifier: NotifierService; private notifier: NotifierService;
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<ManageDailySalesComponent>) { 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'; 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({ this.salesItemForm = this._fb.group({
sales_product: this._fb.array([this.createSalesItemWithData(this.data.editData)]), 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']; let control: any = <FormArray>this.salesItemForm.controls['sales_product'];
control = control.controls[0].get('child') as FormArray; 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)) control.push(this.createDailySalesWithData(elementVal,this.data.editData.sim_id))
this.inWords(elementVal.sales_value,inx,1);
}); });
} }
else{ else{
@ -161,6 +164,7 @@ salesCalculation(indexVal: number,values: any): void {
let getTotalValueCounts = transformData.map(val=>val.sales_value) let getTotalValueCounts = transformData.map(val=>val.sales_value)
.reduce((sum, curr) => parseInt(sum) + parseInt(curr)); .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))); 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{ else{
control.controls[indexVal].controls['margin_value'].setValue(''); control.controls[indexVal].controls['margin_value'].setValue('');
@ -219,6 +223,10 @@ submitDetails(records) {
case 1 : case 1 :
this.Value[c] = this._pd.convertNumberToWords(e); this.Value[c] = this._pd.convertNumberToWords(e);
break; 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 fxLayout="row wrap" *ngFor="let item of businessIncomeItemForm.controls.busIncome['controls']; let s = index;" [formGroupName]="s">
<div fxFlex="100"> <div fxFlex="100">
<mat-form-field style="width: 87%"> <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-option *ngFor="let income of businessIncomeData" [value]="income.business_income_id">{{income.business_income_item}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>

View File

@ -23,8 +23,7 @@
</div> </div>
<div class="item-margin" fxFlex="100"> <div class="item-margin" fxFlex="100">
<mat-form-field style="width: 25%"> <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> <input OnlyNumber type="text" matInput placeholder="Sale Quantity" (keyup)="salesCalculation(s,sales.value);" 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>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 25%"> <mat-form-field style="width: 25%">
<mat-select placeholder="UOM" formControlName="fk_uom_id" required> <mat-select placeholder="UOM" formControlName="fk_uom_id" required>
@ -33,6 +32,7 @@
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 25%"> <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> <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> </mat-form-field>
</div> </div>
@ -42,8 +42,9 @@
<mat-option *ngFor="let frq of frequencyData" [value]="frq.frequency_id">{{frq.name}}</mat-option> <mat-option *ngFor="let frq of frequencyData" [value]="frq.frequency_id">{{frq.name}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </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> <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> </mat-form-field>
</div> </div>
<div class="item-margin" fxFlex="100" *ngIf="data.margin_calculation_status===true"> <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)"> <input matInput OnlyNumber type="text" placeholder="Margin Percentage %" formControlName="margin_per" (keyup)="salesMarginPerCalculation(s,sales.value)">
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 25%"> <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>
<mat-form-field style="width: 25%"> <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> </mat-form-field>
</div> </div>

View File

@ -10,11 +10,18 @@ import { NotifierService } from 'angular-notifier';
styleUrls: ['./manage-sales.component.scss'] styleUrls: ['./manage-sales.component.scss']
}) })
export class ManageSalesComponent implements OnInit { export class ManageSalesComponent implements OnInit {
Sale_Quantity: any[]=[];
pageTitle: string; pageTitle: string;
salesItemForm:FormGroup; salesItemForm:FormGroup;
UOMData: any[]=[]; UOMData: any[]=[];
frequencyData: any[]=[]; frequencyData: any[]=[];
//Declaration for Amout INwords.
annualSaleAmtInwords: any[]=[];
marginAmtInwords: any[]=[];
marginFinalAmtInwords: any[]=[];
ratePerUnitAmtInwords: any[]=[];
private notifier: NotifierService; private notifier: NotifierService;
constructor(notifier: NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService, @Inject(MAT_DIALOG_DATA) public data: any, private dialogRef: MatDialogRef<ManageSalesComponent>) { 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; this.UOMData=this.data.masterData.UOMList;
@ -28,6 +35,20 @@ export class ManageSalesComponent implements OnInit {
this.salesItemForm = this._fb.group({ this.salesItemForm = this._fb.group({
salesCalItemwise: this._fb.array([this.createSalesItemWithData(this.data.editData)]), 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{ else{
this.salesItemForm = this._fb.group({ this.salesItemForm = this._fb.group({
@ -87,9 +108,14 @@ closeDialogue(){
salesCalculation(indexVal: number,values: any): void { salesCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise']; 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!='') { 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 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)); 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 { else {
@ -104,6 +130,7 @@ salesMarginPerCalculation(indexVal: number,values: any): void {
control.controls[indexVal].controls['margin_per_uom'].setValue(''); control.controls[indexVal].controls['margin_per_uom'].setValue('');
if(values.margin_per!='' && values.annual_sale_value!='') { 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)); 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 { else {
control.controls[indexVal].controls['margin_final_value'].setValue(''); control.controls[indexVal].controls['margin_final_value'].setValue('');
@ -112,8 +139,14 @@ salesMarginPerCalculation(indexVal: number,values: any): void {
salesMarginAmtCalculation(indexVal: number,values: any): void { salesMarginAmtCalculation(indexVal: number,values: any): void {
let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise']; let control:any = <FormArray>this.salesItemForm.controls['salesCalItemwise'];
control.controls[indexVal].controls['margin_per'].setValue(''); 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!='') { 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)); control.controls[indexVal].controls['margin_final_value'].setValue(parseInt(values.sales_qty) * parseInt(values.margin_per_uom));
this.inWords(MarginFinalValue,indexVal,3)
} }
else { else {
control.controls[indexVal].controls['margin_final_value'].setValue(''); control.controls[indexVal].controls['margin_final_value'].setValue('');
@ -157,12 +190,20 @@ submitDetails(records) {
}); });
} }
inWords(e,s,flag){ inWords(value,inx,flag){
switch(flag){ switch(flag){
case 1 : case 1 :
this.Sale_Quantity[s] = this._pd.convertNumberToWords(e); this.annualSaleAmtInwords[inx] = this._pd.convertNumberToWords(value);
break; 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-group #matgroup>
<mat-tab label="Summary"> <mat-tab label="Summary">
<ng-template matTabContent> <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>
<mat-card-content> <mat-card-content>
<!-- this is for sales revenue --> <!-- this is for sales revenue -->
@ -302,11 +309,11 @@
<!-- end assessed income tabs control --> <!-- end assessed income tabs control -->
</mat-dialog-content> </mat-dialog-content>
<mat-dialog-actions align="end"> <!-- <mat-dialog-actions align="end">
<button type="button" mat-flat-button (click)="completeAI()" <button type="button" mat-flat-button (click)="completeAI()"
matTooltip="Complete Assessed Income" matTooltipPosition="above" color="primary"> matTooltip="Complete Assessed Income" matTooltipPosition="above" color="primary">
<strong>Complete</strong> <strong>Complete</strong>
</button> </button>
</mat-dialog-actions> </mat-dialog-actions> -->
<notifier-container></notifier-container> <notifier-container></notifier-container>

View File

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

View File

@ -19,7 +19,7 @@
<mat-card-header> <mat-card-header>
<mat-card-title> <mat-card-title>
<small class="expan_table_header">{{expandDetails.salesItem}}</small> <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-title>
<mat-card-subtitle *ngFor="let footer of expandDetails.footerMessage"> <mat-card-subtitle *ngFor="let footer of expandDetails.footerMessage">

View File

@ -31,3 +31,7 @@ tr.mat-footer-row {
.delete-margin { .delete-margin {
margin-left: 3%; 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-option *ngFor="let getData of check__purchse_type" [value]="getData.id">{{getData.name}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </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-select placeholder="Sales Type" formControlName="margin">
<mat-option *ngFor="let getSale of check_sales_type" [value]="getSale.id">{{getSale.name}}</mat-option> <mat-option *ngFor="let getSale of check_sales_type" [value]="getSale.id">{{getSale.name}}</mat-option>
</mat-select> </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 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> </button>

View File

@ -24,7 +24,14 @@ export class GrossProfitCalculationComponent implements OnInit, OnChanges {
} }
changeOptions(values: any){ changeOptions(values: any){
// console.log('values',values);
this.grossProfitForm.controls['margin'].setValue(''); 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){ submitDetails(records: any){
if (this.grossProfitForm.invalid) { if (this.grossProfitForm.invalid) {

View File

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

View File

@ -3,16 +3,19 @@
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<mat-card-title>Sales Calculation</mat-card-title> <mat-card-title>Sales Calculation</mat-card-title>
</mat-card-header> </mat-card-header>{{activateMariginCalculation}}
<mat-card-content> <mat-card-content>
<mat-form-field style="width: 82%"> <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> <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> </mat-form-field>
<!-- {{salesCalculationForm.value.sales_declared_by_customer}} -->
<mat-form-field style="width: 40%" *ngIf="activateMariginCalculation"> <mat-form-field style="width: 40%" *ngIf="activateMariginCalculation">
<input matInput OnlyNumber type="text" placeholder="Margin Percentage %" formControlName="margin_per" (keyup)="salesCalculation(salesCalculationForm.value)" required> <input matInput OnlyNumber type="text" placeholder="Margin Percentage %" formControlName="margin_per" (keyup)="salesCalculation(salesCalculationForm.value)" required>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 40%" *ngIf="activateMariginCalculation"> <mat-form-field style="width: 40%" *ngIf="activateMariginCalculation">
<input matInput OnlyNumber type="text" placeholder="Margin Value" formControlName="margin_value" readonly> <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> </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 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> </button>

View File

@ -15,6 +15,8 @@ export class SalesCalculationComponent implements OnInit, OnChanges, DoCheck {
salesCalculationForm:FormGroup; salesCalculationForm:FormGroup;
activateMariginCalculation: boolean; activateMariginCalculation: boolean;
private notifier: NotifierService; private notifier: NotifierService;
SaleAmtInwords : any;
marginAmtInwords: any;
constructor(notifier:NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService) { constructor(notifier:NotifierService,private _fb: FormBuilder, private _pd: PdTrigerService) {
this.activateMariginCalculation=false; this.activateMariginCalculation=false;
this.notifier = notifier; this.notifier = notifier;
@ -23,9 +25,12 @@ export class SalesCalculationComponent implements OnInit, OnChanges, DoCheck {
ngOnInit() { ngOnInit() {
} }
salesCalculation(values): void { 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 !='') 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.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 // save sales calculations details
@ -60,7 +65,9 @@ validateAllFormFields(formGroup: any) {
// do check component bases // do check component bases
ngDoCheck() { 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){ 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; 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 //detect chnges from parent
ngOnChanges(changes: SimpleChanges) { 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){
if(changes.masterData.currentValue.grossProfitTypeList.length>0){ 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; 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){
if(changes.parentData.currentValue.length>0){ 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({ this.salesCalculationForm = this._fb.group({
sdc_id:[changes.parentData.currentValue[changes.parentData.currentValue.length-1].sdc_id], 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])], 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 [formGroupName]="s">
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none"> <div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:45%"> <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>Select</mat-option>
<mat-option *ngFor="let prop of m_propertyType" [value]="prop.id">{{ prop.name }}</mat-option> <mat-option *ngFor="let prop of m_propertyType" [value]="prop.id">{{ prop.name }}</mat-option>
</mat-select> </mat-select>
@ -51,6 +51,31 @@
<input matInput placeholder="Specify Other Property Type" formControlName="other_property_type" autocomplete="off"> <input matInput placeholder="Specify Other Property Type" formControlName="other_property_type" autocomplete="off">
</mat-form-field> </mat-form-field>
</div> </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> </div>
</div> </div>
@ -254,8 +279,8 @@
<!-- <mat-select placeholder="Name of the Owner" formControlName="name_of_the_owner" > <!-- <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-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name | titlecase}}</mat-option>
</mat-select> --> </mat-select> -->
<mat-select placeholder="Name of the Owner" <mat-select multiple placeholder="Name of the Owner"
formControlName="name_of_the_owner" [compareWith]="compareObjects" required (selectionChange)="setRequiredValidation($event.value.id,sup,4)"> 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-optgroup *ngFor="let group of mergeCompanyApplicant" [label]="group.groupName">
<mat-option *ngFor="let val of group.groupValues" [value]="val"> <mat-option *ngFor="let val of group.groupValues" [value]="val">
{{val.name}} {{val.name}}
@ -264,7 +289,7 @@
</mat-select> </mat-select>
</mat-form-field> </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" <input matInput placeholder="Specify Owner Name"
formControlName="other_owner" autocomplete="off"> formControlName="other_owner" autocomplete="off">
</mat-form-field> </mat-form-field>
@ -463,7 +488,7 @@
</div> </div>
<div fxFlex="40" align="end"> <div fxFlex="40" align="end">
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="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="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> </div>
</mat-dialog-actions> </mat-dialog-actions>
</form> </form>

View File

@ -45,6 +45,9 @@ export class AssetsInfoComponent implements OnInit {
public applicants: any; public applicants: any;
otherEmiamtFlag : boolean = false; otherEmiamtFlag : boolean = false;
businessEmiAmtFlag : boolean = false; businessEmiAmtFlag : boolean = false;
isOtherOwner:any = [];
disableAfterSubmit : boolean = false;
public m_any_asset_loan_type = [{'value': "yes",'viewValue': "Yes"}, public m_any_asset_loan_type = [{'value': "yes",'viewValue': "Yes"},
{'value': "no",'viewValue': "No"}, {'value': "no",'viewValue': "No"},
{'value': "nan",'viewValue': "NA"}] {'value': "nan",'viewValue': "NA"}]
@ -71,6 +74,8 @@ export class AssetsInfoComponent implements OnInit {
public m_vehicle_type = []; public m_vehicle_type = [];
public m_uom_type = [];
private notifier: NotifierService; private notifier: NotifierService;
existCompanyList: any =[]; existCompanyList: any =[];
mergeCompanyApplicant: any=[]; mergeCompanyApplicant: any=[];
@ -117,11 +122,13 @@ export class AssetsInfoComponent implements OnInit {
// this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid,'').subscribe(data => { // this.pdTrigerService.getTypeofActivityForSuppliedInfoForm(this.pdid,'').subscribe(data => {
// this.businessProfessionName = (data.status == 200) ? data.records.profession_name : '' ; // this.businessProfessionName = (data.status == 200) ? data.records.profession_name : '' ;
// }); // });
this.pdTrigerService.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{ this.pdTrigerService.getCompaniesListsForBusiness(this.pdid).subscribe(data=>{
if (data.dataStatus) { if (data.dataStatus) {
this.existCompanyList = data.records.filter(val =>val.is_active===true && val.is_company_applicant===true); this.existCompanyList = data.records.filter(val => val.is_active === true);
} }
// get company list
let modifyCompanyList: any = []; let modifyCompanyList: any = [];
if (this.existCompanyList.length > 0) { if (this.existCompanyList.length > 0) {
modifyCompanyList = this.existCompanyList.map(element => { modifyCompanyList = this.existCompanyList.map(element => {
@ -129,8 +136,6 @@ export class AssetsInfoComponent implements OnInit {
}); });
this.mergeCompanyApplicant.push({ groupName: 'COMPANIES', groupValues: modifyCompanyList }) this.mergeCompanyApplicant.push({ groupName: 'COMPANIES', groupValues: modifyCompanyList })
} }
})
// get applicant list // get applicant list
let modifyApplicantList: any=[]; let modifyApplicantList: any=[];
if(this.applicants.length > 0){ if(this.applicants.length > 0){
@ -141,6 +146,7 @@ export class AssetsInfoComponent implements OnInit {
} }
})
this.getPdSupplierFormDetails(); this.getPdSupplierFormDetails();
this.getM_Assets_Type(); this.getM_Assets_Type();
this.getM_PropertyType(); this.getM_PropertyType();
@ -149,6 +155,7 @@ export class AssetsInfoComponent implements OnInit {
//this.getM_Relation(); //this.getM_Relation();
//this.getM_InsuranceType(); //this.getM_InsuranceType();
this.getM_Vehicle_Type(); 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() { // getM_InsuranceType() {
// this.pdTrigerService.getAllMasterDatas('INSURANCETYPE').subscribe( // this.pdTrigerService.getAllMasterDatas('INSURANCETYPE').subscribe(
// data => { // data => {
@ -372,7 +388,12 @@ export class AssetsInfoComponent implements OnInit {
loadProperty() { loadProperty() {
return this._formBuilder.group({ return this._formBuilder.group({
property_type: [''], 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) { loadPropertyWithData(data) {
return this._formBuilder.group({ return this._formBuilder.group({
property_type: [data.property_type], 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:[''] //property_type:['']
}); });
} }
@ -569,11 +595,7 @@ export class AssetsInfoComponent implements OnInit {
var result = Object.keys(supp_data).map(function (key) { var result = Object.keys(supp_data).map(function (key) {
return supp_data[key]; return supp_data[key];
}); });
result.forEach((datas,index) => {
this.OtherAppxMarketAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.approximate_market_value);
});
if (result.length > 0) { if (result.length > 0) {
for (let val of result) { for (let val of result) {
let vals = { let vals = {
@ -588,9 +610,21 @@ export class AssetsInfoComponent implements OnInit {
emi: val.emi, emi: val.emi,
}; };
const control = <FormArray>this._assetsQuesFrom.controls['assets_details']; 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)); control.push(this.initDetailsWithdata(vals));
this.setAssetsDetailsWithData(vals.assets_mode, val.details, control.length - 1) 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; this.loadDetails = true;
} }
@ -626,7 +660,10 @@ export class AssetsInfoComponent implements OnInit {
case '2': { case '2': {
let array_data : any; let array_data : any;
data.forEach((datas,i) => { 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; const control = (<FormArray>this._assetsQuesFrom.controls['assets_details']).at(val).get('details') as FormArray;
control.push(this.loadPropertyWithData(array_data)); control.push(this.loadPropertyWithData(array_data));
@ -764,8 +801,10 @@ export class AssetsInfoComponent implements OnInit {
// stop here if form is invalid // stop here if form is invalid
if (this._assetsQuesFrom.invalid) { if (this._assetsQuesFrom.invalid) {
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
this.disableAfterSubmit = false;
return; return;
} else { } else {
this.disableAfterSubmit = true;
var answerFormValues = this._assetsQuesFrom.value; var answerFormValues = this._assetsQuesFrom.value;
//To Remove The "Null" With Key also //To Remove The "Null" With Key also
@ -777,13 +816,16 @@ export class AssetsInfoComponent implements OnInit {
this.notifier.notify('success', 'Saved Successfully.'); this.notifier.notify('success', 'Saved Successfully.');
setTimeout(() =>{ setTimeout(() =>{
this.dialogRef.close(); this.dialogRef.close();
this.disableAfterSubmit = false;
},3000); },3000);
} }
else { else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
this.disableAfterSubmit = false;
} }
}, error => { }, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
this.disableAfterSubmit = false;
// this.dialogRef.close(); // this.dialogRef.close();
}); });
//After Saving the BRANCH data then popup close //After Saving the BRANCH data then popup close
@ -829,39 +871,76 @@ 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){ if(flag == 1){
value==1 value==1
? item.controls.other_property_type.setValidators([Validators.required])
: item.controls.other_property_type.clearValidators(); // ? controls2[ChdInx].controls.other_property_type.setValidators([Validators.required])
item.controls.other_property_type.updateValueAndValidity(); // : 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 == 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 == 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) { if (flag == 4) {
value==0 let Avaliablity = 1;
? item.controls.other_owner.setValidators([Validators.required]) // console.log('val',value);
: item.controls.other_owner.clearValidators(); value.forEach(option => {
item.controls.other_owner.updateValueAndValidity(); if(option.id == 0 && option.group_id == 2){
Avaliablity = option.id;
} }
if(flag == 5){ });
value==1 if(Avaliablity == 0){
? item.controls.other_vehicle_type.setValidators([Validators.required]) // console.log('if Avaliablity',Avaliablity);
: item.controls.other_vehicle_type.clearValidators(); // console.log('if this.isOtherOwner[ParInx]',this.isOtherOwner[ParInx]);
item.controls.other_vehicle_type.updateValueAndValidity(); 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 == 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();
// }
} }
/** Amount InWords */ /** Amount InWords */

View File

@ -15,19 +15,22 @@
<mat-tab-group> <mat-tab-group>
<mat-tab label={{pageTitle}}> <mat-tab label={{pageTitle}}>
<ng-template matTabContent> <ng-template matTabContent>
<div fxLayout="row wrap"> <div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<div fxFlex="100"> <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>
<mat-card-header> <mat-card-header>
<mat-card-title> <mat-card-title>
<p>Address Details {{addressLabel | titlecase}}</p> <p>Address Details {{ " : " + itemrow.get('address_label').value | titlecase}}</p>
</mat-card-title> </mat-card-title>
</mat-card-header> </mat-card-header>
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none"> <div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
<mat-form-field style="width: 95%;"> <mat-form-field style="width: 95%;">
<mat-select placeholder="is this the business address ? " (selectionChange)="setRequiredValidation($event.value,'',1);" <mat-select placeholder="is this the business address ? " (selectionChange)="setRequiredValidation($event.value,itemrow,1);"
formControlName="business_address_availability" required> formControlName="business_address_availability" required>
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
@ -36,20 +39,20 @@
</mat-form-field> </mat-form-field>
</div> </div>
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none" *ngIf=" _businessAssetsQuesFrom.controls['business_address_availability'].value == 'yes'"> <div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none" *ngIf=" itemrow.get('business_address_availability').value == 'yes'">
<div style="width:95%"> <div style="width:95%">
<label style="padding-left:2%">How long has business been operated from this premise?</label> <label style="padding-left:2%">How long has business been operated from this premise?</label>
<mat-form-field> <mat-form-field>
<input matInput autocomplete="off" placeholder="Year(s)" formControlName="business_years" <input matInput autocomplete="off" placeholder="Year(s)" formControlName="business_years"
(change)="checkWithExistBusinessYear($event.target.value)" (keypress)="keyPress($event)"> (change)="checkWithExistBusinessYear($event.target.value,i)" (keypress)="keyPress($event)">
<mat-hint style="color: red;">{{yearErrorMessage}}</mat-hint> <mat-hint style="color: red;">{{yearErrorMessage[i]}}</mat-hint>
<mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_years'].value.valid">Year's <!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_years'].value.valid">Year's
Required</mat-error> Required</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<input matInput autocomplete="off" placeholder="Month(s)" formControlName="business_month" <input matInput autocomplete="off" placeholder="Month(s)" formControlName="business_month"
(keypress)="keyPress($event)" (change)="ConvertMonthintoYear($event.target.value)"> (keypress)="keyPress($event)" (change)="ConvertMonthintoYear($event.target.value,i)">
<mat-hint style="color: red;">{{monthErrorMessage}}</mat-hint> <mat-hint style="color: red;">{{monthErrorMessage[i]}}</mat-hint>
<!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_month'].value.valid">Month's <!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_month'].value.valid">Month's
Required</mat-error> --> Required</mat-error> -->
</mat-form-field> </mat-form-field>
@ -57,27 +60,24 @@
<mat-form-field style="width: 95%;"> <mat-form-field style="width: 95%;">
<mat-select [placeholder]="placeholderName" formControlName="business_is_pd_visited"> <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="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_is_pd_visited'].value.valid">Field <!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_is_pd_visited'].value.valid">Field
Required</mat-error> Required</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf=" _businessAssetsQuesFrom.controls['business_is_pd_visited'].value != ''" style="width: 95%;"> <mat-form-field *ngIf=" itemrow.get('business_is_pd_visited').value != ''" style="width: 95%;">
<input matInput autocomplete="off" placeholder="Remarks" formControlName="business_pd_visited_remark"> <input matInput autocomplete="off" placeholder="Remarks" formControlName="business_pd_visited_remark">
<mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_pd_visited_remark'].value.valid">Remarks <!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_pd_visited_remark'].value.valid">Remarks
Required</mat-error> Required</mat-error> -->
</mat-form-field> </mat-form-field>
</div> </div>
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none" *ngIf=" _businessAssetsQuesFrom.controls['business_address_availability'].value == 'yes'"> <div *ngIf="itemrow.get('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-form-field style="width:45%">
<mat-select placeholder="Ownership Type" formControlName="business_ownership_type" <mat-select placeholder="Ownership Type" formControlName="business_ownership_type"
(selectionChange)="setRequiredValidation($event.value,itemrow,7)"> (selectionChange)="setRequiredValidation($event.value,itemrow,7)">
@ -118,7 +118,7 @@
<mat-error>Asset Owned by Required</mat-error> <mat-error>Asset Owned by Required</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field style="width:45%" *ngIf="isOtherOwnerForAddress"> <mat-form-field style="width:45%" *ngIf="isOtherOwnerForAddress[i]">
<input matInput placeholder="Specify Asset Owned Name" formControlName="business_name_of_the_other_owner" <input matInput placeholder="Specify Asset Owned Name" formControlName="business_name_of_the_other_owner"
autocomplete="off"> autocomplete="off">
</mat-form-field> </mat-form-field>
@ -150,12 +150,14 @@
</mat-form-field> </mat-form-field>
</div> </div>
</span> </span>
</div> </div>
</div>
</div>
</div>
</mat-card> </mat-card>
</div> </div>
</div>
</div>
</div>
<div fxFlex="100"> <div fxFlex="100">
<mat-card style="min-height: 550px;"> <mat-card style="min-height: 550px;">
<mat-card-header> <mat-card-header>
@ -313,7 +315,7 @@
<mat-error>Asset Owned by Required</mat-error> <mat-error>Asset Owned by Required</mat-error>
</mat-form-field> </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" <input matInput placeholder="Specify Asset Owned Name" formControlName="business_name_of_the_other_owner"
autocomplete="off"> autocomplete="off">
</mat-form-field> </mat-form-field>

View File

@ -28,21 +28,22 @@ export class BusinessAssetsInfoComponent implements OnInit {
/**Declaration of Form Fields Variables */ /**Declaration of Form Fields Variables */
pdid: string; pdid: string;
company_id: any; 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; private notifier: NotifierService;
public _businessAssetsQuesFrom: FormGroup; public _businessAssetsQuesFrom: FormGroup;
public submitted = false; public submitted = false;
isOtherOwnerForAddress : boolean = false; isOtherOwnerForAddress : any = [];
isOtherOwner: boolean = false; isOtherOwner : any = [];
loadDetails: boolean; loadDetails: boolean;
CustSegAbbr: any; CustSegAbbr: any;
generalExistBusinessYear: Number; generalExistBusinessYear: Number;
generalExistBusinessMonth: Number; generalExistBusinessMonth: Number;
yearErrorMessage: any; yearErrorMessage: any = [];
monthErrorMessage: any; monthErrorMessage: any = [];
currentYear: any = new Date().getFullYear(); currentYear: any = new Date().getFullYear();
addressLabel: any; addressLabel: any = [];
/**Declaration of Dropdown And Array */ /**Declaration of Dropdown And Array */
public applicants: any; public applicants: any;
@ -120,25 +121,6 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.getM_PropertyType(); this.getM_PropertyType();
this.getM_Address_Type(); this.getM_Address_Type();
this.getM_Vehicle_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 */ /** Assets Type For Dropdown List */
@ -189,9 +171,9 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.pdTrigerService.getPDFormDetailsWithCompanyID(this.pdid, '22', this.company_id).subscribe( this.pdTrigerService.getPDFormDetailsWithCompanyID(this.pdid, '22', this.company_id).subscribe(
data => { data => {
if (data) { if (data) {
console.log('data.records',data);
if (data.dataStatus) { if (data.dataStatus) {
console.log('data.records',data.records);
this.formLoadData(data.records); this.formLoadData(data.records);
} else { } else {
this.formLoadData(null); 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 */ /** load Form Data */
formLoadData(val) { formLoadData(val) {
@ -212,38 +267,31 @@ export class BusinessAssetsInfoComponent implements OnInit {
pdid: [this.pdid], pdid: [this.pdid],
formid: ['22'], formid: ['22'],
company_id: [this.company_id], company_id: [this.company_id],
business_years: [value.business_years], // business_address_details: this._formBuilder.array([]),
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_assets_for_address: this._formBuilder.array([]),
business_assets_details: this._formBuilder.array([]), business_assets_details: this._formBuilder.array([]),
business_assets_form_remark: [value.business_assets_form_remark || null] business_assets_form_remark: [value.business_assets_form_remark || null]
}); });
if (value.business_address_availability == 'yes') { // if (value.business_address_availability == 'yes') {
console.log(value.business_assets_for_address);
this.addBusinessAssetsForAddress(value.business_assets_for_address); // this.addBusinessAssetsForAddress(value.business_assets_for_address);
} // }
else { // else {
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address']; // const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.createBusinessAssetsForAddress()); // control.push(this.createBusinessAssetsForAddress());
} // }
this.addBusinessAddressAssetsDetailsWithData(value.business_assets_for_address);
this.addBusinessAssetsDetailsWithData(value.business_assets_details); this.addBusinessAssetsDetailsWithData(value.business_assets_details);
} else { } else {
this._businessAssetsQuesFrom = this._formBuilder.group({ this._businessAssetsQuesFrom = this._formBuilder.group({
pdid: [this.pdid], pdid: [this.pdid],
formid: ['22'], formid: ['22'],
company_id: [this.company_id], company_id: [this.company_id],
business_assets_for_address: this._formBuilder.array([]),
business_assets_details: this._formBuilder.array([ this.initBusinessDetails() ]), 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: [''] business_assets_form_remark: ['']
}); });
this.loadaddresses();
} }
this.loadDetails = true; this.loadDetails = true;
} }
@ -268,8 +316,17 @@ export class BusinessAssetsInfoComponent implements OnInit {
}); });
} }
createBusinessAssetsForAddress(): FormGroup {
initBusinessAddressDetails() {
return this._formBuilder.group({ return this._formBuilder.group({
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_approximate_market_value: [''],
business_ownership_type: [''], business_ownership_type: [''],
business_monthly_rented_amt: [''], business_monthly_rented_amt: [''],
@ -277,10 +334,23 @@ export class BusinessAssetsInfoComponent implements OnInit {
business_name_of_the_other_owner: [''], business_name_of_the_other_owner: [''],
business_vintage: [''], business_vintage: [''],
business_purchase_year: ['', Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], business_purchase_year: ['', Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
business_emi: [''] 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) { selectedPropertyOwnedType(e, s, i) {
// const control = (<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(i).get('business_details') as FormArray ; // const control = (<FormArray>this._businessAssetsQuesFrom.controls['business_assets_details']).at(i).get('business_details') as FormArray ;
@ -387,18 +457,18 @@ export class BusinessAssetsInfoComponent implements OnInit {
} }
createBusinessAssetsForAddressWithData(data): FormGroup { // createBusinessAssetsForAddressWithData(data): FormGroup {
return this._formBuilder.group({ // return this._formBuilder.group({
business_approximate_market_value: [data.business_approximate_market_value], // business_approximate_market_value: [data.business_approximate_market_value],
business_ownership_type: [data.business_ownership_type], // business_ownership_type: [data.business_ownership_type],
business_monthly_rented_amt: [data.business_monthly_rented_amt], // business_monthly_rented_amt: [data.business_monthly_rented_amt],
business_name_of_the_owner: [data.business_name_of_the_owner], // 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_name_of_the_other_owner: [data.business_name_of_the_other_owner],
business_vintage: [data.business_vintage], // business_vintage: [data.business_vintage],
business_purchase_year: [data.business_purchase_year, Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])], // business_purchase_year: [data.business_purchase_year, Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
business_emi: [data.business_emi] // business_emi: [data.business_emi]
}); // });
} // }
initBusinessDetailsWithdata(data) { initBusinessDetailsWithdata(data) {
@ -417,9 +487,69 @@ export class BusinessAssetsInfoComponent implements OnInit {
return formGroup; return formGroup;
} }
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 || ''],
});
}
// 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) {
addBusinessAssetsForAddress(data) {
console.log(data);
var result = Object.keys(data).map(function (key) { var result = Object.keys(data).map(function (key) {
return data[key]; return data[key];
}); });
@ -428,7 +558,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.RentAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_monthly_rented_amt); this.RentAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_monthly_rented_amt);
this.appxMarketAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_approximate_market_value); this.appxMarketAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_approximate_market_value);
let Avaliablity = 1; let Avaliablity = 1;
// console.log(datas.business_name_of_the_owner);
if(datas.business_name_of_the_owner.length > 0){ if(datas.business_name_of_the_owner.length > 0){
datas.business_name_of_the_owner.forEach(option => { datas.business_name_of_the_owner.forEach(option => {
if(option.id == 0 && option.group_id == 2){ if(option.id == 0 && option.group_id == 2){
@ -436,12 +566,18 @@ export class BusinessAssetsInfoComponent implements OnInit {
} }
}); });
} }
this.isOtherOwnerForAddress = Avaliablity == 0 ? true : false; this.isOtherOwnerForAddress[index] = Avaliablity == 0 ? true : false;
}); });
for (let val of result) { for (let val of result) {
let vals = { 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_approximate_market_value: val.business_approximate_market_value,
business_ownership_type: val.business_ownership_type, business_ownership_type: val.business_ownership_type,
business_monthly_rented_amt: val.business_monthly_rented_amt, business_monthly_rented_amt: val.business_monthly_rented_amt,
@ -452,11 +588,12 @@ export class BusinessAssetsInfoComponent implements OnInit {
business_emi: val.business_emi business_emi: val.business_emi
}; };
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address']; const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.createBusinessAssetsForAddressWithData(vals)); control.push(this.initBusinessAddressDetailsWithdata(vals));
// this.initBusinessDetailsWithdata(vals)
} }
} else { } else {
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address']; const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
control.push(this.createBusinessAssetsForAddress()); control.push(this.initBusinessAddressDetails());
} }
} }
@ -472,7 +609,12 @@ export class BusinessAssetsInfoComponent implements OnInit {
this.RentAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.business_monthly_rented_amt); this.RentAmtInwords[index] = this.pdTrigerService.convertNumberToWords(+datas.business_monthly_rented_amt);
let Avaliablity = 1; 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 */ /** 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'];
let business_year = this._businessAssetsQuesFrom.controls.business_years.value; // control.controls[i]['controls'].isactive.setValue(0);
// address_control.controls[index].disable();
// console.log(by);
// return;
// console.log('address_control',address_control);
let business_year = control.controls[i]['controls'].business_years.value;
let converted_month: number = e % 12; let converted_month: number = e % 12;
let converted_year: 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); let Year = +business_year + +Math.floor(converted_year);
if (Year > this.generalExistBusinessYear) { if (Year > this.generalExistBusinessYear) {
this.yearErrorMessage = "Higher than Business Vintage"; this.yearErrorMessage[i] = "Higher than Business Vintage";
this._businessAssetsQuesFrom.controls.business_years.setValue(''); // this._businessAssetsQuesFrom.controls.business_years.setValue('');
this._businessAssetsQuesFrom.controls.business_month.setValue(''); control.controls[i]['controls'].business_years.setValue('');
// this._businessAssetsQuesFrom.controls.business_month.setValue('');
control.controls[i]['controls'].business_month.setValue('');
} }
else { else {
if (Year == this.generalExistBusinessYear && +converted_month > this.generalExistBusinessMonth) { if (Year == this.generalExistBusinessYear && +converted_month > this.generalExistBusinessMonth) {
this.monthErrorMessage = "Higher than Business Vintage"; this.monthErrorMessage[i] = "Higher than Business Vintage";
this._businessAssetsQuesFrom.controls.business_years.setValue(''); // this._businessAssetsQuesFrom.controls.business_years.setValue('');
this._businessAssetsQuesFrom.controls.business_month.setValue(''); control.controls[i]['controls'].business_years.setValue('');
control.controls[i]['controls'].business_month.setValue('');
// this._businessAssetsQuesFrom.controls.business_month.setValue('');
} else { } else {
this.monthErrorMessage = ''; this.monthErrorMessage[i] = '';
this.yearErrorMessage = ''; this.yearErrorMessage[i] = '';
this._businessAssetsQuesFrom.controls.business_years.setValue(+business_year + +Math.floor(converted_year)); // this._businessAssetsQuesFrom.controls.business_years.setValue(+business_year + +Math.floor(converted_year));
this._businessAssetsQuesFrom.controls.business_month.setValue(Math.floor(converted_month)); 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) { if (+e > this.generalExistBusinessYear) {
this.yearErrorMessage = "Higher than Business Vintage"; this.yearErrorMessage[i] = "Higher than Business Vintage";
this._businessAssetsQuesFrom.controls.business_years.setValue(''); // this._businessAssetsQuesFrom.controls.business_years.setValue('');
control.controls[i]['controls'].business_years.setValue('');
} }
else { 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) { setRequiredValidation(value, item, flag) {
console.log('controls',item);
if (flag == 1) { if (flag == 1) {
if (value == 'yes') { if (value == 'yes') {
this._businessAssetsQuesFrom.controls.business_years.setValidators([Validators.required]); item.controls.business_years.setValidators([Validators.required]);
this._businessAssetsQuesFrom.controls.business_address_availability.setValidators([Validators.required]); item.controls.business_address_availability.setValidators([Validators.required]);
this._businessAssetsQuesFrom.controls.business_is_pd_visited.setValidators([Validators.required]); item.controls.business_is_pd_visited.setValidators([Validators.required]);
this._businessAssetsQuesFrom.controls.business_pd_visited_remark.setValidators([Validators.required]); item.controls.business_pd_visited_remark.setValidators([Validators.required]);
} }
else { else {
this._businessAssetsQuesFrom.controls.business_years.clearValidators(); item.controls.business_years.clearValidators();
this._businessAssetsQuesFrom.controls.business_address_availability.clearValidators(); item.controls.business_address_availability.clearValidators();
this._businessAssetsQuesFrom.controls.business_is_pd_visited.clearValidators(); item.controls.business_is_pd_visited.clearValidators();
this._businessAssetsQuesFrom.controls.business_pd_visited_remark.clearValidators(); item.controls.business_pd_visited_remark.clearValidators();
} }
this._businessAssetsQuesFrom.controls.business_years.updateValueAndValidity(); item.controls.business_years.updateValueAndValidity();
this._businessAssetsQuesFrom.controls.business_address_availability.updateValueAndValidity(); item.controls.business_address_availability.updateValueAndValidity();
this._businessAssetsQuesFrom.controls.business_is_pd_visited.updateValueAndValidity(); item.controls.business_is_pd_visited.updateValueAndValidity();
this._businessAssetsQuesFrom.controls.business_pd_visited_remark.updateValueAndValidity(); item.controls.business_pd_visited_remark.updateValueAndValidity();
} }
if (flag == 3) { if (flag == 3) {
@ -725,27 +933,7 @@ export class BusinessAssetsInfoComponent implements OnInit {
item.controls.business_monthly_rented_amt.updateValueAndValidity(); item.controls.business_monthly_rented_amt.updateValueAndValidity();
item.controls.business_name_of_the_owner.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) { if (flag == 5) {
value == 1 value == 1
? item.controls.other_vehicle_type.setValidators([Validators.required]) ? 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_monthly_rented_amt.updateValueAndValidity();
item.controls.business_name_of_the_owner.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 => { data => {
if (data.dataStatus) { if (data.dataStatus) {
let dataForm = data.records; let dataForm = data.records;
// console.log(dataForm);
if (dataForm !== undefined) { if (dataForm !== undefined) {
this._supplierQuesFrom = this._formBuilder.group({ this._supplierQuesFrom = this._formBuilder.group({
pdid: [this.pdid], pdid: [this.pdid],
@ -206,11 +207,16 @@ export class ClientInfoComponent implements OnInit {
// let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) { // let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
// return dataForm.main_raw_materials[key]; // return dataForm.main_raw_materials[key];
// }); // });
if(dataForm.manufacturing_details){
let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials; let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
this.initManufacturingProductsDetails(api_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); 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 // Load form details for the wholeshale trading details
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 || data.type_of_activity_id == 4);
@ -218,11 +224,17 @@ export class ClientInfoComponent implements OnInit {
// let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) { // let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
// return dataForm.trading_products[key]; // return dataForm.trading_products[key];
// }); // });
if(dataForm.trade_details){
let api_trading_products = dataForm.trade_details[0].trading_products; let api_trading_products = dataForm.trade_details[0].trading_products;
this.initTradingProductsDetails(api_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); 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 // Load form details for the service provider prduct details
let arr2 = record.filter(data => data.type_of_activity_id == 5); let arr2 = record.filter(data => data.type_of_activity_id == 5);
@ -230,10 +242,19 @@ export class ClientInfoComponent implements OnInit {
// let api_service_provider_products = Object.keys(dataForm.service_products).map(function (key) { // let api_service_provider_products = Object.keys(dataForm.service_products).map(function (key) {
// return dataForm.service_products[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);
if(dataForm.service_provider_details){
let api_service_provider_products = dataForm.service_provider_details[0].service_products; let api_service_provider_products = dataForm.service_provider_details[0].service_products;
this.initServiceProviderProductsDetails(api_service_provider_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); 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 // Load form details for the retail trading details
let arr3 = record.filter(data => data.type_of_activity_id == 3); let arr3 = record.filter(data => data.type_of_activity_id == 3);
// if (arr3.length > 0) { // if (arr3.length > 0) {

View File

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

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-option *ngFor="let list of m_recommendationList" [value]="list.pdofficer_recommendation_id">{{ list.pdofficer_recommendation }}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </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"> <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>
<mat-form-field style="width:40%;" *ngIf="_finalRemarkForm.controls['pd_officers_recommendation'].value == 4"> <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-form-field>
</mat-card> </mat-card>
</mat-dialog-content> </mat-dialog-content>
<mat-dialog-actions> <mat-dialog-actions>
<div fxFlex="60" class="pb-0 text-sm-left" align="left"> <div fxFlex="60" class="pb-0 text-sm-left" align="left">
<mat-form-field appearance="outline" style="width: 100%"> <mat-form-field appearance="outline" style="width: 100%">
<mat-label>Remarks</mat-label> <mat-label>Other Remarks</mat-label>
<textarea matInput placeholder="Remarks" formControlName="final_form_remarks" required></textarea> <textarea matInput placeholder="Other Remarks" formControlName="final_form_remarks"></textarea>
</mat-form-field> </mat-form-field>
</div> </div>
<div fxFlex="40" align="end"> <div fxFlex="40" align="end">

View File

@ -69,9 +69,10 @@ export class FinalRemarksComponent implements OnInit {
is_service_provided: ['', Validators.required], is_service_provided: ['', Validators.required],
pd_officers_recommendation:['', Validators.required], pd_officers_recommendation:['', Validators.required],
others_pd_officers_recommendation:[''], others_pd_officers_recommendation:[''],
enter_reason_for_negative:[''], reason_for_positive:[''],
enter_reason_for_refer_to_credit:[''], reason_for_negative:[''],
final_form_remarks: ['',Validators.required] reason_for_refer_to_credit:[''],
final_form_remarks: ['']
}); });
this.getM_Type(); this.getM_Type();
this.getM_Recommendation(); 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.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.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.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.reason_for_positive.setValue(data.records.reason_for_positive);
this._finalRemarkForm.controls.enter_reason_for_refer_to_credit.setValue(data.records.enter_reason_for_refer_to_credit); 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.is_service_provided.setValue(data.records.is_service_provided);
this._finalRemarkForm.controls.final_form_remarks.setValue(data.records.final_form_remarks); 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){ // if(this._finalRemarkForm.controls.pd_officers_recommendation.value == 4){
// } // }
console.log('e',e);
if(e==1){ 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'].setValidators([Validators.required]);
this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity();
this._finalRemarkForm.controls['enter_reason_for_negative'].clearValidators(); this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators();
this._finalRemarkForm.controls['enter_reason_for_negative'].updateValueAndValidity(); this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue('');
this._finalRemarkForm.controls['enter_reason_for_negative'].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){ if(e==2){
console.log('all Validation clear ',e);
this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators(); 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['others_pd_officers_recommendation'].setValue('');
this._finalRemarkForm.controls['enter_reason_for_negative'].clearValidators(); this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators();
this._finalRemarkForm.controls['enter_reason_for_negative'].updateValueAndValidity(); this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue('');
this._finalRemarkForm.controls['enter_reason_for_negative'].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){ 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'].setValue('');
this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators();
this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity(); this._finalRemarkForm.controls['others_pd_officers_recommendation'].updateValueAndValidity();
this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].setValue(''); this._finalRemarkForm.controls['reason_for_refer_to_credit'].setValue('');
this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].clearValidators(); this._finalRemarkForm.controls['reason_for_refer_to_credit'].clearValidators();
this._finalRemarkForm.controls['enter_reason_for_refer_to_credit'].updateValueAndValidity();
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){ 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'].setValue('');
this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators(); this._finalRemarkForm.controls['others_pd_officers_recommendation'].clearValidators();
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['others_pd_officers_recommendation'].updateValueAndValidity();
this._finalRemarkForm.controls['reason_for_refer_to_credit'].updateValueAndValidity();
this._finalRemarkForm.controls['enter_reason_for_negative'].setValue(''); this._finalRemarkForm.controls['reason_for_positive'].updateValueAndValidity();
this._finalRemarkForm.controls['enter_reason_for_negative'].clearValidators(); this._finalRemarkForm.controls['reason_for_negative'].updateValueAndValidity();
this._finalRemarkForm.controls['enter_reason_for_negative'].updateValueAndValidity();
}
} }
} }

View File

@ -64,7 +64,7 @@
<span *ngIf="i != 0"> <span *ngIf="i != 0">
<mat-form-field style="width:60%"> <mat-form-field style="width:60%">
<input matInput autocomplete="off" placeholder="Sale Variation from Previous Year in %" <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> (keypress)="keyPress($event)" readonly>
<mat-hint align="start" style="font-size:70%" *ngIf="details.get('financial_annualsales_variation').value != '' "> <mat-hint align="start" style="font-size:70%" *ngIf="details.get('financial_annualsales_variation').value != '' ">
<span *ngIf="details.get('financial_annualsales_variation').value == 0"> <span *ngIf="details.get('financial_annualsales_variation').value == 0">
@ -137,12 +137,11 @@
</div> </div>
<span *ngIf="i != 0"> <span *ngIf="i != 0">
<mat-form-field style="width:45%"> <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 %" placeholder="Profit Variation from Previous Year in %"
formControlName="financial_variation" (keypress)="keyPress($event)" formControlName="financial_variation" (keypress)="keyPress($event)"
readonly> readonly>
<mat-hint align="start" style="font-size:70%" *ngIf="i != 0 && details.get('financial_variation').value != '' " <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)}">
<span *ngIf="details.get('financial_variation').value == 0"> <span *ngIf="details.get('financial_variation').value == 0">
No difference in Profit in FY <i> No difference in Profit in FY <i>
{{details.get('financial_year').value}} </i> over {{details.get('financial_year').value}} </i> over
@ -170,13 +169,13 @@
</span> </span>
</mat-hint> </mat-hint>
<!-- “Increase in Sales in FY 2017-2018 over sales in FY 2016-2017 is 11.11%” --> <!-- “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>
<mat-form-field style="width:45%"> <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" placeholder="Variation of Profit % over sales" formControlName="financial_profit_to_sale_variation"
(keypress)="keyPress($event)" readonly> (keypress)="keyPress($event)" readonly>
<mat-hint align="start" style="font-size:70%" *ngIf="i != 0 && details.get('financial_profit_to_sale_variation').value != '' " <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)}">
<span *ngIf="details.get('financial_profit_to_sale_variation').value == 0"> <span *ngIf="details.get('financial_profit_to_sale_variation').value == 0">
No difference in Profit sales % in FY <i> No difference in Profit sales % in FY <i>
{{details.get('financial_year').value}} </i> over {{details.get('financial_year').value}} </i> over
@ -425,7 +424,7 @@
</mat-select> </mat-select>
</mat-form-field> </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 != ''"> <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"> formControlName="reason_for_working_capital_facilities_availed">
</mat-form-field> </mat-form-field>
</mat-card-content> </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; this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr;
let x = this.customer_segment_abbr.split("-"); let x = this.customer_segment_abbr.split("-");
this.CustSegAbbr = x[1]; this.CustSegAbbr = x[1];
console.log('this.CustSegAbbr',this.CustSegAbbr); // console.log('this.CustSegAbbr',this.CustSegAbbr);
} }
//ViewerOption For Docs Display //ViewerOption For Docs Display
@ -135,6 +135,7 @@ export class FinancialInfoComponent implements OnInit {
let retriveData = value.records; let retriveData = value.records;
if(value.records.is_financial_statements == 'yes'){ if(value.records.is_financial_statements == 'yes'){
this.isDisplay = true;
/** Backend Data of Asper Statement */ /** Backend Data of Asper Statement */
let result = Object.keys(value.records.date_per_financial).map(function(key) { let result = Object.keys(value.records.date_per_financial).map(function(key) {
return value.records.date_per_financial[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('val.financial_margin_of_profit',val.financial_margin_of_profit);
console.log('profit_margin',profit_margin); // console.log('profit_margin',profit_margin);
console.log('childArray.controls.financial_margin_of_loss',childArray.controls.financial_margin_of_loss.value); // 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_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_loss_margin[index] = val.financial_margin_of_loss !='' ? val.financial_margin_of_loss : 0 ;
prev_profit_margin[index] = profit_margin != '' ? profit_margin : 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) { if ((profit_margin != '' || loss_margin != '') && index != 0) {
console.log('temp_prev_losses',prev_loss_margin); // console.log('temp_prev_losses',prev_loss_margin);
console.log('temp_prev_profits',prev_profit_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; loss_margin = loss_margin !== undefined ? loss_margin : 0;
profit_margin = profit_margin !== undefined ? profit_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_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 ; 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('profit_margin',profit_margin);
console.log('pre year loss_margin',temp_prev_loss_margin); // console.log('pre year loss_margin',temp_prev_loss_margin);
console.log('loss_margin',loss_margin); // console.log('loss_margin',loss_margin);
console.log('pre year profit_margin',temp_prev_profit_margin); // console.log('pre year profit_margin',temp_prev_profit_margin);
if(annual_sale != ''){ if(annual_sale != ''){

View File

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

View File

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

View File

@ -163,7 +163,7 @@
<div fxFlex="40" align="end"> <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> </button>
</div> </div>
</mat-dialog-actions> </mat-dialog-actions>

View File

@ -30,7 +30,7 @@ export class LenderRepresentativeComponent implements OnInit {
pageTitle: string ="Lender Representative Details"; pageTitle: string ="Lender Representative Details";
pdid: number; pdid: number;
form_id: number; form_id: number;
disableAfterSubmit : boolean = false;
//snack bar //snack bar
@ -141,9 +141,11 @@ export class LenderRepresentativeComponent implements OnInit {
submitLRForm() { submitLRForm() {
if (!this.representativeForm.valid) { if (!this.representativeForm.valid) {
this.validateAllFormFields(this.representativeForm); this.validateAllFormFields(this.representativeForm);
this.disableAfterSubmit = false;
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
return; return;
} }
this.disableAfterSubmit = true;
let records: any = {}; let records: any = {};
records.pdid = this.pdid; records.pdid = this.pdid;
records.formid = this.form_id; records.formid = this.form_id;
@ -158,13 +160,16 @@ export class LenderRepresentativeComponent implements OnInit {
this.notifier.notify('success', 'Saved Successfully.'); this.notifier.notify('success', 'Saved Successfully.');
setTimeout(() =>{ setTimeout(() =>{
this.dialogRef.close(); this.dialogRef.close();
this.disableAfterSubmit = false;
},3000); },3000);
} }
else { else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
this.disableAfterSubmit = false;
} }
}, error => { }, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
this.disableAfterSubmit = false;
}) })
} }
validateAllFormFields(formGroup: FormGroup) { validateAllFormFields(formGroup: FormGroup) {

View File

@ -377,7 +377,7 @@
<div fxFlex="40" align="end"> <div fxFlex="40" align="end">
<button type="submit" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button matTooltip="Submit" <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> <mat-icon>save</mat-icon>
</button> </button>
</div> </div>

View File

@ -31,7 +31,7 @@ export class LoanDetailsComponent implements OnInit {
lender_applicant_id: any; lender_applicant_id: any;
main_applicant: any; main_applicant: any;
pageTitle: string = "Loan Details"; pageTitle: string = "Loan Details";
disableAfterSubmit : boolean = false;
/**Declaration of formfields Variables */ /**Declaration of formfields Variables */
private notifier: NotifierService; private notifier: NotifierService;
@ -655,9 +655,10 @@ export class LoanDetailsComponent implements OnInit {
if (!this.loanDetailsForm.valid) { if (!this.loanDetailsForm.valid) {
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!'); this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
this.disableAfterSubmit = false;
return; return;
} }
this.disableAfterSubmit = true;
let records: any = {}; let records: any = {};
records.pdid = this.pdid; records.pdid = this.pdid;
records.formid = this.form_id; records.formid = this.form_id;
@ -746,13 +747,16 @@ export class LoanDetailsComponent implements OnInit {
// this.dialogRef.close(); // this.dialogRef.close();
setTimeout(() => { setTimeout(() => {
this.dialogRef.close(); this.dialogRef.close();
this.disableAfterSubmit = false;
}, 3000); }, 3000);
} }
else { else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
this.disableAfterSubmit = false;
} }
}, error => { }, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); 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; const neighbourhoodControl : FormGroup = this._neighbourhoodForm.controls['neighbourhood_list'] as FormGroup;
if(formData.check_type==0){ if(formData.check_type==0){
console.log('neighbourhoodControl',neighbourhoodControl);
// neighbourhoodControl.contdols['neighbourhood_name'].setValidators([Validators.required]); // neighbourhoodControl.contdols['neighbourhood_name'].setValidators([Validators.required]);
// neighbourhoodControl.controls['neighbourhood_name'].updateValueAndValidity(); // neighbourhoodControl.controls['neighbourhood_name'].updateValueAndValidity();

View File

@ -56,6 +56,12 @@
formControlName="others_source"> formControlName="others_source">
</mat-form-field> </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-form-field style="width:45%">
<mat-select placeholder="Income earned by" <mat-select placeholder="Income earned by"
formControlName="income_earned_by"> formControlName="income_earned_by">

View File

@ -24,6 +24,8 @@ import {
import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import { RentalInfoComponent} from './../rental-info/rental-info.component';
@Component({ @Component({
selector: 'app-other-income', selector: 'app-other-income',
templateUrl: './other-income.component.html', templateUrl: './other-income.component.html',
@ -58,6 +60,7 @@ export class OtherIncomeComponent implements OnInit {
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
private _pd: PdTrigerService, private _pd: PdTrigerService,
private dialog: MatDialog,
private dialogRef: MatDialogRef<OtherIncomeComponent>, private dialogRef: MatDialogRef<OtherIncomeComponent>,
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) @Inject(MAT_DIALOG_DATA) public pd_all_details: any)
{ {
@ -154,6 +157,7 @@ public viewerOptions: any = {
return this.fb.group({ return this.fb.group({
source: [''], source: [''],
others_source : [''], others_source : [''],
address : [''],
income_earned_by:[''], income_earned_by:[''],
others_income_earned_by:[''], others_income_earned_by:[''],
amount: [''], amount: [''],
@ -247,4 +251,29 @@ public viewerOptions: any = {
this.amtInwords[i] = this._pd.convertNumberToWords(e.target.value); 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> <span>{{main_applicant}} ({{lender_applicant_id}}), {{customer_segment_abbr}} - {{subproduct_abbr}} </span><br>
{{pageTitle}} {{pageTitle}}
</div> --> </div> -->
<div fxFlex="70" align="left" style="padding: 10px !important;"></div>
<div fxFlex="30" align="end" style="padding: 10px !important;"> <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>

View File

@ -138,16 +138,30 @@ export class StockComponent implements OnInit {
} }
public initstockForms(record){ public initstockForms(record){
// console.log('record.from_business',record.from_business);
let api = Object.keys(record.from_business).map(function (key) { let api = Object.keys(record.from_business).map(function (key) {
return record.from_business[key]; return record.from_business[key];
}); });
// console.log(api);
let type2 = record.from_business.filter(data => data.type_of_activity_id == 2); 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 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 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; let rm_api = record.from_supplier;
@ -319,11 +333,14 @@ export class StockComponent implements OnInit {
manufacturingFormCreation(record) { manufacturingFormCreation(record) {
let arr = record.from_business.filter(data => data.type_of_activity_id == 2); 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 = record.from_supplier;
// let rm_arr = 0;
// console.log('manu arr',arr);
// console.log('rm_arr',rm_arr);
// let rm_arr = 0;
if(arrlength > 0){
this.manufacturingForm = true; this.manufacturingForm = true;
if(arr.length > 0){
return this.fb.group({ return this.fb.group({
manufacturing_raw_materials: this.fb.array([]), manufacturing_raw_materials: this.fb.array([]),
is_sufficiant_raw: [], is_sufficiant_raw: [],
@ -331,7 +348,6 @@ export class StockComponent implements OnInit {
manufacturing_finished_goods: this.fb.array([]), manufacturing_finished_goods: this.fb.array([]),
}) })
} }
else { else {
return; return;
} }

View File

@ -183,13 +183,22 @@ export class SupplierInfoComponent implements OnInit {
// let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) { // let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
// return dataForm.main_raw_materials[key]; // return dataForm.main_raw_materials[key];
// }); // });
if(dataForm.manufacturing_details[0] !== null){
let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials; let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
this.initManufacturingProductsDetails(api_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); 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); let arr1 = record.filter(data => data.type_of_activity_id == 3 || data.type_of_activity_id ==4);
if(arr1.length > 0) { if(arr1.length > 0) {
if(dataForm.trade_details[0] !== null){
// let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) { // let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
// return dataForm.trading_products[key]; // return dataForm.trading_products[key];
// }); // });
@ -197,6 +206,11 @@ export class SupplierInfoComponent implements OnInit {
this.initTradingProductsDetails(api_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); 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; this.noRecordsFound = true;
} else { } else {
this._supplierQuesFrom = this._formBuilder.group({ this._supplierQuesFrom = this._formBuilder.group({
@ -213,7 +227,7 @@ export class SupplierInfoComponent implements OnInit {
this.initManufacturingProductsDetails(null); this.initManufacturingProductsDetails(null);
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(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) { if(arr1.length > 0) {
this.initTradingProductsDetails(null); 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); 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>
</div> </div>
<div fxLayout="row">
<!-- <div fxLayout="row">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100" class="profile-center"> <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"> <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> <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>
<div fxFlex="90"> <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> <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>
</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>
<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 fxLayout="row">
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100" class="profile-center"> <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> <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> <ng-template mat-tab-label>PD History</ng-template>
<div *ngIf="masterPdLogsData.length>0; else nohistory"> <div *ngIf="masterPdLogsData.length>0; else nohistory">
<mat-list class="m-gap p-gap" *ngFor="let master of masterPdLogsData"> <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="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> </mat-list-item>

View File

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

View File

@ -30,6 +30,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
errorMessage: any; errorMessage: any;
pdMasterData: any = []; pdMasterData: any = [];
pdAddressesData: any = [];
pdApplicantData: any = []; pdApplicantData: any = [];
pdDocumentsData: any = []; pdDocumentsData: any = [];
masterPdLogsData: any = []; masterPdLogsData: any = [];
@ -55,45 +56,13 @@ export class ViewPdComponent implements OnInit, OnDestroy {
{ 'backEnd_FieldName': "pd_branch_id", 'frontEnd_FieldName': "Branch" }, { 'backEnd_FieldName': "pd_branch_id", 'frontEnd_FieldName': "Branch" },
{ 'backEnd_FieldName': "pd_contact_landline", 'frontEnd_FieldName': "Lender's Landline Number" }, { 'backEnd_FieldName': "pd_contact_landline", 'frontEnd_FieldName': "Lender's Landline Number" },
{ 'backEnd_FieldName': "main_applicant", 'frontEnd_FieldName': "Applicant Master" }]; { '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; viewID: string;
viewParams: any; viewParams: any;
destroyType: number = 1; destroyType: number = 1;
currentPDStatus: string; currentPDStatus: string;
enableStartPD: boolean; enableStartPD: boolean;
// create values for status check // create values for status check
pdStatusCheck: any = { pdStatusCheck: any = {
"DRAFT": 'DRAFT', "DRAFT": 'DRAFT',
@ -121,8 +90,6 @@ export class ViewPdComponent implements OnInit, OnDestroy {
this.route.params.subscribe(params => { this.route.params.subscribe(params => {
this.viewID = params['pdid']; this.viewID = params['pdid'];
}); });
this.viewPdDetails(this.viewID); this.viewPdDetails(this.viewID);
} }
pd_QC_Rating: Number; pd_QC_Rating: Number;
@ -139,8 +106,12 @@ export class ViewPdComponent implements OnInit, OnDestroy {
this.pdApplicantData = data.records.applicants_details; this.pdApplicantData = data.records.applicants_details;
this.pdApplicantData = this.pdApplicantData.filter(appt => appt.applicant_type != 2); this.pdApplicantData = this.pdApplicantData.filter(appt => appt.applicant_type != 2);
this.pdDocumentsData = data.records.pd_documnets; this.pdDocumentsData = data.records.pd_documnets;
this.masterPdLogsData=data.records.pd_logs.master; this.masterPdLogsData = Object.keys(data.records.pd_logs.master).map(function (key) {
//this.applicantPDLogsData= data.records.pd_logs.master; 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.currentPDStatus = data.records.pd_master_details[0].pd_status;
this.pdAdditionalReqData = data.records.pd_additional_requirements; this.pdAdditionalReqData = data.records.pd_additional_requirements;
// enable pd start time // enable pd start time
@ -211,11 +182,11 @@ export class ViewPdComponent implements OnInit, OnDestroy {
// }) // })
// } // }
Maponclick(master : any){ // Maponclick(master: any) {
let url = "https://www.google.com/maps/place/" // let url = "https://www.google.com/maps/place/"
let concat_url = url+master.addressline1+'/'+master.city_name+','+master.pincode+','+master.state_name; // let concat_url = url + master.addressline1 + '/' + master.city_name + ',' + master.pincode + ',' + master.state_name;
window.open(concat_url,'_blank'); // window.open(concat_url, '_blank');
} // }
editPdMaster(masterData: any, flag) { editPdMaster(masterData: any, flag) {
let record = { let record = {

View File

@ -64,7 +64,24 @@ export class PdTrigerService {
) )
} }
//get product and subproduct master details /* 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> { getProductsDetails():Observable<any> {
return this._http.get<any>(this.apiUrl + 'getListOfProducts') return this._http.get<any>(this.apiUrl + 'getListOfProducts')
.pipe( .pipe(