address form master details changes

This commit is contained in:
gandhimathi 2018-11-14 18:42:40 +05:30
parent beb7d389ff
commit bd92cb8f43
3 changed files with 38 additions and 49 deletions

View File

@ -9,27 +9,18 @@
<mat-form-field> <mat-form-field>
<mat-select placeholder="Address Type" formControlName="address_type"> <mat-select placeholder="Address Type" formControlName="address_type">
<mat-option value="Office">Office</mat-option> <mat-option value="{{m_addressType.address_type_id}}"
<mat-option value="Clinic">Clinic</mat-option> *ngFor="let m_addressType of addressData">{{m_addressType.address_type}}
<mat-option value="Factory">Factory</mat-option> </mat-option>
<mat-option value="Warehouse">Warehouse</mat-option>
<mat-option value="Shop">Shop</mat-option>
<mat-option value="ResidencecumOffice">Residence cum Office</mat-option>
<mat-option value="Residence">Residence</mat-option>
<mat-option value="Other">Other (PD officer to fill)</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="Locality" formControlName="locality"> <mat-select placeholder="Locality" formControlName="locality">
<mat-option value="CommercialOffice">Commercial (Office type) Area <mat-option value="{{m_locality.locality_id}}"
</mat-option> *ngFor="let m_locality of localityData">{{m_locality.locality_name}}
<mat-option value="CommercialShop">Commercial (shop type) Area</mat-option> </mat-option>
<mat-option value="Industrial">Industrial Area</mat-option>
<mat-option value="Residential">Residential Area</mat-option>
<mat-option value="Mix">Mix use (Comment mandatory)</mat-option>
<mat-option value="Rural">Rural (Village) area</mat-option>
<mat-option value="Others">Others (Please specify)</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field *ngIf="addressForm.controls.locality.value == 'Others'"> <mat-form-field *ngIf="addressForm.controls.locality.value == 'Others'">
@ -74,6 +65,9 @@
formControlName="do_you_know"> formControlName="do_you_know">
<mat-option value="yes">Yes</mat-option> <mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="no">No</mat-option>
<mat-option value="{{m_neighbourStatus}}"
*ngFor="let m_neighbourStatus of neighbourStatusData">{{m_neighbourStatus}}
</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
@ -83,9 +77,10 @@
<mat-form-field> <mat-form-field>
<mat-select placeholder="Is the applicant owner" <mat-select placeholder="Is the applicant owner"
formControlName="is_owner"> formControlName="is_owner">
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option> <mat-option value="{{m_applicantOwner}}"
<mat-option value="dont_know">Dont Know</mat-option> *ngFor="let m_applicantOwner of applicantOwnerData">{{m_applicantOwner}}
</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<button type="button" matTooltip="Add More Neighbour Details" matTooltipPosition="above" mat-raised-button mat-icon-button *ngIf="i==0" <button type="button" matTooltip="Add More Neighbour Details" matTooltipPosition="above" mat-raised-button mat-icon-button *ngIf="i==0"

View File

@ -34,6 +34,11 @@ export class AddressComponent implements OnInit {
locationdata: any = []; locationdata: any = [];
commentData: any = []; commentData: any = [];
customerData: any = []; customerData: any = [];
addressData:any = [];
localityData:any = [];
neighbourStatusData:any=["Yes","No"];
applicantOwnerData:any=["Yes","No","Dont Know"];
public currentLoanForm: FormGroup; public currentLoanForm: FormGroup;
private notifier: NotifierService; private notifier: NotifierService;
public addressForm: FormGroup; public addressForm: FormGroup;
@ -53,9 +58,11 @@ export class AddressComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.getLocation(); this.getMasterDetails('PDLOCATIONAPPROACH',1);
this.getComment(); this.getMasterDetails('COMMENTSONLOCALITY',2);
this.getCustomer(); this.getMasterDetails('CUSTOMERBEHAVIOUR',3);
this.getMasterDetails('LOCALITY',4);
this.getMasterDetails('ADDRESSTYPE',5);
this.initAddressForm(); this.initAddressForm();
let params: any = {}; let params: any = {};
params.pd_id = this.pdid; params.pd_id = this.pdid;
@ -85,7 +92,6 @@ export class AddressComponent implements OnInit {
}); });
this.addressForm.controls.neighbourhood.setValue(result); this.addressForm.controls.neighbourhood.setValue(result);
} }
console.log('result', result);
} else { } else {
control.push(this.createNeighbour()); control.push(this.createNeighbour());
} }
@ -118,36 +124,24 @@ export class AddressComponent implements OnInit {
is_owner: ['', Validators.compose([Validators.required])], is_owner: ['', Validators.compose([Validators.required])],
}); });
} }
getLocation() { getMasterDetails(table:string,type:number){
let master_name = 'PDLOCATIONAPPROACH'; this._pd.getAllMasterDatas(table).subscribe(data => {
this._pd.getAllMasterDatas(master_name).subscribe(data => {
console.log('data', data);
data.records.forEach(val => { data.records.forEach(val => {
if (val.isactive == 1) { if (type==1 && val.isactive == 1) {
this.locationdata.push(val); this.locationdata.push(val);
} }
}) else if(type==2 && val.isactive == 1){
});
}
getComment() {
let master_name = 'COMMENTSONLOCALITY';
this._pd.getAllMasterDatas(master_name).subscribe(data => {
console.log('data', data);
data.records.forEach(val => {
if (val.isactive == 1) {
this.commentData.push(val); this.commentData.push(val);
} }
}) else if(type==3 && val.isactive == 1){
});
}
getCustomer() {
let master_name = 'CUSTOMERBEHAVIOUR';
this._pd.getAllMasterDatas(master_name).subscribe(data => {
console.log('data', data);
data.records.forEach(val => {
if (val.isactive == 1) {
this.customerData.push(val); this.customerData.push(val);
} }
else if(type==4 && val.isactive == 1){
this.localityData.push(val);
}
else if(type==5 && val.isactive == 1){
this.addressData.push(val);
}
}) })
}); });
} }

View File

@ -205,13 +205,13 @@ this.loadDataStatus = true;
data => { data => {
if (data.status == 200) { if (data.status == 200) {
if(type==1){ if(type==1){
this.relationShipList=data.records; this.relationShipList=data.records.filter(item => item.isactive == 1);
} }
else if(type==2){ else if(type==2){
this.earningStatus=data.records; this.earningStatus=data.records.filter(item => item.isactive == 1);
} }
else if(type==3){ else if(type==3){
this.qualifications=data.records; this.qualifications=data.records.filter(item => item.isactive == 1);
} }