From 9c4d281a164fccff363186a3ca4da47cdc46f2f9 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Wed, 5 Dec 2018 18:52:24 +0530 Subject: [PATCH] pd additional requirement changes --- .../list-pd/add-pd/add-pd.component.html | 344 +++++++--------- .../list-pd/add-pd/add-pd.component.scss | 3 + .../list-pd/add-pd/add-pd.component.ts | 382 ++++++++++-------- .../edit-pd-applicant.component.html | 159 ++++---- .../edit-pd-applicant.component.scss | 6 + .../edit-pd-applicant.component.ts | 43 +- .../edit-pd-master.component.html | 286 ++++++------- .../edit-pd-master.component.scss | 6 + .../edit-pd-master.component.ts | 139 +++++-- .../manage-pd/list-pd/list-pd.component.html | 1 - .../pd-requirement.component.html | 38 ++ .../pd-requirement.component.scss | 6 + .../pd-requirement.component.spec.ts | 25 ++ .../pd-requirement.component.ts | 111 +++++ .../list-pd/view-pd/view-pd.component.html | 51 ++- .../list-pd/view-pd/view-pd.component.scss | 4 +- .../list-pd/view-pd/view-pd.component.ts | 46 ++- .../manage-pd/manage-pd.module.ts | 7 +- .../pd-service/pd-triger.service.ts | 10 + 19 files changed, 1021 insertions(+), 646 deletions(-) create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.html create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.scss create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.spec.ts create mode 100644 ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.ts 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 a2701b740..a54928b34 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 @@ -1,23 +1,26 @@ -
+
-
-
- -
PD Details
- -
- - - + + + + + PD Details + + + + + + + + Select + {{LL.full_name}} @@ -26,41 +29,41 @@ - + - Applicant ID Required + - - - - {{billL.billing_name}} - - - + + + + - - - Contact Person Required - - - - Contact Number Required + + + Enter Valid Mobile Number. - + - + + Select + + {{PL.product_name}} + - + - + + Select + + {{SPL.subproduct_name}} @@ -68,231 +71,188 @@ - + - + + Select + + {{CSL.customer_segment}} - + - + + Select + + {{PDL.type_name}} + - + Enter valid amount. - + - + + + + Select + {{SL.state_name}} + - + - ` + + Select + + {{CL.city_name}} + - + Enter Valid Pincode. - - - - + + -
-
-
-
-
- -
Main Applicant
- - - Name is Required. + + + + Applicant Details + + + + + - + + + + -
- - + + Enter Valid Mobile Number. - - - - Enter Valid Phone Number. + + + + Enter Valid LandLine Number. -
- - - - - - - - +
-
-
-
+ + + Additional Requirements + + + + + + + -
- - -
{{coDetails.controls.label.value}} {{i+1}}
- -
- - - + + + + + + + + + + + + + + Document + + + + + + + + + -
- - - Enter Valid Mobile Number. - - - - - Enter Valid Phone Number. - -
- - - - - - - {{rel.name}} - - - - -
- - - -
-
-
-
-
-
- -
- -
Co-Applicant
- - - - - -
-
-
-
- -
- - -
Document
- - - - - -
-
- - - - - - - -
- - - - - -
-
-
+
+ + + + + +
+ + + + + + + + +
-
-
- +
- - - - + +
+ + + + +
+
+ + + +
- - - -
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.scss index e69de29bb..b559b3c47 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/add-pd/add-pd.component.scss @@ -0,0 +1,3 @@ +mat-form-field { + margin: 0 2%; + } \ No newline at end of file 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 e858b0690..e0beeaaf4 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 @@ -21,6 +21,7 @@ export class AddPdComponent implements OnInit, OnDestroy { private notifier: NotifierService; public _PDtriggerForm: FormGroup; items: FormArray; + addtional_requirements: FormArray; productList:any; subProductList:any; lenderList:any; @@ -34,11 +35,6 @@ export class AddPdComponent implements OnInit, OnDestroy { // Dynamic co applicant createWithLongContent = false; dynamicCoApplicant = []; - //allocationTypeModel: number; - //allocationTypeCheck: boolean; - //subAllocationTypeCheck: boolean; - //allocationLabel: string; - //subAllocationLabel: string; constructor(notifier: NotifierService,private _fb: FormBuilder,private route: ActivatedRoute, private router: Router,private _pd: PdTrigerService, private _aws:AwsService, private ListPdComponent: ListPdComponent) { this.notifier = notifier; @@ -59,7 +55,6 @@ export class AddPdComponent implements OnInit, OnDestroy { this.getPDTypeList(); this.getRelationMaster(); this.loadFormData(); - this.OnChanges(); } @@ -70,40 +65,29 @@ export class AddPdComponent implements OnInit, OnDestroy { lender_applicant_id: [null, Validators.compose([Validators.required])], lender_contact_person: [null, Validators.compose([Validators.required])], lender_contact_mobile: [null, Validators.compose([Validators.required,Validators.minLength(10),Validators.maxLength(12),Validators.required,Validators.pattern('^[0-9]*$')])], - lender_billing: [null], + //lender_billing: [null], fk_product_id: [null], fk_subproduct_id: [null], fk_pd_type: [null], fk_customer_segment: [null], loan_amount: [null,Validators.compose([Validators.pattern('^[0-9]*$')])], applicant_name: [null], - mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10),Validators.required])], - landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])], - email: [null], + mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10)])], + landline : [null,Validators.compose([Validators.minLength(8),Validators.maxLength(12)])], + company_name: [null],   addressline1: [null], - addressline2: [null], - addressline3: [null], fk_city: [null], fk_state: [null],   pincode : [null,Validators.compose([Validators.minLength(6),Validators.maxLength(6)])], remarks:[null],   // allocation_type: [null],   // sub_allocation_type: [null], - items: this._fb.array([]), - documents: this._fb.array([]) + //items: this._fb.array([]), + documents: this._fb.array([]), + addtional_requirements: this._fb.array([this.createRequiremnt()]) }); } - // enable pd trigger submit function - OnChanges(): void{ - this._PDtriggerForm.valueChanges.subscribe(val => { - if(val.fk_lender_id && val.fk_product_id && val.fk_subproduct_id && val.fk_pd_type && val.fk_customer_segment && val.loan_amount && val.applicant_name && val.mobile_no && val.addressline1 && val.fk_city && val.fk_state && val.pincode){ - this.enablePDButton=true; - } - else{ - this.enablePDButton=false; - } - }); - } + getLenderList(){ this._pd.getLenderDetails().subscribe( data => { @@ -142,34 +126,6 @@ export class AddPdComponent implements OnInit, OnDestroy { data => { if (data.status == 200) { this.pdTypeList=data.records.pd_type; - - //start hide pd allocation type functinality - - // if(data.records.pd_allocation_type){ - // let getDefaultAllocation= data.records.pd_allocation_type.filter(item => item.default == 1); - // if(getDefaultAllocation[0].pd_allocation_type_id==1){ - // this.allocationTypeModel=1; - // this.allocationTypeCheck=false; - // this.subAllocationTypeCheck=false; - // this.allocationLabel="Auto"; - // this.subAllocationLabel="Load Balance"; - // } - // else if(this.allocationTypeModel[0].pd_allocation_type_id==2){ - // this.allocationTypeModel=2; - // this.allocationTypeCheck=false; - // this.subAllocationTypeCheck=true; - // this.allocationLabel="Auto"; - // this.subAllocationLabel="Nearest"; - // } - // else if(this.allocationTypeModel[0].pd_allocation_type_id==3){ - // this.allocationTypeModel=3; - // this.allocationTypeCheck=true; - // this.allocationLabel="Manual"; - // } - - // } - - // end } }, error => this.errorMessage = error); @@ -187,11 +143,6 @@ export class AddPdComponent implements OnInit, OnDestroy { this.cityList=this.cityList[0].cities; } - // lendor billing address - getBillingDetails(lendorID:string){ - this.billingList= this.lenderList.filter(item => item.entity_id == lendorID); - this.billingList=this.billingList[0].billing_address; - } // get relation master details getRelationMaster(){ let relation ="RELATIONSHIPS"; @@ -246,7 +197,7 @@ export class AddPdComponent implements OnInit, OnDestroy { }; get pdMain() { return this._PDtriggerForm.controls; } - get pdCoApplicant() { return this._PDtriggerForm.get('items') as FormArray; } + // get pdCoApplicant() { return this._PDtriggerForm.get('items') as FormArray; } removeCoApplicant(i: number) { const control = this._PDtriggerForm.controls['items']; @@ -258,6 +209,24 @@ export class AddPdComponent implements OnInit, OnDestroy { this.documents.removeAt(index); this.lengthCheckToaddMore=this.lengthCheckToaddMore-1; } + + get pdRequirements() { return this._PDtriggerForm.get('addtional_requirements') as FormArray; } + createRequiremnt(): FormGroup { + return this._fb.group({ + add_req_id:[null], + add_requirement: [null, Validators.compose([Validators.required])], + isactive: [1], + }); + }; + addRequiremnts() { + this.addtional_requirements = this._PDtriggerForm.get('addtional_requirements') as FormArray; + this.addtional_requirements.push(this.createRequiremnt()); + } + + removeRequirements(index: number) { + const requirement_control = this._PDtriggerForm.controls['addtional_requirements']; + requirement_control.removeAt(index); + } public fileSelectionEvent(fileInput: any,oldIndex:number) { @@ -286,116 +255,182 @@ export class AddPdComponent implements OnInit, OnDestroy { this.lengthCheckToaddMore=1; } } - submitPdDetails(formValue: any, status:string) { - if(this._PDtriggerForm.valid){ - // let my_array = this.PDtriggerForm.value; - // Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]); - let pd_details:any={ - "fk_lender_id":formValue.fk_lender_id, - "lender_applicant_id":formValue.lender_applicant_id, - "fk_entity_billing_id":formValue.lender_billing, - "pd_contact_person":formValue.lender_contact_person, - "pd_contact_mobileno":formValue.lender_contact_mobile, - "fk_product_id":formValue.fk_product_id, - "fk_subproduct_id":formValue.fk_subproduct_id, - "fk_pd_type":formValue.fk_pd_type, - "fk_customer_segment":formValue.fk_customer_segment, - "loan_amount":formValue.loan_amount, - "addressline1":formValue.addressline1, - "addressline2":formValue.addressline2, - "addressline3":formValue.addressline3, - "fk_city":formValue.fk_city, - "fk_state":formValue.fk_state, - "pincode":formValue.pincode , - "remarks":formValue.remarks, - "pd_status": status, - //"fk_pd_allocation_type":this.allocationTypeModel , - "fk_createdby" : this._aws.getlocale(), - // "createdon": new Date().toJSON().slice(0,19).replace('T',' ') - }; - let pd_applicant_details : any=[{ - "applicant_name":formValue.applicant_name, - "email":formValue.email, - "mobile_no":formValue.mobile_no, - "landline":formValue.landline, - "applicant_type":1, - "relation":"", - }]; - formValue.items.forEach((itemElement, itemIndex) => { - let obj1 = { - "applicant_name":itemElement.coapplicantName, - "relation":itemElement.relationship, - "email":"", - "mobile_no":itemElement.coapplicant_mobile_no, - "landline":itemElement.coapplicant_landline, - "applicant_type":0, - } - pd_applicant_details.push(obj1) - }); - - // docs details - let pd_form: FormData = new FormData(); - - for(let j=0;jthis.totalfiles[j]) - } - - //reverseFileNames=this.totalFileName.reverse(); - - let AllFilesObj= [] - - formValue.documents.forEach((element, index) => { - // let eachObj= - // { - // 'doc_name' : element.doc_name, - // 'file_name' : this.totalFileName[index] - // } - AllFilesObj.push(element.doc_name); - }); - pd_form.append("pd_details",JSON.stringify(pd_details)) - pd_form.append("pd_applicant_details",JSON.stringify(pd_applicant_details)) - pd_form.append("pd_document_titles",JSON.stringify(AllFilesObj)) - this._pd.addPdDetails(pd_form).subscribe(result => { - if (result.status == 200) { - this.notifier.notify('success', 'PD Saved.'); - this.loadPdListCompoent(true); - } - else { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - } - }, error => { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - }); - } + // save pd in draft + saveDraftPD(formValue: any, status:string){ + this.submitPdDetails(formValue, status); } - // start hide allocation type functionality + //trigger pd + triggerPD(formValue: any, status:string){ + this._PDtriggerForm.controls['fk_lender_id'].setValidators([Validators.required]); + this._PDtriggerForm.controls['fk_lender_id'].updateValueAndValidity(); + + this._PDtriggerForm.controls['fk_product_id'].setValidators([Validators.required]); + this._PDtriggerForm.controls['fk_product_id'].updateValueAndValidity(); + + this._PDtriggerForm.controls['fk_subproduct_id'].setValidators([Validators.required]); + this._PDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity(); + + this._PDtriggerForm.controls['fk_pd_type'].setValidators([Validators.required]); + this._PDtriggerForm.controls['fk_pd_type'].updateValueAndValidity(); - // changeAllocationType(status: boolean) { - // if(status){ - // this.allocationTypeModel=3; - // this.allocationLabel="Manual"; - // } - // else{ - // this.allocationTypeModel=1; - // this.allocationLabel="Auto"; - // this.subAllocationLabel="Load Balance"; - // } - // } - // changeSubAllocationType(status: boolean){ - // if(status){ - // this.allocationTypeModel=2; - // this.allocationLabel="Auto"; - // this.subAllocationLabel="Nearest"; - // } - // else{ - // this.allocationTypeModel=1; - // this.allocationLabel="Auto"; - // this.subAllocationLabel="Load Balance"; - // } - // } - // end + this._PDtriggerForm.controls['fk_customer_segment'].setValidators([Validators.required]); + this._PDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity(); + + this._PDtriggerForm.controls['loan_amount'].setValidators([Validators.required]); + this._PDtriggerForm.controls['loan_amount'].updateValueAndValidity(); + + this._PDtriggerForm.controls['applicant_name'].setValidators([Validators.required]); + this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity(); + + this._PDtriggerForm.controls['mobile_no'].setValidators([Validators.required]); + this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity(); + + this._PDtriggerForm.controls['addressline1'].setValidators([Validators.required]); + this._PDtriggerForm.controls['addressline1'].updateValueAndValidity(); + + this._PDtriggerForm.controls['fk_city'].setValidators([Validators.required]); + this._PDtriggerForm.controls['fk_city'].updateValueAndValidity(); + + this._PDtriggerForm.controls['fk_state'].setValidators([Validators.required]); + this._PDtriggerForm.controls['fk_state'].updateValueAndValidity(); + + this._PDtriggerForm.controls['pincode'].setValidators([Validators.required]); + this._PDtriggerForm.controls['pincode'].updateValueAndValidity(); + setTimeout(() => { + this.clearCustomValidatorFields(); + }, 10000); + this.submitPdDetails(formValue, status); + } + + // this is for clear custom validator required fields + clearCustomValidatorFields(){ + this._PDtriggerForm.controls['fk_lender_id'].clearValidators(); + this._PDtriggerForm.controls['fk_lender_id'].updateValueAndValidity(); + + this._PDtriggerForm.controls['fk_product_id'].clearValidators(); + this._PDtriggerForm.controls['fk_product_id'].updateValueAndValidity(); + + this._PDtriggerForm.controls['fk_subproduct_id'].clearValidators(); + this._PDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity(); + + this._PDtriggerForm.controls['fk_pd_type'].clearValidators(); + this._PDtriggerForm.controls['fk_pd_type'].updateValueAndValidity(); + + this._PDtriggerForm.controls['fk_customer_segment'].clearValidators(); + this._PDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity(); + + this._PDtriggerForm.controls['loan_amount'].clearValidators(); + this._PDtriggerForm.controls['loan_amount'].updateValueAndValidity(); + + this._PDtriggerForm.controls['applicant_name'].clearValidators(); + this._PDtriggerForm.controls['applicant_name'].updateValueAndValidity(); + + this._PDtriggerForm.controls['mobile_no'].clearValidators(); + this._PDtriggerForm.controls['mobile_no'].updateValueAndValidity(); + + this._PDtriggerForm.controls['addressline1'].clearValidators(); + this._PDtriggerForm.controls['addressline1'].updateValueAndValidity(); + + this._PDtriggerForm.controls['fk_city'].clearValidators(); + this._PDtriggerForm.controls['fk_city'].updateValueAndValidity(); + + this._PDtriggerForm.controls['fk_state'].clearValidators(); + this._PDtriggerForm.controls['fk_state'].updateValueAndValidity(); + + this._PDtriggerForm.controls['pincode'].clearValidators(); + this._PDtriggerForm.controls['pincode'].updateValueAndValidity(); + + this.validateAllFormFields(this._PDtriggerForm); + } + + // common function for both draft and process pd + submitPdDetails(formValue: any, status:string) { + if(this._PDtriggerForm.invalid) { + this.validateAllFormFields(this._PDtriggerForm) + return; + } + else { + let pd_details:any={ + "fk_lender_id":formValue.fk_lender_id, + "lender_applicant_id":formValue.lender_applicant_id, + "pd_contact_person":formValue.lender_contact_person, + "pd_contact_mobileno":formValue.lender_contact_mobile, + "fk_product_id":formValue.fk_product_id, + "fk_subproduct_id":formValue.fk_subproduct_id, + "fk_pd_type":formValue.fk_pd_type, + "fk_customer_segment":formValue.fk_customer_segment, + "loan_amount":formValue.loan_amount, + "addressline1":formValue.addressline1, + "fk_city":formValue.fk_city, + "fk_state":formValue.fk_state, + "pincode":formValue.pincode , + "remarks":formValue.remarks, + "pd_status": status, + "fk_createdby" : this._aws.getlocale(), + }; + var pd_applicant_details: any=[]; + if(formValue.applicant_name){ + pd_applicant_details.push({ + "applicant_name":formValue.applicant_name, + "company_name":formValue.company_name, + "mobile_no":formValue.mobile_no, + "landline":formValue.landline, + "applicant_type":1, + "relation":"", + }); + } + + // formValue.items.forEach((itemElement, itemIndex) => { + // let obj1 = { + // "applicant_name":itemElement.coapplicantName, + // "relation":itemElement.relationship, + // "email":"", + // "mobile_no":itemElement.coapplicant_mobile_no, + // "landline":itemElement.coapplicant_landline, + // "applicant_type":0, + // } + // pd_applicant_details.push(obj1) + // }); + + // docs details + let pd_form: FormData = new FormData(); + + for(let j=0;jthis.totalfiles[j]) + } + + //reverseFileNames=this.totalFileName.reverse(); + + let AllFilesObj= [] + + formValue.documents.forEach((element, index) => { + AllFilesObj.push(element.doc_name); + }); + pd_form.append("pd_details",JSON.stringify(pd_details)) + if(pd_applicant_details.length>0){ + pd_form.append("pd_applicant_details",JSON.stringify(pd_applicant_details)) + } + pd_form.append("pd_document_titles",JSON.stringify(AllFilesObj)) + if(formValue.addtional_requirements.length > 0){ + pd_form.append("addtional_requirements",JSON.stringify(formValue.addtional_requirements)) + + } + this._pd.addPdDetails(pd_form).subscribe(result => { + if (result.status == 200) { + this.notifier.notify('success', 'PD Saved.'); + this.loadPdListCompoent(true); + } + else { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + } + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }); + } + + } loadPdListCompoent(from:boolean) { if(from){ this.router.navigate([ '../../' ], { relativeTo: this.route }); @@ -423,4 +458,19 @@ export class AddPdComponent implements OnInit, OnDestroy { event.preventDefault(); } } + // validate all form group and form array fields +validateAllFormFields(formGroup: any) { + Object.keys(formGroup.controls).forEach(field => { + const control = formGroup.get(field); + + if (control instanceof FormControl) { + control.markAsTouched({ onlySelf: true }); + } else if (control instanceof FormGroup) { + this.validateAllFormFields(control); + } else if (control instanceof FormArray) { + this.validateAllFormFields(control); + } + }); +} + } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html index 4980cad00..f3b802eb7 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.html @@ -1,90 +1,89 @@ -
-
- -
- -
+ -
-
- -
Main Applicant
- - - - - Name is required. - - - - - Email is required. - - - -
- - - Mobile number is required. - Enter Valid Mobile Number. - - - - Enter Valid Phone Number. - +

+
+ {{pageTitle}}
- - - -

-
-
-
- - -
{{coDetails.controls.label.value}} {{i+1}}
+
+ + +
+ + + + + + + Main Applicant + + + + -
- - - Name is Required. + + + + + + + + + Enter Valid Mobile Number. + + + + Enter Valid Phone Number. + - - -
- - - Enter Valid Mobile Number. - - - - Enter Valid Phone Number. - -
- - - - - - {{rel.name}} - - - -
+
-
-
-
- + + + + + + + + + + + + + + Enter Valid Mobile Number. + + + + + Enter Valid Phone Number. + + + + + Select + + {{rel.name}} + + + + - + + + + + + + + - -
- -
+ + + + + \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.scss index e69de29bb..4fe099dd8 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.scss @@ -0,0 +1,6 @@ +mat-form-field { + margin: 0 2%; + } +.paragraph_change { + color: #e00201 !important; +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.ts index e1b521fd5..d7614085b 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-applicant/edit-pd-applicant.component.ts @@ -11,7 +11,7 @@ import { PdTrigerService } from '../../../pd-service/pd-triger.service'; encapsulation: ViewEncapsulation.None, }) export class EditPdApplicantComponent implements OnInit { - public pageTitle: string = "Edit Applicant"; + public pageTitle: string = "Applicant Details"; errorMessage: any; public _EditApplicantForm:FormGroup; public notifier: NotifierService; @@ -43,8 +43,8 @@ export class EditPdApplicantComponent implements OnInit { fk_applicant_primary_id: [null], applicant_name: [null, Validators.compose([Validators.required])], mobile_no: [null, Validators.compose([Validators.required,Validators.minLength(10),Validators.maxLength(12)])], - landline: [null, Validators.compose([Validators.required,Validators.minLength(12),Validators.maxLength(13)])], - email: [null, Validators.compose([Validators.required, CustomValidators.email])], + landline: [null, Validators.compose([Validators.minLength(8),Validators.maxLength(12)])], + company_name: [null], applicant_type: [1], coApplicantItems: this._fb.array([]), }); @@ -55,9 +55,9 @@ export class EditPdApplicantComponent implements OnInit { this._EditApplicantForm = this._fb.group({ fk_applicant_primary_id: [this.mainApplicantData[0].pd_co_applicant_id], applicant_name: [this.mainApplicantData[0].applicant_name, Validators.compose([Validators.required])], - mobile_no: [this.mainApplicantData[0].mobile_no, Validators.compose([Validators.required,Validators.minLength(10),Validators.maxLength(12)])], - landline: [this.mainApplicantData[0].landline, Validators.compose([Validators.required,Validators.minLength(12),Validators.maxLength(13)])], - email: [this.mainApplicantData[0].email, Validators.compose([Validators.required, CustomValidators.email])], + mobile_no: [this.mainApplicantData[0].mobile_no, Validators.compose([Validators.required,Validators.required,Validators.minLength(10),Validators.maxLength(12)])], + landline: [this.mainApplicantData[0].landline, Validators.compose([Validators.minLength(8),Validators.maxLength(12)])], + company_name: [this.mainApplicantData[0].company_name], applicant_type: [this.mainApplicantData[0].applicant_type, Validators.compose([Validators.required])], coApplicantItems: this._fb.array([]), }); @@ -76,9 +76,10 @@ export class EditPdApplicantComponent implements OnInit { fk_applicant_primary_id: [listData.pd_co_applicant_id], coapplicantName: [listData.applicant_name, Validators.compose([Validators.required])], coapplicant_mobile_no: [listData.mobile_no,Validators.compose([Validators.minLength(10),Validators.maxLength(12),Validators.pattern('^[0-9]*$')])], - coapplicant_landline: [listData.landline,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])], + coapplicant_landline: [listData.landline,Validators.compose([Validators.minLength(8),Validators.maxLength(12)])], relationship: [listData.relation], applicant_type: [listData.applicant_type, Validators.compose([Validators.required])], + company_name: [listData.company_name], }); } else{ @@ -87,9 +88,10 @@ export class EditPdApplicantComponent implements OnInit { fk_applicant_primary_id: [null], coapplicantName: [null, Validators.compose([Validators.required])], coapplicant_mobile_no: [null, Validators.compose([Validators.minLength(10),Validators.maxLength(12),Validators.pattern('^[0-9]*$')])], - coapplicant_landline: [null, Validators.compose([Validators.minLength(12),Validators.maxLength(13)])], + coapplicant_landline: [null, Validators.compose([Validators.minLength(8),Validators.maxLength(12)])], relationship: [null], applicant_type: [0], + company_name: [null], }); } @@ -105,12 +107,16 @@ export class EditPdApplicantComponent implements OnInit { get pdMainApplicant() { return this._EditApplicantForm.controls; } get pdCoApplicant() { return this._EditApplicantForm.get('coApplicantItems') as FormArray; } updatePdApplicant(formValue: any) { - if(this._EditApplicantForm.valid){ + if(this._EditApplicantForm.invalid) { + this.validateAllFormFields(this._EditApplicantForm) + return; + } + else { let pd_applicant_details : any=[{ "fk_pd_id": this.data.pdID, "pd_co_applicant_id": formValue.fk_applicant_primary_id, "applicant_name":formValue.applicant_name, - "email":formValue.email, + "company_name":formValue.company_name, "mobile_no":formValue.mobile_no, "landline":formValue.landline, "applicant_type":formValue.applicant_type, @@ -123,10 +129,10 @@ export class EditPdApplicantComponent implements OnInit { "pd_co_applicant_id": itemElement.fk_applicant_primary_id, "applicant_name":itemElement.coapplicantName, "relation":itemElement.relationship, - "email":"", "mobile_no":itemElement.coapplicant_mobile_no, "landline":itemElement.coapplicant_landline, "applicant_type":itemElement.applicant_type, + "company_name":itemElement.company_name, "isactive":1 } pd_applicant_details.push(obj1) @@ -179,4 +185,19 @@ export class EditPdApplicantComponent implements OnInit { event.preventDefault(); } } + + // validate all form group and form array fields +validateAllFormFields(formGroup: any) { + Object.keys(formGroup.controls).forEach(field => { + const control = formGroup.get(field); + + if (control instanceof FormControl) { + control.markAsTouched({ onlySelf: true }); + } else if (control instanceof FormGroup) { + this.validateAllFormFields(control); + } else if (control instanceof FormArray) { + this.validateAllFormFields(control); + } + }); +} } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html index 941ac1f08..0fe16aa64 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.html @@ -1,147 +1,151 @@ -
-
- -
- -
- -
-
-
- - - - {{LL.full_name}} - - - - - - - - - Applicant ID Required - - - - - {{billL.billing_name}} - - - - - - Contact Person Required - - - - Contact Number Required - Enter Valid Mobile Number. - + - - - - - {{PL.product_name}} - - - - - - - - - - {{SPL.subproduct_name}} - - - - - - - - - - {{CSL.customer_segment}} - - - - - - - - {{PDL.type_name}} - - - - - - - - - - Enter valid amount. - - - - - - - - - - - - - - - - - - {{SL.state_name}} - - - - - - - - - ` - {{CL.city_name}} - - - - - - - - - - Enter Valid Pincode. - - - +

+
+ {{pageTitle}} +
+
+ + +
+

+ + + + + + + + + + Select + + + {{LL.full_name}} + + + + - -
- -
-
+ + + + + + + + + + Enter Valid Mobile Number. + + + + + + + Select + + + {{PL.product_name}} + + + + + + + + + Select + + + {{SPL.subproduct_name}} + + + + + + + + + Select + + {{CSL.customer_segment}} + + + + + + + Select + + {{PDL.type_name}} + + + + + + + + + + Enter valid amount. + + + + + + + + + + Select + + {{SL.state_name}} + + + + + + + + + Select + + {{CL.city_name}} + + + + + + + + + + Enter Valid Pincode. + - -
- - - - - -
-
-
+ + + + + + +
+ + Remarks + + +
+
+ + +
+
+ + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.scss index e69de29bb..4fe099dd8 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.scss @@ -0,0 +1,6 @@ +mat-form-field { + margin: 0 2%; + } +.paragraph_change { + color: #e00201 !important; +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts index 79367d614..38bfe29f5 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/edit-pd-master/edit-pd-master.component.ts @@ -11,7 +11,7 @@ import { PdTrigerService } from '../../../pd-service/pd-triger.service'; encapsulation: ViewEncapsulation.None }) export class EditPdMasterComponent implements OnInit { - public pageTitle: string = "Edit PD Master"; + public pageTitle: string = "PD Details"; errorMessage: any; productList:any; subProductList:any; @@ -55,7 +55,6 @@ export class EditPdMasterComponent implements OnInit { this.getPDTypeList(); this.loadFormData(); this.applicantLength=this.data.applicantLength; - this.OnChanges(); } @@ -65,10 +64,6 @@ export class EditPdMasterComponent implements OnInit { data => { if (data.status == 200) { this.lenderList=data.records - - if(this.data.records.fk_lender_id){ - this.getBillingDetails(this.data.records.fk_lender_id); - } } }, error => this.errorMessage = error); } @@ -121,39 +116,19 @@ export class EditPdMasterComponent implements OnInit { lender_applicant_id: [this.data.records.lender_applicant_id, Validators.compose([Validators.required])], pd_contact_person: [this.data.records.pd_contact_person, Validators.compose([Validators.required])], pd_contact_mobileno: [this.data.records.pd_contact_mobileno, Validators.compose([Validators.required,Validators.minLength(10),Validators.maxLength(12),Validators.pattern('^[0-9]*$')])], - fk_entity_billing_id: [this.data.records.fk_entity_billing_id], fk_product_id: [this.data.records.fk_product_id], fk_subproduct_id: [this.data.records.fk_subproduct_id], fk_pd_type: [this.data.records.fk_pd_type], fk_customer_segment: [this.data.records.fk_customer_segment], loan_amount: [this.data.records.loan_amount,Validators.compose([Validators.pattern('^[0-9]*$')])],   addressline1: [this.data.records.addressline1], - addressline2: [this.data.records.addressline2], - addressline3: [this.data.records.addressline3], fk_city: [this.data.records.fk_city], fk_state: [this.data.records.fk_state],   pincode : [this.data.records.pincode,Validators.compose([Validators.minLength(6),Validators.maxLength(6),Validators.pattern('^[0-9]*$')])], remarks: [this.data.records.remarks], - }); - if(this.data.records.fk_lender_id && this.data.records.fk_product_id && this.data.records.fk_subproduct_id && this.data.records.fk_pd_type && this.data.records.fk_customer_segment && this.data.records.loan_amount && this.data.records.addressline1 && this.data.records.fk_city && this.data.records.fk_state && this.data.records.pincode){ - this.enablePDButton=true; - } - else{ - this.enablePDButton=false; - } - + }); } - // enable pd trigger submit function - OnChanges(): void{ - this._EditPDtriggerForm.valueChanges.subscribe(val => { - if(val.fk_lender_id && val.fk_product_id && val.fk_subproduct_id && val.fk_pd_type && val.fk_customer_segment && val.loan_amount && val.addressline1 && val.fk_city && val.fk_state && val.pincode){ - this.enablePDButton=true; - } - else{ - this.enablePDButton=false; - } - }); - } + get pdMain() { return this._EditPDtriggerForm.controls; } //get sub product list based on prokduct id @@ -168,14 +143,95 @@ export class EditPdMasterComponent implements OnInit { this.cityList= this.stateList.filter(item => item.state_id == stateID); this.cityList=this.cityList[0].cities; } - // lendor billing address - getBillingDetails(lendorID:string){ - this.billingList= this.lenderList.filter(item => item.entity_id == lendorID); - this.billingList=this.billingList[0].billing_address; - } + + // save pd in draft + saveDraftPD(formValue: any, status:string){ + this.clearCustomValidatorFields(); + this.submitPdDetails(formValue, status); + } + //trigger pd + triggerPD(formValue: any, status:string){ + this._EditPDtriggerForm.controls['fk_lender_id'].setValidators([Validators.required]); + this._EditPDtriggerForm.controls['fk_lender_id'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['fk_product_id'].setValidators([Validators.required]); + this._EditPDtriggerForm.controls['fk_product_id'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['fk_subproduct_id'].setValidators([Validators.required]); + this._EditPDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['fk_pd_type'].setValidators([Validators.required]); + this._EditPDtriggerForm.controls['fk_pd_type'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['fk_customer_segment'].setValidators([Validators.required]); + this._EditPDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['loan_amount'].setValidators([Validators.required]); + this._EditPDtriggerForm.controls['loan_amount'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['addressline1'].setValidators([Validators.required]); + this._EditPDtriggerForm.controls['addressline1'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['fk_city'].setValidators([Validators.required]); + this._EditPDtriggerForm.controls['fk_city'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['fk_state'].setValidators([Validators.required]); + this._EditPDtriggerForm.controls['fk_state'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['pincode'].setValidators([Validators.required]); + this._EditPDtriggerForm.controls['pincode'].updateValueAndValidity(); + if(this.applicantLength==0){ + this.notifier.notify('error', 'Please add applicants.!'); + + } + this.submitPdDetails(formValue, status); + setTimeout(() => { + this.clearCustomValidatorFields(); + }, 10000); + } + + // this is for clear custom validator required fields + clearCustomValidatorFields(){ + this._EditPDtriggerForm.controls['fk_lender_id'].clearValidators(); + this._EditPDtriggerForm.controls['fk_lender_id'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['fk_product_id'].clearValidators(); + this._EditPDtriggerForm.controls['fk_product_id'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['fk_subproduct_id'].clearValidators(); + this._EditPDtriggerForm.controls['fk_subproduct_id'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['fk_pd_type'].clearValidators(); + this._EditPDtriggerForm.controls['fk_pd_type'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['fk_customer_segment'].clearValidators(); + this._EditPDtriggerForm.controls['fk_customer_segment'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['loan_amount'].clearValidators(); + this._EditPDtriggerForm.controls['loan_amount'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['addressline1'].clearValidators(); + this._EditPDtriggerForm.controls['addressline1'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['fk_city'].clearValidators(); + this._EditPDtriggerForm.controls['fk_city'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['fk_state'].clearValidators(); + this._EditPDtriggerForm.controls['fk_state'].updateValueAndValidity(); + + this._EditPDtriggerForm.controls['pincode'].clearValidators(); + this._EditPDtriggerForm.controls['pincode'].updateValueAndValidity(); + + this.validateAllFormFields(this._EditPDtriggerForm); + } + submitPdDetails(formValue: any, status:string) { let updateStatus = this.currentPDStatus == this.pdStatusCheck.DRAFT ? status : this.currentPDStatus == this.pdStatusCheck.TRIGGERED ? status : this.currentPDStatus; - if(this._EditPDtriggerForm.valid){ + if(this._EditPDtriggerForm.invalid) { + this.validateAllFormFields(this._EditPDtriggerForm) + return; + } + else{ let my_array = this._EditPDtriggerForm.value; Object.keys(my_array).forEach((key) => ( my_array[key] == null) && delete my_array[key]); this._pd.editPdMasterDetails(my_array, updateStatus).subscribe(result => { @@ -208,6 +264,21 @@ export class EditPdMasterComponent implements OnInit { event.preventDefault(); } } + + // validate all form group and form array fields +validateAllFormFields(formGroup: any) { + Object.keys(formGroup.controls).forEach(field => { + const control = formGroup.get(field); + + if (control instanceof FormControl) { + control.markAsTouched({ onlySelf: true }); + } else if (control instanceof FormGroup) { + this.validateAllFormFields(control); + } else if (control instanceof FormArray) { + this.validateAllFormFields(control); + } + }); +} } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.html index c3d34c300..718444dc0 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/list-pd.component.html @@ -1,4 +1,3 @@ -
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.html new file mode 100644 index 000000000..914f09e74 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.html @@ -0,0 +1,38 @@ +
+ +

+
+ {{pageTitle}} +
+
+ + +
+

+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.scss new file mode 100644 index 000000000..4fe099dd8 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.scss @@ -0,0 +1,6 @@ +mat-form-field { + margin: 0 2%; + } +.paragraph_change { + color: #e00201 !important; +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.spec.ts new file mode 100644 index 000000000..d7f724e4b --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PdRequirementComponent } from './pd-requirement.component'; + +describe('PdRequirementComponent', () => { + let component: PdRequirementComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PdRequirementComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PdRequirementComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.ts new file mode 100644 index 000000000..cd18dae6d --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/pd-requirement/pd-requirement.component.ts @@ -0,0 +1,111 @@ +import { Component, OnInit,ViewEncapsulation, Inject } from '@angular/core'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; +import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms'; +import { CustomValidators } from 'ng2-validation'; +import { NotifierService } from 'angular-notifier'; +import { PdTrigerService } from '../../../pd-service/pd-triger.service'; + +@Component({ + selector: 'app-pd-requirement', + templateUrl: './pd-requirement.component.html', + styleUrls: ['./pd-requirement.component.scss'], + encapsulation: ViewEncapsulation.None, +}) +export class PdRequirementComponent implements OnInit { + public pageTitle: string = "Additional Requirements Details"; + public _EditPDRequirementForm:FormGroup; + public notifier: NotifierService; + addtional_requirements: FormArray; + public const_requirement : any = { + "add_req_id": '', + "add_requirement":'', + "earning_ans": '', + "isactive": 1, + }; + constructor(private _fb: FormBuilder, + private _pd: PdTrigerService, notifier: NotifierService,private dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: any) { + this.notifier=notifier + } + + ngOnInit() { + this.loadForm(); + + } + loadForm() { + this._EditPDRequirementForm = this._fb.group({ + pdid: [this.data.pdID], + addtional_requirements: this._fb.array([]) +}); +// bind dynamic co applicant data + if(this.data.records.length > 0){ + this.data.records.forEach((itemElement, itemIndex) => { + this.addRequiremnts(itemElement) + }); + } + else { + this.addRequiremnts(this.const_requirement) + } + } + + get pdRequirements() { return this._EditPDRequirementForm.get('addtional_requirements') as FormArray; } + createRequiremnt(receive:any): FormGroup { + return this._fb.group({ + add_req_id:[receive.add_req_id], + add_requirement: [receive.add_requirement, Validators.compose([Validators.required])], + isactive: [receive.isactive], + }); + }; + addRequiremnts(getData:any) { + if(this._EditPDRequirementForm.valid){ + this.addtional_requirements = this._EditPDRequirementForm.get('addtional_requirements') as FormArray; + this.addtional_requirements.push(this.createRequiremnt(getData)); + } + else { + this.validateAllFormFields(this._EditPDRequirementForm); + } + } + + // removeRequirements(index: number) { + // const requirement_control = this._EditPDRequirementForm.controls['additional_requirements']; + // requirement_control.removeAt(index); + // } + + updateAdditionalRequirement(formValue: any) { + if(this._EditPDRequirementForm.invalid) { + this.validateAllFormFields(this._EditPDRequirementForm) + return; + } + else { + let records:any=formValue; + + this._pd.saveAdditionalRequirements(records).subscribe(result => { + if (result.status == 200) { + this.notifier.notify('success', 'Additional Requirements Updated.'); + this.dialogRef.close(); + } + else { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + } + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }); + } + } + + // validate all form group and form array fields +validateAllFormFields(formGroup: any) { + Object.keys(formGroup.controls).forEach(field => { + const control = formGroup.get(field); + + if (control instanceof FormControl) { + control.markAsTouched({ onlySelf: true }); + } else if (control instanceof FormGroup) { + this.validateAllFormFields(control); + } else if (control instanceof FormArray) { + this.validateAllFormFields(control); + } + }); +} + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html index b983d2ba4..2c16cf4c4 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.html @@ -11,7 +11,7 @@
- + @@ -40,25 +40,28 @@
-
- - -
+ -  {{master.city_name}} / {{master.state_name}}-{{master.pincode}} +  {{master.city_name}} / {{master.state_name}}-{{master.pincode}} + +
+ + +
+ - +

{{master.pd_contact_person}}   {{master.pd_contact_mobileno}} (Lender Contact Details)

-

{{master.product_name}} / {{master.subproduct_name}}

+

{{master.product_name}} / {{master.subproduct_name}}

{{master.pd_type_name}} /  {{master.loan_amount}}

-

{{master.addressline1}} , {{master.addressline2}} , {{master.addressline3}}

+

{{master.addressline1}}

Remarks : {{master.remarks}}

@@ -80,7 +83,7 @@

-  {{applicant.applicant_name}}     +  {{applicant.applicant_name}}      {{applicant.mobile_no}}
Main Applicant {{applicant.relation_name}} @@ -91,6 +94,30 @@

No Applicant

+
+ + +
+ +
+ + Additional Requirements + + + + + +

{{requirement.add_requirement}}

+
+
+
+

No Additional Requirements

+
+ + + + +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.scss index 2924cf6a5..85e145279 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.scss @@ -1,5 +1,7 @@ .cardEdit { - display: inline;float:right;padding-top:3%; + display: inline; + float:right; + padding-top:3%; } .minheight { min-height: 100%; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts index 5653b73b3..384506d25 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/view-pd/view-pd.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit,ViewEncapsulation, EventEmitter, Input, Output, OnDestroy } from '@angular/core'; +import { Component, OnInit,ViewEncapsulation, EventEmitter, Input, Output, OnDestroy, Pipe, PipeTransform } from '@angular/core'; import { FormBuilder, FormGroup, Validators, FormControl, FormArray } from '@angular/forms'; import { ActivatedRoute, Router } from '@angular/router'; import { MatDialog } from '@angular/material'; @@ -11,7 +11,9 @@ import { ListPdComponent } from '../list-pd.component'; import { SchedulePdComponent } from '../schedule-pd/schedule-pd.component'; import { EditPdApplicantComponent } from '../edit-pd-applicant/edit-pd-applicant.component'; import { EditPdMasterComponent } from '../edit-pd-master/edit-pd-master.component'; +import { PdRequirementComponent } from '../pd-requirement/pd-requirement.component'; +import {DatePipe } from '@angular/common'; @Component({ selector: 'app-view-pd', templateUrl: './view-pd.component.html', @@ -19,7 +21,7 @@ import { EditPdMasterComponent } from '../edit-pd-master/edit-pd-master.componen encapsulation: ViewEncapsulation.None }) export class ViewPdComponent implements OnInit, OnDestroy { - public selectedMoment = new Date(); + pipe = new DatePipe('en-US'); private notifier:NotifierService; errorMessage: any; pdMasterData: any=[]; @@ -27,11 +29,12 @@ export class ViewPdComponent implements OnInit, OnDestroy { pdDocumentsData: any=[]; masterPdLogsData: any=[]; applicantPDLogsData: any=[]; + pdAdditionalReqData: any=[]; viewID:string; viewParams:any; destroyType:number=1; currentPDStatus:string; - + enableStartPD: boolean; // create values for status check pdStatusCheck :any={ "DRAFT" :'DRAFT', @@ -48,14 +51,24 @@ export class ViewPdComponent implements OnInit, OnDestroy { public _EditPDtriggerForm:FormGroup; constructor(notifier:NotifierService,private dialog: MatDialog,private _fb: FormBuilder, private _pd: PdTrigerService,private route: ActivatedRoute,private router: Router, private ListPdComponent: ListPdComponent) { - this.notifier=notifier + this.notifier=notifier; + this.enableStartPD=false; } ngOnInit() { - this.ListPdComponent.showListView(false); this.route.params.subscribe(params => { this.viewID = params['pdid']; }); + let courrentDateTime: string = this.pipe.transform(new Date(), 'yyyy-MM-dd HH:mm'); + let scheduledDateTime: string="2018-12-03 08:20"; + let diffInMs: number = Date.parse(courrentDateTime) - Date.parse(scheduledDateTime); + let diffInHours: number = Math.floor(diffInMs / 1000 / 60 / 60); + if(diffInHours>=-4){ + this.enableStartPD=true; + } + else { + this.enableStartPD=false; + } this.viewPdDetails(this.viewID); } @@ -69,6 +82,7 @@ export class ViewPdComponent implements OnInit, OnDestroy { this.masterPdLogsData=data.records.pd_logs.master; //this.applicantPDLogsData= data.records.pd_logs.master; this.currentPDStatus = data.records.pd_master_details[0].pd_status; + this.pdAdditionalReqData = data.records.pd_additional_requirements; } }, error => this.errorMessage = error); } @@ -86,6 +100,8 @@ export class ViewPdComponent implements OnInit, OnDestroy { } const dialogPDMaster = this.dialog.open(EditPdMasterComponent, { data: record, + position: { right: '0'}, + width: '80%', disableClose: true }); dialogPDMaster.afterClosed() @@ -101,6 +117,8 @@ export class ViewPdComponent implements OnInit, OnDestroy { } const dialogApplicant = this.dialog.open(EditPdApplicantComponent, { data: setPdDetails, + position: { right: '0'}, + width: '60%', disableClose: true }); dialogApplicant.afterClosed() @@ -109,6 +127,24 @@ export class ViewPdComponent implements OnInit, OnDestroy { this.viewPdDetails(this.viewID) }); } + // edit pd addtional requirements + editAdditionalRequirement(requirementData:any){ + let setPdDetails = { + "pdID":this.viewID, + "records":requirementData + } + const dialogRequirement = this.dialog.open(PdRequirementComponent, { + data: setPdDetails, + position: { right: '0'}, + width: '60%', + disableClose: true + }); + dialogRequirement.afterClosed() + .subscribe(dataresult => { + // this.notifier.notify('success', 'Successfully allocated.!'); + this.viewPdDetails(this.viewID) + }); + } // pd allocation to pdAllocationTo(pdData:any) { if(pdData.fk_pd_type == 1){ diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts index 432694b66..60a7305a5 100755 --- a/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/manage-pd.module.ts @@ -67,6 +67,7 @@ import { PdReportComponent } from './list-pd/pd-report/pd-report.component'; import {RentalInfoComponent} from "./list-pd/start-pd/forms/rental-info/rental-info.component"; import { AllocationViewMoreComponent } from './list-pd/allocation-view-more/allocation-view-more.component'; +import { PdRequirementComponent } from './list-pd/pd-requirement/pd-requirement.component'; /** @@ -141,7 +142,7 @@ const pdCustomNotifierOptions: NotifierOptions = { // AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule, // OwlNativeDateTimeModule, // ], - declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent], + declarations: [RentalInfoComponent, TelePdAllocationComponent, FinancialInfoComponent, BusinessInfoComponent, EmploymentInfoComponent, StockComponent, BankingDetailsComponent, ListPdComponent, FamilyDetailsComponent, AddressComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, CurrentLoanComponent, AssetsInfoComponent, LoanDetailsComponent, OtherIncomeComponent, SupplierInfoComponent, PersonalInfoComponent, LenderRepresentativeComponent, PdReportComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent], // exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent], // providers: [PdTrigerService, GetGeometricLocationService], @@ -173,9 +174,9 @@ const pdCustomNotifierOptions: NotifierOptions = { OwlNativeDateTimeModule, ], // declarations: [ListPdComponent, ManagePdComponent, MapPdViewComponent, AddPdComponent, ViewPdComponent, PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, InprogressPdComponent, AllPdComponent, ScheduledPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, AssetsInfoComponent], - exports: [PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, AllocationViewMoreComponent], + exports: [PdAllocationComponent, SmartPdAllocationComponent, TelePdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent, ClientInfoComponent, SupplierInfoComponent, PersonalInfoComponent, CurrentLoanComponent, LoanDetailsComponent, OtherIncomeComponent, AssetsInfoComponent, AddressComponent, FamilyDetailsComponent, BankingDetailsComponent, StockComponent, EmploymentInfoComponent, BusinessInfoComponent, FinancialInfoComponent, LenderRepresentativeComponent,RentalInfoComponent, AssessedIncomeComponent, AllocationViewMoreComponent, PdRequirementComponent], providers: [PdTrigerService, GetGeometricLocationService], - entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, AllocationViewMoreComponent] + entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent, AllocationViewMoreComponent, PdRequirementComponent] }) export class ManagePdModule { } diff --git a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts index ced9ed0d4..93f3a277e 100755 --- a/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts +++ b/ng6-seed/src/app/personal-discussion/pd-service/pd-triger.service.ts @@ -367,6 +367,16 @@ convertNumberToWords(amount) { return words_string; } + // save additional requirements + saveAdditionalRequirements(saveData: any): Observable { + saveData.createdby = this._aws.getlocale(); + + return this._http.post(this.apiUrl+"savePDAdditionalRequiremets",{"records":saveData}) + .pipe( + catchError(this.handleError('operation', [])) + ) + } + // private handleError(operation = 'operation', result?: T) { // return (error: any): Observable => { // return of(result as T);