diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.html b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.html new file mode 100644 index 000000000..5f1899404 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.html @@ -0,0 +1,43 @@ + + +

Lender Representative Details

+
+ + + Yes + No + + +
+
+
+ + + + + + +
+
+
+ +
+
+ + Remarks + + +
+
+
+ +
+ +
+
+
+ + diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.scss b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.scss new file mode 100644 index 000000000..c6a0fa9d7 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.scss @@ -0,0 +1,11 @@ +.mat-form-field { + width: 100%; + } + +// .address > * { +// width: 100%; +// } +// .matcard mat-form-field { +// margin: 0 2%; +// width:100%; +// } \ No newline at end of file diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.spec.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.spec.ts new file mode 100644 index 000000000..78d54057f --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { LenderRepresentativeComponent } from './lender-representative.component'; + +describe('LenderRepresentativeComponent', () => { + let component: LenderRepresentativeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ LenderRepresentativeComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(LenderRepresentativeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.ts new file mode 100644 index 000000000..bd095dc38 --- /dev/null +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/lender-representative/lender-representative.component.ts @@ -0,0 +1,109 @@ +import {Component,OnInit,Inject,Input } from '@angular/core'; +import {FormBuilder,FormGroup,Validators,FormArray, FormControl,} from '@angular/forms'; +import { NotifierService } from 'angular-notifier'; +/** Service */ +import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; +import { ActivatedRoute, Router } from "@angular/router"; + +@Component({ + selector: 'app-lender-representative', + templateUrl: './lender-representative.component.html', + styleUrls: ['./lender-representative.component.scss'] +}) +export class LenderRepresentativeComponent implements OnInit { + public representativeForm: FormGroup; + private notifier: NotifierService; + @Input() pdid: number; + @Input() form_id: number; + + constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute, + private router: Router, + private _pd: PdTrigerService) { + this.notifier = notifier; + + } + ngOnInit() { + this.initRepresentative(); + let params: any = {}; + params.pd_id = this.pdid; + params.pd_form_id = this.form_id; + this._pd.retriveForm(params).subscribe(value => { + const control = this.representativeForm.controls['lender_representative_details']; + if (value.status == 200) { + + this.representativeForm.controls['lender_representative_accompany'].setValue(value.records.lender_representative_accompany); + this.representativeForm.controls['representative_remarks'].setValue(value.records.representative_remarks); + + if (value.records.lender_representative_accompany == 'Yes') { + var result = Object.keys(value.records.lender_representative_details).map(function (key) { + return value.records.lender_representative_details[key]; + }); + if (result.length > 0) { + result.forEach(val => { + control.push(this.createLRDetail()); + }); + this.representativeForm.controls['lender_representative_details'].setValue(result); + } + } + } + // else { + // control.push(this.createLRDetail()); + // } + }) + } + public initRepresentative(): void { + this.representativeForm = this.fb.group({ + lender_representative_accompany: ['', Validators.compose([Validators.required])], + representative_remarks: ['', Validators.compose([Validators.required])], + lender_representative_details: this.fb.array([]), + }); + } + + selectedLoanChanges(e): void { + if (e.value == 'Yes') { + const control = this.representativeForm.controls['lender_representative_details']; + control.push(this.createLRDetail()); + } else if (e.value == 'No') { + const arr = this.representativeForm.controls.lender_representative_details; + arr.removeAt(0); + } + } + createLRDetail() { + return this.fb.group({ + lender_representative_who_accompanies : ['', Validators.compose([Validators.required])], + lender_representative_carry_loan_files: ['', Validators.compose([Validators.required])], + }); + } + + submitLRForm() { + if (!this.representativeForm.valid) { + this.validateAllFormFields(this.representativeForm); + return; + } + let records: any = {}; + records.pdid = this.pdid; + records.formid = this.form_id; + records.fk_createdby = this.pdid; + records.lender_representative_accompany = this.representativeForm.controls['lender_representative_accompany'].value; + records.representative_remarks = this.representativeForm.controls['representative_remarks'].value; + if (records.lender_representative_accompany == 'Yes') { + records.lender_representative_details = this.representativeForm.controls['lender_representative_details'].value; + } + this._pd.saveForm(records).subscribe(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 b92b5a775..61a3146a5 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 @@ -430,9 +430,10 @@ + + + - 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 24c4e74dd..bc35c864e 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 @@ -59,6 +59,7 @@ 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 { LenderRepresentativeComponent } from './list-pd/start-pd/forms/lender-representative/lender-representative.component'; import { TelePdAllocationComponent } from './list-pd/tele-pd-allocation/tele-pd-allocation.component'; @@ -134,7 +135,7 @@ const pdCustomNotifierOptions: NotifierOptions = { // AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule, // OwlNativeDateTimeModule, // ], - 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], + 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, LenderRepresentativeComponent], // exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent], // providers: [PdTrigerService, GetGeometricLocationService], @@ -165,7 +166,7 @@ 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], + 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], providers: [PdTrigerService, GetGeometricLocationService], entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, TelePdAllocationComponent] }) diff --git a/ng6-seed/src/app/quality-check/qc-list/qc-start/qc-start.component.html b/ng6-seed/src/app/quality-check/qc-list/qc-start/qc-start.component.html index e93d17739..441604b3f 100644 --- a/ng6-seed/src/app/quality-check/qc-list/qc-start/qc-start.component.html +++ b/ng6-seed/src/app/quality-check/qc-list/qc-start/qc-start.component.html @@ -426,6 +426,9 @@ + + +