Aman-Mittal opened a new issue, #229:
URL: https://github.com/apache/fineract-backoffice-ui/issues/229
## What is wrong
Seven destructive actions under **Products** ask for confirmation with
`window.confirm` and a hardcoded English string:
```ts
if (!row.id || !window.confirm('Delete this collateral product?')) return;
```
That produces the browser's own grey dialog: unstyled, untranslated, unable
to signal that the action is destructive, and it freezes the page while it is
open. Everywhere else the application uses its own `DialogService.confirm`,
which is themed, translated and marks destructive actions in red. Across the
app there are 29 of these native calls left; this issue covers the 7 under
Products.
## Business value
These are all irreversible deletions — a collateral product, an
interest-rate chart, a slab, a loan originator, a product mix, a charge, a
dividend. The native box is the weakest possible confirmation for exactly the
actions that most deserve a clear one: it looks like a browser warning rather
than part of the application, gives no visual signal that something is about to
be destroyed, and shows English to a user who has the interface in Hindi or
Korean. Someone working in a non-English locale gets an English question about
deleting a product and has to guess.
## Files
| File | Line |
|---|---|
|
`src/app/features/products/collateral-management/collateral-management-list.component.ts`
| 118 |
|
`src/app/features/products/interest-rate-charts/interest-rate-chart-slabs.component.ts`
| 338 |
|
`src/app/features/products/interest-rate-charts/interest-rate-charts-list.component.ts`
| 129 |
|
`src/app/features/products/loan-originators/loan-originators-list.component.ts`
| 123 |
| `src/app/features/products/product-mix/product-mix.component.ts` | 204 |
|
`src/app/features/products/savings-charges/savings-charges-list.component.ts` |
114 |
|
`src/app/features/products/share-dividends/share-dividends-list.component.ts` |
136 |
## How to fix
There is a worked example already in the tree —
`src/app/features/system/codes/codes-list.component.ts` was converted this way
and is the pattern to copy.
```ts
private readonly dialogService = inject(DialogService);
private readonly translate = inject(TranslateService);
void this.dialogService
.confirm({
title: this.translate.instant('PRODUCTS.DELETE_CHART'),
message: this.translate.instant('PRODUCTS.CONFIRM_DELETE_CHART', { name:
row.name }),
destructive: true,
})
.then((confirmed) => {
if (!confirmed) return;
// ...the existing delete call, unchanged
});
```
Notes:
- `confirm()` returns a `Promise<boolean>`, so the early-return guard
becomes a `.then()` block. That is the only structural change.
- Add the new keys to `src/assets/i18n/en.json`. Only `en.json` is required
— `npm run i18n:check` fails on keys referenced in code but missing there, and
does not require `hi.json`/`ko.json`.
- Write the message in plain language that says what will be lost, rather
than restating the button. "Delete the chart “Standard”? Any slabs under it go
with it." is more use than "Are you sure?".
- Set `destructive: true` on every one of these — they are all deletions.
## Verifying
```
npm run lint
npm run i18n:check
npm test
npm run build
```
If the screen has a spec, add a case asserting the delete is not called when
the dialog resolves `false`. That is the behaviour most likely to be broken by
the rewrite, since the guard moves from a synchronous `return` into a callback.
## Picking this up
No need to be assigned — assignment here is limited to committers. Comment
that you are starting, then open a PR; the comment is enough to stop two people
duplicating the work.
This issue touches only files under `src/app/features/products/`, so it does
not overlap with the other `window.confirm` issues and several can be in flight
at the same time.
--
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]