addresses changes :ps
This commit is contained in:
parent
6dcf363ad6
commit
3f0a91c208
@ -209,7 +209,7 @@
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field style="width: 38%">
|
||||
<input matInput autocomplete="off" placeholder="Mobile Number" formControlName="mobile_no" type="text" (keypress)="keyPress($event)" maxlength="10">
|
||||
<input matInput autocomplete="off" placeholder="Mobile Number" formControlName="mobile_no" type="text" (keypress)="keyPress($event)" maxlength="10" required>
|
||||
<mat-error *ngIf="pdMain.mobile_no.hasError('maxlength') || pdMain.mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
@ -252,7 +252,7 @@
|
||||
</mat-form-field> -->
|
||||
|
||||
<mat-form-field style="width: 38%">
|
||||
<input matInput placeholder="Mobile" formControlName="coapplicant_mobile_no" type="text" (keypress)="keyPress($event)" required>
|
||||
<input matInput placeholder="Mobile Number" formControlName="coapplicant_mobile_no" type="text" (keypress)="keyPress($event)">
|
||||
<mat-error *ngIf="coDetails['controls'].coapplicant_mobile_no.hasError('maxlength') || coDetails['controls'].coapplicant_mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
@ -89,8 +89,8 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
||||
fk_customer_segment: [null],
|
||||
loan_amount: [null, Validators.compose([Validators.pattern('^[0-9]*$')])],
|
||||
applicant_title_name: [''],
|
||||
applicant_name: [null],
|
||||
mobile_no: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(10)])],
|
||||
applicant_name: [null,Validators.compose([Validators.required])],
|
||||
mobile_no: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(10),Validators.required])],
|
||||
// landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])],
|
||||
// email: [null],
|
||||
applicant_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])],
|
||||
@ -251,7 +251,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
||||
label: ['Applicant'],
|
||||
applicant_title_name:[null],
|
||||
coapplicant_name: [null, Validators.compose([Validators.required])],
|
||||
coapplicant_mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10),Validators.required])],
|
||||
coapplicant_mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])],
|
||||
coapplicant_stdcode:[null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])],
|
||||
coapplicant_landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])],
|
||||
company_name:[null],
|
||||
|
||||
@ -133,13 +133,15 @@
|
||||
</mat-form-field>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<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</mat-card-title>
|
||||
<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>
|
||||
<div formArrayName="addresses" *ngFor="let addresses of pdAddresses.controls; let i = index;">
|
||||
<mat-card-content [formGroupName]="i">
|
||||
|
||||
<mat-form-field style="width: 96%">
|
||||
<textarea matInput autocomplete="off" placeholder="Address at which PD is to be done"
|
||||
formControlName="addressline" style="text-transform: uppercase"></textarea>
|
||||
@ -181,29 +183,28 @@
|
||||
<!-- <mat-error *ngIf="pdAddresses.other_pincode.hasError('maxlength') || pdMain.other_pincode.hasError('minlength')">Enter Valid Pincode. </mat-error> -->
|
||||
</mat-form-field>
|
||||
|
||||
<div align="end" *ngIf="pdAddresses.controls.length > 1">
|
||||
<button mat-raised-button mat-icon-button matTooltip="Delete"
|
||||
matTooltipPosition="above" (click)="removeAddresses(i)"
|
||||
type="button">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</div>
|
||||
<mat-card-actions align="end">
|
||||
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addAddresses()"
|
||||
<button mat-raised-button mat-icon-button matTooltip="Delete"
|
||||
matTooltipPosition="above" (click)="removeAddresses(i)"
|
||||
type="button" *ngIf="pdAddresses.controls.length > 1 && addressesDeactivited[i]">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addAddresses()" *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-content>
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions>
|
||||
|
||||
@ -24,7 +24,8 @@ export class EditPdMasterComponent implements OnInit {
|
||||
billingList:any;
|
||||
lenderBranchList: any;
|
||||
pincodeList: any = [];
|
||||
addressesList : any = []
|
||||
addressesList : any = [];
|
||||
addressesDeactivited : any = [];
|
||||
applicantLength:number;
|
||||
// draftStatus: string;
|
||||
// PDTriggerStatus: string;
|
||||
@ -188,18 +189,19 @@ export class EditPdMasterComponent implements OnInit {
|
||||
this._pd.getAddressesDetails(this.pdid).subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.addressesList = data.records;
|
||||
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,
|
||||
addressline: val.addressline.toUpperCase(),
|
||||
fk_city: val.fk_city,
|
||||
fk_state: val.fk_state,
|
||||
pincode: val.pincode,
|
||||
other_pincode:val.other_pincode
|
||||
other_pincode:val.other_pincode,
|
||||
isactive:1,
|
||||
}
|
||||
this.getCityList(val.fk_state,index);
|
||||
this.getPincode(val.pincode,index);
|
||||
@ -253,6 +255,7 @@ export class EditPdMasterComponent implements OnInit {
|
||||
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{
|
||||
@ -264,6 +267,7 @@ export class EditPdMasterComponent implements OnInit {
|
||||
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],
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -274,7 +278,26 @@ export class EditPdMasterComponent implements OnInit {
|
||||
|
||||
removeAddresses(index: number) {
|
||||
const address_control = <FormArray>this._EditPDtriggerForm.controls['addresses'];
|
||||
address_control.removeAt(index);
|
||||
address_control.controls[index]['controls'].isactive.setValue(0);
|
||||
this.addressesDeactivited[index] = false;
|
||||
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;}
|
||||
@ -394,7 +417,8 @@ export class EditPdMasterComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
else{
|
||||
|
||||
console.log('my_array.addresses',my_array.addresses);
|
||||
let filteredAddressesdata = my_array.addresses.filter(item => item.isactive == 1);
|
||||
let lenderMasterArray = {
|
||||
"pd_id": my_array.pd_id,
|
||||
"fk_lender_id": my_array.fk_lender_id,
|
||||
@ -408,11 +432,11 @@ export class EditPdMasterComponent implements OnInit {
|
||||
"fk_pd_type": my_array.fk_pd_type,
|
||||
"fk_customer_segment": my_array.fk_customer_segment,
|
||||
"loan_amount": my_array.loan_amount,
|
||||
"addressline1": my_array.addresses[0].addressline.toUpperCase(),
|
||||
"fk_city": my_array.addresses[0].fk_city,
|
||||
"fk_state": my_array.addresses[0].fk_state,
|
||||
"pincode": my_array.addresses[0].pincode,
|
||||
"other_pincode":my_array.addresses[0].other_pincode,
|
||||
"addressline1": filteredAddressesdata[0].addressline.toUpperCase(),
|
||||
"fk_city": filteredAddressesdata[0].fk_city,
|
||||
"fk_state": filteredAddressesdata[0].fk_state,
|
||||
"pincode": filteredAddressesdata[0].pincode,
|
||||
"other_pincode":filteredAddressesdata[0].other_pincode,
|
||||
"remarks": my_array.remarks,
|
||||
}
|
||||
|
||||
|
||||
@ -113,7 +113,8 @@ export class AddressComponent implements OnInit {
|
||||
this._pd.retriveForm(params).subscribe(data => {
|
||||
const control = <FormArray>this.addressForm.controls['addresses'];
|
||||
if (data.status == 200) {
|
||||
|
||||
console.log('data.records',data.records);
|
||||
console.log('data.records.addresses',data.records.addresses);
|
||||
if (data.records.addresses.length == 0) {
|
||||
control.push(this.createAddresses(null));
|
||||
// this.loadPDAddressesDetails();
|
||||
@ -214,7 +215,8 @@ export class AddressComponent implements OnInit {
|
||||
this._pd.getAddressesDetails(this.pdid).subscribe(
|
||||
data => {
|
||||
if (data.status == 200) {
|
||||
this.addressesList = data.records;
|
||||
this.addressesList = data.records.filter(item => item.isactive == 1);
|
||||
|
||||
if (this.addressesList.length > 0) {
|
||||
this.addressesList.forEach((val,index)=>{
|
||||
let obj = {
|
||||
|
||||
@ -15,19 +15,22 @@
|
||||
<mat-tab-group>
|
||||
<mat-tab label={{pageTitle}}>
|
||||
<ng-template matTabContent>
|
||||
<div fxLayout="row wrap">
|
||||
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<div fxFlex="100">
|
||||
<div formArrayName="business_assets_for_address" fxFill>
|
||||
<div *ngFor="let itemrow of _businessAssetsQuesFrom.controls.business_assets_for_address['controls']; let i=index; let last=last;">
|
||||
<div [formGroupName]="i">
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<mat-card-title>
|
||||
<p>Address Details {{addressLabel | titlecase}}</p>
|
||||
<p>Address Details {{itemrow.get('address_label').value | titlecase}}</p>
|
||||
</mat-card-title>
|
||||
</mat-card-header>
|
||||
|
||||
|
||||
<div fxLayout="row wrap" fxLayoutGap="5px" fxLayoutAlign="start none">
|
||||
<mat-form-field style="width: 95%;">
|
||||
<mat-select placeholder="is this the business address ? " (selectionChange)="setRequiredValidation($event.value,'',1);"
|
||||
<mat-select placeholder="is this the business address ? " (selectionChange)="setRequiredValidation($event.value,itemrow,1);"
|
||||
formControlName="business_address_availability" required>
|
||||
<mat-option>Select</mat-option>
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
@ -36,20 +39,20 @@
|
||||
</mat-form-field>
|
||||
</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%">
|
||||
<label style="padding-left:2%">How long has business been operated from this premise?</label>
|
||||
<mat-form-field>
|
||||
<input matInput autocomplete="off" placeholder="Year(s)" formControlName="business_years"
|
||||
(change)="checkWithExistBusinessYear($event.target.value)" (keypress)="keyPress($event)">
|
||||
<mat-hint style="color: red;">{{yearErrorMessage}}</mat-hint>
|
||||
<mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_years'].value.valid">Year's
|
||||
Required</mat-error>
|
||||
(change)="checkWithExistBusinessYear($event.target.value,i)" (keypress)="keyPress($event)">
|
||||
<mat-hint style="color: red;">{{yearErrorMessage[i]}}</mat-hint>
|
||||
<!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_years'].value.valid">Year's
|
||||
Required</mat-error> -->
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput autocomplete="off" placeholder="Month(s)" formControlName="business_month"
|
||||
(keypress)="keyPress($event)" (change)="ConvertMonthintoYear($event.target.value)">
|
||||
<mat-hint style="color: red;">{{monthErrorMessage}}</mat-hint>
|
||||
(keypress)="keyPress($event)" (change)="ConvertMonthintoYear($event.target.value,i)">
|
||||
<mat-hint style="color: red;">{{monthErrorMessage[i]}}</mat-hint>
|
||||
<!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_month'].value.valid">Month's
|
||||
Required</mat-error> -->
|
||||
</mat-form-field>
|
||||
@ -57,27 +60,24 @@
|
||||
|
||||
|
||||
<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="no">No</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_is_pd_visited'].value.valid">Field
|
||||
Required</mat-error>
|
||||
<!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_is_pd_visited'].value.valid">Field
|
||||
Required</mat-error> -->
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
<mat-form-field *ngIf=" _businessAssetsQuesFrom.controls['business_is_pd_visited'].value != ''" style="width: 95%;">
|
||||
<mat-form-field *ngIf=" itemrow.get('business_is_pd_visited').value != ''" style="width: 95%;">
|
||||
<input matInput autocomplete="off" placeholder="Remarks" formControlName="business_pd_visited_remark">
|
||||
<mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_pd_visited_remark'].value.valid">Remarks
|
||||
Required</mat-error>
|
||||
<!-- <mat-error *ngIf="!_businessAssetsQuesFrom.controls['business_pd_visited_remark'].value.valid">Remarks
|
||||
Required</mat-error> -->
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
|
||||
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none" *ngIf=" _businessAssetsQuesFrom.controls['business_address_availability'].value == 'yes'">
|
||||
<div formArrayName="business_assets_for_address" fxFill>
|
||||
<div *ngFor="let itemrow of _businessAssetsQuesFrom.controls.business_assets_for_address['controls']; let i=index; let last=last;">
|
||||
<div [formGroupName]="i">
|
||||
<div *ngIf="itemrow.get('business_address_availability').value == 'yes'">
|
||||
<mat-form-field style="width:45%">
|
||||
<mat-select placeholder="Ownership Type" formControlName="business_ownership_type"
|
||||
(selectionChange)="setRequiredValidation($event.value,itemrow,7)">
|
||||
@ -150,12 +150,14 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div fxFlex="100">
|
||||
<mat-card style="min-height: 550px;">
|
||||
<mat-card-header>
|
||||
|
||||
@ -28,7 +28,8 @@ export class BusinessAssetsInfoComponent implements OnInit {
|
||||
/**Declaration of Form Fields Variables */
|
||||
pdid: string;
|
||||
company_id: any;
|
||||
placeholderName: any = 'Was any business activity seen at the Address Type during PD visit?';
|
||||
placeholderName: any = [];
|
||||
// 'Was any business activity seen at the Address Type during PD visit?';
|
||||
private notifier: NotifierService;
|
||||
public _businessAssetsQuesFrom: FormGroup;
|
||||
public submitted = false;
|
||||
@ -39,10 +40,10 @@ export class BusinessAssetsInfoComponent implements OnInit {
|
||||
CustSegAbbr: any;
|
||||
generalExistBusinessYear: Number;
|
||||
generalExistBusinessMonth: Number;
|
||||
yearErrorMessage: any;
|
||||
monthErrorMessage: any;
|
||||
yearErrorMessage: any = [];
|
||||
monthErrorMessage: any = [];
|
||||
currentYear: any = new Date().getFullYear();
|
||||
addressLabel: any;
|
||||
addressLabel: any = [];
|
||||
|
||||
/**Declaration of Dropdown And Array */
|
||||
public applicants: any;
|
||||
@ -120,25 +121,6 @@ export class BusinessAssetsInfoComponent implements OnInit {
|
||||
this.getM_PropertyType();
|
||||
this.getM_Address_Type();
|
||||
this.getM_Vehicle_Type();
|
||||
|
||||
let params: any = {};
|
||||
params.pd_id = this.pdid;
|
||||
params.pd_form_id = '5';
|
||||
|
||||
this.pdTrigerService.retriveForm(params).subscribe(data => {
|
||||
if (data.status == 200) {
|
||||
|
||||
this.addressLabel = '';
|
||||
|
||||
let selectedAddressType = this.m_address_type.filter(element => element.address_type_id == data.records.address_type)[0];
|
||||
let address = data.records.address;
|
||||
let addressType = data.records.address_type != 1 ? selectedAddressType.address_type : data.records.address_type_others;
|
||||
|
||||
this.placeholderName = 'Was any business activity seen at the ' + addressType + ' during PD visit?';
|
||||
this.addressLabel = " : " + address + ' / ' + addressType;
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Assets Type For Dropdown List */
|
||||
@ -203,6 +185,79 @@ export class BusinessAssetsInfoComponent implements OnInit {
|
||||
}
|
||||
);
|
||||
}
|
||||
loadaddresses(){
|
||||
console.log('function inside loaded');
|
||||
let params: any = {};
|
||||
params.pd_id = this.pdid;
|
||||
params.pd_form_id = '5';
|
||||
|
||||
this.pdTrigerService.retriveForm(params).subscribe(data => {
|
||||
console.log('response',data);
|
||||
if (data.status == 200) {
|
||||
let dataOfAddress = data.records.addresses.filter(item => item.isactive == 1);
|
||||
console.log(data.records);
|
||||
console.log(data.records.addresses);
|
||||
console.log(dataOfAddress);
|
||||
// // const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
|
||||
if(data.records.addresses.length > 0){
|
||||
data.records.addresses.forEach((data,inx)=>{
|
||||
console.log(data);
|
||||
|
||||
this.addressLabel[inx] = '';
|
||||
|
||||
let selectedAddressType = this.m_address_type.filter(element => element.address_type_id == data.address_type)[0];
|
||||
let address = data.address;
|
||||
let addressType = data.address_type != 1 ? selectedAddressType.address_type : data.address_type_others;
|
||||
|
||||
this.placeholderName[inx] = 'Was any business activity seen at the ' + addressType + ' during PD visit?';
|
||||
let addressLabel = " : " + address + ' / ' + addressType;
|
||||
|
||||
let vals = {
|
||||
address_label:addressLabel,
|
||||
business_years: '',
|
||||
business_month: '',
|
||||
business_address_availability: '',
|
||||
business_is_pd_visited: '',
|
||||
business_pd_visited_remark: '',
|
||||
business_approximate_market_value: '',
|
||||
business_ownership_type: '',
|
||||
business_monthly_rented_amt: '',
|
||||
business_name_of_the_owner: '',
|
||||
business_name_of_the_other_owner: '',
|
||||
business_vintage: '',
|
||||
business_purchase_year: '',
|
||||
business_emi: ''
|
||||
}
|
||||
|
||||
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
control.push(this.initBusinessAddressDetailsWithdata(vals));
|
||||
});
|
||||
}
|
||||
else{
|
||||
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
control.push(this.initBusinessAddressDetails());
|
||||
}
|
||||
}
|
||||
else{
|
||||
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
control.push(this.initBusinessAddressDetails());
|
||||
}
|
||||
});
|
||||
}
|
||||
// business_years: [value.business_years],
|
||||
// business_month: [value.business_month],
|
||||
// business_address_availability: [value.business_address_availability],
|
||||
// business_is_pd_visited: [value.business_is_pd_visited],
|
||||
// business_pd_visited_remark: [value.business_pd_visited_remark],
|
||||
// business_assets_for_address: this._formBuilder.array([]),
|
||||
|
||||
// business_years: [''],
|
||||
// business_month: [''],
|
||||
// business_address_availability: [''],
|
||||
// business_is_pd_visited: [''],
|
||||
// business_pd_visited_remark: [''],
|
||||
// business_assets_for_address: this._formBuilder.array([ this.createBusinessAssetsForAddress() ]),
|
||||
|
||||
/** load Form Data */
|
||||
formLoadData(val) {
|
||||
@ -212,38 +267,31 @@ export class BusinessAssetsInfoComponent implements OnInit {
|
||||
pdid: [this.pdid],
|
||||
formid: ['22'],
|
||||
company_id: [this.company_id],
|
||||
business_years: [value.business_years],
|
||||
business_month: [value.business_month],
|
||||
business_address_availability: [value.business_address_availability],
|
||||
business_is_pd_visited: [value.business_is_pd_visited],
|
||||
business_pd_visited_remark: [value.business_pd_visited_remark],
|
||||
// business_address_details: this._formBuilder.array([]),
|
||||
business_assets_for_address: this._formBuilder.array([]),
|
||||
business_assets_details: this._formBuilder.array([]),
|
||||
business_assets_form_remark: [value.business_assets_form_remark || null]
|
||||
});
|
||||
if (value.business_address_availability == 'yes') {
|
||||
// if (value.business_address_availability == 'yes') {
|
||||
|
||||
this.addBusinessAssetsForAddress(value.business_assets_for_address);
|
||||
}
|
||||
else {
|
||||
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
control.push(this.createBusinessAssetsForAddress());
|
||||
}
|
||||
// this.addBusinessAssetsForAddress(value.business_assets_for_address);
|
||||
// }
|
||||
// else {
|
||||
// const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
// control.push(this.createBusinessAssetsForAddress());
|
||||
// }
|
||||
this.addBusinessAddressAssetsDetailsWithData(value.business_assets_for_address);
|
||||
this.addBusinessAssetsDetailsWithData(value.business_assets_details);
|
||||
} else {
|
||||
this._businessAssetsQuesFrom = this._formBuilder.group({
|
||||
pdid: [this.pdid],
|
||||
formid: ['22'],
|
||||
company_id: [this.company_id],
|
||||
business_assets_for_address: this._formBuilder.array([]),
|
||||
business_assets_details: this._formBuilder.array([ this.initBusinessDetails() ]),
|
||||
business_years: [''],
|
||||
business_month: [''],
|
||||
business_address_availability: [''],
|
||||
business_is_pd_visited: [''],
|
||||
business_pd_visited_remark: [''],
|
||||
business_assets_for_address: this._formBuilder.array([ this.createBusinessAssetsForAddress() ]),
|
||||
business_assets_form_remark: ['']
|
||||
});
|
||||
this.loadaddresses();
|
||||
}
|
||||
this.loadDetails = true;
|
||||
}
|
||||
@ -268,8 +316,17 @@ export class BusinessAssetsInfoComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
createBusinessAssetsForAddress(): FormGroup {
|
||||
|
||||
initBusinessAddressDetails() {
|
||||
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_ownership_type: [''],
|
||||
business_monthly_rented_amt: [''],
|
||||
@ -277,10 +334,23 @@ export class BusinessAssetsInfoComponent implements OnInit {
|
||||
business_name_of_the_other_owner: [''],
|
||||
business_vintage: [''],
|
||||
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) {
|
||||
|
||||
// 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 {
|
||||
return this._formBuilder.group({
|
||||
business_approximate_market_value: [data.business_approximate_market_value],
|
||||
business_ownership_type: [data.business_ownership_type],
|
||||
business_monthly_rented_amt: [data.business_monthly_rented_amt],
|
||||
business_name_of_the_owner: [data.business_name_of_the_owner],
|
||||
business_name_of_the_other_owner: [data.business_name_of_the_other_owner],
|
||||
business_vintage: [data.business_vintage],
|
||||
business_purchase_year: [data.business_purchase_year, Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
|
||||
business_emi: [data.business_emi]
|
||||
});
|
||||
}
|
||||
// createBusinessAssetsForAddressWithData(data): FormGroup {
|
||||
// return this._formBuilder.group({
|
||||
// business_approximate_market_value: [data.business_approximate_market_value],
|
||||
// business_ownership_type: [data.business_ownership_type],
|
||||
// business_monthly_rented_amt: [data.business_monthly_rented_amt],
|
||||
// business_name_of_the_owner: [data.business_name_of_the_owner],
|
||||
// business_name_of_the_other_owner: [data.business_name_of_the_other_owner],
|
||||
// business_vintage: [data.business_vintage],
|
||||
// business_purchase_year: [data.business_purchase_year, Validators.compose([Validators.pattern("[1-9]{1}[0-9]{3}")])],
|
||||
// business_emi: [data.business_emi]
|
||||
// });
|
||||
// }
|
||||
|
||||
initBusinessDetailsWithdata(data) {
|
||||
|
||||
@ -417,12 +487,73 @@ export class BusinessAssetsInfoComponent implements OnInit {
|
||||
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) {
|
||||
// addBusinessAssetsForAddress(data) {
|
||||
|
||||
// var result = Object.keys(data).map(function (key) {
|
||||
// return data[key];
|
||||
// });
|
||||
// if (result.length > 0) {
|
||||
// result.forEach((datas, index) => {
|
||||
// this.RentAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_monthly_rented_amt);
|
||||
// this.appxMarketAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_approximate_market_value);
|
||||
// let Avaliablity = 1;
|
||||
|
||||
// if(datas.business_name_of_the_owner.length > 0){
|
||||
// datas.business_name_of_the_owner.forEach(option => {
|
||||
// if(option.id == 0 && option.group_id == 2){
|
||||
// Avaliablity = option.id;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// this.isOtherOwnerForAddress = Avaliablity == 0 ? true : false;
|
||||
|
||||
// });
|
||||
|
||||
// for (let val of result) {
|
||||
// let vals = {
|
||||
// business_approximate_market_value: val.business_approximate_market_value,
|
||||
// business_ownership_type: val.business_ownership_type,
|
||||
// business_monthly_rented_amt: val.business_monthly_rented_amt,
|
||||
// business_name_of_the_owner: val.business_name_of_the_owner,
|
||||
// business_name_of_the_other_owner: val.business_name_of_the_other_owner,
|
||||
// business_vintage: val.business_vintage,
|
||||
// business_purchase_year: val.business_purchase_year,
|
||||
// business_emi: val.business_emi
|
||||
// };
|
||||
// const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
// control.push(this.createBusinessAssetsForAddressWithData(vals));
|
||||
// }
|
||||
// } else {
|
||||
// const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
// control.push(this.createBusinessAssetsForAddress());
|
||||
// }
|
||||
// }
|
||||
|
||||
addBusinessAddressAssetsDetailsWithData(data) {
|
||||
|
||||
var result = Object.keys(data).map(function (key) {
|
||||
return data[key];
|
||||
});
|
||||
|
||||
if (result.length > 0) {
|
||||
result.forEach((datas, index) => {
|
||||
this.RentAmtInwordsForAddress[index] = this.pdTrigerService.convertNumberToWords(datas.business_monthly_rented_amt);
|
||||
@ -442,6 +573,12 @@ export class BusinessAssetsInfoComponent implements OnInit {
|
||||
|
||||
for (let val of result) {
|
||||
let vals = {
|
||||
address_label:val.address_label,
|
||||
business_years: val.business_years,
|
||||
business_month: val.business_month,
|
||||
business_address_availability: val.business_address_availability,
|
||||
business_is_pd_visited: val.business_is_pd_visited,
|
||||
business_pd_visited_remark: val.business_pd_visited_remark,
|
||||
business_approximate_market_value: val.business_approximate_market_value,
|
||||
business_ownership_type: val.business_ownership_type,
|
||||
business_monthly_rented_amt: val.business_monthly_rented_amt,
|
||||
@ -452,11 +589,12 @@ export class BusinessAssetsInfoComponent implements OnInit {
|
||||
business_emi: val.business_emi
|
||||
};
|
||||
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
control.push(this.createBusinessAssetsForAddressWithData(vals));
|
||||
control.push(this.initBusinessAddressDetailsWithdata(vals));
|
||||
// this.initBusinessDetailsWithdata(vals)
|
||||
}
|
||||
} else {
|
||||
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
control.push(this.createBusinessAssetsForAddress());
|
||||
control.push(this.initBusinessAddressDetails());
|
||||
}
|
||||
}
|
||||
|
||||
@ -647,9 +785,20 @@ export class BusinessAssetsInfoComponent implements OnInit {
|
||||
|
||||
|
||||
/** To Convert Month into Year */
|
||||
ConvertMonthintoYear(e) {
|
||||
ConvertMonthintoYear(e,i) {
|
||||
// const address_control = <FormArray>this._EditPDtriggerForm.controls['addresses'];
|
||||
console.log(e);
|
||||
console.log(i);
|
||||
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
|
||||
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_year: number = e / 12;
|
||||
@ -657,35 +806,41 @@ export class BusinessAssetsInfoComponent implements OnInit {
|
||||
let Year = +business_year + +Math.floor(converted_year);
|
||||
|
||||
if (Year > this.generalExistBusinessYear) {
|
||||
this.yearErrorMessage = "Higher than Business Vintage";
|
||||
this._businessAssetsQuesFrom.controls.business_years.setValue('');
|
||||
this._businessAssetsQuesFrom.controls.business_month.setValue('');
|
||||
this.yearErrorMessage[i] = "Higher than Business Vintage";
|
||||
// this._businessAssetsQuesFrom.controls.business_years.setValue('');
|
||||
control.controls[i]['controls'].business_years.setValue('');
|
||||
// this._businessAssetsQuesFrom.controls.business_month.setValue('');
|
||||
control.controls[i]['controls'].business_month.setValue('');
|
||||
|
||||
}
|
||||
else {
|
||||
if (Year == this.generalExistBusinessYear && +converted_month > this.generalExistBusinessMonth) {
|
||||
this.monthErrorMessage = "Higher than Business Vintage";
|
||||
this._businessAssetsQuesFrom.controls.business_years.setValue('');
|
||||
this._businessAssetsQuesFrom.controls.business_month.setValue('');
|
||||
this.monthErrorMessage[i] = "Higher than Business Vintage";
|
||||
// this._businessAssetsQuesFrom.controls.business_years.setValue('');
|
||||
control.controls[i]['controls'].business_years.setValue('');
|
||||
control.controls[i]['controls'].business_month.setValue('');
|
||||
// this._businessAssetsQuesFrom.controls.business_month.setValue('');
|
||||
|
||||
} else {
|
||||
this.monthErrorMessage = '';
|
||||
this.yearErrorMessage = '';
|
||||
this._businessAssetsQuesFrom.controls.business_years.setValue(+business_year + +Math.floor(converted_year));
|
||||
this._businessAssetsQuesFrom.controls.business_month.setValue(Math.floor(converted_month));
|
||||
this.monthErrorMessage[i] = '';
|
||||
this.yearErrorMessage[i] = '';
|
||||
// this._businessAssetsQuesFrom.controls.business_years.setValue(+business_year + +Math.floor(converted_year));
|
||||
control.controls[i]['controls'].business_years.setValue(+business_year + +Math.floor(converted_year));
|
||||
control.controls[i]['controls'].business_month.setValue(Math.floor(converted_month));
|
||||
// this._businessAssetsQuesFrom.controls.business_month.setValue(Math.floor(converted_month));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkWithExistBusinessYear(e) {
|
||||
|
||||
checkWithExistBusinessYear(e,i) {
|
||||
const control = <FormArray>this._businessAssetsQuesFrom.controls['business_assets_for_address'];
|
||||
if (+e > this.generalExistBusinessYear) {
|
||||
this.yearErrorMessage = "Higher than Business Vintage";
|
||||
this._businessAssetsQuesFrom.controls.business_years.setValue('');
|
||||
|
||||
this.yearErrorMessage[i] = "Higher than Business Vintage";
|
||||
// this._businessAssetsQuesFrom.controls.business_years.setValue('');
|
||||
control.controls[i]['controls'].business_years.setValue('');
|
||||
}
|
||||
else {
|
||||
this.yearErrorMessage = '';
|
||||
this.yearErrorMessage[i] = '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -693,23 +848,23 @@ export class BusinessAssetsInfoComponent implements OnInit {
|
||||
|
||||
if (flag == 1) {
|
||||
if (value == 'yes') {
|
||||
this._businessAssetsQuesFrom.controls.business_years.setValidators([Validators.required]);
|
||||
this._businessAssetsQuesFrom.controls.business_address_availability.setValidators([Validators.required]);
|
||||
this._businessAssetsQuesFrom.controls.business_is_pd_visited.setValidators([Validators.required]);
|
||||
this._businessAssetsQuesFrom.controls.business_pd_visited_remark.setValidators([Validators.required]);
|
||||
item.controls.business_years.setValidators([Validators.required]);
|
||||
item.controls.business_address_availability.setValidators([Validators.required]);
|
||||
item.controls.business_is_pd_visited.setValidators([Validators.required]);
|
||||
item.controls.business_pd_visited_remark.setValidators([Validators.required]);
|
||||
|
||||
}
|
||||
else {
|
||||
this._businessAssetsQuesFrom.controls.business_years.clearValidators();
|
||||
this._businessAssetsQuesFrom.controls.business_address_availability.clearValidators();
|
||||
this._businessAssetsQuesFrom.controls.business_is_pd_visited.clearValidators();
|
||||
this._businessAssetsQuesFrom.controls.business_pd_visited_remark.clearValidators();
|
||||
item.controls.business_years.clearValidators();
|
||||
item.controls.business_address_availability.clearValidators();
|
||||
item.controls.business_is_pd_visited.clearValidators();
|
||||
item.controls.business_pd_visited_remark.clearValidators();
|
||||
|
||||
}
|
||||
this._businessAssetsQuesFrom.controls.business_years.updateValueAndValidity();
|
||||
this._businessAssetsQuesFrom.controls.business_address_availability.updateValueAndValidity();
|
||||
this._businessAssetsQuesFrom.controls.business_is_pd_visited.updateValueAndValidity();
|
||||
this._businessAssetsQuesFrom.controls.business_pd_visited_remark.updateValueAndValidity();
|
||||
item.controls.business_years.updateValueAndValidity();
|
||||
item.controls.business_address_availability.updateValueAndValidity();
|
||||
item.controls.business_is_pd_visited.updateValueAndValidity();
|
||||
item.controls.business_pd_visited_remark.updateValueAndValidity();
|
||||
|
||||
}
|
||||
if (flag == 3) {
|
||||
|
||||
@ -189,6 +189,7 @@ export class ClientInfoComponent implements OnInit {
|
||||
data => {
|
||||
if (data.dataStatus) {
|
||||
let dataForm = data.records;
|
||||
console.log(dataForm);
|
||||
if (dataForm !== undefined) {
|
||||
this._supplierQuesFrom = this._formBuilder.group({
|
||||
pdid: [this.pdid],
|
||||
@ -206,10 +207,26 @@ export class ClientInfoComponent implements OnInit {
|
||||
// let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
|
||||
// return dataForm.main_raw_materials[key];
|
||||
// });
|
||||
let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
|
||||
// let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
|
||||
|
||||
this.initManufacturingProductsDetails(api_main_raw_materials);
|
||||
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null);
|
||||
// this.initManufacturingProductsDetails(api_main_raw_materials);
|
||||
// this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null);
|
||||
if(dataForm.manufacturing_details[0] !== null){
|
||||
alert('not null manu');
|
||||
let api_main_raw_materials = Object.keys(dataForm.manufacturing_details).map(function (key) {
|
||||
return dataForm.manufacturing_details[key];
|
||||
});
|
||||
|
||||
this.initManufacturingProductsDetails(api_main_raw_materials[0]['main_raw_materials']);
|
||||
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(api_main_raw_materials[0]['main_raw_materials_total_payments_percent_on_credit'] || null);
|
||||
|
||||
}
|
||||
else{
|
||||
alert('null manu');
|
||||
this.initManufacturingProductsDetails(null);
|
||||
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Load form details for the wholeshale trading details
|
||||
@ -218,10 +235,26 @@ export class ClientInfoComponent implements OnInit {
|
||||
// let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
|
||||
// return dataForm.trading_products[key];
|
||||
// });
|
||||
let api_trading_products = dataForm.trade_details[0].trading_products;
|
||||
// let api_trading_products = dataForm.trade_details[0].trading_products;
|
||||
|
||||
this.initTradingProductsDetails(api_trading_products);
|
||||
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null);
|
||||
// this.initTradingProductsDetails(api_trading_products);
|
||||
// this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null);
|
||||
if(dataForm.trade_details[0] !== null){
|
||||
// alert('not null manu');
|
||||
let api_trading_products = Object.keys(dataForm.trade_details).map(function (key) {
|
||||
return dataForm.trade_details[key];
|
||||
});
|
||||
|
||||
this.initTradingProductsDetails(api_trading_products[0]['trading_products']);
|
||||
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0]['trading_products_total_payments_percent_on_credit'] || null);
|
||||
|
||||
}
|
||||
else{
|
||||
// alert('null manu');
|
||||
this.initTradingProductsDetails(null);-
|
||||
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Load form details for the service provider prduct details
|
||||
@ -230,9 +263,28 @@ export class ClientInfoComponent implements OnInit {
|
||||
// let api_service_provider_products = Object.keys(dataForm.service_products).map(function (key) {
|
||||
// return dataForm.service_products[key];
|
||||
// });
|
||||
let api_service_provider_products = dataForm.service_provider_details[0].service_products;
|
||||
this.initServiceProviderProductsDetails(api_service_provider_products);
|
||||
this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_provider_details[0].service_products_total_payments_percent_on_credit || null);
|
||||
// let api_service_provider_products = dataForm.service_provider_details[0].service_products;
|
||||
// this.initServiceProviderProductsDetails(api_service_provider_products);
|
||||
// this._supplierQuesFrom.controls['service_provider_details']['controls'][0].controls['service_products_total_payments_percent_on_credit'].setValue(dataForm.service_provider_details[0].service_products_total_payments_percent_on_credit || null);
|
||||
if(dataForm.service_provider_details[0] !== null){
|
||||
// alert('not null manu');
|
||||
let api_service_provider_products = Object.keys(dataForm.manufacturing_details).map(function (key) {
|
||||
return dataForm.manufacturing_details[key];
|
||||
});
|
||||
|
||||
this.initServiceProviderProductsDetails(api_service_provider_products[0]['service_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(api_service_provider_products[0]['service_products_total_payments_percent_on_credit'] || null);
|
||||
|
||||
}
|
||||
else{
|
||||
// alert('null manu');
|
||||
|
||||
this.initServiceProviderProductsDetails(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);
|
||||
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null);
|
||||
|
||||
}
|
||||
}
|
||||
// Load form details for the retail trading details
|
||||
let arr3 = record.filter(data => data.type_of_activity_id == 3);
|
||||
|
||||
@ -184,14 +184,24 @@ export class CurrentLoanComponent implements OnInit {
|
||||
} else {
|
||||
|
||||
this._pd.getAssetsWithLoanFromBusiness(this.pdid).subscribe(data=>{
|
||||
|
||||
console.log('data',data);
|
||||
|
||||
if(data.dataStatus == true){
|
||||
|
||||
|
||||
console.log('data',data.record);
|
||||
// return;
|
||||
|
||||
let AssetData = data.record;
|
||||
|
||||
if(AssetData.business_address_asset.length>0){
|
||||
AssetData.business_address_asset.map(element => {
|
||||
this.dataFromAssets.push({mode:0,
|
||||
mode_name:element.address_label,
|
||||
details:[],
|
||||
owner_name:element.business_name_of_the_owner,
|
||||
form_type:'Data From Bussiness Address'})
|
||||
});
|
||||
}
|
||||
|
||||
if(AssetData.business_assets.length>0){
|
||||
AssetData.business_assets.map(element => {
|
||||
this.dataFromAssets.push({mode:element.business_assets_mode,
|
||||
@ -225,6 +235,13 @@ export class CurrentLoanComponent implements OnInit {
|
||||
|
||||
this.dataFromAssets.forEach((val,index) => {
|
||||
|
||||
if(val.mode == 0){
|
||||
let owner = val.owner_name.map((e => {
|
||||
return e.name.split(',')
|
||||
}));
|
||||
labelarray[index] = val.mode_name +' - '+owner ;
|
||||
}
|
||||
|
||||
if(val.mode == 1){
|
||||
let data;
|
||||
let owner
|
||||
|
||||
@ -425,7 +425,7 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field style="width:42%;" *ngIf="financialForm.controls.is_there_working_capital_available.value == 'yes' && financialForm.controls.working_capital_facilities_availed.value != ''">
|
||||
<input matInput autocomplete="off" placeholder="Specify The Reason"
|
||||
<input matInput autocomplete="off" placeholder="Details of Facility"
|
||||
formControlName="reason_for_working_capital_facilities_availed">
|
||||
</mat-form-field>
|
||||
</mat-card-content>
|
||||
|
||||
@ -138,16 +138,30 @@ export class StockComponent implements OnInit {
|
||||
}
|
||||
|
||||
public initstockForms(record){
|
||||
|
||||
console.log('record.from_business',record.from_business);
|
||||
let api = Object.keys(record.from_business).map(function (key) {
|
||||
return record.from_business[key];
|
||||
});
|
||||
console.log(api);
|
||||
let type2 = record.from_business.filter(data => data.type_of_activity_id == 2);
|
||||
let type2length = type2[0].products ? type2[0].products.length : 0;
|
||||
console.log('type2[0].hasOwnProperty("products")',type2[0].hasOwnProperty("products"));
|
||||
console.log('type2',type2);
|
||||
console.log('type2 0 index',type2[0]);
|
||||
console.log('type2 product',type2[0].product);
|
||||
// console.log('type2 length',type2[0].product.length);
|
||||
|
||||
let type2length = type2[0].hasOwnProperty("products") ? type2[0].products.length : 0;
|
||||
let type3 = record.from_business.filter(data => data.type_of_activity_id == 3);
|
||||
let type3length = type3[0].products ? type2[0].products.length : 0;
|
||||
let type3length = type3[0].hasOwnProperty("products") ? type3[0].products.length : 0;
|
||||
let type4 = record.from_business.filter(data => data.type_of_activity_id == 4);
|
||||
let type4length = type4[0].products ? type2[0].products.length : 0;
|
||||
let type4length = type4[0].hasOwnProperty("products") ? type4[0].products.length : 0;
|
||||
|
||||
console.log(type2);
|
||||
console.log(type2length);
|
||||
console.log(type3);
|
||||
console.log(type3length);
|
||||
console.log(type4);
|
||||
console.log(type4length);
|
||||
|
||||
let rm_api = record.from_supplier;
|
||||
|
||||
|
||||
@ -183,19 +183,53 @@ export class SupplierInfoComponent implements OnInit {
|
||||
// let api_main_raw_materials = Object.keys(dataForm.main_raw_materials).map(function (key) {
|
||||
// return dataForm.main_raw_materials[key];
|
||||
// });
|
||||
let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
|
||||
// let api_main_raw_materials = dataForm.manufacturing_details[0].main_raw_materials;
|
||||
|
||||
// this.initManufacturingProductsDetails(api_main_raw_materials);
|
||||
// this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null);
|
||||
if(dataForm.manufacturing_details[0] !== null){
|
||||
// alert('not null manu');
|
||||
let api_main_raw_materials = Object.keys(dataForm.manufacturing_details).map(function (key) {
|
||||
return dataForm.manufacturing_details[key];
|
||||
});
|
||||
|
||||
this.initManufacturingProductsDetails(api_main_raw_materials[0]['main_raw_materials']);
|
||||
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(api_main_raw_materials[0]['main_raw_materials_total_payments_percent_on_credit'] || null);
|
||||
|
||||
this.initManufacturingProductsDetails(api_main_raw_materials);
|
||||
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(dataForm.manufacturing_details[0].main_raw_materials_total_payments_percent_on_credit || null);
|
||||
}
|
||||
else{
|
||||
// alert('null manu');
|
||||
this.initManufacturingProductsDetails(null);
|
||||
this._supplierQuesFrom.controls['manufacturing_details']['controls'][0].controls['main_raw_materials_total_payments_percent_on_credit'].setValue(null);
|
||||
|
||||
}
|
||||
|
||||
let arr1 = record.filter(data => data.type_of_activity_id == 3 || data.type_of_activity_id ==4);
|
||||
if(arr1.length > 0) {
|
||||
console.log('saas');
|
||||
// let api_trading_products = Object.keys(dataForm.trading_products).map(function (key) {
|
||||
// return dataForm.trading_products[key];
|
||||
// });
|
||||
let api_trading_products = dataForm.trade_details[0].trading_products;
|
||||
this.initTradingProductsDetails(api_trading_products);
|
||||
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null);
|
||||
// let api_trading_products = dataForm.trade_details[0].trading_products;
|
||||
// this.initTradingProductsDetails(api_trading_products);
|
||||
// this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(dataForm.trade_details[0].trading_products_total_payments_percent_on_credit || null);
|
||||
if(dataForm.trade_details[0] !== null){
|
||||
alert('not null trade');
|
||||
let api_trading_products = Object.keys(dataForm.trade_details).map(function (key) {
|
||||
return dataForm.trade_details[key];
|
||||
});
|
||||
console.log(api_trading_products[0]['trading_products']);
|
||||
this.initTradingProductsDetails(api_trading_products[0]['trading_products']);
|
||||
// this.initTradingProductsDetails(api_trading_products['trading_products']);
|
||||
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(api_trading_products[0]['trading_products_total_payments_percent_on_credit'] || null);
|
||||
}
|
||||
else{
|
||||
alert('null trade');
|
||||
this.initTradingProductsDetails(null);
|
||||
this._supplierQuesFrom.controls['trade_details']['controls'][0].controls['trading_products_total_payments_percent_on_credit'].setValue(null);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
this.noRecordsFound = true;
|
||||
} else {
|
||||
|
||||
@ -92,17 +92,32 @@
|
||||
</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="10" appPdLocatedMapView [value]="master">
|
||||
<!-- <span><i class="fa-1x fa fa-map-marker" style="width: 37px;padding: 8px 9px 8px 9px;border-bottom: 2px solid red;"></i></span> -->
|
||||
<span><i class="fa-1x fa fa-map-marker" style="width: 37px;padding: 8px 9px 8px 9px;border-bottom: 2px solid red;"></i></span>
|
||||
</div>
|
||||
<div fxFlex="90">
|
||||
<span *ngIf="master.state_name" class="hover-icon"> {{master.addressline1}},<br> {{master.city_name}},<br>{{master.state_name}}-{{master.pincode_id == 1 ? master.other_pincode : master.pincode }} </span>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div fxLayout="row">
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100" class="profile-center">
|
||||
<div *ngFor="let addresses of master.addresses">
|
||||
<div fxFlex="10" appPdLocatedMapView [value]="addresses">
|
||||
<!-- <span><i class="fa-1x fa fa-map-marker" style="width: 37px;padding: 8px 9px 8px 9px;border-bottom: 2px solid red;"></i></span> -->
|
||||
<span><i class="fa-1x fa fa-map-marker" style="width: 37px;padding: 8px 9px 8px 9px;border-bottom: 2px solid red;"></i></span>
|
||||
</div>
|
||||
<div fxFlex="90">
|
||||
<span *ngIf="addresses.state_name" class="hover-icon"> {{addresses.addressline}},<br> {{addresses.city_name}},<br>{{addresses.state_name}}-{{addresses.pincode == 1 ? addresses.other_pincode : addresses.pincode_display }} </span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--<div fxLayout="row">
|
||||
<div fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100" class="profile-center">
|
||||
<span><i class="fa-1x fa fa-suitcase" style="width: 37px;padding: 8px 9px 8px 9px;border-bottom: 2px solid red;"></i> {{master.addressline1}}</span>
|
||||
@ -279,9 +294,15 @@
|
||||
<ng-template mat-tab-label>PD History</ng-template>
|
||||
<div *ngIf="masterPdLogsData.length>0; else nohistory">
|
||||
<mat-list class="m-gap p-gap" *ngFor="let master of masterPdLogsData">
|
||||
<mat-list-item>
|
||||
<mat-list-item [ngClass]="master.meta_data ? 'metaDataStyle' : '' ">
|
||||
<span style="font-size:15px;"><span style="color:#908f8f">{{master.time}} </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>
|
||||
|
||||
|
||||
@ -10,6 +10,10 @@
|
||||
padding: 0rem !important;
|
||||
}
|
||||
|
||||
.metaDataStyle{
|
||||
height:89px !important;
|
||||
}
|
||||
|
||||
|
||||
:host {
|
||||
margin-left: -5px;
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { Component, OnInit,ViewEncapsulation, EventEmitter, Input, Output, OnDestroy, Pipe, PipeTransform } from '@angular/core';
|
||||
import { Component, OnInit, ViewEncapsulation, EventEmitter, Input, Output, OnDestroy, Pipe, PipeTransform } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import {DatePipe } from '@angular/common';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import { PdTrigerService } from '../../../pd-service/pd-triger.service';
|
||||
import { PdAllocationComponent } from '../pd-allocation/pd-allocation.component';
|
||||
@ -26,94 +26,63 @@ import Swal from 'sweetalert2';
|
||||
})
|
||||
export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
pipe = new DatePipe('en-US');
|
||||
private notifier:NotifierService;
|
||||
private notifier: NotifierService;
|
||||
|
||||
errorMessage: any;
|
||||
pdMasterData: any=[];
|
||||
pdApplicantData: any=[];
|
||||
pdDocumentsData: any=[];
|
||||
masterPdLogsData: any=[];
|
||||
applicantPDLogsData: any=[];
|
||||
pdAdditionalReqData: any=[];
|
||||
FilteredFieldNames : any=[];
|
||||
localcount :any;
|
||||
localstring : any;
|
||||
localMandatoryFields: any=
|
||||
[ {'backEnd_FieldName':"fk_lender_id",'frontEnd_FieldName':"Lender Name"},
|
||||
{'backEnd_FieldName':"lender_applicant_id",'frontEnd_FieldName':"Loan Applicant ID"},
|
||||
{'backEnd_FieldName':"fk_product_id",'frontEnd_FieldName':"Product Name"},
|
||||
{'backEnd_FieldName':"fk_subproduct_id",'frontEnd_FieldName':"Sub Product Name"},
|
||||
{'backEnd_FieldName':"fk_pd_type",'frontEnd_FieldName':"PD Type"},
|
||||
{'backEnd_FieldName':"fk_customer_segment",'frontEnd_FieldName':"Customer Segment"},
|
||||
{'backEnd_FieldName':"loan_amount",'frontEnd_FieldName':"Loan Amount"},
|
||||
{'backEnd_FieldName':"addressline1",'frontEnd_FieldName':"Address at which PD is to be done"},
|
||||
{'backEnd_FieldName':"fk_city",'frontEnd_FieldName':"City"},
|
||||
{'backEnd_FieldName':"fk_state",'frontEnd_FieldName':"State"},
|
||||
{'backEnd_FieldName':"pincode",'frontEnd_FieldName':"Pincode"},
|
||||
{'backEnd_FieldName':"pd_contact_person",'frontEnd_FieldName':"Lender Contact Person"},
|
||||
{'backEnd_FieldName':"pd_contact_mobileno",'frontEnd_FieldName':"Lender's Mobile Number"},
|
||||
{'backEnd_FieldName':"pd_branch_id",'frontEnd_FieldName':"Branch"},
|
||||
{'backEnd_FieldName':"pd_contact_landline",'frontEnd_FieldName':"Lender's Landline Number"},
|
||||
{'backEnd_FieldName':"main_applicant",'frontEnd_FieldName':"Applicant Master"}];
|
||||
// localMandatoryFields: any=
|
||||
// ['fk_lender_id',
|
||||
// 'lender_applicant_id',
|
||||
// 'fk_product_id',
|
||||
// 'fk_subproduct_id',
|
||||
// 'fk_pd_type',
|
||||
// 'fk_customer_segment',
|
||||
// 'loan_amount',
|
||||
// 'addressline1',
|
||||
// 'fk_city',
|
||||
// 'fk_state',
|
||||
// 'pincode',
|
||||
// 'pd_contact_person',
|
||||
// 'pd_contact_mobileno',
|
||||
// 'pd_branch_id',
|
||||
// 'pd_contact_landline'];
|
||||
pdMasterData: any = [];
|
||||
pdAddressesData: any = [];
|
||||
pdApplicantData: any = [];
|
||||
pdDocumentsData: any = [];
|
||||
masterPdLogsData: any = [];
|
||||
applicantPDLogsData: any = [];
|
||||
pdAdditionalReqData: any = [];
|
||||
FilteredFieldNames: any = [];
|
||||
localcount: any;
|
||||
localstring: any;
|
||||
localMandatoryFields: any =
|
||||
[{ 'backEnd_FieldName': "fk_lender_id", 'frontEnd_FieldName': "Lender Name" },
|
||||
{ 'backEnd_FieldName': "lender_applicant_id", 'frontEnd_FieldName': "Loan Applicant ID" },
|
||||
{ 'backEnd_FieldName': "fk_product_id", 'frontEnd_FieldName': "Product Name" },
|
||||
{ 'backEnd_FieldName': "fk_subproduct_id", 'frontEnd_FieldName': "Sub Product Name" },
|
||||
{ 'backEnd_FieldName': "fk_pd_type", 'frontEnd_FieldName': "PD Type" },
|
||||
{ 'backEnd_FieldName': "fk_customer_segment", 'frontEnd_FieldName': "Customer Segment" },
|
||||
{ 'backEnd_FieldName': "loan_amount", 'frontEnd_FieldName': "Loan Amount" },
|
||||
{ 'backEnd_FieldName': "addressline1", 'frontEnd_FieldName': "Address at which PD is to be done" },
|
||||
{ 'backEnd_FieldName': "fk_city", 'frontEnd_FieldName': "City" },
|
||||
{ 'backEnd_FieldName': "fk_state", 'frontEnd_FieldName': "State" },
|
||||
{ 'backEnd_FieldName': "pincode", 'frontEnd_FieldName': "Pincode" },
|
||||
{ 'backEnd_FieldName': "pd_contact_person", 'frontEnd_FieldName': "Lender Contact Person" },
|
||||
{ 'backEnd_FieldName': "pd_contact_mobileno", 'frontEnd_FieldName': "Lender's Mobile Number" },
|
||||
{ 'backEnd_FieldName': "pd_branch_id", 'frontEnd_FieldName': "Branch" },
|
||||
{ 'backEnd_FieldName': "pd_contact_landline", 'frontEnd_FieldName': "Lender's Landline Number" },
|
||||
{ 'backEnd_FieldName': "main_applicant", 'frontEnd_FieldName': "Applicant Master" }];
|
||||
|
||||
// localMandatoryFields2: any=
|
||||
// [ "Lender Name",
|
||||
// "Loan Applicant ID",
|
||||
// "Product Name",
|
||||
// "Sub Product Name",
|
||||
// "PD Type",
|
||||
// "Customer Segment",
|
||||
// "Loan Amount",
|
||||
// "Address at which PD is to be done",
|
||||
// "City",
|
||||
// "State",
|
||||
// "Pincode",
|
||||
// "Lender Contact Person",
|
||||
// "Lender's Mobile Number",
|
||||
// "Branch",
|
||||
// "Lender's Landline Number"];
|
||||
|
||||
viewID:string;
|
||||
viewParams:any;
|
||||
destroyType:number=1;
|
||||
currentPDStatus:string;
|
||||
viewID: string;
|
||||
viewParams: any;
|
||||
destroyType: number = 1;
|
||||
currentPDStatus: string;
|
||||
enableStartPD: boolean;
|
||||
|
||||
// create values for status check
|
||||
pdStatusCheck :any={
|
||||
"DRAFT" :'DRAFT',
|
||||
"TRIGGERED" :'TRIGGERED',
|
||||
"ALLOCATED" :'ALLOCATED',
|
||||
"SCHEDULED" :'SCHEDULED',
|
||||
"INPROGRESS" :'INPROGRESS',
|
||||
"COMPLETED" :'COMPLETED',
|
||||
"QC_COMPLETED" :'QC_COMPLETED',
|
||||
pdStatusCheck: any = {
|
||||
"DRAFT": 'DRAFT',
|
||||
"TRIGGERED": 'TRIGGERED',
|
||||
"ALLOCATED": 'ALLOCATED',
|
||||
"SCHEDULED": 'SCHEDULED',
|
||||
"INPROGRESS": 'INPROGRESS',
|
||||
"COMPLETED": 'COMPLETED',
|
||||
"QC_COMPLETED": 'QC_COMPLETED',
|
||||
};
|
||||
|
||||
mandatoryFieldsValidations: any=[];
|
||||
mandatoryFieldsValidations: any = [];
|
||||
|
||||
// @Input() childData: string;
|
||||
// @Output() loadParent = new EventEmitter<string>();
|
||||
public _EditPDtriggerForm:FormGroup;
|
||||
constructor(notifier:NotifierService,private dialog: MatDialog,private _fb: FormBuilder,
|
||||
private _pd: PdTrigerService,private route: ActivatedRoute,private router: Router, private ListPdComponent: ListPdComponent) {
|
||||
this.notifier=notifier;
|
||||
this.enableStartPD=false;
|
||||
public _EditPDtriggerForm: FormGroup;
|
||||
constructor(notifier: NotifierService, private dialog: MatDialog, private _fb: FormBuilder,
|
||||
private _pd: PdTrigerService, private route: ActivatedRoute, private router: Router, private ListPdComponent: ListPdComponent) {
|
||||
this.notifier = notifier;
|
||||
this.enableStartPD = false;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@ -121,13 +90,11 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
this.route.params.subscribe(params => {
|
||||
this.viewID = params['pdid'];
|
||||
});
|
||||
|
||||
|
||||
this.viewPdDetails(this.viewID);
|
||||
}
|
||||
pd_QC_Rating: Number;
|
||||
|
||||
viewPdDetails(editID:string){
|
||||
viewPdDetails(editID: string) {
|
||||
this.pdMasterData = [];
|
||||
this._pd.editPdDetails(editID).subscribe(
|
||||
data => {
|
||||
@ -136,36 +103,40 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
this.pdMasterData.push(masterData[0]);
|
||||
this.mandatoryFieldsValidations = masterData[1].mandatory_fields;
|
||||
this.pd_QC_Rating = Number(this.pdMasterData.qc_rating);
|
||||
this.pdApplicantData= data.records.applicants_details;
|
||||
this.pdApplicantData = data.records.applicants_details;
|
||||
this.pdApplicantData = this.pdApplicantData.filter(appt => appt.applicant_type != 2);
|
||||
this.pdDocumentsData=data.records.pd_documnets;
|
||||
this.masterPdLogsData=data.records.pd_logs.master;
|
||||
//this.applicantPDLogsData= data.records.pd_logs.master;
|
||||
this.pdDocumentsData = data.records.pd_documnets;
|
||||
this.masterPdLogsData = Object.keys(data.records.pd_logs.master).map(function (key) {
|
||||
return data.records.pd_logs.master[key];
|
||||
});
|
||||
// console.log('data.records.pd_addressdata', data.records.pd_addressdata);
|
||||
this.pdMasterData[0].addresses = data.records.pd_address.filter(item => item.isactive == 1);
|
||||
// console.log('this.pdMasterData[0].addresses', this.pdMasterData[0].addresses);
|
||||
this.currentPDStatus = data.records.pd_master_details[0].pd_status;
|
||||
this.pdAdditionalReqData = data.records.pd_additional_requirements;
|
||||
// enable pd start time
|
||||
if(data.records.pd_master_details[0].scheduled_on_for_validation){
|
||||
if (data.records.pd_master_details[0].scheduled_on_for_validation) {
|
||||
let courrentDateTime: string = this.pipe.transform(new Date(), 'yyyy-MM-dd HH:mm');
|
||||
let scheduledDateTime: string=data.records.pd_master_details[0].scheduled_on_for_validation;
|
||||
let scheduledDateTime: string = data.records.pd_master_details[0].scheduled_on_for_validation;
|
||||
let diffInMs: number = Date.parse(courrentDateTime) - Date.parse(scheduledDateTime);
|
||||
let diffInHours: number = Math.floor(diffInMs / 1000 / 60 / 60);
|
||||
if(diffInHours>=-4){
|
||||
this.enableStartPD=true;
|
||||
if (diffInHours >= -4) {
|
||||
this.enableStartPD = true;
|
||||
}
|
||||
else {
|
||||
this.enableStartPD=false;
|
||||
this.enableStartPD = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.enableStartPD=false;
|
||||
this.enableStartPD = false;
|
||||
}
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
}, error => this.errorMessage = <any>error);
|
||||
}
|
||||
|
||||
loadPdListCompoent() {
|
||||
this.destroyType=2;
|
||||
this.router.navigate([ '../../' ], { relativeTo: this.route });
|
||||
this.destroyType = 2;
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
this.ListPdComponent.pdListLoad(true);
|
||||
}
|
||||
|
||||
@ -211,38 +182,38 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
// })
|
||||
// }
|
||||
|
||||
Maponclick(master : any){
|
||||
Maponclick(master: any) {
|
||||
let url = "https://www.google.com/maps/place/"
|
||||
let concat_url = url+master.addressline1+'/'+master.city_name+','+master.pincode+','+master.state_name;
|
||||
window.open(concat_url,'_blank');
|
||||
let concat_url = url + master.addressline1 + '/' + master.city_name + ',' + master.pincode + ',' + master.state_name;
|
||||
window.open(concat_url, '_blank');
|
||||
}
|
||||
|
||||
editPdMaster(masterData:any,flag){
|
||||
editPdMaster(masterData: any, flag) {
|
||||
let record = {
|
||||
"records":masterData,
|
||||
"records": masterData,
|
||||
"applicantLength": this.pdApplicantData.length
|
||||
}
|
||||
const dialogPDMaster = this.dialog.open(EditPdMasterComponent, {
|
||||
data: record,
|
||||
position: { right: '0'},
|
||||
position: { right: '0' },
|
||||
width: '80%',
|
||||
disableClose: true
|
||||
});
|
||||
dialogPDMaster.afterOpen()
|
||||
.subscribe(dataresult => {
|
||||
if(flag == 1){
|
||||
let ffd : any = [];
|
||||
if (flag == 1) {
|
||||
let ffd: any = [];
|
||||
this.FilteredFieldNames.forEach(field => {
|
||||
ffd.push(field.frontEnd_FieldName);
|
||||
});
|
||||
|
||||
// this.notifier.notify('info', 'Please Fill ' + ffd.join(' , ') + ' Fields.!');
|
||||
Swal({
|
||||
title:'Please complete the below details',
|
||||
title: 'Please complete the below details',
|
||||
confirmButtonColor: "red",
|
||||
// html:true,
|
||||
//text:'Please Fill' + ffd.forEach(data=>{ data }) + ' ! ',
|
||||
text:ffd.join(' , ')
|
||||
text: ffd.join(' , ')
|
||||
});
|
||||
// Swal({
|
||||
// title: "HTML <small>Title</small>!",
|
||||
@ -256,14 +227,14 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
this.viewPdDetails(this.viewID)
|
||||
});
|
||||
}
|
||||
editPdApplicant(applicantData:any){
|
||||
editPdApplicant(applicantData: any) {
|
||||
let setPdDetails = {
|
||||
"pdID":this.viewID,
|
||||
"records":applicantData
|
||||
"pdID": this.viewID,
|
||||
"records": applicantData
|
||||
}
|
||||
const dialogApplicant = this.dialog.open(EditPdApplicantComponent, {
|
||||
data: setPdDetails,
|
||||
position: { right: '0'},
|
||||
position: { right: '0' },
|
||||
width: '60%',
|
||||
disableClose: true
|
||||
});
|
||||
@ -274,14 +245,14 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
// edit pd addtional requirements
|
||||
editAdditionalRequirement(requirementData:any){
|
||||
editAdditionalRequirement(requirementData: any) {
|
||||
let setPdDetails = {
|
||||
"pdID":this.viewID,
|
||||
"records":requirementData
|
||||
"pdID": this.viewID,
|
||||
"records": requirementData
|
||||
}
|
||||
const dialogRequirement = this.dialog.open(PdRequirementComponent, {
|
||||
data: setPdDetails,
|
||||
position: { right: '0'},
|
||||
position: { right: '0' },
|
||||
width: '60%',
|
||||
disableClose: true
|
||||
});
|
||||
@ -292,11 +263,11 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
// pd allocation to
|
||||
pdAllocationTo(pdData:any) {
|
||||
if(pdData.fk_pd_type == 1){
|
||||
pdAllocationTo(pdData: any) {
|
||||
if (pdData.fk_pd_type == 1) {
|
||||
const dialogRef = this.dialog.open(PdAllocationComponent, {
|
||||
data: pdData,
|
||||
position: { right: '0'},
|
||||
position: { right: '0' },
|
||||
width: '80%',
|
||||
disableClose: true
|
||||
});
|
||||
@ -306,10 +277,10 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
this.viewPdDetails(this.viewID)
|
||||
});
|
||||
}
|
||||
else if(pdData.fk_pd_type == 2){
|
||||
else if (pdData.fk_pd_type == 2) {
|
||||
const dialogRef = this.dialog.open(SmartPdAllocationComponent, {
|
||||
data: pdData,
|
||||
position: { right: '0'},
|
||||
position: { right: '0' },
|
||||
width: '80%',
|
||||
disableClose: true
|
||||
});
|
||||
@ -320,10 +291,10 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
this.viewPdDetails(this.viewID)
|
||||
});
|
||||
}
|
||||
else if(pdData.fk_pd_type == 3){
|
||||
else if (pdData.fk_pd_type == 3) {
|
||||
const dialogRef = this.dialog.open(TelePdAllocationComponent, {
|
||||
data: pdData,
|
||||
position: { right: '0'},
|
||||
position: { right: '0' },
|
||||
width: '80%',
|
||||
disableClose: true,
|
||||
});
|
||||
@ -339,7 +310,7 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
// pd schedule details
|
||||
scheduleDetails(pdData:any){
|
||||
scheduleDetails(pdData: any) {
|
||||
|
||||
const dialogSchedule = this.dialog.open(SchedulePdComponent, {
|
||||
data: pdData,
|
||||
@ -353,30 +324,30 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
// start pd
|
||||
getPDStart(pdID:any, status: string){
|
||||
this.destroyType=3;
|
||||
if(status==this.pdStatusCheck.SCHEDULED){
|
||||
getPDStart(pdID: any, status: string) {
|
||||
this.destroyType = 3;
|
||||
if (status == this.pdStatusCheck.SCHEDULED) {
|
||||
const dialogRef = this.dialog.open(PdStatusChangeDialogueComponent, {
|
||||
data: { pdid: this.viewID, pd_status: this.pdStatusCheck.INPROGRESS },
|
||||
disableClose: true,
|
||||
minWidth:'30%',
|
||||
maxWidth:'40%',
|
||||
minWidth: '30%',
|
||||
maxWidth: '40%',
|
||||
});
|
||||
dialogRef.afterClosed()
|
||||
.subscribe(dataresult => {
|
||||
if(dataresult.update_status==true){
|
||||
this.router.navigate([ '../../startpd',pdID], { relativeTo: this.route });
|
||||
if (dataresult.update_status == true) {
|
||||
this.router.navigate(['../../startpd', pdID], { relativeTo: this.route });
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.router.navigate([ '../../startpd',pdID], { relativeTo: this.route });
|
||||
this.router.navigate(['../../startpd', pdID], { relativeTo: this.route });
|
||||
}
|
||||
}
|
||||
|
||||
getPDIDReport(pdID:any) {
|
||||
this.destroyType=3;
|
||||
this.router.navigate([ '../../pd_report',pdID], { relativeTo: this.route });
|
||||
getPDIDReport(pdID: any) {
|
||||
this.destroyType = 3;
|
||||
this.router.navigate(['../../pd_report', pdID], { relativeTo: this.route });
|
||||
}
|
||||
|
||||
// // direct trigger the pd
|
||||
@ -414,21 +385,21 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
|
||||
|
||||
// direct trigger the pd
|
||||
directTriggerPD(data: any,masterdetail : any){
|
||||
directTriggerPD(data: any, masterdetail: any) {
|
||||
|
||||
let pdid = masterdetail.pd_id;
|
||||
let getValues = data.filter(val =>val).map(Val => Val);
|
||||
let getValues = data.filter(val => val).map(Val => Val);
|
||||
this.FilteredFieldNames = getValues.map(x => {
|
||||
let findIndex = this.localMandatoryFields.map(val => val.backEnd_FieldName).indexOf(x);
|
||||
return this.localMandatoryFields[findIndex];
|
||||
});
|
||||
|
||||
if(data.length>0){
|
||||
if (data.length > 0) {
|
||||
this.localcount = 1;
|
||||
this.editPdMaster(masterdetail,this.localcount);
|
||||
this.editPdMaster(masterdetail, this.localcount);
|
||||
}
|
||||
else {
|
||||
let lenderMasterArray = {"pd_id": pdid}
|
||||
let lenderMasterArray = { "pd_id": pdid }
|
||||
this._pd.editPdMasterDetails(lenderMasterArray, this.pdStatusCheck.TRIGGERED).subscribe(result => {
|
||||
if (result.status == 200) {
|
||||
this.notifier.notify('success', 'PD Status Updated.');
|
||||
@ -445,24 +416,24 @@ export class ViewPdComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
|
||||
// updateViewComponent(editBack:string) {
|
||||
// updateViewComponent(editBack:string) {
|
||||
|
||||
// if(editBack=='1'){
|
||||
// this.showEditMasterComponent=!this.showEditMasterComponent
|
||||
// }
|
||||
// else if(editBack=='2'){
|
||||
// this.showEditApplicantComponent=!this.showEditApplicantComponent
|
||||
// }
|
||||
// else if(editBack=='3'){
|
||||
// this.showEditMasterComponent=!this.showEditMasterComponent
|
||||
// }
|
||||
// this.viewPdDetails(this.childData);
|
||||
// }
|
||||
// if(editBack=='1'){
|
||||
// this.showEditMasterComponent=!this.showEditMasterComponent
|
||||
// }
|
||||
// else if(editBack=='2'){
|
||||
// this.showEditApplicantComponent=!this.showEditApplicantComponent
|
||||
// }
|
||||
// else if(editBack=='3'){
|
||||
// this.showEditMasterComponent=!this.showEditMasterComponent
|
||||
// }
|
||||
// this.viewPdDetails(this.childData);
|
||||
// }
|
||||
ngOnDestroy(): void {
|
||||
if(this.destroyType==1){
|
||||
if (this.destroyType == 1) {
|
||||
this.ListPdComponent.pdListLoad(true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user