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

   ## Summary
   
   Multi-disbursal ("tranche") products can be configured (#188), and an 
existing tranche's date or amount can be edited on the loan (#284). Two parts 
of the tranche lifecycle are still missing:
   
   1. **At application:** the loan form never sends `disbursementData`, so the 
expected tranche schedule (date + principal per tranche) can't be entered. 
Fineract then treats the loan as having a single expected disbursement, and 
products that require tranche details can't be used.
   2. **After approval:** tranches can't be **added** or **removed**. Only one 
existing tranche can be modified.
   
   ## Evidence (`main` @ `8da1086f`)
   
   - `src/app/features/loans/loan-form.component.ts` contains no 
`disbursementData`. Its only tranche-related input is `allowFullTermForTranche` 
(line ~516).
   - `src/app/core/adapters/api/api-surface.json` lists 
`getLoansLoanIdDisbursementsDisbursementId` and 
`putLoansLoanIdDisbursementsDisbursementId` only. It has no `editDisbursements` 
call.
   
   ## Platform support
   
   - `POST /v1/loans` and `PUT /v1/loans/{loanId}` accept `disbursementData: [{ 
expectedDisbursementDate, principal }]`. The principals must sum to the loan 
principal, and their count is bounded by the product's `maxTrancheCount`.
   - `PUT /v1/loans/{loanId}/disbursements/editDisbursements` replaces the set 
of undisbursed tranches, adding or deleting entries 
(`LoanDisbursementDetailApiResource`).
   - `PUT /v1/loans/{loanId}/disbursements/{disbursementId}` edits one tranche. 
This is already used.
   
   ## Proposed implementation
   
   - On the loan form, when the selected product has `multiDisburseLoan`, show 
a **Tranches** editor: rows of date + principal, add/remove row, a running 
total checked against principal, and a row count capped at `maxTrancheCount`.
   - On the loan view's disbursement section, add **Add tranche** and **Remove 
tranche** for undisbursed tranches. Both submit through `editDisbursements`.
   - Show the expected-vs-actual disbursement table with clear status per 
tranche.
   
   ## RBAC
   
   | Action | Permission code | Typically granted to |
   |---|---|---|
   | Enter tranches on a new application | `CREATE_LOAN` | loan officer |
   | Change tranches on a submitted application | `UPDATE_LOAN` | loan officer |
   | Add / remove / edit tranches on an approved loan | 
`UPDATE_DISBURSEMENTDETAIL` | credit officer / branch manager |
   | Disburse a tranche (existing) | `DISBURSE_LOAN` | branch manager / teller |
   
   All codes are in `scripts/permission-codes.json`.
   
   - Writes pass with the exact code **or** `ALL_FUNCTIONS`.
   - With maker-checker on, changes are queued for 
`UPDATE_DISBURSEMENTDETAIL_CHECKER`, and the UI should report "submitted for 
approval".
   - Changing an approved loan's disbursement plan is a credit decision, so the 
tranche editor on an approved loan must be gated on `UPDATE_DISBURSEMENTDETAIL` 
and not offered to a role that holds only `CREATE_LOAN`.
   
   ### UI expectations
   
   - Gate the editor controls with `[appRequiresPermission]`.
   - Read-only users see the tranche table but no enabled controls.
   
   ## Acceptance criteria
   
   - [ ] A multi-disbursal loan can be submitted with a tranche schedule, and 
validation enforces the total and the maximum count.
   - [ ] Undisbursed tranches can be added and removed after approval.
   - [ ] Controls are gated as above.
   - [ ] Unit tests cover the `disbursementData` payload, the 
`editDisbursements` payload and the validation.
   


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