merge manage-pd module changes : kdk

This commit is contained in:
dineshkumarkannan 2018-11-23 19:05:05 +05:30
commit 21f17a4aba
18 changed files with 609 additions and 175 deletions

View File

@ -4294,12 +4294,14 @@
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -4314,17 +4316,20 @@
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -4441,7 +4446,8 @@
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -4453,6 +4459,7 @@
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -4467,6 +4474,7 @@
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
@ -4474,12 +4482,14 @@
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.2.4", "version": "2.2.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.1", "safe-buffer": "^5.1.1",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -4498,6 +4508,7 @@
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -4578,7 +4589,8 @@
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true,
"dev": true "dev": true,
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -4590,6 +4602,7 @@
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -4711,6 +4724,7 @@
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",

View File

@ -119,12 +119,12 @@ export class DashboardComponent {
const LastDateForPreMonth = new Date(today.getFullYear(), today.getMonth(), 0); const LastDateForPreMonth = new Date(today.getFullYear(), today.getMonth(), 0);
const FirstDateForPreMonth = new Date(today.getFullYear(), today.getMonth()-1, 1); const FirstDateForPreMonth = new Date(today.getFullYear(), today.getMonth()-1, 1);
console.log('FromDateMin:',fromMin); // console.log('FromDateMin:',fromMin);
console.log('FromDateMax:',fromMax); // console.log('FromDateMax:',fromMax);
console.log('ToDateMin',toMin); // console.log('ToDateMin',toMin);
console.log('ToDateMax',toMax); // console.log('ToDateMax',toMax);
console.log('LastDateForPreMonth',LastDateForPreMonth); // console.log('LastDateForPreMonth',LastDateForPreMonth);
console.log('FirstDateForPreMonth',FirstDateForPreMonth); // console.log('FirstDateForPreMonth',FirstDateForPreMonth);
// const resetRange = {fromDate: today, toDate: today}; // const resetRange = {fromDate: today, toDate: today};
// this.dateRangePicker.resetDates(resetRange); // will trigger selectedDateRangeChanged // this.dateRangePicker.resetDates(resetRange); // will trigger selectedDateRangeChanged
@ -134,7 +134,7 @@ export class DashboardComponent {
this.options = { this.options = {
presets: this.presets, presets: this.presets,
format: 'mediumDate', format: 'mediumDate',
range: {fromDate:FirstDateForPreMonth, toDate: LastDateForPreMonth}, range: {fromDate:FirstDateForPreMonth, toDate: fromMax},
applyLabel: "Submit", applyLabel: "Submit",
calendarOverlayConfig: { calendarOverlayConfig: {
shouldCloseOnBackdropClick: false, shouldCloseOnBackdropClick: false,
@ -191,10 +191,7 @@ getDoughnutChartData(){
this._dashboardService.getPDDetailForDoughnut(fromdate,todate,cityarr,lenderarr).subscribe(data => { this._dashboardService.getPDDetailForDoughnut(fromdate,todate,cityarr,lenderarr).subscribe(data => {
this.flag = 1; this.flag = 1;
console.log(' ***** Doughnut Chart Data *****'); console.log(' ***** Doughnut Chart Data *****',data);
console.log('Whole Data',data);
console.log('Monthly Status',data.records.current_month);
let DraftIndexvalue = this.doughnutChartLabels.indexOf('Draft'); let DraftIndexvalue = this.doughnutChartLabels.indexOf('Draft');
let TriggedIndexvalue = this.doughnutChartLabels.indexOf('Triggered'); let TriggedIndexvalue = this.doughnutChartLabels.indexOf('Triggered');
@ -475,8 +472,11 @@ getDoughnutChartData(){
} }
else{ else{
//console.log('Else Condition month'); this.tempDataFullPD = [0,0,0,0,0,0,0];
this.tempDataSmartPD = [0,0,0,0,0,0,0];
this.tempDataTelePD = [0,0,0,0,0,0,0];
} }
this.doughnutChartDataForFullPD = this.tempDataFullPD; this.doughnutChartDataForFullPD = this.tempDataFullPD;
this.doughnutChartDataForSmartPD = this.tempDataSmartPD; this.doughnutChartDataForSmartPD = this.tempDataSmartPD;
this.doughnutChartDataForTelePD = this.tempDataTelePD; this.doughnutChartDataForTelePD = this.tempDataTelePD;
@ -484,16 +484,9 @@ getDoughnutChartData(){
this.total2 = this.tempDataSmartPD.reduce((a, b) => a + b, 0); this.total2 = this.tempDataSmartPD.reduce((a, b) => a + b, 0);
this.total3 = this.tempDataTelePD.reduce((a, b) => a + b, 0); this.total3 = this.tempDataTelePD.reduce((a, b) => a + b, 0);
console.log('Final full Data Completed',this.doughnutChartDataForFullPD); console.log('Final Full Data '+ this.doughnutChartDataForFullPD+'Temp Data'+this.tempDataFullPD+'Full Total '+this.total1);
console.log('temp full Data',this.tempDataFullPD); console.log('Final Smart Data '+ this.doughnutChartDataForSmartPD+' Temp Data '+this.tempDataSmartPD+'Smart Total '+this.total2);
console.log('Final Smart Data Completed',this.doughnutChartDataForSmartPD); console.log('Final Tele Data '+ this.doughnutChartDataForTelePD+' Temp Data'+this.tempDataTelePD+'Tele Total '+this.total3);
console.log('temp Smart Data',this.tempDataSmartPD);
console.log('Final Tele Data Completed',this.doughnutChartDataForTelePD);
console.log('temp Tele Data',this.tempDataTelePD);
console.log('total3',this.total3);
console.log('total2',this.total2);
console.log('total1',this.total1);
}) })
} }
@ -518,7 +511,7 @@ onChange(e :any,flag: any) {
let fromdate; let fromdate;
let todate; let todate;
console.log('flag',flag);
if(flag == 1){ if(flag == 1){
fromdate = new Date(e.fromDate); fromdate = new Date(e.fromDate);
@ -543,16 +536,12 @@ onChange(e :any,flag: any) {
} }
// console.log('fromdate',fromdate);
// console.log('todate',todate);
// console.log('lenderarr',this.selectedLender);
// console.log('cityarr',this.selectedCity);
this._dashboardService.getPDDetailForDoughnut(fromdate,todate,this.selectedCity,this.selectedLender).subscribe(data => { this._dashboardService.getPDDetailForDoughnut(fromdate,todate,this.selectedCity,this.selectedLender).subscribe(data => {
console.log(' *****Updated Date Doughnut Chart Data *****'); console.log(' *****Updated Date Doughnut Chart Data *****',data);
console.log('Whole Data',data);
if(data.records.current_month.length != 0){ if(data.records.current_month.length != 0){
this.total1 = 0; this.total1 = 0;
this.total2 = 0; this.total2 = 0;
@ -848,7 +837,9 @@ onChange(e :any,flag: any) {
} }
else{ else{
//console.log('Else Condition month'); this.tempDataFullPD = [0,0,0,0,0,0,0];
this.tempDataSmartPD = [0,0,0,0,0,0,0];
this.tempDataTelePD = [0,0,0,0,0,0,0];
} }
this.doughnutChartDataForFullPD= this.tempDataFullPD; this.doughnutChartDataForFullPD= this.tempDataFullPD;
@ -858,24 +849,14 @@ onChange(e :any,flag: any) {
this.total1 = this.tempDataFullPD.reduce((a, b) => a + b, 0); this.total1 = this.tempDataFullPD.reduce((a, b) => a + b, 0);
this.total2 = this.tempDataSmartPD.reduce((a, b) => a + b, 0); this.total2 = this.tempDataSmartPD.reduce((a, b) => a + b, 0);
this.total3 = this.tempDataTelePD.reduce((a, b) => a + b, 0); this.total3 = this.tempDataTelePD.reduce((a, b) => a + b, 0);
console.log('Canvas Full',this.FullCanvas) ;
console.log('Canvas Smart',this.SmartCanvas);
console.log('Canvas Tele',this.TeleCanvas);
this.FullCanvas.chart.update(); this.FullCanvas.chart.update();
this.SmartCanvas.chart.update(); this.SmartCanvas.chart.update();
this.TeleCanvas.chart.update(); this.TeleCanvas.chart.update();
//: string[] = ['Draft','Triggered','Allocated','Scheduled','InProgress','Completed','QC Completed'];
console.log('Final full Data Completed',this.doughnutChartDataForFullPD);
console.log('temp full Data',this.tempDataFullPD);
console.log('Final Smart Data Completed',this.doughnutChartDataForSmartPD);
console.log('temp Smart Data',this.tempDataSmartPD);
console.log('Final Tele Data Completed',this.doughnutChartDataForTelePD);
console.log('temp Tele Data',this.tempDataTelePD);
console.log('total3',this.total3);
console.log('total2',this.total2);
console.log('total1',this.total1);
console.log('Final Full Data '+ this.doughnutChartDataForFullPD+'Temp Data'+this.tempDataFullPD+'Full Total '+this.total1);
console.log('Final Smart Data '+ this.doughnutChartDataForSmartPD+' Temp Data '+this.tempDataSmartPD+'Smart Total '+this.total2);
console.log('Final Tele Data '+ this.doughnutChartDataForTelePD+' Temp Data'+this.tempDataTelePD+'Tele Total '+this.total3);
}) })

View File

@ -21,7 +21,6 @@ const currentdate = new Date().toJSON().slice(0,19).replace('T',' ');
export class DashboardService { export class DashboardService {
private apiUrl = environment.apiEndpoint; private apiUrl = environment.apiEndpoint;
//private apiUrl = 'http://localhost/sparqapi/api/';
constructor(private _http: HttpClient, constructor(private _http: HttpClient,
private _aws:AwsService) { } private _aws:AwsService) { }
@ -53,17 +52,17 @@ export class DashboardService {
// } // }
getPDDetailForDoughnut(fromdate,todate,cityarr,lenderarr): Observable<any> { getPDDetailForDoughnut(fromdate,todate,cityarr,lenderarr): Observable<any> {
console.log(')))))');
console.log(fromdate); console.log('From',fromdate);
console.log(todate); console.log('To',todate);
console.log(cityarr); console.log('Lender Arr',lenderarr);
console.log(lenderarr); console.log('City Arr',cityarr);
console.log('(((');
return this._http.post(this.apiUrl+'getDashBoardMaster', { return this._http.post(this.apiUrl+'getDashBoardMaster', {
"fromdate":fromdate, "fromdate":fromdate != '' && fromdate != null && fromdate != undefined ? fromdate : '',
"todate": todate, "todate": todate != '' && todate != null && todate != undefined ? todate : '',
"cityarr":cityarr, "lenderarr": lenderarr,"cityarr":cityarr})
"lenderarr": lenderarr})
.pipe(catchError(this.handleError('role', [])) .pipe(catchError(this.handleError('role', []))
) )

View File

@ -54,7 +54,7 @@
<p>Neighbourhood</p> <p>Neighbourhood</p>
</mat-card-header> </mat-card-header>
<div formArrayName="neighbourhood"> <div formArrayName="neighbourhood">
<div *ngFor="let item of addressForm.controls.neighbourhood['controls']; let i=index"> <div *ngFor="let item of addressForm.controls.neighbourhood['controls']; let i=index" >
<mat-card-content class="matcard" [formGroup]="item"> <mat-card-content class="matcard" [formGroup]="item">
<mat-form-field> <mat-form-field>
<input matInput placeholder="Neighbour Name" <input matInput placeholder="Neighbour Name"

View File

@ -333,7 +333,7 @@ public m_investmentType = [];
} }
case '4': { case '4': {
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.loadJwellDescription()); //control.push(this.loadJwellDescription());
break; break;
} }
case '5': { case '5': {
@ -542,7 +542,7 @@ public m_investmentType = [];
} }
case '4': { case '4': {
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.loadJwellDescriptionWithData(data)); //control.push(this.loadJwellDescriptionWithData(data));
break; break;
} }
case '5': { case '5': {

View File

@ -105,10 +105,14 @@ export class BankingDetailsComponent implements OnInit {
account_type: ['', Validators.compose([Validators.required])], account_type: ['', Validators.compose([Validators.required])],
salary: ['', Validators.compose([Validators.required])], salary: ['', Validators.compose([Validators.required])],
limit: ['', Validators.compose([Validators.required])], limit: ['', Validators.compose([Validators.required])],
is_main: ['', Validators.compose([Validators.required])], //is_main: ['', Validators.compose([Validators.required])],
//is_main: [this.pd_cus_segment == 'SAL' ? '' : '', Validators.compose([Validators.required])],
//is_main:[''],
is_main: this.pd_cus_segment == 'SAL' ? [''] : ['', Validators.compose([Validators.required])],
vintage_year: ['', Validators.compose([Validators.required])], vintage_year: ['', Validators.compose([Validators.required])],
vintage_month: ['', Validators.compose([Validators.required])], vintage_month: ['', Validators.compose([Validators.required])],
}); });
} }
addBankdetails(index, event) { addBankdetails(index, event) {
@ -117,6 +121,10 @@ export class BankingDetailsComponent implements OnInit {
let length = control.length; let length = control.length;
this.step = length; this.step = length;
control.push(this.createBankarray()); control.push(this.createBankarray());
// if(this.pd_cus_segment != 'SAL') {
// this.bankingForm.controls.is_main.setValidators([Validators.required]);
// this.bankingForm.controls.is_main.updateValueAndValidity();
// }
} }
deleteBankdetails(index: number) { deleteBankdetails(index: number) {

View File

@ -0,0 +1,190 @@
<mat-card style="min-height: 550px;">
<mat-card-content>
<p>Rental Information Form</p>
<form class="address" [formGroup]="rentalForm">
<mat-form-field>
<input matInput placeholder="Person met / Shown the Property(if he is not applicant or co-applicant)" formControlName="person_met">
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Property Owner" formControlName="property_own">
<mat-option value="applicant">Applicant</mat-option>
<mat-option value="co_applicant">co-applicant</mat-option>
<mat-option value="parental">Parental</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Nature of the let out property" formControlName="nature_property">
<mat-option value="residentail/commercial">Residential/commercial</mat-option>
<mat-option value="other">other</mat-option>
</mat-select>
</mat-form-field>
<div formArrayName="rental_home">
<mat-accordion
*ngFor="let item of rentalForm.controls.rental_home['controls']; let i=index"
[formGroupName]="i">
<mat-expansion-panel class="fields" [expanded]="step == i">
<mat-expansion-panel-header>
<mat-panel-title>
<h5>{{i+1}} Rental Home Details</h5>
</mat-panel-title>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button *ngIf="i==0"
color="primary" style="float: right;" (click)="addProperty($event)">
<mat-icon>add</mat-icon>
</button>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button *ngIf="i>0"
style="float: right;" (click)="deleteProperty(i)">
<mat-icon>delete</mat-icon>
</button>
</mat-expansion-panel-header>
<mat-form-field appearance="outline" style="width: 100%">
<mat-label>Complete address of the property</mat-label>
<textarea matInput placeholder="Address" formControlName="complete_add"></textarea>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Area of the Property(in sq yd or Sq ft)"
formControlName="area_of_property">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Structure of the let out property (eg. No of floors in total,G,FF,SF etc, let out floors from them)"
formControlName="structure_property">
</mat-form-field>
<mat-form-field>
<input type="number" matInput placeholder="Total rooms let out (eg single room,2 BHK, let out rooms on each floor)"
formControlName="total_room">
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Is Rent agreement available"
formControlName="is_rent">
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
<div *ngIf="item.controls['is_rent'].value == 'yes'">
<mat-form-field>
<input matInput [matDatepicker]="picker" formControlName="date_agreement"
placeholder="Date of Agreement">
<mat-datepicker-toggle matSuffix
[for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Validity"
formControlName="date_validity">
</mat-form-field>
<mat-form-field>
<input type="number" matInput placeholder="Rent as per Agreement"
formControlName="rent_agreement">
</mat-form-field>
<mat-form-field>
<input type="number" matInput placeholder="Actual Rent"
formControlName="actual_rent">
</mat-form-field>
<mat-form-field>
<mat-select placeholder="Photo of agreement taken ?"
formControlName="photo_areegment">
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
</div>
<mat-card>
<mat-card-header>
<p>How is rent received? (Is it in bank or cash, how much in which mode)</p>
</mat-card-header>
<mat-card-content>
<mat-form-field>
<input type="number" matInput placeholder="bank"
formControlName="bank">
</mat-form-field>
<mat-form-field>
<input type="number" matInput placeholder="Cash"
formControlName="cash">
</mat-form-field>
</mat-card-content>
</mat-card>
<mat-form-field>
<input matInput placeholder="Rent received from each floor and or Rooms (eg FF has 4 rooms, rent per room are Rs 2500, Rs 4000 and Rs 3200 respectively)"
formControlName="rent_each_floor">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Total rent received (Total montly rental from property/ies, with break up)"
formControlName="total_rent">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Property Paper or other related document to prove ownership (eg. Property registry etc)"
formControlName="related_doc_owner">
</mat-form-field>
<mat-card>
<mat-card-header>
<p>Details of the tenants (eg Name and Mobile No and other details)</p>
</mat-card-header>
<div formArrayName="details_tenants">
<div *ngFor="let deatil of item.controls.details_tenants['controls']; let idx=index" [formGroupName]="idx">
<mat-card-content>
<mat-form-field>
<input matInput placeholder="Name"
formControlName="name">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Mobile No"
formControlName="mobile_no">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Tenant Seen"
formControlName="tenants_seen">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Tenant confirmed owner"
formControlName="tenants_con_owner">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Rent Paid"
formControlName="rent_paid">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Staying since"
formControlName="staying_since">
</mat-form-field>
<button type="button" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button *ngIf="idx==0"
color="primary" style="float: right;" (click)="addTenant(i)">
<mat-icon>add</mat-icon>
</button>
<button type="button" (click)="deleteTenant(idx, i)" class="mr-1 mb-1 hover-icon" mat-raised-button mat-icon-button *ngIf="idx>0"
style="float: right;">
<mat-icon>delete</mat-icon>
</button>
</mat-card-content>
</div>
</div>
</mat-card>
<mat-form-field>
<mat-select placeholder="Photogaraphs of the property"
formControlName="property_photographs">
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Third party check of prevailing rent in the neighbour hood (TPC with whom, how much rent quoted)"
formControlName="third_party_check">
</mat-form-field>
</mat-expansion-panel>
</mat-accordion>
</div>
<div style="text-align: right;" class="pt-1">
<button class="mr-1 mb-1 hover-icon" type="submit" mat-raised-button mat-icon-button type="submit" matTooltip="Submit" matTooltipPosition="above" (click)="rentalSubmit()"><mat-icon>save</mat-icon>
</button>
</div>
</form>
</mat-card-content>
</mat-card>

View File

@ -0,0 +1,27 @@
.address {
display: flex;
padding: 0 2%;
flex-direction: column;
}
.address > * {
width: 100%;
}
.matcard mat-form-field {
margin: 0 2%;
width:40%;
}
.address .button {
float: right;
width: 10px;
background: #62B013;
color: white;
}
mat-form-field {
width: 27%;
margin: 0 2%;
}
.fields mat-form-field {
width: 45%;
margin: 0 2%;
}

View File

@ -0,0 +1,167 @@
import {Component, OnInit, Input, Output} from '@angular/core';
import {FormBuilder, FormGroup, Validators, FormControl, FormArray} from '@angular/forms';
import {NotifierService} from 'angular-notifier';
import {PdTrigerService} from './../../../../../pd-service/pd-triger.service';
import {Key} from 'protractor';
@Component({
selector: 'app-rental-info',
templateUrl: './rental-info.component.html',
styleUrls: ['./rental-info.component.scss']
})
export class RentalInfoComponent implements OnInit {
// @Input() pdid: string;
// @Input() pd_all_details: any;
// form_id: number;
@Input() pdid: number;
@Input() form_id: number;
step: number;
public rentalForm: FormGroup;
tenantsList: FormArray;
propertyList: FormGroup;
private notifier: NotifierService;
constructor(notifier: NotifierService, private _fb: FormBuilder, private _pd: PdTrigerService) {
this.notifier = notifier;
// this.form_id = 3;
}
ngOnInit() {
this.step = 0;
this.inintRentalForm();
this.createpropertyArray();
let params: any = {};
params.pd_id = this.pdid;
params.pd_form_id = this.form_id;
this._pd.retriveForm(params).subscribe(value => {
let subArray: any;
const control = <FormArray>this.rentalForm.controls['rental_home'];
if (value.status == 200) {
let rentalinfo = value.records;
var result = Object.keys(value.records.rental_home).map(function (key) {
return value.records.rental_home[key];
});
if (result.length == 0) {
const control = <FormArray>this.rentalForm.controls['rental_home'];
control.push(this.createpropertyArray());
} else {
result.forEach((datas, index) => {
control.push(this.createpropertyArray());
const parentControl = <FormGroup>this.rentalForm.controls['rental_home']['controls'][index];
const sub = <FormArray>parentControl.controls['details_tenants'];
console.log('control', parentControl);
subArray = Object.keys(datas.details_tenants).map(function (key) {
return datas.details_tenants[key];
});
if (subArray.length > 0) {
subArray.forEach((val) => {
console.log('val', val);
sub.push(this.createTenatsArray());
})
sub.removeAt(0);
}
datas.details_tenants = subArray;
});
}
rentalinfo.rental_home = result;
rentalinfo.pdid = this.pdid;
rentalinfo.formid = this.form_id;
rentalinfo.fk_createdby = this.pdid;
this.rentalForm.setValue(rentalinfo);
} else {
control.push(this.createpropertyArray());
}
});
}
inintRentalForm() {
this.rentalForm = this._fb.group({
pdid: this.pdid,
formid: this.form_id,
fk_createdby: this.pdid,
person_met: ['', Validators.compose([Validators.required])],
property_own: ['', Validators.compose([Validators.required])],
nature_property: ['', Validators.compose([Validators.required])],
rental_home: this._fb.array([])
});
}
createpropertyArray() {
this.propertyList = this._fb.group({
complete_add: ['', Validators.compose([Validators.required])],
area_of_property: ['', Validators.compose([Validators.required])],
structure_property: ['', Validators.compose([Validators.required])],
total_room: ['', Validators.compose([Validators.required])],
is_rent: ['', Validators.compose([Validators.required])],
date_agreement: [''],
date_validity: [''],
rent_agreement: [''],
actual_rent: [''],
photo_areegment: [''],
bank: ['', Validators.compose([Validators.required])],
cash: ['', Validators.compose([Validators.required])],
rent_each_floor: ['', Validators.compose([Validators.required])],
total_rent: ['', Validators.compose([Validators.required])],
related_doc_owner: ['', Validators.compose([Validators.required])],
property_photographs: ['', Validators.compose([Validators.required])],
third_party_check: ['', Validators.compose([Validators.required])],
details_tenants: this._fb.array([this.createTenatsArray()]),
});
return this.propertyList;
}
createTenatsArray() {
return this._fb.group({
name: ['', Validators.compose([Validators.required])],
mobile_no: ['', Validators.compose([Validators.required])],
tenants_seen: ['', Validators.compose([Validators.required])],
tenants_con_owner: ['', Validators.compose([Validators.required])],
staying_since: ['', Validators.compose([Validators.required])],
rent_paid: ['', Validators.compose([Validators.required])],
});
}
addProperty(event) {
event.stopPropagation();
const control = <FormArray>this.rentalForm.controls['rental_home'];
control.push(this.createpropertyArray());
let length = control.length;
this.step = length - 1;
}
deleteProperty(index) {
const control = <FormArray>this.rentalForm.controls['rental_home'];
control.removeAt(index);
}
addTenant(parentIndex:number) {
const parentControl = <FormGroup>this.rentalForm.controls['rental_home']['controls'][parentIndex];
const control = <FormArray>parentControl.controls['details_tenants'];
console.log(parentControl);
console.log(control);
control.push(this.createTenatsArray());
}
deleteTenant(idx, parentIndex) {
const parentControl = <FormGroup>this.rentalForm.controls['rental_home']['controls'][parentIndex];
const control = <FormArray>parentControl.controls['details_tenants'];
control.removeAt(idx);
}
rentalSubmit() {
if (!this.rentalForm.valid) {
return;
}
console.log('form', this.rentalForm.value);
let records = this.rentalForm.value;
this._pd.saveForm(records).subscribe(data => {
console.log('data', data);
this.notifier.notify('success', 'Saved Successfully.');
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
})
}
}

View File

@ -31,9 +31,12 @@
<mat-list-item class="custm-list-item" (click)="OnSelectDirectForms(formButton)" style="background-color:#e0e0e0"> <mat-list-item class="custm-list-item" (click)="OnSelectDirectForms(formButton)" style="background-color:#e0e0e0">
<span class="mt-0">{{ (formButton.form_name.length>17)? (formButton.form_name | slice:0:17)+'..':(formButton.form_name) }}</span> <span class="mt-0">{{ (formButton.form_name.length>17)? (formButton.form_name | slice:0:17)+'..':(formButton.form_name) }}</span>
</mat-list-item> </mat-list-item>
</mat-list> </mat-list>
<!--<mat-list>-->
<!--<mat-list-item (click)="OnSelectDirectForms(rentalDetail)" style="background-color:#e0e0e0">-->
<!--<span class="mt-0">{{rentalDetail.form_name}}</span>-->
<!--</mat-list-item>-->
<!--</mat-list>-->
</mat-sidenav> </mat-sidenav>
<mat-toolbar color="primary" fxHide="false" fxHide.gt-sm> <mat-toolbar color="primary" fxHide="false" fxHide.gt-sm>
@ -433,9 +436,12 @@
<ng-container *ngSwitchCase="15"> <ng-container *ngSwitchCase="15">
<app-lender-representative [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-lender-representative> <app-lender-representative [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-lender-representative>
</ng-container> </ng-container>
<ng-container *ngSwitchCase="17">
<app-rental-info [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-rental-info>
</ng-container>
</ng-container> </ng-container>
</div> </div>
<!-- end form based questions --> <!-- end form based questions -->
</figure> </figure>

View File

@ -29,6 +29,7 @@ export class StartPdComponent implements OnInit, OnDestroy {
answerList: any = []; answerList: any = [];
ansPDList: any = []; ansPDList: any = [];
relationDetails: any = [1]; relationDetails: any = [1];
rentalDetail: any = { form_id: "16", form_name: "Rental Information", isAnswered: true}
// errorMessage:any; // errorMessage:any;
// selectedCategory:any=[]; // selectedCategory:any=[];
// categoryList: any=[]; // categoryList: any=[];
@ -294,6 +295,7 @@ pdFullDetails:any=[];
this.pdMasterList=data.records.pdmaster_details; this.pdMasterList=data.records.pdmaster_details;
this.categoryList=data.records.question_answers; this.categoryList=data.records.question_answers;
this.categoryFormButtons = data.records.template_forms; this.categoryFormButtons = data.records.template_forms;
console.log('formButtons', this.categoryFormButtons);
let filterApplicantName= data.records.pdapplicants_detials.filter(item => item.applicant_type == 1); let filterApplicantName= data.records.pdapplicants_detials.filter(item => item.applicant_type == 1);
this.mainApplicantName = filterApplicantName[0].applicant_name; this.mainApplicantName = filterApplicantName[0].applicant_name;
this.currentPDStatus = data.records.pdmaster_details.pd_status; this.currentPDStatus = data.records.pdmaster_details.pd_status;
@ -625,6 +627,7 @@ pdFullDetails:any=[];
OnSelectDirectForms(details: any) { OnSelectDirectForms(details: any) {
this.formsCategoryEnable = true; this.formsCategoryEnable = true;
this.selectedFormsCategory = details; this.selectedFormsCategory = details;
console.log('select..', this.selectedFormsCategory);
} }

View File

@ -9,7 +9,7 @@ import {
MatProgressBarModule, MatDialogModule, MatSortModule, MatProgressBarModule, MatDialogModule, MatSortModule,
MatToolbarModule, MatSelectModule, MatListModule, MatGridListModule, MatTabsModule, MatCheckboxModule, MatToolbarModule, MatSelectModule, MatListModule, MatGridListModule, MatTabsModule, MatCheckboxModule,
MatBadgeModule, MatExpansionModule, MatStepperModule, MatSidenavModule, MatMenuModule, MatButtonToggleModule, MatBadgeModule, MatExpansionModule, MatStepperModule, MatSidenavModule, MatMenuModule, MatButtonToggleModule,
MatAutocompleteModule MatAutocompleteModule, MatDatepickerModule
} from '@angular/material'; } from '@angular/material';
import {MatSlideToggleModule} from '@angular/material/slide-toggle'; import {MatSlideToggleModule} from '@angular/material/slide-toggle';
import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {FormsModule, ReactiveFormsModule} from '@angular/forms';
@ -62,8 +62,12 @@ import {FinancialInfoComponent} from "./list-pd/start-pd/forms/financial-info/fi
import { LenderRepresentativeComponent } from './list-pd/start-pd/forms/lender-representative/lender-representative.component'; import { LenderRepresentativeComponent } from './list-pd/start-pd/forms/lender-representative/lender-representative.component';
import { TelePdAllocationComponent } from './list-pd/tele-pd-allocation/tele-pd-allocation.component'; import { TelePdAllocationComponent } from './list-pd/tele-pd-allocation/tele-pd-allocation.component';
import { PdReportComponent } from './list-pd/pd-report/pd-report.component'; import { PdReportComponent } from './list-pd/pd-report/pd-report.component';
import {RentalInfoComponent} from "./list-pd/start-pd/forms/rental-info/rental-info.component";
/** /**
* Custom angular notifier options * Custom angular notifier options
*/ */
@ -136,7 +140,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
// AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule, // AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule,
// OwlNativeDateTimeModule, // OwlNativeDateTimeModule,
// ], // ],
declarations: [TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent], declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent],
// exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent], // exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent],
// providers: [PdTrigerService, GetGeometricLocationService], // providers: [PdTrigerService, GetGeometricLocationService],
@ -161,6 +165,7 @@ const pdCustomNotifierOptions: NotifierOptions = {
ReactiveFormsModule, ReactiveFormsModule,
FileUploadModule, FileUploadModule,
TreeModule, TreeModule,
MatDatepickerModule,
MatDialogModule,MatSortModule, MatDialogModule,MatSortModule,
NgxMatSelectSearchModule,MatTooltipModule, MatExpansionModule, NgxMatSelectSearchModule,MatTooltipModule, MatExpansionModule,
AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}),OwlDateTimeModule, AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}),OwlDateTimeModule,

View File

@ -6,24 +6,26 @@ import { FormBuilder,
import { MatDialog, import { MatDialog,
MatDialogRef, MatDialogRef,
MAT_DIALOG_DATA } from '@angular/material'; MAT_DIALOG_DATA } from '@angular/material';
/** Service */ /** Service */
import { MastersService } from '../../service/masters/masters.service'; import { MastersService } from '../../service/masters/masters.service';
import { PdTeamService } from '../../service/masters/pd-team.service'; import { PdTeamService } from '../../service/masters/pd-team.service';
import { NotifierService } from 'angular-notifier'; import { Router } from '@angular/router';
import { empty } from 'rxjs';
import { Router } from '@angular/router';
import { empty } from 'rxjs';
/**sweet alert */ /**sweet alert */
import Swal from 'sweetalert2'; import Swal from 'sweetalert2';
@Component({ @Component({
selector: 'app-pd-team-add', selector: 'app-pd-team-add',
templateUrl: './pd-team-add.component.html', templateUrl: './pd-team-add.component.html',
styleUrls: ['./pd-team-add.component.scss'] styleUrls: ['./pd-team-add.component.scss']
}) })
export class PdTeamAddComponent implements OnInit { export class PdTeamAddComponent implements OnInit {
public _pdTeamForm: FormGroup; public _pdTeamForm: FormGroup;
private notifier: NotifierService;
color = 'primary'; color = 'primary';
errorMessage:string; errorMessage:string;
@ -42,17 +44,16 @@ selectedProductDatas : any=[];
selectedSegmentDatas : any=[]; selectedSegmentDatas : any=[];
constructor(private _formBuilder: FormBuilder, constructor(private _formBuilder: FormBuilder,
private _notifier: NotifierService,
private _pdTeamService: PdTeamService, private _pdTeamService: PdTeamService,
private _router: Router, private _router: Router,
private _masterService: MastersService) private _masterService: MastersService)
{ {
this.notifier = _notifier;
} }
ngOnInit() { ngOnInit() {
//console.log(this.notifier);
this.PdTeamFormDatas(); this.PdTeamFormDatas();
/** For Checking City Validation datas - checking purpose - Already exists are not */ /** For Checking City Validation datas - checking purpose - Already exists are not */
@ -143,15 +144,16 @@ onSubmit() {
this._pdTeamService.addPdTeamDetail(this._pdTeamForm.value).subscribe( this._pdTeamService.addPdTeamDetail(this._pdTeamForm.value).subscribe(
dataresult => { dataresult => {
if(dataresult.dataStatus == true) { if(dataresult.dataStatus == true) {
this.notifier.notify('success', 'Record Saved Successfully.!');
Swal('Record Saved Successfully.!','success'); Swal('Record Saved Successfully.!','success');
this._router.navigate(['/setting/pdteam/pdteamlist']); this._router.navigate(['/setting/pdteam/pdteamlist']);
} }
else { else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
Swal('Wrong.!'); //Swal('Wrong.!');
//alert('Some Thing Wents Wrong Try Again !'); Swal('Some Thing Wents Wrong Try Again !');
//this.errorMessage = "Some Thing Wents Wrong Try Again !"; //this.errorMessage = "Some Thing Wents Wrong Try Again !";
} }
}); });
@ -228,10 +230,9 @@ onChangeEntityId($event){
//console.log(this.CityValidation,lenderId); //console.log(this.CityValidation,lenderId);
this._pdTeamService.getLenderData(lenderId).subscribe( this._pdTeamService.getLenderData(lenderId).subscribe(
dataresult => { dataresult => {
if(dataresult.dataStatus == true) { if(dataresult.dataStatus == true) {
this.CityValidation = dataresult.records; this.CityValidation = dataresult.records;
console.log(this.CityValidation); //console.log(this.CityValidation);
} }
}, error => this.errorMessage = <any> error); }, error => this.errorMessage = <any> error);
} }

View File

@ -1,4 +1,4 @@
<div style="max-height: 580px;"> <div style="max-height: 580px;" *ngIf="apiFinishLoad">
<form [formGroup]="_pdTeamForm" (submit)="onSubmit()"> <form [formGroup]="_pdTeamForm" (submit)="onSubmit()">
<mat-card style="padding: 6px;"> <mat-card style="padding: 6px;">
<div class="ml-xs mr-xs" style="width: 100%;" fxLayout="row" fxLayoutAlign="center"> <div class="ml-xs mr-xs" style="width: 100%;" fxLayout="row" fxLayoutAlign="center">

View File

@ -6,9 +6,9 @@ import { FormBuilder,
/** Service */ /** Service */
import { MastersService } from '../../service/masters/masters.service'; import { MastersService } from '../../service/masters/masters.service';
import { PdTeamService } from '../../service/masters/pd-team.service'; import { PdTeamService } from '../../service/masters/pd-team.service';
import { NotifierService } from 'angular-notifier';
/** Here this component is like as a partent component */ /** Here this component is like as a partent component */
import { PdTeamListComponent } from './../pd-team-list/pd-team-list.component'; import { Router,ActivatedRoute } from '@angular/router';
/**sweet alert */ /**sweet alert */
import Swal from 'sweetalert2'; import Swal from 'sweetalert2';
@Component({ @Component({
@ -22,14 +22,15 @@ export class PdTeamEditComponent implements OnInit {
public _pdTeamForm: FormGroup; public _pdTeamForm: FormGroup;
public submitted = false; public submitted = false;
public listView: any = true; public listView: any = true;
private notifier: NotifierService;
color = 'primary'; color = 'primary';
errorMessage:string; errorMessage:string;
lenderId:any; lenderId:any;
teamID: any;
apiFinishLoad: boolean;
//This "childMessage" to get the function or data from partent component //This "childMessage" to get the function or data from partent component
@Input() public childMessage: any; //@Input() public childMessage: any;
public childMessage: any[];
//This Type Of Array Declaration for select dropdown to list the datas //This Type Of Array Declaration for select dropdown to list the datas
citydatas: any[]; citydatas: any[];
lenderdatas: any[]; lenderdatas: any[];
@ -51,27 +52,33 @@ export class PdTeamEditComponent implements OnInit {
selectedCityDatas : any=[]; selectedCityDatas : any=[];
selectedProductDatas : any=[]; selectedProductDatas : any=[];
selectedSegmentDatas : any=[]; selectedSegmentDatas : any=[];
//EditDatasforFormGroup: any; //EditDatasforFormGroup: any;
constructor(private _formBuilder: FormBuilder, constructor(private _formBuilder: FormBuilder,
private _notifier: NotifierService, private _router: Router,private route: ActivatedRoute,
private _pdTeamService: PdTeamService, private _pdTeamService: PdTeamService,
private _PdTeamListComponent: PdTeamListComponent,
private _masterService: MastersService) { private _masterService: MastersService) {
this.notifier = _notifier;
} }
/** Onready function */ /** Onready function */
ngOnInit() { ngOnInit() {
//console.log(atob(this.route.snapshot.params['id']));
this.teamID = atob(this.route.snapshot.params['id']);
//console.log(this.teamID);
this._pdTeamForm = this._formBuilder.group({
pdteam_id: ['', Validators.compose([Validators.required])],
team_name: ['', Validators.compose([Validators.required])],
fk_lender: ['', Validators.compose([Validators.required])],
fk_city: ['', Validators.compose([Validators.required])],
fk_customer_segment: ['', Validators.compose([Validators.required])],
fk_product:['', Validators.compose([Validators.required])],
});
this.PdTeamFormDatas(); this.PdTeamFormDatas();
//console.log('hai I am Child This onready function',this.childMessage);
// this._pdTeamService.getAllPDTeamWithPDTeamID(this.childMessage).subscribe(
// dataresult => {
// console.log(dataresult);
// this.EditDatasforFormGroup = dataresult.records;
// console.log(this.EditDatasforFormGroup);
// });
/** For Checking City Validation datas - checking purpose - Already exists are not */ /** For Checking City Validation datas - checking purpose - Already exists are not */
this._pdTeamService.getAllPdTeamCityMapping().subscribe( this._pdTeamService.getAllPdTeamCityMapping().subscribe(
dataresult => { dataresult => {
@ -117,18 +124,30 @@ export class PdTeamEditComponent implements OnInit {
this.customerSegmentdatas = this.customerSegmentdatas.filter(segment=>segment.isactive == 1 ); this.customerSegmentdatas = this.customerSegmentdatas.filter(segment=>segment.isactive == 1 );
} }
}, error => this.errorMessage = <any> error); }, error => this.errorMessage = <any> error);
this.lenderId = this._pdTeamForm.value['fk_lender'];
this._pdTeamService.getLenderData(this.lenderId).subscribe( // this.lenderId = this._pdTeamForm.value.fk_lender;
dataresult => { // console.log('form data',this._pdTeamForm);
if(dataresult.dataStatus == true){ // console.log('form data Particular Value',this._pdTeamForm.value.fk_lender);
this.CityValidation = dataresult.records; // this._pdTeamService.getLenderData(this.lenderId).subscribe(
} // dataresult => {
}, error => this.errorMessage = <any> error); // if(dataresult.dataStatus == true){
// this.CityValidation = dataresult.records;
// }
// });
} }
/** Pd Team Form Datas */ /** Pd Team Form Datas */
PdTeamFormDatas(){ PdTeamFormDatas(){
this._pdTeamService.getAllPDTeamWithPDTeamID(this.teamID).subscribe(
dataresult => {
//console.log('Response Data',dataresult);
if(dataresult.status == 200)
this.childMessage = dataresult.records;
// console.log('Record Data',dataresult.records);
// console.log('sdafd',this.childMessage[0].team_name);
//console.log('Patricular pdteam_id Datas',this.childMessage); //console.log('Patricular pdteam_id Datas',this.childMessage);
// let PdTeamcity:any = []; // let PdTeamcity:any = [];
@ -174,16 +193,36 @@ export class PdTeamEditComponent implements OnInit {
} }
}, error => this.errorMessage = <any> error); }, error => this.errorMessage = <any> error);
this._pdTeamForm = this._formBuilder.group({ this._pdTeamForm.controls['pdteam_id'].setValue(this.childMessage[0].pdteam_id);
pdteam_id: [this.childMessage[0].pdteam_id, Validators.compose([Validators.required])], this._pdTeamForm.controls['team_name'].setValue(this.childMessage[0].team_name);
team_name: [this.childMessage[0].team_name, Validators.compose([Validators.required])], this._pdTeamForm.controls['fk_lender'].setValue(this.childMessage[0].fk_lender_id);
fk_lender: [this.childMessage[0].fk_lender_id, Validators.compose([Validators.required])], this._pdTeamForm.controls['fk_city'].setValue(PdTeamCity);
fk_city: [PdTeamCity, Validators.compose([Validators.required])], this._pdTeamForm.controls['fk_customer_segment'].setValue(this.DBCustomerSegmentDatas);
fk_customer_segment: [this.DBCustomerSegmentDatas, Validators.compose([Validators.required])], this._pdTeamForm.controls['fk_product'].setValue(this.DBProductDatas);
fk_product:[this.DBProductDatas, Validators.compose([Validators.required])], this.apiFinishLoad = true;
// this.lenderId = this._pdTeamForm.get('fk_customer_segment').value;
// console.log('asf',this.lenderId);
// console.log('form data',this._pdTeamForm);
this._pdTeamService.getLenderData(this.childMessage[0].fk_lender_id).subscribe(
dataresult => {
if(dataresult.dataStatus == true){
this.CityValidation = dataresult.records;
}
}); });
// this._pdTeamForm = this._formBuilder.group({
// pdteam_id: [this.childMessage[0].pdteam_id, Validators.compose([Validators.required])],
// team_name: [this.childMessage[0].team_name, Validators.compose([Validators.required])],
// fk_lender: [this.childMessage[0].fk_lender_id, Validators.compose([Validators.required])],
// fk_city: [PdTeamCity, Validators.compose([Validators.required])],
// fk_customer_segment: [this.DBCustomerSegmentDatas, Validators.compose([Validators.required])],
// fk_product:[this.DBProductDatas, Validators.compose([Validators.required])],
// });
});
} }
/** convenience getter for easy access to form fields */ /** convenience getter for easy access to form fields */
@ -191,7 +230,7 @@ export class PdTeamEditComponent implements OnInit {
/** For Popup Close Button */ /** For Popup Close Button */
onNoClick(): void { onNoClick(): void {
this._PdTeamListComponent.changeListView(); this._router.navigate(['/setting/pdteam/pdteamlist']);
} }
/** To Reset Popup Data For Add*/ /** To Reset Popup Data For Add*/
@ -225,9 +264,9 @@ export class PdTeamEditComponent implements OnInit {
this._pdTeamService.editPdTeamchildDetails(ActiveDatas,'PDTEAMCUSTOMERSEGMENT') this._pdTeamService.editPdTeamchildDetails(ActiveDatas,'PDTEAMCUSTOMERSEGMENT')
.subscribe(dataresult=>{ .subscribe(dataresult=>{
if (dataresult.dataStatus == true){ if (dataresult.dataStatus == true){
//alert('InActive Changes Done in cs'); // alert('InActive Changes Done in cs');
let index = this.selectedSegmentDatas.indexOf(CustomerSegmentName.name); // let index = this.selectedSegmentDatas.indexOf(CustomerSegmentName.name);
this.selectedSegmentDatas.splice(index,1); // this.selectedSegmentDatas.splice(index,1);
}else{} }else{}
}); });
@ -326,6 +365,7 @@ export class PdTeamEditComponent implements OnInit {
else if($event.source._selected == false ){ else if($event.source._selected == false ){
console.log('Return False for city Selection Data'); console.log('Return False for city Selection Data');
let index = this.selectedCityDatas.indexOf(cityName.name); let index = this.selectedCityDatas.indexOf(cityName.name);
this.selectedCityDatas.splice(index,1); this.selectedCityDatas.splice(index,1);
@ -336,16 +376,20 @@ export class PdTeamEditComponent implements OnInit {
dataresult => { dataresult => {
if (dataresult.dataStatus == true) { if (dataresult.dataStatus == true) {
data = dataresult.records; data = dataresult.records;
//console.log('data',data); //console.log('data',data);
data = data.filter(pdteamcity=>pdteamcity.fk_city_id == $event.source.value); data = data.filter(pdteamcity=>pdteamcity.fk_city_id == $event.source.value);
data = data.filter(pdteamcity=>pdteamcity.fk_pdteam_id == this._pdTeamForm.value.pdteam_id)[0]; data = data.filter(pdteamcity=>pdteamcity.fk_pdteam_id == this._pdTeamForm.value.pdteam_id)[0];
//console.log(data.pdteam_city_id); // console.log('cityID',data.pdteam_city_id);
// console.log('Event value',$event.source.value);
this._pdTeamService.deletePDteamCity($event.source.value).subscribe(data=>{ this._pdTeamService.deletePDteamCity($event.source.value).subscribe(data=>{
if (dataresult.dataStatus == true) {//alert('Deleted'); // console.log('Response Data',data);
let index = this.selectedCityDatas.indexOf(cityName.name); // if (dataresult.dataStatus == true) {
this.selectedCityDatas.splice(index,1); // alert('Deleted');
//this._PdTeamListComponent.changeListView(); // // let index = this.selectedCityDatas.indexOf(cityName.name);
} // // this.selectedCityDatas.splice(index,1);
// }
}); });
} }
}, error => this.errorMessage = <any> error); }, error => this.errorMessage = <any> error);
@ -378,17 +422,17 @@ export class PdTeamEditComponent implements OnInit {
dataresult => { dataresult => {
if (dataresult.dataStatus == true) { if (dataresult.dataStatus == true) {
data = dataresult.records; data = dataresult.records;
console.log('data',data); //console.log('data',data);
data = data.filter(pdteamproduct=>pdteamproduct.fk_product_id == $event.source.value && pdteamproduct.isactive == 1); data = data.filter(pdteamproduct=>pdteamproduct.fk_product_id == $event.source.value && pdteamproduct.isactive == 1);
data = data.filter(pdteamcity=>pdteamcity.fk_pdteam_id == this._pdTeamForm.value.pdteam_id)[0]; data = data.filter(pdteamcity=>pdteamcity.fk_pdteam_id == this._pdTeamForm.value.pdteam_id)[0];
console.log(data.pdteam_city_id); //console.log(data.pdteam_city_id);
let ActiveDatas = { 'pdteam_product_id':data.pdteam_product_id,'isactive': '0'} ; let ActiveDatas = { 'pdteam_product_id':data.pdteam_product_id,'isactive': '0'} ;
this._pdTeamService.editPdTeamchildDetails(ActiveDatas,'PDTEAMPRODUCT') this._pdTeamService.editPdTeamchildDetails(ActiveDatas,'PDTEAMPRODUCT')
.subscribe(dataresult=>{ .subscribe(dataresult=>{
if (dataresult.dataStatus == true){ if (dataresult.dataStatus == true){
//alert('InActive Changes Done in product'); // alert('InActive Changes Done in product');
let index = this.selectedProductDatas.indexOf(productName.name); // let index = this.selectedProductDatas.indexOf(productName.name);
this.selectedProductDatas.splice(index,1); // this.selectedProductDatas.splice(index,1);
} }
else{ else{
//alert("Sorry Try Again !"); //alert("Sorry Try Again !");
@ -411,11 +455,13 @@ export class PdTeamEditComponent implements OnInit {
dataresult=>{ dataresult=>{
if (dataresult.dataStatus == true){ if (dataresult.dataStatus == true){
Swal("Data Edited Successfully"); Swal("Data Edited Successfully");
// this.notifier.notify('success', 'Record Edited Successfully.!');
this._router.navigate(['/setting/pdteam/pdteamlist']);
} }
else{ else{
Swal("SomeThing Wents Wrong Try Again !"); Swal("SomeThing Wents Wrong Try Again !");
// this.notifier.notify('warning', 'SomeThing Wents Wrong Try Again !');
} }
}); });

View File

@ -1,4 +1,4 @@
<div *ngIf="listView"> <!-- <div *ngIf="listView"> -->
<mat-card> <mat-card>
<div fxLayout="row" fxLayoutAlign="start center" class="mb-1"> <div fxLayout="row" fxLayoutAlign="start center" class="mb-1">
<div class="ml-xs mr-xs" style="width: 30%;"> <div class="ml-xs mr-xs" style="width: 30%;">
@ -57,7 +57,7 @@
<mat-header-cell *matHeaderCellDef> Action </mat-header-cell> <mat-header-cell *matHeaderCellDef> Action </mat-header-cell>
<mat-cell *matCellDef="let row"> <mat-cell *matCellDef="let row">
<button mat-icon-button [color]="color" class="hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="editPdTeam(row.pdteam_id)"><mat-icon>edit</mat-icon></button> <button mat-icon-button [color]="color" class="hover-icon" matTooltip="Edit" matTooltipPosition="above" (click)="toEditPdTeam(row.pdteam_id)"><mat-icon>edit</mat-icon></button>
</mat-cell> </mat-cell>
</ng-container> </ng-container>
@ -71,8 +71,7 @@
</div> </div>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</div> <!-- </div> -->
<!--<div *ngIf="!listView"> <!--<div *ngIf="!listView">
<app-pd-team-edit [childMessage]="parentMessage"></app-pd-team-edit> <app-pd-team-edit [childMessage]="parentMessage"></app-pd-team-edit>
</div>--> </div>-->
<notifier-container></notifier-container>

View File

@ -9,8 +9,7 @@ MatTableDataSource } from '@angular/material';
import { MastersService } from '../../service/masters/masters.service'; import { MastersService } from '../../service/masters/masters.service';
import { PdTeamService } from '../../service/masters/pd-team.service'; import { PdTeamService } from '../../service/masters/pd-team.service';
import { NotifierService } from 'angular-notifier'; import { Router,ActivatedRoute } from '@angular/router';
import { Router } from '@angular/router';
/**sweet alert */ /**sweet alert */
import Swal from 'sweetalert2'; import Swal from 'sweetalert2';
@ -38,11 +37,9 @@ export class PdTeamListComponent implements OnInit {
userData = null; userData = null;
noRecordFound: boolean = false; noRecordFound: boolean = false;
private notifier: NotifierService;
public listView: any = true;
public dataLength: number; public dataLength: number;
public dataSource = new MatTableDataSource(); public dataSource = new MatTableDataSource();
public parentMessage: any = [];
displayedColumns = ['serialno','team_name','lender_name','actions','isactive']; displayedColumns = ['serialno','team_name','lender_name','actions','isactive'];
@ -50,34 +47,25 @@ export class PdTeamListComponent implements OnInit {
@ViewChild(MatSort) sort: MatSort; @ViewChild(MatSort) sort: MatSort;
constructor(notifier: NotifierService, constructor(
private router: Router, private router: Router,private route: ActivatedRoute,
private _MasterService: MastersService, private _MasterService: MastersService,
private _PdTeamService: PdTeamService) { private _PdTeamService: PdTeamService) {
this.getPdTeam(); this.getPdTeam();
this.notifier = notifier;
} }
ngOnInit() { this.getPdTeam(); } ngOnInit() { this.getPdTeam(); }
/** To edit data */ /** To edit data */
editPdTeam(detail){ toEditPdTeam(pdteam_id){
//this.router.navigate(['/setting/pdteam/editpdteam',pdteam_id]);
this._PdTeamService.getAllPDTeamWithPDTeamID(detail).subscribe( console.log(btoa(pdteam_id));
dataresult => { this.router.navigate(['/setting/pdteam/editpdteam',btoa(pdteam_id)]);
this.parentMessage = dataresult;
this.parentMessage = this.parentMessage.records;
this.listView = false;
});
} }
/**To Manage Team */
managepdteam(){ /**To Manage Team */
managepdteam(){
this.router.navigate(['/setting/pdteam/pdteammanage']); this.router.navigate(['/setting/pdteam/pdteammanage']);
}
changeListView(){
this.getPdTeam();
this.listView = true;
} }
/** To get data for listing */ /** To get data for listing */

View File

@ -15,7 +15,7 @@ export const PdTeamRoutes: Routes = [{
path: 'addpdteam', path: 'addpdteam',
component: PdTeamAddComponent component: PdTeamAddComponent
},{ },{
path:'editpdteam', path:'editpdteam/:id',
component:PdTeamEditComponent component:PdTeamEditComponent
},{ },{
path:'pdteammanage', path:'pdteammanage',