diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html
index ae3ae69..c2c7750 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.html
@@ -227,7 +227,7 @@
-
+
State Required.
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts
index a2583b0..4ec1f29 100755
--- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts
+++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.ts
@@ -595,6 +595,11 @@ export class AddPdComponent implements OnInit, OnDestroy {
}
//trigger pd
triggerPD(formValue: any, status: string) {
+
+ // this._PDtriggerForm.controls['fk_city'].setValidators([Validators.required]);
+ // this._PDtriggerForm.controls['fk_city'].updateValueAndValidity();
+ // this._PDtriggerForm.controls['pincode'].setValidators([Validators.required]);
+ // this._PDtriggerForm.controls['pincode'].updateValueAndValidity();
this._PDtriggerForm.controls['fk_lender_id'].setValidators([Validators.required]);
this._PDtriggerForm.controls['fk_lender_id'].updateValueAndValidity();
@@ -743,10 +748,75 @@ export class AddPdComponent implements OnInit, OnDestroy {
// }
// return invalid;
// }
+
// common function for both draft and process pd
+
submitPdDetails(formValue: any, status: string) {
// console.log('inside the submitPdDetails data');
-
+ console.log(formValue);
+ console.log(formValue.addresses[0].pincode)
+ if(formValue.addresses[0].pincode == undefined || formValue.addresses[0].fk_city == undefined || formValue.addresses[0].fk_state == undefined)
+ {
+ if(formValue.addresses[0].pincode == undefined && formValue.addresses[0].fk_city == undefined && formValue.addresses[0].fk_state == undefined)
+ {
+ let control_address = this._PDtriggerForm.get('addresses')['controls'][0] as FormArray
+ control_address.get('pincode').enable()
+ control_address.get('fk_city').enable()
+ control_address.get('fk_state').enable()
+ // this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
+ }
+ else if(formValue.addresses[0].pincode == undefined && formValue.addresses[0].fk_city == undefined )
+ {
+ let control_address = this._PDtriggerForm.get('addresses')['controls'][0] as FormArray
+ control_address.get('pincode').enable()
+ control_address.get('fk_city').enable()
+ //this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
+ }
+ else if(formValue.addresses[0].pincode == undefined && formValue.addresses[0].fk_state == undefined)
+ {
+ let control_address = this._PDtriggerForm.get('addresses')['controls'][0] as FormArray
+ control_address.get('pincode').enable()
+ control_address.get('fk_state').enable()
+ // this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
+ }
+ else if(formValue.addresses[0].fk_city == undefined && formValue.addresses[0].fk_state == undefined)
+ {
+
+ let control_address = this._PDtriggerForm.get('addresses')['controls'][0] as FormArray
+ control_address.get('fk_city').enable()
+ control_address.get('fk_state').enable()
+ // this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
+ }
+
+ else if(formValue.addresses[0].pincode == undefined )
+ {
+ let control_address = this._PDtriggerForm.get('addresses')['controls'][0] as FormArray
+ control_address.get('pincode').enable()
+ // this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
+ }
+ else if(formValue.addresses[0].pincode == undefined )
+ {
+ let control_address = this._PDtriggerForm.get('addresses')['controls'][0] as FormArray
+ control_address.get('pincode').enable()
+ //this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
+ }
+ else if(formValue.addresses[0].fk_city == undefined )
+ {
+
+ let control_address = this._PDtriggerForm.get('addresses')['controls'][0] as FormArray
+ control_address.get('fk_city').enable()
+ //this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
+ }
+ else if(formValue.addresses[0].fk_state == undefined )
+ {
+
+ let control_address = this._PDtriggerForm.get('addresses')['controls'][0] as FormArray
+ control_address.get('fk_state').enable()
+ // this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
+ }
+ this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
+ }
+ // return
if (this._PDtriggerForm.invalid) {
// let validate = this.findInvalidControls();
// console.log('validate checking',validate);
@@ -1221,13 +1291,14 @@ searchFun(control:any,i:number,option){
maxWidth:'75vw'
})
dialogRef.afterClosed().subscribe(result=>{
+ console.log(result);
if(result) {
this.excel_file_id = result.excel_file_id
console.log(result,JSON.stringify(result));
// let formValues = {}
let records = result.records
-
+ console.log(records);
if(records ) {
// records.forEach(val=>{
Object.keys(records).forEach(key_name=>{
@@ -1251,10 +1322,15 @@ searchFun(control:any,i:number,option){
this.addressList = records['address_details']
let control_address = this._PDtriggerForm.get('addresses')['controls'][0] as FormArray
+ // control_address.get('addressline1')
+ // control_address.get('fk_state')
+ // control_address.get('fk_city')
+ // control_address.get('pincode')
control_address.get('addressline1').disable()
control_address.get('fk_state').disable()
control_address.get('fk_city').disable()
control_address.get('pincode').disable()
+
this.choosed_address.setValidators(Validators.required)
}
// formValues[val.key_name] = val.value