vaidikgarg-bit opened a new pull request, #852:
URL: https://github.com/apache/fineract-backoffice-ui/pull/852
Closes #784
Fineract credits a share dividend to the accounts only after it is approved.
This UI could declare and delete a dividend but had no way to approve one, so
every dividend declared from it stayed pending.
### Dividend detail page
The new route is `shares/:productId/dividends/:dividendId`, guarded on
`READ_DIVIDEND_SHAREPRODUCT`.
The header shows the period, total amount, number of accounts and status.
`GET …/dividend/{id}` returns only the account rows, so the header is read from
the product's dividend list. The two requests go out together, and if either
fails the page shows an error instead of half the data.
Below the header is a paged table of what each share account receives:
account number, client, amount and posting status. It can be searched by
account number. Fineract matches the number exactly, and the search label says
so.
Approve and Delete appear only while the dividend is pending. Approve is
gated on `APPROVE_DIVIDEND_SHAREPRODUCT` and Delete on
`DELETE_DIVIDEND_SHAREPRODUCT`, each with `[appRequiresPermission]` plus a
`[disabled]` binding, since the directive marks only the host element. With
`rbacEnabled: false` both are enabled, as the directive would have them.
Approve asks for confirmation and states the total and the number of
accounts. Once an approval goes through, Approve and Delete stay disabled for
the rest of the visit, and the page refreshes in place without losing the
current page or search. If that refresh fails with anything other than 403 or
404, the page stays as it was and the error interceptor reports the failure.
Delete returns to the list.
If maker-checker queues the approval, the toast says it was submitted for
approval, and a note on the page says the dividend stays pending until a
checker acts. Keeping both buttons disabled means the user cannot queue the
command twice or delete a dividend a checker is about to approve. The hold
lasts only for this visit, since neither endpoint says whether an approval is
waiting.
Fineract answers a queued command with `{commandId, resourceId,
rollbackTransaction: true}` (`RollbackTransactionNotApprovedException`), and
for approve the `resourceId` is the dividend's id. The shared
`isMakerCheckerPending` reads a present `resourceId` as applied, so the adapter
also checks `rollbackTransaction`. I left the shared helper alone because other
screens use it.
On load, a 403, a 404, or a dividend id that is not on the product shows a
message with no retry, because retrying will not change the answer. Any other
failure offers a retry. A failure while paging uses the data table's own error
state.
### Dividend list
The list has a new status column (Pending or Approved) and a View link on
each row. Delete appears only on pending rows and is disabled without
`DELETE_DIVIDEND_SHAREPRODUCT`.
### Adapter (ADR 0006)
`SHARE_DIVIDEND_API` gains `list`, `get` and `delete` next to `approve` from
the first commit. It parses the two string-typed reads and maps Fineract's
status ids (product: 100 pending, 300 approved; account: 100 pending, 300
posted). It also absorbs the generated `get` method taking the dividend id
before the product id. Both screens now use the adapter, which removes their
two `no-generated-api-import` suppressions and adds one entry to
`api-surface.json`.
New `SHARE_DIVIDENDS.*` keys are in en, fr and hi. hi also gains
`COMMON.MUTATION_SUBMITTED_FOR_APPROVAL`, which the approve toast uses and
which was missing there.
### Tests
- Adapter: the approve payload and the maker-checker outcome, including
Fineract's queued response that carries `resourceId`; list and payout parsing
with status mapping and ISO dates; the argument order of `get`, with
`accountNo` forwarded and an empty one left off; delete.
- View: the header and first page; paging by offset; a search resets to page
0 and keeps the account count for the whole dividend; a late page response is
ignored.
- Gating: the GET is emitted from a `Subject` after the first
`detectChanges`, then the inner button's `.disabled` is asserted, for Approve
and for Delete. `rbacEnabled: false` is covered as well.
- Approve: the confirmation includes the total and the count; the success
toast and the refresh in place; Approve stays disabled while the refresh is in
flight; a search during the refresh does not lose the new status; a failed
refresh keeps the page with both buttons disabled; the maker-checker toast,
after which Approve and Delete are held off; no spinner on Approve while a
delete runs; cancelling.
- An approved dividend shows neither Approve nor Delete. Load errors for
403, 404, a missing id, and 500 with retry.
- List: status text, the View link's `href`, Delete only on pending rows,
Delete disabled without the permission, and no delete for an approved row.
For each regression test I removed the fix it covers and confirmed the test
fails.
### Checks run
`npm run lint`, `npm run format:check`, `npx ng build`, the full unit suite
(`npm run test:unit`), `node scripts/check-translations.mjs`, `node
scripts/check-api-surface.mjs`, and the `check:*` scripts for template-text,
icons, a11y-names, ui-primitives, internal-endpoints, route-permissions,
permission-codes, nav-ids, branding-path, responsive and theme-contrast.
I did not run Playwright or try it against a real Fineract backend.
### Left out
Amounts show as plain numbers and dates as `YYYY-MM-DD`, as the list already
showed them. Currency formatting is not part of this change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]