merge pd changes:kms
This commit is contained in:
parent
88461c46fa
commit
395c1868bc
@ -1,3 +1,4 @@
|
||||
|
||||
<mat-card style="min-height: 550px;">
|
||||
<mat-card-content>
|
||||
<p>PD Address Details</p>
|
||||
@ -116,7 +117,7 @@
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<notifier-container></notifier-container>
|
||||
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
|
||||
@ -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,7 +163,6 @@ export class AddressComponent implements OnInit {
|
||||
}
|
||||
onSubmit() {
|
||||
if (!this.addressForm.valid) {
|
||||
this.validateAllFormFields(this.addressForm);
|
||||
return;
|
||||
}
|
||||
console.log('form', this.addressForm.value);
|
||||
|
||||
@ -1,3 +1,72 @@
|
||||
<!--<<<<<<< HEAD-->
|
||||
<!--<mat-card style="padding: 12px;">-->
|
||||
<!--<form [formGroup]="bankingForm" class="bankForm">-->
|
||||
<!--<div formArrayName="itemRows">-->
|
||||
<!--<mat-accordion-->
|
||||
<!--*ngFor="let itemrow of bankingForm.controls.itemRows.controls; let i=index"-->
|
||||
<!--[formGroupName]="i">-->
|
||||
<!--<mat-expansion-panel class="banlFields" [expanded]="step == i" (opened)="setStep(i)">-->
|
||||
<!--<mat-expansion-panel-header>-->
|
||||
<!--<mat-panel-title>-->
|
||||
<!--<h4>{{i+1}} Banking details<span *ngIf="i==0" style="float: right;">-->
|
||||
<!--<mat-icon (click)="addBankdetails($event)">add</mat-icon>-->
|
||||
<!--</span>-->
|
||||
<!--<span *ngIf="i > 0">-->
|
||||
<!--<mat-icon (click)="deleteBankdetails(i, $event)">delete</mat-icon>-->
|
||||
<!--</span></h4>-->
|
||||
<!--</mat-panel-title>-->
|
||||
<!--</mat-expansion-panel-header>-->
|
||||
<!--<mat-form-field>-->
|
||||
<!--<input matInput placeholder="Applicant Name"-->
|
||||
<!--formControlName="applicant_name">-->
|
||||
<!--</mat-form-field>-->
|
||||
<!--<mat-form-field>-->
|
||||
<!--<input matInput placeholder="Bank Name" formControlName="bank_name">-->
|
||||
<!--</mat-form-field>-->
|
||||
|
||||
<!--<mat-form-field>-->
|
||||
<!--<mat-select placeholder="Account Type"-->
|
||||
<!--formControlName="account_type">-->
|
||||
<!--<mat-option value="Savings">Savings</mat-option>-->
|
||||
<!--<mat-option value="Current">Current</mat-option>-->
|
||||
<!--<mat-option value="OD">OD</mat-option>-->
|
||||
<!--<mat-option value="CC">CC</mat-option>-->
|
||||
|
||||
<!--</mat-select>-->
|
||||
<!--</mat-form-field>-->
|
||||
|
||||
<!--<mat-form-field>-->
|
||||
<!--<mat-select placeholder="Salary Credited in this account"-->
|
||||
<!--formControlName="salary">-->
|
||||
<!--<mat-option value="Yes">Yes</mat-option>-->
|
||||
<!--<mat-option value="No">No</mat-option>-->
|
||||
<!--<mat-option value="NA">NA</mat-option>-->
|
||||
<!--</mat-select>-->
|
||||
<!--</mat-form-field>-->
|
||||
<!--<mat-form-field>-->
|
||||
<!--<input matInput placeholder="Limit in case of OD / CC account"-->
|
||||
<!--formControlName="limit">-->
|
||||
<!--</mat-form-field>-->
|
||||
<!--<mat-form-field>-->
|
||||
<!--<mat-select placeholder="Is this the main business account"-->
|
||||
<!--formControlName="is_main">-->
|
||||
<!--<mat-option value="Yes">Yes</mat-option>-->
|
||||
<!--<mat-option value="No">No</mat-option>-->
|
||||
<!--</mat-select>-->
|
||||
<!--</mat-form-field>-->
|
||||
<!--<mat-form-field>-->
|
||||
<!--<input matInput placeholder="Approximate Vintage"-->
|
||||
<!--formControlName="vintage">-->
|
||||
<!--</mat-form-field>-->
|
||||
<!--</mat-expansion-panel>-->
|
||||
|
||||
<!--</mat-accordion>-->
|
||||
<!--</div>-->
|
||||
<!--<button mat-raised-button class="button" (click)="bankSubmit()">Submit-->
|
||||
<!--</button>-->
|
||||
<!--</form>-->
|
||||
<!--</mat-card>-->
|
||||
<!--=======-->
|
||||
<mat-card style="min-height: 550px;">
|
||||
<mat-card-content>
|
||||
<p>Banking Information</p>
|
||||
@ -61,7 +130,7 @@
|
||||
</button>
|
||||
</mat-expansion-panel>
|
||||
<div *ngIf="bankingForm.controls.itemRows['controls'].length == (i+1)">
|
||||
<button class="mr-1 mb-1" color="primary" mat-raised-button mat-icon-button matTooltip="Add More Banking Details" matTooltipPosition="above" (click)="addBankdetails(i)">
|
||||
<button class="mr-1 mb-1" color="primary" mat-raised-button mat-icon-button matTooltip="Add More Banking Details" matTooltipPosition="above" (click)="addBankdetails(i, $event)">
|
||||
<mat-icon >add</mat-icon>
|
||||
</button></div>
|
||||
</mat-accordion>
|
||||
|
||||
@ -39,6 +39,7 @@ export class BankingDetailsComponent implements OnInit {
|
||||
this.notifier = notifier;
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.step = 0;
|
||||
this.initBankingForm();
|
||||
@ -49,9 +50,7 @@ export class BankingDetailsComponent implements OnInit {
|
||||
console.log('data', data);
|
||||
const control = <FormArray>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];
|
||||
});
|
||||
@ -68,12 +67,14 @@ export class BankingDetailsComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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,23 +86,27 @@ 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 = <FormArray>this.bankingForm.controls['itemRows'];
|
||||
let length = control.length;
|
||||
this.step = length;
|
||||
control.push(this.createBankarray());
|
||||
}
|
||||
|
||||
deleteBankdetails(index: number) {
|
||||
console.log('index value -', index);
|
||||
const control = <FormArray>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 = {};
|
||||
@ -118,6 +123,7 @@ export class BankingDetailsComponent implements OnInit {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
});
|
||||
}
|
||||
|
||||
validateAllFormFields(formGroup: FormGroup) {
|
||||
Object.keys(formGroup.controls).forEach(field => {
|
||||
const control = formGroup.get(field);
|
||||
|
||||
@ -0,0 +1,311 @@
|
||||
<mat-card style="padding: 12px;">
|
||||
<p>Business Details</p>
|
||||
<form [formGroup]="businessForm" class="address">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Name of Business / Profession" formControlName="profession_name">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="How many years in Business" formControlName="business_years">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Industry"
|
||||
formControlName="industry">
|
||||
<mat-option value="{{list.industry_classification_id}}" *ngFor="let list of industryData">{{list.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Type of Activity"
|
||||
formControlName="type_of_activity">
|
||||
<mat-option value="{{type.type_of_activity_id}}" *ngFor="let type of activityData">{{type.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Seasonality" formControlName="seasonality">
|
||||
</mat-form-field>
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<p>Designation
|
||||
<p>
|
||||
</mat-card-header>
|
||||
<div formArrayName="designation">
|
||||
<div *ngFor="let members of businessForm.controls.designation['controls']; let i=index"
|
||||
[formGroupName]="i">
|
||||
<mat-card-content class="card">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Name" formControlName="sec_name">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Designation" formControlName="sec_designation">
|
||||
</mat-form-field>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addDesignation()"
|
||||
*ngIf="i==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteDesignation(i)"
|
||||
*ngIf="i>0">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Who started the business / professions"
|
||||
formControlName="who_started">
|
||||
<mat-option value="applicant">Started by Applicant</mat-option>
|
||||
<mat-option value="family_business">Family Business</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Main person running the businesss"
|
||||
formControlName="main_person">
|
||||
<mat-option value="applicants">One of the applicants</mat-option>
|
||||
<mat-option value="Relative">Relative of an applicant</mat-option>
|
||||
<mat-option value="Others">Others</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="businessForm.controls['main_person'].value == 'Others'">
|
||||
<input matInput placeholder="Specify other persion"
|
||||
formControlName="other_main_person">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select multiple placeholder="Other family members invovled"
|
||||
formControlName="other_main_person"formControlName="family_members_involved" (selectionChange)="relationChanged($event)">
|
||||
<mat-option value="{{member.relationship_id}}" *ngFor="let member of relationData">{{member.name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Any other business before"
|
||||
formControlName="before_business">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Any delays"
|
||||
formControlName="any_delays">
|
||||
</mat-form-field>
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<p>Partners / Directors / Shareholders
|
||||
<p>
|
||||
</mat-card-header>
|
||||
<div formArrayName="partners">
|
||||
<div *ngFor="let members of businessForm.controls.partners['controls']; let i=index"
|
||||
[formGroupName]="i">
|
||||
<mat-card-content class="card">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Name"
|
||||
formControlName="partner_name">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Share of Profit / Shareholding"
|
||||
formControlName="shareholding">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="No. of yrs in this business"
|
||||
formControlName="current_business_experiance">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Total Business experience"
|
||||
formControlName="total_business_experiance">
|
||||
</mat-form-field>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addPartnerDetails()"
|
||||
*ngIf="i==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deletePartnerDetails(i)"
|
||||
*ngIf="i>0">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<p>Employees As per applicant
|
||||
<p>
|
||||
</mat-card-header>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Total"
|
||||
formControlName="employees_total">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Permanent"
|
||||
formControlName="employees_permanent">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Temporary"
|
||||
formControlName="employees_temporary">
|
||||
</mat-form-field>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<p>As per PD Officer
|
||||
<p>
|
||||
</mat-card-header>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Total"
|
||||
formControlName="officer_total">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Permanent"
|
||||
formControlName="officer_permanent">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Temporary"
|
||||
formControlName="officer_temporary">
|
||||
</mat-form-field>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<p>Investments
|
||||
<p>
|
||||
</mat-card-header>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Amount invested by applicant"
|
||||
formControlName="invested_amount">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Monthly Working capital needed"
|
||||
formControlName="working_capital">
|
||||
</mat-form-field>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<p>Location
|
||||
<p>
|
||||
</mat-card-header>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field>
|
||||
<mat-select
|
||||
placeholder="Is the location of the business / profession suited to the nature of business / service provided? "
|
||||
formControlName="is_service_provided">
|
||||
<mat-option value="well_suited.">Well Suited.</mat-option>
|
||||
<mat-option value="fairly_suited">Fairly Suited</mat-option>
|
||||
<mat-option value="not_suited">Not Suited</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<p>Business Setup
|
||||
<p>
|
||||
</mat-card-header>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="What is the Ownership of the setup ?"
|
||||
formControlName="ownership_setup">
|
||||
<mat-option value="self_owned">self owned</mat-option>
|
||||
<mat-option value="rented">Rented</mat-option>
|
||||
<mat-option value="family_owned">Family Owned</mat-option>
|
||||
<mat-option value="others">others</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="businessForm.controls['ownership_setup'].value == 'others'">
|
||||
<input matInput placeholder="please specify"
|
||||
formControlName="ownership_others">
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="businessForm.controls['ownership_setup'].value == 'rented'">
|
||||
<input matInput placeholder="provide rent paid?"
|
||||
formControlName="rent_paid">
|
||||
</mat-form-field>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<p>Is the below documents seen and photo captured ?
|
||||
<p>
|
||||
</mat-card-header>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Shop and Eat Act Cert"
|
||||
formControlName="shop_eat_act_cert">
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="GST Regn cert"
|
||||
formControlName="gst_Regn_cert">
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Export / import cert"
|
||||
formControlName="export_import_cert">
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="FactoryCert"
|
||||
formControlName="factory_cert">
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Cert of practice"
|
||||
formControlName="practice_cert">
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="PF Regn"
|
||||
formControlName="pf_regn">
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="ESIC Regn"
|
||||
formControlName="esic_regn">
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="do you want to add other documents?"
|
||||
formControlName="other_documents">
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<div formArrayName="documents" *ngIf="businessForm.controls['other_documents'].value == 'yes'">
|
||||
<div *ngFor="let members of businessForm.controls.documents['controls']; let i=index"
|
||||
[formGroupName]="i">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Specify Document Details"
|
||||
formControlName="document">
|
||||
</mat-form-field>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addDocuments()"
|
||||
*ngIf="i==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteDocuments(i)"
|
||||
*ngIf="i>0">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="60" class="pb-0 text-sm-left">
|
||||
<mat-form-field appearance="outline" style="width: 100%">
|
||||
<mat-label>Remarks</mat-label>
|
||||
<textarea matInput placeholder="Remarks" formControlName="business_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<button mat-raised-button type="submit" class="button" (click)="submitDetails()">Submit</button>
|
||||
</form>
|
||||
</mat-card>
|
||||
@ -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;
|
||||
}
|
||||
@ -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 = <FormArray>this.businessForm.controls['designation'];
|
||||
// const Partnr = <FormArray>this.businessForm.controls['partners'];
|
||||
// const otherDoc = <FormArray>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 = <FormArray>this.businessForm.controls['designation'];
|
||||
const Partnr = <FormArray>this.businessForm.controls['partners'];
|
||||
const otherDoc = <FormArray>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 = <FormArray>this.businessForm.controls['designation'];
|
||||
control.push(this.createDesignation());
|
||||
}
|
||||
deleteDesignation(index) {
|
||||
const control = <FormArray>this.businessForm.controls['designation'];
|
||||
control.removeAt(index);
|
||||
}
|
||||
addPartnerDetails() {
|
||||
const control = <FormArray>this.businessForm.controls['partners'];
|
||||
control.push(this.createPartners());
|
||||
}
|
||||
deletePartnerDetails(index) {
|
||||
const control = <FormArray>this.businessForm.controls['partners'];
|
||||
control.removeAt(index);
|
||||
}
|
||||
addDocuments() {
|
||||
const control = <FormArray>this.businessForm.controls['documents'];
|
||||
control.push(this.createDocument());
|
||||
}
|
||||
deleteDocuments(index) {
|
||||
const control = <FormArray>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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -200,13 +200,11 @@ 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() {
|
||||
this.submitted = true;
|
||||
|
||||
@ -47,8 +47,16 @@
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="60" class="pb-0 text-sm-left">
|
||||
<mat-form-field appearance="outline" style="width: 100%">
|
||||
<mat-label>Remarks</mat-label>
|
||||
<textarea matInput placeholder="Remarks" formControlName="currentloan_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: right;">
|
||||
<button type="submit" mat-raised-button mat-icon-button type="submit" matTooltip="Submit" matTooltipPosition="above" (click)="submitCurrentloan()"><mat-icon>save</mat-icon>
|
||||
<button type="submit" mat-raised-button mat-icon-button matTooltip="Submit" matTooltipPosition="above" (click)="submitCurrentloan()"><mat-icon>save</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
}
|
||||
.address .button {
|
||||
float: right;
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
background: #62B013;
|
||||
color: white;
|
||||
|
||||
@ -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,7 +94,6 @@ export class CurrentLoanComponent implements OnInit {
|
||||
}
|
||||
submitCurrentloan() {
|
||||
if (!this.currentLoanForm.valid) {
|
||||
this.validateAllFormFields(this.currentLoanForm);
|
||||
return;
|
||||
}
|
||||
let records: any = {};
|
||||
@ -99,6 +101,7 @@ export class CurrentLoanComponent implements OnInit {
|
||||
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 => {
|
||||
|
||||
@ -0,0 +1,76 @@
|
||||
<mat-card style="padding: 12px;">
|
||||
<form [formGroup]="employmentForm" class="address">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Name of employer" formControlName="employer_name">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Since how long working with this employer?" formControlName="how_long">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Was the employer met?"
|
||||
formControlName="was_met">
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="employmentForm.controls['was_met'].value == 'yes'">
|
||||
<input matInput placeholder="Name and Designation of person met" formControlName="name_designation">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Salary amount confirmed ?"
|
||||
formControlName="confirm_salary">
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="employmentForm.controls['confirm_salary'].value == 'yes'">
|
||||
<input matInput placeholder="What is the salary amount confirmed?" formControlName="confirm_salary_amount">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Attendance Register seen ?"
|
||||
formControlName="attendance_seen">
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Salary register seen ?"
|
||||
formControlName="sal_reg_seen">
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<p>Salary Details<p>
|
||||
</mat-card-header>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Gross" formControlName="gross">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Net Take home"
|
||||
formControlName="net_take_home">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Bonus or incentive"
|
||||
formControlName="bonus_incentive">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Any delays"
|
||||
formControlName="any_delays">
|
||||
</mat-form-field>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="60" class="pb-0 text-sm-left">
|
||||
<mat-form-field appearance="outline" style="width: 100%">
|
||||
<mat-label>Remarks</mat-label>
|
||||
<textarea matInput placeholder="Remarks" formControlName="employment_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<button mat-raised-button type="submit" class="button" (click)="submitDetails()">Submit</button>
|
||||
</form>
|
||||
</mat-card>
|
||||
@ -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;
|
||||
}
|
||||
@ -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.!');
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
<mat-card style="min-height: 550px;">
|
||||
<mat-card-content>
|
||||
<p>Family Details</p>
|
||||
@ -145,7 +146,6 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<notifier-container></notifier-container>
|
||||
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
@ -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,7 +195,6 @@ export class FamilyDetailsComponent implements OnInit {
|
||||
}
|
||||
submitFamily() {
|
||||
if (!this.familyForm.valid) {
|
||||
this.validateAllFormFields(this.familyForm);
|
||||
return;
|
||||
}
|
||||
console.log('data', this.familyForm.value);
|
||||
|
||||
@ -0,0 +1,90 @@
|
||||
<mat-card style="padding: 12px;">
|
||||
<form [formGroup]="financialForm" class="address">
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<p>Data as per Financial statements<p>
|
||||
</mat-card-header>
|
||||
<div formArrayName="date_per_financial">
|
||||
<div *ngFor="let details of financialForm.controls.date_per_financial['controls']; let i=index"
|
||||
[formGroupName]="i">
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Year (format: 2015-16)" formControlName="financial_year">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Annual Sale" formControlName="financial_annual_sale" (change)="calMargin(i, details)">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Net Profit / Loss" formControlName="financial_net_profit" (change)="calMargin( i, details); calYearVariation( i, details)">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Margin" formControlName="financial_margin">
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="i != 0">
|
||||
<input matInput [ngClass]="{'highlight': details.controls['financial_variation'].value >= 40 || details.controls['financial_variation'].value >= -40}" placeholder="Variation from Previous Year" formControlName="financial_variation">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Reason for major difference" formControlName="financial_reason">
|
||||
</mat-form-field>
|
||||
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addDate()"
|
||||
*ngIf="i==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteDate(i)"
|
||||
*ngIf="i>0">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<p>Estimated Value<p>
|
||||
</mat-card-header>
|
||||
<div formArrayName="estimated_value">
|
||||
<div *ngFor="let details of financialForm.controls.estimated_value['controls']; let i=index"
|
||||
[formGroupName]="i">
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Year (format: 2015-16)" formControlName="estimate_year">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Annual Sale" formControlName="estimate_annual_sale" (change)="calMarginVal( i, details)">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Net Profit / Loss" formControlName="estimate_net_profit" (change)="calMarginVal( i, details); calVariation( i, details)">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput disabled placeholder="Margin" formControlName="estimate_margin">
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="i != 0">
|
||||
<input matInput [ngClass]="{'highlight': details.controls['estimate_variation'].value >= 40 || details.controls['estimate_variation'].value >= -40}" placeholder="Variation from Previous Year" formControlName="estimate_variation">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Reason for major difference" formControlName="estimate_reason">
|
||||
</mat-form-field>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addGoods()"
|
||||
*ngIf="i==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteGoods(i)"
|
||||
*ngIf="i>0">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="60" class="pb-0 text-sm-left">
|
||||
<mat-form-field appearance="outline" style="width: 100%">
|
||||
<mat-label>Remarks</mat-label>
|
||||
<textarea matInput placeholder="Remarks" formControlName="financial_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<button mat-raised-button type="submit" class="button" (click)="submitDetails()">Submit</button>
|
||||
</form>
|
||||
</mat-card>
|
||||
@ -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;
|
||||
}
|
||||
@ -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 = <FormArray>this.financialForm.controls['date_per_financial'];
|
||||
const estimated_val = <FormArray>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 = <FormArray>this.financialForm.controls['date_per_financial'];
|
||||
control.push(this.createDate());
|
||||
}
|
||||
deleteDate(index) {
|
||||
const control = <FormArray>this.financialForm.controls['date_per_financial'];
|
||||
control.removeAt(index);
|
||||
}
|
||||
addGoods() {
|
||||
const control = <FormArray>this.financialForm.controls['estimated_value'];
|
||||
control.push(this.createValue());
|
||||
}
|
||||
deleteGoods(index) {
|
||||
const control = <FormArray>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 = <FormArray>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 = <FormArray>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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -1,48 +1,125 @@
|
||||
<!--<form [formGroup]="loanDetailsForm" class="address">
|
||||
<mat-card style="padding: 12px;">
|
||||
<form [formGroup]="loanDetailsForm" class="address">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Loan Amount applied" formControlName="loan_amount">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="What is the end use"
|
||||
formControlName="other_income">
|
||||
<mat-option value="Yes">Yes</mat-option>
|
||||
<mat-option value="No">No</mat-option>
|
||||
<mat-select multiple placeholder="What is the end use"
|
||||
formControlName="end_use" (selectionChange)="endUserChange($event)">
|
||||
<mat-option value="purchase_of_property"> Puchase of property</mat-option>
|
||||
<mat-option value="construction">Construction</mat-option>
|
||||
<mat-option value="extention">Extention</mat-option>
|
||||
<mat-option value="improvement">Improvement</mat-option>
|
||||
<mat-option value="working_capital">Working capital</mat-option>
|
||||
<mat-option value="purchase_of_business_asset">Purchase of business asset</mat-option>
|
||||
<mat-option value="to_close_an_existing_debt">to close an existing debt</mat-option>
|
||||
<mat-option value="other">Other purpose</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-card *ngIf="currentLoanForm.controls.existing_loan.value == 'Yes'">
|
||||
<mat-card-header>
|
||||
<p>Loan Details<p>
|
||||
</mat-card-header>
|
||||
<div formArrayName="income_details">
|
||||
<div *ngFor="let details of otherIncomeForm.controls.income_details['controls']; let i=index"
|
||||
[formGroupName]="i">
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field *ngIf="isOtherPurpose">
|
||||
<input matInput placeholder="Specify end use" formControlName="end_use_other">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Is there a Balance Transfer"
|
||||
formControlName="is_transfer">
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Is there a Top/Up"
|
||||
formControlName="is_topup">
|
||||
<mat-option value="yes">Yes</mat-option>
|
||||
<mat-option value="no">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes'">
|
||||
<input matInput placeholder="Balance Transfer Amount" formControlName="balance_transfer_amount">
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="loanDetailsForm.controls['is_topup'].value == 'yes'">
|
||||
<input matInput placeholder="Top Up Amt" formControlName="topup_amount">
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="loanDetailsForm.controls['is_topup'].value == 'yes' || loanDetailsForm.controls['is_transfer'].value == 'yes'">
|
||||
<input matInput placeholder="Lender from where Balance Transfer done" formControlName="lender">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Amount of own contribution" formControlName="own_contribution">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Source"
|
||||
formControlName="source">
|
||||
<mat-option value="rental_income">Rental Income</mat-option>
|
||||
<mat-option value="interest_income">Interest Income</mat-option>
|
||||
<mat-option value="agricultural_income">Agricultural Income</mat-option>
|
||||
<mat-option value="dividend_income">Dividend Income and Others</mat-option>
|
||||
<mat-option value="borrowed">Borrowed from Relatives & Friends</mat-option>
|
||||
<mat-option value="own_money">Own money</mat-option>
|
||||
<mat-option value="other">Loan from another lender</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="loanDetailsForm.controls['source'].value =='other'">
|
||||
<input matInput placeholder="Specify lender name and type" formControlName="lender_name_type">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="EMI comfort level" formControlName="emi_level">
|
||||
</mat-form-field>
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<p>Mortgage
|
||||
<p>
|
||||
</mat-card-header>
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field>
|
||||
<mat-select placeholder="Type of property" formControlName="property_type">
|
||||
<mat-option value="bungalow">Bungalow</mat-option>
|
||||
<mat-option value="flat">Flat</mat-option>
|
||||
<mat-option value="row_house">Row House</mat-option>
|
||||
<mat-option value="floor">Floor</mat-option>
|
||||
<mat-option value="chawl">Chawl</mat-option>
|
||||
<mat-option value="shed">Shed</mat-option>
|
||||
<mat-option value="office">Office</mat-option>
|
||||
<mat-option value="shop_in_market">Shop in a market</mat-option>
|
||||
<mat-option value="shop_in_mall">shop in a mall</mat-option>
|
||||
<mat-option value="standalone_shop">standalone shop</mat-option>
|
||||
<mat-option value="clinic">clinic</mat-option>
|
||||
<mat-option value="factory">Factory</mat-option>
|
||||
<mat-option value="vacant_land">Vacant Land</mat-option>
|
||||
<mat-option value="others">Others</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="loanDetailsForm.controls['property_type'].value =='others'">
|
||||
<input matInput placeholder="Please specify type of property" formControlName="ownershipOther">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select multiple placeholder="Name of owner"
|
||||
formControlName="owner_name" (selectionChange)="ownerNameChange($event)">
|
||||
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Amount" formControlName="amount">
|
||||
<mat-select placeholder="Status of construction"
|
||||
formControlName="construction_status">
|
||||
<mat-option value="other_purpose">Under-construction</mat-option>
|
||||
<mat-option value="other_purpose">Complete</mat-option>
|
||||
<mat-option value="other_purpose">Vacant Land</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="EMV as per customer"
|
||||
formControlName="emv_per_customer">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Frequency" formControlName="frequency">
|
||||
<input matInput placeholder="Value as per agreement"
|
||||
formControlName="value_per_agreement">
|
||||
</mat-form-field>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addIncomeDetails()"
|
||||
*ngIf="i==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteIncomeDetails(i)"
|
||||
*ngIf="i>0">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
<button type="submit" (click)="submitCurrentDetails()"></button>
|
||||
</form>-->
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="60" class="pb-0 text-sm-left">
|
||||
<mat-form-field appearance="outline" style="width: 100%">
|
||||
<mat-label>Remarks</mat-label>
|
||||
<textarea matInput placeholder="Remarks" formControlName="loandetails_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<button mat-raised-button type="submit" class="button" (click)="submitLoanDetails()">Submit</button>
|
||||
</form>
|
||||
</mat-card>
|
||||
@ -7,6 +7,9 @@
|
||||
.address > * {
|
||||
width: 100%;
|
||||
}
|
||||
.matcard > * {
|
||||
width: 80%;
|
||||
}
|
||||
.matcard mat-form-field {
|
||||
margin: 0 2%;
|
||||
width:26%;
|
||||
|
||||
@ -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 = <FormArray>this.otherIncomeForm.controls['income_details'];
|
||||
// control.push(this.createDetail());
|
||||
// }
|
||||
// deleteIncomeDetails(index) {
|
||||
// const control = <FormArray>this.otherIncomeForm.controls['income_details'];
|
||||
// control.removeAt(index);
|
||||
// }
|
||||
// submitCurrentDetails() {
|
||||
// if (!this.otherIncomeForm.valid) {
|
||||
// this.validateAllFormFields(this.otherIncomeForm);
|
||||
// return;
|
||||
// }
|
||||
// let records: any = {};
|
||||
// records.pdid = '254';
|
||||
// records.formid = '254';
|
||||
// records.fk_createdby = '254';
|
||||
// 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);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
<!--<mat-card style="padding: 12px;">-->
|
||||
<!--<form [formGroup]="otherIncomeForm" class="address">-->
|
||||
<!--<mat-form-field>-->
|
||||
<!--<mat-select placeholder="Other Income"-->
|
||||
<!--formControlName="other_income">-->
|
||||
<!--<mat-option value="Yes">Yes</mat-option>-->
|
||||
<!--<mat-option value="No">No</mat-option>-->
|
||||
<!--</mat-select>-->
|
||||
<!--</mat-form-field>-->
|
||||
<!--<mat-card *ngIf="otherIncomeForm.controls.other_income.value == 'Yes'">-->
|
||||
<!--<mat-card-header>-->
|
||||
<!--<p>Loan Details<p>-->
|
||||
<!--</mat-card-header>-->
|
||||
<!--<div formArrayName="income_details">-->
|
||||
<!--<div *ngFor="let details of otherIncomeForm.get('income_details').controls; let i=index"-->
|
||||
<!--[formGroupName]="i">-->
|
||||
<!--<mat-card-content class="matcard">-->
|
||||
|
||||
<mat-card style="min-height: 550px;">
|
||||
<mat-card-content>
|
||||
<p>Other Income Details</p>
|
||||
@ -9,6 +27,34 @@
|
||||
<mat-option value="No">No</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<!--<mat-form-field>-->
|
||||
<!--<input matInput placeholder="Amount" formControlName="amount">-->
|
||||
<!--</mat-form-field>-->
|
||||
<!--<mat-form-field>-->
|
||||
<!--<mat-select placeholder="Frequency" formControlName="frequency">-->
|
||||
<!--<mat-option value="{{frq.frequency_id}}" *ngFor="let frq of frequencyData">{{frq.name}}</mat-option>-->
|
||||
<!--</mat-select>-->
|
||||
<!--</mat-form-field>-->
|
||||
<!--<button type="button" mat-raised-button mat-icon-button (click)="addIncomeDetails()"-->
|
||||
<!--*ngIf="i==0">-->
|
||||
<!--<mat-icon>add</mat-icon>-->
|
||||
<!--</button>-->
|
||||
<!--<button type="button" mat-raised-button mat-icon-button (click)="deleteIncomeDetails(i)"-->
|
||||
<!--*ngIf="i>0">-->
|
||||
<!--<mat-icon>close</mat-icon>-->
|
||||
<!--</button>-->
|
||||
<!--</mat-card-content>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--</mat-card>-->
|
||||
<!--<mat-form-field>-->
|
||||
<!--<input matInput placeholder="Remarks" formControlName="otherincome_remarks">-->
|
||||
<!--</mat-form-field>-->
|
||||
<!--<button mat-raised-button type="submit" class="button" (click)="submitCurrentDetails()">Submit</button>-->
|
||||
<!--</form>-->
|
||||
<!--</mat-card>-->
|
||||
|
||||
<mat-card *ngIf="otherIncomeForm.controls.other_income.value == 'Yes'">
|
||||
<mat-card-header>
|
||||
<p>Income Details<p>
|
||||
@ -46,6 +92,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="60" class="pb-0 text-sm-left">
|
||||
<mat-form-field appearance="outline" style="width: 100%">
|
||||
<mat-label>Remarks</mat-label>
|
||||
<textarea matInput placeholder="Remarks" formControlName="otherincome_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<div style="text-align: right;">
|
||||
<button type="submit" mat-raised-button mat-icon-button type="submit" matTooltip="Submit" matTooltipPosition="above" (click)="submitCurrentDetails()"><mat-icon>save</mat-icon>
|
||||
</button>
|
||||
@ -53,4 +107,3 @@
|
||||
</form>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
.address .button {
|
||||
float: right;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background: #62B013;
|
||||
color: white;
|
||||
}
|
||||
@ -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,7 +103,6 @@ export class OtherIncomeComponent implements OnInit {
|
||||
}
|
||||
submitCurrentDetails() {
|
||||
if (!this.otherIncomeForm.valid) {
|
||||
this.validateAllFormFields(this.otherIncomeForm);
|
||||
return;
|
||||
}
|
||||
let records: any = {};
|
||||
@ -108,6 +110,7 @@ export class OtherIncomeComponent implements OnInit {
|
||||
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 => {
|
||||
|
||||
@ -0,0 +1,86 @@
|
||||
<mat-card style="padding: 12px;">
|
||||
<form [formGroup]="stockForm" class="address">
|
||||
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<p>Raw Materials<p>
|
||||
</mat-card-header>
|
||||
<div formArrayName="raw_materials">
|
||||
<div *ngFor="let details of stockForm.controls.raw_materials['controls']; let i=index"
|
||||
[formGroupName]="i">
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Name" formControlName="raw_name">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Quantity" formControlName="raw_quantity">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Value" formControlName="raw_value">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Value of Rawmaterials as per Financial Statements" formControlName="rawmaterial_value">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Is the Stock of Raw Materials Sufficient ?" formControlName="is_sufficiant_raw">
|
||||
</mat-form-field>
|
||||
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addRawMaterials()"
|
||||
*ngIf="i==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteRawMaterials(i)"
|
||||
*ngIf="i>0">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
<mat-card>
|
||||
<mat-card-header>
|
||||
<p>Finished Goods<p>
|
||||
</mat-card-header>
|
||||
<div formArrayName="finished_goods">
|
||||
<div *ngFor="let details of stockForm.controls.finished_goods['controls']; let i=index"
|
||||
[formGroupName]="i">
|
||||
<mat-card-content class="matcard">
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Name" formControlName="goods_name">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Quantity" formControlName="goods_quantity">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Value" formControlName="goods_value">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Value of Finished Goods as per Financial Statements" formControlName="finished_goods_value">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Is the Stock of Finished Goods Sufficient ?" formControlName="is_sufficiant_goods">
|
||||
</mat-form-field>
|
||||
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="addGoods()"
|
||||
*ngIf="i==0">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
<button type="button" mat-raised-button mat-icon-button (click)="deleteGoods(i)"
|
||||
*ngIf="i>0">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</mat-card-content>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="60" class="pb-0 text-sm-left">
|
||||
<mat-form-field appearance="outline" style="width: 100%">
|
||||
<mat-label>Remarks</mat-label>
|
||||
<textarea matInput placeholder="Remarks" formControlName="stock_remarks"></textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
<button mat-raised-button type="submit" class="button" (click)="submitDetails()">Submit</button>
|
||||
</form>
|
||||
</mat-card>
|
||||
@ -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;
|
||||
}
|
||||
@ -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 = <FormArray>this.stockForm.controls['raw_materials'];
|
||||
const finishedGoods = <FormArray>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 = <FormArray>this.stockForm.controls['raw_materials'];
|
||||
control.push(this.createRawmaterial());
|
||||
}
|
||||
deleteRawMaterials(index) {
|
||||
const control = <FormArray>this.stockForm.controls['raw_materials'];
|
||||
control.removeAt(index);
|
||||
}
|
||||
addGoods() {
|
||||
const control = <FormArray>this.stockForm.controls['finished_goods'];
|
||||
control.push(this.createGoods());
|
||||
}
|
||||
deleteGoods(index) {
|
||||
const control = <FormArray>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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -9,6 +9,7 @@
|
||||
<button _ngcontent-c21="" [disabled]="currentPDStatus !=pdStatusCheck.INPROGRESS || actualQuestions!=answeredQuestions" class="compose-btn mat-warn mat-raised-button mb-1" (click)="changePDStatus(pdStatusCheck.COMPLETED);"><span>{{currentPDStatus==pdStatusCheck.INPROGRESS ? 'COMPLETE':(currentPDStatus==pdStatusCheck.QC_COMPLETED ? 'QC COMPLETED' : currentPDStatus ) }}</span></button>
|
||||
|
||||
<!--{{ (currentPDStatus==pdStatusCheck.INPROGRESS)? 'COMPLETE':(currentPDStatus) }} -->
|
||||
<div *ngIf="categoryList != ''">
|
||||
<mat-expansion-panel *ngFor="let category of categoryList;let catIndex = index; ">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title class="text-xs-left">
|
||||
@ -25,7 +26,7 @@
|
||||
|
||||
</mat-list>
|
||||
</mat-expansion-panel>
|
||||
|
||||
</div>
|
||||
<mat-list *ngFor="let formButton of categoryFormButtons">
|
||||
<mat-list-item class="custm-list-item" (click)="OnSelectDirectForms(formButton)" style="background-color:#e0e0e0">
|
||||
<span class="mt-0">{{ (formButton.form_name.length>17)? (formButton.form_name | slice:0:17)+'..':(formButton.form_name) }}</span>
|
||||
@ -414,6 +415,22 @@
|
||||
<ng-container *ngSwitchCase="9">
|
||||
<app-other-income [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-other-income>
|
||||
</ng-container>
|
||||
<ng-container *ngSwitchCase="10">
|
||||
<app-loan-details [pdid]="startPD" [form_id]="selectedFormsCategory.form_id" [applicant_details]="pdFullDetails"></app-loan-details>
|
||||
</ng-container>
|
||||
<ng-container *ngSwitchCase="11">
|
||||
<app-stock [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-stock>
|
||||
</ng-container>
|
||||
<ng-container *ngSwitchCase="12">
|
||||
<app-employment-info [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-employment-info>
|
||||
</ng-container>
|
||||
<ng-container *ngSwitchCase="13">
|
||||
<app-business-info [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-business-info>
|
||||
</ng-container>
|
||||
<ng-container *ngSwitchCase="14">
|
||||
<app-financial-info [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-financial-info>
|
||||
</ng-container>
|
||||
|
||||
<!-- end personal type questions
|
||||
-->
|
||||
</ng-container>
|
||||
|
||||
@ -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 = <any> 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 = <any> 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 = <any> 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="";
|
||||
// }
|
||||
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) {
|
||||
|
||||
@ -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],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user