diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html index 70e06809f..a932c765d 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.html @@ -1,3 +1,4 @@ +

PD Address Details

@@ -116,7 +117,7 @@ - +
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts index 0ea3bafc5..58294fabb 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/address/address.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit, Inject, - Input + Input, ElementRef } from '@angular/core'; import { @@ -22,6 +22,7 @@ import { /** Service */ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import {ActivatedRoute, Router} from "@angular/router"; + @Component({ selector: 'app-address', templateUrl: './address.component.html', @@ -45,7 +46,7 @@ export class AddressComponent implements OnInit { public customerBehaviour: AbstractControl; - constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, + constructor(private el: ElementRef, notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, private router: Router, private _pd: PdTrigerService) { this.notifier = notifier; @@ -162,8 +163,7 @@ export class AddressComponent implements OnInit { } onSubmit() { if (!this.addressForm.valid) { - this.validateAllFormFields(this.addressForm); - return; + return; } console.log('form', this.addressForm.value); let records: any = {}; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html index d21a1d3ac..622f281b1 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.html @@ -1,3 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Banking Information

@@ -61,7 +130,7 @@
-
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts index b99d4d8e8..f832d64f4 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/banking-details/banking-details.component.ts @@ -39,6 +39,7 @@ export class BankingDetailsComponent implements OnInit { this.notifier = notifier; } + ngOnInit() { this.step = 0; this.initBankingForm(); @@ -48,32 +49,32 @@ export class BankingDetailsComponent implements OnInit { this._pd.retriveForm(params).subscribe(data => { console.log('data', data); const control = this.bankingForm.controls['itemRows']; - if( data.status == 200) { - - this.bankingForm.controls.banking_form_remark.setValue(data.records.banking_form_remark); - - var result = Object.keys(data.records.banking_details).map(function (key) { - return data.records.banking_details[key]; - }); - if (result.length == 0) { - control.push(this.createBankarray()); - } else { - result.forEach(datas => { - control.push(this.createBankarray()); - }); - this.bankingForm.controls.itemRows.setValue(result); - } - } else { - control.push(this.createBankarray()); - } + if (data.status == 200) { + this.bankingForm.controls.banking_form_remark.setValue(data.records.banking_form_remark); + var result = Object.keys(data.records.banking_details).map(function (key) { + return data.records.banking_details[key]; + }); + if (result.length == 0) { + control.push(this.createBankarray()); + } else { + result.forEach(datas => { + control.push(this.createBankarray()); + }); + this.bankingForm.controls.itemRows.setValue(result); + } + } else { + control.push(this.createBankarray()); + } }); } + public initBankingForm(): void { this.bankingForm = this.fb.group({ banking_form_remark: [''], itemRows: this.fb.array([]) }); } + createBankarray() { return this.fb.group({ applicant_name: ['', Validators.compose([Validators.required])], @@ -85,39 +86,44 @@ export class BankingDetailsComponent implements OnInit { vintage: ['', Validators.compose([Validators.required])], }); } - addBankdetails(index: any) { - console.log('index value -',index); - //this.step++; - this.step = index++; - console.log('step value -',this.step); + + addBankdetails(index, event) { + event.stopPropagation(); const control = this.bankingForm.controls['itemRows']; + let length = control.length; + this.step = length; control.push(this.createBankarray()); } + deleteBankdetails(index: number) { - console.log('index value -',index); + console.log('index value -', index); const control = this.bankingForm.controls['itemRows']; control.removeAt(index); } + setStep(index: number) { + this.step = index; + } + bankSubmit() { if (!this.bankingForm.valid) { - this.validateAllFormFields(this.bankingForm); - return; - } - let records: any = {}; - records.pdid = this.pdid; - records.formid = '7'; - records.banking_form_remark = this.bankingForm.controls.banking_form_remark.value; - // records.fk_createdby = '252'; - records.banking_details = this.bankingForm.controls['itemRows'].value; - console.log('data', records); - this._pd.saveForm(records).subscribe(data => { - console.log('data', data); - this.notifier.notify('success', 'Saved Successfully.'); - }, error => { - this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); - }); + return; + } + let records: any = {}; + records.pdid = this.pdid; + records.formid = '7'; + records.banking_form_remark = this.bankingForm.controls.banking_form_remark.value; + // records.fk_createdby = '252'; + records.banking_details = this.bankingForm.controls['itemRows'].value; + console.log('data', records); + this._pd.saveForm(records).subscribe(data => { + console.log('data', data); + this.notifier.notify('success', 'Saved Successfully.'); + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }); } + validateAllFormFields(formGroup: FormGroup) { Object.keys(formGroup.controls).forEach(field => { const control = formGroup.get(field); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html new file mode 100644 index 000000000..a508f499c --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.html @@ -0,0 +1,311 @@ + +

Business Details

+
+ + + + + + + + + {{list.name}} + + + + + {{type.name}} + + + + + + + +

Designation +

+ +

+
+ + + + + + + + + + +
+
+
+ + + Started by Applicant + Family Business + + + + + One of the applicants + Relative of an applicant + Others + + + + + + + + {{member.name}} + + + + + + + + + + +

Partners / Directors / Shareholders +

+ +

+
+ + + + + + + + + + + + + + + + +
+
+
+ + +

Employees As per applicant +

+ + + + + + + + + + + + + + + +

As per PD Officer +

+ + + + + + + + + + + + + + + +

Investments +

+ + + + + + + + + + + + +

Location +

+ + + + + Well Suited. + Fairly Suited + Not Suited + + + + + + +

Business Setup +

+ + + + + self owned + Rented + Family Owned + others + + + + + + + + + + + + +

Is the below documents seen and photo captured ? +

+ + + + + Yes + No + + + + + Yes + No + + + + + Yes + No + + + + + Yes + No + + + + + Yes + No + + + + + Yes + No + + + + + Yes + No + + + + + Yes + No + + +

+
+ + + + + +
+
+ +
+
+
+ + Remarks + + +
+
+ +
+
\ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.scss new file mode 100644 index 000000000..3be75d28c --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.scss @@ -0,0 +1,24 @@ +.address { + display: flex; + padding: 0 2%; + flex-direction: column; +} + +.address > * { + width: 100%; +} +.matcard > * { + width: 80%; +} +.card mat-form-field { + margin: 0 2%; +} +.matcard mat-form-field { + margin: 0 2%; +} +.address .button { + float: right; + width: 10px; + background: #62B013; + color: white; +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts new file mode 100644 index 000000000..624cb0caf --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/business-info/business-info.component.ts @@ -0,0 +1,291 @@ +import { + Component, + OnInit, + Inject, + Input +} from '@angular/core'; + +import { + FormBuilder, + FormGroup, + Validators, + FormArray, FormControl, AbstractControl, +} from '@angular/forms'; + +import { NotifierService } from 'angular-notifier'; + +import { + MatDialog, + MatDialogRef, + MAT_DIALOG_DATA +} from '@angular/material'; +/** Service */ +import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; +import {ActivatedRoute, Router} from "@angular/router"; + +@Component({ + selector: 'app-business-info', + templateUrl: './business-info.component.html', + styleUrls: ['./business-info.component.scss'] +}) +export class BusinessInfoComponent implements OnInit { + @Input() pdid: number; + @Input() form_id: number; + relationData: any = []; + industryData: any = []; + activityData: any = []; + relativeNames: any; + public businessForm: FormGroup; + private notifier: NotifierService; + + constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, + private router: Router, + private _pd: PdTrigerService) { + this.notifier = notifier; + } + ngOnInit() { + this.getRelation(); + this.getIndustry(); + this.getActivity(); + this.initBusinessForm(); + // const Desgn = this.businessForm.controls['designation']; + // const Partnr = this.businessForm.controls['partners']; + // const otherDoc = this.businessForm.controls['documents']; + let params: any = {}; + params.pd_id = this.pdid; + params.pd_form_id = this.form_id; + this._pd.retriveForm(params).subscribe(data => { + let businessVal = data.records; + console.log('data', businessVal); + let constVal: any; + const Desgn = this.businessForm.controls['designation']; + const Partnr = this.businessForm.controls['partners']; + const otherDoc = this.businessForm.controls['documents']; + + if (data.status == 200) { + let DocArray: any; + let DesgnArray = Object.keys(data.records.designation).map(function (key) { + return data.records.designation[key]; + }); + let PartnrArray = Object.keys(data.records.partners).map(function (key) { + return data.records.partners[key]; + }); + + let selectedMembers = Object.keys(data.records.family_members_involved).map(function (key) { + return data.records.family_members_involved[key]; + }); + let enduse: any = []; + selectedMembers.forEach(val => { + enduse.push(val.member); + }); + if (DesgnArray.length == 0) { + Desgn.push(this.createDesignation()); + } else { + Desgn.push(this.createDesignation()); + } + if (PartnrArray.length == 0) { + Partnr.push(this.createPartners()); + } else { + PartnrArray.forEach(datas => { + Partnr.push(this.createPartners()); + }); + } + if (data.other_documents == 'yes') { + DocArray = Object.keys(data.records.documents).map(function (key) { + return data.records.documents[key]; + }); + DocArray.forEach(datas => { + otherDoc.push(this.createDocument()); + }); + } else { + DocArray = [{document: ''}]; + otherDoc.push(this.createDocument()); + } + if (data.records.ownership_setup != 'others') { + businessVal.ownership_others = ''; + } + if (data.records.ownership_setup != 'rented') { + businessVal.rent_paid = ''; + } + businessVal.family_members_involved = enduse; + businessVal.pdid = this.pdid; + businessVal.formid = this.form_id; + businessVal.fk_createdby = this.pdid; + businessVal.designation = DesgnArray; + businessVal.partners = PartnrArray; + businessVal.documents = DocArray; + console.log('businessVal', businessVal); + + this.businessForm.setValue(businessVal); + } else { + Desgn.push(this.createDesignation()); + Partnr.push(this.createPartners()); + otherDoc.push(this.createDocument()); + } + + }); + // Desgn.push(this.createDesignation()); + // Partnr.push(this.createPartners()); + // otherDoc.push(this.createDocument()); + } + public initBusinessForm(): void { + this.businessForm = this.fb.group({ + pdid: this.pdid, + formid: this.form_id, + fk_createdby: this.pdid, + profession_name: ['', Validators.compose([Validators.required])], + business_years: ['', Validators.compose([Validators.required])], + industry: ['', Validators.compose([Validators.required])], + type_of_activity: ['', Validators.compose([Validators.required])], + seasonality: ['', Validators.compose([Validators.required])], + designation: this.fb.array([]), + partners: this.fb.array([]), + employees_total: ['', Validators.compose([Validators.required])], + employees_permanent: ['', Validators.compose([Validators.required])], + employees_temporary: ['', Validators.compose([Validators.required])], + officer_total: ['', Validators.compose([Validators.required])], + officer_permanent: ['', Validators.compose([Validators.required])], + officer_temporary: ['', Validators.compose([Validators.required])], + invested_amount: ['', Validators.compose([Validators.required])], + working_capital: ['', Validators.compose([Validators.required])], + is_service_provided: ['', Validators.compose([Validators.required])], + ownership_setup: ['', Validators.compose([Validators.required])], + ownership_others: [''], + rent_paid: [''], + shop_eat_act_cert: ['', Validators.compose([Validators.required])], + gst_Regn_cert: ['', Validators.compose([Validators.required])], + export_import_cert: ['', Validators.compose([Validators.required])], + factory_cert: ['', Validators.compose([Validators.required])], + practice_cert: ['', Validators.compose([Validators.required])], + pf_regn: ['', Validators.compose([Validators.required])], + esic_regn: ['', Validators.compose([Validators.required])], + other_documents: ['', Validators.compose([Validators.required])], + documents: this.fb.array([]), + business_remarks: ['', Validators.compose([Validators.required])], + who_started: ['', Validators.compose([Validators.required])], + main_person: ['', Validators.compose([Validators.required])], + other_main_person: [''], + family_members_involved: ['', Validators.compose([Validators.required])], + before_business: ['', Validators.compose([Validators.required])], + any_delays: ['', Validators.compose([Validators.required])], + }); + } + createDesignation(): FormGroup { + return this.fb.group({ + sec_name: ['', Validators.compose([Validators.required])], + sec_designation: ['', Validators.compose([Validators.required])], + }); + } + createPartners(): FormGroup { + return this.fb.group({ + partner_name: ['', Validators.compose([Validators.required])], + shareholding: ['', Validators.compose([Validators.required])], + current_business_experiance: ['', Validators.compose([Validators.required])], + total_business_experiance: ['', Validators.compose([Validators.required])], + }); + } + createDocument() { + return this.fb.group({ + document: [''] + }); + } + addDesignation() { + const control = this.businessForm.controls['designation']; + control.push(this.createDesignation()); + } + deleteDesignation(index) { + const control = this.businessForm.controls['designation']; + control.removeAt(index); + } + addPartnerDetails() { + const control = this.businessForm.controls['partners']; + control.push(this.createPartners()); + } + deletePartnerDetails(index) { + const control = this.businessForm.controls['partners']; + control.removeAt(index); + } + addDocuments() { + const control = this.businessForm.controls['documents']; + control.push(this.createDocument()); + } + deleteDocuments(index) { + const control = this.businessForm.controls['documents']; + control.removeAt(index); + } + getRelation() { + let master_name = 'RELATIONSHIPS'; + this._pd.getAllMasterDatas(master_name).subscribe(data => { + console.log('data', data); + data.records.forEach(val => { + if (val.isactive == 1) { + this.relationData.push(val); + } + }) + }); + } + relationChanged(event) { + this.relativeNames = []; + event.value.forEach(option => { + this.relativeNames.push({member: option}); + }); + } + getIndustry() { + let master_name = 'INDUSTRYCLASSIFICATION'; + this._pd.getAllMasterDatas(master_name).subscribe(data => { + console.log('data', data); + data.records.forEach(val => { + if (val.isactive == 1) { + this.industryData.push(val); + } + }) + }); + } + getActivity() { + let master_name = 'TYPEOFACTIVITY'; + this._pd.getAllMasterDatas(master_name).subscribe(data => { + console.log('data', data); + data.records.forEach(val => { + if (val.isactive == 1) { + this.activityData.push(val); + } + }) + }); + } + submitDetails() { + let family: any = []; + if (!this.businessForm.valid) { + console.log('form', this.businessForm) + return; + } + let design: any; + let records = this.businessForm.value; + if (records.other_documents == 'no') { + delete records.documents; + } + if (records.rent_paid == '') { + delete records.rent_paid; + } + if (records.ownership_others == '') { + delete records.ownership_others; + } + records.family_members_involved = this.relativeNames; + console.log('recordss', records); + this._pd.saveForm(records).subscribe(data => { + console.log('data', data); + this.notifier.notify('success', 'Saved Successfully.'); + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }); + } + validateAllFormFields(formGroup: FormGroup) { + 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); + } + }); + } +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts index 5e373360f..cc1911240 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/client-info/client-info.component.ts @@ -200,12 +200,10 @@ var result = Object.keys(supp_data).map(function(key) { this.paymentModeTextBox = e.value; // this.f.supplier_details.controls.get('payment_mode_value'); } - public freqPurchaseTextBox: number; selectedFreqPurchase(e){ this.freqPurchaseTextBox = e.value; } - /** To Save/Edited Popup Data */ onSubmit() { @@ -216,10 +214,10 @@ var result = Object.keys(supp_data).map(function(key) { } else { var answerFormValues = this._supplierQuesFrom.value; - //To Remove The "Null" With Key also + // To Remove The "Null" With Key also Object.keys(answerFormValues).forEach((key) => (answerFormValues[key] == null) && delete answerFormValues[key]); alert(JSON.stringify(answerFormValues)); - //Add BRANCH data with help Service File + // Add BRANCH data with help Service File this.pdTrigerService.savePDFormDetailsWithID(answerFormValues).subscribe( dataresult => { if (dataresult.status == 200) { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.html index 46b35754a..ca8fb72ff 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.html @@ -47,8 +47,16 @@
+
+
+ + Remarks + + +
+
-
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.scss index 77cadfaa7..345378a3b 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.scss @@ -13,7 +13,6 @@ } .address .button { float: right; - height: 10px; width: 10px; background: #62B013; color: white; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts index 30248aa13..a1a4b369b 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/current-loan/current-loan.component.ts @@ -22,6 +22,7 @@ import { /** Service */ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import {ActivatedRoute, Router} from "@angular/router"; + @Component({ selector: 'app-current-loan', templateUrl: './current-loan.component.html', @@ -52,6 +53,7 @@ export class CurrentLoanComponent implements OnInit { return value.records.loan_details[key]; }); this.currentLoanForm.controls['existing_loan'].setValue(value.records.existing_loan); + this.currentLoanForm.controls['currentloan_remarks'].setValue(value.records.currentloan_remarks); if (result.length > 0) { result.forEach(val => { control.push(this.createLoanDetail()); @@ -68,7 +70,8 @@ export class CurrentLoanComponent implements OnInit { public initCurrentloanForm(): void { this.currentLoanForm = this.fb.group({ existing_loan: ['', Validators.compose([Validators.required])], - loan_details: this.fb.array([]) + currentloan_remarks: ['', Validators.compose([Validators.required])], + loan_details: this.fb.array([]), }); } createLoanDetail() { @@ -91,14 +94,14 @@ export class CurrentLoanComponent implements OnInit { } submitCurrentloan() { if (!this.currentLoanForm.valid) { - this.validateAllFormFields(this.currentLoanForm); - return; + return; } let records: any = {}; records.pdid = this.pdid; records.formid = this.form_id; records.fk_createdby = this.pdid; records.existing_loan = this.currentLoanForm.controls['existing_loan'].value; + records.currentloan_remarks = this.currentLoanForm.controls['currentloan_remarks'].value; records.loan_details = this.currentLoanForm.controls['loan_details'].value; console.log('data', records); this._pd.saveForm(records).subscribe(data => { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.html new file mode 100644 index 000000000..0f16f392e --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.html @@ -0,0 +1,76 @@ + +
+ + + + + + + + + Yes + No + + + + + + + + Yes + No + + + + + + + + Yes + No + + + + + Yes + No + + + + +

Salary Details

+ + + + + + + + + + + + + + + + + +

+
+ + Remarks + + +
+
+ + +
\ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.scss new file mode 100644 index 000000000..8c61eec1d --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.scss @@ -0,0 +1,21 @@ +.address { + display: flex; + padding: 0 2%; + flex-direction: column; +} + +.address > * { + width: 100%; +} +.matcard > * { + width: 80%; +} +.matcard mat-form-field { + margin: 0 2%; +} +.address .button { + float: right; + width: 10px; + background: #62B013; + color: white; +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts new file mode 100644 index 000000000..2a95ace92 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/employment-info/employment-info.component.ts @@ -0,0 +1,121 @@ +import { + Component, + OnInit, + Inject, + Input +} from '@angular/core'; + +import { + FormBuilder, + FormGroup, + Validators, + FormArray, FormControl, +} from '@angular/forms'; + +import { NotifierService } from 'angular-notifier'; + +import { + MatDialog, + MatDialogRef, + MAT_DIALOG_DATA +} from '@angular/material'; +/** Service */ +import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; +import {ActivatedRoute, Router} from '@angular/router'; + +@Component({ + selector: 'app-employment-info', + templateUrl: './employment-info.component.html', + styleUrls: ['./employment-info.component.scss'] +}) +export class EmploymentInfoComponent implements OnInit { + @Input() pdid: number; + @Input() form_id: number; + public employmentForm: FormGroup; + private notifier: NotifierService; + + constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, + private router: Router, + private _pd: PdTrigerService) { + this.notifier = notifier; + } + ngOnInit() { + this.initemploymentForm(); + let params: any = {}; + params.pd_id = this.pdid; + params.pd_form_id = this.form_id; + this._pd.retriveForm(params).subscribe(value => { + console.log('value', value); + if (value.status == 200) { + this.employmentForm.controls['employer_name'].setValue(value.records.employer_name); + this.employmentForm.controls['how_long'].setValue(value.records.how_long); + this.employmentForm.controls['was_met'].setValue(value.records.was_met); + if (value.records.name_designation) { + this.employmentForm.controls['name_designation'].setValue(value.records.name_designation); + } + this.employmentForm.controls['confirm_salary'].setValue(value.records.confirm_salary); + if (value.records.confirm_salary_amount) { + this.employmentForm.controls['confirm_salary_amount'].setValue(value.records.confirm_salary_amount); + } + this.employmentForm.controls['attendance_seen'].setValue(value.records.attendance_seen); + this.employmentForm.controls['sal_reg_seen'].setValue(value.records.sal_reg_seen); + this.employmentForm.controls['gross'].setValue(value.records.gross); + this.employmentForm.controls['net_take_home'].setValue(value.records.net_take_home); + this.employmentForm.controls['bonus_incentive'].setValue(value.records.bonus_incentive); + this.employmentForm.controls['any_delays'].setValue(value.records.any_delays); + this.employmentForm.controls['employment_remarks'].setValue(value.records.employment_remarks); + } + }) + } + public initemploymentForm(): void { + this.employmentForm = this.fb.group({ + employer_name: ['', Validators.compose([Validators.required])], + how_long: ['', Validators.compose([Validators.required])], + was_met: ['', Validators.compose([Validators.required])], + name_designation: [''], + confirm_salary: ['', Validators.compose([Validators.required])], + confirm_salary_amount: [''], + attendance_seen: ['', Validators.compose([Validators.required])], + sal_reg_seen: ['', Validators.compose([Validators.required])], + gross: ['', Validators.compose([Validators.required])], + net_take_home: ['', Validators.compose([Validators.required])], + bonus_incentive: ['', Validators.compose([Validators.required])], + any_delays: ['', Validators.compose([Validators.required])], + employment_remarks: ['', Validators.compose([Validators.required])], + }); + } + submitDetails() { + if (!this.employmentForm.valid) { + return; + } + let records: any = {}; + records.pdid = this.pdid; + records.formid = this.form_id; + records.fk_createdby = this.pdid; + records.employer_name = this.employmentForm.controls['employer_name'].value; + records.how_long = this.employmentForm.controls['how_long'].value; + records.was_met = this.employmentForm.controls['was_met'].value; + if (this.employmentForm.controls['was_met'].value == 'yes') { + records.name_designation = this.employmentForm.controls['name_designation'].value; + } + records.confirm_salary = this.employmentForm.controls['confirm_salary'].value; + if (this.employmentForm.controls['confirm_salary'].value == 'yes') { + records.confirm_salary_amount = this.employmentForm.controls['confirm_salary_amount'].value; + } + records.attendance_seen = this.employmentForm.controls['attendance_seen'].value; + records.sal_reg_seen = this.employmentForm.controls['sal_reg_seen'].value; + records.gross = this.employmentForm.controls['gross'].value; + records.net_take_home = this.employmentForm.controls['net_take_home'].value; + records.bonus_incentive = this.employmentForm.controls['bonus_incentive'].value; + records.any_delays = this.employmentForm.controls['any_delays'].value; + records.employment_remarks = this.employmentForm.controls['employment_remarks'].value; + console.log('data', records); + this._pd.saveForm(records).subscribe(data => { + console.log('data', data); + this.notifier.notify('success', 'Saved Successfully.'); + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }) + } + +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html index 90262f5f6..f62fc181e 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.html @@ -1,3 +1,4 @@ +

Family Details

@@ -145,7 +146,6 @@ -
diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts index c37f8e968..5d7148a1c 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/family-details/family-details.component.ts @@ -22,6 +22,7 @@ import { /** Service */ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import {ActivatedRoute, Router} from "@angular/router"; + @Component({ selector: 'app-family-details', templateUrl: './family-details.component.html', @@ -194,8 +195,7 @@ export class FamilyDetailsComponent implements OnInit { } submitFamily() { if (!this.familyForm.valid) { - this.validateAllFormFields(this.familyForm); - return; + return; } console.log('data', this.familyForm.value); let records: any = {}; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html new file mode 100644 index 000000000..720f89fc3 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.html @@ -0,0 +1,90 @@ + +
+ + +

Data as per Financial statements

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + +

Estimated Value

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + Remarks + + +
+
+ +
+
\ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.scss new file mode 100644 index 000000000..efbc1400d --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.scss @@ -0,0 +1,21 @@ +.address { + display: flex; + padding: 0 2%; + flex-direction: column; +} + +.address > * { + width: 100%; +} +.matcard mat-form-field { + margin: 0 2%; +} +.address .button { + float: right; + width: 10px; + background: #62B013; + color: white; +} +.highlight { + color: red; +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts new file mode 100644 index 000000000..41e4e8014 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/financial-info/financial-info.component.ts @@ -0,0 +1,195 @@ +import { + Component, + OnInit, + Inject, + Input +} from '@angular/core'; + +import { + FormBuilder, + FormGroup, + Validators, + FormArray, FormControl, AbstractControl, +} from '@angular/forms'; + +import { NotifierService } from 'angular-notifier'; + +import { + MatDialog, + MatDialogRef, + MAT_DIALOG_DATA +} from '@angular/material'; +/** Service */ +import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; +import {ActivatedRoute, Router} from '@angular/router'; + +@Component({ + selector: 'app-financial-info', + templateUrl: './financial-info.component.html', + styleUrls: ['./financial-info.component.scss'] +}) +export class FinancialInfoComponent implements OnInit { + @Input() pdid: number; + @Input() form_id: number; + public financialForm: FormGroup; + private notifier: NotifierService; + marginVal: any = [] ; + setmargin: AbstractControl; + constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, + private router: Router, + private _pd: PdTrigerService) { + this.notifier = notifier; + } + ngOnInit() { + this.initstockForm(); + let params: any = {}; + params.pd_id = this.pdid; + params.pd_form_id = this.form_id; + this._pd.retriveForm(params).subscribe(value => { + console.log('value', value); + const financial_date = this.financialForm.controls['date_per_financial']; + const estimated_val = this.financialForm.controls['estimated_value']; + if (value.status == 200) { + let retriveData = value.records; + let result = Object.keys(value.records.date_per_financial).map(function(key) { + return value.records.date_per_financial[key]; + }); + let result_val = Object.keys(value.records.estimated_value).map(function(key) { + return value.records.estimated_value[key]; + }); + if (result.length > 0) { + result.forEach(val => { + financial_date.push(this.createDate()); + }); + retriveData.date_per_financial = result; + } else { + financial_date.push(this.createDate()); + } + if (result_val.length > 0) { + result_val.forEach(val => { + estimated_val.push(this.createValue()); + }); + retriveData.estimated_value = result_val; + } else { + estimated_val.push(this.createValue()); + } + retriveData.pdid = this.pdid; + retriveData.formid = this.form_id; + retriveData.fk_createdby = this.pdid; + this.financialForm.setValue(retriveData); + } else { + financial_date.push(this.createDate()); + estimated_val.push(this.createValue()); + } + }) + } + public initstockForm(): void { + this.financialForm = this.fb.group({ + pdid: this.pdid, + formid: this.form_id, + fk_createdby: this.pdid, + financial_remarks: ['', Validators.compose([Validators.required])], + date_per_financial: this.fb.array([]), + estimated_value: this.fb.array([]) + }); + } + createDate() { + return this.fb.group({ + financial_year: ['', Validators.compose([Validators.required, Validators.pattern(/^[0-9]{4}-[0-9]{2}$/)])], + financial_annual_sale: ['', Validators.compose([Validators.required, Validators.pattern(/^[0-9\(\)]+$/)])], + financial_net_profit: ['', Validators.compose([Validators.required, Validators.pattern(/^-?[1-9]\d*|0$/)])], + financial_margin: ['', Validators.compose([Validators.required])], + financial_variation: [''], + financial_reason: ['', Validators.compose([Validators.required])], + }); + } + createValue() { + return this.fb.group({ + estimate_year: ['', Validators.compose([Validators.required, Validators.pattern(/^[0-9]{4}-[0-9]{2}$/)])], + estimate_annual_sale: ['', Validators.compose([Validators.required, Validators.pattern(/^[0-9\(\)]+$/)])], + estimate_net_profit: ['', Validators.compose([Validators.required, Validators.pattern(/^-?[1-9]\d*|0$/)])], + estimate_margin: ['', Validators.compose([Validators.required])], + estimate_variation: [''], + estimate_reason: ['', Validators.compose([Validators.required])], + }); + } + addDate() { + const control = this.financialForm.controls['date_per_financial']; + control.push(this.createDate()); + } + deleteDate(index) { + const control = this.financialForm.controls['date_per_financial']; + control.removeAt(index); + } + addGoods() { + const control = this.financialForm.controls['estimated_value']; + control.push(this.createValue()); + } + deleteGoods(index) { + const control = this.financialForm.controls['estimated_value']; + control.removeAt(index); + } + calYearVariation(index, detail) { + let profit = detail.value.financial_net_profit; + if ( profit != '' && index != 0) { + console.log('value') + let array = this.financialForm.controls['date_per_financial'] + let prev_profit = array.value[index - 1].financial_net_profit; + let variation = profit - prev_profit / prev_profit * 100; + detail.controls.financial_variation.setValue(variation.toFixed(2)) + // detail.controls.financial_variation.disable() + } + } + calMargin(index, detail) { + console.log('detail', detail); + let salary = detail.value.financial_annual_sale; + let profit = detail.value.financial_net_profit; + if (salary != '' && profit != '') { + let margin = profit / salary * 100; + detail.controls.financial_margin.setValue(margin.toFixed(2)) + // detail.controls.financial_margin.disable() + } + } + calVariation(index, detail) { + let profit = detail.value.estimate_net_profit; + if ( profit != '' && index != 0) { + let array = this.financialForm.controls['estimated_value'] + let prev_profit = array.value[index - 1].estimate_net_profit; + let variation = profit - prev_profit / prev_profit * 100; + detail.controls.estimate_variation.setValue(variation.toFixed(2)) + // detail.controls.estimate_variation.disable() + } + } + calMarginVal(index, detail) { + let salary = detail.value.estimate_annual_sale; + let profit = detail.value.estimate_net_profit; + if (salary != '' && profit != '') { + let margin = profit / salary * 100; + detail.controls.estimate_margin.setValue(margin.toFixed(2)) + // detail.controls.estimate_margin.disable() + } + } + submitDetails() { + if (!this.financialForm.valid) { + return; + } + let records = this.financialForm.value; + console.log('data', records); + this._pd.saveForm(records).subscribe(data => { + console.log('data', data); + this.notifier.notify('success', 'Saved Successfully.'); + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }) + } + validateAllFormFields(formGroup: FormGroup) { + 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); + } + }); + } +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html index 76554034b..dd8ad6799 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.html @@ -1,48 +1,125 @@ - \ No newline at end of file +
+
+ + Remarks + + +
+
+ + +
\ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.scss index 345378a3b..fce74bbc3 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.scss @@ -7,6 +7,9 @@ .address > * { width: 100%; } +.matcard > * { + width: 80%; +} .matcard mat-form-field { margin: 0 2%; width:26%; diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts index 9bc956f27..01648a36d 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/loan-details/loan-details.component.ts @@ -22,6 +22,7 @@ import { /** Service */ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import {ActivatedRoute, Router} from '@angular/router'; + @Component({ selector: 'app-loan-details', templateUrl: './loan-details.component.html', @@ -30,74 +31,167 @@ import {ActivatedRoute, Router} from '@angular/router'; export class LoanDetailsComponent implements OnInit { public loanDetailsForm: FormGroup; private notifier: NotifierService; - frequencyData: any; - + @Input() pdid: number; + @Input() form_id: number; + @Input() applicant_details: any; + applicants: any; + isOtherPurpose: boolean = false; + isSource: boolean = false; + endUserList: any = []; + ownerNames: any = []; constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, private router: Router, private _pd: PdTrigerService) { + this.notifier = notifier; } ngOnInit() { + this.applicants = this.applicant_details.pdapplicants_detials; this.initloanDetailsForm(); - // this.getFrequency(); + let params: any = {}; + params.pd_id = this.pdid; + params.pd_form_id = this.form_id; + this._pd.retriveForm(params).subscribe(value => { + console.log('value', value); + if (value.status == 200) { + let result = Object.keys(value.records.end_use_group).map(function(key) { + return value.records.end_use_group[key]; + }); + let owner = Object.keys(value.records.owner_name_group).map(function(key) { + return value.records.owner_name_group[key]; + }); + + let enduse: any = []; + result.forEach(val => { + enduse.push(val.end_use); + }); + let ownername: any = []; + owner.forEach(val => { + ownername.push(val.owner_name); + }); + console.log('enduse', enduse); + console.log('ownername', ownername); + this.loanDetailsForm.controls['loan_amount'].setValue(value.records.loan_amount); + this.loanDetailsForm.controls['end_use'].setValue(enduse); + if (value.records.end_use_other) { + this.loanDetailsForm.controls['end_use_other'].setValue(value.records.end_use_other); + } + this.loanDetailsForm.controls['is_transfer'].setValue(value.records.is_transfer); + this.loanDetailsForm.controls['is_topup'].setValue(value.records.is_topup); + if (value.records.balance_transfer_amount) { + this.loanDetailsForm.controls['balance_transfer_amount'].setValue(value.records.balance_transfer_amount); + } + if (value.records.topup_amount) { + this.loanDetailsForm.controls['topup_amount'].setValue(value.records.topup_amount); + } + if (value.records.lender) { + this.loanDetailsForm.controls['lender'].setValue(value.records.lender); + } + this.loanDetailsForm.controls['own_contribution'].setValue(value.records.own_contribution); + this.loanDetailsForm.controls['source'].setValue(value.records.source); + if (value.records.lender_name_type) { + this.loanDetailsForm.controls['lender_name_type'].setValue(value.records.lender_name_type); + } + this.loanDetailsForm.controls['emi_level'].setValue(value.records.emi_level); + this.loanDetailsForm.controls['property_type'].setValue(value.records.property_type); + this.loanDetailsForm.controls['owner_name'].setValue(ownername); + this.loanDetailsForm.controls['construction_status'].setValue(value.records.construction_status); + this.loanDetailsForm.controls['emv_per_customer'].setValue(value.records.emv_per_customer); + this.loanDetailsForm.controls['value_per_agreement'].setValue(value.records.value_per_agreement); + this.loanDetailsForm.controls['loandetails_remarks'].setValue(value.records.loandetails_remarks); + } + }) } public initloanDetailsForm(): void { this.loanDetailsForm = this.fb.group({ - other_income: ['', Validators.compose([Validators.required])], - // income_details: this.fb.array([this.createDetail()]) + loan_amount: ['', Validators.compose([Validators.required])], + end_use: ['', Validators.compose([Validators.required])], + end_use_other: [''], + is_transfer: ['', Validators.compose([Validators.required])], + is_topup: ['', Validators.compose([Validators.required])], + balance_transfer_amount: [''], + topup_amount: [''], + lender: [''], + own_contribution: ['', Validators.compose([Validators.required])], + source: ['', Validators.compose([Validators.required])], + lender_name_type: [''], + emi_level: ['', Validators.compose([Validators.required])], + property_type: ['', Validators.compose([Validators.required])], + owner_name: ['', Validators.compose([Validators.required])], + construction_status: ['', Validators.compose([Validators.required])], + emv_per_customer: ['', Validators.compose([Validators.required])], + value_per_agreement: ['', Validators.compose([Validators.required])], + loandetails_remarks: ['', Validators.compose([Validators.required])], + }); + } + endUserChange(event) { + this.endUserList = []; + event.value.forEach(option => { + this.endUserList.push({end_use: option}); + if (option == 'other') { + this.isOtherPurpose = true; + } + }); + } + ownerNameChange(event) { + this.ownerNames = []; + event.value.forEach(option => { + this.ownerNames.push({owner_name: option}); + }); + } + submitLoanDetails() { + console.log('formData', this.loanDetailsForm.value); + if (!this.loanDetailsForm.valid) { + return; + } + let records: any = {}; + records.pdid = this.pdid; + records.formid = this.form_id; + records.fk_createdby = this.pdid; + records.loan_amount = this.loanDetailsForm.controls['loan_amount'].value; + records.end_use_group = this.endUserList; + if (this.isOtherPurpose) { + records.end_use_other = this.loanDetailsForm.controls['end_use_other'].value; + } + records.is_transfer = this.loanDetailsForm.controls['is_transfer'].value; + records.is_topup = this.loanDetailsForm.controls['is_topup'].value; + if (this.loanDetailsForm.controls['is_transfer'].value == 'yes') { + records.balance_transfer_amount = this.loanDetailsForm.controls['balance_transfer_amount'].value; + } + if (this.loanDetailsForm.controls['is_topup'].value == 'yes') { + records.topup_amount = this.loanDetailsForm.controls['topup_amount'].value; + } + if (this.loanDetailsForm.controls['is_topup'].value == 'yes' || this.loanDetailsForm.controls['is_transfer'].value == 'yes') { + records.lender = this.loanDetailsForm.controls['lender'].value; + } + records.own_contribution = this.loanDetailsForm.controls['own_contribution'].value; + records.source = this.loanDetailsForm.controls['source'].value; + if (this.loanDetailsForm.controls['source'].value == 'other') { + records.lender_name_type = this.loanDetailsForm.controls['lender_name_type'].value; + } + records.emi_level = this.loanDetailsForm.controls['emi_level'].value; + records.property_type = this.loanDetailsForm.controls['property_type'].value; + records.owner_name_group = this.ownerNames; + records.construction_status = this.loanDetailsForm.controls['construction_status'].value; + records.emv_per_customer = this.loanDetailsForm.controls['emv_per_customer'].value; + records.value_per_agreement = this.loanDetailsForm.controls['value_per_agreement'].value; + records.loandetails_remarks = this.loanDetailsForm.controls['loandetails_remarks'].value; + console.log('data', records); + this._pd.saveForm(records).subscribe(data => { + console.log('data', data); + this.notifier.notify('success', 'Saved Successfully.'); + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }) + } + validateAllFormFields(formGroup: FormGroup) { + 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); + } }); } - // createDetail() { - // return this.fb.group({ - // source: ['', Validators.compose([Validators.required])], - // amount: ['', Validators.compose([Validators.required])], - // frequency: ['', Validators.compose([Validators.required])], - // }); - // } - // getFrequency() { - // let master_name = 'FREQUENCY'; - // this._pd.getAllMasterDatas(master_name).subscribe(data => { - // console.log('data', data); - // data.records.forEach(val => { - // if (val.isactive == 1) { - // this.frequencyData.push(val); - // } - // }) - // }); - // } - // addIncomeDetails() { - // const control = this.otherIncomeForm.controls['income_details']; - // control.push(this.createDetail()); - // } - // deleteIncomeDetails(index) { - // const control = this.otherIncomeForm.controls['income_details']; - // control.removeAt(index); - // } - // submitCurrentDetails() { - // if (!this.otherIncomeForm.valid) { - // this.validateAllFormFields(this.otherIncomeForm); - // return; - // } - // let records: any = {}; - // records.pdid = '25‎4'; - // records.formid = '25‎4'; - // records.fk_createdby = '25‎4'; - // records.other_income = this.otherIncomeForm.controls['other_income'].value; - // records.income_details = this.otherIncomeForm.controls['income_details'].value; - // console.log('data', records); - // this._pd.saveForm(records).subscribe(data => { - // console.log('data', data); - // this.notifier.notify('success', 'Saved Successfully.'); - // }) - // } - // validateAllFormFields(formGroup: FormGroup) { - // 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); - // } - // }); - // } } diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html index d5cccc6d5..fc82feab0 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.html @@ -1,3 +1,21 @@ + + + + + + + + + + + + + + + + + +

Other Income Details

@@ -9,6 +27,34 @@ No + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Income Details

@@ -46,6 +92,14 @@ +

+
+ + Remarks + + +
+
@@ -53,4 +107,3 @@ - diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.scss index 100dc0b17..db319b869 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.scss +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.scss @@ -13,7 +13,6 @@ .address .button { float: right; width: 10px; - height: 10px; background: #62B013; color: white; } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts index 49ddd9cf3..fc5435bf7 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/other-income/other-income.component.ts @@ -22,6 +22,7 @@ import { /** Service */ import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import {ActivatedRoute, Router} from '@angular/router'; + @Component({ selector: 'app-other-income', templateUrl: './other-income.component.html', @@ -53,6 +54,7 @@ export class OtherIncomeComponent implements OnInit { return value.records.income_details[key]; }); this.otherIncomeForm.controls['other_income'].setValue(value.records.other_income); + this.otherIncomeForm.controls['otherincome_remarks'].setValue(value.records.otherincome_remarks); if (result.length > 0) { result.forEach(val => { control.push(this.createDetail()); @@ -69,6 +71,7 @@ export class OtherIncomeComponent implements OnInit { public initOtherincomeForm(): void { this.otherIncomeForm = this.fb.group({ other_income: ['', Validators.compose([Validators.required])], + otherincome_remarks: ['', Validators.compose([Validators.required])], income_details: this.fb.array([]) }); } @@ -100,14 +103,14 @@ export class OtherIncomeComponent implements OnInit { } submitCurrentDetails() { if (!this.otherIncomeForm.valid) { - this.validateAllFormFields(this.otherIncomeForm); - return; + return; } let records: any = {}; records.pdid = this.pdid; records.formid = this.form_id; records.fk_createdby = this.pdid; records.other_income = this.otherIncomeForm.controls['other_income'].value; + records.otherincome_remarks = this.otherIncomeForm.controls['otherincome_remarks'].value; records.income_details = this.otherIncomeForm.controls['income_details'].value; console.log('data', records); this._pd.saveForm(records).subscribe(data => { diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html new file mode 100644 index 000000000..3a55530a2 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.html @@ -0,0 +1,86 @@ + +
+ + + +

Raw Materials

+ +

+
+ + + + + + + + + + + + + + + + + + + + +
+
+
+ + +

Finished Goods

+ +

+
+ + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + Remarks + + +
+
+ +
+
\ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.scss new file mode 100644 index 000000000..db319b869 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.scss @@ -0,0 +1,18 @@ +.address { + display: flex; + padding: 0 2%; + flex-direction: column; +} + +.address > * { + width: 100%; +} +.matcard mat-form-field { + margin: 0 2%; +} +.address .button { + float: right; + width: 10px; + background: #62B013; + color: white; +} \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts new file mode 100644 index 000000000..aaddf2420 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/stock/stock.component.ts @@ -0,0 +1,151 @@ +import { + Component, + OnInit, + Inject, + Input +} from '@angular/core'; + +import { + FormBuilder, + FormGroup, + Validators, + FormArray, FormControl, +} from '@angular/forms'; + +import { NotifierService } from 'angular-notifier'; + +import { + MatDialog, + MatDialogRef, + MAT_DIALOG_DATA +} from '@angular/material'; +/** Service */ +import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; +import {ActivatedRoute, Router} from '@angular/router'; + +@Component({ + selector: 'app-stock', + templateUrl: './stock.component.html', + styleUrls: ['./stock.component.scss'] +}) +export class StockComponent implements OnInit { + @Input() pdid: number; + @Input() form_id: number; + public stockForm: FormGroup; + private notifier: NotifierService; + + constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, + private router: Router, + private _pd: PdTrigerService) { + this.notifier = notifier; + } + ngOnInit() { + this.initstockForm(); + let params: any = {}; + params.pd_id = this.pdid; + params.pd_form_id = this.form_id; + this._pd.retriveForm(params).subscribe(value => { + console.log('value', value); + const rawMaterial = this.stockForm.controls['raw_materials']; + const finishedGoods = this.stockForm.controls['finished_goods']; + if (value.status == 200) { + let result = Object.keys(value.records.raw_materials).map(function(key) { + return value.records.raw_materials[key]; + }); + let result_Goods = Object.keys(value.records.finished_goods).map(function(key) { + return value.records.finished_goods[key]; + }); + this.stockForm.controls['stock_remarks'].setValue(value.records.stock_remarks); + if (result.length > 0) { + result.forEach(val => { + rawMaterial.push(this.createRawmaterial()); + }); + this.stockForm.controls['raw_materials'].setValue(result); + } else { + rawMaterial.push(this.createRawmaterial()); + } + if (result_Goods.length > 0) { + result_Goods.forEach(val => { + finishedGoods.push(this.createGoods()); + }); + this.stockForm.controls['finished_goods'].setValue(result_Goods); + } else { + finishedGoods.push(this.createGoods()); + } + } else { + rawMaterial.push(this.createRawmaterial()); + finishedGoods.push(this.createGoods()); + } + }) + } + public initstockForm(): void { + this.stockForm = this.fb.group({ + stock_remarks: ['', Validators.compose([Validators.required])], + raw_materials: this.fb.array([]), + finished_goods: this.fb.array([]) + }); + } + createRawmaterial() { + return this.fb.group({ + raw_name: ['', Validators.compose([Validators.required])], + raw_quantity: ['', Validators.compose([Validators.required])], + raw_value: ['', Validators.compose([Validators.required])], + rawmaterial_value: ['', Validators.compose([Validators.required])], + is_sufficiant_raw: ['', Validators.compose([Validators.required])], + }); + } + createGoods() { + return this.fb.group({ + goods_name: ['', Validators.compose([Validators.required])], + goods_quantity: ['', Validators.compose([Validators.required])], + goods_value: ['', Validators.compose([Validators.required])], + finished_goods_value: ['', Validators.compose([Validators.required])], + is_sufficiant_goods: ['', Validators.compose([Validators.required])], + }); + } + addRawMaterials() { + const control = this.stockForm.controls['raw_materials']; + control.push(this.createRawmaterial()); + } + deleteRawMaterials(index) { + const control = this.stockForm.controls['raw_materials']; + control.removeAt(index); + } + addGoods() { + const control = this.stockForm.controls['finished_goods']; + control.push(this.createGoods()); + } + deleteGoods(index) { + const control = this.stockForm.controls['finished_goods']; + control.removeAt(index); + } + submitDetails() { + if (!this.stockForm.valid) { + return; + } + let records: any = {}; + records.pdid = this.pdid; + records.formid = this.form_id; + records.fk_createdby = this.pdid; + records.raw_materials = this.stockForm.controls['raw_materials'].value; + records.stock_remarks = this.stockForm.controls['stock_remarks'].value; + records.finished_goods = this.stockForm.controls['finished_goods'].value; + console.log('data', records); + this._pd.saveForm(records).subscribe(data => { + console.log('data', data); + this.notifier.notify('success', 'Saved Successfully.'); + }, error => { + this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); + }) + } + validateAllFormFields(formGroup: FormGroup) { + 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); + } + }); + } +} diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html index 0b2ceefd6..ab40fa472 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.html @@ -6,9 +6,10 @@
- + - + +
@@ -25,7 +26,7 @@ - +
{{ (formButton.form_name.length>17)? (formButton.form_name | slice:0:17)+'..':(formButton.form_name) }} @@ -414,6 +415,22 @@ + + + + + + + + + + + + + + + + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts index 027461918..026e6a552 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/start-pd.component.ts @@ -44,10 +44,71 @@ export class StartPdComponent implements OnInit, OnDestroy { // answerList:any=[]; // ansPDList:any=[]; + +// category static form buttons + categoryFormButtons: any = [ + { + "form_id": 1, + "form_name": "Supplier Details" + }, + { + "form_id": 2, + "form_name": "Client Details", + }, + { + "form_id": 3, + "form_name": "Personal Details", + }, + { + "form_id":4, + "form_name":"Asset Details", + }, + { + "form_id": 5, + "form_name": "Address" + }, + { + "form_id": 6, + "form_name": "Family", + }, + { + "form_id": 7, + "form_name": "Banking", + }, + { + "form_id": 8, + "form_name": "Current Loan", + }, + { + "form_id": 9, + "form_name": "Other Income", + }, + { + "form_id": 10, + "form_name": "Loan Details", + }, + { + "form_id": 11, + "form_name": "Stock", + }, + { + "form_id": 12, + "form_name": "Employmet Info", + }, + { + "form_id": 13, + "form_name": "Business Info", + }, + { + "form_id": 14, + "form_name": "Financial Info", + }, + ]; + pdFullDetails:any=[]; // category static form buttons - categoryFormButtons: any; +// categoryFormButtons: any; // = [ // { // "form_id": 1, @@ -154,30 +215,53 @@ pdFullDetails:any=[]; } // load pd template details - loadTemplates(startID: string) { - this._pd.loadPDTemplates(startID).subscribe( - data => { - if (data.status == 200) { - this.pdMasterList = data.records.pdmaster_details; - this.categoryList = data.records.question_answers; - this.categoryFormButtons = data.records.template_forms; - let filterApplicantName = data.records.pdapplicants_detials.filter(item => item.applicant_type == 1); - this.mainApplicantName = filterApplicantName[0].applicant_name; - this.currentPDStatus = data.records.pdmaster_details.pd_status; - this.actualQuestions = data.records.counts.overall_question_count; - this.answeredQuestions = data.records.counts.overall_answered_count; - - this.pdFullDetails = data.records - } - else { - this.pdMasterList = ""; - this.mainApplicantName = ""; - this.categoryList = []; - this.currentPDStatus = ""; - } - }, error => this.errorMessage = error); - } +// loadTemplates(startID: string) { +// this._pd.loadPDTemplates(startID).subscribe( +// data => { +// if (data.status == 200) { +// this.pdMasterList = data.records.pdmaster_details; +// this.categoryList = data.records.question_answers; +// let filterApplicantName = data.records.pdapplicants_detials.filter(item => item.applicant_type == 1); +// this.mainApplicantName = filterApplicantName[0].applicant_name; +// this.currentPDStatus = data.records.pdmaster_details.pd_status; +// +// this.actualQuestions = data.records.counts.overall_question_count; +// this.answeredQuestions = data.records.counts.overall_answered_count; +// +// } +// else { +// this.pdMasterList = ""; +// this.mainApplicantName = ""; +// this.categoryList = []; +// this.currentPDStatus = ""; +// } +// }, error => this.errorMessage = error); +// } +// loadTemplates(startID: string) { +// this._pd.loadPDTemplates(startID).subscribe( +// data => { +// if (data.status == 200) { +// this.pdMasterList = data.records.pdmaster_details; +// this.categoryList = data.records.question_answers; +// // this.categoryFormButtons = data.records.template_forms; +// let filterApplicantName = data.records.pdapplicants_detials.filter(item => item.applicant_type == 1); +// this.mainApplicantName = filterApplicantName[0].applicant_name; +// this.currentPDStatus = data.records.pdmaster_details.pd_status; +// +// this.actualQuestions = data.records.counts.overall_question_count; +// this.answeredQuestions = data.records.counts.overall_answered_count; +// +// this.pdFullDetails = data.records +// } +// else { +// this.pdMasterList = ""; +// this.mainApplicantName = ""; +// this.categoryList = []; +// this.currentPDStatus = ""; +// } +// }, error => this.errorMessage = error); +// } ngOnDestroy(): void { this.listPDComponent.showListView(true); @@ -203,32 +287,32 @@ pdFullDetails:any=[]; this.getAnswers(serachQuestions); } - // loadTemplates(startID:string){ - // this._pd.loadPDTemplates(startID).subscribe( - // data => { - // if (data.status == 200) { - // this.pdMasterList=data.records.pdmaster_details; - // this.categoryList=data.records.question_answers; - // let filterApplicantName= data.records.pdapplicants_detials.filter(item => item.applicant_type == 1); - // this.mainApplicantName = filterApplicantName[0].applicant_name; - // this.currentPDStatus = data.records.pdmaster_details.pd_status; - // - // this.actualQuestions = data.records.counts.overall_question_count; - // this.answeredQuestions = data.records.counts.overall_answered_count; - // - // this.pdFullDetails = data.records - // - // } - // else{ - // this.pdMasterList=""; - // this.mainApplicantName=""; - // this.categoryList=[]; - // this.currentPDStatus=""; - // } - // this.getAnswers(serachQuestions); - // - // }); - // } + loadTemplates(startID:string){ + this._pd.loadPDTemplates(startID).subscribe( + data => { + if (data.status == 200) { + this.pdMasterList=data.records.pdmaster_details; + this.categoryList=data.records.question_answers; + let filterApplicantName= data.records.pdapplicants_detials.filter(item => item.applicant_type == 1); + this.mainApplicantName = filterApplicantName[0].applicant_name; + this.currentPDStatus = data.records.pdmaster_details.pd_status; + + this.actualQuestions = data.records.counts.overall_question_count; + this.answeredQuestions = data.records.counts.overall_answered_count; + + this.pdFullDetails = data.records + + } + else{ + this.pdMasterList = ""; + this.mainApplicantName = ""; + this.categoryList = []; + this.currentPDStatus = ""; + } + // this.getAnswers(serachQuestions); + + }); + } // load question based answer list getAnswers(serachList: any) { 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 3942b2bd3..4ccb8e100 100644 --- 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 @@ -55,6 +55,11 @@ import { AssetsInfoComponent } from './list-pd/start-pd/forms/assets-info/assets import {AddressComponent} from "./list-pd/start-pd/forms/address/address.component"; import {FamilyDetailsComponent} from "./list-pd/start-pd/forms/family-details/family-details.component"; import {BankingDetailsComponent} from "./list-pd/start-pd/forms/banking-details/banking-details.component"; +import {StockComponent} from "./list-pd/start-pd/forms/stock/stock.component"; +import {EmploymentInfoComponent} from "./list-pd/start-pd/forms/employment-info/employment-info.component"; +import {BusinessInfoComponent} from "./list-pd/start-pd/forms/business-info/business-info.component"; +import {FinancialInfoComponent} from "./list-pd/start-pd/forms/financial-info/financial-info.component"; + import { TelePdAllocationComponent } from './list-pd/tele-pd-allocation/tele-pd-allocation.component'; /** @@ -129,7 +134,8 @@ const pdCustomNotifierOptions: NotifierOptions = { // AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule, // OwlNativeDateTimeModule, // ], - declarations: [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, TelePdAllocationComponent], + declarations: [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], + // exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent], // providers: [PdTrigerService, GetGeometricLocationService], // entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent],