This commit is contained in:
saravanakumarkandasami 2018-10-23 18:11:45 +05:30
commit 2bbce82f42
6 changed files with 2205 additions and 1945 deletions

File diff suppressed because it is too large Load Diff

View File

@ -36,15 +36,14 @@
<mat-error *ngIf="!_pdTeamForm.controls['fk_city'].valid && _pdTeamForm.controls['fk_city'].touched" class="mat-text-warn">City Name Requried.</mat-error>
</mat-form-field>
<span fxFlex="0 1 auto" class="ml-xs">
<h6 *ngIf="selectedCityDatas.length != 0"> The Selected Cities are., </h6>
<ul *ngFor="let data of selectedCityDatas">
<h6> The Selected Cities are., </h6>
<!-- <h6> The Selected Cities are., </h6> -->
<li>{{data}}</li>
</ul>
</span>
</div>
<h6>Products</h6> <hr> <br>
@ -57,9 +56,9 @@
<mat-error *ngIf="!_pdTeamForm.controls['fk_product'].valid && _pdTeamForm.controls['fk_product'].touched" class="mat-text-warn">Product Name Requried.</mat-error>
</mat-form-field>
<span fxFlex="0 1 auto" class="ml-xs">
<h6 *ngIf="selectedProductDatas.length != 0"> The Selected Products are., </h6>
<ul *ngFor="let data of selectedProductDatas">
<h6> The Selected Products are., </h6>
<!-- <h6> The Selected Products are., </h6> -->
<li>{{data}}</li>
</ul>
</span>
@ -77,9 +76,9 @@
</mat-form-field>
<span fxFlex="0 1 auto" class="ml-xs">
<h6 *ngIf="selectedSegmentDatas.length != 0"> The Selected Customer segment are., </h6>
<ul *ngFor="let data of selectedSegmentDatas">
<h6> The Selected Customer segment are., </h6>
<!-- <h6> The Selected Customer segment are., </h6> -->
<li>{{data}}</li>
</ul>
</span>

View File

@ -36,8 +36,9 @@ customerSegmentdatas: any[];
//This Type Of Array Declaration
pdTeamCityArray:any= [];
pdTeamProductArray: Array<{teamid: number, productid: number}> = [];
pdTeamCustomerSegmentArray: Array<{teamid: number, customerid: number}> = [];
CityValidation:any= [];
//pdTeamProductArray: Array<{teamid: number, productid: number}> = [];
//pdTeamCustomerSegmentArray: Array<{teamid: number, customerid: number}> = [];
//This Type Of Array Declaration for Local Purpose and List the data in html page
selectedCityDatas : any=[];
@ -71,7 +72,7 @@ this._pdTeamService.getAllPdTeamCityMapping()
/** To Display The City Data For City DropDown */
this._masterService.getAllMasterData('CITY').subscribe(
dataresult => {
if (dataresult.status == 200) {
if(dataresult.dataStatus == true){
this.citydatas = dataresult.records;
this.citydatas = this.citydatas.filter(city=>city.isactive == 1 );
}
@ -81,7 +82,7 @@ this._masterService.getAllMasterData('CITY').subscribe(
/** To Display The Entities Data For Entities DropDown */
this._masterService.getAllMasterData('ENTITY').subscribe(
dataresult => {
if (dataresult.status == 200) {
if(dataresult.dataStatus == true){
this.lenderdatas = dataresult.records;
this.lenderdatas = this.lenderdatas.filter(entity=>entity.isactive == 1 );
}
@ -90,7 +91,7 @@ this._masterService.getAllMasterData('ENTITY').subscribe(
/** To Display The Entities Data For Entities DropDown */
this._masterService.getAllMasterData('PRODUCTS').subscribe(
dataresult => {
if (dataresult.status == 200) {
if(dataresult.dataStatus == true) {
this.productdatas = dataresult.records;
this.productdatas = this.productdatas.filter(product=>product.isactive == 1 );
}
@ -99,7 +100,7 @@ this._masterService.getAllMasterData('PRODUCTS').subscribe(
/** To Display The Entities Data For Entities DropDown */
this._masterService.getAllMasterData('CUSTOMERSEGMENT').subscribe(
dataresult => {
if (dataresult.status == 200) {
if(dataresult.dataStatus == true) {
this.customerSegmentdatas = dataresult.records;
this.customerSegmentdatas = this.customerSegmentdatas.filter(segment=>segment.isactive == 1 );
}
@ -144,7 +145,7 @@ onSubmit() {
this._pdTeamService.addPdTeamDetail(this._pdTeamForm.value).subscribe(
dataresult => {
if (dataresult.status == 200) {
if(dataresult.dataStatus == true) {
//this.notifier.notify('success', 'Record Saved Successfully.!');
Swal('Record Saved Successfully.!','success');
this._pdTeamForm.reset();
@ -176,27 +177,66 @@ onChangeCustomerSegmentDatas($event){
}
/**on change function for City to display the as List in html page */
// onChangeCityDatas($event){
// var mycheck = 0 ;
// //let cityName = $event.source.value;
// let cityName = this.citydatas.filter(city=>city.city_id == $event.source.value)[0];
// if($event.source._selected === true ){
// for(let Duplication_City of this.pdTeamCityArray){
// let teamname = Duplication_City.team_name;
// let dup_cityname = Duplication_City.CITYMAP.filter(city=>city.city_id == $event.source.value);
// if(dup_cityname != ''){
// for(let data of dup_cityname){
// if(data.name == cityName.name){
// alert('"'+data.name+'" Already Existing with "'+ teamname +'"');
// $event.source._selected = false;
// mycheck++;
// }
// }
// }
// }
// if(mycheck == 0){
// this.selectedCityDatas.push(cityName.name);
// }
// }
// else if($event.source._selected === false ){
// let index = this.selectedCityDatas.indexOf(cityName.name);
// this.selectedCityDatas.splice(index,1);
// }
// }
onChangeCityDatas($event){
var mycheck = 0 ;
//let cityName = $event.source.value;
let cityName = this.citydatas.filter(city=>city.city_id == $event.source.value)[0];
let lenderId = this._pdTeamForm.value['fk_lender'];
if(lenderId != null){
let cityName = this.citydatas.filter(city=>city.city_id == $event.source.value)[0];//city array
// console.log(cityName);
// console.log($event.source.value);
if($event.source._selected === true ){
this._pdTeamService.getLenderData(lenderId).subscribe(
dataresult => {
for(let Duplication_City of this.pdTeamCityArray){
let teamname = Duplication_City.team_name;
let dup_cityname = Duplication_City.CITYMAP.filter(city=>city.city_id == $event.source.value);
if(dup_cityname != ''){
for(let data of dup_cityname){
if(data.name == cityName.name){
alert('"'+data.name+'" Already Existing with "'+ teamname +'"');
$event.source._selected = false;
mycheck++;
if(dataresult.dataStatus == true) {
this.CityValidation = dataresult.records;
}
}, error => this.errorMessage = <any> error);
if(this.CityValidation != ''){
for(let data of this.CityValidation){
if(data['fk_city_id'] == $event.source.value){
Swal('<h5>"'+data['city_name']+'" already existing with "'+ data['team_name'] +'"</h5>');
$event.source._selected = false;
mycheck = 1;
}
}
}
@ -204,13 +244,17 @@ onChangeCityDatas($event){
if(mycheck == 0){
this.selectedCityDatas.push(cityName.name);
}
}
else if($event.source._selected === false ){
$event.source._selected = false;
let index = this.selectedCityDatas.indexOf(cityName.name);
this.selectedCityDatas.splice(index,1);
}
}
else{
Swal('Pick Up The Lender Name');
$event.source._selected = false;
}
}
/**on change function for Product to display the data as List in html page */

View File

@ -5,7 +5,8 @@
<h2 mat-dialog-title style="width: 50%;">PD TEAM</h2>
<div style="width: 20%;"></div>
<div style="width: 30%;text-align:right;">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button>
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" (click)="onNoClick()"><mat-icon>close</mat-icon></button> -->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Close" matTooltipPosition="above" type="button" (click)="onNoClick()"><mat-icon>close</mat-icon></button>
</div>
</div>
@ -13,14 +14,16 @@
<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start">
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
<input matInput type="text" placeholder="Team Name" required formControlName="team_name">
<mat-error *ngIf="submitted && f.team_name.hasError('required')" class="mat-text-warn">You must Include Team Name.</mat-error>
<!-- <mat-error *ngIf="submitted && f.team_name.hasError('required')" class="mat-text-warn">You must Include Team Name.</mat-error> -->
<mat-error *ngIf="!_pdTeamForm.controls['team_name'].valid && _pdTeamForm.controls['team_name'].touched" class="mat-text-warn">Team Name Requried.</mat-error>
</mat-form-field>
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
<mat-select placeholder="Lender" required formControlName="fk_lender">
<mat-option *ngFor="let ld of lenderdatas" [value]="ld.entity_id" >{{ ld.short_name }} {{ ld.full_name }} </mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.fk_lender.hasError('required')" class="mat-text-warn">You must Select Lender Name.</mat-error>
<!-- <mat-error *ngIf="submitted && f.fk_lender.hasError('required')" class="mat-text-warn">You must Select Lender Name.</mat-error> -->
<mat-error *ngIf="!_pdTeamForm.controls['fk_lender'].valid && _pdTeamForm.controls['fk_lender'].touched" class="mat-text-warn">Lender Name Requried.</mat-error>
</mat-form-field>
</div>
@ -29,13 +32,15 @@
<mat-form-field fxFlex="0 1 auto" class="ml-xs">
<mat-select placeholder="City" required formControlName="fk_city" multiple>
<mat-option *ngFor="let cd of citydatas " [value]="cd.city_id" (onSelectionChange)="onChangeCityDatas($event)" >{{ cd.name }} </mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.fk_city.hasError('required')" class="mat-text-warn">You must Select Cities.</mat-error>
<!-- <mat-error *ngIf="submitted && f.fk_city.hasError('required')" class="mat-text-warn">You must Select Cities.</mat-error> -->
<mat-error *ngIf="!_pdTeamForm.controls['fk_city'].valid && _pdTeamForm.controls['fk_city'].touched" class="mat-text-warn">City Name Requried.</mat-error>
</mat-form-field>
<span fxFlex="0 1 auto" class="ml-xs">
<h6 *ngIf="selectedCityDatas.length != 0"> The Selected Cities are., </h6>
<ul *ngFor="let data of selectedCityDatas">
<h6> The Selected Cities are., </h6>
<li>{{data}}</li>
</ul>
</span>
@ -50,12 +55,13 @@
<mat-select placeholder="Product" required formControlName="fk_product" multiple>
<mat-option *ngFor="let pd of productdatas " [value]="pd.product_id" (onSelectionChange)="onChangeProductDatas($event)" >{{ pd.name }} </mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.fk_product.hasError('required')" class="mat-text-warn">You must Select Product.</mat-error>
<!-- <mat-error *ngIf="submitted && f.fk_product.hasError('required')" class="mat-text-warn">You must Select Product.</mat-error> -->
<mat-error *ngIf="!_pdTeamForm.controls['fk_product'].valid && _pdTeamForm.controls['fk_product'].touched" class="mat-text-warn">Product Name Requried.</mat-error>
</mat-form-field>
<span fxFlex="0 1 auto" class="ml-xs">
<h6 *ngIf="selectedProductDatas.length != 0"> The Selected Products are., </h6>
<ul *ngFor="let data of selectedProductDatas">
<h6> The Selected Products are., </h6>
<li>{{data}}</li>
</ul>
</span>
@ -68,12 +74,13 @@
<mat-select placeholder="Customer Segment" required formControlName="fk_customer_segment" multiple>
<mat-option *ngFor="let csd of customerSegmentdatas" [value]="csd.customer_segment_id" (onSelectionChange)="onChangeCustomerSegmentDatas($event)">{{csd.name}}</mat-option>
</mat-select>
<mat-error *ngIf="submitted && f.fk_customer_segment.hasError('required')" class="mat-text-warn">You must Select Customer Segment.</mat-error>
<!-- <mat-error *ngIf="submitted && f.fk_customer_segment.hasError('required')" class="mat-text-warn">You must Select Customer Segment.</mat-error> -->
<mat-error *ngIf="!_pdTeamForm.controls['fk_customer_segment'].valid && _pdTeamForm.controls['fk_customer_segment'].touched" class="mat-text-warn">CustomerSegment Name Requried.</mat-error>
</mat-form-field>
<span fxFlex="0 1 auto" class="ml-xs">
<h6 *ngIf="selectedSegmentDatas.length != 0"> The Selected Customer segment are., </h6>
<ul *ngFor="let data of selectedSegmentDatas">
<h6> The Selected Customer segment are., </h6>
<li>{{data}}</li>
</ul>
</span>
@ -82,7 +89,8 @@
<div class="row" style="text-align:right;">
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="reset"><mat-icon>settings_backup_restore</mat-icon></button> -->
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" type="button" (click)="onResetForEdit($event)" ><mat-icon>settings_backup_restore</mat-icon></button> -->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button>
<!-- <button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit"><mat-icon>save</mat-icon></button> -->
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="submit" [disabled]="!_pdTeamForm.valid"><mat-icon>save</mat-icon></button>
</div>
</mat-card>
</form>

View File

@ -1,16 +1,12 @@
import { Component, OnInit, Input } from '@angular/core';
import { FormBuilder,
FormGroup,
Validators,
FormControl } from '@angular/forms';
/** 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';
/**sweet alert */
@ -25,6 +21,7 @@ export class PdTeamEditComponent implements OnInit {
public _pdTeamForm: FormGroup;
public submitted = false;
public listView: any = true;
private notifier: NotifierService;
color = 'primary';
errorMessage:string;
@ -40,8 +37,14 @@ export class PdTeamEditComponent implements OnInit {
//This Type Of Array Declaration for Validation
pdTeamCityArray:any= [];
pdTeamProductArray: Array<{teamid: number, productid: number}> = [];
pdTeamCustomerSegmentArray: Array<{teamid: number, customerid: number}> = [];
CityValidation:any= [];
//pdTeamProductArray: Array<{teamid: number, productid: number}> = [];
//pdTeamCustomerSegmentArray: Array<{teamid: number, customerid: number}> = [];
//This Type Of Array Declaration to Check the Existing Data
DBCityDatas:any=[];
DBProductDatas:any=[];
DBCustomerSegmentDatas:any=[];
//This Type Of Array Declaration for Local Purpose and List the data in html page
selectedCityDatas : any=[];
@ -133,22 +136,42 @@ export class PdTeamEditComponent implements OnInit {
}
let PdTeamProduct:any = [];
for(let ptp of this.childMessage[0].PRODUCTS){
PdTeamProduct.push(ptp.product_id);
// for(let ptp of this.childMessage[0].PRODUCTS){
// PdTeamProduct.push(ptp.product_id);
// }
this._pdTeamService.getProductData(this.childMessage[0].pdteam_id).subscribe(
dataresult => {
if (dataresult.dataStatus == true) {
for(let ptp of dataresult.records){
this.DBProductDatas.push(ptp.fk_product_id);
this.selectedProductDatas.push(ptp.name);
this._pdTeamForm.controls['fk_product'].setValue(this.DBProductDatas);
}
}
}, error => this.errorMessage = <any> error);
let PdTeamCS:any = [];
for(let ptcs of this.childMessage[0].CUSTOMERSEGMENT){
PdTeamCS.push(ptcs.customer_segment_id);
// for(let ptcs of this.childMessage[0].CUSTOMERSEGMENT){
// PdTeamCS.push(ptcs.customer_segment_id);
// }
this._pdTeamService.getCustomerSegmentData(this.childMessage[0].pdteam_id).subscribe(
dataresult => {
if (dataresult.dataStatus == true) {
for(let ptcs of dataresult.records){
this.DBCustomerSegmentDatas.push(ptcs.customer_segment_id);
this.selectedSegmentDatas.push(ptcs.name);
this._pdTeamForm.controls['fk_customer_segment'].setValue(this.DBCustomerSegmentDatas);
}
}
}, error => this.errorMessage = <any> error);
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: [PdTeamCS, Validators.compose([Validators.required])],
fk_product:[PdTeamProduct, Validators.compose([Validators.required])],
fk_customer_segment: [this.DBCustomerSegmentDatas, Validators.compose([Validators.required])],
fk_product:[this.DBProductDatas, Validators.compose([Validators.required])],
});
@ -169,41 +192,103 @@ export class PdTeamEditComponent implements OnInit {
/**on change function for customer segment to dispaly the as List in html page */
onChangeCustomerSegmentDatas($event){
//let CustomerSegmentName = $event.source.value.name;
if($event.isUserInput != false){
let CustomerSegmentName = this.customerSegmentdatas.filter(cs=>cs.customer_segment_id == $event.source.value)[0];
if($event.source._selected === true ){
this.selectedSegmentDatas.push(CustomerSegmentName.name);
}
else if($event.source._selected === false ){
else if($event.isUserInput != false && $event.source._selected === false ){
let index = this.selectedSegmentDatas.indexOf(CustomerSegmentName.name);
this.selectedSegmentDatas.splice(index,1);
let data;
this._masterService.getAllMasterData('PDTEAMCUSTOMERSEGMENT').subscribe(
dataresult => {
if (dataresult.dataStatus == true) {
data = dataresult.records;
data = data.filter(pdteamcustomer=>pdteamcustomer.fk_cs_id == $event.source.value && pdteamcustomer.isactive == 1);
data = data.filter(pdteamcustomer=>pdteamcustomer.fk_pdteam_id == this._pdTeamForm.value.pdteam_id)[0];
let ActiveDatas = { 'pdteam_customer_segment_id':data.pdteam_customer_segment_id,'isactive': '0'} ;
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);
}
}
}else{}
});
}
}, error => this.errorMessage = <any> error);
}
}
}
/**on change function for City to display the as List in html page */
// onChangeCityDatas($event){
// var mycheck = 0 ;
// let cityName = this.citydatas.filter(city=>city.city_id == $event.source.value)[0];
// if($event.source._selected == true ){
// for(let Duplication_City of this.pdTeamCityArray){
// let teamname = Duplication_City.team_name;
// let dup_cityname = Duplication_City.CITYMAP.filter(city=>city.city_id == $event.source.value);
// if(dup_cityname != ''){
// for(let data of dup_cityname){
// if(data.name == cityName.name){
// Swal('<h5>"'+data.name+'" already existing with "'+ teamname +'"</h5>');
// $event.source._selected = false;
// mycheck=1;
// }
// }
// }
// }
// if(mycheck == 0){
// this.selectedCityDatas.push(cityName.name);
// }
// }
// else if($event.source._selected === false ){
// let index = this.selectedCityDatas.indexOf(cityName.name);
// this.selectedCityDatas.splice(index,1);
// }
// }
onChangeCityDatas($event){
//console.log('inside the function Event');
var mycheck = 0 ;
let lenderId = this._pdTeamForm.value['fk_lender'];
let cityName = this.citydatas.filter(city=>city.city_id == $event.source.value)[0];//city array
if($event.isUserInput != false){
// console.log(cityName);
// console.log($event.source.value);
let cityName = this.citydatas.filter(city=>city.city_id == $event.source.value)[0];
if($event.source._selected == true ){
for(let Duplication_City of this.pdTeamCityArray){
let teamname = Duplication_City.team_name;
let dup_cityname = Duplication_City.CITYMAP.filter(city=>city.city_id == $event.source.value);
if(dup_cityname != ''){
for(let data of dup_cityname){
if(data.name == cityName.name){
Swal('<h5>"'+data.name+'" already existing with "'+ teamname +'"</h5>');
$event.source._selected = false;
mycheck=1;
if($event.source._selected === true ){
this._pdTeamService.getLenderData(lenderId).subscribe(
dataresult => {
if(dataresult.dataStatus == true){
this.CityValidation = dataresult.records;
}
}, error => this.errorMessage = <any> error);
if(this.CityValidation != ''){
for(let data of this.CityValidation){
if(data['fk_city_id'] == $event.source.value){
Swal('<h5>"'+data['city_name']+'" already existing with "'+ data['team_name'] +'"</h5>');
$event.source._selected = false;
mycheck = 1;
}
}
}
@ -211,28 +296,82 @@ export class PdTeamEditComponent implements OnInit {
if(mycheck == 0){
this.selectedCityDatas.push(cityName.name);
}
}
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);
//$event.source._selected = false;
let data;
this._masterService.getAllMasterData('PDTEAMCITY').subscribe(
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);
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();
}
});
}
}, error => this.errorMessage = <any> error);
//console.log(data);
}
}
else if($event.isUserInput != true && $event.source._selected == true) {
this.selectedCityDatas.push(cityName.name);
}
}
/**on change function for Product to display the data as List in html page */
onChangeProductDatas($event){
if($event.isUserInput != false){
//let productName = $event.source.value.name;
let productName = this.productdatas.filter(product=>product.product_id == $event.source.value )[0];
if($event.source._selected === true ){
this.selectedProductDatas.push(productName.name);
}
else if($event.source._selected === false ){
else if($event.isUserInput != false && $event.source._selected === false ){
let index = this.selectedProductDatas.indexOf(productName.name);
this.selectedProductDatas.splice(index,1);
let data;
this._masterService.getAllMasterData('PDTEAMPRODUCT').subscribe(
dataresult => {
if (dataresult.dataStatus == true) {
data = dataresult.records;
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);
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);
}
else{
//alert("Sorry Try Again !");
}
});
}
}, error => this.errorMessage = <any> error);
}
}
}
/** To Edited form Data */
@ -243,7 +382,6 @@ export class PdTeamEditComponent implements OnInit {
(key) => ( pdTeamFormValues[key] == null) && delete pdTeamFormValues[key]);
this._pdTeamService.editPdTeamDetail(pdTeamFormValues).subscribe(
dataresult=>{
if (dataresult.dataStatus == true){
Swal("Data Edited Successfully");

View File

@ -65,13 +65,25 @@ return this._http.post<any>(this.apiUrl+"savePDTeam", ArrayData)
var ArrayData = { "records": Records }
console.log(ArrayData);
return this._http.post(this.apiUrl+'savePDTeam',ArrayData)
//return this._http.post(this.apiUrl+'savePDTeam',ArrayData)
return this._http.post<any>(this.apiUrl+"savePDTeam", ArrayData)
.pipe(
catchError(this.handleError('role', []))
)
}
editPdTeamchildDetails(Records: any,MasterName:string): Observable<any> {
var ArrayData = { "master_name":MasterName,
"records": Records }
var data = this._http.post(this.apiUrl+'saveMaster',ArrayData);
return data;
}
/**
* TO Inactive the Master Datas using API Call
@ -100,20 +112,65 @@ return this._http.post<any>(this.apiUrl+"savePDTeam", ArrayData)
// }
//To delete PDTeam Mapping Details
deletePdTeamMapDetails(Records:any){
Records.fk_updatedby = this._aws.getlocale();//to get user id for who is update the record
Records.updatedon = currentdate;//to get Current date and Time for when the Record is updated
deletePDteamCity(id:any): Observable<any> {
var ArrayData = { "records": [Records]};
var ArrayData = { "pdteam_city_id": id};
console.log('service data',ArrayData);
// console.log(ArrayData);
// console.log('PdTeamMapDetails in service');
return this._http.post(this.apiUrl+"deletePdTeamMapping",ArrayData).pipe(
return this._http.post<any>(this.apiUrl+"deletePdTeamMapping", ArrayData).pipe(
catchError(this.handleError('role', []))
);
}
// deletePdTeamMapDetails(Records:any){
// Records.fk_updatedby = this._aws.getlocale();//to get user id for who is update the record
// Records.updatedon = currentdate;//to get Current date and Time for when the Record is updated
// var ArrayData = { "records": [Records]};
// // console.log(ArrayData);
// // console.log('PdTeamMapDetails in service');
// return this._http.post(this.apiUrl+"deletePdTeamMapping",ArrayData).pipe(
// catchError(this.handleError('role', []))
// );
// }
getLenderData(lenderId: any): Observable<any> {
var ArrayData = {"lender_id":lenderId }
return this._http.post(this.apiUrl+"getLender",ArrayData)
.pipe(
catchError(this.handleError('role', []))
)
}
getProductData(TeamId: any): Observable<any> {
var ArrayData = {"team_id":TeamId }
return this._http.post(this.apiUrl+"getProduct",ArrayData)
.pipe(
catchError(this.handleError('role', []))
)
}
getCustomerSegmentData(TeamId: any): Observable<any> {
var ArrayData = {"team_id":TeamId }
return this._http.post(this.apiUrl+"getCustomerSegment",ArrayData)
.pipe(
catchError(this.handleError('role', []))
)
}
getExistingCityDatas(){
return this._http.get<any>(this.apiUrl+'getExistingCityDatas')
.pipe(
catchError(this.handleError('role', []))
)
}
@ -143,7 +200,7 @@ return this._http.post<any>(this.apiUrl+"savePDTeam", ArrayData)
)
}
getAllPDTeamWithPDTeamID(Primarykey): Observable<any> {
getAllPDTeamWithPDTeamID(Primarykey: any): Observable<any> {
var pk = { "primary_key":Primarykey }
return this._http.post<any>(this.apiUrl+'getListOfPDTeam',pk)
@ -153,7 +210,7 @@ return this._http.post<any>(this.apiUrl+"savePDTeam", ArrayData)
}
// /** Get All PD Team Child Data using API call Based on Primary Key */
getAllPdTeamMapListWithPK(Primarykey): Observable<any> {
getAllPdTeamMapListWithPK(Primarykey: any): Observable<any> {
var pk = { "primary_key":Primarykey }
//var Primar = Primarykey