Changes: ps

This commit is contained in:
venbatechnologies@gmail.com 2019-02-27 10:39:50 +05:30
parent ff3732cb4d
commit 15e70a8fa1
2 changed files with 636 additions and 507 deletions

View File

@ -10,17 +10,13 @@
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<mat-card-title> <mat-card-title> PD Details </mat-card-title>
PD Details
</mat-card-title>
</mat-card-header> </mat-card-header>
<mat-card-content> <mat-card-content>
<mat-form-field style="width: 28%"> <mat-form-field style="width: 28%">
<mat-select placeholder="Lender Name" formControlName="fk_lender_id"> <mat-select placeholder="Lender Name" formControlName="fk_lender_id">
<!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" --> <!-- (selectionChange)="getBillingDetails(pdMain.fk_lender_id.value)" -->
<mat-option> <mat-option> Select </mat-option>
Select
</mat-option>
<mat-option (click)="selectedLender(LL)" *ngFor="let LL of lenderList" [value]="LL.entity_id" > <mat-option (click)="selectedLender(LL)" *ngFor="let LL of lenderList" [value]="LL.entity_id" >
{{LL.full_name}} {{LL.full_name}}
</mat-option> </mat-option>
@ -126,19 +122,20 @@
<mat-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount. </mat-error> <mat-error *ngIf="pdMain.loan_amount.hasError('pattern')">Enter valid amount. </mat-error>
</mat-form-field> </mat-form-field>
</mat-card-content>
</mat-card>
<mat-card>
<mat-card-header>
<mat-card-title>Address Details</mat-card-title>
</mat-card-header>
<mat-card-content>
<mat-form-field style="width: 96%"> <mat-form-field style="width: 96%">
<textarea matInput autocomplete="off" placeholder="Address at which PD is to be done" formControlName="addressline1" style="text-transform: uppercase"></textarea> <textarea matInput autocomplete="off" placeholder="Address at which PD is to be done" formControlName="addressline1" style="text-transform: uppercase"></textarea>
<!-- oninput="this.value = this.value.toUpperCase()" --> <!-- oninput="this.value = this.value.toUpperCase()" -->
<!-- <mat-error *ngIf="pdMain.addressline1.hasError('required')">Address1 required.</mat-error> --> <!-- <mat-error *ngIf="pdMain.addressline1.hasError('required')">Address1 required.</mat-error> -->
</mat-form-field> </mat-form-field>
<!-- <mat-form-field style="width: 28%">
<textarea matInput autocomplete="off" placeholder="Address 2" formControlName="addressline2" oninput="this.value = this.value.toUpperCase()"></textarea>
</mat-form-field>
<mat-form-field style="width: 28%">
<textarea matInput autocomplete="off" placeholder="Address 3" formControlName="addressline3" oninput="this.value = this.value.toUpperCase()"></textarea>
</mat-form-field>-->
<mat-form-field style="width: 32%"> <mat-form-field style="width: 32%">
<mat-select placeholder="State" formControlName="fk_state" (selectionChange)="getCityList(pdMain.fk_state.value)"> <mat-select placeholder="State" formControlName="fk_state" (selectionChange)="getCityList(pdMain.fk_state.value)">
<mat-option> <mat-option>
@ -155,29 +152,22 @@
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 32%"> <mat-form-field style="width: 32%">
<mat-select placeholder="City" formControlName="fk_city"> <mat-select placeholder="City" formControlName="fk_city">
<mat-option> <mat-option> Select </mat-option>
Select
</mat-option>
<mat-option *ngFor="let CL of cityList" [value]="CL.city_id"> <mat-option *ngFor="let CL of cityList" [value]="CL.city_id">
{{CL.city_name}} {{CL.city_name}}
</mat-option> </mat-option>
</mat-select> </mat-select>
<!-- <mat-error *ngIf="pdMain.fk_city.hasError('required')">City Required.</mat-error> --> <!-- <mat-error *ngIf="pdMain.fk_city.hasError('required')">City Required.</mat-error> -->
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 24%"> <mat-form-field style="width: 24%">
<!-- <input matInput autocomplete="off" placeholder="Pincode" formControlName="pincode" (keypress)="keyPress($event)"> -->
<!-- <mat-error *ngIf="pdMain.pincode.hasError('required')">Pincode Required.</mat-error> -->
<!-- <mat-error *ngIf="pdMain.pincode.hasError('maxlength') || pdMain.pincode.hasError('minlength')">Enter Valid Pincode. </mat-error> -->
<mat-select placeholder="Pincode" formControlName="pincode" > <mat-select placeholder="Pincode" formControlName="pincode" >
<mat-option>Select</mat-option> <mat-option>Select</mat-option>
<mat-option *ngFor="let PL of pincodeList" [value]="PL.pincode_id">{{PL.pincode}}</mat-option> <mat-option *ngFor="let PL of pincodeList" [value]="PL.pincode_id">{{PL.pincode}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field style="width: 24%" *ngIf="pdMain.pincode.value == 1" > <mat-form-field style="width: 24%" *ngIf="pdMain.pincode.value == 1" >
<input matInput autocomplete="off" placeholder="Specify Pincode" formControlName="other_pincode" (keypress)="keyPress($event)"> <input matInput autocomplete="off" placeholder="Specify Pincode" formControlName="other_pincode" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.other_pincode.hasError('maxlength') || pdMain.other_pincode.hasError('minlength')">Enter Valid Pincode. </mat-error> <mat-error *ngIf="pdMain.other_pincode.hasError('maxlength') || pdMain.other_pincode.hasError('minlength')">Enter Valid Pincode. </mat-error>
@ -223,9 +213,69 @@
<mat-error *ngIf="pdMain.applicant_landline.hasError('maxlength') || pdMain.applicant_landline.hasError('minlength')">Enter Valid LandLine Number. </mat-error> <mat-error *ngIf="pdMain.applicant_landline.hasError('maxlength') || pdMain.applicant_landline.hasError('minlength')">Enter Valid LandLine Number. </mat-error>
</mat-form-field> </mat-form-field>
<!-- <mat-card formArrayName="items">
<mat-card-content>
<mat-list *ngFor="let coappList of items.controls; let ca = index;" [formGroupName]="ca">
<h3>Co App</h3>
<mat-list-item>
<mat-form-field style="width: 70%">
<input matInput autocomplete="off" placeholder="coapp Name" formControlName="coapplicantName" type="text">
</mat-form-field>
<div style="width:50%">
<!-- <span (click)="removeItem(d)">
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above" type="button"><mat-icon>delete</mat-icon></button>
</span> --
</div>
</mat-list-item>
</mat-list>
</mat-card-content>
<mat-card-actions align="end">
</mat-card-actions>
</mat-card> -->
<!-- Phone field to be split into 2 parts. Mobile Number mandatory and optional land line number with std code. --> <!-- Phone field to be split into 2 parts. Mobile Number mandatory and optional land line number with std code. -->
</mat-card-content> </mat-card-content>
<mat-dialog-actions align="end">
<!-- <button mat-raised-button mat-icon-button matTooltip="Add Document" matTooltipPosition="above" class="mr-1 mb-1 hover-icon" color="primary" (click)="addCoApplicant()" type="button"><mat-icon>attach_file</mat-icon></button> -->
</mat-dialog-actions>
</mat-card> </mat-card>
<!---- <div fxLayout="row" fxLayoutGap="5%" fxLayoutAlign="start none">
<mat-form-field style="width: 50%">
<input matInput placeholder="Mobile" formControlName="coapplicant_mobile_no" type="text" (keypress)="keyPress($event)" required>
<!-- <mat-error *ngIf="coDetails['controls'].coapplicant_mobile_no.hasError('maxlength') || coDetails['controls'].coapplicant_mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error> --
</mat-form-field>
<mat-form-field style="width: 50%">
<input matInput placeholder="LandLine" formControlName="coapplicant_landline" type="text" (keypress)="keyPress($event)">
<!-- <mat-error *ngIf="coDetails['controls'].coapplicant_landline.hasError('maxlength') || coDetails['controls'].coapplicant_landline.hasError('minlength')">Enter Valid Phone Number. </mat-error> --
</mat-form-field>
</div>
<mat-form-field style="width: 100%">
<mat-select placeholder="Relationship" formControlName="relationship">
<mat-option *ngFor="let rel of relationShipList" [value]="rel.relationship_id" >
{{rel.name}}
</mat-option>
</mat-select>
</mat-form-field>
<div style="width:20%">
<span (click)="removeCoApplicant(i)">
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span>
</div>
</div>
</mat-card>
</div>
</div>-->
<mat-card> <mat-card>
<mat-card-header> <mat-card-header>
<mat-card-title>Additional Requirements</mat-card-title> <mat-card-title>Additional Requirements</mat-card-title>
@ -306,4 +356,86 @@
<!-- <div fxLayout="row" fxLayoutWrap="wrap">
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<mat-card class="p-2">
<h5>Main Applicant</h5>
<mat-form-field style="width: 100%">
<input matInput placeholder="Name" formControlName="applicant_name">
<mat-error *ngIf="pdMain.applicant_name.hasError('required')">Name is Required.</mat-error>
</mat-form-field>
<div fxLayout="row" fxLayoutGap="5%" fxLayoutAlign="start none">
<mat-form-field style="width: 50%">
<input matInput placeholder="Mobile" formControlName="mobile_no" type="text" (keypress)="keyPress($event)" required>
<mat-error *ngIf="pdMain.mobile_no.hasError('maxlength') || pdMain.mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 50%">
<input matInput placeholder="LandLine" formControlName="landline" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="pdMain.landline.hasError('maxlength') || pdMain.landline.hasError('minlength')">Enter Valid Phone Number. </mat-error>
</mat-form-field>
</div>
<mat-form-field style="width: 100%">
<input matInput placeholder="Email" formControlName="email" type="email">
<!-- <mat-error *ngIf="pdMain.email.hasError('required')">Email Required.</mat-error> ----
</mat-form-field>
</mat-card>
</div>
</div>
<div fxLayout="row" fxLayoutWrap="wrap" formArrayName="items" *ngFor="let coDetails of pdCoApplicant.controls; let i = index;">
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<mat-card class="p-2">
<h5>{{coDetails.controls.label.value}} {{i+1}}</h5>
<div [formGroupName]="i">
<mat-form-field style="width: 100%">
<input matInput placeholder="Name" formControlName="coapplicantName" type="text" required>
</mat-form-field>
<div fxLayout="row" fxLayoutGap="5%" fxLayoutAlign="start none">
<mat-form-field style="width: 50%">
<input matInput placeholder="Mobile" formControlName="coapplicant_mobile_no" type="text" (keypress)="keyPress($event)" required>
<mat-error *ngIf="coDetails['controls'].coapplicant_mobile_no.hasError('maxlength') || coDetails['controls'].coapplicant_mobile_no.hasError('minlength')">Enter Valid Mobile Number. </mat-error>
</mat-form-field>
<mat-form-field style="width: 50%">
<input matInput placeholder="LandLine" formControlName="coapplicant_landline" type="text" (keypress)="keyPress($event)">
<mat-error *ngIf="coDetails['controls'].coapplicant_landline.hasError('maxlength') || coDetails['controls'].coapplicant_landline.hasError('minlength')">Enter Valid Phone Number. </mat-error>
</mat-form-field>
</div>
<mat-form-field style="width: 100%">
<mat-select placeholder="Relationship" formControlName="relationship">
<mat-option *ngFor="let rel of relationShipList" [value]="rel.relationship_id" >
{{rel.name}}
</mat-option>
</mat-select>
</mat-form-field>
<div style="width:20%">
<span (click)="removeCoApplicant(i)">
<button mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
</span>
</div>
</div>
</mat-card>
</div>
</div> -->
<!-- <div fxLayout="row" fxLayoutWrap="wrap">
<div class="column" fxFlex.xs="100" fxFlex.sm="100" fxFlex.md="100" fxFlex.lg="100" fxFlex.xl="100">
<mat-card class="p-2">
<h5>Co-Applicant</h5>
<button mat-fab class="mr-1 mb-1" color="primary" matTooltip="Add Co-Applicant" matTooltipPosition="above" style="opacity: 0.8;border:2px;border-radius: 50%;" (click)="addCoApplicant()"><mat-icon>group_add</mat-icon><div class="mat-button-ripple mat-ripple" matripple=""></div><div class="mat-button-focus-overlay"></div></button>
<button mat-raised-button mat-button-sm color="primary" (click)="addCoApplicant()" type="button">Add More Co-Applicant</button>
</mat-card>
</div>
</div> -->

View File

@ -18,6 +18,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
//@Output() loadParent = new EventEmitter<string>(); //@Output() loadParent = new EventEmitter<string>();
cancelStatus: boolean; cancelStatus: boolean;
enablePDButton: boolean; enablePDButton: boolean;
coapplicantFlag: boolean = false;
draftStatus: string; draftStatus: string;
PDTriggerStatus: string; PDTriggerStatus: string;
private notifier: NotifierService; private notifier: NotifierService;
@ -91,15 +92,15 @@ export class AddPdComponent implements OnInit, OnDestroy {
applicant_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])], applicant_stdcode: [null, Validators.compose([Validators.minLength(3), Validators.maxLength(5), Validators.pattern('^[0-9]*$')])],
applicant_landline: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])], applicant_landline: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(8), Validators.pattern('^[0-9]*$')])],
company_name: [null], company_name: [null],
  addressline1: [null], addressline1: [null],
fk_city: [null], fk_city: [null],
fk_state: [null], fk_state: [null],
  pincode : [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */ pincode: [null],/** ,Validators.compose([Validators.minLength(6),Validators.maxLength(6)]) */
other_pincode: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])], other_pincode: [null, Validators.compose([Validators.minLength(6), Validators.maxLength(6)])],
remarks: [null], remarks: [null],
  // allocation_type: [null], // allocation_type: [null],
  // sub_allocation_type: [null], // sub_allocation_type: [null],
//items: this._fb.array([]), items: this._fb.array([]),
documents: this._fb.array([]), documents: this._fb.array([]),
addtional_requirements: this._fb.array([this.createRequiremnt()]) addtional_requirements: this._fb.array([this.createRequiremnt()])
}); });
@ -219,26 +220,25 @@ export class AddPdComponent implements OnInit, OnDestroy {
} }
createItem(): FormGroup { createItem(): FormGroup {
return this._fb.group({ return this._fb.group({
label: ['Co Applicant'],
coapplicantName: [null, Validators.compose([Validators.required])], coapplicantName: [null, Validators.compose([Validators.required])],
coapplicant_mobile_no: [null,Validators.compose([Validators.minLength(10),Validators.maxLength(10),Validators.required])], // coapplicantTitleName: [null],
coapplicant_landline : [null,Validators.compose([Validators.minLength(12),Validators.maxLength(13)])], // companyName: [null],
relationship: [null], // applicantType: 0,
// coapplicant_mobile_no: [null, Validators.compose([Validators.minLength(10), Validators.maxLength(10), Validators.required])],
// coapplicant_landline: [null, Validators.compose([Validators.minLength(12), Validators.maxLength(13)])],
// relationship: [null],
}); });
}; };
addCoApplicant() { addCoApplicant() {
if(this._PDtriggerForm.valid){
this.items = this._PDtriggerForm.get('items') as FormArray; this.items = this._PDtriggerForm.get('items') as FormArray;
this.items.push(this.createItem()); this.items.push(this.createItem());
} }
}
addMoreDocs() { addMoreDocs() {
if (this.totalfiles.length != 0) { if (this.totalfiles.length != 0) {
if (this.documents.value[0].doc_name != "" && ((this.lengthCheckToaddMore) === (this.totalfiles.length))) {
if( this.documents.value[0].doc_name != "" && ((this.lengthCheckToaddMore) === (this.totalfiles.length)) )
{
this.documents.insert(0, this.generateDocuments()) this.documents.insert(0, this.generateDocuments())
this.lengthCheckToaddMore = this.lengthCheckToaddMore + 1; this.lengthCheckToaddMore = this.lengthCheckToaddMore + 1;
} }
@ -248,6 +248,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
this.lengthCheckToaddMore = this.lengthCheckToaddMore + 1; this.lengthCheckToaddMore = this.lengthCheckToaddMore + 1;
} }
} }
generateDocuments(): FormGroup { generateDocuments(): FormGroup {
return this._fb.group({ return this._fb.group({
doc_name: [null],//Validators.compose([Validators.required]) doc_name: [null],//Validators.compose([Validators.required])
@ -259,7 +260,8 @@ export class AddPdComponent implements OnInit, OnDestroy {
return this._PDtriggerForm.get('documents') as FormArray; return this._PDtriggerForm.get('documents') as FormArray;
}; };
get pdMain() { get pdMain() {
return this._PDtriggerForm.controls; } 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) { removeCoApplicant(i: number) {
@ -299,13 +301,11 @@ export class AddPdComponent implements OnInit, OnDestroy {
reader.onload = (event: any) => { reader.onload = (event: any) => {
} }
if(oldIndex==0) if (oldIndex == 0) {
{
this.totalfiles.unshift((fileInput.target.files[0])) this.totalfiles.unshift((fileInput.target.files[0]))
this.totalFileName.unshift(fileInput.target.files[0].name) this.totalFileName.unshift(fileInput.target.files[0].name)
} }
else else {
{
this.totalfiles[oldIndex] = (fileInput.target.files[0]); this.totalfiles[oldIndex] = (fileInput.target.files[0]);
this.totalFileName[oldIndex] = fileInput.target.files[0].name this.totalFileName[oldIndex] = fileInput.target.files[0].name
} }
@ -313,8 +313,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
reader.readAsDataURL(fileInput.target.files[0]); reader.readAsDataURL(fileInput.target.files[0]);
} }
if(this.totalfiles.length == 1) if (this.totalfiles.length == 1) {
{
this.lengthCheckToaddMore = 1; this.lengthCheckToaddMore = 1;
} }
} }
@ -469,7 +468,7 @@ export class AddPdComponent implements OnInit, OnDestroy {
"fk_city": formValue.fk_city, "fk_city": formValue.fk_city,
"fk_state": formValue.fk_state, "fk_state": formValue.fk_state,
"pincode": formValue.pincode, "pincode": formValue.pincode,
"other_pincode":formValue.other_pincode , "other_pincode": formValue.other_pincode,
"remarks": formValue.remarks, "remarks": formValue.remarks,
"pd_status": status, "pd_status": status,
"fk_createdby": this._aws.getlocale(), "fk_createdby": this._aws.getlocale(),
@ -487,24 +486,23 @@ export class AddPdComponent implements OnInit, OnDestroy {
}); });
} }
formValue.items.forEach((itemElement, itemIndex) => {
// formValue.items.forEach((itemElement, itemIndex) => { let obj1 = {
// let obj1 = { "applicant_name": itemElement.coapplicantName,
// "applicant_name":itemElement.coapplicantName, "applicant_title_name": itemElement.applicant_title_name,
// "relation":itemElement.relationship, "company_name": itemElement.company_name,
// "email":"", "mobile_no": itemElement.coapplicant_mobile_no,
// "mobile_no":itemElement.coapplicant_mobile_no, "landline": itemElement.coapplicant_landline,
// "landline":itemElement.coapplicant_landline, "applicant_type": 0,
// "applicant_type":0, "relation": "",
// } }
// pd_applicant_details.push(obj1) pd_applicant_details.push(obj1)
// }); });
// docs details // docs details
let pd_form: FormData = new FormData(); let pd_form: FormData = new FormData();
for(let j=0;j<this.totalfiles.length; j++) for (let j = 0; j < this.totalfiles.length; j++) {
{
pd_form.append('pddocuments[]', <File>this.totalfiles[j]) pd_form.append('pddocuments[]', <File>this.totalfiles[j])
} }
@ -602,5 +600,4 @@ inWords(e,flag:number){
} }
} }
} }