Shift Clock error handling IO-699

This commit is contained in:
Patrick Fic
2021-02-26 14:55:16 -08:00
parent 3caf02f3f7
commit 7e25ca40b8
8 changed files with 74 additions and 11 deletions

View File

@@ -27559,6 +27559,48 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>noemployeeforuser</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>noemployeeforuser_sub</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
</children>
</folder_node>
<folder_node>

View File

@@ -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"]({

View File

@@ -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);

View File

@@ -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 <LoadingSpinner />;
if (error) return <AlertComponent message={error.message} type="error" />;
if (!employeeId)
return (
<div>
<Result
status="500"
title={t("timetickets.errors.noemployeeforuser")}
subTitle={t("timetickets.errors.noemployeeforuser_sub")}
/>
</div>
);
return (
<div>
{data.timetickets.length > 0 ? (

View File

@@ -5,9 +5,7 @@ import TimeTicketShift from "../../components/time-ticket-shift/time-ticket-shif
export default function ShiftClock() {
return (
<RbacWrapper action="shiftclock:view">
<div>
<TimeTicketShift />
</div>
<TimeTicketShift />
</RbacWrapper>
);
}

View File

@@ -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",

View File

@@ -1691,7 +1691,9 @@
"clockingin": "",
"clockingout": "",
"creating": "",
"deleting": ""
"deleting": "",
"noemployeeforuser": "",
"noemployeeforuser_sub": ""
},
"fields": {
"actualhrs": "",

View File

@@ -1691,7 +1691,9 @@
"clockingin": "",
"clockingout": "",
"creating": "",
"deleting": ""
"deleting": "",
"noemployeeforuser": "",
"noemployeeforuser_sub": ""
},
"fields": {
"actualhrs": "",