charges add module add in the saving account and current account
This commit is contained in:
+12
@@ -30,6 +30,18 @@
|
||||
</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="flex-fill">
|
||||
<mat-label>Opening Balance</mat-label>
|
||||
<input matInput type="number" [min]="minRequiredOpeningBalance ?? 0" formControlName="openingBalance" />
|
||||
<span matPrefix>₹ </span>
|
||||
@if (minRequiredOpeningBalance) {
|
||||
<mat-hint>Minimum required: ₹{{ minRequiredOpeningBalance }}</mat-hint>
|
||||
}
|
||||
@if (activateSavingsAccountForm.controls.openingBalance.hasError('min')) {
|
||||
<mat-error>Opening balance must be at least ₹{{ minRequiredOpeningBalance ?? 0 }}</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
|
||||
|
||||
+15
-2
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
import { Component, OnInit, Input, inject } from '@angular/core';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
@@ -36,6 +36,8 @@ export class ActivateSavingsAccountComponent implements OnInit {
|
||||
private router = inject(Router);
|
||||
private settingsService = inject(SettingsService);
|
||||
|
||||
@Input() minRequiredOpeningBalance: number | null = null;
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
@@ -69,10 +71,18 @@ export class ActivateSavingsAccountComponent implements OnInit {
|
||||
* Creates the activate savings account form.
|
||||
*/
|
||||
createActivateSavingsAccountForm() {
|
||||
const minBalance = this.minRequiredOpeningBalance ?? 0;
|
||||
this.activateSavingsAccountForm = this.formBuilder.group({
|
||||
activatedOnDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
openingBalance: [
|
||||
minBalance,
|
||||
[
|
||||
Validators.required,
|
||||
Validators.min(minBalance)
|
||||
]
|
||||
]
|
||||
});
|
||||
}
|
||||
@@ -89,11 +99,14 @@ export class ActivateSavingsAccountComponent implements OnInit {
|
||||
if (activateSavingsAccountFormData.activatedOnDate instanceof Date) {
|
||||
activateSavingsAccountFormData.activatedOnDate = this.dateUtils.formatDate(prevActivatedOnDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
const data: any = {
|
||||
...activateSavingsAccountFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
if (data.openingBalance === 0 || data.openingBalance === null) {
|
||||
delete data.openingBalance;
|
||||
}
|
||||
this.savingsService.executeSavingsAccountCommand(this.accountId, 'activate', data).subscribe(() => {
|
||||
this.router.navigate(['../../transactions'], { relativeTo: this.route });
|
||||
});
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
<mifosx-reject-savings-account></mifosx-reject-savings-account>
|
||||
}
|
||||
@if (actions['Activate']) {
|
||||
<mifosx-activate-savings-account></mifosx-activate-savings-account>
|
||||
<mifosx-activate-savings-account
|
||||
[minRequiredOpeningBalance]="accountData?.minRequiredOpeningBalance"
|
||||
></mifosx-activate-savings-account>
|
||||
}
|
||||
@if (actions['Undo Approval']) {
|
||||
<mifosx-undo-approval-savings-account></mifosx-undo-approval-savings-account>
|
||||
|
||||
@@ -102,10 +102,13 @@ export class SavingAccountActionsComponent {
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
*/
|
||||
accountData: any;
|
||||
|
||||
constructor() {
|
||||
this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
|
||||
if (data.savingsAccountActionData) {
|
||||
this.currency = data.savingsAccountActionData.currency;
|
||||
this.accountData = data.savingsAccountActionData;
|
||||
}
|
||||
});
|
||||
const name = this.route.snapshot.params['name'] as string;
|
||||
|
||||
Reference in New Issue
Block a user