Fixed Deposit account request fixes
This commit is contained in:
committed by
Adam Saghy
parent
363806286a
commit
76bdff35dc
+1
-1
@@ -3,7 +3,7 @@
|
||||
<mat-form-field fxFlex="48%">
|
||||
<mat-label>{{"labels.inputs.Charge" | translate }}</mat-label>
|
||||
<mat-select #charge>
|
||||
<mat-option *ngFor="let charge of chargeData | chargesFilter:chargesDataSource:currencyCode.value"
|
||||
<mat-option *ngFor="let charge of chargeData"
|
||||
[value]="charge">
|
||||
{{ charge.name }}
|
||||
</mat-option>
|
||||
|
||||
+17
-12
@@ -12,6 +12,7 @@ import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicke
|
||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { Charge, Currency } from 'app/shared/models/general.model';
|
||||
|
||||
/**
|
||||
* Fixed Deposit Account Charges Step
|
||||
@@ -30,7 +31,7 @@ export class FixedDepositAccountChargesStepComponent implements OnInit, OnChange
|
||||
/** Validity of fixed depsits account form */
|
||||
@Input() fixedDepositAccountFormValid: boolean;
|
||||
/** Currency Code */
|
||||
@Input() currencyCode: UntypedFormControl;
|
||||
currency: Currency | null = null;
|
||||
|
||||
/** Charges Data */
|
||||
chargeData: any;
|
||||
@@ -53,21 +54,25 @@ export class FixedDepositAccountChargesStepComponent implements OnInit, OnChange
|
||||
private settingsService: SettingsService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.currencyCode.valueChanges.subscribe(() => {
|
||||
if (!this.isChargesPatched && this.fixedDepositsAccountTemplate.charges) {
|
||||
this.chargesDataSource = this.fixedDepositsAccountTemplate.charges.map((charge: any) => ({...charge, id: charge.chargeId})) || [];
|
||||
this.isChargesPatched = true;
|
||||
} else {
|
||||
this.chargesDataSource = [];
|
||||
}
|
||||
});
|
||||
this.chargesDataSource = [];
|
||||
if (this.fixedDepositsAccountTemplate.id && this.fixedDepositsAccountTemplate.charges) {
|
||||
this.chargesDataSource = this.fixedDepositsAccountTemplate.charges.map((charge: any) => ({...charge, id: charge.chargeId})) || [];
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges() {
|
||||
if (this.fixedDepositsAccountProductTemplate) {
|
||||
this.chargeData = this.fixedDepositsAccountProductTemplate.chargeOptions;
|
||||
if (this.currency == null) {
|
||||
if (this.fixedDepositsAccountTemplate.currency) {
|
||||
this.currency = this.fixedDepositsAccountTemplate.currency;
|
||||
} else if (this.fixedDepositsAccountProductTemplate && this.fixedDepositsAccountProductTemplate.currency) {
|
||||
this.currency = this.fixedDepositsAccountProductTemplate.currency;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.fixedDepositsAccountProductTemplate) {
|
||||
this.chargeData = this.fixedDepositsAccountProductTemplate.chargeOptions
|
||||
.filter((c: Charge) => c.currency.code === this.currency.code);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a charge
|
||||
|
||||
+7
-2
@@ -14,7 +14,7 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field fxFlex="48%" (click)="submittedOnDatePicker.open()">
|
||||
<mat-form-field fxFlex="48%" (click)="submittedOnDatePicker.open()" *ngIf="isProductSelected">
|
||||
<mat-label>{{"labels.inputs.Submitted On" | translate }}</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="submittedOnDatePicker"
|
||||
formControlName="submittedOnDate" required>
|
||||
@@ -25,7 +25,7 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field fxFlex="48%">
|
||||
<mat-form-field fxFlex="48%" *ngIf="isProductSelected">
|
||||
<mat-label>{{"labels.inputs.Field Officer" | translate }}</mat-label>
|
||||
<mat-select formControlName="fieldOfficerId">
|
||||
<mat-option *ngFor="let officer of fieldOfficerData" [value]="officer.id">
|
||||
@@ -34,6 +34,11 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field fxFlex="48%" *ngIf="isProductSelected">
|
||||
<mat-label>{{"labels.inputs.External id" | translate}}</mat-label>
|
||||
<input matInput formControlName="externalId" matTooltip="{{ 'tooltips.Provides an external id' | translate}}">
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
|
||||
<div fxLayout="row" class="margin-t" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="2%">
|
||||
|
||||
+8
-2
@@ -32,6 +32,8 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit {
|
||||
/** Fixed Deposits Account Details Form */
|
||||
fixedDepositAccountDetailsForm: UntypedFormGroup;
|
||||
|
||||
isProductSelected = false;
|
||||
|
||||
/** Fixed Deposits Account Template with product data */
|
||||
@Output() fixedDepositsAccountProductTemplate = new EventEmitter();
|
||||
|
||||
@@ -55,7 +57,9 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit {
|
||||
if (this.fixedDepositsAccountTemplate.depositProductId) {
|
||||
this.fixedDepositAccountDetailsForm.patchValue({
|
||||
'productId': this.fixedDepositsAccountTemplate.depositProductId,
|
||||
'submittedOnDate': this.fixedDepositsAccountTemplate.timeline.submittedOnDate && new Date(this.fixedDepositsAccountTemplate.timeline.submittedOnDate)
|
||||
'submittedOnDate': this.fixedDepositsAccountTemplate.timeline.submittedOnDate
|
||||
&& new Date(this.fixedDepositsAccountTemplate.timeline.submittedOnDate),
|
||||
'externalId': this.fixedDepositsAccountTemplate.externalId || '',
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -68,7 +72,8 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit {
|
||||
this.fixedDepositAccountDetailsForm = this.formBuilder.group({
|
||||
'productId': ['', Validators.required],
|
||||
'submittedOnDate': ['', Validators.required],
|
||||
'fieldOfficerId': ['']
|
||||
'fieldOfficerId': [''],
|
||||
'externalId': ['']
|
||||
});
|
||||
}
|
||||
|
||||
@@ -80,6 +85,7 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit {
|
||||
this.fixedDepositAccountDetailsForm.get('productId').valueChanges.subscribe((productId: string) => {
|
||||
this.fixedDepositsService.getFixedDepositsAccountTemplate(clientId, productId).subscribe((response: any) => {
|
||||
this.fixedDepositsAccountProductTemplate.emit(response);
|
||||
this.isProductSelected = true;
|
||||
this.fieldOfficerData = response.fieldOfficerOptions;
|
||||
if (!this.isFieldOfficerPatched && this.fixedDepositsAccountTemplate.fieldOfficerId) {
|
||||
this.fixedDepositAccountDetailsForm.get('fieldOfficerId').patchValue(this.fixedDepositsAccountTemplate.fieldOfficerId);
|
||||
|
||||
+5
@@ -14,6 +14,11 @@
|
||||
<span fxFlex="60%">{{ fixedDepositAccountData.submittedOnDate | dateFormat }}</span>
|
||||
</div>
|
||||
|
||||
<div fxFlexFill *ngIf="fixedDepositAccountData.externalId">
|
||||
<span fxFlex="40%">{{"labels.inputs.External Id" | translate }}</span>
|
||||
<span fxFlex="60%">{{ fixedDepositAccountData.externalId }}</span>
|
||||
</div>
|
||||
|
||||
<div fxFlexFill>
|
||||
<span fxFlex="40%">{{"labels.inputs.Field Officer" | translate }}</span>
|
||||
<span fxFlex="60%">{{ (fixedDepositAccountData.fieldOfficerId | find:fixedDepositsAccountProductTemplate.fieldOfficerOptions:'id':'displayName') || 'Unassigned' }}</span>
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@
|
||||
</mat-checkbox>
|
||||
|
||||
<mat-form-field fxFlex="48%" *ngIf="fixedDepositAccountSettingsForm.contains('linkAccountId')" class="margin-b">
|
||||
<mat-label>{{"labels.inputs.Link Savings Account" | translate }}</mat-label>
|
||||
<mat-label>{{"labels.inputs.Linked Savings Account" | translate }}</mat-label>
|
||||
<mat-select formControlName="linkAccountId" required>
|
||||
<mat-option *ngFor="let account of savingsAccountsData" [value]="account.id">
|
||||
{{ account.accountNo }}
|
||||
|
||||
+2
-2
@@ -13,10 +13,10 @@
|
||||
<span fxFlex="48%" fxHide.lt-md></span>
|
||||
|
||||
<mat-form-field fxFlex="48%">
|
||||
<mat-label>{{"labels.inputs.Deposit Period Frequency" | translate }}</mat-label>
|
||||
<mat-label>{{"labels.inputs.Deposit Period" | translate }}</mat-label>
|
||||
<input type="number" matInput formControlName="depositPeriod" required>
|
||||
<mat-error>
|
||||
{{"labels.inputs.Deposit Period Frequency" | translate }} {{ "labels.commons.is" |translate}} <strong>{{ "labels.commons.required" | translate}}</strong>
|
||||
{{"labels.inputs.Deposit Period" | translate }} {{ "labels.commons.is" |translate}} <strong>{{ "labels.commons.required" | translate}}</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
+12
-1
@@ -52,7 +52,7 @@ export class FixedDepositAccountTermsStepComponent implements OnInit, OnChanges
|
||||
|
||||
ngOnInit() {
|
||||
this.maxDate = this.settingsService.businessDate;
|
||||
if (this.fixedDepositsAccountTemplate.interestCompoundingPeriodType) {
|
||||
if (this.fixedDepositsAccountTemplate.id) {
|
||||
this.fixedDepositAccountTermsForm.patchValue({
|
||||
'interestCompoundingPeriodType': this.fixedDepositsAccountTemplate.interestCompoundingPeriodType.id,
|
||||
'interestPostingPeriodType': this.fixedDepositsAccountTemplate.interestPostingPeriodType.id,
|
||||
@@ -89,6 +89,17 @@ export class FixedDepositAccountTermsStepComponent implements OnInit, OnChanges
|
||||
this.interestCalculationTypeData = this.fixedDepositsAccountProductTemplate.interestCalculationTypeOptions;
|
||||
this.interestCalculationDaysInYearTypeData = this.fixedDepositsAccountProductTemplate.interestCalculationDaysInYearTypeOptions;
|
||||
this.periodFrequencyTypeData = this.fixedDepositsAccountProductTemplate.periodFrequencyTypeOptions;
|
||||
if (!this.fixedDepositsAccountTemplate.id) {
|
||||
this.fixedDepositAccountTermsForm.patchValue({
|
||||
'interestCompoundingPeriodType': this.fixedDepositsAccountProductTemplate.interestCompoundingPeriodType.id,
|
||||
'interestPostingPeriodType': this.fixedDepositsAccountProductTemplate.interestPostingPeriodType.id,
|
||||
'interestCalculationType': this.fixedDepositsAccountProductTemplate.interestCalculationType.id,
|
||||
'interestCalculationDaysInYearType': this.fixedDepositsAccountProductTemplate.interestCalculationDaysInYearType.id,
|
||||
'depositAmount': this.fixedDepositsAccountProductTemplate.depositAmount,
|
||||
'depositPeriod': this.fixedDepositsAccountProductTemplate.minDepositTerm,
|
||||
'depositPeriodFrequencyId': this.fixedDepositsAccountProductTemplate.minDepositTermType.id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user