changes:ps

This commit is contained in:
venbatechnologies@gmail.com 2019-01-21 14:58:19 +05:30
parent 26be95f769
commit 6bff2193f8
7 changed files with 101 additions and 40 deletions

View File

@ -144,7 +144,7 @@
Select
</mat-option>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.state_name}}
{{SL.name}}
</mat-option>
@ -168,9 +168,13 @@
<mat-form-field style="width: 24%">
<input matInput autocomplete="off" placeholder="Pincode" formControlName="pincode" (keypress)="keyPress($event)">
<!-- <input matInput autocomplete="off" placeholder="Pincode" formControlName="pincode" (keypress)="keyPress($event)"> -->
<!-- <mat-error *ngIf="pdMain.pincode.hasError('required')">Pincode Required.</mat-error> -->
<mat-error *ngIf="pdMain.pincode.hasError('maxlength') || pdMain.pincode.hasError('minlength')">Enter Valid Pincode. </mat-error>
<!-- <mat-error *ngIf="pdMain.pincode.hasError('maxlength') || pdMain.pincode.hasError('minlength')">Enter Valid Pincode. </mat-error> -->
<mat-select placeholder="Pincode" formControlName="pincode" >
<mat-option>Select</mat-option>
<mat-option *ngFor="let PL of pincodeList" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
</mat-select>
</mat-form-field>

View File

@ -34,6 +34,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
pdTypeList:any;
billingList: any;
relationShipList: any;
pincodeList: any = [];
errorMessage: any;
loanAmtInWords : any;
titleList: any;
@ -93,7 +94,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
  addressline1: [null],
fk_city: [null],
fk_state: [null],
  pincode : [null,Validators.compose([Validators.minLength(6),Validators.maxLength(6)])],
  pincode : [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
remarks:[null],
  // allocation_type: [null],
  // sub_allocation_type: [null],
@ -136,13 +137,21 @@ export class AddPdComponent implements OnInit, OnDestroy {
}
}, error => this.errorMessage = <any> error);
}
// getStateCityList(){
// this._pd.getStateCityDetails().subscribe(
// data => {
// if (data.status == 200) {
// this.stateList=data.records
// }
// }, error => this.errorMessage = <any> error);
// }
getStateCityList(){
this._pd.getStateCityDetails().subscribe(
this._pd.getAllMasterDatas('STATE').subscribe(
data => {
if (data.status == 200) {
this.stateList=data.records
this.stateList = data.records.filter(item => item.isactive == 1);
}
}, error => this.errorMessage = <any> error);
});
}
getPDTypeList(){
this._pd.getPDTypeDetails().subscribe(
@ -160,10 +169,25 @@ export class AddPdComponent implements OnInit, OnDestroy {
this.subProductList=this.subProductList[0].subproducts;
}
// get city list details based on state id
// getCityList(stateID:string){
// console.log(this.cityList);
// this.cityList= this.stateList.filter(item => item.state_id == stateID);
// console.log(this.cityList);
// this.cityList=this.cityList[0].cities;
// console.log(this.cityList);
// }
//get city list details based on state id
getCityList(stateID:string){
this.cityList= this.stateList.filter(item => item.state_id == stateID);
this.cityList=this.cityList[0].cities;
console.log('getCityList',stateID);
this._pd.getStateWiseCities(stateID).subscribe(data=>{
if (data.status == 200) {
console.log(data);
this.cityList = data.records.cities;
this.pincodeList = data.records.pincode;
}
});
}
// get relation master details

View File

@ -131,8 +131,12 @@
<mat-form-field style="width: 24%;">
<input matInput placeholder="Pincode" formControlName="pincode" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.pincode.hasError('pattern') || pdMain.pincode.hasError('maxlength') || pdMain.pincode.hasError('minlength')">Enter Valid Pincode. </mat-error>
<!-- <input matInput placeholder="Pincode" formControlName="pincode" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.pincode.hasError('pattern') || pdMain.pincode.hasError('maxlength') || pdMain.pincode.hasError('minlength')">Enter Valid Pincode. </mat-error> -->
<mat-select placeholder="Pincode" formControlName="pincode" >
<mat-option>Select</mat-option>
<mat-option *ngFor="let PL of pincodeList" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
</mat-select>
</mat-form-field>
</mat-card-content>

View File

@ -21,6 +21,7 @@ export class EditPdMasterComponent implements OnInit {
cityList:any;
pdTypeList:any;
billingList:any;
pincodeList: any = [];
applicantLength:number;
// draftStatus: string;
// PDTriggerStatus: string;
@ -89,18 +90,27 @@ export class EditPdMasterComponent implements OnInit {
}
}, error => this.errorMessage = <any> error);
}
// getStateCityList(){
// this._pd.getStateCityDetails().subscribe(
// data => {
// if (data.status == 200) {
// this.stateList=data.records
// if(this.data.records.fk_state){
// this.getCityList(this.data.records.fk_state);
// }
// }
// }, error => this.errorMessage = <any> error);
// }
getStateCityList(){
this._pd.getStateCityDetails().subscribe(
this._pd.getAllMasterDatas('STATE').subscribe(
data => {
if (data.status == 200) {
this.stateList=data.records
if(this.data.records.fk_state){
this.getCityList(this.data.records.fk_state);
this.stateList = data.records.filter(item => item.isactive == 1);
}
});
}
}
}, error => this.errorMessage = <any> error);
}
getPDTypeList(){
this._pd.getPDTypeDetails().subscribe(
data => {
@ -126,6 +136,9 @@ export class EditPdMasterComponent implements OnInit {
landline = null;
}
}
this.getCityList(this.data.records.fk_state);
this._EditPDtriggerForm = this._fb.group({
pd_id: [this.data.records.pd_id],
fk_lender_id: [this.data.records.fk_lender_id, Validators.compose([Validators.required])],
@ -142,7 +155,7 @@ export class EditPdMasterComponent implements OnInit {
  addressline1: [this.data.records.addressline1],
fk_city: [this.data.records.fk_city],
fk_state: [this.data.records.fk_state],
  pincode : [this.data.records.pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])],
  pincode : [this.data.records.pincode],/** Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])], */
remarks: [this.data.records.remarks],
});
}
@ -156,11 +169,23 @@ export class EditPdMasterComponent implements OnInit {
this.subProductList=this.subProductList[0].subproducts;
}
// //get city list details based on state id
// getCityList(stateID:string){
// this.cityList= this.stateList.filter(item => item.state_id == stateID);
// this.cityList=this.cityList[0].cities;
// }
//get city list details based on state id
getCityList(stateID:string){
this.cityList= this.stateList.filter(item => item.state_id == stateID);
this.cityList=this.cityList[0].cities;
console.log('getCityList',stateID);
this._pd.getStateWiseCities(stateID).subscribe(data=>{
if (data.status == 200) {
console.log(data);
this.cityList = data.records.cities;
this.pincodeList = data.records.pincode;
}
});
}
// save pd in draft
saveDraftPD(formValue: any, status:string){

View File

@ -281,17 +281,18 @@
<div>
<mat-form-field>
<mat-select placeholder="Select a person" formControlName="selected_person" required>
<!-- <mat-select placeholder="Select a person" formControlName="selected_person" required>
<mat-option value="{{person.pd_co_applicant_id}}" *ngFor="let person of selectPerson">
{{person.applicant_name}}
</mat-option>
</mat-select>
</mat-select> -->
<input matInput placeholder="person" formControlName="selected_person" required>
</mat-form-field>
</div>
<div>
<h5>Residence Details</h5>
<mat-form-field>
<mat-select matInput placeholder="State" formControlName="residence_state" required (selectionChange)="getCity($event.value)" >
<mat-select matInput placeholder="State" formControlName="residence_state" required (selectionChange)="getCity($event.value,ix)" >
<mat-option value="{{s.state_id}}" *ngFor="let s of stateData">
{{s.name}}
</mat-option>
@ -299,7 +300,7 @@
</mat-form-field>
<mat-form-field>
<mat-select matInput placeholder="City" formControlName="residence_city" required>
<mat-option *ngFor="let c of cityData" [value]="c.city_id" >
<mat-option *ngFor="let c of cityData[ix]" [value]="c.city_id" >
{{c.city_name}}
</mat-option>
</mat-select>

View File

@ -511,8 +511,9 @@ export class FamilyDetailsComponent implements OnInit {
const control = <FormArray>this.familyForm.controls['family_details'];
control.push(formData);
} else {
for (let val of records) {
this.getCity(val.residence_state);
records.forEach((val,index) => {
//for (let val of records)
this.getCity(val.residence_state,index);
let formData: FormGroup = this.fb.group({
selected_person: [val.selected_person, Validators.compose([Validators.required])],
residence_place: [val.residence_place, Validators.compose([])],
@ -528,11 +529,10 @@ export class FamilyDetailsComponent implements OnInit {
});
const control = <FormArray>this.familyForm.controls['family_details'];
control.push(formData);
// this.getCity(val.residence_state);
let inx = control.length - 1;
this.addFamilyMemberDetailsWithData(inx, val.family_members_details);
console.log(control);
}
});
}
this.noRecordsFound = true;
@ -641,14 +641,14 @@ export class FamilyDetailsComponent implements OnInit {
});
}
getCity(e){
getCity(e,i){
console.log(e);
// this.cityData = this.wholeCityData.filter(city=>city.fk_state_id == e);
// this._pd.retriveForm(params).subscribe(data => {
this._pd.getStateWiseCities(e).subscribe(data=>{
if (data.status == 200) {
console.log(data.status);
this.cityData = data.records.cities;
this.cityData[i] = data.records.cities;
console.log(this.cityData);
}
});

View File

@ -477,7 +477,10 @@ export class PdTrigerService {
)
}
/** To get StateWise City Data For Family Form */
/** To get StateWise City List For
* 1) Family Form
* 2) add PD
*/
getStateWiseCities(stateid:any): Observable<any> {
return this._http.post<any>(this.apiUrl + "getListOfStatesAndCities", { "records":{ "state_id" : stateid}})
.pipe(