- Current Account module with full CRUD, transactions, charges, hold/release, block/unblock - Current Products management under Products module - DIP mobile number verification with real API call to /lookup/check - Sanctions verification dialog - Charges support for Current Account (chargeAppliesTo=5) in create/edit - Fixed permissions from SAVINGSACCOUNT to CURRENTACCOUNT across all current account components - Added all missing translation keys for Current Account in en-US.json Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
198 lines
5.2 KiB
TypeScript
198 lines
5.2 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/.
|
|
*/
|
|
|
|
/** Current Account Buttons Configuration */
|
|
export class CurrentAccountButtonsConfiguration {
|
|
optionArray: {
|
|
name: string;
|
|
taskPermissionName: string;
|
|
}[];
|
|
|
|
buttonsArray: {
|
|
name: string;
|
|
icon: string;
|
|
taskPermissionName: string;
|
|
}[];
|
|
|
|
constructor(status: string, substatus: any) {
|
|
this.setOptions(status);
|
|
this.setButtons(status, substatus);
|
|
}
|
|
|
|
get singleButtons() {
|
|
return this.buttonsArray;
|
|
}
|
|
|
|
get options() {
|
|
return this.optionArray;
|
|
}
|
|
|
|
setButtons(status: string, substatus: any) {
|
|
switch (status) {
|
|
case 'Active':
|
|
this.buttonsArray = [];
|
|
if (!substatus.block) {
|
|
if (!substatus.blockCredit) {
|
|
this.buttonsArray.push(
|
|
{
|
|
name: 'Deposit',
|
|
icon: 'arrow-up',
|
|
taskPermissionName: 'DEPOSIT_CURRENTACCOUNT'
|
|
},
|
|
{
|
|
name: 'Block Deposit',
|
|
icon: 'lock',
|
|
taskPermissionName: 'BLOCKDEPOSIT_CURRENTACCOUNT'
|
|
}
|
|
);
|
|
} else {
|
|
this.buttonsArray.push({
|
|
name: 'Unblock Deposit',
|
|
icon: 'lock-open',
|
|
taskPermissionName: 'UNBLOCKDEPOSIT_CURRENTACCOUNT'
|
|
});
|
|
}
|
|
if (!substatus.blockDebit) {
|
|
this.buttonsArray.push(
|
|
{
|
|
name: 'Withdrawal',
|
|
icon: 'arrow-down',
|
|
taskPermissionName: 'WITHDRAWAL_CURRENTACCOUNT'
|
|
},
|
|
{
|
|
name: 'Block Withdrawal',
|
|
icon: 'lock',
|
|
taskPermissionName: 'BLOCKWITHDRAWAL_CURRENTACCOUNT'
|
|
}
|
|
);
|
|
} else {
|
|
this.buttonsArray.push({
|
|
name: 'Unblock Withdrawal',
|
|
icon: 'lock-open',
|
|
taskPermissionName: 'UNBLOCKWITHDRAWAL_CURRENTACCOUNT'
|
|
});
|
|
}
|
|
this.buttonsArray = this.buttonsArray.concat([
|
|
{
|
|
name: 'Block Account',
|
|
icon: 'lock',
|
|
taskPermissionName: 'BLOCK_CURRENTACCOUNT'
|
|
},
|
|
{
|
|
name: 'Hold Amount',
|
|
icon: 'lock',
|
|
taskPermissionName: 'HOLDAMOUNT_CURRENTACCOUNT'
|
|
},
|
|
{
|
|
name: 'Calculate Interest',
|
|
icon: 'table',
|
|
taskPermissionName: 'CALCULATEINTEREST_CURRENTACCOUNT'
|
|
},
|
|
{
|
|
name: 'Post Interest As On',
|
|
icon: 'arrow-right',
|
|
taskPermissionName: 'POSTINTEREST_CURRENTACCOUNT'
|
|
}
|
|
]);
|
|
} else {
|
|
this.buttonsArray = [
|
|
{
|
|
name: 'Unblock Account',
|
|
icon: 'lock-open',
|
|
taskPermissionName: 'UNBLOCK_CURRENTACCOUNT'
|
|
}
|
|
];
|
|
}
|
|
break;
|
|
case 'Submitted and pending approval':
|
|
this.buttonsArray = [
|
|
{
|
|
name: 'Modify Application',
|
|
icon: 'pen',
|
|
taskPermissionName: 'UPDATE_CURRENTACCOUNT'
|
|
},
|
|
{
|
|
name: 'Approve',
|
|
icon: 'check',
|
|
taskPermissionName: 'APPROVE_CURRENTACCOUNT'
|
|
}
|
|
];
|
|
break;
|
|
case 'Approved':
|
|
this.buttonsArray = [
|
|
{
|
|
name: 'Undo Approval',
|
|
icon: 'undo',
|
|
taskPermissionName: 'APPROVALUNDO_CURRENTACCOUNT'
|
|
},
|
|
{
|
|
name: 'Activate',
|
|
icon: 'check',
|
|
taskPermissionName: 'ACTIVATE_CURRENTACCOUNT'
|
|
},
|
|
{
|
|
name: 'Add Charge',
|
|
icon: 'plus',
|
|
taskPermissionName: 'CREATE_CURRENTACCOUNTCHARGE'
|
|
}
|
|
];
|
|
break;
|
|
default:
|
|
this.buttonsArray = [];
|
|
}
|
|
}
|
|
|
|
setOptions(status: string) {
|
|
switch (status) {
|
|
case 'Active':
|
|
this.optionArray = [
|
|
{
|
|
name: 'Post Interest',
|
|
taskPermissionName: 'POSTINTEREST_CURRENTACCOUNT'
|
|
},
|
|
{
|
|
name: 'Add Charge',
|
|
taskPermissionName: 'CREATE_CURRENTACCOUNTCHARGE'
|
|
},
|
|
{
|
|
name: 'Close',
|
|
taskPermissionName: 'CLOSE_CURRENTACCOUNT'
|
|
}
|
|
];
|
|
break;
|
|
case 'Submitted and pending approval':
|
|
this.optionArray = [
|
|
{
|
|
name: 'Reject',
|
|
taskPermissionName: 'REJECT_CURRENTACCOUNT'
|
|
},
|
|
{
|
|
name: 'Withdrawn by Client',
|
|
taskPermissionName: 'WITHDRAW_CURRENTACCOUNT'
|
|
},
|
|
{
|
|
name: 'Add Charge',
|
|
taskPermissionName: 'CREATE_CURRENTACCOUNTCHARGE'
|
|
},
|
|
{
|
|
name: 'Delete',
|
|
taskPermissionName: 'DELETE_CURRENTACCOUNT'
|
|
}
|
|
];
|
|
break;
|
|
case 'Approved':
|
|
default:
|
|
this.optionArray = [];
|
|
}
|
|
}
|
|
|
|
addOption(option: { name: string; taskPermissionName: string }) {
|
|
this.optionArray.push(option);
|
|
}
|
|
}
|