address : ps

This commit is contained in:
venbatechnologies@gmail.com 2019-01-12 17:54:29 +05:30
parent 1c89d95778
commit 31966f9c45
4 changed files with 109 additions and 70 deletions

View File

@ -89,7 +89,7 @@
</mat-form-field>
</div>
<div fxFlex="33">
<!-- <div fxFlex="33">
<mat-form-field style="width: 80%;">
<mat-select placeholder="Ownership" formControlName="address_ownership">
<mat-option value="{{ownerShip.id}}"
@ -112,7 +112,7 @@
<mat-hint align="start" style="font-size:70%" *ngIf="addressForm.controls['rent_amt'].value != ''">{{"&#8377;"}} {{rentAmtInwords}} Only</mat-hint>
</mat-form-field>
</div>
</div> -->
</div>
<div fxLayout="row wrap">
@ -147,11 +147,11 @@
<div fxLayout="row wrap">
<div fxFlex="100">
<mat-form-field style="width: 95%;">
<!--placeholder="Was any business activity seen at the (Address Type) seen during PD visit?"-->
<!--placeholder="Was any business activity seen at the (Address Type) seen during PD visit?"-->
<mat-select placeholder="Are there any other premises from which 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-select>
</mat-form-field>
</div>
</div>
@ -196,22 +196,22 @@
</mat-form-field>
<mat-form-field style="width: 40%;">
<!-- <mat-form-field style="width: 40%;">
<mat-select placeholder="Ownership" formControlName="premises_ownership">
<mat-option value="{{ownerShip.id}}" *ngFor="let ownerShip of ownerShipData">
{{ownerShip.name}}
</mat-option>
</mat-select>
</mat-form-field>
</mat-form-field> -->
<!-- <mat-form-field *ngIf="addressForm.controls['premises_ownership'].value == 4 "> -->
<mat-form-field *ngIf="item.get('premises_ownership').value == 4" style="width: 40%;">
<input matInput placeholder="Specify Ownership" formControlName="premises_ownership_others" autocomplete="off">
</mat-form-field>
<mat-form-field *ngIf="item.get('premises_ownership').value == 3" style="width: 40%;">
<input matInput placeholder="What is the monthly rent paid?" formControlName="premises_rent_amt" autocomplete="off" (keypress)="keyPress($event)" (keyup)="inWords($event,i)">
<mat-hint align="start" style="font-size:70%" *ngIf="item.get('premises_rent_amt').value != ''">{{"&#8377;"}} {{premisesRentAmtInwords[i]}} Only</mat-hint>
</mat-form-field>
<!-- <mat-form-field *ngIf="item.get('premises_ownership').value == 4" style="width: 40%;">
<input matInput placeholder="Specify Ownership" formControlName="premises_ownership_others" autocomplete="off">
</mat-form-field>
<mat-form-field *ngIf="item.get('premises_ownership').value == 3" style="width: 40%;">
<input matInput placeholder="What is the monthly rent paid?" formControlName="premises_rent_amt" autocomplete="off" (keypress)="keyPress($event)" (keyup)="inWords($event,i)">
<mat-hint align="start" style="font-size:70%" *ngIf="item.get('premises_rent_amt').value != ''">{{"&#8377;"}} {{premisesRentAmtInwords[i]}} Only</mat-hint>
</mat-form-field> -->
<mat-form-field style="width: 40%">
<input matInput placeholder="Remarks"
formControlName="premises_remarks" style="width: 65%;" autocomplete="off">

View File

@ -37,7 +37,7 @@ export class AddressComponent implements OnInit {
pdid : number;
form_id: number;
pdAddress: string;
CustSegAbbr: any;
loadDataStatus: boolean=true;
PremisesOtherFlag:boolean;
@ -57,8 +57,8 @@ export class AddressComponent implements OnInit {
formPremisesCityArray: any = [];
additional_premises: any=[];
bussiness_address_type: any=[];
premisesRentAmtInwords:any=[];
rentAmtInwords:any;
// premisesRentAmtInwords:any=[];
// rentAmtInwords:any;
tempArr: any[];
placeholderName : any = 'Was any business activity seen at the Address Type during PD visit?';
//neighbourStatusData:any=["Yes","No"];
@ -73,10 +73,10 @@ export class AddressComponent implements OnInit {
public pdLocation: AbstractControl;
public commentlocality: AbstractControl;
public other_comment_locality: AbstractControl;
public customerBehaviour: AbstractControl;
public ownership: AbstractControl;
public other_ownership: AbstractControl;
public rent_amt : AbstractControl;
// public customerBehaviour: AbstractControl;
// public ownership: AbstractControl;
// public other_ownership: AbstractControl;
// public rent_amt : AbstractControl;
public other_premises_bussiness_activity : AbstractControl;
public bussiness_activity_remark: AbstractControl;
public bussinessActivity: AbstractControl;
@ -91,8 +91,15 @@ export class AddressComponent implements OnInit {
private dialogRef: MatDialogRef<AddressComponent>,
@Inject(MAT_DIALOG_DATA) public pd_all_details: any)
{
console.log(this.pd_all_details);
this.pdid = this.pd_all_details.pdmaster_details.pd_id;
this.form_id = 5;
// console.log(this.pd_all_details.template_forms.form_id);
// console.log(this.pd_all_details.pdmaster_details.customer_segment_abbr);
let CSAbbrSearch = this.pd_all_details.pdmaster_details.customer_segment_abbr.search("-");
this.CustSegAbbr = this.pd_all_details.pdmaster_details.customer_segment_abbr.substr(0,CSAbbrSearch);
this.notifier = notifier;
this.pdAddress = this.pd_all_details.pdmaster_details.addressline1;
}
@ -143,12 +150,12 @@ export class AddressComponent implements OnInit {
this.addressForm.controls.locality_others.setValue(data.records.locality_others);
}
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.other_ownership.setValue(data.records.other_ownership);
this.addressForm.controls.rent_amt.setValue(data.records.rent_amt);
if(data.records.address_ownership == 3){
this.rentAmtInwords = this._pd.convertNumberToWords(data.records.rent_amt);
}
// this.addressForm.controls.address_ownership.setValue(data.records.address_ownership);
// this.addressForm.controls.other_ownership.setValue(data.records.other_ownership);
// this.addressForm.controls.rent_amt.setValue(data.records.rent_amt);
// if(data.records.address_ownership == 3){
// this.rentAmtInwords = this._pd.convertNumberToWords(data.records.rent_amt);
// }
this.addressForm.controls.other_premises_bussiness_activity.setValue(data.records.other_premises_bussiness_activity);
if(data.records.other_premises_bussiness_activity != '' && data.records.other_premises_bussiness_activity !=null) {
this.addressForm.controls.bussiness_activity_remark.setValue(data.records.other_premises_bussiness_activity);
@ -173,7 +180,7 @@ export class AddressComponent implements OnInit {
control.push(this.createUnits());
} else {
resultOfUnits.forEach((datas,index) => {
this.premisesRentAmtInwords[index] = this._pd.convertNumberToWords(datas.premises_rent_amt);
// this.premisesRentAmtInwords[index] = this._pd.convertNumberToWords(datas.premises_rent_amt);
control.push(this.createUnits());
});
this.addressForm.controls.additional_address_units.setValue(resultOfUnits);
@ -205,9 +212,9 @@ export class AddressComponent implements OnInit {
//neighbourhood: this.fb.array([]),
additional_address_units: this.fb.array([]),
address_form_remark:[''],
address_ownership:[''],
other_ownership:[''],
rent_amt:[''],
// address_ownership:[''],
// other_ownership:[''],
// rent_amt:[''],
other_premises_bussiness_activity : [''],
bussiness_activity_remark:[''],
bussiness_activity:[''],
@ -224,9 +231,9 @@ export class AddressComponent implements OnInit {
this.commentlocality = this.addressForm.controls['comment_locality'];
this.other_comment_locality = this.addressForm.controls['other_comment_locality'];
//this.customerBehaviour = this.addressForm.controls['customer_behaviour'];
this.ownership = this.addressForm.controls['address_ownership'];
this.other_ownership = this.addressForm.controls['other_ownership'];
this.rent_amt = this.addressForm.controls['rent_amt'];
// this.ownership = this.addressForm.controls['address_ownership'];
// this.other_ownership = this.addressForm.controls['other_ownership'];
// this.rent_amt = this.addressForm.controls['rent_amt'];
this.other_premises_bussiness_activity = this.addressForm.controls['other_premises_bussiness_activity'],
this.bussiness_activity_remark = this.addressForm.controls['bussiness_activity_remark'],
this.bussinessActivity = this.addressForm.controls['bussiness_activity'];
@ -249,9 +256,9 @@ export class AddressComponent implements OnInit {
premises_type: [''],
premises_type_others: [''],
premises_city: [''],
premises_ownership: [''],
premises_ownership_others: [''],
premises_rent_amt:[''],
// premises_ownership: [''],
// premises_ownership_others: [''],
// premises_rent_amt:[''],
premises_remarks: [''],
});
}
@ -281,6 +288,9 @@ export class AddressComponent implements OnInit {
this.localityData.push(val);
}
else if(type==5 && val.isactive == 1){
if(this.CustSegAbbr == 'SENP' || this.CustSegAbbr == 'SEP'){
val.filter(at => at.address_type != 'Residence' && at.address_type != 'Residence cum Office');
}
this.addressData.push(val);
}
else if(type==6 && val.isactive == 1){
@ -336,9 +346,14 @@ export class AddressComponent implements OnInit {
onSubmit() {
if (!this.addressForm.valid) {
return;
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
return;
}
if(this.address.value.other_premises_bussiness_activity != ''){
if(this.address.value.bussiness_activity_remark != ''){
this.notifier.notify('warning', 'Fill Remark!');
return;
}}
let records: any = {};
records.address = this.address.value;
@ -357,9 +372,9 @@ export class AddressComponent implements OnInit {
//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.other_ownership = this.other_ownership.value;
records.rent_amt = this.rent_amt.value;
// records.address_ownership = this.ownership.value;
// records.other_ownership = this.other_ownership.value;
// records.rent_amt = this.rent_amt.value;
records.other_premises_bussiness_activity = this.other_premises_bussiness_activity.value;
records.bussiness_activity_remark = this.bussiness_activity_remark.value;
records.bussiness_activity = this.bussinessActivity.value;
@ -377,10 +392,14 @@ export class AddressComponent implements OnInit {
// console.log(JSON.stringify(records));
this._pd.saveForm(records).subscribe(data => {
this.notifier.notify('success', 'Saved Successfully.');
this.dialogRef.close();
}, error => {
if(data.status == 200) {
this.notifier.notify('success', 'Saved Successfully.');
this.dialogRef.close();
}
else {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}
}, error => {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
});
}
@ -422,11 +441,11 @@ export class AddressComponent implements OnInit {
}
}
inWords(e,i){
this.premisesRentAmtInwords[i] = this._pd.convertNumberToWords(e.target.value);
}
// inWords(e,i){
// this.premisesRentAmtInwords[i] = this._pd.convertNumberToWords(e.target.value);
// }
inWordsForRent(e){
this.rentAmtInwords = this._pd.convertNumberToWords(e.target.value);
}
// inWordsForRent(e){
// this.rentAmtInwords = this._pd.convertNumberToWords(e.target.value);
// }
}

View File

@ -26,7 +26,7 @@
</div>
</mat-card-header>
<mat-card-content formArrayName="neighbourhood_list" *ngIf="_neighbourhoodForm.controls.check_type.value==0">
<mat-card-content *ngFor="let neighbourhood of _neighbourhoodForm.controls.neighbourhood_list['controls']; let n = index;" [formGroupName]="n">
<mat-card-content *ngFor="let neighbourhood of _neighbourhoodForm.controls.neighbourhood_list['controls']; let n = index;" [formGroupName]="n">
<mat-form-field style="width: 42%">
<input matInput autocomplete="off" placeholder="Neighbour Name" formControlName="neighbourhood_name" type="text">
</mat-form-field>
@ -37,9 +37,21 @@
</mat-select>
</mat-form-field>
<mat-form-field style="width: 42%" *ngIf="neighbourhood.controls.do_know.value=='Yes'">
<input matInput autocomplete="off" placeholder="How Long to Know the Applicant " formControlName="how_long_do_know" type="text" (keypress)="keyPress($event)">
</mat-form-field>
<!-- <mat-form-field style="width: 42%" *ngIf="neighbourhood.controls.do_know.value=='Yes'"> -->
<!-- <input matInput autocomplete="off" placeholder="How Long to Know the Applicant " formControlName="how_long_do_know" type="text" (keypress)="keyPress($event)"> -->
<!-- </mat-form-field> -->
<div fxLayout="row wrap" *ngIf="neighbourhood.controls.do_know.value=='Yes'">
<div fxFlex="100">
<label>How Long to Know the Applicant</label>
<mat-form-field>
<input matInput autocomplete="off" placeholder="Year(s)" formControlName="how_long_do_know_in_year" (keypress)="keyPress($event)">
</mat-form-field>
<mat-form-field>
<input matInput autocomplete="off" placeholder="Month(s)" formControlName="how_long_do_know_in_month" (keypress)="keyPress($event)" (change)="ConvertMonthintoYear(neighbourhood,$event.target.value,1)">
</mat-form-field>
</div>
</div>
<mat-form-field style="width: 42%" *ngIf="neighbourhood.controls.do_know.value=='Yes'">
<mat-select placeholder="Is the Applicant Owner" formControlName="is_applicant_owner">
<mat-option value="Yes">Yes</mat-option>
@ -91,7 +103,7 @@
<input matInput autocomplete="off" placeholder="Year(s)" formControlName="year_relation_applicant" (keypress)="keyPress($event)">
</mat-form-field>
<mat-form-field style="width: 12%">
<input matInput autocomplete="off" placeholder="Month(s)" formControlName="months_relation_applicant" (keypress)="keyPress($event)" (change)="ConvertMonthintoYear(reference,$event.target.value)">
<input matInput autocomplete="off" placeholder="Month(s)" formControlName="months_relation_applicant" (keypress)="keyPress($event)" (change)="ConvertMonthintoYear(reference,$event.target.value,2)">
</mat-form-field>
<mat-form-field style="width: 28%">
<input matInput autocomplete="off" [placeholder]="reference.controls.relationship_with.value ==4 ? 'Rent Amount' : 'Volume of Business'" formControlName="business_volume_amount" type="text" (keypress)="keyPress($event)" (keyup)="inWords($event,r)">

View File

@ -17,7 +17,7 @@ export class NeighbourHoodComponent implements OnInit {
private notifier: NotifierService;
check_type:any=[{'id':0,'type_name':'Neighbourhood'},{'id':1,'type_name':'Reference Check'}]
default_reference_details: any= {'reference_name':'','mobile':'','landline':'-','location':'','relationship_with':'','year_relation_applicant':'','months_relation_applicant':'','business_volume_amount':'','business_volume_unit':'','reference_final_remarks':'','positive_remark':'','negative_remark':'','insufficient_info_remark':''};
default_neighbourhood_details: any= {'neighbourhood_name':'','do_know':'','how_long_do_know':'','is_applicant_owner':''};
default_neighbourhood_details: any= {'neighbourhood_name':'','do_know':'','how_long_do_know_in_year':'','how_long_do_know_in_month':'','is_applicant_owner':''};
busineesRelationshipList:any=[];
volumeunitList:any=[];
@ -175,7 +175,8 @@ export class NeighbourHoodComponent implements OnInit {
return this._fb.group({
neighbourhood_name: [elementValue.neighbourhood_name],
do_know: [elementValue.do_know],
how_long_do_know: [elementValue.how_long_do_know],
how_long_do_know_in_year: [elementValue.how_long_do_know_in_year],
how_long_do_know_in_month: [elementValue.how_long_do_know_in_month],
is_applicant_owner: [elementValue.is_applicant_owner],
});
}
@ -219,7 +220,8 @@ export class NeighbourHoodComponent implements OnInit {
neighbourhood_list.push({
"neighbourhood_name":element.neighbourhood_name,
"do_know":element.do_know,
"how_long_do_know":element.how_long_do_know,
"how_long_do_know_in_year":element.how_long_do_know_in_year,
"how_long_do_know_month":element.how_long_do_know_month,
"is_applicant_owner":element.is_applicant_owner,
})
});
@ -288,17 +290,23 @@ validateAllFormFields(formGroup: any) {
}
/** To Convert Month into Year */
ConvertMonthintoYear(itemrow,e){
// console.log(itemrow);
// console.log(e);
let year = itemrow.controls.year_relation_applicant.value;
ConvertMonthintoYear(itemrow,e,flag){
if(flag == 2){
let converted_month : number = e%12;
let converted_year : number = e/12;
itemrow.controls.year_relation_applicant.setValue(+year + +Math.floor(converted_year));
itemrow.controls.months_relation_applicant.setValue(Math.floor(converted_month));
let year = itemrow.controls.year_relation_applicant.value;
let converted_month : number = e%12;
let converted_year : number = e/12;
itemrow.controls.year_relation_applicant.setValue(+year + +Math.floor(converted_year));
itemrow.controls.months_relation_applicant.setValue(Math.floor(converted_month));
}
else if(flag == 1){
let year = itemrow.controls.how_long_do_know_in_year.value;
let converted_month : number = e%12;
let converted_year : number = e/12;
itemrow.controls.how_long_do_know_in_year.setValue(+year + +Math.floor(converted_year));
itemrow.controls.how_long_do_know_in_month.setValue(Math.floor(converted_month));
}
}
/** Amount InWords */