Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

style: turn promise date green when delivery date is on time

Brad Barbin611aff397768
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrdersTable.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrdersTable.tsx
index c03e6d53d3..0b990bdb76 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrdersTable.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrdersTable.tsx
@@ -128,22 +128,34 @@ const PurchaseOrdersTable = memo(
{
accessorKey: "receiptPromisedDate",
header: "Promised Date",
- cell: ({ row }) => (
- <span
- className={
- ["To Receive", "To Receive and Invoice", "Draft"].includes(
- row.original.status ?? ""
- ) &&
- row.original.receiptPromisedDate &&
- row.original.receiptPromisedDate <
- today(getLocalTimeZone()).toString()
- ? "text-red-500"
- : ""
- }
- >
- {formatDate(row.original.receiptPromisedDate)}
- </span>
- ),
+ cell: ({ row }) => {
+ const isReceivedOnTime =
+ row.original.deliveryDate &&
+ row.original.receiptPromisedDate &&
+ row.original.deliveryDate <= row.original.receiptPromisedDate;
+
+ const isOverdue =
+ ["To Receive", "To Receive and Invoice", "Draft"].includes(
+ row.original.status ?? ""
+ ) &&
+ row.original.receiptPromisedDate &&
+ row.original.receiptPromisedDate <
+ today(getLocalTimeZone()).toString();
+
+ return (
+ <span
+ className={
+ isReceivedOnTime
+ ? "text-emerald-500"
+ : isOverdue
+ ? "text-red-500"
+ : ""
+ }
+ >
+ {formatDate(row.original.receiptPromisedDate)}
+ </span>
+ );
+ },
meta: {
icon: <LuCalendar />,
},