diff --git a/client/src/components/jobs-admin-change-status/jobs-admin-change.status.component.jsx b/client/src/components/jobs-admin-change-status/jobs-admin-change.status.component.jsx new file mode 100644 index 000000000..a20c6ea20 --- /dev/null +++ b/client/src/components/jobs-admin-change-status/jobs-admin-change.status.component.jsx @@ -0,0 +1,57 @@ +import { DownCircleFilled } from "@ant-design/icons"; +import { useMutation } from "@apollo/client"; +import { Button, Dropdown, Menu, notification } from "antd"; +import React from "react"; +import { useTranslation } from "react-i18next"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { UPDATE_JOB_STATUS } from "../../graphql/jobs.queries"; +import { selectBodyshop } from "../../redux/user/user.selectors"; + +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop, +}); +const mapDispatchToProps = (dispatch) => ({ + //setUserLanguage: language => dispatch(setUserLanguage(language)) +}); +export default connect(mapStateToProps, mapDispatchToProps)(JobsAdminStatus); + +export function JobsAdminStatus({ bodyshop, job }) { + const { t } = useTranslation(); + + const [mutationUpdateJobstatus] = useMutation(UPDATE_JOB_STATUS); + const updateJobStatus = (status) => { + mutationUpdateJobstatus({ + variables: { jobId: job.id, status: status }, + }) + .then((r) => { + notification["success"]({ message: t("jobs.successes.save") }); + // refetch(); + }) + .catch((error) => { + notification["error"]({ message: t("jobs.errors.saving") }); + }); + }; + + const statusmenu = ( + { + updateJobStatus(e.key); + }} + > + {bodyshop.md_ro_statuses.statuses.map((item) => ( + {item} + ))} + + ); + + return ( + + + + ); +} diff --git a/client/src/pages/jobs-admin/jobs-admin.page.jsx b/client/src/pages/jobs-admin/jobs-admin.page.jsx index d4bf941f8..b133e314e 100644 --- a/client/src/pages/jobs-admin/jobs-admin.page.jsx +++ b/client/src/pages/jobs-admin/jobs-admin.page.jsx @@ -15,6 +15,8 @@ import JobAdminOwnerReassociate from "../../components/jobs-admin-owner-reassoci import JobsAdminUnvoid from "../../components/jobs-admin-unvoid/jobs-admin-unvoid.component"; import JobAdminVehicleReassociate from "../../components/jobs-admin-vehicle-reassociate/jobs-admin-vehicle-reassociate.component"; import LoadingSpinner from "../../components/loading-spinner/loading-spinner.component"; +import JobsAdminStatus from "../../components/jobs-admin-change-status/jobs-admin-change.status.component"; + import NotFound from "../../components/not-found/not-found.component"; import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component"; import { GET_JOB_BY_PK } from "../../graphql/jobs.queries"; @@ -96,6 +98,7 @@ export function JobsCloseContainer({ setBreadcrumbs, setSelectedHeader }) { + diff --git a/server/accounting/qbxml/qbxml-receivables.js b/server/accounting/qbxml/qbxml-receivables.js index 4d2c58672..0bb763a18 100644 --- a/server/accounting/qbxml/qbxml-receivables.js +++ b/server/accounting/qbxml/qbxml-receivables.js @@ -288,7 +288,7 @@ const generateInvoiceQbxml = ( }); // console.log("Done creating hash", JSON.stringify(invoiceLineHash)); - if (!hasMapaLine) { + if (!hasMapaLine && jobs_by_pk.job_totals.rates.mapa.total.amount > 0) { console.log("Adding MAPA Line Manually."); const mapaAccountName = responsibilityCenters.defaults.profits.MAPA; @@ -313,7 +313,7 @@ const generateInvoiceQbxml = ( } } - if (!hasMashLine) { + if (!hasMashLine && jobs_by_pk.job_totals.rates.mash.total.amount > 0) { console.log("Adding MASH Line Manually."); const mashAccountName = responsibilityCenters.defaults.profits.MASH;