Files
cbsnexora/src/app/deposits/fixed-deposits/fixed-deposits-account-actions/fixed-deposits-account-actions.component.ts
T
niteshandClaude Sonnet 5 8d0d8822f0 feat(fd): convert Premature Close to a dialog, with its full calculation shown
Was a full-page form at a dedicated route, reached by navigating away from
the account -- now a popup dialog in the same visual language as the
Payment/Renew dialog, just in this Danger Zone action's own red accent.
Also fixes a real gap in the form it replaces: the premature amount/action
options never loaded until a maker happened to touch the date picker, since
the calculation was only ever triggered on value change, never on open.

Added a breakdown panel showing exactly how the shown Maturity Amount was
reached -- Deposit Amount, Contracted Interest Rate, Pre-Closure Penalty
(when applicable), and the resulting Interest Earned -- using data the
account-view page already had, since the calculation endpoint itself only
ever returns the final number.

Removed the now-dead full-page component/route target it replaces.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-28 13:03:01 +05:30

79 lines
3.1 KiB
TypeScript

/**
* Copyright since 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/** Angular Imports */
import { Component, inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ApproveFixedDepositsAccountComponent } from './approve-fixed-deposits-account/approve-fixed-deposits-account.component';
import { RejectFixedDepositsAccountComponent } from './reject-fixed-deposits-account/reject-fixed-deposits-account.component';
import { ActivateFixedDepositsAccountComponent } from './activate-fixed-deposits-account/activate-fixed-deposits-account.component';
import { UndoApprovalFixedDepositsAccountComponent } from './undo-approval-fixed-deposits-account/undo-approval-fixed-deposits-account.component';
import { WithdrawByClientFixedDepositsAccountComponent } from './withdraw-by-client-fixed-deposits-account/withdraw-by-client-fixed-deposits-account.component';
import { AddChargeFixedDepositsAccountComponent } from './add-charge-fixed-deposits-account/add-charge-fixed-deposits-account.component';
import { CloseFixedDepositsAccountComponent } from './close-fixed-deposits-account/close-fixed-deposits-account.component';
import { FixedDepositsCashTransactionComponent } from './fixed-deposits-cash-transaction/fixed-deposits-cash-transaction.component';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
/**
* Fixed deposits account actions component.
*/
@Component({
selector: 'mifosx-fixed-deposits-account-actions',
templateUrl: './fixed-deposits-account-actions.component.html',
styleUrls: ['./fixed-deposits-account-actions.component.scss'],
imports: [
...STANDALONE_SHARED_IMPORTS,
ApproveFixedDepositsAccountComponent,
RejectFixedDepositsAccountComponent,
ActivateFixedDepositsAccountComponent,
UndoApprovalFixedDepositsAccountComponent,
WithdrawByClientFixedDepositsAccountComponent,
AddChargeFixedDepositsAccountComponent,
CloseFixedDepositsAccountComponent,
FixedDepositsCashTransactionComponent
]
})
export class FixedDepositsAccountActionsComponent {
private route = inject(ActivatedRoute);
/** Flag object to store possible actions and render appropriate UI to the user */
actions: {
Approve: boolean;
Reject: boolean;
Activate: boolean;
Close: boolean;
'Undo Approval': boolean;
'Undo Activation': boolean;
'Add Charge': boolean;
'Withdrawn by Client': boolean;
Withdrawal: boolean;
Deposit: boolean;
} = {
Approve: false,
Reject: false,
Activate: false,
Close: false,
'Undo Approval': false,
'Undo Activation': false,
'Add Charge': false,
'Withdrawn by Client': false,
Withdrawal: false,
Deposit: false
};
/**
* @param {ActivatedRoute} route Activated Route
*/
constructor() {
const name = this.route.snapshot.params['name'];
if (name && name in this.actions) {
this.actions[name as keyof typeof this.actions] = true;
}
}
}