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.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.mob.utsmyanmar.ui.theme.Color
|
import com.mob.utsmyanmar.ui.theme.Color
|
||||||
|
import com.mob.utsmyanmar.ui.theme.MOBPOSTheme
|
||||||
import com.mob.utsmyanmar.utils.convertDateString
|
import com.mob.utsmyanmar.utils.convertDateString
|
||||||
import com.utsmyanmar.paylibs.model.PayDetail
|
import com.utsmyanmar.paylibs.model.PayDetail
|
||||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
|
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
|
||||||
@ -47,13 +49,32 @@ internal fun HistoryTransactionCard(
|
|||||||
colors = CardDefaults.cardColors(containerColor = Color.White)
|
colors = CardDefaults.cardColors(containerColor = Color.White)
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.padding(16.dp)) {
|
Column(modifier = Modifier.padding(16.dp)) {
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = displayTransactionTitle(payDetail),
|
||||||
|
color = Color.LegacyRed,
|
||||||
|
style = MaterialTheme.typography.titleSmall
|
||||||
|
)
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
horizontalArrangement = Arrangement.SpaceBetween
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = displayTransactionTitle(payDetail),
|
text = "Date & Time",
|
||||||
color = Color.LegacyRed,
|
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
|
style = MaterialTheme.typography.titleSmall
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
@ -62,13 +83,47 @@ internal fun HistoryTransactionCard(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.height(4.dp))
|
Spacer(modifier = Modifier.height(4.dp))
|
||||||
Text("Trace ${payDetail.voucherNo.ifBlank { "-" }}", style = MaterialTheme.typography.bodySmall)
|
Row(
|
||||||
Text("RRN ${payDetail.referNo.ifBlank { "-" }}", style = MaterialTheme.typography.bodySmall, color = Color.Gray)
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
) {
|
||||||
Text(
|
Text(
|
||||||
"${convertDateString(payDetail.transDate)} ${payDetail.transTime}",
|
text = "Trace No",
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.titleSmall
|
||||||
color = Color.Gray
|
|
||||||
)
|
)
|
||||||
|
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.Modifier
|
||||||
import androidx.compose.ui.draw.shadow
|
import androidx.compose.ui.draw.shadow
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
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.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.mob.utsmyanmar.ui.components.NumericKeypad
|
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.Color
|
||||||
import com.mob.utsmyanmar.ui.theme.MOBPOSTheme
|
import com.mob.utsmyanmar.ui.theme.MOBPOSTheme
|
||||||
import com.utsmyanmar.paylibs.model.PayDetail
|
import com.utsmyanmar.paylibs.model.PayDetail
|
||||||
@ -57,7 +55,6 @@ private val searchKeys = listOf(
|
|||||||
listOf("C", "0", "\u232B")
|
listOf("C", "0", "\u232B")
|
||||||
)
|
)
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ReprintAnyTransactionScreen(
|
fun ReprintAnyTransactionScreen(
|
||||||
viewModel: HistoryViewModel,
|
viewModel: HistoryViewModel,
|
||||||
@ -66,6 +63,22 @@ fun ReprintAnyTransactionScreen(
|
|||||||
onReprintTransaction: (PayDetail) -> Unit,
|
onReprintTransaction: (PayDetail) -> Unit,
|
||||||
) {
|
) {
|
||||||
val allTransactions by viewModel.getTransactionHistory().observeAsState(emptyList())
|
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 searchQuery by remember { mutableStateOf("") }
|
||||||
var isFocused by remember { mutableStateOf(false) }
|
var isFocused by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
@ -237,27 +250,44 @@ private fun SearchInputBox(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@P2Preview
|
@Preview(showBackground = true)
|
||||||
@P3Preview
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ReprintAnyTransactionScreenPreview() {
|
private fun ReprintAnyTransactionScreenPreview() {
|
||||||
MOBPOSTheme {
|
MOBPOSTheme {
|
||||||
Box(modifier = Modifier.height(600.dp)) {
|
ReprintAnyTransactionContent(
|
||||||
Card(
|
allTransactions = listOf(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
PayDetail().apply {
|
||||||
colors = CardDefaults.cardColors(containerColor = Color.White)
|
transDate = "21/09/26"
|
||||||
) {
|
transTime = "14:04:15"
|
||||||
Column(modifier = Modifier.padding(16.dp)) {
|
merchantName = "UTS Merchant"
|
||||||
Text(
|
merchantNo = "100089476209176"
|
||||||
text = "SALE",
|
terminalNo = "10420257"
|
||||||
color = Color.LegacyRed,
|
voucherNo = "000001"
|
||||||
style = MaterialTheme.typography.titleSmall
|
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 = {}
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(4.dp))
|
|
||||||
Text("Trace 000001", style = MaterialTheme.typography.bodySmall)
|
|
||||||
Text("RRN 123456789012", style = MaterialTheme.typography.bodySmall, color = Color.Gray)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user