Successful 2tier and 3 tier export of invoices. BOD-83 BOD-131
This commit is contained in:
@@ -18,6 +18,8 @@ export function JobsCloseSaveButton({
|
||||
jobTotals,
|
||||
labMatAllocations,
|
||||
partsAllocations,
|
||||
setInvoicedState,
|
||||
disabled,
|
||||
}) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const { t } = useTranslation();
|
||||
@@ -38,9 +40,23 @@ export function JobsCloseSaveButton({
|
||||
},
|
||||
},
|
||||
},
|
||||
optimisticResponse: {
|
||||
update_jobs: {
|
||||
returning: {
|
||||
id: jobId,
|
||||
date_invoiced: new Date(),
|
||||
status: bodyshop.md_ro_statuses.default_invoiced || "Invoiced*",
|
||||
invoice_allocation: {
|
||||
labMatAllocations,
|
||||
partsAllocations,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!!!result.errors) {
|
||||
notification["success"]({ message: t("jobs.successes.invoiced") });
|
||||
setInvoicedState(true);
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: t("jobs.errors.invoicing", {
|
||||
@@ -50,14 +66,14 @@ export function JobsCloseSaveButton({
|
||||
}
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<Button
|
||||
onClick={handleSave}
|
||||
disabled={suspenseAmount > 0}
|
||||
disabled={suspenseAmount > 0 || disabled}
|
||||
loading={loading}
|
||||
>
|
||||
{t("general.actions.close")}
|
||||
{t("general.actions.save")}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user