- Merge client update into test-beta

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-01-18 19:20:08 -05:00
696 changed files with 92291 additions and 107075 deletions

View File

@@ -1,59 +1,60 @@
import { Button, notification } from "antd";
import {Button, notification} from "antd";
import Axios from "axios";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
export default function JobCalculateTotals({ job, disabled, refetch }) {
const { t } = useTranslation();
const [loading, setLoading] = useState(false);
import React, {useState} from "react";
import {useTranslation} from "react-i18next";
const handleCalculate = async () => {
try {
setLoading(true);
export default function JobCalculateTotals({job, disabled, refetch}) {
const {t} = useTranslation();
const [loading, setLoading] = useState(false);
await Axios.post("/job/totalsssu", {
id: job.id,
});
const handleCalculate = async () => {
try {
setLoading(true);
if (refetch) refetch();
// const result = await updateJob({
// refetchQueries: ["GET_JOB_BY_PK"],
// awaitRefetchQueries: true,
// variables: {
// jobId: job.id,
// job: {
// job_totals: newTotals,
// clm_total: Dinero(newTotals.totals.total_repairs).toFormat("0.00"),
// owner_owing: Dinero(newTotals.totals.custPayable.total).toFormat(
// "0.00"
// ),
// },
// },
// });
// if (!!!result.errors) {
// notification["success"]({ message: t("jobs.successes.updated") });
// } else {
// notification["error"]({
// message: t("jobs.errors.updating", {
// error: JSON.stringify(result.errors),
// }),
// });
// }
} catch (error) {
notification["error"]({
message: t("jobs.errors.updating", {
error: JSON.stringify(error),
}),
});
} finally {
setLoading(false);
}
};
await Axios.post("/job/totalsssu", {
id: job.id,
});
return (
<div>
<Button loading={loading} onClick={handleCalculate} disabled={disabled}>
{t("jobs.actions.recalculate")}
</Button>
</div>
);
if (refetch) refetch();
// const result = await updateJob({
// refetchQueries: ["GET_JOB_BY_PK"],
// awaitRefetchQueries: true,
// variables: {
// jobId: job.id,
// job: {
// job_totals: newTotals,
// clm_total: Dinero(newTotals.totals.total_repairs).toFormat("0.00"),
// owner_owing: Dinero(newTotals.totals.custPayable.total).toFormat(
// "0.00"
// ),
// },
// },
// });
// if (!!!result.errors) {
// notification["success"]({ message: t("jobs.successes.updated") });
// } else {
// notification["error"]({
// message: t("jobs.errors.updating", {
// error: JSON.stringify(result.errors),
// }),
// });
// }
} catch (error) {
notification["error"]({
message: t("jobs.errors.updating", {
error: JSON.stringify(error),
}),
});
} finally {
setLoading(false);
}
};
return (
<div>
<Button loading={loading} onClick={handleCalculate} disabled={disabled}>
{t("jobs.actions.recalculate")}
</Button>
</div>
);
}