Merge branch 'master' of https://bitbucket.org/sriramv18/sparqsineedge
This commit is contained in:
commit
b92a4382de
@ -14,7 +14,7 @@
|
||||
<mat-form-field class="example-full-width">
|
||||
<mat-select placeholder="City" [formControl]="myControl" multiple>
|
||||
<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" >
|
||||
(+{{myControl.value.length - 1}} {{myControl.value?.length === 2 ? 'other' : 'others'}})
|
||||
</span>
|
||||
@ -30,7 +30,7 @@
|
||||
<mat-form-field class="example-full-width">
|
||||
<mat-select placeholder="Lender" [formControl]="myControl2" multiple>
|
||||
<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" >
|
||||
(+{{myControl2.value.length - 1}} {{myControl2.value?.length === 2 ? 'other' : 'others'}})
|
||||
</span>
|
||||
|
||||
@ -119,12 +119,12 @@ export class DashboardComponent {
|
||||
const LastDateForPreMonth = new Date(today.getFullYear(), today.getMonth(), 0);
|
||||
const FirstDateForPreMonth = new Date(today.getFullYear(), today.getMonth()-1, 1);
|
||||
|
||||
console.log('FromDateMin:',fromMin);
|
||||
console.log('FromDateMax:',fromMax);
|
||||
console.log('ToDateMin',toMin);
|
||||
console.log('ToDateMax',toMax);
|
||||
console.log('LastDateForPreMonth',LastDateForPreMonth);
|
||||
console.log('FirstDateForPreMonth',FirstDateForPreMonth);
|
||||
// console.log('FromDateMin:',fromMin);
|
||||
// console.log('FromDateMax:',fromMax);
|
||||
// console.log('ToDateMin',toMin);
|
||||
// console.log('ToDateMax',toMax);
|
||||
// console.log('LastDateForPreMonth',LastDateForPreMonth);
|
||||
// console.log('FirstDateForPreMonth',FirstDateForPreMonth);
|
||||
|
||||
// const resetRange = {fromDate: today, toDate: today};
|
||||
// this.dateRangePicker.resetDates(resetRange); // will trigger selectedDateRangeChanged
|
||||
@ -134,7 +134,7 @@ export class DashboardComponent {
|
||||
this.options = {
|
||||
presets: this.presets,
|
||||
format: 'mediumDate',
|
||||
range: {fromDate:FirstDateForPreMonth, toDate: LastDateForPreMonth},
|
||||
range: {fromDate:FirstDateForPreMonth, toDate: fromMax},
|
||||
applyLabel: "Submit",
|
||||
calendarOverlayConfig: {
|
||||
shouldCloseOnBackdropClick: false,
|
||||
@ -191,10 +191,7 @@ getDoughnutChartData(){
|
||||
|
||||
this._dashboardService.getPDDetailForDoughnut(fromdate,todate,cityarr,lenderarr).subscribe(data => {
|
||||
this.flag = 1;
|
||||
console.log(' ***** Doughnut Chart Data *****');
|
||||
console.log('Whole Data',data);
|
||||
console.log('Monthly Status',data.records.current_month);
|
||||
|
||||
console.log(' ***** Doughnut Chart Data *****',data);
|
||||
|
||||
let DraftIndexvalue = this.doughnutChartLabels.indexOf('Draft');
|
||||
let TriggedIndexvalue = this.doughnutChartLabels.indexOf('Triggered');
|
||||
@ -475,8 +472,11 @@ getDoughnutChartData(){
|
||||
}
|
||||
|
||||
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.doughnutChartDataForSmartPD = this.tempDataSmartPD;
|
||||
this.doughnutChartDataForTelePD = this.tempDataTelePD;
|
||||
@ -484,17 +484,10 @@ getDoughnutChartData(){
|
||||
this.total2 = this.tempDataSmartPD.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('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);
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@ -518,7 +511,7 @@ onChange(e :any,flag: any) {
|
||||
|
||||
let fromdate;
|
||||
let todate;
|
||||
console.log('flag',flag);
|
||||
|
||||
if(flag == 1){
|
||||
|
||||
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 => {
|
||||
|
||||
console.log(' *****Updated Date Doughnut Chart Data *****');
|
||||
console.log('Whole Data',data);
|
||||
console.log(' *****Updated Date Doughnut Chart Data *****',data);
|
||||
|
||||
if(data.records.current_month.length != 0){
|
||||
this.total1 = 0;
|
||||
this.total2 = 0;
|
||||
@ -848,34 +837,26 @@ onChange(e :any,flag: any) {
|
||||
}
|
||||
|
||||
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.doughnutChartDataForSmartPD = this.tempDataSmartPD;
|
||||
this.doughnutChartDataForTelePD = this.tempDataTelePD;
|
||||
this.doughnutChartLabels = this.doughnutChartLabels;
|
||||
this.total1 = this.tempDataFullPD.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);
|
||||
console.log('Canvas Full',this.FullCanvas) ;
|
||||
console.log('Canvas Smart',this.SmartCanvas);
|
||||
console.log('Canvas Tele',this.TeleCanvas);
|
||||
this.total1 = this.tempDataFullPD.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.FullCanvas.chart.update();
|
||||
this.SmartCanvas.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);
|
||||
|
||||
})
|
||||
|
||||
|
||||
@ -21,7 +21,6 @@ const currentdate = new Date().toJSON().slice(0,19).replace('T',' ');
|
||||
export class DashboardService {
|
||||
|
||||
private apiUrl = environment.apiEndpoint;
|
||||
//private apiUrl = 'http://localhost/sparqapi/api/';
|
||||
|
||||
constructor(private _http: HttpClient,
|
||||
private _aws:AwsService) { }
|
||||
@ -53,17 +52,17 @@ export class DashboardService {
|
||||
// }
|
||||
|
||||
getPDDetailForDoughnut(fromdate,todate,cityarr,lenderarr): Observable<any> {
|
||||
console.log(')))))');
|
||||
console.log(fromdate);
|
||||
console.log(todate);
|
||||
console.log(cityarr);
|
||||
console.log(lenderarr);
|
||||
console.log('(((');
|
||||
|
||||
console.log('From',fromdate);
|
||||
console.log('To',todate);
|
||||
console.log('Lender Arr',lenderarr);
|
||||
console.log('City Arr',cityarr);
|
||||
|
||||
|
||||
return this._http.post(this.apiUrl+'getDashBoardMaster', {
|
||||
"fromdate":fromdate,
|
||||
"todate": todate,
|
||||
"cityarr":cityarr,
|
||||
"lenderarr": lenderarr})
|
||||
"fromdate":fromdate != '' && fromdate != null && fromdate != undefined ? fromdate : '',
|
||||
"todate": todate != '' && todate != null && todate != undefined ? todate : '',
|
||||
"lenderarr": lenderarr,"cityarr":cityarr})
|
||||
.pipe(catchError(this.handleError('role', []))
|
||||
)
|
||||
|
||||
|
||||
@ -105,10 +105,14 @@ export class BankingDetailsComponent implements OnInit {
|
||||
account_type: ['', Validators.compose([Validators.required])],
|
||||
salary: ['', 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_month: ['', Validators.compose([Validators.required])],
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
addBankdetails(index, event) {
|
||||
@ -117,6 +121,10 @@ export class BankingDetailsComponent implements OnInit {
|
||||
let length = control.length;
|
||||
this.step = length;
|
||||
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) {
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
<input matInput placeholder="Specify End Use" formControlName="end_use_other">
|
||||
</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>
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
|
||||
@ -170,7 +170,8 @@ getM_sourceofamount() {
|
||||
end_use: ['', Validators.compose([Validators.required])],
|
||||
end_use_other: [''],
|
||||
is_transfer: ['', Validators.compose([Validators.required])],
|
||||
is_topup: ['', Validators.compose([Validators.required])],
|
||||
//is_topup: ['', Validators.compose([Validators.required])],
|
||||
is_topup: [''],
|
||||
balance_transfer_amount: [''],
|
||||
topup_amount: [''],
|
||||
lender: [''],
|
||||
@ -204,6 +205,7 @@ getM_sourceofamount() {
|
||||
submitLoanDetails() {
|
||||
console.log('formData', this.loanDetailsForm.value);
|
||||
if (!this.loanDetailsForm.valid) {
|
||||
//this.notifier.notify('warning', 'Form Invaild Check all requried Field .!');
|
||||
return;
|
||||
}
|
||||
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 */
|
||||
keyPress(event: any) {
|
||||
const pattern = /[0-9]/;
|
||||
|
||||
@ -6,24 +6,26 @@ import { FormBuilder,
|
||||
import { MatDialog,
|
||||
MatDialogRef,
|
||||
MAT_DIALOG_DATA } from '@angular/material';
|
||||
|
||||
/** Service */
|
||||
import { MastersService } from '../../service/masters/masters.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 */
|
||||
import Swal from 'sweetalert2';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pd-team-add',
|
||||
templateUrl: './pd-team-add.component.html',
|
||||
styleUrls: ['./pd-team-add.component.scss']
|
||||
})
|
||||
|
||||
export class PdTeamAddComponent implements OnInit {
|
||||
|
||||
public _pdTeamForm: FormGroup;
|
||||
private notifier: NotifierService;
|
||||
|
||||
color = 'primary';
|
||||
errorMessage:string;
|
||||
|
||||
@ -42,17 +44,16 @@ selectedProductDatas : any=[];
|
||||
selectedSegmentDatas : any=[];
|
||||
|
||||
constructor(private _formBuilder: FormBuilder,
|
||||
private _notifier: NotifierService,
|
||||
private _pdTeamService: PdTeamService,
|
||||
private _router: Router,
|
||||
private _masterService: MastersService)
|
||||
{
|
||||
this.notifier = _notifier;
|
||||
|
||||
}
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
//console.log(this.notifier);
|
||||
|
||||
this.PdTeamFormDatas();
|
||||
|
||||
/** For Checking City Validation datas - checking purpose - Already exists are not */
|
||||
@ -143,15 +144,16 @@ onSubmit() {
|
||||
this._pdTeamService.addPdTeamDetail(this._pdTeamForm.value).subscribe(
|
||||
dataresult => {
|
||||
if(dataresult.dataStatus == true) {
|
||||
this.notifier.notify('success', 'Record Saved Successfully.!');
|
||||
|
||||
Swal('Record Saved Successfully.!','success');
|
||||
this._router.navigate(['/setting/pdteam/pdteamlist']);
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
Swal('Wrong.!');
|
||||
//alert('Some Thing Wents Wrong Try Again !');
|
||||
|
||||
//Swal('Wrong.!');
|
||||
Swal('Some Thing Wents Wrong Try Again !');
|
||||
//this.errorMessage = "Some Thing Wents Wrong Try Again !";
|
||||
}
|
||||
});
|
||||
@ -225,13 +227,12 @@ onChangeEntityId($event){
|
||||
}
|
||||
|
||||
if($event.isUserInput != false){
|
||||
//console.log(this.CityValidation,lenderId);
|
||||
//console.log(this.CityValidation,lenderId);
|
||||
this._pdTeamService.getLenderData(lenderId).subscribe(
|
||||
dataresult => {
|
||||
|
||||
if(dataresult.dataStatus == true) {
|
||||
this.CityValidation = dataresult.records;
|
||||
console.log(this.CityValidation);
|
||||
//console.log(this.CityValidation);
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
}
|
||||
@ -263,7 +264,7 @@ onChangeCityDatas($event){
|
||||
mycheck = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mycheck == 0){
|
||||
this.selectedCityDatas.push(cityName.name);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div style="max-height: 580px;">
|
||||
<div style="max-height: 580px;" *ngIf="apiFinishLoad">
|
||||
<form [formGroup]="_pdTeamForm" (submit)="onSubmit()">
|
||||
<mat-card style="padding: 6px;">
|
||||
<div class="ml-xs mr-xs" style="width: 100%;" fxLayout="row" fxLayoutAlign="center">
|
||||
|
||||
@ -6,9 +6,9 @@ import { FormBuilder,
|
||||
/** Service */
|
||||
import { MastersService } from '../../service/masters/masters.service';
|
||||
import { PdTeamService } from '../../service/masters/pd-team.service';
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
/** 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 */
|
||||
import Swal from 'sweetalert2';
|
||||
@Component({
|
||||
@ -22,14 +22,15 @@ export class PdTeamEditComponent implements OnInit {
|
||||
public _pdTeamForm: FormGroup;
|
||||
public submitted = false;
|
||||
public listView: any = true;
|
||||
private notifier: NotifierService;
|
||||
color = 'primary';
|
||||
errorMessage:string;
|
||||
lenderId:any;
|
||||
teamID: any;
|
||||
apiFinishLoad: boolean;
|
||||
|
||||
//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
|
||||
citydatas: any[];
|
||||
lenderdatas: any[];
|
||||
@ -51,27 +52,33 @@ export class PdTeamEditComponent implements OnInit {
|
||||
selectedCityDatas : any=[];
|
||||
selectedProductDatas : any=[];
|
||||
selectedSegmentDatas : any=[];
|
||||
|
||||
//EditDatasforFormGroup: any;
|
||||
|
||||
constructor(private _formBuilder: FormBuilder,
|
||||
private _notifier: NotifierService,
|
||||
private _router: Router,private route: ActivatedRoute,
|
||||
private _pdTeamService: PdTeamService,
|
||||
private _PdTeamListComponent: PdTeamListComponent,
|
||||
private _masterService: MastersService) {
|
||||
this.notifier = _notifier;
|
||||
|
||||
}
|
||||
|
||||
/** Onready function */
|
||||
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();
|
||||
//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 */
|
||||
this._pdTeamService.getAllPdTeamCityMapping().subscribe(
|
||||
dataresult => {
|
||||
@ -117,18 +124,30 @@ export class PdTeamEditComponent implements OnInit {
|
||||
this.customerSegmentdatas = this.customerSegmentdatas.filter(segment=>segment.isactive == 1 );
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
this.lenderId = this._pdTeamForm.value['fk_lender'];
|
||||
this._pdTeamService.getLenderData(this.lenderId).subscribe(
|
||||
dataresult => {
|
||||
if(dataresult.dataStatus == true){
|
||||
this.CityValidation = dataresult.records;
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
|
||||
// this.lenderId = this._pdTeamForm.value.fk_lender;
|
||||
// console.log('form data',this._pdTeamForm);
|
||||
// console.log('form data Particular Value',this._pdTeamForm.value.fk_lender);
|
||||
// this._pdTeamService.getLenderData(this.lenderId).subscribe(
|
||||
// dataresult => {
|
||||
// if(dataresult.dataStatus == true){
|
||||
// this.CityValidation = dataresult.records;
|
||||
// }
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
/** Pd Team Form Datas */
|
||||
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);
|
||||
|
||||
// let PdTeamcity:any = [];
|
||||
@ -142,7 +161,7 @@ export class PdTeamEditComponent implements OnInit {
|
||||
let PdTeamCity:any = [];
|
||||
for(let ptc of this.childMessage[0].CITYMAP){
|
||||
PdTeamCity.push(ptc.city_id);
|
||||
}
|
||||
}
|
||||
|
||||
let PdTeamProduct:any = [];
|
||||
// for(let ptp of this.childMessage[0].PRODUCTS){
|
||||
@ -173,17 +192,37 @@ export class PdTeamEditComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
|
||||
this._pdTeamForm.controls['pdteam_id'].setValue(this.childMessage[0].pdteam_id);
|
||||
this._pdTeamForm.controls['team_name'].setValue(this.childMessage[0].team_name);
|
||||
this._pdTeamForm.controls['fk_lender'].setValue(this.childMessage[0].fk_lender_id);
|
||||
this._pdTeamForm.controls['fk_city'].setValue(PdTeamCity);
|
||||
this._pdTeamForm.controls['fk_customer_segment'].setValue(this.DBCustomerSegmentDatas);
|
||||
this._pdTeamForm.controls['fk_product'].setValue(this.DBProductDatas);
|
||||
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])],
|
||||
// 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 */
|
||||
@ -191,9 +230,9 @@ export class PdTeamEditComponent implements OnInit {
|
||||
|
||||
/** For Popup Close Button */
|
||||
onNoClick(): void {
|
||||
this._PdTeamListComponent.changeListView();
|
||||
this._router.navigate(['/setting/pdteam/pdteamlist']);
|
||||
}
|
||||
|
||||
|
||||
/** To Reset Popup Data For Add*/
|
||||
// onResetForEdit(){
|
||||
// this.PdTeamFormDatas();
|
||||
@ -225,9 +264,9 @@ export class PdTeamEditComponent implements OnInit {
|
||||
this._pdTeamService.editPdTeamchildDetails(ActiveDatas,'PDTEAMCUSTOMERSEGMENT')
|
||||
.subscribe(dataresult=>{
|
||||
if (dataresult.dataStatus == true){
|
||||
//alert('InActive Changes Done in cs');
|
||||
let index = this.selectedSegmentDatas.indexOf(CustomerSegmentName.name);
|
||||
this.selectedSegmentDatas.splice(index,1);
|
||||
// alert('InActive Changes Done in cs');
|
||||
// let index = this.selectedSegmentDatas.indexOf(CustomerSegmentName.name);
|
||||
// this.selectedSegmentDatas.splice(index,1);
|
||||
|
||||
}else{}
|
||||
});
|
||||
@ -326,6 +365,7 @@ export class PdTeamEditComponent implements OnInit {
|
||||
else if($event.source._selected == false ){
|
||||
|
||||
console.log('Return False for city Selection Data');
|
||||
|
||||
let index = this.selectedCityDatas.indexOf(cityName.name);
|
||||
this.selectedCityDatas.splice(index,1);
|
||||
|
||||
@ -336,16 +376,20 @@ export class PdTeamEditComponent implements OnInit {
|
||||
dataresult => {
|
||||
if (dataresult.dataStatus == true) {
|
||||
data = dataresult.records;
|
||||
|
||||
//console.log('data',data);
|
||||
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];
|
||||
//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=>{
|
||||
if (dataresult.dataStatus == true) {//alert('Deleted');
|
||||
let index = this.selectedCityDatas.indexOf(cityName.name);
|
||||
this.selectedCityDatas.splice(index,1);
|
||||
//this._PdTeamListComponent.changeListView();
|
||||
}
|
||||
// console.log('Response Data',data);
|
||||
// if (dataresult.dataStatus == true) {
|
||||
// alert('Deleted');
|
||||
// // let index = this.selectedCityDatas.indexOf(cityName.name);
|
||||
// // this.selectedCityDatas.splice(index,1);
|
||||
// }
|
||||
});
|
||||
}
|
||||
}, error => this.errorMessage = <any> error);
|
||||
@ -378,17 +422,17 @@ export class PdTeamEditComponent implements OnInit {
|
||||
dataresult => {
|
||||
if (dataresult.dataStatus == true) {
|
||||
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(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'} ;
|
||||
this._pdTeamService.editPdTeamchildDetails(ActiveDatas,'PDTEAMPRODUCT')
|
||||
.subscribe(dataresult=>{
|
||||
if (dataresult.dataStatus == true){
|
||||
//alert('InActive Changes Done in product');
|
||||
let index = this.selectedProductDatas.indexOf(productName.name);
|
||||
this.selectedProductDatas.splice(index,1);
|
||||
// alert('InActive Changes Done in product');
|
||||
// let index = this.selectedProductDatas.indexOf(productName.name);
|
||||
// this.selectedProductDatas.splice(index,1);
|
||||
}
|
||||
else{
|
||||
//alert("Sorry Try Again !");
|
||||
@ -411,11 +455,13 @@ export class PdTeamEditComponent implements OnInit {
|
||||
dataresult=>{
|
||||
if (dataresult.dataStatus == true){
|
||||
Swal("Data Edited Successfully");
|
||||
// this.notifier.notify('success', 'Record Edited Successfully.!');
|
||||
|
||||
this._router.navigate(['/setting/pdteam/pdteamlist']);
|
||||
|
||||
}
|
||||
else{
|
||||
Swal("SomeThing Wents Wrong Try Again !");
|
||||
// this.notifier.notify('warning', 'SomeThing Wents Wrong Try Again !');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div *ngIf="listView">
|
||||
<!-- <div *ngIf="listView"> -->
|
||||
<mat-card>
|
||||
<div fxLayout="row" fxLayoutAlign="start center" class="mb-1">
|
||||
<div class="ml-xs mr-xs" style="width: 30%;">
|
||||
@ -57,7 +57,7 @@
|
||||
<mat-header-cell *matHeaderCellDef> Action </mat-header-cell>
|
||||
<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>
|
||||
</ng-container>
|
||||
@ -71,8 +71,7 @@
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<!--<div *ngIf="!listView">
|
||||
<app-pd-team-edit [childMessage]="parentMessage"></app-pd-team-edit>
|
||||
</div>-->
|
||||
<notifier-container></notifier-container>
|
||||
@ -9,8 +9,7 @@ MatTableDataSource } from '@angular/material';
|
||||
import { MastersService } from '../../service/masters/masters.service';
|
||||
import { PdTeamService } from '../../service/masters/pd-team.service';
|
||||
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
import { Router } from '@angular/router';
|
||||
import { Router,ActivatedRoute } from '@angular/router';
|
||||
/**sweet alert */
|
||||
import Swal from 'sweetalert2';
|
||||
|
||||
@ -38,47 +37,36 @@ export class PdTeamListComponent implements OnInit {
|
||||
userData = null;
|
||||
noRecordFound: boolean = false;
|
||||
|
||||
private notifier: NotifierService;
|
||||
public listView: any = true;
|
||||
|
||||
public dataLength: number;
|
||||
public dataSource = new MatTableDataSource();
|
||||
public parentMessage: any = [];
|
||||
|
||||
|
||||
displayedColumns = ['serialno','team_name','lender_name','actions','isactive'];
|
||||
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
||||
|
||||
constructor(notifier: NotifierService,
|
||||
private router: Router,
|
||||
constructor(
|
||||
private router: Router,private route: ActivatedRoute,
|
||||
private _MasterService: MastersService,
|
||||
private _PdTeamService: PdTeamService) {
|
||||
this.getPdTeam();
|
||||
this.notifier = notifier;
|
||||
}
|
||||
|
||||
ngOnInit() { this.getPdTeam(); }
|
||||
|
||||
/** To edit data */
|
||||
editPdTeam(detail){
|
||||
|
||||
this._PdTeamService.getAllPDTeamWithPDTeamID(detail).subscribe(
|
||||
dataresult => {
|
||||
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;
|
||||
toEditPdTeam(pdteam_id){
|
||||
//this.router.navigate(['/setting/pdteam/editpdteam',pdteam_id]);
|
||||
console.log(btoa(pdteam_id));
|
||||
this.router.navigate(['/setting/pdteam/editpdteam',btoa(pdteam_id)]);
|
||||
}
|
||||
|
||||
/**To Manage Team */
|
||||
managepdteam(){
|
||||
this.router.navigate(['/setting/pdteam/pdteammanage']);
|
||||
}
|
||||
|
||||
/** To get data for listing */
|
||||
getPdTeam() {
|
||||
|
||||
@ -15,7 +15,7 @@ export const PdTeamRoutes: Routes = [{
|
||||
path: 'addpdteam',
|
||||
component: PdTeamAddComponent
|
||||
},{
|
||||
path:'editpdteam',
|
||||
path:'editpdteam/:id',
|
||||
component:PdTeamEditComponent
|
||||
},{
|
||||
path:'pdteammanage',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user