Skip to content

Implemented a Export Dialog Box in Transaction Screen#2607

Open
gurnoorpannu wants to merge 3 commits intoopenMF:developmentfrom
gurnoorpannu:feature/loan-transactions-export-dialog
Open

Implemented a Export Dialog Box in Transaction Screen#2607
gurnoorpannu wants to merge 3 commits intoopenMF:developmentfrom
gurnoorpannu:feature/loan-transactions-export-dialog

Conversation

@gurnoorpannu
Copy link
Contributor

@gurnoorpannu gurnoorpannu commented Feb 10, 2026

Fixes - Jira-#657

Before:-
image

After:-

image

Recording:-

FILE.2026-02-16.18.20.06.mp4

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

  • New Features
    • Added loan transaction export dialog with selectable From/To dates.
    • Users can generate transaction reports for a chosen date range.
    • Date inputs include validation and show an "invalid date range" message.
    • Export action button added to the loan transactions screen.
    • Localized labels for export, date fields, report generation, and validation.

@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

Adds an export UI: six new string resources, a new ExportTransactionsDialog composable with from/to date pickers and validation, and a scaffold action in LoanTransactionsScreen that opens the dialog and returns a selected date range.

Changes

Cohort / File(s) Summary
String Resources
feature/loan/src/commonMain/composeResources/values/strings.xml
Added six strings for export UI and date-range validation: feature_loan_export, feature_loan_export_transactions, feature_loan_from_date, feature_loan_to_date, feature_loan_generate_report, feature_loan_invalid_date_range.
Export Dialog Component
feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanTransaction/ExportTransactionsDialog.kt
New composable dialog implementing two date pickers, date initialization/helpers, date formatting, validation (toDate >= fromDate), error messaging, and onGenerateReport(fromMillis, toMillis) callback.
Screen Integration
feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanTransaction/LoanTransactionsScreen.kt
Added export IconButton, showExportDialog state, opens ExportTransactionsDialog and wires onGenerateReport (placeholder).

Sequence Diagram

sequenceDiagram
    actor User
    participant LoanTransactionsScreen as LTScreen
    participant ExportTransactionsDialog as Dialog
    participant DatePicker as Picker

    User->>LTScreen: Tap export button
    LTScreen->>LTScreen: set showExportDialog = true
    LTScreen->>Dialog: show dialog

    User->>Dialog: Open from-date picker
    Dialog->>Picker: request from-date (min 2000-01-01)
    Picker->>Dialog: return fromDate (ms)
    Dialog->>Dialog: update fromDate

    User->>Dialog: Open to-date picker
    Dialog->>Picker: request to-date (min 2000-01-01)
    Picker->>Dialog: return toDate (ms)
    Dialog->>Dialog: update toDate, validate range

    alt Valid date range
        User->>Dialog: Tap Generate Report
        Dialog->>LTScreen: onGenerateReport(fromMs, toMs)
        LTScreen->>Dialog: dismiss dialog
    else Invalid date range
        Dialog->>User: show invalid date range error
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • itsPronay
  • TheKalpeshPawar
  • biplab1

Poem

🐰 I hopped to add a date or two,

From and To now pick what's true,
Generate waits till ranges align,
Transactions packaged, neat and fine,
A tiny hop for export time!

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: implementing an export dialog box in the transaction screen, which aligns with the PR's primary objective of adding export functionality to the Loan Transactions screen.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into development
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

@Kartikey15dem
Copy link
Contributor

I think the the close(x) button should be black with transparent background.

private fun formatDateFromMillis(millis: Long?): String {
if (millis == null) return ""
val localDate = Instant.fromEpochMilliseconds(millis)
.toLocalDateTime(TimeZone.currentSystemDefault())

Choose a reason for hiding this comment

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

there is a time zone mismatch with fun createSelectableDatesFrom(minDate: LocalDate) = object : SelectableDates I suggest using TimeZone.UTC for consistency

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will fix that, ty for the review :)


<!-- Export Loan Transactions -->
<string name="feature_loan_export">Export</string>
<string name="feature_loan_export_transactions">Export</string>

Choose a reason for hiding this comment

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

why two different keys with same values ? you meant the second one to be Export Transactions did't you

}

@OptIn(ExperimentalTime::class)
@Composable

Choose a reason for hiding this comment

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

I think this function should not be annotated with Composable it does not emit UI, call remember or other compose APIs or take compose parameter, marking it with compose it triggers unnecessary recomposition tracking overhead.

var showToDatePicker by rememberSaveable { mutableStateOf(false) }
var fromDate: Long? by rememberSaveable { mutableStateOf(null) }
var toDate: Long? by rememberSaveable { mutableStateOf(null) }
var showInvalidDateRangeError by remember { mutableStateOf(false) }

Choose a reason for hiding this comment

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

this will be lost on config change, should not it be rememberSaveable also ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@markrizkalla I kept it as remember intentionally since it is just a error message that gets recalculated when the user interacts with the form only the actual date values need to survive config changes

@gurnoorpannu gurnoorpannu force-pushed the feature/loan-transactions-export-dialog branch from 377ec90 to c7cb0e4 Compare February 16, 2026 09:38
@sonarqubecloud
Copy link

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.

🧹 Nitpick comments (1)
feature/loan/src/commonMain/composeResources/values/strings.xml (1)

297-298: Duplicate string values: feature_loan_export and feature_loan_export_transactions are both "Export".

These strings serve different UI purposes: feature_loan_export is used as a content description for the export button icon (line 136 of LoanTransactionsScreen.kt), while feature_loan_export_transactions is the dialog title (line 134 of ExportTransactionsDialog.kt). Consider differentiating their values—e.g., "Export" for the button and "Export Transactions" for the dialog title—to provide better context in different parts of the UI.

Copy link
Contributor

@amanna13 amanna13 left a comment

Choose a reason for hiding this comment

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

Hey @gurnoorpannu ! Consider attaching a video (screen recording) for all the possible situations as mentioned in the ticket description-

On tapping Export, show a dialog with:
From Date (required)
To Date (required)
Cancel button
Generate Report button (disabled until validation passes)
Validation rules:
Both dates must be selected
To Date cannot be earlier than From Date
Only after valid input, the Generate Report button should become active

It's hard to validate these things with a single screenshot.
Thanks!

@gurnoorpannu
Copy link
Contributor Author

Hey @gurnoorpannu ! Consider attaching a video (screen recording) for all the possible situations as mentioned in the ticket description-

On tapping Export, show a dialog with:
From Date (required)
To Date (required)
Cancel button
Generate Report button (disabled until validation passes)
Validation rules:
Both dates must be selected
To Date cannot be earlier than From Date
Only after valid input, the Generate Report button should become active

It's hard to validate these things with a single screenshot. Thanks!

updated it 👍

@amanna13
Copy link
Contributor

@gurnoorpannu Have you validated that if To Date is earlier than From Date then Generate Report button should not be active !? Also I had a doubt, correct me if I'm wrong. The ticket mentions that button must be named as "Generate Report" in your implementation you have button named "Generate".
From a user perspective, I believe that "Generate Report" adds more clarity to what it's intended use is for.

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.

4 participants