Validation and confirmation messages.
This commit is contained in:
@@ -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>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user