ads screen added
This commit is contained in:
parent
72ecfbe4e7
commit
57dcd13c34
@ -73,6 +73,9 @@ dependencies {
|
|||||||
implementation(libs.androidx.compose.material.icons.extended)
|
implementation(libs.androidx.compose.material.icons.extended)
|
||||||
// splash screen
|
// splash screen
|
||||||
implementation(libs.androidx.core.splashscreen)
|
implementation(libs.androidx.core.splashscreen)
|
||||||
|
//image lib
|
||||||
|
implementation("io.coil-kt.coil3:coil-compose:3.4.0")
|
||||||
|
implementation("io.coil-kt.coil3:coil-network-okhttp:3.4.0")
|
||||||
// local libs
|
// local libs
|
||||||
implementation(project(":baselib"))
|
implementation(project(":baselib"))
|
||||||
implementation(project(":mpulib"))
|
implementation(project(":mpulib"))
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.mob.utsmyanmar
|
|||||||
|
|
||||||
import com.mob.utsmyanmar.utils.AppContextHolder
|
import com.mob.utsmyanmar.utils.AppContextHolder
|
||||||
import com.utsmyanmar.baselib.BaseApplication
|
import com.utsmyanmar.baselib.BaseApplication
|
||||||
|
import com.utsmyanmar.paylibs.network.ISOSocket
|
||||||
import dagger.hilt.android.HiltAndroidApp
|
import dagger.hilt.android.HiltAndroidApp
|
||||||
|
|
||||||
@HiltAndroidApp
|
@HiltAndroidApp
|
||||||
@ -11,6 +12,7 @@ class MyApplication : BaseApplication() {
|
|||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
AppContextHolder.init(this)
|
AppContextHolder.init(this)
|
||||||
|
ISOSocket.getInstance().initContext(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,419 +1,554 @@
|
|||||||
package com.mob.utsmyanmar.ui.dashboard
|
package com.mob.utsmyanmar.ui.dashboard
|
||||||
|
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
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.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.pager.HorizontalPager
|
||||||
|
import androidx.compose.foundation.pager.rememberPagerState
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.*
|
import androidx.compose.material.icons.filled.BarChart
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material.icons.filled.Check
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.material.icons.filled.ChevronRight
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.material.icons.filled.Dashboard
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.material.icons.filled.GridView
|
||||||
|
import androidx.compose.material.icons.filled.History
|
||||||
|
import androidx.compose.material.icons.filled.Link
|
||||||
|
import androidx.compose.material.icons.filled.Menu
|
||||||
|
import androidx.compose.material.icons.filled.PointOfSale
|
||||||
|
import androidx.compose.material.icons.filled.QrCode
|
||||||
|
import androidx.compose.material.icons.filled.Sync
|
||||||
|
import androidx.compose.material.icons.filled.Wallet
|
||||||
|
import androidx.compose.material3.Card
|
||||||
|
import androidx.compose.material3.CardDefaults
|
||||||
|
import androidx.compose.material3.HorizontalDivider
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.AlertDialog
|
||||||
|
import androidx.compose.material3.ModalDrawerSheet
|
||||||
|
import androidx.compose.material3.ModalNavigationDrawer
|
||||||
|
import androidx.compose.material3.NavigationDrawerItem
|
||||||
|
import androidx.compose.material3.NavigationDrawerItemDefaults
|
||||||
|
import androidx.compose.material3.Scaffold
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TextButton
|
||||||
|
import androidx.compose.material3.VerticalDivider
|
||||||
|
import androidx.compose.material3.rememberDrawerState
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
|
import androidx.compose.ui.layout.ContentScale
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
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 coil3.compose.AsyncImage
|
||||||
import com.mob.utsmyanmar.ui.components.appbar.AppBar
|
import com.mob.utsmyanmar.ui.components.appbar.AppBar
|
||||||
import com.mob.utsmyanmar.ui.preview.P2Preview
|
import com.mob.utsmyanmar.ui.preview.P2Preview
|
||||||
import com.mob.utsmyanmar.ui.theme.Color
|
import com.mob.utsmyanmar.ui.theme.Color
|
||||||
|
import com.utsmyanmar.paylibs.sign_on.EchoTestProcess
|
||||||
|
import com.utsmyanmar.paylibs.sign_on.SignOnListener
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun DashboardScreen2(
|
fun DashboardScreen2(
|
||||||
onNavigateAmount: (String) -> Unit = {},
|
onNavigateAmount: (String) -> Unit = {},
|
||||||
onNavigateSignOn: () -> Unit = {}
|
onNavigateSignOn: () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
Scaffold(
|
val drawerState = rememberDrawerState(initialValue = androidx.compose.material3.DrawerValue.Closed)
|
||||||
containerColor = Color.IvoryBeige,
|
val scope = rememberCoroutineScope()
|
||||||
topBar = {
|
val mainHandler = remember { Handler(Looper.getMainLooper()) }
|
||||||
AppBar(title = "Dashboard")
|
var showHostActionDialog by remember { mutableStateOf(false) }
|
||||||
}
|
var activeHostAction by remember { mutableStateOf("Log-On") }
|
||||||
) { paddingValues ->
|
var isHostActionRunning by remember { mutableStateOf(false) }
|
||||||
Column(
|
var dialogMessage by remember { mutableStateOf("") }
|
||||||
modifier = Modifier
|
|
||||||
.padding(paddingValues)
|
|
||||||
.fillMaxSize()
|
|
||||||
.padding(horizontal = 16.dp)
|
|
||||||
) {
|
|
||||||
Spacer(modifier = Modifier.height(0.dp))
|
|
||||||
AdvertisingArea()
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
|
||||||
SummaryCard()
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
|
||||||
MenuGrid(
|
|
||||||
onNavigateAmount = onNavigateAmount,
|
|
||||||
onNavigateSignOn = onNavigateSignOn
|
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.height(18.dp))
|
|
||||||
// RecentTransactionHeader()
|
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
|
||||||
// RecentTransactionList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
fun confirmationMessage(action: String) = "Do you want to start ${action.lowercase()}?"
|
||||||
private fun AdvertisingArea() {
|
fun processingMessage(action: String) = "Sending ${action.lowercase()} request to host..."
|
||||||
Card(
|
fun successMessage(action: String) = "$action success."
|
||||||
modifier = Modifier.fillMaxWidth(),
|
fun failureMessage(action: String, resultCode: Int?) = "$action failed. Response code: ${resultCode ?: -1}"
|
||||||
shape = RoundedCornerShape(0.dp),
|
fun networkFailureMessage(action: String) = "Network error during $action."
|
||||||
colors = CardDefaults.cardColors(containerColor = Color.White),
|
fun openHostActionDialog(action: String) {
|
||||||
) {
|
activeHostAction = action
|
||||||
Row(
|
isHostActionRunning = false
|
||||||
modifier = Modifier.height(170.dp) ) {
|
dialogMessage = confirmationMessage(action)
|
||||||
|
showHostActionDialog = true
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (showHostActionDialog) {
|
||||||
@Composable
|
AlertDialog(
|
||||||
private fun SummaryCard() {
|
onDismissRequest = {
|
||||||
Card(
|
if (!isHostActionRunning) {
|
||||||
modifier = Modifier.fillMaxWidth(),
|
showHostActionDialog = false
|
||||||
shape = RoundedCornerShape(16.dp),
|
}
|
||||||
colors = CardDefaults.cardColors(containerColor = Color.White),
|
},
|
||||||
elevation = CardDefaults.cardElevation(4.dp)
|
title = {
|
||||||
) {
|
Text(
|
||||||
Row(
|
text = activeHostAction,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
color = Color.LegacyRed,
|
||||||
) {
|
fontWeight = FontWeight.Bold
|
||||||
Column(
|
|
||||||
modifier = Modifier.weight(1f)
|
|
||||||
) {
|
|
||||||
SummaryItem(
|
|
||||||
title = "Sales Today",
|
|
||||||
value = "MMK 2,000,000",
|
|
||||||
subtitle = "47 Transactions",
|
|
||||||
icon = Icons.Default.BarChart,
|
|
||||||
iconBg = Color.CrimsonRed
|
|
||||||
)
|
)
|
||||||
|
},
|
||||||
HorizontalDivider(color = Color.Gray, modifier = Modifier.padding(vertical = 6.dp, horizontal = 6.dp))
|
text = {
|
||||||
|
Text(text = dialogMessage)
|
||||||
|
},
|
||||||
|
confirmButton = {
|
||||||
|
TextButton(
|
||||||
|
onClick = {
|
||||||
|
if (isHostActionRunning) return@TextButton
|
||||||
|
|
||||||
SummaryItem(
|
if (dialogMessage != confirmationMessage(activeHostAction)) {
|
||||||
title = "Settlement",
|
showHostActionDialog = false
|
||||||
value = "Completed",
|
dialogMessage = confirmationMessage(activeHostAction)
|
||||||
subtitle = "Today 11:00 PM",
|
return@TextButton
|
||||||
icon = Icons.Default.Check,
|
}
|
||||||
iconBg = Color.CrimsonRed
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
VerticalDivider(color = Color.Gray, modifier = Modifier.height(160.dp))
|
|
||||||
|
|
||||||
Column(
|
isHostActionRunning = true
|
||||||
modifier = Modifier
|
dialogMessage = processingMessage(activeHostAction)
|
||||||
.weight(0.75f)
|
|
||||||
.padding(start = 18.dp),
|
val signOnProcess = EchoTestProcess.getInstance()
|
||||||
horizontalAlignment = Alignment.Start
|
val request = if (activeHostAction == "Log-Off") {
|
||||||
) {
|
signOnProcess.enqueueLogOff()
|
||||||
Row(
|
} else {
|
||||||
verticalAlignment = Alignment.Bottom
|
signOnProcess.enqueueLogOn()
|
||||||
|
}
|
||||||
|
|
||||||
|
request
|
||||||
|
.startSignOn(object : SignOnListener {
|
||||||
|
override fun onSuccessSignOn() {
|
||||||
|
mainHandler.post {
|
||||||
|
isHostActionRunning = false
|
||||||
|
dialogMessage = successMessage(activeHostAction)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailureSignOn(resultCode: Int?) {
|
||||||
|
mainHandler.post {
|
||||||
|
isHostActionRunning = false
|
||||||
|
mainHandler.post {
|
||||||
|
isHostActionRunning = false
|
||||||
|
dialogMessage = failureMessage(activeHostAction, resultCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun onNetworkFailSignOn(message: String?) {
|
||||||
|
mainHandler.post {
|
||||||
|
isHostActionRunning = false
|
||||||
|
dialogMessage = message?.takeIf { it.isNotBlank() }
|
||||||
|
?: networkFailureMessage(activeHostAction)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = "Last Sync",
|
text = when {
|
||||||
fontSize = 12.sp,
|
isHostActionRunning -> "Processing"
|
||||||
)
|
dialogMessage == confirmationMessage(activeHostAction) -> "Start"
|
||||||
// IconCircle(Icons.Default.Sync, Color.CrimsonRed)
|
else -> "Close"
|
||||||
|
},
|
||||||
|
color = Color.LegacyRed
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
Spacer(Modifier.height(6.dp))
|
dismissButton = {
|
||||||
|
if (!isHostActionRunning) {
|
||||||
|
TextButton(
|
||||||
|
onClick = {
|
||||||
|
showHostActionDialog = false
|
||||||
|
dialogMessage = confirmationMessage(activeHostAction)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Text(text = "Cancel", color = Color.Gray)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
containerColor = Color.White
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
ModalNavigationDrawer(
|
||||||
|
drawerState = drawerState,
|
||||||
|
drawerContent = {
|
||||||
|
ModalDrawerSheet(
|
||||||
|
modifier = Modifier.fillMaxWidth(0.78f),
|
||||||
|
drawerContainerColor = Color.White,
|
||||||
|
drawerShape = RoundedCornerShape(topEnd = 24.dp, bottomEnd = 24.dp)
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.background(Color.LegacyRed)
|
||||||
|
.padding(horizontal = 20.dp, vertical = 28.dp)
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = "MOBPOS",
|
||||||
|
color = Color.White,
|
||||||
|
fontSize = 22.sp,
|
||||||
|
fontWeight = FontWeight.Bold
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(6.dp))
|
||||||
|
Text(
|
||||||
|
text = "Quick navigation",
|
||||||
|
color = Color.White.copy(alpha = 0.85f),
|
||||||
|
fontSize = 13.sp
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
|
|
||||||
|
DrawerItem("Log-On", Icons.Default.Dashboard) {
|
||||||
|
scope.launch { drawerState.close() }
|
||||||
|
openHostActionDialog("Log-On")
|
||||||
|
}
|
||||||
|
DrawerItem("Log-Off", Icons.Default.Dashboard) {
|
||||||
|
scope.launch { drawerState.close() }
|
||||||
|
openHostActionDialog("Log-Off")
|
||||||
|
}
|
||||||
|
DrawerItem("Sale", Icons.Default.PointOfSale) {
|
||||||
|
scope.launch { drawerState.close() }
|
||||||
|
onNavigateAmount("Sale")
|
||||||
|
}
|
||||||
|
DrawerItem("Sign On", Icons.Default.Link) {
|
||||||
|
scope.launch { drawerState.close() }
|
||||||
|
onNavigateSignOn()
|
||||||
|
}
|
||||||
|
DrawerItem("Settlement", Icons.Default.Wallet) {
|
||||||
|
scope.launch { drawerState.close() }
|
||||||
|
}
|
||||||
|
DrawerItem("History", Icons.Default.History) {
|
||||||
|
scope.launch { drawerState.close() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Scaffold(
|
||||||
|
containerColor = Color.IvoryBeige,
|
||||||
|
topBar = {
|
||||||
|
AppBar(
|
||||||
|
title = "Dashboard",
|
||||||
|
icon = Icons.Default.Menu,
|
||||||
|
onIconClick = { scope.launch { drawerState.open() } }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
) { paddingValues ->
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.padding(paddingValues)
|
||||||
|
.fillMaxSize()
|
||||||
|
// .padding(horizontal = 16.dp)
|
||||||
|
) {
|
||||||
|
AdvertisingArea()
|
||||||
|
SummaryCard()
|
||||||
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
MenuGrid(
|
||||||
|
onNavigateAmount = onNavigateAmount,
|
||||||
|
onNavigateSignOn = onNavigateSignOn
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun DrawerItem(
|
||||||
|
title: String,
|
||||||
|
icon: ImageVector,
|
||||||
|
onClick: () -> Unit
|
||||||
|
) {
|
||||||
|
NavigationDrawerItem(
|
||||||
|
label = {
|
||||||
Text(
|
Text(
|
||||||
text = "5 mins ago",
|
text = title,
|
||||||
fontSize = 18.sp,
|
fontWeight = FontWeight.Medium
|
||||||
color = Color.LegacyRed,
|
)
|
||||||
fontWeight = FontWeight.SemiBold
|
},
|
||||||
|
selected = false,
|
||||||
|
onClick = onClick,
|
||||||
|
icon = {
|
||||||
|
Icon(
|
||||||
|
imageVector = icon,
|
||||||
|
contentDescription = title
|
||||||
|
)
|
||||||
|
},
|
||||||
|
modifier = Modifier.padding(horizontal = 12.dp, vertical = 2.dp),
|
||||||
|
colors = NavigationDrawerItemDefaults.colors(
|
||||||
|
unselectedContainerColor = androidx.compose.ui.graphics.Color.Transparent,
|
||||||
|
unselectedIconColor = Color.LegacyRed,
|
||||||
|
unselectedTextColor = Color.Black
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun AdvertisingArea() {
|
||||||
|
|
||||||
|
val imageArray = listOf(
|
||||||
|
"https://i.ytimg.com/vi/eRUVxGRp1Ms/maxresdefault.jpg",
|
||||||
|
"https://sunmi.ua/wp-content/themes/yootheme/cache/04/p6-3-en-04a68bb5.jpeg",
|
||||||
|
"https://mma.prnewswire.com/media/2080956/SUNMI_3rd_generation_products_T3_PRO_series_V3_MIX.jpg?p=facebook"
|
||||||
|
);
|
||||||
|
val pageState = rememberPagerState(pageCount = {imageArray.size})
|
||||||
|
|
||||||
|
LaunchedEffect(pageState) {
|
||||||
|
while (true){
|
||||||
|
delay(10000)
|
||||||
|
val nextPage = (pageState.currentPage + 1) % imageArray.size;
|
||||||
|
|
||||||
|
pageState.animateScrollToPage(
|
||||||
|
page = nextPage,
|
||||||
|
animationSpec = tween(durationMillis = 700)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Card(
|
||||||
|
modifier = Modifier.fillMaxWidth().height(170.dp),
|
||||||
|
shape = RoundedCornerShape(0.dp),
|
||||||
|
colors = CardDefaults.cardColors(containerColor = Color.White),
|
||||||
|
) {
|
||||||
|
HorizontalPager(
|
||||||
|
state = pageState,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
) { page ->
|
||||||
|
AsyncImage(
|
||||||
|
model = imageArray[page],
|
||||||
|
contentDescription = "ads images",
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
contentScale = ContentScale.Crop
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Composable
|
||||||
@Composable
|
private fun SummaryCard() {
|
||||||
private fun SummaryItem(
|
Card(
|
||||||
title: String,
|
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp),
|
||||||
value: String,
|
shape = RoundedCornerShape(16.dp),
|
||||||
subtitle: String,
|
colors = CardDefaults.cardColors(containerColor = Color.White),
|
||||||
icon: ImageVector,
|
elevation = CardDefaults.cardElevation(4.dp)
|
||||||
iconBg: androidx.compose.ui.graphics.Color
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
verticalAlignment = Alignment.Top,
|
|
||||||
modifier = Modifier.padding(6.dp)
|
|
||||||
) {
|
|
||||||
Column(
|
|
||||||
modifier = Modifier.weight(1f),
|
|
||||||
) {
|
) {
|
||||||
Text(title, fontSize = 12.sp)
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
Text(
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
value,
|
SummaryItem(
|
||||||
fontSize = 14.sp,
|
title = "Sales Today",
|
||||||
color = Color.LegacyRed,
|
value = "MMK 2,000,000",
|
||||||
fontWeight = FontWeight.Bold
|
subtitle = "47 Transactions",
|
||||||
)
|
icon = Icons.Default.BarChart,
|
||||||
Text(subtitle, fontSize = 12.sp)
|
iconBg = Color.CrimsonRed
|
||||||
}
|
)
|
||||||
// IconCircle(icon, iconBg)
|
|
||||||
}
|
HorizontalDivider(
|
||||||
}
|
color = Color.Gray,
|
||||||
|
modifier = Modifier.padding(vertical = 6.dp, horizontal = 6.dp)
|
||||||
@Composable
|
)
|
||||||
private fun MenuGrid(
|
|
||||||
onNavigateAmount: (String) -> Unit,
|
SummaryItem(
|
||||||
onNavigateSignOn: () -> Unit
|
title = "Settlement",
|
||||||
) {
|
value = "Completed",
|
||||||
Column(
|
subtitle = "Today 11:00 PM",
|
||||||
verticalArrangement = Arrangement.spacedBy(10.dp)
|
icon = Icons.Default.Check,
|
||||||
) {
|
iconBg = Color.CrimsonRed
|
||||||
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
)
|
||||||
MenuCard(
|
|
||||||
title = "Sale",
|
|
||||||
icon = Icons.Default.PointOfSale,
|
|
||||||
modifier = Modifier.weight(1f),
|
|
||||||
onClick = { onNavigateAmount("Sale") }
|
|
||||||
)
|
|
||||||
MenuCard("MMQR", Icons.Default.QrCode, Modifier.weight(1f))
|
|
||||||
MenuCard("History", Icons.Default.History, Modifier.weight(1f))
|
|
||||||
}
|
|
||||||
|
|
||||||
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
|
||||||
MenuCard(
|
|
||||||
"Sign On",
|
|
||||||
Icons.Default.Link,
|
|
||||||
Modifier.weight(1f),
|
|
||||||
onClick = onNavigateSignOn
|
|
||||||
)
|
|
||||||
MenuCard("Settlement", Icons.Default.Wallet, Modifier.weight(1f))
|
|
||||||
MenuCard("See More", Icons.Default.GridView, Modifier.weight(1f))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun MenuCard(
|
|
||||||
title: String,
|
|
||||||
icon: ImageVector,
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
onClick: (() -> Unit)? = null
|
|
||||||
) {
|
|
||||||
Card(
|
|
||||||
modifier = modifier
|
|
||||||
.height(100.dp)
|
|
||||||
.then(
|
|
||||||
if (onClick != null) {
|
|
||||||
Modifier.clickable(onClick = onClick)
|
|
||||||
} else {
|
|
||||||
Modifier
|
|
||||||
}
|
}
|
||||||
),
|
|
||||||
shape = RoundedCornerShape(14.dp),
|
VerticalDivider(color = Color.Gray, modifier = Modifier.height(160.dp))
|
||||||
colors = CardDefaults.cardColors(containerColor = Color.White),
|
|
||||||
elevation = CardDefaults.cardElevation(5.dp)
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(0.75f)
|
||||||
|
.padding(start = 18.dp),
|
||||||
|
horizontalAlignment = Alignment.Start
|
||||||
|
) {
|
||||||
|
Row(verticalAlignment = Alignment.Bottom) {
|
||||||
|
Text(
|
||||||
|
text = "Last Sync",
|
||||||
|
fontSize = 12.sp
|
||||||
|
)
|
||||||
|
IconCircle(Icons.Default.Sync, Color.CrimsonRed)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(Modifier.height(6.dp))
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = "5 mins ago",
|
||||||
|
fontSize = 18.sp,
|
||||||
|
color = Color.LegacyRed,
|
||||||
|
fontWeight = FontWeight.SemiBold
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun SummaryItem(
|
||||||
|
title: String,
|
||||||
|
value: String,
|
||||||
|
subtitle: String,
|
||||||
|
icon: ImageVector,
|
||||||
|
iconBg: androidx.compose.ui.graphics.Color
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
verticalAlignment = Alignment.Top,
|
||||||
|
modifier = Modifier.padding(6.dp)
|
||||||
|
) {
|
||||||
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
|
Text(title, fontSize = 12.sp)
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
color = Color.LegacyRed,
|
||||||
|
fontWeight = FontWeight.Bold
|
||||||
|
)
|
||||||
|
Text(subtitle, fontSize = 12.sp)
|
||||||
|
}
|
||||||
|
IconCircle(icon, iconBg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun IconCircle(
|
||||||
|
icon: ImageVector,
|
||||||
|
color: androidx.compose.ui.graphics.Color
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.size(38.dp)
|
||||||
.padding(6.dp)
|
.clip(CircleShape)
|
||||||
|
.background(color.copy(alpha = 0.1f)),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Column {
|
Icon(
|
||||||
Icon(
|
imageVector = icon,
|
||||||
imageVector = icon,
|
contentDescription = null,
|
||||||
contentDescription = title,
|
tint = color,
|
||||||
tint = Color.LegacyRed,
|
modifier = Modifier.size(22.dp)
|
||||||
modifier = Modifier.size(50.dp)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
|
||||||
|
|
||||||
Row(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
verticalAlignment = Alignment.CenterVertically
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = title,
|
|
||||||
fontSize = 12.sp,
|
|
||||||
color = Color.Black,
|
|
||||||
overflow = TextOverflow.Ellipsis,
|
|
||||||
maxLines = 1,
|
|
||||||
modifier = Modifier.weight(1f)
|
|
||||||
)
|
|
||||||
Icon(
|
|
||||||
imageVector = Icons.Default.ChevronRight,
|
|
||||||
contentDescription = null,
|
|
||||||
tint = Color.LegacyRed,
|
|
||||||
modifier = Modifier
|
|
||||||
.size(28.dp)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//
|
|
||||||
//@Composable
|
|
||||||
//private fun RecentTransactionHeader() {
|
|
||||||
// Row(
|
|
||||||
// modifier = Modifier.fillMaxWidth(),
|
|
||||||
// verticalAlignment = Alignment.CenterVertically
|
|
||||||
// ) {
|
|
||||||
// Text(
|
|
||||||
// text = "Recent Transactions",
|
|
||||||
// color = Color.LegacyRed,
|
|
||||||
// fontSize = 16.sp,
|
|
||||||
// fontWeight = FontWeight.SemiBold,
|
|
||||||
// modifier = Modifier.weight(1f)
|
|
||||||
// )
|
|
||||||
//
|
|
||||||
// Text(
|
|
||||||
// text = "View All",
|
|
||||||
// color = Color.LegacyRed,
|
|
||||||
// fontSize = 14.sp
|
|
||||||
// )
|
|
||||||
//
|
|
||||||
// Icon(
|
|
||||||
// imageVector = Icons.Default.ChevronRight,
|
|
||||||
// contentDescription = null,
|
|
||||||
// tint = Color.LegacyRed
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//@Composable
|
|
||||||
//private fun RecentTransactionList() {
|
|
||||||
// Card(
|
|
||||||
// modifier = Modifier.fillMaxWidth(),
|
|
||||||
// shape = RoundedCornerShape(14.dp),
|
|
||||||
// colors = CardDefaults.cardColors(containerColor = Color.White),
|
|
||||||
// elevation = CardDefaults.cardElevation(2.dp)
|
|
||||||
// ) {
|
|
||||||
// Column {
|
|
||||||
// TransactionRow(
|
|
||||||
// iconText = "VISA",
|
|
||||||
// time = "4:12 PM",
|
|
||||||
// type = "Card Payment",
|
|
||||||
// amount = "MMK 100,000",
|
|
||||||
// status = "Success",
|
|
||||||
// statusColor = Color.LegacyRed,
|
|
||||||
// statusTextColor = Color.LegacyRed
|
|
||||||
// )
|
|
||||||
//
|
|
||||||
// Divider(color = Color.LegacyRed)
|
|
||||||
//
|
|
||||||
// TransactionRow(
|
|
||||||
// iconText = "MMQR",
|
|
||||||
// time = "8:43 AM",
|
|
||||||
// type = "MMQR",
|
|
||||||
// amount = "MMK 50,000",
|
|
||||||
// status = "Success",
|
|
||||||
// statusColor = Color.LegacyRed,
|
|
||||||
// statusTextColor = Color.LegacyRed
|
|
||||||
// )
|
|
||||||
//
|
|
||||||
// Divider(color = Color.LegacyRed)
|
|
||||||
//
|
|
||||||
// TransactionRow(
|
|
||||||
// iconText = "MC",
|
|
||||||
// time = "9:10 PM",
|
|
||||||
// type = "Card Payment",
|
|
||||||
// amount = "MMK 150,000",
|
|
||||||
// status = "Failed",
|
|
||||||
// statusColor = Color.LegacyRed,
|
|
||||||
// statusTextColor = Color.LegacyRed
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//@Composable
|
|
||||||
//private fun TransactionRow(
|
|
||||||
// iconText: String,
|
|
||||||
// time: String,
|
|
||||||
// type: String,
|
|
||||||
// amount: String,
|
|
||||||
// status: String,
|
|
||||||
// statusColor: androidx.compose.ui.graphics.Color,
|
|
||||||
// statusTextColor: androidx.compose.ui.graphics.Color
|
|
||||||
//) {
|
|
||||||
// Row(
|
|
||||||
// modifier = Modifier
|
|
||||||
// .fillMaxWidth()
|
|
||||||
// .height(62.dp)
|
|
||||||
// .padding(horizontal = 14.dp),
|
|
||||||
// verticalAlignment = Alignment.CenterVertically
|
|
||||||
// ) {
|
|
||||||
// Text(
|
|
||||||
// text = iconText,
|
|
||||||
// color = Color.LegacyRed,
|
|
||||||
// fontWeight = FontWeight.Bold,
|
|
||||||
// fontSize = 20.sp,
|
|
||||||
// modifier = Modifier.width(70.dp)
|
|
||||||
// )
|
|
||||||
//
|
|
||||||
// Column(modifier = Modifier.weight(1f)) {
|
|
||||||
// Text(time, fontSize = 12.sp, color = Color.Black)
|
|
||||||
// Text(type, fontSize = 12.sp, color = Color.Gray)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Text(
|
|
||||||
// text = amount,
|
|
||||||
// fontSize = 12.sp,
|
|
||||||
// color = Color.Black,
|
|
||||||
// modifier = Modifier.width(90.dp)
|
|
||||||
// )
|
|
||||||
//
|
|
||||||
// Box(
|
|
||||||
// modifier = Modifier
|
|
||||||
// .clip(RoundedCornerShape(8.dp))
|
|
||||||
// .padding(horizontal = 10.dp, vertical = 5.dp)
|
|
||||||
// ) {
|
|
||||||
// Text(
|
|
||||||
// text = status,
|
|
||||||
// fontSize = 12.sp,
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Icon(
|
|
||||||
// imageVector = Icons.Default.ChevronRight,
|
|
||||||
// contentDescription = null,
|
|
||||||
// tint = Color.LegacyRed,
|
|
||||||
// modifier = Modifier.size(26.dp)
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//@Composable
|
|
||||||
//private fun IconCircle(
|
|
||||||
// icon: ImageVector,
|
|
||||||
// color: androidx.compose.ui.graphics.Color
|
|
||||||
//) {
|
|
||||||
// Box(
|
|
||||||
// modifier = Modifier
|
|
||||||
// .size(38.dp)
|
|
||||||
// .clip(CircleShape)
|
|
||||||
// .background(color.copy(alpha = 0.1f)),
|
|
||||||
// contentAlignment = Alignment.Center
|
|
||||||
// ) {
|
|
||||||
// Icon(
|
|
||||||
// imageVector = icon,
|
|
||||||
// contentDescription = null,
|
|
||||||
// tint = color,
|
|
||||||
// modifier = Modifier.size(22.dp)
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
@P2Preview
|
@Composable
|
||||||
@Composable
|
private fun MenuGrid(
|
||||||
fun PreviewDashboardScreen2() {
|
onNavigateAmount: (String) -> Unit,
|
||||||
DashboardScreen2()
|
onNavigateSignOn: () -> Unit
|
||||||
}
|
) {
|
||||||
|
Column(
|
||||||
|
verticalArrangement = Arrangement.spacedBy(10.dp),
|
||||||
|
modifier = Modifier.padding(horizontal = 16.dp)
|
||||||
|
) {
|
||||||
|
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||||
|
MenuCard(
|
||||||
|
title = "Sale",
|
||||||
|
icon = Icons.Default.PointOfSale,
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
onClick = { onNavigateAmount("Sale") }
|
||||||
|
)
|
||||||
|
MenuCard("MMQR", Icons.Default.QrCode, Modifier.weight(1f))
|
||||||
|
MenuCard("History", Icons.Default.History, Modifier.weight(1f))
|
||||||
|
}
|
||||||
|
|
||||||
|
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
|
||||||
|
MenuCard(
|
||||||
|
"Sign On",
|
||||||
|
Icons.Default.Link,
|
||||||
|
Modifier.weight(1f),
|
||||||
|
onClick = onNavigateSignOn
|
||||||
|
)
|
||||||
|
MenuCard("Settlement", Icons.Default.Wallet, Modifier.weight(1f))
|
||||||
|
MenuCard("See More", Icons.Default.GridView, Modifier.weight(1f))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun MenuCard(
|
||||||
|
title: String,
|
||||||
|
icon: ImageVector,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
onClick: (() -> Unit)? = null
|
||||||
|
) {
|
||||||
|
Card(
|
||||||
|
modifier = modifier
|
||||||
|
.height(100.dp)
|
||||||
|
.then(
|
||||||
|
if (onClick != null) {
|
||||||
|
Modifier.clickable(onClick = onClick)
|
||||||
|
} else {
|
||||||
|
Modifier
|
||||||
|
}
|
||||||
|
),
|
||||||
|
shape = RoundedCornerShape(14.dp),
|
||||||
|
colors = CardDefaults.cardColors(containerColor = Color.White),
|
||||||
|
elevation = CardDefaults.cardElevation(5.dp)
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(6.dp)
|
||||||
|
) {
|
||||||
|
Column {
|
||||||
|
Icon(
|
||||||
|
imageVector = icon,
|
||||||
|
contentDescription = title,
|
||||||
|
tint = Color.LegacyRed,
|
||||||
|
modifier = Modifier.size(50.dp)
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = title,
|
||||||
|
fontSize = 12.sp,
|
||||||
|
color = Color.Black,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
maxLines = 1,
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
)
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Default.ChevronRight,
|
||||||
|
contentDescription = null,
|
||||||
|
tint = Color.LegacyRed,
|
||||||
|
modifier = Modifier.size(28.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@P2Preview
|
||||||
|
@Composable
|
||||||
|
fun PreviewDashboardScreen2() {
|
||||||
|
DashboardScreen2()
|
||||||
|
}
|
||||||
|
|||||||
@ -349,6 +349,10 @@ public class ISOSocket {
|
|||||||
if (!isSwitchIp) {
|
if (!isSwitchIp) {
|
||||||
serverIP = getIp();
|
serverIP = getIp();
|
||||||
serverPort = getPort();
|
serverPort = getPort();
|
||||||
|
// serverIP = "posuat.myanmarorientalbank.com";
|
||||||
|
// serverPort = 5033;
|
||||||
|
// serverIP = "10.255.255.195";
|
||||||
|
// serverPort = 5555;
|
||||||
} else {
|
} else {
|
||||||
isSwitchIp = false;
|
isSwitchIp = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,8 +47,7 @@ public class EchoTestProcess {
|
|||||||
private EchoTestProcess() {
|
private EchoTestProcess() {
|
||||||
tradeData = Params.newTrade(true);
|
tradeData = Params.newTrade(true);
|
||||||
payDetail = tradeData.getPayDetail();
|
payDetail = tradeData.getPayDetail();
|
||||||
isoMsgX = new ISOMsgX.ISOMsgXBuilder(ISOVersion.VERSION_1993, ISOMode.BOTH_HEADER_TPDU,HostName.BPC)
|
isoMsgX = new ISOMsgX.ISOMsgXBuilder(ISOVersion.VERSION_1993, ISOMode.BOTH_HEADER_TPDU,HostName.BPC).build();
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public StartSignOn enqueue(boolean isSecondary) {
|
public StartSignOn enqueue(boolean isSecondary) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user