Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ import com.mifos.core.model.objects.payloads.GroupLoanPayload
import com.mifos.core.network.model.LoansPayload
import com.mifos.room.entities.accounts.loans.Loan
import com.mifos.room.entities.client.ClientPayloadEntity
import io.ktor.client.statement.HttpResponse
import kotlinx.coroutines.flow.Flow

/**
* Created by Aditya Gupta on 10/08/23.
*/
interface DataTableListRepository {

fun createLoansAccount(loansPayload: LoansPayload?): Flow<DataState<Loan>>
fun createLoansAccount(loansPayload: LoansPayload?): Flow<DataState<HttpResponse>>

fun createGroupLoansAccount(loansPayload: GroupLoanPayload?): Flow<DataState<Loan>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ package com.mifos.core.data.repository
import com.mifos.core.common.utils.DataState
import com.mifos.core.model.objects.organisations.LoanProducts
import com.mifos.core.network.model.LoansPayload
import com.mifos.room.entities.accounts.loans.Loan
import com.mifos.room.entities.templates.loans.LoanTemplate
import io.ktor.client.statement.HttpResponse
import kotlinx.coroutines.flow.Flow

/**
Expand All @@ -25,5 +25,5 @@ interface LoanAccountRepository {

fun getLoansAccountTemplate(clientId: Int, productId: Int): Flow<DataState<LoanTemplate>>

fun createLoansAccount(loansPayload: LoansPayload): Flow<DataState<Loan>>
fun createLoansAccount(loansPayload: LoansPayload): Flow<DataState<HttpResponse>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import com.mifos.core.network.datamanager.DataManagerLoan
import com.mifos.core.network.model.LoansPayload
import com.mifos.room.entities.accounts.loans.Loan
import com.mifos.room.entities.client.ClientPayloadEntity
import io.ktor.client.statement.HttpResponse
import kotlinx.coroutines.flow.Flow

/**
Expand All @@ -30,7 +31,7 @@ class DataTableListRepositoryImp(
private val dataManagerClient: DataManagerClient,
) : DataTableListRepository {

override fun createLoansAccount(loansPayload: LoansPayload?): Flow<DataState<Loan>> {
override fun createLoansAccount(loansPayload: LoansPayload?): Flow<DataState<HttpResponse>> {
return dataManagerLoan.createLoansAccount(loansPayload)
.asDataStateFlow()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import com.mifos.core.data.repository.LoanAccountRepository
import com.mifos.core.model.objects.organisations.LoanProducts
import com.mifos.core.network.datamanager.DataManagerLoan
import com.mifos.core.network.model.LoansPayload
import com.mifos.room.entities.accounts.loans.Loan
import com.mifos.room.entities.templates.loans.LoanTemplate
import io.ktor.client.statement.HttpResponse
import kotlinx.coroutines.flow.Flow

/**
Expand All @@ -38,7 +38,7 @@ class LoanAccountRepositoryImp(
.asDataStateFlow()
}

override fun createLoansAccount(loansPayload: LoansPayload): Flow<DataState<Loan>> {
override fun createLoansAccount(loansPayload: LoansPayload): Flow<DataState<HttpResponse>> {
return dataManagerLoan.createLoansAccount(loansPayload)
.asDataStateFlow()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.mifos.core.designsystem.theme.MifosTheme
import core.designsystem.generated.resources.Res
Expand All @@ -39,6 +40,7 @@ import org.jetbrains.compose.ui.tooling.preview.Preview
@Composable
fun MifosSweetError(
message: String,
isShowLoadMsg: Boolean = true,
modifier: Modifier = Modifier
.fillMaxSize()
.padding(18.dp)
Expand All @@ -52,14 +54,16 @@ fun MifosSweetError(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
Text(
text = stringResource(Res.string.core_designsystem_unable_to_load),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.secondary,
)
if (isShowLoadMsg) {
Text(
text = stringResource(Res.string.core_designsystem_unable_to_load),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.secondary,
)
}
Text(
text = message,
style = MaterialTheme.typography.bodyMedium,
style = MaterialTheme.typography.bodyMedium.copy(textAlign = TextAlign.Center),
color = MaterialTheme.colorScheme.secondary,
)
if (isRetryEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ package com.mifos.core.domain.useCases
import com.mifos.core.common.utils.DataState
import com.mifos.core.data.repository.LoanAccountRepository
import com.mifos.core.network.model.LoansPayload
import com.mifos.room.entities.accounts.loans.Loan
import io.ktor.client.statement.HttpResponse
import kotlinx.coroutines.flow.Flow

class CreateLoanAccountUseCase(
private val loanAccountRepository: LoanAccountRepository,
) {

operator fun invoke(loansPayload: LoansPayload): Flow<DataState<Loan>> =
operator fun invoke(loansPayload: LoansPayload): Flow<DataState<HttpResponse>> =
loanAccountRepository.createLoansAccount(loansPayload)
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import com.mifos.core.network.BaseApiManager
import com.mifos.core.network.GenericResponse
import com.mifos.core.network.model.LoansPayload
import com.mifos.room.entities.PaymentTypeOptionEntity
import com.mifos.room.entities.accounts.loans.Loan
import com.mifos.room.entities.accounts.loans.LoanRepaymentRequestEntity
import com.mifos.room.entities.accounts.loans.LoanRepaymentResponseEntity
import com.mifos.room.entities.accounts.loans.LoanWithAssociationsEntity
import com.mifos.room.entities.templates.loans.LoanRepaymentTemplateEntity
import com.mifos.room.entities.templates.loans.LoanTemplate
import com.mifos.room.entities.templates.loans.LoanTransactionTemplate
import com.mifos.room.helper.LoanDaoHelper
import io.ktor.client.statement.HttpResponse
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
Expand Down Expand Up @@ -90,7 +90,7 @@ class DataManagerLoan(
return mBaseApiManager.loanService.getLoansAccountTemplate(clientId, productId)
}

fun createLoansAccount(loansPayload: LoansPayload?): Flow<Loan> {
fun createLoansAccount(loansPayload: LoansPayload?): Flow<HttpResponse> {
return mBaseApiManager.loanService.createLoansAccount(loansPayload)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ data class LoansPayload(
var fundId: Int? = null,
var linkAccountId: Int? = null,
var dataTables: ArrayList<DataTablePayload>? = null,
var externalId: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import de.jensklingenberg.ktorfit.http.GET
import de.jensklingenberg.ktorfit.http.POST
import de.jensklingenberg.ktorfit.http.Path
import de.jensklingenberg.ktorfit.http.Query
import io.ktor.client.statement.HttpResponse
import kotlinx.coroutines.flow.Flow

/**
Expand Down Expand Up @@ -75,7 +76,7 @@ interface LoanService {
fun getAllLoans(): Flow<List<LoanProducts>>

@POST(APIEndPoint.CREATE_LOANS_ACCOUNTS)
fun createLoansAccount(@Body loansPayload: LoansPayload?): Flow<Loan>
fun createLoansAccount(@Body loansPayload: LoansPayload?): Flow<HttpResponse>

@GET(APIEndPoint.CREATE_LOANS_ACCOUNTS + "/template?templateType=individual")
fun getLoansAccountTemplate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ package com.mifos.core.ui.components

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
Expand Down Expand Up @@ -66,22 +65,23 @@ fun MifosStepper(
),
horizontalAlignment = Alignment.CenterHorizontally,
) {
LazyRow(
state = listState,
Box(
modifier = Modifier
.clip(shape = DesignToken.shapes.medium)
.background(MaterialTheme.colorScheme.primary)
.padding(vertical = DesignToken.padding.largeIncreasedExtra)
.padding(start = DesignToken.padding.small)
.padding(
vertical = DesignToken.padding.largeIncreasedExtra,
)
.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
contentAlignment = Alignment.Center,
) {
steps.forEachIndexed { index, step ->
repeat(2) { it ->
item {
Row(
verticalAlignment = Alignment.Top,
) {
LazyRow(
state = listState,
contentPadding = PaddingValues(horizontal = DesignToken.padding.small),
) {
steps.forEachIndexed { index, step ->
repeat(2) { it ->
item {
if (it == 0) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
Expand All @@ -107,7 +107,6 @@ fun MifosStepper(
color = MaterialTheme.colorScheme.primary,
)
}

Spacer(modifier = Modifier.height(DesignToken.padding.small))
BasicText(
text = step.name,
Expand All @@ -120,16 +119,14 @@ fun MifosStepper(
),
)
}
} else {
if (index != steps.lastIndex) {
Box(
modifier = Modifier
.padding(vertical = DesignToken.padding.large)
.width(DesignToken.padding.small)
.height(1.dp)
.background(AppColors.stepperColor),
)
}
} else if (index != steps.lastIndex) {
Box(
modifier = Modifier
.padding(vertical = DesignToken.padding.large)
.width(DesignToken.padding.small)
.height(1.dp)
.background(AppColors.stepperColor),
)
}
}
}
Expand All @@ -154,7 +151,7 @@ private fun MifosStepperDemo() {

MifosStepper(
steps = steps,
currentIndex = 2,
currentIndex = 0,
onStepChange = { },
modifier = Modifier
.fillMaxWidth(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ object TextFieldsValidator {

fun doubleNumberValidator(input: String): StringResource? {
return when {
input.isBlank() -> Res.string.error_field_empty
input.count { it == '.' } > 1 -> Res.string.error_invalid_number
input.any { !it.isDigit() && it != '.' } -> Res.string.error_digits_only
input.toDoubleOrNull() == null -> Res.string.error_invalid_number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@
<string name="client_apply_new_applications_apply_share_account">Apply for new share account</string>
<string name="client_apply_new_applications_apply_recurring_account">Apply for new recurring deposit account</string>
<string name="client_apply_new_applications_apply_fixed_account">Apply for new fixed deposit account</string>
<string name="client_apply_new_applications_client_inactive_msg">This client account is currently inactive. Activation is required before a new account can be created.</string>

<string name="step_details">Details</string>
<string name="step_terms">Terms</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import kotlinx.serialization.Serializable

@Serializable
data class ClientApplyNewApplicationRoute(
val clientId: Int = -1,
val clientId: Int,
val status: String,
)

fun NavGraphBuilder.clientApplyNewApplicationRoute(
Expand All @@ -41,6 +42,6 @@ fun NavGraphBuilder.clientApplyNewApplicationRoute(
}
}

fun NavController.navigateToClientApplyNewApplicationScreen(clientId: Int) {
this.navigate(ClientApplyNewApplicationRoute(clientId))
fun NavController.navigateToClientApplyNewApplicationScreen(clientId: Int, status: String) {
this.navigate(ClientApplyNewApplicationRoute(clientId, status))
}
Loading