Timetickets Fixes

This commit is contained in:
Patrick Fic
2023-08-04 15:36:16 -07:00
parent 31735b947a
commit a07d28670d
8 changed files with 77 additions and 87 deletions

View File

@@ -18,7 +18,7 @@ import ErrorDisplay from "../error-display/error-display.component";
const mapStateToProps = createStructuredSelector({
currentEmployee: selectCurrentEmployee,
signingIn: selectSigningIn,
signingError: selectSignInError,
signinError: selectSignInError,
});
const mapDispatchToProps = (dispatch) => ({
@@ -27,7 +27,7 @@ const mapDispatchToProps = (dispatch) => ({
});
export function EmployeeSignIn({
signingError,
signinError,
signingIn,
employeeSignInStart,
}) {
@@ -46,40 +46,45 @@ export function EmployeeSignIn({
onSubmit={formSubmit}
>
{({ handleChange, handleBlur, handleSubmit, values }) => {
const signingErrorMsg = signingError ? (<ErrorDisplay errorMessage={signingError} />) : null;
return(
<View>
<TextInput
label={t("employeesignin.fields.employeeid")}
mode="outlined"
autoCapitalize="none"
keyboardType="default"
onChangeText={handleChange("employeeId")}
onBlur={handleBlur("employeeId")}
value={values.employeeId}
style={[localStyles.input]}
/>
<TextInput
label={t("employeesignin.fields.pin")}
mode="outlined"
secureTextEntry={true}
onChangeText={handleChange("pin")}
onBlur={handleBlur("pin")}
value={values.pin}
style={[localStyles.input]}
textContentType={"none"}
/>
{signingErrorMsg}
<Button
mode="outlined"
loading={signingIn}
onPress={handleSubmit}
>
<Text>{t("employeesignin.actions.employeesignin")}</Text>
</Button>
</View>
)
}}
return (
<View>
<TextInput
label={t("employeesignin.fields.employeeid")}
mode="outlined"
autoCapitalize="none"
keyboardType="default"
autoComplete="off"
onChangeText={handleChange("employeeId")}
onBlur={handleBlur("employeeId")}
value={values.employeeId}
textContentType={"none"}
style={localStyles.item}
/>
<TextInput
label={t("employeesignin.fields.pin")}
mode="outlined"
secureTextEntry={true}
autoComplete="off"
onChangeText={handleChange("pin")}
onBlur={handleBlur("pin")}
value={values.pin}
textContentType={"none"}
style={localStyles.item}
/>
<Button
mode="outlined"
loading={signingIn}
onPress={handleSubmit}
style={localStyles.item}
>
<Text>{t("employeesignin.actions.employeesignin")}</Text>
</Button>
{signinError ? (
<ErrorDisplay errorMessage={signinError} />
) : null}
</View>
);
}}
</Formik>
</View>
</View>
@@ -91,10 +96,12 @@ const localStyles = StyleSheet.create({
display: "flex",
flex: 1,
},
item: {
marginTop: 12,
marginBottom: 12,
},
signInContainer: {
flex: 1,
},
input: {
margin: 12,
},
});