feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration - Checkpoint
This commit is contained in:
@@ -37,8 +37,8 @@ export function DmsCustomerSelector(props) {
|
||||
const rrProps = {
|
||||
rrOpenRoLimit: rrOptions.openRoLimit,
|
||||
onRrOpenRoFinished: rrOptions.onOpenRoFinished,
|
||||
rrCashierPending: rrOptions.cashierPending,
|
||||
onRrCashierFinished: rrOptions.onCashierFinished
|
||||
rrValidationPending: rrOptions.validationPending,
|
||||
onValidationFinished: rrOptions.onValidationFinished
|
||||
};
|
||||
return <RRCustomerSelector {...base} {...rrProps} />;
|
||||
}
|
||||
|
||||
@@ -49,8 +49,8 @@ export default function RRCustomerSelector({
|
||||
socket,
|
||||
rrOpenRoLimit = false,
|
||||
onRrOpenRoFinished,
|
||||
rrCashierPending = false,
|
||||
onRrCashierFinished
|
||||
rrValidationPending = false,
|
||||
onValidationFinished
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [open, setOpen] = useState(false);
|
||||
@@ -58,10 +58,10 @@ export default function RRCustomerSelector({
|
||||
const [selectedCustomer, setSelectedCustomer] = useState(null);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
|
||||
// Show dialog automatically when cashiering is pending
|
||||
// Show dialog automatically when validation is pending
|
||||
useEffect(() => {
|
||||
if (rrCashierPending) setOpen(true);
|
||||
}, [rrCashierPending]);
|
||||
if (rrValidationPending) setOpen(true);
|
||||
}, [rrValidationPending]);
|
||||
|
||||
// Listen for RR customer selection list
|
||||
useEffect(() => {
|
||||
@@ -196,22 +196,21 @@ export default function RRCustomerSelector({
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Cashiering step banner */}
|
||||
{rrCashierPending && (
|
||||
{/* Validation step banner */}
|
||||
{rrValidationPending && (
|
||||
<Alert
|
||||
type="info"
|
||||
showIcon
|
||||
message="Complete cashiering in Reynolds"
|
||||
message="Complete Validation in Reynolds"
|
||||
description={
|
||||
<div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
|
||||
<div>
|
||||
We created the Repair Order in Reynolds. Please complete the cashiering/closeout steps in
|
||||
Reynolds. When done, click <strong>Finished/Close</strong> to finalize and mark this export as
|
||||
complete.
|
||||
We created the Repair Order. Please validate the totals and taxes in the DMS system. When done,
|
||||
click <strong>Finished</strong> to finalize and mark this export as complete.
|
||||
</div>
|
||||
<div>
|
||||
<Space>
|
||||
<Button type="primary" onClick={onRrCashierFinished}>
|
||||
<Button type="primary" onClick={onValidationFinished}>
|
||||
Finished / Close
|
||||
</Button>
|
||||
</Space>
|
||||
|
||||
@@ -43,7 +43,7 @@ const DMS_SOCKET_EVENTS = {
|
||||
[DMS_MAP.reynolds]: {
|
||||
log: "rr-log-event",
|
||||
partialResult: "rr-export-job:result",
|
||||
cashierNeeded: "rr-cashiering-required",
|
||||
validationNeeded: "rr-validation-required",
|
||||
exportSuccess: "export-success",
|
||||
exportFailed: "export-failed"
|
||||
},
|
||||
@@ -104,7 +104,7 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
|
||||
const [rrOpenRoLimit, setRrOpenRoLimit] = useState(false);
|
||||
const clearRrOpenRoLimit = () => setRrOpenRoLimit(false);
|
||||
|
||||
const [rrCashierPending, setRrCashierPending] = useState(false);
|
||||
const [rrValidationPending, setrrValidationPending] = useState(false);
|
||||
|
||||
const { loading, error, data } = useQuery(QUERY_JOB_EXPORT_DMS, {
|
||||
variables: { id: jobId },
|
||||
@@ -259,8 +259,8 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
|
||||
const jobIdResolved = payload?.jobId ?? payload;
|
||||
notification.success({ message: t("jobs.successes.exported") });
|
||||
|
||||
// Clear RR cashier flag if any
|
||||
setRrCashierPending(false);
|
||||
// Clear RR Validation flag if any
|
||||
setrrValidationPending(false);
|
||||
|
||||
insertAuditTrail({
|
||||
jobid: jobIdResolved,
|
||||
@@ -276,40 +276,41 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
|
||||
// RR-only extras
|
||||
|
||||
const onPartialResult = () => {
|
||||
setRrCashierPending(true);
|
||||
setrrValidationPending(true);
|
||||
setLogs((prev) => [
|
||||
...prev,
|
||||
{
|
||||
timestamp: new Date(),
|
||||
level: "INFO",
|
||||
message:
|
||||
"Repair Order created in Reynolds. Complete cashiering in Reynolds, then click Finished/Close to finalize."
|
||||
"Repair Order created in Reynolds. Complete validation in Reynolds, then click Finished/Close to finalize."
|
||||
}
|
||||
]);
|
||||
notification.info({
|
||||
message: "Reynolds RO created",
|
||||
description:
|
||||
"Complete cashiering in Reynolds, then click Finished/Close to finalize and mark this export complete.",
|
||||
"Complete validation in Reynolds, then click Finished/Close to finalize and mark this export complete.",
|
||||
duration: 8
|
||||
});
|
||||
};
|
||||
|
||||
const onCashierRequired = (payload) => {
|
||||
setRrCashierPending(true);
|
||||
const onValidationRequired = (payload) => {
|
||||
setrrValidationPending(true);
|
||||
setLogs((prev) => [
|
||||
...prev,
|
||||
{
|
||||
timestamp: new Date(),
|
||||
level: "INFO",
|
||||
message:
|
||||
"Repair Order created in Reynolds. Complete cashiering in Reynolds, then click Finished/Close to finalize.",
|
||||
"Repair Order created in Reynolds. Complete validation in Reynolds, then click Finished/Close to finalize.",
|
||||
meta: { payload }
|
||||
}
|
||||
]);
|
||||
};
|
||||
|
||||
if (mode === DMS_MAP.reynolds && channels.partialResult) activeSocket.on(channels.partialResult, onPartialResult);
|
||||
if (mode === DMS_MAP.reynolds && channels.cashierNeeded) activeSocket.on(channels.cashierNeeded, onCashierRequired);
|
||||
if (mode === DMS_MAP.reynolds && channels.validationNeeded)
|
||||
activeSocket.on(channels.validationrNeeded, onValidationRequired);
|
||||
|
||||
return () => {
|
||||
activeSocket.off("connect", onConnect);
|
||||
@@ -323,8 +324,8 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
|
||||
|
||||
if (mode === DMS_MAP.reynolds && channels.partialResult)
|
||||
activeSocket.off(channels.partialResult, onPartialResult);
|
||||
if (mode === DMS_MAP.reynolds && channels.cashierNeeded)
|
||||
activeSocket.off(channels.cashierNeeded, onCashierRequired);
|
||||
if (mode === DMS_MAP.reynolds && channels.validationNeeded)
|
||||
activeSocket.off(channels.validationNeeded, onValidationRequired);
|
||||
|
||||
// Only tear down legacy socket listeners; don't disconnect WSS from here
|
||||
if (!isWssMode(mode)) {
|
||||
@@ -335,7 +336,7 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
|
||||
}, [mode, activeSocket, channels, logLevel, notification, t, insertAuditTrail, history]);
|
||||
|
||||
// RR finalize callback (unchanged public behavior)
|
||||
const handleRrCashierFinished = () => {
|
||||
const handleRrValidationFinished = () => {
|
||||
if (!jobId) return;
|
||||
if (!isWssMode(mode)) return; // RR is WSS-only
|
||||
activeSocket.emit("rr-finalize-repair-order", { jobId }, (ack) => {
|
||||
@@ -385,8 +386,8 @@ export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, inse
|
||||
rrOptions={{
|
||||
openRoLimit: rrOpenRoLimit,
|
||||
onOpenRoFinished: clearRrOpenRoLimit,
|
||||
cashierPending: rrCashierPending,
|
||||
onCashierFinished: handleRrCashierFinished
|
||||
validationPending: rrValidationPending,
|
||||
onValidationFinished: handleRrValidationFinished
|
||||
}}
|
||||
/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user