Validation and confirmation messages.

This commit is contained in:
Patrick Fic
2023-08-03 14:14:01 -07:00
parent 1d7f1cccba
commit 3e8660bb61
9 changed files with 127 additions and 39 deletions

View File

@@ -1,5 +1,14 @@
import { Button, Card, Col, Row, Space, Table, Typography } from "antd";
import { SyncOutlined } from '@ant-design/icons'
import {
Button,
Card,
Col,
Row,
Space,
Table,
Typography,
notification,
} from "antd";
import { SyncOutlined } from "@ant-design/icons";
import axios from "axios";
import _ from "lodash";
import React, { useEffect, useMemo, useState } from "react";
@@ -225,10 +234,34 @@ export function PayrollLaborAllocationsTable({
<Space>
<Button
onClick={async () => {
await axios.post("/payroll/payall", {
const response = await axios.post("/payroll/payall", {
jobid: jobId,
});
if (refetch) refetch();
if (response.status === 200) {
if (response.data.success) {
notification.open({
type: "success",
message: t("timetickets.successes.payall"),
});
} else {
notification.open({
type: "error",
message: t("timetickets.errors.payall", {
error: response.data.error,
}),
});
}
if (refetch) refetch();
} else {
notification.open({
type: "error",
message: t("timetickets.errors.payall", {
error: JSON.stringify(""),
}),
});
}
}}
>
{t("timetickets.actions.payall")}
@@ -242,7 +275,7 @@ export function PayrollLaborAllocationsTable({
refetch();
}}
>
<SyncOutlined/>
<SyncOutlined />
</Button>
</Space>
}

View File

@@ -1,4 +1,8 @@
import Icon, { SearchOutlined, ScheduleOutlined } from "@ant-design/icons";
import Icon, {
SearchOutlined,
ScheduleOutlined,
UserAddOutlined,
} from "@ant-design/icons";
import { Layout, Menu } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
@@ -68,19 +72,28 @@ export function TechSider({
<Link to={`/tech/joblookup`}>{t("menus.tech.joblookup")}</Link>
</Menu.Item>
{Enhanced_Payroll.treatment === "on" ? (
<Menu.Item
key="3"
disabled={!!!technician}
icon={<Icon component={FaBusinessTime} />}
onClick={() => {
setTimeTicketTaskContext({
actions: {},
context: { jobid: null },
});
}}
>
{t("menus.tech.claimtask")}
</Menu.Item>
<>
<Menu.Item
key="TechAssignedProdJobs"
disabled={!!!technician}
icon={<UserAddOutlined />}
>
<Link to={`/tech/assigned`}> {t("menus.tech.assignedjobs")}</Link>
</Menu.Item>
<Menu.Item
key="3"
disabled={!!!technician}
icon={<Icon component={FaBusinessTime} />}
onClick={() => {
setTimeTicketTaskContext({
actions: {},
context: { jobid: null },
});
}}
>
{t("menus.tech.claimtask")}
</Menu.Item>
</>
) : (
<Menu.Item
key="3"
@@ -107,13 +120,7 @@ export function TechSider({
>
<Link to={`/tech/board`}> {t("menus.tech.productionboard")}</Link>
</Menu.Item>
<Menu.Item
key="TechAssignedProdJobs"
disabled={!!!technician}
icon={<Icon component={BsKanban} />}
>
<Link to={`/tech/assigned`}> {t("menus.tech.assignedjobs")}</Link>
</Menu.Item>
<Menu.Item
key="7"
disabled={!!!technician}

View File

@@ -74,7 +74,7 @@ export function TimeTicketTaskModalComponent({
<Form.Item dependencies={["task"]}>
{() => {
const { task } = form.getFieldsValue();
const theTaskPreset = bodyshop.md_tasks_presets.presets.find(
const theTaskPreset = bodyshop.md_tasks_presets?.presets?.find(
(tp) => tp.name === task
);