Aman-Mittal commented on code in PR #831:
URL:
https://github.com/apache/fineract-backoffice-ui/pull/831#discussion_r4366814617
##########
src/app/features/loans/loan-form.component.ts:
##########
@@ -486,9 +488,13 @@ const OPERATION_FAILED_MESSAGE = 'Operation failed. Please
try again.';
'LOANS.REPAYMENTS_STARTING_FROM_DATE' | appTranslate
}}</ion-label>
@if (pickersReady()) {
- <ion-datetime-button
- datetime="repaymentsStartingFromDate-picker"
- ></ion-datetime-button>
+ <ion-datetime-button
datetime="repaymentsStartingFromDate-picker">
+ @if (!isEditMode() && !repaymentsStartingFromDate) {
Review Comment:
In edit mode `loadLoanData()` never fills in `repaymentsStartingFromDate`,
and this placeholder is hidden there, so editing a loan still shows today's
date in this field, which is the symptom #793 describes. Dropping
`!isEditMode() &&` from this condition would make the field truthful in edit
mode too at no cost. Otherwise, could you open a follow-up issue so it isn't
lost?
##########
e2e/loan-optional-repayment-date.spec.ts:
##########
@@ -0,0 +1,210 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { expect, test, type Page } from './fixtures';
+
+async function signIn(page: Page): Promise<void> {
+ await page.route('**/config.json*', async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({ fineractApiUrl: '/api/v1', defaultTenant:
'default' }),
+ });
+ });
+ await page.route('**/api/v1/authentication**', async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({
+ username: 'mifos',
+ userId: 1,
+ base64EncodedAuthenticationKey: 'YmFzZTY0',
+ authenticated: true,
+ officeId: 1,
+ officeName: 'Head Office',
+ permissions: ['ALL_FUNCTIONS'],
+ }),
+ });
+ });
+ await page.route('**/api/v1/configurations/name/enable-business-date**',
(route) =>
+ route.fulfill({ json: { name: 'enable-business-date', enabled: false } }),
+ );
+ await page.route('**/api/v1/businessdate**', async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify([{ type: 'BUSINESS_DATE', date: [2026, 9, 5] }]),
+ });
+ });
+
+ await page.goto('/login');
+ await page.locator('#tenantId').fill('default');
+ await page.locator('#username').fill('mifos');
+ await page.locator('#password').fill('password');
+ await page.getByRole('button', { name: 'Sign In' }).click();
+ await expect(page).toHaveURL('/dashboard');
+}
+
+const pickerId = 'repaymentsStartingFromDate-picker';
+const dateButton = (page: Page) =>
page.locator(`ion-datetime-button[datetime="${pickerId}"]`);
+const product = {
+ id: 3,
+ name: 'Synthetic Loan',
+ principal: 1000,
+ numberOfRepayments: 12,
+ repaymentEvery: 1,
+ repaymentFrequencyType: { id: 2 },
+ interestRatePerPeriod: 10,
+ interestType: { id: 0 },
+ amortizationType: { id: 1 },
+ interestCalculationPeriodType: { id: 1 },
+ transactionProcessingStrategyCode: 'mifos-standard-strategy',
+};
+
+async function openForm(page: Page) {
+ await page.goto('/loans/create?clientId=7');
+ await page.locator('ion-select[name="productId"]').click();
+ await page
+ .locator('ion-popover, ion-alert')
+ .getByRole('radio', { name: 'Synthetic Loan', exact: true })
+ .click();
+ await expect(page.getByRole('button', { name: 'Save', exact: true
})).toBeEnabled();
+}
+
+async function submit(page: Page) {
+ const request = page.waitForRequest(
+ (r) => r.method() === 'POST' && /\/loans(?:\?|$)/.test(r.url()),
+ );
+ await page.getByRole('button', { name: 'Save', exact: true }).click();
+ return (await request).postDataJSON();
+}
+
+test.use({ video: 'on' });
Review Comment:
Nit: `playwright.config.ts` already records video on CI (`video:
process.env.CI ? 'on' : …`), so this override adds nothing there, and the
screenshot calls below only save files and assert nothing. Could both go?
##########
src/assets/i18n/fr.json:
##########
@@ -548,6 +548,8 @@
"CONFIRM_INACTIVATE": "Désactiver {{name}} ? Les frais ne seront plus
appliqués à ce compte."
},
"LOANS": {
+ "REPAYMENT_START_DATE_NOT_SET": "Non renseignée",
+ "CLEAR_REPAYMENT_START_DATE": "Effacer la date de début",
Review Comment:
Nit: "Effacer la date de début" loses which start date it is. Suggest
"Effacer la date de début des remboursements".
##########
src/app/features/loans/loan-form.component.ts:
##########
@@ -501,6 +507,18 @@ const OPERATION_FAILED_MESSAGE = 'Operation failed. Please
try again.';
></ion-datetime>
</ng-template>
</ion-modal>
+ @if (!isEditMode() && repaymentsStartingFromDate) {
Review Comment:
`ion-datetime-button` is used in about 65 files, and #747 (client date of
birth) has the same "shows today when empty" symptom. Not for this PR, but "Not
set" plus Clear might belong in a shared primitive under `src/app/ui/` (next to
`app-deferred-datetime-button`) rather than inline here. Worth a follow-up
issue?
--
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]