MainActivity.
kt
package [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link].*
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link].*
import [Link]
import [Link]
import [Link]
import [Link]
@Composable
fun POSHomePage() {
Column(
modifier = [Link](),
verticalArrangement = [Link],
) {
TopAppBar(
title = { Text(text = "Kasir Lsp",
letterSpacing = [Link],fontSize = [Link]) },
backgroundColor = Color(0xFFD8BFD8),
contentColor = [Link]
)
Spacer(modifier = [Link]([Link]))
Spacer(modifier = [Link]([Link]))
TotalIncomeView(totalIncome = 1500000.0)
Spacer(modifier = [Link]([Link]))
val context = [Link]
val intentMasterData = Intent(context, MasterData::[Link])
val intentQr = Intent(context, Qr::[Link])
val intentTransaction = Intent(context, Transaction::[Link])
Row(
modifier = [Link](),
horizontalArrangement = [Link],
verticalAlignment = [Link]
) {
MenuIcon(
icon = painterResource(id = [Link]),
label = "Master Data",
onClick = {
[Link](intentMasterData)
}
)
MenuIcon(
icon = painterResource(id = [Link]),
label = "Transaksi",
onClick = {
[Link](intentTransaction)
}
)
MenuIcon(
icon = painterResource(id = [Link]),
label = "QR",
onClick = {
[Link](intentQr)
}
)
}
Spacer(modifier = [Link]([Link]))
Card(
modifier = Modifier
.fillMaxWidth()
.height([Link])
.padding([Link]),
shape = [Link],
elevation = [Link]
) {
Column(
modifier = Modifier
.fillMaxSize()
.padding([Link])
) {
Text(
text = "History Pesanan",
style = [Link],
modifier = Modifier
.padding(bottom = [Link])
.padding(start = [Link])
)
Row(
modifier = [Link](),
horizontalArrangement = [Link],
verticalAlignment = [Link]
) {
Text(
text = "Transaksi 1",
style = [Link],
modifier = Modifier
.padding([Link])
.padding(start = [Link])
)
Text(
text = "Rp.100.000,00",
style = [Link],
modifier = Modifier
.padding([Link])
.padding(end = [Link])
)
}
Row(
modifier = [Link](),
horizontalArrangement = [Link],
verticalAlignment = [Link]
) {
Text(
text = "Transaksi 2",
style = [Link],
modifier = Modifier
.padding([Link])
.padding(start = [Link])
)
Text(
text = "Rp.100.000,00",
style = [Link],
modifier = Modifier
.padding([Link])
.padding(end = [Link])
)
}
// TextButton(
// onClick = { /* Handle button click */ },
// modifier = Modifier
// .wrapContentSize()
// .align([Link]),
// colors = [Link]([Link])
// ) {
// Text(
// text = "Lihat Detail",
// color = [Link]// Ubah warna teks
// )
// }
}
}
}
}
@Composable
fun MenuIcon(icon: Painter, label: String, onClick: () -> Unit) {
Box(
modifier = Modifier
.size([Link])
.clickable { onClick() },
contentAlignment = [Link]
) {
Column(
horizontalAlignment = [Link]
) {
Box(
modifier = Modifier
.size([Link])
.background(color = [Link], shape =
CircleShape),
contentAlignment = [Link]
) {
Image(
painter = icon,
contentDescription = null,
modifier = [Link]([Link]),
contentScale = [Link]
)
}
Spacer(modifier = [Link]([Link]))
Text(text = label)
}
}
}
@Composable
fun TotalIncomeView(totalIncome: Double) {
// Container untuk total pendapatan
val formattedTotalIncome =
[Link](Locale("id", "ID"))
.format(totalIncome)
Box(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = [Link])
.height([Link])
.background(color = [Link], shape =
[Link]),
contentAlignment = [Link]
) {
Box(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = [Link])
.height([Link])
.background(color = [Link], shape =
[Link]),
contentAlignment = [Link]
) {
Text(
text = "Total Income: $formattedTotalIncome",
fontSize = [Link],
fontWeight = [Link]
)
}
}
}
@Composable
fun AppBar() {
@Composable
fun MenuButton(text: String) {
Button(
onClick = {
/* Action for menu item */
},
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = [Link], vertical = [Link]),
colors = [Link]([Link]),
shape = [Link],
content = {
Text(text = text)
},
)
}
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
POSHomePage()
}
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
[Link](savedInstanceState)
setContent {
POSHomePage()
}
}
}