Fixed Deposit account request with Maturity Instruction

This commit is contained in:
Jose Alberto Hernandez
2023-12-22 15:28:04 +01:00
committed by Adam Saghy
parent af97eba60b
commit 77814f03a1
22 changed files with 73 additions and 137 deletions
@@ -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';
@@ -27,8 +26,6 @@ export class EditFixedDepositAccountComponent {
/** 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 */
@@ -77,13 +74,6 @@ export class EditFixedDepositAccountComponent {
return this.fixedDepositsAccountDetailsStep.fixedDepositAccountDetailsForm;
}
/**
* Retrieves Fixed Deposit Account Currency Form Data
*/
get fixedDepositAccountCurrencyForm() {
return this.fixedDepositAccountCurrencyStep.fixedDepositAccountCurrencyForm;
}
/**
* Retrieves Fixed Deposit Account Terms Form Data
*/
@@ -1,33 +0,0 @@
<form [formGroup]="fixedDepositAccountCurrencyForm">
<div fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column">
<mat-form-field fxFlex="48%">
<mat-label>{{"labels.inputs.Currency" | translate }}</mat-label>
<input type="text" matInput formControlName="currencyCode" >
</mat-form-field>
<mat-form-field fxFlex="48%">
<mat-label>{{"labels.inputs.Decimal Places" | translate }}</mat-label>
<input type="number" matInput formControlName="decimalPlaces" >
</mat-form-field>
<mat-form-field fxFlex="48%">
<mat-label>{{"labels.inputs.Currency Multiple" | translate }}</mat-label>
<input type="number" matInput formControlName="currencyMultiple">
</mat-form-field>
</div>
<div fxLayout="row" class="margin-t" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="2%">
<button mat-raised-button matStepperPrevious>
<fa-icon icon="arrow-left" class="m-r-10"></fa-icon>
{{"labels.buttons.Previous" | translate }}
</button>
<button mat-raised-button matStepperNext>
{{"labels.buttons.Next" | translate }}
<fa-icon icon="arrow-right" class="m-l-10"></fa-icon>
</button>
</div>
</form>
@@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FixedDepositAccountCurrencyStepComponent } from './fixed-deposit-account-currency-step.component';
describe('FixedDepositAccountCurrencyStepComponent', () => {
let component: FixedDepositAccountCurrencyStepComponent;
let fixture: ComponentFixture<FixedDepositAccountCurrencyStepComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FixedDepositAccountCurrencyStepComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(FixedDepositAccountCurrencyStepComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -1,53 +0,0 @@
/** Angular Imports */
import { Component, OnChanges, Input } from '@angular/core';
import { UntypedFormGroup, UntypedFormBuilder } from '@angular/forms';
/**
* Fixed Deposit Account Currency Step
*/
@Component({
selector: 'mifosx-fixed-deposit-account-currency-step',
templateUrl: './fixed-deposit-account-currency-step.component.html',
styleUrls: ['./fixed-deposit-account-currency-step.component.scss']
})
export class FixedDepositAccountCurrencyStepComponent implements OnChanges {
/** Fixed deposits account template */
@Input() fixedDepositsAccountTemplate: any;
/** Fixed deposits account and product template */
@Input() fixedDepositsAccountProductTemplate: any;
/** Fixed Deposit Account Currency Form */
fixedDepositAccountCurrencyForm: UntypedFormGroup;
/** Currency Data */
currencyData: any;
/**
* @param {FormBuilder} formBuilder Form Builder
*/
constructor(private formBuilder: UntypedFormBuilder) {
this.createFixedDepositAccountCurrencyForm();
}
ngOnChanges() {
if (this.fixedDepositsAccountProductTemplate) {
this.fixedDepositAccountCurrencyForm.patchValue({
'currencyCode': this.fixedDepositsAccountProductTemplate.currency.code,
'decimalPlaces': this.fixedDepositsAccountProductTemplate.currency.decimalPlaces,
'currencyMultiple': this.fixedDepositsAccountProductTemplate.currency.inMultiplesOf
});
}
}
/**
* Creates fd currency form.
*/
createFixedDepositAccountCurrencyForm() {
this.fixedDepositAccountCurrencyForm = this.formBuilder.group({
'currencyCode': [{ value: '', disabled: true}],
'decimalPlaces': [{ value: '', disabled: true }],
'currencyMultiple': [{ value: '', disabled: true }]
});
}
}
@@ -111,6 +111,11 @@
<span fxFlex="60%">{{ fixedDepositAccountData.linkAccountId | find:fixedDepositsAccountProductTemplate.savingsAccounts:'id':'accountNo' }}</span>
</div>
<div fxFlexFill *ngIf="fixedDepositAccountData.maturityInstructionId">
<span fxFlex="40%">{{"labels.inputs.Maturity Instructions" | translate }}</span>
<span fxFlex="60%">{{ fixedDepositAccountData.maturityInstructionId | find:fixedDepositsAccountProductTemplate.maturityInstructionOptions:'id':'value' }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">{{"labels.inputs.Apply Penal Interest (less)" | translate }}:</span>
<span fxFlex="60%">{{ fixedDepositsAccountProductTemplate.preClosurePenalApplicable ? 'Yes' : 'No' }}</span>
@@ -95,6 +95,29 @@
<mat-divider fxFlex="98%"></mat-divider>
<mat-form-field fxFlex="48%">
<mat-label>{{"labels.inputs.Maturity Instructions" | translate }}</mat-label>
<mat-select formControlName="maturityInstructionId">
<mat-option *ngFor="let maturityInstruction of maturityInstructionOptions" [value]="maturityInstruction.id">
{{ maturityInstruction.value }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field fxFlex="48%" *ngIf="fixedDepositAccountSettingsForm.contains('transferToSavingsId')" class="margin-b">
<mat-label>{{"labels.inputs.Transfer to savings account" | translate }}</mat-label>
<mat-select formControlName="transferToSavingsId" required>
<mat-option *ngFor="let account of savingsAccountsData" [value]="account.id">
{{ account.accountNo }}
</mat-option>
</mat-select>
<mat-error>
{{"labels.inputs.Transfer to savings account" | translate }} {{ "labels.commons.is" |translate}} <strong>{{ "labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>
<mat-divider fxFlex="98%"></mat-divider>
<h4 fxFlex="23%" class="mat-h4">{{"labels.heading.For Pre-mature closure" | translate }}</h4>
<mat-checkbox fxFlex="73%" labelPosition="before" formControlName="preClosurePenalApplicable" class="margin-v">
@@ -2,6 +2,7 @@
import { Component, OnInit, Input, OnChanges } from '@angular/core';
import { UntypedFormGroup, UntypedFormBuilder, UntypedFormControl, Validators } from '@angular/forms';
import { SettingsService } from 'app/settings/settings.service';
import { OptionData } from 'app/shared/models/option-data.model';
/**
* Fixed Deposits Account Settings Step
@@ -33,6 +34,8 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
/** Savings Accounts Data */
savingsAccountsData: any;
maturityInstructionOptions: OptionData;
/**
* @param {FormBuilder} formBuilder Form Builder
* @param {SettingsService} settingsService Settings Service
@@ -54,7 +57,8 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
'maxDepositTermTypeId': this.fixedDepositsAccountProductTemplate.maxDepositTermType ? this.fixedDepositsAccountProductTemplate.maxDepositTermType.id : '',
'preClosurePenalApplicable': this.fixedDepositsAccountProductTemplate.preClosurePenalApplicable,
'preClosurePenalInterest': this.fixedDepositsAccountProductTemplate.preClosurePenalInterest,
'preClosurePenalInterestOnTypeId': this.fixedDepositsAccountProductTemplate.preClosurePenalInterestOnType ? this.fixedDepositsAccountProductTemplate.preClosurePenalInterestOnType.id : ''
'preClosurePenalInterestOnTypeId': this.fixedDepositsAccountProductTemplate.preClosurePenalInterestOnType ? this.fixedDepositsAccountProductTemplate.preClosurePenalInterestOnType.id : '',
'maturityInstructionId': this.fixedDepositsAccountProductTemplate.maturityInstructionId
});
if (this.fixedDepositsAccountProductTemplate.withHoldTax) {
this.fixedDepositAccountSettingsForm.addControl('withHoldTax', new UntypedFormControl(false));
@@ -101,7 +105,8 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
'transferInterestToSavings': [false],
'preClosurePenalApplicable': [{ value: '', disabled: true }],
'preClosurePenalInterest': [{ value: '', disabled: true }],
'preClosurePenalInterestOnTypeId': [{ value: '', disabled: true }]
'preClosurePenalInterestOnTypeId': [{ value: '', disabled: true }],
'maturityInstructionId': ['']
});
}
@@ -117,6 +122,15 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
this.fixedDepositAccountSettingsForm.removeControl('linkAccountId');
}
});
this.fixedDepositAccountSettingsForm.get('maturityInstructionId').valueChanges.subscribe((value: number) => {
console.log(value);
if (value > 100) {
this.fixedDepositAccountSettingsForm.addControl('transferToSavingsId', new UntypedFormControl('', Validators.required));
this.fixedDepositAccountSettingsForm.get('transferToSavingsId').patchValue(this.fixedDepositsAccountTemplate.transferToSavingsId && this.fixedDepositsAccountTemplate.transferToSavingsId.id);
} else {
this.fixedDepositAccountSettingsForm.removeControl('transferToSavingsId');
}
});
}
/**
@@ -127,6 +141,7 @@ export class FixedDepositAccountSettingsStepComponent implements OnInit, OnChang
this.periodFrequencyTypeData = this.fixedDepositsAccountProductTemplate.periodFrequencyTypeOptions;
this.savingsAccountsData = this.fixedDepositsAccountProductTemplate.savingsAccounts;
this.preClosurePenalInterestOnTypeData = this.fixedDepositsAccountProductTemplate.preClosurePenalInterestOnTypeOptions;
this.maturityInstructionOptions = this.fixedDepositsAccountProductTemplate.maturityInstructionOptions;
}
/**
@@ -40,6 +40,10 @@
<td>{{"labels.inputs.Tax Group" | translate }}</td>
<td>{{fixedDepositsAccountData.taxGroup.name}}</td>
</tr>
<tr *ngIf="fixedDepositsAccountData.onAccountClosure">
<td>{{"labels.inputs.Maturity Instructions" | translate }}</td>
<td>{{fixedDepositsAccountData.onAccountClosure.value}}</td>
</tr>
</tbody>
</table>
</div>
@@ -36,7 +36,6 @@ import { FixedDepositAccountChargesStepComponent } from './fixed-deposit-account
import { FixedDepositAccountSettingsStepComponent } from './fixed-deposit-account-stepper/fixed-deposit-account-settings-step/fixed-deposit-account-settings-step.component';
import { FixedDepositAccountInterestRateChartStepComponent } from './fixed-deposit-account-stepper/fixed-deposit-account-interest-rate-chart-step/fixed-deposit-account-interest-rate-chart-step.component';
import { FixedDepositAccountPreviewStepComponent } from './fixed-deposit-account-stepper/fixed-deposit-account-preview-step/fixed-deposit-account-preview-step.component';
import { FixedDepositAccountCurrencyStepComponent } from './fixed-deposit-account-stepper/fixed-deposit-account-currency-step/fixed-deposit-account-currency-step.component';
import { EditFixedDepositAccountComponent } from './edit-fixed-deposit-account/edit-fixed-deposit-account.component';
import { GeneralTabComponent } from './fixed-deposit-account-view/general-tab/general-tab.component';
@@ -75,7 +74,6 @@ import { GeneralTabComponent } from './fixed-deposit-account-view/general-tab/ge
FixedDepositAccountSettingsStepComponent,
FixedDepositAccountInterestRateChartStepComponent,
FixedDepositAccountPreviewStepComponent,
FixedDepositAccountCurrencyStepComponent,
EditFixedDepositAccountComponent,
GeneralTabComponent
],