Files
cbsnexora/src/app/shares/shares-account-view/shares-buttons.config.ts
T
niteshandClaude Sonnet 5 cc5cd4c6ab
Tests / testRigor (push) Canceled after 0s
build-run / Run Lint, Build and Deploy (push) Canceled after 0s
Publish Image in Docker Hub / build (push) Canceled after 0s
Playwright E2E Tests / Run Playwright Tests (push) Canceled after 0s
feat(shares): add Share Withdrawal maker-checker workflow with GL settlement
Clerk submits a governed share redemption request (shares, Board Resolution
No., Meeting Date, settlement Payment Type); Bank Manager reviews with a
live backend-validated checklist (account/GL state, not just submit-time
snapshot) before approving, which redeems the shares and settles the
linked savings account in one transaction. Adds a Passbook tab to the
Share Account view, a reusable search-select control, and a Savings
Product "Map Payment Types to Specific Funds" fund-source override (only
Loan Products had this before) so settlement can be GL-mapped correctly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-05 16:55:21 +05:30

146 lines
3.7 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/.
*/
/** Shares Account Buttons Configuration */
export class SharesButtonsConfiguration {
optionArray: {
name: string;
taskPermissionName: string;
}[];
buttonsArray: {
name: string;
icon: string;
taskPermissionName: 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: 'Apply Additional Shares',
icon: 'arrow-right',
taskPermissionName: 'APPLYADDITIONAL_SHAREACCOUNT'
},
{
name: 'Approve Additional Shares',
icon: 'arrow-right',
taskPermissionName: 'APPROVEADDITIONAL_SHAREACCOUNT'
},
{
name: 'Reject Additional Shares',
icon: 'arrow-left',
taskPermissionName: 'REJECTADDITIONAL_SHAREACCOUNT'
}
// 'Redeem Shares' is intentionally not offered here — a share withdrawal must go
// through the Clerk Dashboard maker-checker flow (Clerk Dashboard > My Share Requests),
// never a direct one-step action from this view.
];
break;
case 'Submitted and pending approval':
this.buttonsArray = [
{
name: 'Modify Application',
icon: 'pencil',
taskPermissionName: 'UPDATE_SHAREACCOUNT'
},
{
name: 'Approve',
icon: 'check',
taskPermissionName: 'APPROVE_SHAREACCOUNT'
}
];
break;
case 'Approved':
this.buttonsArray = [
{
name: 'Undo Approval',
icon: 'undo',
taskPermissionName: 'APPROVALUNDO_SHAREACCOUNT'
},
{
name: 'Activate',
icon: 'check',
taskPermissionName: 'ACTIVATE_SHAREACCOUNT'
}
];
break;
default:
this.buttonsArray = [];
}
}
setOptions(status: string) {
switch (status) {
case 'Active':
this.optionArray = [
{
name: 'Edit Details',
taskPermissionName: 'SUBMITEDIT_SHAREACCOUNT'
},
{
name: 'Share Certificate',
taskPermissionName: 'READ_SHAREACCOUNTPURCHASE'
},
{
name: 'Close',
taskPermissionName: 'CLOSE_SHAREACCOUNT'
}
];
break;
case 'Submitted and pending approval':
this.optionArray = [
{
name: 'Reject',
taskPermissionName: 'REJECT_SHAREACCOUNT'
},
{
name: 'Delete',
taskPermissionName: 'DELETE_SHAREACCOUNT'
}
];
break;
case 'Approved':
default:
this.optionArray = [];
}
}
addOption(option: { name: string; taskPermissionName: string }) {
this.optionArray.push(option);
}
removeButton(name: string) {
const buttonNames = this.buttonsArray.map((entry) => entry.name);
const index = buttonNames.indexOf(name);
this.buttonsArray.splice(index, 1);
}
removeOption(name: string) {
const optionNames = this.optionArray.map((entry) => entry.name);
const index = optionNames.indexOf(name);
if (index > -1) {
this.optionArray.splice(index, 1);
}
}
}