mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-03 19:03:15 +00:00
74 lines
2.1 KiB
JavaScript
74 lines
2.1 KiB
JavaScript
|
|
// Mock work orders data
|
||
|
|
const mockWorkOrders = [
|
||
|
|
{
|
||
|
|
id: 1,
|
||
|
|
workOrderNumber: "WO-001",
|
||
|
|
title: "HVAC System Maintenance",
|
||
|
|
location: "Springfield Office",
|
||
|
|
priority: "High",
|
||
|
|
status: "In Progress",
|
||
|
|
createdDate: "2024-01-15",
|
||
|
|
dueDate: "2024-01-22",
|
||
|
|
assignedTo: "John Anderson",
|
||
|
|
description: "Quarterly maintenance for HVAC system including filter replacement and inspection",
|
||
|
|
estimatedHours: 4,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: 2,
|
||
|
|
workOrderNumber: "WO-002",
|
||
|
|
title: "Electrical Repair",
|
||
|
|
location: "Chicago Distribution Center",
|
||
|
|
priority: "Medium",
|
||
|
|
status: "Open",
|
||
|
|
createdDate: "2024-01-16",
|
||
|
|
dueDate: "2024-01-25",
|
||
|
|
assignedTo: "Sarah Martinez",
|
||
|
|
description: "Fix faulty outlet in warehouse section C",
|
||
|
|
estimatedHours: 2,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id: 3,
|
||
|
|
workOrderNumber: "WO-003",
|
||
|
|
title: "Plumbing Issue",
|
||
|
|
location: "Indianapolis Warehouse",
|
||
|
|
priority: "Low",
|
||
|
|
status: "Completed",
|
||
|
|
createdDate: "2024-01-10",
|
||
|
|
dueDate: "2024-01-20",
|
||
|
|
assignedTo: "Mike Johnson",
|
||
|
|
description: "Repair leaking pipe in bathroom",
|
||
|
|
estimatedHours: 3,
|
||
|
|
},
|
||
|
|
];
|
||
|
|
|
||
|
|
export const getWorkOrders = async () => {
|
||
|
|
await new Promise(resolve => setTimeout(resolve, 300));
|
||
|
|
return [...mockWorkOrders];
|
||
|
|
};
|
||
|
|
|
||
|
|
export const getWorkOrderById = async (id) => {
|
||
|
|
await new Promise(resolve => setTimeout(resolve, 200));
|
||
|
|
return mockWorkOrders.find(w => w.id === parseInt(id));
|
||
|
|
};
|
||
|
|
|
||
|
|
export const addWorkOrder = async (workOrder) => {
|
||
|
|
await new Promise(resolve => setTimeout(resolve, 500));
|
||
|
|
const newWorkOrder = { id: mockWorkOrders.length + 1, ...workOrder };
|
||
|
|
mockWorkOrders.push(newWorkOrder);
|
||
|
|
return newWorkOrder;
|
||
|
|
};
|
||
|
|
|
||
|
|
export const editWorkOrder = async (workOrder) => {
|
||
|
|
await new Promise(resolve => setTimeout(resolve, 500));
|
||
|
|
const idx = mockWorkOrders.findIndex(w => w.id === workOrder.id);
|
||
|
|
if (idx >= 0) mockWorkOrders[idx] = workOrder;
|
||
|
|
return workOrder;
|
||
|
|
};
|
||
|
|
|
||
|
|
export const deleteWorkOrder = async (id) => {
|
||
|
|
await new Promise(resolve => setTimeout(resolve, 500));
|
||
|
|
const idx = mockWorkOrders.findIndex(w => w.id === id);
|
||
|
|
if (idx >= 0) mockWorkOrders.splice(idx, 1);
|
||
|
|
return true;
|
||
|
|
};
|