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: realtime quote lines

Brad Barbin7cea207c7fa9
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteLineCosting.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteLineCosting.tsx
index 950b16b494..a57842abf0 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteLineCosting.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteLineCosting.tsx
@@ -1,5 +1,4 @@
import {
- Button,
Card,
CardContent,
CardHeader,
@@ -398,14 +397,14 @@ const QuoteLineCosting = ({
</Tr>
</Tbody>
<Tfoot>
- <Tr className="font-bold">
+ {/* <Tr className="font-bold">
<Td className="border-r border-border" />
{quantityCosts.map(({ quantity }) => (
<Td key={quantity} className="font-mono">
<Button variant="secondary">Add</Button>
</Td>
))}
- </Tr>
+ </Tr> */}
</Tfoot>
</Table>
</CardContent>
diff --git a/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx b/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
index a6b30fdace..87eeb0b150 100644
--- a/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
@@ -4,7 +4,7 @@ import { json, redirect } from "@remix-run/node";
import { Outlet, useLoaderData, useParams } from "@remix-run/react";
import { useMemo } from "react";
import type { Tree } from "~/components/TreeView";
-import { usePermissions, useRouteData } from "~/hooks";
+import { usePermissions, useRealtime, useRouteData } from "~/hooks";
import { CadModel } from "~/modules/items";
import type { QuoteMethod } from "~/modules/sales";
import {
@@ -131,6 +131,10 @@ export default function QuoteLine() {
if (!quoteId) throw new Error("Could not find quoteId");
if (!lineId) throw new Error("Could not find lineId");
+ useRealtime("quoteLine", `id=eq.${lineId}`);
+ useRealtime("quoteMaterial", `quoteLineId=eq.${lineId}`);
+ useRealtime("quoteOperation", `quoteLineId=eq.${lineId}`);
+
const quoteData = useRouteData<{ methods: Tree<QuoteMethod>[] }>(
path.to.quote(quoteId)
);
diff --git a/packages/database/supabase/migrations/20240802023246_realtime-quote-lines.sql b/packages/database/supabase/migrations/20240802023246_realtime-quote-lines.sql
new file mode 100644
index 0000000000..86c74f344d
--- /dev/null
+++ b/packages/database/supabase/migrations/20240802023246_realtime-quote-lines.sql
@@ -0,0 +1,3 @@
+ALTER publication supabase_realtime ADD TABLE "quoteLine";
+ALTER publication supabase_realtime ADD TABLE "quoteMaterial";
+ALTER publication supabase_realtime ADD TABLE "quoteOperation";
\ No newline at end of file