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: add created by to properities sidebars

Brad Barbin8c003af24552
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx b/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx
index 766b640730..42fea3e5a7 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobProperties.tsx
@@ -23,7 +23,12 @@ import { RiProgress8Line } from "react-icons/ri";
import { Await, useFetcher, useParams } from "react-router";
import { z } from "zod";
import { zfd } from "zod-form-data";
-import { Assignee, Hyperlink, useOptimisticAssignment } from "~/components";
+import {
+ Assignee,
+ EmployeeAvatar,
+ Hyperlink,
+ useOptimisticAssignment
+} from "~/components";
import {
Customer,
Item,
@@ -536,6 +541,13 @@ const JobProperties = () => {
/>
</ValidatedForm>
+ <VStack spacing={2}>
+ <span className="text-xs font-medium text-muted-foreground">
+ Created By
+ </span>
+ <EmployeeAvatar employeeId={routeData?.job?.createdBy} />
+ </VStack>
+
<CustomFormInlineFields
customFields={
(routeData?.job?.customFields ?? {}) as Record<string, Json>
diff --git a/apps/erp/app/modules/purchasing/purchasing.service.ts b/apps/erp/app/modules/purchasing/purchasing.service.ts
index 43275d7024..d8b9008a4a 100644
--- a/apps/erp/app/modules/purchasing/purchasing.service.ts
+++ b/apps/erp/app/modules/purchasing/purchasing.service.ts
@@ -938,17 +938,26 @@ export async function finalizePurchaseOrder(
purchaseOrderId: string,
userId: string
) {
- const lines = await getPurchaseOrderLines(client, purchaseOrderId);
+ const [purchaseOrder, lines] = await Promise.all([
+ getPurchaseOrder(client, purchaseOrderId),
+ getPurchaseOrderLines(client, purchaseOrderId)
+ ]);
const { status } = getPurchaseOrderStatus(lines.data || []);
+ const updateData: Database["public"]["Tables"]["purchaseOrder"]["Update"] = {
+ status,
+ updatedAt: today(getLocalTimeZone()).toString(),
+ updatedBy: userId
+ };
+
+ // Only set orderDate if it's not already set
+ if (!purchaseOrder.data?.orderDate) {
+ updateData.orderDate = today(getLocalTimeZone()).toString();
+ }
+
return client
.from("purchaseOrder")
- .update({
- status,
- orderDate: today(getLocalTimeZone()).toString(),
- updatedAt: today(getLocalTimeZone()).toString(),
- updatedBy: userId
- })
+ .update(updateData)
.eq("id", purchaseOrderId);
}
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderProperties.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderProperties.tsx
index eaa9d2bf8b..106c2d32f3 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderProperties.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderProperties.tsx
@@ -24,7 +24,12 @@ import {
import { Link, useFetcher, useParams } from "react-router";
import { z } from "zod";
import { zfd } from "zod-form-data";
-import { Assignee, Hyperlink, useOptimisticAssignment } from "~/components";
+import {
+ Assignee,
+ EmployeeAvatar,
+ Hyperlink,
+ useOptimisticAssignment
+} from "~/components";
import {
Currency,
Location,
@@ -470,6 +475,14 @@ const PurchaseOrderProperties = () => {
</HStack>
</VStack>
)}
+
+ <VStack spacing={2}>
+ <span className="text-xs font-medium text-muted-foreground">
+ Created By
+ </span>
+ <EmployeeAvatar employeeId={routeData?.purchaseOrder?.createdBy} />
+ </VStack>
+
<CustomFormInlineFields
customFields={
(routeData?.purchaseOrder?.customFields ?? {}) as Record<string, Json>
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteProperties.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteProperties.tsx
index f2c092e44c..87878fce7a 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteProperties.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteProperties.tsx
@@ -16,7 +16,11 @@ import { LuCopy, LuInfo, LuLink, LuRefreshCcw } from "react-icons/lu";
import { useFetcher, useParams } from "react-router";
import { z } from "zod";
import { zfd } from "zod-form-data";
-import { Assignee, useOptimisticAssignment } from "~/components";
+import {
+ Assignee,
+ EmployeeAvatar,
+ useOptimisticAssignment
+} from "~/components";
import {
Currency,
Customer,
@@ -454,6 +458,13 @@ const QuoteProperties = () => {
</HStack>
</VStack>
)}
+ <VStack spacing={2}>
+ <span className="text-xs font-medium text-muted-foreground">
+ Created By
+ </span>
+ <EmployeeAvatar employeeId={routeData?.quote?.createdBy} />
+ </VStack>
+
<CustomFormInlineFields
customFields={
(routeData?.quote?.customFields ?? {}) as Record<string, Json>
diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderProperties.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderProperties.tsx
index de5c5cf17f..b35ceb0715 100644
--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderProperties.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderProperties.tsx
@@ -16,7 +16,11 @@ import { LuCopy, LuInfo, LuLink, LuRefreshCcw } from "react-icons/lu";
import { useFetcher, useParams } from "react-router";
import { z } from "zod";
import { zfd } from "zod-form-data";
-import { Assignee, useOptimisticAssignment } from "~/components";
+import {
+ Assignee,
+ EmployeeAvatar,
+ useOptimisticAssignment
+} from "~/components";
import {
Currency,
Customer,
@@ -460,6 +464,13 @@ const SalesOrderProperties = () => {
</HStack>
</VStack>
)}
+ <VStack spacing={2}>
+ <span className="text-xs font-medium text-muted-foreground">
+ Created By
+ </span>
+ <EmployeeAvatar employeeId={routeData?.salesOrder?.createdBy} />
+ </VStack>
+
<CustomFormInlineFields
customFields={
(routeData?.salesOrder?.customFields ?? {}) as Record<string, Json>