correction anomalies
This commit is contained in:
@@ -4,7 +4,7 @@ import SetStatus from '@/components/setStatus';
|
|||||||
import { ThemedView, } from '@/components/theme/themed-view';
|
import { ThemedView, } from '@/components/theme/themed-view';
|
||||||
import Constants from 'expo-constants'; //pour connaître la taille de la barre menu de l'OS en haut
|
import Constants from 'expo-constants'; //pour connaître la taille de la barre menu de l'OS en haut
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { StyleSheet, View,Text } from 'react-native';
|
import { StyleSheet, View,Text, ScrollView } from 'react-native';
|
||||||
import { useChantier } from '../ContextChantier';
|
import { useChantier } from '../ContextChantier';
|
||||||
import Anomaly from '@/components/anomaly';
|
import Anomaly from '@/components/anomaly';
|
||||||
|
|
||||||
@@ -26,9 +26,13 @@ export default function Home() {
|
|||||||
<View style={{width:"100%", position: 'absolute',marginLeft:"50%"}}>
|
<View style={{width:"100%", position: 'absolute',marginLeft:"50%"}}>
|
||||||
<SetStatus></SetStatus>
|
<SetStatus></SetStatus>
|
||||||
</View>
|
</View>
|
||||||
<ChantierSummary style={styles.summary} data={{ chantier }} />
|
<ScrollView>
|
||||||
<Anomaly style={styles.anomaly} data={{chantier}}/>
|
<View style={{paddingTop:60}}>
|
||||||
{role === "chef"}
|
<ChantierSummary style={styles.summary} data={{ chantier }} />
|
||||||
|
<Anomaly style={styles.anomaly} data={{chantier}}/>
|
||||||
|
{role === "chef"}
|
||||||
|
</View>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</ThemedView>
|
</ThemedView>
|
||||||
@@ -43,7 +47,6 @@ const styles = StyleSheet.create({
|
|||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
marginTop: Constants.statusBarHeight, //pour la barre menu du haut
|
marginTop: Constants.statusBarHeight, //pour la barre menu du haut
|
||||||
paddingTop : 60,
|
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Chantier } from '@/class/class';
|
import { Chantier } from '@/class/class';
|
||||||
import { ThemedView } from '@/components/theme/themed-view';
|
import { ThemedView } from '@/components/theme/themed-view';
|
||||||
import React, { use, useEffect, useState } from 'react';
|
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 { ThemedText } from './theme/themed-text';
|
||||||
import { deleteAnomalie, addAnomalie, getChantiers } from '@/services/ressourcesService';
|
import { deleteAnomalie, addAnomalie, getChantiers } from '@/services/ressourcesService';
|
||||||
import { useChantier } from '@/app/ContextChantier';
|
import { useChantier } from '@/app/ContextChantier';
|
||||||
@@ -63,31 +63,33 @@ export default function Anomaly({data,style}: Props) {
|
|||||||
{data.chantier ? (
|
{data.chantier ? (
|
||||||
<ThemedView lvl={4} style={styles.anomaliesContainer}>
|
<ThemedView lvl={4} style={styles.anomaliesContainer}>
|
||||||
<ThemedText style={styles.anomaliesTitle}>Anomalies</ThemedText>
|
<ThemedText style={styles.anomaliesTitle}>Anomalies</ThemedText>
|
||||||
{data.chantier.anomalies.length > 0 ? (
|
{/* Add Anomaly Section */}
|
||||||
data.chantier.anomalies.map((anomaly, index) => (
|
<View style={styles.addContainer}>
|
||||||
<ThemedView key={index} lvl={2} style={styles.anomalyItem}>
|
<TextInput style={styles.input} placeholder="Nouvelle anomalie..." value={newAnomaly} onChangeText={setNewAnomaly} />
|
||||||
<ThemedText style={styles.anomalyText}>• {anomaly}</ThemedText>
|
<TouchableOpacity style={styles.addButton} onPress={handleAdd}>
|
||||||
<TouchableOpacity onPress={() => handleDelete(anomaly)} style={styles.deleteButton}>
|
<Text style={styles.addButtonText}>Ajouter</Text>
|
||||||
<Text style={styles.deleteText}>✕</Text>
|
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</ThemedView>
|
<TouchableOpacity onPress={selectImage} style={styles.addButton}>
|
||||||
))
|
<Text style={styles.addButton}>Choisir une image</Text>
|
||||||
) : (
|
</TouchableOpacity>
|
||||||
<ThemedText style={styles.noAnomaly}>Aucune anomalie</ThemedText>
|
{imageUri && (
|
||||||
) }
|
<Image source={{ uri: imageUri }} style={styles.image} />
|
||||||
{/* Add Anomaly Section */}
|
)}
|
||||||
<View style={styles.addContainer}>
|
</View>
|
||||||
<TextInput style={styles.input} placeholder="Nouvelle anomalie..." value={newAnomaly} onChangeText={setNewAnomaly} />
|
|
||||||
<TouchableOpacity style={styles.addButton} onPress={handleAdd}>
|
|
||||||
<Text style={styles.addButtonText}>Ajouter</Text>
|
{data.chantier.anomalies.length > 0 ? (
|
||||||
</TouchableOpacity>
|
data.chantier.anomalies.map((anomaly, index) => (
|
||||||
<TouchableOpacity onPress={selectImage} style={styles.addButton}>
|
<ThemedView key={index} lvl={2} style={styles.anomalyItem}>
|
||||||
<Text style={styles.addButton}>Choisir une image</Text>
|
<ThemedText style={styles.anomalyText}>• {anomaly}</ThemedText>
|
||||||
</TouchableOpacity>
|
<TouchableOpacity onPress={() => handleDelete(anomaly)} style={styles.deleteButton}>
|
||||||
{imageUri && (
|
<Text style={styles.deleteText}>✕</Text>
|
||||||
<Image source={{ uri: imageUri }} style={styles.image} />
|
</TouchableOpacity>
|
||||||
)}
|
</ThemedView>
|
||||||
</View>
|
))
|
||||||
|
) : (
|
||||||
|
<ThemedText style={styles.noAnomaly}>Aucune anomalie</ThemedText>
|
||||||
|
) }
|
||||||
</ThemedView>
|
</ThemedView>
|
||||||
): null}
|
): null}
|
||||||
</View>
|
</View>
|
||||||
@@ -99,7 +101,6 @@ const styles = StyleSheet.create({
|
|||||||
anomaliesContainer: {
|
anomaliesContainer: {
|
||||||
padding: 5,
|
padding: 5,
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
//height: 150,
|
|
||||||
},
|
},
|
||||||
anomaliesTitle: {
|
anomaliesTitle: {
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
@@ -138,7 +139,6 @@ const styles = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
//add anomaly styles
|
//add anomaly styles
|
||||||
addContainer: {
|
addContainer: {
|
||||||
marginTop: 10,
|
|
||||||
marginLeft: 2,
|
marginLeft: 2,
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
alignItems: "center"
|
alignItems: "center"
|
||||||
|
|||||||
Reference in New Issue
Block a user