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 task primitive to attributes and rename attribtues to steps

Brad Barbin20cf1f2d36d1
diff --git a/apps/erp/app/components/Icons.tsx b/apps/erp/app/components/Icons.tsx
index 1a4d0b03a1..afb2d04f71 100644
--- a/apps/erp/app/components/Icons.tsx
+++ b/apps/erp/app/components/Icons.tsx
@@ -9,6 +9,7 @@ import {
LuCircle,
LuCircleCheck,
LuCircleX,
+ LuClipboardCheck,
LuClock,
LuClock3,
LuExternalLink,
@@ -185,6 +186,8 @@ export const ProcedureAttributeTypeIcon = ({
className?: string;
}) => {
switch (type) {
+ case "Task":
+ return <LuClipboardCheck className={cn("text-amber-500", className)} />;
case "Value":
return <LuQrCode className={cn("text-foreground", className)} />;
case "Measurement":
diff --git a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
index c86eac5bbd..f7bd434a92 100644
--- a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
+++ b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx
@@ -21,6 +21,7 @@ import {
HStack,
IconButton,
Label,
+ Loading,
ToggleGroup,
ToggleGroupItem,
Tooltip,
@@ -28,6 +29,7 @@ import {
TooltipTrigger,
VStack,
cn,
+ toast,
useDebounce,
useDisclosure,
useThrottle,
@@ -48,13 +50,13 @@ import {
LuHammer,
LuInfo,
LuList,
- LuMinimize2,
LuMaximize2,
+ LuMinimize2,
LuSettings2,
LuSquareFunction,
LuTriangleAlert,
- LuX,
LuWaypoints,
+ LuX,
} from "react-icons/lu";
import { z } from "zod";
import { DirectionAwareTabs, EmployeeAvatar, TimeTypeIcon } from "~/components";
@@ -104,18 +106,18 @@ import {
import type { action as editMethodOperationAttributeAction } from "~/routes/x+/items+/methods+/operation.attribute.$id";
import type { action as editMethodOperationParameterAction } from "~/routes/x+/items+/methods+/operation.parameter.$id";
+import type { action as newMethodOperationParameterAction } from "~/routes/x+/items+/methods+/operation.parameter.new";
import type { action as editMethodOperationToolAction } from "~/routes/x+/items+/methods+/operation.tool.$id";
import type { action as newMethodOperationToolAction } from "~/routes/x+/items+/methods+/operation.tool.new";
-import type { action as newMethodOperationParameterAction } from "~/routes/x+/items+/methods+/operation.parameter.new";
+import Procedure from "~/components/Form/Procedure";
+import { SupplierProcessPreview } from "~/components/Form/SupplierProcess";
+import { useUnitOfMeasure } from "~/components/Form/UnitOfMeasure";
+import { ProcedureAttributeTypeIcon } from "~/components/Icons";
import { useTools } from "~/stores";
import { getPrivateUrl, path } from "~/utils/path";
import { methodOperationValidator } from "../../items.models";
import type { ConfigurationParameter, ConfigurationRule } from "../../types";
-import { ProcedureAttributeTypeIcon } from "~/components/Icons";
-import { useUnitOfMeasure } from "~/components/Form/UnitOfMeasure";
-import Procedure from "~/components/Form/Procedure";
-import { SupplierProcessPreview } from "~/components/Form/SupplierProcess";
type Operation = z.infer<typeof methodOperationValidator> & {
workInstruction: JSONContent | null;
@@ -550,7 +552,7 @@ const BillOfProcess = ({
disabled: hasProcedure || item.data.operationType === "Outside",
label: (
<span className="flex items-center gap-2">
- <span>Attributes</span>
+ <span>Steps</span>
{hasProcedure && (
<Tooltip>
<TooltipTrigger>
@@ -1653,7 +1655,8 @@ function AttributesForm({
onConfigure?: (c: Configuration) => void;
}) {
const fetcher = useFetcher<typeof newMethodOperationParameterAction>();
- const [type, setType] = useState<OperationAttribute["type"]>("Value");
+ const [type, setType] = useState<OperationAttribute["type"]>("Task");
+ const [description, setDescription] = useState<JSONContent>({});
const [numericControls, setNumericControls] = useState<string[]>([]);
const typeOptions = useMemo(
() =>
@@ -1669,6 +1672,29 @@ function AttributesForm({
[]
);
+ const { carbon } = useCarbon();
+ const {
+ company: { id: companyId },
+ } = useUser();
+
+ const onUploadImage = async (file: File) => {
+ const fileType = file.name.split(".").pop();
+ const fileName = `${companyId}/parts/${nanoid()}.${fileType}`;
+
+ const result = await carbon?.storage.from("private").upload(fileName, file);
+
+ if (result?.error) {
+ toast.error("Failed to upload image");
+ throw new Error(result.error.message);
+ }
+
+ if (!result?.data) {
+ throw new Error("Failed to upload image");
+ }
+
+ return getPrivateUrl(result.data.path);
+ };
+
if (isDisabled && isTemporaryId(operationId)) {
return (
<Alert className="max-w-[420px] mx-auto my-8">
@@ -1682,8 +1708,12 @@ function AttributesForm({
}
return (
- <div className="flex flex-col gap-6">
- <div className="p-6 border rounded-lg">
+ <Loading
+ className="flex flex-col gap-6"
+ isLoading={fetcher.state !== "idle"}
+ // this is a hack to re-render the editor component when the form is submitted with the default values
+ >
+ <div className="p-6 border rounded-lg mb-6">
<ValidatedForm
action={path.to.newMethodOperationAttribute}
method="post"
@@ -1693,8 +1723,8 @@ function AttributesForm({
defaultValues={{
id: undefined,
name: "",
- description: "",
- type: "Value",
+ description: {},
+ type: "Task",
unitOfMeasureCode: "",
minValue: 0,
maxValue: 0,
@@ -1707,12 +1737,14 @@ function AttributesForm({
operationId,
}}
onSubmit={() => {
- setType("Value");
+ setType("Task");
+ setDescription({});
}}
className="w-full"
>
<Hidden name="operationId" />
<Hidden name="sortOrder" />
+ <Hidden name="description" value={JSON.stringify(description)} />
<VStack spacing={4}>
<div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">
<SelectControlled
@@ -1729,6 +1761,18 @@ function AttributesForm({
<Input name="name" label="Name" />
</div>
+ <VStack spacing={2} className="w-full col-span-2">
+ <Label>Description</Label>
+ <Editor
+ initialValue={description}
+ onUpload={onUploadImage}
+ onChange={(value) => {
+ setDescription(value);
+ }}
+ className="[&_.is-empty]:text-muted-foreground min-h-[120px] p-4 rounded-lg border w-full"
+ />
+ </VStack>
+
{type === "Measurement" && (
<div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">
<UnitOfMeasure
@@ -1783,7 +1827,7 @@ function AttributesForm({
isDisabled={isDisabled || fetcher.state !== "idle"}
isLoading={fetcher.state !== "idle"}
>
- Add Attribute
+ Add Step
</Submit>
</VStack>
</ValidatedForm>
@@ -1807,7 +1851,7 @@ function AttributesForm({
))}
</div>
)}
- </div>
+ </Loading>
);
}
@@ -1872,6 +1916,32 @@ function AttributesListItem({
const date = updatedAt ?? createdAt;
const unitOfMeasures = useUnitOfMeasure();
+ const [description, setDescription] = useState<JSONContent>(
+ attribute.description ?? {}
+ );
+
+ const { carbon } = useCarbon();
+ const {
+ company: { id: companyId },
+ } = useUser();
+
+ const onUploadImage = async (file: File) => {
+ const fileType = file.name.split(".").pop();
+ const fileName = `${companyId}/parts/${nanoid()}.${fileType}`;
+
+ const result = await carbon?.storage.from("private").upload(fileName, file);
+
+ if (result?.error) {
+ toast.error("Failed to upload image");
+ throw new Error(result.error.message);
+ }
+
+ if (!result?.data) {
+ throw new Error("Failed to upload image");
+ }
+
+ return getPrivateUrl(result.data.path);
+ };
if (!id) return null;
@@ -1900,6 +1970,7 @@ function AttributesListItem({
className="w-full"
>
<Hidden name="operationId" />
+ <Hidden name="description" value={JSON.stringify(description)} />
<VStack spacing={4}>
<div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">
<SelectControlled
@@ -1914,7 +1985,19 @@ function AttributesListItem({
/>
<Input name="name" label="Name" />
</div>
- <Input name="description" label="Description" />
+
+ <VStack spacing={2} className="w-full col-span-2">
+ <Label>Description</Label>
+ <Editor
+ initialValue={description}
+ onUpload={onUploadImage}
+ onChange={(value) => {
+ setDescription(value);
+ }}
+ className="[&_.is-empty]:text-muted-foreground min-h-[120px] p-4 rounded-lg border w-full"
+ />
+ </VStack>
+
{type === "Measurement" && (
<div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">
<UnitOfMeasure
@@ -2046,9 +2129,12 @@ function AttributesListItem({
<LuInfo className="text-muted-foreground size-3" />
</TooltipTrigger>
<TooltipContent side="right">
- <p className="text-foreground text-sm">
- {attribute.description}
- </p>
+ <p
+ className="prose prose-sm dark:prose-invert text-foreground text-sm"
+ dangerouslySetInnerHTML={{
+ __html: generateHTML(attribute.description),
+ }}
+ />
</TooltipContent>
</Tooltip>
)}
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
index 76e2ff1b60..8d2fb2ffd7 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
@@ -15,6 +15,7 @@ import {
CardContent,
CardHeader,
CardTitle,
+ Checkbox,
Count,
DropdownMenu,
DropdownMenuContent,
@@ -39,10 +40,10 @@ import {
TooltipTrigger,
VStack,
cn,
+ toast,
useDebounce,
useDisclosure,
useMount,
- Checkbox,
} from "@carbon/react";
import { Editor, generateHTML } from "@carbon/react/Editor";
import {
@@ -67,8 +68,8 @@ import {
LuHammer,
LuInfo,
LuMaximize2,
- LuPaperclip,
LuMinimize2,
+ LuPaperclip,
LuRefreshCcw,
LuSend,
LuSettings2,
@@ -122,10 +123,17 @@ import {
import type { action as editJobOperationAttributeAction } from "~/routes/x+/job+/methods+/operation.attribute.$id";
import type { action as editJobOperationParameterAction } from "~/routes/x+/job+/methods+/operation.parameter.$id";
-import type { action as editJobOperationToolAction } from "~/routes/x+/job+/methods+/operation.tool.$id";
import type { action as newJobOperationParameterAction } from "~/routes/x+/job+/methods+/operation.parameter.new";
+import type { action as editJobOperationToolAction } from "~/routes/x+/job+/methods+/operation.tool.$id";
import type { action as newJobOperationToolAction } from "~/routes/x+/job+/methods+/operation.tool.new";
+import { useNumberFormatter } from "@react-aria/i18n";
+import Procedure from "~/components/Form/Procedure";
+import { SupplierProcessPreview } from "~/components/Form/SupplierProcess";
+import UnitOfMeasure, {
+ useUnitOfMeasure,
+} from "~/components/Form/UnitOfMeasure";
+import { ProcedureAttributeTypeIcon } from "~/components/Icons";
import { usePeople, useTools } from "~/stores";
import { getPrivateUrl, path } from "~/utils/path";
import {
@@ -135,14 +143,7 @@ import {
} from "../../production.models";
import { getProductionEventsPage } from "../../production.service";
import type { Job, JobOperation } from "../../types";
-import UnitOfMeasure, {
- useUnitOfMeasure,
-} from "~/components/Form/UnitOfMeasure";
import { JobOperationStatus, JobOperationTags } from "./JobOperationStatus";
-import { ProcedureAttributeTypeIcon } from "~/components/Icons";
-import Procedure from "~/components/Form/Procedure";
-import { useNumberFormatter } from "@react-aria/i18n";
-import { SupplierProcessPreview } from "~/components/Form/SupplierProcess";
export type Operation = z.infer<typeof jobOperationValidator> & {
assignee: string | null;
@@ -773,7 +774,7 @@ const JobBillOfProcess = ({
disabled: item.data.operationType === "Outside",
label: (
<span className="flex items-center gap-2">
- <span>Attributes</span>
+ <span>Steps</span>
{attributes.length > 0 && <Count count={attributes.length} />}
</span>
),
@@ -990,7 +991,6 @@ export default JobBillOfProcess;
function isTemporaryId(id: string) {
return id.length < 20;
}
-
function AttributesForm({
operationId,
isDisabled,
@@ -1001,7 +1001,8 @@ function AttributesForm({
attributes: JobOperationAttribute[];
}) {
const fetcher = useFetcher<typeof newJobOperationParameterAction>();
- const [type, setType] = useState<OperationAttribute["type"]>("Value");
+ const [type, setType] = useState<OperationAttribute["type"]>("Task");
+ const [description, setDescription] = useState<JSONContent>({});
const [numericControls, setNumericControls] = useState<string[]>([]);
const typeOptions = useMemo(
() =>
@@ -1017,6 +1018,29 @@ function AttributesForm({
[]
);
+ const { carbon } = useCarbon();
+ const {
+ company: { id: companyId },
+ } = useUser();
+
+ const onUploadImage = async (file: File) => {
+ const fileType = file.name.split(".").pop();
+ const fileName = `${companyId}/parts/${nanoid()}.${fileType}`;
+
+ const result = await carbon?.storage.from("private").upload(fileName, file);
+
+ if (result?.error) {
+ toast.error("Failed to upload image");
+ throw new Error(result.error.message);
+ }
+
+ if (!result?.data) {
+ throw new Error("Failed to upload image");
+ }
+
+ return getPrivateUrl(result.data.path);
+ };
+
if (isDisabled && isTemporaryId(operationId)) {
return (
<Alert className="max-w-[420px] mx-auto my-8">
@@ -1030,8 +1054,11 @@ function AttributesForm({
}
return (
- <div className="flex flex-col gap-6">
- <div className="p-6 border rounded-lg">
+ <Loading
+ className="flex flex-col gap-6"
+ isLoading={fetcher.state !== "idle"}
+ >
+ <div className="p-6 border rounded-lg mb-6">
<ValidatedForm
action={path.to.newJobOperationAttribute}
method="post"
@@ -1042,7 +1069,7 @@ function AttributesForm({
id: undefined,
name: "",
description: "",
- type: "Value",
+ type: "Task",
unitOfMeasureCode: "",
minValue: 0,
maxValue: 0,
@@ -1061,6 +1088,7 @@ function AttributesForm({
>
<Hidden name="operationId" />
<Hidden name="sortOrder" />
+ <Hidden name="description" value={JSON.stringify(description)} />
<VStack spacing={4}>
<div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">
<SelectControlled
@@ -1077,6 +1105,18 @@ function AttributesForm({
<Input name="name" label="Name" />
</div>
+ <VStack spacing={2} className="w-full col-span-2">
+ <Label>Description</Label>
+ <Editor
+ initialValue={description}
+ onUpload={onUploadImage}
+ onChange={(value) => {
+ setDescription(value);
+ }}
+ className="[&_.is-empty]:text-muted-foreground min-h-[120px] p-4 rounded-lg border w-full"
+ />
+ </VStack>
+
{type === "Measurement" && (
<div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">
<UnitOfMeasure
@@ -1131,14 +1171,14 @@ function AttributesForm({
isDisabled={isDisabled || fetcher.state !== "idle"}
isLoading={fetcher.state !== "idle"}
>
- Add Attribute
+ Add Step
</Submit>
</VStack>
</ValidatedForm>
</div>
{attributes.length > 0 && (
- <div className="border rounded-lg">
+ <div className="border rounded-lg ">
{[...attributes]
.sort((a, b) => (a.sortOrder ?? 0) - (b.sortOrder ?? 0))
.map((a, index) => (
@@ -1152,7 +1192,7 @@ function AttributesForm({
))}
</div>
)}
- </div>
+ </Loading>
);
}
@@ -1183,6 +1223,13 @@ function AttributesListItem({
const deleteModalDisclosure = useDisclosure();
const submitted = useRef(false);
const fetcher = useFetcher<typeof editJobOperationAttributeAction>();
+ const [description, setDescription] = useState<JSONContent>(() => {
+ try {
+ return attribute.description ? JSON.parse(attribute.description) : {};
+ } catch (e) {
+ return {};
+ }
+ });
useEffect(() => {
if (submitted.current && fetcher.state === "idle") {
@@ -1211,6 +1258,28 @@ function AttributesListItem({
const date = updatedAt ?? createdAt;
const unitOfMeasures = useUnitOfMeasure();
+ const { carbon } = useCarbon();
+ const {
+ company: { id: companyId },
+ } = useUser();
+
+ const onUploadImage = async (file: File) => {
+ const fileType = file.name.split(".").pop();
+ const fileName = `${companyId}/parts/${nanoid()}.${fileType}`;
+
+ const result = await carbon?.storage.from("private").upload(fileName, file);
+
+ if (result?.error) {
+ toast.error("Failed to upload image");
+ throw new Error(result.error.message);
+ }
+
+ if (!result?.data) {
+ throw new Error("Failed to upload image");
+ }
+
+ return getPrivateUrl(result.data.path);
+ };
if (!id) return null;
@@ -1233,6 +1302,7 @@ function AttributesListItem({
className="w-full"
>
<Hidden name="operationId" />
+ <Hidden name="description" value={JSON.stringify(description)} />
<VStack spacing={4}>
<div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">
<SelectControlled
@@ -1247,7 +1317,19 @@ function AttributesListItem({
/>
<Input name="name" label="Name" />
</div>
- <Input name="description" label="Description" />
+
+ <VStack spacing={2} className="w-full col-span-2">
+ <Label>Description</Label>
+ <Editor
+ initialValue={description}
+ onUpload={onUploadImage}
+ onChange={(value) => {
+ setDescription(value);
+ }}
+ className="[&_.is-empty]:text-muted-foreground min-h-[120px] p-4 rounded-lg border w-full"
+ />
+ </VStack>
+
{type === "Measurement" && (
<div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">
<UnitOfMeasure
diff --git a/apps/erp/app/modules/production/ui/Procedures/ProcedureExplorer.tsx b/apps/erp/app/modules/production/ui/Procedures/ProcedureExplorer.tsx
index 1b2674f664..de6aaf5621 100644
--- a/apps/erp/app/modules/production/ui/Procedures/ProcedureExplorer.tsx
+++ b/apps/erp/app/modules/production/ui/Procedures/ProcedureExplorer.tsx
@@ -1,3 +1,4 @@
+import { useCarbon } from "@carbon/auth";
import {
Array as ArrayInput,
Hidden,
@@ -5,73 +6,76 @@ import {
Number,
SelectControlled,
Submit,
- TextArea,
ValidatedForm,
} from "@carbon/form";
+import type { JSONContent } from "@carbon/react";
import {
Button,
- HStack,
- Kbd,
+ cn,
Drawer,
DrawerBody,
DrawerContent,
- DrawerTitle,
- DrawerHeader,
- Tooltip,
- TooltipContent,
- TooltipTrigger,
- useDisclosure,
- useKeyboardShortcuts,
- VStack,
- ToggleGroup,
- ToggleGroupItem,
DrawerFooter,
- IconButton,
+ DrawerHeader,
+ DrawerTitle,
DropdownMenu,
DropdownMenuContent,
DropdownMenuIcon,
DropdownMenuItem,
DropdownMenuTrigger,
- useDebounce,
- cn,
+ HStack,
+ IconButton,
+ Kbd,
+ Label,
Tabs,
TabsContent,
TabsList,
TabsTrigger,
+ toast,
+ ToggleGroup,
+ ToggleGroupItem,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+ useDebounce,
+ useDisclosure,
+ useKeyboardShortcuts,
+ VStack,
} from "@carbon/react";
+import { Editor } from "@carbon/react/Editor";
import { prettifyKeyboardShortcut } from "@carbon/utils";
import { useFetcher, useParams } from "@remix-run/react";
+import { Reorder } from "framer-motion";
+import { nanoid } from "nanoid";
import { useEffect, useMemo, useRef, useState } from "react";
+import { flushSync } from "react-dom";
import {
LuActivity,
LuCirclePlus,
LuEllipsisVertical,
LuGripVertical,
- LuInfo,
LuMaximize2,
LuMinimize2,
LuPencil,
LuTrash,
} from "react-icons/lu";
+import type { z } from "zod";
import { Empty } from "~/components";
-import { usePermissions, useRouteData } from "~/hooks";
-import { path } from "~/utils/path";
-import type {
- Procedure,
- ProcedureAttribute,
- ProcedureParameter,
-} from "../../types";
+import { UnitOfMeasure } from "~/components/Form";
+import { ProcedureAttributeTypeIcon } from "~/components/Icons";
import { ConfirmDelete } from "~/components/Modals";
+import { usePermissions, useRouteData, useUser } from "~/hooks";
+import { procedureAttributeType } from "~/modules/shared";
+import { getPrivateUrl, path } from "~/utils/path";
import {
procedureAttributeValidator,
procedureParameterValidator,
} from "../../production.models";
-import { ProcedureAttributeTypeIcon } from "~/components/Icons";
-import { UnitOfMeasure } from "~/components/Form";
-import type { z } from "zod";
-import { Reorder } from "framer-motion";
-import { flushSync } from "react-dom";
-import { procedureAttributeType } from "~/modules/shared";
+import type {
+ Procedure,
+ ProcedureAttribute,
+ ProcedureParameter,
+} from "../../types";
export default function ProcedureExplorer() {
const { id } = useParams();
@@ -111,8 +115,8 @@ export default function ProcedureExplorer() {
id: selectedAttribute?.id,
procedureId: id,
name: selectedAttribute?.name ?? "",
- description: selectedAttribute?.description ?? "",
- type: selectedAttribute?.type ?? "Measurement",
+ description: selectedAttribute?.description ?? {},
+ type: selectedAttribute?.type ?? "Task",
sortOrder: selectedAttribute?.sortOrder ?? maxSortOrder + 1,
unitOfMeasureCode: selectedAttribute?.unitOfMeasureCode ?? "",
minValue: selectedAttribute ? selectedAttribute?.minValue ?? undefined : 0,
@@ -242,7 +246,7 @@ export default function ProcedureExplorer() {
>
<div className="w-full p-2">
<TabsList className="w-full grid grid-cols-2">
- <TabsTrigger value="attributes">Attributes</TabsTrigger>
+ <TabsTrigger value="attributes">Steps</TabsTrigger>
<TabsTrigger value="parameters">Parameters</TabsTrigger>
</TabsList>
</div>
@@ -292,7 +296,7 @@ export default function ProcedureExplorer() {
procedureAttributeDisclosure.onOpen();
}}
>
- Add Attribute
+ Add Step
</Button>
)}
</Empty>
@@ -316,12 +320,12 @@ export default function ProcedureExplorer() {
procedureAttributeDisclosure.onOpen();
}}
>
- Add Attribute
+ Add Step
</Button>
</TooltipTrigger>
<TooltipContent>
<HStack>
- <span>Add Attribute</span>
+ <span>Add Step</span>
<Kbd>{prettifyKeyboardShortcut("Command+Shift+a")}</Kbd>
</HStack>
</TooltipContent>
@@ -402,6 +406,7 @@ export default function ProcedureExplorer() {
</VStack>
{procedureAttributeDisclosure.isOpen && (
<ProcedureAttributeForm
+ // @ts-ignore
initialValues={procedureAttribtueInitialValues}
isDisabled={isDisabled}
onClose={procedureAttributeDisclosure.onClose}
@@ -446,7 +451,6 @@ function ProcedureAttributeItem({
const { id } = useParams();
if (!id) throw new Error("Could not find id");
const permissions = usePermissions();
-
if (!attribute || !attribute.id || !attribute.name) return null;
return (
@@ -478,18 +482,6 @@ function ProcedureAttributeItem({
<VStack spacing={0} className="flex-grow">
<HStack>
<p className="text-foreground text-sm">{attribute.name}</p>
- {attribute.description && (
- <Tooltip>
- <TooltipTrigger>
- <LuInfo className="text-muted-foreground size-3" />
- </TooltipTrigger>
- <TooltipContent side="right">
- <p className="text-foreground text-sm">
- {attribute.description}
- </p>
- </TooltipContent>
- </Tooltip>
- )}
</HStack>
{(attribute.minValue !== null || attribute.maxValue !== null) && (
<p className="text-muted-foreground text-xs">
@@ -525,7 +517,7 @@ function ProcedureAttributeItem({
}}
>
<DropdownMenuIcon icon={<LuPencil />} />
- Edit Attribute
+ Edit Step
</DropdownMenuItem>
<DropdownMenuItem
destructive
@@ -634,7 +626,6 @@ function ProcedureParameterItem({
</VStack>
);
}
-
function ProcedureAttributeForm({
initialValues,
isDisabled,
@@ -650,6 +641,7 @@ function ProcedureAttributeForm({
const [type, setType] = useState<ProcedureAttribute["type"]>(
initialValues.type
);
+
const [numericControls, setNumericControls] = useState<string[]>(() => {
const controls = [];
if (initialValues.type === "Measurement") {
@@ -663,6 +655,30 @@ function ProcedureAttributeForm({
return controls;
});
+ // Fix for JSON parsing error - safely parse description or use empty object
+ const [description, setDescription] = useState<JSONContent>(() => {
+ try {
+ // Handle both string and object cases
+ if (typeof initialValues.description === "string") {
+ return JSON.parse(initialValues.description || "{}") as JSONContent;
+ } else if (
+ initialValues.description &&
+ typeof initialValues.description === "object"
+ ) {
+ return initialValues.description as JSONContent;
+ }
+ return {} as JSONContent;
+ } catch (e) {
+ console.error("Error parsing description:", e);
+ return {} as JSONContent;
+ }
+ });
+
+ const { carbon } = useCarbon();
+ const {
+ company: { id: companyId },
+ } = useUser();
+
const fetcher = useFetcher<{
success: boolean;
}>();
@@ -689,6 +705,24 @@ function ProcedureAttributeForm({
const isEditing = !!initialValues.id;
+ const onUploadImage = async (file: File) => {
+ const fileType = file.name.split(".").pop();
+ const fileName = `${companyId}/parts/${nanoid()}.${fileType}`;
+
+ const result = await carbon?.storage.from("private").upload(fileName, file);
+
+ if (result?.error) {
+ toast.error("Failed to upload image");
+ throw new Error(result.error.message);
+ }
+
+ if (!result?.data) {
+ throw new Error("Failed to upload image");
+ }
+
+ return getPrivateUrl(result.data.path);
+ };
+
return (
<Drawer
open
@@ -712,14 +746,13 @@ function ProcedureAttributeForm({
className="flex flex-col h-full"
>
<DrawerHeader>
- <DrawerTitle>
- {isEditing ? "Edit Attribute" : "Add Attribute"}
- </DrawerTitle>
+ <DrawerTitle>{isEditing ? "Edit Step" : "Add Step"}</DrawerTitle>
</DrawerHeader>
<DrawerBody>
<Hidden name="procedureId" />
<Hidden name="sortOrder" />
<Hidden name="id" />
+ <Hidden name="description" value={JSON.stringify(description)} />
<VStack spacing={4}>
<SelectControlled
name="type"
@@ -733,7 +766,17 @@ function ProcedureAttributeForm({
}}
/>
<Input name="name" label="Name" />
- <TextArea name="description" label="Description" />
+ <VStack spacing={2} className="w-full">
+ <Label>Description</Label>
+ <Editor
+ initialValue={description}
+ onUpload={onUploadImage}
+ onChange={(value) => {
+ setDescription(value);
+ }}
+ className="[&_.is-empty]:text-muted-foreground min-h-[120px] p-4 rounded-lg border w-full"
+ />
+ </VStack>
{type === "Measurement" && (
<>
<UnitOfMeasure
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
index f0e46749ae..0df0bc9614 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
@@ -21,6 +21,7 @@ import {
HStack,
IconButton,
Label,
+ Loading,
ToggleGroup,
ToggleGroupItem,
Tooltip,
@@ -28,6 +29,7 @@ import {
TooltipTrigger,
VStack,
cn,
+ toast,
useDebounce,
useDisclosure,
} from "@carbon/react";
@@ -621,7 +623,7 @@ const QuoteBillOfProcess = ({
disabled: hasProcedure || item.data.operationType === "Outside",
label: (
<span className="flex items-center gap-2">
- <span>Attributes</span>
+ <span>Steps</span>
{hasProcedure && (
<Tooltip>
<TooltipTrigger>
@@ -831,8 +833,34 @@ function AttributesForm({
attributes: OperationAttribute[];
}) {
const fetcher = useFetcher<typeof newQuoteOperationParameterAction>();
- const [type, setType] = useState<OperationAttribute["type"]>("Value");
+ const [type, setType] = useState<OperationAttribute["type"]>("Task");
const [numericControls, setNumericControls] = useState<string[]>([]);
+
+ const [description, setDescription] = useState<JSONContent>({});
+
+ const { carbon } = useCarbon();
+ const {
+ company: { id: companyId },
+ } = useUser();
+
+ const onUploadImage = async (file: File) => {
+ const fileType = file.name.split(".").pop();
+ const fileName = `${companyId}/parts/${nanoid()}.${fileType}`;
+
+ const result = await carbon?.storage.from("private").upload(fileName, file);
+
+ if (result?.error) {
+ toast.error("Failed to upload image");
+ throw new Error(result.error.message);
+ }
+
+ if (!result?.data) {
+ throw new Error("Failed to upload image");
+ }
+
+ return getPrivateUrl(result.data.path);
+ };
+
const typeOptions = useMemo(
() =>
procedureAttributeType.map((type) => ({
@@ -860,8 +888,12 @@ function AttributesForm({
}
return (
- <div className="flex flex-col gap-6">
- <div className="p-6 border rounded-lg">
+ <Loading
+ className="flex flex-col gap-6"
+ isLoading={fetcher.state !== "idle"}
+ // this is a hack to re-render the editor component when the form is submitted with the default values
+ >
+ <div className="p-6 border rounded-lg mb-6">
<ValidatedForm
action={path.to.newQuoteOperationAttribute}
method="post"
@@ -872,7 +904,7 @@ function AttributesForm({
id: undefined,
name: "",
description: "",
- type: "Value",
+ type: "Task",
unitOfMeasureCode: "",
minValue: 0,
maxValue: 0,
@@ -886,11 +918,13 @@ function AttributesForm({
}}
onSubmit={() => {
setType("Value");
+ setDescription([]);
}}
className="w-full"
>
<Hidden name="operationId" />
<Hidden name="sortOrder" />
+ <Hidden name="description" value={JSON.stringify(description)} />
<VStack spacing={4}>
<div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">
<SelectControlled
@@ -907,6 +941,18 @@ function AttributesForm({
<Input name="name" label="Name" />
</div>
+ <VStack spacing={2} className="w-full col-span-2">
+ <Label>Description</Label>
+ <Editor
+ initialValue={description}
+ onUpload={onUploadImage}
+ onChange={(value) => {
+ setDescription(value);
+ }}
+ className="[&_.is-empty]:text-muted-foreground min-h-[120px] p-4 rounded-lg border w-full"
+ />
+ </VStack>
+
{type === "Measurement" && (
<div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">
<UnitOfMeasure
@@ -961,7 +1007,7 @@ function AttributesForm({
isDisabled={isDisabled || fetcher.state !== "idle"}
isLoading={fetcher.state !== "idle"}
>
- Add Attribute
+ Add Step
</Submit>
</VStack>
</ValidatedForm>
@@ -982,7 +1028,7 @@ function AttributesForm({
))}
</div>
)}
- </div>
+ </Loading>
);
}
@@ -1023,6 +1069,7 @@ function AttributesListItem({
}, [fetcher.state]);
const [type, setType] = useState<OperationAttribute["type"]>(attribute.type);
+
const [numericControls, setNumericControls] = useState<string[]>(() => {
const controls = [];
if (type === "Measurement") {
@@ -1042,6 +1089,33 @@ function AttributesListItem({
const unitOfMeasures = useUnitOfMeasure();
+ const [description, setDescription] = useState<JSONContent>(
+ attribute.description ?? {}
+ );
+
+ const { carbon } = useCarbon();
+ const {
+ company: { id: companyId },
+ } = useUser();
+
+ const onUploadImage = async (file: File) => {
+ const fileType = file.name.split(".").pop();
+ const fileName = `${companyId}/parts/${nanoid()}.${fileType}`;
+
+ const result = await carbon?.storage.from("private").upload(fileName, file);
+
+ if (result?.error) {
+ toast.error("Failed to upload image");
+ throw new Error(result.error.message);
+ }
+
+ if (!result?.data) {
+ throw new Error("Failed to upload image");
+ }
+
+ return getPrivateUrl(result.data.path);
+ };
+
if (!id) return null;
return (
@@ -1055,6 +1129,8 @@ function AttributesListItem({
resetAfterSubmit
onSubmit={() => {
disclosure.onClose();
+ setType("Task");
+ setDescription({});
}}
defaultValues={{
...attribute,
@@ -1063,6 +1139,7 @@ function AttributesListItem({
className="w-full"
>
<Hidden name="operationId" />
+ <Hidden name="description" value={JSON.stringify(description)} />
<VStack spacing={4}>
<div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">
<SelectControlled
@@ -1077,7 +1154,19 @@ function AttributesListItem({
/>
<Input name="name" label="Name" />
</div>
- <Input name="description" label="Description" />
+
+ <VStack spacing={2} className="w-full col-span-2">
+ <Label>Description</Label>
+ <Editor
+ initialValue={description}
+ onUpload={onUploadImage}
+ onChange={(value) => {
+ setDescription(value);
+ }}
+ className="[&_.is-empty]:text-muted-foreground min-h-[120px] p-4 rounded-lg border w-full"
+ />
+ </VStack>
+
{type === "Measurement" && (
<div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">
<UnitOfMeasure
@@ -1157,9 +1246,12 @@ function AttributesListItem({
<LuInfo className="text-muted-foreground size-3" />
</TooltipTrigger>
<TooltipContent side="right">
- <p className="text-foreground text-sm">
- {attribute.description}
- </p>
+ <p
+ className="prose prose-sm dark:prose-invert text-foreground text-sm"
+ dangerouslySetInnerHTML={{
+ __html: generateHTML(attribute.description),
+ }}
+ />
</TooltipContent>
</Tooltip>
)}
diff --git a/apps/erp/app/modules/shared/shared.models.ts b/apps/erp/app/modules/shared/shared.models.ts
index 4b71275924..767b4df166 100644
--- a/apps/erp/app/modules/shared/shared.models.ts
+++ b/apps/erp/app/modules/shared/shared.models.ts
@@ -71,6 +71,7 @@ export const noteValidator = z.object({
export const operationTypes = ["Inside", "Outside"] as const;
export const procedureAttributeType = [
+ "Task",
"Value",
"Measurement",
"Checkbox",
@@ -97,7 +98,16 @@ export const operationAttributeValidator = z
id: zfd.text(z.string().optional()),
operationId: z.string().min(1, { message: "Operation is required" }),
name: z.string().min(1, { message: "Name is required" }),
- description: zfd.text(z.string().optional()),
+ description: z
+ .string()
+ .min(1, { message: "Description is required" })
+ .transform((val) => {
+ try {
+ return JSON.parse(val);
+ } catch (e) {
+ return {};
+ }
+ }),
type: z.enum(procedureAttributeType, {
errorMap: () => ({ message: "Type is required" }),
}),
diff --git a/apps/erp/app/routes/share+/quote.$id.tsx b/apps/erp/app/routes/share+/quote.$id.tsx
index 4a773cc5fb..f3f6070555 100644
--- a/apps/erp/app/routes/share+/quote.$id.tsx
+++ b/apps/erp/app/routes/share+/quote.$id.tsx
@@ -564,7 +564,7 @@ const LineItems = ({
</span>
{Object.keys(line.externalNotes ?? {}).length > 0 && (
<div
- className="prose dark:prose-invert prose-sm mt-2 text-muted-foreground"
+ className="prose dark:prose-invert prose mt-2 text-muted-foreground"
dangerouslySetInnerHTML={{
__html: generateHTML(line.externalNotes as JSONContent),
}}
diff --git a/apps/erp/app/styles/docs.css b/apps/erp/app/styles/docs.css
index 13cecf88e8..c0bda68f30 100644
--- a/apps/erp/app/styles/docs.css
+++ b/apps/erp/app/styles/docs.css
@@ -1262,7 +1262,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > ul > li p):not(
+ :where(.prose > ul > li p):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-top: 0.5714286em;
@@ -1272,7 +1272,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > ul > li > :first-child):not(
+ :where(.prose > ul > li > :first-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-top: 1.1428571em;
@@ -1281,7 +1281,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > ul > li > :last-child):not(
+ :where(.prose > ul > li > :last-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-bottom: 1.1428571em;
@@ -1290,7 +1290,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > ol > li > :first-child):not(
+ :where(.prose > ol > li > :first-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-top: 1.1428571em;
@@ -1299,7 +1299,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > ol > li > :last-child):not(
+ :where(.prose > ol > li > :last-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-bottom: 1.1428571em;
@@ -1464,7 +1464,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > :first-child):not(
+ :where(.prose > :first-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-top: 0;
@@ -1473,7 +1473,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > :last-child):not(
+ :where(.prose > :last-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-bottom: 0;
diff --git a/apps/mes/app/components/Icons.tsx b/apps/mes/app/components/Icons.tsx
index 8abb6a0095..3b815e58b1 100644
--- a/apps/mes/app/components/Icons.tsx
+++ b/apps/mes/app/components/Icons.tsx
@@ -1,15 +1,17 @@
-import { cn } from "@carbon/react";
import type { Database } from "@carbon/database";
+import { cn } from "@carbon/react";
import { AiOutlinePartition } from "react-icons/ai";
import { FaCodePullRequest } from "react-icons/fa6";
import {
LuAtom,
LuBarcode,
+ LuBox,
LuCircleCheck,
LuCircleX,
+ LuClipboardCheck,
LuClock,
- LuGroup,
LuFlaskConical,
+ LuGroup,
LuHammer,
LuHeadphones,
LuImage,
@@ -20,7 +22,6 @@ import {
LuSquare,
LuToggleLeft,
LuUser,
- LuBox,
} from "react-icons/lu";
import {
@@ -213,6 +214,8 @@ export const ProcedureAttributeTypeIcon = ({
className?: string;
}) => {
switch (type) {
+ case "Task":
+ return <LuClipboardCheck className={cn("text-amber-500", className)} />;
case "Value":
return <LuQrCode className={cn("text-foreground", className)} />;
case "Measurement":
diff --git a/apps/mes/app/components/JobOperation.tsx b/apps/mes/app/components/JobOperation.tsx
index 9a78b8abcc..37308d66b1 100644
--- a/apps/mes/app/components/JobOperation.tsx
+++ b/apps/mes/app/components/JobOperation.tsx
@@ -159,6 +159,7 @@ import {
LuCheck,
LuChevronDown,
LuChevronLeft,
+ LuChevronRight,
LuChevronUp,
LuCircleCheck,
LuCirclePlus,
@@ -566,6 +567,106 @@ export const JobOperation = ({
</div>
</div>
+ <Suspense key={`attributes-${operationId}`}>
+ <Await resolve={procedure}>
+ {(resolvedProcedure) => {
+ const { attributes, parameters } = resolvedProcedure;
+
+ return (
+ <>
+ {attributes.length > 0 && (
+ <>
+ <Separator />
+ <div className="flex flex-col items-start justify-between w-full">
+ <div className="flex flex-col gap-4 p-4 lg:p-6 w-full">
+ <HStack className="justify-between w-full">
+ <Heading size="h3">Steps</Heading>
+ <div className="flex items-center gap-2">
+ {attributes.length > 0 && (
+ <>
+ <Progress
+ value={
+ (attributes.filter(
+ (a) => a.jobOperationAttributeRecord
+ ).length /
+ attributes.length) *
+ 100
+ }
+ className="h-2 w-24"
+ />
+ <span className="text-xs text-muted-foreground">
+ {
+ attributes.filter(
+ (a) => a.jobOperationAttributeRecord
+ ).length
+ }{" "}
+ of {attributes.length} complete
+ </span>
+ </>
+ )}
+ </div>
+ </HStack>
+ <div className="border rounded-lg">
+ {attributes
+ .sort(
+ (a, b) =>
+ (a.sortOrder ?? 0) - (b.sortOrder ?? 0)
+ )
+ .map((a, index) => (
+ <AttributesListItem
+ key={`attribute-${a.id}`}
+ attribute={a}
+ onRecord={onRecordAttributeRecord}
+ onDelete={onDeleteAttributeRecord}
+ operationId={operationId}
+ className={
+ index === attributes.length - 1
+ ? "border-none"
+ : ""
+ }
+ />
+ ))}
+ </div>
+ </div>
+ </div>
+ </>
+ )}
+ {parameters.length > 0 && (
+ <>
+ <Separator />
+ <div className="flex flex-col items-start justify-between w-full">
+ <div className="flex flex-col gap-4 p-4 lg:p-6 w-full">
+ <HStack className="justify-between w-full">
+ <Heading size="h3">Process Parameters</Heading>
+ </HStack>
+ <div className="border rounded-lg">
+ {parameters
+ .sort((a, b) =>
+ (a.key ?? "").localeCompare(b.key ?? "")
+ )
+ .map((p, index) => (
+ <ParametersListItem
+ key={`parameter-${p.id}`}
+ parameter={p}
+ operationId={operationId}
+ className={
+ index === parameters.length - 1
+ ? "border-none"
+ : ""
+ }
+ />
+ ))}
+ </div>
+ </div>
+ </div>
+ </>
+ )}
+ </>
+ );
+ }}
+ </Await>
+ </Suspense>
+
<Separator />
<div className="flex flex-col items-start justify-between w-full">
<div className="flex flex-col gap-4 p-4 lg:p-6 w-full">
@@ -777,82 +878,6 @@ export const JobOperation = ({
</div>
</div>
- <Suspense key={`attributes-${operationId}`}>
- <Await resolve={procedure}>
- {(resolvedProcedure) => {
- const { attributes, parameters } = resolvedProcedure;
-
- return (
- <>
- {attributes.length > 0 && (
- <>
- <Separator />
- <div className="flex flex-col items-start justify-between w-full">
- <div className="flex flex-col gap-4 p-4 lg:p-6 w-full">
- <HStack className="justify-between w-full">
- <Heading size="h3">Quality Attributes</Heading>
- </HStack>
- <div className="border rounded-lg">
- {attributes
- .sort(
- (a, b) =>
- (a.sortOrder ?? 0) - (b.sortOrder ?? 0)
- )
- .map((a, index) => (
- <AttributesListItem
- key={`attribute-${a.id}`}
- attribute={a}
- onRecord={onRecordAttributeRecord}
- onDelete={onDeleteAttributeRecord}
- operationId={operationId}
- className={
- index === attributes.length - 1
- ? "border-none"
- : ""
- }
- />
- ))}
- </div>
- </div>
- </div>
- </>
- )}
- {parameters.length > 0 && (
- <>
- <Separator />
- <div className="flex flex-col items-start justify-between w-full">
- <div className="flex flex-col gap-4 p-4 lg:p-6 w-full">
- <HStack className="justify-between w-full">
- <Heading size="h3">Process Parameters</Heading>
- </HStack>
- <div className="border rounded-lg">
- {parameters
- .sort((a, b) =>
- (a.key ?? "").localeCompare(b.key ?? "")
- )
- .map((p, index) => (
- <ParametersListItem
- key={`parameter-${p.id}`}
- parameter={p}
- operationId={operationId}
- className={
- index === parameters.length - 1
- ? "border-none"
- : ""
- }
- />
- ))}
- </div>
- </div>
- </div>
- </>
- )}
- </>
- );
- }}
- </Await>
- </Suspense>
-
<Separator />
<div className="flex flex-col items-start justify-between w-full">
<div className="flex flex-col gap-4 p-4 lg:p-6 w-full">
@@ -1139,9 +1164,7 @@ export const JobOperation = ({
>
<div className="w-full py-2 px-4 sticky top-0 z-10">
<TabsList className="w-full grid grid-cols-2">
- <TabsTrigger value="attributes">
- Attributes
- </TabsTrigger>
+ <TabsTrigger value="attributes">Steps</TabsTrigger>
<TabsTrigger value="parameters">
Parameters
</TabsTrigger>
@@ -4004,7 +4027,6 @@ function IssueModal({
</Modal>
);
}
-
function AttributesListItem({
attribute,
compact = false,
@@ -4020,10 +4042,14 @@ function AttributesListItem({
onRecord: (attribute: JobOperationAttribute) => void;
onDelete: (attribute: JobOperationAttribute) => void;
}) {
+ const disclosure = useDisclosure();
+ const fetcher = useFetcher<{ success: boolean }>();
const user = useUser();
const { name, description, type, unitOfMeasureCode, minValue, maxValue } =
attribute;
+ const hasDescription = description && Object.keys(description).length > 0;
+
if (!operationId) return null;
return (
@@ -4039,11 +4065,6 @@ function AttributesListItem({
<span className="text-foreground text-sm font-medium">
{name}
</span>
- {description && (
- <span className="text-muted-foreground text-sm">
- {description}
- </span>
- )}
</HStack>
{type === "Measurement" && (
<span className="text-xs text-muted-foreground">
@@ -4063,49 +4084,80 @@ function AttributesListItem({
<div className="flex items-center justify-end gap-2">
{attribute.jobOperationAttributeRecord ? (
<div className="flex items-center gap-2">
+ {type !== "Task" &&
+ (compact ? (
+ <IconButton
+ aria-label="Update attribute"
+ variant="secondary"
+ icon={<LuCircleCheck />}
+ isDisabled={
+ attribute.jobOperationAttributeRecord?.createdBy !==
+ user?.id
+ }
+ onClick={() => onRecord(attribute)}
+ className={cn(
+ "text-emerald-500",
+ attribute.minValue !== null &&
+ attribute.jobOperationAttributeRecord?.numericValue !=
+ null &&
+ attribute.jobOperationAttributeRecord.numericValue <
+ attribute.minValue &&
+ "text-red-500",
+ attribute.maxValue !== null &&
+ attribute.jobOperationAttributeRecord?.numericValue !=
+ null &&
+ attribute.jobOperationAttributeRecord.numericValue >
+ attribute.maxValue &&
+ "text-red-500"
+ )}
+ />
+ ) : (
+ <Button
+ variant="secondary"
+ rightIcon={<LuCircleCheck />}
+ onClick={() => onRecord(attribute)}
+ >
+ Update
+ </Button>
+ ))}
+ <IconButton
+ aria-label="Delete attribute"
+ variant="secondary"
+ icon={<LuTrash />}
+ isDisabled={attribute.createdBy !== user?.id}
+ onClick={() => onDelete(attribute)}
+ />
+ </div>
+ ) : type === "Task" ? (
+ <fetcher.Form method="post" action={path.to.record}>
+ <input
+ type="hidden"
+ name="jobOperationAttributeId"
+ value={attribute.id}
+ />
+
+ <input type="hidden" name="booleanValue" value="true" />
{compact ? (
<IconButton
- aria-label="Update attribute"
+ aria-label="Record attribute"
variant="secondary"
icon={<LuCircleCheck />}
- isDisabled={
- attribute.jobOperationAttributeRecord?.createdBy !==
- user?.id
- }
- onClick={() => onRecord(attribute)}
- className={cn(
- "text-emerald-500",
- attribute.minValue !== null &&
- attribute.jobOperationAttributeRecord?.numericValue !=
- null &&
- attribute.jobOperationAttributeRecord.numericValue <
- attribute.minValue &&
- "text-red-500",
- attribute.maxValue !== null &&
- attribute.jobOperationAttributeRecord?.numericValue !=
- null &&
- attribute.jobOperationAttributeRecord.numericValue >
- attribute.maxValue &&
- "text-red-500"
- )}
+ type="submit"
+ isLoading={fetcher.state !== "idle"}
+ isDisabled={fetcher.state !== "idle"}
/>
) : (
<Button
+ type="submit"
variant="secondary"
rightIcon={<LuCircleCheck />}
- onClick={() => onRecord(attribute)}
+ isLoading={fetcher.state !== "idle"}
+ isDisabled={fetcher.state !== "idle"}
>
- Update
+ Complete
</Button>
)}
- <IconButton
- aria-label="Delete attribute"
- variant="secondary"
- icon={<LuTrash />}
- isDisabled={attribute.createdBy !== user?.id}
- onClick={() => onDelete(attribute)}
- />
- </div>
+ </fetcher.Form>
) : compact ? (
<IconButton
aria-label="Record attribute"
@@ -4122,8 +4174,26 @@ function AttributesListItem({
Record
</Button>
)}
+ {hasDescription && (
+ <IconButton
+ aria-label={
+ disclosure.isOpen ? "Hide description" : "Show description"
+ }
+ variant="ghost"
+ icon={disclosure.isOpen ? <LuChevronDown /> : <LuChevronRight />}
+ onClick={disclosure.onToggle}
+ />
+ )}
</div>
</div>
+ {disclosure.isOpen && hasDescription && (
+ <div
+ className="mt-4 text-sm prose prose-sm dark:prose-invert"
+ dangerouslySetInnerHTML={{
+ __html: generateHTML(description as JSONContent),
+ }}
+ />
+ )}
</div>
);
}
@@ -4139,6 +4209,11 @@ function PreviewAttributeRecord({
if (!attribute.jobOperationAttributeRecord) return null;
return (
<div className="min-w-[200px] truncate text-right font-medium">
+ {attribute.type === "Task" && (
+ <Checkbox
+ checked={attribute.jobOperationAttributeRecord.booleanValue ?? false}
+ />
+ )}
{attribute.type === "Checkbox" && (
<Checkbox
checked={attribute.jobOperationAttributeRecord.booleanValue ?? false}
@@ -4320,7 +4395,6 @@ function RecordModal({
>
<ModalHeader>
<ModalTitle>{attribute.name}</ModalTitle>
- <ModalDescription>{attribute.description}</ModalDescription>
</ModalHeader>
<ModalBody>
<Hidden name="jobOperationAttributeId" />
@@ -4334,6 +4408,14 @@ function RecordModal({
<Hidden name="value" value={filePath ?? ""} />
)}
<VStack spacing={4}>
+ {attribute.description && (
+ <div
+ className="flex flex-col gap-2"
+ dangerouslySetInnerHTML={{
+ __html: generateHTML(attribute.description as JSONContent),
+ }}
+ />
+ )}
{attribute.type === "Value" && (
<InputField name="value" label="" />
)}
diff --git a/apps/mes/app/styles/docs.css b/apps/mes/app/styles/docs.css
index 13cecf88e8..c0bda68f30 100644
--- a/apps/mes/app/styles/docs.css
+++ b/apps/mes/app/styles/docs.css
@@ -1262,7 +1262,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > ul > li p):not(
+ :where(.prose > ul > li p):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-top: 0.5714286em;
@@ -1272,7 +1272,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > ul > li > :first-child):not(
+ :where(.prose > ul > li > :first-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-top: 1.1428571em;
@@ -1281,7 +1281,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > ul > li > :last-child):not(
+ :where(.prose > ul > li > :last-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-bottom: 1.1428571em;
@@ -1290,7 +1290,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > ol > li > :first-child):not(
+ :where(.prose > ol > li > :first-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-top: 1.1428571em;
@@ -1299,7 +1299,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > ol > li > :last-child):not(
+ :where(.prose > ol > li > :last-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-bottom: 1.1428571em;
@@ -1464,7 +1464,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > :first-child):not(
+ :where(.prose > :first-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-top: 0;
@@ -1473,7 +1473,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > :last-child):not(
+ :where(.prose > :last-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-bottom: 0;
diff --git a/apps/starter/app/styles/docs.css b/apps/starter/app/styles/docs.css
index 13cecf88e8..c0bda68f30 100644
--- a/apps/starter/app/styles/docs.css
+++ b/apps/starter/app/styles/docs.css
@@ -1262,7 +1262,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > ul > li p):not(
+ :where(.prose > ul > li p):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-top: 0.5714286em;
@@ -1272,7 +1272,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > ul > li > :first-child):not(
+ :where(.prose > ul > li > :first-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-top: 1.1428571em;
@@ -1281,7 +1281,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > ul > li > :last-child):not(
+ :where(.prose > ul > li > :last-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-bottom: 1.1428571em;
@@ -1290,7 +1290,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > ol > li > :first-child):not(
+ :where(.prose > ol > li > :first-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-top: 1.1428571em;
@@ -1299,7 +1299,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > ol > li > :last-child):not(
+ :where(.prose > ol > li > :last-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-bottom: 1.1428571em;
@@ -1464,7 +1464,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > :first-child):not(
+ :where(.prose > :first-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-top: 0;
@@ -1473,7 +1473,7 @@
.Docs
.doc-section
article:first-child
- :where(.prose-sm > :last-child):not(
+ :where(.prose > :last-child):not(
:where([class~="not-prose"], [class~="not-prose"] *)
) {
margin-bottom: 0;
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index eb2c7ee771..b03120cb0b 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -8972,7 +8972,7 @@ export type Database = {
companyId: string
createdAt: string
createdBy: string
- description: string | null
+ description: Json | null
fileTypes: string[] | null
id: string
listValues: string[] | null
@@ -8991,7 +8991,7 @@ export type Database = {
companyId: string
createdAt?: string
createdBy: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -9010,7 +9010,7 @@ export type Database = {
companyId?: string
createdAt?: string
createdBy?: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -11150,7 +11150,7 @@ export type Database = {
companyId: string
createdAt: string
createdBy: string
- description: string | null
+ description: Json | null
fileTypes: string[] | null
id: string
listValues: string[] | null
@@ -11169,7 +11169,7 @@ export type Database = {
companyId: string
createdAt?: string
createdBy: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -11188,7 +11188,7 @@ export type Database = {
companyId?: string
createdAt?: string
createdBy?: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -11702,6 +11702,7 @@ export type Database = {
assignee: string | null
closeDate: string | null
companyId: string | null
+ content: Json
createdAt: string
createdBy: string
customerId: string | null
@@ -11746,6 +11747,7 @@ export type Database = {
assignee?: string | null
closeDate?: string | null
companyId?: string | null
+ content?: Json
createdAt?: string
createdBy: string
customerId?: string | null
@@ -11792,6 +11794,7 @@ export type Database = {
assignee?: string | null
closeDate?: string | null
companyId?: string | null
+ content?: Json
createdAt?: string
createdBy?: string
customerId?: string | null
@@ -12173,7 +12176,7 @@ export type Database = {
nonConformanceActionTask: {
Row: {
actionType: Database["public"]["Enums"]["nonConformanceAction"] | null
- assigneeId: string | null
+ assignee: string | null
completedDate: string | null
createdAt: string
createdBy: string
@@ -12190,7 +12193,7 @@ export type Database = {
actionType?:
| Database["public"]["Enums"]["nonConformanceAction"]
| null
- assigneeId?: string | null
+ assignee?: string | null
completedDate?: string | null
createdAt?: string
createdBy: string
@@ -12207,7 +12210,7 @@ export type Database = {
actionType?:
| Database["public"]["Enums"]["nonConformanceAction"]
| null
- assigneeId?: string | null
+ assignee?: string | null
completedDate?: string | null
createdAt?: string
createdBy?: string
@@ -12222,36 +12225,36 @@ export type Database = {
}
Relationships: [
{
- foreignKeyName: "nonConformanceActionTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceActionTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employees"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceActionTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceActionTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employeesAcrossCompanies"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceActionTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceActionTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employeeSummary"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceActionTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceActionTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "user"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceActionTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceActionTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
@@ -12340,7 +12343,7 @@ export type Database = {
approvalType:
| Database["public"]["Enums"]["nonConformanceApproval"]
| null
- assigneeId: string | null
+ assignee: string | null
completedDate: string | null
createdAt: string
createdBy: string
@@ -12357,7 +12360,7 @@ export type Database = {
approvalType?:
| Database["public"]["Enums"]["nonConformanceApproval"]
| null
- assigneeId?: string | null
+ assignee?: string | null
completedDate?: string | null
createdAt?: string
createdBy: string
@@ -12374,7 +12377,7 @@ export type Database = {
approvalType?:
| Database["public"]["Enums"]["nonConformanceApproval"]
| null
- assigneeId?: string | null
+ assignee?: string | null
completedDate?: string | null
createdAt?: string
createdBy?: string
@@ -12389,36 +12392,36 @@ export type Database = {
}
Relationships: [
{
- foreignKeyName: "nonConformanceApprovalTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceApprovalTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employees"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceApprovalTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceApprovalTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employeesAcrossCompanies"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceApprovalTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceApprovalTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employeeSummary"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceApprovalTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceApprovalTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "user"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceApprovalTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceApprovalTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
@@ -12504,7 +12507,7 @@ export type Database = {
}
nonConformanceInvestigationTask: {
Row: {
- assigneeId: string | null
+ assignee: string | null
completedDate: string | null
createdAt: string
createdBy: string
@@ -12521,7 +12524,7 @@ export type Database = {
updatedBy: string | null
}
Insert: {
- assigneeId?: string | null
+ assignee?: string | null
completedDate?: string | null
createdAt?: string
createdBy: string
@@ -12538,7 +12541,7 @@ export type Database = {
updatedBy?: string | null
}
Update: {
- assigneeId?: string | null
+ assignee?: string | null
completedDate?: string | null
createdAt?: string
createdBy?: string
@@ -12556,36 +12559,36 @@ export type Database = {
}
Relationships: [
{
- foreignKeyName: "nonConformanceInvestigationTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceInvestigationTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employees"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceInvestigationTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceInvestigationTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employeesAcrossCompanies"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceInvestigationTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceInvestigationTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employeeSummary"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceInvestigationTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceInvestigationTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "user"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceInvestigationTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceInvestigationTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
@@ -12669,73 +12672,6 @@ export type Database = {
},
]
}
- nonConformanceOwner: {
- Row: {
- createdAt: string
- createdBy: string
- id: string
- nonConformanceId: string
- ownerId: string
- }
- Insert: {
- createdAt?: string
- createdBy: string
- id?: string
- nonConformanceId: string
- ownerId: string
- }
- Update: {
- createdAt?: string
- createdBy?: string
- id?: string
- nonConformanceId?: string
- ownerId?: string
- }
- Relationships: [
- {
- foreignKeyName: "nonConformanceOwner_nonConformanceId_fkey"
- columns: ["nonConformanceId"]
- isOneToOne: false
- referencedRelation: "nonConformance"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "nonConformanceOwner_ownerId_fkey"
- columns: ["ownerId"]
- isOneToOne: false
- referencedRelation: "employees"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "nonConformanceOwner_ownerId_fkey"
- columns: ["ownerId"]
- isOneToOne: false
- referencedRelation: "employeesAcrossCompanies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "nonConformanceOwner_ownerId_fkey"
- columns: ["ownerId"]
- isOneToOne: false
- referencedRelation: "employeeSummary"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "nonConformanceOwner_ownerId_fkey"
- columns: ["ownerId"]
- isOneToOne: false
- referencedRelation: "user"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "nonConformanceOwner_ownerId_fkey"
- columns: ["ownerId"]
- isOneToOne: false
- referencedRelation: "userDefaults"
- referencedColumns: ["userId"]
- },
- ]
- }
nonConformanceReviewer: {
Row: {
createdAt: string
@@ -15200,7 +15136,7 @@ export type Database = {
companyId: string | null
createdAt: string
createdBy: string
- description: string | null
+ description: Json | null
fileTypes: string[] | null
id: string
listValues: string[] | null
@@ -15219,7 +15155,7 @@ export type Database = {
companyId?: string | null
createdAt?: string
createdBy: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -15238,7 +15174,7 @@ export type Database = {
companyId?: string | null
createdAt?: string
createdBy?: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -20111,7 +20047,7 @@ export type Database = {
companyId: string
createdAt: string
createdBy: string
- description: string | null
+ description: Json | null
fileTypes: string[] | null
id: string
listValues: string[] | null
@@ -20130,7 +20066,7 @@ export type Database = {
companyId: string
createdAt?: string
createdBy: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -20149,7 +20085,7 @@ export type Database = {
companyId?: string
createdAt?: string
createdBy?: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -33366,14 +33302,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -35460,14 +35396,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["paymentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["paymentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -38721,6 +38657,7 @@ export type Database = {
| "Person"
| "List"
| "File"
+ | "Task"
procedureStatus: "Draft" | "Active" | "Archived"
processType: "Inside" | "Outside" | "Inside and Outside"
productionEventType: "Setup" | "Labor" | "Machine"
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index eb2c7ee771..b03120cb0b 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -8972,7 +8972,7 @@ export type Database = {
companyId: string
createdAt: string
createdBy: string
- description: string | null
+ description: Json | null
fileTypes: string[] | null
id: string
listValues: string[] | null
@@ -8991,7 +8991,7 @@ export type Database = {
companyId: string
createdAt?: string
createdBy: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -9010,7 +9010,7 @@ export type Database = {
companyId?: string
createdAt?: string
createdBy?: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -11150,7 +11150,7 @@ export type Database = {
companyId: string
createdAt: string
createdBy: string
- description: string | null
+ description: Json | null
fileTypes: string[] | null
id: string
listValues: string[] | null
@@ -11169,7 +11169,7 @@ export type Database = {
companyId: string
createdAt?: string
createdBy: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -11188,7 +11188,7 @@ export type Database = {
companyId?: string
createdAt?: string
createdBy?: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -11702,6 +11702,7 @@ export type Database = {
assignee: string | null
closeDate: string | null
companyId: string | null
+ content: Json
createdAt: string
createdBy: string
customerId: string | null
@@ -11746,6 +11747,7 @@ export type Database = {
assignee?: string | null
closeDate?: string | null
companyId?: string | null
+ content?: Json
createdAt?: string
createdBy: string
customerId?: string | null
@@ -11792,6 +11794,7 @@ export type Database = {
assignee?: string | null
closeDate?: string | null
companyId?: string | null
+ content?: Json
createdAt?: string
createdBy?: string
customerId?: string | null
@@ -12173,7 +12176,7 @@ export type Database = {
nonConformanceActionTask: {
Row: {
actionType: Database["public"]["Enums"]["nonConformanceAction"] | null
- assigneeId: string | null
+ assignee: string | null
completedDate: string | null
createdAt: string
createdBy: string
@@ -12190,7 +12193,7 @@ export type Database = {
actionType?:
| Database["public"]["Enums"]["nonConformanceAction"]
| null
- assigneeId?: string | null
+ assignee?: string | null
completedDate?: string | null
createdAt?: string
createdBy: string
@@ -12207,7 +12210,7 @@ export type Database = {
actionType?:
| Database["public"]["Enums"]["nonConformanceAction"]
| null
- assigneeId?: string | null
+ assignee?: string | null
completedDate?: string | null
createdAt?: string
createdBy?: string
@@ -12222,36 +12225,36 @@ export type Database = {
}
Relationships: [
{
- foreignKeyName: "nonConformanceActionTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceActionTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employees"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceActionTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceActionTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employeesAcrossCompanies"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceActionTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceActionTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employeeSummary"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceActionTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceActionTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "user"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceActionTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceActionTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
@@ -12340,7 +12343,7 @@ export type Database = {
approvalType:
| Database["public"]["Enums"]["nonConformanceApproval"]
| null
- assigneeId: string | null
+ assignee: string | null
completedDate: string | null
createdAt: string
createdBy: string
@@ -12357,7 +12360,7 @@ export type Database = {
approvalType?:
| Database["public"]["Enums"]["nonConformanceApproval"]
| null
- assigneeId?: string | null
+ assignee?: string | null
completedDate?: string | null
createdAt?: string
createdBy: string
@@ -12374,7 +12377,7 @@ export type Database = {
approvalType?:
| Database["public"]["Enums"]["nonConformanceApproval"]
| null
- assigneeId?: string | null
+ assignee?: string | null
completedDate?: string | null
createdAt?: string
createdBy?: string
@@ -12389,36 +12392,36 @@ export type Database = {
}
Relationships: [
{
- foreignKeyName: "nonConformanceApprovalTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceApprovalTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employees"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceApprovalTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceApprovalTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employeesAcrossCompanies"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceApprovalTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceApprovalTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employeeSummary"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceApprovalTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceApprovalTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "user"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceApprovalTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceApprovalTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
@@ -12504,7 +12507,7 @@ export type Database = {
}
nonConformanceInvestigationTask: {
Row: {
- assigneeId: string | null
+ assignee: string | null
completedDate: string | null
createdAt: string
createdBy: string
@@ -12521,7 +12524,7 @@ export type Database = {
updatedBy: string | null
}
Insert: {
- assigneeId?: string | null
+ assignee?: string | null
completedDate?: string | null
createdAt?: string
createdBy: string
@@ -12538,7 +12541,7 @@ export type Database = {
updatedBy?: string | null
}
Update: {
- assigneeId?: string | null
+ assignee?: string | null
completedDate?: string | null
createdAt?: string
createdBy?: string
@@ -12556,36 +12559,36 @@ export type Database = {
}
Relationships: [
{
- foreignKeyName: "nonConformanceInvestigationTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceInvestigationTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employees"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceInvestigationTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceInvestigationTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employeesAcrossCompanies"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceInvestigationTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceInvestigationTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "employeeSummary"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceInvestigationTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceInvestigationTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "user"
referencedColumns: ["id"]
},
{
- foreignKeyName: "nonConformanceInvestigationTask_assigneeId_fkey"
- columns: ["assigneeId"]
+ foreignKeyName: "nonConformanceInvestigationTask_assignee_fkey"
+ columns: ["assignee"]
isOneToOne: false
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
@@ -12669,73 +12672,6 @@ export type Database = {
},
]
}
- nonConformanceOwner: {
- Row: {
- createdAt: string
- createdBy: string
- id: string
- nonConformanceId: string
- ownerId: string
- }
- Insert: {
- createdAt?: string
- createdBy: string
- id?: string
- nonConformanceId: string
- ownerId: string
- }
- Update: {
- createdAt?: string
- createdBy?: string
- id?: string
- nonConformanceId?: string
- ownerId?: string
- }
- Relationships: [
- {
- foreignKeyName: "nonConformanceOwner_nonConformanceId_fkey"
- columns: ["nonConformanceId"]
- isOneToOne: false
- referencedRelation: "nonConformance"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "nonConformanceOwner_ownerId_fkey"
- columns: ["ownerId"]
- isOneToOne: false
- referencedRelation: "employees"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "nonConformanceOwner_ownerId_fkey"
- columns: ["ownerId"]
- isOneToOne: false
- referencedRelation: "employeesAcrossCompanies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "nonConformanceOwner_ownerId_fkey"
- columns: ["ownerId"]
- isOneToOne: false
- referencedRelation: "employeeSummary"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "nonConformanceOwner_ownerId_fkey"
- columns: ["ownerId"]
- isOneToOne: false
- referencedRelation: "user"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "nonConformanceOwner_ownerId_fkey"
- columns: ["ownerId"]
- isOneToOne: false
- referencedRelation: "userDefaults"
- referencedColumns: ["userId"]
- },
- ]
- }
nonConformanceReviewer: {
Row: {
createdAt: string
@@ -15200,7 +15136,7 @@ export type Database = {
companyId: string | null
createdAt: string
createdBy: string
- description: string | null
+ description: Json | null
fileTypes: string[] | null
id: string
listValues: string[] | null
@@ -15219,7 +15155,7 @@ export type Database = {
companyId?: string | null
createdAt?: string
createdBy: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -15238,7 +15174,7 @@ export type Database = {
companyId?: string | null
createdAt?: string
createdBy?: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -20111,7 +20047,7 @@ export type Database = {
companyId: string
createdAt: string
createdBy: string
- description: string | null
+ description: Json | null
fileTypes: string[] | null
id: string
listValues: string[] | null
@@ -20130,7 +20066,7 @@ export type Database = {
companyId: string
createdAt?: string
createdBy: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -20149,7 +20085,7 @@ export type Database = {
companyId?: string
createdAt?: string
createdBy?: string
- description?: string | null
+ description?: Json | null
fileTypes?: string[] | null
id?: string
listValues?: string[] | null
@@ -33366,14 +33302,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -35460,14 +35396,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["paymentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["paymentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -38721,6 +38657,7 @@ export type Database = {
| "Person"
| "List"
| "File"
+ | "Task"
procedureStatus: "Draft" | "Active" | "Archived"
processType: "Inside" | "Outside" | "Inside and Outside"
productionEventType: "Setup" | "Labor" | "Machine"
diff --git a/packages/database/supabase/migrations/20250407130252_attribute-task.sql b/packages/database/supabase/migrations/20250407130252_attribute-task.sql
new file mode 100644
index 0000000000..17e7d5b324
--- /dev/null
+++ b/packages/database/supabase/migrations/20250407130252_attribute-task.sql
@@ -0,0 +1,11 @@
+ALTER TYPE "procedureAttributeType" ADD VALUE 'Task';
+
+ALTER TABLE "procedureAttribute" DROP COLUMN "description";
+ALTER TABLE "jobOperationAttribute" DROP COLUMN "description";
+ALTER TABLE "quoteOperationAttribute" DROP COLUMN "description";
+ALTER TABLE "methodOperationAttribute" DROP COLUMN "description";
+
+ALTER TABLE "procedureAttribute" ADD COLUMN "description" JSON DEFAULT '{}';
+ALTER TABLE "jobOperationAttribute" ADD COLUMN "description" JSON DEFAULT '{}';
+ALTER TABLE "quoteOperationAttribute" ADD COLUMN "description" JSON DEFAULT '{}';
+ALTER TABLE "methodOperationAttribute" ADD COLUMN "description" JSON DEFAULT '{}';
diff --git a/packages/react/src/Editor/Editor.tsx b/packages/react/src/Editor/Editor.tsx
index daf757550e..6f6a3d7e76 100644
--- a/packages/react/src/Editor/Editor.tsx
+++ b/packages/react/src/Editor/Editor.tsx
@@ -106,7 +106,7 @@ const Editor = ({
handleDrop: (view, event, _slice, moved) =>
handleImageDrop(view, event, moved, uploadFn),
attributes: {
- class: `prose prose-lg dark:prose-invert focus:outline-none max-w-full`,
+ class: `prose dark:prose-invert focus:outline-none max-w-full`,
},
}}
onUpdate={({ editor }) => {
diff --git a/packages/react/src/Label.tsx b/packages/react/src/Label.tsx
index 10d398287d..4f64f07f94 100644
--- a/packages/react/src/Label.tsx
+++ b/packages/react/src/Label.tsx
@@ -6,7 +6,7 @@ import { forwardRef } from "react";
import { cn } from "./utils/cn";
const labelVariants = cva(
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
+ "text-xs font-medium text-muted-foreground leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
);
const Label = forwardRef<