android-client icon indicating copy to clipboard operation
android-client copied to clipboard

feat(loan): implement dynamic datatable steps for new loan creation

Open TheKalpeshPawar opened this issue 6 months ago โ€ข 11 comments

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
AUTOEMPLEO PARA MUJERES EN EL MARXO DEL PLAN MICHOACAN POR LA PAX Y LA JUSTICIA_1 AUTOEMPLEO PARA MUJERES EN EL MARXO DEL PLAN MICHOACAN POR LA PAX Y LA JUSTICIA_2
PROGRAMA DEL APOYO DE MOTORES 1 PROGRAMA DEL APOYO DE MOTORES 2
PROGRAMA DEL APOYO DE MOTORES_2 PROGRAMA DEL APOYO DE MOTORES_1
REST
CREDITO SOLIDARIO

TheKalpeshPawar avatar May 25 '26 16:05 TheKalpeshPawar

Review Change Stack

[!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_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to 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.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot] avatar May 25 '26 16:05 coderabbitai[bot]

@TheKalpeshPawar Please address the CodeRabbitAI suggestions relevant to this PR.

biplab1 avatar May 26 '26 13:05 biplab1

@coderabbitai Improve PR title based on this: https://github.com/openMF/mifos-pay/wiki/Commit-style-guide.

biplab1 avatar May 26 '26 13:05 biplab1

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

coderabbitai[bot] avatar May 26 '26 13:05 coderabbitai[bot]

Please attach the screenshot of web-app screen showing the data table associated with the loan account.

biplab1 avatar Jun 02 '26 13:06 biplab1

@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 avatar Jun 10 '26 08:06 TheKalpeshPawar

@TheKalpeshPawar @biplab1 we are testing it

IOhacker avatar Jun 11 '26 22:06 IOhacker

@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

IOhacker avatar Jun 12 '26 03:06 IOhacker

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

IOhacker avatar Jun 12 '26 18:06 IOhacker

@niyajali Please review and merge this if everything looks good.

biplab1 avatar Jun 18 '26 13:06 biplab1