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

   ## Summary
   
   The Working Capital loan screen offers **Edit** in its actions menu, but the 
button leads nowhere. No screen can modify a submitted loan application, 
although Fineract supports it.
   
   ## Evidence (`main` @ `8da1086f`)
   
   - `src/app/features/working-capital/loans/wc-loan-view.component.ts:1214` 
navigates to `/working-capital/loans/edit/${loanId}`.
   - `src/app/features/working-capital/working-capital.routes.ts` declares 
`loans`, `loans/create`, `loans/view/:id` and `loans/:id/action/:command`, but 
no `loans/edit/:id`. The navigation therefore falls through to the wildcard 
route.
   - `src/app/core/adapters/api/api-surface.json` lists no 
`putWorkingCapitalLoansLoanId`. The UI never calls the update endpoint.
   
   ## Platform support
   
   - `PUT /v1/working-capital-loans/{loanId}` (and by external id) modifies a 
loan that is still *Submitted and pending approval*.
   - `GET /v1/working-capital-loans/template` supplies the field options.
   
   ## Proposed implementation
   
   - Reuse `wc-loan-form.component.ts` in edit mode. Load the loan, prefill the 
form, and send only the changed fields with `PUT`.
   - Add the `loans/edit/:id` route.
   - Offer **Edit** only while the loan status is *Submitted and pending 
approval*. Fineract rejects the change in any other status, so the button 
should not appear there.
   - Add `putWorkingCapitalLoansLoanId` to the API manifest.
   
   ## RBAC
   
   | Action | Permission code | Typically granted to |
   |---|---|---|
   | View loan | `READ_WORKINGCAPITALLOAN` | all lending roles, auditors |
   | Modify application | `UPDATE_WORKINGCAPITALLOAN` | loan officer / credit 
officer who captured the application |
   | Approve application (checker) | `UPDATE_WORKINGCAPITALLOAN_CHECKER`, when 
maker-checker is on | branch manager / credit approver |
   
   ### How Fineract evaluates these permissions
   
   - A write command passes when the user holds the exact code above **or** 
`ALL_FUNCTIONS` (`AppUser.hasNotPermissionForAnyOf("ALL_FUNCTIONS", code)` in 
`fineract-core`). Every code listed here is present in 
`scripts/permission-codes.json`.
   - Reads also pass with `ALL_FUNCTIONS_READ`.
   - When maker-checker is enabled for a code, the command is queued, and only 
a user holding `<CODE>_CHECKER` (or `ALL_FUNCTIONS`) can approve it in the 
checker inbox. The UI should then show "submitted for approval" instead of a 
success message.
   
   ### UI expectations
   
   - Guard the new route with `permissionGuard` and 
`UPDATE_WORKINGCAPITALLOAN`. `scripts/check-route-permissions.mjs` must pass.
   - Gate the **Edit** menu item with `[appRequiresPermission]`, using the same 
code.
   - A read-only role (`ALL_FUNCTIONS_READ`) must not see an enabled Edit item.
   
   ## Acceptance criteria
   
   - [ ] **Edit** on a submitted Working Capital loan opens a prefilled form, 
and saving updates the loan.
   - [ ] **Edit** is not offered once the loan is approved, active, rejected or 
closed.
   - [ ] A user without `UPDATE_WORKINGCAPITALLOAN` sees no Edit item, and a 
direct URL redirects to `/forbidden`.
   - [ ] Unit tests cover edit-mode prefill, the PUT payload, and the 
permission-gated menu item.
   


-- 
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