mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-07 16:19:01 +00:00
66 lines
1.5 KiB
TypeScript
66 lines
1.5 KiB
TypeScript
type DispatchStatusActionsProps = {
|
|
status: string;
|
|
locked: boolean;
|
|
busy: boolean;
|
|
onAccept: () => void;
|
|
onRefuse: () => void;
|
|
onStart: () => void;
|
|
onComplete: () => void;
|
|
onRequestCancel: () => void;
|
|
};
|
|
|
|
export function DispatchStatusActions({
|
|
status,
|
|
locked,
|
|
busy,
|
|
onAccept,
|
|
onRefuse,
|
|
onStart,
|
|
onComplete,
|
|
onRequestCancel,
|
|
}: DispatchStatusActionsProps) {
|
|
return (
|
|
<div className="vp-actions">
|
|
{status === "Sent" && (
|
|
<>
|
|
<button
|
|
type="button"
|
|
className="vp-btn vp-btn-success"
|
|
disabled={busy}
|
|
onClick={onAccept}
|
|
>
|
|
Accept Dispatch
|
|
</button>
|
|
<button type="button" className="vp-btn vp-btn-warn" disabled={busy} onClick={onRefuse}>
|
|
Refuse Dispatch
|
|
</button>
|
|
</>
|
|
)}
|
|
{status === "Acknowledged" && (
|
|
<button type="button" className="vp-btn vp-btn-primary" disabled={busy} onClick={onStart}>
|
|
Start Work
|
|
</button>
|
|
)}
|
|
{status === "In Progress" && (
|
|
<button
|
|
type="button"
|
|
className="vp-btn vp-btn-primary"
|
|
disabled={busy}
|
|
onClick={onComplete}
|
|
>
|
|
Mark Completed
|
|
</button>
|
|
)}
|
|
{!locked && status !== "Sent" && (
|
|
<button
|
|
type="button"
|
|
className="vp-btn vp-btn-warn"
|
|
disabled={busy}
|
|
onClick={onRequestCancel}
|
|
>
|
|
Request Cancel
|
|
</button>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|