diff --git a/src/app/screens/ActivateInstitution.js b/src/app/screens/ActivateInstitution.js index c69d448..e9a379e 100644 --- a/src/app/screens/ActivateInstitution.js +++ b/src/app/screens/ActivateInstitution.js @@ -1,5 +1,6 @@ import React, { useState } from "react"; import { View, Text, StyleSheet } from "react-native"; +import { showMessage } from "react-native-flash-message"; import { dimensions } from "../config/dimensions"; import colors from "../config/colors"; import SearchablePicker from "../components/SearchablePicker"; diff --git a/src/app/screens/ActivateInstitutionCode.js b/src/app/screens/ActivateInstitutionCode.js index e341d01..7f41110 100644 --- a/src/app/screens/ActivateInstitutionCode.js +++ b/src/app/screens/ActivateInstitutionCode.js @@ -11,7 +11,8 @@ import { FormField, ErrorMessage, } from "../components/forms"; -import {KeyboardAwareScrollView} from "react-native-keyboard-aware-scroll-view"; +import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view"; +import ConfirmationModal from "../components/ConfirmationModal"; function Header() { return ( @@ -94,15 +95,40 @@ function ValidateCode({ institutionRole, user }) { /> - + ); } +function verifyCode(code) { + return true; +} + +function processOnSubmit(navigation, form, instRole, setShowLog) { + if (instRole == "Não responsável") { + if (verifyCode(form.code)) { + setShowLog({show: true, message: true}); + } else { + setShowLog({show: true, message: false}); + } + + } else if (verifyCode(form.code)) { + navigation.navigate("ActivateInstitutionShowCode", { code: form.code }); + } else { + setShowLog({show: true, message: false}); + } + + // navigation.navigate("ActivateInstitutionShowCode", { code: form.code }); + +} + export default function ActivateInstitutionCode({ route, navigation }) { const { instRole } = route.params; const { user, _ } = useContext(AuthContext); + const initialState = {show: false, message: true} + const [showLog, setShowLog] = useState(initialState); + return (
{ console.log("Forms values: \n" + JSON.stringify(form)); - navigation.navigate("ActivateInstitutionShowCode", { code: form.code }); + processOnSubmit(navigation, form, instRole, setShowLog); }} > - - setShowLog(initialState)} + onDecline={() => setShowLog(initialState)} /> - + + + +
); } @@ -154,7 +185,7 @@ const styles = StyleSheet.create({ }, iconField: { justifyContent: "center", - alignItems:"center", + alignItems: "center", flexDirection: "row", marginBottom: 24, }, diff --git a/src/app/screens/ActivateInstitutionShowCode.js b/src/app/screens/ActivateInstitutionShowCode.js index a399c34..f5157e0 100644 --- a/src/app/screens/ActivateInstitutionShowCode.js +++ b/src/app/screens/ActivateInstitutionShowCode.js @@ -1,13 +1,60 @@ import React, { useState, useContext } from "react"; -import {View, Text} from "react-native"; +import { View, Text } from "react-native"; +import { dimensions } from "../config/dimensions"; +import colors from "../config/colors"; +function Header() { + return ( + + + Código de ativação + + + ); +} -export default function ActivateInstitutionShowCode({route}) { - const {code} = route.params + +export default function ActivateInstitutionShowCode({ route }) { + const { code } = route.params; + const [actCode, setActCode] = useState("123456789012"); return ( - {code} - - ) +
+ + Você é responsável pela institução. Compartilhe o código de ativação com + as demais pessoas vinculadas à instituição que utilizam o aplicativo + + + {actCode} + + ); }