-
Notifications
You must be signed in to change notification settings - Fork 625
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
Aditya3815
wants to merge
19
commits into
openMF:kmp-impl
Choose a base branch
from
Aditya3815:collectionsheet-enhancement
base: kmp-impl
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
acda6fd
start collection-sheet enhancement
Aditya3815 e87f0c5
Add Preview dependencies and annotation DevicePreview to Preview
Aditya3815 a6e63b8
Index 1 out of bounds for length 1 resolved
Aditya3815 568038a
Merge branch 'refs/heads/kmp-impl' into collectionsheet-enhancement
Aditya3815 5832ff9
updated
Aditya3815 5cc2a65
Merge branch 'refs/heads/kmp-impl' into collectionsheet-enhancement
Aditya3815 93c9e8f
Complete
Aditya3815 f9676ba
complete 2
Aditya3815 ff585b1
Collection Sheet Enhancement Complete
Aditya3815 a276755
Index removed as parameter instead directly passing loan
Aditya3815 82d87fd
Merge branch 'kmp-impl' into collectionsheet-enhancement
revanthkumarJ 447d1eb
Merge branch 'kmp-impl' into collectionsheet-enhancement
revanthkumarJ 48ec51b
updated
revanthkumarJ d652cf4
updated
revanthkumarJ 6f2288d
updated
revanthkumarJ 4829298
updated
revanthkumarJ 84a5543
updated
revanthkumarJ f2d6dca
Merge branch 'kmp-impl' into collectionsheet-enhancement
niyajali 3cbb9c3
Merge branch 'kmp-impl' into collectionsheet-enhancement
niyajali File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ import androidx.compose.foundation.layout.padding | |
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.foundation.lazy.items | ||
import androidx.compose.foundation.lazy.itemsIndexed | ||
import androidx.compose.foundation.shape.CircleShape | ||
import androidx.compose.material3.Icon | ||
|
@@ -58,14 +59,15 @@ import com.mifos.core.designsystem.component.MifosSweetError | |
import com.mifos.core.designsystem.icon.MifosIcons | ||
import com.mifos.core.model.objects.account.loan.PaymentTypeOptions | ||
import com.mifos.core.model.objects.collectionsheets.LoanAndClientName | ||
import com.mifos.core.model.objects.collectionsheets.LoanCollectionSheet | ||
import com.mifos.core.network.model.IndividualCollectionSheetPayload | ||
import com.mifos.core.ui.util.DevicePreview | ||
import com.mifos.room.entities.collectionsheet.ClientCollectionSheet | ||
import com.mifos.room.entities.collectionsheet.IndividualCollectionSheet | ||
import com.mifos.room.entities.noncore.BulkRepaymentTransactions | ||
import kotlinx.coroutines.launch | ||
import org.jetbrains.compose.resources.painterResource | ||
import org.jetbrains.compose.resources.stringResource | ||
import org.jetbrains.compose.ui.tooling.preview.Preview | ||
import org.koin.compose.viewmodel.koinViewModel | ||
|
||
@Composable | ||
|
@@ -178,17 +180,17 @@ internal fun IndividualCollectionSheetDetailsScreen( | |
} else { | ||
LazyColumn { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whenever u use |
||
sheet.clients?.toList()?.let { | ||
itemsIndexed(it) { index, client -> | ||
itemsIndexed(it.zip(loansAndClientNames)) { index,(client, loanAndClientName) -> | ||
IndividualCollectionSheetItem( | ||
client = client, | ||
index = index, | ||
loan = loanAndClientName.loan, | ||
onClick = { | ||
sheet.paymentTypeOptions?.let { paymentTypeOptions -> | ||
submit( | ||
index, | ||
payload, | ||
paymentTypeOptions.map { paymentTypeOption -> paymentTypeOption.name.toString() }, | ||
loansAndClientNames[index], | ||
paymentTypeOptions.map { it.name.toString() }, | ||
loanAndClientName, | ||
paymentTypeOptions.toList(), | ||
client.clientId, | ||
) | ||
|
@@ -206,10 +208,11 @@ internal fun IndividualCollectionSheetDetailsScreen( | |
@Composable | ||
private fun IndividualCollectionSheetItem( | ||
client: ClientCollectionSheet, | ||
index: Int, | ||
loan: LoanCollectionSheet?, | ||
modifier: Modifier = Modifier, | ||
onClick: () -> Unit, | ||
) { | ||
|
||
OutlinedCard( | ||
modifier = modifier | ||
.padding(6.dp) | ||
|
@@ -246,18 +249,16 @@ private fun IndividualCollectionSheetItem( | |
Text( | ||
text = it, | ||
style = MaterialTheme.typography.bodyLarge, | ||
|
||
) | ||
} | ||
Row { | ||
Text( | ||
text = stringResource(Res.string.feature_collection_sheet_total_due), | ||
style = MaterialTheme.typography.bodyMedium, | ||
|
||
) | ||
Spacer(modifier = Modifier.width(16.dp)) | ||
Text( | ||
text = client.loans?.get(index)?.totalDue.toString(), | ||
text = (loan?.totalDue ?: 0.0).toString(), | ||
style = MaterialTheme.typography.bodyMedium, | ||
) | ||
} | ||
|
@@ -268,18 +269,16 @@ private fun IndividualCollectionSheetItem( | |
) | ||
Spacer(modifier = Modifier.width(16.dp)) | ||
Text( | ||
text = client.loans?.get(index)?.chargesDue.toString(), | ||
text = (loan?.chargesDue ?: 0.0).toString(), | ||
style = MaterialTheme.typography.bodyMedium, | ||
) | ||
} | ||
if (loan?.productShortName != null) { | ||
Text( | ||
text = "${loan.productShortName} (#${loan.productShortName})", | ||
style = MaterialTheme.typography.bodyMedium, | ||
) | ||
} | ||
Text( | ||
text = "${client.loans?.get(index)?.productShortName} (#${ | ||
client.loans?.get( | ||
index, | ||
)?.productShortName | ||
})", | ||
style = MaterialTheme.typography.bodyMedium, | ||
) | ||
} | ||
Icon( | ||
imageVector = MifosIcons.ArrowForward, | ||
|
@@ -289,7 +288,7 @@ private fun IndividualCollectionSheetItem( | |
} | ||
} | ||
|
||
@DevicePreview | ||
@Preview | ||
@Composable | ||
private fun IndividualCollectionSheetDetailsScreenEmptyPreview() { | ||
IndividualCollectionSheetDetailsScreen( | ||
|
@@ -303,7 +302,7 @@ private fun IndividualCollectionSheetDetailsScreenEmptyPreview() { | |
) | ||
} | ||
|
||
@DevicePreview | ||
@Preview | ||
@Composable | ||
private fun IndividualCollectionSheetDetailsScreenErrorPreview() { | ||
IndividualCollectionSheetDetailsScreen( | ||
|
@@ -317,7 +316,7 @@ private fun IndividualCollectionSheetDetailsScreenErrorPreview() { | |
) | ||
} | ||
|
||
@DevicePreview | ||
@Preview | ||
@Composable | ||
private fun IndividualCollectionSheetDetailsScreenLoadingPreview() { | ||
IndividualCollectionSheetDetailsScreen( | ||
|
@@ -331,7 +330,7 @@ private fun IndividualCollectionSheetDetailsScreenLoadingPreview() { | |
) | ||
} | ||
|
||
@DevicePreview | ||
@Preview | ||
@Composable | ||
private fun IndividualCollectionSheetDetailsScreenSuccessPreview() { | ||
IndividualCollectionSheetDetailsScreen( | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 {}
blockThere was a problem hiding this comment.
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 thedependencies{}
: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