city issue fixed
This commit is contained in:
parent
5d04b39ead
commit
e67fbc9eb3
@ -15,6 +15,7 @@ import { takeUntil } from 'rxjs/operators';
|
||||
import { Subject } from 'rxjs';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { ExcelUploadDialogComponent } from './excel-upload-dialog/excel-upload-dialog.component';
|
||||
import { log } from 'console';
|
||||
@Component({
|
||||
selector: 'app-add-pd',
|
||||
templateUrl: './add-pd.component.html',
|
||||
@ -84,6 +85,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
||||
prod_seg: any;
|
||||
usertype: string;
|
||||
range: any;
|
||||
pincodedata: any;
|
||||
constructor(notifier: NotifierService, private _fb: FormBuilder, private route: ActivatedRoute,
|
||||
private router: Router, private _pd: PdTrigerService, private _aws: AwsService, private ListPdComponent: ListPdComponent,
|
||||
private titleCase : TitleCasePipe,private userService:UserService,private matDialog:MatDialog) {
|
||||
@ -407,9 +409,11 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
||||
|
||||
//get city list details based on state id
|
||||
getCityList(stateID: string,index) {
|
||||
console.log(stateID)
|
||||
this.getvendor(stateID)
|
||||
this._pd.getStateWiseCities(stateID).subscribe(data => {
|
||||
if (data.status == 200) {
|
||||
console.log(data.records)
|
||||
this.cityList[index] = data.records.cities;
|
||||
this.pincodeList[index] = data.records.pincode;
|
||||
this.cityData[index]=this.cityList[index]
|
||||
@ -587,7 +591,8 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
||||
this.lengthCheckToaddMore = 1;
|
||||
}
|
||||
}
|
||||
getPincode(e,i){ this.pincodeflag[i] = e == 1 ? true : false;}
|
||||
getPincode(e,i){ this.pincodeflag[i] = e == 1 ? true : false;
|
||||
console.log(e , i)}
|
||||
// save pd in draft
|
||||
saveDraftPD(formValue: any, status: string) {
|
||||
//alert('Inside The Draft PD');
|
||||
@ -794,7 +799,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
|
||||
control_address.get('pincode').enable()
|
||||
// this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
|
||||
}
|
||||
else if(formValue.addresses[0].pincode == undefined )
|
||||
else if(formValue.addresses[0].pincode == undefined && formValue.addresses[0].pincode == "")
|
||||
{
|
||||
let control_address = this._PDtriggerForm.get('addresses')['controls'][0] as FormArray
|
||||
control_address.get('pincode').enable()
|
||||
@ -1326,10 +1331,13 @@ searchFun(control:any,i:number,option){
|
||||
// control_address.get('fk_state')
|
||||
// control_address.get('fk_city')
|
||||
// control_address.get('pincode')
|
||||
console.log('jkhjjjhguhg')
|
||||
control_address.get('addressline1').disable()
|
||||
control_address.get('fk_state').disable()
|
||||
control_address.get('fk_city').disable()
|
||||
control_address.get('pincode').disable()
|
||||
let pincode = control_address.get('pincode');
|
||||
console.log(pincode);
|
||||
|
||||
this.choosed_address.setValidators(Validators.required)
|
||||
}
|
||||
@ -1341,9 +1349,8 @@ searchFun(control:any,i:number,option){
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onChangeSelectedAddress(value) {
|
||||
console.log(value)
|
||||
|
||||
let state=value.state;
|
||||
this.getvendor(state)
|
||||
if(value) {
|
||||
@ -1351,9 +1358,31 @@ searchFun(control:any,i:number,option){
|
||||
console.log(control_address);
|
||||
control_address.get('addressline1').setValue(value.addressline)
|
||||
control_address.get('fk_state').setValue(value.state)
|
||||
this.getCityList(value.state,0);
|
||||
control_address.get('fk_city').setValue(value.city)
|
||||
control_address.get('pincode').setValue(value.pincode)
|
||||
this.getCityList(value.state,0);
|
||||
this._pd.getStateWiseCities(value.state).subscribe(data => {
|
||||
if (data.status == 200) {
|
||||
|
||||
this.pincodedata = data.records.pincode;
|
||||
console.log( this.pincodedata )
|
||||
let pincode_is_avai = this.pincodedata.filter(t=>t.pincode_id ==value.pincode);
|
||||
let length=pincode_is_avai.length;
|
||||
console.log( length )
|
||||
if(length==0)
|
||||
{
|
||||
control_address.get('pincode').enable()
|
||||
control_address.get('pincode').setValue("")
|
||||
}
|
||||
else
|
||||
{
|
||||
control_address.get('pincode').setValue(value.pincode)
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
changePDTypeSlideValue(event) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user