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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
refactor(mobile): one item header, shared summary rows, simpler storage-unit and picking-line phone paths, shared sheet rows, SplitButton and CreateMenu reuse
aashu9350bfe04229
diff --git a/apps/erp/app/components/Layout/Mobile/CreateSheet.tsx b/apps/erp/app/components/Layout/Mobile/CreateSheet.tsxdeleted file mode 100644index 3b3a7012ca..0000000000--- a/apps/erp/app/components/Layout/Mobile/CreateSheet.tsx+++ /dev/null@@ -1,49 +0,0 @@-// SPDX-License-Identifier: AGPL-3.0-only-// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,-// including ports, remain AGPLv3; serving them over a network requires releasing their source.--import {- BottomSheet,- BottomSheetBody,- BottomSheetContent,- BottomSheetHeader,- BottomSheetTitle,- PrefetchLink-} from "@carbon/react";-import { Trans } from "@lingui/react/macro";-import { useCreate } from "../Topbar/CreateMenu";-import { SheetRowContent, sheetRowClassName } from "./SheetRow";--/** The tab bar's Create sheet: the desktop Create menu's items, same order. */-export function CreateSheet({- open,- onOpenChange-}: {- open: boolean;- onOpenChange: (open: boolean) => void;-}) {- const items = useCreate();- return (- <BottomSheet open={open} onOpenChange={onOpenChange}>- <BottomSheetContent>- <BottomSheetHeader>- <BottomSheetTitle>- <Trans>Create</Trans>- </BottomSheetTitle>- </BottomSheetHeader>- <BottomSheetBody className="px-2">- {items.map((item) => (- <PrefetchLink- key={item.to}- to={item.to}- className={sheetRowClassName}- onClick={() => onOpenChange(false)}- >- <SheetRowContent icon={item.icon} label={item.name} />- </PrefetchLink>- ))}- </BottomSheetBody>- </BottomSheetContent>- </BottomSheet>- );-}diff --git a/apps/erp/app/components/Layout/Mobile/MobileTabBar.tsx b/apps/erp/app/components/Layout/Mobile/MobileTabBar.tsxindex 203ece22bf..f8ed122ba7 100644--- a/apps/erp/app/components/Layout/Mobile/MobileTabBar.tsx+++ b/apps/erp/app/components/Layout/Mobile/MobileTabBar.tsx@@ -11,8 +11,8 @@ import { Avatar } from "~/components";import { useUser } from "~/hooks";import { useUIStore } from "~/stores/ui";import { path } from "~/utils/path";+import CreateMenu from "../Topbar/CreateMenu";import { useBottomBarActive } from "./ChromeSlots";-import { CreateSheet } from "./CreateSheet";import { ModulesSheet } from "./ModulesSheet";import { ProfileSheet } from "./ProfileSheet";import { useAppBar } from "./useAppBar";@@ -58,11 +58,16 @@ export function MobileTabBar() {label={t`Search`}onClick={openSearchModal}/>- <TabBarItem- icon={<LuSquarePen />}- label={t`Create`}- isActive={sheet === "create"}- onClick={() => setSheet("create")}+ <CreateMenu+ open={sheet === "create"}+ onOpenChange={setOpen("create")}+ trigger={+ <TabBarItem+ icon={<LuSquarePen />}+ label={t`Create`}+ isActive={sheet === "create"}+ />+ }/><TabBarItemicon={<LuLayoutGrid />}@@ -83,7 +88,6 @@ export function MobileTabBar() {onClick={() => setSheet("profile")}/></TabBar>- <CreateSheet open={sheet === "create"} onOpenChange={setOpen("create")} /><ModulesSheetopen={sheet === "modules"}onOpenChange={setOpen("modules")}diff --git a/apps/erp/app/components/Layout/Mobile/ModulesSheet.tsx b/apps/erp/app/components/Layout/Mobile/ModulesSheet.tsxindex 91cd95d565..be286a9641 100644--- a/apps/erp/app/components/Layout/Mobile/ModulesSheet.tsx+++ b/apps/erp/app/components/Layout/Mobile/ModulesSheet.tsx@@ -8,7 +8,8 @@ import {BottomSheetContent,BottomSheetHeader,BottomSheetTitle,- PrefetchLink+ PrefetchLink,+ sheetRowClassName} from "@carbon/react";import { Trans, useLingui } from "@lingui/react/macro";import { ModuleCard } from "~/components/ModuleCard";@@ -17,7 +18,7 @@ import {ImplementationData} from "~/hooks/useImplementationNavItem";import { useModules, useSettingsModule } from "~/hooks/useModules";-import { SheetRowContent, sheetRowClassName } from "./SheetRow";+import { SheetRowContent } from "./SheetRow";/*** The tab bar's Modules sheet: the desktop rail's items in rail order —diff --git a/apps/erp/app/components/Layout/Mobile/ProfileSheet.tsx b/apps/erp/app/components/Layout/Mobile/ProfileSheet.tsxindex 931ecdfcf5..b684fbf22f 100644--- a/apps/erp/app/components/Layout/Mobile/ProfileSheet.tsx+++ b/apps/erp/app/components/Layout/Mobile/ProfileSheet.tsx@@ -14,6 +14,8 @@ import {cn,ItarDisclosure,PrefetchLink,+ SheetSectionLabel,+ sheetRowClassName,useMode} from "@carbon/react";import { themes } from "@carbon/utils";@@ -33,12 +35,7 @@ import {useCompanySwitchRedirect} from "../Topbar/CompanySwitcher";import { NotificationsPanel } from "../Topbar/Notifications";-import {- SheetRowButton,- SheetRowContent,- SheetRowGroup,- sheetRowClassName-} from "./SheetRow";+import { SheetRowButton, SheetRowContent, SheetRowGroup } from "./SheetRow";/** Consecutive items with the same `group`, as the desktop separators split them. */function groupItems(items: AccountMenuItem[]) {@@ -316,9 +313,7 @@ export function ProfileSheet({{screen.id === "companies" &&companyGroups.map((group) => (<SheetRowGroup key={group.name}>- <div className="px-3 pt-2 pb-1 text-xs font-medium uppercase tracking-[0.04em] text-muted-foreground">- {group.name}- </div>+ <SheetSectionLabel>{group.name}</SheetSectionLabel>{group.companies.map((company) => {const logo =mode === "dark"diff --git a/apps/erp/app/components/Layout/Mobile/SheetRow.tsx b/apps/erp/app/components/Layout/Mobile/SheetRow.tsxindex d8e8f08e35..214d3b2952 100644--- a/apps/erp/app/components/Layout/Mobile/SheetRow.tsx+++ b/apps/erp/app/components/Layout/Mobile/SheetRow.tsx@@ -2,13 +2,13 @@// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,// including ports, remain AGPLv3; serving them over a network requires releasing their source.-import { cn } from "@carbon/react";+import { cn, sheetRowClassName } from "@carbon/react";import type { ComponentProps, ReactNode } from "react";import { forwardRef } from "react";import { LuArrowUpRight, LuCheck, LuChevronRight } from "react-icons/lu";/**- * One 48pt row in a shell sheet (Create, Modules, Profile). The trailing+ * One 48pt row in a shell sheet (Modules, Profile). The trailing* indicator: › drills in, ↗ leaves the app, ✓ marks the current.*/export type SheetRowTrailing = "drill" | "external" | "check" | ReactNode;@@ -57,9 +57,6 @@ export function SheetRowContent({);}-export const sheetRowClassName =- "flex min-h-12 w-full items-center gap-3 rounded-lg px-3 text-[15px] text-foreground outline-none active:bg-accent focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50";-export const SheetRowButton = forwardRef<HTMLButtonElement,ComponentProps<"button"> & { destructive?: boolean }diff --git a/apps/erp/app/components/Layout/Navigation/ContentSidebar.tsx b/apps/erp/app/components/Layout/Navigation/ContentSidebar.tsxindex cb391360af..49caa43541 100644--- a/apps/erp/app/components/Layout/Navigation/ContentSidebar.tsx+++ b/apps/erp/app/components/Layout/Navigation/ContentSidebar.tsx@@ -19,11 +19,11 @@ const ContentSidebar = ({ links }: { links: Route[] }) => {const [params] = useUrlParams();const filter = params.get("q") ?? undefined;const presentation = useSidebarPresentation();+ const isActive = (route: Route) =>+ location.pathname.includes(route.to) && route.q === filter;if (presentation === "title") {- const active = links.find(- (route) => location.pathname.includes(route.to) && route.q === filter- );+ const active = links.find(isActive);return active ? <>{active.name}</> : null;}@@ -36,9 +36,7 @@ const ContentSidebar = ({ links }: { links: Route[] }) => {to={route.to + (route.q ? `?q=${route.q}` : "")}icon={route.icon}label={route.name}- isActive={- location.pathname.includes(route.to) && route.q === filter- }+ isActive={isActive(route)}/>))}</SheetNavGroup>@@ -50,19 +48,17 @@ const ContentSidebar = ({ links }: { links: Route[] }) => {<VStack><VStack spacing={1} className="p-2">{links.map((route) => {- const isActive =- location.pathname.includes(route.to) && route.q === filter;+ const active = isActive(route);return (<Buttonkey={route.name}asChildleftIcon={route.icon}- variant={isActive ? "active" : "ghost"}+ variant={active ? "active" : "ghost"}data-nav-item=""className={cn("w-full justify-start",- !isActive &&- "hover:bg-transparent hover:text-active-foreground"+ !active && "hover:bg-transparent hover:text-active-foreground")}><PrefetchLink to={route.to + (route.q ? `?q=${route.q}` : "")}>diff --git a/apps/erp/app/components/Layout/Navigation/GroupedContentSidebar.tsx b/apps/erp/app/components/Layout/Navigation/GroupedContentSidebar.tsxindex 6c2afa7b64..a0c66c1f57 100644--- a/apps/erp/app/components/Layout/Navigation/GroupedContentSidebar.tsx+++ b/apps/erp/app/components/Layout/Navigation/GroupedContentSidebar.tsx@@ -96,16 +96,21 @@ const GroupedContentSidebar = ({};const presentation = useSidebarPresentation();+ const search = `${location.pathname}${location.search}`;+ const isViewActive = (view: { id: string }) =>+ search.includes(`view=${view.id}`);+ // While a saved view is open (view= in the URL), it holds the highlight.+ const isActive = (route: GroupedRoute) =>+ matchesRoute(route, location.pathname, exactMatch) &&+ (Boolean(route.isActive) || exactMatch || !search.includes("view="));+if (presentation === "title") {// Compact app bar title: the item the switcher sheet below ticks.- const search = `${location.pathname}${location.search}`;for (const route of groups.flatMap((group) => group.routes)) {if (!matchesRoute(route, location.pathname, exactMatch)) continue;- const view = route.views?.find((v) => search.includes(`view=${v.id}`));+ const view = route.views?.find(isViewActive);if (view) return <>{view.name}</>;- if (Boolean(route.isActive) || exactMatch || !search.includes("view=")) {- return <>{route.name}</>;- }+ if (isActive(route)) return <>{route.name}</>;}return null;}@@ -113,17 +118,11 @@ const GroupedContentSidebar = ({// Compact section switcher: the same groups, order and active rule as// the panel below. Saved views open from here; reordering and deleting// them stays on desktop.- const search = `${location.pathname}${location.search}`;return (<div className="flex flex-col">{groups.map((group) => (<SheetNavGroup key={group.name} title={group.name}>{group.routes.map((route) => {- const isActive =- matchesRoute(route, location.pathname, exactMatch) &&- (Boolean(route.isActive) ||- exactMatch ||- !search.includes("view="));const views = [...(route.views ?? [])].sort((a, b) => a.sortOrder - b.sortOrder);@@ -133,14 +132,14 @@ const GroupedContentSidebar = ({to={route.to + (route.q ? `?q=${route.q}` : "")}icon={route.icon}label={route.name}- isActive={isActive}+ isActive={isActive(route)}/>{views.map((view) => (<SheetNavRowkey={view.to}to={view.to}label={view.name}- isActive={search.includes(`view=${view.id}`)}+ isActive={isViewActive(view)}inset/>))}@@ -166,13 +165,7 @@ const GroupedContentSidebar = ({{group.name}</Subheading>{group.routes.map((route) => {- const isActive =- matchesRoute(route, location.pathname, exactMatch) &&- (Boolean(route.isActive) ||- exactMatch ||- !`${location.pathname}${location.search}`.includes(- "view="- ));+ const active = isActive(route);const hasViews = route.views && route.views.length > 0;const isExpanded = expandedViews[route.name];@@ -193,10 +186,10 @@ const GroupedContentSidebar = ({<ButtonasChildleftIcon={route.icon}- variant={isActive ? "active" : "ghost"}+ variant={active ? "active" : "ghost"}className={cn("justify-start flex-grow truncate",- isActive+ active? "shadow-none dark:shadow-button-base": "hover:bg-transparent hover:text-active-foreground hover:scale-100 focus-visible:scale-100")}@@ -223,7 +216,7 @@ const GroupedContentSidebar = ({{hasViews && isExpanded && (<ViewsReorderGroupviews={route.views ?? []}- location={location}+ isViewActive={isViewActive}onReorder={(updates) => {const formData = new FormData();formData.append("updates", JSON.stringify(updates));@@ -261,12 +254,12 @@ const GroupedContentSidebar = ({const ViewsReorderGroup = ({views,- location,+ isViewActive,onReorder,onDelete}: {views: { id: string; name: string; to: string; sortOrder: number }[];- location: ReturnType<typeof useSidebarLocation>;+ isViewActive: (view: { id: string }) => boolean;onReorder: (updates: { id: string; name: string; to: string; sortOrder: number }[]) => void;@@ -315,10 +308,7 @@ const ViewsReorderGroup = ({className="flex flex-col gap-y-0.5 my-0.5">{sortedViews.map((view) => {- const isViewActive = `${location.pathname}${location.search}`.includes(- `view=${view.id}`- );-+ const active = isViewActive(view);return (<Reorder.Item key={view.to} value={view} className="w-full"><div@@ -327,10 +317,10 @@ const ViewsReorderGroup = ({><ButtonasChild- variant={isViewActive ? "active" : "ghost"}+ variant={active ? "active" : "ghost"}className={cn("justify-start text-sm pl-7 pr-7 truncate flex-grow !shadow-none",- isViewActive+ active? "shadow-none border-active-foreground/30 dark:border-none dark:shadow-button-base": "hover:bg-transparent hover:text-active-foreground")}diff --git a/apps/erp/app/components/Layout/Navigation/SidebarPresentation.tsx b/apps/erp/app/components/Layout/Navigation/SidebarPresentation.tsxindex 7830b63fc4..1d3b8efb5f 100644--- a/apps/erp/app/components/Layout/Navigation/SidebarPresentation.tsx+++ b/apps/erp/app/components/Layout/Navigation/SidebarPresentation.tsx@@ -2,10 +2,15 @@// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,// including ports, remain AGPLv3; serving them over a network requires releasing their source.-import { cn, PrefetchLink } from "@carbon/react";+import {+ cn,+ PrefetchLink,+ SheetSectionLabel,+ sheetRowClassName+} from "@carbon/react";import type { ReactNode } from "react";import { createContext, useContext } from "react";-import { LuCheck } from "react-icons/lu";+import { SheetRowContent } from "../Mobile/SheetRow";/*** Where a module sidebar renders: the desktop side panel, the compact section@@ -43,18 +48,16 @@ export function SheetNavRow({to={to}aria-current={isActive ? "page" : undefined}className={cn(- "flex min-h-12 items-center gap-3 rounded-lg px-3 text-[15px] text-foreground active:bg-accent",+ sheetRowClassName,inset && "pl-11 text-sm text-muted-foreground",isActive && "font-medium")}>- {icon ? (- <span className="flex size-5 shrink-0 items-center justify-center text-muted-foreground [&>svg]:size-5">- {icon}- </span>- ) : null}- <span className="min-w-0 flex-1 truncate">{label}</span>- {isActive ? <LuCheck className="size-5 shrink-0 text-primary" /> : null}+ <SheetRowContent+ icon={icon}+ label={label}+ trailing={isActive ? "check" : null}+ /></PrefetchLink>);}@@ -69,11 +72,7 @@ export function SheetNavGroup({}) {return (<div className="flex flex-col pb-2">- {title ? (- <div className="px-3 pt-3 pb-1 text-xs font-medium uppercase tracking-[0.04em] text-muted-foreground">- {title}- </div>- ) : null}+ {title ? <SheetSectionLabel>{title}</SheetSectionLabel> : null}{children}</div>);diff --git a/apps/erp/app/components/Layout/Topbar/CreateMenu.tsx b/apps/erp/app/components/Layout/Topbar/CreateMenu.tsxindex 104f9fa622..3f2c443154 100644--- a/apps/erp/app/components/Layout/Topbar/CreateMenu.tsx+++ b/apps/erp/app/components/Layout/Topbar/CreateMenu.tsx@@ -122,15 +122,28 @@ export function useCreate(): Route[] {return result.sort((a, b) => a.name.localeCompare(b.name));}-const CreateMenu = ({ trigger }: { trigger: React.ReactNode }) => {+const CreateMenu = ({+ trigger,+ open,+ onOpenChange+}: {+ trigger: React.ReactNode;+ open?: boolean;+ onOpenChange?: (open: boolean) => void;+}) => {+ const { t } = useLingui();const createLinks = useCreate();if (!createLinks.length) return null;return (- <DropdownMenu>+ <DropdownMenu open={open} onOpenChange={onOpenChange}><DropdownMenuTrigger asChild>{trigger}</DropdownMenuTrigger>- <DropdownMenuContent align="center" className="w-48">+ <DropdownMenuContent+ align="center"+ className="w-48"+ aria-label={t`Create`}+ >{createLinks.map((link) => (<DropdownMenuItem key={link.to} asChild><Link to={link.to}>diff --git a/apps/erp/app/components/SummaryLineRow.tsx b/apps/erp/app/components/SummaryLineRow.tsxindex 4742b893bd..5012db0994 100644--- a/apps/erp/app/components/SummaryLineRow.tsx+++ b/apps/erp/app/components/SummaryLineRow.tsx@@ -2,6 +2,7 @@// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,// including ports, remain AGPLv3; serving them over a network requires releasing their source.+import { cn } from "@carbon/react";import type { ReactNode } from "react";import { Link } from "react-router";@@ -21,9 +22,26 @@ type SummaryLineRowProps = {const rowClassName ="flex w-full min-w-0 flex-col gap-0.5 py-3 text-left active:bg-accent";+/** Phones: the divided list that holds a summary card's SummaryLineRows. */+export function SummaryLineList({+ className,+ children+}: {+ className?: string;+ children: ReactNode;+}) {+ return (+ <div+ className={cn("flex w-full flex-col divide-y divide-border", className)}+ >+ {children}+ </div>+ );+}+/**- * Phones: one document line in a summary card (SO, PO, Quote). A link opens- * the line's page; a button expands the line in place.+ * Phones: one document line in a summary card. A link opens the line's page;+ * a button expands the line in place.*/export function SummaryLineRow(props: SummaryLineRowProps) {const content = (diff --git a/apps/erp/app/components/Table/components/Compact/FilterSortSheet.tsx b/apps/erp/app/components/Table/components/Compact/FilterSortSheet.tsxindex 3e791897ef..24233c9398 100644--- a/apps/erp/app/components/Table/components/Compact/FilterSortSheet.tsx+++ b/apps/erp/app/components/Table/components/Compact/FilterSortSheet.tsx@@ -12,11 +12,12 @@ import {BottomSheetTitle,Button,PrefetchLink,- Spinner+ SheetSectionLabel,+ Spinner,+ sheetRowClassName} from "@carbon/react";import { Trans, useLingui } from "@lingui/react/macro";import type { PostgrestResponse } from "@supabase/supabase-js";-import type { ReactNode } from "react";import { useEffect, useMemo, useState } from "react";import {LuArrowDown,@@ -31,17 +32,6 @@ import type { ColumnFilter, Option } from "../Filter/types";import { useFilters } from "../Filter/useFilters";import { useSort } from "../Sort/useSort";-const rowClassName =- "flex min-h-12 w-full items-center gap-3 rounded-lg px-3 text-left text-[15px] text-foreground outline-none active:bg-accent focus-visible:ring-[3px] focus-visible:ring-ring/50";--function Overline({ children }: { children: ReactNode }) {- return (- <div className="px-3 pt-3 pb-1 text-xs font-medium uppercase tracking-[0.04em] text-muted-foreground">- {children}- </div>- );-}-/** The options of one filter column: static, fetched, or a custom picker. */function FilterOptions({filter,@@ -117,7 +107,7 @@ function FilterOptions({type="button"role={isExclusive ? "radio" : "checkbox"}aria-checked={checked}- className={rowClassName}+ className={sheetRowClassName}onClick={() =>isExclusive && !checked? setFilter(filter.accessorKey, option.value)@@ -224,14 +214,14 @@ export function FilterSortSheet({<>{views.length > 0 ? (<>- <Overline>+ <SheetSectionLabel><Trans>Saved views</Trans>- </Overline>+ </SheetSectionLabel>{views.map((v) => (<PrefetchLinkkey={v.id}to={viewHref(v)}- className={rowClassName}+ className={sheetRowClassName}onClick={() => onOpenChange(false)}><span className="min-w-0 flex-1 truncate">{v.name}</span>@@ -244,9 +234,9 @@ export function FilterSortSheet({) : null}{sortEntries.length > 0 ? (<>- <Overline>+ <SheetSectionLabel><Trans>Sort</Trans>- </Overline>+ </SheetSectionLabel>{sortEntries.map(([key, label]) => {const direction = isSorted(key);const isActive = direction !== null;@@ -256,7 +246,7 @@ export function FilterSortSheet({type="button"role="checkbox"aria-checked={isActive}- className={rowClassName}+ className={sheetRowClassName}onClick={() => setSort(key)}><span className="min-w-0 flex-1 truncate">{label}</span>@@ -277,16 +267,16 @@ export function FilterSortSheet({) : null}{filters.length > 0 ? (<>- <Overline>+ <SheetSectionLabel><Trans>Filters</Trans>- </Overline>+ </SheetSectionLabel>{filters.map((filter) => {const applied = getFilter(filter.accessorKey);return (<buttonkey={filter.accessorKey}type="button"- className={rowClassName}+ className={sheetRowClassName}onClick={() => setActiveFilter(filter)}>{filter.icon ? (diff --git a/apps/erp/app/modules/inventory/ui/PickingLists/PickingListLines.tsx b/apps/erp/app/modules/inventory/ui/PickingLists/PickingListLines.tsxindex 59a8aa30ca..94c3b80a36 100644--- a/apps/erp/app/modules/inventory/ui/PickingLists/PickingListLines.tsx+++ b/apps/erp/app/modules/inventory/ui/PickingLists/PickingListLines.tsx@@ -3,11 +3,13 @@// including ports, remain AGPLv3; serving them over a network requires releasing their source.import type {+ ActionPresentation,TrackedEntityOption,TrackedEntityPickOrder,TrackedEntitySelection} from "@carbon/react";import {+ ActionPresentationProvider,Badge,BarProgress,Button,@@ -268,6 +270,11 @@ function PickingKitCard({);}+const phoneActionCells: ActionPresentation = {+ kind: "bar",+ emphasis: "secondary"+};+function PickingListLineItem({line,pickingListId,@@ -418,98 +425,95 @@ function PickingListLineItem({</Badge>);- // Phones: the line's buttons share their own row as equal 44pt halves.- const phoneButton = isPhone- ? { size: "lg" as const, className: "flex-1" }- : {};- const phoneButtonRow = isPhone ? "w-full gap-2 space-x-0" : undefined;-- const actions = isLocked ? null : isTracked ? (- <HStack spacing={1} className={phoneButtonRow}>- {pickedLots.length === 1 ? (- <Button- variant="secondary"- leftIcon={<LuUndo2 />}- isDisabled={!canPick || isPending}- onClick={() => unpickTracked(pickedLots[0].trackedEntityId)}- {...phoneButton}- >- {pickedLots[0].trackedEntity?.readableId ? (- <Trans>Unpick {pickedLots[0].trackedEntity.readableId}</Trans>- ) : (+ // Phones: the buttons fill their own row as equal 44pt cells.+ const actions = isLocked ? null : (+ <ActionPresentationProvider value={isPhone ? phoneActionCells : null}>+ <HStack+ spacing={1}+ className="max-md:basis-full max-md:gap-2 max-md:space-x-0 max-md:[&>button]:min-w-fit max-md:[&>button]:flex-1"+ >+ {isTracked ? (+ <>+ {pickedLots.length === 1 ? (+ <Button+ variant="secondary"+ leftIcon={<LuUndo2 />}+ isDisabled={!canPick || isPending}+ onClick={() => unpickTracked(pickedLots[0].trackedEntityId)}+ >+ {pickedLots[0].trackedEntity?.readableId ? (+ <Trans>Unpick {pickedLots[0].trackedEntity.readableId}</Trans>+ ) : (+ <Trans>Unpick</Trans>+ )}+ </Button>+ ) : pickedLots.length > 1 ? (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button+ variant="secondary"+ leftIcon={<LuUndo2 />}+ rightIcon={<LuChevronDown />}+ isDisabled={!canPick || isPending}+ >+ <Trans>Unpick</Trans>+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ {pickedLots.map((lot) => (+ <DropdownMenuItem+ key={lot.trackedEntityId}+ onClick={() => unpickTracked(lot.trackedEntityId)}+ >+ <DropdownMenuIcon icon={<LuUndo2 />} />+ {lot.trackedEntity?.readableId ?? lot.trackedEntityId}+ </DropdownMenuItem>+ ))}+ </DropdownMenuContent>+ </DropdownMenu>+ ) : null}+ {!isPicked && (+ <Button+ variant="secondary"+ leftIcon={<LuQrCode />}+ isDisabled={!canPick || isPending}+ onClick={openPicker}+ >+ <Trans>Scan</Trans>+ </Button>+ )}+ </>+ ) : isPicked ? (+ <Button+ variant="secondary"+ leftIcon={<LuUndo2 />}+ isDisabled={!canPick || isPending}+ isLoading={isPending}+ onClick={() => pick(0)}+ ><Trans>Unpick</Trans>- )}- </Button>- ) : pickedLots.length > 1 ? (- <DropdownMenu>- <DropdownMenuTrigger asChild>+ </Button>+ ) : (+ <><Buttonvariant="secondary"- leftIcon={<LuUndo2 />}- rightIcon={<LuChevronDown />}isDisabled={!canPick || isPending}- {...phoneButton}+ onClick={() => setShortOpen(true)}>- <Trans>Unpick</Trans>+ <Trans>Short</Trans></Button>- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- {pickedLots.map((lot) => (- <DropdownMenuItem- key={lot.trackedEntityId}- onClick={() => unpickTracked(lot.trackedEntityId)}- >- <DropdownMenuIcon icon={<LuUndo2 />} />- {lot.trackedEntity?.readableId ?? lot.trackedEntityId}- </DropdownMenuItem>- ))}- </DropdownMenuContent>- </DropdownMenu>- ) : null}- {!isPicked && (- <Button- variant="secondary"- leftIcon={<LuQrCode />}- isDisabled={!canPick || isPending}- onClick={openPicker}- {...phoneButton}- >- <Trans>Scan</Trans>- </Button>- )}- </HStack>- ) : isPicked ? (- <Button- variant="secondary"- leftIcon={<LuUndo2 />}- isDisabled={!canPick || isPending}- isLoading={isPending}- onClick={() => pick(0)}- {...phoneButton}- >- <Trans>Unpick</Trans>- </Button>- ) : (- <HStack spacing={1} className={phoneButtonRow}>- <Button- variant="secondary"- isDisabled={!canPick || isPending}- onClick={() => setShortOpen(true)}- {...phoneButton}- >- <Trans>Short</Trans>- </Button>- <Button- variant={isPhone ? "secondary" : undefined}- leftIcon={<LuCirclePlus />}- isDisabled={!canPick || isPending}- isLoading={isPending}- onClick={() => pick(quantityToPick)}- {...phoneButton}- >- <Trans>Pick</Trans>- </Button>- </HStack>+ <Button+ leftIcon={<LuCirclePlus />}+ isDisabled={!canPick || isPending}+ isLoading={isPending}+ onClick={() => pick(quantityToPick)}+ >+ <Trans>Pick</Trans>+ </Button>+ </>+ )}+ </HStack>+ </ActionPresentationProvider>);return (@@ -637,9 +641,8 @@ function PickingListLineItem({) : (quantityBadge)}- {isPhone ? null : actions}+ {actions}</div>- {isPhone && actions ? <div className="flex w-full">{actions}</div> : null}{shortOpen && (<ShortPickModaldiff --git a/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitForm.tsx b/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitForm.tsxindex 6b17ac3a41..5acfc4d424 100644--- a/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitForm.tsx+++ b/apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitForm.tsx@@ -10,8 +10,6 @@ import {FormLabel,HStack,Input as InputBase,- InputGroup,- InputLeftElement,ModalDrawer,ModalDrawerBody,ModalDrawerContent,@@ -23,7 +21,6 @@ import {VStack} from "@carbon/react";import { Trans, useLingui } from "@lingui/react/macro";-import { LuLock } from "react-icons/lu";import { useFetcher } from "react-router";import type { z } from "zod";import { PrintButton } from "~/components";@@ -35,7 +32,6 @@ import {Submit,WorkCenter} from "~/components/Form";-import { useLocations } from "~/components/Form/Location";import { usePermissions } from "~/hooks";import { storageUnitValidator } from "~/modules/inventory";import { path } from "~/utils/path";@@ -70,13 +66,9 @@ const StorageUnitForm = ({? !permissions.can("update", "parts"): !permissions.can("create", "parts");- // Phones, edit only: a full-screen sheet with Save in its header. The New- // sheet and the inline create modal stay as they are.+ // Phones, edit only: a full-height sheet with Save in its header.const { isPhone } = useViewport();const isPhoneEdit = isEditing && isPhone;- const locations = useLocations();- const locationName =- locations.find((l) => l.value === initialValues.locationId)?.label ?? "";const saveButton = (<Submit isDisabled={isDisabled}>@@ -108,13 +100,7 @@ const StorageUnitForm = ({if (!open) onClose?.();}}>- <ModalDrawerContent- className={- isPhoneEdit- ? "max-md:h-[calc(100dvh-env(safe-area-inset-top)-12px)]"- : undefined- }- >+ <ModalDrawerContent size={isPhoneEdit ? "full" : undefined}><ValidatedFormvalidator={storageUnitValidator}method="post"@@ -153,37 +139,15 @@ const StorageUnitForm = ({<VStack spacing={4}><Input name="name" label={t`Name`} />- {isPhoneEdit ? (- <FormControl>- <FormLabel htmlFor="locationId-readonly">- {t`Location`}- </FormLabel>- <Hidden name="locationId" />- <InputGroup>- <InputLeftElement>- <LuLock className="size-4 text-muted-foreground" />- </InputLeftElement>- <InputBase- id="locationId-readonly"- value={locationName}- isReadOnly- className="text-muted-foreground"- />- </InputGroup>- <FormHelperText>{t`Set when the unit was created`}</FormHelperText>- </FormControl>- ) : (- <Location- isReadOnly={isEditing}- name="locationId"- label={t`Location`}- />- )}+ <Location+ isReadOnly={isEditing}+ name="locationId"+ label={t`Location`}+ /><StorageUnitParentSelectname="parentId"label={t`Parent Storage Unit`}- // Phones: the helper text under the field explains it.- termId={isPhoneEdit ? undefined : "storage-unit-parent"}+ termId="storage-unit-parent"locationId={locationId}isOptionalhelperText={t`Must be in the same location`}@@ -212,9 +176,7 @@ const StorageUnitForm = ({<WorkCentername="workCenterId"label={t`Work Center`}- termId={- isPhoneEdit ? undefined : "storage-unit-work-center"- }+ termId="storage-unit-work-center"locationId={locationId}isOptionalhelperText={t`Assigns this storage unit to a work center (lineside)`}diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceSummary.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceSummary.tsxindex 197d62f3c3..0745ebd0ae 100644--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceSummary.tsx+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceSummary.tsx@@ -16,6 +16,7 @@ import {Td,Tr,TruncatedTooltipText,+ useViewport,VStack} from "@carbon/react";import { distinctItemText, getItemReadableId } from "@carbon/utils";@@ -28,6 +29,7 @@ import { Link, useParams } from "react-router";import { DateTime, MethodIcon, SupplierAvatar } from "~/components";import { useAccounts } from "~/components/Form/Account";import { useUnitOfMeasure } from "~/components/Form/UnitOfMeasure";+import { SummaryLineList, SummaryLineRow } from "~/components/SummaryLineRow";import {useCurrencyFormatter,usePercentFormatter,@@ -58,6 +60,7 @@ const LineItems = ({purchaseInvoiceLines: PurchaseInvoiceLine[];shouldConvertCurrency: boolean;}) => {+ const { isPhone } = useViewport();const [items] = useItems();const accounts = useAccounts();const { invoiceId } = useParams();@@ -73,296 +76,305 @@ const LineItems = ({);};- return (- <VStack spacing={8} className="w-full overflow-hidden">- {purchaseInvoiceLines.map((line) => {- if (!line.id) return null;-- const isGlAccount = line.invoiceLineType === "G/L Account";- const isFixedAsset = line.invoiceLineType === "Fixed Asset";- const isIndirect = isGlAccount || isFixedAsset;- const itemReadableId = isGlAccount- ? line.description || "Indirect Expense"- : isFixedAsset- ? line.assetReadableId || "Fixed Asset"- : getItemReadableId(items, line.itemId);- const lineDescription = isGlAccount- ? (accounts.find((a) => a.id === line.accountId)?.name ??- "Indirect Expense")- : isFixedAsset- ? line.description || "Fixed Asset"- : distinctItemText(itemReadableId, line.description);- const lineTotal = (line.unitPrice ?? 0) * (line.quantity ?? 0);- const supplierLineTotal =- (line.supplierUnitPrice ?? 0) * (line.quantity ?? 0);- const total =- lineTotal + (line.taxAmount ?? 0) + (line.shippingCost ?? 0);- const supplierTotal =- supplierLineTotal +- (line.supplierTaxAmount ?? 0) +- (line.supplierShippingCost ?? 0);-- return (- <motion.div- key={line.id}- initial={{ opacity: 0, y: 8 }}- animate={{ opacity: 1, y: 0 }}- transition={{ duration: 0.2, ease: "easeOut" }}- className="border-b border-input py-6 w-full"- >- <HStack spacing={4} className="items-start">- {line.thumbnailPath ? (- <img- alt={itemReadableId ?? ""}- className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg max-md:size-16"- src={getPrivateUrl(line.thumbnailPath)}- />- ) : (- <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 max-md:size-16">- <LuImage className="w-16 h-16 text-muted-foreground max-md:size-8" />- </div>- )}+ const rows = purchaseInvoiceLines.map((line) => {+ if (!line.id) return null;++ const isGlAccount = line.invoiceLineType === "G/L Account";+ const isFixedAsset = line.invoiceLineType === "Fixed Asset";+ const isIndirect = isGlAccount || isFixedAsset;+ const itemReadableId = isGlAccount+ ? line.description || "Indirect Expense"+ : isFixedAsset+ ? line.assetReadableId || "Fixed Asset"+ : getItemReadableId(items, line.itemId);+ const lineDescription = isGlAccount+ ? (accounts.find((a) => a.id === line.accountId)?.name ??+ "Indirect Expense")+ : isFixedAsset+ ? line.description || "Fixed Asset"+ : distinctItemText(itemReadableId, line.description);+ const lineTotal = (line.unitPrice ?? 0) * (line.quantity ?? 0);+ const supplierLineTotal =+ (line.supplierUnitPrice ?? 0) * (line.quantity ?? 0);+ const total = lineTotal + (line.taxAmount ?? 0) + (line.shippingCost ?? 0);+ const supplierTotal =+ supplierLineTotal ++ (line.supplierTaxAmount ?? 0) ++ (line.supplierShippingCost ?? 0);++ // Phones: one row that opens the line page (its Edit link, the+ // badges and the breakdown stay on desktop).+ if (isPhone) {+ return (+ <SummaryLineRow+ key={line.id}+ to={path.to.purchaseInvoiceLine(invoiceId, line.id)}+ title={itemReadableId}+ value={formatter.format(total)}+ description={lineDescription}+ meta={+ <>+ {line.quantity} × {formatter.format(line.unitPrice ?? 0)}{" "}+ {+ unitOfMeasures.find(+ (uom) => uom.value === line.purchaseUnitOfMeasureCode+ )?.label+ }+ </>+ }+ />+ );+ }++ return (+ <motion.div+ key={line.id}+ initial={{ opacity: 0, y: 8 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ duration: 0.2, ease: "easeOut" }}+ className="border-b border-input py-6 w-full"+ >+ <HStack spacing={4} className="items-start">+ {line.thumbnailPath ? (+ <img+ alt={itemReadableId ?? ""}+ className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg"+ src={getPrivateUrl(line.thumbnailPath)}+ />+ ) : (+ <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4">+ <LuImage className="w-16 h-16 text-muted-foreground" />+ </div>+ )}- <VStack spacing={0} className="flex-1 min-w-0">- <div- className="flex flex-col cursor-pointer w-full"- onClick={() => toggleOpen(line.id!)}- >- {/* The text column must shrink (flex-1 min-w-0) or a long+ <VStack spacing={0} className="flex-1 min-w-0">+ <div+ className="flex flex-col cursor-pointer w-full"+ onClick={() => toggleOpen(line.id!)}+ >+ {/* The text column must shrink (flex-1 min-w-0) or a longdescription shoves the totals out of the card, and itschildren need w-full because VStack is items-start, whichsizes each child to its own content and leaves truncateinert no matter how narrow the column gets. */}- <div className="flex items-center justify-between w-full max-md:flex-col max-md:items-start max-md:gap-2">- <VStack- spacing={0}- className="flex-1 min-w-0 max-md:w-full"+ <div className="flex items-center justify-between w-full">+ <VStack spacing={0} className="flex-1 min-w-0">+ <HStack spacing={2} className="flex min-w-0 w-full">+ <Heading className="truncate">{itemReadableId}</Heading>+ <Button+ asChild+ variant="link"+ size="sm"+ className="text-muted-foreground flex-shrink-0"+ >+ <Link+ to={path.to.purchaseInvoiceLine(invoiceId, line.id!)}+ >+ Edit+ </Link>+ </Button>+ </HStack>+ {lineDescription && (+ <TruncatedTooltipText+ className="text-muted-foreground text-sm truncate w-full"+ tooltip={lineDescription}>- <HStack spacing={2} className="flex min-w-0 w-full">- <Heading className="truncate">{itemReadableId}</Heading>- <Button- asChild- variant="link"- size="sm"- className="text-muted-foreground flex-shrink-0"- >- <Link- to={path.to.purchaseInvoiceLine(- invoiceId,- line.id!- )}- >- Edit- </Link>- </Button>- </HStack>- {lineDescription && (- <TruncatedTooltipText- className="text-muted-foreground text-sm truncate w-full"- tooltip={lineDescription}- >- {lineDescription}- </TruncatedTooltipText>+ {lineDescription}+ </TruncatedTooltipText>+ )}+ </VStack>+ <VStack spacing={2} className="flex-shrink-0 items-end w-auto">+ <HStack spacing={4}>+ <VStack spacing={0}>+ <span className="font-semibold text-xl whitespace-nowrap">+ {formatter.format(total)}+ </span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-sm">+ {presentationCurrencyFormatter.format(supplierTotal)}+ </span>)}</VStack>- <VStack- spacing={2}- className="flex-shrink-0 items-end w-auto max-md:items-start max-md:w-full"+ <motion.div+ animate={{+ rotate: openItems.includes(line.id) ? 90 : 0+ }}+ transition={{ duration: 0.3 }}>- <HStack spacing={4}>- <VStack spacing={0}>- <span className="font-semibold text-xl whitespace-nowrap">- {formatter.format(total)}- </span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-sm">- {presentationCurrencyFormatter.format(- supplierTotal- )}- </span>- )}- </VStack>- <motion.div- animate={{- rotate: openItems.includes(line.id) ? 90 : 0- }}- transition={{ duration: 0.3 }}- >- <LuChevronRight size={24} />- </motion.div>- </HStack>- <div className="flex items-center gap-2">- {!isIndirect && (- <Badge- variant="outline"- className="flex items-center gap-2"- >- {line.quantity}- <MethodIcon- // @ts-expect-error- type={line.methodType ?? "Pull from Inventory"}- />- </Badge>- )}- <Badge variant="green">- {formatter.format(line.unitPrice ?? 0)}{" "}+ <LuChevronRight size={24} />+ </motion.div>+ </HStack>+ <div className="flex items-center gap-2">+ {!isIndirect && (+ <Badge+ variant="outline"+ className="flex items-center gap-2"+ >+ {line.quantity}+ <MethodIcon+ // @ts-expect-error+ type={line.methodType ?? "Pull from Inventory"}+ />+ </Badge>+ )}+ <Badge variant="green">+ {formatter.format(line.unitPrice ?? 0)}{" "}+ {+ unitOfMeasures.find(+ (uom) => uom.value === line.purchaseUnitOfMeasureCode+ )?.label+ }+ </Badge>+ {(line.taxPercent ?? 0) > 0 ? (+ <Badge variant="red">+ {percentFormatter.format(line.taxPercent ?? 0)} Tax+ </Badge>+ ) : null}+ </div>+ </VStack>+ </div>+ </div>+ </VStack>+ </HStack>++ <motion.div+ initial="collapsed"+ animate={openItems.includes(line.id) ? "open" : "collapsed"}+ variants={{+ open: { opacity: 1, height: "auto", marginTop: 16 },+ collapsed: { opacity: 0, height: 0, marginTop: 0 }+ }}+ transition={{ duration: 0.3 }}+ className="w-full overflow-hidden"+ >+ <div className="w-full">+ <Table>+ <Tbody>+ <Tr>+ <Td>+ <Trans>Quantity</Trans>+ </Td>+ <Td className="text-right">+ <VStack spacing={0}>+ <span>+ {line.quantity}{" "}+ {+ unitOfMeasures.find(+ (uom) =>+ uom.value === line.purchaseUnitOfMeasureCode+ )?.label+ }+ </span>+ {line.conversionFactor !== 1 && (+ <span className="text-muted-foreground text-xs">+ {(line.quantity ?? 0) * (line.conversionFactor ?? 1)}{" "}{unitOfMeasures.find((uom) =>- uom.value === line.purchaseUnitOfMeasureCode+ uom.value === line.inventoryUnitOfMeasureCode)?.label}- </Badge>- {(line.taxPercent ?? 0) > 0 ? (- <Badge variant="red">- {percentFormatter.format(line.taxPercent ?? 0)} Tax- </Badge>- ) : null}- </div>+ </span>+ )}</VStack>- </div>- </div>- </VStack>- </HStack>-- <motion.div- initial="collapsed"- animate={openItems.includes(line.id) ? "open" : "collapsed"}- variants={{- open: { opacity: 1, height: "auto", marginTop: 16 },- collapsed: { opacity: 0, height: 0, marginTop: 0 }- }}- transition={{ duration: 0.3 }}- className="w-full overflow-hidden"- >- <div className="w-full">- <Table>- <Tbody>- <Tr>- <Td>- <Trans>Quantity</Trans>- </Td>- <Td className="text-right">- <VStack spacing={0}>- <span>- {line.quantity}{" "}- {- unitOfMeasures.find(- (uom) =>- uom.value === line.purchaseUnitOfMeasureCode- )?.label- }- </span>- {line.conversionFactor !== 1 && (- <span className="text-muted-foreground text-xs">- {(line.quantity ?? 0) *- (line.conversionFactor ?? 1)}{" "}- {- unitOfMeasures.find(- (uom) =>- uom.value ===- line.inventoryUnitOfMeasureCode- )?.label- }- </span>- )}- </VStack>- </Td>- </Tr>- <Tr>- <Td>- <Trans>Unit Price</Trans>- </Td>- <Td className="text-right">- <VStack spacing={0}>- <span>{formatter.format(line.unitPrice ?? 0)}</span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-xs">- {presentationCurrencyFormatter.format(- line.supplierUnitPrice ?? 0- )}- </span>+ </Td>+ </Tr>+ <Tr>+ <Td>+ <Trans>Unit Price</Trans>+ </Td>+ <Td className="text-right">+ <VStack spacing={0}>+ <span>{formatter.format(line.unitPrice ?? 0)}</span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-xs">+ {presentationCurrencyFormatter.format(+ line.supplierUnitPrice ?? 0)}- </VStack>- </Td>- </Tr>- <Tr>- <Td>Shipping Cost</Td>- <Td className="text-right">- <VStack spacing={0}>- <span>- {formatter.format(line.shippingCost ?? 0)}- </span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-xs">- {presentationCurrencyFormatter.format(- line.supplierShippingCost ?? 0- )}- </span>- )}- </VStack>- </Td>- </Tr>- <Tr className="border-b border-border">- <Td>- <Trans>Extended Price</Trans>- </Td>- <Td className="text-right">- <VStack spacing={0}>- <span>{formatter.format(lineTotal)}</span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-xs">- {presentationCurrencyFormatter.format(- supplierLineTotal- )}- </span>+ </span>+ )}+ </VStack>+ </Td>+ </Tr>+ <Tr>+ <Td>Shipping Cost</Td>+ <Td className="text-right">+ <VStack spacing={0}>+ <span>{formatter.format(line.shippingCost ?? 0)}</span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-xs">+ {presentationCurrencyFormatter.format(+ line.supplierShippingCost ?? 0)}- </VStack>- </Td>- </Tr>-- <Tr key="tax" className="border-b border-border">- <Td>- Tax ({percentFormatter.format(line.taxPercent ?? 0)})- </Td>- <Td className="text-right">- <VStack spacing={0}>- <span>{formatter.format(line.taxAmount ?? 0)}</span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-xs">- {presentationCurrencyFormatter.format(- line.supplierTaxAmount ?? 0- )}- </span>+ </span>+ )}+ </VStack>+ </Td>+ </Tr>+ <Tr className="border-b border-border">+ <Td>+ <Trans>Extended Price</Trans>+ </Td>+ <Td className="text-right">+ <VStack spacing={0}>+ <span>{formatter.format(lineTotal)}</span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-xs">+ {presentationCurrencyFormatter.format(+ supplierLineTotal)}- </VStack>- </Td>- </Tr>-- <Tr key="total" className="font-semibold">- <Td>- <Trans>Total</Trans>- </Td>- <Td className="text-right">- <VStack spacing={0}>- <span>{formatter.format(total)}</span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-xs">- {presentationCurrencyFormatter.format(- supplierTotal- )}- </span>+ </span>+ )}+ </VStack>+ </Td>+ </Tr>++ <Tr key="tax" className="border-b border-border">+ <Td>Tax ({percentFormatter.format(line.taxPercent ?? 0)})</Td>+ <Td className="text-right">+ <VStack spacing={0}>+ <span>{formatter.format(line.taxAmount ?? 0)}</span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-xs">+ {presentationCurrencyFormatter.format(+ line.supplierTaxAmount ?? 0)}- </VStack>- </Td>- </Tr>- </Tbody>- </Table>- </div>- </motion.div>- </motion.div>- );- })}+ </span>+ )}+ </VStack>+ </Td>+ </Tr>++ <Tr key="total" className="font-semibold">+ <Td>+ <Trans>Total</Trans>+ </Td>+ <Td className="text-right">+ <VStack spacing={0}>+ <span>{formatter.format(total)}</span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-xs">+ {presentationCurrencyFormatter.format(supplierTotal)}+ </span>+ )}+ </VStack>+ </Td>+ </Tr>+ </Tbody>+ </Table>+ </div>+ </motion.div>+ </motion.div>+ );+ });++ if (isPhone) {+ return <SummaryLineList>{rows}</SummaryLineList>;+ }++ return (+ <VStack spacing={8} className="w-full overflow-hidden">+ {rows}</VStack>);};diff --git a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceSummary.tsx b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceSummary.tsxindex f9fe7c4dd9..13d4d256e4 100644--- a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceSummary.tsx+++ b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceSummary.tsx@@ -16,6 +16,7 @@ import {Td,Tr,TruncatedTooltipText,+ useViewport,VStack} from "@carbon/react";import { distinctItemText, getItemReadableId } from "@carbon/utils";@@ -27,6 +28,7 @@ import { LuChevronRight, LuImage } from "react-icons/lu";import { Link, useParams } from "react-router";import { CustomerAvatar, DateTime, MethodIcon } from "~/components";import { useUnitOfMeasure } from "~/components/Form/UnitOfMeasure";+import { SummaryLineList, SummaryLineRow } from "~/components/SummaryLineRow";import {useCurrencyFormatter,usePercentFormatter,@@ -61,6 +63,7 @@ const LineItems = ({const { invoiceId } = useParams();if (!invoiceId) throw new Error("Could not find invoiceId");+ const { isPhone } = useViewport();const [items] = useItems();const percentFormatter = usePercentFormatter();const rentalLineTypeLabel = useRentalLineTypeLabel();@@ -73,299 +76,313 @@ const LineItems = ({);};- return (- <VStack spacing={8} className="w-full overflow-hidden">- {salesInvoiceLines.map((line) => {- if (!line.id) return null;-- const itemReadableId =- line.invoiceLineType === "Rental"- ? rentalLineTypeLabel(line.rentalLineType)- : line.invoiceLineType === "Fixed Asset"- ? (line as any).assetReadableId || "Fixed Asset"- : getItemReadableId(items, line.itemId);- const description = distinctItemText(itemReadableId, line.description);- // The discount reduces the merchandise only (the generated net- // prices); add-ons and shipping are not discounted.- const discountPercent = line.discountPercent ?? 0;- const discount = percentFormatter.format(discountPercent);- const lineSubtotal = (line.netUnitPrice ?? 0) * (line.quantity ?? 0);- const customerSubtotal =- (line.convertedNetUnitPrice ?? 0) * (line.quantity ?? 0);- const total =- (lineSubtotal + (line.addOnCost ?? 0) + (line.shippingCost ?? 0)) *- (1 + (line.taxPercent ?? 0)) +- (line.nonTaxableAddOnCost ?? 0);- const customerTotal =- (customerSubtotal +- (line.convertedAddOnCost ?? 0) +- (line.convertedShippingCost ?? 0)) *- (1 + (line.taxPercent ?? 0)) +- (line.convertedNonTaxableAddOnCost ?? 0);-- const lineTaxAmount =- (line.taxPercent ?? 0) *- (lineSubtotal + (line.addOnCost ?? 0) + (line.shippingCost ?? 0));-- const customerLineTaxAmount =- (line.taxPercent ?? 0) *- (customerSubtotal +- (line.convertedAddOnCost ?? 0) +- (line.convertedShippingCost ?? 0));-- return (- <motion.div- key={line.id}- initial={{ opacity: 0, y: 8 }}- animate={{ opacity: 1, y: 0 }}- transition={{ duration: 0.2, ease: "easeOut" }}- className="border-b border-input py-6 w-full"- >- <HStack spacing={4} className="items-start">- {line.thumbnailPath ? (- <img- alt={itemReadableId ?? ""}- className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg max-md:size-16"- src={getPrivateUrl(line.thumbnailPath)}- />- ) : (- <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 max-md:size-16">- <LuImage className="w-16 h-16 text-muted-foreground max-md:size-8" />- </div>- )}+ const rows = salesInvoiceLines.map((line) => {+ if (!line.id) return null;++ const itemReadableId =+ line.invoiceLineType === "Rental"+ ? rentalLineTypeLabel(line.rentalLineType)+ : line.invoiceLineType === "Fixed Asset"+ ? (line as any).assetReadableId || "Fixed Asset"+ : getItemReadableId(items, line.itemId);+ const description = distinctItemText(itemReadableId, line.description);+ // The discount reduces the merchandise only (the generated net+ // prices); add-ons and shipping are not discounted.+ const discountPercent = line.discountPercent ?? 0;+ const discount = percentFormatter.format(discountPercent);+ const lineSubtotal = (line.netUnitPrice ?? 0) * (line.quantity ?? 0);+ const customerSubtotal =+ (line.convertedNetUnitPrice ?? 0) * (line.quantity ?? 0);+ const total =+ (lineSubtotal + (line.addOnCost ?? 0) + (line.shippingCost ?? 0)) *+ (1 + (line.taxPercent ?? 0)) ++ (line.nonTaxableAddOnCost ?? 0);+ const customerTotal =+ (customerSubtotal ++ (line.convertedAddOnCost ?? 0) ++ (line.convertedShippingCost ?? 0)) *+ (1 + (line.taxPercent ?? 0)) ++ (line.convertedNonTaxableAddOnCost ?? 0);++ const lineTaxAmount =+ (line.taxPercent ?? 0) *+ (lineSubtotal + (line.addOnCost ?? 0) + (line.shippingCost ?? 0));- <VStack spacing={0} className="flex-1 min-w-0">- <div- className="flex flex-col cursor-pointer w-full"- onClick={() => toggleOpen(line.id!)}- >- {/* The text column must shrink (flex-1 min-w-0) or a long+ const customerLineTaxAmount =+ (line.taxPercent ?? 0) *+ (customerSubtotal ++ (line.convertedAddOnCost ?? 0) ++ (line.convertedShippingCost ?? 0));++ // Phones: one row that opens the line page (its Edit link, the+ // badges and the breakdown stay on desktop).+ if (isPhone) {+ return (+ <SummaryLineRow+ key={line.id}+ to={path.to.salesInvoiceLine(invoiceId, line.id)}+ title={itemReadableId}+ value={formatter.format(total)}+ description={description}+ meta={+ <>+ {line.quantity} × {formatter.format(line.unitPrice ?? 0)}{" "}+ {+ unitOfMeasures.find(+ (uom) => uom.value === line.unitOfMeasureCode+ )?.label+ }+ </>+ }+ />+ );+ }++ return (+ <motion.div+ key={line.id}+ initial={{ opacity: 0, y: 8 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ duration: 0.2, ease: "easeOut" }}+ className="border-b border-input py-6 w-full"+ >+ <HStack spacing={4} className="items-start">+ {line.thumbnailPath ? (+ <img+ alt={itemReadableId ?? ""}+ className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg"+ src={getPrivateUrl(line.thumbnailPath)}+ />+ ) : (+ <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4">+ <LuImage className="w-16 h-16 text-muted-foreground" />+ </div>+ )}++ <VStack spacing={0} className="flex-1 min-w-0">+ <div+ className="flex flex-col cursor-pointer w-full"+ onClick={() => toggleOpen(line.id!)}+ >+ {/* The text column must shrink (flex-1 min-w-0) or a longdescription shoves the totals out of the card, and itschildren need w-full because VStack is items-start, whichsizes each child to its own content and leaves truncateinert no matter how narrow the column gets. */}- <div className="flex items-center justify-between w-full max-md:flex-col max-md:items-start max-md:gap-2">- <VStack- spacing={0}- className="flex-1 min-w-0 max-md:w-full"+ <div className="flex items-center justify-between w-full">+ <VStack spacing={0} className="flex-1 min-w-0">+ <HStack spacing={2} className="flex min-w-0 w-full">+ <Heading className="truncate">{itemReadableId}</Heading>+ <Button+ asChild+ variant="link"+ size="sm"+ className="text-muted-foreground flex-shrink-0"+ >+ <Link to={path.to.salesInvoiceLine(invoiceId, line.id!)}>+ Edit+ </Link>+ </Button>+ </HStack>+ {description && (+ <TruncatedTooltipText+ className="text-muted-foreground text-sm truncate w-full"+ tooltip={description}>- <HStack spacing={2} className="flex min-w-0 w-full">- <Heading className="truncate">{itemReadableId}</Heading>- <Button- asChild- variant="link"- size="sm"- className="text-muted-foreground flex-shrink-0"- >- <Link- to={path.to.salesInvoiceLine(invoiceId, line.id!)}- >- Edit- </Link>- </Button>- </HStack>- {description && (- <TruncatedTooltipText- className="text-muted-foreground text-sm truncate w-full"- tooltip={description}- >- {description}- </TruncatedTooltipText>+ {description}+ </TruncatedTooltipText>+ )}+ </VStack>+ <VStack spacing={2} className="flex-shrink-0 items-end w-auto">+ <HStack spacing={4}>+ <VStack spacing={0}>+ <span className="font-semibold text-xl whitespace-nowrap">+ {formatter.format(total)}+ </span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-sm">+ {presentationCurrencyFormatter.format(customerTotal)}+ </span>)}</VStack>- <VStack- spacing={2}- className="flex-shrink-0 items-end w-auto max-md:items-start max-md:w-full"+ <motion.div+ animate={{+ rotate: openItems.includes(line.id) ? 90 : 0+ }}+ transition={{ duration: 0.3 }}>- <HStack spacing={4}>- <VStack spacing={0}>- <span className="font-semibold text-xl whitespace-nowrap">- {formatter.format(total)}- </span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-sm">- {presentationCurrencyFormatter.format(- customerTotal- )}- </span>- )}- </VStack>- <motion.div- animate={{- rotate: openItems.includes(line.id) ? 90 : 0- }}- transition={{ duration: 0.3 }}- >- <LuChevronRight size={24} />- </motion.div>- </HStack>- <div className="flex items-center gap-2">- <Badge- variant="outline"- className="flex items-center gap-2"- >- {line.quantity}- {line.invoiceLineType !== "Fixed Asset" &&- line.invoiceLineType !== "Rental" && (- <MethodIcon- type={line.methodType ?? "Pull from Inventory"}- />- )}- </Badge>- <Badge variant="green">- {formatter.format(line.unitPrice ?? 0)}{" "}- {- unitOfMeasures.find(- (uom) => uom.value === line.unitOfMeasureCode- )?.label- }- </Badge>- {discountPercent > 0 ? (- <Badge variant="secondary">- <Trans>{discount} off</Trans>- </Badge>- ) : null}- {(line.taxPercent ?? 0) > 0 ? (- <Badge variant="red">- {percentFormatter.format(line.taxPercent ?? 0)} Tax- </Badge>- ) : null}- </div>- </VStack>+ <LuChevronRight size={24} />+ </motion.div>+ </HStack>+ <div className="flex items-center gap-2">+ <Badge+ variant="outline"+ className="flex items-center gap-2"+ >+ {line.quantity}+ {line.invoiceLineType !== "Fixed Asset" &&+ line.invoiceLineType !== "Rental" && (+ <MethodIcon+ type={line.methodType ?? "Pull from Inventory"}+ />+ )}+ </Badge>+ <Badge variant="green">+ {formatter.format(line.unitPrice ?? 0)}{" "}+ {+ unitOfMeasures.find(+ (uom) => uom.value === line.unitOfMeasureCode+ )?.label+ }+ </Badge>+ {discountPercent > 0 ? (+ <Badge variant="secondary">+ <Trans>{discount} off</Trans>+ </Badge>+ ) : null}+ {(line.taxPercent ?? 0) > 0 ? (+ <Badge variant="red">+ {percentFormatter.format(line.taxPercent ?? 0)} Tax+ </Badge>+ ) : null}</div>- </div>- </VStack>- </HStack>-- <motion.div- initial="collapsed"- animate={openItems.includes(line.id) ? "open" : "collapsed"}- variants={{- open: { opacity: 1, height: "auto", marginTop: 16 },- collapsed: { opacity: 0, height: 0, marginTop: 0 }- }}- transition={{ duration: 0.3 }}- className="w-full overflow-hidden"- >- <div className="w-full">- <Table>- <Tbody>- <Tr>- <Td>- <Trans>Quantity</Trans>- </Td>- <Td className="text-right">- <VStack spacing={0}>- <span>- {line.quantity}{" "}- {- unitOfMeasures.find(- (uom) => uom.value === line.unitOfMeasureCode- )?.label- }- </span>- </VStack>- </Td>- </Tr>- <Tr>- <Td>- <Trans>Unit Price</Trans>- </Td>- <Td className="text-right">- <VStack spacing={0}>- <span>{formatter.format(line.unitPrice ?? 0)}</span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-xs">- {presentationCurrencyFormatter.format(- line.convertedUnitPrice ?? 0- )}- </span>- )}- {discountPercent > 0 && (- <span className="text-muted-foreground text-xs">- <Trans>{discount} off</Trans>- </span>- )}- </VStack>- </Td>- </Tr>- <Tr>- <Td>Shipping Cost</Td>- <Td className="text-right">- <VStack spacing={0}>- <span>- {formatter.format(line.shippingCost ?? 0)}- </span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-xs">- {presentationCurrencyFormatter.format(- line.convertedShippingCost ?? 0- )}- </span>+ </VStack>+ </div>+ </div>+ </VStack>+ </HStack>++ <motion.div+ initial="collapsed"+ animate={openItems.includes(line.id) ? "open" : "collapsed"}+ variants={{+ open: { opacity: 1, height: "auto", marginTop: 16 },+ collapsed: { opacity: 0, height: 0, marginTop: 0 }+ }}+ transition={{ duration: 0.3 }}+ className="w-full overflow-hidden"+ >+ <div className="w-full">+ <Table>+ <Tbody>+ <Tr>+ <Td>+ <Trans>Quantity</Trans>+ </Td>+ <Td className="text-right">+ <VStack spacing={0}>+ <span>+ {line.quantity}{" "}+ {+ unitOfMeasures.find(+ (uom) => uom.value === line.unitOfMeasureCode+ )?.label+ }+ </span>+ </VStack>+ </Td>+ </Tr>+ <Tr>+ <Td>+ <Trans>Unit Price</Trans>+ </Td>+ <Td className="text-right">+ <VStack spacing={0}>+ <span>{formatter.format(line.unitPrice ?? 0)}</span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-xs">+ {presentationCurrencyFormatter.format(+ line.convertedUnitPrice ?? 0)}- </VStack>- </Td>- </Tr>- <Tr className="border-b border-border">- <Td>- <Trans>Extended Price</Trans>- </Td>- <Td className="text-right">- <VStack spacing={0}>- <span>{formatter.format(lineSubtotal)}</span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-xs">- {presentationCurrencyFormatter.format(- customerSubtotal- )}- </span>+ </span>+ )}+ {discountPercent > 0 && (+ <span className="text-muted-foreground text-xs">+ <Trans>{discount} off</Trans>+ </span>+ )}+ </VStack>+ </Td>+ </Tr>+ <Tr>+ <Td>Shipping Cost</Td>+ <Td className="text-right">+ <VStack spacing={0}>+ <span>{formatter.format(line.shippingCost ?? 0)}</span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-xs">+ {presentationCurrencyFormatter.format(+ line.convertedShippingCost ?? 0)}- </VStack>- </Td>- </Tr>-- <Tr key="tax" className="border-b border-border">- <Td>- Tax ({percentFormatter.format(line.taxPercent ?? 0)})- </Td>- <Td className="text-right">- <VStack spacing={0}>- <span>{formatter.format(lineTaxAmount)}</span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-xs">- {presentationCurrencyFormatter.format(- customerLineTaxAmount- )}- </span>+ </span>+ )}+ </VStack>+ </Td>+ </Tr>+ <Tr className="border-b border-border">+ <Td>+ <Trans>Extended Price</Trans>+ </Td>+ <Td className="text-right">+ <VStack spacing={0}>+ <span>{formatter.format(lineSubtotal)}</span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-xs">+ {presentationCurrencyFormatter.format(+ customerSubtotal)}- </VStack>- </Td>- </Tr>-- <Tr key="total" className="font-semibold">- <Td>- <Trans>Total</Trans>- </Td>- <Td className="text-right">- <VStack spacing={0}>- <span>{formatter.format(total)}</span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-xs">- {presentationCurrencyFormatter.format(- customerTotal- )}- </span>+ </span>+ )}+ </VStack>+ </Td>+ </Tr>++ <Tr key="tax" className="border-b border-border">+ <Td>Tax ({percentFormatter.format(line.taxPercent ?? 0)})</Td>+ <Td className="text-right">+ <VStack spacing={0}>+ <span>{formatter.format(lineTaxAmount)}</span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-xs">+ {presentationCurrencyFormatter.format(+ customerLineTaxAmount)}- </VStack>- </Td>- </Tr>- </Tbody>- </Table>- </div>- </motion.div>- </motion.div>- );- })}+ </span>+ )}+ </VStack>+ </Td>+ </Tr>++ <Tr key="total" className="font-semibold">+ <Td>+ <Trans>Total</Trans>+ </Td>+ <Td className="text-right">+ <VStack spacing={0}>+ <span>{formatter.format(total)}</span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-xs">+ {presentationCurrencyFormatter.format(customerTotal)}+ </span>+ )}+ </VStack>+ </Td>+ </Tr>+ </Tbody>+ </Table>+ </div>+ </motion.div>+ </motion.div>+ );+ });++ if (isPhone) {+ return <SummaryLineList>{rows}</SummaryLineList>;+ }++ return (+ <VStack spacing={8} className="w-full overflow-hidden">+ {rows}</VStack>);};diff --git a/apps/erp/app/modules/items/ui/Consumables/ConsumableHeader.tsx b/apps/erp/app/modules/items/ui/Consumables/ConsumableHeader.tsxindex fa944d78ad..e4ee053d59 100644--- a/apps/erp/app/modules/items/ui/Consumables/ConsumableHeader.tsx+++ b/apps/erp/app/modules/items/ui/Consumables/ConsumableHeader.tsx@@ -2,26 +2,14 @@// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,// including ports, remain AGPLv3; serving them over a network requires releasing their source.-import {- DropdownMenuIcon,- DropdownMenuItem,- DropdownMenuSeparator,- MENU_ITEM_SHORTCUTS,- Status,- useDisclosure-} from "@carbon/react";-import { Trans, useLingui } from "@lingui/react/macro";-import { LuTrash } from "react-icons/lu";+import { Trans } from "@lingui/react/macro";import { useParams } from "react-router";-import { useAuditLog } from "~/components/AuditLog";-import { DetailsTopbar } from "~/components/Layout";-import { RecordHeader } from "~/components/Layout/RecordHeader";-import ConfirmDelete from "~/components/Modals/ConfirmDelete";-import { usePermissions, useRouteData, useUser } from "~/hooks";-import { useResolved } from "~/hooks/useResolved";+import { useRouteData } from "~/hooks";import { path } from "~/utils/path";import type { Consumable } from "../../types";-import { getItemLifecycleStatus } from "../Item/ItemSupersessionForm";+import ItemRecordHeader, {+ type ItemSupersession+} from "../Item/ItemRecordHeader";import { useConsumableNavigation } from "./useConsumableNavigation";const ConsumableHeader = () => {@@ -29,82 +17,21 @@ const ConsumableHeader = () => {const { itemId } = useParams();if (!itemId) throw new Error("itemId not found");- const { company } = useUser();- const permissions = usePermissions();- const { t } = useLingui();- const deleteModal = useDisclosure();- const { trigger: auditLogTrigger, drawer: auditLogDrawer } = useAuditLog({- entityType: "item",- entityId: itemId,- companyId: company.id,- variant: "dropdown"- });-const routeData = useRouteData<{consumableSummary: Consumable;- supersession: Promise<{- supersessionMode:- | "Consume First"- | "Prefer New"- | "Stock Only"- | "No Stock";- } | null>;+ supersession: ItemSupersession;}>(path.to.consumable(itemId));- const supersession = useResolved(routeData?.supersession, null, itemId);- const lifecycleStatus = getItemLifecycleStatus(- supersession?.supersessionMode- );-- const statusPill = lifecycleStatus && (- <Status color={lifecycleStatus.color}>{lifecycleStatus.label}</Status>- );- const menuItems = (- <>- {auditLogTrigger}- <DropdownMenuSeparator />- <DropdownMenuItem- shortcut={MENU_ITEM_SHORTCUTS.delete}- disabled={- !permissions.can("delete", "parts") || !permissions.is("employee")- }- destructive- onClick={deleteModal.onOpen}- >- <DropdownMenuIcon icon={<LuTrash />} />- <Trans>Delete Consumable</Trans>- </DropdownMenuItem>- </>- );-return (- <>- <RecordHeader- title={routeData?.consumableSummary?.readableIdWithRevision}- titleTo={path.to.consumableDetails(itemId)}- copyValue={routeData?.consumableSummary?.readableIdWithRevision ?? ""}- menu={menuItems}- status={statusPill}- aside={<DetailsTopbar links={links} />}- />- {deleteModal.isOpen && (- <ConfirmDelete- action={path.to.deleteItem(itemId)}- isOpen={deleteModal.isOpen}- name={- routeData?.consumableSummary?.readableIdWithRevision ?? "consumable"- }- text={t`Are you sure you want to delete ${routeData?.consumableSummary?.readableIdWithRevision}? This cannot be undone.`}- onCancel={() => {- deleteModal.onClose();- }}- onSubmit={() => {- deleteModal.onClose();- }}- />- )}- {auditLogDrawer}- </>+ <ItemRecordHeader+ itemId={itemId}+ readableId={routeData?.consumableSummary?.readableIdWithRevision}+ detailsTo={path.to.consumableDetails(itemId)}+ links={links}+ supersession={routeData?.supersession}+ deleteLabel={<Trans>Delete Consumable</Trans>}+ deleteFallbackName="consumable"+ />);};diff --git a/apps/erp/app/modules/items/ui/Item/ItemRecordHeader.tsx b/apps/erp/app/modules/items/ui/Item/ItemRecordHeader.tsxnew file mode 100644index 0000000000..0a01d57d78--- /dev/null+++ b/apps/erp/app/modules/items/ui/Item/ItemRecordHeader.tsx@@ -0,0 +1,140 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,+// including ports, remain AGPLv3; serving them over a network requires releasing their source.++import {+ DropdownMenuIcon,+ DropdownMenuItem,+ DropdownMenuSeparator,+ MENU_ITEM_SHORTCUTS,+ Status,+ useDisclosure+} from "@carbon/react";+import { Trans, useLingui } from "@lingui/react/macro";+import type { ComponentProps, ReactNode } from "react";+import { LuGitPullRequestArrow, LuTrash } from "react-icons/lu";+import { useAuditLog } from "~/components/AuditLog";+import { DetailsTopbar } from "~/components/Layout";+import { RecordHeader } from "~/components/Layout/RecordHeader";+import ConfirmDelete from "~/components/Modals/ConfirmDelete";+import { usePermissions, useUser } from "~/hooks";+import { useResolved } from "~/hooks/useResolved";+import { path } from "~/utils/path";+import type { SupersessionMode } from "../../items.models";+import { CreateChangeNoticeModal } from "../ChangeNotice";+import { getItemLifecycleStatus } from "./ItemSupersessionForm";++export type ItemSupersession = Promise<{+ supersessionMode: SupersessionMode;+} | null>;++type ItemRecordHeaderProps = {+ itemId: string;+ readableId?: string | null;+ subtitle?: ReactNode;+ detailsTo: string;+ links: ComponentProps<typeof DetailsTopbar>["links"];+ supersession?: ItemSupersession;+ deleteLabel: ReactNode;+ deleteFallbackName: string;+ withChangeNotice?: boolean;+};++const ItemRecordHeader = ({+ itemId,+ readableId,+ subtitle,+ detailsTo,+ links,+ supersession: supersessionPromise,+ deleteLabel,+ deleteFallbackName,+ withChangeNotice = false+}: ItemRecordHeaderProps) => {+ const { t } = useLingui();+ const { company } = useUser();+ const permissions = usePermissions();+ const deleteModal = useDisclosure();+ const changeNoticeModal = useDisclosure();+ const { trigger: auditLogTrigger, drawer: auditLogDrawer } = useAuditLog({+ entityType: "item",+ entityId: itemId,+ companyId: company.id,+ variant: "dropdown"+ });++ const supersession = useResolved(supersessionPromise, null, itemId);+ const lifecycleStatus = getItemLifecycleStatus(+ supersession?.supersessionMode+ );++ const statusPill = lifecycleStatus && (+ <Status color={lifecycleStatus.color}>{lifecycleStatus.label}</Status>+ );+ const menuItems = (+ <>+ {auditLogTrigger}+ <DropdownMenuSeparator />+ {withChangeNotice && (+ <>+ <DropdownMenuItem+ disabled={!permissions.can("create", "parts")}+ onClick={changeNoticeModal.onOpen}+ >+ <DropdownMenuIcon icon={<LuGitPullRequestArrow />} />+ <Trans>Create Change Notice</Trans>+ </DropdownMenuItem>+ <DropdownMenuSeparator />+ </>+ )}+ <DropdownMenuItem+ shortcut={MENU_ITEM_SHORTCUTS.delete}+ disabled={+ !permissions.can("delete", "parts") || !permissions.is("employee")+ }+ destructive+ onClick={deleteModal.onOpen}+ >+ <DropdownMenuIcon icon={<LuTrash />} />+ {deleteLabel}+ </DropdownMenuItem>+ </>+ );++ return (+ <>+ <RecordHeader+ title={readableId}+ titleTo={detailsTo}+ copyValue={readableId ?? ""}+ menu={menuItems}+ status={statusPill}+ subtitle={subtitle}+ aside={<DetailsTopbar links={links} />}+ />+ {deleteModal.isOpen && (+ <ConfirmDelete+ action={path.to.deleteItem(itemId)}+ isOpen={deleteModal.isOpen}+ name={readableId ?? deleteFallbackName}+ text={t`Are you sure you want to delete ${readableId}? This cannot be undone.`}+ onCancel={() => {+ deleteModal.onClose();+ }}+ onSubmit={() => {+ deleteModal.onClose();+ }}+ />+ )}+ {changeNoticeModal.isOpen && (+ <CreateChangeNoticeModal+ itemId={itemId}+ onClose={changeNoticeModal.onClose}+ />+ )}+ {auditLogDrawer}+ </>+ );+};++export default ItemRecordHeader;diff --git a/apps/erp/app/modules/items/ui/Materials/MaterialHeader.tsx b/apps/erp/app/modules/items/ui/Materials/MaterialHeader.tsxindex 5dd2fc0c4e..953b7f37c7 100644--- a/apps/erp/app/modules/items/ui/Materials/MaterialHeader.tsx+++ b/apps/erp/app/modules/items/ui/Materials/MaterialHeader.tsx@@ -2,109 +2,36 @@// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,// including ports, remain AGPLv3; serving them over a network requires releasing their source.-import {- DropdownMenuIcon,- DropdownMenuItem,- DropdownMenuSeparator,- MENU_ITEM_SHORTCUTS,- Status,- useDisclosure-} from "@carbon/react";-import { Trans, useLingui } from "@lingui/react/macro";-import { LuTrash } from "react-icons/lu";+import { Trans } from "@lingui/react/macro";import { useParams } from "react-router";-import { useAuditLog } from "~/components/AuditLog";-import { DetailsTopbar } from "~/components/Layout";-import { RecordHeader } from "~/components/Layout/RecordHeader";-import ConfirmDelete from "~/components/Modals/ConfirmDelete";-import { usePermissions, useRouteData, useUser } from "~/hooks";-import { useResolved } from "~/hooks/useResolved";+import { useRouteData } from "~/hooks";import { path } from "~/utils/path";import type { Material } from "../../types";-import { getItemLifecycleStatus } from "../Item/ItemSupersessionForm";+import ItemRecordHeader, {+ type ItemSupersession+} from "../Item/ItemRecordHeader";import { useMaterialNavigation } from "./useMaterialNavigation";const MaterialHeader = () => {- const { t } = useLingui();const links = useMaterialNavigation();const { itemId } = useParams();if (!itemId) throw new Error("itemId not found");- const { company } = useUser();- const permissions = usePermissions();- const deleteModal = useDisclosure();- const { trigger: auditLogTrigger, drawer: auditLogDrawer } = useAuditLog({- entityType: "item",- entityId: itemId,- companyId: company.id,- variant: "dropdown"- });-const routeData = useRouteData<{materialSummary: Material;- supersession: Promise<{- supersessionMode:- | "Consume First"- | "Prefer New"- | "Stock Only"- | "No Stock";- } | null>;+ supersession: ItemSupersession;}>(path.to.material(itemId));- const supersession = useResolved(routeData?.supersession, null, itemId);- const lifecycleStatus = getItemLifecycleStatus(- supersession?.supersessionMode- );-- const statusPill = lifecycleStatus && (- <Status color={lifecycleStatus.color}>{lifecycleStatus.label}</Status>- );- const menuItems = (- <>- {auditLogTrigger}- <DropdownMenuSeparator />- <DropdownMenuItem- shortcut={MENU_ITEM_SHORTCUTS.delete}- disabled={- !permissions.can("delete", "parts") || !permissions.is("employee")- }- destructive- onClick={deleteModal.onOpen}- >- <DropdownMenuIcon icon={<LuTrash />} />- <Trans>Delete Material</Trans>- </DropdownMenuItem>- </>- );-return (- <>- <RecordHeader- title={routeData?.materialSummary?.readableIdWithRevision}- titleTo={path.to.materialDetails(itemId)}- copyValue={routeData?.materialSummary?.readableIdWithRevision ?? ""}- menu={menuItems}- status={statusPill}- aside={<DetailsTopbar links={links} />}- />- {deleteModal.isOpen && (- <ConfirmDelete- action={path.to.deleteItem(itemId)}- isOpen={deleteModal.isOpen}- name={- routeData?.materialSummary?.readableIdWithRevision ?? "material"- }- text={t`Are you sure you want to delete ${routeData?.materialSummary?.readableIdWithRevision}? This cannot be undone.`}- onCancel={() => {- deleteModal.onClose();- }}- onSubmit={() => {- deleteModal.onClose();- }}- />- )}- {auditLogDrawer}- </>+ <ItemRecordHeader+ itemId={itemId}+ readableId={routeData?.materialSummary?.readableIdWithRevision}+ detailsTo={path.to.materialDetails(itemId)}+ links={links}+ supersession={routeData?.supersession}+ deleteLabel={<Trans>Delete Material</Trans>}+ deleteFallbackName="material"+ />);};diff --git a/apps/erp/app/modules/items/ui/Parts/PartHeader.tsx b/apps/erp/app/modules/items/ui/Parts/PartHeader.tsxindex cfe6559c89..d93998e53a 100644--- a/apps/erp/app/modules/items/ui/Parts/PartHeader.tsx+++ b/apps/erp/app/modules/items/ui/Parts/PartHeader.tsx@@ -2,124 +2,38 @@// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,// including ports, remain AGPLv3; serving them over a network requires releasing their source.-import {- DropdownMenuIcon,- DropdownMenuItem,- DropdownMenuSeparator,- MENU_ITEM_SHORTCUTS,- Status,- useDisclosure-} from "@carbon/react";-import { Trans, useLingui } from "@lingui/react/macro";-import { LuGitPullRequestArrow, LuTrash } from "react-icons/lu";+import { Trans } from "@lingui/react/macro";import { useParams } from "react-router";-import { useAuditLog } from "~/components/AuditLog";-import { DetailsTopbar } from "~/components/Layout";-import { RecordHeader } from "~/components/Layout/RecordHeader";-import ConfirmDelete from "~/components/Modals/ConfirmDelete";-import { usePermissions, useRouteData, useUser } from "~/hooks";-import { useResolved } from "~/hooks/useResolved";+import { useRouteData } from "~/hooks";import { path } from "~/utils/path";import type { PartSummary } from "../../types";-import { CreateChangeNoticeModal } from "../ChangeNotice";-import { getItemLifecycleStatus } from "../Item/ItemSupersessionForm";+import ItemRecordHeader, {+ type ItemSupersession+} from "../Item/ItemRecordHeader";import { usePartNavigation } from "./usePartNavigation";const PartHeader = () => {- const { t } = useLingui();const links = usePartNavigation();const { itemId } = useParams();if (!itemId) throw new Error("itemId not found");- const { company } = useUser();- const permissions = usePermissions();- const deleteModal = useDisclosure();- const changeNoticeModal = useDisclosure();- const { trigger: auditLogTrigger, drawer: auditLogDrawer } = useAuditLog({- entityType: "item",- entityId: itemId,- companyId: company.id,- variant: "dropdown"- });-const routeData = useRouteData<{partSummary: PartSummary;- supersession: Promise<{- supersessionMode:- | "Consume First"- | "Prefer New"- | "Stock Only"- | "No Stock";- } | null>;+ supersession: ItemSupersession;}>(path.to.part(itemId));- const supersession = useResolved(routeData?.supersession, null, itemId);- const lifecycleStatus = getItemLifecycleStatus(- supersession?.supersessionMode- );-- const statusPill = lifecycleStatus && (- <Status color={lifecycleStatus.color}>{lifecycleStatus.label}</Status>- );- const menuItems = (- <>- {auditLogTrigger}- <DropdownMenuSeparator />- <DropdownMenuItem- disabled={!permissions.can("create", "parts")}- onClick={changeNoticeModal.onOpen}- >- <DropdownMenuIcon icon={<LuGitPullRequestArrow />} />- <Trans>Create Change Notice</Trans>- </DropdownMenuItem>- <DropdownMenuSeparator />- <DropdownMenuItem- shortcut={MENU_ITEM_SHORTCUTS.delete}- disabled={- !permissions.can("delete", "parts") || !permissions.is("employee")- }- destructive- onClick={deleteModal.onOpen}- >- <DropdownMenuIcon icon={<LuTrash />} />- <Trans>Delete Part</Trans>- </DropdownMenuItem>- </>- );-return (- <>- <RecordHeader- title={routeData?.partSummary?.readableIdWithRevision}- titleTo={path.to.partDetails(itemId)}- copyValue={routeData?.partSummary?.readableIdWithRevision ?? ""}- menu={menuItems}- status={statusPill}- subtitle={routeData?.partSummary?.name}- aside={<DetailsTopbar links={links} />}- />- {deleteModal.isOpen && (- <ConfirmDelete- action={path.to.deleteItem(itemId)}- isOpen={deleteModal.isOpen}- name={routeData?.partSummary?.readableIdWithRevision ?? "part"}- text={t`Are you sure you want to delete ${routeData?.partSummary?.readableIdWithRevision}? This cannot be undone.`}- onCancel={() => {- deleteModal.onClose();- }}- onSubmit={() => {- deleteModal.onClose();- }}- />- )}- {changeNoticeModal.isOpen && (- <CreateChangeNoticeModal- itemId={itemId}- onClose={changeNoticeModal.onClose}- />- )}- {auditLogDrawer}- </>+ <ItemRecordHeader+ itemId={itemId}+ readableId={routeData?.partSummary?.readableIdWithRevision}+ subtitle={routeData?.partSummary?.name}+ withChangeNotice+ detailsTo={path.to.partDetails(itemId)}+ links={links}+ supersession={routeData?.supersession}+ deleteLabel={<Trans>Delete Part</Trans>}+ deleteFallbackName="part"+ />);};diff --git a/apps/erp/app/modules/items/ui/Services/ServiceHeader.tsx b/apps/erp/app/modules/items/ui/Services/ServiceHeader.tsxindex fe42ed72f2..768d02bf6c 100644--- a/apps/erp/app/modules/items/ui/Services/ServiceHeader.tsx+++ b/apps/erp/app/modules/items/ui/Services/ServiceHeader.tsx@@ -2,107 +2,36 @@// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,// including ports, remain AGPLv3; serving them over a network requires releasing their source.-import {- DropdownMenuIcon,- DropdownMenuItem,- DropdownMenuSeparator,- MENU_ITEM_SHORTCUTS,- Status,- useDisclosure-} from "@carbon/react";-import { Trans, useLingui } from "@lingui/react/macro";-import { LuTrash } from "react-icons/lu";+import { Trans } from "@lingui/react/macro";import { useParams } from "react-router";-import { useAuditLog } from "~/components/AuditLog";-import { DetailsTopbar } from "~/components/Layout";-import { RecordHeader } from "~/components/Layout/RecordHeader";-import ConfirmDelete from "~/components/Modals/ConfirmDelete";-import { usePermissions, useRouteData, useUser } from "~/hooks";-import { useResolved } from "~/hooks/useResolved";+import { useRouteData } from "~/hooks";import { path } from "~/utils/path";import type { Service } from "../../types";-import { getItemLifecycleStatus } from "../Item/ItemSupersessionForm";+import ItemRecordHeader, {+ type ItemSupersession+} from "../Item/ItemRecordHeader";import { useServiceNavigation } from "./useServiceNavigation";const ServiceHeader = () => {- const { t } = useLingui();const links = useServiceNavigation();const { itemId } = useParams();if (!itemId) throw new Error("itemId not found");- const { company } = useUser();- const permissions = usePermissions();- const deleteModal = useDisclosure();- const { trigger: auditLogTrigger, drawer: auditLogDrawer } = useAuditLog({- entityType: "item",- entityId: itemId,- companyId: company.id,- variant: "dropdown"- });-const routeData = useRouteData<{serviceSummary: Service;- supersession: Promise<{- supersessionMode:- | "Consume First"- | "Prefer New"- | "Stock Only"- | "No Stock";- } | null>;+ supersession: ItemSupersession;}>(path.to.service(itemId));- const supersession = useResolved(routeData?.supersession, null, itemId);- const lifecycleStatus = getItemLifecycleStatus(- supersession?.supersessionMode- );-- const statusPill = lifecycleStatus && (- <Status color={lifecycleStatus.color}>{lifecycleStatus.label}</Status>- );- const menuItems = (- <>- {auditLogTrigger}- <DropdownMenuSeparator />- <DropdownMenuItem- shortcut={MENU_ITEM_SHORTCUTS.delete}- disabled={- !permissions.can("delete", "parts") || !permissions.is("employee")- }- destructive- onClick={deleteModal.onOpen}- >- <DropdownMenuIcon icon={<LuTrash />} />- <Trans>Delete Service</Trans>- </DropdownMenuItem>- </>- );-return (- <>- <RecordHeader- title={routeData?.serviceSummary?.readableIdWithRevision}- titleTo={path.to.serviceDetails(itemId)}- copyValue={routeData?.serviceSummary?.readableIdWithRevision ?? ""}- menu={menuItems}- status={statusPill}- aside={<DetailsTopbar links={links} />}- />- {deleteModal.isOpen && (- <ConfirmDelete- action={path.to.deleteItem(itemId)}- isOpen={deleteModal.isOpen}- name={routeData?.serviceSummary?.readableIdWithRevision ?? "service"}- text={t`Are you sure you want to delete ${routeData?.serviceSummary?.readableIdWithRevision}? This cannot be undone.`}- onCancel={() => {- deleteModal.onClose();- }}- onSubmit={() => {- deleteModal.onClose();- }}- />- )}- {auditLogDrawer}- </>+ <ItemRecordHeader+ itemId={itemId}+ readableId={routeData?.serviceSummary?.readableIdWithRevision}+ detailsTo={path.to.serviceDetails(itemId)}+ links={links}+ supersession={routeData?.supersession}+ deleteLabel={<Trans>Delete Service</Trans>}+ deleteFallbackName="service"+ />);};diff --git a/apps/erp/app/modules/items/ui/Tools/ToolHeader.tsx b/apps/erp/app/modules/items/ui/Tools/ToolHeader.tsxindex e1e062553e..c8de550365 100644--- a/apps/erp/app/modules/items/ui/Tools/ToolHeader.tsx+++ b/apps/erp/app/modules/items/ui/Tools/ToolHeader.tsx@@ -2,123 +2,37 @@// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,// including ports, remain AGPLv3; serving them over a network requires releasing their source.-import {- DropdownMenuIcon,- DropdownMenuItem,- DropdownMenuSeparator,- MENU_ITEM_SHORTCUTS,- Status,- useDisclosure-} from "@carbon/react";-import { Trans, useLingui } from "@lingui/react/macro";-import { LuGitPullRequestArrow, LuTrash } from "react-icons/lu";+import { Trans } from "@lingui/react/macro";import { useParams } from "react-router";-import { useAuditLog } from "~/components/AuditLog";-import { DetailsTopbar } from "~/components/Layout";-import { RecordHeader } from "~/components/Layout/RecordHeader";-import ConfirmDelete from "~/components/Modals/ConfirmDelete";-import { usePermissions, useRouteData, useUser } from "~/hooks";-import { useResolved } from "~/hooks/useResolved";+import { useRouteData } from "~/hooks";import { path } from "~/utils/path";import type { Tool } from "../../types";-import { CreateChangeNoticeModal } from "../ChangeNotice";-import { getItemLifecycleStatus } from "../Item/ItemSupersessionForm";+import ItemRecordHeader, {+ type ItemSupersession+} from "../Item/ItemRecordHeader";import { useToolNavigation } from "./useToolNavigation";const ToolHeader = () => {- const { t } = useLingui();const links = useToolNavigation();const { itemId } = useParams();if (!itemId) throw new Error("itemId not found");- const { company } = useUser();- const permissions = usePermissions();- const deleteModal = useDisclosure();- const changeNoticeModal = useDisclosure();- const { trigger: auditLogTrigger, drawer: auditLogDrawer } = useAuditLog({- entityType: "item",- entityId: itemId,- companyId: company.id,- variant: "dropdown"- });-const routeData = useRouteData<{toolSummary: Tool;- supersession: Promise<{- supersessionMode:- | "Consume First"- | "Prefer New"- | "Stock Only"- | "No Stock";- } | null>;+ supersession: ItemSupersession;}>(path.to.tool(itemId));- const supersession = useResolved(routeData?.supersession, null, itemId);- const lifecycleStatus = getItemLifecycleStatus(- supersession?.supersessionMode- );-- const statusPill = lifecycleStatus && (- <Status color={lifecycleStatus.color}>{lifecycleStatus.label}</Status>- );- const menuItems = (- <>- {auditLogTrigger}- <DropdownMenuSeparator />- <DropdownMenuItem- disabled={!permissions.can("create", "parts")}- onClick={changeNoticeModal.onOpen}- >- <DropdownMenuIcon icon={<LuGitPullRequestArrow />} />- <Trans>Create Change Notice</Trans>- </DropdownMenuItem>- <DropdownMenuSeparator />- <DropdownMenuItem- shortcut={MENU_ITEM_SHORTCUTS.delete}- disabled={- !permissions.can("delete", "parts") || !permissions.is("employee")- }- destructive- onClick={deleteModal.onOpen}- >- <DropdownMenuIcon icon={<LuTrash />} />- <Trans>Delete Tool</Trans>- </DropdownMenuItem>- </>- );-return (- <>- <RecordHeader- title={routeData?.toolSummary?.readableIdWithRevision}- titleTo={path.to.toolDetails(itemId)}- copyValue={routeData?.toolSummary?.readableIdWithRevision ?? ""}- menu={menuItems}- status={statusPill}- aside={<DetailsTopbar links={links} />}- />- {deleteModal.isOpen && (- <ConfirmDelete- action={path.to.deleteItem(itemId)}- isOpen={deleteModal.isOpen}- name={routeData?.toolSummary?.readableIdWithRevision ?? "tool"}- text={t`Are you sure you want to delete ${routeData?.toolSummary?.readableIdWithRevision}? This cannot be undone.`}- onCancel={() => {- deleteModal.onClose();- }}- onSubmit={() => {- deleteModal.onClose();- }}- />- )}- {changeNoticeModal.isOpen && (- <CreateChangeNoticeModal- itemId={itemId}- onClose={changeNoticeModal.onClose}- />- )}- {auditLogDrawer}- </>+ <ItemRecordHeader+ itemId={itemId}+ readableId={routeData?.toolSummary?.readableIdWithRevision}+ withChangeNotice+ detailsTo={path.to.toolDetails(itemId)}+ links={links}+ supersession={routeData?.supersession}+ deleteLabel={<Trans>Delete Tool</Trans>}+ deleteFallbackName="tool"+ />);};diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsxindex 9371e35f6a..97a75466d5 100644--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsx+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsx@@ -10,7 +10,6 @@ import {CardDescription,CardHeader,CardTitle,- cn,Heading,HStack,Table,@@ -37,7 +36,7 @@ import {import { useAccounts } from "~/components/Form/Account";import { useUnitOfMeasure } from "~/components/Form/UnitOfMeasure";import { useShowRecordPanel } from "~/components/Layout/Panels";-import { SummaryLineRow } from "~/components/SummaryLineRow";+import { SummaryLineList, SummaryLineRow } from "~/components/SummaryLineRow";import {useCurrencyFormatter,usePercentFormatter,@@ -92,377 +91,362 @@ const LineItems = ({const phoneLineLimit = 3;const shownLines = isPhone ? lines.slice(0, phoneLineLimit) : lines;- return (- <VStack- spacing={8}- className={cn(- "w-full overflow-hidden",- isPhone && "space-y-0 divide-y divide-border"- )}- >- {shownLines.map((line) => {- if (!line.id) return null;-- const isGlAccount = line.purchaseOrderLineType === "G/L Account";- const isFixedAsset = line.purchaseOrderLineType === "Fixed Asset";- const isIndirect = isGlAccount || isFixedAsset;- const isReceivable = !isGlAccount && (line.purchaseQuantity ?? 0) > 0;- const quantityReceived = line.quantityReceived ?? 0;- const quantityInvoiced = line.quantityInvoiced ?? 0;- const itemReadableId = isGlAccount- ? line.description || "Indirect Expense"- : isFixedAsset- ? line.assetReadableId || "Fixed Asset"- : getItemReadableId(items, line.itemId);- const lineDescription = isGlAccount- ? (accounts.find((a) => a.id === line.accountId)?.name ??- "Indirect Expense")- : isFixedAsset- ? line.description || "Fixed Asset"- : distinctItemText(itemReadableId, line.description);- const lineTotal = (line.unitPrice ?? 0) * (line.purchaseQuantity ?? 0);- const supplierLineTotal =- (line.supplierUnitPrice ?? 0) * (line.purchaseQuantity ?? 0);- const total =- lineTotal + (line.taxAmount ?? 0) + (line.shippingCost ?? 0);- const supplierTotal =- supplierLineTotal +- (line.supplierTaxAmount ?? 0) +- (line.supplierShippingCost ?? 0);- const unitOfMeasureLabel = unitOfMeasures.find(- (uom) => uom.value === line.purchaseUnitOfMeasureCode- )?.label;-- // Phones: one row that opens the line page (its Edit link, the- // badges and the breakdown stay on desktop).- if (isPhone) {- return (- <SummaryLineRow- key={line.id}- to={path.to.purchaseOrderLine(orderId, line.id)}- title={itemReadableId}- value={formatter.format(total)}- description={lineDescription}- meta={- <>- {line.purchaseQuantity} ×{" "}- {formatter.format(line.unitPrice ?? 0)} {unitOfMeasureLabel}- </>- }+ const rows = shownLines.map((line) => {+ if (!line.id) return null;++ const isGlAccount = line.purchaseOrderLineType === "G/L Account";+ const isFixedAsset = line.purchaseOrderLineType === "Fixed Asset";+ const isIndirect = isGlAccount || isFixedAsset;+ const isReceivable = !isGlAccount && (line.purchaseQuantity ?? 0) > 0;+ const quantityReceived = line.quantityReceived ?? 0;+ const quantityInvoiced = line.quantityInvoiced ?? 0;+ const itemReadableId = isGlAccount+ ? line.description || "Indirect Expense"+ : isFixedAsset+ ? line.assetReadableId || "Fixed Asset"+ : getItemReadableId(items, line.itemId);+ const lineDescription = isGlAccount+ ? (accounts.find((a) => a.id === line.accountId)?.name ??+ "Indirect Expense")+ : isFixedAsset+ ? line.description || "Fixed Asset"+ : distinctItemText(itemReadableId, line.description);+ const lineTotal = (line.unitPrice ?? 0) * (line.purchaseQuantity ?? 0);+ const supplierLineTotal =+ (line.supplierUnitPrice ?? 0) * (line.purchaseQuantity ?? 0);+ const total = lineTotal + (line.taxAmount ?? 0) + (line.shippingCost ?? 0);+ const supplierTotal =+ supplierLineTotal ++ (line.supplierTaxAmount ?? 0) ++ (line.supplierShippingCost ?? 0);+ const unitOfMeasureLabel = unitOfMeasures.find(+ (uom) => uom.value === line.purchaseUnitOfMeasureCode+ )?.label;++ // Phones: one row that opens the line page (its Edit link, the+ // badges and the breakdown stay on desktop).+ if (isPhone) {+ return (+ <SummaryLineRow+ key={line.id}+ to={path.to.purchaseOrderLine(orderId, line.id)}+ title={itemReadableId}+ value={formatter.format(total)}+ description={lineDescription}+ meta={+ <>+ {line.purchaseQuantity} × {formatter.format(line.unitPrice ?? 0)}{" "}+ {unitOfMeasureLabel}+ </>+ }+ />+ );+ }++ return (+ <motion.div+ key={line.id}+ initial={{ opacity: 0, y: 8 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ duration: 0.2, ease: "easeOut" }}+ className="border-b border-input py-6 w-full"+ >+ <HStack spacing={4} className="items-start">+ {line.thumbnailPath ? (+ <img+ alt={itemReadableId!}+ className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg"+ src={getPrivateUrl(line.thumbnailPath)}/>- );- }-- return (- <motion.div- key={line.id}- initial={{ opacity: 0, y: 8 }}- animate={{ opacity: 1, y: 0 }}- transition={{ duration: 0.2, ease: "easeOut" }}- className="border-b border-input py-6 w-full"- >- <HStack spacing={4} className="items-start">- {line.thumbnailPath ? (- <img- alt={itemReadableId!}- className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg max-md:size-14"- src={getPrivateUrl(line.thumbnailPath)}- />- ) : (- <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 max-md:size-14 max-md:p-3">- <LuImage className="w-16 h-16 text-muted-foreground max-md:size-8" />- </div>- )}-- <VStack spacing={0} className="flex-1 min-w-0">- <div- className="flex flex-col cursor-pointer w-full"- onClick={() => toggleOpen(line.id!)}- >- {/* The text column must shrink (flex-1 min-w-0) or a long+ ) : (+ <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4">+ <LuImage className="w-16 h-16 text-muted-foreground" />+ </div>+ )}++ <VStack spacing={0} className="flex-1 min-w-0">+ <div+ className="flex flex-col cursor-pointer w-full"+ onClick={() => toggleOpen(line.id!)}+ >+ {/* The text column must shrink (flex-1 min-w-0) or a longdescription shoves the totals out of the card, and itschildren need w-full because VStack is items-start, whichsizes each child to its own content and leaves truncateinert no matter how narrow the column gets. */}- <div className="flex items-center justify-between w-full max-md:flex-wrap max-md:gap-y-2">- <VStack- spacing={0}- className="flex-1 min-w-0 max-md:basis-full"+ <div className="flex items-center justify-between w-full">+ <VStack spacing={0} className="flex-1 min-w-0">+ <HStack spacing={2} className="flex min-w-0 w-full">+ <Heading className="truncate">{itemReadableId}</Heading>+ <Button+ asChild+ variant="link"+ size="sm"+ className="text-muted-foreground flex-shrink-0">- <HStack spacing={2} className="flex min-w-0 w-full">- <Heading className="truncate">{itemReadableId}</Heading>- <Button- asChild- variant="link"- size="sm"- className="text-muted-foreground flex-shrink-0"- >- <Link- to={path.to.purchaseOrderLine(orderId, line.id!)}- >- <Trans>Edit</Trans>- </Link>- </Button>- </HStack>- {lineDescription && (- <TruncatedTooltipText- className="text-muted-foreground text-sm truncate w-full"- tooltip={lineDescription}- >- {lineDescription}- </TruncatedTooltipText>+ <Link to={path.to.purchaseOrderLine(orderId, line.id!)}>+ <Trans>Edit</Trans>+ </Link>+ </Button>+ </HStack>+ {lineDescription && (+ <TruncatedTooltipText+ className="text-muted-foreground text-sm truncate w-full"+ tooltip={lineDescription}+ >+ {lineDescription}+ </TruncatedTooltipText>+ )}+ </VStack>+ <VStack spacing={2} className="flex-shrink-0 items-end w-auto">+ <HStack spacing={4}>+ <VStack spacing={0}>+ <span className="font-semibold text-xl whitespace-nowrap">+ {formatter.format(total)}+ </span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-sm">+ {presentationCurrencyFormatter.format(supplierTotal)}+ </span>)}</VStack>- <VStack- spacing={2}- className="flex-shrink-0 items-end w-auto max-md:basis-full max-md:items-start"+ <motion.div+ animate={{+ rotate: openItems.includes(line.id) ? 90 : 0+ }}+ transition={{ duration: 0.3 }}>- <HStack spacing={4}>- <VStack spacing={0}>- <span className="font-semibold text-xl whitespace-nowrap">- {formatter.format(total)}- </span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-sm">- {presentationCurrencyFormatter.format(- supplierTotal- )}- </span>- )}- </VStack>- <motion.div- animate={{- rotate: openItems.includes(line.id) ? 90 : 0- }}- transition={{ duration: 0.3 }}- >- <LuChevronRight size={24} />- </motion.div>- </HStack>- <div className="flex items-center gap-2">- {!isIndirect && (- <Badge- variant="outline"- className="flex items-center gap-2"- >- {line.purchaseQuantity}- <MethodIcon- // @ts-expect-error- type={line.methodType ?? "Pull from Inventory"}- />- </Badge>- )}- <Badge variant="green">- {formatter.format(line.unitPrice ?? 0)}{" "}+ <LuChevronRight size={24} />+ </motion.div>+ </HStack>+ <div className="flex items-center gap-2">+ {!isIndirect && (+ <Badge+ variant="outline"+ className="flex items-center gap-2"+ >+ {line.purchaseQuantity}+ <MethodIcon+ // @ts-expect-error+ type={line.methodType ?? "Pull from Inventory"}+ />+ </Badge>+ )}+ <Badge variant="green">+ {formatter.format(line.unitPrice ?? 0)}{" "}+ {+ unitOfMeasures.find(+ (uom) => uom.value === line.purchaseUnitOfMeasureCode+ )?.label+ }+ </Badge>+ {(line.taxPercent ?? 0) > 0 ? (+ <Badge variant="red">+ {percentFormatter.format(line.taxPercent ?? 0)} Tax+ </Badge>+ ) : null}+ </div>+ </VStack>+ </div>+ </div>+ </VStack>+ </HStack>++ <motion.div+ initial="collapsed"+ animate={openItems.includes(line.id) ? "open" : "collapsed"}+ variants={{+ open: { opacity: 1, height: "auto", marginTop: 16 },+ collapsed: { opacity: 0, height: 0, marginTop: 0 }+ }}+ transition={{ duration: 0.3 }}+ className="w-full overflow-hidden"+ >+ <div className="w-full">+ <Table>+ <Tbody>+ <Tr>+ <Td>Quantity</Td>+ <Td className="text-right">+ <VStack spacing={0} className="items-end">+ <span>+ {line.purchaseQuantity}{" "}+ {+ unitOfMeasures.find(+ (uom) =>+ uom.value === line.purchaseUnitOfMeasureCode+ )?.label+ }+ </span>+ {line.conversionFactor !== 1 && (+ <span className="text-muted-foreground text-xs">+ {(line.purchaseQuantity ?? 0) *+ (line.conversionFactor ?? 1)}{" "}{unitOfMeasures.find((uom) =>- uom.value === line.purchaseUnitOfMeasureCode+ uom.value === line.inventoryUnitOfMeasureCode)?.label}- </Badge>- {(line.taxPercent ?? 0) > 0 ? (- <Badge variant="red">- {percentFormatter.format(line.taxPercent ?? 0)} Tax- </Badge>- ) : null}- </div>+ </span>+ )}</VStack>- </div>- </div>- </VStack>- </HStack>-- <motion.div- initial="collapsed"- animate={openItems.includes(line.id) ? "open" : "collapsed"}- variants={{- open: { opacity: 1, height: "auto", marginTop: 16 },- collapsed: { opacity: 0, height: 0, marginTop: 0 }- }}- transition={{ duration: 0.3 }}- className="w-full overflow-hidden"- >- <div className="w-full">- <Table>- <Tbody>- <Tr>- <Td>Quantity</Td>- <Td className="text-right">- <VStack spacing={0} className="items-end">- <span>- {line.purchaseQuantity}{" "}- {- unitOfMeasures.find(- (uom) =>- uom.value === line.purchaseUnitOfMeasureCode- )?.label- }- </span>- {line.conversionFactor !== 1 && (+ </Td>+ </Tr>+ {isReceivable && (+ <Tr>+ <Td>Received</Td>+ <Td className="text-right">+ <VStack spacing={0} className="items-end">+ <span>+ {quantityReceived} of {line.purchaseQuantity}{" "}+ {+ unitOfMeasures.find(+ (uom) =>+ uom.value === line.purchaseUnitOfMeasureCode+ )?.label+ }+ </span>+ {!line.receivedComplete &&+ (line.quantityToReceive ?? 0) > 0 && (<span className="text-muted-foreground text-xs">- {(line.purchaseQuantity ?? 0) *- (line.conversionFactor ?? 1)}{" "}- {- unitOfMeasures.find(- (uom) =>- uom.value ===- line.inventoryUnitOfMeasureCode- )?.label- }+ {line.quantityToReceive} remaining</span>)}- </VStack>- </Td>- </Tr>- {isReceivable && (- <Tr>- <Td>Received</Td>- <Td className="text-right">- <VStack spacing={0} className="items-end">- <span>- {quantityReceived} of {line.purchaseQuantity}{" "}- {- unitOfMeasures.find(- (uom) =>- uom.value === line.purchaseUnitOfMeasureCode- )?.label- }- </span>- {!line.receivedComplete &&- (line.quantityToReceive ?? 0) > 0 && (- <span className="text-muted-foreground text-xs">- {line.quantityToReceive} remaining- </span>- )}- </VStack>- </Td>- </Tr>- )}- {(line.purchaseQuantity ?? 0) > 0 && (- <Tr>- <Td>Invoiced</Td>- <Td className="text-right">- <VStack spacing={0} className="items-end">- <span>- {quantityInvoiced} of {line.purchaseQuantity}{" "}- {- unitOfMeasures.find(- (uom) =>- uom.value === line.purchaseUnitOfMeasureCode- )?.label- }- </span>- {!line.invoicedComplete &&- (line.quantityToInvoice ?? 0) > 0 && (- <span className="text-muted-foreground text-xs">- {line.quantityToInvoice} remaining- </span>- )}- </VStack>- </Td>- </Tr>- )}- <Tr>- <Td>Unit Price</Td>- <Td className="text-right">- <VStack spacing={0} className="items-end">- <span>{formatter.format(line.unitPrice ?? 0)}</span>- {shouldConvertCurrency && (+ </VStack>+ </Td>+ </Tr>+ )}+ {(line.purchaseQuantity ?? 0) > 0 && (+ <Tr>+ <Td>Invoiced</Td>+ <Td className="text-right">+ <VStack spacing={0} className="items-end">+ <span>+ {quantityInvoiced} of {line.purchaseQuantity}{" "}+ {+ unitOfMeasures.find(+ (uom) =>+ uom.value === line.purchaseUnitOfMeasureCode+ )?.label+ }+ </span>+ {!line.invoicedComplete &&+ (line.quantityToInvoice ?? 0) > 0 && (<span className="text-muted-foreground text-xs">- {presentationCurrencyFormatter.format(- line.supplierUnitPrice ?? 0- )}+ {line.quantityToInvoice} remaining</span>)}- </VStack>- </Td>- </Tr>- <Tr className="border-b border-border">- <Td>Extended Price</Td>- <Td className="text-right">- <VStack spacing={0} className="items-end">- <span>{formatter.format(lineTotal)}</span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-xs">- {presentationCurrencyFormatter.format(- supplierLineTotal- )}- </span>+ </VStack>+ </Td>+ </Tr>+ )}+ <Tr>+ <Td>Unit Price</Td>+ <Td className="text-right">+ <VStack spacing={0} className="items-end">+ <span>{formatter.format(line.unitPrice ?? 0)}</span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-xs">+ {presentationCurrencyFormatter.format(+ line.supplierUnitPrice ?? 0)}- </VStack>- </Td>- </Tr>-- <Tr key="tax">- <Td>- Tax ({percentFormatter.format(line.taxPercent ?? 0)})- </Td>- <Td className="text-right">- <VStack spacing={0} className="items-end">- <span>{formatter.format(line.taxAmount ?? 0)}</span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-xs">- {presentationCurrencyFormatter.format(- line.supplierTaxAmount ?? 0- )}- </span>+ </span>+ )}+ </VStack>+ </Td>+ </Tr>+ <Tr className="border-b border-border">+ <Td>Extended Price</Td>+ <Td className="text-right">+ <VStack spacing={0} className="items-end">+ <span>{formatter.format(lineTotal)}</span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-xs">+ {presentationCurrencyFormatter.format(+ supplierLineTotal)}- </VStack>- </Td>- </Tr>-- <Tr key="shipping" className="border-b border-border">- <Td>Shipping</Td>- <Td className="text-right">- <VStack spacing={0} className="items-end">- <span>- {formatter.format(line.shippingCost ?? 0)}- </span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-xs">- {presentationCurrencyFormatter.format(- line.supplierShippingCost ?? 0- )}- </span>+ </span>+ )}+ </VStack>+ </Td>+ </Tr>++ <Tr key="tax">+ <Td>Tax ({percentFormatter.format(line.taxPercent ?? 0)})</Td>+ <Td className="text-right">+ <VStack spacing={0} className="items-end">+ <span>{formatter.format(line.taxAmount ?? 0)}</span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-xs">+ {presentationCurrencyFormatter.format(+ line.supplierTaxAmount ?? 0)}- </VStack>- </Td>- </Tr>-- <Tr key="total" className="font-semibold">- <Td>Total</Td>- <Td className="text-right">- <VStack spacing={0} className="items-end">- <span>{formatter.format(total)}</span>- {shouldConvertCurrency && (- <span className="text-muted-foreground text-xs">- {presentationCurrencyFormatter.format(- supplierTotal- )}- </span>+ </span>+ )}+ </VStack>+ </Td>+ </Tr>++ <Tr key="shipping" className="border-b border-border">+ <Td>Shipping</Td>+ <Td className="text-right">+ <VStack spacing={0} className="items-end">+ <span>{formatter.format(line.shippingCost ?? 0)}</span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-xs">+ {presentationCurrencyFormatter.format(+ line.supplierShippingCost ?? 0)}- </VStack>- </Td>- </Tr>- </Tbody>- </Table>- </div>- </motion.div>- </motion.div>- );- })}- {isPhone && lines.length > phoneLineLimit ? (- <div className="w-full pt-3">- <Button- variant="secondary"- className="w-full"- onClick={() => showRecordPanel("explorer")}- >- {t`See all ${lines.length}`}- </Button>- </div>- ) : null}+ </span>+ )}+ </VStack>+ </Td>+ </Tr>++ <Tr key="total" className="font-semibold">+ <Td>Total</Td>+ <Td className="text-right">+ <VStack spacing={0} className="items-end">+ <span>{formatter.format(total)}</span>+ {shouldConvertCurrency && (+ <span className="text-muted-foreground text-xs">+ {presentationCurrencyFormatter.format(supplierTotal)}+ </span>+ )}+ </VStack>+ </Td>+ </Tr>+ </Tbody>+ </Table>+ </div>+ </motion.div>+ </motion.div>+ );+ });++ if (isPhone) {+ return (+ <SummaryLineList>+ {rows}+ {lines.length > phoneLineLimit ? (+ <div className="w-full pt-3">+ <Button+ variant="secondary"+ className="w-full"+ onClick={() => showRecordPanel("explorer")}+ >+ {t`See all ${lines.length}`}+ </Button>+ </div>+ ) : null}+ </SummaryLineList>+ );+ }++ return (+ <VStack spacing={8} className="w-full overflow-hidden">+ {rows}</VStack>);};diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteSummary.tsx b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteSummary.tsxindex 85794be8cd..163f789559 100644--- a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteSummary.tsx+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteSummary.tsx@@ -17,6 +17,7 @@ import {Thead,Tr,TruncatedTooltipText,+ useViewport,VStack} from "@carbon/react";import { distinctItemText, getItemReadableId } from "@carbon/utils";@@ -29,6 +30,7 @@ import { Link, useParams } from "react-router";import { DateTime, SupplierAvatar } from "~/components";import { useAccounts } from "~/components/Form/Account";import { useUnitOfMeasure } from "~/components/Form/UnitOfMeasure";+import { SummaryLineList, SummaryLineRow } from "~/components/SummaryLineRow";import { useCurrencyFormatter, useRouteData, useUser } from "~/hooks";import { useItems } from "~/stores";import { getPrivateUrl, path } from "~/utils/path";@@ -49,6 +51,7 @@ const LineItems = ({locale: string;}) => {const { company } = useUser();+ const { isPhone } = useViewport();const accounts = useAccounts();const { id } = useParams();if (!id) throw new Error("Could not find quote id");@@ -91,109 +94,143 @@ const LineItems = ({const shouldConvertCurrency =routeData?.quote.currencyCode !== company?.baseCurrencyCode;- return (- <VStack spacing={8} className="w-full overflow-hidden">- {routeData?.lines?.map((line) => {- const prices = pricingByLine[line.id!];+ const rows = routeData?.lines?.map((line) => {+ const prices = pricingByLine[line.id!];- const isGlAccount = line.supplierQuoteLineType === "G/L Account";- const itemReadableId = isGlAccount- ? line.description || "Indirect Expense"- : getItemReadableId(items, line.itemId);- const lineDescription = isGlAccount- ? (accounts.find((a) => a.id === line.accountId)?.name ??- "G/L Account")- : distinctItemText(itemReadableId, line.description);- if (!line || !prices || !line.id) {- return null;- }+ const isGlAccount = line.supplierQuoteLineType === "G/L Account";+ const itemReadableId = isGlAccount+ ? line.description || "Indirect Expense"+ : getItemReadableId(items, line.itemId);+ const lineDescription = isGlAccount+ ? (accounts.find((a) => a.id === line.accountId)?.name ?? "G/L Account")+ : distinctItemText(itemReadableId, line.description);+ if (!line || !prices || !line.id) {+ return null;+ }- return (- <motion.div- key={line.id}- initial={{ opacity: 0, y: 8 }}- animate={{ opacity: 1, y: 0 }}- transition={{ duration: 0.2, ease: "easeOut" }}- className="py-6 w-full"- >- <HStack spacing={4} className="items-start">- {line.thumbnailPath ? (- <img- alt={itemReadableId!}- className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg max-md:size-14"- src={getPrivateUrl(line.thumbnailPath)}- />- ) : (- <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 max-md:size-14 max-md:p-3">- <LuImage className="w-16 h-16 text-muted-foreground max-md:size-8" />- </div>- )}+ const pricingOptions = (+ <motion.div+ initial="collapsed"+ animate={openItems.includes(line.id) ? "open" : "collapsed"}+ variants={{+ open: { opacity: 1, height: "auto", marginTop: 16 },+ collapsed: { opacity: 0, height: 0, marginTop: 0 }+ }}+ transition={{ duration: 0.3 }}+ className="w-full overflow-hidden"+ >+ <LinePricingOptions+ formatter={formatter}+ line={line}+ options={pricingByLine[line.id!]}+ quoteCurrency={routeData?.quote.currencyCode ?? "USD"}+ quoteExchangeRate={routeData?.quote.exchangeRate ?? 1}+ shouldConvertCurrency={shouldConvertCurrency}+ locale={locale}+ />+ </motion.div>+ );- <VStack spacing={0} className="flex-1 min-w-0">- <div- className="flex flex-col cursor-pointer w-full"- onClick={() => toggleOpen(line.id!)}- >- <div className="flex items-center gap-x-4 justify-between flex-grow">- <HStack spacing={2} className="min-w-0 flex-shrink">- <Heading className="truncate">{itemReadableId}</Heading>- <Button- asChild- variant="link"- size="sm"- className="text-muted-foreground flex-shrink-0"- >- <Link to={path.to.supplierQuoteLine(id, line.id!)}>- <Trans>Edit</Trans>- </Link>- </Button>- </HStack>- <HStack spacing={4}>- <motion.div- animate={{- rotate: openItems.includes(line.id) ? 90 : 0- }}- transition={{ duration: 0.3 }}- >- <LuChevronRight size={24} />- </motion.div>- </HStack>- </div>- {lineDescription && (- <TruncatedTooltipText- className="text-muted-foreground text-sm truncate"- tooltip={lineDescription}- >- {lineDescription}- </TruncatedTooltipText>- )}- </div>- </VStack>- </HStack>+ // Phones: a text row (no image or Edit link) that opens the prices.+ if (isPhone) {+ return (+ <div key={line.id} className="w-full">+ <SummaryLineRow+ expanded={openItems.includes(line.id)}+ onClick={() => toggleOpen(line.id!)}+ title={itemReadableId}+ value={null}+ trailing={+ <motion.span+ className="self-center text-muted-foreground"+ animate={{ rotate: openItems.includes(line.id) ? 90 : 0 }}+ transition={{ duration: 0.3 }}+ >+ <LuChevronRight className="size-4" />+ </motion.span>+ }+ description={lineDescription}+ />+ {pricingOptions}+ </div>+ );+ }- <motion.div- initial="collapsed"- animate={openItems.includes(line.id) ? "open" : "collapsed"}- variants={{- open: { opacity: 1, height: "auto", marginTop: 16 },- collapsed: { opacity: 0, height: 0, marginTop: 0 }- }}- transition={{ duration: 0.3 }}- className="w-full overflow-hidden"+ return (+ <motion.div+ key={line.id}+ initial={{ opacity: 0, y: 8 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ duration: 0.2, ease: "easeOut" }}+ className="py-6 w-full"+ >+ <HStack spacing={4} className="items-start">+ {line.thumbnailPath ? (+ <img+ alt={itemReadableId!}+ className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg"+ src={getPrivateUrl(line.thumbnailPath)}+ />+ ) : (+ <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4">+ <LuImage className="w-16 h-16 text-muted-foreground" />+ </div>+ )}++ <VStack spacing={0} className="flex-1 min-w-0">+ <div+ className="flex flex-col cursor-pointer w-full"+ onClick={() => toggleOpen(line.id!)}>- <LinePricingOptions- formatter={formatter}- line={line}- options={pricingByLine[line.id!]}- quoteCurrency={routeData?.quote.currencyCode ?? "USD"}- quoteExchangeRate={routeData?.quote.exchangeRate ?? 1}- shouldConvertCurrency={shouldConvertCurrency}- locale={locale}- />- </motion.div>- </motion.div>- );- })}+ <div className="flex items-center gap-x-4 justify-between flex-grow">+ <HStack spacing={2} className="min-w-0 flex-shrink">+ <Heading className="truncate">{itemReadableId}</Heading>+ <Button+ asChild+ variant="link"+ size="sm"+ className="text-muted-foreground flex-shrink-0"+ >+ <Link to={path.to.supplierQuoteLine(id, line.id!)}>+ <Trans>Edit</Trans>+ </Link>+ </Button>+ </HStack>+ <HStack spacing={4}>+ <motion.div+ animate={{+ rotate: openItems.includes(line.id) ? 90 : 0+ }}+ transition={{ duration: 0.3 }}+ >+ <LuChevronRight size={24} />+ </motion.div>+ </HStack>+ </div>+ {lineDescription && (+ <TruncatedTooltipText+ className="text-muted-foreground text-sm truncate"+ tooltip={lineDescription}+ >+ {lineDescription}+ </TruncatedTooltipText>+ )}+ </div>+ </VStack>+ </HStack>++ {pricingOptions}+ </motion.div>+ );+ });++ if (isPhone) {+ return <SummaryLineList>{rows}</SummaryLineList>;+ }++ return (+ <VStack spacing={8} className="w-full overflow-hidden">+ {rows}</VStack>);};diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsxindex 126a5709b6..9ca85ec486 100644--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx@@ -9,7 +9,6 @@ import {CardDescription,CardHeader,CardTitle,- cn,Heading,HStack,RadioGroup,@@ -37,7 +36,7 @@ import {MotionMoney,RevisionSuffix} from "~/components";-import { SummaryLineRow } from "~/components/SummaryLineRow";+import { SummaryLineList, SummaryLineRow } from "~/components/SummaryLineRow";import {useCurrencyDecimals,useCurrencyFormatter,@@ -130,179 +129,172 @@ const LineItems = ({const shouldConvertCurrency =routeData?.quote.currencyCode !== company?.baseCurrencyCode;- return (- <VStack- spacing={8}- className={cn(- "w-full overflow-hidden tracking-tight",- isPhone && "space-y-0 divide-y divide-border"- )}- >- {routeData?.lines?.map((line) => {- const prices = pricingByLine[line.id!];-- if (!line || !prices || !line.id) {- return null;- }-- const selectedLine = selectedLines[line.id] || deselectedLine;- const lineTotal =- (selectedLine.convertedNetUnitPrice ?? 0) *- (selectedLine.quantity ?? 0) +- (selectedLine.convertedAddOn ?? 0) +- (selectedLine.convertedShippingCost ?? 0) +- ((selectedLine.convertedNetUnitPrice ?? 0) *- (selectedLine.quantity ?? 0) +- (selectedLine.convertedTaxableAddOn ?? 0) +- (selectedLine.convertedShippingCost ?? 0)) *- (selectedLine.taxPercent ?? 0);- // The quantity-break picker: a tap on the line opens it.- const pricingOptions = (- <motion.div- initial="collapsed"- animate={openItems.includes(line.id) ? "open" : "collapsed"}- variants={{- open: { opacity: 1, height: "auto", marginTop: 16 },- collapsed: { opacity: 0, height: 0, marginTop: 0 }- }}- transition={{ duration: 0.3 }}- className="w-full overflow-hidden"- >- <LinePricingOptions- formatter={formatter}- line={line}- options={pricingByLine[line.id!]}- quoteCurrency={routeData?.quote.currencyCode ?? "USD"}- quoteExchangeRate={routeData?.quote.exchangeRate ?? 1}- shouldConvertCurrency={shouldConvertCurrency}- locale={locale}- selectedLine={selectedLine}- onSelectQuantity={onSelectQuantity}+ const rows = routeData?.lines?.map((line) => {+ const prices = pricingByLine[line.id!];++ if (!line || !prices || !line.id) {+ return null;+ }++ const selectedLine = selectedLines[line.id] || deselectedLine;+ const lineTotal =+ (selectedLine.convertedNetUnitPrice ?? 0) * (selectedLine.quantity ?? 0) ++ (selectedLine.convertedAddOn ?? 0) ++ (selectedLine.convertedShippingCost ?? 0) ++ ((selectedLine.convertedNetUnitPrice ?? 0) *+ (selectedLine.quantity ?? 0) ++ (selectedLine.convertedTaxableAddOn ?? 0) ++ (selectedLine.convertedShippingCost ?? 0)) *+ (selectedLine.taxPercent ?? 0);+ // The quantity-break picker: a tap on the line opens it.+ const pricingOptions = (+ <motion.div+ initial="collapsed"+ animate={openItems.includes(line.id) ? "open" : "collapsed"}+ variants={{+ open: { opacity: 1, height: "auto", marginTop: 16 },+ collapsed: { opacity: 0, height: 0, marginTop: 0 }+ }}+ transition={{ duration: 0.3 }}+ className="w-full overflow-hidden"+ >+ <LinePricingOptions+ formatter={formatter}+ line={line}+ options={pricingByLine[line.id!]}+ quoteCurrency={routeData?.quote.currencyCode ?? "USD"}+ quoteExchangeRate={routeData?.quote.exchangeRate ?? 1}+ shouldConvertCurrency={shouldConvertCurrency}+ locale={locale}+ selectedLine={selectedLine}+ onSelectQuantity={onSelectQuantity}+ />+ </motion.div>+ );++ // Phones: a text row (no image or Edit link); the line page opens+ // from the Lines tab.+ if (isPhone) {+ return (+ <div key={line.id} className="w-full">+ <SummaryLineRow+ expanded={openItems.includes(line.id)}+ onClick={() => toggleOpen(line.id!)}+ title={line.itemReadableId}+ value={+ <MotionMoney+ value={lineTotal}+ currency={currencyCode}+ decimalPlaces={currencyDecimals}+ />+ }+ trailing={+ <motion.span+ className="self-center text-muted-foreground"+ animate={{ rotate: openItems.includes(line.id) ? 90 : 0 }}+ transition={{ duration: 0.3 }}+ >+ <LuChevronRight className="size-4" />+ </motion.span>+ }+ description={distinctItemText(+ line.itemReadableId,+ line.description+ )}+ meta={+ selectedLine.quantity > 0 ? (+ <>+ {selectedLine.quantity} ×{" "}+ {formatter.format(selectedLine.convertedNetUnitPrice ?? 0)}{" "}+ {line.unitOfMeasureCode}+ </>+ ) : null+ }+ />+ {pricingOptions}+ </div>+ );+ }++ return (+ <motion.div+ key={line.id}+ initial={{ opacity: 0, y: 8 }}+ animate={{ opacity: 1, y: 0 }}+ transition={{ duration: 0.2, ease: "easeOut" }}+ className="border-b border-input py-6 w-full"+ >+ <HStack spacing={4} className="items-start">+ {line.thumbnailPath ? (+ <img+ alt={line.itemReadableId!}+ className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg"+ src={getPrivateUrl(line.thumbnailPath)}/>- </motion.div>- );+ ) : (+ <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4">+ <LuImage className="w-16 h-16 text-muted-foreground" />+ </div>+ )}- // Phones: a text row (no image or Edit link); the line page opens- // from the Lines tab.- if (isPhone) {- return (- <div key={line.id} className="w-full">- <SummaryLineRow- expanded={openItems.includes(line.id)}- onClick={() => toggleOpen(line.id!)}- title={line.itemReadableId}- value={+ <VStack spacing={0} className="flex-1 min-w-0">+ <div+ className="flex flex-col cursor-pointer w-full"+ onClick={() => toggleOpen(line.id!)}+ >+ <div className="flex items-center gap-x-4 justify-between flex-grow">+ <HStack spacing={2} className="min-w-0 flex-shrink">+ <Heading className="truncate">{line.itemReadableId}</Heading>+ <Button+ asChild+ variant="link"+ size="sm"+ className="text-muted-foreground flex-shrink-0"+ >+ <Link to={path.to.quoteLine(quoteId, line.id!)}>Edit</Link>+ </Button>+ </HStack>+ <HStack spacing={4}><MotionMoney+ className="font-semibold text-xl whitespace-nowrap"value={lineTotal}currency={currencyCode}decimalPlaces={currencyDecimals}/>- }- trailing={- <motion.span- className="self-center text-muted-foreground"- animate={{ rotate: openItems.includes(line.id) ? 90 : 0 }}+ <motion.div+ animate={{+ rotate: openItems.includes(line.id) ? 90 : 0+ }}transition={{ duration: 0.3 }}>- <LuChevronRight className="size-4" />- </motion.span>- }- description={distinctItemText(- line.itemReadableId,- line.description- )}- meta={- selectedLine.quantity > 0 ? (- <>- {selectedLine.quantity} ×{" "}- {formatter.format(- selectedLine.convertedNetUnitPrice ?? 0- )}{" "}- {line.unitOfMeasureCode}- </>- ) : null- }- />- {pricingOptions}- </div>- );- }-- return (- <motion.div- key={line.id}- initial={{ opacity: 0, y: 8 }}- animate={{ opacity: 1, y: 0 }}- transition={{ duration: 0.2, ease: "easeOut" }}- className="border-b border-input py-6 w-full"- >- <HStack spacing={4} className="items-start">- {line.thumbnailPath ? (- <img- alt={line.itemReadableId!}- className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg max-md:size-14"- src={getPrivateUrl(line.thumbnailPath)}- />- ) : (- <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 max-md:size-14 max-md:p-3">- <LuImage className="w-16 h-16 text-muted-foreground max-md:size-8" />- </div>+ <LuChevronRight size={24} />+ </motion.div>+ </HStack>+ </div>+ {distinctItemText(line.itemReadableId, line.description) && (+ <TruncatedTooltipText+ className="text-muted-foreground text-sm truncate"+ tooltip={line.description}+ >+ {line.description}+ </TruncatedTooltipText>)}+ </div>+ </VStack>+ </HStack>- <VStack spacing={0} className="flex-1 min-w-0">- <div- className="flex flex-col cursor-pointer w-full"- onClick={() => toggleOpen(line.id!)}- >- <div className="flex items-center gap-x-4 justify-between flex-grow max-md:flex-wrap max-md:gap-y-2">- <HStack spacing={2} className="min-w-0 flex-shrink">- <Heading className="truncate">- {line.itemReadableId}- </Heading>- <Button- asChild- variant="link"- size="sm"- className="text-muted-foreground flex-shrink-0"- >- <Link to={path.to.quoteLine(quoteId, line.id!)}>- Edit- </Link>- </Button>- </HStack>- <HStack spacing={4}>- <MotionMoney- className="font-semibold text-xl whitespace-nowrap"- value={lineTotal}- currency={currencyCode}- decimalPlaces={currencyDecimals}- />- <motion.div- animate={{- rotate: openItems.includes(line.id) ? 90 : 0- }}- transition={{ duration: 0.3 }}- >- <LuChevronRight size={24} />- </motion.div>- </HStack>- </div>- {distinctItemText(line.itemReadableId, line.description) && (- <TruncatedTooltipText- className="text-muted-foreground text-sm truncate"- tooltip={line.description}- >- {line.description}- </TruncatedTooltipText>- )}- </div>- </VStack>- </HStack>+ {pricingOptions}+ </motion.div>+ );+ });- {pricingOptions}- </motion.div>- );- })}+ if (isPhone) {+ return <SummaryLineList className="tracking-tight">{rows}</SummaryLineList>;+ }++ return (+ <VStack spacing={8} className="w-full overflow-hidden tracking-tight">+ {rows}</VStack>);};diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsxindex 31cbff2d8f..ec8a5eb27c 100644--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsx+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsx@@ -59,7 +59,7 @@ import {MotionMoney} from "~/components";import { Confirm } from "~/components/Modals";-import { SummaryLineRow } from "~/components/SummaryLineRow";+import { SummaryLineList, SummaryLineRow } from "~/components/SummaryLineRow";import {useCurrencyDecimals,useCurrencyFormatter,@@ -409,7 +409,7 @@ function LineItems({// badges and the breakdown stay on desktop).if (isPhone) {return (- <div className="flex w-full flex-col divide-y divide-border">+ <SummaryLineList>{lines.map((line) =>line.id ? (<SummaryLineRow@@ -442,7 +442,7 @@ function LineItems({/>) : null)}- </div>+ </SummaryLineList>);}@@ -476,12 +476,12 @@ function LineItems({{line.thumbnailPath ? (<imgalt={line.itemReadableId!}- className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg max-md:size-14"+ className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg"src={getPrivateUrl(line.thumbnailPath)}/>) : (- <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4 max-md:size-14 max-md:p-3">- <LuImage className="w-16 h-16 text-muted-foreground max-md:size-8" />+ <div className="w-24 h-24 shrink-0 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-4">+ <LuImage className="w-16 h-16 text-muted-foreground" /></div>)}@@ -495,11 +495,8 @@ function LineItems({children need w-full because VStack is items-start, whichsizes each child to its own content and leaves truncateinert no matter how narrow the column gets. */}- <div className="flex items-center justify-between w-full max-md:flex-wrap max-md:gap-y-2">- <VStack- spacing={0}- className="flex-1 min-w-0 max-md:basis-full"- >+ <div className="flex items-center justify-between w-full">+ <VStack spacing={0} className="flex-1 min-w-0"><HStack spacing={2} className="flex min-w-0 w-full"><Heading className="truncate">{title}</Heading><Button@@ -524,7 +521,7 @@ function LineItems({</VStack><VStackspacing={2}- className="flex-shrink-0 items-end w-auto max-md:basis-full max-md:items-start"+ className="flex-shrink-0 items-end w-auto"><HStack spacing={4}><MotionMoney@@ -572,7 +569,7 @@ function LineItems({<Badge variant={jobVariant}>{jobLabel}</Badge>{jobs.length > 0 && (<Tooltip>- <TooltipTrigger className="max-md:hit-area">+ <TooltipTrigger><Badge variant="secondary">{jobs.length} <Trans>Jobs</Trans><LuEllipsisVertical className="w-3 h-3 ml-2" />diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.poindex 221f8bcd61..ba5d0a45be 100644--- a/packages/locale/locales/de/erp.po+++ b/packages/locale/locales/de/erp.po@@ -18868,9 +18868,6 @@ msgstr "Richten Sie Ihre Ressourcen und Einstellungen ein"msgid "Set Version {0} as Active Version?"msgstr "Version {0} als aktive Version festlegen?"-msgid "Set when the unit was created"-msgstr ""-msgid "Set your default location in profile settings to pick a storage unit."msgstr "Legen Sie Ihren Standardort in den Profileinstellungen fest, um eine Lagereinheit auszuwählen."diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.poindex 7083389d06..5cde8d43a9 100644--- a/packages/locale/locales/en/erp.po+++ b/packages/locale/locales/en/erp.po@@ -18868,9 +18868,6 @@ msgstr "Set up your resources and settings"msgid "Set Version {0} as Active Version?"msgstr "Set Version {0} as Active Version?"-msgid "Set when the unit was created"-msgstr "Set when the unit was created"-msgid "Set your default location in profile settings to pick a storage unit."msgstr "Set your default location in profile settings to pick a storage unit."diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.poindex 5fc4efef6f..6e5fc77bcb 100644--- a/packages/locale/locales/es/erp.po+++ b/packages/locale/locales/es/erp.po@@ -18868,9 +18868,6 @@ msgstr "Configura tus recursos y configuración"msgid "Set Version {0} as Active Version?"msgstr "¿Establecer la versión {0} como versión activa?"-msgid "Set when the unit was created"-msgstr ""-msgid "Set your default location in profile settings to pick a storage unit."msgstr "Establece tu ubicación predeterminada en la configuración del perfil para seleccionar una unidad de almacenamiento."diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.poindex 24622d1187..f621bdbdd1 100644--- a/packages/locale/locales/fr/erp.po+++ b/packages/locale/locales/fr/erp.po@@ -18868,9 +18868,6 @@ msgstr "Configurez vos ressources et paramètres"msgid "Set Version {0} as Active Version?"msgstr "Définir la version {0} comme version active ?"-msgid "Set when the unit was created"-msgstr ""-msgid "Set your default location in profile settings to pick a storage unit."msgstr "Définissez votre emplacement par défaut dans les paramètres de profil pour sélectionner une unité de stockage."diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.poindex 807000f1f0..d51d4f18bf 100644--- a/packages/locale/locales/hi/erp.po+++ b/packages/locale/locales/hi/erp.po@@ -18868,9 +18868,6 @@ msgstr "अपने संसाधन और सेटिंग्स सेmsgid "Set Version {0} as Active Version?"msgstr "संस्करण {0} को सक्रिय संस्करण के रूप में सेट करें?"-msgid "Set when the unit was created"-msgstr ""-msgid "Set your default location in profile settings to pick a storage unit."msgstr "एक भंडारण इकाई चुनने के लिए प्रोफ़ाइल सेटिंग्स में अपना डिफ़ॉल्ट स्थान सेट करें।"diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.poindex f306e11b4f..a975e092a1 100644--- a/packages/locale/locales/it/erp.po+++ b/packages/locale/locales/it/erp.po@@ -18868,9 +18868,6 @@ msgstr "Configura le tue risorse e impostazioni"msgid "Set Version {0} as Active Version?"msgstr "Imposta la versione {0} come versione attiva?"-msgid "Set when the unit was created"-msgstr ""-msgid "Set your default location in profile settings to pick a storage unit."msgstr "Imposta la tua ubicazione predefinita nelle impostazioni del profilo per scegliere un'unità di stoccaggio."diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.poindex 2c0de47f92..61bd9fac3e 100644--- a/packages/locale/locales/ja/erp.po+++ b/packages/locale/locales/ja/erp.po@@ -18868,9 +18868,6 @@ msgstr "リソースと設定をセットアップする"msgid "Set Version {0} as Active Version?"msgstr "バージョン {0} をアクティブバージョンとして設定しますか?"-msgid "Set when the unit was created"-msgstr ""-msgid "Set your default location in profile settings to pick a storage unit."msgstr "プロフィール設定でデフォルトの場所を設定して、保管ユニットを選択してください。"diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.poindex bca7a0492b..ec1fee158e 100644--- a/packages/locale/locales/ko/erp.po+++ b/packages/locale/locales/ko/erp.po@@ -18868,9 +18868,6 @@ msgstr "자원 및 설정 구성"msgid "Set Version {0} as Active Version?"msgstr "버전 {0}을(를) 활성 버전으로 설정하시겠습니까?"-msgid "Set when the unit was created"-msgstr ""-msgid "Set your default location in profile settings to pick a storage unit."msgstr "프로필 설정에서 기본 사업장을 설정하여 보관 단위를 선택하세요."diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.poindex a4d88112a3..2c0b2c08b5 100644--- a/packages/locale/locales/pl/erp.po+++ b/packages/locale/locales/pl/erp.po@@ -18868,9 +18868,6 @@ msgstr "Skonfiguruj swoje zasoby i ustawienia"msgid "Set Version {0} as Active Version?"msgstr "Ustawić wersję {0} jako aktywną wersję?"-msgid "Set when the unit was created"-msgstr ""-msgid "Set your default location in profile settings to pick a storage unit."msgstr "Ustaw swoją domyślną lokalizację w ustawieniach profilu, aby wybrać jednostkę magazynową."diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.poindex 5fb12b6c82..bb973b5207 100644--- a/packages/locale/locales/pt/erp.po+++ b/packages/locale/locales/pt/erp.po@@ -18868,9 +18868,6 @@ msgstr "Configure seus recursos e configurações"msgid "Set Version {0} as Active Version?"msgstr "Definir Versão {0} como Versão Ativa?"-msgid "Set when the unit was created"-msgstr ""-msgid "Set your default location in profile settings to pick a storage unit."msgstr "Defina sua localização padrão nas configurações de perfil para escolher uma unidade de armazenamento."diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.poindex dd8b3fb2ed..148bc919ef 100644--- a/packages/locale/locales/ru/erp.po+++ b/packages/locale/locales/ru/erp.po@@ -18868,9 +18868,6 @@ msgstr "Настройте ваши ресурсы и параметры"msgid "Set Version {0} as Active Version?"msgstr "Установить версию {0} как активную версию?"-msgid "Set when the unit was created"-msgstr ""-msgid "Set your default location in profile settings to pick a storage unit."msgstr "Установите местоположение по умолчанию в настройках профиля, чтобы выбрать единицу хранения."diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.poindex 07097485cf..954905ae4b 100644--- a/packages/locale/locales/tr/erp.po+++ b/packages/locale/locales/tr/erp.po@@ -18868,9 +18868,6 @@ msgstr "Kaynaklarınızı ve ayarlarınızı ayarlayın"msgid "Set Version {0} as Active Version?"msgstr "Sürüm {0}\"ü Aktif Sürüm Olarak Ayarla?"-msgid "Set when the unit was created"-msgstr ""-msgid "Set your default location in profile settings to pick a storage unit."msgstr "Bir depolama birimi seçmek için varsayılan konumunuzu profil ayarlarınızda belirleyin."diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.poindex 09523985ea..eb054c7f15 100644--- a/packages/locale/locales/zh/erp.po+++ b/packages/locale/locales/zh/erp.po@@ -18868,9 +18868,6 @@ msgstr "设置您的资源和设置"msgid "Set Version {0} as Active Version?"msgstr "将版本 {0} 设置为启用版本?"-msgid "Set when the unit was created"-msgstr ""-msgid "Set your default location in profile settings to pick a storage unit."msgstr "在个人资料设置中设置默认地点以选择存储单元。"diff --git a/packages/react/src/BottomSheet.tsx b/packages/react/src/BottomSheet.tsxindex 8243993033..3748f82cdd 100644--- a/packages/react/src/BottomSheet.tsx+++ b/packages/react/src/BottomSheet.tsx@@ -201,6 +201,26 @@ const BottomSheetDescription = forwardRef<));BottomSheetDescription.displayName = "BottomSheetDescription";+/** One 48pt row of a phone sheet: a menu item, an option or a link. */+const sheetRowClassName =+ "relative flex min-h-12 w-full select-none items-center gap-3 rounded-sm px-3 text-left text-[15px] text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent active:bg-accent disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50";++/** The uppercase label over a section of sheet rows. */+const SheetSectionLabel = forwardRef<+ HTMLDivElement,+ HTMLAttributes<HTMLDivElement>+>(({ className, ...props }, ref) => (+ <div+ ref={ref}+ className={cn(+ "px-3 pt-3 pb-1 text-xs font-medium uppercase tracking-[0.04em] text-muted-foreground",+ className+ )}+ {...props}+ />+));+SheetSectionLabel.displayName = "SheetSectionLabel";+export {BottomSheet,BottomSheetBack,@@ -211,5 +231,7 @@ export {BottomSheetFooter,BottomSheetHeader,BottomSheetTitle,- BottomSheetTrigger+ BottomSheetTrigger,+ SheetSectionLabel,+ sheetRowClassName};diff --git a/packages/react/src/MenuSheet.tsx b/packages/react/src/MenuSheet.tsxindex df1ce8a887..a17744837e 100644--- a/packages/react/src/MenuSheet.tsx+++ b/packages/react/src/MenuSheet.tsx@@ -28,7 +28,9 @@ import {BottomSheetBody,BottomSheetContent,BottomSheetHeader,- BottomSheetTitle+ BottomSheetTitle,+ SheetSectionLabel,+ sheetRowClassName} from "./BottomSheet";import type { PopperPositionProps } from "./PopupSheet";import { cn } from "./utils/cn";@@ -195,9 +197,6 @@ export const MenuSheetContent = forwardRef<);MenuSheetContent.displayName = "MenuSheetContent";-const rowClassName =- "relative flex min-h-12 w-full select-none items-center gap-3 rounded-sm px-3 text-left text-[15px] text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent active:bg-accent disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50";-type ItemProps = Omit<ComponentPropsWithoutRef<"button">, "onSelect"> & {asChild?: boolean;disabled?: boolean;@@ -248,7 +247,7 @@ export const MenuSheetItem = forwardRef<HTMLButtonElement, ItemProps>(disabled={asChild ? undefined : disabled}aria-disabled={disabled || undefined}className={cn(- rowClassName,+ sheetRowClassName,destructive && "text-destructive",className)}@@ -344,16 +343,7 @@ export const MenuSheetLabel = forwardRef<>(({ className, inset: _inset, ...props }, ref) => {const onPage = useOnPage();if (!onPage) return null;- return (- <div- ref={ref}- className={cn(- "px-3 pt-3 pb-1 text-xs font-medium uppercase tracking-[0.04em] text-muted-foreground",- className- )}- {...props}- />- );+ return <SheetSectionLabel ref={ref} className={className} {...props} />;});MenuSheetLabel.displayName = "MenuSheetLabel";@@ -413,7 +403,7 @@ export const MenuSheetSubTrigger = forwardRef<HTMLButtonElement, ItemProps>(role="menuitem"aria-haspopup="menu"disabled={disabled}- className={cn(rowClassName, className)}+ className={cn(sheetRowClassName, className)}{...props}onClick={() => push({ id: subId, label: children })}>diff --git a/packages/react/src/SelectSheet.tsx b/packages/react/src/SelectSheet.tsxindex 66c31b4ee9..76f96c47c7 100644--- a/packages/react/src/SelectSheet.tsx+++ b/packages/react/src/SelectSheet.tsx@@ -13,7 +13,9 @@ import {BottomSheetContent,BottomSheetHeader,BottomSheetTitle,- BottomSheetTrigger+ BottomSheetTrigger,+ SheetSectionLabel,+ sheetRowClassName} from "./BottomSheet";import { useIsomorphicLayoutEffect } from "./hooks/useIsomorphicLayoutEffect";import type { PopperPositionProps } from "./PopupSheet";@@ -252,10 +254,7 @@ export const SelectSheetItem = forwardRef<role="option"aria-selected={checked}disabled={disabled}- className={cn(- "relative flex min-h-12 w-full select-none items-center gap-3 rounded-sm px-3 text-left text-[15px] text-foreground outline-none hover:bg-accent focus-visible:bg-accent active:bg-accent disabled:pointer-events-none disabled:opacity-50",- className- )}+ className={cn(sheetRowClassName, className)}onClick={() => sheet.select(value)}{...props}>@@ -295,16 +294,7 @@ export const SelectSheetLabel = forwardRef<>(({ className, ...props }, ref) => {const registryOnly = useContext(RegistryContext);if (registryOnly) return null;- return (- <div- ref={ref}- className={cn(- "px-3 pt-3 pb-1 text-xs font-medium uppercase tracking-[0.04em] text-muted-foreground",- className- )}- {...props}- />- );+ return <SheetSectionLabel ref={ref} className={className} {...props} />;});SelectSheetLabel.displayName = "SelectSheetLabel";diff --git a/packages/react/src/SplitButton.tsx b/packages/react/src/SplitButton.tsxindex 218214fbb2..7291858d1e 100644--- a/packages/react/src/SplitButton.tsx+++ b/packages/react/src/SplitButton.tsx@@ -51,73 +51,57 @@ const SplitButton = forwardRef<HTMLButtonElement, SplitButtonProps>(},ref) => {- // Phones, in a record action's bar cell or sheet row: the main button- // fills the space and the chevron keeps a 44pt cell. Its own Buttons- // render plainly (the boundary) so only these classes apply.+ // Phones, in a record action's bar cell or sheet row: the main Button+ // reads the presentation itself; the chevron keeps a 44pt cell.const presentation = useActionPresentation();const presented = presentation !== null;// A bar cell shows the main action only; the dropdown's items become// rows of the record's ⋯, so the 44pt bar has one target.const inBar = presentation?.kind === "bar";- const mainVariant =- presentation?.kind === "bar"- ? presentation.emphasis- : presentation?.kind === "row"- ? "ghost"- : variant;+ const chevronVariant = presentation?.kind === "row" ? "ghost" : variant;return (- <ActionPresentationBoundary>- <div className={cn("flex", presented && "w-full min-w-0")}>- <Button- ref={ref}- onClick={- presentation?.kind === "row"- ? () => {- onClick?.();- setTimeout(presentation.onSelect, 0);- }- : onClick- }- leftIcon={leftIcon}- variant={mainVariant}- size={presented ? "lg" : size}- isLoading={isLoading}- isDisabled={isDisabled}- className={cn(- !inBar &&- `rounded-r-none before:rounded-r-none hover:scale-100 focus-visible:scale-100`,- presented && "min-w-0 flex-1",- presentation?.kind === "row" &&- "h-12 justify-start rounded-sm px-3 text-[15px] font-normal text-foreground shadow-none",- className- )}- >- {children}- </Button>- {inBar ? (- presentation.overflow?.(- dropdownItems.map((item, index) => (- <Button- key={index}- variant="secondary"- leftIcon={item.icon}- isDisabled={item.disabled}- onClick={item.onClick}- >- {item.label}- </Button>- ))- )- ) : (+ <div className={cn("flex", presented && "w-full min-w-0")}>+ <Button+ ref={ref}+ onClick={onClick}+ leftIcon={leftIcon}+ variant={variant}+ size={size}+ isLoading={isLoading}+ isDisabled={isDisabled}+ className={cn(+ !inBar &&+ `rounded-r-none before:rounded-r-none hover:scale-100 focus-visible:scale-100`,+ className+ )}+ >+ {children}+ </Button>+ {inBar ? (+ presentation.overflow?.(+ dropdownItems.map((item, index) => (+ <Button+ key={index}+ variant="secondary"+ leftIcon={item.icon}+ isDisabled={item.disabled}+ onClick={item.onClick}+ >+ {item.label}+ </Button>+ ))+ )+ ) : (+ <ActionPresentationBoundary><DropdownMenu><DropdownMenuTrigger asChild><Button- variant={mainVariant}+ variant={chevronVariant}size={presented ? "lg" : size}isDisabled={isDisabled || isLoading}className={cn("rounded-l-none border-l px-1 before:rounded-l-none border-none shadow-none",- mainVariant === "primary" &&+ chevronVariant === "primary" &&"dark:shadow-[inset_0px_0.5px_0px_rgb(255_255_255_/_0.32)] dark:hover:shadow-button-primary hover:scale-100 focus-visible:scale-100",presented && "w-11 shrink-0 justify-center px-0")}@@ -138,9 +122,9 @@ const SplitButton = forwardRef<HTMLButtonElement, SplitButtonProps>())}</DropdownMenuContent></DropdownMenu>- )}- </div>- </ActionPresentationBoundary>+ </ActionPresentationBoundary>+ )}+ </div>);});diff --git a/packages/react/src/TabBar.tsx b/packages/react/src/TabBar.tsxindex 03e3dd6b5e..0447addc7b 100644--- a/packages/react/src/TabBar.tsx+++ b/packages/react/src/TabBar.tsx@@ -2,7 +2,8 @@// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,// including ports, remain AGPLv3; serving them over a network requires releasing their source.-import type { HTMLAttributes, ReactNode } from "react";+import type { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from "react";+import { forwardRef } from "react";import { Link } from "react-router";import { cn } from "./utils/cn";@@ -38,67 +39,76 @@ type TabBarItemProps = {pill?: boolean;} & (| { to: string; onClick?: never }- | {- to?: never;- onClick: () => void;- /** Buttons that open a sheet: announce it. */- "aria-haspopup"?: "dialog";- "aria-expanded"?: boolean;- }+ // A button; it can be a Radix trigger (`asChild`) for a menu or sheet.+ | ({ to?: never } & Omit<+ ButtonHTMLAttributes<HTMLButtonElement>,+ "children" | "className"+ >));/** One tab: a link when `to` is set, else a button. */-export function TabBarItem(props: TabBarItemProps) {- const { icon, label, isActive = false, count, pill = false } = props;- const content = (- <>- <span- className={cn(- "relative flex items-center justify-center [&>svg]:size-5",- pill ? "h-7 w-12 rounded-full" : "size-6",- pill && isActive && "bg-active",- isActive ? "text-foreground" : "text-muted-foreground"- )}- >- {icon}- {count ? (- <span className="absolute -top-1 left-1/2 ml-1 h-4 min-w-4 rounded-full bg-primary px-1 text-center text-[10px] font-medium leading-4 text-primary-foreground tabular-nums">- {count}- </span>- ) : null}- </span>- <span- className={cn(- "max-w-full truncate",- isActive ? "text-foreground" : "text-muted-foreground"- )}- >- {label}- </span>- </>- );+export const TabBarItem = forwardRef<HTMLButtonElement, TabBarItemProps>(+ (props, ref) => {+ const { icon, label, isActive = false, count, pill = false } = props;+ const content = (+ <>+ <span+ className={cn(+ "relative flex items-center justify-center [&>svg]:size-5",+ pill ? "h-7 w-12 rounded-full" : "size-6",+ pill && isActive && "bg-active",+ isActive ? "text-foreground" : "text-muted-foreground"+ )}+ >+ {icon}+ {count ? (+ <span className="absolute -top-1 left-1/2 ml-1 h-4 min-w-4 rounded-full bg-primary px-1 text-center text-[10px] font-medium leading-4 text-primary-foreground tabular-nums">+ {count}+ </span>+ ) : null}+ </span>+ <span+ className={cn(+ "max-w-full truncate",+ isActive ? "text-foreground" : "text-muted-foreground"+ )}+ >+ {label}+ </span>+ </>+ );++ if (props.to !== undefined) {+ return (+ <Link+ to={props.to}+ className={tabBarItemClassName}+ aria-current={isActive ? "page" : undefined}+ >+ {content}+ </Link>+ );+ }- if (props.to !== undefined) {+ const {+ icon: _icon,+ label: _label,+ isActive: _isActive,+ count: _count,+ pill: _pill,+ to: _to,+ ...buttonProps+ } = props;return (- <Link- to={props.to}+ <button+ ref={ref}+ type="button"+ {...buttonProps}className={tabBarItemClassName}- aria-current={isActive ? "page" : undefined}>{content}- </Link>+ </button>);}-- return (- <button- type="button"- className={tabBarItemClassName}- onClick={props.onClick}- aria-haspopup={props["aria-haspopup"]}- aria-expanded={props["aria-expanded"]}- >- {content}- </button>- );-}+);+TabBarItem.displayName = "TabBarItem";diff --git a/packages/react/src/index.tsx b/packages/react/src/index.tsxindex b26b81a7b6..df05585a71 100644--- a/packages/react/src/index.tsx+++ b/packages/react/src/index.tsx@@ -44,7 +44,9 @@ import {BottomSheetFooter,BottomSheetHeader,BottomSheetTitle,- BottomSheetTrigger+ BottomSheetTrigger,+ SheetSectionLabel,+ sheetRowClassName} from "./BottomSheet";import type { ButtonProps } from "./Button";import { Button, buttonVariants } from "./Button";@@ -624,6 +626,8 @@ export {SelectTrigger,SelectValue,Separator,+ SheetSectionLabel,+ sheetRowClassName,KeyboardKeys,MENU_ITEM_SHORTCUTS,SHORTCUTS,