- the great reformat

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-02-06 18:23:46 -05:00
parent 3b54fd27bb
commit 4eb8faa5d9
383 changed files with 54009 additions and 52734 deletions

View File

@@ -1,21 +1,21 @@
import { useMutation } from "@apollo/client";
import { Button, Space, notification } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import {useMutation} from "@apollo/client";
import {Button, Space, notification} from "antd";
import React, {useState} from "react";
import {useTranslation} from "react-i18next";
import moment from "moment";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {INSERT_EXPORT_LOG} from "../../graphql/accounting.queries";
import {
MARK_JOB_AS_EXPORTED,
MARK_JOB_AS_UNINVOICED,
MARK_JOB_FOR_REEXPORT,
MARK_JOB_AS_EXPORTED,
MARK_JOB_AS_UNINVOICED,
MARK_JOB_FOR_REEXPORT,
} from "../../graphql/jobs.queries";
import { insertAuditTrail } from "../../redux/application/application.actions";
import {insertAuditTrail} from "../../redux/application/application.actions";
import {
selectBodyshop,
selectCurrentUser,
selectBodyshop,
selectCurrentUser,
} from "../../redux/user/user.selectors";
import AuditTrailMapping from "../../utils/AuditTrailMappings";
@@ -33,27 +33,27 @@ export default connect(
)(JobAdminMarkReexport);
export function JobAdminMarkReexport({
insertAuditTrail,
bodyshop,
currentUser,
job,
}) {
const { t } = useTranslation();
const [loading, setLoading] = useState(false);
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
insertAuditTrail,
bodyshop,
currentUser,
job,
}) {
const {t} = useTranslation();
const [loading, setLoading] = useState(false);
const [insertExportLog] = useMutation(INSERT_EXPORT_LOG);
const [markJobForReexport] = useMutation(MARK_JOB_FOR_REEXPORT);
const [markJobExported] = useMutation(MARK_JOB_AS_EXPORTED);
const [markJobUninvoiced] = useMutation(MARK_JOB_AS_UNINVOICED);
const [markJobForReexport] = useMutation(MARK_JOB_FOR_REEXPORT);
const [markJobExported] = useMutation(MARK_JOB_AS_EXPORTED);
const [markJobUninvoiced] = useMutation(MARK_JOB_AS_UNINVOICED);
const handleMarkForExport = async () => {
setLoading(true);
const result = await markJobForReexport({
variables: {
jobId: job.id,
default_invoiced: bodyshop.md_ro_statuses.default_invoiced,
},
});
const handleMarkForExport = async () => {
setLoading(true);
const result = await markJobForReexport({
variables: {
jobId: job.id,
default_invoiced: bodyshop.md_ro_statuses.default_invoiced,
},
});
if (!result.errors) {
notification["success"]({message: t("jobs.successes.save")});
@@ -71,15 +71,15 @@ export function JobAdminMarkReexport({
setLoading(false);
};
const handleMarkExported = async () => {
setLoading(true);
const result = await markJobExported({
variables: {
jobId: job.id,
date_exported: dayjs(),
default_exported: bodyshop.md_ro_statuses.default_exported,
},
});
const handleMarkExported = async () => {
setLoading(true);
const result = await markJobExported({
variables: {
jobId: job.id,
date_exported: dayjs(),
default_exported: bodyshop.md_ro_statuses.default_exported,
},
});
await insertExportLog({
variables: {
@@ -111,14 +111,14 @@ export function JobAdminMarkReexport({
setLoading(false);
};
const handleUninvoice = async () => {
setLoading(true);
const result = await markJobUninvoiced({
variables: {
jobId: job.id,
default_delivered: bodyshop.md_ro_statuses.default_delivered,
},
});
const handleUninvoice = async () => {
setLoading(true);
const result = await markJobUninvoiced({
variables: {
jobId: job.id,
default_delivered: bodyshop.md_ro_statuses.default_delivered,
},
});
if (!result.errors) {
notification["success"]({message: t("jobs.successes.save")});
@@ -136,31 +136,31 @@ export function JobAdminMarkReexport({
setLoading(false);
};
return (
<>
<Space wrap>
<Button
loading={loading}
disabled={!job.date_exported}
onClick={handleMarkForExport}
>
{t("jobs.labels.markforreexport")}
</Button>
<Button
loading={loading}
disabled={job.date_exported}
onClick={handleMarkExported}
>
{t("jobs.actions.markasexported")}
</Button>
<Button
loading={loading}
disabled={!job.date_invoiced || job.date_exported}
onClick={handleUninvoice}
>
{t("jobs.actions.uninvoice")}
</Button>
</Space>
</>
);
return (
<>
<Space wrap>
<Button
loading={loading}
disabled={!job.date_exported}
onClick={handleMarkForExport}
>
{t("jobs.labels.markforreexport")}
</Button>
<Button
loading={loading}
disabled={job.date_exported}
onClick={handleMarkExported}
>
{t("jobs.actions.markasexported")}
</Button>
<Button
loading={loading}
disabled={!job.date_invoiced || job.date_exported}
onClick={handleUninvoice}
>
{t("jobs.actions.uninvoice")}
</Button>
</Space>
</>
);
}