Tech login and checklist fixes.

This commit is contained in:
Patrick Fic
2021-02-24 10:38:55 -08:00
parent 57600a1e5a
commit 19207013e2
8 changed files with 56 additions and 60 deletions

View File

@@ -64,7 +64,7 @@ export function JobChecklistForm({
[(type === "intake" && "intakechecklist") ||
(type === "deliver" && "deliverchecklist")]: {
...values,
formItems: formItems.map((fi) => {
form: formItems.map((fi) => {
return {
...fi,
value: values[fi.name],

View File

@@ -611,12 +611,6 @@ export default function ShopInfoComponent({ form, saveLoading }) {
label={t("bodyshop.fields.md_ins_co.street1")}
key={`${index}street1`}
name={[field.name, "street1"]}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<Input />
</Form.Item>
@@ -633,12 +627,6 @@ export default function ShopInfoComponent({ form, saveLoading }) {
label={t("bodyshop.fields.md_ins_co.city")}
key={`${index}city`}
name={[field.name, "city"]}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<Input />
</Form.Item>
@@ -647,12 +635,6 @@ export default function ShopInfoComponent({ form, saveLoading }) {
label={t("bodyshop.fields.md_ins_co.state")}
key={`${index}state`}
name={[field.name, "state"]}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<Input />
</Form.Item>
@@ -661,12 +643,6 @@ export default function ShopInfoComponent({ form, saveLoading }) {
label={t("bodyshop.fields.md_ins_co.zip")}
key={`${index}zip`}
name={[field.name, "zip"]}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<Input />
</Form.Item>

View File

@@ -40,7 +40,6 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
>
<Input />
</Form.Item>
<Form.Item
className="imex-flex-row__margin"
label={t("jobs.fields.intake.type")}
@@ -61,7 +60,6 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
))}
</Select>
</Form.Item>
<Form.Item
className="imex-flex-row__margin"
label={t("jobs.fields.intake.label")}
@@ -76,7 +74,6 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
>
<Input />
</Form.Item>
<Form.Item
className="imex-flex-row__margin"
label={t("jobs.fields.intake.required")}
@@ -86,7 +83,34 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
>
<Switch />
</Form.Item>
<Form.Item
className="imex-flex-row__margin"
label={t("jobs.fields.intake.min")}
key={`${index}min`}
name={[field.name, "min"]}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<Input />
</Form.Item>
<Form.Item
className="imex-flex-row__margin"
label={t("jobs.fields.intake.max")}
key={`${index}max`}
name={[field.name, "max"]}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<Input />
</Form.Item>
<DeleteFilled
onClick={() => {
remove(field.name);

View File

@@ -36,39 +36,42 @@ export function TechLogin({
};
return (
<div className='tech-login-container'>
<div className="tech-login-container">
{technician ? <Redirect to={`/tech/joblookup`} /> : null}
<Form
layout='vertical'
layout="vertical"
onFinish={handleFinish}
autoComplete='new-password'>
autoComplete="new-password"
>
<Form.Item
label={t("tech.fields.employeeid")}
name='employeeid'
name="employeeid"
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}>
<Input size='large' autoComplete='new-password' />
]}
>
<Input size="large" autoComplete="new-password" />
</Form.Item>
<Form.Item
label={t("tech.fields.pin")}
name='pin'
name="pin"
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}>
<Input.Password size='large' autoComplete='new-password' />
]}
>
<Input.Password size="large" autoComplete="new-password" />
</Form.Item>
<Button htmlType='submit' loading={loginLoading} className='login-btn'>
<Button htmlType="submit" loading={loginLoading} className="login-btn">
{t("general.actions.login")}
</Button>
</Form>
{loginError ? <AlertComponent type='error' message={loginError} /> : null}
{loginError ? <AlertComponent type="error" message={loginError} /> : null}
</div>
);
}

View File

@@ -11,6 +11,7 @@ import "./index.css";
import { persistor, store } from "./redux/store";
//import * as serviceWorker from "./serviceWorker"; //This is registered in a separate component to track notifications.
import "./translations/i18n";
import "./utils/CleanAxios";
require("dotenv").config();

View File

@@ -1,5 +1,6 @@
import { useQuery } from "@apollo/client";
import { Col, Row, Typography } from "antd";
import moment from "moment";
import React, { useEffect } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -15,7 +16,6 @@ import {
setSelectedHeader,
} from "../../redux/application/application.actions";
import { selectBodyshop } from "../../redux/user/user.selectors";
import moment from "moment";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop,
@@ -78,12 +78,12 @@ export function JobsChecklistViewContainer({
{t("jobs.labels.intakechecklist")}
</Typography.Title>
{data.jobs_by_pk.intakechecklist &&
data.jobs_by_pk.intakechecklist.formItems && (
data.jobs_by_pk.intakechecklist.form && (
<>
<JobChecklistForm
formItems={
data.jobs_by_pk.intakechecklist &&
data.jobs_by_pk.intakechecklist.formItems
data.jobs_by_pk.intakechecklist.form
}
type="intake"
job={data.jobs_by_pk}
@@ -98,12 +98,12 @@ export function JobsChecklistViewContainer({
{t("jobs.labels.deliverchecklist")}
</Typography.Title>
{data.jobs_by_pk.deliverchecklist &&
data.jobs_by_pk.deliverchecklist.formItems && (
data.jobs_by_pk.deliverchecklist.form && (
<>
<JobChecklistForm
formItems={
data.jobs_by_pk.deliverchecklist &&
data.jobs_by_pk.deliverchecklist.formItems
data.jobs_by_pk.deliverchecklist.form
}
type="deliver"
job={data.jobs_by_pk}

View File

@@ -16,6 +16,7 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
return {
...state,
technician: null,
loginError: null,
};
case TechActionTypes.TECH_LOGIN_START:
return {

View File

@@ -1,6 +1,6 @@
import axios from "axios";
import { all, call, put, select, takeLatest } from "redux-saga/effects";
import { auth, logImEXEvent } from "../../firebase/firebase.utils";
import { logImEXEvent } from "../../firebase/firebase.utils";
import { selectBodyshop } from "../user/user.selectors";
import { techLoginFailure, techLoginSuccess } from "./tech.actions";
import TechActionTypes from "./tech.types";
@@ -13,20 +13,11 @@ export function* signInStart({ payload: { employeeid, pin } }) {
logImEXEvent("redux_tech_sign_in");
const bodyshop = yield select(selectBodyshop);
const response = yield call(
axios.post,
"/tech/login",
{
shopid: bodyshop.id,
employeeid: employeeid,
pin: pin,
},
{
headers: {
Authorization: `Bearer ${yield auth.currentUser.getIdToken()}`,
},
}
);
const response = yield call(axios.post, "/tech/login", {
shopid: bodyshop.id,
employeeid: employeeid,
pin: pin,
});
const { valid, technician, error } = response.data;