Skip to content

Collection Sheet Enhancement #2406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: kmp-impl
Choose a base branch
from

Conversation

Aditya3815
Copy link
Contributor

@Aditya3815 Aditya3815 commented Jun 16, 2025

Screen_recording_20250625_225800.mp4

Fixes - Jira-#MIFOSAC-453

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.

@Aditya3815 Aditya3815 changed the title Collection Sheet Collection Sheet Enhancement Jun 16, 2025
# Conflicts:
#	cmp-android/dependencies/demoDebugRuntimeClasspath.txt
#	cmp-android/dependencies/prodDebugRuntimeClasspath.txt
# Conflicts:
#	feature/collectionSheet/src/commonMain/kotlin/com/mifos/feature/individualCollectionSheet/paymentDetails/PaymentDetailsScreen.kt
@Aditya3815 Aditya3815 marked this pull request as ready for review June 25, 2025 17:31
@revanthkumarJ
Copy link

@Aditya3815 can you replace if Total Charges , and other fields if null show zero on screen as showing null on screen to user is not appropriate

@@ -25,11 +26,16 @@ kotlin {
implementation(compose.ui)
implementation(projects.core.domain)
implementation(libs.kotlinx.serialization.json)
implementation(compose.components.uiToolingPreview)
Copy link
Member

Choose a reason for hiding this comment

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

Remove this as u already defined in dependencies {} block

Copy link
Member

Choose a reason for hiding this comment

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

i mentioned remove it from commonMain but keep the dependencies{}:

  • cause when we create a project from KMP wizard this way it is done by default maybe they have sth in mind where in future the previews will work for all platform if we have it here
dependencies {
    debugImplementation(compose.uiTooling)
}

@@ -210,6 +210,8 @@ private fun IndividualCollectionSheetItem(
modifier: Modifier = Modifier,
onClick: () -> Unit,
) {
val loan = client.loans?.getOrNull(index)
Copy link
Member

Choose a reason for hiding this comment

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

i see that this index is not use anywhere except finding the loan. so instead of passing index why not passing the loan itself from place this composable is called

state.officeList[index].id.let {
getStaffList(it)
officeId = it
println("DEBUG: Office selection - Index: $index, List size: ${state.officeList.size}, Value: $value")
Copy link
Member

Choose a reason for hiding this comment

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

remove all of these println

)
Spacer(modifier = Modifier.width(16.dp))
Text(
text = client.loans?.get(index)?.totalDue.toString(),
text = (loan?.totalDue ?: 0).toString(),
Copy link
Member

Choose a reason for hiding this comment

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

  • the zero should be in this format 0.0
  • i see this screen there are things that need to be taken care of at viewmodel and the screen should only display to user, but no worries for now we should come back for all of these

state.staffList[index].id?.let {
staffId = it
try {
if (index >= 0 && index < state.staffList.size) {
Copy link
Member

Choose a reason for hiding this comment

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

having these codes like try/cathc is highly discouraged in UI. use build it extension functions: sth like below change accordingly

state.officeList.getOrNull(index)?.let { selectedOfficeEntity ->
    selectedOfficeEntity.id?.let {
        getStaffList(it)
        officeId = it
    }
    selectedOffice = selectedOfficeEntity.name.toString()
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@HekmatullahAmin as you requested I have done changes can you do review now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After that I will run the spotlessApply

Removed duplicate depndencies from build.gradle.kts
change the Int to Double type 0 -> 0.0
onClick = {
sheet.paymentTypeOptions?.let { paymentTypeOptions ->
submit(
index,
0,
Copy link
Member

Choose a reason for hiding this comment

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

  • By removing index i meant to remove it from composable and just pass the loan as a parameter instead of going to composable and finding again using the index. where the index is not used in that composable at any line.
  • but you removed the index from submit and other areas an hardcoded it.
  • when i review the code i compare it to the previous code cause i am not fully aware of each variable and what specefic screen do. so keep the things as before just inside the IndividualCollectionSheetItem instead of passing index pass the loan using maybe client.loans?.get(index).
  • so have itemsIndexed as before

@@ -178,17 +180,17 @@ internal fun IndividualCollectionSheetDetailsScreen(
} else {
LazyColumn {
Copy link
Member

Choose a reason for hiding this comment

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

whenever u use LazyColumn use key for better performance

@@ -25,11 +26,16 @@ kotlin {
implementation(compose.ui)
implementation(projects.core.domain)
implementation(libs.kotlinx.serialization.json)
implementation(compose.components.uiToolingPreview)
Copy link
Member

Choose a reason for hiding this comment

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

i mentioned remove it from commonMain but keep the dependencies{}:

  • cause when we create a project from KMP wizard this way it is done by default maybe they have sth in mind where in future the previews will work for all platform if we have it here
dependencies {
    debugImplementation(compose.uiTooling)
}

@Nagarjuna0033
Copy link

Nagarjuna0033 commented Jul 13, 2025

@Aditya3815 are you working on this pr, if not can you close this

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.

5 participants