Aman-Mittal opened a new pull request, #189:
URL: https://github.com/apache/fineract-backoffice-ui/pull/189

   Closes #188.
   
   The loan product form had no control for down payments or tranche 
disbursement, so a product
   created in this application could never use either — and 
`allowFullTermForTranche` on the loan
   application form, which needs a progressive product *with* 
multi-disbursement enabled, had never
   been reachable for a product made here.
   
   Adds a **Disbursement and Down Payment** section covering 
`multiDisburseLoan`, `maxTrancheCount`,
   `disallowExpectedDisbursements`, `enableDownPayment`,
   `disbursedAmountPercentageForDownPayment` and 
`enableAutoRepaymentForDownPayment`.
   
   ### Keeping the engines apart
   
   Down payment is a progressive-engine capability, so it is offered only for 
progressive products
   and is **cleared** when the schedule type moves back to cumulative. Hiding 
the controls is not
   enough on its own: a value left behind would still be submitted, describing 
a product the
   cumulative engine cannot honour. The dependent settings follow their parent 
the same way, and
   `allowFullTermForTranche` is dropped along with multi-disbursement, since 
that is the only thing
   that makes it reachable.
   
   On a cumulative product the section says where the setting lives rather than 
silently omitting it.
   
   ### A silent data-loss bug this exposed
   
   `loadProductData` rebuilds the payload field by field, so anything the form 
does not name is
   dropped on save. Opening a product configured elsewhere with tranches or a 
down payment and
   pressing Save removed both, without saying so. The new fields are now 
carried through explicitly.
   
   ### Two things only testing found
   
   - **Visibility had to move to signals.** `product` is a signal holding an 
object, so assigning to
     `product().enableDownPayment` changes nothing the template is watching, 
and the dependent
     controls never appeared. Driven by `downPaymentEnabled` / 
`multiDisburseEnabled` signals now —
     the same reason `isProgressive` was already its own signal.
   - **`IonCheckbox` was missing from the component's imports.** Without it 
`ngModel` has no value
     accessor, so the checkboxes rendered but never emitted. `npm run build` 
does not catch this;
     only driving the form does.
   
   Both were my own bugs, caught before review because the e2e spec exercises 
the controls rather
   than the class.
   
   ### Comprehensibility
   
   Every new control carries plain-language help written for someone new to 
lending operations — what
   the setting does, not a restatement of its name. For example:
   
   > **Down payment (% of the amount disbursed)** — How much of the disbursed 
amount the borrower
   > pays upfront, as a percentage. 20 on a 1,000 disbursement means a 200 down 
payment and 800
   > repaid over the schedule.
   
   ### Tests
   
   The product form had **no spec at all**. This adds:
   
   - unit cover for the gating, both clearing rules, and the edit round trip;
   - `e2e/loan-product-down-payment.spec.ts` (mocked, so it runs in the fast CI 
project) which
     asserts the **submitted payload** — including that a down payment 
configured and then abandoned
     by switching back to cumulative does not reach the request;
   - demo steps configuring a down payment and tranches on the progressive 
product, and showing the
     explanation in its place on the cumulative one.
   
   ### Verification
   
   | Check | Result |
   |---|---|
   | Unit tests | **715 passing** (707 → 715) |
   | Mocked Playwright | **200/200 passing** (195 → 200) |
   | `tsc` (app + spec) | 0 errors |
   | `npm run build` | passes |
   | lint (empty suppressions baseline), format, i18n, icons, license | all 
clean |
   
   I also drove the form by hand against mocks and checked the rendered result 
before committing —
   the section, the labels and the conditional controls all behave as described.
   
   ### Not in this PR
   
   The demo steps run only in the `backend` project, which needs a live 
Fineract, so they are
   unverified here; their assertions mirror the mocked spec that does run.
   
   Interest recalculation is still a hardcoded `false` with no control, and 
`chargeOffBehaviour`,
   `enableAccrualActivityPosting`, `fixedLength` and `repaymentStartDateType` 
remain unexposed. Those
   are the next step of #188's phase, kept separate rather than folded in here.
   


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