Skip to content

Conversation

@revanthkumarJ
Copy link
Contributor

@revanthkumarJ revanthkumarJ commented Nov 21, 2025

WhatsApp.Video.2025-11-21.at.10.49.51.PM.mp4

Summary by CodeRabbit

  • New Features

    • View detailed collateral information for clients, including item names, base prices, and quantities. The new collateral details screen provides a comprehensive overview of each client's collateral assets.
  • Bug Fixes & Improvements

    • Fixed actions menu to display only when menu items are available, improving UI cleanliness.
    • Streamlined navigation flow to client profiles.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 21, 2025

Warning

Rate limit exceeded

@revanthkumarJ has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 46 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 69b64d0 and f67cb2c.

📒 Files selected for processing (2)
  • feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientCollateralDetails/ClientCollateralDetailScreen.kt (1 hunks)
  • feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientCollateralDetails/ClientCollateralDetailViewmodel.kt (1 hunks)

Walkthrough

This PR introduces a new client collateral details feature by adding an API endpoint to fetch collateral items, implementing repository and data manager methods, creating a collateral details screen with navigation and viewmodel, and updating UI components. The feature integrates across multiple layers from network to UI.

Changes

Cohort / File(s) Summary
Navigation Layer
cmp-navigation/.../AuthenticatedNavbarNavigationScreen.kt, feature/client/.../ClientNavigation.kt
Updates navigation routing to use navigateToClientProfileRoute instead of navigateClientDetailsScreen; adds collateral detail destination and navigation handler.
API & Network Layer
core/network/.../ClientService.kt, core/network/.../DataManagerClient.kt, core/network/.../CollateralItem.kt
Introduces getClientCollateralItems API endpoint, adds CollateralItemResult data class, and delegates through DataManagerClient.
Data Repository Layer
core/data/.../ClientDetailsRepository.kt, core/data/.../ClientDetailsRepositoryImp.kt
Adds getClientCollaterals suspend function to interface and implementation, wrapping API calls in DataState.
UI Component
core/ui/.../MifosActionsListingCardComponent.kt
Adds conditional rendering for menu (only when non-empty), introduces localized string for "Name" key, and refactors menu items into a padded Column.
Feature: Collateral Details
feature/client/.../ClientCollateralDetailRoute.kt, feature/client/.../ClientCollateralDetailScreen.kt, feature/client/.../ClientCollateralDetailViewmodel.kt
Introduces serializable route, composable screen with state-based rendering (Empty/Loading/Error/Success), and viewmodel managing collateral data fetch and UI state via network-aware DataState handling.
Dependency Injection
feature/client/.../ClientModule.kt
Registers ClientCollateralDetailViewmodel into the DI module.

Sequence Diagram

sequenceDiagram
    participant Nav as NavController
    participant Route as ClientCollateralDetailRoute
    participant Screen as ClientCollateralDetailScreen
    participant VM as ClientCollateralDetailViewmodel
    participant Repo as ClientDetailsRepository
    participant API as ClientService
    participant UI as UI State Machine

    Nav->>Route: navigateToClientCollateralDetailRoute(clientId)
    Route->>Screen: Render with clientId
    Screen->>VM: Collect state from Koin
    VM->>VM: Init: check NetworkMonitor
    alt Network Available
        VM->>Repo: getClientCollaterals(clientId)
        Repo->>API: clientService.getClientCollateralItems(clientId)
        API-->>Repo: List<CollateralItemResult>
        Repo-->>VM: DataState.Success(data)
    else Network Unavailable
        VM->>VM: Emit Error state
    end
    VM->>UI: Update state (Loading→Success/Error/Empty)
    UI->>Screen: Render based on state
    rect rgb(200, 220, 240)
        Note over Screen: Empty → MifosEmptyCard<br/>Loading → MifosProgressIndicator<br/>Error → MifosErrorComponent<br/>Success → LazyColumn with items
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Viewmodel state management logic (ClientCollateralDetailViewmodel.kt): Verify DataState handling, network availability checks, and retry mechanics
  • Route registration and navigation flow (ClientCollateralDetailRoute.kt, ClientNavigation.kt): Confirm proper integration with existing navigation graph
  • API endpoint correctness (ClientService.kt): Validate endpoint path and response model mapping
  • UI component conditional rendering (MifosActionsListingCardComponent.kt): Ensure menu visibility logic doesn't break existing usages

Possibly related PRs

  • openMF/android-client#2536: Modifies the same MifosActionsListingCardComponent.kt UI component with related expansion state handling and actions listing behavior.

Suggested reviewers

  • Arinyadav1
  • biplab1
  • sam-arth07

Poem

🐰 Collaterals hop into view,
New routes and screens, tried and true!
From API calls to UI gleam,
A feature complete—the rabbit's dream!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding a new collateral data screen feature throughout the codebase.

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

🧹 Nitpick comments (4)
feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientCollateralDetails/ClientCollateralDetailScreen.kt (3)

61-73: Consider wiring scaffold back-press to navigation

onBackPressed = { } makes the scaffold’s back action a no-op. Since navController is already available and the breadcrumb bar provides back navigation, you may want to keep behavior consistent by delegating back-press to the nav controller as well.

For example:

-    MifosScaffold(
-        title = "",
-        onBackPressed = { },
-        modifier = modifier,
-    ) { paddingValues ->
+    MifosScaffold(
+        title = "",
+        onBackPressed = { navController.popBackStack() },
+        modifier = modifier,
+    ) { paddingValues ->

121-140: Improve item-count text for localization/pluralization

totalItem + " " + stringResource(Res.string.client_savings_item) hardcodes string concatenation and may not localize well for different languages (plural forms, word order).

If possible, prefer a dedicated plural/string resource with format args (e.g., "Collateral items: %d") and use stringResource with parameters instead of manual concatenation.


142-154: Use explicit numeric types/formatting for monetary and percentage values

total and totalCollateral are computed with plain *// and then toString(). Depending on the types of basePrice, quantity, and pctToBase, this may:

  • Truncate decimals if everything is Int (integer division).
  • Display unformatted raw numbers instead of user-friendly currency/amount strings.

Consider:

  • Ensuring the calculation uses Double or a decimal type (e.g. total * (item.pctToBase / 100.0) if pctToBase is an Int), and
  • Formatting values via your existing amount/currency formatter (if available) before passing them as Strings to MifosActionsCollateralDataListingComponent.
feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientCollateralDetails/ClientCollateralDetailViewmodel.kt (1)

98-116: Remove or use currently unused state and event types

ClientCollateralDetailsState.networkConnection and the ClientCollateralDetailsEvent sealed interface are defined but never used in this screen’s ViewModel/UI flow.

To reduce noise:

  • Either wire networkConnection into your UI or remove it from the state for now, and
  • Drop ClientCollateralDetailsEvent until you have concrete one-off events to expose (snackbars, navigation, etc.).
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f9dc5bf and 69b64d0.

📒 Files selected for processing (12)
  • cmp-navigation/src/commonMain/kotlin/cmp/navigation/authenticated/AuthenticatedNavbarNavigationScreen.kt (2 hunks)
  • core/data/src/commonMain/kotlin/com/mifos/core/data/repository/ClientDetailsRepository.kt (2 hunks)
  • core/data/src/commonMain/kotlin/com/mifos/core/data/repositoryImp/ClientDetailsRepositoryImp.kt (2 hunks)
  • core/network/src/commonMain/kotlin/com/mifos/core/network/datamanager/DataManagerClient.kt (2 hunks)
  • core/network/src/commonMain/kotlin/com/mifos/core/network/model/CollateralItem.kt (1 hunks)
  • core/network/src/commonMain/kotlin/com/mifos/core/network/services/ClientService.kt (2 hunks)
  • core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosActionsListingCardComponent.kt (3 hunks)
  • feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientCollateralDetails/ClientCollateralDetailRoute.kt (1 hunks)
  • feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientCollateralDetails/ClientCollateralDetailScreen.kt (1 hunks)
  • feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientCollateralDetails/ClientCollateralDetailViewmodel.kt (1 hunks)
  • feature/client/src/commonMain/kotlin/com/mifos/feature/client/di/ClientModule.kt (2 hunks)
  • feature/client/src/commonMain/kotlin/com/mifos/feature/client/navigation/ClientNavigation.kt (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientCollateralDetails/ClientCollateralDetailRoute.kt (1)
feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientCollateralDetails/ClientCollateralDetailScreen.kt (1)
  • ClientCollateralDetailScreen (41-52)
core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosActionsListingCardComponent.kt (1)
core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosListingComponent.kt (2)
  • MifosListingRowItem (103-128)
  • MifosListingRowItem (172-200)
feature/client/src/commonMain/kotlin/com/mifos/feature/client/navigation/ClientNavigation.kt (1)
feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientCollateralDetails/ClientCollateralDetailRoute.kt (1)
  • clientCollateralDetailDestination (22-28)
feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientCollateralDetails/ClientCollateralDetailScreen.kt (5)
core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosBreadCrumb.kt (1)
  • MifosBreadcrumbNavBar (36-107)
core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosEmptyCard.kt (1)
  • MifosEmptyCard (28-46)
core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosErrorComponent.kt (1)
  • MifosErrorComponent (41-60)
core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosProgressIndicator.kt (1)
  • MifosProgressIndicator (41-68)
core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosActionsListingCardComponent.kt (1)
  • MifosActionsCollateralDataListingComponent (226-309)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: PR Checks / Build Android Application
🔇 Additional comments (20)
cmp-navigation/src/commonMain/kotlin/cmp/navigation/authenticated/AuthenticatedNavbarNavigationScreen.kt (2)

353-353: Clarify whether onSavings should use the new navigation route.

The onSavings parameter uses navigateClientDetailsScreen while onClient (line 350) uses the newer navigateToClientProfileRoute. This inconsistency suggests either:

  1. An incomplete migration where onSavings should also use navigateToClientProfileRoute
  2. Intentional routing where savings navigation should lead to a different screen than client navigation

If this is unintentional and should be updated, the import on line 80 would also become unused.


78-78: No changes needed—the navigation inconsistency is intentional.

The PR correctly distinguishes between two different user flows in the searchNavGraph:

  • Line 350 (onClient): When a client is selected directly from search → navigates to navigateToClientProfileRoute (new)
  • Line 353 (onSavings): When a savings account is selected from search → navigates to navigateClientDetailsScreen (existing)

These parameters serve different semantic purposes and should use different navigation targets. The change is correct as-is.

core/ui/src/commonMain/kotlin/com/mifos/core/ui/components/MifosActionsListingCardComponent.kt (4)

43-43: LGTM! String resource import added for localization.


235-235: LGTM! Collateral cards now start collapsed.

Setting isExpanded = false ensures collateral data cards start in a collapsed state, which is appropriate for this non-interactive component that doesn't have an onClick handler.


241-241: LGTM! Localized string resource usage.

Replacing the hardcoded "Name" string with stringResource(Res.string.name) enables proper internationalization.


267-306: LGTM! Defensive guard prevents rendering empty menu section.

Wrapping the menu Surface and Column in an if (menuList.isNotEmpty()) check ensures the menu UI is only rendered when actions are available, avoiding empty visual elements.

core/network/src/commonMain/kotlin/com/mifos/core/network/datamanager/DataManagerClient.kt (2)

30-30: LGTM! Import added for new model type.


189-191: LGTM! Data manager method follows established patterns.

The new getClientCollateralItems method correctly delegates to the service layer and follows the same pattern as other data retrieval methods in this class.

core/data/src/commonMain/kotlin/com/mifos/core/data/repository/ClientDetailsRepository.kt (2)

16-16: LGTM! Import added for repository method signature.


45-45: LGTM! Repository interface extended with collateral retrieval method.

The new getClientCollaterals method signature is consistent with other repository methods and appropriately wraps the response in DataState for error handling.

core/network/src/commonMain/kotlin/com/mifos/core/network/services/ClientService.kt (1)

25-25: LGTM! Import added for API response type.

feature/client/src/commonMain/kotlin/com/mifos/feature/client/navigation/ClientNavigation.kt (3)

36-37: LGTM! Navigation imports added for collateral details screen.


236-236: LGTM! Collateral data navigation now functional.

The navigation lambda is now properly implemented, replacing the previous empty placeholder with actual navigation to the client collateral detail route.


244-246: LGTM! Collateral detail destination registered in navigation graph.

The destination is properly registered following the same pattern as other client-related destinations.

feature/client/src/commonMain/kotlin/com/mifos/feature/client/di/ClientModule.kt (2)

20-20: LGTM! Import added for DI registration.


89-89: LGTM! ViewModel registered with Koin DI container.

The ClientCollateralDetailViewmodel is properly registered following the same pattern as other ViewModels in the module.

core/data/src/commonMain/kotlin/com/mifos/core/data/repositoryImp/ClientDetailsRepositoryImp.kt (2)

19-19: LGTM! Import added for implementation.


76-83: LGTM! Repository implementation follows established error handling pattern.

The getClientCollaterals method correctly implements the interface, properly wraps the data manager call in try-catch, and returns appropriate DataState values for success and error cases, consistent with other methods in this class.

feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientCollateralDetails/ClientCollateralDetailRoute.kt (1)

17-38: Route and navigation helper look consistent

The ClientCollateralDetailRoute plus the clientCollateralDetailDestination and navigateToClientCollateralDetailRoute helpers are wired in a type-safe way and align with the serialization-based navigation pattern; no issues spotted here.

feature/client/src/commonMain/kotlin/com/mifos/feature/client/clientCollateralDetails/ClientCollateralDetailViewmodel.kt (1)

39-88: State transitions cover main cases; consider also tracking network flag in state if needed

The getCollaterals coroutine handles Loading, Success (with empty vs non-empty lists), and Error (online and offline) cleanly, and uses networkMonitor to distinguish connectivity issues.

If you intend to use networkConnection from ClientCollateralDetailsState in the UI, you might also want to update that field alongside state updates; otherwise it can likely be dropped to keep the state minimal.

@therajanmaurya therajanmaurya merged commit 36fbf47 into openMF:development Nov 21, 2025
3 checks passed
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