feat(loan): implement dynamic datatable steps for new loan creation
Fixes - Jira-#MIFOSAC-706
https://github.com/user-attachments/assets/e9431ff4-9aea-4530-a386-926f7796b7a3
| AUTOEMPLEO PARA MUJERES EN EL MARXO ....1 | AUTOEMPLEO PARA MUJERES EN EL MARXO ....2 |
|---|---|
| PROGRAMA DEL APOYO DE MOTORES 1 | PROGRAMA DEL APOYO DE MOTORES 2 |
|---|---|
| REST | |
|---|---|
[!NOTE]
Reviews paused
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
reviews.auto_review.auto_pause_after_reviewed_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.Use the checkboxes below for quick actions:
- [ ] โถ๏ธ Resume reviews
- [ ] ๐ Trigger review
Walkthrough
Refactors datatable flows: removes widget DTO plumbing, introduces typed per-cell values, reworks DataTable list UI/ViewModel to collect per-table field state and coerce payloads, and updates navigation/serialization and loan/client flows to support inline datatable editing.
Changes
A single coherent refactor touching serialization, navigation, DataTable list UI/VM, typed cell values, NewLoan integration, datatable step UI, and small supporting edits.
Developer checkpoints (expand)
- Serialization & schema alignment
- Navigation args & callback refactor
- DataTableList UI and ViewModel field handling
- Type-safe datatable cell values
- NewLoan inline datatable steps & ViewModel integration
- DatatableStepPage UI components
- Supporting constants, routing fixes, and .gitignore
Datatable Field Editing Refactoring โ developer checkpoints
| Layer / File(s) | Summary |
|---|---|
Serialization and Schema Updates core/database/.../ColumnHeader.kt, core/database/.../LoanTemplate.kt, core/network/.../LoansPayload.kt, core/network/.../GetDataTablesResponseMapper.kt |
@SerialName annotations added; LoanTemplate.dataTables element made nullable; network mapper sets ColumnHeader.dataTableColumnName. |
Navigation Callback Refactoring feature/data-table/.../DataTableNavigation.kt, feature/data-table/.../DataTableListNavArgs.kt, feature/client/.../ClientNavigation.kt, cmp-navigation/.../AuthenticatedNavigation.kt |
Removed legacy formWidget/FormWidgetDTO from navigation signatures; added polymorphic navArgJson serializer; updated client/authenticated navigation to call navigateDataTableList with new args. |
DataTable List: UI & ViewModel feature/data-table/.../DataTableListViewModel.kt, feature/data-table/.../DataTableListScreen.kt |
ViewModel now stores per-table formValues and exposes actions for OnFieldChanged; screen wires onFieldChanged and renders stateful inputs; payload building centralized in buildPayloadMap/coerce. |
Type-safe Datatable Field Value feature/loan/.../DatatableFieldValue.kt |
Adds sealed interface DatatableFieldValue with Text, Bool, Code variants used for typed cell state and submission. |
New Loan: Datatable Step Pages & ViewModel Integration feature/loan/.../DatatableStepPage.kt, feature/loan/.../NewLoanAccountScreen.kt, feature/loan/.../NewLoanAccountViewModel.kt |
Adds DatatableStepPage composable; NewLoanAccountScreen builds dynamic steps per datatable; ViewModel tracks datatableValues, adds UpdateDatatableField action, and serializes datatable payloads (filters system columns, coerces numeric types). |
DatatableStepPage UI components feature/loan/.../DatatableStepPage.kt |
Composable input rows for text, numeric, date, boolean, dropdown; helpers to filter system/primary-key columns and compute display labels. |
Supporting Constants & Misc feature/data-table/.../DataTableColumnType.kt, feature/loan/.../LoanAccountScreen.kt, .gitignore |
Introduces DataTableColumnType constants, filters null datatables before routing in LoanAccountScreen, and ignores additional developer artifacts in .gitignore. |
Sequence Diagram (high-level flow)
sequenceDiagram
participant User
participant NewLoanAccountScreen
participant NavController
participant DataTableListScreen
participant DataTableListViewModel
User->>NewLoanAccountScreen: tap Submit when loan has datatables
NewLoanAccountScreen->>NavController: navigateDataTableList(dataTables, payload, requestType)
NavController->>DataTableListScreen: open with encoded args
DataTableListScreen->>DataTableListViewModel: initial state (data tables, payload)
User->>DataTableListScreen: edit cell -> onFieldChanged(tableIdx,column,value)
DataTableListScreen->>DataTableListViewModel: dispatch OnFieldChanged(tableIdx,column,value)
DataTableListViewModel->>DataTableListViewModel: buildPayloadMap() -> create*Account() request
Estimated code review effort
๐ฏ 4 (Complex) | โฑ๏ธ ~60 minutes
Suggested reviewers
- biplab1
- niyajali
- revanthkumarJ
[!IMPORTANT]
Pre-merge checks failed
Please resolve all errors before merging. Addressing warnings is optional.
โ Failed checks (1 error, 1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Jira Link And Before/After Sections | โ Error | PR description includes Jira link (MIFOSAC-706) and an asset, but lacks explicit "Before:" and "After:" sections in table format as required by the PR template for UI changes. | Add a "Before" and "After" section with a table format (as shown in .github/PULL_REQUEST_TEMPLATE.md) containing screenshots/media demonstrating the UI changes for datatable steps. |
| Docstring Coverage | โ ๏ธ Warning | Docstring coverage is 8.11% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
โ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | โ Passed | Title follows the required commit format (feat scope subject) and clearly describes the main change: dynamic datatable steps for new loan creation. |
| Description check | โ Passed | PR description references a Jira issue (MIFOSAC-706) and includes screenshots showing the UI implementation, which aligns with the changeset's datatable and loan-related modifications. |
โจ Finishing Touches
๐งช Generate unit tests (beta)
- [ ] Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
@TheKalpeshPawar Please address the CodeRabbitAI suggestions relevant to this PR.
@coderabbitai Improve PR title based on this: https://github.com/openMF/mifos-pay/wiki/Commit-style-guide.
[!TIP] For best results, initiate chat on the files or code changes.
๐งฉ Analysis chain
๐ Script executed:
#!/bin/bash
# Fetch the commit style guide wiki page
curl -s "https://github.com/openMF/mifos-pay/wiki/Commit-style-guide" | python3 -c "
import sys, re
html = sys.stdin.read()
# Extract text between wiki-body div
match = re.search(r'<div[^>]*class=\"[^\"]*markdown-body[^\"]*\"[^>]*>(.*?)</div>', html, re.DOTALL)
if match:
text = match.group(1)
# Strip HTML tags
text = re.sub(r'<[^>]+>', '', text)
# Clean up whitespace
text = re.sub(r'\n{3,}', '\n\n', text)
print(text.strip())
else:
# Try to find any substantial text
text = re.sub(r'<[^>]+>', '', html)
text = re.sub(r'\n{3,}', '\n\n', text)
# Print first 3000 chars
print(text[:3000])
"
Length of output: 2380
๐ Script executed:
#!/bin/bash
gh pr edit 2693 --repo openMF/mifos-x-field-officer-app \
--title "feat(loan): implement dynamic datatable steps for new loan creation"
Length of output: 691
@biplab1 The automated title update was blocked due to workflow restriction settings. Please update the PR title manually to:
feat(loan): implement dynamic datatable steps for new loan creation
Why this title?
| Element | Current | Improved | Reason |
|---|---|---|---|
| Type | enhancement |
feat |
enhancement is not in the valid type list; feat = new API/behavior for end user |
| Scope | (missing) | loan |
Primary module affected is feature/loan |
| Subject | Implement the Dynamic Data Table Entity for new loan creation |
implement dynamic datatable steps for new loan creation |
Must be present tense, lower case per the style guide |
Please attach the screenshot of web-app screen showing the data table associated with the loan account.
@biplab1 I am not able to login into the web app. If you can, then can you please cross-check the datatables against the screenshots I have uploaded for review?
@TheKalpeshPawar @biplab1 we are testing it
@TheKalpeshPawar @biplab1 we got the following error (we are testing it using the mifos-bank-1)
https://github.com/user-attachments/assets/60f4010a-5bf4-4ed4-b7c7-e1007bb9df14
@TheKalpeshPawar @biplab1 we identified the issue, it was a missing grant on the back end. It is working now.
This PR can be merged!
Thank you!
@niyajali Please review and merge this if everything looks good.
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code