mini preview box fixed
This commit is contained in:
parent
a2e2829649
commit
4dee4bb6f9
@ -23,8 +23,10 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.mob.utsmyanmar.ui.theme.Color
|
||||
import com.mob.utsmyanmar.ui.theme.MOBPOSTheme
|
||||
import com.mob.utsmyanmar.utils.convertDateString
|
||||
import com.utsmyanmar.paylibs.model.PayDetail
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
|
||||
@ -47,13 +49,32 @@ internal fun HistoryTransactionCard(
|
||||
colors = CardDefaults.cardColors(containerColor = Color.White)
|
||||
) {
|
||||
Column(modifier = Modifier.padding(16.dp)) {
|
||||
|
||||
Text(
|
||||
text = displayTransactionTitle(payDetail),
|
||||
color = Color.LegacyRed,
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(
|
||||
text = displayTransactionTitle(payDetail),
|
||||
color = Color.LegacyRed,
|
||||
text = "Date & Time",
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
Text(
|
||||
"${convertDateString(payDetail.transDate)} ${payDetail.transTime}",
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(
|
||||
text = "Amount",
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
Text(
|
||||
@ -62,13 +83,47 @@ internal fun HistoryTransactionCard(
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
Text("Trace ${payDetail.voucherNo.ifBlank { "-" }}", style = MaterialTheme.typography.bodySmall)
|
||||
Text("RRN ${payDetail.referNo.ifBlank { "-" }}", style = MaterialTheme.typography.bodySmall, color = Color.Gray)
|
||||
Text(
|
||||
"${convertDateString(payDetail.transDate)} ${payDetail.transTime}",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = Color.Gray
|
||||
)
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(
|
||||
text = "Trace No",
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
Text(
|
||||
text = payDetail.voucherNo.ifBlank { "-" },
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(
|
||||
text = "Reference No",
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
Text(
|
||||
text = payDetail.referNo.ifBlank { "-" },
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(
|
||||
text = "Approval Code",
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
Text(
|
||||
text = payDetail.approvalCode.ifBlank { "-" },
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -270,3 +325,21 @@ internal fun HistoryNumericKeypad(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun HistoryTransactionCardPreview() {
|
||||
MOBPOSTheme {
|
||||
HistoryTransactionCard(
|
||||
payDetail = PayDetail().apply {
|
||||
transDate = "21/09/26"
|
||||
transTime = "14:04:15"
|
||||
voucherNo = "000001"
|
||||
referNo = "123456789012"
|
||||
transType = "SALE"
|
||||
amount = 1500000L
|
||||
},
|
||||
onClick = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,12 +39,10 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.shadow
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.mob.utsmyanmar.ui.components.NumericKeypad
|
||||
import com.mob.utsmyanmar.ui.preview.P2Preview
|
||||
import com.mob.utsmyanmar.ui.preview.P3Preview
|
||||
import com.mob.utsmyanmar.ui.theme.Color
|
||||
import com.mob.utsmyanmar.ui.theme.MOBPOSTheme
|
||||
import com.utsmyanmar.paylibs.model.PayDetail
|
||||
@ -57,7 +55,6 @@ private val searchKeys = listOf(
|
||||
listOf("C", "0", "\u232B")
|
||||
)
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun ReprintAnyTransactionScreen(
|
||||
viewModel: HistoryViewModel,
|
||||
@ -66,6 +63,22 @@ fun ReprintAnyTransactionScreen(
|
||||
onReprintTransaction: (PayDetail) -> Unit,
|
||||
) {
|
||||
val allTransactions by viewModel.getTransactionHistory().observeAsState(emptyList())
|
||||
ReprintAnyTransactionContent(
|
||||
allTransactions = allTransactions,
|
||||
hostType = hostType,
|
||||
onBack = onBack,
|
||||
onReprintTransaction = onReprintTransaction
|
||||
)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun ReprintAnyTransactionContent(
|
||||
allTransactions: List<PayDetail>,
|
||||
hostType: HostType,
|
||||
onBack: () -> Unit,
|
||||
onReprintTransaction: (PayDetail) -> Unit,
|
||||
) {
|
||||
var searchQuery by remember { mutableStateOf("") }
|
||||
var isFocused by remember { mutableStateOf(false) }
|
||||
|
||||
@ -237,27 +250,44 @@ private fun SearchInputBox(
|
||||
}
|
||||
}
|
||||
|
||||
@P2Preview
|
||||
@P3Preview
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun ReprintAnyTransactionScreenPreview() {
|
||||
MOBPOSTheme {
|
||||
Box(modifier = Modifier.height(600.dp)) {
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
colors = CardDefaults.cardColors(containerColor = Color.White)
|
||||
) {
|
||||
Column(modifier = Modifier.padding(16.dp)) {
|
||||
Text(
|
||||
text = "SALE",
|
||||
color = Color.LegacyRed,
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
Text("Trace 000001", style = MaterialTheme.typography.bodySmall)
|
||||
Text("RRN 123456789012", style = MaterialTheme.typography.bodySmall, color = Color.Gray)
|
||||
ReprintAnyTransactionContent(
|
||||
allTransactions = listOf(
|
||||
PayDetail().apply {
|
||||
transDate = "21/09/26"
|
||||
transTime = "14:04:15"
|
||||
merchantName = "UTS Merchant"
|
||||
merchantNo = "100089476209176"
|
||||
terminalNo = "10420257"
|
||||
voucherNo = "000001"
|
||||
referNo = "123456789012"
|
||||
approvalCode = "123456"
|
||||
transType = "SALE"
|
||||
amount = 1500000L
|
||||
accountType = "MPU"
|
||||
cardNo = "9503036867315548"
|
||||
},
|
||||
PayDetail().apply {
|
||||
transDate = "21/09/26"
|
||||
transTime = "15:20:30"
|
||||
merchantName = "UTS Merchant"
|
||||
merchantNo = "100089476209176"
|
||||
terminalNo = "10420257"
|
||||
voucherNo = "000002"
|
||||
referNo = "123456789013"
|
||||
approvalCode = "654321"
|
||||
transType = "SALE"
|
||||
amount = 250000L
|
||||
accountType = "MPU"
|
||||
cardNo = "9503036867319999"
|
||||
}
|
||||
}
|
||||
}
|
||||
),
|
||||
hostType = HostType.MPU,
|
||||
onBack = {},
|
||||
onReprintTransaction = {}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user