terminal disable screen
This commit is contained in:
parent
13aed803ae
commit
f173c974d0
@ -39,7 +39,7 @@ class DashboardViewModel @Inject constructor(
|
|||||||
loadCarouselUrls()
|
loadCarouselUrls()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadCarouselUrls() {
|
fun loadCarouselUrls() {
|
||||||
val raw = runCatching {
|
val raw = runCatching {
|
||||||
SystemParamsOperation.getInstance().carouselUrls
|
SystemParamsOperation.getInstance().carouselUrls
|
||||||
}.getOrDefault("")
|
}.getOrDefault("")
|
||||||
|
|||||||
@ -1,19 +1,36 @@
|
|||||||
package com.mob.utsmyanmar.ui.disable
|
package com.mob.utsmyanmar.ui.disable
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
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.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.offset
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.rememberScrollState
|
||||||
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
|
import androidx.compose.material3.ButtonDefaults
|
||||||
|
import androidx.compose.material3.Card
|
||||||
|
import androidx.compose.material3.CardDefaults
|
||||||
|
import androidx.compose.material3.CenterAlignedTopAppBar
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
import androidx.compose.runtime.Composable
|
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.draw.clip
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
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.text.style.TextAlign
|
||||||
@ -22,45 +39,214 @@ import androidx.compose.ui.unit.sp
|
|||||||
import com.mob.utsmyanmar.R
|
import com.mob.utsmyanmar.R
|
||||||
import com.mob.utsmyanmar.ui.theme.Color
|
import com.mob.utsmyanmar.ui.theme.Color
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun DisableScreen(
|
fun DisableScreen(
|
||||||
message: String,
|
message: String,
|
||||||
onRetry: () -> Unit
|
onRetry: () -> Unit
|
||||||
) {
|
) {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
containerColor = Color.IvoryBeige
|
containerColor = Color.IvoryBeige,
|
||||||
|
topBar = {
|
||||||
|
CenterAlignedTopAppBar(
|
||||||
|
title = {
|
||||||
|
Text(
|
||||||
|
text = "Terminal Disabled",
|
||||||
|
color = Color.White,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
fontSize = 18.sp
|
||||||
|
)
|
||||||
|
},
|
||||||
|
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(
|
||||||
|
containerColor = Color.LegacyRed
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(paddingValues),
|
.padding(paddingValues)
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
.verticalScroll(rememberScrollState()),
|
||||||
verticalArrangement = Arrangement.Center
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
) {
|
) {
|
||||||
Icon(
|
Spacer(Modifier.height(40.dp))
|
||||||
painter = painterResource(R.drawable.ic_alert_triangle),
|
|
||||||
contentDescription = null,
|
// Terminal icon with X badge
|
||||||
tint = Color.LegacyRed,
|
Box(
|
||||||
modifier = Modifier.size(100.dp)
|
modifier = Modifier
|
||||||
)
|
.size(160.dp)
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
.clip(CircleShape)
|
||||||
|
.background(Color.LegacyRed.copy(alpha = 0.1f)),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(R.drawable.ic_terminal),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(90.dp),
|
||||||
|
tint = Color.LegacyRed
|
||||||
|
)
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.size(52.dp)
|
||||||
|
.align(Alignment.BottomEnd)
|
||||||
|
.offset(x = (-8).dp, y = (-8).dp)
|
||||||
|
.clip(CircleShape)
|
||||||
|
.background(Color.CrimsonRed),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(R.drawable.ic_cancel_circle),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(32.dp),
|
||||||
|
tint = Color.White
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(Modifier.height(24.dp))
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "Terminal Disabled",
|
text = "This terminal is disabled",
|
||||||
fontSize = 20.sp,
|
fontSize = 22.sp,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
color = Color.LegacyRed
|
color = Color.LegacyRed,
|
||||||
|
textAlign = TextAlign.Center
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
|
||||||
|
Spacer(Modifier.height(8.dp))
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = message,
|
text = "You won't be able to process any\ntransactions until the terminal is enabled.",
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
|
color = Color.Gray,
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
modifier = Modifier.padding(horizontal = 32.dp)
|
modifier = Modifier.padding(horizontal = 32.dp)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(24.dp))
|
|
||||||
Button(onClick = onRetry) {
|
Spacer(Modifier.height(28.dp))
|
||||||
Text(text = "Retry")
|
|
||||||
|
// Info cards
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 16.dp),
|
||||||
|
verticalArrangement = Arrangement.spacedBy(10.dp)
|
||||||
|
) {
|
||||||
|
// Why card
|
||||||
|
Card(
|
||||||
|
shape = RoundedCornerShape(12.dp),
|
||||||
|
colors = CardDefaults.cardColors(containerColor = Color.White),
|
||||||
|
elevation = CardDefaults.cardElevation(0.dp)
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.padding(16.dp),
|
||||||
|
verticalAlignment = Alignment.Top
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.size(48.dp)
|
||||||
|
.clip(CircleShape)
|
||||||
|
.background(Color.LegacyRed.copy(alpha = 0.1f)),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(R.drawable.ic_protection_shield),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(26.dp),
|
||||||
|
tint = Color.LegacyRed
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Spacer(Modifier.width(12.dp))
|
||||||
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
|
Text(
|
||||||
|
text = "Why is this terminal disabled?",
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
fontSize = 14.sp
|
||||||
|
)
|
||||||
|
Spacer(Modifier.height(4.dp))
|
||||||
|
Text(
|
||||||
|
text = message.ifBlank {
|
||||||
|
"The terminal may be disabled by an administrator due to security, compliance or configuration changes."
|
||||||
|
},
|
||||||
|
fontSize = 13.sp,
|
||||||
|
color = Color.Gray
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Help card
|
||||||
|
Card(
|
||||||
|
shape = RoundedCornerShape(12.dp),
|
||||||
|
colors = CardDefaults.cardColors(
|
||||||
|
containerColor = Color.GoldenGlow.copy(alpha = 0.35f)
|
||||||
|
),
|
||||||
|
elevation = CardDefaults.cardElevation(0.dp)
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.padding(16.dp),
|
||||||
|
verticalAlignment = Alignment.Top
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.size(48.dp)
|
||||||
|
.clip(CircleShape)
|
||||||
|
.background(Color.GoldenGlow.copy(alpha = 0.5f)),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(R.drawable.ic_alert_triangle),
|
||||||
|
contentDescription = null,
|
||||||
|
modifier = Modifier.size(26.dp),
|
||||||
|
tint = Color.LegacyRed
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Spacer(Modifier.width(12.dp))
|
||||||
|
Column(modifier = Modifier.weight(1f)) {
|
||||||
|
Text(
|
||||||
|
text = "Need help?",
|
||||||
|
fontWeight = FontWeight.SemiBold,
|
||||||
|
fontSize = 14.sp
|
||||||
|
)
|
||||||
|
Spacer(Modifier.height(4.dp))
|
||||||
|
Text(
|
||||||
|
text = "Contact your system administrator or support team.",
|
||||||
|
fontSize = 13.sp,
|
||||||
|
color = Color.Gray
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Spacer(Modifier.height(32.dp))
|
||||||
|
|
||||||
|
Button(
|
||||||
|
onClick = onRetry,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 16.dp)
|
||||||
|
.height(52.dp),
|
||||||
|
shape = RoundedCornerShape(28.dp),
|
||||||
|
colors = ButtonDefaults.buttonColors(containerColor = Color.LegacyRed)
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(R.drawable.ic_refresh),
|
||||||
|
contentDescription = null,
|
||||||
|
tint = Color.White,
|
||||||
|
modifier = Modifier.size(20.dp)
|
||||||
|
)
|
||||||
|
Spacer(Modifier.width(8.dp))
|
||||||
|
Text(
|
||||||
|
text = "Retry",
|
||||||
|
color = Color.White,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
fontWeight = FontWeight.SemiBold
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(Modifier.height(24.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -113,6 +113,14 @@ fun AppNavGraph(
|
|||||||
androidx.compose.runtime.LaunchedEffect(tmsSetupViewModel) {
|
androidx.compose.runtime.LaunchedEffect(tmsSetupViewModel) {
|
||||||
tmsSetupViewModel.onSyncCompleted.collect {
|
tmsSetupViewModel.onSyncCompleted.collect {
|
||||||
dashboardViewModel.refreshLastSyncTime()
|
dashboardViewModel.refreshLastSyncTime()
|
||||||
|
dashboardViewModel.loadCarouselUrls()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
androidx.compose.runtime.LaunchedEffect(tmsSetupViewModel) {
|
||||||
|
tmsSetupViewModel.navigateToDisable.collect { message ->
|
||||||
|
navController.navigate(Routes.Disable.createRoute(message)) {
|
||||||
|
launchSingleTop = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DashboardScreen2(
|
DashboardScreen2(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user