bodyHrs ? "red" : "green" }}
diff --git a/client/src/components/scoreboard-display/scoreboard-display.component.jsx b/client/src/components/scoreboard-display/scoreboard-display.component.jsx
index f25f5a21c..4a6f2fee4 100644
--- a/client/src/components/scoreboard-display/scoreboard-display.component.jsx
+++ b/client/src/components/scoreboard-display/scoreboard-display.component.jsx
@@ -5,7 +5,7 @@ import ScoreboardLastDays from "../scoreboard-last-days/scoreboard-last-days.com
import ScoreboardTargetsTable from "../scoreboard-targets-table/scoreboard-targets-table.component";
export default function ScoreboardDisplayComponent({ scoreboardSubscription }) {
- const { loading, error, data } = scoreboardSubscription;
+ const { data } = scoreboardSubscription;
const scoreBoardlist = (data && data.scoreboard) || [];
console.log("ScoreboardDisplayComponent -> scoreBoardlist", scoreBoardlist);
diff --git a/client/src/components/scoreboard-targets-table/scoreboard-targets-table.component.jsx b/client/src/components/scoreboard-targets-table/scoreboard-targets-table.component.jsx
index f0423a6b9..99ed3773e 100644
--- a/client/src/components/scoreboard-targets-table/scoreboard-targets-table.component.jsx
+++ b/client/src/components/scoreboard-targets-table/scoreboard-targets-table.component.jsx
@@ -1,11 +1,11 @@
+import { CalendarOutlined } from "@ant-design/icons";
+import { Col, Row, Statistic } from "antd";
import React from "react";
+import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
import * as Util from "./scoreboard-targets-table.util";
-import { Row, Col, Card, Statistic } from "antd";
-import { CalendarOutlined } from "@ant-design/icons";
-import { useTranslation } from "react-i18next";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
});
@@ -35,7 +35,7 @@ export function ScoreboardTargetsTable({ bodyshop }) {
@@ -70,7 +70,7 @@ export function ScoreboardTargetsTable({ bodyshop }) {
diff --git a/client/src/components/scoreboard-targets-table/scoreboard-targets-table.util.js b/client/src/components/scoreboard-targets-table/scoreboard-targets-table.util.js
index e683a3132..47d40c759 100644
--- a/client/src/components/scoreboard-targets-table/scoreboard-targets-table.util.js
+++ b/client/src/components/scoreboard-targets-table/scoreboard-targets-table.util.js
@@ -1,5 +1,4 @@
-import moment from "moment";
-import momentbd from "moment-business-days";
+import moment from "moment-business-days";
moment.updateLocale("ca", {
workingWeekdays: [1, 2, 3, 4, 5],
diff --git a/client/src/components/tech-header/tech-header.component.jsx b/client/src/components/tech-header/tech-header.component.jsx
new file mode 100644
index 000000000..ba0dd2946
--- /dev/null
+++ b/client/src/components/tech-header/tech-header.component.jsx
@@ -0,0 +1,29 @@
+import { Layout, Typography } from "antd";
+import React from "react";
+import { connect } from "react-redux";
+import { createStructuredSelector } from "reselect";
+import { selectTechnician } from "../../redux/tech/tech.selectors";
+import { useTranslation } from "react-i18next";
+const { Header } = Layout;
+
+const mapStateToProps = createStructuredSelector({
+ technician: selectTechnician,
+});
+const mapDispatchToProps = (dispatch) => ({
+ //setUserLanguage: language => dispatch(setUserLanguage(language))
+});
+
+export function TechHeader({ technician }) {
+ const { t } = useTranslation();
+ return (
+
+
+ {!!technician
+ ? t("tech.labels.loggedin", { name: technician.name })
+ : t("tech.labels.notloggedin")}
+
+
+ );
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(TechHeader);
diff --git a/client/src/components/tech-login/tech-login.component.jsx b/client/src/components/tech-login/tech-login.component.jsx
new file mode 100644
index 000000000..3f361b950
--- /dev/null
+++ b/client/src/components/tech-login/tech-login.component.jsx
@@ -0,0 +1,59 @@
+import { Button, Form, Input } from "antd";
+import React from "react";
+import { useTranslation } from "react-i18next";
+import { connect } from "react-redux";
+import { createStructuredSelector } from "reselect";
+import { loginStart } from "../../redux/tech/tech.actions";
+import {
+ selectLoginError,
+ selectTechnician,
+} from "../../redux/tech/tech.selectors";
+import "./tech-login.styles.scss";
+
+const mapStateToProps = createStructuredSelector({
+ technician: selectTechnician,
+ loginError: selectLoginError,
+});
+
+const mapDispatchToProps = (dispatch) => ({
+ loginStart: (user) => dispatch(loginStart(user)),
+});
+
+export function TechLogin({ technician, loginError, loginStart }) {
+ const { t } = useTranslation();
+ const handleFinish = (values) => {
+ loginStart(values);
+ };
+ return (
+
+
+
+
+
+
+
+
+
+
+ );
+}
+export default connect(mapStateToProps, mapDispatchToProps)(TechLogin);
diff --git a/client/src/components/tech-login/tech-login.styles.scss b/client/src/components/tech-login/tech-login.styles.scss
new file mode 100644
index 000000000..c7d1d5a57
--- /dev/null
+++ b/client/src/components/tech-login/tech-login.styles.scss
@@ -0,0 +1,16 @@
+.tech-login-container {
+ display: flex;
+ align-items: center;
+ flex-direction: column;
+ padding: 2rem;
+ form {
+ width: 75vw;
+ max-width: 30rem;
+ }
+ .login-btn {
+ margin: 1.5rem 0rem;
+ position: relative;
+ left: 50%;
+ transform: translate(-50%, 0);
+ }
+}
diff --git a/client/src/components/tech-sider/tech-sider.component.jsx b/client/src/components/tech-sider/tech-sider.component.jsx
new file mode 100644
index 000000000..35cd4ffd2
--- /dev/null
+++ b/client/src/components/tech-sider/tech-sider.component.jsx
@@ -0,0 +1,67 @@
+import Icon, { SearchOutlined } from "@ant-design/icons";
+import { Layout, Menu } from "antd";
+import React, { useState } from "react";
+import { useTranslation } from "react-i18next";
+import { FiLogIn, FiLogOut } from "react-icons/fi";
+import { MdTimer, MdTimerOff } from "react-icons/md";
+import { connect } from "react-redux";
+import { Link } from "react-router-dom";
+import { createStructuredSelector } from "reselect";
+import { selectTechnician } from "../../redux/tech/tech.selectors";
+const { Sider } = Layout;
+
+const mapStateToProps = createStructuredSelector({
+ technician: selectTechnician,
+});
+const mapDispatchToProps = (dispatch) => ({
+ //setUserLanguage: language => dispatch(setUserLanguage(language))
+});
+
+export function TechSider({ technician }) {
+ const [collapsed, setCollapsed] = useState(true);
+ const { t } = useTranslation();
+ const onCollapse = (collapsed) => {
+ setCollapsed(collapsed);
+ };
+
+ return (
+
+
+
+ );
+}
+export default connect(mapStateToProps, mapDispatchToProps)(TechSider);
diff --git a/client/src/pages/tech/tech.page.component.jsx b/client/src/pages/tech/tech.page.component.jsx
new file mode 100644
index 000000000..3c0c70a0b
--- /dev/null
+++ b/client/src/pages/tech/tech.page.component.jsx
@@ -0,0 +1,70 @@
+import { BackTop, Layout } from "antd";
+import React, { lazy, Suspense, useEffect } from "react";
+import { useTranslation } from "react-i18next";
+import { Route, Switch } from "react-router-dom";
+import ErrorBoundary from "../../components/error-boundary/error-boundary.component";
+import FcmNotification from "../../components/fcm-notification/fcm-notification.component";
+import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
+import TechHeader from "../../components/tech-header/tech-header.component";
+import TechSider from "../../components/tech-sider/tech-sider.component";
+import "./tech.page.styles.scss";
+
+const ManageRootPage = lazy(() =>
+ import("../manage-root/manage-root.page.container")
+);
+const JobsPage = lazy(() => import("../jobs/jobs.page"));
+
+const TimeTicketModalContainer = lazy(() =>
+ import("../../components/time-ticket-modal/time-ticket-modal.container")
+);
+const PrintCenterModalContainer = lazy(() =>
+ import("../../components/print-center-modal/print-center-modal.container")
+);
+const TechLogin = lazy(() =>
+ import("../../components/tech-login/tech-login.component")
+);
+
+const { Content } = Layout;
+
+export default function TechPage({ match }) {
+ const { t } = useTranslation();
+
+ useEffect(() => {
+ document.title = t("titles.app");
+ }, [t]);
+
+ return (
+
+
+
+
+
+
+
+
+ }>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/client/src/pages/tech/tech.page.container.jsx b/client/src/pages/tech/tech.page.container.jsx
new file mode 100644
index 000000000..d4446f05b
--- /dev/null
+++ b/client/src/pages/tech/tech.page.container.jsx
@@ -0,0 +1,30 @@
+import { useQuery } from "@apollo/react-hooks";
+import React, { useEffect } from "react";
+import { connect } from "react-redux";
+import AlertComponent from "../../components/alert/alert.component";
+import { QUERY_BODYSHOP } from "../../graphql/bodyshop.queries";
+import { setBodyshop } from "../../redux/user/user.actions";
+import TechPage from "./tech.page.component";
+import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component";
+import { useTranslation } from "react-i18next";
+
+const mapDispatchToProps = (dispatch) => ({
+ setBodyshop: (bs) => dispatch(setBodyshop(bs)),
+});
+
+export function TechPageContainer({ setBodyshop, match }) {
+ const { loading, error, data } = useQuery(QUERY_BODYSHOP, {
+ fetchPolicy: "network-only",
+ });
+ const { t } = useTranslation();
+ useEffect(() => {
+ if (data) setBodyshop(data.bodyshops[0]);
+ }, [data, setBodyshop]);
+
+ if (loading)
+ return ;
+ if (error) return ;
+ return ;
+}
+
+export default connect(null, mapDispatchToProps)(TechPageContainer);
diff --git a/client/src/pages/tech/tech.page.styles.scss b/client/src/pages/tech/tech.page.styles.scss
new file mode 100644
index 000000000..08a7e5817
--- /dev/null
+++ b/client/src/pages/tech/tech.page.styles.scss
@@ -0,0 +1,9 @@
+.tech-content-container {
+ overflow-y: auto;
+ padding: 1rem;
+ background: #fff;
+}
+
+.tech-layout-container {
+ height: 100vh;
+}
diff --git a/client/src/redux/root.reducer.js b/client/src/redux/root.reducer.js
index 7eb3709a3..4bd0153d8 100644
--- a/client/src/redux/root.reducer.js
+++ b/client/src/redux/root.reducer.js
@@ -7,11 +7,12 @@ import messagingReducer from "./messaging/messaging.reducer";
import emailReducer from "./email/email.reducer";
import modalsReducer from "./modals/modals.reducer";
import applicationReducer from "./application/application.reducer";
+import techReducer from "./tech/tech.reducer";
const persistConfig = {
key: "root",
storage,
whitelist: ["messaging"],
- blacklist: ["user", "email", "modals"],
+ blacklist: ["user", "email", "modals", "tech"],
};
const rootReducer = combineReducers({
@@ -20,6 +21,7 @@ const rootReducer = combineReducers({
email: emailReducer,
modals: modalsReducer,
application: applicationReducer,
+ tech: techReducer,
});
export default persistReducer(persistConfig, rootReducer);
diff --git a/client/src/redux/root.saga.js b/client/src/redux/root.saga.js
index 02d46530f..d18dd9d9c 100644
--- a/client/src/redux/root.saga.js
+++ b/client/src/redux/root.saga.js
@@ -5,6 +5,8 @@ import { messagingSagas } from "./messaging/messaging.sagas";
import { emailSagas } from "./email/email.sagas";
import { modalsSagas } from "./modals/modals.sagas";
import { applicationSagas } from "./application/application.sagas";
+import { techSagas } from "./tech/tech.sagas";
+
export default function* rootSaga() {
yield all([
call(userSagas),
@@ -12,5 +14,6 @@ export default function* rootSaga() {
call(emailSagas),
call(modalsSagas),
call(applicationSagas),
+ call(techSagas),
]);
}
diff --git a/client/src/redux/tech/tech.actions.js b/client/src/redux/tech/tech.actions.js
new file mode 100644
index 000000000..0f548b826
--- /dev/null
+++ b/client/src/redux/tech/tech.actions.js
@@ -0,0 +1,16 @@
+import TechActionTypes from "./tech.types";
+
+export const loginStart = ({ technician, password }) => ({
+ type: TechActionTypes.LOGIN_START,
+ payload: { technician, password },
+});
+
+export const loginSuccess = (tech) => ({
+ type: TechActionTypes.LOGIN_SUCCESS,
+ payload: tech,
+});
+
+export const loginFailure = (error) => ({
+ type: TechActionTypes.LOGIN_SUCCESS,
+ payload: error,
+});
diff --git a/client/src/redux/tech/tech.reducer.js b/client/src/redux/tech/tech.reducer.js
new file mode 100644
index 000000000..6e863aaf1
--- /dev/null
+++ b/client/src/redux/tech/tech.reducer.js
@@ -0,0 +1,25 @@
+import TechActionTypes from "./tech.types";
+const INITIAL_STATE = {
+ technician: null,
+ loginError: null,
+};
+
+const applicationReducer = (state = INITIAL_STATE, action) => {
+ switch (action.type) {
+ case TechActionTypes.LOGIN_SUCCESS:
+ return {
+ ...state,
+ technician: action.payload,
+ };
+ case TechActionTypes.LOGIN_FAILURE:
+ return {
+ ...state,
+ loginError: action.payload,
+ };
+
+ default:
+ return state;
+ }
+};
+
+export default applicationReducer;
diff --git a/client/src/redux/tech/tech.sagas.js b/client/src/redux/tech/tech.sagas.js
new file mode 100644
index 000000000..f0dc12f99
--- /dev/null
+++ b/client/src/redux/tech/tech.sagas.js
@@ -0,0 +1,19 @@
+import { all, takeLatest, call, put } from "redux-saga/effects";
+import TechActionTypes from "./tech.types";
+import { client } from "../../App/App.container";
+import { loginSuccess, loginFailure } from "./tech.actions";
+
+export function* onSignInStart() {
+ yield takeLatest(TechActionTypes.LOGIN_START, signInStart);
+}
+export function* signInStart({ payload: { technician, password } }) {
+ try {
+ yield put(loginSuccess({ username: "TECHNICIAN" }));
+ } catch (error) {
+ yield put(loginFailure(error));
+ }
+}
+
+export function* techSagas() {
+ yield all([call(onSignInStart)]);
+}
diff --git a/client/src/redux/tech/tech.selectors.js b/client/src/redux/tech/tech.selectors.js
new file mode 100644
index 000000000..fc30844ad
--- /dev/null
+++ b/client/src/redux/tech/tech.selectors.js
@@ -0,0 +1,12 @@
+import { createSelector } from "reselect";
+
+const selectTechReducer = (state) => state.tech;
+
+export const selectTechnician = createSelector(
+ [selectTechReducer],
+ (application) => application.technician
+);
+export const selectLoginError = createSelector(
+ [selectTechReducer],
+ (application) => application.loginError
+);
diff --git a/client/src/redux/tech/tech.types.js b/client/src/redux/tech/tech.types.js
new file mode 100644
index 000000000..e4a4931e7
--- /dev/null
+++ b/client/src/redux/tech/tech.types.js
@@ -0,0 +1,6 @@
+const TechActionTypes = {
+ LOGIN_START: "LOGIN_START",
+ LOGIN_SUCCESS: "LOGIN_SUCCESS",
+ LOGIN_FAILURE: "LOGIN_FAILURE",
+};
+export default TechActionTypes;
diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json
index 27dbf0b7b..ab836cf90 100644
--- a/client/src/translations/en_us/common.json
+++ b/client/src/translations/en_us/common.json
@@ -825,6 +825,16 @@
"profilesidebar": {
"profile": "My Profile",
"shops": "My Shops"
+ },
+ "tech": {
+ "clockin": "Clock In",
+ "clockout": "Clock Out",
+ "home": "Home",
+ "joblookup": "Job Lookup",
+ "login": "Login",
+ "logout": "Logout",
+ "productionboard": "Production Board",
+ "productionlist": "Production List"
}
},
"messaging": {
@@ -1036,6 +1046,12 @@
"removed": "Job removed from scoreboard."
}
},
+ "tech": {
+ "labels": {
+ "loggedin": "Logged in as {{name}}",
+ "notloggedin": "Not logged in."
+ }
+ },
"templates": {
"errors": {
"updating": "Error updating template {{error}}."
diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json
index 7718ccdab..99b676693 100644
--- a/client/src/translations/es/common.json
+++ b/client/src/translations/es/common.json
@@ -825,6 +825,16 @@
"profilesidebar": {
"profile": "Mi perfil",
"shops": "Mis tiendas"
+ },
+ "tech": {
+ "clockin": "",
+ "clockout": "",
+ "home": "",
+ "joblookup": "",
+ "login": "",
+ "logout": "",
+ "productionboard": "",
+ "productionlist": ""
}
},
"messaging": {
@@ -1036,6 +1046,12 @@
"removed": ""
}
},
+ "tech": {
+ "labels": {
+ "loggedin": "",
+ "notloggedin": ""
+ }
+ },
"templates": {
"errors": {
"updating": ""
diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json
index 059406459..2beb3f8ee 100644
--- a/client/src/translations/fr/common.json
+++ b/client/src/translations/fr/common.json
@@ -825,6 +825,16 @@
"profilesidebar": {
"profile": "Mon profil",
"shops": "Mes boutiques"
+ },
+ "tech": {
+ "clockin": "",
+ "clockout": "",
+ "home": "",
+ "joblookup": "",
+ "login": "",
+ "logout": "",
+ "productionboard": "",
+ "productionlist": ""
}
},
"messaging": {
@@ -1036,6 +1046,12 @@
"removed": ""
}
},
+ "tech": {
+ "labels": {
+ "loggedin": "",
+ "notloggedin": ""
+ }
+ },
"templates": {
"errors": {
"updating": ""
diff --git a/client/src/utils/aamva.js b/client/src/utils/aamva.js
index 0f81b49ec..a497b1eeb 100644
--- a/client/src/utils/aamva.js
+++ b/client/src/utils/aamva.js
@@ -455,10 +455,11 @@
}
}
+ var name;
switch (Number(version[1])) {
case 1: {
// version one joining all of the names in one string
- var name = parsedData.DAA.split(",");
+ name = parsedData.DAA.split(",");
parsedData.DCS = name[0];
parsedData.DAC = name[1];
parsedData.DAD = name[2];
@@ -475,7 +476,7 @@
}
case 3: {
// version 3 putting middle and first names in the same field
- var name = parsedData.DCT.split(",");
+ name = parsedData.DCT.split(",");
parsedData.DAC = name[0]; // first name
parsedData.DAD = name[1]; // middle name
break;