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 === "intake" && "intakechecklist") ||
(type === "deliver" && "deliverchecklist")]: { (type === "deliver" && "deliverchecklist")]: {
...values, ...values,
formItems: formItems.map((fi) => { form: formItems.map((fi) => {
return { return {
...fi, ...fi,
value: values[fi.name], value: values[fi.name],

View File

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

View File

@@ -40,7 +40,6 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
> >
<Input /> <Input />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
className="imex-flex-row__margin" className="imex-flex-row__margin"
label={t("jobs.fields.intake.type")} label={t("jobs.fields.intake.type")}
@@ -61,7 +60,6 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
))} ))}
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
className="imex-flex-row__margin" className="imex-flex-row__margin"
label={t("jobs.fields.intake.label")} label={t("jobs.fields.intake.label")}
@@ -76,7 +74,6 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
> >
<Input /> <Input />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
className="imex-flex-row__margin" className="imex-flex-row__margin"
label={t("jobs.fields.intake.required")} label={t("jobs.fields.intake.required")}
@@ -86,7 +83,34 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
> >
<Switch /> <Switch />
</Form.Item> </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 <DeleteFilled
onClick={() => { onClick={() => {
remove(field.name); remove(field.name);

View File

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

View File

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

View File

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

View File

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

View File

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