Shift Clock error handling IO-699
This commit is contained in:
@@ -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"]({
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 ? (
|
||||
|
||||
Reference in New Issue
Block a user