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.

feat: add purchase order assignment notification

Brad Barbin45cea0dc6d32
diff --git a/apps/carbon/app/components/Layout/Topbar/Notifications.tsx b/apps/carbon/app/components/Layout/Topbar/Notifications.tsx
index e120ddc6f5..4de73a549d 100644
--- a/apps/carbon/app/components/Layout/Topbar/Notifications.tsx
+++ b/apps/carbon/app/components/Layout/Topbar/Notifications.tsx
@@ -23,6 +23,7 @@ import {
LuHammer,
LuInbox,
LuMailCheck,
+ LuShoppingCart,
} from "react-icons/lu";
import {
RiProgress2Line,
@@ -121,6 +122,14 @@ function GenericNotification({
onClose: () => void;
}) {
switch (event) {
+ case NotificationEvent.PurchaseOrderAssignment:
+ return (
+ <Notification
+ icon={<LuShoppingCart />}
+ to={path.to.purchaseOrderDetails(id)}
+ {...props}
+ />
+ );
case NotificationEvent.SalesRfqAssignment:
return (
<Notification
@@ -203,6 +212,7 @@ const Notifications = () => {
if (isOpen && hasUnseenNotifications) {
markAllMessagesAsSeen();
}
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [hasUnseenNotifications, isOpen]);
return (
diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SuppliersTable.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SuppliersTable.tsx
index cd2d6a1df0..712f0a5ecb 100644
--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SuppliersTable.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SuppliersTable.tsx
@@ -1,6 +1,6 @@
-import { Button, MenuIcon, MenuItem } from "@carbon/react";
+import { MenuIcon, MenuItem } from "@carbon/react";
import { formatDate } from "@carbon/utils";
-import { Link, useNavigate } from "@remix-run/react";
+import { useNavigate } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import { memo, useMemo } from "react";
import {
@@ -8,7 +8,6 @@ import {
LuCalendar,
LuEuro,
LuGlobe,
- LuPackage,
LuPencil,
LuPhone,
LuPrinter,
@@ -119,20 +118,7 @@ const SuppliersTable = memo(
// </Button>
// ),
// },
- {
- id: "parts",
- header: "Parts",
- cell: ({ row }) => (
- <Button variant="secondary" asChild>
- <Link to={`${path.to.parts}?supplierId=${row.original.id}`}>
- {row.original.partCount ?? 0} Parts
- </Link>
- </Button>
- ),
- meta: {
- icon: <LuPackage />,
- },
- },
+
{
accessorKey: "currencyCode",
header: "Currency",
diff --git a/apps/carbon/app/novu/workflows.ts b/apps/carbon/app/novu/workflows.ts
index 3fdbd88312..a53f49517a 100644
--- a/apps/carbon/app/novu/workflows.ts
+++ b/apps/carbon/app/novu/workflows.ts
@@ -10,12 +10,13 @@ const payloadSchema = z.object({
recordId: z.string(),
description: z.string(),
event: z.enum([
- NotificationEvent.SalesRfqAssignment,
- NotificationEvent.QuoteAssignment,
- NotificationEvent.SalesOrderAssignment,
- NotificationEvent.JobAssignment,
NotificationEvent.DigitalQuoteResponse,
+ NotificationEvent.JobAssignment,
+ NotificationEvent.PurchaseOrderAssignment,
+ NotificationEvent.QuoteAssignment,
NotificationEvent.QuoteExpired,
+ NotificationEvent.SalesOrderAssignment,
+ NotificationEvent.SalesRfqAssignment,
]),
from: z.string().optional(),
});
diff --git a/apps/carbon/app/routes/api+/assign.ts b/apps/carbon/app/routes/api+/assign.ts
index 1a0031b6db..ac159ccc1d 100644
--- a/apps/carbon/app/routes/api+/assign.ts
+++ b/apps/carbon/app/routes/api+/assign.ts
@@ -71,6 +71,8 @@ function getNotificationEvent(table: string): NotificationEvent | null {
return NotificationEvent.SalesOrderAssignment;
case "job":
return NotificationEvent.JobAssignment;
+ case "purchaseOrder":
+ return NotificationEvent.PurchaseOrderAssignment;
default:
return null;
}
diff --git a/apps/carbon/app/trigger/notify.ts b/apps/carbon/app/trigger/notify.ts
index 621260115a..71e22512b5 100644
--- a/apps/carbon/app/trigger/notify.ts
+++ b/apps/carbon/app/trigger/notify.ts
@@ -43,10 +43,11 @@ export const notifyTask = task({
function getWorkflow(type: NotificationEvent) {
switch (type) {
- case NotificationEvent.SalesRfqAssignment:
+ case NotificationEvent.JobAssignment:
+ case NotificationEvent.PurchaseOrderAssignment:
case NotificationEvent.QuoteAssignment:
case NotificationEvent.SalesOrderAssignment:
- case NotificationEvent.JobAssignment:
+ case NotificationEvent.SalesRfqAssignment:
return NotificationWorkflow.Assignment;
case NotificationEvent.DigitalQuoteResponse:
return NotificationWorkflow.DigitalQuoteResponse;
diff --git a/packages/notifications/src/index.ts b/packages/notifications/src/index.ts
index 657ebc6f6e..4322f0f74b 100644
--- a/packages/notifications/src/index.ts
+++ b/packages/notifications/src/index.ts
@@ -9,12 +9,13 @@ export enum NotificationWorkflow {
}
export enum NotificationEvent {
- SalesRfqAssignment = "sales-rfq-assignment",
- QuoteAssignment = "quote-assignment",
- SalesOrderAssignment = "sales-order-assignment",
- JobAssignment = "job-assignment",
DigitalQuoteResponse = "digital-quote-response",
+ JobAssignment = "job-assignment",
+ PurchaseOrderAssignment = "purchase-order-assignment",
+ QuoteAssignment = "quote-assignment",
QuoteExpired = "quote-expired",
+ SalesOrderAssignment = "sales-order-assignment",
+ SalesRfqAssignment = "sales-rfq-assignment",
}
export enum NotificationType {