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 1db81a3b1..ec1ec32b6 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 @@ -9,6 +9,7 @@ import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { Link, useNavigate } from "react-router-dom"; import { createStructuredSelector } from "reselect"; +import { useNotification } from "../../contexts/Notifications/notificationContext.jsx"; import { useSocket } from "../../contexts/SocketIO/useSocket.js"; import { auth, logImEXEvent } from "../../firebase/firebase.utils"; import { CANCEL_APPOINTMENTS_BY_JOB_ID, INSERT_MANUAL_APPT } from "../../graphql/appointments.queries"; @@ -32,7 +33,6 @@ import ShareToTeamsButton from "../share-to-teams/share-to-teams.component.jsx"; import AddToProduction from "./jobs-detail-header-actions.addtoproduction.util"; import DuplicateJob from "./jobs-detail-header-actions.duplicate.util"; import JobsDetailHeaderActionsToggleProduction from "./jobs-detail-header-actions.toggle-production"; -import { useNotification } from "../../contexts/Notifications/notificationContext.jsx"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, @@ -1078,17 +1078,26 @@ export function JobsDetailHeaderActions({ menuItems.push({ key: "deletejob", id: "job-actions-deletejob", - label: ( - e.stopPropagation()} - onConfirm={handleDeleteJob} - > - {t("menus.jobsactions.deletejob")} - - ) + label: + job.job_watchers.length === 0 ? ( + e.stopPropagation()} + onConfirm={handleDeleteJob} + > + {t("menus.jobsactions.deletejob")} + + ) : ( + e.stopPropagation()} + showCancel={false} + > + {t("menus.jobsactions.deletejob")} + + ) }); } @@ -1109,8 +1118,8 @@ export function JobsDetailHeaderActions({ e.stopPropagation()} onConfirm={handleVoidJob} > diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 2724b4f4e..fd3dd5134 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -2031,9 +2031,10 @@ "stands": "Stands", "waived": "Waived" }, - "deleteconfirm": "Are you sure you want to delete this Job? This cannot be undone. ", + "deleteconfirm": "Are you sure you want to delete this Job? This cannot be undone.", "deletedelivery": "Delete Delivery Checklist", "deleteintake": "Delete Intake Checklist", + "deletewatchers": "Remove Watchers before deleting this Job.", "deliverchecklist": "Deliver Checklist", "difference": "Difference", "diskscan": "Scan Disk for Estimates", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 0471105a5..bf3817291 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -2034,6 +2034,7 @@ "deleteconfirm": "", "deletedelivery": "", "deleteintake": "", + "deletewatchers": "", "deliverchecklist": "", "difference": "", "diskscan": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 83a28df3c..8a4092e1a 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -2034,6 +2034,7 @@ "deleteconfirm": "", "deletedelivery": "", "deleteintake": "", + "deletewatchers": "", "deliverchecklist": "", "difference": "", "diskscan": "",