Address form changes: ps
This commit is contained in:
parent
b326be9b4d
commit
a15ba89ac2
@ -4,20 +4,25 @@
|
||||
<p>PD Address Details</p>
|
||||
<form class="address" [formGroup]="addressForm">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Address" formControlName="address">
|
||||
<input matInput placeholder="Address" formControlName="address" required>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Address Type" formControlName="address_type">
|
||||
<mat-select placeholder="Address Type" formControlName="address_type" required>
|
||||
<mat-option value="{{m_addressType.address_type_id}}"
|
||||
*ngFor="let m_addressType of addressData">{{m_addressType.address_type}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
<mat-form-field *ngIf="addressForm.controls['address_type'].value == 12">
|
||||
<input matInput placeholder="Address Type Others" formControlName="address_type_others">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
|
||||
<mat-select placeholder="Locality" formControlName="locality">
|
||||
<mat-select placeholder="Locality" formControlName="locality" required>
|
||||
<mat-option value="{{m_locality.locality_id}}"
|
||||
*ngFor="let m_locality of localityData">{{m_locality.locality_name}}
|
||||
</mat-option>
|
||||
@ -28,14 +33,14 @@
|
||||
formControlName="locality_others">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Approach to PD Location" formControlName="pd_location">
|
||||
<mat-select placeholder="Approach to PD Location" formControlName="pd_location" required>
|
||||
<mat-option value="{{data.pd_location_approach_id}}"
|
||||
*ngFor="let data of locationdata">{{data.description}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Comment on Locality" formControlName="comment_locality">
|
||||
<mat-select placeholder="Comment on Locality" formControlName="comment_locality" required>
|
||||
<mat-option value="{{data.comments_on_locality_id}}"
|
||||
*ngFor="let data of commentData">{{data.rating}}
|
||||
</mat-option>
|
||||
@ -43,12 +48,41 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Customer Behaviour"
|
||||
formControlName="customer_behaviour">
|
||||
formControlName="customer_behaviour" required>
|
||||
<mat-option value="{{data.customer_behaviour_id}}"
|
||||
*ngFor="let data of customerData">{{data.description}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Ownership" formControlName="address_ownership">
|
||||
<mat-option value="{{ownerShip.id}}"
|
||||
*ngFor="let ownerShip of ownerShipData">
|
||||
{{ownerShip.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Is there any business activity is being run?"
|
||||
formControlName="bussiness_activity" required>
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="addressForm.controls['bussiness_activity'].value == 'yes'">
|
||||
<mat-select placeholder="Bussiness Type" formControlName="bussiness_address_type">
|
||||
<mat-option value="{{m_addressType.address_type_id}}"
|
||||
*ngFor="let m_addressType of addressData">{{m_addressType.address_type}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="addressForm.controls['bussiness_address_type'].value == 12">
|
||||
<input matInput placeholder="Bussiness Address Type Others" formControlName="bussiness_address_type_others">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<p>Neighbourhood</p>
|
||||
@ -56,31 +90,48 @@
|
||||
<div formArrayName="neighbourhood">
|
||||
<div *ngFor="let item of addressForm.controls.neighbourhood['controls']; let i=index" >
|
||||
<mat-card-content class="matcard" [formGroup]="item">
|
||||
<div>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Neighbour Name"
|
||||
formControlName="name">
|
||||
formControlName="name" required>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Do you know"
|
||||
formControlName="do_you_know">
|
||||
formControlName="do_you_know" required>
|
||||
<mat-option value="{{m_neighbourStatus}}"
|
||||
*ngFor="let m_neighbourStatus of neighbourStatusData">{{m_neighbourStatus}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
|
||||
<mat-select placeholder="Is the applicant owner"
|
||||
formControlName="is_owner" required>
|
||||
|
||||
<mat-option value="{{m_applicantOwner}}"
|
||||
*ngFor="let m_applicantOwner of applicantOwnerData">{{m_applicantOwner}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<!-- <mat-form-field>
|
||||
<input matInput placeholder="How long do you know the applicant"
|
||||
formControlName="how_long">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Is the applicant owner"
|
||||
formControlName="is_owner">
|
||||
|
||||
<mat-option value="{{m_applicantOwner}}"
|
||||
*ngFor="let m_applicantOwner of applicantOwnerData">{{m_applicantOwner}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</mat-form-field> -->
|
||||
<div>
|
||||
<label>How long do you know the applicant?</label>
|
||||
<br>
|
||||
<mat-form-field>
|
||||
<input matInput type="number" placeholder="Year" formControlName="how_long_year" required min='0'>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput type="number" placeholder="Month" formControlName="how_long_month" required min='0' max='12'>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
|
||||
<button type="button" matTooltip="Add More Neighbour Details" class="mr-1 mb-1 hover-icon" matTooltipPosition="above" mat-raised-button mat-icon-button *ngIf="i==0"
|
||||
(click)="addNeighbour($event)"
|
||||
color="primary" style="float: right;">
|
||||
|
||||
@ -36,6 +36,8 @@ export class AddressComponent implements OnInit {
|
||||
customerData: any = [];
|
||||
addressData:any = [];
|
||||
localityData:any = [];
|
||||
ownerShipData:any = [];
|
||||
|
||||
neighbourStatusData:any=["Yes","No"];
|
||||
applicantOwnerData:any=["Yes","No","Dont Know"];
|
||||
|
||||
@ -49,8 +51,10 @@ export class AddressComponent implements OnInit {
|
||||
public pdLocation: AbstractControl;
|
||||
public commentlocality: AbstractControl;
|
||||
public customerBehaviour: AbstractControl;
|
||||
|
||||
|
||||
|
||||
public ownership: AbstractControl;
|
||||
public bussinessActivity: AbstractControl;
|
||||
|
||||
constructor(private el: ElementRef, notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private _pd: PdTrigerService) {
|
||||
@ -58,11 +62,13 @@ export class AddressComponent implements OnInit {
|
||||
|
||||
}
|
||||
ngOnInit() {
|
||||
console.clear();
|
||||
this.getMasterDetails('PDLOCATIONAPPROACH',1);
|
||||
this.getMasterDetails('COMMENTSONLOCALITY',2);
|
||||
this.getMasterDetails('CUSTOMERBEHAVIOUR',3);
|
||||
this.getMasterDetails('LOCALITY',4);
|
||||
this.getMasterDetails('ADDRESSTYPE',5);
|
||||
this.getMasterDetails('RESIDENCEOWNERSHIP',6);
|
||||
this.initAddressForm();
|
||||
let params: any = {};
|
||||
params.pd_id = this.pdid;
|
||||
@ -77,10 +83,21 @@ export class AddressComponent implements OnInit {
|
||||
this.addressForm.controls.address.setValue(data.records.address);
|
||||
this.addressForm.controls.pd_location.setValue(data.records.pd_location);
|
||||
this.addressForm.controls.address_type.setValue(data.records.address_type);
|
||||
if(data.records.address_type == 12) {
|
||||
this.addressForm.controls.address_type_others.setValue(data.records.address_type_others);
|
||||
}
|
||||
this.addressForm.controls.comment_locality.setValue(data.records.comment_locality);
|
||||
this.addressForm.controls.customer_behaviour.setValue(data.records.customer_behaviour);
|
||||
this.addressForm.controls.locality.setValue(data.records.locality);
|
||||
this.addressForm.controls.address_form_remark.setValue(data.records.address_form_remark);
|
||||
this.addressForm.controls.address_ownership.setValue(data.records.address_ownership);
|
||||
this.addressForm.controls.bussiness_activity.setValue(data.records.bussiness_activity);
|
||||
if(data.records.bussiness_activity == 'yes') {
|
||||
this.addressForm.controls.bussiness_address_type.setValue(data.records.bussiness_address_type);
|
||||
if(data.records.bussiness_address_type == 12) {
|
||||
this.addressForm.controls.bussiness_address_type_others.setValue(data.records.bussiness_address_type_others);
|
||||
}
|
||||
}
|
||||
if (data.records.locality_others) {
|
||||
this.addressForm.controls.locality_others.setValue(data.records.locality_others);
|
||||
}
|
||||
@ -101,13 +118,18 @@ export class AddressComponent implements OnInit {
|
||||
this.addressForm = this.fb.group({
|
||||
address: ['', Validators.compose([Validators.required])],
|
||||
address_type: ['', Validators.compose([Validators.required])],
|
||||
address_type_others: [''],
|
||||
locality: ['', Validators.compose([Validators.required])],
|
||||
locality_others: [''],
|
||||
pd_location: ['', Validators.compose([Validators.required])],
|
||||
comment_locality: ['', Validators.compose([Validators.required])],
|
||||
customer_behaviour: ['', Validators.compose([Validators.required])],
|
||||
neighbourhood: this.fb.array([]),
|
||||
address_form_remark:['']
|
||||
address_form_remark:[''],
|
||||
address_ownership:[''],
|
||||
bussiness_activity:[''],
|
||||
bussiness_address_type:[''],
|
||||
bussiness_address_type_others: ['']
|
||||
});
|
||||
this.address = this.addressForm.controls['address'];
|
||||
this.addressType = this.addressForm.controls['address_type'];
|
||||
@ -115,12 +137,16 @@ export class AddressComponent implements OnInit {
|
||||
this.pdLocation = this.addressForm.controls['pd_location'];
|
||||
this.commentlocality = this.addressForm.controls['comment_locality'];
|
||||
this.customerBehaviour = this.addressForm.controls['customer_behaviour'];
|
||||
this.ownership = this.addressForm.controls['address_ownership'];
|
||||
this.bussinessActivity = this.addressForm.controls['bussiness_activity'];
|
||||
// this.bussiessAddressType = this.addressForm.controls['bussiness_address_type'];
|
||||
}
|
||||
createNeighbour(): FormGroup {
|
||||
return this.fb.group({
|
||||
name: ['', Validators.compose([Validators.required])],
|
||||
do_you_know: ['', Validators.compose([Validators.required])],
|
||||
how_long: ['', Validators.compose([Validators.required])],
|
||||
how_long_year: ['', Validators.compose([Validators.required])],
|
||||
how_long_month: ['', Validators.compose([Validators.required])],
|
||||
is_owner: ['', Validators.compose([Validators.required])],
|
||||
});
|
||||
}
|
||||
@ -142,6 +168,9 @@ export class AddressComponent implements OnInit {
|
||||
else if(type==5 && val.isactive == 1){
|
||||
this.addressData.push(val);
|
||||
}
|
||||
else if(type==6 && val.isactive == 1){
|
||||
this.ownerShipData.push(val);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
@ -163,6 +192,9 @@ export class AddressComponent implements OnInit {
|
||||
let records: any = {};
|
||||
records.address = this.address.value;
|
||||
records.address_type = this.addressType.value;
|
||||
if (this.addressType.value == 12) {
|
||||
records.address_type_others = this.addressForm.controls.address_type_others.value;
|
||||
}
|
||||
records.locality = this.locality.value;
|
||||
if (this.locality.value == 'Others') {
|
||||
records.locality_others = this.addressForm.controls.locality_others.value;
|
||||
@ -172,6 +204,14 @@ export class AddressComponent implements OnInit {
|
||||
records.customer_behaviour = this.commentlocality.value;
|
||||
records.neighbourhood = this.addressForm.controls.neighbourhood.value;
|
||||
records.address_form_remark = this.addressForm.controls.address_form_remark.value;
|
||||
records.address_ownership = this.ownership.value;
|
||||
records.bussiness_activity = this.bussinessActivity.value;
|
||||
if (this.bussinessActivity.value == 'yes') {
|
||||
records.bussiness_address_type = this.addressForm.controls.bussiness_address_type.value;
|
||||
if (records.bussiness_address_type == 12) {
|
||||
records.bussiness_address_type_others = this.addressForm.controls.bussiness_address_type_others.value;
|
||||
}
|
||||
}
|
||||
records.pdid = this.pdid;
|
||||
records.formid = '5';
|
||||
// records.fk_createdby = '250';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user