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: implement ui for editing attributes by category on person page

Brad Barbin4a1ea0340309
diff --git a/apps/erp/app/components/Form/EmojiPicker.tsx b/apps/erp/app/components/Form/EmojiPicker.tsx
new file mode 100644
index 0000000000..653a90c78b
--- /dev/null
+++ b/apps/erp/app/components/Form/EmojiPicker.tsx
@@ -0,0 +1,94 @@
+import { useControlField, useField } from "@carbon/form";
+import {
+ Button,
+ FormControl,
+ FormErrorMessage,
+ Popover,
+ PopoverContent,
+ PopoverFooter,
+ PopoverTrigger,
+} from "@carbon/react";
+import data from "@emoji-mart/data";
+import Picker from "@emoji-mart/react";
+import { useState } from "react";
+import { LuSmilePlus, LuTrash } from "react-icons/lu";
+
+type EmojiPickerProps = {
+ name: string;
+ label?: string;
+};
+
+type EmojiData = {
+ native: string;
+ id: string;
+ name: string;
+};
+
+const EmojiPicker = ({ name }: EmojiPickerProps) => {
+ const { error } = useField(name);
+ const [value, setValue] = useControlField<string>(name);
+ const [open, setOpen] = useState(false);
+
+ const onEmojiSelect = (emoji: EmojiData) => {
+ setValue(emoji.native);
+ setOpen(false);
+ };
+
+ const onRemove = () => {
+ setValue("");
+ setOpen(false);
+ };
+
+ return (
+ <FormControl>
+ <input type="hidden" name={name} value={value ?? ""} />
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger asChild>
+ {value ? (
+ <button
+ type="button"
+ className="inline-flex items-center justify-center rounded-md h-16 w-16 text-5xl hover:bg-accent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
+ >
+ {value}
+ </button>
+ ) : (
+ <div>
+ <Button type="button" variant="ghost" leftIcon={<LuSmilePlus />}>
+ Add icon
+ </Button>
+ </div>
+ )}
+ </PopoverTrigger>
+ <PopoverContent
+ className="w-auto p-0 border-0 bg-white"
+ align="start"
+ sideOffset={8}
+ >
+ <Picker
+ data={data}
+ onEmojiSelect={onEmojiSelect}
+ theme="light"
+ previewPosition="none"
+ skinTonePosition="none"
+ navPosition="bottom"
+ perLine={8}
+ />
+ {value && (
+ <PopoverFooter className="flex justify-center">
+ <Button
+ variant="destructive"
+ onClick={onRemove}
+ leftIcon={<LuTrash className="h-4 w-4 mr-2" />}
+ >
+ Remove icon
+ </Button>
+ </PopoverFooter>
+ )}
+ </PopoverContent>
+ </Popover>
+ {error && <FormErrorMessage>{error}</FormErrorMessage>}
+ </FormControl>
+ );
+};
+
+export default EmojiPicker;
diff --git a/apps/erp/app/components/Form/index.ts b/apps/erp/app/components/Form/index.ts
index ed1653dccf..df114d99fd 100644
--- a/apps/erp/app/components/Form/index.ts
+++ b/apps/erp/app/components/Form/index.ts
@@ -44,6 +44,7 @@ import DefaultMethodType from "./DefaultMethodType";
import Department from "./Department";
import Employee from "./Employee";
import Employees from "./Employees";
+import EmojiPicker from "./EmojiPicker";
import Item from "./Item";
import ItemPostingGroup from "./ItemPostingGroup";
import Location from "./Location";
@@ -104,6 +105,7 @@ export {
Department,
Employee,
Employees,
+ EmojiPicker,
Hidden,
Input,
InputControlled,
diff --git a/apps/erp/app/modules/account/account.models.ts b/apps/erp/app/modules/account/account.models.ts
index b19c4971fc..942c6c99d0 100644
--- a/apps/erp/app/modules/account/account.models.ts
+++ b/apps/erp/app/modules/account/account.models.ts
@@ -61,6 +61,16 @@ export const attributeUserValidator = z.object({
value: z.string().min(1, { message: "User is required" }),
});
+export const attributeCustomerValidator = z.object({
+ ...attributeDefaults,
+ value: z.string().min(1, { message: "Customer is required" }),
+});
+
+export const attributeSupplierValidator = z.object({
+ ...attributeDefaults,
+ value: z.string().min(1, { message: "Supplier is required" }),
+});
+
export const deleteUserAttributeValueValidator = z.object({
userAttributeId: z.string().min(20),
userAttributeValueId: z.string().min(20),
diff --git a/apps/erp/app/modules/account/account.service.ts b/apps/erp/app/modules/account/account.service.ts
index 481d2ef573..4c2fc86b2f 100644
--- a/apps/erp/app/modules/account/account.service.ts
+++ b/apps/erp/app/modules/account/account.service.ts
@@ -31,7 +31,7 @@ export async function getAttributes(
return client
.from("userAttributeCategory")
.select(
- `id, name, companyId,
+ `id, name, emoji, companyId,
userAttribute(id, name, listOptions, canSelfManage,
attributeDataType(id, isBoolean, isDate, isNumeric, isText, isUser),
userAttributeValue(
@@ -63,6 +63,55 @@ export async function getPublicAttributes(
return getAttributes(client, userId, companyId, true);
}
+export async function getAllAttributeCategories(
+ client: SupabaseClient<Database>,
+ userId: string,
+ companyId: string
+) {
+ return client
+ .from("userAttributeCategory")
+ .select(
+ `id, name, emoji, companyId,
+ userAttribute(id, name, listOptions, canSelfManage,
+ attributeDataType(id, isBoolean, isDate, isNumeric, isText, isUser),
+ userAttributeValue(
+ id, valueBoolean, valueDate, valueNumeric, valueText, valueUser
+ )
+ )`
+ )
+ .eq("companyId", companyId)
+ .eq("active", true)
+ .eq("userAttribute.active", true)
+ .eq("userAttribute.userAttributeValue.userId", userId)
+ .order("sortOrder", { foreignTable: "userAttribute", ascending: true });
+}
+
+export async function getAttributeCategoryWithValues(
+ client: SupabaseClient<Database>,
+ categoryId: string,
+ userId: string,
+ companyId: string
+) {
+ return client
+ .from("userAttributeCategory")
+ .select(
+ `id, name, emoji, companyId, public,
+ userAttribute(id, name, listOptions, canSelfManage,
+ attributeDataType(id, isBoolean, isDate, isNumeric, isText, isUser),
+ userAttributeValue(
+ id, valueBoolean, valueDate, valueNumeric, valueText, valueUser
+ )
+ )`
+ )
+ .eq("id", categoryId)
+ .eq("companyId", companyId)
+ .eq("active", true)
+ .eq("userAttribute.active", true)
+ .eq("userAttribute.userAttributeValue.userId", userId)
+ .order("sortOrder", { foreignTable: "userAttribute", ascending: true })
+ .single();
+}
+
export async function updateAvatar(
client: SupabaseClient<Database>,
userId: string,
@@ -136,6 +185,14 @@ export async function upsertUserAttributeValue(
valueUpdate = { valueUser: value };
}
+ if (type === "customer" && typeof value === "string") {
+ valueUpdate = { valueText: value };
+ }
+
+ if (type === "supplier" && typeof value === "string") {
+ valueUpdate = { valueText: value };
+ }
+
if (userAttributeValueId) {
return client
.from("userAttributeValue")
diff --git a/apps/erp/app/modules/account/ui/UserAttributes/UserAttributesForm.tsx b/apps/erp/app/modules/account/ui/UserAttributes/UserAttributesForm.tsx
index 7a5936e070..223d6a5607 100644
--- a/apps/erp/app/modules/account/ui/UserAttributes/UserAttributesForm.tsx
+++ b/apps/erp/app/modules/account/ui/UserAttributes/UserAttributesForm.tsx
@@ -4,9 +4,10 @@ import { parseDate } from "@internationalized/date";
import { useLocale } from "@react-aria/i18n";
import { useFetcher, useParams } from "@remix-run/react";
import { useState } from "react";
-import type { ZodSchema } from 'zod/v3';
+import type { ZodSchema } from "zod/v3";
import {
Boolean as BooleanInput,
+ Customer,
DatePicker,
Employee,
Hidden,
@@ -14,14 +15,19 @@ import {
Number as NumberInput,
Select,
Submit,
+ Supplier,
} from "~/components/Form";
import { UserSelect } from "~/components/Selectors";
+import CustomerAvatar from "~/components/CustomerAvatar";
+import SupplierAvatar from "~/components/SupplierAvatar";
import { usePermissions, useUser } from "~/hooks";
import { DataType } from "~/modules/shared";
import { path } from "~/utils/path";
import {
attributeBooleanValidator,
+ attributeCustomerValidator,
attributeNumericValidator,
+ attributeSupplierValidator,
attributeTextValidator,
attributeUserValidator,
deleteUserAttributeValueValidator,
@@ -100,7 +106,6 @@ type GenericAttributeRowProps = {
displayValue: string | number | boolean;
isAuthorized: boolean;
type: DataType;
- // @ts-expect-error
updateFetcher: ReturnType<typeof useFetcher>;
userAttributeId: string;
userAttributeValueId?: string;
@@ -111,6 +116,7 @@ type GenericAttributeRowProps = {
const GenericAttributeRow = (props: GenericAttributeRowProps) => {
const editing = useDisclosure();
+ const { locale } = useLocale();
const onSubmit = (value: string | boolean | number) => {
props.setOptimisticUpdate(value);
editing.onClose();
@@ -120,7 +126,7 @@ const GenericAttributeRow = (props: GenericAttributeRowProps) => {
<div key={props.attribute.id} className="w-full">
{editing.isOpen
? TypedForm({ ...props, onSubmit, onClose: editing.onClose })
- : TypedDisplay({ ...props, onOpen: editing.onOpen })}
+ : TypedDisplay({ ...props, locale, onOpen: editing.onOpen })}
</div>
);
};
@@ -349,6 +355,72 @@ function TypedForm(
</div>
</ValidatedForm>
);
+ case DataType.Customer:
+ return (
+ <ValidatedForm
+ method="post"
+ action={path.to.userAttribute(userId)}
+ validator={attributeCustomerValidator}
+ defaultValues={{
+ userAttributeId,
+ userAttributeValueId,
+ value: value?.toString(),
+ }}
+ fetcher={updateFetcher}
+ onSubmit={(data) => onSubmit(data.value)}
+ >
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center">
+ <p className="text-muted-foreground self-center">
+ {attribute.name}
+ </p>
+ <div>
+ <Hidden name="type" value="customer" />
+ <Hidden name="userAttributeId" />
+ <Hidden name="userAttributeValueId" />
+ <Customer label="" name="value" />
+ </div>
+ <HStack className="justify-end w-full self-center">
+ <Submit type="submit">Save</Submit>
+ <Button variant="ghost" onClick={onClose}>
+ Cancel
+ </Button>
+ </HStack>
+ </div>
+ </ValidatedForm>
+ );
+ case DataType.Supplier:
+ return (
+ <ValidatedForm
+ method="post"
+ action={path.to.userAttribute(userId)}
+ validator={attributeSupplierValidator}
+ defaultValues={{
+ userAttributeId,
+ userAttributeValueId,
+ value: value?.toString(),
+ }}
+ fetcher={updateFetcher}
+ onSubmit={(data) => onSubmit(data.value)}
+ >
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center">
+ <p className="text-muted-foreground self-center">
+ {attribute.name}
+ </p>
+ <div>
+ <Hidden name="type" value="supplier" />
+ <Hidden name="userAttributeId" />
+ <Hidden name="userAttributeValueId" />
+ <Supplier label="" name="value" />
+ </div>
+ <HStack className="justify-end w-full self-center">
+ <Submit type="submit">Save</Submit>
+ <Button variant="ghost" onClick={onClose}>
+ Cancel
+ </Button>
+ </HStack>
+ </div>
+ </ValidatedForm>
+ );
default:
return (
<div className="text-destructive bg-destructive-foreground p-4 w-full">
@@ -360,14 +432,15 @@ function TypedForm(
function TypedDisplay(
props: GenericAttributeRowProps & {
+ locale: string;
onOpen: () => void;
}
) {
- const { locale } = useLocale();
const {
attribute,
displayValue,
isAuthorized,
+ locale,
type,
userAttributeValueId,
value,
@@ -386,7 +459,7 @@ function TypedDisplay(
)}
<HStack className="justify-end w-full self-center">
<Button
- isDisabled={!isAuthorized || !attribute.canSelfManage}
+ isDisabled={isAuthorized && !attribute.canSelfManage}
variant="ghost"
onClick={onOpen}
>
@@ -440,6 +513,46 @@ function TypedDisplay(
<p className="self-center">{displayValue}</p>
)}
+ <UpdateRemoveButtons
+ canRemove={
+ !isAuthorized || (attribute.canSelfManage === true && !!value)
+ }
+ canUpdate={!isAuthorized || (attribute.canSelfManage ?? false)}
+ {...props}
+ onSubmit={setOptimisticUpdate}
+ />
+ </div>
+ );
+ case DataType.Customer:
+ return (
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center">
+ <p className="text-muted-foreground self-center">{attribute.name}</p>
+ {value ? (
+ <CustomerAvatar customerId={value.toString()} />
+ ) : (
+ <p className="self-center">{displayValue}</p>
+ )}
+
+ <UpdateRemoveButtons
+ canRemove={
+ !isAuthorized || (attribute.canSelfManage === true && !!value)
+ }
+ canUpdate={!isAuthorized || (attribute.canSelfManage ?? false)}
+ {...props}
+ onSubmit={setOptimisticUpdate}
+ />
+ </div>
+ );
+ case DataType.Supplier:
+ return (
+ <div className="grid grid-cols-[1fr_2fr_1fr] border-t border-border gap-x-2 pt-3 w-full items-center">
+ <p className="text-muted-foreground self-center">{attribute.name}</p>
+ {value ? (
+ <SupplierAvatar supplierId={value.toString()} />
+ ) : (
+ <p className="self-center">{displayValue}</p>
+ )}
+
<UpdateRemoveButtons
canRemove={
!isAuthorized || (attribute.canSelfManage === true && !!value)
@@ -514,6 +627,16 @@ function getGenericProps(
value = userAttributeValue.valueUser;
if (userAttributeValue.valueUser)
displayValue = userAttributeValue.valueUser;
+ break;
+ case DataType.Customer:
+ value = userAttributeValue.valueText;
+ if (userAttributeValue.valueText)
+ displayValue = userAttributeValue.valueText;
+ break;
+ case DataType.Supplier:
+ value = userAttributeValue.valueText;
+ if (userAttributeValue.valueText)
+ displayValue = userAttributeValue.valueText;
}
}
diff --git a/apps/erp/app/modules/people/people.models.ts b/apps/erp/app/modules/people/people.models.ts
index cfc94edd69..69879b6a8b 100644
--- a/apps/erp/app/modules/people/people.models.ts
+++ b/apps/erp/app/modules/people/people.models.ts
@@ -1,4 +1,4 @@
-import { z } from 'zod/v3';
+import { z } from "zod/v3";
import { zfd } from "zod-form-data";
import { DataType } from "~/modules/shared";
@@ -27,6 +27,7 @@ export const attributeValidator = z
export const attributeCategoryValidator = z.object({
id: zfd.text(z.string().optional()),
name: z.string().min(1, { message: "Name is required" }),
+ emoji: zfd.text(z.string().optional()),
isPublic: zfd.checkbox(),
});
diff --git a/apps/erp/app/modules/people/people.service.ts b/apps/erp/app/modules/people/people.service.ts
index ea8b0620e5..b207b8b614 100644
--- a/apps/erp/app/modules/people/people.service.ts
+++ b/apps/erp/app/modules/people/people.service.ts
@@ -429,6 +429,7 @@ export async function insertAttributeCategory(
client: SupabaseClient<Database>,
attributeCategory: {
name: string;
+ emoji?: string;
public: boolean;
companyId: string;
createdBy: string;
@@ -481,6 +482,7 @@ export async function updateAttributeCategory(
attributeCategory: {
id: string;
name: string;
+ emoji?: string;
public: boolean;
updatedBy: string;
}
diff --git a/apps/erp/app/modules/people/ui/Attributes/AttributeCategoriesTable.tsx b/apps/erp/app/modules/people/ui/Attributes/AttributeCategoriesTable.tsx
index 28de222b49..534364edd0 100644
--- a/apps/erp/app/modules/people/ui/Attributes/AttributeCategoriesTable.tsx
+++ b/apps/erp/app/modules/people/ui/Attributes/AttributeCategoriesTable.tsx
@@ -10,7 +10,7 @@ import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo, useState } from "react";
import { BiAddToQueue } from "react-icons/bi";
import { BsListUl } from "react-icons/bs";
-import { LuPencil, LuTrash } from "react-icons/lu";
+import { LuPencil, LuTrash, LuListChecks } from "react-icons/lu";
import { Hyperlink, New, Table } from "~/components";
import { ConfirmDelete } from "~/components/Modals";
import { usePermissions, useUrlParams } from "~/hooks";
@@ -49,7 +49,14 @@ const AttributeCategoriesTable = memo(
accessorKey: "name",
header: "Category",
cell: ({ row }) => (
- <Hyperlink to={row.original.id}>{row.original.name}</Hyperlink>
+ <Hyperlink to={row.original.id} className="flex items-center gap-2">
+ {row.original.emoji ? (
+ <span className="text-base">{row.original.emoji}</span>
+ ) : (
+ <LuListChecks />
+ )}{" "}
+ <span>{row.original.name}</span>
+ </Hyperlink>
),
},
{
diff --git a/apps/erp/app/modules/people/ui/Attributes/AttributeCategoryDetail.tsx b/apps/erp/app/modules/people/ui/Attributes/AttributeCategoryDetail.tsx
index 5e3cb98fec..74be2d6ecb 100644
--- a/apps/erp/app/modules/people/ui/Attributes/AttributeCategoryDetail.tsx
+++ b/apps/erp/app/modules/people/ui/Attributes/AttributeCategoryDetail.tsx
@@ -1,5 +1,6 @@
import {
ActionMenu,
+ Badge,
Button,
Drawer,
DrawerBody,
@@ -144,9 +145,18 @@ const AttributeCategoryDetail = ({
>
<DrawerContent>
<DrawerHeader>
- <DrawerTitle>{attributeCategory.name}</DrawerTitle>
+ <DrawerTitle>
+ {attributeCategory.emoji ? (
+ <span>{attributeCategory.emoji}</span>
+ ) : null}{" "}
+ {attributeCategory.name}
+ </DrawerTitle>
<DrawerDescription>
- {attributeCategory.public ? "Public" : "Private"}
+ <Badge
+ variant={attributeCategory.public ? "default" : "secondary"}
+ >
+ {attributeCategory.public ? "Public" : "Private"}
+ </Badge>
</DrawerDescription>
</DrawerHeader>
<DrawerBody>
diff --git a/apps/erp/app/modules/people/ui/Attributes/AttributeCategoryForm.tsx b/apps/erp/app/modules/people/ui/Attributes/AttributeCategoryForm.tsx
index 83aa3703dc..0df8c54a3c 100644
--- a/apps/erp/app/modules/people/ui/Attributes/AttributeCategoryForm.tsx
+++ b/apps/erp/app/modules/people/ui/Attributes/AttributeCategoryForm.tsx
@@ -10,8 +10,8 @@ import {
HStack,
VStack,
} from "@carbon/react";
-import type { z } from 'zod/v3';
-import { Boolean, Hidden, Input, Submit } from "~/components/Form";
+import type { z } from "zod/v3";
+import { Boolean, EmojiPicker, Hidden, Input, Submit } from "~/components/Form";
import { usePermissions } from "~/hooks";
import { path } from "~/utils/path";
@@ -59,7 +59,10 @@ const AttributeCategoryForm = ({
<DrawerBody>
<Hidden name="id" />
<VStack spacing={4}>
+ <EmojiPicker name="emoji" />
+
<Input name="name" label="Category Name" />
+
<Boolean
name="isPublic"
label="Public"
diff --git a/apps/erp/app/modules/people/ui/Person/PersonSidebar/PersonSidebar.tsx b/apps/erp/app/modules/people/ui/Person/PersonSidebar/PersonSidebar.tsx
index 3f784b78f1..a6e7ad982a 100644
--- a/apps/erp/app/modules/people/ui/Person/PersonSidebar/PersonSidebar.tsx
+++ b/apps/erp/app/modules/people/ui/Person/PersonSidebar/PersonSidebar.tsx
@@ -1,8 +1,13 @@
+import type { PublicAttributes } from "~/modules/account";
import { DetailSidebar } from "~/components/Layout";
import { usePersonSidebar } from "./usePersonSidebar";
-const PersonSidebar = () => {
- const links = usePersonSidebar();
+type PersonSidebarProps = {
+ attributeCategories: PublicAttributes[];
+};
+
+const PersonSidebar = ({ attributeCategories }: PersonSidebarProps) => {
+ const links = usePersonSidebar(attributeCategories);
return <DetailSidebar links={links} />;
};
diff --git a/apps/erp/app/modules/people/ui/Person/PersonSidebar/usePersonSidebar.tsx b/apps/erp/app/modules/people/ui/Person/PersonSidebar/usePersonSidebar.tsx
index b55a729cb1..2ffabb7629 100644
--- a/apps/erp/app/modules/people/ui/Person/PersonSidebar/usePersonSidebar.tsx
+++ b/apps/erp/app/modules/people/ui/Person/PersonSidebar/usePersonSidebar.tsx
@@ -1,7 +1,8 @@
-import { LuHardHat, LuStickyNote, LuUser } from "react-icons/lu";
+import { LuHardHat, LuList, LuStickyNote, LuUser } from "react-icons/lu";
+import type { PublicAttributes } from "~/modules/account";
-export function usePersonSidebar() {
- return [
+export function usePersonSidebar(attributeCategories: PublicAttributes[]) {
+ const baseLinks = [
{
name: "Profile",
to: "details",
@@ -18,4 +19,16 @@ export function usePersonSidebar() {
icon: <LuStickyNote />,
},
];
+
+ const categoryLinks = attributeCategories.map((category) => ({
+ name: category.name ?? "Attributes",
+ to: `attributes/${category.id}`,
+ icon: category.emoji ? (
+ <span className="text-base">{category.emoji}</span>
+ ) : (
+ <LuList />
+ ),
+ }));
+
+ return [...baseLinks, ...categoryLinks];
}
diff --git a/apps/erp/app/routes/x+/account+/$userId.attribute.tsx b/apps/erp/app/routes/x+/account+/$userId.attribute.tsx
index 8acee15359..1a22dcd662 100644
--- a/apps/erp/app/routes/x+/account+/$userId.attribute.tsx
+++ b/apps/erp/app/routes/x+/account+/$userId.attribute.tsx
@@ -4,10 +4,12 @@ import { flash } from "@carbon/auth/session.server";
import { validationError, validator } from "@carbon/form";
import type { ActionFunctionArgs } from "@vercel/remix";
import { json } from "@vercel/remix";
-import type { ZodSchema } from 'zod/v3';
+import type { ZodSchema } from "zod/v3";
import {
attributeBooleanValidator,
+ attributeCustomerValidator,
attributeNumericValidator,
+ attributeSupplierValidator,
attributeTextValidator,
attributeUserValidator,
upsertUserAttributeValue,
@@ -110,6 +112,10 @@ function getValidatorByType(type: string) {
return attributeTextValidator;
case "user":
return attributeUserValidator;
+ case "supplier":
+ return attributeSupplierValidator;
+ case "customer":
+ return attributeCustomerValidator;
default:
throw new Error("Invalid type provided");
}
diff --git a/apps/erp/app/routes/x+/people+/attributes.$categoryId.tsx b/apps/erp/app/routes/x+/people+/attributes.$categoryId.tsx
index b948bc16eb..c82cbe6635 100644
--- a/apps/erp/app/routes/x+/people+/attributes.$categoryId.tsx
+++ b/apps/erp/app/routes/x+/people+/attributes.$categoryId.tsx
@@ -50,12 +50,13 @@ export async function action({ request }: ActionFunctionArgs) {
return validationError(validation.error);
}
- const { id, name, isPublic } = validation.data;
+ const { id, name, emoji, isPublic } = validation.data;
if (!id) throw new Error("ID is was not found");
const updateCategory = await updateAttributeCategory(client, {
id,
name,
+ emoji,
public: isPublic,
updatedBy: userId,
});
@@ -83,6 +84,7 @@ export default function EditAttributeCategoryRoute() {
const initialValues = {
id: attributeCategory?.id,
name: attributeCategory?.name ?? "",
+ emoji: attributeCategory?.emoji ?? "",
isPublic: attributeCategory?.public ?? false,
};
diff --git a/apps/erp/app/routes/x+/people+/attributes.new.tsx b/apps/erp/app/routes/x+/people+/attributes.new.tsx
index 043b08c05a..f4faed1e32 100644
--- a/apps/erp/app/routes/x+/people+/attributes.new.tsx
+++ b/apps/erp/app/routes/x+/people+/attributes.new.tsx
@@ -26,10 +26,11 @@ export async function action({ request }: ActionFunctionArgs) {
return validationError(validation.error);
}
- const { name, isPublic } = validation.data;
+ const { name, emoji, isPublic } = validation.data;
const createAttributeCategory = await insertAttributeCategory(client, {
name,
+ emoji,
public: isPublic,
companyId,
createdBy: userId,
@@ -56,6 +57,7 @@ export default function NewAttributeCategoryRoute() {
const initialValues = {
name: "",
+ emoji: "",
isPublic: false,
};
diff --git a/apps/erp/app/routes/x+/person+/$personId.attributes.$categoryId.tsx b/apps/erp/app/routes/x+/person+/$personId.attributes.$categoryId.tsx
new file mode 100644
index 0000000000..78a7676531
--- /dev/null
+++ b/apps/erp/app/routes/x+/person+/$personId.attributes.$categoryId.tsx
@@ -0,0 +1,71 @@
+import { error } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { flash } from "@carbon/auth/session.server";
+import {
+ Badge,
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+} from "@carbon/react";
+import { useLoaderData } from "@remix-run/react";
+import type { LoaderFunctionArgs } from "@vercel/remix";
+import { json, redirect } from "@vercel/remix";
+import { getAttributeCategoryWithValues } from "~/modules/account";
+import { UserAttributesForm } from "~/modules/account/ui/UserAttributes";
+import { path } from "~/utils/path";
+
+export async function loader({ request, params }: LoaderFunctionArgs) {
+ const { client, companyId } = await requirePermissions(request, {
+ view: "people",
+ });
+
+ const { personId, categoryId } = params;
+ if (!personId) throw new Error("Could not find personId");
+ if (!categoryId) throw new Error("Could not find categoryId");
+
+ const category = await getAttributeCategoryWithValues(
+ client,
+ categoryId,
+ personId,
+ companyId
+ );
+
+ if (category.error || !category.data) {
+ throw redirect(
+ path.to.person(personId),
+ await flash(
+ request,
+ error(category.error, "Failed to load attribute category")
+ )
+ );
+ }
+
+ return json({
+ category: category.data,
+ });
+}
+
+export default function PersonAttributeCategoryRoute() {
+ const { category } = useLoaderData<typeof loader>();
+
+ return (
+ <Card>
+ <CardHeader>
+ <CardTitle>
+ {category.emoji ? <span>{category.emoji}</span> : null}{" "}
+ {category.name}
+ </CardTitle>
+ <CardDescription>
+ <Badge variant={category.public ? "default" : "secondary"}>
+ {category.public ? "Public" : "Private"}
+ </Badge>
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <UserAttributesForm attributeCategory={category} />
+ </CardContent>
+ </Card>
+ );
+}
diff --git a/apps/erp/app/routes/x+/person+/$personId.tsx b/apps/erp/app/routes/x+/person+/$personId.tsx
index 578275f233..39e962ffc2 100644
--- a/apps/erp/app/routes/x+/person+/$personId.tsx
+++ b/apps/erp/app/routes/x+/person+/$personId.tsx
@@ -2,11 +2,12 @@ import { assertIsPost, error, success } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import { flash } from "@carbon/auth/session.server";
import { validationError, validator } from "@carbon/form";
-import { Outlet } from "@remix-run/react";
+import { Outlet, useLoaderData } from "@remix-run/react";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "@vercel/remix";
import { json, redirect } from "@vercel/remix";
import {
accountProfileValidator,
+ getAllAttributeCategories,
updatePublicAccount,
} from "~/modules/account";
import { getEmployeeSummary } from "~/modules/people";
@@ -27,8 +28,9 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const { personId } = params;
if (!personId) throw new Error("Could not find personId");
- const [employeeSummary] = await Promise.all([
+ const [employeeSummary, attributeCategories] = await Promise.all([
getEmployeeSummary(client, personId, companyId),
+ getAllAttributeCategories(client, personId, companyId),
]);
if (employeeSummary.error) {
@@ -43,6 +45,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
return json({
employeeSummary: employeeSummary.data,
+ attributeCategories: attributeCategories.data ?? [],
});
}
@@ -83,11 +86,13 @@ export async function action({ request, params }: ActionFunctionArgs) {
}
export default function PersonRoute() {
+ const { attributeCategories } = useLoaderData<typeof loader>();
+
return (
<>
<PersonPreview />
<div className="grid grid-cols-1 md:grid-cols-[1fr_4fr] h-full w-full gap-4">
- <PersonSidebar />
+ <PersonSidebar attributeCategories={attributeCategories} />
<Outlet />
</div>
</>
diff --git a/apps/erp/app/utils/path.ts b/apps/erp/app/utils/path.ts
index 280edeca79..b1442a361d 100644
--- a/apps/erp/app/utils/path.ts
+++ b/apps/erp/app/utils/path.ts
@@ -1079,6 +1079,8 @@ export const path = {
person: (id: string) => generatePath(`${x}/person/${id}`),
personDetails: (id: string) => generatePath(`${x}/person/${id}/details`),
personJob: (id: string) => generatePath(`${x}/person/${id}/job`),
+ personAttributeCategory: (personId: string, categoryId: string) =>
+ generatePath(`${x}/person/${personId}/attributes/${categoryId}`),
stockTransfer: (id: string) => generatePath(`${x}/stock-transfer/${id}`),
stockTransferComplete: (id: string) =>
generatePath(`${x}/stock-transfer/${id}/complete`),
diff --git a/apps/erp/package.json b/apps/erp/package.json
index 105cbf78fd..d52931dae5 100644
--- a/apps/erp/package.json
+++ b/apps/erp/package.json
@@ -4,8 +4,8 @@
"dependencies": {
"@ai-sdk-tools/agents": "1.2.0",
"@ai-sdk-tools/artifacts": "1.2.0",
- "@ai-sdk-tools/devtools": "1.2.0",
"@ai-sdk-tools/cache": "1.2.0",
+ "@ai-sdk-tools/devtools": "1.2.0",
"@ai-sdk-tools/memory": "1.2.0",
"@ai-sdk-tools/store": "1.2.0",
"@ai-sdk/anthropic": "^2.0.41",
@@ -24,6 +24,8 @@
"@carbon/utils": "*",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/sortable": "^8.0.0",
+ "@emoji-mart/data": "^1.2.1",
+ "@emoji-mart/react": "^1.1.1",
"@epic-web/remember": "^1.1.0",
"@internationalized/date": "^3.5.2",
"@marsidev/react-turnstile": "^1.1.0",
@@ -59,6 +61,7 @@
"cookie": "^0.6.0",
"d3": "^7.8.5",
"d3-array": "^3.2.4",
+ "emoji-mart": "^5.6.0",
"framer-motion": "^11.1.7",
"isbot": "3.6.13",
"json-2-csv": "^5.5.10",
diff --git a/package-lock.json b/package-lock.json
index 62ebc6ebf4..253302de35 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -113,6 +113,8 @@
"@carbon/utils": "*",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/sortable": "^8.0.0",
+ "@emoji-mart/data": "^1.2.1",
+ "@emoji-mart/react": "^1.1.1",
"@epic-web/remember": "^1.1.0",
"@internationalized/date": "^3.5.2",
"@marsidev/react-turnstile": "^1.1.0",
@@ -148,6 +150,7 @@
"cookie": "^0.6.0",
"d3": "^7.8.5",
"d3-array": "^3.2.4",
+ "emoji-mart": "^5.6.0",
"framer-motion": "^11.1.7",
"isbot": "3.6.13",
"json-2-csv": "^5.5.10",
@@ -2160,6 +2163,22 @@
"tslib": "^2.4.0"
}
},
+ "node_modules/@emoji-mart/data": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@emoji-mart/data/-/data-1.2.1.tgz",
+ "integrity": "sha512-no2pQMWiBy6gpBEiqGeU77/bFejDqUTRY7KX+0+iur13op3bqUsXdnwoZs6Xb1zbv0gAj5VvS1PWoUUckSr5Dw==",
+ "license": "MIT"
+ },
+ "node_modules/@emoji-mart/react": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@emoji-mart/react/-/react-1.1.1.tgz",
+ "integrity": "sha512-NMlFNeWgv1//uPsvLxvGQoIerPuVdXwK/EUek8OOkJ6wVOWPUizRBJU0hDqWZCOROVpfBgCemaC3m6jDOXi03g==",
+ "license": "MIT",
+ "peerDependencies": {
+ "emoji-mart": "^5.2",
+ "react": "^16.8 || ^17 || ^18"
+ }
+ },
"node_modules/@emotion/babel-plugin": {
"version": "11.13.5",
"resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.13.5.tgz",
@@ -17536,6 +17555,12 @@
"url": "https://github.com/sindresorhus/emittery?sponsor=1"
}
},
+ "node_modules/emoji-mart": {
+ "version": "5.6.0",
+ "resolved": "https://registry.npmjs.org/emoji-mart/-/emoji-mart-5.6.0.tgz",
+ "integrity": "sha512-eJp3QRe79pjwa+duv+n7+5YsNhRcMl812EcFVwrnRvYKoNPoQb5qxU8DG6Bgwji0akHdp6D4Ln6tYLG58MFSow==",
+ "license": "MIT"
+ },
"node_modules/emoji-regex": {
"version": "10.6.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz",
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index d897bf9da2..7b1f0a9e7b 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -16438,6 +16438,7 @@ export type Database = {
Row: {
assignee: string | null
companyId: string
+ completedDate: string | null
createdAt: string
createdBy: string
id: string
@@ -16451,6 +16452,7 @@ export type Database = {
Insert: {
assignee?: string | null
companyId: string
+ completedDate?: string | null
createdAt?: string
createdBy: string
id?: string
@@ -16464,6 +16466,7 @@ export type Database = {
Update: {
assignee?: string | null
companyId?: string
+ completedDate?: string | null
createdAt?: string
createdBy?: string
id?: string
@@ -19639,6 +19642,7 @@ export type Database = {
name: string
processId: string | null
status: Database["public"]["Enums"]["procedureStatus"]
+ tags: string[] | null
updatedAt: string | null
updatedBy: string | null
version: number
@@ -19654,6 +19658,7 @@ export type Database = {
name: string
processId?: string | null
status?: Database["public"]["Enums"]["procedureStatus"]
+ tags?: string[] | null
updatedAt?: string | null
updatedBy?: string | null
version?: number
@@ -19669,6 +19674,7 @@ export type Database = {
name?: string
processId?: string | null
status?: Database["public"]["Enums"]["procedureStatus"]
+ tags?: string[] | null
updatedAt?: string | null
updatedBy?: string | null
version?: number
@@ -23125,7 +23131,6 @@ export type Database = {
id: string
name: string
status: Database["public"]["Enums"]["qualityDocumentStatus"]
- tags: string[] | null
updatedAt: string | null
updatedBy: string | null
version: number
@@ -23140,7 +23145,6 @@ export type Database = {
id?: string
name: string
status?: Database["public"]["Enums"]["qualityDocumentStatus"]
- tags?: string[] | null
updatedAt?: string | null
updatedBy?: string | null
version?: number
@@ -23155,7 +23159,6 @@ export type Database = {
id?: string
name?: string
status?: Database["public"]["Enums"]["qualityDocumentStatus"]
- tags?: string[] | null
updatedAt?: string | null
updatedBy?: string | null
version?: number
@@ -35689,6 +35692,7 @@ export type Database = {
companyId: string | null
createdAt: string
createdBy: string
+ emoji: string | null
id: string
name: string
protected: boolean | null
@@ -35701,6 +35705,7 @@ export type Database = {
companyId?: string | null
createdAt?: string
createdBy: string
+ emoji?: string | null
id?: string
name: string
protected?: boolean | null
@@ -35713,6 +35718,7 @@ export type Database = {
companyId?: string | null
createdAt?: string
createdBy?: string
+ emoji?: string | null
id?: string
name?: string
protected?: boolean | null
@@ -37748,6 +37754,7 @@ export type Database = {
defaultMethodType: Database["public"]["Enums"]["methodType"] | null
description: string | null
id: string | null
+ itemPostingGroupId: string | null
itemTrackingType:
| Database["public"]["Enums"]["itemTrackingType"]
| null
@@ -37934,6 +37941,13 @@ export type Database = {
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
},
+ {
+ foreignKeyName: "itemCost_itemPostingGroupId_fkey"
+ columns: ["itemPostingGroupId"]
+ isOneToOne: false
+ referencedRelation: "itemPostingGroup"
+ referencedColumns: ["id"]
+ },
]
}
contractors: {
@@ -41881,6 +41895,7 @@ export type Database = {
defaultMethodType: Database["public"]["Enums"]["methodType"] | null
description: string | null
id: string | null
+ itemPostingGroupId: string | null
itemTrackingType:
| Database["public"]["Enums"]["itemTrackingType"]
| null
@@ -42045,6 +42060,13 @@ export type Database = {
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
},
+ {
+ foreignKeyName: "itemCost_itemPostingGroupId_fkey"
+ columns: ["itemPostingGroupId"]
+ isOneToOne: false
+ referencedRelation: "itemPostingGroup"
+ referencedColumns: ["id"]
+ },
]
}
procedures: {
@@ -42055,6 +42077,7 @@ export type Database = {
name: string | null
processId: string | null
status: Database["public"]["Enums"]["procedureStatus"] | null
+ tags: string[] | null
version: number | null
versions: Json | null
}
@@ -43764,7 +43787,6 @@ export type Database = {
id: string | null
name: string | null
status: Database["public"]["Enums"]["qualityDocumentStatus"] | null
- tags: string[] | null
version: number | null
versions: Json | null
}
@@ -45712,14 +45734,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["invoiceCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["invoiceCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -46255,14 +46277,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"]
@@ -48379,6 +48401,7 @@ export type Database = {
defaultMethodType: Database["public"]["Enums"]["methodType"] | null
description: string | null
id: string | null
+ itemPostingGroupId: string | null
itemTrackingType:
| Database["public"]["Enums"]["itemTrackingType"]
| null
@@ -48543,6 +48566,13 @@ export type Database = {
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
},
+ {
+ foreignKeyName: "itemCost_itemPostingGroupId_fkey"
+ columns: ["itemPostingGroupId"]
+ isOneToOne: false
+ referencedRelation: "itemPostingGroup"
+ referencedColumns: ["id"]
+ },
]
}
userDefaults: {
@@ -48927,6 +48957,7 @@ export type Database = {
defaultMethodType: Database["public"]["Enums"]["methodType"]
description: string
id: string
+ itemPostingGroupId: string
itemTrackingType: Database["public"]["Enums"]["itemTrackingType"]
modelName: string
modelPath: string
@@ -49319,6 +49350,7 @@ export type Database = {
grade: string
gradeId: string
id: string
+ itemPostingGroupId: string
itemTrackingType: Database["public"]["Enums"]["itemTrackingType"]
materialForm: string
materialFormId: string
@@ -50372,7 +50404,9 @@ export type Database = {
| "Reject"
| "Request Approval"
purchaseOrderType: "Purchase" | "Return" | "Outside Processing"
- purchasePriceUpdateTiming: "Invoice Post" | "Purchase Order Finalize"
+ purchasePriceUpdateTiming:
+ | "Purchase Invoice Post"
+ | "Purchase Order Finalize"
qualityDocumentStatus: "Draft" | "Active" | "Archived"
quoteLineStatus: "Not Started" | "In Progress" | "Complete" | "No Quote"
quoteStatus:
@@ -51476,7 +51510,10 @@ export const Constants = {
"Request Approval",
],
purchaseOrderType: ["Purchase", "Return", "Outside Processing"],
- purchasePriceUpdateTiming: ["Invoice Post", "Purchase Order Finalize"],
+ purchasePriceUpdateTiming: [
+ "Purchase Invoice Post",
+ "Purchase Order Finalize",
+ ],
qualityDocumentStatus: ["Draft", "Active", "Archived"],
quoteLineStatus: ["Not Started", "In Progress", "Complete", "No Quote"],
quoteStatus: [
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index d897bf9da2..7b1f0a9e7b 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -16438,6 +16438,7 @@ export type Database = {
Row: {
assignee: string | null
companyId: string
+ completedDate: string | null
createdAt: string
createdBy: string
id: string
@@ -16451,6 +16452,7 @@ export type Database = {
Insert: {
assignee?: string | null
companyId: string
+ completedDate?: string | null
createdAt?: string
createdBy: string
id?: string
@@ -16464,6 +16466,7 @@ export type Database = {
Update: {
assignee?: string | null
companyId?: string
+ completedDate?: string | null
createdAt?: string
createdBy?: string
id?: string
@@ -19639,6 +19642,7 @@ export type Database = {
name: string
processId: string | null
status: Database["public"]["Enums"]["procedureStatus"]
+ tags: string[] | null
updatedAt: string | null
updatedBy: string | null
version: number
@@ -19654,6 +19658,7 @@ export type Database = {
name: string
processId?: string | null
status?: Database["public"]["Enums"]["procedureStatus"]
+ tags?: string[] | null
updatedAt?: string | null
updatedBy?: string | null
version?: number
@@ -19669,6 +19674,7 @@ export type Database = {
name?: string
processId?: string | null
status?: Database["public"]["Enums"]["procedureStatus"]
+ tags?: string[] | null
updatedAt?: string | null
updatedBy?: string | null
version?: number
@@ -23125,7 +23131,6 @@ export type Database = {
id: string
name: string
status: Database["public"]["Enums"]["qualityDocumentStatus"]
- tags: string[] | null
updatedAt: string | null
updatedBy: string | null
version: number
@@ -23140,7 +23145,6 @@ export type Database = {
id?: string
name: string
status?: Database["public"]["Enums"]["qualityDocumentStatus"]
- tags?: string[] | null
updatedAt?: string | null
updatedBy?: string | null
version?: number
@@ -23155,7 +23159,6 @@ export type Database = {
id?: string
name?: string
status?: Database["public"]["Enums"]["qualityDocumentStatus"]
- tags?: string[] | null
updatedAt?: string | null
updatedBy?: string | null
version?: number
@@ -35689,6 +35692,7 @@ export type Database = {
companyId: string | null
createdAt: string
createdBy: string
+ emoji: string | null
id: string
name: string
protected: boolean | null
@@ -35701,6 +35705,7 @@ export type Database = {
companyId?: string | null
createdAt?: string
createdBy: string
+ emoji?: string | null
id?: string
name: string
protected?: boolean | null
@@ -35713,6 +35718,7 @@ export type Database = {
companyId?: string | null
createdAt?: string
createdBy?: string
+ emoji?: string | null
id?: string
name?: string
protected?: boolean | null
@@ -37748,6 +37754,7 @@ export type Database = {
defaultMethodType: Database["public"]["Enums"]["methodType"] | null
description: string | null
id: string | null
+ itemPostingGroupId: string | null
itemTrackingType:
| Database["public"]["Enums"]["itemTrackingType"]
| null
@@ -37934,6 +37941,13 @@ export type Database = {
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
},
+ {
+ foreignKeyName: "itemCost_itemPostingGroupId_fkey"
+ columns: ["itemPostingGroupId"]
+ isOneToOne: false
+ referencedRelation: "itemPostingGroup"
+ referencedColumns: ["id"]
+ },
]
}
contractors: {
@@ -41881,6 +41895,7 @@ export type Database = {
defaultMethodType: Database["public"]["Enums"]["methodType"] | null
description: string | null
id: string | null
+ itemPostingGroupId: string | null
itemTrackingType:
| Database["public"]["Enums"]["itemTrackingType"]
| null
@@ -42045,6 +42060,13 @@ export type Database = {
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
},
+ {
+ foreignKeyName: "itemCost_itemPostingGroupId_fkey"
+ columns: ["itemPostingGroupId"]
+ isOneToOne: false
+ referencedRelation: "itemPostingGroup"
+ referencedColumns: ["id"]
+ },
]
}
procedures: {
@@ -42055,6 +42077,7 @@ export type Database = {
name: string | null
processId: string | null
status: Database["public"]["Enums"]["procedureStatus"] | null
+ tags: string[] | null
version: number | null
versions: Json | null
}
@@ -43764,7 +43787,6 @@ export type Database = {
id: string | null
name: string | null
status: Database["public"]["Enums"]["qualityDocumentStatus"] | null
- tags: string[] | null
version: number | null
versions: Json | null
}
@@ -45712,14 +45734,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["invoiceCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["invoiceCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -46255,14 +46277,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"]
@@ -48379,6 +48401,7 @@ export type Database = {
defaultMethodType: Database["public"]["Enums"]["methodType"] | null
description: string | null
id: string | null
+ itemPostingGroupId: string | null
itemTrackingType:
| Database["public"]["Enums"]["itemTrackingType"]
| null
@@ -48543,6 +48566,13 @@ export type Database = {
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
},
+ {
+ foreignKeyName: "itemCost_itemPostingGroupId_fkey"
+ columns: ["itemPostingGroupId"]
+ isOneToOne: false
+ referencedRelation: "itemPostingGroup"
+ referencedColumns: ["id"]
+ },
]
}
userDefaults: {
@@ -48927,6 +48957,7 @@ export type Database = {
defaultMethodType: Database["public"]["Enums"]["methodType"]
description: string
id: string
+ itemPostingGroupId: string
itemTrackingType: Database["public"]["Enums"]["itemTrackingType"]
modelName: string
modelPath: string
@@ -49319,6 +49350,7 @@ export type Database = {
grade: string
gradeId: string
id: string
+ itemPostingGroupId: string
itemTrackingType: Database["public"]["Enums"]["itemTrackingType"]
materialForm: string
materialFormId: string
@@ -50372,7 +50404,9 @@ export type Database = {
| "Reject"
| "Request Approval"
purchaseOrderType: "Purchase" | "Return" | "Outside Processing"
- purchasePriceUpdateTiming: "Invoice Post" | "Purchase Order Finalize"
+ purchasePriceUpdateTiming:
+ | "Purchase Invoice Post"
+ | "Purchase Order Finalize"
qualityDocumentStatus: "Draft" | "Active" | "Archived"
quoteLineStatus: "Not Started" | "In Progress" | "Complete" | "No Quote"
quoteStatus:
@@ -51476,7 +51510,10 @@ export const Constants = {
"Request Approval",
],
purchaseOrderType: ["Purchase", "Return", "Outside Processing"],
- purchasePriceUpdateTiming: ["Invoice Post", "Purchase Order Finalize"],
+ purchasePriceUpdateTiming: [
+ "Purchase Invoice Post",
+ "Purchase Order Finalize",
+ ],
qualityDocumentStatus: ["Draft", "Active", "Archived"],
quoteLineStatus: ["Not Started", "In Progress", "Complete", "No Quote"],
quoteStatus: [
diff --git a/packages/database/supabase/migrations/20251202015133_attribute-category-emoji.sql b/packages/database/supabase/migrations/20251202015133_attribute-category-emoji.sql
new file mode 100644
index 0000000000..9e5a3decf5
--- /dev/null
+++ b/packages/database/supabase/migrations/20251202015133_attribute-category-emoji.sql
@@ -0,0 +1,3 @@
+-- Add emoji column to attributeCategory table
+ALTER TABLE "userAttributeCategory"
+ADD COLUMN "emoji" TEXT;