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 Select
</mat-option> </mat-option>
<mat-option *ngFor="let SL of stateList" [value]="SL.state_id"> <mat-option *ngFor="let SL of stateList" [value]="SL.state_id">
{{SL.state_name}} {{SL.name}}
</mat-option> </mat-option>
@ -168,9 +168,13 @@
<mat-form-field style="width: 24%"> <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('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> </mat-form-field>

View File

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

View File

@ -131,8 +131,12 @@
<mat-form-field style="width: 24%;"> <mat-form-field style="width: 24%;">
<input matInput placeholder="Pincode" formControlName="pincode" (keypress)="keyPress($event)"> <!-- <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-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-form-field>
</mat-card-content> </mat-card-content>

View File

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

View File

@ -281,17 +281,18 @@
<div> <div>
<mat-form-field> <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"> <mat-option value="{{person.pd_co_applicant_id}}" *ngFor="let person of selectPerson">
{{person.applicant_name}} {{person.applicant_name}}
</mat-option> </mat-option>
</mat-select> </mat-select> -->
<input matInput placeholder="person" formControlName="selected_person" required>
</mat-form-field> </mat-form-field>
</div> </div>
<div> <div>
<h5>Residence Details</h5> <h5>Residence Details</h5>
<mat-form-field> <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"> <mat-option value="{{s.state_id}}" *ngFor="let s of stateData">
{{s.name}} {{s.name}}
</mat-option> </mat-option>
@ -299,7 +300,7 @@
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select matInput placeholder="City" formControlName="residence_city" required> <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}} {{c.city_name}}
</mat-option> </mat-option>
</mat-select> </mat-select>

View File

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