mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-09-30 06:53:12 +00:00
Add Last Updated column to work order list
- Maps lastUpdated from API response - Formatted as YYYY-MM-DD HH:MM TZ, shows dash when never updated
This commit is contained in:
parent
7b544d26db
commit
4b44237b61
2 changed files with 10 additions and 0 deletions
|
|
@ -182,6 +182,15 @@ export default function Table({ loading, error, rows, onEdit, onDelete, page, se
|
|||
{ key: "assignedTo", label: "Assigned To", render: (val, row) => (
|
||||
<AssignDropdown value={val || row.employeeName} rowId={row.id} onUpdate={handleAssignUpdate} />
|
||||
)},
|
||||
{ key: "lastUpdated", label: "Last Updated", render: (val) => {
|
||||
if (!val) return "—";
|
||||
const d = new Date(val.endsWith("Z") ? val : val + "Z");
|
||||
if (isNaN(d)) return val;
|
||||
const date = d.toLocaleDateString("en-CA");
|
||||
const time = d.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit", hour12: false });
|
||||
const tz = d.toLocaleTimeString(undefined, { timeZoneName: "short" }).split(" ").pop();
|
||||
return `${date} ${time} ${tz}`;
|
||||
}},
|
||||
];
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export const fetchWorkOrdersPaged = async ({ search = "", page = 1, pageSize = 1
|
|||
createdDate: x.createdDate ?? x.CreatedDate ?? "",
|
||||
dueDate: x.dueDate ?? x.DueDate ?? "",
|
||||
assignedTo: x.assignedTo ?? x.AssignedTo ?? x.employeeName ?? x.EmployeeName ?? "",
|
||||
lastUpdated: x.lastUpdated ?? x.LastUpdated ?? "",
|
||||
}));
|
||||
return {
|
||||
rows,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue