Норм путь к отчету

This commit is contained in:
Кашин Максим 2023-12-25 23:53:50 +04:00
parent 34f379b65d
commit 99f294da5d

View File

@ -282,20 +282,6 @@ fun UserProfile(
.padding(16.dp),
verticalArrangement = Arrangement.Center
) {
Button(
onClick = {
coroutineScope.launch {
//createPdfFile(context = context, fileName = "отчет.pdf")
navController?.navigate(Screen.Report.route)
Log.d("context", "${context}")
}
},
modifier = Modifier
.fillMaxWidth()
.padding(8.dp)
) {
Text("Сформировать")
}
Text(
"Темная тема",
@ -383,6 +369,7 @@ fun LoginScreen(navController: NavController?) {
@Composable
fun LoginScreenProfile(currentUserViewModel: CurrentUserViewModel = viewModel(factory = AppViewModelProvider.Factory), navController: NavController?) {
var getUser by remember { mutableStateOf(currentUserViewModel.user) }
val coroutineScope = rememberCoroutineScope()
Column(
modifier = Modifier
.fillMaxSize()
@ -405,8 +392,21 @@ fun LoginScreenProfile(currentUserViewModel: CurrentUserViewModel = viewModel(fa
text = "Вы авторизованы под аккаунтом: ${getUser?.login}",
textAlign = TextAlign.Center
)
Spacer(modifier = Modifier.height(16.dp))
if(getUser?.role == "admin") {
Button(
onClick = {
coroutineScope.launch {
navController?.navigate(Screen.Report.route)
}
},
modifier = Modifier
.fillMaxWidth()
.padding(8.dp)
) {
Text("Сформировать отчет")
}
}
Button(
onClick = {