Fixed Deposit account request fixes

This commit is contained in:
Jose Alberto Hernandez
2023-12-12 10:01:55 +01:00
committed by Adam Saghy
parent 363806286a
commit 76bdff35dc
15 changed files with 75 additions and 64 deletions
@@ -1,7 +1,7 @@
<div class="container">
<mat-horizontal-stepper class="mat-elevation-z8" labelPosition="bottom" #fixedDepositAccountStepper>
<ng-template matStepperIcon="number">
<fa-icon icon="pencil-alt" size="sm"></fa-icon>
</ng-template>
@@ -33,17 +33,6 @@
</mat-step>
<mat-step [stepControl]="fixedDepositAccountDetailsForm.get('productId')">
<ng-template matStepLabel>{{"labels.inputs.CURRENCY" | translate }}</ng-template>
<mifosx-fixed-deposit-account-currency-step
[fixedDepositsAccountTemplate]="fixedDepositsAccountTemplate"
[fixedDepositsAccountProductTemplate]="fixedDepositsAccountProductTemplate">
</mifosx-fixed-deposit-account-currency-step>
</mat-step>
<mat-step [stepControl]="fixedDepositAccountTermsForm">
<ng-template matStepLabel>{{"labels.inputs.TERMS" | translate }}</ng-template>
@@ -84,8 +73,7 @@
<mifosx-fixed-deposit-account-charges-step
[fixedDepositsAccountTemplate]="fixedDepositsAccountTemplate"
[fixedDepositsAccountProductTemplate]="fixedDepositsAccountProductTemplate"
[fixedDepositAccountFormValid]="fixedDepositAccountFormValid"
[currencyCode]="fixedDepositAccountCurrencyForm.get('currencyCode')">
[fixedDepositAccountFormValid]="fixedDepositAccountFormValid">
</mifosx-fixed-deposit-account-charges-step>
</mat-step>
@@ -8,7 +8,6 @@ import { SettingsService } from 'app/settings/settings.service';
/** Custom Components */
import { FixedDepositAccountDetailsStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-details-step/fixed-deposit-account-details-step.component';
import { FixedDepositAccountCurrencyStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-currency-step/fixed-deposit-account-currency-step.component';
import { FixedDepositAccountTermsStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-terms-step/fixed-deposit-account-terms-step.component';
import { FixedDepositAccountSettingsStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-settings-step/fixed-deposit-account-settings-step.component';
import { FixedDepositAccountChargesStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-charges-step/fixed-deposit-account-charges-step.component';
@@ -26,8 +25,6 @@ export class CreateFixedDepositAccountComponent {
/** Fixed Deposits Account Details Step */
@ViewChild(FixedDepositAccountDetailsStepComponent, { static: true }) fixedDepositsAccountDetailsStep: FixedDepositAccountDetailsStepComponent;
/** Fixed Deposits Account Currency Step */
@ViewChild(FixedDepositAccountCurrencyStepComponent, { static: true }) fixedDepositAccountCurrencyStep: FixedDepositAccountCurrencyStepComponent;
/** Fixed Deposits Account Terms Step */
@ViewChild(FixedDepositAccountTermsStepComponent, { static: true }) fixedDepositAccountTermsStep: FixedDepositAccountTermsStepComponent;
/** Fixed Deposits Account Settings Step */
@@ -73,13 +70,6 @@ export class CreateFixedDepositAccountComponent {
return this.fixedDepositsAccountDetailsStep.fixedDepositAccountDetailsForm;
}
/**
* Retrieves Fixed Deposit Account Currency Form Data
*/
get fixedDepositAccountCurrencyForm() {
return this.fixedDepositAccountCurrencyStep.fixedDepositAccountCurrencyForm;
}
/**
* Retrieves Fixed Deposit Account Terms Form Data
*/
@@ -33,17 +33,6 @@
</mat-step>
<mat-step [stepControl]="fixedDepositAccountDetailsForm.get('productId')">
<ng-template matStepLabel>{{"labels.inputs.CURRENCY" | translate }}</ng-template>
<mifosx-fixed-deposit-account-currency-step
[fixedDepositsAccountTemplate]="fixedDepositsAccountAndTemplate"
[fixedDepositsAccountProductTemplate]="fixedDepositsAccountProductTemplate">
</mifosx-fixed-deposit-account-currency-step>
</mat-step>
<mat-step [stepControl]="fixedDepositAccountTermsForm">
<ng-template matStepLabel>{{"labels.inputs.TERMS" | translate }}</ng-template>
@@ -84,8 +73,7 @@
<mifosx-fixed-deposit-account-charges-step
[fixedDepositsAccountTemplate]="fixedDepositsAccountAndTemplate"
[fixedDepositsAccountProductTemplate]="fixedDepositsAccountProductTemplate"
[fixedDepositAccountFormValid]="fixedDepositAccountFormValidAndNotPristine"
[currencyCode]="fixedDepositAccountCurrencyForm.get('currencyCode')">
[fixedDepositAccountFormValid]="fixedDepositAccountFormValidAndNotPristine">
</mifosx-fixed-deposit-account-charges-step>
</mat-step>
@@ -13,6 +13,7 @@ import { FixedDepositAccountTermsStepComponent } from '../fixed-deposit-account-
import { FixedDepositAccountSettingsStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-settings-step/fixed-deposit-account-settings-step.component';
import { FixedDepositAccountChargesStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-charges-step/fixed-deposit-account-charges-step.component';
import { Dates } from 'app/core/utils/dates';
import { Currency } from 'app/shared/models/general.model';
/**
* Edit Fixed Deposit Account Component
@@ -40,6 +41,8 @@ export class EditFixedDepositAccountComponent {
/** Fixed Deposit Account Product Template */
fixedDepositsAccountProductTemplate: any;
currency: Currency;
/**
* Fetches FD account template from `resolve`
* @param {ActivatedRoute} route Activated Route
@@ -64,6 +67,7 @@ export class EditFixedDepositAccountComponent {
*/
setTemplate($event: any) {
this.fixedDepositsAccountProductTemplate = $event;
this.currency = this.fixedDepositsAccountAndTemplate.currency;
}
/**
@@ -119,7 +123,7 @@ export class EditFixedDepositAccountComponent {
...this.fixedDepositsAccountDetailsStep.fixedDepositAccountDetails,
...this.fixedDepositAccountTermsStep.fixedDepositAccountTerms,
...this.fixedDepositAccountSettingsStep.fixedDepositAccountSettings,
...this.fixedDepositAccountChargesStep.fixedDepositAccountCharges,
...this.fixedDepositAccountChargesStep?.fixedDepositAccountCharges
};
}
@@ -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>
@@ -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
@@ -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%">
@@ -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);
@@ -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>
@@ -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 }}
@@ -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>
@@ -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,
});
}
}
/**
@@ -7,6 +7,15 @@
<h4 class="table-headers">{{"labels.heading.Fixed Deposit Details" | translate }}</h4>
<table>
<tbody>
<tr>
<td>{{"labels.inputs.External Id" | translate }}</td>
<td>
<span *ngIf="fixedDepositsAccountData.externalId">
<mifosx-external-identifier externalId="{{fixedDepositsAccountData.externalId}}" completed="true"></mifosx-external-identifier>
</span>
<span *ngIf="!fixedDepositsAccountData.externalId"> {{"labels.inputs.Not Available" | translate}} </span>
</td>
</tr>
<tr>
<td>{{"labels.inputs.Activated On" | translate }}</td>
<td>{{fixedDepositsAccountData.timeline.activatedOnDate ? (fixedDepositsAccountData.timeline.activatedOnDate | dateFormat) : 'Not Activated'}}</td>
+4 -4
View File
@@ -64,8 +64,8 @@ export interface Charge {
isPaymentType?: boolean;
currency?: Currency;
amount?: number;
chargeTimeType?: Charge;
chargeAppliesTo?: Charge;
chargeCalculationType?: Charge;
chargePaymentMode?: Charge;
chargeTimeType?: OptionData;
chargeAppliesTo?: OptionData;
chargeCalculationType?: OptionData;
chargePaymentMode?: OptionData;
}
+1 -1
View File
@@ -67,7 +67,7 @@ export class TasksService {
.set('status', '100');
return this.http.get('/loans', { params: httpParams });
}
/**
* Get all loans to be created
*/