PD team issues fixes : ps

This commit is contained in:
venbatechnologies@gmail.com 2018-10-30 15:52:57 +05:30
parent 1e54f530f5
commit c5bc88d8f3
5 changed files with 1888 additions and 1833 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
<h2 mat-dialog-title style="width: 50%;">Add New 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()" [color]="color"><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()" type="button"><mat-icon>close</mat-icon></button>
</div>
</div>
@ -19,7 +19,8 @@
<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-option *ngFor="let ld of lenderdatas" [value]="ld.entity_id" >{{ ld.short_name }} {{ ld.full_name }} </mat-option> -->
<mat-option *ngFor="let ld of lenderdatas" [value]="ld.entity_id" (onSelectionChange)="onChangeEntityId($event)" >{{ ld.short_name }} {{ ld.full_name }} </mat-option>
</mat-select>
<!-- <mat-error *ngIf="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>
@ -30,7 +31,7 @@
<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="flex-start">
<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-option *ngFor="let cd of citydatas" [value]="cd?.city_id" (onSelectionChange)="onChangeCityDatas($event)" >{{ cd?.name }} </mat-option>
</mat-select>
<!-- <mat-error *ngIf="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>

View File

@ -210,6 +210,33 @@ onChangeCustomerSegmentDatas($event){
// }
// }
onChangeEntityId($event){
//console.log($event);
let lenderId = $event.source.value;
this.CityValidation = [];
this.selectedCityDatas = [];
if(this._pdTeamForm.value['fk_city'] != null){
this.f.fk_city.setValue(null);
alert(this._pdTeamForm.value['fk_city']);
}
if($event.isUserInput != false){
//console.log(this.CityValidation,lenderId);
this._pdTeamService.getLenderData(lenderId).subscribe(
dataresult => {
if(dataresult.dataStatus == true) {
this.CityValidation = dataresult.records;
console.log(this.CityValidation);
}
}, error => this.errorMessage = <any> error);
}
}
onChangeCityDatas($event){
var mycheck = 0 ;
@ -219,14 +246,14 @@ onChangeCityDatas($event){
// console.log(cityName);
// console.log($event.source.value);
if($event.source._selected === true ){
this._pdTeamService.getLenderData(lenderId).subscribe(
dataresult => {
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(dataresult.dataStatus == true) {
// this.CityValidation = dataresult.records;
// }
// }, error => this.errorMessage = <any> error);
if(this.CityValidation != ''){
for(let data of this.CityValidation){
@ -242,7 +269,7 @@ onChangeCityDatas($event){
this.selectedCityDatas.push(cityName.name);
}
}
else if($event.source._selected === false ){
else if($event.source._selected == false ){
$event.source._selected = false;
let index = this.selectedCityDatas.indexOf(cityName.name);
this.selectedCityDatas.splice(index,1);

View File

@ -6,7 +6,7 @@
<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" type="button" (click)="onNoClick()" [color]="color"><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>
@ -19,8 +19,9 @@
</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 placeholder="Lender" required formControlName="fk_lender" disabled="true">
<!-- <mat-option *ngFor="let ld of lenderdatas" [value]="ld.entity_id" >{{ ld.short_name }} {{ ld.full_name }} </mat-option> -->
<mat-option *ngFor="let ld of lenderdatas" [value]="ld.entity_id" (onSelectionChange)="onChangeEntityId($event)" >{{ 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="!_pdTeamForm.controls['fk_lender'].valid && _pdTeamForm.controls['fk_lender'].touched" class="mat-text-warn">Lender Name Requried.</mat-error>

View File

@ -25,6 +25,7 @@ export class PdTeamEditComponent implements OnInit {
private notifier: NotifierService;
color = 'primary';
errorMessage:string;
lenderId:any;
//This "childMessage" to get the function or data from partent component
@Input() public childMessage: any;
@ -115,7 +116,15 @@ export class PdTeamEditComponent implements OnInit {
this.customerSegmentdatas = dataresult.records;
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(
dataresult => {
if(dataresult.dataStatus == true){
this.CityValidation = dataresult.records;
}
}, error => this.errorMessage = <any> error);
}
/** Pd Team Form Datas */
@ -266,6 +275,23 @@ export class PdTeamEditComponent implements OnInit {
// }
// }
onChangeEntityId($event){
//console.log($event);
let lenderId = $event.source.value;
this.CityValidation = [];
if($event.isUserInput != false){
//console.log(this.CityValidation,lenderId);
this._pdTeamService.getLenderData(lenderId).subscribe(
dataresult => {
if(dataresult.dataStatus == true) {
this.CityValidation = dataresult.records;
//console.log(this.CityValidation);
}
}, error => this.errorMessage = <any> error);
// console.log(this.CityValidation);
}
}
onChangeCityDatas($event){
//console.log('inside the function Event');
var mycheck = 0 ;
@ -275,13 +301,13 @@ export class PdTeamEditComponent implements OnInit {
// console.log(cityName);
// console.log($event.source.value);
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($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){
@ -297,7 +323,7 @@ export class PdTeamEditComponent implements OnInit {
this.selectedCityDatas.push(cityName.name);
}
}
else if($event.source._selected === false ){
else if($event.source._selected == false ){
console.log('Return False for city Selection Data');
let index = this.selectedCityDatas.indexOf(cityName.name);
@ -310,10 +336,10 @@ export class PdTeamEditComponent implements OnInit {
dataresult => {
if (dataresult.dataStatus == true) {
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_pdteam_id == this._pdTeamForm.value.pdteam_id)[0];
console.log(data.pdteam_city_id);
//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);