This commit is contained in:
venbatechnologies@gmail.com 2021-03-15 13:03:21 +05:30
commit c5030449f6
7 changed files with 462 additions and 22 deletions

Binary file not shown.

View File

@ -392,7 +392,7 @@
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none" *ngIf="lender_short_name != 'CLIX' && lender_short_name != 'MWISE' || prod_catagory == 'LFMP'">
<mat-form-field *ngIf="sup.get('assets_mode').value != ''" style="width:95%">
<mat-label>Is There a Loan Against This Asset?</mat-label>
<mat-label>Facility to Loan?</mat-label>
<mat-select
formControlName="emi">
<mat-option>Select</mat-option>

View File

@ -10,7 +10,7 @@
matTooltipPosition="right" mat-dialog-close>
<mat-icon>close</mat-icon>
</button>
</div>
</div>
</h2>
<mat-dialog-content style="border-bottom: 2px solid #e2412f8f;">
<mat-tab-group>
@ -188,7 +188,7 @@
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:95%"
*ngIf="(itemrow.get('business_ownership_type').value == 'owned')">
<mat-label>Is There a {{lender_short_name == 'CFPL' ? 'Facility' :'Loan'}} Existing Against This Asset?</mat-label>
<mat-label>Is There a Loan Existing Against This Asset?</mat-label>
<mat-select
formControlName="business_emi">
<mat-option>Select</mat-option>
@ -448,7 +448,7 @@
*ngIf="(sup.get('business_assets_mode').value != '') && sup.get('business_ownership_type').value == 'owned' && (lender_short_name != 'CLIX' && lender_short_name != 'MWISE' || prod_catagory === 'LFMP')">
<div fxLayout="row wrap" fxLayoutGap="2px" fxLayoutAlign="start none">
<mat-form-field style="width:95%">
<mat-label>Is There a {{lender_short_name == 'CFPL' ? 'Facility' :'Loan'}} Existing Against This Asset?</mat-label>
<mat-label>Is There a Loan Existing Against This Asset?</mat-label>
<mat-select
formControlName="business_emi">
<mat-option>Select</mat-option>

View File

@ -12,11 +12,11 @@
</div>
</h2>
<mat-dialog-content style="border-bottom: 2px solid #e2412f8f;">
<mat-tab-group>
<mat-tab-group>
<mat-tab label="Details">
<ng-template matTabContent>
<div fxLayout="row wrap">
<div fxFlex="100">
<div fxFlex="100" *ngIf="financial != 'no'">
<mat-card *ngIf="fk_pd_type != '3'">
<mat-card-header>
<mat-card-title>
@ -241,7 +241,7 @@
</div>
</div>
<div fxLayout="row wrap" *ngIf="CustSegAbbr != 'AI'">
<div fxFlex="100">
<div fxFlex="100" *ngIf="financial != 'no'">
<mat-card>
<mat-card-header>
<mat-card-title>
@ -787,12 +787,39 @@
</mat-card>
</div>
</div>
<div *ngIf="lender_short_name== 'CFPL'">
<mat-card-subtitle>
<p>Financial Data</p>
</mat-card-subtitle>
<mat-form-field style="width:92%">
<input matInput autocomplete="off" placeholder="Turnover in last completed Year"
formControlName="turnover_lastcomplete_year" OnlyNumber type="text">
</mat-form-field>
<mat-form-field style="width:92%">
<input matInput autocomplete="off" placeholder="YTD turnover"
formControlName="ytd_turnover" OnlyNumber type="text">
</mat-form-field>
<mat-form-field style="width:92%">
<input matInput autocomplete="off" placeholder="Overall debtor collection period"
formControlName="deptor_collection_period" OnlyNumber type="text">
</mat-form-field>
<mat-form-field style="width:92%">
<input matInput autocomplete="off" placeholder="Overall Inventory holding period"
formControlName="inventory_holding_period" OnlyNumber type="text">
</mat-form-field>
<mat-form-field style="width:92%">
<input matInput autocomplete="off" placeholder="Overall creditor payment period"
formControlName="creditor_payment_period" OnlyNumber type="text">
</mat-form-field>
</div>
<div fxLayout="row wrap">
<div fxFlex="100">
<mat-card>
<mat-card-header>
<mat-card-title>
<p>Working Capital Details</p>
<p>Total Banking Facilities</p>
</mat-card-title>
</mat-card-header>
<mat-card-content>
@ -810,7 +837,7 @@
formControlName="unsold_stock_lies_in_days" OnlyNumber type="text">
</mat-form-field>
<mat-form-field style="width:92%">
<mat-select placeholder="Is there Working Capital Facilities?" formControlName="is_there_working_capital_available">
<mat-select placeholder="Is there {{lender_short_name == 'CFPL' ? 'Total Banking Facilities' :'Working Capital Facilities'}}?" formControlName="is_there_working_capital_available">
<!-- (selectionChange)="selectedWorkingCptl($event.value)" -->
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
@ -824,9 +851,9 @@
</mat-select>
</mat-form-field> -->
<div *ngIf="financialForm.controls.is_there_working_capital_available.value == 'yes'">
<mat-card-subtitle>
<p>Working Capital Facilities availed</p>
<p>{{lender_short_name == 'CFPL' ? 'Total Banking Facilities' :'Working Capital Facilities'}} availed</p>
</mat-card-subtitle>
<div class="toggle" fxLayout="row wrap" formArrayName="select_working_capital_facilities_availed">
@ -840,15 +867,17 @@
<mat-form-field style="width:42%;" *ngIf="financialForm.controls['other_reason_for_working_capital_facilities_availed']">
<input matInput autocomplete="off" placeholder="Others Working Capital Facilities availed"
<input matInput autocomplete="off" placeholder="Others
{{lender_short_name == 'CFPL' ? 'Total Banking Facilities' :'Working Capital Facilities'}}?
availed"
formControlName="other_reason_for_working_capital_facilities_availed">
<mat-error *ngIf="financialForm.controls['other_reason_for_working_capital_facilities_availed'].hasError('required')">Other Reason For Working Capital Facilities Availed Required</mat-error>
<mat-error *ngIf="financialForm.controls['other_reason_for_working_capital_facilities_availed'].hasError('required')">Other Reason For{{lender_short_name == 'CFPL' ? 'Total Banking Facilities' :'Working Capital Facilities'}} Availed Required</mat-error>
</mat-form-field>
<mat-form-field style="width:42%;" *ngIf="financialForm.controls['reason_for_working_capital_facilities_availed']">
<input matInput autocomplete="off" placeholder="Details of Others Facility"
formControlName="reason_for_working_capital_facilities_availed">
<mat-error *ngIf="financialForm.controls['reason_for_working_capital_facilities_availed'].hasError('required')">Reason For Working Capital Facilities Availed Required</mat-error>
<mat-error *ngIf="financialForm.controls['reason_for_working_capital_facilities_availed'].hasError('required')">Reason For {{lender_short_name == 'CFPL' ? 'Total Banking Facilities' :'Working Capital Facilities'}} Availed Required</mat-error>
</mat-form-field>
<mat-form-field style="width:42%;" *ngIf="financialForm.controls['bank_guarantee']">
@ -889,7 +918,36 @@
formControlName="od_limit">
<mat-error *ngIf="financialForm.controls['od_limit'].hasError('required')">OD Limit Required</mat-error>
</mat-form-field>
<mat-form-field style="width:42%;" *ngIf="financialForm.controls['lender_name']">
<input matInput autocomplete="off" placeholder="Name of the Lender"
formControlName="lender_name">
<mat-error *ngIf="financialForm.controls['lender_name'].hasError('required')">Name of the Lender Required</mat-error>
</mat-form-field>
<mat-form-field style="width:42%;" *ngIf="financialForm.controls['loan_amount']">
<input matInput autocomplete="off" placeholder="Loan Amount"
formControlName="loan_amount">
<mat-error *ngIf="financialForm.controls['loan_amount'].hasError('required')">Loan Amount Required</mat-error>
</mat-form-field>
<mat-form-field style="width:42%;" *ngIf="financialForm.controls['loan_type']">
<input matInput autocomplete="off" placeholder="Loan Type"
formControlName="loan_type">
<mat-error *ngIf="financialForm.controls['loan_type'].hasError('required')">Loan Type Required</mat-error>
</mat-form-field>
<mat-form-field style="width:42%;" *ngIf="financialForm.controls['loan_tenor']">
<input matInput autocomplete="off" placeholder="Loan Tenor"
formControlName="loan_tenor">
<mat-error *ngIf="financialForm.controls['loan_tenor'].hasError('required')">Loan Tenor Required</mat-error>
</mat-form-field>
<mat-form-field style="width:42%;" *ngIf="financialForm.controls['loan_start_date']">
<input matInput autocomplete="off" placeholder="Loan start date"
formControlName="loan_start_date">
<mat-error *ngIf="financialForm.controls['loan_start_date'].hasError('required')">Loan start date Required</mat-error>
</mat-form-field>
<mat-form-field style="width:42%;" *ngIf="financialForm.controls['monthly_emi']">
<input matInput autocomplete="off" placeholder="Monthly obligation-Interest/EMI"
formControlName="monthly_emi">
<mat-error *ngIf="financialForm.controls['monthly_emi'].hasError('required')">Monthly obligation-Interest/EMI Required</mat-error>
</mat-form-field>
</div>
</mat-card-content>
</mat-card>

View File

@ -12,7 +12,7 @@ import {
FormArray, FormControl, AbstractControl,
} from '@angular/forms';
import { NotifierService } from 'angular-notifier';
import { NotifierService } from 'angular-notifier';
import {
MatDialog,
@ -101,6 +101,7 @@ export class FinancialInfoComponent implements OnInit {
},
]
fk_pd_type: any;
financial: string;
constructor(notifier: NotifierService,
private fb: FormBuilder,
@ -119,6 +120,10 @@ export class FinancialInfoComponent implements OnInit {
this.main_applicant = this.pd_all_details.pdmaster_details.main_applicant;
this.lender_applicant_id = this.pd_all_details.pdmaster_details.lender_applicant_id;
this.lender_short_name = this.pd_all_details.pdmaster_details.lender_short_name;
if(this.lender_short_name=='CFPL')
{
this.financial='no';
}
this.product_abbr = this.pd_all_details.pdmaster_details.product_abbr;
this.prod_catagory = this.pd_all_details.pdmaster_details.prod_catagory;
this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr;
@ -154,17 +159,38 @@ export class FinancialInfoComponent implements OnInit {
ngOnInit() {
this.initstockForm();
if(this.lender_short_name == "IIB"){
this.financialForm.addControl('tot_business_FY',new FormControl())
this.financialForm.addControl('orders_hand_FY',new FormControl())
this.financialForm.addControl('remarks_tot_business_FY',new FormControl())
}
if(this.lender_short_name == 'CFPL')
{
/* for check box view based on cfpl */
this.av.push({id:8,name:'Name of Lender'});
this.av.push({id:9,name:'Loan amount'});
this.av.push({id:10,name:'Loan Type'});
this.av.push({id:11,name:'Loan Tenor'});
this.av.push({id:12,name:'Loan start date'});
this.av.push({id:13,name:'Monthly obligation-Interest/EMI'});
/*--------------------------*/
/*for financial data */
this.financialForm.addControl('turnover_lastcomplete_year',new FormControl())
this.financialForm.addControl('ytd_turnover',new FormControl())
this.financialForm.addControl('deptor_collection_period',new FormControl())
this.financialForm.addControl('inventory_holding_period',new FormControl())
this.financialForm.addControl('creditor_payment_period',new FormControl())
/*--------------------------*/
}
if(this.customer_segment_abbr == "SE-DI"){
this.financialForm.addControl('kuccha_records_shown',new FormControl())
this.financialForm.addControl('customer_declared_turnover',new FormControl())
this.financialForm.addControl('kuccha_bill_allowed',new FormControl())
}
if(this.lender_short_name == 'CHFPL'){
this.financialForm.addControl('is_turnover_validated',new FormControl('yes',Validators.compose([Validators.required])))
this.financialForm.addControl('how_turnover_validated',new FormControl('',Validators.compose([Validators.required])))
@ -255,6 +281,31 @@ export class FinancialInfoComponent implements OnInit {
this.financialForm.addControl('other_reason_for_working_capital_facilities_availed', new FormControl(''));
this.financialForm.addControl('reason_for_working_capital_facilities_availed', new FormControl(''));
}
if (val.exist_status == 1 && val.id == 8) {
this.financialForm.addControl('lender_name', new FormControl(''));
}
if (val.exist_status == 1 && val.id == 9) {
this.financialForm.addControl('loan_amount', new FormControl(''));
}
if (val.exist_status == 1 && val.id == 10) {
this.financialForm.addControl('loan_type', new FormControl(''));
}
if (val.exist_status == 1 && val.id == 11) {
this.financialForm.addControl('loan_tenor', new FormControl(''));
}
if (val.exist_status == 1 && val.id == 12) {
this.financialForm.addControl('loan_start_date', new FormControl(''));
}
if (val.exist_status == 1 && val.id == 13) {
this.financialForm.addControl('monthly_emi', new FormControl(''));
}
});
@ -498,6 +549,43 @@ export class FinancialInfoComponent implements OnInit {
this.financialForm.addControl('other_reason_for_working_capital_facilities_availed', new FormControl(''));
this.financialForm.addControl('reason_for_working_capital_facilities_availed', new FormControl(''));
}
if (event.value.exist_status == true && event.value.id == 8) {
this.financialForm.removeControl('lender_name');
}
else if (event.value.exist_status == false && event.value.id == 8) {
this.financialForm.addControl('lender_name', new FormControl(''));
}
if (event.value.exist_status == true && event.value.id == 9) {
this.financialForm.removeControl('loan_amount');
}
else if (event.value.exist_status == false && event.value.id == 9) {
this.financialForm.addControl('loan_amount', new FormControl(''));
}
if (event.value.exist_status == true && event.value.id == 10) {
this.financialForm.removeControl('loan_type');
}
else if (event.value.exist_status == false && event.value.id == 10) {
this.financialForm.addControl('loan_type', new FormControl(''));
}
if (event.value.exist_status == true && event.value.id == 11) {
this.financialForm.removeControl('loan_tenor');
}
else if (event.value.exist_status == false && event.value.id == 11) {
this.financialForm.addControl('loan_tenor', new FormControl(''));
}
if (event.value.exist_status == true && event.value.id == 12) {
this.financialForm.removeControl('loan_start_date');
}
else if (event.value.exist_status == false && event.value.id == 12) {
this.financialForm.addControl('loan_start_date', new FormControl(''));
}
if (event.value.exist_status == true && event.value.id == 13) {
this.financialForm.removeControl('monthly_emi');
}
else if (event.value.exist_status == false && event.value.id == 13) {
this.financialForm.addControl('monthly_emi', new FormControl(''));
}
// if(event.value.exist_status==true && event.value.id==1){
// let othersControl = <FormArray>this.businessForm.controls['others_activity_details'];
@ -2030,9 +2118,25 @@ export class FinancialInfoComponent implements OnInit {
if(records.od_limit) delete records.od_limit;
if(records.other_reason_for_working_capital_facilities_availed) delete records.other_reason_for_working_capital_facilities_availed ;
if(records.reason_for_working_capital_facilities_availed) delete records.reason_for_working_capital_facilities_availed ;
}
if(this.lender_short_name=='CFPL')
{
if(records.lender_name) delete records.lender_name ;
if(records.loan_amount) delete records.loan_amount;
if(records.loan_type) delete records.loan_type;
if(records.loan_tenor) delete records.loan_tenor;
if(records.loan_start_date) delete records.loan_start_date;
if(records.monthly_emi) delete records.monthly_emi;
/* for remove control */
if(records.turnover_lastcomplete_year) delete records.turnover_lastcomplete_year;
if(records.ytd_turnover) delete records.ytd_turnover;
if(records.deptor_collection_period) delete records.deptor_collection_period;
if(records.inventory_holding_period) delete records.inventory_holding_period;
if(records.creditor_payment_period) delete records.creditor_payment_period;
/*-----------------------*/
}
}
this._pd.saveForm(records).subscribe(data => {
if(data.status == 200) {
this.notifier.notify('success', 'Saved Successfully.');

View File

@ -13,7 +13,7 @@
</h2>
<mat-dialog-content style="border-bottom: 2px solid #e2412f8f;">
<mat-tab-group>
<mat-tab label="Details">
<ng-template matTabContent>
@ -317,6 +317,163 @@
</mat-card-content>
</mat-card>
</mat-card>
<mat-card *ngIf="lenderShortName == 'CFPL'">
<mat-card-header>
<mat-card-title>Anchor Details Section</mat-card-title>
</mat-card-header>
<mat-card-content class="matcard">
<mat-form-field style="width: 64%">
<input matInput placeholder="Facility Amount Applied For?" formControlName="facility_amount"
OnlyNumber type="text"
autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="loanDetailsForm.controls['facility_amount'].value != ''">{{"&#8377;"}} {{ loanDetailsForm.controls['facility_amount'].value | numberToWords }} Only</mat-hint>
<!-- <mat-hint align="start" style="font-size:90%" *ngIf="loanDetailsForm.controls['loan_amount'].value != ''">{{"&#8377;"}}
{{loanAmtInWords}} Only</mat-hint> -->
</mat-form-field>
<mat-form-field style="width: 28%">
<input matInput placeholder="Name of the Anchor"
type="text" formControlName="anchor_name"
autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="loanDetailsForm.controls['anchor_name'].value != ''"></mat-hint>
</mat-form-field>
<h6>Applicant's association vintage with the Anchor</h6>
<mat-form-field >
<input matInput placeholder="Year" formControlName="vintage_anchor_year"
OnlyNumber type="text" required>
</mat-form-field>
<mat-form-field >
<input matInput placeholder="Month" formControlName="vintage_anchor_month"
OnlyNumber type="text" >
</mat-form-field>
<mat-form-field style="width: 28%">
<input matInput placeholder="Monthly business (sale/purchase) with the Anchor" formControlName="monthly_business_anchor"
OnlyNumber type="text"
autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="loanDetailsForm.controls['monthly_business_anchor'].value != ''">{{"&#8377;"}} {{ loanDetailsForm.controls['monthly_business_anchor'].value | numberToWords }} Only</mat-hint>
<!-- <mat-hint align="start" style="font-size:90%" *ngIf="loanDetailsForm.controls['loan_amount'].value != ''">{{"&#8377;"}}
{{loanAmtInWords}} Only</mat-hint> -->
</mat-form-field>
<mat-form-field style="width: 28%">
<input matInput placeholder="Business concentration with Anchor" formControlName="business_concentration"
OnlyNumber type="text"
autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="loanDetailsForm.controls['business_concentration'].value != ''"> {{ loanDetailsForm.controls['business_concentration'].value }} %</mat-hint>
<!-- <mat-hint align="start" style="font-size:90%" *ngIf="loanDetailsForm.controls['loan_amount'].value != ''">{{"&#8377;"}}
{{loanAmtInWords}} Only</mat-hint> -->
</mat-form-field>
<h6>Credit period with the Anchor (Days)</h6>
<mat-form-field style="width: 28%">
<input matInput placeholder="Days" formControlName="credit_period_days"
OnlyNumber type="text" >
</mat-form-field>
<div>
<mat-form-field style="width: 64%">
<mat-select placeholder="Payment Mechanism" (selectionChange)="selectedBalancesTransferChanges($event.value)"
formControlName="payment_mechanism">
<mat-option>Select</mat-option>
<mat-option value="bill_wise">Bill-Wise</mat-option>
<mat-option value="open_account">Open Account</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 28%">
<input matInput placeholder="Average Invoice Value" formControlName="average_invoicevalue"
OnlyNumber type="text" (change)="loanCalc()"
autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="loanDetailsForm.controls['average_invoicevalue'].value != ''">{{"&#8377;"}} {{ loanDetailsForm.controls['average_invoicevalue'].value | numberToWords }} Only</mat-hint>
<!-- <mat-hint align="start" style="font-size:90%" *ngIf="loanDetailsForm.controls['loan_amount'].value != ''">{{"&#8377;"}}
{{loanAmtInWords}} Only</mat-hint> -->
</mat-form-field>
<span>
<div fxLayout="row wrap">
<mat-form-field style="width: 64%">
<!-- <input matInput placeholder="Seasonality" formControlName="seasonality" required> -->
<mat-select placeholder="Are there peak seasons for the business with Anchor" (selectionChange)="peakseasonsChanges($event.value)"
formControlName="peakseasons_anchor"
required>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No Major Changes In Sales
</mat-option>
</mat-select>
<mat-error *ngIf="loanDetailsForm.controls['peakseasons_anchor'].hasError('required')">Is The Business Seasonal Required</mat-error>
</mat-form-field>
<mat-form-field style="width: 60%" *ngIf="peakseasons == 'yes'">
<mat-select multiple placeholder="Months in which sales/service is low?"
formControlName="sales_low_months" required>
<mat-option value="1">January</mat-option>
<mat-option value="2">February</mat-option>
<mat-option value="3">March</mat-option>
<mat-option value="4">April</mat-option>
<mat-option value="5">May</mat-option>
<mat-option value="6">June</mat-option>
<mat-option value="7">July</mat-option>
<mat-option value="8">August</mat-option>
<mat-option value="9">September</mat-option>
<mat-option value="10">October</mat-option>
<mat-option value="11">November</mat-option>
<mat-option value="12">December</mat-option>
</mat-select>
<mat-error *ngIf="loanDetailsForm.controls['sales_low_months'].hasError('required')">In Which Period Is Maximum Sale / Service Done Required</mat-error>
</mat-form-field>
</div>
<div fxLayout="row nowrap" *ngIf="peakseasons == 'yes'">
<mat-form-field style="width: 38%">
<textarea matInput placeholder="Comments" formControlName="peak_season_comment"
required></textarea>
<mat-error *ngIf="loanDetailsForm.controls['peak_season_comment'].hasError('required')">Comments Required</mat-error>
</mat-form-field>
<!-- <mat-form-field>
<input matInput placeholder="Any delays"
formControlName="any_delays" required>
</mat-form-field> -->
</div>
<mat-form-field style="width: 64%">
<mat-select placeholder="Are there debit/credit notes being issued to/by Anchor" (selectionChange)="selecteddebitcreditChanges($event.value)"
formControlName="anchor_notes">
<mat-option>Select</mat-option>
<mat-option value="yes">Yes</mat-option>
<mat-option value="no">No</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field style="width: 28%" *ngIf="debitcredit_notes == 'yes'">
<input matInput placeholder="Reason for such debit/credit notes"
type="text" formControlName="debitcredit_notes"
autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="loanDetailsForm.controls['debitcredit_notes'].value != ''"></mat-hint>
</mat-form-field>
<mat-form-field style="width: 64%">
<input matInput placeholder="Value of stock related to Anchor" OnlyNumber type="text"
formControlName="stock_related_anchor"
autocomplete="off">
<mat-hint align="start" style="font-size:90%" *ngIf="loanDetailsForm.controls['stock_related_anchor'].value != ''">{{"&#8377;"}} {{ loanDetailsForm.controls['stock_related_anchor'].value | numberToWords }} Only</mat-hint>
</mat-form-field>
<mat-form-field
style="width: 28%">
<input matInput placeholder="Observations on Sample Invoices"
formControlName="sample_invoices" autocomplete="off">
<mat-error *ngIf="loanDetailsForm.controls['sample_invoices'].hasError('required')">Observations on Sample Invoices Required</mat-error>
</mat-form-field>
</span>
</div>
</mat-card-content>
</mat-card>
</div>
</div>
</ng-template>

View File

@ -2,7 +2,7 @@ import {
Component,
OnInit,
Inject,
Input
Input
} from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormArray, FormControl } from '@angular/forms';
@ -95,6 +95,8 @@ export class LoanDetailsComponent implements OnInit {
image_doc_params: { pdid: number; form_id: number; company_id: string; };
addressList: any = [];
prod_catagory: any;
debitcredit_notes: string;
peakseasons: string;
@ -127,6 +129,7 @@ export class LoanDetailsComponent implements OnInit {
this.subproduct_abbr = this.pd_all_details.pdmaster_details.subproduct_abbr;
this.customer_segment_abbr = this.pd_all_details.pdmaster_details.customer_segment_abbr;
this.lenderShortName = this.pd_all_details.pdmaster_details.lender_short_name;
if(this.lenderShortName == 'CFPL') {
this.pageTitle = 'Facility & Anchor Details'
}
@ -148,6 +151,8 @@ export class LoanDetailsComponent implements OnInit {
/** init Fns */
ngOnInit() {
this.initloanDetailsForm();
console.log(this.loanDetailsForm.controls);
this.getM_EndUseofLoad();
this.getM_EndUseForLoan(this.pdid,this.pd_all_details.pdmaster_details.fk_subproduct_id);
this.getM_State();
@ -203,6 +208,38 @@ export class LoanDetailsComponent implements OnInit {
params.pd_id = this.pdid;
params.pd_form_id = this.form_id;
this._pd.retriveForm(params).subscribe(value => {
if(this.lenderShortName=='CFPL')
{
this.loanDetailsForm.controls['facility_amount'].setValue(value.records.facility_amount);
this.loanDetailsForm.controls['anchor_name'].setValue(value.records.anchor_name);
this.loanDetailsForm.controls['vintage_anchor_year'].setValue(value.records.vintage_anchor_year);
this.loanDetailsForm.controls['vintage_anchor_month'].setValue(value.records.vintage_anchor_month);
this.loanDetailsForm.controls['monthly_business_anchor'].setValue(value.records.monthly_business_anchor);
this.loanDetailsForm.controls['business_concentration'].setValue(value.records.business_concentration);
this.loanDetailsForm.controls['credit_period_days'].setValue(value.records.credit_period_days);
this.loanDetailsForm.controls['payment_mechanism'].setValue(value.records.payment_mechanism);
this.loanDetailsForm.controls['average_invoicevalue'].setValue(value.records.average_invoicevalue);
this.loanDetailsForm.controls['peakseasons_anchor'].setValue(value.records.peakseasons_anchor);
this.loanDetailsForm.controls['anchor_notes'].setValue(value.records.anchor_notes);
if(value.records.anchor_notes=='yes')
{
this.debitcredit_notes='yes';
this.loanDetailsForm.controls['debitcredit_notes'].setValue(value.records.debitcredit_notes);
}
if(value.records.peakseasons_anchor=='yes')
{
this.peakseasons='yes';
this.loanDetailsForm.controls['sales_low_months'].setValue(value.records.sales_low_months);
this.loanDetailsForm.controls['peak_season_comment'].setValue(value.records.peak_season_comment);
}
this.loanDetailsForm.controls['stock_related_anchor'].setValue(value.records.stock_related_anchor);
this.loanDetailsForm.controls['sample_invoices'].setValue(value.records.sample_invoices);
}
// *ngIf="prod_catagory === 'HL' || prod_catagory === 'LL' || prod_catagory === 'LAP' "
if (value.status == 200) {
let result = Object.keys(value.records.end_use_group).map(function (key) {
@ -502,8 +539,59 @@ export class LoanDetailsComponent implements OnInit {
pinSearch: [''],
other_pincode:[''],
loandetails_remarks: [''],
});
if(this.lenderShortName=='CFPL')
{
this.loanDetailsForm.addControl('facility_amount', new FormControl('', Validators.required));
this.loanDetailsForm.addControl('anchor_name', new FormControl('', Validators.required));
this.loanDetailsForm.addControl('vintage_anchor_year', new FormControl('', Validators.required));
this.loanDetailsForm.addControl('vintage_anchor_month', new FormControl('', Validators.required));
this.loanDetailsForm.addControl('monthly_business_anchor', new FormControl('', Validators.required));
this.loanDetailsForm.addControl('business_concentration', new FormControl('', Validators.required));
this.loanDetailsForm.addControl('credit_period_days', new FormControl('', Validators.required));
this.loanDetailsForm.addControl('payment_mechanism', new FormControl('', Validators.required));
this.loanDetailsForm.addControl('average_invoicevalue', new FormControl('', Validators.required));
this.loanDetailsForm.addControl('peakseasons_anchor', new FormControl('', Validators.required));
this.loanDetailsForm.addControl('anchor_notes', new FormControl('', Validators.required));
// if(this.debitcredit_notes=='yes')
// {
this.loanDetailsForm.addControl('debitcredit_notes', new FormControl(''));
this.loanDetailsForm.addControl('sales_low_months', new FormControl(''));
this.loanDetailsForm.addControl('peak_season_comment', new FormControl(''));
// }
this.loanDetailsForm.addControl('stock_related_anchor', new FormControl('', Validators.required));
this.loanDetailsForm.addControl('sample_invoices', new FormControl('', Validators.required));
}
}
selecteddebitcreditChanges(event: any) {
// console.log(this.lenderShortName);
if (event == 'no') {
this.loanDetailsForm.removeControl('debitcredit_notes');
this.debitcredit_notes='no';
}
else if (event == 'yes') {
this.loanDetailsForm.addControl('debitcredit_notes', new FormControl(''));
this.debitcredit_notes='yes';
}
}
peakseasonsChanges(event: any) {
// console.log(this.lenderShortName);
if (event == 'no') {
this.loanDetailsForm.removeControl('sales_low_months');
this.loanDetailsForm.removeControl('peak_season_comment');
this.peakseasons='no';
}
else if (event == 'yes') {
this.loanDetailsForm.addControl('sales_low_months', new FormControl(''));
this.loanDetailsForm.addControl('peak_season_comment', new FormControl(''));
this.peakseasons='yes';
}
}
// compare objects for merge two master table details
@ -775,7 +863,7 @@ export class LoanDetailsComponent implements OnInit {
/** To save Loan FOrm Details */
submitLoanDetails() {
if(this.isOtherSource == false){
this.loanDetailsForm.controls['other_source'].setValue('');
this.loanDetailsForm.controls['other_source'].clearValidators();
@ -879,6 +967,7 @@ export class LoanDetailsComponent implements OnInit {
if (!this.loanDetailsForm.valid) {
this.validateAllFormFields(this.loanDetailsForm);
this.notifier.notify('warning', 'Please Fill All Mandatory Fields.!');
const invalid = [];
const controls = this.loanDetailsForm.controls;
@ -891,8 +980,36 @@ export class LoanDetailsComponent implements OnInit {
this.disableAfterSubmit = false;
return;
}
this.disableAfterSubmit = true;
let records: any = {};
if(this.lenderShortName=='CFPL')
{
records.facility_amount = this.loanDetailsForm.controls['facility_amount'].value;
records.anchor_name = this.loanDetailsForm.controls['anchor_name'].value;
records.vintage_anchor_year = this.loanDetailsForm.controls['vintage_anchor_year'].value;
records.vintage_anchor_month = this.loanDetailsForm.controls['vintage_anchor_month'].value;
records.monthly_business_anchor = this.loanDetailsForm.controls['monthly_business_anchor'].value;
records.business_concentration = this.loanDetailsForm.controls['business_concentration'].value;
records.credit_period_days = this.loanDetailsForm.controls['credit_period_days'].value;
records.payment_mechanism = this.loanDetailsForm.controls['payment_mechanism'].value;
records.average_invoicevalue = this.loanDetailsForm.controls['average_invoicevalue'].value;
records.peakseasons_anchor = this.loanDetailsForm.controls['peakseasons_anchor'].value;
records.anchor_notes = this.loanDetailsForm.controls['anchor_notes'].value;
if(this.loanDetailsForm.controls['anchor_notes'].value=='yes')
{
records.debitcredit_notes = this.loanDetailsForm.controls['debitcredit_notes'].value;
}
if(this.loanDetailsForm.controls['peakseasons_anchor'].value=='yes')
{
records.sales_low_months = this.loanDetailsForm.controls['sales_low_months'].value;
records.peak_season_comment = this.loanDetailsForm.controls['peak_season_comment'].value;
}
records.stock_related_anchor = this.loanDetailsForm.controls['stock_related_anchor'].value;
records.sample_invoices = this.loanDetailsForm.controls['sample_invoices'].value;
}
records.parent_pdid = this.parent_pdid;
records.pdid = this.pdid;
records.formid = this.form_id;
@ -989,9 +1106,13 @@ export class LoanDetailsComponent implements OnInit {
records.city=this.loanDetailsForm.controls['city'].value;
records.pincode=this.loanDetailsForm.controls['pincode'].value;
records.other_pincode=this.loanDetailsForm.controls['other_pincode'].value;
console.log(records);
console.log('latest');
this._pd.saveForm(records).subscribe(data => {
if (data.status == 200) {
console.log(data);
console.log('success');
this.notifier.notify('success', 'Saved Successfully.');
// this.dialogRef.close();
setTimeout(() => {