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: redirect to lines when create is from purchase order

Brad Barbin8fa62a317917
diff --git a/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptLines.tsx b/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptLines.tsx
index c1547bbb97..94b7fd9384 100644
--- a/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptLines.tsx
+++ b/apps/carbon/app/modules/inventory/ui/Receipts/ReceiptLines.tsx
@@ -13,6 +13,7 @@ import Grid from "~/components/Grid";
import { useRealtime, useRouteData } from "~/hooks";
import { useSupabase } from "~/lib/supabase";
import type { Receipt, ReceiptLine } from "~/modules/inventory";
+import { useParts } from "~/stores";
import type { ListItem } from "~/types";
import { path } from "~/utils/path";
@@ -29,6 +30,8 @@ const ReceiptLines = () => {
locations: ListItem[];
}>(path.to.receipt(receiptId));
+ const [parts] = useParts();
+
const receiptLineColumns = useMemo<ColumnDef<ReceiptLine>[]>(() => {
return [
{
@@ -36,6 +39,17 @@ const ReceiptLines = () => {
header: "Part",
cell: (item) => item.getValue(),
},
+ {
+ header: "Name",
+ cell: ({ row }) => {
+ return parts.find((p) => p.id === row.original.partId)?.name ?? null;
+ },
+ },
+ {
+ accessorKey: "receivedQuantity",
+ header: "Received Quantity",
+ cell: (item) => item.getValue(),
+ },
{
accessorKey: "orderQuantity",
header: "Order Quantity",
@@ -46,11 +60,6 @@ const ReceiptLines = () => {
header: "Outstanding Quantity",
cell: (item) => item.getValue(),
},
- {
- accessorKey: "receivedQuantity",
- header: "Received Quantity",
- cell: (item) => item.getValue(),
- },
{
accessorKey: "unitPrice",
header: "Unit Cost",
@@ -75,7 +84,7 @@ const ReceiptLines = () => {
cell: (item) => item.getValue(),
},
];
- }, [routeData?.locations]);
+ }, [routeData?.locations, parts]);
const onCellEdit = useCallback(
async (id: string, value: unknown, row: ReceiptLine) => {
diff --git a/apps/carbon/app/root.tsx b/apps/carbon/app/root.tsx
index 0de5fe6fd2..0171cbc25c 100644
--- a/apps/carbon/app/root.tsx
+++ b/apps/carbon/app/root.tsx
@@ -1,5 +1,5 @@
// root.tsx
-import { Button, Heading, toast } from "@carbon/react";
+import { Button, Heading, Toaster, toast } from "@carbon/react";
import { validator } from "@carbon/remix-validated-form";
import type {
ActionFunctionArgs,
@@ -121,6 +121,7 @@ function Document({
<ScrollRestoration />
<Scripts />
<Analytics />
+ <Toaster />
{process.env.NODE_ENV === "development" && <LiveReload />}
</body>
</html>
@@ -141,6 +142,7 @@ export default function App() {
}
}, [result]);
+ /* Dark/Light Mode */
const mode = useMode();
return (
diff --git a/apps/carbon/app/routes/x+/_layout.tsx b/apps/carbon/app/routes/x+/_layout.tsx
index 02589c9ef5..2aefd5176f 100644
--- a/apps/carbon/app/routes/x+/_layout.tsx
+++ b/apps/carbon/app/routes/x+/_layout.tsx
@@ -113,22 +113,6 @@ export default function AuthenticatedRoute() {
</div>
</div>
</div>
- {/* <div className="h-screen min-h-[0px] basis-0 flex-1">
- <div className="flex h-full">
- <IconSidebar />
- <div className="w-full h-full">
- <div className="grid grid-rows-[auto_1fr] h-full w-full">
- <Topbar />
- <div className="flex w-full h-full">
- <VStack spacing={0} className="bg-muted">
- <Outlet />
- </VStack>
- </div>
- </div>
- </div>
- </div>
- <Toaster />
- </div> */}
</TooltipProvider>
</RealtimeDataProvider>
</SupabaseProvider>
diff --git a/apps/carbon/app/routes/x+/receipt+/new.tsx b/apps/carbon/app/routes/x+/receipt+/new.tsx
index f131deb2ee..6997025c27 100644
--- a/apps/carbon/app/routes/x+/receipt+/new.tsx
+++ b/apps/carbon/app/routes/x+/receipt+/new.tsx
@@ -43,7 +43,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
);
}
- throw redirect(path.to.receipt(purchaseOrderReceipt.data.id));
+ throw redirect(path.to.receiptLines(purchaseOrderReceipt.data.id));
default:
const defaultReceipt = await serviceRole.functions.invoke<{
id: string;
@@ -60,6 +60,6 @@ export async function loader({ request }: LoaderFunctionArgs) {
);
}
- throw redirect(path.to.receipt(defaultReceipt.data.id));
+ throw redirect(path.to.receiptDetails(defaultReceipt.data.id));
}
}
diff --git a/apps/carbon/app/utils/path.ts b/apps/carbon/app/utils/path.ts
index 6295a18c8e..77698aabae 100644
--- a/apps/carbon/app/utils/path.ts
+++ b/apps/carbon/app/utils/path.ts
@@ -446,9 +446,10 @@ export const path = {
quoteRelease: (id: string) => generatePath(`${x}/quote/${id}/release`),
quotes: `${x}/sales/quotes`,
receipt: (id: string) => generatePath(`${x}/receipt/${id}`),
+ receiptInvoice: (id: string) => generatePath(`${x}/receipt/${id}/invoice`),
receiptDetails: (id: string) => generatePath(`${x}/receipt/${id}/details`),
+ receiptLines: (id: string) => generatePath(`${x}/receipt/${id}/lines`),
receipts: `${x}/inventory/receipts`,
- receiptInvoice: (id: string) => generatePath(`${x}/receipt/${id}/invoice`),
receiptPost: (id: string) =>
generatePath(`${x}/inventory/receipts/${id}/post`),
receiptRoot: `${x}/receipt`,