Skip to content

Conversation

@WizCoderr
Copy link
Contributor

@WizCoderr WizCoderr commented Oct 27, 2025

Fixes - Jira-#Issue_Number

Didn't create a Jira ticket, click here to create new.

Please Add Screenshots If there are any UI changes.

Before After

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the static analysis check ./gradlew check or ci-prepush.sh to make sure you didn't break anything

  • If you have multiple commits please combine them into one commit by squashing them.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added QR code functionality to loan account actions.
    • Enhanced loan account details screen with comprehensive account information, including balances, dates, status, and transaction history.
    • Implemented network status monitoring for loan operations.
  • Improvements

    • Restructured loan account navigation with improved screen organization.
    • Enhanced repayment schedule display for better usability.

@coderabbitai
Copy link

coderabbitai bot commented Oct 27, 2025

Walkthrough

This pull request extends the loan account feature module with navigation infrastructure, expanded state management, and new UI components. It introduces navigation routes and helpers for loan accounts, details, summaries, and repayment schedules, while significantly expanding ViewModel state structures and adding corresponding composables with enhanced documentation.

Changes

Cohort / File(s) Summary
Documentation additions
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/component/AccountSummaryCard.kt, RepaymentPeriodCard.kt
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccount/LoanAccountScreen.kt
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountSummary/AccountSummaryScreen.kt
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountRepaymentSchedule/RepaymentScheduleScreen.kt
Added KDoc comments to composables documenting purpose, parameters, and behavior without altering function signatures or logic.
Action items and sealed types
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/component/LoanActionItems.kt
Added new QrCode data object to LoanActionItems sealed class with title, subtitle, icon, and route properties; expanded loanAccountActions collection to include all actions.
Navigation routes and helpers
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccount/LoanAccountNavigation.kt
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountDetails/LoanAccountDetailsNavigation.kt
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountRepaymentSchedule/RepaymentScheduleRoute.kt
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountSummary/AccountSummaryRoute.kt
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/navigation/LoanNavigation.kt
Added public extension functions on NavController and NavGraphBuilder to enable navigation to loan account screens with appropriate slide transitions and callback wiring. Introduced route data classes and graph-level navigation orchestration.
Screen components and layouts
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountDetails/LoanAccountDetailsScreen.kt
Introduced LoanAccountDetailsScreen with expanded navigation callbacks, plus LoanAccountDetailsContent, AccountDetailsGrid, SavingsAccountActions, and LoanAccountDialogs composables; added LabelValueItem data class for UI rendering.
ViewModel state and actions
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccount/LoanAccountViewModel.kt
Added nine new public action types to LoanAccountsAction sealed interface (OnFirstLaunched, OnDismissDialog, OnNavigateBack, ToggleAmountVisible, OnRetry, LoadAccounts, OnAccountClicked, ReceiveNetworkStatus, and Internal.ReceiveLoanAccounts) with enhanced event documentation.
ViewModel expansions
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountDetails/LoanAccountDetailsViewModel.kt
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountSummary/AccountSummaryViewModel.kt
Extended constructor signatures to include networkMonitor and userPreferencesRepository dependencies; significantly expanded public state data classes (LoanAccountDetailsState, LoanAccountSummaryState) with properties for account details, transaction lists, and status; added getQrString() method to details ViewModel; updated DialogState.Error to carry explicit message field.
Repayment schedule state layer
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountRepaymentSchedule/RepaymentScheduleViewModel.kt
Added internal RepaymentScheduleState data class with fields for account and period data; introduced RepaymentScheduleEvent and RepaymentScheduleAction sealed interfaces with nested DialogState and Internal.ReceivedRepaymentSchedule member; added PayInstallment with extended payload (accountId, outStandingBalance, transfer details).
Screen renames and signatures
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountRepaymentSchedule/RepaymentScheduleScreen.kt
Renamed ChargeDetailScreen to RepaymentScheduleScreen; updated RepaymentScheduleList signature to accept nullable currencyCode and maxDigits parameters; added RepaymentScreenContent and RepaymentDialogs composables.

Sequence Diagram

sequenceDiagram
  participant User
  participant Navigation as Navigation Layer
  participant LoanGraph as Loan Nav Graph
  participant LoanAcct as Loan Account Screen
  participant LoanDetails as Loan Details Screen
  participant LoanVM as Loan ViewModel
  participant SummaryVM as Summary ViewModel
  participant Repo as Repository

  User->>Navigation: Navigate to Loan Graph
  Navigation->>LoanGraph: loanNavGraph() with callbacks
  LoanGraph->>LoanAcct: loanAccountDestination()
  
  User->>LoanAcct: View account list / Click account
  LoanAcct->>LoanVM: OnAccountClicked(accountId)
  LoanVM->>Repo: Fetch account details
  Repo-->>LoanVM: DataState<AccountDetails>
  LoanVM->>LoanVM: Update state with account data
  
  LoanVM->>Navigation: Navigate to Loan Details
  Navigation->>LoanGraph: navigateToLoanAccountDetailsScreen()
  LoanGraph->>LoanDetails: loanAccountDetailsDestination()
  
  LoanDetails->>SummaryVM: Load summary data
  SummaryVM->>Repo: Fetch with network monitor
  Repo-->>SummaryVM: LoanWithAssociations
  SummaryVM->>SummaryVM: Populate displayItems, transactionList
  SummaryVM-->>LoanDetails: Updated state
  
  User->>LoanDetails: Click action (Pay, Summary, Schedule, QR, etc.)
  LoanDetails->>Navigation: Navigate to respective screen
  
  Note over LoanVM,SummaryVM: Network status monitored<br/>Error dialogs handled via DialogState
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • ViewModel constructor updates require verification of dependency injection correctness and initialization order, particularly the addition of networkMonitor and userPreferencesRepository across multiple ViewModels.
  • State data class expansions (e.g., LoanAccountDetailsState, LoanAccountSummaryState) need validation that all new properties are properly initialized and integrated into the reducer/state-update logic, and that defaults are sensible.
  • Navigation callback wiring across five navigation files must be verified for consistency and correct parameter passing through the graph hierarchy.
  • Action/Event definitions in LoanAccountViewModel and new state classes should be checked for completeness and correct usage patterns.
  • Screen component additions (AccountDetailsGrid, SavingsAccountActions, LoanAccountDialogs) and their integration with the updated state should be reviewed for data binding correctness.
  • Screen rename (ChargeDetailScreenRepaymentScheduleScreen) needs verification that all references are updated and routing is consistent.

Poem

🐰 Through nested graphs and states we hop,
With QR codes and actions top to bottom,
Navigation threads from loan to sum,
Account details parsed and become one,
A rabbit's joy—when viewmodels run! 🏦✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The PR title "Documentation for features/loan-account" is misleading about the actual scope of work. While the changeset does include documentation additions (KDoc comments), the primary changes are significantly more extensive and include functional additions beyond documentation: new public APIs (QrCode data object, navigation functions, getQrString() method), new composables and data classes (LoanAccountDetailsContent, AccountDetailsGrid, LabelValueItem), expanded ViewModel constructor signatures and state models with numerous new properties, parameter type changes (nullability updates), and a function rename (ChargeDetailScreen → RepaymentScheduleScreen). A developer scanning the PR history would perceive this as a documentation-focused change, when in reality it represents substantial feature implementation and API expansion for loan account functionality. Revise the PR title to accurately reflect the primary work. A more descriptive title would be: "Add QR code support and expand loan account details with enhanced navigation and state management" or similar, which captures the feature implementation, new public APIs, and structural improvements that comprise the majority of this changeset.
Docstring Coverage ⚠️ Warning Docstring coverage is 76.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountRepaymentSchedule/RepaymentScheduleViewModel.kt (1)

192-192: Remove debug println statement.

This debug print statement should be removed before merging to production.

Apply this diff to remove the debug statement:

             is DataState.Success -> {
                 val result = dataState.data
-                println("from success ${ result?.repaymentSchedule?.periods}")
                 val currencyCode = result?.currency?.code
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccount/LoanAccountViewModel.kt (1)

140-144: Correct the function documentation.

The documentation mentions "fetchClient" and "fetchLonPurpose" functions that don't exist in the code. Line 150 shows the actual implementation calls LoadAccounts.

Apply this diff to fix the documentation:

     /**
      * Retries the data fetching process. If the network is unavailable, it shows
-     * a network error dialog. Otherwise, it triggers the `loadAccounts` `fetchClient`,
-     * `fetchLonPurpose` function.
+     * a network error dialog. Otherwise, it triggers the `loadAccounts` action.
      */
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountDetails/LoanAccountDetailsScreen.kt (1)

268-301: Correct the documentation - this is for loan accounts, not savings accounts.

The documentation states "savings account" but this composable is clearly for loan accounts based on the parameter type Set<LoanActionItems> and its location in the loan-account feature.

Apply this diff to fix the documentation:

 /**
- * A composable that displays the actions that can be performed on a savings account.
+ * A composable that displays the actions that can be performed on a loan account.
  *
  * @param visibleActions A set of [LoanActionItems] that should be visible.
  * @param onActionClick A callback that is invoked when an action is clicked.
  */
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountDetails/LoanAccountDetailsViewModel.kt (2)

180-196: Fix invalid nested return and guard against “null” strings in QR payload.

The function uses return if (...) { return ... } else { ... }, which is invalid and can fail compilation. Also, toString() on nullable fields yields the literal "null".

  • Remove the inner return.
  • Ensure officeName, clientName, and accountNumber are all non‑blank before building the QR string.
  • Use orEmpty() to avoid "null" literals.

Apply:

 fun getQrString(): String {
-    val officeName = userPreferencesRepository.userInfo.value.officeName
-    return if (officeName.isNotEmpty()) {
-        return getAccountDetailsInString(
-            clientName = state.clientName.toString(),
-            accountNumber = state.accountNumber.toString(),
-            accountType = AccountType(
-                id = 1,
-                code = "accountType.loan",
-                value = "Loan Account",
-            ),
-            officeName = officeName,
-        )
-    } else {
-        ""
-    }
+    val officeName = userPreferencesRepository.userInfo.value.officeName
+    val client = state.clientName.orEmpty()
+    val accNo = state.accountNumber.orEmpty()
+    if (officeName.isEmpty() || client.isBlank() || accNo.isBlank()) return ""
+    return getAccountDetailsInString(
+        clientName = client,
+        accountNumber = accNo,
+        accountType = AccountType(
+            id = 1,
+            code = "accountType.loan",
+            value = "Loan Account",
+        ),
+        officeName = officeName,
+    )
 }

262-276: Preserve route accountId when response is null; update isEmpty flag.

Overwriting with -1L on null loses the known id. Also, isEmpty stays true forever.

Apply:

-            it.copy(
-                accountId = loan?.id?.toLong() ?: -1L,
+            it.copy(
+                accountId = loan?.id?.toLong() ?: it.accountId,
                 accountStatus = loan?.status?.loanStatus,
                 accountNumber = loan?.accountNo,
                 clientName = loan?.clientName,
                 product = loan?.loanProductName,
                 submissionDate = DateHelper.getDateAsString(loan?.timeline?.submittedOnDate ?: emptyList()),
                 displayItems = displayItems,
                 transactionList = transactions,
                 totalOutStandingBalance = loan?.summary?.totalOutstanding,
-                uiState = ScreenUiState.Success,
+                isEmpty = loan == null,
+                uiState = ScreenUiState.Success,
             )

Optional: use updateState { ... } for consistency with the helper.

🧹 Nitpick comments (12)
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/component/AccountSummaryCard.kt (2)

55-63: Document the default parameter value and special behaviors.

The documentation is clear but could be more complete:

  1. The title parameter has a default value of "" (line 68) which isn't mentioned in the KDoc.
  2. The special color treatment for status labels (lines 130-134) is an undocumented behavior that might be useful for users of this component to know.

Consider applying this diff to improve the documentation:

 /**
  * A composable that displays a summary of account details in a card format.
  * The card is expandable to show more details.
  *
  * @param keyValuePairs A map of key-value pairs to display as account details. The key is a
  *   [StringResource] for the label, and the value is the string to display.
  * @param modifier The modifier to be applied to the component.
- * @param title The title of the card.
+ * @param title The title of the card. Defaults to an empty string.
  */

144-163: Consider using more realistic test data in the preview.

The preview uses mismatched test data where labels don't align with their values (e.g., account number label shows "John Miller", product type shows a date). Using more semantically accurate test data would make the preview more helpful for developers.

For example:

AccountSummaryCard(
    keyValuePairs = mapOf(
        Res.string.feature_loan_account_number_label to "000123456",
        Res.string.feature_loan_product_type_label to "Personal Loan",
        Res.string.feature_loan_scheme_label to "Standard Scheme",
        Res.string.feature_loan_account_status_label to "Active",
    ),
)
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountRepaymentSchedule/RepaymentScheduleViewModel.kt (1)

291-336: Consider using consistent types for transferSuccessDestination.

RepaymentScheduleEvent.PayInstallment uses String for transferSuccessDestination (line 296), while RepaymentScheduleAction.OnPayInstallment uses the TransferSuccessDestination enum (line 335). This requires a conversion via .name at line 97, which adds complexity and may confuse future maintainers about why the types differ.

Consider using the same type in both interfaces for consistency, or document why they differ if there's a specific architectural reason.

feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountRepaymentSchedule/RepaymentScheduleScreen.kt (1)

163-167: Pass null instead of empty string for consistency.

The RepaymentScheduleList signature now accepts String? for currencyCode (line 200), but line 165 still falls back to an empty string when the code is null. For consistency with the nullable signature, consider passing null instead.

Apply this diff:

                     RepaymentScheduleList(
                         periods = state.getPeriods,
-                        currencyCode = state.loanWithAssociations?.currency?.code ?: "",
+                        currencyCode = state.loanWithAssociations?.currency?.code,
                         maxDigits = state.loanWithAssociations?.currency?.decimalPlaces?.toInt(),
                         onPayClick = { period ->
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountDetails/LoanAccountDetailsScreen.kt (1)

218-266: Consider simplifying the parameter signature.

The details parameter combines a nullable type with a default value (List<LabelValueItem>? = emptyList()), which is redundant. Consider either making it non-nullable with a default or nullable without a default for clearer semantics.

Option 1 (preferred): Non-nullable with default

 internal fun AccountDetailsGrid(
     label: String? = null,
-    details: List<LabelValueItem>? = emptyList(),
+    details: List<LabelValueItem> = emptyList(),
 ) {
     Column(
         modifier = Modifier
             .fillMaxWidth(),
         verticalArrangement = Arrangement.spacedBy(DesignToken.spacing.largeIncreased),
     ) {
         if (label != null) {
             Text(
                 text = label,
                 style = MifosTypography.labelLargeEmphasized,
                 color = MaterialTheme.colorScheme.onSurface,
             )
         }
-        if (details != null) {
+        if (details.isNotEmpty()) {
             FlowRow(

Option 2: Nullable without default

 internal fun AccountDetailsGrid(
     label: String? = null,
-    details: List<LabelValueItem>? = emptyList(),
+    details: List<LabelValueItem>?,
 ) {
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountSummary/AccountSummaryViewModel.kt (2)

322-338: Consider tracking these incomplete features.

Two TODO comments indicate missing fields in the data model/API:

  • Lines 322-338: Interest and principal outstanding details
  • Lines 376-380: Linked account information

These are properly documented with TODO comments, but consider creating tracking issues to ensure they're addressed.

Would you like me to open issues to track these incomplete features?

Also applies to: 376-380


416-422: Consider simplifying nullable list types.

The properties are declared as List<LabelValueItem>? with a default of emptyList(), making them nullable types with non-null defaults. This pattern can be confusing since the values will never actually be null.

Consider using non-nullable types instead:

-    val accountDetails: List<LabelValueItem>? = emptyList(),
-    val payOffDetails: List<LabelValueItem>? = emptyList(),
-    val chargeDetails: List<LabelValueItem>? = emptyList(),
-    val waiversDetails: List<LabelValueItem>? = emptyList(),
-    val paidOffDetails: List<LabelValueItem>? = emptyList(),
-    val outStandingDetails: List<LabelValueItem>? = emptyList(),
-    val installmentDetails: List<LabelValueItem>? = emptyList(),
+    val accountDetails: List<LabelValueItem> = emptyList(),
+    val payOffDetails: List<LabelValueItem> = emptyList(),
+    val chargeDetails: List<LabelValueItem> = emptyList(),
+    val waiversDetails: List<LabelValueItem> = emptyList(),
+    val paidOffDetails: List<LabelValueItem> = emptyList(),
+    val outStandingDetails: List<LabelValueItem> = emptyList(),
+    val installmentDetails: List<LabelValueItem> = emptyList(),

This eliminates unnecessary null checks in consuming code.

feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountDetails/LoanAccountDetailsViewModel.kt (5)

186-191: Avoid hard‑coded AccountType literals; prefer shared constants or localized values.

Using id = 1, code = "accountType.loan", and "Loan Account" in-line risks drift and i18n gaps. Source from a shared constant/enum or resources.


249-260: Format installment amount with currency instead of raw toString().

Surface uses formatted outstanding; keep consistency for txn.amount.

Apply:

-                LabelValueItem(
-                    Res.string.feature_loan_installment_amount_label,
-                    txn.amount.toString(),
-                ),
+                LabelValueItem(
+                    Res.string.feature_loan_installment_amount_label,
+                    CurrencyFormatter.format(
+                        txn.amount,
+                        loan?.currency?.code,
+                        loan?.currency?.decimalPlaces?.toInt()
+                    ),
+                ),

If txn.amount is not a numeric type supported by CurrencyFormatter.format, adjust accordingly. Please confirm the signature.


300-316: Tighten state nullability; consider renaming totalOutStandingBalance.

  • transactionList and uiState can be non‑nullable with emptyList()/Loading defaults.
  • Spelling: totalOutstandingBalance improves readability (rename if API surface permits).

Apply:

-    val transactionList: List<LabelValueItem>? = emptyList(),
+    val transactionList: List<LabelValueItem> = emptyList(),
...
-    val uiState: ScreenUiState? = ScreenUiState.Loading,
+    val uiState: ScreenUiState = ScreenUiState.Loading,

Renaming the balance field is optional and may be deferred if it touches many call sites.


55-59: Rename loanAccountRepositoryImp to loanRepository for clarity.

Variable name implies a concrete implementation while the type is the abstraction.


175-179: KDoc for QR helper is good; consider noting other preconditions.

State that clientName/accountNumber must be non‑blank (in addition to officeName), matching the guard in code.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc3d86b and 7159c6d.

📒 Files selected for processing (16)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/component/AccountSummaryCard.kt (1 hunks)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/component/LoanActionItems.kt (2 hunks)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/component/RepaymentPeriodCard.kt (1 hunks)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccount/LoanAccountNavigation.kt (1 hunks)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccount/LoanAccountScreen.kt (3 hunks)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccount/LoanAccountViewModel.kt (4 hunks)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountDetails/LoanAccountDetailsNavigation.kt (1 hunks)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountDetails/LoanAccountDetailsScreen.kt (6 hunks)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountDetails/LoanAccountDetailsViewModel.kt (5 hunks)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountRepaymentSchedule/RepaymentScheduleRoute.kt (1 hunks)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountRepaymentSchedule/RepaymentScheduleScreen.kt (4 hunks)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountRepaymentSchedule/RepaymentScheduleViewModel.kt (6 hunks)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountSummary/AccountSummaryRoute.kt (1 hunks)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountSummary/AccountSummaryScreen.kt (3 hunks)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountSummary/AccountSummaryViewModel.kt (3 hunks)
  • feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/navigation/LoanNavigation.kt (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountRepaymentSchedule/RepaymentScheduleRoute.kt (1)
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountRepaymentSchedule/RepaymentScheduleScreen.kt (1)
  • RepaymentScheduleScreen (58-97)
🔇 Additional comments (19)
feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountSummary/AccountSummaryScreen.kt (1)

51-57: Solid documentation additions across all composables.

The KDoc blocks are well-written, clear, and follow Kotlin conventions consistently. All parameters are documented with appropriate type references, and the descriptions concisely convey the purpose and behavior of each composable. The documentation provides value for future maintainers and IDE consumers.

Also applies to: 86-92, 111-118

feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/component/RepaymentPeriodCard.kt (1)

52-62: LGTM! Clear and accurate documentation.

The KDoc effectively documents the composable's purpose, parameters, and behavior. The documentation accurately reflects the implementation and will help developers understand how to use this component.

feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccount/LoanAccountViewModel.kt (3)

33-40: LGTM! Clear and comprehensive class documentation.

The documentation accurately describes the ViewModel's responsibilities and parameters.


56-306: Excellent documentation additions.

The comprehensive documentation for functions, state management, and data flow significantly improves code maintainability and readability.


309-479: Well-structured documentation for state, actions, and events.

The detailed KDoc comments for LoanAccountsState, LoanAccountsAction, and LoanAccountsEvent provide clear understanding of the data structures and their purposes.

feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountDetails/LoanAccountDetailsScreen.kt (2)

61-146: LGTM! Clear documentation for screen composables.

The documentation accurately describes the purpose and parameters for both the main screen and content composables.


303-337: LGTM! Clear documentation for dialogs and data class.

The documentation accurately describes the purpose and parameters for the dialog composable and the LabelValueItem data class.

feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/component/LoanActionItems.kt (4)

32-40: Excellent documentation for the sealed class.

The KDoc clearly describes the purpose of LoanActionItems and documents all properties with appropriate detail.


47-49: Well-documented action items.

Each action now has clear documentation explaining its purpose, making the codebase more maintainable.

Also applies to: 57-59, 67-69, 77-79, 87-89, 97-99


108-118: Complete and well-documented action list.

The loanAccountActions list correctly includes all defined actions, uses immutable collections appropriate for Compose, and has clear documentation.


97-105: No issues found — QrCode action is properly integrated.

Verification confirms that Constants.QR_CODE is defined in core/common/src/commonMain/kotlin/org/mifos/mobile/core/common/Constants.kt and correctly integrated throughout the codebase. The navigation routing is properly handled in LoanAccountDetailsScreen.kt (lines 116–118), the action follows the same pattern as the corresponding SavingsActionItems.QrCode, and the navigation callback is wired correctly in the graph. All resource strings, icons, and routes are consistent.

feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountSummary/AccountSummaryViewModel.kt (4)

56-75: LGTM! Clear and comprehensive documentation.

The ViewModel documentation clearly describes its purpose and documents all constructor parameters following KDoc conventions.


372-375: Verify the auto-debit logic mapping.

The auto-debit status is determined by if (loan?.npa == true) "Off" else "On". Since NPA typically indicates "Non-Performing Asset" (a loan in default), please verify that this correctly maps the NPA flag to the auto-debit display value according to business requirements.


441-488: LGTM! Well-structured and documented action/event definitions.

The sealed interfaces for events and actions are clearly documented with comprehensive KDoc comments. The separation of internal actions is a good design pattern.


349-367: Filter firstPeriod by unpaid status for accurate "next payment" display.

The code inconsistently handles period selection. Line 353 explicitly identifies unpaid periods (it.complete == false), but line 349 uses firstOrNull() without checking completion status for "next payment" and "regular payment" display.

If the first period is completed or a disbursement entry, these labels will show incorrect information. Align with the established pattern elsewhere in the codebase:

val nextUnpaidPeriod = loan?.repaymentSchedule
    ?.periods
    ?.firstOrNull { it.complete == false }

Then use nextUnpaidPeriod instead of firstPeriod for lines 359 and 366.

feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/loanAccountDetails/LoanAccountDetailsViewModel.kt (4)

46-53: KDoc additions for constructor and responsibilities look good.

Clearer docs improve maintainability.


280-297: State KDoc expansion reads well.

Covers all fields and their intent succinctly.


382-397: Event KDoc improvements LGTM.

Clear navigation semantics.


402-441: Action KDoc improvements LGTM.

Good separation of UI vs. Internal actions.

@therajanmaurya therajanmaurya merged commit df79b26 into openMF:development Oct 28, 2025
8 checks passed
@WizCoderr WizCoderr deleted the MM-433 branch October 28, 2025 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants