Merge branch 'master' of https://bitbucket.org/sriramv18/sparqsineedge
This commit is contained in:
commit
805039c78f
@ -99,12 +99,12 @@
|
||||
formControlName="applicant_name" required>
|
||||
|
||||
<mat-option value="{{owner.pd_co_applicant_id}}" *ngFor="let owner of applicants">{{owner.applicant_name}}</mat-option>
|
||||
<mat-option value="Others">Others</mat-option>
|
||||
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="itemrow.get('applicant_name').value == 'Others'">
|
||||
<mat-form-field *ngIf="itemrow.get('applicant_name').value == 0">
|
||||
<input matInput placeholder="Specify Other Applicant"
|
||||
formControlName="other_applicant">
|
||||
formControlName="other_applicant" autocomplete="off">
|
||||
</mat-form-field>
|
||||
|
||||
<!-- <mat-form-field>
|
||||
@ -122,7 +122,7 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="itemrow.get('bank_name').value == 3">
|
||||
<input matInput placeholder="Specify Other Bank Name"
|
||||
formControlName="other_bank">
|
||||
formControlName="other_bank" autocomplete="off">
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
@ -140,7 +140,7 @@
|
||||
</mat-select>-->
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-form-field *ngIf="salaryField">
|
||||
<mat-select placeholder="Salary Credited in this account"
|
||||
formControlName="salary" required>
|
||||
<mat-option value="Yes">Yes</mat-option>
|
||||
@ -151,7 +151,7 @@
|
||||
|
||||
<mat-form-field *ngIf="itemrow.get('account_type').value != 2">
|
||||
<input matInput placeholder="Limit in case of OD / CC account"
|
||||
formControlName="limit" (keypress)="keyPress($event)" required>
|
||||
formControlName="limit" (keypress)="keyPress($event)" required autocomplete="off">
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="pd_cus_segment!='SAL'">
|
||||
<mat-select placeholder="Is this the main business account"
|
||||
@ -169,10 +169,10 @@
|
||||
<br>
|
||||
<div fxLayout="row" fxLayoutGap="2px" fxLayoutAlign="start none">
|
||||
<mat-form-field>
|
||||
<input matInput type="number" placeholder="Year" formControlName="vintage_year" required min='0'>
|
||||
<input matInput type="number" placeholder="Year(s)" formControlName="vintage_year" required min='0' (keypress)="keyPress($event)" autocomplete="off">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput type="number" placeholder="Month" formControlName="vintage_month" required min='0' max='12'>
|
||||
<input matInput type="number" placeholder="Month(s)" formControlName="vintage_month" required min='0' max='11'(keypress)="keyPress($event)" autocomplete="off">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -37,6 +37,7 @@ export class BankingDetailsComponent implements OnInit {
|
||||
public applicants: any;
|
||||
m_accountType= [];
|
||||
m_btLenderList = [];
|
||||
salaryField : boolean;
|
||||
|
||||
constructor(notifier: NotifierService, private fb: FormBuilder, private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
@ -46,6 +47,7 @@ export class BankingDetailsComponent implements OnInit {
|
||||
this.pd_cus_segment = this.pd_all_details.pdmaster_details.customer_segment_abbr.toUpperCase();
|
||||
this.pd_cus_segment = this.pd_cus_segment.substring(0,3);
|
||||
this.applicants = this.pd_all_details.pdapplicants_detials;
|
||||
this.applicants.push({'pd_co_applicant_id':'0','applicant_name':'Others'});
|
||||
this.notifier = notifier;
|
||||
|
||||
}
|
||||
@ -57,6 +59,8 @@ export class BankingDetailsComponent implements OnInit {
|
||||
this.initBankingForm();
|
||||
this.getM_AccountType();
|
||||
this.getM_BTLenderList();
|
||||
|
||||
this.salaryField = this.pd_cus_segment.substring(0,2) == 'SE' ? false : true ;
|
||||
// this.pd_cus_segment = this.pd_all_details.pdmaster_details.customer_segment_abbr.toUpperCase();
|
||||
// // console.log("(0,3): " + this.pd_cus_segment.substring(0,3));
|
||||
// // console.log(this.pd_all_details.pdmaster_details);
|
||||
@ -123,7 +127,8 @@ export class BankingDetailsComponent implements OnInit {
|
||||
bank_name: ['', Validators.compose([Validators.required])],
|
||||
other_bank: [''],
|
||||
account_type: ['', Validators.compose([Validators.required])],
|
||||
salary: ['', Validators.compose([Validators.required])],
|
||||
//salary: ['', Validators.compose([Validators.required])],
|
||||
salary: this.pd_cus_segment.substring(0,2) == 'SE' ? [''] : ['', Validators.compose([Validators.required])],
|
||||
limit: ['', Validators.compose([Validators.required])],
|
||||
//is_main: ['', Validators.compose([Validators.required])],
|
||||
//is_main: [this.pd_cus_segment == 'SAL' ? '' : '', Validators.compose([Validators.required])],
|
||||
@ -188,13 +193,13 @@ export class BankingDetailsComponent implements OnInit {
|
||||
}
|
||||
|
||||
selectedAccTypeChanges(event: any){
|
||||
console.log('First Time',event);
|
||||
console.log('First Time Value',event.value);
|
||||
// console.log('First Time',event);
|
||||
// console.log('First Time Value',event.value);
|
||||
if(event.value == 2) {
|
||||
const control = <FormArray>this.bankingForm.controls['itemRows'];
|
||||
console.log('Inside If Condition');
|
||||
console.log(control);
|
||||
console.log(control.controls);
|
||||
// console.log('Inside If Condition');
|
||||
// console.log(control);
|
||||
// console.log(control.controls);
|
||||
|
||||
control.controls[0].get('limit').clearValidators();
|
||||
control.controls[0].get('limit').updateValueAndValidity();
|
||||
@ -208,7 +213,7 @@ export class BankingDetailsComponent implements OnInit {
|
||||
|
||||
}
|
||||
else{
|
||||
alert('sd');
|
||||
//alert('sd');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -17,13 +17,13 @@
|
||||
<div fxLayout="row wrap">
|
||||
<div fxFlex="100">
|
||||
<mat-card>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Loan Amount Applied for ? " formControlName="loan_amount" (keypress)="keyPress($event)" (keyup)="inWords($event,1)" required >
|
||||
<mat-form-field style="width: 25%">
|
||||
<input matInput placeholder="Loan Amount Applied for ? " formControlName="loan_amount" (keypress)="keyPress($event)" (keyup)="inWords($event,1)" (change)="loanCalc()" required autocomplete="off">
|
||||
<mat-hint align="end" *ngIf="loanDetailsForm.controls['loan_amount'].value != ''">{{"₹"}} {{loanAmtInWords}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select multiple (selectionChange)="endUserChange($event)" placeholder="What is the end use" formControlName="end_use" required>
|
||||
<mat-option *ngFor="let enduse of m_endUseofLoad" [value]="enduse.id">{{ enduse.name }}</mat-option>
|
||||
<mat-form-field style="width: 25%">
|
||||
<mat-select multiple (selectionChange)="endUserChange($event.value)" placeholder="What is the end use" formControlName="end_use" required>
|
||||
<mat-option *ngFor="let enduse of m_endUseofLoad" [value]="enduse.subproduct_id">{{ enduse.name }}</mat-option>
|
||||
</mat-select>
|
||||
<!--<mat-select multiple placeholder="What is the end use"
|
||||
formControlName="end_use" (selectionChange)="endUserChange($event)">
|
||||
@ -37,49 +37,52 @@
|
||||
<mat-option value="other">Other purpose</mat-option>
|
||||
</mat-select>-->
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="isOtherPurpose">
|
||||
<input matInput placeholder="Specify End Use" formControlName="end_use_other">
|
||||
<mat-form-field *ngIf="isOtherPurpose" style="width: 25%">
|
||||
<input matInput placeholder="Specify End Use" formControlName="end_use_other" autocomplete="off">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-form-field style="width: 30%">
|
||||
<mat-select placeholder="Is there a balance transfer ? " (selectionChange)="selectedBalancesTransferChanges($event)"
|
||||
formControlName="is_transfer" required >
|
||||
<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="What is the amount required for Balance Transfer ? " (keypress)="keyPress($event)" formControlName="balance_transfer_amount" (keyup)="inWords($event,2)">
|
||||
<div *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes' && loanDetailsForm.controls['is_transfer'].value != ''">
|
||||
<mat-form-field style="width: 50%">
|
||||
<input matInput placeholder="What is the amount required for Balance Transfer ? " (keypress)="keyPress($event)" formControlName="balance_transfer_amount" (keyup)="inWords($event,2)" (change)="loanCalc()" autocomplete="off">
|
||||
<mat-hint align="end" *ngIf="loanDetailsForm.controls['loan_amount'].value != ''">{{"₹"}} {{balTxrfAmtInWords}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes'">
|
||||
<mat-form-field style="width:20%">
|
||||
<mat-select placeholder="Is there a Top Up"
|
||||
formControlName="is_topup" required>
|
||||
<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'">
|
||||
<mat-form-field style="width: 50%">
|
||||
<mat-select placeholder="Lender from where balance transfer done"
|
||||
formControlName="lender">
|
||||
<mat-option *ngFor="let btLen of m_btLenderList" [value]="btLen.bt_lender_list_id">{{ btLen.lender_name }}</mat-option>
|
||||
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="loanDetailsForm.controls['lender'].value == 3">
|
||||
<input matInput placeholder="Specify Others Lender" formControlName="other_bt_lender">
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value == 'yes' && loanDetailsForm.controls['is_topup'].value == 'yes'">
|
||||
<input matInput placeholder="Top Up Amt" (keypress)="keyPress($event)" formControlName="topup_amount" (keyup)="inWords($event,5)">
|
||||
<mat-hint align="end" *ngIf="loanDetailsForm.controls['topup_amount'].value != ''">{{"₹"}} {{topUpAmtInWords}} Only</mat-hint>
|
||||
|
||||
<mat-form-field *ngIf="loanDetailsForm.controls['lender'].value == 3" style="width: 25%">
|
||||
<input matInput placeholder="Specify Others Lender" formControlName="other_bt_lender" autocomplete="off">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value != 'yes'">
|
||||
<input matInput placeholder="Amount of Own Contribution" formControlName="own_contribution" (keypress)="keyPress($event)" required (keyup)="inWords($event,4)">
|
||||
<mat-form-field *ngIf="loanDetailsForm.controls['is_topup'].value == 'yes' && loanDetailsForm.controls['is_topup'].value != '' " style="width: 20%">
|
||||
<input matInput placeholder="Top Up Amount" (keypress)="keyPress($event)" formControlName="topup_amount" (keyup)="inWords($event,5)" autocomplete="off">
|
||||
<mat-hint align="end" *ngIf="loanDetailsForm.controls['topup_amount'].value != ''">{{"₹"}} {{topUpAmtInWords}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div *ngIf="loanDetailsForm.controls['is_transfer'].value != 'yes' && loanDetailsForm.controls['is_transfer'].value != '' ">
|
||||
|
||||
<mat-form-field style="width: 35%">
|
||||
<input matInput placeholder="Amount of Own Contribution" formControlName="own_contribution" (keypress)="keyPress($event)" required (keyup)="inWords($event,4)" autocomplete="off">
|
||||
<mat-hint align="end" *ngIf="loanDetailsForm.controls['own_contribution'].value != ''">{{"₹"}} {{ownContributionInWords}} Only</mat-hint>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="loanDetailsForm.controls['is_transfer'].value != 'yes'">
|
||||
<mat-form-field style="width: 35%">
|
||||
<mat-select placeholder="Source" formControlName="source" required>
|
||||
<mat-option *ngFor="let sour of m_sourceofamount" [value]="sour.id">{{ sour.name }}</mat-option>
|
||||
</mat-select>
|
||||
@ -90,12 +93,17 @@
|
||||
<mat-option value="own_money">Own money</mat-option>
|
||||
<mat-option value="other">Loan from another lender</mat-option>
|
||||
</mat-select>-->
|
||||
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="loanDetailsForm.controls['source'].value =='other'">
|
||||
<input matInput placeholder="Specify Lender Name and Type" formControlName="lender_name_type">
|
||||
<mat-form-field *ngIf="loanDetailsForm.controls['source'].value =='other'" style="width: 35%">
|
||||
<input matInput placeholder="Specify Lender Name and Type" formControlName="lender_name_type" autocomplete="off">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="EMI Comfort Level" formControlName="emi_level" (keypress)="keyPress($event)" required>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<mat-form-field style="width: 50%">
|
||||
<input matInput placeholder="EMI Comfort Level" formControlName="emi_level" (keypress)="keyPress($event)" required autocomplete="off">
|
||||
</mat-form-field>
|
||||
<!-- <div *ngIf="productAbbr === 'HL' || productAbbr === 'LL' || productAbbr === 'LAP' "> -->
|
||||
<mat-card *ngIf="mortageCardAccess">
|
||||
@ -125,7 +133,7 @@
|
||||
</mat-select>-->
|
||||
|
||||
<mat-form-field *ngIf="mortageAccess">
|
||||
<input matInput placeholder="Specify Type of Property" formControlName="property_type_others">
|
||||
<input matInput placeholder="Specify Type of Property" formControlName="property_type_others" autocomplete="off">
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-select multiple placeholder="Name of Owner"
|
||||
@ -136,7 +144,7 @@
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="OtherOwnerFlag">
|
||||
<input matInput placeholder="Specify Other Owner Name" formControlName="other_owners_name">
|
||||
<input matInput placeholder="Specify Other Owner Name" formControlName="other_owners_name" autocomplete="off">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
@ -147,7 +155,7 @@
|
||||
|
||||
<mat-form-field *ngIf="loanDetailsForm.controls['construction_status'].value == 4">
|
||||
<input matInput placeholder="What is the approximate stage of construction (%)?"
|
||||
formControlName="percentage_of_construction" (keypress)="keyPress($event)" required>
|
||||
formControlName="percentage_of_construction" (keypress)="keyPress($event)" required autocomplete="off">
|
||||
</mat-form-field>
|
||||
|
||||
<!--<mat-select placeholder="Status of construction"
|
||||
@ -159,7 +167,7 @@
|
||||
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Estimate Market Value as Per Customer"
|
||||
formControlName="emv_per_customer" (keypress)="keyPress($event)" required>
|
||||
formControlName="emv_per_customer" (keypress)="keyPress($event)" required autocomplete="off">
|
||||
</mat-form-field>
|
||||
<!-- <mat-form-field>
|
||||
<input matInput placeholder="Value as Per Agreement"
|
||||
|
||||
@ -38,6 +38,7 @@ export class LoanDetailsComponent implements OnInit {
|
||||
|
||||
applicants: any;
|
||||
productAbbr: any;
|
||||
productID: any;
|
||||
subProductName: any;
|
||||
|
||||
isOtherPurpose: boolean = false;
|
||||
@ -70,8 +71,10 @@ export class LoanDetailsComponent implements OnInit {
|
||||
private router: Router,
|
||||
private _pd: PdTrigerService,
|
||||
@Inject(MAT_DIALOG_DATA) public pd_all_details: any) {
|
||||
|
||||
this.applicants = this.pd_all_details.pdapplicants_detials;
|
||||
this.productAbbr = this.pd_all_details.pdmaster_details.product_abbr;
|
||||
this.productID = this.pd_all_details.pdmaster_details.fk_product_id;
|
||||
this.subProductName = this.pd_all_details.pdmaster_details.subproduct_name;
|
||||
this.exist_loan_amt = this.pd_all_details.pdmaster_details.loan_amount != '' ? this.pd_all_details.pdmaster_details.loan_amount :'';
|
||||
this.loanAmtInWords = this._pd.convertNumberToWords(this.exist_loan_amt);
|
||||
@ -81,7 +84,8 @@ export class LoanDetailsComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
console.clear();
|
||||
console.log(this.pd_all_details);
|
||||
this.initloanDetailsForm();
|
||||
this.getM_EndUseofLoad();
|
||||
this.getM_sourceofamount();
|
||||
@ -123,6 +127,7 @@ export class LoanDetailsComponent implements OnInit {
|
||||
if(value.records.loan_amount){ this.loanAmtInWords = this._pd.convertNumberToWords(value.records.loan_amount); }
|
||||
|
||||
this.loanDetailsForm.controls['end_use'].setValue(enduse);
|
||||
this.endUserChange(enduse);
|
||||
if (value.records.end_use_other) {
|
||||
this.loanDetailsForm.controls['end_use_other'].setValue(value.records.end_use_other);
|
||||
}
|
||||
@ -187,9 +192,10 @@ export class LoanDetailsComponent implements OnInit {
|
||||
// =============
|
||||
|
||||
getM_EndUseofLoad() {
|
||||
this._pd.getAllMasterDatas('ENDUSEOFLOAN').subscribe(
|
||||
//this._pd.getAllMasterDatas('ENDUSEOFLOAN').subscribe(
|
||||
this._pd.getAllMasterDatas('SUBPRODUCTS').subscribe(
|
||||
data => {
|
||||
this.m_endUseofLoad = data.records.filter(data => data.isactive == 1);
|
||||
this.m_endUseofLoad = data.records.filter(data => data.isactive == 1 && data.fk_product_id == this.productID);
|
||||
},
|
||||
error => {
|
||||
// this.notifier.notify('warning', 'No Category Records Found.!');
|
||||
@ -307,15 +313,33 @@ getM_sourceofamount() {
|
||||
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;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
endUserChange(event) {
|
||||
this.endUserList = [];
|
||||
event.value.forEach(option => {
|
||||
event.forEach(option => {
|
||||
let othersData = this.m_endUseofLoad.filter(sub=>sub.subproduct_id==option)[0];
|
||||
othersData = othersData.name.substr(0,6).toLowerCase();
|
||||
|
||||
this.endUserList.push({ end_use: option });
|
||||
if (option == 'other') {
|
||||
if (othersData == 'others') {
|
||||
this.isOtherPurpose = true;
|
||||
return ;
|
||||
}else
|
||||
{
|
||||
this.isOtherPurpose = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ownerNameChange(event) {
|
||||
let EventValue;
|
||||
|
||||
@ -491,4 +515,21 @@ getM_sourceofamount() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* LoanCalculation
|
||||
*/
|
||||
loanCalc()
|
||||
{
|
||||
let BtAmount = this.loanDetailsForm.value.balance_transfer_amount;
|
||||
let loanAmount = this.loanDetailsForm.value.loan_amount;
|
||||
let topupAmt ;
|
||||
if(BtAmount !=null && BtAmount !='' && loanAmount !=null && loanAmount!='')
|
||||
{
|
||||
topupAmt = loanAmount - BtAmount;
|
||||
//topUpAmtInWords
|
||||
}
|
||||
this.loanDetailsForm.controls['topup_amount'].setValue(topupAmt);
|
||||
this.topUpAmtInWords = this._pd.convertNumberToWords(topupAmt);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
<!--<div *ngIf="listofCity.length > 0">
|
||||
<mat-card *ngFor="let city of listofCity; let i = index;">
|
||||
<h4>{{city.name}}</h4>
|
||||
<div *ngIf="city.branch_details.length > 0">
|
||||
<form class="example-form">
|
||||
<mat-form-field class="example-full-width">
|
||||
<input matInput placeholder="Add Branch" name="first" [(ngModel)]="newElement[city.name]">
|
||||
</mat-form-field> <span *ngIf="newElement[city.name]"><mat-icon (click)="addItem(city.name)">check</mat-icon></span>
|
||||
</form>
|
||||
<mat-list role="list" class="inlist">
|
||||
<ng-container *ngFor="let branch of city.branch_details; let i = index;">
|
||||
<mat-list-item role="listitem" *ngIf="branch.isactive == 1" class="list-item" [ngStyle]="{ 'border-color': i === currentElement ? '#f44336' : 'gray'}">
|
||||
<label style="width: 80%" [hidden]="currentElement === i">{{branch.branch_name}}</label>
|
||||
<input *ngIf="currentElement === i" matInput placeholder="Add Branch" [(ngModel)]="branch.branch_name">
|
||||
<span (click)="editItem(i)" [hidden]="currentElement === i"><mat-icon>edit</mat-icon></span>
|
||||
<span (click)="editItem(-1)" *ngIf="currentElement === i"><mat-icon>check</mat-icon></span>
|
||||
<span (click)="deleteItem(branch, i)"><mat-icon>delete</mat-icon></span>
|
||||
</mat-list-item>
|
||||
</ng-container>
|
||||
</mat-list>
|
||||
</div>
|
||||
<div *ngIf="city.branch_details.length == 0">
|
||||
<h2 style="color: #ddd; text-align: center;">No Records Found...</h2>
|
||||
</div>
|
||||
</mat-card>
|
||||
<pre>{{ newElement | json}}</pre>
|
||||
<div class="row" style="text-align:right;">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" (click)="reset();false"><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="button"
|
||||
(click)="saveBranch()"><mat-icon>save</mat-icon></button>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="listofCity.length == 0">
|
||||
<h2 style="color: #ddd; text-align: center;">No Records Found...</h2>
|
||||
</div>-->
|
||||
|
||||
<form [formGroup]="_addEntityBranchFrom" (submit)="onSubmit()">
|
||||
<div formArrayName="branch_details" class="example-full-width">
|
||||
<mat-card *ngFor="let region of _addEntityBranchFrom.controls.branch_details['controls']; let i=index">
|
||||
<mat-card-content *ngIf="region.get('isactive').value == 1">
|
||||
<div [formGroupName]="i">
|
||||
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="2%" fxLayoutAlign="center center">
|
||||
<mat-form-field fxFlex="30%">
|
||||
<input matInput placeholder="Branch Name" name="first" formControlName="branch_name">
|
||||
<mat-error *ngIf="submitted && region['controls'].branch_name.hasError('required')" class="mat-text-warn">Branch Name Required.!</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field fxFlex="30%">
|
||||
<mat-select placeholder="City *" formControlName="fk_city_id">
|
||||
<mat-option *ngFor="let city of m_city" [value]="city.fk_city_id">{{ city.name }}</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="submitted && region['controls'].fk_city_id.hasError('required')" class="mat-text-warn">City Required.!</mat-error>
|
||||
</mat-form-field>
|
||||
<div fxFlex="30%" style="text-align:center;">
|
||||
<!--<mat-checkbox *ngIf="region.get('entity_lender_branch_id').value != null" formControlName="isactive" [ngModel]="region.get('isactive').value == 1 ? true : region.get('isactive').value == 0 ? false : null"
|
||||
(ngModelChange)="region.get('isactive').value = $event ? 1 : 0"></mat-checkbox>
|
||||
|
||||
<span *ngIf="_addEntityBranchFrom.controls.branch_details.controls.length > 1" (click)="removeLanguage(i)">-->
|
||||
<button (click)="deleteEntityBranch(i, $event); false" mat-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Delete" matTooltipPosition="above"><mat-icon>delete</mat-icon></button>
|
||||
<!--</span>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div class="row" style="text-align:right;">
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1" color="primary" matTooltip="Add More Region Information" matTooltipPosition="above" (click)="addRegionFormData(null, $event); false"><mat-icon>add</mat-icon></button>
|
||||
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Reset" matTooltipPosition="above" (click)="reset();false"><mat-icon>settings_backup_restore</mat-icon></button>
|
||||
<button mat-raised-button mat-icon-button class="mr-1 mb-1 hover-icon" matTooltip="Save" matTooltipPosition="above" type="button" (click)="saveBranch(); false"><mat-icon>save</mat-icon></button>
|
||||
</div>
|
||||
</form>
|
||||
@ -0,0 +1,14 @@
|
||||
.inlist{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.inlist > * {
|
||||
width: 350px;
|
||||
}
|
||||
|
||||
.list-item {
|
||||
border: 1px solid gray;
|
||||
margin: 2px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { EntityBranchAddComponent } from './entity-branch-add.component';
|
||||
|
||||
describe('EntityBranchAddComponent', () => {
|
||||
let component: EntityBranchAddComponent;
|
||||
let fixture: ComponentFixture<EntityBranchAddComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EntityBranchAddComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(EntityBranchAddComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,245 @@
|
||||
import { Component, ViewChild, OnInit, OnDestroy, Input, Inject } from '@angular/core';
|
||||
import { MatPaginator, MatSort, MatTableDataSource, MatDialog, MatDialogRef, MAT_DIALOG_DATA, PageEvent } from '@angular/material';
|
||||
import { FormGroup, FormControl, FormBuilder, Validators, FormArray } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { DataSource } from '@angular/cdk/table';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { NotifierService } from 'angular-notifier';
|
||||
|
||||
import { MastersService } from './../../../service/masters/masters.service';
|
||||
import { EntityService } from './../../../service/entity/entity.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-entity-branch-add',
|
||||
templateUrl: './entity-branch-add.component.html',
|
||||
styleUrls: ['./entity-branch-add.component.scss']
|
||||
})
|
||||
export class EntityBranchAddComponent implements OnInit {
|
||||
|
||||
@Input() public entityId: number;
|
||||
public newElement: any= {};
|
||||
public listofCity = [];
|
||||
public listOfBranch = [];
|
||||
|
||||
public m_city: any = [];
|
||||
|
||||
public _addEntityBranchFrom: FormGroup;
|
||||
public submitted = false;
|
||||
|
||||
/**
|
||||
* Notifier service
|
||||
*/
|
||||
private notifier: NotifierService;
|
||||
|
||||
constructor(
|
||||
notifier: NotifierService,
|
||||
private entityService: EntityService,
|
||||
private mastersService: MastersService,
|
||||
private _formBuilder: FormBuilder) {
|
||||
this.notifier = notifier;
|
||||
this._addEntityBranchFrom = this._formBuilder.group({
|
||||
branch_details: this._formBuilder.array([
|
||||
// this.addRegionFormData(null, null),
|
||||
])
|
||||
})
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.entityService.getEntityBranchList(this.entityId).subscribe(data => {
|
||||
if (data.dataStatus) {
|
||||
this.listofCity = data.records;
|
||||
this.m_city = data.records.city_master;
|
||||
// this.listOfBranch = data.records;
|
||||
this.setFormDatas(data.records.branch_details);
|
||||
}
|
||||
}, err => {
|
||||
})
|
||||
}
|
||||
|
||||
setFormDatas(record) {
|
||||
if (record.length > 0) {
|
||||
for (let val of record) {
|
||||
let vals = {
|
||||
entity_lender_branch_id: val.entity_lender_branch_id,
|
||||
branch_name: val.branch_name,
|
||||
fk_entity_id: val.fk_entity_id,
|
||||
fk_region_id: val.fk_region_id,
|
||||
fk_city_id: val.fk_city_id,
|
||||
fk_updatedby: val.fk_updatedby,
|
||||
fk_createdby: val.fk_createdby,
|
||||
isactive: val.isactive,
|
||||
};
|
||||
this.addRegionFormData(vals, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// convenience getter for easy access to form fields
|
||||
get f() { return this._addEntityBranchFrom.controls; }
|
||||
|
||||
// Dynamic Form field creation Functionality : START ===>
|
||||
initRegionFormLoad(data) {
|
||||
return this._formBuilder.group({
|
||||
entity_lender_branch_id: [data.entity_lender_branch_id],
|
||||
branch_name: [data.branch_name, Validators.compose([Validators.required])],
|
||||
fk_city_id: [data.fk_city_id, Validators.compose([Validators.required])],
|
||||
fk_entity_id: [data.fk_entity_id],
|
||||
fk_updatedby: [data.fk_updatedby],
|
||||
fk_createdby: [data.fk_createdby],
|
||||
isactive: [data.isactive],
|
||||
});
|
||||
}
|
||||
addRegionFormData(data, e) {
|
||||
if (data == null) {
|
||||
let newDate = {
|
||||
entity_lender_branch_id: null,
|
||||
branch_name:null,
|
||||
fk_entity_id: this.entityId,
|
||||
fk_createdby: null,
|
||||
fk_updatedby: null,
|
||||
fk_city_id: null,
|
||||
isactive: 1,
|
||||
}
|
||||
const control = <FormArray>this._addEntityBranchFrom.controls['branch_details'];
|
||||
control.push(this.initRegionFormLoad(newDate));
|
||||
} else {
|
||||
const control = <FormArray>this._addEntityBranchFrom.controls['branch_details'];
|
||||
control.push(this.initRegionFormLoad(data));
|
||||
}
|
||||
}
|
||||
|
||||
deleteEntityBranch(inx, e) {
|
||||
e.stopPropagation();
|
||||
const control = <FormArray>this._addEntityBranchFrom.controls['branch_details'];
|
||||
// let dataS = control.controls[inx].value;
|
||||
if(control.controls[inx].value['entity_lender_branch_id'] !== null){
|
||||
console.log( this._addEntityBranchFrom.controls['branch_details']['controls'][inx].controls.isactive);
|
||||
this._addEntityBranchFrom.controls['branch_details']['controls'][inx].controls.isactive.setValue("0");
|
||||
console.log( this._addEntityBranchFrom.controls['branch_details']['controls'][inx].controls.isactive.value);
|
||||
} else {
|
||||
control.removeAt(inx);
|
||||
}
|
||||
}
|
||||
|
||||
// public listOfBranch = [
|
||||
// {
|
||||
// "entity_lender_branch_id": 1,
|
||||
// "branch_name": "Dev Test Branch 1",
|
||||
// "isactive": "1",
|
||||
// "fk_createdby": "1",
|
||||
// "fk_updatedby": "1",
|
||||
// "fk_entity_id": "1"
|
||||
// },
|
||||
// {
|
||||
// "entity_lender_branch_id": 2,
|
||||
// "branch_name": "Dev Test Branch 2",
|
||||
// "isactive": "1",
|
||||
// "fk_createdby": "1",
|
||||
// "fk_updatedby": "1",
|
||||
// "fk_entity_id": "1"
|
||||
// },
|
||||
// {
|
||||
// "entity_lender_branch_id": 3,
|
||||
// "branch_name": "Dev Test Branch 3",
|
||||
// "isactive": "1",
|
||||
// "fk_createdby": "1",
|
||||
// "fk_updatedby": "1",
|
||||
// "fk_entity_id": "1"
|
||||
// }
|
||||
// ];
|
||||
|
||||
addItem(prop): void {
|
||||
// let data = {
|
||||
// "entity_lender_branch_id": null,
|
||||
// "branch_name": this.newElement.name,
|
||||
// "isactive": "1",
|
||||
// "fk_createdby": null,
|
||||
// "fk_updatedby": null,
|
||||
// "fk_entity_id": this.entityId.toString()
|
||||
// }
|
||||
// this.listOfBranch.push(data);
|
||||
// this.newElement.name = '';
|
||||
}
|
||||
|
||||
public currentElement = -1;
|
||||
editItem(i): void {
|
||||
this.currentElement = i;
|
||||
}
|
||||
|
||||
deleteItem(obj, i): void {
|
||||
if (obj.entity_lender_branch_id !== null) {
|
||||
obj.isactive = 0;
|
||||
} else {
|
||||
this.listOfBranch.splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/** To Save/Edited Popup Data */
|
||||
onSubmit() {
|
||||
alert();
|
||||
this.submitted = true;
|
||||
// stop here if form is invalid
|
||||
if (this._addEntityBranchFrom.invalid) {
|
||||
// this.errorMessage = "Please Fill All Mandate Fields.";
|
||||
return;
|
||||
} else {
|
||||
var formValues = this._addEntityBranchFrom.value;
|
||||
//To Remove The "Null" With Key also
|
||||
Object.keys(formValues).forEach((key) => (formValues[key] == null) && delete formValues[key]);
|
||||
alert(JSON.stringify(formValues.branch_details));
|
||||
// this.entityService.updateEntityIdRegionInfoDetails(formValues.region_lender).subscribe(
|
||||
// dataresult => {
|
||||
// if (dataresult.status == 200) {
|
||||
// console.log(dataresult);
|
||||
// this.notifier.notify('success', 'Your Changes Updated.!');
|
||||
// const arr = <FormArray>this._editEntityRegionFrom.controls.region_lender;
|
||||
// arr.controls.splice(0);
|
||||
// // this.getEntityIDRegionInfoDetails();
|
||||
// }
|
||||
// else {
|
||||
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
// // this.errorMessage = "Something Wents Wrong Try Again.!";
|
||||
// }
|
||||
// }, error => {
|
||||
// this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
// // this.errorMessage = "Some Thing Wents Wrong Try Again.!";
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
saveBranch(): void {
|
||||
// alert();
|
||||
var formValues = this._addEntityBranchFrom.value;
|
||||
//To Remove The "Null" With Key also
|
||||
Object.keys(formValues).forEach((key) => (formValues[key] == null) && delete formValues[key]);
|
||||
// alert(JSON.stringify(formValues.branch_details));
|
||||
|
||||
this.entityService.updateEntityIdBranchInfoDetails(formValues.branch_details).subscribe(data => {
|
||||
if (data.dataStatus) {
|
||||
this.notifier.notify('success', 'Your Changes Updated.!');
|
||||
} else {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
}
|
||||
}, err => {
|
||||
this.notifier.notify('warning', 'Something Wents Wrong Try Again.!');
|
||||
})
|
||||
}
|
||||
|
||||
reset(): void {
|
||||
this.listOfBranch = [];
|
||||
this.ngOnInit();
|
||||
}
|
||||
}
|
||||
|
||||
// "records": [
|
||||
// {
|
||||
// "entity_lender_branch_id": null,
|
||||
// "branch_name": "Dev Test Branch",
|
||||
// "isactive": "1",
|
||||
// "fk_createdby": "1",
|
||||
// "fk_updatedby": "1",
|
||||
// "fk_entity_id": "1"
|
||||
// }
|
||||
// ]
|
||||
@ -233,6 +233,12 @@
|
||||
<app-entity-edit-vendor-city-info [entityId]="entity_id">
|
||||
</app-entity-edit-vendor-city-info>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<mat-tab *ngIf="localEntityType == 2" label="Branch">
|
||||
<ng-template matTabContent>
|
||||
<app-entity-branch-add [entityId]="entity_id">
|
||||
</app-entity-branch-add>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
<mat-tab label="TAT Information">
|
||||
<ng-template matTabContent>
|
||||
|
||||
@ -38,6 +38,7 @@ import { EntityEditBillingInfoComponent } from './entity-edit/entity-edit-billin
|
||||
|
||||
import { DialogAddEditBillingInfo } from './entity-edit/entity-edit-billing-info/entity-edit-billing-info.component';
|
||||
import { EntityEditVendorCityInfoComponent } from './entity-edit/entity-edit-vendor-city-info/entity-edit-vendor-city-info.component';
|
||||
import { EntityBranchAddComponent } from './entity-edit/entity-branch-add/entity-branch-add.component';
|
||||
// import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
/**
|
||||
* Custom angular notifier options
|
||||
@ -115,7 +116,8 @@ const customNotifierOptions: NotifierOptions = {
|
||||
EntityEditPriceComponent,
|
||||
EntityEditBillingInfoComponent,
|
||||
DialogAddEditBillingInfo,
|
||||
EntityEditVendorCityInfoComponent
|
||||
EntityEditVendorCityInfoComponent,
|
||||
EntityBranchAddComponent
|
||||
],
|
||||
entryComponents: [
|
||||
EntityEditComponent,
|
||||
|
||||
@ -165,6 +165,22 @@ export class EntityService {
|
||||
}
|
||||
|
||||
|
||||
getEntityBranchList(entity_id: any): Observable<any> {
|
||||
// Add safe, URL encoded search parameter if there is a search term
|
||||
const options = entity_id ?
|
||||
{ params: new HttpParams().set('entityid', entity_id) } : {};
|
||||
|
||||
return this._http.get<any[]>(this.apiUrl + "listLenderBranches", options);
|
||||
}
|
||||
|
||||
updateEntityIdBranchInfoDetails(Records: any): Observable<any>{
|
||||
Records.map(data=>{
|
||||
data.fk_updatedby = data.fk_createdby == null ? null : this._aws.getlocale();
|
||||
data.fk_createdby = data.fk_createdby == null ? this._aws.getlocale() : data.fk_createdby;
|
||||
})
|
||||
return this._http.post<any[]>(this.apiUrl + "saveLenderBranches", {'records': Records });
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TO Handle The Error
|
||||
|
||||
Loading…
Reference in New Issue
Block a user