Aman-Mittal opened a new issue, #231:
URL: https://github.com/apache/fineract-backoffice-ui/issues/231

   ## What is wrong
   
   Seven destructive actions on **loan** and **client** sub-screens ask for 
confirmation with `window.confirm` and a hardcoded English string:
   
   ```ts
   if (!row.id || !window.confirm('Delete this charge?')) 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 on loan 
and client screens.
   
   ## Business value
   
   These sit closest to money. Undoing a client transaction, deleting a loan 
charge, removing a guarantor, dropping an interest pause or a post-dated check 
all change what a borrower owes or what security stands behind the loan — and 
every one of them is confirmed today by a browser dialog that a teller can 
dismiss on reflex without registering what it said.
   
   The transactions one is the sharpest case: the prompt reads "Undo this 
transaction?" with no amount, no date and no account, so there is nothing on 
screen to check the action against before agreeing to it. A confirmation that 
cannot be verified is not really a confirmation.
   
   ## Files
   
   | File | Line |
   |---|---|
   | `src/app/features/loans/charges/loan-charges-list.component.ts` | 115 |
   | `src/app/features/loans/guarantors/guarantors-list.component.ts` | 129 |
   | `src/app/features/loans/interest-pauses/interest-pauses-list.component.ts` 
| 112 |
   | 
`src/app/features/loans/post-dated-checks/post-dated-checks-list.component.ts` 
| 121 |
   | `src/app/features/clients/charges/client-charges-list.component.ts` | 121 |
   | `src/app/features/clients/collateral/client-collateral-list.component.ts` 
| 119 |
   | 
`src/app/features/clients/transactions/client-transactions-list.component.ts` | 
112 |
   
   ## How to fix
   
   There is a worked example 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('LOANS.DELETE_CHARGE'),
       message: this.translate.instant('LOANS.CONFIRM_DELETE_CHARGE', { 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`.
   - **Put the identifying detail in the message.** These screens all have the 
row in hand, so the amount and date can go into the text — the person 
confirming should be able to check they are undoing the transaction they meant 
to. Interpolate with `this.translate.instant('KEY', { amount, date })`.
   - Set `destructive: true` on every one of these.
   
   ## 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 or undo is not 
called when the dialog resolves `false`. That is the behaviour most likely to 
break in the rewrite, since the guard moves from a synchronous `return` into a 
callback — and on these screens a confirmation that silently stops working is a 
real problem.
   
   ## 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/loans/` and 
`src/app/features/clients/`, 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]

Reply via email to