added tech signin screen

This commit is contained in:
jfrye122
2023-04-12 12:04:23 -04:00
parent 6d4ce20118
commit bdf90c1f79
4 changed files with 140 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
import { Formik } from "formik";
import React from "react";
import { View, StyleSheet, Text } from "react-native";
import { Button, TextInput } from "react-native-paper";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
//TODO JF add props
const mapStateToProps = (state) => ({});
//TODO JF add prop functions to call dispatch with actions
const mapDispatchToProps = {};
export function TechSignIn({ employeeSignInStart, employeeSigningIn }) {
const { t } = useTranslation();
//TODO add call to dispatch action
const formSubmit = (values) => {
const { employeeId, pin } = values;
// techSignInStart(employeeId, pin);
};
return (
<View style={localStyles.content}>
<View style={localStyles.signInContainer}>
<Formik
initialValues={{ employeeId: "", pin: "" }}
onSubmit={formSubmit}
>
{({ handleChange, handleBlur, handleSubmit, values }) => (
<View>
<TextInput
label={t("techsignin.fields.employeeid")}
mode="outlined"
autoCapitalize="none"
keyboardType="default"
onChangeText={handleChange("employeeId")}
onBlur={handleBlur("employeeId")}
value={values.employeeId}
style={[localStyles.input]}
/>
<TextInput
label={t("techsignin.fields.pin")}
mode="outlined"
secureTextEntry={true}
onChangeText={handleChange("pin")}
onBlur={handleBlur("pin")}
value={values.pin}
style={[localStyles.input]}
/>
<Button
mode="outlined"
loading={employeeSigningIn}
onPress={handleSubmit}
>
<Text>{t("techsignin.actions.techsignin")}</Text>
</Button>
</View>
)}
</Formik>
</View>
</View>
);
}
const localStyles = StyleSheet.create({
content: {
display: "flex",
flex: 1,
},
signInContainer: {
flex: 1,
},
input: {
margin: 12,
},
});
export default connect(mapStateToProps, mapDispatchToProps)(TechSignIn);

View File

@@ -305,6 +305,40 @@
"email": "Email",
"password": "Password"
}
},
"techsignin": {
"actions": {
"techsignin": "Sign In"
},
"errors": {
"employeeidnotfound": "No employee ID found.",
"wrongpin": "The pin you entered is not correct."
},
"fields": {
"employeeid": "EmployeeID",
"pin": "PIN"
},
"titles": {
"signin": "Tech Sign In"
}
},
"timeticketbrowser": {
"actions": {
"refresh": "Refresh",
"upload": "Upload",
"activetickets": "Time Tickets",
"detail": "Time Ticket Details",
"notickets": "There are no active tickets."
},
"labels": {
"converting": "Converting",
"selectjob": "--- Select a ticket ---",
"selectticketassetselector": "Please select a ticket to update. ",
"uploading": "Uploading"
},
"titles": {
"timeticketbrowsertab": "Time Tickets"
}
}
}
}

View File

@@ -305,6 +305,19 @@
"email": "Email",
"password": ""
}
},
"techsignin": {
"actions": {
"techsignin": ""
},
"errors": {
"employeeidnotfound": "",
"wrongpin": ""
},
"fields": {
"employeeid": "",
"pin": ""
}
}
}
}

View File

@@ -305,6 +305,19 @@
"email": "Email",
"password": ""
}
},
"techsignin": {
"actions": {
"techsignin": ""
},
"errors": {
"employeeidnotfound": "",
"wrongpin": ""
},
"fields": {
"employeeid": "",
"pin": ""
}
}
}
}