merge pd changes:kms

This commit is contained in:
gandhimathi 2018-11-13 17:49:00 +05:30
parent 88461c46fa
commit 395c1868bc
31 changed files with 2038 additions and 213 deletions

View File

@ -1,3 +1,4 @@
<mat-card style="min-height: 550px;"> <mat-card style="min-height: 550px;">
<mat-card-content> <mat-card-content>
<p>PD Address Details</p> <p>PD Address Details</p>
@ -116,7 +117,7 @@
</div> </div>
</form> </form>
<notifier-container></notifier-container>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>

View File

@ -2,7 +2,7 @@ import {
Component, Component,
OnInit, OnInit,
Inject, Inject,
Input Input, ElementRef
} from '@angular/core'; } from '@angular/core';
import { import {
@ -22,6 +22,7 @@ import {
/** Service */ /** Service */
import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
import {ActivatedRoute, Router} from "@angular/router"; import {ActivatedRoute, Router} from "@angular/router";
@Component({ @Component({
selector: 'app-address', selector: 'app-address',
templateUrl: './address.component.html', templateUrl: './address.component.html',
@ -45,7 +46,7 @@ export class AddressComponent implements OnInit {
public customerBehaviour: AbstractControl; 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 router: Router,
private _pd: PdTrigerService) { private _pd: PdTrigerService) {
this.notifier = notifier; this.notifier = notifier;
@ -162,7 +163,6 @@ export class AddressComponent implements OnInit {
} }
onSubmit() { onSubmit() {
if (!this.addressForm.valid) { if (!this.addressForm.valid) {
this.validateAllFormFields(this.addressForm);
return; return;
} }
console.log('form', this.addressForm.value); console.log('form', this.addressForm.value);

View File

@ -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 style="min-height: 550px;">
<mat-card-content> <mat-card-content>
<p>Banking Information</p> <p>Banking Information</p>
@ -61,7 +130,7 @@
</button> </button>
</mat-expansion-panel> </mat-expansion-panel>
<div *ngIf="bankingForm.controls.itemRows['controls'].length == (i+1)"> <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> <mat-icon >add</mat-icon>
</button></div> </button></div>
</mat-accordion> </mat-accordion>

View File

@ -39,6 +39,7 @@ export class BankingDetailsComponent implements OnInit {
this.notifier = notifier; this.notifier = notifier;
} }
ngOnInit() { ngOnInit() {
this.step = 0; this.step = 0;
this.initBankingForm(); this.initBankingForm();
@ -49,9 +50,7 @@ export class BankingDetailsComponent implements OnInit {
console.log('data', data); console.log('data', data);
const control = <FormArray>this.bankingForm.controls['itemRows']; const control = <FormArray>this.bankingForm.controls['itemRows'];
if (data.status == 200) { if (data.status == 200) {
this.bankingForm.controls.banking_form_remark.setValue(data.records.banking_form_remark); this.bankingForm.controls.banking_form_remark.setValue(data.records.banking_form_remark);
var result = Object.keys(data.records.banking_details).map(function (key) { var result = Object.keys(data.records.banking_details).map(function (key) {
return data.records.banking_details[key]; return data.records.banking_details[key];
}); });
@ -68,12 +67,14 @@ export class BankingDetailsComponent implements OnInit {
} }
}); });
} }
public initBankingForm(): void { public initBankingForm(): void {
this.bankingForm = this.fb.group({ this.bankingForm = this.fb.group({
banking_form_remark: [''], banking_form_remark: [''],
itemRows: this.fb.array([]) itemRows: this.fb.array([])
}); });
} }
createBankarray() { createBankarray() {
return this.fb.group({ return this.fb.group({
applicant_name: ['', Validators.compose([Validators.required])], applicant_name: ['', Validators.compose([Validators.required])],
@ -85,23 +86,27 @@ export class BankingDetailsComponent implements OnInit {
vintage: ['', Validators.compose([Validators.required])], vintage: ['', Validators.compose([Validators.required])],
}); });
} }
addBankdetails(index: any) {
console.log('index value -',index); addBankdetails(index, event) {
//this.step++; event.stopPropagation();
this.step = index++;
console.log('step value -',this.step);
const control = <FormArray>this.bankingForm.controls['itemRows']; const control = <FormArray>this.bankingForm.controls['itemRows'];
let length = control.length;
this.step = length;
control.push(this.createBankarray()); control.push(this.createBankarray());
} }
deleteBankdetails(index: number) { deleteBankdetails(index: number) {
console.log('index value -', index); console.log('index value -', index);
const control = <FormArray>this.bankingForm.controls['itemRows']; const control = <FormArray>this.bankingForm.controls['itemRows'];
control.removeAt(index); control.removeAt(index);
} }
setStep(index: number) {
this.step = index;
}
bankSubmit() { bankSubmit() {
if (!this.bankingForm.valid) { if (!this.bankingForm.valid) {
this.validateAllFormFields(this.bankingForm);
return; return;
} }
let records: any = {}; let records: any = {};
@ -118,6 +123,7 @@ export class BankingDetailsComponent implements OnInit {
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!'); this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
}); });
} }
validateAllFormFields(formGroup: FormGroup) { validateAllFormFields(formGroup: FormGroup) {
Object.keys(formGroup.controls).forEach(field => { Object.keys(formGroup.controls).forEach(field => {
const control = formGroup.get(field); const control = formGroup.get(field);

View File

@ -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>

View File

@ -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;
}

View File

@ -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);
}
});
}
}

View File

@ -200,13 +200,11 @@ var result = Object.keys(supp_data).map(function(key) {
this.paymentModeTextBox = e.value; this.paymentModeTextBox = e.value;
// this.f.supplier_details.controls.get('payment_mode_value'); // this.f.supplier_details.controls.get('payment_mode_value');
} }
public freqPurchaseTextBox: number; public freqPurchaseTextBox: number;
selectedFreqPurchase(e){ selectedFreqPurchase(e){
this.freqPurchaseTextBox = e.value; this.freqPurchaseTextBox = e.value;
} }
/** To Save/Edited Popup Data */ /** To Save/Edited Popup Data */
onSubmit() { onSubmit() {
this.submitted = true; this.submitted = true;

View File

@ -47,8 +47,16 @@
</div> </div>
</div> </div>
</mat-card> </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;"> <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> </button>
</div> </div>

View File

@ -13,7 +13,6 @@
} }
.address .button { .address .button {
float: right; float: right;
height: 10px;
width: 10px; width: 10px;
background: #62B013; background: #62B013;
color: white; color: white;

View File

@ -22,6 +22,7 @@ import {
/** Service */ /** Service */
import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
import {ActivatedRoute, Router} from "@angular/router"; import {ActivatedRoute, Router} from "@angular/router";
@Component({ @Component({
selector: 'app-current-loan', selector: 'app-current-loan',
templateUrl: './current-loan.component.html', templateUrl: './current-loan.component.html',
@ -52,6 +53,7 @@ export class CurrentLoanComponent implements OnInit {
return value.records.loan_details[key]; return value.records.loan_details[key];
}); });
this.currentLoanForm.controls['existing_loan'].setValue(value.records.existing_loan); this.currentLoanForm.controls['existing_loan'].setValue(value.records.existing_loan);
this.currentLoanForm.controls['currentloan_remarks'].setValue(value.records.currentloan_remarks);
if (result.length > 0) { if (result.length > 0) {
result.forEach(val => { result.forEach(val => {
control.push(this.createLoanDetail()); control.push(this.createLoanDetail());
@ -68,7 +70,8 @@ export class CurrentLoanComponent implements OnInit {
public initCurrentloanForm(): void { public initCurrentloanForm(): void {
this.currentLoanForm = this.fb.group({ this.currentLoanForm = this.fb.group({
existing_loan: ['', Validators.compose([Validators.required])], existing_loan: ['', Validators.compose([Validators.required])],
loan_details: this.fb.array([]) currentloan_remarks: ['', Validators.compose([Validators.required])],
loan_details: this.fb.array([]),
}); });
} }
createLoanDetail() { createLoanDetail() {
@ -91,7 +94,6 @@ export class CurrentLoanComponent implements OnInit {
} }
submitCurrentloan() { submitCurrentloan() {
if (!this.currentLoanForm.valid) { if (!this.currentLoanForm.valid) {
this.validateAllFormFields(this.currentLoanForm);
return; return;
} }
let records: any = {}; let records: any = {};
@ -99,6 +101,7 @@ export class CurrentLoanComponent implements OnInit {
records.formid = this.form_id; records.formid = this.form_id;
records.fk_createdby = this.pdid; records.fk_createdby = this.pdid;
records.existing_loan = this.currentLoanForm.controls['existing_loan'].value; 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; records.loan_details = this.currentLoanForm.controls['loan_details'].value;
console.log('data', records); console.log('data', records);
this._pd.saveForm(records).subscribe(data => { this._pd.saveForm(records).subscribe(data => {

View File

@ -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>

View File

@ -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;
}

View File

@ -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.!');
})
}
}

View File

@ -1,3 +1,4 @@
<mat-card style="min-height: 550px;"> <mat-card style="min-height: 550px;">
<mat-card-content> <mat-card-content>
<p>Family Details</p> <p>Family Details</p>
@ -145,7 +146,6 @@
</div> </div>
</form> </form>
<notifier-container></notifier-container>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>

View File

@ -22,6 +22,7 @@ import {
/** Service */ /** Service */
import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
import {ActivatedRoute, Router} from "@angular/router"; import {ActivatedRoute, Router} from "@angular/router";
@Component({ @Component({
selector: 'app-family-details', selector: 'app-family-details',
templateUrl: './family-details.component.html', templateUrl: './family-details.component.html',
@ -194,7 +195,6 @@ export class FamilyDetailsComponent implements OnInit {
} }
submitFamily() { submitFamily() {
if (!this.familyForm.valid) { if (!this.familyForm.valid) {
this.validateAllFormFields(this.familyForm);
return; return;
} }
console.log('data', this.familyForm.value); console.log('data', this.familyForm.value);

View File

@ -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>

View File

@ -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;
}

View File

@ -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);
}
});
}
}

View File

@ -1,48 +1,125 @@
<!--<form [formGroup]="loanDetailsForm" class="address"> <mat-card style="padding: 12px;">
<form [formGroup]="loanDetailsForm" class="address">
<mat-form-field> <mat-form-field>
<input matInput placeholder="Loan Amount applied" formControlName="loan_amount"> <input matInput placeholder="Loan Amount applied" formControlName="loan_amount">
</mat-form-field> </mat-form-field>
<mat-form-field> <mat-form-field>
<mat-select placeholder="What is the end use" <mat-select multiple placeholder="What is the end use"
formControlName="other_income"> formControlName="end_use" (selectionChange)="endUserChange($event)">
<mat-option value="Yes">Yes</mat-option> <mat-option value="purchase_of_property"> Puchase of property</mat-option>
<mat-option value="No">No</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-select>
</mat-form-field> </mat-form-field>
<mat-card *ngIf="currentLoanForm.controls.existing_loan.value == 'Yes'"> <mat-form-field *ngIf="isOtherPurpose">
<mat-card-header> <input matInput placeholder="Specify end use" formControlName="end_use_other">
<p>Loan Details<p> </mat-form-field>
</mat-card-header> <mat-form-field>
<div formArrayName="income_details"> <mat-select placeholder="Is there a Balance Transfer"
<div *ngFor="let details of otherIncomeForm.controls.income_details['controls']; let i=index" formControlName="is_transfer">
[formGroupName]="i"> <mat-option value="yes">Yes</mat-option>
<mat-card-content class="matcard"> <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-form-field>
<mat-select placeholder="Source" <mat-select placeholder="Source"
formControlName="source"> formControlName="source">
<mat-option value="rental_income">Rental Income</mat-option> <mat-option value="borrowed">Borrowed from Relatives & Friends</mat-option>
<mat-option value="interest_income">Interest Income</mat-option> <mat-option value="own_money">Own money</mat-option>
<mat-option value="agricultural_income">Agricultural Income</mat-option> <mat-option value="other">Loan from another lender</mat-option>
<mat-option value="dividend_income">Dividend Income and Others</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-select>
</mat-form-field> </mat-form-field>
<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>
<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> </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> </mat-card-content>
</div>
</div>
</mat-card> </mat-card>
<button type="submit" (click)="submitCurrentDetails()"></button> <div fxLayout="row">
</form>--> <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>

View File

@ -7,6 +7,9 @@
.address > * { .address > * {
width: 100%; width: 100%;
} }
.matcard > * {
width: 80%;
}
.matcard mat-form-field { .matcard mat-form-field {
margin: 0 2%; margin: 0 2%;
width:26%; width:26%;

View File

@ -22,6 +22,7 @@ import {
/** Service */ /** Service */
import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
@Component({ @Component({
selector: 'app-loan-details', selector: 'app-loan-details',
templateUrl: './loan-details.component.html', templateUrl: './loan-details.component.html',
@ -30,74 +31,167 @@ import {ActivatedRoute, Router} from '@angular/router';
export class LoanDetailsComponent implements OnInit { export class LoanDetailsComponent implements OnInit {
public loanDetailsForm: FormGroup; public loanDetailsForm: FormGroup;
private notifier: NotifierService; 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, constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
private router: Router, private router: Router,
private _pd: PdTrigerService) { private _pd: PdTrigerService) {
this.notifier = notifier;
} }
ngOnInit() { ngOnInit() {
this.applicants = this.applicant_details.pdapplicants_detials;
this.initloanDetailsForm(); 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 { public initloanDetailsForm(): void {
this.loanDetailsForm = this.fb.group({ this.loanDetailsForm = this.fb.group({
other_income: ['', Validators.compose([Validators.required])], loan_amount: ['', Validators.compose([Validators.required])],
// income_details: this.fb.array([this.createDetail()]) 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);
// }
// });
// }
} }

View File

@ -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 style="min-height: 550px;">
<mat-card-content> <mat-card-content>
<p>Other Income Details</p> <p>Other Income Details</p>
@ -9,6 +27,34 @@
<mat-option value="No">No</mat-option> <mat-option value="No">No</mat-option>
</mat-select> </mat-select>
</mat-form-field> </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 *ngIf="otherIncomeForm.controls.other_income.value == 'Yes'">
<mat-card-header> <mat-card-header>
<p>Income Details<p> <p>Income Details<p>
@ -46,6 +92,14 @@
</div> </div>
</div> </div>
</mat-card> </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;"> <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 type="submit" mat-raised-button mat-icon-button type="submit" matTooltip="Submit" matTooltipPosition="above" (click)="submitCurrentDetails()"><mat-icon>save</mat-icon>
</button> </button>
@ -53,4 +107,3 @@
</form> </form>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>

View File

@ -13,7 +13,6 @@
.address .button { .address .button {
float: right; float: right;
width: 10px; width: 10px;
height: 10px;
background: #62B013; background: #62B013;
color: white; color: white;
} }

View File

@ -22,6 +22,7 @@ import {
/** Service */ /** Service */
import { PdTrigerService } from '../../../../../pd-service/pd-triger.service'; import { PdTrigerService } from '../../../../../pd-service/pd-triger.service';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
@Component({ @Component({
selector: 'app-other-income', selector: 'app-other-income',
templateUrl: './other-income.component.html', templateUrl: './other-income.component.html',
@ -53,6 +54,7 @@ export class OtherIncomeComponent implements OnInit {
return value.records.income_details[key]; return value.records.income_details[key];
}); });
this.otherIncomeForm.controls['other_income'].setValue(value.records.other_income); this.otherIncomeForm.controls['other_income'].setValue(value.records.other_income);
this.otherIncomeForm.controls['otherincome_remarks'].setValue(value.records.otherincome_remarks);
if (result.length > 0) { if (result.length > 0) {
result.forEach(val => { result.forEach(val => {
control.push(this.createDetail()); control.push(this.createDetail());
@ -69,6 +71,7 @@ export class OtherIncomeComponent implements OnInit {
public initOtherincomeForm(): void { public initOtherincomeForm(): void {
this.otherIncomeForm = this.fb.group({ this.otherIncomeForm = this.fb.group({
other_income: ['', Validators.compose([Validators.required])], other_income: ['', Validators.compose([Validators.required])],
otherincome_remarks: ['', Validators.compose([Validators.required])],
income_details: this.fb.array([]) income_details: this.fb.array([])
}); });
} }
@ -100,7 +103,6 @@ export class OtherIncomeComponent implements OnInit {
} }
submitCurrentDetails() { submitCurrentDetails() {
if (!this.otherIncomeForm.valid) { if (!this.otherIncomeForm.valid) {
this.validateAllFormFields(this.otherIncomeForm);
return; return;
} }
let records: any = {}; let records: any = {};
@ -108,6 +110,7 @@ export class OtherIncomeComponent implements OnInit {
records.formid = this.form_id; records.formid = this.form_id;
records.fk_createdby = this.pdid; records.fk_createdby = this.pdid;
records.other_income = this.otherIncomeForm.controls['other_income'].value; 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; records.income_details = this.otherIncomeForm.controls['income_details'].value;
console.log('data', records); console.log('data', records);
this._pd.saveForm(records).subscribe(data => { this._pd.saveForm(records).subscribe(data => {

View File

@ -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>

View File

@ -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;
}

View File

@ -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);
}
});
}
}

View File

@ -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> <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) }} --> <!--{{ (currentPDStatus==pdStatusCheck.INPROGRESS)? 'COMPLETE':(currentPDStatus) }} -->
<div *ngIf="categoryList != ''">
<mat-expansion-panel *ngFor="let category of categoryList;let catIndex = index; "> <mat-expansion-panel *ngFor="let category of categoryList;let catIndex = index; ">
<mat-expansion-panel-header> <mat-expansion-panel-header>
<mat-panel-title class="text-xs-left"> <mat-panel-title class="text-xs-left">
@ -25,7 +26,7 @@
</mat-list> </mat-list>
</mat-expansion-panel> </mat-expansion-panel>
</div>
<mat-list *ngFor="let formButton of categoryFormButtons"> <mat-list *ngFor="let formButton of categoryFormButtons">
<mat-list-item class="custm-list-item" (click)="OnSelectDirectForms(formButton)" style="background-color:#e0e0e0"> <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> <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"> <ng-container *ngSwitchCase="9">
<app-other-income [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-other-income> <app-other-income [pdid]="startPD" [form_id]="selectedFormsCategory.form_id"></app-other-income>
</ng-container> </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 <!-- end personal type questions
--> -->
</ng-container> </ng-container>

View File

@ -44,10 +44,71 @@ export class StartPdComponent implements OnInit, OnDestroy {
// answerList:any=[]; // answerList:any=[];
// ansPDList: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=[]; pdFullDetails:any=[];
// category static form buttons // category static form buttons
categoryFormButtons: any; // categoryFormButtons: any;
// = [ // = [
// { // {
// "form_id": 1, // "form_id": 1,
@ -154,30 +215,53 @@ pdFullDetails:any=[];
} }
// load pd template details // 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; // loadTemplates(startID: string) {
this.answeredQuestions = data.records.counts.overall_answered_count; // this._pd.loadPDTemplates(startID).subscribe(
// data => {
this.pdFullDetails = data.records // if (data.status == 200) {
} // this.pdMasterList = data.records.pdmaster_details;
else { // this.categoryList = data.records.question_answers;
this.pdMasterList = ""; // let filterApplicantName = data.records.pdapplicants_detials.filter(item => item.applicant_type == 1);
this.mainApplicantName = ""; // this.mainApplicantName = filterApplicantName[0].applicant_name;
this.categoryList = []; // this.currentPDStatus = data.records.pdmaster_details.pd_status;
this.currentPDStatus = ""; //
} // this.actualQuestions = data.records.counts.overall_question_count;
}, error => this.errorMessage = <any> error); // 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 { ngOnDestroy(): void {
this.listPDComponent.showListView(true); this.listPDComponent.showListView(true);
@ -203,32 +287,32 @@ pdFullDetails:any=[];
this.getAnswers(serachQuestions); this.getAnswers(serachQuestions);
} }
// loadTemplates(startID:string){ loadTemplates(startID:string){
// this._pd.loadPDTemplates(startID).subscribe( this._pd.loadPDTemplates(startID).subscribe(
// data => { data => {
// if (data.status == 200) { if (data.status == 200) {
// this.pdMasterList=data.records.pdmaster_details; this.pdMasterList=data.records.pdmaster_details;
// this.categoryList=data.records.question_answers; this.categoryList=data.records.question_answers;
// let filterApplicantName= data.records.pdapplicants_detials.filter(item => item.applicant_type == 1); let filterApplicantName= data.records.pdapplicants_detials.filter(item => item.applicant_type == 1);
// this.mainApplicantName = filterApplicantName[0].applicant_name; this.mainApplicantName = filterApplicantName[0].applicant_name;
// this.currentPDStatus = data.records.pdmaster_details.pd_status; this.currentPDStatus = data.records.pdmaster_details.pd_status;
//
// this.actualQuestions = data.records.counts.overall_question_count; this.actualQuestions = data.records.counts.overall_question_count;
// this.answeredQuestions = data.records.counts.overall_answered_count; this.answeredQuestions = data.records.counts.overall_answered_count;
//
// this.pdFullDetails = data.records this.pdFullDetails = data.records
//
// } }
// else{ else{
// this.pdMasterList=""; this.pdMasterList = "";
// this.mainApplicantName=""; this.mainApplicantName = "";
// this.categoryList=[]; this.categoryList = [];
// this.currentPDStatus=""; this.currentPDStatus = "";
// } }
// this.getAnswers(serachQuestions); // this.getAnswers(serachQuestions);
//
// }); });
// } }
// load question based answer list // load question based answer list
getAnswers(serachList: any) { getAnswers(serachList: any) {

View File

@ -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 {AddressComponent} from "./list-pd/start-pd/forms/address/address.component";
import {FamilyDetailsComponent} from "./list-pd/start-pd/forms/family-details/family-details.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 {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'; 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, // AgmCoreModule.forRoot({apiKey: 'AIzaSyBtdO5k6CRntAMJCF-H5uZjTCoSGX95cdk'}), OwlDateTimeModule,
// OwlNativeDateTimeModule, // 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], // exports: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent, StartPdComponent, CompletedPdComponent, QcCompletedPdComponent],
// providers: [PdTrigerService, GetGeometricLocationService], // providers: [PdTrigerService, GetGeometricLocationService],
// entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent], // entryComponents: [PdAllocationComponent, SmartPdAllocationComponent, SchedulePdComponent, EditPdApplicantComponent, EditPdMasterComponent],