diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index e771a1050..f3c5771b0 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -27559,6 +27559,48 @@ + + noemployeeforuser + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + + + noemployeeforuser_sub + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + diff --git a/client/src/components/shop-employees/shop-employees.container.jsx b/client/src/components/shop-employees/shop-employees.container.jsx index 01d5c0608..d9d57fd69 100644 --- a/client/src/components/shop-employees/shop-employees.container.jsx +++ b/client/src/components/shop-employees/shop-employees.container.jsx @@ -30,6 +30,7 @@ function ShopEmployeesContainer({ bodyshop }) { const [updateEmployee] = useMutation(UPDATE_EMPLOYEE); const [insertEmployees] = useMutation(INSERT_EMPLOYEES); const [deleteEmployee] = useMutation(DELETE_EMPLOYEE); + const handleDelete = (id) => { logImEXEvent("shop_employee_delete"); @@ -57,7 +58,13 @@ function ShopEmployeesContainer({ bodyshop }) { logImEXEvent("shop_employee_update"); updateEmployee({ - variables: { id: employeeState[0].id, employee: values }, + variables: { + id: employeeState[0].id, + employee: { + ...values, + user_email: values.user_email === "" ? null : values.user_email, + }, + }, }) .then((r) => { notification["success"]({ diff --git a/client/src/components/time-ticket-shift-form/time-ticket-shift-form.container.jsx b/client/src/components/time-ticket-shift-form/time-ticket-shift-form.container.jsx index 72e331867..c2180ee8a 100644 --- a/client/src/components/time-ticket-shift-form/time-ticket-shift-form.container.jsx +++ b/client/src/components/time-ticket-shift-form/time-ticket-shift-form.container.jsx @@ -40,10 +40,6 @@ export function TimeTicektShiftContainer({ return assoc && assoc.user && assoc.user.employee && assoc.user.employee.id; }, [bodyshop, currentUser.email]); - console.log( - "🚀 ~ file: time-ticket-shift-form.container.jsx ~ line 42 ~ employeeId", - employeeId - ); const handleFinish = async (values) => { setLoading(true); diff --git a/client/src/components/time-ticket-shift/time-ticket-shift.container.jsx b/client/src/components/time-ticket-shift/time-ticket-shift.container.jsx index a3f27c3c1..d320a8ca9 100644 --- a/client/src/components/time-ticket-shift/time-ticket-shift.container.jsx +++ b/client/src/components/time-ticket-shift/time-ticket-shift.container.jsx @@ -1,5 +1,7 @@ import { useQuery } from "@apollo/client"; +import { Result } from "antd"; import React, { useMemo } from "react"; +import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { QUERY_ACTIVE_SHIFT_TIME_TICKETS } from "../../graphql/timetickets.queries"; @@ -28,6 +30,7 @@ export function TimeTicketShiftContainer({ currentUser, isTechConsole, }) { + const { t } = useTranslation(); const employeeId = useMemo(() => { const assoc = bodyshop.associations.filter( (a) => a.useremail === currentUser.email @@ -48,6 +51,17 @@ export function TimeTicketShiftContainer({ if (loading) return ; if (error) return ; + if (!employeeId) + return ( +
+ +
+ ); + return (
{data.timetickets.length > 0 ? ( diff --git a/client/src/pages/shift-clock/shift-clock.page.jsx b/client/src/pages/shift-clock/shift-clock.page.jsx index 15209ce06..d026da567 100644 --- a/client/src/pages/shift-clock/shift-clock.page.jsx +++ b/client/src/pages/shift-clock/shift-clock.page.jsx @@ -5,9 +5,7 @@ import TimeTicketShift from "../../components/time-ticket-shift/time-ticket-shif export default function ShiftClock() { return ( -
- -
+
); } diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 5a308a29e..0d663e616 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1691,7 +1691,9 @@ "clockingin": "Error while clocking in. {{message}}", "clockingout": "Error while clocking out. {{message}}", "creating": "Error creating time ticket. {{message}}", - "deleting": "Error deleting time ticket. {{message}}" + "deleting": "Error deleting time ticket. {{message}}", + "noemployeeforuser": "Unable to use Shift Clock", + "noemployeeforuser_sub": "An employee record has not been created for this user. Please create one before using the shift clock. " }, "fields": { "actualhrs": "Actual Hours", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 4a9bfdf49..f98d2a6a8 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1691,7 +1691,9 @@ "clockingin": "", "clockingout": "", "creating": "", - "deleting": "" + "deleting": "", + "noemployeeforuser": "", + "noemployeeforuser_sub": "" }, "fields": { "actualhrs": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 26b251e04..62a05a54b 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1691,7 +1691,9 @@ "clockingin": "", "clockingout": "", "creating": "", - "deleting": "" + "deleting": "", + "noemployeeforuser": "", + "noemployeeforuser_sub": "" }, "fields": { "actualhrs": "",