mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-09-30 04:33:11 +00:00
Map frontend form fields to backend DTO fields on work order edit
- Frontend uses workOrderNumber/title/assignedTo, backend expects WorkerOrderNumber/WorkerOrderTitle/AssignTo - Prevents null overwrite of existing data on save
This commit is contained in:
parent
d979d5571a
commit
dc8c8b68f3
1 changed files with 13 additions and 1 deletions
|
|
@ -49,7 +49,19 @@ export const addWorkOrder = async (workOrder) => {
|
|||
|
||||
export const editWorkOrder = async (workOrder) => {
|
||||
try {
|
||||
return await workOrderApi.update(workOrder.id, workOrder);
|
||||
return await workOrderApi.update(workOrder.id, {
|
||||
Id: workOrder.id,
|
||||
WorkerOrderNumber: workOrder.workOrderNumber,
|
||||
WorkerOrderTitle: workOrder.title,
|
||||
Description: workOrder.description,
|
||||
PO: workOrder.po,
|
||||
TT: workOrder.tt,
|
||||
AssignTo: workOrder.assignedTo || null,
|
||||
DueDate: workOrder.dueDate || null,
|
||||
Priority: workOrder.priority || null,
|
||||
Status: workOrder.status,
|
||||
LocationId: workOrder.locationId ? parseInt(workOrder.locationId) : null,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error updating work order:", error);
|
||||
throw error;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue