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: work center/location switching and job card in MES

Brad Barbin57a50ae11364
diff --git a/apps/carbon/app/components/AvatarMenu.tsx b/apps/carbon/app/components/AvatarMenu.tsx
index 2584928ed3..48929705a2 100644
--- a/apps/carbon/app/components/AvatarMenu.tsx
+++ b/apps/carbon/app/components/AvatarMenu.tsx
@@ -77,18 +77,13 @@ const AvatarMenu = () => {
Dashboard
</Link>
</DropdownMenuItem>
+ <DropdownMenuSeparator />
<DropdownMenuItem asChild>
<Link to={path.to.profile}>
<DropdownMenuIcon icon={<LuUser />} />
Account Settings
</Link>
</DropdownMenuItem>
- <DropdownMenuItem asChild>
- <Link to={path.to.apiIntroduction}>
- <DropdownMenuIcon icon={<LuFileText />} />
- API Documentation
- </Link>
- </DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem onSelect={(e) => e.preventDefault()}>
<div className="flex items-center justify-between w-full">
@@ -150,6 +145,13 @@ const AvatarMenu = () => {
</DropdownMenuSubContent>
</DropdownMenuSub>
<DropdownMenuSeparator />
+ <DropdownMenuItem asChild>
+ <Link to={path.to.apiIntroduction}>
+ <DropdownMenuIcon icon={<LuFileText />} />
+ API Documentation
+ </Link>
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
<DropdownMenuItem onSelect={(e) => e.preventDefault()}>
<Form method="post" action={path.to.logout}>
<button type="submit" className="w-full flex items-center">
diff --git a/apps/carbon/app/components/Layout/Navigation/GroupedContentSidebar.tsx b/apps/carbon/app/components/Layout/Navigation/GroupedContentSidebar.tsx
index a0b730c90e..8aeae83632 100644
--- a/apps/carbon/app/components/Layout/Navigation/GroupedContentSidebar.tsx
+++ b/apps/carbon/app/components/Layout/Navigation/GroupedContentSidebar.tsx
@@ -1,4 +1,4 @@
-import { Button, VStack } from "@carbon/react";
+import { Button, cn, VStack } from "@carbon/react";
import { Link } from "@remix-run/react";
import { useOptimisticLocation } from "~/hooks";
import type { RouteGroup } from "~/types";
@@ -39,7 +39,11 @@ const GroupedContentSidebar = ({
leftIcon={route.icon}
variant={isActive ? "active" : "ghost"}
size="sm"
- className="w-full justify-start"
+ className={cn(
+ "w-full justify-start",
+ !isActive &&
+ "hover:bg-active hover:text-active-foreground"
+ )}
>
<Link
to={route.to + (route.q ? `?q=${route.q}` : "")}
diff --git a/apps/carbon/app/components/SortableList.tsx b/apps/carbon/app/components/SortableList.tsx
index fb6901639d..efd94a5c3c 100644
--- a/apps/carbon/app/components/SortableList.tsx
+++ b/apps/carbon/app/components/SortableList.tsx
@@ -5,6 +5,7 @@ import type { ReactNode } from "react";
import { useState } from "react";
import { Checkbox, HStack, cn } from "@carbon/react";
+import { flushSync } from "react-dom";
import { LuTrash } from "react-icons/lu";
export interface Item {
@@ -50,7 +51,7 @@ function SortableListItem<T>({
const dragControls = useDragControls();
const handleDragStart = (event: any) => {
- setIsDragging(true);
+ flushSync(() => setIsDragging(true));
dragControls.start(event, { snapToCursor: true });
handleDrag();
};
@@ -117,24 +118,31 @@ function SortableListItem<T>({
key={`${item.checked}`}
className="px-1 flex flex-grow truncate cursor-pointer"
role="button"
- onClick={(e) => {
- if (!isDragging) {
- onSelectItem(item.id);
- }
- }}
>
<HStack className="w-full justify-between">
{typeof item.title === "string" ? (
- <h4
+ <span
className={cn(
- "flex text-base md:text-lg truncate",
+ "flex font-semibold text-sm md:text-base truncate hover:underline",
item.checked ? "text-red-400" : "text-foreground"
)}
+ onClick={(e) => {
+ if (!isDragging) {
+ onSelectItem(item.id);
+ }
+ }}
>
{item.title}
- </h4>
+ </span>
) : (
- <div className={item.checked ? "text-red-400" : ""}>
+ <div
+ onClick={(e) => {
+ if (!isDragging) {
+ onSelectItem(item.id);
+ }
+ }}
+ className={item.checked ? "text-red-400" : ""}
+ >
{item.title}
</div>
)}
diff --git a/apps/carbon/app/hooks/useTheme.tsx b/apps/carbon/app/hooks/useTheme.tsx
index f639b27655..4d8cb5c4ff 100644
--- a/apps/carbon/app/hooks/useTheme.tsx
+++ b/apps/carbon/app/hooks/useTheme.tsx
@@ -6,7 +6,7 @@ import { useRouteData } from "./useRouteData";
export function useOptimisticTheme() {
const fetchers = useFetchers();
- const themeFetcher = fetchers.find((f) => f.formAction === "/");
+ const themeFetcher = fetchers.find((f) => f.formAction === path.to.theme);
if (themeFetcher && themeFetcher.formData) {
const theme = { theme: themeFetcher.formData.get("theme") };
diff --git a/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsx b/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsx
index ca1a17125f..0ed44bdc08 100644
--- a/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsx
+++ b/apps/carbon/app/modules/items/ui/Item/BillOfMaterial.tsx
@@ -69,7 +69,7 @@ function makeItem(material: Material): ItemWithData {
id: material.id!,
title: (
<VStack spacing={0} className="py-2.5">
- <h4 className="flex font-semibold text-base md:text-lg truncate">
+ <h4 className="flex font-mono text-sm md:text-base truncate">
{material.itemReadableId}
</h4>
{material?.description && (
diff --git a/apps/carbon/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx b/apps/carbon/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
index 3466fdf31d..a4e4f03ab1 100644
--- a/apps/carbon/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
+++ b/apps/carbon/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
@@ -69,7 +69,7 @@ function makeItem(material: Material): ItemWithData {
id: material.id!,
title: (
<VStack spacing={0} className="py-2.5">
- <h4 className="flex font-semibold text-base md:text-lg truncate">
+ <h4 className="flex font-mono text-sm md:text-base truncate">
{material.itemReadableId}
</h4>
{material?.description && (
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
index b1a0b52c8e..4ee35a834f 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
@@ -69,7 +69,7 @@ function makeItem(material: Material): ItemWithData {
id: material.id!,
title: (
<VStack spacing={0} className="py-2.5">
- <h4 className="flex font-semibold text-base md:text-lg truncate">
+ <h4 className="flex font-mono text-sm md:text-base truncate">
{material.itemReadableId}
</h4>
{material?.description && (
diff --git a/apps/carbon/app/modules/settings/ui/Integrations/IntegrationsList.tsx b/apps/carbon/app/modules/settings/ui/Integrations/IntegrationsList.tsx
index 1c31cad65a..fbea22fc47 100644
--- a/apps/carbon/app/modules/settings/ui/Integrations/IntegrationsList.tsx
+++ b/apps/carbon/app/modules/settings/ui/Integrations/IntegrationsList.tsx
@@ -25,7 +25,7 @@ const IntegrationsList = ({ integrations }: IntegrationsListProps) => {
onClick={() => navigate(integration.id!)}
>
<CardHeader>
- <CardTitle className="text-base md:text-lg">
+ <CardTitle className="text-sm md:text-base">
{integration.title}
</CardTitle>
<CardDescription>{integration.description}</CardDescription>
diff --git a/apps/carbon/app/modules/settings/ui/Theme/ThemeForm.tsx b/apps/carbon/app/modules/settings/ui/Theme/ThemeForm.tsx
index ba0af4797c..ef46cebdae 100644
--- a/apps/carbon/app/modules/settings/ui/Theme/ThemeForm.tsx
+++ b/apps/carbon/app/modules/settings/ui/Theme/ThemeForm.tsx
@@ -63,7 +63,7 @@ const ThemeForm = ({ theme: defaultValues }: ThemeFormProps) => {
variant="secondary"
type="submit"
className={cn(
- "justify-start",
+ "justify-start w-full",
isActive && "border-2 border-primary"
)}
style={
diff --git a/apps/mes-prototype/src/components/Nav.tsx b/apps/mes-prototype/src/components/Nav.tsx
index 968f456f04..d459327581 100644
--- a/apps/mes-prototype/src/components/Nav.tsx
+++ b/apps/mes-prototype/src/components/Nav.tsx
@@ -6,7 +6,6 @@ import {
Tooltip,
TooltipContent,
TooltipTrigger,
- cn,
} from "@carbon/react";
import { Link } from "react-router-dom";
@@ -16,7 +15,7 @@ interface NavProps {
title: string;
label?: string;
icon: IconType;
- variant: "primary" | "ghost";
+ variant: "active" | "ghost";
}[];
}
@@ -51,26 +50,11 @@ export function Nav({ links, isCollapsed }: NavProps) {
key={index}
leftIcon={<link.icon />}
variant={link.variant}
- className={cn(
- link.variant === "primary" &&
- "dark:bg-muted dark:text-white dark:hover:bg-muted dark:hover:text-white",
- "justify-start"
- )}
asChild
>
<Link to="#">
{link.title}
- {link.label && (
- <span
- className={cn(
- "ml-auto",
- link.variant === "primary" &&
- "text-background dark:text-white"
- )}
- >
- {link.label}
- </span>
- )}
+ {link.label && <span className="ml-auto">{link.label}</span>}
</Link>
</Button>
)
diff --git a/apps/mes-prototype/src/routes/jobs.tsx b/apps/mes-prototype/src/routes/jobs.tsx
index 5014d2e94c..2894fd7dd7 100644
--- a/apps/mes-prototype/src/routes/jobs.tsx
+++ b/apps/mes-prototype/src/routes/jobs.tsx
@@ -142,7 +142,7 @@ export function Jobs({
)}
</div>
</div>
- <div className="flex flex-col h-[calc(100%-52px)] justify-between overflow-y-auto">
+ <div className="flex flex-col h-[calc(100%-52px)] justify-between overflow-y-auto bg-background">
<div className="flex flex-col">
<Separator />
<Nav
@@ -152,7 +152,7 @@ export function Jobs({
title: "Jobs",
label: "128",
icon: LuCalendarClock,
- variant: "primary",
+ variant: "active",
},
{
title: "Active",
diff --git a/apps/mes/app/assets/icons/AlmostDoneIcon.tsx b/apps/mes/app/assets/icons/AlmostDoneIcon.tsx
new file mode 100644
index 0000000000..921e44a27f
--- /dev/null
+++ b/apps/mes/app/assets/icons/AlmostDoneIcon.tsx
@@ -0,0 +1,34 @@
+export function AlmostDoneIcon({ className }: { className?: string }) {
+ return (
+ <svg
+ width="14"
+ height="14"
+ viewBox="0 0 14 14"
+ fill="none"
+ color="currentColor"
+ className={className}
+ >
+ <circle
+ cx="7"
+ cy="7"
+ r="6"
+ fill="none"
+ stroke="#26a544"
+ strokeWidth="2"
+ strokeDasharray="3.14 0"
+ strokeDashoffset="-0.7"
+ ></circle>
+ <circle
+ cx="7"
+ cy="7"
+ r="2"
+ fill="none"
+ stroke="#26a544"
+ strokeWidth="4"
+ strokeDasharray="9.377654070965532 100"
+ strokeDashoffset="0"
+ transform="rotate(-90 7 7)"
+ ></circle>
+ </svg>
+ );
+}
diff --git a/apps/mes/app/assets/icons/AttemptIcon.tsx b/apps/mes/app/assets/icons/AttemptIcon.tsx
new file mode 100644
index 0000000000..9fd9d7f6eb
--- /dev/null
+++ b/apps/mes/app/assets/icons/AttemptIcon.tsx
@@ -0,0 +1,29 @@
+export function AttemptIcon({ className }: { className?: string }) {
+ return (
+ <svg
+ className={className}
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <g clipPath="url(#clip0_9964_113464)">
+ <path
+ fillRule="evenodd"
+ clipRule="evenodd"
+ d="M16 0H0V16H16V0ZM7.09906 4.4L4.53906 11.5H6.11906L6.63906 10H9.35906L9.87906 11.5H11.4591L8.89906 4.4H7.09906ZM7.99906 6L8.92906 8.73H7.06906L7.99906 6Z"
+ fill="currentColor"
+ />
+ </g>
+ <defs>
+ <clipPath id="clip0_9964_113464">
+ <path
+ d="M0 2C0 0.895431 0.895431 0 2 0H14C15.1046 0 16 0.895431 16 2V14C16 15.1046 15.1046 16 14 16H2C0.895431 16 0 15.1046 0 14V2Z"
+ fill="white"
+ />
+ </clipPath>
+ </defs>
+ </svg>
+ );
+}
diff --git a/apps/mes/app/assets/icons/HighPriorityIcon.tsx b/apps/mes/app/assets/icons/HighPriorityIcon.tsx
new file mode 100644
index 0000000000..e138e67e38
--- /dev/null
+++ b/apps/mes/app/assets/icons/HighPriorityIcon.tsx
@@ -0,0 +1,18 @@
+export function HighPriorityIcon({ className }: { className?: string }) {
+ return (
+ <svg
+ aria-label="High Priority"
+ className={className}
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ fill="currentColor"
+ role="img"
+ focusable="false"
+ >
+ <rect x="1.5" y="8" width="3" height="6" rx="1"></rect>
+ <rect x="6.5" y="5" width="3" height="9" rx="1"></rect>
+ <rect x="11.5" y="2" width="3" height="12" rx="1"></rect>
+ </svg>
+ );
+}
diff --git a/apps/mes/app/assets/icons/InProgressStatusIcon.tsx b/apps/mes/app/assets/icons/InProgressStatusIcon.tsx
new file mode 100644
index 0000000000..17b4632108
--- /dev/null
+++ b/apps/mes/app/assets/icons/InProgressStatusIcon.tsx
@@ -0,0 +1,35 @@
+export function InProgressStatusIcon({ className }: { className?: string }) {
+ return (
+ <svg
+ width="14"
+ height="14"
+ viewBox="0 0 14 14"
+ fill="none"
+ color="currentColor"
+ className={className}
+ >
+ <circle
+ cx="7"
+ cy="7"
+ r="6"
+ fill="none"
+ stroke="#f2be00"
+ strokeWidth="2"
+ strokeDasharray="3.14 0"
+ strokeDashoffset="-0.7"
+ ></circle>
+ <circle
+ className="progress"
+ cx="7"
+ cy="7"
+ r="2"
+ fill="none"
+ stroke="#f2be00"
+ strokeWidth="4"
+ strokeDasharray="6.2517693806436885 100"
+ strokeDashoffset="0"
+ transform="rotate(-90 7 7)"
+ ></circle>
+ </svg>
+ );
+}
diff --git a/apps/mes/app/assets/icons/LowPriorityIcon.tsx b/apps/mes/app/assets/icons/LowPriorityIcon.tsx
new file mode 100644
index 0000000000..b05e94e861
--- /dev/null
+++ b/apps/mes/app/assets/icons/LowPriorityIcon.tsx
@@ -0,0 +1,25 @@
+export function LowPriorityIcon({ className }: { className?: string }) {
+ return (
+ <svg
+ aria-label="Low Priority"
+ className={className}
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ fill="currentColor"
+ role="img"
+ focusable="false"
+ >
+ <rect x="1.5" y="8" width="3" height="6" rx="1"></rect>
+ <rect x="6.5" y="5" width="3" height="9" rx="1" fillOpacity="0.4"></rect>
+ <rect
+ x="11.5"
+ y="2"
+ width="3"
+ height="12"
+ rx="1"
+ fillOpacity="0.4"
+ ></rect>
+ </svg>
+ );
+}
diff --git a/apps/mes/app/assets/icons/MediumPriorityIcon.tsx b/apps/mes/app/assets/icons/MediumPriorityIcon.tsx
new file mode 100644
index 0000000000..296884ae02
--- /dev/null
+++ b/apps/mes/app/assets/icons/MediumPriorityIcon.tsx
@@ -0,0 +1,25 @@
+export function MediumPriorityIcon({ className }: { className?: string }) {
+ return (
+ <svg
+ aria-label="Medium Priority"
+ className={className}
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ fill="currentColor"
+ role="img"
+ focusable="false"
+ >
+ <rect x="1.5" y="8" width="3" height="6" rx="1"></rect>
+ <rect x="6.5" y="5" width="3" height="9" rx="1"></rect>
+ <rect
+ x="11.5"
+ y="2"
+ width="3"
+ height="12"
+ rx="1"
+ fillOpacity="0.4"
+ ></rect>
+ </svg>
+ );
+}
diff --git a/apps/mes/app/assets/icons/ShowParentIcon.tsx b/apps/mes/app/assets/icons/ShowParentIcon.tsx
new file mode 100644
index 0000000000..656f311124
--- /dev/null
+++ b/apps/mes/app/assets/icons/ShowParentIcon.tsx
@@ -0,0 +1,35 @@
+export function ShowParentIcon({ className }: { className?: string }) {
+ return (
+ <svg
+ className={className}
+ viewBox="0 0 16 16"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ fill="currentColor"
+ fillRule="evenodd"
+ clipRule="evenodd"
+ d="M3.125 16H3.625H4.125V15H3.125H2C1.89733 15 1.8 14.9848 1.70919 14.9573L1.19765 14.8024L1.04267 14.2908C1.01515 14.2 1 14.1027 1 14V12.875V11.875H0V12.375V12.875V14C0 14.202 0.0299409 14.397 0.0856265 14.5808C0.135047 14.7439 0.204744 14.8982 0.291786 15.0407C0.363386 15.158 0.446722 15.2673 0.540161 15.3671C0.570065 15.399 0.601004 15.4299 0.632924 15.4598C0.732663 15.5533 0.841982 15.6366 0.95925 15.7082C1.10181 15.7953 1.25612 15.865 1.41923 15.9144C1.60303 15.9701 1.79802 16 2 16H3.125ZM10.125 15V16H9.625H9.125H6.875H6.375H5.875V15H6.875H9.125H10.125ZM15 5.875H16V6.375V6.875V9.125V9.625V10.125H15V9.125V6.875V5.875ZM5.875 1V0H6.375H6.875H9.125H9.625H10.125V1H9.125H6.875H5.875ZM1 10.125H0V9.625V9.125V6.875V6.375V5.875H1V6.875V9.125V10.125ZM0 3.625V4.125H1V3.125V2C1 1.89733 1.01515 1.8 1.04267 1.70919L1.19765 1.19765L1.70919 1.04267C1.8 1.01515 1.89733 1 2 1H3.125H4.125V0H3.625H3.125H2C1.79802 0 1.60303 0.0299409 1.41923 0.0856264C1.25612 0.135047 1.10181 0.204744 0.95925 0.291786C0.841983 0.363386 0.732663 0.446722 0.632924 0.540161C0.601004 0.570065 0.570065 0.601004 0.540161 0.632924C0.446722 0.732663 0.363386 0.841982 0.291786 0.95925C0.204744 1.10181 0.135047 1.25612 0.0856265 1.41923C0.0299409 1.60303 0 1.79802 0 2V3.125V3.625ZM12.375 0H11.875V1H12.875H14C14.1027 1 14.2 1.01515 14.2908 1.04267L14.8024 1.19765L14.9573 1.70919C14.9848 1.8 15 1.89733 15 2V3.125V4.125H16V3.625V3.125V2C16 1.79802 15.9701 1.60303 15.9144 1.41923C15.865 1.25612 15.7953 1.10181 15.7082 0.95925C15.6366 0.841982 15.5533 0.732663 15.4598 0.632924C15.4299 0.601004 15.399 0.570065 15.3671 0.540161C15.2673 0.446722 15.158 0.363386 15.0407 0.291786C14.8982 0.204744 14.7439 0.135047 14.5808 0.0856265C14.397 0.0299409 14.202 0 14 0H12.875H12.375ZM16 12.375V11.875H15V12.875V14C15 14.1027 14.9848 14.2 14.9573 14.2908L14.8024 14.8024L14.2908 14.9573C14.2 14.9848 14.1027 15 14 15H12.875H11.875V16H12.375H12.875H14C14.202 16 14.397 15.9701 14.5808 15.9144C14.7439 15.865 14.8982 15.7953 15.0407 15.7082C15.158 15.6366 15.2673 15.5533 15.3671 15.4598C15.399 15.4299 15.4299 15.399 15.4598 15.3671C15.5533 15.2673 15.6366 15.158 15.7082 15.0407C15.7953 14.8982 15.865 14.7439 15.9144 14.5808C15.9701 14.397 16 14.202 16 14V12.875V12.375ZM8.75 6.26758L10.4523 7.96991C10.7452 8.26281 11.2201 8.26281 11.513 7.96991C11.8059 7.67702 11.8059 7.20215 11.513 6.90925L8.59099 3.98725C8.43431 3.83057 8.22556 3.7577 8.02045 3.76865C7.81604 3.75834 7.60821 3.83124 7.45209 3.98736L4.53009 6.90937C4.23719 7.20226 4.23719 7.67713 4.53009 7.97003C4.82298 8.26292 5.29785 8.26292 5.59075 7.97003L7.25 6.31077L7.25 11.25C7.25 11.6642 7.58579 12 8 12C8.41421 12 8.75 11.6642 8.75 11.25L8.75 6.26758Z"
+ />
+ </svg>
+ );
+}
+
+export function ShowParentIconSelected({ className }: { className?: string }) {
+ return (
+ <svg
+ className={className}
+ viewBox="0 0 16 16"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path
+ fill="currentColor"
+ fillRule="evenodd"
+ clipRule="evenodd"
+ d="M2 0C0.895431 0 0 0.895431 0 2V14C0 15.1046 0.895431 16 2 16H14C15.1046 16 16 15.1046 16 14V2C16 0.895431 15.1046 0 14 0H2ZM8.75 6.26758L10.4523 7.96991C10.7452 8.26281 11.2201 8.26281 11.513 7.96991C11.8059 7.67702 11.8059 7.20215 11.513 6.90925L8.59099 3.98725C8.43344 3.8297 8.22324 3.7569 8.01703 3.76884C7.8138 3.75958 7.60752 3.83254 7.45234 3.98773L4.53033 6.90973C4.23744 7.20263 4.23744 7.6775 4.53033 7.97039C4.82322 8.26329 5.2981 8.26329 5.59099 7.97039L7.25 6.31138L7.25 11.25C7.25 11.6642 7.58579 12 8 12C8.41421 12 8.75 11.6642 8.75 11.25L8.75 6.26758Z"
+ />
+ </svg>
+ );
+}
diff --git a/apps/mes/app/assets/icons/TaskIcon.tsx b/apps/mes/app/assets/icons/TaskIcon.tsx
new file mode 100644
index 0000000000..48d9c4181d
--- /dev/null
+++ b/apps/mes/app/assets/icons/TaskIcon.tsx
@@ -0,0 +1,29 @@
+export function TaskIcon({ className }: { className?: string }) {
+ return (
+ <svg
+ className={className}
+ width="16"
+ height="16"
+ viewBox="0 0 16 16"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <g clipPath="url(#clip0_9221_99732)">
+ <path
+ fillRule="evenodd"
+ clipRule="evenodd"
+ d="M16 0H0V16H16V0ZM10.8901 5.73995V4.44995H5.11011V5.73995H7.23011V11.55H8.77011V5.73995H10.8901Z"
+ fill="currentColor"
+ />
+ </g>
+ <defs>
+ <clipPath id="clip0_9221_99732">
+ <path
+ d="M0 2C0 0.895431 0.895431 0 2 0H14C15.1046 0 16 0.895431 16 2V14C16 15.1046 15.1046 16 14 16H2C0.895431 16 0 15.1046 0 14V2Z"
+ fill="white"
+ />
+ </clipPath>
+ </defs>
+ </svg>
+ );
+}
diff --git a/apps/mes/app/assets/icons/TodoStatusIcon.tsx b/apps/mes/app/assets/icons/TodoStatusIcon.tsx
new file mode 100644
index 0000000000..58458ad63c
--- /dev/null
+++ b/apps/mes/app/assets/icons/TodoStatusIcon.tsx
@@ -0,0 +1,35 @@
+export function TodoStatusIcon({ className }: { className?: string }) {
+ return (
+ <svg
+ width="14"
+ height="14"
+ viewBox="0 0 14 14"
+ fill="none"
+ color="currentColor"
+ className="className"
+ >
+ <circle
+ cx="7"
+ cy="7"
+ r="6"
+ fill="none"
+ stroke="#e2e2e2"
+ strokeWidth="2"
+ strokeDasharray="3.14 0"
+ strokeDashoffset="-0.7"
+ ></circle>
+ <circle
+ className="progress"
+ cx="7"
+ cy="7"
+ r="2"
+ fill="none"
+ stroke="#e2e2e2"
+ strokeWidth="4"
+ strokeDasharray="0 100"
+ strokeDashoffset="0"
+ transform="rotate(-90 7 7)"
+ ></circle>
+ </svg>
+ );
+}
diff --git a/apps/mes/app/components/AvatarMenu.tsx b/apps/mes/app/components/AvatarMenu.tsx
new file mode 100644
index 0000000000..0e10c9580a
--- /dev/null
+++ b/apps/mes/app/components/AvatarMenu.tsx
@@ -0,0 +1,141 @@
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuIcon,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuRadioGroup,
+ DropdownMenuRadioItem,
+ DropdownMenuSeparator,
+ DropdownMenuSub,
+ DropdownMenuSubContent,
+ DropdownMenuSubTrigger,
+ DropdownMenuTrigger,
+ Switch,
+} from "@carbon/react";
+import { Form, Link, useFetcher } from "@remix-run/react";
+import { useRef, useState } from "react";
+import { LuLogOut, LuMapPin, LuMoon, LuSun, LuUser } from "react-icons/lu";
+import { Avatar } from "~/components";
+import { useUser } from "~/hooks";
+import { useMode } from "~/hooks/useMode";
+import type { action } from "~/routes/x+/location";
+import type { Location } from "~/services/jobs";
+import { path } from "~/utils/path";
+
+const AvatarMenu = ({
+ isCollapsed,
+ location,
+ locations,
+}: {
+ isCollapsed: boolean;
+ location: string;
+ locations: Location[];
+}) => {
+ const user = useUser();
+ const name = `${user.firstName} ${user.lastName}`;
+
+ const mode = useMode();
+
+ const nextMode = mode === "dark" ? "light" : "dark";
+ const modeSubmitRef = useRef<HTMLButtonElement>(null);
+
+ const fetcher = useFetcher<typeof action>();
+ const [isOpen, setIsOpen] = useState(false);
+
+ const updateLocation = (value: string) => {
+ const formData = new FormData();
+ formData.append("location", value);
+ fetcher.submit(formData, { method: "POST", action: path.to.location });
+ };
+
+ const optimisticLocation =
+ (fetcher.formData?.get("location") as string | undefined) ?? location;
+
+ return (
+ <DropdownMenu open={isOpen} onOpenChange={setIsOpen}>
+ <DropdownMenuTrigger className="flex items-center justify-start gap-2 outline-none focus-visible:outline-none">
+ <Avatar size="sm" src={user?.avatarUrl ?? undefined} name={name} />
+ {!isCollapsed && (
+ <span className="text-sm font-medium truncate">{name}</span>
+ )}
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="start" className="w-56">
+ <DropdownMenuLabel>Signed in as {name}</DropdownMenuLabel>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem asChild>
+ <Link to={path.to.accountSettings}>
+ <DropdownMenuIcon icon={<LuUser />} />
+ Account Settings
+ </Link>
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ {locations.length > 1 ? (
+ <>
+ <DropdownMenuSub>
+ <DropdownMenuSubTrigger>
+ <DropdownMenuIcon icon={<LuMapPin />} />
+ Location
+ </DropdownMenuSubTrigger>
+ <DropdownMenuSubContent>
+ <DropdownMenuRadioGroup value={optimisticLocation}>
+ {locations.map((loc) => (
+ <DropdownMenuRadioItem
+ key={loc.id}
+ value={loc.id}
+ onSelect={(e) => {
+ e.preventDefault();
+ updateLocation(loc.id);
+ }}
+ >
+ {loc.name}
+ </DropdownMenuRadioItem>
+ ))}
+ </DropdownMenuRadioGroup>
+ </DropdownMenuSubContent>
+ </DropdownMenuSub>
+ <DropdownMenuSeparator />
+ </>
+ ) : null}
+ <DropdownMenuItem onSelect={(e) => e.preventDefault()}>
+ <div className="flex items-center justify-between w-full">
+ <div className="flex items-center justify-start">
+ <DropdownMenuIcon
+ icon={mode === "dark" ? <LuMoon /> : <LuSun />}
+ />
+ Dark Mode
+ </div>
+ <div>
+ <Switch
+ checked={mode === "dark"}
+ onCheckedChange={() => modeSubmitRef.current?.click()}
+ />
+ <fetcher.Form
+ action={path.to.root}
+ method="post"
+ onSubmit={() => {
+ document.body.removeAttribute("style");
+ }}
+ className="sr-only"
+ >
+ <input type="hidden" name="mode" value={nextMode} />
+ <button ref={modeSubmitRef} className="sr-only" type="submit" />
+ </fetcher.Form>
+ </div>
+ </div>
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem onSelect={(e) => e.preventDefault()}>
+ <Form method="post" action={path.to.logout}>
+ <button type="submit" className="w-full flex items-center">
+ <DropdownMenuIcon icon={<LuLogOut />} />
+ <span>Sign Out</span>
+ </button>
+ </Form>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
+};
+
+export default AvatarMenu;
diff --git a/apps/mes/app/routes/_public+/_layout.tsx b/apps/mes/app/routes/_public+/_layout.tsx
index 023fb41efe..d77e29ca38 100644
--- a/apps/mes/app/routes/_public+/_layout.tsx
+++ b/apps/mes/app/routes/_public+/_layout.tsx
@@ -1,16 +1,9 @@
-import { Outlet, useLoaderData } from "@remix-run/react";
+import { Outlet } from "@remix-run/react";
import { BsHexagonFill } from "react-icons/bs";
-import type { LoaderFunctionArgs } from "@vercel/remix";
-
-export async function loader({ request }: LoaderFunctionArgs) {
- return {
- data: getRandomQuote(),
- };
-}
+import { Heading } from "@carbon/react";
export default function PublicRoute() {
- const { data } = useLoaderData<typeof loader>();
return (
<div className="container relative h-full flex-col items-center justify-center grid lg:max-w-none lg:grid-cols-2 lg:px-0">
<div className="relative hidden h-full flex-col bg-muted p-10 text-white lg:flex dark:border-r">
@@ -19,14 +12,19 @@ export default function PublicRoute() {
<BsHexagonFill className="w-6 h-6 mr-2" />
CarbonOS
</div>
- {data && (
- <div className="relative z-20 mt-auto">
- <blockquote className="space-y-2">
- <p className="text-lg">&ldquo;{data?.quote}&rdquo;</p>
- <footer className="text-sm">{data?.source}</footer>
- </blockquote>
- </div>
- )}
+
+ <div className="relative z-20 mt-auto">
+ <blockquote className="space-y-2">
+ <Heading size="display" className="text-white/90">
+ Let's build something
+ <span className="inline-block">
+ <span className="loading-dot">.</span>
+ <span className="loading-dot">.</span>
+ <span className="loading-dot">.</span>
+ </span>
+ </Heading>
+ </blockquote>
+ </div>
</div>
<div className="lg:p-8">
<div className="mx-auto flex w-full flex-col justify-center space-y-6 sm:w-[350px]">
@@ -36,169 +34,3 @@ export default function PublicRoute() {
</div>
);
}
-
-function getRandomQuote() {
- const randomQuote = quotes[Math.floor(Math.random() * quotes.length)];
- return randomQuote;
-}
-
-const quotes = [
- {
- quote: "Nothing can be changed until it is faced.",
- source: "James Baldwin",
- },
- {
- quote:
- "The Sun will rise and set regardless. What we choose to do with the light while it's here is up to us. Journey wisely.",
- source: "Alex Elle",
- },
- {
- quote: "I am unfolding slowly because blooming takes time.",
- source: "Alex Elle",
- },
- {
- quote: "Someone once told me love isn’t perfect—or predictable.",
- source: "Lauren Morrill",
- },
- {
- quote:
- "Sometimes you climb out of bed in the morning and you think, I'm not going to make it, but you laugh inside — remembering all the times you've felt that way",
- source: "Charles Bukowski",
- },
- {
- quote: "If you can't beat the fear, just do it scared.",
- source: "Glennon Doyle",
- },
- {
- quote: "There is a crack in everything. That's how the light gets in.",
- source: "Rumi",
- },
- {
- quote: "We must bring our own light into the darkness.",
- source: "Charles Bukowski",
- },
- {
- quote: "You are not too old. And it is not too late.",
- source: "Rainer Maria Rilke",
- },
- {
- quote: "There is nothing holding you back in life more than yourself.",
- source: "Brianna Wiest",
- },
- {
- quote:
- "Another person's success is not the absence of your own. Another person's progress is not the absence of your own. Another person's happiness is not the absense of your own.",
- source: "Brianna Wiest",
- },
- {
- quote:
- "The things we lose are not losses. They are entry ways. They are the world saying, sometimes sharply, there is something else out there.",
- source: "Brianna Wiest",
- },
- {
- quote: "You are allowed to outgrow people.",
- source: "Mantra Magazine",
- },
- {
- quote:
- "Stop feeling bad for outgrowing people who had the chance to grow with you.",
- source: "Hunter Pauley",
- },
- {
- quote: "Don't let someone live rent-free in your head.",
- source: "Ann Landers",
- },
- {
- quote:
- "Not everything that is faced can be changed, but nothing can be changed until it is faced.",
- source: "James Baldwin",
- },
- {
- quote: "No force on earth can stop an idea whose time has come.",
- source: "Victor Hugo",
- },
- {
- quote: "Learning never exhausts the mind.",
- source: "Leonardo da Vinci",
- },
- {
- quote: "The journey of a thousand miles begins with one step.",
- source: "Lao Tzu",
- },
- {
- quote: "If opportunity doesn't knock, build a door.",
- source: "Milton Berle",
- },
- {
- quote: "Everything has beauty, but not everyone sees it.",
- source: "Confucius",
- },
- {
- quote:
- "The best and most beautiful things in the world cannot be seen or even touched - they must be felt with the heart.",
- source: "Helen Keller",
- },
- {
- quote: "Simplicity is the ultimate sophistication.",
- source: "Leonardo da Vinci",
- },
- {
- quote: "The best revenge is massive success.",
- source: "Frank Sinatra",
- },
- {
- quote:
- "The distance between insanity and genius is measured only by success.",
- source: "Bruce Feirstein",
- },
- {
- quote: "Success is the sum of small efforts, repeated day-in and day-out.",
- source: "Robert Collier",
- },
- {
- quote: "The mind is everything. What you think you become.",
- source: "Gautama Buddha",
- },
- {
- quote: "Peace comes from within. Do not seek it without.",
- source: "Gautama Buddha",
- },
- {
- quote:
- "What you think, you become. What you feel, you attract. What you imagine, you create.",
- source: "The Buddha",
- },
- {
- quote: "Share your knowledge. It is a way to achieve immortality.",
- source: "The Dalai Lama",
- },
- {
- quote: "Man is made by his belief. As he believes, so he is.",
- source: "Bhagavad Gita",
- },
- {
- quote:
- "Life’s most persistent and urgent question is, ‘What are you doing for others?’",
- source: "Martin Luther King, Jr.",
- },
- {
- quote: "Once you choose hope, anythings possible.",
- source: "Christopher Reeve",
- },
- {
- quote: "Learn from yesterday, live for today, hope for tomorrow.",
- source: "Albert Einstein",
- },
- {
- quote: "Stay hungry, stay foolish.",
- source: "Steve Jobs",
- },
- {
- quote: "The only way to do great work is to love what you do.",
- source: "Steve Jobs",
- },
- {
- quote: "You are never too old to set another goal or to dream a new dream.",
- source: "C.S. Lewis",
- },
-];
diff --git a/apps/mes/app/routes/x+/_index.tsx b/apps/mes/app/routes/x+/_index.tsx
index 00f3d356dc..d32e52de85 100644
--- a/apps/mes/app/routes/x+/_index.tsx
+++ b/apps/mes/app/routes/x+/_index.tsx
@@ -1,7 +1,15 @@
+import { requirePermissions } from "@carbon/auth/auth.server";
import type { LoaderFunction } from "@vercel/remix";
import { redirect } from "@vercel/remix";
+import { getLocationAndWorkCenter } from "~/services/location.server";
import { path } from "~/utils/path";
-export const loader: LoaderFunction = async () => {
- return redirect(path.to.jobs);
+export const loader: LoaderFunction = async ({ request }) => {
+ const { client, companyId, userId } = await requirePermissions(request, {});
+ const [, workCenter] = await getLocationAndWorkCenter(request, client, {
+ companyId,
+ userId,
+ });
+
+ return redirect(path.to.jobs(workCenter));
};
diff --git a/apps/mes/app/routes/x+/_layout.tsx b/apps/mes/app/routes/x+/_layout.tsx
index c5e143bdaf..5e7cd28f2c 100644
--- a/apps/mes/app/routes/x+/_layout.tsx
+++ b/apps/mes/app/routes/x+/_layout.tsx
@@ -1,16 +1,6 @@
import {
- Avatar,
- Button,
ClientOnly,
cn,
- IconButton,
- Modal,
- ModalContent,
- ModalDescription,
- ModalFooter,
- ModalHeader,
- ModalTitle,
- ModalTrigger,
ResizableHandle,
ResizablePanel,
ResizablePanelGroup,
@@ -18,31 +8,26 @@ import {
Toaster,
TooltipProvider,
} from "@carbon/react";
-import { Form, Outlet, useLoaderData, useNavigation } from "@remix-run/react";
+import { Outlet, useLoaderData, useNavigation } from "@remix-run/react";
import type { LoaderFunctionArgs } from "@vercel/remix";
import { json, redirect } from "@vercel/remix";
import NProgress from "nprogress";
import { useEffect, useState } from "react";
-import {
- CarbonProvider,
- getCarbon,
- getCompanies,
- getUser,
- VERCEL_URL,
-} from "@carbon/auth";
+import { CarbonProvider, getCarbon, getCompanies, getUser } from "@carbon/auth";
import {
destroyAuthSession,
requireAuthSession,
} from "@carbon/auth/session.server";
-import { LuLogOut } from "react-icons/lu";
+import AvatarMenu from "~/components/AvatarMenu";
+import { getLocationsByCompany } from "~/services/jobs";
+import {
+ getLocationAndWorkCenter,
+ setLocationAndWorkCenter,
+} from "~/services/location.server";
import { defaultLayout } from "~/utils/layout";
import { path } from "~/utils/path";
-export const ERP_URL = VERCEL_URL?.includes("localhost")
- ? "http://localhost:3000"
- : `https://app.carbonos.dev`;
-
export async function loader({ request }: LoaderFunctionArgs) {
const { accessToken, companyId, expiresAt, expiresIn, userId } =
await requireAuthSession(request, { verify: true });
@@ -62,23 +47,42 @@ export async function loader({ request }: LoaderFunctionArgs) {
const company = companies.data?.find((c) => c.companyId === companyId);
if (!company) {
- throw redirect(ERP_URL);
+ throw redirect(path.to.accountSettings);
}
- return json({
- session: {
- accessToken,
- expiresIn,
- expiresAt,
+ const [[location, workCenter, updated], locations] = await Promise.all([
+ getLocationAndWorkCenter(request, client, {
+ companyId,
+ userId,
+ }),
+ getLocationsByCompany(client, companyId),
+ ]);
+
+ return json(
+ {
+ session: {
+ accessToken,
+ expiresIn,
+ expiresAt,
+ },
+ company,
+ companies: companies.data ?? [],
+ location,
+ locations: locations.data ?? [],
+ user: user.data,
},
- company,
- companies: companies.data ?? [],
- user: user.data,
- });
+ updated
+ ? {
+ headers: {
+ "Set-Cookie": setLocationAndWorkCenter(location, workCenter),
+ },
+ }
+ : undefined
+ );
}
export default function AuthenticatedRoute() {
- const { session, company, companies, user } = useLoaderData<typeof loader>();
+ const { session, location, locations } = useLoaderData<typeof loader>();
const [isCollapsed, setIsCollapsed] = useState(false);
const transition = useNavigation();
@@ -124,23 +128,22 @@ export default function AuthenticatedRoute() {
<div
className={cn(
"flex h-[52px] items-center justify-start bg-background",
- isCollapsed ? "h-[52px]" : "px-2"
+ isCollapsed ? "h-[52px]" : "px-4"
)}
>
<div
className={cn(
- "flex items-center space-x-2 w-full",
+ "flex items-center w-full",
isCollapsed ? "justify-center" : "justify-start"
)}
>
- <Avatar
- size="sm"
- src={user?.avatarUrl ?? undefined}
- name={user?.fullName ?? ""}
+ <AvatarMenu
+ // company={company}
+ // companies={companies}
+ isCollapsed={isCollapsed}
+ location={location}
+ locations={locations}
/>
- {!isCollapsed && (
- <span className="text-sm truncate">{user?.fullName}</span>
- )}
</div>
</div>
<div className="flex flex-col h-[calc(100%-52px)] justify-between overflow-y-auto">
@@ -152,41 +155,7 @@ export default function AuthenticatedRoute() {
"flex flex-col p-2 w-full",
isCollapsed && "items-center justify-center "
)}
- >
- <Modal>
- <ModalTrigger asChild>
- {isCollapsed ? (
- <IconButton
- type="submit"
- aria-label="Sign out"
- icon={<LuLogOut />}
- />
- ) : (
- <Button size="lg" type="submit" className="w-full">
- Sign out
- </Button>
- )}
- </ModalTrigger>
- <ModalContent size="small">
- <ModalHeader>
- <ModalTitle>Are you sure?</ModalTitle>
- <ModalDescription>
- You will be logged out
- </ModalDescription>
- </ModalHeader>
-
- <ModalFooter>
- <Form
- method="post"
- action={path.to.logout}
- className="w-full"
- >
- <Button type="submit">Sign Out</Button>
- </Form>
- </ModalFooter>
- </ModalContent>
- </Modal>
- </div>
+ ></div>
</div>
</ResizablePanel>
<ResizableHandle withHandle />
diff --git a/apps/mes/app/routes/x+/jobs.$workCenterId.tsx b/apps/mes/app/routes/x+/jobs.$workCenterId.tsx
new file mode 100644
index 0000000000..29c8662b13
--- /dev/null
+++ b/apps/mes/app/routes/x+/jobs.$workCenterId.tsx
@@ -0,0 +1,363 @@
+import {
+ Card,
+ CardContent,
+ CardHeader,
+ cn,
+ Heading,
+ HStack,
+ Input,
+ ResizablePanel,
+ ScrollArea,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+ Separator,
+ Tabs,
+ TabsContent,
+ TabsList,
+ TabsTrigger,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@carbon/react";
+import {
+ LuAlertTriangle,
+ LuCheckCircle,
+ LuClipboardCheck,
+ LuSearch,
+ LuTimer,
+ LuXCircle,
+} from "react-icons/lu";
+import { defaultLayout } from "~/utils/layout";
+
+import { notFound } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import {
+ convertDateStringToIsoString,
+ formatDurationMilliseconds,
+ formatRelativeTime,
+} from "@carbon/utils";
+import { Link, useLoaderData, useNavigate, useParams } from "@remix-run/react";
+import { json, type LoaderFunctionArgs } from "@vercel/remix";
+import { BsExclamationSquareFill } from "react-icons/bs";
+import { AlmostDoneIcon } from "~/assets/icons/AlmostDoneIcon";
+import { HighPriorityIcon } from "~/assets/icons/HighPriorityIcon";
+import { InProgressStatusIcon } from "~/assets/icons/InProgressStatusIcon";
+import { LowPriorityIcon } from "~/assets/icons/LowPriorityIcon";
+import { MediumPriorityIcon } from "~/assets/icons/MediumPriorityIcon";
+import { TodoStatusIcon } from "~/assets/icons/TodoStatusIcon";
+import type { Operation, OperationSettings } from "~/services/jobs";
+import {
+ getJobOperationsByWorkCenter,
+ getWorkCentersByLocation,
+} from "~/services/jobs";
+import {
+ getLocationAndWorkCenter,
+ setLocationAndWorkCenter,
+} from "~/services/location.server";
+import { makeDurationsAndProgress } from "~/utils/jobs";
+import { path } from "~/utils/path";
+
+// TODO: load dynamically
+const operationSettings: OperationSettings = {
+ showCustomer: false,
+ showDescription: true,
+ showDueDate: true,
+ showDuration: true,
+ showEmployee: false,
+ showProgress: false,
+ showStatus: true,
+};
+
+export async function loader({ request, params }: LoaderFunctionArgs) {
+ const { client, companyId, userId } = await requirePermissions(request, {});
+
+ const { workCenterId } = params;
+ if (!workCenterId) throw notFound("workCenterId not found");
+ const [location, workCenter] = await getLocationAndWorkCenter(
+ request,
+ client,
+ {
+ companyId,
+ userId,
+ }
+ );
+
+ const [operations, workCenters] = await Promise.all([
+ getJobOperationsByWorkCenter(client, {
+ locationId: location,
+ workCenterId: workCenterId,
+ }),
+ getWorkCentersByLocation(client, location),
+ ]);
+
+ const payload = {
+ operations: operations.data?.map(makeDurationsAndProgress) ?? [],
+ workCenters: workCenters.data ?? [],
+ };
+
+ if (workCenter !== workCenterId) {
+ const locationId =
+ workCenters.data?.find((wc) => wc.id === workCenterId)?.locationId ??
+ location;
+ return json(payload, {
+ headers: {
+ "Set-Cookie": setLocationAndWorkCenter(locationId, workCenterId),
+ },
+ });
+ }
+
+ return json(payload);
+}
+
+export default function JobsRoute() {
+ const { operations, workCenters } = useLoaderData<typeof loader>();
+ console.log({ operations });
+ const { workCenterId } = useParams();
+ if (!workCenterId) throw new Error("workCenterId not found");
+ const navigate = useNavigate();
+
+ return (
+ <ResizablePanel defaultSize={defaultLayout[1]} minSize={30}>
+ <Tabs defaultValue="current">
+ <div className="flex items-center px-4 py-2 h-[52px] bg-background">
+ <Heading size="h2">Jobs</Heading>
+ <TabsList className="ml-auto">
+ <TabsTrigger value="current">Current</TabsTrigger>
+ <TabsTrigger value="all">All</TabsTrigger>
+ </TabsList>
+ </div>
+ <Separator />
+ <div className="p-4">
+ <div className="relative">
+ <div className="flex justify-between gap-4">
+ <div className="flex flex-grow">
+ <LuSearch className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
+ <Input
+ // value={input}
+ // onChange={onSearchChange}
+ placeholder="Search"
+ className="pl-8"
+ />
+ </div>
+ <div className="flex flex-shrink basis-64">
+ <Select
+ value={workCenterId}
+ onValueChange={(value) => {
+ navigate(path.to.jobs(value));
+ }}
+ >
+ <SelectTrigger aria-label="Select work cell">
+ <SelectValue placeholder="Select a work cell">
+ {workCenters.find((wc) => wc.id === workCenterId)?.name}
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent>
+ {workCenters.map((cell) => (
+ <SelectItem key={cell.id} value={cell.id}>
+ {cell.name}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <TabsContent value="current" className="p-4 pt-0">
+ <OperationsList
+ key={`current:${workCenterId}`}
+ operations={operations.filter((operation) =>
+ ["In Progress", "Ready", "Todo"].includes(
+ operation.operationStatus
+ )
+ )}
+ {...operationSettings}
+ />
+ </TabsContent>
+ <TabsContent value="all" className="p-4 pt-0">
+ <OperationsList
+ key={`all-${workCenterId}`}
+ operations={operations}
+ {...operationSettings}
+ />
+ </TabsContent>
+ </Tabs>
+ </ResizablePanel>
+ );
+}
+
+type OperationsListProps = OperationSettings & {
+ operations: Operation[];
+};
+
+function OperationsList({ operations, ...settings }: OperationsListProps) {
+ const { operationId } = useParams();
+ console.log({ operations });
+ return operations.length > 0 ? (
+ <ScrollArea className="h-[calc(100vh-120px)]">
+ <div className="flex flex-col gap-2">
+ {operations.map((operation) => (
+ <OperationCard
+ key={operation.id}
+ operation={operation}
+ isSelected={operationId === operation.id}
+ {...settings}
+ />
+ ))}
+ </div>
+ </ScrollArea>
+ ) : (
+ <div className="flex flex-col w-full h-[calc(100vh-120px)] items-center justify-center gap-4">
+ <div className="flex justify-center items-center h-12 w-12 rounded-full bg-foreground text-background">
+ <LuAlertTriangle className="h-6 w-6" />
+ </div>
+ <span className="text-lg font-mono font-light text-foreground uppercase">
+ No scheduled jobs
+ </span>
+ </div>
+ );
+}
+
+type OperationCardProps = {
+ isSelected: boolean;
+ operation: Operation;
+} & OperationSettings;
+
+function OperationCard({
+ operation,
+ isSelected = false,
+ showCustomer,
+ showDescription,
+ showDueDate,
+ showDuration,
+ showEmployee,
+ showProgress,
+ showStatus,
+}: OperationCardProps) {
+ const isOverdue =
+ operation.jobDeadlineType !== "No Deadline" && operation.jobDueDate
+ ? new Date(operation.jobDueDate) < new Date()
+ : false;
+
+ return (
+ <Link to={operation.id}>
+ <Card
+ className={cn("cursor-pointer", isSelected && "from-muted to-muted")}
+ >
+ <CardHeader className={cn("max-w-full p-3 border-b relative")}>
+ <div className="flex w-full max-w-full justify-between">
+ <div className="flex flex-col space-y-0">
+ {operation.itemReadableId && (
+ <span className="text-xs text-muted-foreground truncate">
+ {operation.itemReadableId}
+ </span>
+ )}
+ <span className="mr-auto font-semibold truncate">
+ {operation.jobReadableId}
+ </span>
+ </div>
+ </div>
+ </CardHeader>
+ <CardContent className="p-3 space-y-2 text-left whitespace-pre-wrap text-sm">
+ {showDescription && operation.description && (
+ <HStack className="justify-start space-x-2">
+ <LuClipboardCheck className="text-muted-foreground" />
+ <span className="text-sm">{operation.description}</span>
+ </HStack>
+ )}
+ {showStatus && operation.operationStatus && (
+ <HStack className="justify-start space-x-2">
+ {getStatusIcon(operation.operationStatus)}
+ <span className="text-sm">{operation.operationStatus}</span>
+ </HStack>
+ )}
+ {showDuration && operation.duration && (
+ <HStack className="justify-start space-x-2">
+ <LuTimer className="text-muted-foreground" />
+ <span className="text-sm">
+ {formatDurationMilliseconds(operation.duration)}
+ </span>
+ </HStack>
+ )}
+ {showDueDate && operation.jobDeadlineType && (
+ <HStack className="justify-start space-x-2">
+ {getDeadlineIcon(operation.jobDeadlineType, isOverdue)}
+ <Tooltip>
+ <TooltipTrigger>
+ <span
+ className={cn("text-sm", isOverdue ? "text-red-500" : "")}
+ >
+ {["ASAP", "No Deadline"].includes(operation.jobDeadlineType)
+ ? getDeadlineText(operation.jobDeadlineType)
+ : operation.jobDueDate
+ ? `Due ${formatRelativeTime(
+ convertDateStringToIsoString(operation.jobDueDate)
+ )}`
+ : "–"}
+ </span>
+ </TooltipTrigger>
+ <TooltipContent side="right">
+ {getDeadlineText(operation.jobDeadlineType)}
+ </TooltipContent>
+ </Tooltip>
+ </HStack>
+ )}
+ </CardContent>
+ </Card>
+ </Link>
+ );
+}
+
+export function getStatusIcon(status: Operation["operationStatus"]) {
+ switch (status) {
+ case "Ready":
+ case "Todo":
+ return <TodoStatusIcon className="text-foreground" />;
+ case "Waiting":
+ case "Canceled":
+ return <LuXCircle className="text-muted-foreground" />;
+ case "Done":
+ return <LuCheckCircle className="text-blue-600" />;
+ case "In Progress":
+ return <AlmostDoneIcon />;
+ case "Paused":
+ return <InProgressStatusIcon />;
+ default:
+ return null;
+ }
+}
+
+export function getDeadlineIcon(
+ deadlineType: Operation["jobDeadlineType"],
+ overdue: boolean
+) {
+ switch (deadlineType) {
+ case "ASAP":
+ return <BsExclamationSquareFill className="text-red-500" />;
+ case "Hard Deadline":
+ return <HighPriorityIcon className={cn(overdue ? "text-red-500" : "")} />;
+ case "Soft Deadline":
+ return (
+ <MediumPriorityIcon className={cn(overdue ? "text-red-500" : "")} />
+ );
+ case "No Deadline":
+ return <LowPriorityIcon />;
+ }
+}
+
+export function getDeadlineText(deadlineType: Operation["jobDeadlineType"]) {
+ switch (deadlineType) {
+ case "ASAP":
+ return "ASAP";
+ case "Hard Deadline":
+ return "Hard deadline";
+ case "Soft Deadline":
+ return "Soft deadline";
+ case "No Deadline":
+ return "No deadline";
+ }
+}
diff --git a/apps/mes/app/routes/x+/jobs.tsx b/apps/mes/app/routes/x+/jobs.tsx
deleted file mode 100644
index c376c0b6d5..0000000000
--- a/apps/mes/app/routes/x+/jobs.tsx
+++ /dev/null
@@ -1,116 +0,0 @@
-import {
- Heading,
- Input,
- ResizablePanel,
- Separator,
- Tabs,
- TabsContent,
- TabsList,
- TabsTrigger,
-} from "@carbon/react";
-import { LuSearch } from "react-icons/lu";
-import { defaultLayout } from "~/utils/layout";
-
-import { requirePermissions } from "@carbon/auth/auth.server";
-import { useLoaderData } from "@remix-run/react";
-import { json, type LoaderFunctionArgs } from "@vercel/remix";
-import {
- getLocationAndWorkCenter,
- setLocationAndWorkCenter,
-} from "~/services/location.server";
-
-export async function loader({ request }: LoaderFunctionArgs) {
- const { client, companyId, userId } = await requirePermissions(request, {});
-
- const [location, workCenter, updated] = await getLocationAndWorkCenter(
- request,
- client,
- {
- companyId,
- userId,
- }
- );
-
- const [jobs, workCenters, locations] = await Promise.all([
- client.rpc("get_job_operations_by_work_center", {
- location_id: location,
- work_center_id: workCenter,
- }),
- client.from("workCenter").select("*").eq("locationId", location),
- client.from("location").select("*").eq("companyId", companyId),
- ]);
-
- const payload = {
- jobs: jobs.data ?? [],
- location,
- locations: locations.data ?? [],
- workCenter,
- workCenters: workCenters.data ?? [],
- };
-
- if (updated) {
- return json(payload, {
- headers: {
- "Set-Cookie": setLocationAndWorkCenter(location, workCenter),
- },
- });
- }
-
- return json(payload);
-}
-
-export default function JobsRoute() {
- const payload = useLoaderData<typeof loader>();
-
- return (
- <ResizablePanel defaultSize={defaultLayout[1]} minSize={30}>
- <Tabs defaultValue="current">
- <div className="flex items-center px-4 py-2 h-[52px] bg-background">
- <Heading size="h2">Jobs</Heading>
- <TabsList className="ml-auto">
- <TabsTrigger value="current">Current</TabsTrigger>
- <TabsTrigger value="all">All</TabsTrigger>
- </TabsList>
- </div>
- <Separator />
- <div className="p-4">
- <div className="relative">
- <div className="flex justify-between">
- <div className="flex flex-grow">
- <LuSearch className="absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" />
- <Input
- // value={input}
- // onChange={onSearchChange}
- placeholder="Search"
- className="pl-8"
- />
- </div>
- <div className="flex flex-shrink">
- {/* <WorkCellSelect
- workCells={workCells}
- value={selectedWorkCell}
- onChange={setSelectedWorkCell}
- /> */}
- </div>
- </div>
- </div>
- </div>
-
- <TabsContent value="current" className="m-0">
- <pre>{JSON.stringify(payload, null, 2)}</pre>
- {/* <JobsList
- jobs={workCellJobs.filter((job) =>
- ["IN_PROGRESS", "PAUSED", "READY", "TODO"].includes(
- job.status
- )
- )}
- {...jobSettings}
- /> */}
- </TabsContent>
- <TabsContent value="all" className="m-0">
- {/* <JobsList jobs={workCellJobs} {...jobSettings} /> */}
- </TabsContent>
- </Tabs>
- </ResizablePanel>
- );
-}
diff --git a/apps/mes/app/routes/x+/location.tsx b/apps/mes/app/routes/x+/location.tsx
new file mode 100644
index 0000000000..5e9efcdd3b
--- /dev/null
+++ b/apps/mes/app/routes/x+/location.tsx
@@ -0,0 +1,25 @@
+import { assertIsPost } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import type { ActionFunctionArgs } from "@vercel/remix";
+import { redirect } from "@vercel/remix";
+import { getWorkCentersByLocation } from "~/services/jobs";
+import { setLocationAndWorkCenter } from "~/services/location.server";
+import { path } from "~/utils/path";
+
+export async function action({ request }: ActionFunctionArgs) {
+ assertIsPost(request);
+ const { client } = await requirePermissions(request, {});
+ const formData = await request.formData();
+
+ const location = formData.get("location");
+ if (!location || typeof location !== "string") {
+ return null;
+ }
+
+ const workCenters = await getWorkCentersByLocation(client, location);
+ const workCenter = workCenters?.data?.[0]?.id ?? "";
+
+ throw redirect(path.to.authenticatedRoot, {
+ headers: { "Set-Cookie": setLocationAndWorkCenter(location, workCenter) },
+ });
+}
diff --git a/apps/mes/app/services/jobs.ts b/apps/mes/app/services/jobs.ts
new file mode 100644
index 0000000000..3a1e5b7fa5
--- /dev/null
+++ b/apps/mes/app/services/jobs.ts
@@ -0,0 +1,63 @@
+import type { Database } from "@carbon/database";
+import type { SupabaseClient } from "@supabase/supabase-js";
+
+export type OperationSettings = {
+ showCustomer: boolean;
+ showDescription: boolean;
+ showDueDate: boolean;
+ showDuration: boolean;
+ showEmployee: boolean;
+ showProgress: boolean;
+ showStatus: boolean;
+};
+
+export type BaseOperation = NonNullable<
+ Awaited<ReturnType<typeof getJobOperationsByWorkCenter>>["data"]
+>[number];
+
+export type Operation = BaseOperation & {
+ duration: number;
+ setupDuration: number;
+ laborDuration: number;
+ machineDuration: number;
+};
+
+export type WorkCenter = NonNullable<
+ Awaited<ReturnType<typeof getJobOperationsByWorkCenter>>["data"]
+>[number];
+
+export type Location = NonNullable<
+ Awaited<ReturnType<typeof getLocationsByCompany>>["data"]
+>[number];
+
+export async function getJobOperationsByWorkCenter(
+ client: SupabaseClient<Database>,
+ { locationId, workCenterId }: { locationId: string; workCenterId: string }
+) {
+ return client.rpc("get_job_operations_by_work_center", {
+ location_id: locationId,
+ work_center_id: workCenterId,
+ });
+}
+
+export async function getWorkCentersByLocation(
+ client: SupabaseClient<Database>,
+ locationId: string
+) {
+ return client
+ .from("workCenter")
+ .select("*")
+ .eq("locationId", locationId)
+ .order("name", { ascending: true });
+}
+
+export async function getLocationsByCompany(
+ client: SupabaseClient<Database>,
+ companyId: string
+) {
+ return client
+ .from("location")
+ .select("*")
+ .eq("companyId", companyId)
+ .order("name", { ascending: true });
+}
diff --git a/apps/mes/app/styles/tailwind.css b/apps/mes/app/styles/tailwind.css
index 08ab4f7ba2..fae3c558d0 100644
--- a/apps/mes/app/styles/tailwind.css
+++ b/apps/mes/app/styles/tailwind.css
@@ -86,3 +86,23 @@ p.is-editor-empty:first-child:before {
height: 0;
pointer-events: none;
}
+
+@keyframes loading {
+ 0%,
+ 100% {
+ opacity: 0;
+ }
+ 50% {
+ opacity: 1;
+ }
+}
+.loading-dot {
+ animation: loading 1.4s ease-in-out infinite;
+ opacity: 0;
+}
+.loading-dot:nth-child(2) {
+ animation-delay: 0.2s;
+}
+.loading-dot:nth-child(3) {
+ animation-delay: 0.4s;
+}
diff --git a/apps/mes/app/utils/jobs.ts b/apps/mes/app/utils/jobs.ts
new file mode 100644
index 0000000000..7612703acd
--- /dev/null
+++ b/apps/mes/app/utils/jobs.ts
@@ -0,0 +1,139 @@
+import type { BaseOperation, Operation } from "~/services/jobs";
+
+export function makeDurationsAndProgress(operation: BaseOperation): Operation {
+ let setupDuration = 0;
+ let laborDuration = 0;
+ let machineDuration = 0;
+
+ // Calculate setup duration
+ switch (operation.setupUnit) {
+ case "Total Hours":
+ setupDuration = operation.setupTime * 3600000; // Convert hours to milliseconds
+ break;
+ case "Total Minutes":
+ setupDuration = operation.setupTime * 60000; // Convert minutes to milliseconds
+ break;
+ case "Hours/Piece":
+ setupDuration =
+ operation.setupTime * operation.operationQuantity * 3600000;
+ break;
+ case "Hours/100 Pieces":
+ setupDuration =
+ (operation.setupTime / 100) * operation.operationQuantity * 3600000;
+ break;
+ case "Hours/1000 Pieces":
+ setupDuration =
+ (operation.setupTime / 1000) * operation.operationQuantity * 3600000;
+ break;
+ case "Minutes/Piece":
+ setupDuration = operation.setupTime * operation.operationQuantity * 60000;
+ break;
+ case "Minutes/100 Pieces":
+ setupDuration =
+ (operation.setupTime / 100) * operation.operationQuantity * 60000;
+ break;
+ case "Minutes/1000 Pieces":
+ setupDuration =
+ (operation.setupTime / 1000) * operation.operationQuantity * 60000;
+ break;
+ case "Pieces/Hour":
+ setupDuration =
+ (operation.operationQuantity / operation.setupTime) * 3600000;
+ break;
+ case "Pieces/Minute":
+ setupDuration =
+ (operation.operationQuantity / operation.setupTime) * 60000;
+ break;
+ case "Seconds/Piece":
+ setupDuration = operation.setupTime * operation.operationQuantity * 1000;
+ break;
+ }
+
+ // Calculate labor duration
+ switch (operation.laborUnit) {
+ case "Hours/Piece":
+ laborDuration =
+ operation.laborTime * operation.operationQuantity * 3600000;
+ break;
+ case "Hours/100 Pieces":
+ laborDuration =
+ (operation.laborTime / 100) * operation.operationQuantity * 3600000;
+ break;
+ case "Hours/1000 Pieces":
+ laborDuration =
+ (operation.laborTime / 1000) * operation.operationQuantity * 3600000;
+ break;
+ case "Minutes/Piece":
+ laborDuration = operation.laborTime * operation.operationQuantity * 60000;
+ break;
+ case "Minutes/100 Pieces":
+ laborDuration =
+ (operation.laborTime / 100) * operation.operationQuantity * 60000;
+ break;
+ case "Minutes/1000 Pieces":
+ laborDuration =
+ (operation.laborTime / 1000) * operation.operationQuantity * 60000;
+ break;
+ case "Pieces/Hour":
+ laborDuration =
+ (operation.operationQuantity / operation.laborTime) * 3600000;
+ break;
+ case "Pieces/Minute":
+ laborDuration =
+ (operation.operationQuantity / operation.laborTime) * 60000;
+ break;
+ case "Seconds/Piece":
+ laborDuration = operation.laborTime * operation.operationQuantity * 1000;
+ break;
+ }
+
+ // Calculate machine duration
+ switch (operation.machineUnit) {
+ case "Hours/Piece":
+ machineDuration =
+ operation.machineTime * operation.operationQuantity * 3600000;
+ break;
+ case "Hours/100 Pieces":
+ machineDuration =
+ (operation.machineTime / 100) * operation.operationQuantity * 3600000;
+ break;
+ case "Hours/1000 Pieces":
+ machineDuration =
+ (operation.machineTime / 1000) * operation.operationQuantity * 3600000;
+ break;
+ case "Minutes/Piece":
+ machineDuration =
+ operation.machineTime * operation.operationQuantity * 60000;
+ break;
+ case "Minutes/100 Pieces":
+ machineDuration =
+ (operation.machineTime / 100) * operation.operationQuantity * 60000;
+ break;
+ case "Minutes/1000 Pieces":
+ machineDuration =
+ (operation.machineTime / 1000) * operation.operationQuantity * 60000;
+ break;
+ case "Pieces/Hour":
+ machineDuration =
+ (operation.operationQuantity / operation.machineTime) * 3600000;
+ break;
+ case "Pieces/Minute":
+ machineDuration =
+ (operation.operationQuantity / operation.machineTime) * 60000;
+ break;
+ case "Seconds/Piece":
+ machineDuration =
+ operation.machineTime * operation.operationQuantity * 1000;
+ break;
+ }
+
+ const totalDuration = setupDuration + laborDuration + machineDuration;
+
+ return {
+ ...operation,
+ duration: totalDuration,
+ setupDuration,
+ laborDuration,
+ machineDuration,
+ };
+}
diff --git a/apps/mes/app/utils/path.ts b/apps/mes/app/utils/path.ts
index ba2ec980c2..12d8bf2900 100644
--- a/apps/mes/app/utils/path.ts
+++ b/apps/mes/app/utils/path.ts
@@ -1,14 +1,22 @@
import { SUPABASE_API_URL } from "@carbon/auth";
+import { generatePath } from "@remix-run/react";
+
+export const ERP_URL =
+ process.env.NODE_ENV === "development"
+ ? "http://localhost:3000"
+ : `https://app.carbonos.dev`;
const x = "/x"; // from ~/routes/x+ folder
export const path = {
to: {
+ accountSettings: `${ERP_URL}/x/account`,
authenticatedRoot: x,
callback: "/callback",
forgotPassword: "/forgot-password",
healthcheck: "/healthcheck",
- jobs: `${x}/jobs`,
+ jobs: (workCenter: string) => generatePath(`${x}/jobs/${workCenter}`),
+ location: `${x}/location`,
login: "/login",
logout: "/logout",
refreshSession: "/refresh-session",
diff --git a/packages/auth/src/config/env.ts b/packages/auth/src/config/env.ts
index 5497626477..1f69c6851f 100644
--- a/packages/auth/src/config/env.ts
+++ b/packages/auth/src/config/env.ts
@@ -7,6 +7,7 @@ declare global {
SUPABASE_ANON_PUBLIC: string;
POSTHOG_API_HOST: string;
POSTHOG_PROJECT_PUBLIC_KEY: string;
+ VERCEL_URL: string;
};
}
}
@@ -72,7 +73,7 @@ export const SESSION_KEY = "auth";
export const SESSION_ERROR_KEY = "error";
export const SESSION_MAX_AGE = 60 * 60 * 24 * 7; // 7 days;
export const REFRESH_ACCESS_TOKEN_THRESHOLD = 60 * 10; // 10 minutes left before token expires
-export const VERCEL_URL = getEnv("VERCEL_URL");
+export const VERCEL_URL = getEnv("VERCEL_URL", { isSecret: false });
/**
* Shared envs
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index 89389c9eca..f9a3f6204c 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -4677,6 +4677,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobOperation.quantityScrapped",
},
+ {
+ $ref: "#/parameters/rowFilter.jobOperation.status",
+ },
{
$ref: "#/parameters/select",
},
@@ -4832,6 +4835,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobOperation.quantityScrapped",
},
+ {
+ $ref: "#/parameters/rowFilter.jobOperation.status",
+ },
{
$ref: "#/parameters/preferReturn",
},
@@ -4941,6 +4947,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobOperation.quantityScrapped",
},
+ {
+ $ref: "#/parameters/rowFilter.jobOperation.status",
+ },
{
$ref: "#/parameters/body.jobOperation",
},
@@ -6513,6 +6522,18 @@ export default {
{
$ref: "#/parameters/rowFilter.jobOperationsWithMakeMethods.customFields",
},
+ {
+ $ref: "#/parameters/rowFilter.jobOperationsWithMakeMethods.operationQuantity",
+ },
+ {
+ $ref: "#/parameters/rowFilter.jobOperationsWithMakeMethods.quantityComplete",
+ },
+ {
+ $ref: "#/parameters/rowFilter.jobOperationsWithMakeMethods.quantityScrapped",
+ },
+ {
+ $ref: "#/parameters/rowFilter.jobOperationsWithMakeMethods.status",
+ },
{
$ref: "#/parameters/select",
},
@@ -37055,6 +37076,7 @@ export default {
"companyId",
"createdAt",
"createdBy",
+ "status",
],
properties: {
id: {
@@ -37259,6 +37281,20 @@ export default {
format: "numeric",
type: "number",
},
+ status: {
+ default: "Todo",
+ enum: [
+ "Canceled",
+ "Done",
+ "In Progress",
+ "Paused",
+ "Ready",
+ "Todo",
+ "Waiting",
+ ],
+ format: 'public."jobOperationStatus"',
+ type: "string",
+ },
},
type: "object",
},
@@ -38087,6 +38123,31 @@ export default {
customFields: {
format: "jsonb",
},
+ operationQuantity: {
+ format: "numeric",
+ type: "number",
+ },
+ quantityComplete: {
+ format: "numeric",
+ type: "number",
+ },
+ quantityScrapped: {
+ format: "numeric",
+ type: "number",
+ },
+ status: {
+ enum: [
+ "Canceled",
+ "Done",
+ "In Progress",
+ "Paused",
+ "Ready",
+ "Todo",
+ "Waiting",
+ ],
+ format: 'public."jobOperationStatus"',
+ type: "string",
+ },
},
type: "object",
},
@@ -53114,6 +53175,13 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.jobOperation.status": {
+ name: "status",
+ required: false,
+ format: 'public."jobOperationStatus"',
+ in: "query",
+ type: "string",
+ },
"body.journalLine": {
name: "journalLine",
description: "journalLine",
@@ -54175,6 +54243,34 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.jobOperationsWithMakeMethods.operationQuantity": {
+ name: "operationQuantity",
+ required: false,
+ format: "numeric",
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.jobOperationsWithMakeMethods.quantityComplete": {
+ name: "quantityComplete",
+ required: false,
+ format: "numeric",
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.jobOperationsWithMakeMethods.quantityScrapped": {
+ name: "quantityScrapped",
+ required: false,
+ format: "numeric",
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.jobOperationsWithMakeMethods.status": {
+ name: "status",
+ required: false,
+ format: 'public."jobOperationStatus"',
+ in: "query",
+ type: "string",
+ },
"body.customerLocation": {
name: "customerLocation",
description: "customerLocation",
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 5d9377ed3e..70b51afd0b 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -7759,6 +7759,7 @@ export type Database = {
quantityScrapped: number | null
setupTime: number
setupUnit: Database["public"]["Enums"]["factor"]
+ status: Database["public"]["Enums"]["jobOperationStatus"]
updatedAt: string | null
updatedBy: string | null
workCenterId: string | null
@@ -7793,6 +7794,7 @@ export type Database = {
quantityScrapped?: number | null
setupTime?: number
setupUnit?: Database["public"]["Enums"]["factor"]
+ status?: Database["public"]["Enums"]["jobOperationStatus"]
updatedAt?: string | null
updatedBy?: string | null
workCenterId?: string | null
@@ -7827,6 +7829,7 @@ export type Database = {
quantityScrapped?: number | null
setupTime?: number
setupUnit?: Database["public"]["Enums"]["factor"]
+ status?: Database["public"]["Enums"]["jobOperationStatus"]
updatedAt?: string | null
updatedBy?: string | null
workCenterId?: string | null
@@ -23379,14 +23382,18 @@ export type Database = {
operationOrder:
| Database["public"]["Enums"]["methodOperationOrder"]
| null
+ operationQuantity: number | null
operationSupplierProcessId: string | null
operationType: Database["public"]["Enums"]["operationType"] | null
operationUnitCost: number | null
order: number | null
overheadRate: number | null
processId: string | null
+ quantityComplete: number | null
+ quantityScrapped: number | null
setupTime: number | null
setupUnit: Database["public"]["Enums"]["factor"] | null
+ status: Database["public"]["Enums"]["jobOperationStatus"] | null
updatedAt: string | null
updatedBy: string | null
workCenterId: string | null
@@ -25050,14 +25057,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
@@ -26784,14 +26791,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["paymentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["paymentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
@@ -28740,7 +28747,7 @@ export type Database = {
location_id: string
}
Returns: {
- jobOperationId: string
+ id: string
jobId: string
operationOrder: number
processId: string
@@ -28753,12 +28760,16 @@ export type Database = {
machineTime: number
machineUnit: Database["public"]["Enums"]["factor"]
operationOrderType: Database["public"]["Enums"]["methodOperationOrder"]
- jobNumber: string
+ jobReadableId: string
jobStatus: Database["public"]["Enums"]["jobStatus"]
- jobPriority: number
jobDueDate: string
+ jobDeadlineType: Database["public"]["Enums"]["deadlineType"]
parentMaterialId: string
- parentMaterialReadableId: string
+ itemReadableId: string
+ operationStatus: Database["public"]["Enums"]["jobOperationStatus"]
+ operationQuantity: number
+ quantityComplete: number
+ quantityScrapped: number
}[]
}
get_method_tree: {
@@ -29091,6 +29102,14 @@ export type Database = {
| "Service"
| "Consumable"
| "Fixture"
+ jobOperationStatus:
+ | "Canceled"
+ | "Done"
+ | "In Progress"
+ | "Paused"
+ | "Ready"
+ | "Todo"
+ | "Waiting"
jobStatus:
| "Draft"
| "Ready"
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 5d9377ed3e..70b51afd0b 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -7759,6 +7759,7 @@ export type Database = {
quantityScrapped: number | null
setupTime: number
setupUnit: Database["public"]["Enums"]["factor"]
+ status: Database["public"]["Enums"]["jobOperationStatus"]
updatedAt: string | null
updatedBy: string | null
workCenterId: string | null
@@ -7793,6 +7794,7 @@ export type Database = {
quantityScrapped?: number | null
setupTime?: number
setupUnit?: Database["public"]["Enums"]["factor"]
+ status?: Database["public"]["Enums"]["jobOperationStatus"]
updatedAt?: string | null
updatedBy?: string | null
workCenterId?: string | null
@@ -7827,6 +7829,7 @@ export type Database = {
quantityScrapped?: number | null
setupTime?: number
setupUnit?: Database["public"]["Enums"]["factor"]
+ status?: Database["public"]["Enums"]["jobOperationStatus"]
updatedAt?: string | null
updatedBy?: string | null
workCenterId?: string | null
@@ -23379,14 +23382,18 @@ export type Database = {
operationOrder:
| Database["public"]["Enums"]["methodOperationOrder"]
| null
+ operationQuantity: number | null
operationSupplierProcessId: string | null
operationType: Database["public"]["Enums"]["operationType"] | null
operationUnitCost: number | null
order: number | null
overheadRate: number | null
processId: string | null
+ quantityComplete: number | null
+ quantityScrapped: number | null
setupTime: number | null
setupUnit: Database["public"]["Enums"]["factor"] | null
+ status: Database["public"]["Enums"]["jobOperationStatus"] | null
updatedAt: string | null
updatedBy: string | null
workCenterId: string | null
@@ -25050,14 +25057,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
@@ -26784,14 +26791,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["paymentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["paymentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
@@ -28740,7 +28747,7 @@ export type Database = {
location_id: string
}
Returns: {
- jobOperationId: string
+ id: string
jobId: string
operationOrder: number
processId: string
@@ -28753,12 +28760,16 @@ export type Database = {
machineTime: number
machineUnit: Database["public"]["Enums"]["factor"]
operationOrderType: Database["public"]["Enums"]["methodOperationOrder"]
- jobNumber: string
+ jobReadableId: string
jobStatus: Database["public"]["Enums"]["jobStatus"]
- jobPriority: number
jobDueDate: string
+ jobDeadlineType: Database["public"]["Enums"]["deadlineType"]
parentMaterialId: string
- parentMaterialReadableId: string
+ itemReadableId: string
+ operationStatus: Database["public"]["Enums"]["jobOperationStatus"]
+ operationQuantity: number
+ quantityComplete: number
+ quantityScrapped: number
}[]
}
get_method_tree: {
@@ -29091,6 +29102,14 @@ export type Database = {
| "Service"
| "Consumable"
| "Fixture"
+ jobOperationStatus:
+ | "Canceled"
+ | "Done"
+ | "In Progress"
+ | "Paused"
+ | "Ready"
+ | "Todo"
+ | "Waiting"
jobStatus:
| "Draft"
| "Ready"
diff --git a/packages/database/supabase/migrations/20240927033740_job-operations-for-mes.sql b/packages/database/supabase/migrations/20240927033740_job-operations-for-mes.sql
index c1638da90d..0fcf0ad8c7 100644
--- a/packages/database/supabase/migrations/20240927033740_job-operations-for-mes.sql
+++ b/packages/database/supabase/migrations/20240927033740_job-operations-for-mes.sql
@@ -1,9 +1,36 @@
+
+
+CREATE TYPE "jobOperationStatus" AS ENUM (
+ 'Canceled',
+ 'Done',
+ 'In Progress',
+ 'Paused',
+ 'Ready',
+ 'Todo',
+ 'Waiting'
+);
+
+ALTER TABLE "jobOperation"
+ADD COLUMN "status" "jobOperationStatus" NOT NULL DEFAULT 'Todo';
+
+CREATE OR REPLACE VIEW "jobOperationsWithMakeMethods" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ mm.id AS "makeMethodId",
+ jo.*
+ FROM "jobOperation" jo
+ INNER JOIN "jobMakeMethod" jmm
+ ON jo."jobMakeMethodId" = jmm.id
+ LEFT JOIN "makeMethod" mm
+ ON jmm."itemId" = mm."itemId";
+
+CREATE INDEX idx_job_status_location ON "job" ("status", "locationId");
+
CREATE OR REPLACE FUNCTION get_job_operations_by_work_center(
work_center_id TEXT,
location_id TEXT
)
RETURNS TABLE (
- "jobOperationId" TEXT,
+ "id" TEXT,
"jobId" TEXT,
"operationOrder" DOUBLE PRECISION,
"processId" TEXT,
@@ -16,46 +43,58 @@ RETURNS TABLE (
"machineTime" NUMERIC(10,2),
"machineUnit" factor,
"operationOrderType" "methodOperationOrder",
- "jobNumber" TEXT,
+ "jobReadableId" TEXT,
"jobStatus" "jobStatus",
- "jobPriority" INTEGER,
"jobDueDate" DATE,
+ "jobDeadlineType" "deadlineType",
"parentMaterialId" TEXT,
- "parentMaterialReadableId" TEXT
+ "itemReadableId" TEXT,
+ "operationStatus" "jobOperationStatus",
+ "operationQuantity" NUMERIC(10,2),
+ "quantityComplete" NUMERIC(10,2),
+ "quantityScrapped" NUMERIC(10,2)
)
SECURITY INVOKER
AS $$
BEGIN
RETURN QUERY
- WITH relevant_job_operations AS (
- SELECT jo.*
- FROM "jobOperation" jo
- WHERE jo."workCenterId" = work_center_id
+ WITH relevant_jobs AS (
+ SELECT *
+ FROM "job"
+ WHERE "locationId" = location_id
+ AND ("status" = 'Ready' OR "status" = 'In Progress' OR "status" = 'Paused')
)
SELECT
- rjo."id" AS "jobOperationId",
- rjo."jobId",
- rjo."order" AS "operationOrder",
- rjo."processId",
- rjo."workCenterId",
- rjo."description",
- rjo."setupTime",
- rjo."setupUnit",
- rjo."laborTime",
- rjo."laborUnit",
- rjo."machineTime",
- rjo."machineUnit",
- rjo."operationOrder" AS "operationOrderType",
- j."jobId" AS "jobNumber",
- j."status" AS "jobStatus",
- j."priority" AS "jobPriority",
- j."dueDate" AS "jobDueDate",
+ jo."id",
+ jo."jobId",
+ jo."order" AS "operationOrder",
+ jo."processId",
+ jo."workCenterId",
+ jo."description",
+ jo."setupTime",
+ jo."setupUnit",
+ jo."laborTime",
+ jo."laborUnit",
+ jo."machineTime",
+ jo."machineUnit",
+ jo."operationOrder" AS "operationOrderType",
+ rj."jobId" AS "jobReadableId",
+ rj."status" AS "jobStatus",
+ rj."dueDate" AS "jobDueDate",
+ rj."deadlineType" AS "jobDeadlineType",
jmm."parentMaterialId",
- i."readableId" AS "parentMaterialReadableId"
- FROM relevant_job_operations rjo
- JOIN "job" j ON j."id" = rjo."jobId"
- LEFT JOIN "jobMakeMethod" jmm ON j."id" = jmm."jobId"
- LEFT JOIN "item" i ON jmm."parentMaterialId" = i."id"
- WHERE j."locationId" = location_id;
+ i."readableId" as "itemReadableId",
+ CASE
+ WHEN rj."status" = 'Paused' THEN 'Paused'
+ ELSE jo."status"
+ END AS "operationStatus",
+ jo."operationQuantity",
+ jo."quantityComplete",
+ jo."quantityScrapped"
+ FROM "jobOperation" jo
+ JOIN relevant_jobs rj ON rj.id = jo."jobId"
+ LEFT JOIN "jobMakeMethod" jmm ON jo."jobMakeMethodId" = jmm.id
+ LEFT JOIN "item" i ON jmm."itemId" = i.id
+ WHERE jo."workCenterId" = work_center_id;
END;
$$ LANGUAGE plpgsql;
diff --git a/packages/react/src/Button.tsx b/packages/react/src/Button.tsx
index 08563a25d8..6b571874e2 100644
--- a/packages/react/src/Button.tsx
+++ b/packages/react/src/Button.tsx
@@ -13,7 +13,7 @@ export const buttonVariants = cva(
variants: {
variant: {
primary:
- "bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm shadow-[inset_0_2px_3px_0_theme(colors.white/15%)]",
+ "bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm shadow-[inset_0_1px_2px_0_theme(colors.white/15%)]",
active:
"bg-active text-active-foreground hover:bg-active/90 hover:text-active-foreground",
secondary:
diff --git a/packages/react/src/Dropdown.tsx b/packages/react/src/Dropdown.tsx
index d9ddee18cb..04442fd8ac 100644
--- a/packages/react/src/Dropdown.tsx
+++ b/packages/react/src/Dropdown.tsx
@@ -8,8 +8,7 @@ import type {
ReactElement,
} from "react";
import { cloneElement, forwardRef } from "react";
-import { LuCheckCircle2, LuChevronRight } from "react-icons/lu";
-import { RxCheck } from "react-icons/rx";
+import { LuCheck, LuChevronRight } from "react-icons/lu";
import { cn } from "./utils/cn";
@@ -128,7 +127,7 @@ const DropdownMenuCheckboxItem = forwardRef<
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<DropdownMenuPrimitive.ItemIndicator>
- <RxCheck className="h-4 w-4" />
+ <LuCheck className="h-4 w-4" />
</DropdownMenuPrimitive.ItemIndicator>
</span>
{children}
@@ -152,7 +151,7 @@ const DropdownMenuRadioItem = forwardRef<
{children}
<span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
<DropdownMenuPrimitive.ItemIndicator>
- <LuCheckCircle2 className="h-4 w-4 text-green-500" />
+ <LuCheck className="h-4 w-4 " />
</DropdownMenuPrimitive.ItemIndicator>
</span>
</DropdownMenuPrimitive.RadioItem>
diff --git a/packages/react/src/Select.tsx b/packages/react/src/Select.tsx
index 12463b4634..0e11fc34fd 100644
--- a/packages/react/src/Select.tsx
+++ b/packages/react/src/Select.tsx
@@ -6,11 +6,11 @@ import { cva } from "class-variance-authority";
import type { ComponentPropsWithoutRef, ElementRef } from "react";
import { forwardRef } from "react";
import {
- RxCaretSort,
- RxCheck,
- RxChevronDown,
- RxChevronUp,
-} from "react-icons/rx";
+ LuCheck,
+ LuChevronDown,
+ LuChevronsUpDown,
+ LuChevronUp,
+} from "react-icons/lu";
import { cn } from "./utils/cn";
@@ -56,7 +56,7 @@ const SelectTrigger = forwardRef<
>
{children}
<SelectPrimitive.Icon asChild>
- <RxCaretSort className="h-4 w-4 opacity-50" />
+ <LuChevronsUpDown className="h-4 w-4 opacity-50" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
));
@@ -74,7 +74,7 @@ const SelectScrollUpButton = forwardRef<
)}
{...props}
>
- <RxChevronUp />
+ <LuChevronUp />
</SelectPrimitive.ScrollUpButton>
));
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
@@ -91,7 +91,7 @@ const SelectScrollDownButton = forwardRef<
)}
{...props}
>
- <RxChevronDown />
+ <LuChevronDown />
</SelectPrimitive.ScrollDownButton>
));
SelectScrollDownButton.displayName =
@@ -155,7 +155,7 @@ const SelectItem = forwardRef<
>
<span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
<SelectPrimitive.ItemIndicator>
- <RxCheck className="h-4 w-4" />
+ <LuCheck className="h-4 w-4" />
</SelectPrimitive.ItemIndicator>
</span>
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
diff --git a/packages/utils/src/themes.ts b/packages/utils/src/themes.ts
index b07d6b6faf..27f4545cc9 100644
--- a/packages/utils/src/themes.ts
+++ b/packages/utils/src/themes.ts
@@ -169,62 +169,6 @@ export const themes = [
},
},
},
- {
- name: "rose",
- label: "Rose",
- activeColor: {
- light: "346.8 77.2% 49.8%",
- dark: "346.8 77.2% 49.8%",
- },
- cssVars: {
- light: {
- background: "0 0% 100%",
- foreground: "240 10% 3.9%",
- card: "0 0% 100%",
- "card-foreground": "240 10% 3.9%",
- popover: "0 0% 100%",
- "popover-foreground": "240 10% 3.9%",
- primary: "346.8 77.2% 49.8%",
- "primary-foreground": "355.7 100% 97.3%",
- active: "0 0% 86%",
- "active-foreground": "0 0% 4.1%",
- secondary: "240 4.8% 95.9%",
- "secondary-foreground": "240 5.9% 10%",
- muted: "240 4.8% 95.9%",
- "muted-foreground": "240 3.8% 46.1%",
- accent: "240 4.8% 95.9%",
- "accent-foreground": "240 5.9% 10%",
- destructive: "0 84.2% 60.2%",
- "destructive-foreground": "0 0% 98%",
- border: "240 5.9% 90%",
- input: "240 5.9% 90%",
- ring: "346.8 77.2% 49.8%",
- },
- dark: {
- background: "20 14.3% 6.1%",
- foreground: "0 0% 95%",
- popover: "0 0% 9%",
- "popover-foreground": "0 0% 95%",
- card: "24 9.8% 9%",
- "card-foreground": "0 0% 95%",
- primary: "346.8 77.2% 49.8%",
- "primary-foreground": "355.7 100% 97.3%",
- active: "0 0% 86%",
- "active-foreground": "0 0% 4.1%",
- secondary: "240 3.7% 15.9%",
- "secondary-foreground": "0 0% 98%",
- muted: "0 0% 15%",
- "muted-foreground": "240 5% 64.9%",
- accent: "12 6.5% 15.1%",
- "accent-foreground": "0 0% 98%",
- destructive: "0 62.8% 30.6%",
- "destructive-foreground": "0 85.7% 97.3%",
- border: "240 3.7% 15.9%",
- input: "240 3.7% 15.9%",
- ring: "346.8 77.2% 49.8%",
- },
- },
- },
{
name: "orange",
label: "Orange",
@@ -281,6 +225,63 @@ export const themes = [
},
},
},
+ {
+ name: "yellow",
+ label: "Yellow",
+ activeColor: {
+ light: "47.9 95.8% 53.1%",
+ dark: "47.9 95.8% 53.1%",
+ },
+ cssVars: {
+ light: {
+ background: "0 0% 100%",
+ foreground: "20 14.3% 4.1%",
+ card: "0 0% 100%",
+ "card-foreground": "20 14.3% 4.1%",
+ popover: "0 0% 100%",
+ "popover-foreground": "20 14.3% 4.1%",
+ primary: "47.9 95.8% 53.1%",
+ "primary-foreground": "26 83.3% 14.1%",
+ active: "0 0% 86%",
+ "active-foreground": "0 0% 4.1%",
+ secondary: "60 4.8% 95.9%",
+ "secondary-foreground": "24 9.8% 10%",
+ muted: "60 4.8% 95.9%",
+ "muted-foreground": "25 5.3% 44.7%",
+ accent: "60 4.8% 95.9%",
+ "accent-foreground": "24 9.8% 10%",
+ destructive: "0 84.2% 60.2%",
+ "destructive-foreground": "60 9.1% 97.8%",
+ border: "20 5.9% 90%",
+ input: "20 5.9% 90%",
+ ring: "20 14.3% 4.1%",
+ },
+ dark: {
+ background: "20 14.3% 6.1%",
+ foreground: "60 9.1% 97.8%",
+ card: "20 14.3% 4.1%",
+ "card-foreground": "60 9.1% 97.8%",
+ popover: "20 14.3% 4.1%",
+ "popover-foreground": "60 9.1% 97.8%",
+ primary: "47.9 95.8% 53.1%",
+ "primary-foreground": "26 83.3% 14.1%",
+ active: "47.9 95.8% 13.1%",
+ "active-foreground": "47.9 95.8% 53.1%",
+ secondary: "12 6.5% 15.1%",
+ "secondary-foreground": "60 9.1% 97.8%",
+ muted: "12 6.5% 15.1%",
+ "muted-foreground": "24 5.4% 63.9%",
+ accent: "12 6.5% 15.1%",
+ "accent-foreground": "60 9.1% 97.8%",
+ destructive: "0 62.8% 30.6%",
+ "destructive-foreground": "60 9.1% 97.8%",
+ border: "12 6.5% 15.1%",
+ input: "12 6.5% 15.1%",
+ ring: "35.5 91.7% 32.9%",
+ },
+ },
+ },
+
{
name: "green",
label: "Green",
@@ -393,62 +394,6 @@ export const themes = [
},
},
},
- {
- name: "yellow",
- label: "Yellow",
- activeColor: {
- light: "47.9 95.8% 53.1%",
- dark: "47.9 95.8% 53.1%",
- },
- cssVars: {
- light: {
- background: "0 0% 100%",
- foreground: "20 14.3% 4.1%",
- card: "0 0% 100%",
- "card-foreground": "20 14.3% 4.1%",
- popover: "0 0% 100%",
- "popover-foreground": "20 14.3% 4.1%",
- primary: "47.9 95.8% 53.1%",
- "primary-foreground": "26 83.3% 14.1%",
- active: "0 0% 86%",
- "active-foreground": "0 0% 4.1%",
- secondary: "60 4.8% 95.9%",
- "secondary-foreground": "24 9.8% 10%",
- muted: "60 4.8% 95.9%",
- "muted-foreground": "25 5.3% 44.7%",
- accent: "60 4.8% 95.9%",
- "accent-foreground": "24 9.8% 10%",
- destructive: "0 84.2% 60.2%",
- "destructive-foreground": "60 9.1% 97.8%",
- border: "20 5.9% 90%",
- input: "20 5.9% 90%",
- ring: "20 14.3% 4.1%",
- },
- dark: {
- background: "20 14.3% 6.1%",
- foreground: "60 9.1% 97.8%",
- card: "20 14.3% 4.1%",
- "card-foreground": "60 9.1% 97.8%",
- popover: "20 14.3% 4.1%",
- "popover-foreground": "60 9.1% 97.8%",
- primary: "47.9 95.8% 53.1%",
- "primary-foreground": "26 83.3% 14.1%",
- active: "47.9 95.8% 13.1%",
- "active-foreground": "47.9 95.8% 53.1%",
- secondary: "12 6.5% 15.1%",
- "secondary-foreground": "60 9.1% 97.8%",
- muted: "12 6.5% 15.1%",
- "muted-foreground": "24 5.4% 63.9%",
- accent: "12 6.5% 15.1%",
- "accent-foreground": "60 9.1% 97.8%",
- destructive: "0 62.8% 30.6%",
- "destructive-foreground": "60 9.1% 97.8%",
- border: "12 6.5% 15.1%",
- input: "12 6.5% 15.1%",
- ring: "35.5 91.7% 32.9%",
- },
- },
- },
{
name: "violet",
label: "Violet",
@@ -466,8 +411,8 @@ export const themes = [
"popover-foreground": "224 71.4% 4.1%",
primary: "252.1 83.3% 47.8%",
"primary-foreground": "210 20% 98%",
- active: "0 0% 86%",
- "active-foreground": "0 0% 4.1%",
+ active: "220 14.3% 95.9%",
+ "active-foreground": "252.1 83.3% 47.8%",
secondary: "220 14.3% 95.9%",
"secondary-foreground": "220.9 39.3% 11%",
muted: "220 14.3% 95.9%",
@@ -487,7 +432,7 @@ export const themes = [
"card-foreground": "210 20% 98%",
popover: "263 41.4 8.9%",
"popover-foreground": "210 20% 98%",
- primary: "263 70% 40.4%",
+ primary: "327 70% 40.4%",
"primary-foreground": "210 20% 98%",
active: "263 40% 20%",
"active-foreground": "263 41 98%",