@@ -53,12 +53,11 @@ import androidx.compose.material3.TextButton
5353import androidx.compose.material3.rememberDatePickerState
5454import androidx.compose.runtime.Composable
5555import androidx.compose.runtime.getValue
56- import androidx.compose.runtime.mutableStateOf
5756import androidx.compose.runtime.remember
58- import androidx.compose.runtime.saveable.rememberSaveable
5957import androidx.compose.runtime.setValue
6058import androidx.compose.ui.Alignment
6159import androidx.compose.ui.Modifier
60+ import androidx.compose.ui.text.input.ImeAction
6261import androidx.compose.ui.text.input.KeyboardType
6362import androidx.lifecycle.compose.collectAsStateWithLifecycle
6463import androidx.navigation.NavController
@@ -180,7 +179,6 @@ private fun LoanAccountDisbursementContent(
180179 onCancel : () -> Unit ,
181180) {
182181 val scrollState = rememberScrollState()
183- var showDatePickerDialog by rememberSaveable { mutableStateOf(false ) }
184182
185183 val currencySymbol = state.template?.currency?.displaySymbol ? : " "
186184 val availableAmountRaw = state.template?.availableDisbursementAmountWithOverApplied
@@ -202,21 +200,23 @@ private fun LoanAccountDisbursementContent(
202200 },
203201 )
204202
205- if (showDatePickerDialog) {
203+ if (state. showDatePickerDialog) {
206204 DatePickerDialog (
207- onDismissRequest = { showDatePickerDialog = false },
205+ onDismissRequest = { onAction( LoanDisbursementAction . ToggleDatePickerDialog ( false )) },
208206 confirmButton = {
209207 TextButton (
210208 onClick = {
211209 datePickerState.selectedDateMillis?.let {
212210 onAction(LoanDisbursementAction .UpdateDate (it))
213211 }
214- showDatePickerDialog = false
212+ onAction( LoanDisbursementAction . ToggleDatePickerDialog ( false ))
215213 },
216214 ) { Text (stringResource(Res .string.feature_loan_select_date)) }
217215 },
218216 dismissButton = {
219- TextButton (onClick = { showDatePickerDialog = false }) {
217+ TextButton (
218+ onClick = { onAction(LoanDisbursementAction .ToggleDatePickerDialog (false )) },
219+ ) {
220220 Text (stringResource(Res .string.feature_loan_cancel))
221221 }
222222 },
@@ -240,7 +240,7 @@ private fun LoanAccountDisbursementContent(
240240 MifosDatePickerTextField (
241241 value = DateHelper .getDateAsStringFromLong(state.disbursementDate),
242242 label = stringResource(Res .string.feature_loan_approval_disbursement_date),
243- openDatePicker = { showDatePickerDialog = true },
243+ openDatePicker = { onAction( LoanDisbursementAction . ToggleDatePickerDialog ( true )) },
244244 )
245245
246246 Spacer (modifier = Modifier .height(KptTheme .spacing.md))
@@ -329,7 +329,12 @@ private fun LoanAccountDisbursementContent(
329329 value = state.accountNumber,
330330 onValueChange = { onAction(LoanDisbursementAction .UpdateAccountNumber (it)) },
331331 label = stringResource(Res .string.feature_loan_show_account_number),
332- error = null ,
332+ config = MifosTextFieldConfig (
333+ keyboardOptions = KeyboardOptions (
334+ keyboardType = KeyboardType .Number ,
335+ imeAction = ImeAction .Next ,
336+ ),
337+ ),
333338 )
334339
335340 Spacer (modifier = Modifier .height(KptTheme .spacing.sm))
@@ -338,7 +343,12 @@ private fun LoanAccountDisbursementContent(
338343 value = state.checkNumber,
339344 onValueChange = { onAction(LoanDisbursementAction .UpdateCheckNumber (it)) },
340345 label = stringResource(Res .string.feature_loan_cheque_number),
341- error = null ,
346+ config = MifosTextFieldConfig (
347+ keyboardOptions = KeyboardOptions (
348+ keyboardType = KeyboardType .Number ,
349+ imeAction = ImeAction .Next ,
350+ ),
351+ ),
342352 )
343353
344354 Spacer (modifier = Modifier .height(KptTheme .spacing.sm))
@@ -347,7 +357,12 @@ private fun LoanAccountDisbursementContent(
347357 value = state.routingCode,
348358 onValueChange = { onAction(LoanDisbursementAction .UpdateRoutingCode (it)) },
349359 label = stringResource(Res .string.feature_loan_routing_code),
350- error = null ,
360+ config = MifosTextFieldConfig (
361+ keyboardOptions = KeyboardOptions (
362+ keyboardType = KeyboardType .Number ,
363+ imeAction = ImeAction .Next ,
364+ ),
365+ ),
351366 )
352367
353368 Spacer (modifier = Modifier .height(KptTheme .spacing.sm))
@@ -356,7 +371,12 @@ private fun LoanAccountDisbursementContent(
356371 value = state.receiptNumber,
357372 onValueChange = { onAction(LoanDisbursementAction .UpdateReceiptNumber (it)) },
358373 label = stringResource(Res .string.feature_loan_receipt_number),
359- error = null ,
374+ config = MifosTextFieldConfig (
375+ keyboardOptions = KeyboardOptions (
376+ keyboardType = KeyboardType .Number ,
377+ imeAction = ImeAction .Next ,
378+ ),
379+ ),
360380 )
361381
362382 Spacer (modifier = Modifier .height(KptTheme .spacing.sm))
@@ -365,7 +385,12 @@ private fun LoanAccountDisbursementContent(
365385 value = state.bankNumber,
366386 onValueChange = { onAction(LoanDisbursementAction .UpdateBankNumber (it)) },
367387 label = stringResource(Res .string.feature_loan_bank_number),
368- error = null ,
388+ config = MifosTextFieldConfig (
389+ keyboardOptions = KeyboardOptions (
390+ keyboardType = KeyboardType .Number ,
391+ imeAction = ImeAction .Done ,
392+ ),
393+ ),
369394 )
370395 }
371396 }
0 commit comments