correction anomalies

This commit is contained in:
Rochas
2025-12-13 22:51:09 +01:00
parent ee72368b94
commit 9b34feb43e
2 changed files with 35 additions and 32 deletions

View File

@@ -1,7 +1,7 @@
import { Chantier } from '@/class/class';
import { ThemedView } from '@/components/theme/themed-view';
import React, { use, useEffect, useState } from 'react';
import { TouchableOpacity, StyleProp, StyleSheet, View, Image, ViewStyle,Text, TextInput } from 'react-native';
import { TouchableOpacity, StyleProp, StyleSheet, View, Image, ViewStyle,Text, TextInput, ScrollView } from 'react-native';
import { ThemedText } from './theme/themed-text';
import { deleteAnomalie, addAnomalie, getChantiers } from '@/services/ressourcesService';
import { useChantier } from '@/app/ContextChantier';
@@ -63,31 +63,33 @@ export default function Anomaly({data,style}: Props) {
{data.chantier ? (
<ThemedView lvl={4} style={styles.anomaliesContainer}>
<ThemedText style={styles.anomaliesTitle}>Anomalies</ThemedText>
{data.chantier.anomalies.length > 0 ? (
data.chantier.anomalies.map((anomaly, index) => (
<ThemedView key={index} lvl={2} style={styles.anomalyItem}>
<ThemedText style={styles.anomalyText}> {anomaly}</ThemedText>
<TouchableOpacity onPress={() => handleDelete(anomaly)} style={styles.deleteButton}>
<Text style={styles.deleteText}></Text>
{/* Add Anomaly Section */}
<View style={styles.addContainer}>
<TextInput style={styles.input} placeholder="Nouvelle anomalie..." value={newAnomaly} onChangeText={setNewAnomaly} />
<TouchableOpacity style={styles.addButton} onPress={handleAdd}>
<Text style={styles.addButtonText}>Ajouter</Text>
</TouchableOpacity>
</ThemedView>
))
) : (
<ThemedText style={styles.noAnomaly}>Aucune anomalie</ThemedText>
) }
{/* Add Anomaly Section */}
<View style={styles.addContainer}>
<TextInput style={styles.input} placeholder="Nouvelle anomalie..." value={newAnomaly} onChangeText={setNewAnomaly} />
<TouchableOpacity style={styles.addButton} onPress={handleAdd}>
<Text style={styles.addButtonText}>Ajouter</Text>
</TouchableOpacity>
<TouchableOpacity onPress={selectImage} style={styles.addButton}>
<Text style={styles.addButton}>Choisir une image</Text>
</TouchableOpacity>
{imageUri && (
<Image source={{ uri: imageUri }} style={styles.image} />
)}
</View>
<TouchableOpacity onPress={selectImage} style={styles.addButton}>
<Text style={styles.addButton}>Choisir une image</Text>
</TouchableOpacity>
{imageUri && (
<Image source={{ uri: imageUri }} style={styles.image} />
)}
</View>
{data.chantier.anomalies.length > 0 ? (
data.chantier.anomalies.map((anomaly, index) => (
<ThemedView key={index} lvl={2} style={styles.anomalyItem}>
<ThemedText style={styles.anomalyText}> {anomaly}</ThemedText>
<TouchableOpacity onPress={() => handleDelete(anomaly)} style={styles.deleteButton}>
<Text style={styles.deleteText}></Text>
</TouchableOpacity>
</ThemedView>
))
) : (
<ThemedText style={styles.noAnomaly}>Aucune anomalie</ThemedText>
) }
</ThemedView>
): null}
</View>
@@ -99,7 +101,6 @@ const styles = StyleSheet.create({
anomaliesContainer: {
padding: 5,
borderRadius: 10,
//height: 150,
},
anomaliesTitle: {
fontSize: 16,
@@ -138,7 +139,6 @@ const styles = StyleSheet.create({
},
//add anomaly styles
addContainer: {
marginTop: 10,
marginLeft: 2,
flexDirection: "row",
alignItems: "center"