test
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useChantier } from '@/app/ContextChantier';
|
||||
import { changeChantierStatus, getChantiers } from "@/services/ressourcesService";
|
||||
import { changeChantierStatus } from "@/services/ressourcesService";
|
||||
import { useState } from 'react';
|
||||
import { Dimensions, LayoutAnimation, Modal, Pressable, StyleSheet, View } from 'react-native';
|
||||
import Animated, { LinearTransition } from 'react-native-reanimated';
|
||||
@@ -31,17 +31,16 @@ export default function SetStatus() {
|
||||
|
||||
async function onConfirm(): Promise<void> {
|
||||
if(chantier == null) return;
|
||||
setOpenConfirmation(false);
|
||||
|
||||
setCurrentStatus(tempStatus);
|
||||
setIsOpen(false);
|
||||
await changeChantierStatus(chantier.id,tempStatus)
|
||||
//Il faut changer le UX
|
||||
setChantier({...chantier,etat: tempStatus})
|
||||
|
||||
//Il faut charger la bdd
|
||||
//const updatedChantiers = await getChantiers();
|
||||
//const updatedChantier = updatedChantiers.find(c=> c.id=== chantier.id);
|
||||
//if (updatedChantier) setChantier(updatedChantier);
|
||||
setOpenConfirmation(false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function onCancel(): void {
|
||||
@@ -70,14 +69,14 @@ export default function SetStatus() {
|
||||
return(
|
||||
<Modal transparent={true} >
|
||||
<View style={styles.overlay}>
|
||||
<ThemedView style={styles.OverlayView}>
|
||||
<ThemedView style={styles.overlayView}>
|
||||
<ThemedText style={{fontSize: 25}}>Changer l'était du chantier en {tempStatus} ?</ThemedText>
|
||||
<View style={styles.OverlayView}>
|
||||
<View style={styles.overlayView}>
|
||||
<ThemedButton lvl={2} border={5} style={styles.buttonValid} onPress={() => onConfirm()}>
|
||||
<ThemedText style={{fontSize: 25}}>Confirmer</ThemedText>
|
||||
</ThemedButton>
|
||||
</View>
|
||||
<View style={styles.OverlayView}>
|
||||
<View style={styles.overlayView}>
|
||||
<ThemedButton lvl={2} border={5} style={styles.buttonValid} onPress={() => onCancel()}>
|
||||
<ThemedText style={{fontSize: 25}}>Annuler</ThemedText>
|
||||
</ThemedButton>
|
||||
@@ -177,7 +176,7 @@ const styles = StyleSheet.create({
|
||||
width:"100%",
|
||||
height:"100%",
|
||||
},
|
||||
OverlayView:{
|
||||
overlayView:{
|
||||
borderRadius: 20,
|
||||
padding: 20,
|
||||
alignItems: "center",
|
||||
@@ -185,7 +184,7 @@ const styles = StyleSheet.create({
|
||||
//backgroundColor:'#ff0000',
|
||||
},
|
||||
buttonValid:{
|
||||
borderWidth: 2,
|
||||
//borderWidth: 2,
|
||||
width:'100%',
|
||||
margin: 0,
|
||||
borderRadius: 15,
|
||||
|
||||
Reference in New Issue
Block a user