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 footer to sortable list item

Brad Barbinf2625e81fdd2
diff --git a/apps/erp/app/components/Assignee.tsx b/apps/erp/app/components/Assignee.tsx
index a1dc096ba1..f7bf2cbe13 100644
--- a/apps/erp/app/components/Assignee.tsx
+++ b/apps/erp/app/components/Assignee.tsx
@@ -10,6 +10,7 @@ import {
PopoverContent,
PopoverTrigger,
VStack,
+ buttonVariants,
cn,
} from "@carbon/react";
import { useFetcher, useFetchers } from "@remix-run/react";
@@ -30,7 +31,7 @@ export type AssigneeProps = Omit<
> & {
id: string;
table: string;
- size?: "sm" | "md" | "lg";
+ size?: "sm" | "md";
value?: string;
isReadOnly?: boolean;
placeholder?: string;
@@ -43,8 +44,8 @@ const Assign = forwardRef<HTMLButtonElement, AssigneeProps>(
{
id,
table,
- size,
value,
+ size = "md",
isReadOnly,
placeholder,
variant = "button",
@@ -95,7 +96,10 @@ const Assign = forwardRef<HTMLButtonElement, AssigneeProps>(
<HStack className="w-full justify-between">
{variant === "inline" &&
(value ? (
- <EmployeeAvatar size={size ?? "xs"} employeeId={value ?? null} />
+ <EmployeeAvatar
+ size={size === "sm" ? "xxs" : "xs"}
+ employeeId={value ?? null}
+ />
) : (
<span className="text-sm">Unassigned</span>
))}
@@ -105,9 +109,14 @@ const Assign = forwardRef<HTMLButtonElement, AssigneeProps>(
{variant === "button" ? (
<button
className={cn(
- "rounded-md px-2.5 py-0.5 text-sm transition-colors cursor-pointer hover:bg-accent hover:text-accent-foreground border border-input bg-card font-normal",
-
- className
+ buttonVariants({
+ variant: "secondary",
+ size: size,
+ isDisabled: isReadOnly,
+ isLoading: fetcher.state !== "idle",
+ isIcon: false,
+ className,
+ })
)}
role="combobox"
aria-expanded={open}
@@ -119,13 +128,15 @@ const Assign = forwardRef<HTMLButtonElement, AssigneeProps>(
>
{value ? (
<EmployeeAvatar
- size={size ?? "xs"}
+ size={size === "sm" ? "xxs" : "xs"}
employeeId={value ?? null}
/>
) : (
<div className="flex items-center justify-start gap-2">
- <LuUser className="w-4 h-4" />
- <span className="text-sm">Unassigned</span>
+ <LuUser
+ className={size === "sm" ? "w-3 h-3" : "w-4 h-4"}
+ />
+ <span>Unassigned</span>
</div>
)}
</button>
diff --git a/apps/erp/app/components/Form/Tags.tsx b/apps/erp/app/components/Form/Tags.tsx
index ee13f49eff..7a3add1c10 100644
--- a/apps/erp/app/components/Form/Tags.tsx
+++ b/apps/erp/app/components/Form/Tags.tsx
@@ -3,6 +3,7 @@ import { CreatableMultiSelect } from "@carbon/form";
import { Badge, HStack } from "@carbon/react";
import { useFetcher } from "@remix-run/react";
import { useMemo } from "react";
+import { LuTags } from "react-icons/lu";
import type { action } from "~/routes/x+/settings+/tags.new";
import { path } from "~/utils/path";
@@ -20,7 +21,7 @@ const TagsPreview = (
options: { value: string; label: string; helper?: string }[]
) => {
return (
- <HStack className="space-x-0 flex-wrap gap-1 items-start">
+ <HStack className="space-x-0 flex-grow gap-1 items-start">
{value.map((label: string) => (
<Badge key={label} variant="secondary">
{label}
@@ -49,6 +50,7 @@ const Tags = ({ table, availableTags, ...props }: TagsSelectProps) => {
{...props}
showCreateOptionOnEmpty={false}
inline={props.inline ? TagsPreview : undefined}
+ inlineIcon={<LuTags />}
onCreateOption={(option) => {
if (!option) return;
diff --git a/apps/erp/app/components/SortableList.tsx b/apps/erp/app/components/SortableList.tsx
index 823536c8ba..21131e13cb 100644
--- a/apps/erp/app/components/SortableList.tsx
+++ b/apps/erp/app/components/SortableList.tsx
@@ -11,6 +11,7 @@ import { LuTrash } from "react-icons/lu";
export interface Item {
checked: boolean;
details?: ReactNode;
+ footer?: ReactNode;
id: string;
isTemporary?: boolean;
order?: "With Previous" | "After Previous";
@@ -98,58 +99,62 @@ function SortableListItem<T>({
layout="position"
>
{!isExpanded ? (
- <div className="flex w-full items-center gap-x-2 truncate">
- {/* List Remove Actions */}
- <Checkbox
- checked={item.checked}
- id={`checkbox-${item.id}`}
- aria-label="Mark to delete"
- onCheckedChange={() => onToggleItem(item.id)}
- className="ml-3 border-foreground/20 bg-background/30 data-[state=checked]:bg-background data-[state=checked]:text-red-200 flex flex-shrink-0 "
- />
- {/* List Order */}
- <p className="font-medium text-xs pl-1 text-foreground/50 flex flex-shrink-0">
- {getParallelizedOrder(order, item, items)}
- </p>
-
- {/* List Title */}
- <div
- key={`${item.checked}`}
- className="px-1 flex flex-grow truncate cursor-pointer"
- role="button"
- >
- <HStack className="w-full justify-between">
- {typeof item.title === "string" ? (
- <span
- className={cn(
- "flex font-medium text-sm md:text-base truncate hover:underline",
- item.checked ? "text-red-400" : "text-foreground"
- )}
- onClick={(e) => {
- if (!isDragging) {
- onSelectItem(item.id);
- }
- }}
- >
- {item.title}
- </span>
- ) : (
- <div
- onClick={(e) => {
- if (!isDragging) {
- onSelectItem(item.id);
- }
- }}
- className={item.checked ? "text-red-400" : ""}
- >
- {item.title}
- </div>
- )}
-
- {item.details && (
- <div className="flex flex-shrink-0">{item.details}</div>
- )}
- </HStack>
+ <div className="flex flex-col w-full">
+ <div className="flex w-full items-center gap-x-2 truncate">
+ {/* List Remove Actions */}
+ <Checkbox
+ checked={item.checked}
+ id={`checkbox-${item.id}`}
+ aria-label="Mark to delete"
+ onCheckedChange={() => onToggleItem(item.id)}
+ className="ml-3 border-foreground/20 bg-background/30 data-[state=checked]:bg-background data-[state=checked]:text-red-200 flex flex-shrink-0 "
+ />
+ {/* List Order */}
+ <p className="font-medium text-xs pl-1 text-foreground/50 flex flex-shrink-0">
+ {getParallelizedOrder(order, item, items)}
+ </p>
+
+ {/* List Title */}
+ <div
+ key={`${item.checked}`}
+ className="px-1 flex flex-grow truncate cursor-pointer"
+ role="button"
+ >
+ <HStack className="w-full justify-between">
+ {typeof item.title === "string" ? (
+ <span
+ className={cn(
+ "flex font-medium text-sm md:text-base truncate hover:underline",
+ item.checked ? "text-red-400" : "text-foreground"
+ )}
+ onClick={(e) => {
+ if (!isDragging) {
+ onSelectItem(item.id);
+ }
+ }}
+ >
+ {item.title}
+ </span>
+ ) : (
+ <div
+ onClick={(e) => {
+ if (!isDragging) {
+ onSelectItem(item.id);
+ }
+ }}
+ className={item.checked ? "text-red-400" : ""}
+ >
+ {item.title}
+ </div>
+ )}
+
+ {item.details && (
+ <div className="flex flex-shrink-0">
+ {item.details}
+ </div>
+ )}
+ </HStack>
+ </div>
</div>
</div>
) : null}
@@ -157,6 +162,11 @@ function SortableListItem<T>({
{/* List Item Children */}
{renderExtra && renderExtra(item)}
</motion.div>
+ {item.footer && (
+ <div className="flex w-full items-center border-t border-border px-3 pt-3 pb-1">
+ {item.footer}
+ </div>
+ )}
</div>
<div
onPointerDown={isDraggable ? handleDragStart : undefined}
diff --git a/apps/erp/app/hooks/useTags.tsx b/apps/erp/app/hooks/useTags.tsx
new file mode 100644
index 0000000000..fb12d3e5b2
--- /dev/null
+++ b/apps/erp/app/hooks/useTags.tsx
@@ -0,0 +1,28 @@
+import { useFetcher } from "@remix-run/react";
+import { useCallback } from "react";
+import { path } from "~/utils/path";
+
+export function useTags({ id, table }: { id?: string; table: string }) {
+ const fetcher = useFetcher<{}>();
+ const onUpdateTags = useCallback(
+ (value: string[]) => {
+ if (!id) return;
+ const formData = new FormData();
+
+ formData.append("ids", id);
+ formData.append("table", table);
+ value.forEach((v) => {
+ formData.append("value", v.replace(/\\\\"/g, '"'));
+ });
+
+ fetcher.submit(formData, {
+ method: "post",
+ action: path.to.tags,
+ });
+ },
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [id, table]
+ );
+
+ return { onUpdateTags };
+}
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
index f0a862a768..69c8dba010 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
@@ -56,8 +56,13 @@ import {
LuTriangleAlert,
LuX,
} from "react-icons/lu";
-import { type z } from "zod";
-import { DirectionAwareTabs, EmployeeAvatar, TimeTypeIcon } from "~/components";
+import { z } from "zod";
+import {
+ Assignee,
+ DirectionAwareTabs,
+ EmployeeAvatar,
+ TimeTypeIcon,
+} from "~/components";
import Activity from "~/components/Activity";
import {
Hidden,
@@ -70,6 +75,7 @@ import {
StandardFactor,
Submit,
SupplierProcess,
+ Tags,
Tool,
UnitHint,
WorkCenter,
@@ -81,6 +87,7 @@ import { ConfirmDelete } from "~/components/Modals";
import type { Item, SortableItemRenderProps } from "~/components/SortableList";
import { SortableList, SortableListItem } from "~/components/SortableList";
import { usePermissions, useRouteData, useUrlParams, useUser } from "~/hooks";
+import { useTags } from "~/hooks/useTags";
import type { OperationTool } from "~/modules/shared";
import {
methodOperationOrders,
@@ -96,7 +103,9 @@ import { getProductionEventsPage } from "../../production.service";
import type { Job, JobOperation } from "../../types";
type Operation = z.infer<typeof jobOperationValidator> & {
+ assignee: string | null;
status: JobOperation["status"];
+ tags: string[] | null;
workInstruction: JSONContent | null;
};
@@ -110,13 +119,20 @@ type JobBillOfProcessProps = {
operations: (Operation & {
jobOperationTool: OperationTool[];
})[];
+ tags: { name: string }[];
};
-function makeItems(operations: Operation[]): ItemWithData[] {
- return operations.map(makeItem);
+function makeItems(
+ operations: Operation[],
+ tags: { name: string }[]
+): ItemWithData[] {
+ return operations.map((operation) => makeItem(operation, tags));
}
-function makeItem(operation: Operation): ItemWithData {
+function makeItem(
+ operation: Operation,
+ tags: { name: string }[]
+): ItemWithData {
return {
id: operation.id!,
title: (
@@ -156,6 +172,17 @@ function makeItem(operation: Operation): ItemWithData {
)}
</HStack>
),
+ footer: isTemporaryId(operation.id ?? "") ? null : (
+ <HStack>
+ <Assignee
+ table="jobOperation"
+ id={operation.id!}
+ size="sm"
+ value={operation.assignee ?? undefined}
+ />
+ <JobOperationTags operation={operation} availableTags={tags} />
+ </HStack>
+ ),
data: operation,
};
}
@@ -164,6 +191,7 @@ const initialOperation: Omit<
Operation,
"jobMakeMethodId" | "order" | "jobOperationTool"
> = {
+ assignee: null,
description: "",
laborRate: 0,
laborTime: 0,
@@ -180,6 +208,7 @@ const initialOperation: Omit<
setupTime: 0,
setupUnit: "Total Minutes",
status: "Todo",
+ tags: [],
workCenterId: "",
workInstruction: {},
};
@@ -232,6 +261,7 @@ const JobBillOfProcess = ({
jobMakeMethodId,
locationId,
operations: initialOperations,
+ tags,
}: JobBillOfProcessProps) => {
const { carbon, accessToken } = useCarbon();
const sortOrderFetcher = useFetcher<{}>();
@@ -287,9 +317,11 @@ const JobBillOfProcess = ({
if (!pendingOperation.id) {
operationsById.set("temporary", {
...pendingOperation,
+ assignee: null,
status: "Todo",
workInstruction: {},
jobOperationTool: [],
+ tags: [],
});
} else {
operationsById.set(pendingOperation.id, {
@@ -311,7 +343,7 @@ const JobBillOfProcess = ({
(a, b) => (orderState[a.id!] ?? a.order) - (orderState[b.id!] ?? b.order)
);
- const items = makeItems(operations).map((item) => ({
+ const items = makeItems(operations, tags).map((item) => ({
...item,
checked: checkedState[item.id] ?? false,
}));
@@ -2004,3 +2036,34 @@ function Notes({ jobOperationId }: { jobOperationId: string }) {
</div>
);
}
+
+function JobOperationTags({
+ operation,
+ availableTags,
+}: {
+ operation: Operation;
+ availableTags: { name: string }[];
+}) {
+ const { onUpdateTags } = useTags({ id: operation.id, table: "jobOperation" });
+
+ return (
+ <ValidatedForm
+ defaultValues={{
+ tags: operation.tags ?? [],
+ }}
+ validator={z.object({
+ tags: z.array(z.string()).optional(),
+ })}
+ className="w-full"
+ >
+ <Tags
+ availableTags={availableTags}
+ label=""
+ name="tags"
+ table="operation"
+ inline
+ onChange={onUpdateTags}
+ />
+ </ValidatedForm>
+ );
+}
diff --git a/apps/erp/app/routes/x+/job+/$jobId.make.$methodId.$materialId.tsx b/apps/erp/app/routes/x+/job+/$jobId.make.$methodId.$materialId.tsx
index 16b4f50ae3..6838261dc5 100644
--- a/apps/erp/app/routes/x+/job+/$jobId.make.$methodId.$materialId.tsx
+++ b/apps/erp/app/routes/x+/job+/$jobId.make.$methodId.$materialId.tsx
@@ -29,11 +29,11 @@ import {
JobMaterialForm,
} from "~/modules/production/ui/Jobs";
import JobMakeMethodTools from "~/modules/production/ui/Jobs/JobMakeMethodTools";
-import { getModelByItemId } from "~/modules/shared";
+import { getModelByItemId, getTagsList } from "~/modules/shared";
import { path } from "~/utils/path";
export async function loader({ request, params }: LoaderFunctionArgs) {
- const { client } = await requirePermissions(request, {
+ const { client, companyId } = await requirePermissions(request, {
view: "production",
});
@@ -42,10 +42,11 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
if (!methodId) throw new Error("Could not find methodId");
if (!materialId) throw new Error("Could not find materialId");
- const [material, materials, operations] = await Promise.all([
+ const [material, materials, operations, tags] = await Promise.all([
getJobMaterial(client, materialId),
getJobMaterialsByMethodId(client, methodId),
getJobOperationsByMethodId(client, methodId),
+ getTagsList(client, companyId, "operation"),
]);
if (material.error) {
throw redirect(
@@ -114,6 +115,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
operations?.data?.map((o) => o.id)
),
model: getModelByItemId(client, material.data.itemId!),
+ tags: tags.data ?? [],
});
}
@@ -124,7 +126,7 @@ export default function JobMakeMethodRoute() {
if (!jobId) throw new Error("Could not find jobId");
const routeData = useRouteData<{ job: Job }>(path.to.job(jobId));
const loaderData = useLoaderData<typeof loader>();
- const { material, materials, operations, productionData } = loaderData;
+ const { material, materials, operations, productionData, tags } = loaderData;
return (
<VStack spacing={2} className="p-2">
@@ -139,6 +141,7 @@ export default function JobMakeMethodRoute() {
jobMakeMethodId={methodId}
operations={operations}
locationId={routeData?.job?.locationId ?? ""}
+ tags={tags}
/>
<JobBillOfMaterial
key={`bom:${methodId}`}
diff --git a/apps/erp/app/routes/x+/job+/$jobId.method.$methodId.tsx b/apps/erp/app/routes/x+/job+/$jobId.method.$methodId.tsx
index d828dd2583..c60dd917ec 100644
--- a/apps/erp/app/routes/x+/job+/$jobId.method.$methodId.tsx
+++ b/apps/erp/app/routes/x+/job+/$jobId.method.$methodId.tsx
@@ -27,10 +27,11 @@ import {
JobEstimatesVsActuals,
} from "~/modules/production/ui/Jobs";
import JobMakeMethodTools from "~/modules/production/ui/Jobs/JobMakeMethodTools";
+import { getTagsList } from "~/modules/shared";
import { path } from "~/utils/path";
export async function loader({ request, params }: LoaderFunctionArgs) {
- const { client } = await requirePermissions(request, {
+ const { client, companyId } = await requirePermissions(request, {
view: "production",
});
@@ -38,9 +39,10 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
if (!jobId) throw new Error("Could not find jobId");
if (!methodId) throw new Error("Could not find methodId");
- const [materials, operations] = await Promise.all([
+ const [materials, operations, tags] = await Promise.all([
getJobMaterialsByMethodId(client, methodId),
getJobOperationsByMethodId(client, methodId),
+ getTagsList(client, companyId, "operation"),
]);
if (materials.error) {
@@ -86,6 +88,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
client,
operations?.data?.map((o) => o.id)
),
+ tags: tags.data ?? [],
});
}
@@ -97,7 +100,7 @@ export default function JobMakeMethodRoute() {
const routeData = useRouteData<{ job: Job }>(path.to.job(jobId));
const loaderData = useLoaderData<typeof loader>();
- const { materials, operations, productionData } = loaderData;
+ const { materials, operations, productionData, tags } = loaderData;
return (
<div className="h-[calc(100dvh-49px)] w-full items-start overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent">
@@ -108,6 +111,7 @@ export default function JobMakeMethodRoute() {
jobMakeMethodId={methodId}
operations={operations}
locationId={routeData?.job?.locationId ?? ""}
+ tags={tags}
/>
<JobBillOfMaterial
key={`bom:${methodId}`}
diff --git a/apps/erp/app/routes/x+/settings+/tags.tsx b/apps/erp/app/routes/x+/settings+/tags.tsx
index d9150fa81a..d16bc2b6f5 100644
--- a/apps/erp/app/routes/x+/settings+/tags.tsx
+++ b/apps/erp/app/routes/x+/settings+/tags.tsx
@@ -36,6 +36,9 @@ function getIdField(table: string) {
case "fixture":
return "itemId";
case "job":
+ case "jobOperation":
+ case "methodOperation":
+ case "quoteOperation":
default:
return "id";
}
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 9a0a8c2dc3..1d23052de3 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -8455,6 +8455,7 @@ export type Database = {
}
jobOperation: {
Row: {
+ assignee: string | null
companyId: string
createdAt: string
createdBy: string
@@ -8486,12 +8487,14 @@ export type Database = {
setupTime: number
setupUnit: Database["public"]["Enums"]["factor"]
status: Database["public"]["Enums"]["jobOperationStatus"]
+ tags: string[] | null
updatedAt: string | null
updatedBy: string | null
workCenterId: string | null
workInstruction: Json
}
Insert: {
+ assignee?: string | null
companyId: string
createdAt?: string
createdBy: string
@@ -8523,12 +8526,14 @@ export type Database = {
setupTime?: number
setupUnit?: Database["public"]["Enums"]["factor"]
status?: Database["public"]["Enums"]["jobOperationStatus"]
+ tags?: string[] | null
updatedAt?: string | null
updatedBy?: string | null
workCenterId?: string | null
workInstruction?: Json
}
Update: {
+ assignee?: string | null
companyId?: string
createdAt?: string
createdBy?: string
@@ -8560,12 +8565,48 @@ export type Database = {
setupTime?: number
setupUnit?: Database["public"]["Enums"]["factor"]
status?: Database["public"]["Enums"]["jobOperationStatus"]
+ tags?: string[] | null
updatedAt?: string | null
updatedBy?: string | null
workCenterId?: string | null
workInstruction?: Json
}
Relationships: [
+ {
+ foreignKeyName: "jobOperation_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "jobOperation_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "jobOperation_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "jobOperation_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "jobOperation_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
{
foreignKeyName: "jobOperation_companyId_fkey"
columns: ["companyId"]
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 9a0a8c2dc3..1d23052de3 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -8455,6 +8455,7 @@ export type Database = {
}
jobOperation: {
Row: {
+ assignee: string | null
companyId: string
createdAt: string
createdBy: string
@@ -8486,12 +8487,14 @@ export type Database = {
setupTime: number
setupUnit: Database["public"]["Enums"]["factor"]
status: Database["public"]["Enums"]["jobOperationStatus"]
+ tags: string[] | null
updatedAt: string | null
updatedBy: string | null
workCenterId: string | null
workInstruction: Json
}
Insert: {
+ assignee?: string | null
companyId: string
createdAt?: string
createdBy: string
@@ -8523,12 +8526,14 @@ export type Database = {
setupTime?: number
setupUnit?: Database["public"]["Enums"]["factor"]
status?: Database["public"]["Enums"]["jobOperationStatus"]
+ tags?: string[] | null
updatedAt?: string | null
updatedBy?: string | null
workCenterId?: string | null
workInstruction?: Json
}
Update: {
+ assignee?: string | null
companyId?: string
createdAt?: string
createdBy?: string
@@ -8560,12 +8565,48 @@ export type Database = {
setupTime?: number
setupUnit?: Database["public"]["Enums"]["factor"]
status?: Database["public"]["Enums"]["jobOperationStatus"]
+ tags?: string[] | null
updatedAt?: string | null
updatedBy?: string | null
workCenterId?: string | null
workInstruction?: Json
}
Relationships: [
+ {
+ foreignKeyName: "jobOperation_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "jobOperation_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "jobOperation_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "jobOperation_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "jobOperation_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
{
foreignKeyName: "jobOperation_companyId_fkey"
columns: ["companyId"]
diff --git a/packages/database/supabase/migrations/20250120143155_job-operation-assignments.sql b/packages/database/supabase/migrations/20250120143155_job-operation-assignments.sql
new file mode 100644
index 0000000000..45c5467662
--- /dev/null
+++ b/packages/database/supabase/migrations/20250120143155_job-operation-assignments.sql
@@ -0,0 +1,2 @@
+ALTER TABLE "jobOperation" ADD COLUMN "assignee" TEXT REFERENCES "user"("id") ON DELETE SET NULL;
+ALTER TABLE "jobOperation" ADD COLUMN "tags" TEXT[] DEFAULT '{}';
\ No newline at end of file
diff --git a/packages/react/src/Avatar.tsx b/packages/react/src/Avatar.tsx
index b1190e9296..27fdb3a029 100644
--- a/packages/react/src/Avatar.tsx
+++ b/packages/react/src/Avatar.tsx
@@ -30,6 +30,7 @@ export const avatarVariants = cva(
md: "h-12 w-12 text-base",
sm: "h-8 w-8 text-xs",
xs: "h-6 w-6 text-xxs",
+ xxs: "h-4 w-4 text-[10px]",
},
isGroup: {
true: "ring-2 ring-background",
diff --git a/packages/react/src/CreateableMultiSelect.tsx b/packages/react/src/CreateableMultiSelect.tsx
index b7cddbba58..66b22f7f35 100644
--- a/packages/react/src/CreateableMultiSelect.tsx
+++ b/packages/react/src/CreateableMultiSelect.tsx
@@ -41,6 +41,7 @@ export type CreatableMultiSelectProps = Omit<
value: string[],
options: { value: string; label: string; helper?: string }[]
) => React.ReactNode;
+ inlineIcon?: React.ReactElement;
onChange: (selected: string[]) => void;
onCreateOption?: (inputValue: string) => void;
};
@@ -63,6 +64,7 @@ const CreatableMultiSelect = forwardRef<
itemHeight = 40,
showCreateOptionOnEmpty = true,
inline,
+ inlineIcon,
onChange,
onCreateOption,
...props
@@ -99,7 +101,15 @@ const CreatableMultiSelect = forwardRef<
size={size ?? "sm"}
variant="secondary"
aria-label={hasSelections ? "Edit" : "Add"}
- icon={hasSelections ? <LuSettings2 /> : <LuCirclePlus />}
+ icon={
+ inlineIcon ? (
+ inlineIcon
+ ) : hasSelections ? (
+ <LuSettings2 />
+ ) : (
+ <LuCirclePlus />
+ )
+ }
ref={ref}
isDisabled={isReadOnly}
onClick={() => setOpen(true)}