diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel
index 95881f674..8a16a9bd8 100644
--- a/bodyshop_translations.babel
+++ b/bodyshop_translations.babel
@@ -29965,6 +29965,27 @@
+
+ cancelallappointments
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
closejob
false
diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx
index 4222addc2..7cac639e9 100644
--- a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx
+++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx
@@ -7,6 +7,7 @@ import { connect } from "react-redux";
import { Link, useHistory } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import { logImEXEvent } from "../../firebase/firebase.utils";
+import { CANCEL_APPOINTMENTS_BY_JOB_ID } from "../../graphql/appointments.queries";
import { DELETE_JOB, UPDATE_JOB, VOID_JOB } from "../../graphql/jobs.queries";
import { selectJobReadOnly } from "../../redux/application/application.selectors";
import { setModalContext } from "../../redux/modals/modals.actions";
@@ -56,6 +57,7 @@ export function JobsDetailHeaderActions({
const [deleteJob] = useMutation(DELETE_JOB);
const [updateJob] = useMutation(UPDATE_JOB);
const [voidJob] = useMutation(VOID_JOB);
+ const [cancelAllAppointments] = useMutation(CANCEL_APPOINTMENTS_BY_JOB_ID);
const jobInProduction = useMemo(() => {
return bodyshop.md_ro_statuses.production_statuses.includes(job.status);
}, [job, bodyshop.md_ro_statuses.production_statuses]);
@@ -121,6 +123,39 @@ export function JobsDetailHeaderActions({
>
{t("jobs.actions.schedule")}
+
+ e.stopPropagation()}
+ disabled={job.status !== bodyshop.md_ro_statuses.default_scheduled}
+ onConfirm={async () => {
+ const jobUpdate = await cancelAllAppointments({
+ variables: {
+ jobid: job.id,
+ job: {
+ date_scheduled: null,
+ scheduled_in: null,
+ scheduled_completion: null,
+ status: bodyshop.md_ro_statuses.default_imported,
+ },
+ },
+ });
+ if (!jobUpdate.errors) {
+ notification["success"]({
+ message: t("appointments.successes.canceled"),
+ });
+ return;
+ }
+ }}
+ getPopupContainer={(trigger) => trigger.parentNode}
+ >
+ {t("menus.jobsactions.cancelallappointments")}
+
+