From 5271970ec174db9ab183d204ff299c2cca9c90cb Mon Sep 17 00:00:00 2001 From: Dave Date: Fri, 16 Jan 2026 16:41:56 -0500 Subject: [PATCH] feature/IO-3499-React-19: Ticket Ticket Issues, Employee Select Issues --- .../job-close-ro-gaurd.labor.jsx | 11 +- .../job-employee-assignments.component.jsx | 310 ++++++++++-------- .../job-employee-assignments.container.jsx | 103 +++--- .../jobs-detail-labor.container.jsx | 8 +- .../tech-job-clock-out-button.component.jsx | 31 +- client/src/translations/en_us/common.json | 3 +- client/src/translations/es/common.json | 3 +- client/src/translations/fr/common.json | 3 +- 8 files changed, 265 insertions(+), 207 deletions(-) diff --git a/client/src/components/job-close-ro-guard/job-close-ro-gaurd.labor.jsx b/client/src/components/job-close-ro-guard/job-close-ro-gaurd.labor.jsx index e856bf240..51233e151 100644 --- a/client/src/components/job-close-ro-guard/job-close-ro-gaurd.labor.jsx +++ b/client/src/components/job-close-ro-guard/job-close-ro-gaurd.labor.jsx @@ -16,11 +16,15 @@ const mapDispatchToProps = () => ({}); export default connect(mapStateToProps, mapDispatchToProps)(JobCloseRoGuardLabor); export function JobCloseRoGuardLabor({ job, bodyshop, warningCallback }) { + const jobId = job?.id ?? null; + const { loading, error, data, refetch } = useQuery(GET_LINE_TICKET_BY_PK, { - variables: { id: job.id }, + variables: { id: jobId }, + skip: !jobId, fetchPolicy: "network-only", nextFetchPolicy: "network-only" }); + const { treatments: { Enhanced_Payroll } } = useTreatmentsWithConfig({ @@ -29,12 +33,13 @@ export function JobCloseRoGuardLabor({ job, bodyshop, warningCallback }) { splitKey: bodyshop.imexshopid }); + if (!jobId) return ; if (loading) return ; if (error) return ; return Enhanced_Payroll.treatment === "on" ? ( ) : ( ({ - //setUserLanguage: language => dispatch(setUserLanguage(language)) -}); +const mapDispatchToProps = () => ({}); const iconStyle = { marginLeft: ".3rem" }; @@ -31,163 +29,199 @@ export function JobEmployeeAssignments({ loading }) { const { t } = useTranslation(); - const [assignment, setAssignment] = useState({ - operation: null, - employeeid: null - }); - const [visibility, setVisibility] = useState(false); - const onChange = (value, option) => { - setAssignment({ ...assignment, employeeid: value, name: option.name }); + // Which assignment popover is currently open: "body" | "prep" | "refinish" | "csr" | null + const [openOperation, setOpenOperation] = useState(null); + + // Current selection inside the popover + const [selected, setSelected] = useState({ employeeid: null, name: null }); + + const employeeOptions = (bodyshop?.employees || []) + .filter((emp) => emp.active) + .map((emp) => ({ + value: emp.id, + label: `${emp.first_name} ${emp.last_name}` + })); + + const getPopupContainer = () => document.querySelector("#time-ticket-modal") || document.body; + + const openFor = (operation) => { + if (jobRO) return; + setSelected({ employeeid: null, name: null }); + setOpenOperation(operation); }; - const popContent = ( - - - - - - - + + {!isShiftTicket && ( - + )} diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 9ccdd0c0e..c3c562745 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1128,7 +1128,8 @@ "actions": { "addvacation": "Add Vacation", "new": "New Employee", - "newrate": "New Rate" + "newrate": "New Rate", + "select": "Select Employee" }, "errors": { "delete": "Error encountered while deleting employee. {{message}}", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 0e4fa7aea..3737dcd90 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1128,7 +1128,8 @@ "actions": { "addvacation": "", "new": "Nuevo empleado", - "newrate": "" + "newrate": "", + "select": "" }, "errors": { "delete": "Se encontró un error al eliminar al empleado. {{message}}", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 7b8a38072..b6708d7a6 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1128,7 +1128,8 @@ "actions": { "addvacation": "", "new": "Nouvel employé", - "newrate": "" + "newrate": "", + "select": "" }, "errors": { "delete": "Erreur rencontrée lors de la suppression de l'employé. {{message}}",