This commit is contained in:
Akisha 2018-11-23 16:44:04 +05:30
commit b92a4382de
12 changed files with 203 additions and 162 deletions

View File

@ -14,7 +14,7 @@
<mat-form-field class="example-full-width"> <mat-form-field class="example-full-width">
<mat-select placeholder="City" [formControl]="myControl" multiple> <mat-select placeholder="City" [formControl]="myControl" multiple>
<mat-select-trigger style="color:#fff;"> <mat-select-trigger style="color:#fff;">
{{myControl.value ? myControl.value[0].name : ''}} {{myControl.value != null && myControl.value != '' ? myControl.value[0].name : ''}}
<span *ngIf="myControl.value?.length > 1" > <span *ngIf="myControl.value?.length > 1" >
(+{{myControl.value.length - 1}} {{myControl.value?.length === 2 ? 'other' : 'others'}}) (+{{myControl.value.length - 1}} {{myControl.value?.length === 2 ? 'other' : 'others'}})
</span> </span>
@ -30,7 +30,7 @@
<mat-form-field class="example-full-width"> <mat-form-field class="example-full-width">
<mat-select placeholder="Lender" [formControl]="myControl2" multiple> <mat-select placeholder="Lender" [formControl]="myControl2" multiple>
<mat-select-trigger style="color:#fff;"> <mat-select-trigger style="color:#fff;">
{{myControl2.value ? myControl2.value[0].short_name : ''}} {{myControl2.value != null && myControl2.value != '' ? myControl2.value[0].short_name : ''}}
<span *ngIf="myControl2.value?.length > 1" > <span *ngIf="myControl2.value?.length > 1" >
(+{{myControl2.value.length - 1}} {{myControl2.value?.length === 2 ? 'other' : 'others'}}) (+{{myControl2.value.length - 1}} {{myControl2.value?.length === 2 ? 'other' : 'others'}})
</span> </span>

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,34 +837,26 @@ 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;
this.doughnutChartDataForSmartPD = this.tempDataSmartPD; this.doughnutChartDataForSmartPD = this.tempDataSmartPD;
this.doughnutChartDataForTelePD = this.tempDataTelePD; this.doughnutChartDataForTelePD = this.tempDataTelePD;
this.doughnutChartLabels = this.doughnutChartLabels; this.doughnutChartLabels = this.doughnutChartLabels;
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

@ -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

@ -24,7 +24,7 @@
<input matInput placeholder="Specify End Use" formControlName="end_use_other"> <input matInput placeholder="Specify End Use" formControlName="end_use_other">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Is there a balance transfer" <mat-select placeholder="Is there a balance transfer" (selectionChange)="selectedBalancesTransferChanges($event)"
formControlName="is_transfer" required> formControlName="is_transfer" required>
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>

View File

@ -170,7 +170,8 @@ getM_sourceofamount() {
end_use: ['', Validators.compose([Validators.required])], end_use: ['', Validators.compose([Validators.required])],
end_use_other: [''], end_use_other: [''],
is_transfer: ['', Validators.compose([Validators.required])], is_transfer: ['', Validators.compose([Validators.required])],
is_topup: ['', Validators.compose([Validators.required])], //is_topup: ['', Validators.compose([Validators.required])],
is_topup: [''],
balance_transfer_amount: [''], balance_transfer_amount: [''],
topup_amount: [''], topup_amount: [''],
lender: [''], lender: [''],
@ -204,6 +205,7 @@ getM_sourceofamount() {
submitLoanDetails() { submitLoanDetails() {
console.log('formData', this.loanDetailsForm.value); console.log('formData', this.loanDetailsForm.value);
if (!this.loanDetailsForm.valid) { if (!this.loanDetailsForm.valid) {
//this.notifier.notify('warning', 'Form Invaild Check all requried Field .!');
return; return;
} }
let records: any = {}; let records: any = {};
@ -269,6 +271,23 @@ getM_sourceofamount() {
} }
}); });
} }
selectedBalancesTransferChanges(event: any){
// console.log('First Time',event);
// console.log('First Time Value',event.value);
if(event.value == 'no') {
this.loanDetailsForm.controls['is_topup'].clearValidators();
this.loanDetailsForm.controls['is_topup'].updateValueAndValidity();
// console.log('no',event.value);
}
else if(event.value == 'yes'){
this.loanDetailsForm.controls['is_topup'].setValidators([Validators.required]);
this.loanDetailsForm.controls['is_topup'].updateValueAndValidity();
// console.log('yes',event.value);
}
}
/** On Key Press Event For Amount */ /** On Key Press Event For Amount */
keyPress(event: any) { keyPress(event: any) {
const pattern = /[0-9]/; const pattern = /[0-9]/;

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 !";
} }
}); });
@ -225,13 +227,12 @@ onChangeEntityId($event){
} }
if($event.isUserInput != false){ if($event.isUserInput != false){
//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);
} }
@ -263,7 +264,7 @@ onChangeCityDatas($event){
mycheck = 1; mycheck = 1;
} }
} }
} }
if(mycheck == 0){ if(mycheck == 0){
this.selectedCityDatas.push(cityName.name); this.selectedCityDatas.push(cityName.name);

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 = [];
@ -142,7 +161,7 @@ export class PdTeamEditComponent implements OnInit {
let PdTeamCity:any = []; let PdTeamCity:any = [];
for(let ptc of this.childMessage[0].CITYMAP){ for(let ptc of this.childMessage[0].CITYMAP){
PdTeamCity.push(ptc.city_id); PdTeamCity.push(ptc.city_id);
} }
let PdTeamProduct:any = []; let PdTeamProduct:any = [];
// for(let ptp of this.childMessage[0].PRODUCTS){ // for(let ptp of this.childMessage[0].PRODUCTS){
@ -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,36 +47,27 @@ 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(){
this.router.navigate(['/setting/pdteam/pdteammanage']);
}
changeListView(){
this.getPdTeam();
this.listView = true;
} }
/**To Manage Team */
managepdteam(){
this.router.navigate(['/setting/pdteam/pdteammanage']);
}
/** To get data for listing */ /** To get data for listing */
getPdTeam() { getPdTeam() {

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',