Browse Source

Hiding bug in pluviometerRegister

master
GabrielTrettel 3 years ago
parent
commit
3bfba928d1
  1. 94
      src/app/screens/PluviometerRegisterScreen.js

94
src/app/screens/PluviometerRegisterScreen.js

@ -16,12 +16,24 @@ import { AssembleIngestionPluvRegistration } from "../components/forms/AssembleI
const dims = scaleDimsFromWidth(85, 85, 25); const dims = scaleDimsFromWidth(85, 85, 25);
function Institution({ user }) { function Institution({ user }) {
const institutionMap = {
E: "Escola",
D: "Defesa Civil",
N: "Não governamental",
O: "Outra",
N: "Nenhuma",
};
return ( return (
<View style={{ marginTop: 24, marginBottom: 24 }}>
<Text style={styles.label}>Tippo de instituição: </Text>
<View style={{ marginBottom: 24 }}>
<Text style={styles.label}>Tipo de instituição: </Text>
<View style={{ flexDirection: "row", marginTop: 16 }}> <View style={{ flexDirection: "row", marginTop: 16 }}>
<FontAwesome5 name="university" size={30} color={colors.primary} /> <FontAwesome5 name="university" size={30} color={colors.primary} />
<Text style={styles.subText}>{user.institutionType}</Text>
<Text style={styles.subText}>
{user.institutiontype
? institutionMap[user.institutiontype]
: "Tipo de instituição não informado"}
</Text>
</View> </View>
<Text style={[styles.label, { marginTop: 24 }]}> <Text style={[styles.label, { marginTop: 24 }]}>
@ -29,7 +41,11 @@ function Institution({ user }) {
</Text> </Text>
<View style={{ flexDirection: "row" }}> <View style={{ flexDirection: "row" }}>
<FontAwesome5 name="university" size={30} color={colors.primary} /> <FontAwesome5 name="university" size={30} color={colors.primary} />
<Text style={styles.subText}>{user.institutionName}</Text>
<Text style={styles.subText}>
{user.institution
? user.institution
: "Nome da instituição não informado"}
</Text>
</View> </View>
</View> </View>
); );
@ -127,59 +143,52 @@ function PluviometerRegisterScreen(props) {
}); });
props.navigation.navigate("Home"); props.navigation.navigate("Home");
}
else{
} else {
showMessage({ showMessage({
message: "Erro ao cadastrar pluviômetro. Por favor, tente mais tarde!",
message:
"Erro ao cadastrar pluviômetro. Por favor, tente mais tarde!",
duration: 1950, duration: 1950,
icon: "danger", icon: "danger",
type: "danger", type: "danger",
onPress: () => {}, onPress: () => {},
}); });
} }
}} }}
> >
<View padding={16}> <View padding={16}>
<Text style={styles.title}>Cadastro do Pluviômetro</Text> <Text style={styles.title}>Cadastro do Pluviômetro</Text>
<View>
<Text
style={{
marginTop: 24,
marginBottom: 16,
fontSize: dimensions.text.secondary,
fontWeight: "bold",
textAlign: "left",
color: colors.secondary,
}}
>
Data do cadastro:{" "}
</Text>
{/* <Text */}
{/* style={{ */}
{/* marginTop: 24, */}
{/* marginBottom: 16, */}
{/* fontSize: dimensions.text.secondary, */}
{/* fontWeight: "bold", */}
{/* textAlign: "left", */}
{/* color: colors.secondary, */}
{/* }} */}
{/* > */}
{/* Data do cadastro: */}
{/* </Text> */}
<View
style={{
marginBottom: 24,
}}
>
<FormDatePicker
onDateChange={(value) => setDate(value)}
onTimeChange={(value) => setTime(value)}
date={date}
time={time}
formTypeFace={"pluviometerRegister"}
/>
</View>
</View>
{/* <FormDatePicker */}
{/* onDateChange={(value) => setDate(value)} */}
{/* onTimeChange={(value) => setTime(value)} */}
{/* date={date} */}
{/* time={time} */}
{/* formTypeFace={"pluviometerRegister"} */}
{/* /> */}
<Text style={styles.label}>Endereço do pluviômetro*: </Text> <Text style={styles.label}>Endereço do pluviômetro*: </Text>
<LocationPicker
navigation={props.navigation}
location={location}
setLocationAddr={setLocationAddr}
setGeoLocation={setCoordinates}
/>
{user.institutionType && <Institution user={user} />}
<View marginBottom={24}>
<LocationPicker
navigation={props.navigation}
location={location}
setLocationAddr={setLocationAddr}
setGeoLocation={setCoordinates}
/>
</View>
<Institution user={user} />
<SubmitButton title="Cadastrar" paddingHorizontal={0} /> <SubmitButton title="Cadastrar" paddingHorizontal={0} />
</View> </View>
</Form> </Form>
@ -209,6 +218,7 @@ const styles = StyleSheet.create({
paddingLeft: 16, paddingLeft: 16,
}, },
title: { title: {
marginVertical: 24,
fontSize: 18, fontSize: 18,
fontWeight: "bold", fontWeight: "bold",
textAlign: "center", textAlign: "center",

Loading…
Cancel
Save