/** * 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/. */ /** Fixed Deposits Account Buttons Configuration */ export class FixedDepositsButtonsConfiguration { optionArray: { name: string; }[]; buttonsArray: { name: string; icon: string; }[]; constructor(status: string) { this.setOptions(status); this.setButtons(status); } get singleButtons() { return this.buttonsArray; } get options() { return this.optionArray; } setButtons(status: string) { switch (status) { case 'Active': this.buttonsArray = [ { name: 'Deposit', icon: 'fa fa-arrow-down' }, { name: 'Withdrawal', icon: 'fa fa-arrow-up' }, { name: 'Premature Close', icon: 'fa fa-arrow-left' }, { name: 'Calculate Interest', icon: 'fa fa-table' }, { name: 'Undo Activation', icon: 'fa fa-undo' } ]; break; case 'Matured': // 'Close' (the generic Fineract apply-maturity-instructions action) is deliberately left out // here -- what happens to a matured FD is now handled either automatically by the nightly job // (an account opened with an explicit instruction) or manually via the FD Dashboard's Renew // action (an account left without one, backdated within grace / gap-interest after). Closing // from here would go around both of those paths. this.buttonsArray = [ { name: 'Calculate Interest', icon: 'fa fa-table' } ]; break; case 'Submitted and pending approval': this.buttonsArray = [ { name: 'Modify Application', icon: 'fa fa-pencil ' }, { name: 'Approve', icon: 'fa fa-check' } ]; break; case 'Approved': this.buttonsArray = [ { name: 'Undo Approval', icon: 'fa fa-undo' }, { name: 'Activate', icon: 'fa fa-check' } ]; break; case 'Rejected': case 'rejected': this.buttonsArray = [ { name: 'Modify Application', icon: 'fa fa-pencil' } ]; break; default: this.buttonsArray = []; } } setOptions(status: string) { switch (status) { case 'Active': this.optionArray = [ { name: 'Post Interest' }, { name: 'Add Charge' } ]; break; case 'Matured': // Payment only makes sense once the deposit has actually matured -- an Active FD that needs // closing early already has Premature Close for that. this.optionArray = [ { name: 'Post Interest' }, { name: 'Add Charge' }, { name: 'Payment' } ]; break; case 'Submitted and pending approval': this.optionArray = [ { name: 'Reject' }, { name: 'Withdrawn by Client' }, { name: 'Add Charge' }, { name: 'Delete' }, { name: 'Terminate' } ]; break; case 'Approved': default: this.optionArray = []; } } addOption(option: { name: string }) { this.optionArray.push(option); } }