Merge branch 'popup' into 'main'

Added confirm popup for Ajout mot

See merge request odabasioglu1/sae5!5
main
Odabasioglu Cemal 2023-12-07 13:34:52 +00:00
commit 9181deaa03
2 changed files with 61 additions and 7 deletions

View File

@ -40,6 +40,8 @@ dependencies {
implementation("org.apache.poi:poi:5.0.0")
implementation("org.apache.poi:poi-ooxml:5.0.0")
}
compose.desktop {

View File

@ -22,13 +22,19 @@ import java.awt.Frame
import java.io.File
import java.io.FileWriter
import java.io.IOException
<<<<<<< src/main/kotlin/main/Main.kt
=======
import org.apache.poi.ss.usermodel.CellType
import org.apache.poi.ss.usermodel.Workbook
import org.apache.poi.xssf.usermodel.XSSFWorkbook
import java.io.FileInputStream
>>>>>>> src/main/kotlin/main/Main.kt
val customRedColor = Color(0xFFB70D1B)
@Composable
fun homePage(
onGlossaireClick: () -> Unit,
@ -339,6 +345,8 @@ fun verifierChampsRequis(mot: Map<String, String>): Boolean {
}
@Composable
fun choixLangagePage(
onRetourClick: () -> Unit,
@ -490,11 +498,61 @@ fun glossairePage(
}
<<<<<<< src/main/kotlin/main/Main.kt
@OptIn(ExperimentalMaterialApi::class)
=======
>>>>>>> src/main/kotlin/main/Main.kt
@Composable
fun formulairePage(onAnnulerClick: () -> Unit) {
// State to track whether to show the snackbar
val snackbarVisibleState = remember { mutableStateOf(false) }
val nom = remember { mutableStateOf("") }
val description = remember { mutableStateOf("") }
val contextePrincipal = remember { mutableStateOf("") }
val contexte2 = remember { mutableStateOf("") }
val lieA = remember { mutableStateOf("") }
val synonyme = remember { mutableStateOf("") }
val antonyme = remember { mutableStateOf("") }
val openDialog = remember { mutableStateOf(false) }
if (openDialog.value) {
AlertDialog(
onDismissRequest = {
openDialog.value = false
},
title = {
Text(text = "Confirmation d'ajout de mot")
},
text = {
Text("Le mot a bien été ajouté au glossaire.")
},
confirmButton = {
Button(
onClick = {
openDialog.value = false
nom.value = ""
description.value = ""
contextePrincipal.value = ""
contexte2.value = ""
lieA.value = ""
synonyme.value = ""
antonyme.value = ""
},
colors = ButtonDefaults.buttonColors(
backgroundColor = customRedColor,
contentColor = Color.White
)
) {
Text("Fermer")
}
}
)
}
MaterialTheme {
Column(
modifier = Modifier.padding(16.dp),
@ -503,14 +561,12 @@ fun formulairePage(onAnnulerClick: () -> Unit) {
) {
Text(text = "Nouveau mot", style = MaterialTheme.typography.h5)
val nom = remember { mutableStateOf("") }
TextField(
value = nom.value,
onValueChange = { nom.value = it },
label = { Text("Mot *") },
)
val description = remember { mutableStateOf("") }
TextField(
value = description.value,
onValueChange = { description.value = it },
@ -521,7 +577,6 @@ fun formulairePage(onAnnulerClick: () -> Unit) {
)
)
val contextePrincipal = remember { mutableStateOf("") }
TextField(
value = contextePrincipal.value,
onValueChange = { contextePrincipal.value = it },
@ -532,7 +587,6 @@ fun formulairePage(onAnnulerClick: () -> Unit) {
)
)
val contexte2 = remember { mutableStateOf("") }
TextField(
value = contexte2.value,
onValueChange = { contexte2.value = it },
@ -543,7 +597,6 @@ fun formulairePage(onAnnulerClick: () -> Unit) {
)
)
val lieA = remember { mutableStateOf("") }
TextField(
value = lieA.value,
onValueChange = { lieA.value = it },
@ -554,7 +607,6 @@ fun formulairePage(onAnnulerClick: () -> Unit) {
)
)
val synonyme = remember { mutableStateOf("") }
TextField(
value = synonyme.value,
onValueChange = { synonyme.value = it },
@ -565,7 +617,6 @@ fun formulairePage(onAnnulerClick: () -> Unit) {
)
)
val antonyme = remember { mutableStateOf("") }
TextField(
value = antonyme.value,
onValueChange = { antonyme.value = it },
@ -610,6 +661,7 @@ fun formulairePage(onAnnulerClick: () -> Unit) {
)
ajouterMotAuGlossaire(nouveauMot)
openDialog.value = true
// Réinitialiser les champs après l'ajout
nom.value = ""