-
+
diff --git a/client/src/components/job-search-select/job-search-select.component.jsx b/client/src/components/job-search-select/job-search-select.component.jsx
index 62d1f60f3..7fa9b3c6c 100644
--- a/client/src/components/job-search-select/job-search-select.component.jsx
+++ b/client/src/components/job-search-select/job-search-select.component.jsx
@@ -8,8 +8,6 @@ import { SEARCH_JOBS_BY_ID_FOR_AUTOCOMPLETE, SEARCH_JOBS_FOR_AUTOCOMPLETE } from
import AlertComponent from "../alert/alert.component";
import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component";
-const { Option } = Select;
-
const JobSearchSelect = ({
disabled,
convertedOnly = false,
@@ -87,24 +85,24 @@ const JobSearchSelect = ({
style={{ width: "100%" }}
suffixIcon={(loading || idLoading) && } // matches OLD spinner semantics
notFoundContent={loading ? : null} // matches OLD (loading only)
- >
- {theOptions
- ? theOptions.map((o) => (
-
- ))
- : null}
-
+ options={theOptions?.map((o) => ({
+ key: o.id,
+ value: o.id,
+ status: o.status,
+ label: (
+
+
+ {`${clm_no && o.clm_no ? `${o.clm_no} | ` : ""}${o.ro_number || t("general.labels.na")} | ${OwnerNameDisplayFunction(
+ o
+ )} | ${o.v_model_yr || ""} ${o.v_make_desc || ""} ${o.v_model_desc || ""}`}
+
+
+ {o.status}
+
+
+ )
+ }))}
+ />
{error ? : null}
{idError ? : null}
diff --git a/client/src/components/jobs-admin-class/jobs-admin-class.component.jsx b/client/src/components/jobs-admin-class/jobs-admin-class.component.jsx
index a89547f8f..537995bbc 100644
--- a/client/src/components/jobs-admin-class/jobs-admin-class.component.jsx
+++ b/client/src/components/jobs-admin-class/jobs-admin-class.component.jsx
@@ -59,13 +59,12 @@ export function JobsAdminClass({ bodyshop, job }) {
}
]}
>
-
+
diff --git a/client/src/components/jobs-close-lines/jobs-close-lines.component.jsx b/client/src/components/jobs-close-lines/jobs-close-lines.component.jsx
index a6ad151fb..e737173e6 100644
--- a/client/src/components/jobs-close-lines/jobs-close-lines.component.jsx
+++ b/client/src/components/jobs-close-lines/jobs-close-lines.component.jsx
@@ -141,13 +141,11 @@ export function JobsCloseLines({ bodyshop, job, jobRO }) {
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}}
disabled={jobRO}
- >
- {bodyshop.md_responsibility_centers.profits.map((p) => (
-
- {p.name}
-
- ))}
-
+ options={bodyshop.md_responsibility_centers.profits.map((p) => ({
+ value: p.name,
+ label: p.name
+ }))}
+ />
|
@@ -171,13 +169,11 @@ export function JobsCloseLines({ bodyshop, job, jobRO }) {
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}}
disabled={jobRO}
- >
- {bodyshop.md_responsibility_centers.profits.map((p) => (
-
- {p.name}
-
- ))}
-
+ options={bodyshop.md_responsibility_centers.profits.map((p) => ({
+ value: p.name,
+ label: p.name
+ }))}
+ />
|
diff --git a/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx b/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx
index 72de99502..61db25a24 100644
--- a/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx
+++ b/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx
@@ -2,7 +2,7 @@ import { useMutation } from "@apollo/client/react";
import { Button, Divider, Form, Input, Modal, Select, Space, Switch } from "antd";
import axios from "axios";
import { some } from "lodash";
-import { useCallback, useState } from "react";
+import { useCallback, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
@@ -19,10 +19,10 @@ import { useSocket } from "../../contexts/SocketIO/useSocket.js";
import RREarlyROForm from "../dms-post-form/rr-early-ro-form";
const mapStateToProps = createStructuredSelector({
- //currentUser: selectCurrentUser
bodyshop: selectBodyshop,
jobRO: selectJobReadOnly
});
+
const mapDispatchToProps = (dispatch) => ({
insertAuditTrail: ({ jobid, operation, type }) =>
dispatch(
@@ -37,16 +37,17 @@ const mapDispatchToProps = (dispatch) => ({
export function JobsConvertButton({ bodyshop, job, refetch, jobRO, insertAuditTrail, parentFormIsFieldsTouched }) {
const [open, setOpen] = useState(false);
const [loading, setLoading] = useState(false);
- const [earlyRoCreated, setEarlyRoCreated] = useState(!!job?.dms_id); // Track early RO creation state
- const [earlyRoCreatedThisSession, setEarlyRoCreatedThisSession] = useState(false); // Track if created in THIS modal session
+
+ const [earlyRoCreated, setEarlyRoCreated] = useState(!!job?.dms_id);
+ const [earlyRoCreatedThisSession, setEarlyRoCreatedThisSession] = useState(false);
+
const [mutationConvertJob] = useMutation(CONVERT_JOB_TO_RO);
const { t } = useTranslation();
const [form] = Form.useForm();
const notification = useNotification();
const allFormValues = Form.useWatch([], form);
- const { socket } = useSocket(); // Extract socket from context
+ const { socket } = useSocket();
- // Get Fortellis treatment for proper DMS mode detection
const {
treatments: { Fortellis }
} = useTreatmentsWithConfig({
@@ -55,16 +56,64 @@ export function JobsConvertButton({ bodyshop, job, refetch, jobRO, insertAuditTr
splitKey: bodyshop?.imexshopid
});
- // Check if bodyshop has Reynolds integration using the proper getDmsMode function
const dmsMode = getDmsMode(bodyshop, Fortellis.treatment);
const isReynoldsMode = dmsMode === DMS_MAP.reynolds;
+ const insuranceOptions = useMemo(
+ () =>
+ (bodyshop?.md_ins_cos ?? []).map((s) => ({
+ value: s.name,
+ label: s.name
+ })),
+ [bodyshop?.md_ins_cos]
+ );
+
+ const classOptions = useMemo(
+ () =>
+ (bodyshop?.md_classes ?? []).map((s) => ({
+ value: s,
+ label: s
+ })),
+ [bodyshop?.md_classes]
+ );
+
+ const referralOptions = useMemo(
+ () =>
+ (bodyshop?.md_referral_sources ?? []).map((s) => ({
+ value: s,
+ label: s
+ })),
+ [bodyshop?.md_referral_sources]
+ );
+
+ const csrOptions = useMemo(
+ () =>
+ (bodyshop?.employees ?? [])
+ .filter((emp) => emp.active)
+ .map((emp) => ({
+ value: emp.id,
+ label: `${emp.first_name} ${emp.last_name}`
+ })),
+ [bodyshop?.employees]
+ );
+
+ const categoryOptions = useMemo(
+ () =>
+ (bodyshop?.md_categories ?? []).map((s) => ({
+ value: s,
+ label: s
+ })),
+ [bodyshop?.md_categories]
+ );
+
const handleConvert = async ({ employee_csr, category, ...values }) => {
if (parentFormIsFieldsTouched()) {
alert(t("jobs.labels.savebeforeconversion"));
return;
}
+
setLoading(true);
+
const res = await mutationConvertJob({
variables: {
jobId: job.id,
@@ -78,13 +127,11 @@ export function JobsConvertButton({ bodyshop, job, refetch, jobRO, insertAuditTr
});
if (values.ca_gst_registrant) {
- await axios.post("/job/totalsssu", {
- id: job.id
- });
+ await axios.post("/job/totalsssu", { id: job.id });
}
if (!res.errors) {
- refetch();
+ refetch?.();
notification.success({
title: t("jobs.successes.converted")
});
@@ -97,19 +144,20 @@ export function JobsConvertButton({ bodyshop, job, refetch, jobRO, insertAuditTr
setOpen(false);
}
+
setLoading(false);
};
const submitDisabled = useCallback(() => some(allFormValues, (v) => v === undefined), [allFormValues]);
const handleEarlyROSuccess = (result) => {
- setEarlyRoCreated(true); // Mark early RO as created
- setEarlyRoCreatedThisSession(true); // Mark as created in this session
+ setEarlyRoCreated(true);
+ setEarlyRoCreatedThisSession(true);
notification.success({
title: t("jobs.successes.early_ro_created"),
description: `RO Number: ${result.roNumber || "N/A"}`
});
- // Delay refetch to keep success message visible for 2 seconds
+
setTimeout(() => {
refetch?.();
}, 2000);
@@ -130,29 +178,28 @@ export function JobsConvertButton({ bodyshop, job, refetch, jobRO, insertAuditTr
disabled={job.converted || jobRO}
loading={loading}
onClick={() => {
- setEarlyRoCreated(!!job?.dms_id); // Initialize state based on current job
- setEarlyRoCreatedThisSession(false); // Reset session state when opening modal
+ setEarlyRoCreated(!!job?.dms_id);
+ setEarlyRoCreatedThisSession(false);
setOpen(true);
}}
>
{t("jobs.actions.convert")}