mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-07 03:32:06 +00:00
Update dispatch for multi-WO support
- Pass WorkOrderIds array in dispatch API call - DispatchDetailModal shows WO list from junction table in header - dispatchToVendor API simplified to pass full payload
This commit is contained in:
parent
4de6c54fc0
commit
714376c61b
2 changed files with 7 additions and 7 deletions
|
|
@ -138,11 +138,8 @@ export const addDispatchComment = async (dispatchId, text, sendEmail = true) =>
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const dispatchToVendor = async (workOrderId, payload) => {
|
export const dispatchToVendor = async (payload) => {
|
||||||
return post(`${API_URL}/WorkOrder/DispatchToVendor`, {
|
return post(`${API_URL}/WorkOrder/DispatchToVendor`, payload);
|
||||||
WorkOrderId: workOrderId,
|
|
||||||
...payload,
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const changeWorkOrderStatus = async (id, status) => {
|
export const changeWorkOrderStatus = async (id, status) => {
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,9 @@ function DispatchDetailModal({ dispatchId, onClose, onUpdated }) {
|
||||||
<div className="woDispatchHeader">
|
<div className="woDispatchHeader">
|
||||||
<div>
|
<div>
|
||||||
<h3>{dispatch.dispatchNumber || dispatch.poNumber} · {dispatch.vendorName}</h3>
|
<h3>{dispatch.dispatchNumber || dispatch.poNumber} · {dispatch.vendorName}</h3>
|
||||||
<span className="dispatchDetailSub">PO: {dispatch.poNumber} · WO: {dispatch.woNumber} · {dispatch.vendorEmail}</span>
|
<span className="dispatchDetailSub">
|
||||||
|
PO: {dispatch.poNumber} · {dispatch.workOrders?.length > 0 ? `${dispatch.workOrders.length} WO(s): ${dispatch.workOrders.map(w => w.woNumber).join(", ")}` : `WO: ${dispatch.woNumber}`} · {dispatch.vendorEmail}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<button className="woDispatchClose" onClick={onClose}>×</button>
|
<button className="woDispatchClose" onClick={onClose}>×</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -406,7 +408,8 @@ function DispatchModal({ wo, onClose, onDispatched }) {
|
||||||
if (!selectedId) { toast.error("Select a vendor"); return; }
|
if (!selectedId) { toast.error("Select a vendor"); return; }
|
||||||
setSending(true);
|
setSending(true);
|
||||||
try {
|
try {
|
||||||
await dispatchToVendor(wo.id, {
|
await dispatchToVendor({
|
||||||
|
WorkOrderIds: [wo.id],
|
||||||
VendorIds: [selectedId],
|
VendorIds: [selectedId],
|
||||||
NTEAmount: nteAmount ? parseFloat(nteAmount) : null,
|
NTEAmount: nteAmount ? parseFloat(nteAmount) : null,
|
||||||
ScheduledDate: scheduledDate || null,
|
ScheduledDate: scheduledDate || null,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue