Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

Remove log noise: Lingui uncompiled-message, react-pdf string children, opaque storage download errors (#1751)

Sidf7f79904167b
diff --git a/.ai/plans/2026-09-28-log-noise.md b/.ai/plans/2026-09-28-log-noise.md
new file mode 100644
index 0000000000..235cfacb31
--- /dev/null
+++ b/.ai/plans/2026-09-28-log-noise.md
@@ -0,0 +1,89 @@
+# Log noise: Lingui "Uncompiled message", react-pdf string children, opaque storage download errors
+
+Three warnings/errors fire on hot paths in production (browser + server) and carry no signal.
+
+## 1. Lingui "Uncompiled message detected!"
+
+**Cause.** `i18n._(x)` with a plain string. Catalogs are compiled by `@lingui/vite-plugin`
+from `.po` with no explicit ids, so every key is `generateMessageId(msgid)` (a hash) —
+`@lingui/format-po` line 123. A plain-string lookup never matches, falls back to the
+string, and — because no runtime message compiler is installed — `@lingui/core` calls
+`console.warn` unconditionally (no NODE_ENV guard). So these calls never translated
+anything; they only cost a formatted warning per call, per render.
+
+**Inventory** (type-checker driven: every `i18n._` / `i18n.t` / `t(...)` whose argument
+type admits `string`, over the ERP and MES programs incl. workspace packages, strict
+null checks forced): 11 ERP sites, 0 MES.
+
+| Site | Arg is | Fix |
+|---|---|---|
+| `components/Layout/Topbar/Breadcrumbs.tsx:72` | entity readable ids + 15 literal handles | pass strings through; literal handles → `` msg`` `` |
+| `components/Table/Table.tsx:306` | column headers (already `t```) + "Actions"/"Expand"/"Collapse row"/"Expand row" | drop helper; literals → `` t`` `` |
+| `components/Table/components/Columns.tsx:42` | column headers | drop helper |
+| `components/Table/components/Filter/Filter.tsx:85` | filter headers / option helper text | drop helper |
+| `components/Table/components/Filter/ActiveFilters.tsx:140` | filter headers, option labels (data) | drop helper |
+| `components/Table/components/TableHeader.tsx:171` | saved-view name (data) / title (already `t```) | drop helper |
+| `components/New.tsx:32` | label (callers pass `t```; one literal) | drop; literal caller → `` t`` `` |
+| `components/Form/CustomerStatus.tsx:38` | customer status names (DB rows) | render raw |
+| `modules/sales/ui/Customer/CustomerHeader.tsx:134` | customer status name (DB) | render raw |
+| `modules/sales/ui/CustomerStatuses/CustomerStatusesTable.tsx:28` | status name (DB) | render raw |
+| `modules/sales/ui/Customers/CustomersTable.tsx:64` | status name (DB) | render raw |
+
+Output is unchanged for every data string (the lookup always missed). The literal
+breadcrumbs / table sr-only labels / "IC Transaction" become real translations.
+
+**Guard.** The Lingui warning itself: once these are gone it only fires on a real
+regression. No extra check.
+
+- [x] Fix the 11 sites
+- [x] `pnpm lingui:extract`: 3 new msgids (Collapse row, Expand row, IC Transaction), filled by hand in 12 locales from existing catalog terminology
+- [x] Re-run the type-checker inventory → 0 hits (ERP + MES)
+
+## 2. react-pdf "Invalid '' string child outside <Text> component"
+
+**Cause.** `{value && <Text>…</Text>}` inside a `<View>` where `value` is `""` (or a
+number `0`) renders the raw value as a View child. Type-checker inventory (strict null
+checks forced — `packages/documents` is not `strict`, which is why TS never flagged it):
+105 sites across 27 PDF files, mostly `PartiesBlock`/`Header`/`Summary` address lines.
+
+**Fix.** Rewrite every `{cond && <X/>}` in `packages/documents/src/pdf/**` as
+`{cond ? <X/> : null}` (188 sites flagged by Biome, booleans included — uniform and
+behaviour-preserving). Fix remaining non-`&&` string children by hand (`Note.tsx`).
+
+**Guard.** None added. Biome 2.3's `nursery/noLeakedRender` was tried and rejected: it
+is syntactic and also flags `a && b ? <X/> : null` (a `&&` in a ternary TEST, which
+cannot leak) — 50 false positives after the rewrite. The react-pdf warning itself is
+the regression signal once the baseline is quiet.
+
+- [x] Codemod `&&` → ternary in `packages/documents/src/pdf/**` (186 sites, 38 files), then `biome format`
+- [x] Non-`&&` leaks: the one remaining inventory hit (`Note.tsx`, `ReactNode` from the
+ rich-text converter called on the doc root) is a false positive — bare text is
+ only returned for text nodes, which render inside `<Text>`
+- [x] Re-run PDF inventory → 0 hits; typecheck `@carbon/documents`
+
+## 3. Storage "Failed to download file" with `StorageUnknownError: {}`
+
+**Cause.** storage-js 2.80 `download()` passes `noResolveJson: true`, so a non-OK
+response (404, 400, 403) is wrapped as `StorageUnknownError(JSON.stringify(Response))`
+= `"{}"`; the status only survives on `error.originalError.status`. The routes log
+neither path nor status, then sleep 1 s and repeat the whole download (company bucket +
+legacy fallback = 4 storage requests) before answering 404/500. The route-level retry is
+redundant: `fetchWithRetry` (`packages/auth/src/lib/supabase/client.ts`) already retries
+5xx/408/524 and network errors with backoff for storage GETs.
+
+**Fix.** `storageErrorStatus(error)` in `@carbon/files` (reads `status` /
+`originalError.status`). In the four copy-pasted routes — ERP + MES
+`file+/preview+/$bucket.$.tsx`, ERP `file+/model+/public.$.tsx`,
+`share+/customer.$id.$.tsx` — download once, log `{ path, status }` once, 404 on a
+missing object, and drop the sleep-and-retry.
+
+- [x] Helper + unit test in `packages/files`
+- [x] Four routes. A miss (`isStorageNotFound`: a 404, or a 400 whose unread body says `"statusCode":"404"` — storage answers a missing object/bucket with 400 and uses 400 for an invalid key too) → 404; any other failure (5xx, auth, no status) → 500
+- [x] Typecheck erp, mes, @carbon/files
+
+## Verification
+
+- [x] scoped typechecks (one filter at a time)
+- [x] `@carbon/files` tests; ERP `Table/utils.test.ts`
+- [ ] Browser: a part detail page + a table page show no "Uncompiled message" warnings;
+ a PDF with an empty address line logs no string-child warning
diff --git a/apps/erp/app/components/Form/CustomerStatus.tsx b/apps/erp/app/components/Form/CustomerStatus.tsx
index cc07fce98c..6d4be5085b 100644
--- a/apps/erp/app/components/Form/CustomerStatus.tsx
+++ b/apps/erp/app/components/Form/CustomerStatus.tsx
@@ -17,7 +17,7 @@ import { useEmptyState } from "./emptyStates";
type CustomerStatusSelectProps = Omit<ComboboxProps, "options">;
const CustomerStatus = (props: CustomerStatusSelectProps) => {
- const { i18n, t } = useLingui();
+ const { t } = useLingui();
const newCustomerStatusModal = useDisclosure();
const [created, setCreated] = useState<string>("");
const triggerRef = useRef<HTMLButtonElement>(null);
@@ -35,7 +35,7 @@ const CustomerStatus = (props: CustomerStatusSelectProps) => {
options={
options.map((o) => ({
value: o.value,
- label: <Enumerable value={i18n._(o.label)} />
+ label: <Enumerable value={o.label} />
})) ?? []
}
emptyMessage={emptyMessage}
diff --git a/apps/erp/app/components/Layout/Topbar/Breadcrumbs.tsx b/apps/erp/app/components/Layout/Topbar/Breadcrumbs.tsx
index a00a2f7d5c..debd1212c8 100644
--- a/apps/erp/app/components/Layout/Topbar/Breadcrumbs.tsx
+++ b/apps/erp/app/components/Layout/Topbar/Breadcrumbs.tsx
@@ -65,11 +65,12 @@ const Breadcrumbs = () => {
const { i18n } = useLingui();
const matches = useMatches();
+ // Only a `msg` descriptor is translatable; a plain string is data (an entity's
+ // readable id) and is shown as-is.
const translateBreadcrumb = (value: unknown): ReactNode => {
if (typeof value === "object" && value !== null && "id" in value) {
return i18n._(value as { id: string; message?: string });
}
- if (typeof value === "string") return i18n._(value);
return value as ReactNode;
};
diff --git a/apps/erp/app/components/New.tsx b/apps/erp/app/components/New.tsx
index 3d280ca51e..f647f3e902 100644
--- a/apps/erp/app/components/New.tsx
+++ b/apps/erp/app/components/New.tsx
@@ -28,8 +28,7 @@ type NewProps = {
};
const New = ({ label, to, variant = "primary" }: NewProps) => {
- const { i18n, t } = useLingui();
- const translatedLabel = label ? i18n._(label) : undefined;
+ const { t } = useLingui();
useEffect(() => {
mountedCount++;
@@ -53,9 +52,7 @@ const New = ({ label, to, variant = "primary" }: NewProps) => {
variant={variant}
shortcut={isSoleNew ? SHORTCUTS.newRecord : undefined}
>
- <Link to={to}>
- {translatedLabel ? `${t`Add`} ${translatedLabel}` : t`Add`}
- </Link>
+ <Link to={to}>{label ? `${t`Add`} ${label}` : t`Add`}</Link>
</Button>
);
};
diff --git a/apps/erp/app/components/Table/Table.tsx b/apps/erp/app/components/Table/Table.tsx
index 004168e74e..492ecc0d11 100644
--- a/apps/erp/app/components/Table/Table.tsx
+++ b/apps/erp/app/components/Table/Table.tsx
@@ -300,11 +300,9 @@ const Table = <T extends object>({
renderExpandedRow,
canExpandRow
}: TableProps<T>) => {
- const { i18n } = useLingui();
+ const { t } = useLingui();
const tableContainerRef = useRef<HTMLDivElement>(null);
- const translateLabel = useCallback((value: string) => i18n._(value), [i18n]);
-
const { currentView, view } = useSavedViews();
/* Expandable Rows */
@@ -450,10 +448,7 @@ const Table = <T extends object>({
exportValues,
sortKeyToLabel,
exportOnlyColumns
- } = useMemo(
- () => buildColumnMaps(columns, translateLabel),
- [columns, translateLabel]
- );
+ } = useMemo(() => buildColumnMaps(columns), [columns]);
// Export-only columns must never render in the grid. Force them hidden in the
// table state without mutating the stored columnVisibility (so saved-view
@@ -474,7 +469,11 @@ const Table = <T extends object>({
...getExpandColumn<T>(
expandedRows,
toggleRowExpanded,
- translateLabel,
+ {
+ expand: t`Expand`,
+ expandRow: t`Expand row`,
+ collapseRow: t`Collapse row`
+ },
canExpandRow
)
);
@@ -484,7 +483,7 @@ const Table = <T extends object>({
}
result.push(...columns);
if (renderContextMenu) {
- result.push(...getActionColumn<T>(renderContextMenu, translateLabel));
+ result.push(...getActionColumn<T>(renderContextMenu, t`Actions`));
}
return result;
}, [
@@ -495,7 +494,7 @@ const Table = <T extends object>({
canExpandRow,
expandedRows,
toggleRowExpanded,
- translateLabel
+ t
]);
const table = useReactTable({
@@ -1235,9 +1234,7 @@ const Table = <T extends object>({
{header.column.columnDef.meta?.icon}
{typeof header.column.columnDef.header ===
"string"
- ? translateLabel(
- header.column.columnDef.header
- )
+ ? header.column.columnDef.header
: flexRender(
header.column.columnDef.header,
header.getContext()
@@ -1302,9 +1299,7 @@ const Table = <T extends object>({
{header.column.columnDef.meta?.icon}
{typeof header.column.columnDef.header ===
"string"
- ? translateLabel(
- header.column.columnDef.header
- )
+ ? header.column.columnDef.header
: flexRender(
header.column.columnDef.header,
header.getContext()
@@ -1520,14 +1515,12 @@ function getRowSelectionColumn<T>(
function getActionColumn<T>(
renderContextMenu: (item: T) => JSX.Element | null,
- translateLabel: (value: string) => string
+ actionsLabel: string
): ColumnDef<T>[] {
return [
{
id: "Actions",
- header: () => (
- <span className="sr-only">{translateLabel("Actions")}</span>
- ),
+ header: () => <span className="sr-only">{actionsLabel}</span>,
cell: (item) => (
<div className="flex justify-end">
<ActionMenu>{renderContextMenu(item.row.original)}</ActionMenu>
@@ -1541,7 +1534,7 @@ function getActionColumn<T>(
function getExpandColumn<T>(
expandedRows: Record<number, boolean>,
toggleRowExpanded: (rowIndex: number) => void,
- translateLabel: (value: string) => string,
+ labels: { expand: string; expandRow: string; collapseRow: string },
canExpandRow?: (row: T) => boolean
): ColumnDef<T>[] {
return [
@@ -1549,7 +1542,7 @@ function getExpandColumn<T>(
id: "Expand",
size: 40,
enablePinning: true,
- header: () => <span className="sr-only">{translateLabel("Expand")}</span>,
+ header: () => <span className="sr-only">{labels.expand}</span>,
cell: ({ row }) => {
// No chevron for rows that have nothing to reveal (tree `hasChildren`).
if (canExpandRow && !canExpandRow(row.original)) return null;
@@ -1562,11 +1555,7 @@ function getExpandColumn<T>(
toggleRowExpanded(row.index);
}}
className="p-1 hover:bg-muted rounded transition-colors text-muted-foreground hover:text-foreground"
- aria-label={
- isExpanded
- ? translateLabel("Collapse row")
- : translateLabel("Expand row")
- }
+ aria-label={isExpanded ? labels.collapseRow : labels.expandRow}
>
{isExpanded ? (
<LuChevronDown className="size-4" />
diff --git a/apps/erp/app/components/Table/components/Columns.tsx b/apps/erp/app/components/Table/components/Columns.tsx
index 780b129786..bdfeb4a8a8 100644
--- a/apps/erp/app/components/Table/components/Columns.tsx
+++ b/apps/erp/app/components/Table/components/Columns.tsx
@@ -37,9 +37,7 @@ const Columns = <T extends object>({
withSelectableRows,
setColumnOrder
}: ColumnsProps<T>) => {
- const { t, i18n } = useLingui();
-
- const translate = (value: string) => i18n._(value);
+ const { t } = useLingui();
return (
<Drawer>
@@ -123,7 +121,7 @@ const Columns = <T extends object>({
/>
<span className="text-sm flex-grow flex items-center gap-2">
{column.columnDef.meta?.icon}
- <>{translate(column.columnDef.header as string)}</>
+ <>{column.columnDef.header as string}</>
</span>
<IconButton
aria-label={t`Toggle column`}
diff --git a/apps/erp/app/components/Table/components/Filter/ActiveFilters.tsx b/apps/erp/app/components/Table/components/Filter/ActiveFilters.tsx
index dae0b2f979..bfefcc33ee 100644
--- a/apps/erp/app/components/Table/components/Filter/ActiveFilters.tsx
+++ b/apps/erp/app/components/Table/components/Filter/ActiveFilters.tsx
@@ -64,7 +64,7 @@ type ActiveFilterProps = {
};
const ActiveFilter = ({ filter, operator, value }: ActiveFilterProps) => {
- const { t, i18n } = useLingui();
+ const { t } = useLingui();
const { hasFilter, removeKey, toggleFilter } = useFilters();
const [open, setOpen] = useState(false);
@@ -118,27 +118,19 @@ const ActiveFilter = ({ filter, operator, value }: ActiveFilterProps) => {
const [first, ...others] = v.split(",");
if (others && others.length > 0) {
return `${1 + others.length} ${
- filter.pluralHeader
- ? translate(filter.pluralHeader)
- : `${translate(filter.header)}s`
+ filter.pluralHeader || `${filter.header}s`
}`;
} else {
if (filter.filter.type === "custom" && filter.filter.getLabel) {
const node = filter.filter.getLabel(first);
if (node == null) return first;
- return typeof node === "string"
- ? translate(node)
- : reactNodeToString(node);
+ return typeof node === "string" ? node : reactNodeToString(node);
}
const node = options.find((o) => o.value === v)?.label ?? "";
- return typeof node === "string"
- ? translate(node)
- : reactNodeToString(node);
+ return typeof node === "string" ? node : reactNodeToString(node);
}
};
- const translate = (text: string) => i18n._(text);
-
return (
<HStack spacing={0}>
<Button
@@ -147,7 +139,7 @@ const ActiveFilter = ({ filter, operator, value }: ActiveFilterProps) => {
size="sm"
variant="secondary"
>
- {translate(filter.header)}
+ {filter.header}
</Button>
<Button className="rounded-none border-l-0" size="sm" variant="secondary">
{operator === "eq" ? (
@@ -232,11 +224,7 @@ const ActiveFilter = ({ filter, operator, value }: ActiveFilterProps) => {
>
<HStack spacing={2}>
<Checkbox isChecked={isChecked} tabIndex={-1} />
- <span>
- {typeof option.label === "string"
- ? translate(option.label)
- : option.label}
- </span>
+ <span>{option.label}</span>
</HStack>
</CommandItem>
);
diff --git a/apps/erp/app/components/Table/components/Filter/Filter.tsx b/apps/erp/app/components/Table/components/Filter/Filter.tsx
index 80679d8192..54080ca07d 100644
--- a/apps/erp/app/components/Table/components/Filter/Filter.tsx
+++ b/apps/erp/app/components/Table/components/Filter/Filter.tsx
@@ -33,7 +33,7 @@ export type FilterProps = Omit<
const Filter = forwardRef<HTMLButtonElement, FilterProps>(
({ filters, trigger = "button", ...props }, ref) => {
- const { t, i18n } = useLingui();
+ const { t } = useLingui();
const {
clearFilters,
getFilter,
@@ -82,16 +82,14 @@ const Filter = forwardRef<HTMLButtonElement, FilterProps>(
}
}, [fetcher.data, activeFilter]);
- const translate = useCallback((value: string) => i18n._(value), [i18n]);
-
const columnFilters = useMemo(
() =>
filters.map((f) => ({
value: f.accessorKey,
- label: translate(f.header),
+ label: f.header,
icon: f.icon
})),
- [filters, translate]
+ [filters]
);
const availableFilters = useMemo(
@@ -233,7 +231,7 @@ const Filter = forwardRef<HTMLButtonElement, FilterProps>(
</CommandGroup>
) : (
<div className="max-h-[300px] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent">
- <CommandGroup heading={translate(activeFilter.header)}>
+ <CommandGroup heading={activeFilter.header}>
{activeOptions.map((option) => {
const isChecked = hasFilter(
activeFilter.accessorKey,
@@ -270,7 +268,7 @@ const Filter = forwardRef<HTMLButtonElement, FilterProps>(
<span>{option.label}</span>
{option.helperText && (
<p className="text-xs text-muted-foreground truncate">
- {translate(option.helperText)}
+ {option.helperText}
</p>
)}
</VStack>
diff --git a/apps/erp/app/components/Table/components/TableHeader.tsx b/apps/erp/app/components/Table/components/TableHeader.tsx
index 0ee748c2da..22da19bbd4 100644
--- a/apps/erp/app/components/Table/components/TableHeader.tsx
+++ b/apps/erp/app/components/Table/components/TableHeader.tsx
@@ -141,7 +141,7 @@ const TableHeader = <T extends object>({
withCsvExport = true,
sort
}: HeaderProps<T>) => {
- const { t, i18n } = useLingui();
+ const { t } = useLingui();
const [params, setParams] = useUrlParams();
const currentFilters = params.getAll("filter").filter(Boolean);
const currentSorts = params.getAll("sort").filter(Boolean);
@@ -166,11 +166,7 @@ const TableHeader = <T extends object>({
}, [fetcher.state, fetcher.data?.success]);
const { currentView, hasView } = useSavedViews();
- const translateText = (value: string | undefined) => {
- if (!value) return value;
- return i18n._(value);
- };
- const viewTitle = translateText(currentView?.name ?? title);
+ const viewTitle = currentView?.name ?? title;
// const viewDescription = currentView?.description ?? "";
const savedViewFormValidator = useMemo(
() =>
diff --git a/apps/erp/app/components/Table/utils.test.ts b/apps/erp/app/components/Table/utils.test.ts
index 1bd662b810..58888f4615 100644
--- a/apps/erp/app/components/Table/utils.test.ts
+++ b/apps/erp/app/components/Table/utils.test.ts
@@ -13,42 +13,37 @@ type Row = {
tags: string[];
};
-const upper = (value: string) => value.toUpperCase();
-
const cols = (...columns: ColumnDef<Row, unknown>[]) => columns;
describe("buildColumnMaps", () => {
it("keeps today's behavior: accessorKey + string header -> accessors + sortKey", () => {
const { accessors, exportValues, sortKeyToLabel } = buildColumnMaps(
- cols({ accessorKey: "type", header: "Type" }),
- upper
+ cols({ accessorKey: "type", header: "Type" })
);
- expect(accessors).toEqual({ type: "TYPE" });
+ expect(accessors).toEqual({ type: "Type" });
expect(exportValues).toEqual({});
- expect(sortKeyToLabel).toEqual({ type: "TYPE" });
+ expect(sortKeyToLabel).toEqual({ type: "Type" });
});
it("throws when an accessorKey contains an underscore", () => {
expect(() =>
- buildColumnMaps(cols({ accessorKey: "a_b", header: "X" }), upper)
+ buildColumnMaps(cols({ accessorKey: "a_b", header: "X" }))
).toThrow(/Cannot contain '_'/);
});
it("allows an underscore in a custom-field accessor (generated id)", () => {
const { accessors } = buildColumnMaps(
- cols({ accessorKey: "customFields->>qzAx_-vk3", header: "Color" }),
- upper
+ cols({ accessorKey: "customFields->>qzAx_-vk3", header: "Color" })
);
- expect(accessors).toEqual({ "customFields->>qzAx_-vk3": "COLOR" });
+ expect(accessors).toEqual({ "customFields->>qzAx_-vk3": "Color" });
});
it("includes a display column (id, no accessor) that has exportValue", () => {
const exportValue = (row: Row) => row.tags.join(", ");
const { accessors, exportValues, sortKeyToLabel } = buildColumnMaps(
- cols({ id: "labels", header: "Labels", meta: { exportValue } }),
- upper
+ cols({ id: "labels", header: "Labels", meta: { exportValue } })
);
- expect(accessors).toEqual({ labels: "LABELS" });
+ expect(accessors).toEqual({ labels: "Labels" });
expect(exportValues.labels).toBe(exportValue);
// a display column is not sortable on the server
expect(sortKeyToLabel).toEqual({});
@@ -61,10 +56,9 @@ describe("buildColumnMaps", () => {
id: "week1",
header: () => null,
meta: { filterHeader: "Week 1", exportValue }
- }),
- upper
+ })
);
- expect(accessors).toEqual({ week1: "WEEK 1" });
+ expect(accessors).toEqual({ week1: "Week 1" });
// JSX-header columns never enter the sort picker
expect(sortKeyToLabel).toEqual({});
});
@@ -76,18 +70,16 @@ describe("buildColumnMaps", () => {
accessorKey: "type",
header: "",
meta: { filterHeader: "Unit of Measure", exportValue }
- }),
- upper
+ })
);
- expect(accessors).toEqual({ type: "UNIT OF MEASURE" });
+ expect(accessors).toEqual({ type: "Unit of Measure" });
// an empty string header still yields a (blank) sort-picker label, unchanged
expect(sortKeyToLabel).toEqual({ type: "" });
});
it("ignores a JSX-header column with no exportValue and no filterHeader", () => {
const { accessors, exportValues, sortKeyToLabel } = buildColumnMaps(
- cols({ id: "week1", header: () => null }),
- upper
+ cols({ id: "week1", header: () => null })
);
expect(accessors).toEqual({});
expect(exportValues).toEqual({});
@@ -101,13 +93,12 @@ describe("buildColumnMaps", () => {
accessorKey: "supplierTypeId",
header: "Type",
meta: { sortBy: "type", exportValue }
- }),
- upper
+ })
);
// value + filter stay on the id; export + sort move to the name
- expect(accessors).toEqual({ supplierTypeId: "TYPE" });
+ expect(accessors).toEqual({ supplierTypeId: "Type" });
expect(exportValues.supplierTypeId).toBe(exportValue);
- expect(sortKeyToLabel).toEqual({ type: "TYPE" });
+ expect(sortKeyToLabel).toEqual({ type: "Type" });
});
});
@@ -121,9 +112,9 @@ describe("exportOnlyColumn", () => {
});
const { accessors, exportValues, sortKeyToLabel, exportOnlyColumns } =
- buildColumnMaps(cols(column), upper);
+ buildColumnMaps(cols(column));
- expect(accessors).toEqual({ itemName: "ITEM NAME" });
+ expect(accessors).toEqual({ itemName: "Item Name" });
expect(exportValues.itemName).toBe(value);
expect(exportOnlyColumns).toEqual(["itemName"]);
// no accessorKey, so it can never reach the server-sort picker
diff --git a/apps/erp/app/components/Table/utils.ts b/apps/erp/app/components/Table/utils.ts
index 5a244d1a75..238617a781 100644
--- a/apps/erp/app/components/Table/utils.ts
+++ b/apps/erp/app/components/Table/utils.ts
@@ -7,11 +7,11 @@ export function getAccessorKey<T>(columnDef: ColumnDef<T, unknown>) {
}
export interface ColumnMaps<T> {
- // accessorKey (or column id for display columns) -> translated header label
+ // accessorKey (or column id for display columns) -> header label
accessors: Record<string, string>;
// export key -> function returning the CSV value for the full row
exportValues: Record<string, (row: T) => unknown>;
- // server sort key (`meta.sortBy ?? accessorKey`) -> translated header label
+ // server sort key (`meta.sortBy ?? accessorKey`) -> header label
sortKeyToLabel: Record<string, string>;
// export keys flagged `meta.exportOnly` — rendered nowhere in the grid but
// still emitted to CSV. Table.tsx force-hides these columns.
@@ -23,8 +23,7 @@ export interface ColumnMaps<T> {
// UI. A column's accessorKey drives value + filter, but sort (meta.sortBy) and
// export (meta.exportValue) can each point at a different field.
export function buildColumnMaps<T>(
- columns: ColumnDef<T, unknown>[],
- translate: (value: string) => string
+ columns: ColumnDef<T, unknown>[]
): ColumnMaps<T> {
const accessors: Record<string, string> = {};
const exportValues: Record<string, (row: T) => unknown> = {};
@@ -52,12 +51,10 @@ export function buildColumnMaps<T>(
// CSV heading: a non-empty string header wins, then filterHeader (covers
// JSX-header and blank-header columns), then a (possibly empty) string
// header — never invents a heading for a JSX header that lacks filterHeader.
- const rawLabel =
+ const exportLabel =
stringHeader && stringHeader.length > 0
? stringHeader
: (filterHeader ?? stringHeader);
- const exportLabel =
- rawLabel !== undefined ? translate(rawLabel) : undefined;
const includeInExport =
(!!accessorKey && stringHeader !== undefined) || !!exportValue;
@@ -77,7 +74,7 @@ export function buildColumnMaps<T>(
// columns (e.g. MRP week columns with a filterHeader) never flood it.
if (accessorKey && stringHeader !== undefined) {
const sortKey = column.meta?.sortBy ?? accessorKey;
- sortKeyToLabel[sortKey] = translate(stringHeader);
+ sortKeyToLabel[sortKey] = stringHeader;
}
}
diff --git a/apps/erp/app/modules/production/ui/Assemblies/AssemblyInstructionsTable.tsx b/apps/erp/app/modules/production/ui/Assemblies/AssemblyInstructionsTable.tsx
index 4b15c5e3d0..c689747177 100644
--- a/apps/erp/app/modules/production/ui/Assemblies/AssemblyInstructionsTable.tsx
+++ b/apps/erp/app/modules/production/ui/Assemblies/AssemblyInstructionsTable.tsx
@@ -10,6 +10,7 @@ import {
VStack
} from "@carbon/react";
import { getItemById, getItemReadableId } from "@carbon/utils";
+import { useLingui } from "@lingui/react/macro";
import type { ColumnDef } from "@tanstack/react-table";
import { memo, useCallback, useMemo, useState } from "react";
import { flushSync } from "react-dom";
@@ -66,6 +67,7 @@ function ProcessingStatus({ status }: { status?: string | null }) {
const AssemblyInstructionsTable = memo(
({ data, count }: AssemblyInstructionsTableProps) => {
+ const { t } = useLingui();
const navigate = useNavigate();
const permissions = usePermissions();
const [items] = useItems();
@@ -277,7 +279,7 @@ const AssemblyInstructionsTable = memo(
primaryAction={
permissions.can("create", "production") && (
<New
- label="Assembly Instruction"
+ label={t`Assembly Instruction`}
to={path.to.newAssemblyInstruction}
/>
)
diff --git a/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx b/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx
index a6fc457734..2f974c9350 100644
--- a/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx
+++ b/apps/erp/app/modules/sales/ui/Customer/CustomerHeader.tsx
@@ -37,7 +37,7 @@ import { path } from "~/utils/path";
import type { CustomerDetail, CustomerStatus } from "../../types";
const CustomerHeader = () => {
- const { i18n, t } = useLingui();
+ const { t } = useLingui();
const { customerId } = useParams();
if (!customerId) throw new Error("Could not find customerId");
@@ -130,11 +130,7 @@ const CustomerHeader = () => {
<Trans>Status</Trans>
</CardAttributeLabel>
<CardAttributeValue>
- {customerStatus ? (
- <Enumerable value={i18n._(customerStatus)} />
- ) : (
- "-"
- )}
+ {customerStatus ? <Enumerable value={customerStatus} /> : "-"}
</CardAttributeValue>
</CardAttribute>
<CardAttribute>
diff --git a/apps/erp/app/modules/sales/ui/CustomerStatuses/CustomerStatusesTable.tsx b/apps/erp/app/modules/sales/ui/CustomerStatuses/CustomerStatusesTable.tsx
index e45c8fad39..5d23f14ca5 100644
--- a/apps/erp/app/modules/sales/ui/CustomerStatuses/CustomerStatusesTable.tsx
+++ b/apps/erp/app/modules/sales/ui/CustomerStatuses/CustomerStatusesTable.tsx
@@ -19,16 +19,11 @@ type CustomerStatusesTableProps = {
const CustomerStatusesTable = memo(
({ data, count }: CustomerStatusesTableProps) => {
- const { t, i18n } = useLingui();
+ const { t } = useLingui();
const [params] = useUrlParams();
const navigate = useNavigate();
const permissions = usePermissions();
- const translateStatus = useCallback(
- (value: string) => i18n._(value),
- [i18n]
- );
-
const customColumns = useCustomColumns<CustomerStatus>("customerStatus");
const columns = useMemo<ColumnDef<CustomerStatus>[]>(() => {
const defaultColumns: ColumnDef<CustomerStatus>[] = [
@@ -37,7 +32,7 @@ const CustomerStatusesTable = memo(
header: t`Customer Status`,
cell: ({ row }) => (
<Hyperlink to={row.original.id}>
- <Enumerable value={translateStatus(row.original.name ?? "")} />
+ <Enumerable value={row.original.name ?? ""} />
</Hyperlink>
),
meta: {
@@ -46,7 +41,7 @@ const CustomerStatusesTable = memo(
}
];
return [...defaultColumns, ...customColumns];
- }, [customColumns, t, translateStatus]);
+ }, [customColumns, t]);
const renderContextMenu = useCallback(
(row: CustomerStatus) => {
diff --git a/apps/erp/app/modules/sales/ui/Customers/CustomersTable.tsx b/apps/erp/app/modules/sales/ui/Customers/CustomersTable.tsx
index 4be10e0cbc..281e2fe4f1 100644
--- a/apps/erp/app/modules/sales/ui/Customers/CustomersTable.tsx
+++ b/apps/erp/app/modules/sales/ui/Customers/CustomersTable.tsx
@@ -8,7 +8,7 @@ import {
} from "@carbon/react";
import { Trans, useLingui } from "@lingui/react/macro";
import type { ColumnDef } from "@tanstack/react-table";
-import { memo, useCallback, useMemo, useState } from "react";
+import { memo, useMemo, useState } from "react";
import {
LuBookMarked,
LuCalendar,
@@ -51,7 +51,7 @@ type CustomersTableProps = {
const CustomersTable = memo(
({ data, count, customerStatuses, tags }: CustomersTableProps) => {
- const { t, i18n } = useLingui();
+ const { t } = useLingui();
const navigate = useNavigate();
const permissions = usePermissions();
const [people] = usePeople();
@@ -60,11 +60,6 @@ const CustomersTable = memo(
null
);
- const translateStatus = useCallback(
- (value: string) => i18n._(value),
- [i18n]
- );
-
const customerTypes = useCustomerTypes();
const companySettings = useCompanySettings();
const showCustomerReadableId =
@@ -103,15 +98,13 @@ const CustomersTable = memo(
{
accessorKey: "status",
header: t`Status`,
- cell: (item) => (
- <Enumerable value={translateStatus(item.getValue<string>())} />
- ),
+ cell: (item) => <Enumerable value={item.getValue<string>()} />,
meta: {
filter: {
type: "static",
options: customerStatuses?.map((status) => ({
value: status.name,
- label: <Enumerable value={translateStatus(status.name ?? "")} />
+ label: <Enumerable value={status.name ?? ""} />
}))
},
pluralHeader: t`Statuses`,
@@ -276,7 +269,6 @@ const CustomersTable = memo(
customColumns,
tags,
t,
- translateStatus,
showCustomerReadableId
]);
diff --git a/apps/erp/app/routes/file+/model+/public.$.tsx b/apps/erp/app/routes/file+/model+/public.$.tsx
index afc359d311..9ce3ae4156 100644
--- a/apps/erp/app/routes/file+/model+/public.$.tsx
+++ b/apps/erp/app/routes/file+/model+/public.$.tsx
@@ -3,8 +3,10 @@ import { getCarbonServiceRole } from "@carbon/auth/client.server";
import {
fileResponseHeaders,
getContentType,
+ isStorageNotFound,
isUnsafeStoragePath,
- storage
+ storage,
+ storageErrorStatus
} from "@carbon/files";
import { getLogger } from "@carbon/logger";
import type { LoaderFunctionArgs } from "react-router";
@@ -38,23 +40,19 @@ export async function loader({ params }: LoaderFunctionArgs) {
// the companyId, which selects the per-company bucket (with legacy fallback).
const companyId = path.split("/")[0];
- async function downloadFile() {
- const result = await storage(client).company(companyId).download(`${path}`);
- if (!result.data) {
- logger.error("Failed to download file", { error: result.error });
- return null;
- }
- return result.data;
- }
-
- let fileData = await downloadFile();
- if (!fileData) {
- // Wait for a second and try again
- await new Promise((resolve) => setTimeout(resolve, 1000));
- fileData = await downloadFile();
- if (!fileData) {
- throw new Error("Failed to download file after retry");
- }
+ // No retry here: the client's fetchWithRetry already retries 5xx and
+ // network failures.
+ const { data: fileData, error } = await storage(client)
+ .company(companyId)
+ .download(path);
+ if (error) {
+ logger.error("Failed to download file", {
+ path,
+ status: storageErrorStatus(error),
+ error
+ });
+ if (await isStorageNotFound(error)) throw notFound("File not found");
+ throw new Response(null, { status: 500 });
}
const headers = fileResponseHeaders(
diff --git a/apps/erp/app/routes/file+/preview+/$bucket.$.tsx b/apps/erp/app/routes/file+/preview+/$bucket.$.tsx
index 723f67a5b3..c223c8b1b9 100644
--- a/apps/erp/app/routes/file+/preview+/$bucket.$.tsx
+++ b/apps/erp/app/routes/file+/preview+/$bucket.$.tsx
@@ -6,9 +6,11 @@ import {
fileResponseHeaders,
getCompanyPrivateBucket,
getContentType,
+ isStorageNotFound,
isUnsafeStoragePath,
LEGACY_PRIVATE_BUCKET,
storage,
+ storageErrorStatus,
TEMP_STAGING_BUCKET
} from "@carbon/files";
import { getLogger } from "@carbon/logger";
@@ -99,33 +101,34 @@ export let loader = async ({ request, params }: LoaderFunctionArgs) => {
if (!transformed.error) {
// imgproxy may negotiate webp via Accept — trust the blob, not the path
contentType = transformed.data.type || "image/jpeg";
- return transformed.data;
+ return transformed;
}
// No imgproxy (stale self-host stack) — fall through to the raw bytes;
// Safari can still render them.
logger.error(transformed.error);
}
// Use the original encoded path for the storage API call
- const result = await source.download(path);
- if (result.error) {
- logger.error("Failed to download file", { error: result.error });
- return null;
- }
- return result.data;
+ return source.download(path);
}
- let fileData = await downloadFile();
- if (!fileData) {
- // Wait for a second and try again
- await new Promise((resolve) => setTimeout(resolve, 1000));
- fileData = await downloadFile();
- if (!fileData) {
- // A missing object is a clean 404, not a 500 — consumers (e.g. the model
- // download flow) branch on the status; an opaque error page body must
- // never be saved to disk as if it were the file.
- return new Response(null, { status: 404 });
- }
+ // No retry here: the client's fetchWithRetry already retries 5xx and
+ // network failures.
+ const result = await downloadFile();
+ if (result.error) {
+ logger.error("Failed to download file", {
+ path,
+ status: storageErrorStatus(result.error),
+ error: result.error
+ });
+ // A missing object is a clean 404, not a 500 — consumers (e.g. the model
+ // download flow) branch on the status; an opaque error page body must
+ // never be saved to disk as if it were the file.
+ // Anything else is a real failure and must not pass for a miss.
+ return new Response(null, {
+ status: (await isStorageNotFound(result.error)) ? 404 : 500
+ });
}
+ const fileData = result.data;
const headers = fileResponseHeaders(
contentType,
diff --git a/apps/erp/app/routes/share+/customer.$id.$.tsx b/apps/erp/app/routes/share+/customer.$id.$.tsx
index 98c33f2ae8..29987dfa02 100644
--- a/apps/erp/app/routes/share+/customer.$id.$.tsx
+++ b/apps/erp/app/routes/share+/customer.$id.$.tsx
@@ -4,9 +4,11 @@ import {
fileResponseHeaders,
getContentType,
hasCompanyPrivateObjectPathPrefix,
+ isStorageNotFound,
isUnsafeStoragePath,
MEDIA_CONTENT_TYPES,
- storage
+ storage,
+ storageErrorStatus
} from "@carbon/files";
import { supportedModelTypes } from "@carbon/files/cad";
import { Ratelimit, redis } from "@carbon/kv";
@@ -113,25 +115,20 @@ export let loader = async ({ params, request }: LoaderFunctionArgs) => {
throw new Error(`File type ${fileType} not supported`);
const contentType = getContentType(fileType);
- async function downloadFile() {
- const result = await storage(serviceRole)
- .company(shareCompanyId)
- .download(`${path}`);
- if (!result.data) {
- logger.error("Failed to download file", { error: result.error });
- return null;
- }
- return result.data;
- }
-
- let fileData = await downloadFile();
- if (!fileData) {
- // Wait for a second and try again
- await new Promise((resolve) => setTimeout(resolve, 1000));
- fileData = await downloadFile();
- if (!fileData) {
- throw new Error("Failed to download file after retry");
- }
+ // No retry here: the client's fetchWithRetry already retries 5xx and
+ // network failures.
+ const { data: fileData, error } = await storage(serviceRole)
+ .company(shareCompanyId)
+ .download(path);
+ if (error) {
+ logger.error("Failed to download file", {
+ path,
+ status: storageErrorStatus(error),
+ error
+ });
+ return new Response(null, {
+ status: (await isStorageNotFound(error)) ? 404 : 500
+ });
}
const headers = fileResponseHeaders(
diff --git a/apps/erp/app/routes/x+/accounting+/cost-centers.tsx b/apps/erp/app/routes/x+/accounting+/cost-centers.tsx
index 3c832db940..ff1f3d29a2 100644
--- a/apps/erp/app/routes/x+/accounting+/cost-centers.tsx
+++ b/apps/erp/app/routes/x+/accounting+/cost-centers.tsx
@@ -11,6 +11,7 @@ import {
TabsTrigger
} from "@carbon/react";
import { msg } from "@lingui/core/macro";
+import { useLingui } from "@lingui/react/macro";
import { useCallback } from "react";
import type { LoaderFunctionArgs } from "react-router";
import { Outlet, redirect, useLoaderData, useNavigate } from "react-router";
@@ -56,6 +57,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
}
export default function Route() {
+ const { t } = useLingui();
const { costCenters } = useLoaderData<typeof loader>();
const navigate = useNavigate();
@@ -90,7 +92,7 @@ export default function Route() {
<TabsTrigger value="list">List View</TabsTrigger>
</TabsList>
<New
- label="Cost Center"
+ label={t`Cost Center`}
to={path.to.newCostCenter}
variant="primary"
/>
diff --git a/apps/erp/app/routes/x+/accounting+/intercompany.tsx b/apps/erp/app/routes/x+/accounting+/intercompany.tsx
index a4ce7f1c08..d5d2c60480 100644
--- a/apps/erp/app/routes/x+/accounting+/intercompany.tsx
+++ b/apps/erp/app/routes/x+/accounting+/intercompany.tsx
@@ -1,6 +1,7 @@
import { requirePermissions } from "@carbon/auth/auth.server";
import { Button, VStack } from "@carbon/react";
import { msg } from "@lingui/core/macro";
+import { useLingui } from "@lingui/react/macro";
import type { LoaderFunctionArgs } from "react-router";
import { Outlet, useFetcher, useLoaderData } from "react-router";
import { New } from "~/components";
@@ -47,6 +48,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
}
export default function IntercompanyRoute() {
+ const { t } = useLingui();
const { data, count } = useLoaderData<typeof loader>();
const [params] = useUrlParams();
const permissions = usePermissions();
@@ -90,7 +92,7 @@ export default function IntercompanyRoute() {
Regenerate
</Button>
</regenerateFetcher.Form>
- <New label="IC Transaction" to={`new?${params.toString()}`} />
+ <New label={t`IC Transaction`} to={`new?${params.toString()}`} />
</div>
)
}
diff --git a/apps/erp/app/routes/x+/credits+/$memoId.tsx b/apps/erp/app/routes/x+/credits+/$memoId.tsx
index f4e37269bc..29d5fdce9a 100644
--- a/apps/erp/app/routes/x+/credits+/$memoId.tsx
+++ b/apps/erp/app/routes/x+/credits+/$memoId.tsx
@@ -3,6 +3,7 @@ import { requirePermissions } from "@carbon/auth/auth.server";
import { flash } from "@carbon/auth/session.server";
import { validationError, validator } from "@carbon/form";
import { VStack } from "@carbon/react";
+import { msg } from "@lingui/core/macro";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";
import { data, redirect, useLoaderData } from "react-router";
import {
@@ -18,7 +19,7 @@ import type { Handle } from "~/utils/handle";
import { path } from "~/utils/path";
export const handle: Handle = {
- breadcrumb: "Credit / Debit Memos",
+ breadcrumb: msg`Credit / Debit Memos`,
to: path.to.memos
};
diff --git a/apps/erp/app/routes/x+/credits+/_layout.tsx b/apps/erp/app/routes/x+/credits+/_layout.tsx
index af35e8bd38..8f12725298 100644
--- a/apps/erp/app/routes/x+/credits+/_layout.tsx
+++ b/apps/erp/app/routes/x+/credits+/_layout.tsx
@@ -1,3 +1,4 @@
+import { msg } from "@lingui/core/macro";
import type { MetaFunction } from "react-router";
import { Outlet } from "react-router";
import type { Handle } from "~/utils/handle";
@@ -8,7 +9,7 @@ export const meta: MetaFunction = () => {
};
export const handle: Handle = {
- breadcrumb: "Invoicing",
+ breadcrumb: msg`Invoicing`,
to: path.to.invoicing,
module: "invoicing"
};
diff --git a/apps/erp/app/routes/x+/invoicing+/card-transactions.tsx b/apps/erp/app/routes/x+/invoicing+/card-transactions.tsx
index 06adbfbdc6..34b43afcb8 100644
--- a/apps/erp/app/routes/x+/invoicing+/card-transactions.tsx
+++ b/apps/erp/app/routes/x+/invoicing+/card-transactions.tsx
@@ -2,6 +2,7 @@ import { error } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import { flash } from "@carbon/auth/session.server";
import { VStack } from "@carbon/react";
+import { msg } from "@lingui/core/macro";
import type { LoaderFunctionArgs } from "react-router";
import { Outlet, redirect, useLoaderData } from "react-router";
import {
@@ -13,7 +14,7 @@ import { path } from "~/utils/path";
import { getGenericQueryFilters } from "~/utils/query";
export const handle: Handle = {
- breadcrumb: "Card Transactions",
+ breadcrumb: msg`Card Transactions`,
to: path.to.cardTransactions,
module: "invoicing"
};
diff --git a/apps/erp/app/routes/x+/invoicing+/credits.tsx b/apps/erp/app/routes/x+/invoicing+/credits.tsx
index acff346283..8c1068f37e 100644
--- a/apps/erp/app/routes/x+/invoicing+/credits.tsx
+++ b/apps/erp/app/routes/x+/invoicing+/credits.tsx
@@ -1,6 +1,7 @@
import { error } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import { flash } from "@carbon/auth/session.server";
+import { msg } from "@lingui/core/macro";
import type { LoaderFunctionArgs } from "react-router";
import { redirect, useLoaderData } from "react-router";
import { getMemos, MemosTable } from "~/modules/invoicing";
@@ -9,7 +10,7 @@ import { path } from "~/utils/path";
import { getGenericQueryFilters } from "~/utils/query";
export const handle: Handle = {
- breadcrumb: "Credit / Debit Memos",
+ breadcrumb: msg`Credit / Debit Memos`,
to: path.to.memos,
module: "invoicing"
};
diff --git a/apps/erp/app/routes/x+/invoicing+/payables.tsx b/apps/erp/app/routes/x+/invoicing+/payables.tsx
index a978dc6061..08d9775e8b 100644
--- a/apps/erp/app/routes/x+/invoicing+/payables.tsx
+++ b/apps/erp/app/routes/x+/invoicing+/payables.tsx
@@ -1,5 +1,6 @@
import { requirePermissions } from "@carbon/auth/auth.server";
import { datetime } from "@carbon/utils";
+import { msg } from "@lingui/core/macro";
import type { LoaderFunctionArgs } from "react-router";
import { useLoaderData } from "react-router";
import {
@@ -14,7 +15,7 @@ import type { Handle } from "~/utils/handle";
import { path } from "~/utils/path";
export const handle: Handle = {
- breadcrumb: "Payables",
+ breadcrumb: msg`Payables`,
to: path.to.payables,
module: "invoicing"
};
diff --git a/apps/erp/app/routes/x+/invoicing+/payments.tsx b/apps/erp/app/routes/x+/invoicing+/payments.tsx
index ab86b84ad7..1cd9ef92ce 100644
--- a/apps/erp/app/routes/x+/invoicing+/payments.tsx
+++ b/apps/erp/app/routes/x+/invoicing+/payments.tsx
@@ -1,6 +1,7 @@
import { error } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import { flash } from "@carbon/auth/session.server";
+import { msg } from "@lingui/core/macro";
import type { LoaderFunctionArgs } from "react-router";
import { redirect, useLoaderData } from "react-router";
import { getPayments, PaymentsTable } from "~/modules/invoicing";
@@ -9,7 +10,7 @@ import { path } from "~/utils/path";
import { getGenericQueryFilters } from "~/utils/query";
export const handle: Handle = {
- breadcrumb: "Payments",
+ breadcrumb: msg`Payments`,
to: path.to.payments,
module: "invoicing"
};
diff --git a/apps/erp/app/routes/x+/invoicing+/receivables.tsx b/apps/erp/app/routes/x+/invoicing+/receivables.tsx
index a8642ab0e8..bed4adb7ac 100644
--- a/apps/erp/app/routes/x+/invoicing+/receivables.tsx
+++ b/apps/erp/app/routes/x+/invoicing+/receivables.tsx
@@ -1,5 +1,6 @@
import { requirePermissions } from "@carbon/auth/auth.server";
import { datetime } from "@carbon/utils";
+import { msg } from "@lingui/core/macro";
import type { LoaderFunctionArgs } from "react-router";
import { useLoaderData } from "react-router";
import {
@@ -14,7 +15,7 @@ import type { Handle } from "~/utils/handle";
import { path } from "~/utils/path";
export const handle: Handle = {
- breadcrumb: "Receivables",
+ breadcrumb: msg`Receivables`,
to: path.to.receivables,
module: "invoicing"
};
diff --git a/apps/erp/app/routes/x+/journal-entry+/$journalEntryId.tsx b/apps/erp/app/routes/x+/journal-entry+/$journalEntryId.tsx
index 1964dbb394..1793abe8e6 100644
--- a/apps/erp/app/routes/x+/journal-entry+/$journalEntryId.tsx
+++ b/apps/erp/app/routes/x+/journal-entry+/$journalEntryId.tsx
@@ -1,6 +1,7 @@
import { error } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
import { flash } from "@carbon/auth/session.server";
+import { msg } from "@lingui/core/macro";
import type { LoaderFunctionArgs } from "react-router";
import { Outlet, redirect, useParams } from "react-router";
import {
@@ -14,7 +15,7 @@ import { path } from "~/utils/path";
export const handle: Handle = {
breadcrumb: detailBreadcrumb(
- { breadcrumb: "Journal Entries", to: path.to.accountingJournals },
+ { breadcrumb: msg`Journal Entries`, to: path.to.accountingJournals },
(data) => data?.journalEntry?.journalEntryId
),
module: "accounting"
diff --git a/apps/erp/app/routes/x+/journal-entry+/_layout.tsx b/apps/erp/app/routes/x+/journal-entry+/_layout.tsx
index 5ce106f736..96555e11cb 100644
--- a/apps/erp/app/routes/x+/journal-entry+/_layout.tsx
+++ b/apps/erp/app/routes/x+/journal-entry+/_layout.tsx
@@ -1,3 +1,4 @@
+import { msg } from "@lingui/core/macro";
import type { MetaFunction } from "react-router";
import { Outlet } from "react-router";
import type { Handle } from "~/utils/handle";
@@ -8,7 +9,7 @@ export const meta: MetaFunction = () => {
};
export const handle: Handle = {
- breadcrumb: "Accounting",
+ breadcrumb: msg`Accounting`,
to: path.to.accountingJournals,
module: "accounting"
};
diff --git a/apps/erp/app/routes/x+/payments+/$paymentId.tsx b/apps/erp/app/routes/x+/payments+/$paymentId.tsx
index 7c5c33cfdc..79e1f95cab 100644
--- a/apps/erp/app/routes/x+/payments+/$paymentId.tsx
+++ b/apps/erp/app/routes/x+/payments+/$paymentId.tsx
@@ -4,6 +4,7 @@ import { flash } from "@carbon/auth/session.server";
import { validationError, validator } from "@carbon/form";
import { VStack } from "@carbon/react";
import type { FundingSource } from "@carbon/utils";
+import { msg } from "@lingui/core/macro";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";
import { data, redirect, useLoaderData } from "react-router";
import {
@@ -29,7 +30,7 @@ import { path } from "~/utils/path";
export const handle: Handle = {
breadcrumb: detailBreadcrumb(
- { breadcrumb: "Payments", to: path.to.payments },
+ { breadcrumb: msg`Payments`, to: path.to.payments },
(data) => data?.payment?.paymentId
),
module: "invoicing"
diff --git a/apps/erp/app/routes/x+/payments+/_layout.tsx b/apps/erp/app/routes/x+/payments+/_layout.tsx
index 1257b30214..16f0477d2e 100644
--- a/apps/erp/app/routes/x+/payments+/_layout.tsx
+++ b/apps/erp/app/routes/x+/payments+/_layout.tsx
@@ -1,3 +1,4 @@
+import { msg } from "@lingui/core/macro";
import type { MetaFunction } from "react-router";
import { Outlet } from "react-router";
import type { Handle } from "~/utils/handle";
@@ -8,7 +9,7 @@ export const meta: MetaFunction = () => {
};
export const handle: Handle = {
- breadcrumb: "Invoicing",
+ breadcrumb: msg`Invoicing`,
to: path.to.invoicing,
module: "invoicing"
};
diff --git a/apps/erp/app/routes/x+/payments+/payment-refund.test.ts b/apps/erp/app/routes/x+/payments+/payment-refund.test.ts
index 10bb666615..42db73f6e5 100644
--- a/apps/erp/app/routes/x+/payments+/payment-refund.test.ts
+++ b/apps/erp/app/routes/x+/payments+/payment-refund.test.ts
@@ -28,6 +28,9 @@ vi.mock("@carbon/form", () => ({
validator: vi.fn()
}));
vi.mock("@carbon/react", () => ({ VStack: vi.fn() }));
+vi.mock("@lingui/core/macro", () => ({
+ msg: (strings: TemplateStringsArray) => ({ id: strings.join("") })
+}));
vi.mock("~/utils/handle", () => ({ detailBreadcrumb: vi.fn() }));
vi.mock("~/utils/form", () => ({ setCustomFields: vi.fn() }));
vi.mock("~/utils/path", () => ({
diff --git a/apps/erp/app/routes/x+/people+/departments.tsx b/apps/erp/app/routes/x+/people+/departments.tsx
index 3b27a863d5..f86af68504 100644
--- a/apps/erp/app/routes/x+/people+/departments.tsx
+++ b/apps/erp/app/routes/x+/people+/departments.tsx
@@ -108,7 +108,7 @@ export default function Route() {
<TabsTrigger value="list">List View</TabsTrigger>
</TabsList>
<New
- label="Department"
+ label={t`Department`}
to={path.to.newDepartment}
variant="primary"
/>
diff --git a/apps/erp/app/routes/x+/sales+/price-list.tsx b/apps/erp/app/routes/x+/sales+/price-list.tsx
index 39f8606d5f..41daf654e6 100644
--- a/apps/erp/app/routes/x+/sales+/price-list.tsx
+++ b/apps/erp/app/routes/x+/sales+/price-list.tsx
@@ -1,5 +1,6 @@
import { requirePermissions } from "@carbon/auth/auth.server";
import { VStack } from "@carbon/react";
+import { msg } from "@lingui/core/macro";
import type { LoaderFunctionArgs } from "react-router";
import { Outlet, useLoaderData } from "react-router";
import { getBaseCatalog, resolvePriceList } from "~/modules/sales";
@@ -9,7 +10,7 @@ import { path } from "~/utils/path";
import { getGenericQueryFilters } from "~/utils/query";
export const handle: Handle = {
- breadcrumb: "Price List",
+ breadcrumb: msg`Price List`,
to: path.to.salesPriceList
};
diff --git a/apps/erp/app/routes/x+/sales+/pricing-rules.tsx b/apps/erp/app/routes/x+/sales+/pricing-rules.tsx
index 8cccfc9931..e820c6efc4 100644
--- a/apps/erp/app/routes/x+/sales+/pricing-rules.tsx
+++ b/apps/erp/app/routes/x+/sales+/pricing-rules.tsx
@@ -1,5 +1,6 @@
import { requirePermissions } from "@carbon/auth/auth.server";
import { VStack } from "@carbon/react";
+import { msg } from "@lingui/core/macro";
import type { LoaderFunctionArgs } from "react-router";
import { Outlet, useLoaderData } from "react-router";
import { getPricingRules } from "~/modules/sales";
@@ -9,7 +10,7 @@ import { path } from "~/utils/path";
import { getGenericQueryFilters } from "~/utils/query";
export const handle: Handle = {
- breadcrumb: "Pricing Rules",
+ breadcrumb: msg`Pricing Rules`,
to: path.to.salesPricingRules
};
diff --git a/apps/erp/app/routes/x+/settings+/companies.tsx b/apps/erp/app/routes/x+/settings+/companies.tsx
index fee4552e3b..321591e7ea 100644
--- a/apps/erp/app/routes/x+/settings+/companies.tsx
+++ b/apps/erp/app/routes/x+/settings+/companies.tsx
@@ -11,6 +11,8 @@ import {
TabsTrigger
} from "@carbon/react";
import { isInternalEmail } from "@carbon/utils";
+import { msg } from "@lingui/core/macro";
+import { useLingui } from "@lingui/react/macro";
import { useCallback } from "react";
import type { LoaderFunctionArgs } from "react-router";
import { Outlet, redirect, useLoaderData, useNavigate } from "react-router";
@@ -24,7 +26,7 @@ import type { Handle } from "~/utils/handle";
import { path } from "~/utils/path";
export const handle: Handle = {
- breadcrumb: "Companies",
+ breadcrumb: msg`Companies`,
to: path.to.companies
};
@@ -56,6 +58,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
}
export default function SubsidiariesRoute() {
+ const { t } = useLingui();
const { companies } = useLoaderData<typeof loader>();
const navigate = useNavigate();
@@ -83,7 +86,7 @@ export default function SubsidiariesRoute() {
<TabsTrigger value="list">List View</TabsTrigger>
</TabsList>
<New
- label="Company"
+ label={t`Company`}
to={path.to.newCompanyInGroup}
variant="primary"
/>
diff --git a/apps/erp/app/routes/x+/settings+/printing.tsx b/apps/erp/app/routes/x+/settings+/printing.tsx
index 66bf4614ba..2fd6ec1a90 100644
--- a/apps/erp/app/routes/x+/settings+/printing.tsx
+++ b/apps/erp/app/routes/x+/settings+/printing.tsx
@@ -14,6 +14,7 @@ import {
import { invalidatePrinterCache } from "@carbon/printing/printing.server";
import { Button, Heading, ScrollArea, VStack } from "@carbon/react";
import { labelSizes } from "@carbon/utils";
+import { msg } from "@lingui/core/macro";
import { Trans } from "@lingui/react/macro";
import { LuPrinter } from "react-icons/lu";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";
@@ -26,7 +27,7 @@ import type { Handle } from "~/utils/handle";
import { path } from "~/utils/path";
export const handle: Handle = {
- breadcrumb: "Printing",
+ breadcrumb: msg`Printing`,
to: path.to.printingSettings
};
diff --git a/apps/mes/app/routes/file+/preview+/$bucket.$.tsx b/apps/mes/app/routes/file+/preview+/$bucket.$.tsx
index 75a89ad0a7..a73e1d7103 100644
--- a/apps/mes/app/routes/file+/preview+/$bucket.$.tsx
+++ b/apps/mes/app/routes/file+/preview+/$bucket.$.tsx
@@ -6,9 +6,11 @@ import {
fileResponseHeaders,
getCompanyPrivateBucket,
getContentType,
+ isStorageNotFound,
isUnsafeStoragePath,
LEGACY_PRIVATE_BUCKET,
storage,
+ storageErrorStatus,
TEMP_STAGING_BUCKET
} from "@carbon/files";
import { getLogger } from "@carbon/logger";
@@ -107,33 +109,34 @@ export let loader = async ({ request, params }: LoaderFunctionArgs) => {
if (!transformed.error) {
// imgproxy may negotiate webp via Accept — trust the blob, not the path
contentType = transformed.data.type || "image/jpeg";
- return transformed.data;
+ return transformed;
}
// No imgproxy (stale self-host stack) — fall through to the raw bytes;
// Safari can still render them.
log.error("Failed to transform HEIC file", { error: transformed.error });
}
// Use the original encoded path for the storage API call
- const result = await source.download(path);
- if (result.error) {
- log.error("Failed to download file", { error: result.error });
- return null;
- }
- return result.data;
+ return source.download(path);
}
- let fileData = await downloadFile();
- if (!fileData) {
- // Wait for a second and try again
- await new Promise((resolve) => setTimeout(resolve, 1000));
- fileData = await downloadFile();
- if (!fileData) {
- // A missing object is a clean 404, not a 500 — consumers (e.g. the model
- // download flow) branch on the status; an opaque error page body must
- // never be saved to disk as if it were the file.
- return new Response(null, { status: 404 });
- }
+ // No retry here: the client's fetchWithRetry already retries 5xx and
+ // network failures.
+ const result = await downloadFile();
+ if (result.error) {
+ log.error("Failed to download file", {
+ path,
+ status: storageErrorStatus(result.error),
+ error: result.error
+ });
+ // A missing object is a clean 404, not a 500 — consumers (e.g. the model
+ // download flow) branch on the status; an opaque error page body must
+ // never be saved to disk as if it were the file.
+ // Anything else is a real failure and must not pass for a miss.
+ return new Response(null, {
+ status: (await isStorageNotFound(result.error)) ? 404 : 500
+ });
}
+ const fileData = result.data;
const headers = fileResponseHeaders(
contentType,
diff --git a/packages/documents/src/pdf/BatchListPDF.tsx b/packages/documents/src/pdf/BatchListPDF.tsx
index 6c73af43c2..a399cad1ac 100644
--- a/packages/documents/src/pdf/BatchListPDF.tsx
+++ b/packages/documents/src/pdf/BatchListPDF.tsx
@@ -85,23 +85,23 @@ export const BatchListPDF = ({
/>
<View style={tw("flex flex-row gap-8 mb-4 text-xs")}>
- {processName && (
+ {processName ? (
<View style={tw("flex flex-col")}>
<Text style={tw("font-bold text-gray-500 uppercase text-[8px]")}>
Process
</Text>
<Text>{processName}</Text>
</View>
- )}
- {workCenterName && (
+ ) : null}
+ {workCenterName ? (
<View style={tw("flex flex-col")}>
<Text style={tw("font-bold text-gray-500 uppercase text-[8px]")}>
Work Center
</Text>
<Text>{workCenterName}</Text>
</View>
- )}
- {batch.createdAt && (
+ ) : null}
+ {batch.createdAt ? (
<View style={tw("flex flex-col")}>
<Text style={tw("font-bold text-gray-500 uppercase text-[8px]")}>
Created
@@ -110,7 +110,7 @@ export const BatchListPDF = ({
{formatDate(batch.createdAt.slice(0, 10), undefined, locale)}
</Text>
</View>
- )}
+ ) : null}
<View style={tw("flex flex-col")}>
<Text style={tw("font-bold text-gray-500 uppercase text-[8px]")}>
Jobs
@@ -132,12 +132,12 @@ export const BatchListPDF = ({
{member.jobReadableId ?? ""}
</Text>
<View style={tw(COL_THUMBNAIL)}>
- {member.thumbnail && (
+ {member.thumbnail ? (
<Image
src={member.thumbnail}
style={tw("w-full h-auto border rounded border-gray-300")}
/>
- )}
+ ) : null}
</View>
<Text style={tw(COL_ITEM)}>{member.itemReadableId ?? ""}</Text>
<Text style={tw(COL_DESCRIPTION)}>
diff --git a/packages/documents/src/pdf/JobTravelerPDF.tsx b/packages/documents/src/pdf/JobTravelerPDF.tsx
index c06bdf99b0..fdb5061506 100644
--- a/packages/documents/src/pdf/JobTravelerPDF.tsx
+++ b/packages/documents/src/pdf/JobTravelerPDF.tsx
@@ -112,7 +112,7 @@ export const JobTravelerPageContent = (props: PageContentProps) => {
if (!render) return null;
return <Fragment key={block.id}>{render({ block, data })}</Fragment>;
})}
- {data.includeMaterials && <MaterialsBlock data={data} />}
+ {data.includeMaterials ? <MaterialsBlock data={data} /> : null}
</View>
);
};
diff --git a/packages/documents/src/pdf/KanbanLabelPDF.tsx b/packages/documents/src/pdf/KanbanLabelPDF.tsx
index 0b8607313a..75c99b194f 100644
--- a/packages/documents/src/pdf/KanbanLabelPDF.tsx
+++ b/packages/documents/src/pdf/KanbanLabelPDF.tsx
@@ -145,7 +145,7 @@ const KanbanLabelPDF = ({
/>
{/* Thumbnail if available */}
- {label.thumbnail && (
+ {label.thumbnail ? (
<Image
src={label.thumbnail}
style={{
@@ -155,7 +155,7 @@ const KanbanLabelPDF = ({
marginLeft: 8
}}
/>
- )}
+ ) : null}
</View>
{/* Item Information */}
diff --git a/packages/documents/src/pdf/ProductLabelPDF.tsx b/packages/documents/src/pdf/ProductLabelPDF.tsx
index 8177170390..a781c2d61e 100644
--- a/packages/documents/src/pdf/ProductLabelPDF.tsx
+++ b/packages/documents/src/pdf/ProductLabelPDF.tsx
@@ -198,7 +198,7 @@ const ProductLabelPDF = ({
>
{textBlocks.map(renderBlock)}
</View>
- {rightBlocks.length > 0 && (
+ {rightBlocks.length > 0 ? (
<View
style={{
...tw("flex flex-col items-end justify-start"),
@@ -207,7 +207,7 @@ const ProductLabelPDF = ({
>
{rightBlocks.map(renderBlock)}
</View>
- )}
+ ) : null}
</View>
{barcodeBlocks.map(renderBlock)}
{entityBlocks.map(renderBlock)}
diff --git a/packages/documents/src/pdf/blocks/KeyValueBlock.tsx b/packages/documents/src/pdf/blocks/KeyValueBlock.tsx
index aaf6236469..80f9e3b2de 100644
--- a/packages/documents/src/pdf/blocks/KeyValueBlock.tsx
+++ b/packages/documents/src/pdf/blocks/KeyValueBlock.tsx
@@ -18,11 +18,11 @@ export function KeyValueBlock({
return (
<View style={tw("border border-gray-200 mb-4")}>
<View style={tw("p-3")}>
- {block.title && (
+ {block.title ? (
<Text style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}>
{block.title}
</Text>
- )}
+ ) : null}
<View style={tw("text-[9px] text-gray-800")}>
{rows.map((row, index) => (
<View
diff --git a/packages/documents/src/pdf/blocks/LineItemsBlock.tsx b/packages/documents/src/pdf/blocks/LineItemsBlock.tsx
index a9872b2a5f..a545f0fdfc 100644
--- a/packages/documents/src/pdf/blocks/LineItemsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/LineItemsBlock.tsx
@@ -97,23 +97,23 @@ export function LineItemsBlock({
{getLineDescriptionDetails(line)}
</Text>
{opts.showThumbnails &&
- thumbnails &&
- line.id &&
- line.id in thumbnails &&
- thumbnails[line.id] && (
- <View style={tw("mt-1 w-16")}>
- <Image
- src={thumbnails[line.id]!}
- style={tw("w-full h-auto")}
- />
- </View>
- )}
- {line.invoiceLineType !== "Comment" && totalTaxAndFees > 0 && (
+ thumbnails &&
+ line.id &&
+ line.id in thumbnails &&
+ thumbnails[line.id] ? (
+ <View style={tw("mt-1 w-16")}>
+ <Image
+ src={thumbnails[line.id]!}
+ style={tw("w-full h-auto")}
+ />
+ </View>
+ ) : null}
+ {line.invoiceLineType !== "Comment" && totalTaxAndFees > 0 ? (
<View style={tw("mt-1")}>
<Text style={tw("text-[9px] text-gray-600 font-bold")}>
Tax & Fees
</Text>
- {lineShippingCost > 0 && (
+ {lineShippingCost > 0 ? (
<View style={tw("flex flex-row justify-between")}>
<Text
style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
@@ -124,8 +124,8 @@ export function LineItemsBlock({
{numberFormatter.format(lineShippingCost)}
</Text>
</View>
- )}
- {lineAddOnCost > 0 && (
+ ) : null}
+ {lineAddOnCost > 0 ? (
<View style={tw("flex flex-row justify-between")}>
<Text
style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
@@ -136,8 +136,8 @@ export function LineItemsBlock({
{numberFormatter.format(lineAddOnCost)}
</Text>
</View>
- )}
- {lineNonTaxableAddOnCost > 0 && (
+ ) : null}
+ {lineNonTaxableAddOnCost > 0 ? (
<View style={tw("flex flex-row justify-between")}>
<Text
style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
@@ -148,8 +148,8 @@ export function LineItemsBlock({
{numberFormatter.format(lineNonTaxableAddOnCost)}
</Text>
</View>
- )}
- {lineTaxPercent > 0 && (
+ ) : null}
+ {lineTaxPercent > 0 ? (
<View style={tw("flex flex-row justify-between")}>
<Text
style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
@@ -160,9 +160,9 @@ export function LineItemsBlock({
{numberFormatter.format(lineTaxAmount)}
</Text>
</View>
- )}
+ ) : null}
</View>
- )}
+ ) : null}
</View>
<Text style={tw("w-1/6 text-center text-gray-600")}>
{line.invoiceLineType === "Comment"
@@ -180,14 +180,14 @@ export function LineItemsBlock({
: numberFormatter.format(getLineTotal(line))}
</Text>
</View>
- {Object.keys(line.externalNotes ?? {}).length > 0 && (
+ {Object.keys(line.externalNotes ?? {}).length > 0 ? (
<View style={tw("px-3 py-2 border-b border-gray-200")}>
<Note
key={`${line.id}-notes`}
content={line.externalNotes as JSONContent}
/>
</View>
- )}
+ ) : null}
</View>
);
})}
diff --git a/packages/documents/src/pdf/blocks/PartiesBlock.tsx b/packages/documents/src/pdf/blocks/PartiesBlock.tsx
index 1fc50b7dcf..7db0e40a18 100644
--- a/packages/documents/src/pdf/blocks/PartiesBlock.tsx
+++ b/packages/documents/src/pdf/blocks/PartiesBlock.tsx
@@ -71,11 +71,11 @@ export function PartiesBlock({ data }: { data: SalesInvoiceData }) {
country={invoiceCountryName ?? customerCountryName}
/>
{customerTaxId &&
- !isEoriCountry(invoiceCountryName ?? customerCountryName) && (
- <Text>Tax ID: {customerTaxId}</Text>
- )}
- {customerVatNumber && <Text>VAT: {customerVatNumber}</Text>}
- {customerEori && <Text>EORI: {customerEori}</Text>}
+ !isEoriCountry(invoiceCountryName ?? customerCountryName) ? (
+ <Text>Tax ID: {customerTaxId}</Text>
+ ) : null}
+ {customerVatNumber ? <Text>VAT: {customerVatNumber}</Text> : null}
+ {customerEori ? <Text>EORI: {customerEori}</Text> : null}
</View>
</View>
@@ -93,49 +93,53 @@ export function PartiesBlock({ data }: { data: SalesInvoiceData }) {
Invoice Details
</Text>
<View style={tw("text-[9px] text-gray-800")}>
- {salesInvoice?.dateIssued && (
+ {salesInvoice?.dateIssued ? (
<Text>
Date Issued:{" "}
{formatDate(salesInvoice.dateIssued, undefined, locale)}
</Text>
- )}
- {salesInvoice?.dateDue && (
+ ) : null}
+ {salesInvoice?.dateDue ? (
<Text style={tw("font-bold")}>
Due Date:{" "}
{formatDate(salesInvoice.dateDue, undefined, locale)}
</Text>
- )}
- {salesInvoice?.customerReference && (
+ ) : null}
+ {salesInvoice?.customerReference ? (
<Text>Customer Ref: {salesInvoice.customerReference}</Text>
- )}
- {salesOrderIds && salesOrderIds.length > 0 && (
+ ) : null}
+ {salesOrderIds && salesOrderIds.length > 0 ? (
<Text>
{salesOrderIds.length > 1
? "Sales Orders: "
: "Sales Order: "}
{salesOrderIds.join(", ")}
</Text>
- )}
- {paymentTerm && <Text>Payment Terms: {paymentTerm.name}</Text>}
- {shippingMethod && <Text>Shipping: {shippingMethod.name}</Text>}
- {salesInvoiceShipment?.shippingTermId && (
+ ) : null}
+ {paymentTerm ? (
+ <Text>Payment Terms: {paymentTerm.name}</Text>
+ ) : null}
+ {shippingMethod ? (
+ <Text>Shipping: {shippingMethod.name}</Text>
+ ) : null}
+ {salesInvoiceShipment?.shippingTermId ? (
<Text>
Shipping Terms: {salesInvoiceShipment.shippingTermId}
</Text>
- )}
- {salesInvoiceShipment?.incoterm && (
+ ) : null}
+ {salesInvoiceShipment?.incoterm ? (
<Text>
Incoterm: {salesInvoiceShipment.incoterm}
{salesInvoiceShipment.incotermLocation
? ` — ${salesInvoiceShipment.incotermLocation}`
: ""}
</Text>
- )}
+ ) : null}
</View>
</View>
{/* Ship To — only when shipment has a distinct address (not falling back to customer's main address) */}
- {shipmentCustomerName && (
+ {shipmentCustomerName ? (
<View style={tw("p-3")}>
<Text
style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
@@ -154,7 +158,7 @@ export function PartiesBlock({ data }: { data: SalesInvoiceData }) {
/>
</View>
</View>
- )}
+ ) : null}
</View>
</View>
</View>
diff --git a/packages/documents/src/pdf/blocks/RichTextBlock.tsx b/packages/documents/src/pdf/blocks/RichTextBlock.tsx
index e523af1c31..165de0012a 100644
--- a/packages/documents/src/pdf/blocks/RichTextBlock.tsx
+++ b/packages/documents/src/pdf/blocks/RichTextBlock.tsx
@@ -31,16 +31,16 @@ export function RichTextBlock({
return (
<View style={tw("border border-gray-200 mb-4")}>
<View style={tw("p-3")}>
- {block.title && (
+ {block.title ? (
<Text style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}>
{block.title}
</Text>
- )}
- {hasContent && (
+ ) : null}
+ {hasContent ? (
<View style={tw("text-[9px] text-gray-800")}>
<Note content={content} />
</View>
- )}
+ ) : null}
</View>
</View>
);
diff --git a/packages/documents/src/pdf/blocks/SummaryBlock.tsx b/packages/documents/src/pdf/blocks/SummaryBlock.tsx
index 570d52c62c..0d244aa902 100644
--- a/packages/documents/src/pdf/blocks/SummaryBlock.tsx
+++ b/packages/documents/src/pdf/blocks/SummaryBlock.tsx
@@ -54,7 +54,7 @@ export function SummaryBlock({
(line) =>
(line.convertedAddOnCost ?? 0) > 0 ||
(line.convertedNonTaxableAddOnCost ?? 0) > 0
- ) && (
+ ) ? (
<View
style={[
tw("flex flex-row py-1.5 px-3 text-[9px]"),
@@ -76,7 +76,7 @@ export function SummaryBlock({
)}
</Text>
</View>
- )}
+ ) : null}
{/* Shipping */}
{(() => {
@@ -106,7 +106,7 @@ export function SummaryBlock({
})()}
{/* Taxes */}
- {salesInvoiceLines.some((line) => (line.taxPercent ?? 0) > 0) && (
+ {salesInvoiceLines.some((line) => (line.taxPercent ?? 0) > 0) ? (
<View
style={[
tw("flex flex-row py-1.5 px-3 text-[9px]"),
@@ -125,7 +125,7 @@ export function SummaryBlock({
)}
</Text>
</View>
- )}
+ ) : null}
<View style={tw("h-[1px] bg-gray-200")} />
<View style={tw("flex flex-row py-2 px-3 text-[9px]")}>
diff --git a/packages/documents/src/pdf/blocks/issue/ActionTasksBlock.tsx b/packages/documents/src/pdf/blocks/issue/ActionTasksBlock.tsx
index 57d1fc5d1a..bccea45c1c 100644
--- a/packages/documents/src/pdf/blocks/issue/ActionTasksBlock.tsx
+++ b/packages/documents/src/pdf/blocks/issue/ActionTasksBlock.tsx
@@ -41,13 +41,13 @@ export function ActionTasksBlock({ data }: { data: IssueData }) {
}
</Text>
<View style={tw("flex flex-col gap-1 text-[10px]")}>
- {task.supplier?.name && (
+ {task.supplier?.name ? (
<View style={tw("flex flex-row gap-2")}>
<Text style={tw("font-bold text-gray-600")}>Supplier:</Text>
<Text style={tw("text-gray-800")}>{task.supplier.name}</Text>
</View>
- )}
- {task.assignee && assignees[task.assignee] && (
+ ) : null}
+ {task.assignee && assignees[task.assignee] ? (
<View style={tw("flex flex-row gap-2")}>
<Text style={tw("font-bold text-gray-600")}>
{task.supplier?.name ? "Verified by" : "Completed by"}:
@@ -56,21 +56,21 @@ export function ActionTasksBlock({ data }: { data: IssueData }) {
{assignees[task.assignee]}
</Text>
</View>
- )}
- {task.completedDate && (
+ ) : null}
+ {task.completedDate ? (
<View style={tw("flex flex-row gap-2")}>
<Text style={tw("font-bold text-gray-600")}>
Completed on:
</Text>
<Text style={tw("text-gray-800")}>{task.completedDate}</Text>
</View>
- )}
+ ) : null}
</View>
- {Object.keys(task.notes ?? {}).length > 0 && (
+ {Object.keys(task.notes ?? {}).length > 0 ? (
<View style={tw("mt-2 pt-2 border-t border-gray-200")}>
<Note content={task.notes as JSONContent} />
</View>
- )}
+ ) : null}
{/* Job Operation Step Records */}
{jobOperationStepRecords
.filter((step) => step.nonConformanceActionId === task.id)
@@ -78,7 +78,7 @@ export function ActionTasksBlock({ data }: { data: IssueData }) {
step.jobOperationStepRecord?.some(
(record) => record.booleanValue !== null
)
- ) && (
+ ) ? (
<View style={tw("mt-2 pt-2 border-t border-gray-200")}>
<Text
style={tw(
@@ -123,9 +123,9 @@ export function ActionTasksBlock({ data }: { data: IssueData }) {
<View style={tw("flex flex-col")}>
<Text style={tw("text-gray-800")}>{step.name}</Text>
<Text style={tw("text-[8px] text-gray-400 mt-0.5")}>
- {operationToJobId[step.operationId] && (
+ {operationToJobId[step.operationId] ? (
<>Job {operationToJobId[step.operationId]} • </>
- )}
+ ) : null}
{assignees[record.createdBy] || "Unknown"} •{" "}
{
new Date(record.createdAt)
@@ -138,7 +138,7 @@ export function ActionTasksBlock({ data }: { data: IssueData }) {
))
)}
</View>
- )}
+ ) : null}
</View>
</View>
))}
diff --git a/packages/documents/src/pdf/blocks/issue/AssociationsBlock.tsx b/packages/documents/src/pdf/blocks/issue/AssociationsBlock.tsx
index c5e54d650b..7c802bffa7 100644
--- a/packages/documents/src/pdf/blocks/issue/AssociationsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/issue/AssociationsBlock.tsx
@@ -48,18 +48,18 @@ export function AssociationsBlock({ data }: { data: IssueData }) {
<View key={item.id} style={rowStyle}>
<Text style={tw("w-1/4 font-bold text-gray-600")}>Item:</Text>
<Text style={tw("text-gray-800")}>{item.documentReadableId}</Text>
- {item.disposition && (
+ {item.disposition ? (
<>
<Text style={tw("text-gray-400")}>-</Text>
<Text style={tw("text-gray-800")}>{item.disposition}</Text>
</>
- )}
- {item.quantity && (
+ ) : null}
+ {item.quantity ? (
<>
<Text style={tw("text-gray-400")}>-</Text>
<Text style={tw("text-gray-800")}>Qty: {item.quantity}</Text>
</>
- )}
+ ) : null}
</View>
))}
{SIMPLE_GROUPS.flatMap(({ key, label }) =>
diff --git a/packages/documents/src/pdf/blocks/issue/IssueDetailsBlock.tsx b/packages/documents/src/pdf/blocks/issue/IssueDetailsBlock.tsx
index 189a3dff98..bb7435367d 100644
--- a/packages/documents/src/pdf/blocks/issue/IssueDetailsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/issue/IssueDetailsBlock.tsx
@@ -19,15 +19,15 @@ export function IssueDetailsBlock({ data }: { data: IssueData }) {
Issue Details
</Text>
<View style={tw("text-[10px] text-gray-800")}>
- {nonConformance.name && (
+ {nonConformance.name ? (
<Text style={tw("font-bold")}>{nonConformance.name}</Text>
- )}
- {ncType?.name && (
+ ) : null}
+ {ncType?.name ? (
<Text style={tw("mt-1")}>Type: {ncType.name}</Text>
- )}
- {nonConformance.status && (
+ ) : null}
+ {nonConformance.status ? (
<Text>Status: {nonConformance.status}</Text>
- )}
+ ) : null}
<Text>
Initiated By: {assignees[nonConformance.createdBy] || "Unknown"}
</Text>
@@ -38,18 +38,18 @@ export function IssueDetailsBlock({ data }: { data: IssueData }) {
Dates
</Text>
<View style={tw("text-[10px] text-gray-800")}>
- {nonConformance.openDate && (
+ {nonConformance.openDate ? (
<Text>
Started:{" "}
{formatDate(nonConformance.openDate, undefined, locale)}
</Text>
- )}
- {nonConformance.closeDate && (
+ ) : null}
+ {nonConformance.closeDate ? (
<Text>
Completed:{" "}
{formatDate(nonConformance.closeDate, undefined, locale)}
</Text>
- )}
+ ) : null}
</View>
</View>
</View>
diff --git a/packages/documents/src/pdf/blocks/issue/ReviewersBlock.tsx b/packages/documents/src/pdf/blocks/issue/ReviewersBlock.tsx
index 1f289cd3ec..7fba75b52c 100644
--- a/packages/documents/src/pdf/blocks/issue/ReviewersBlock.tsx
+++ b/packages/documents/src/pdf/blocks/issue/ReviewersBlock.tsx
@@ -34,11 +34,11 @@ export function ReviewersBlock({ data }: { data: IssueData }) {
</Text>
</View>
- {Object.keys(reviewer.notes ?? {}).length > 0 && (
+ {Object.keys(reviewer.notes ?? {}).length > 0 ? (
<View style={tw("mt-1")}>
<Note content={reviewer.notes as JSONContent} />
</View>
- )}
+ ) : null}
</View>
))}
</View>
diff --git a/packages/documents/src/pdf/blocks/jobTraveler/JobDetailsBlock.tsx b/packages/documents/src/pdf/blocks/jobTraveler/JobDetailsBlock.tsx
index 224f0337c9..60f756e3b6 100644
--- a/packages/documents/src/pdf/blocks/jobTraveler/JobDetailsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/jobTraveler/JobDetailsBlock.tsx
@@ -84,19 +84,19 @@ export function JobDetailsBlock({ data }: { data: JobTravelerData }) {
</Text>
</View>
- {methodRevision && methodRevision !== "0" && (
+ {methodRevision && methodRevision !== "0" ? (
<View style={jobHeaderStyles.infoRow}>
<Text style={jobHeaderStyles.label}>Method Revision:</Text>
<Text style={jobHeaderStyles.value}>V{methodRevision}</Text>
</View>
- )}
+ ) : null}
- {getTrackingNumber() && (
+ {getTrackingNumber() ? (
<View style={jobHeaderStyles.infoRow}>
<Text style={jobHeaderStyles.label}>Tracking:</Text>
<Text style={jobHeaderStyles.value}>{getTrackingNumber()}</Text>
</View>
- )}
+ ) : null}
<View style={jobHeaderStyles.infoRow}>
<Text style={jobHeaderStyles.label}>Item:</Text>
@@ -113,60 +113,60 @@ export function JobDetailsBlock({ data }: { data: JobTravelerData }) {
</Text>
</View>
- {job.scrapQuantity && job.scrapQuantity > 0 && (
+ {job.scrapQuantity && job.scrapQuantity > 0 ? (
<View style={jobHeaderStyles.infoRow}>
<Text style={jobHeaderStyles.label}>Scrap Qty:</Text>
<Text style={jobHeaderStyles.value}>
{job.scrapQuantity} {job.unitOfMeasureCode}
</Text>
</View>
- )}
+ ) : null}
<View style={jobHeaderStyles.infoRow}>
<Text style={jobHeaderStyles.label}>Target:</Text>
<Text style={jobHeaderStyles.value}>{getTargetInfo()}</Text>
</View>
- {customer && (
+ {customer ? (
<View style={jobHeaderStyles.infoRow}>
<Text style={jobHeaderStyles.label}>Customer:</Text>
<Text style={jobHeaderStyles.value}>{customer.name}</Text>
</View>
- )}
+ ) : null}
- {job.startDate && (
+ {job.startDate ? (
<View style={jobHeaderStyles.infoRow}>
<Text style={jobHeaderStyles.label}>Start Date:</Text>
<Text style={jobHeaderStyles.value}>
{formatDate(job.startDate, undefined, locale)}
</Text>
</View>
- )}
+ ) : null}
- {job.dueDate && (
+ {job.dueDate ? (
<View style={jobHeaderStyles.infoRow}>
<Text style={jobHeaderStyles.label}>Due Date:</Text>
<Text style={jobHeaderStyles.value}>
{formatDate(job.dueDate, undefined, locale)}
</Text>
</View>
- )}
+ ) : null}
- {job.deadlineType && (
+ {job.deadlineType ? (
<View style={jobHeaderStyles.infoRow}>
<Text style={jobHeaderStyles.label}>Deadline Type:</Text>
<Text style={jobHeaderStyles.value}>{job.deadlineType}</Text>
</View>
- )}
+ ) : null}
</View>
<View style={jobHeaderStyles.rightSection}>
- {thumbnail && (
+ {thumbnail ? (
<View>
<Image
src={thumbnail}
style={tw("w-full h-auto border rounded-lg border-gray-300")}
/>
</View>
- )}
+ ) : null}
</View>
</View>
</View>
diff --git a/packages/documents/src/pdf/blocks/jobTraveler/OperationsBlock.tsx b/packages/documents/src/pdf/blocks/jobTraveler/OperationsBlock.tsx
index 746717927f..b4c6f230ab 100644
--- a/packages/documents/src/pdf/blocks/jobTraveler/OperationsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/jobTraveler/OperationsBlock.tsx
@@ -135,25 +135,25 @@ export function OperationsBlock({
<Text style={tw("font-bold")}>{operation.description}</Text>
</View>
<View style={tw("w-3/12 text-left")}>
- {hasExpectedTimes && (
+ {hasExpectedTimes ? (
<View style={tw("flex flex-col gap-1")}>
- {setupTimeFormatted && (
+ {setupTimeFormatted ? (
<Text style={tw("text-[10px]")}>
Setup: {setupTimeFormatted}
</Text>
- )}
- {laborTimeFormatted && (
+ ) : null}
+ {laborTimeFormatted ? (
<Text style={tw("text-[10px]")}>
Labor: {laborTimeFormatted}
</Text>
- )}
- {machineTimeFormatted && (
+ ) : null}
+ {machineTimeFormatted ? (
<Text style={tw("text-[10px]")}>
Machine: {machineTimeFormatted}
</Text>
- )}
+ ) : null}
</View>
- )}
+ ) : null}
</View>
</View>
@@ -166,31 +166,31 @@ export function OperationsBlock({
</View>
<View style={tw("w-full flex flex-row justify-start gap-2")}>
- {isInside && setupQrCode && (
+ {isInside && setupQrCode ? (
<View style={tw("flex flex-col items-center w-1/4")}>
<>
<Image src={setupQrCode} style={tw("w-16 h-16")} />
<Text style={tw("text-[10px] mt-1")}>Setup</Text>
</>
</View>
- )}
+ ) : null}
- {isInside && laborQrCode && (
+ {isInside && laborQrCode ? (
<View style={tw("flex flex-col items-center w-1/4")}>
<>
<Image src={laborQrCode} style={tw("w-16 h-16")} />
<Text style={tw("text-[10px] mt-1")}>Labor</Text>
</>
</View>
- )}
- {isInside && machiningQrCode && (
+ ) : null}
+ {isInside && machiningQrCode ? (
<View style={tw("flex flex-col items-center w-1/4")}>
<>
<Image src={machiningQrCode} style={tw("w-16 h-16")} />
<Text style={tw("text-[10px] mt-1")}>Machine</Text>
</>
</View>
- )}
+ ) : null}
<View style={tw("flex flex-col items-center w-1/4")}>
<Image src={completeQrCode} style={tw("w-16 h-16")} />
<Text style={tw("text-[10px] mt-1")}>Complete</Text>
@@ -198,9 +198,9 @@ export function OperationsBlock({
</View>
</View>
- {(hasWorkInstruction || hasProcedureSteps) && (
+ {hasWorkInstruction || hasProcedureSteps ? (
<View style={tw("mt-2 ml-8")}>
- {hasProcedureSteps && (
+ {hasProcedureSteps ? (
<View style={tw("mb-2")}>
<Text
style={{
@@ -252,23 +252,23 @@ export function OperationsBlock({
<Text style={tw("text-[9px] font-bold")}>
{step.name}
</Text>
- {hasStepDescription && (
+ {hasStepDescription ? (
<Note
title="Procedure Step"
content={stepDescription}
/>
- )}
+ ) : null}
</View>
</View>
);
})}
</View>
- )}
- {hasWorkInstruction && (
+ ) : null}
+ {hasWorkInstruction ? (
<Note title="Work Instructions" content={workInstruction} />
- )}
+ ) : null}
</View>
- )}
+ ) : null}
</View>
);
})}
diff --git a/packages/documents/src/pdf/blocks/packingSlip/DetailsBlock.tsx b/packages/documents/src/pdf/blocks/packingSlip/DetailsBlock.tsx
index d5c3073608..a1a3933ba6 100644
--- a/packages/documents/src/pdf/blocks/packingSlip/DetailsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/packingSlip/DetailsBlock.tsx
@@ -15,7 +15,9 @@ export function DetailsBlock({ data }: { data: PackingSlipData }) {
Shipping
</Text>
<View style={tw("text-[10px] text-gray-800")}>
- {shippingMethod?.name && <Text>Method: {shippingMethod.name}</Text>}
+ {shippingMethod?.name ? (
+ <Text>Method: {shippingMethod.name}</Text>
+ ) : null}
</View>
</View>
<View style={tw("w-1/2 p-3")}>
@@ -23,7 +25,7 @@ export function DetailsBlock({ data }: { data: PackingSlipData }) {
Payment
</Text>
<View style={tw("text-[10px] text-gray-800")}>
- {paymentTerm?.name && <Text>Terms: {paymentTerm.name}</Text>}
+ {paymentTerm?.name ? <Text>Terms: {paymentTerm.name}</Text> : null}
</View>
</View>
</View>
diff --git a/packages/documents/src/pdf/blocks/packingSlip/LineItemsBlock.tsx b/packages/documents/src/pdf/blocks/packingSlip/LineItemsBlock.tsx
index e8d51ae7fe..fa93ec2ed5 100644
--- a/packages/documents/src/pdf/blocks/packingSlip/LineItemsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/packingSlip/LineItemsBlock.tsx
@@ -51,9 +51,9 @@ export function LineItemsBlock({
Description
</Text>
<Text style={tw("w-2/12 text-right")}>Qty</Text>
- {hasTrackedEntities && (
+ {hasTrackedEntities ? (
<Text style={tw("w-5/12 text-right")}>Serial/Batch</Text>
- )}
+ ) : null}
</View>
{shipmentLines
@@ -93,17 +93,17 @@ export function LineItemsBlock({
{line.description}
</Text>
{opts.showThumbnails &&
- thumbnails &&
- line.id != null &&
- line.id in thumbnails &&
- thumbnails[line.id] && (
- <View style={tw("mt-1 w-16")}>
- <Image
- src={thumbnails[line.id]!}
- style={tw("w-full h-auto")}
- />
- </View>
- )}
+ thumbnails &&
+ line.id != null &&
+ line.id in thumbnails &&
+ thumbnails[line.id] ? (
+ <View style={tw("mt-1 w-16")}>
+ <Image
+ src={thumbnails[line.id]!}
+ style={tw("w-full h-auto")}
+ />
+ </View>
+ ) : null}
<View style={tw("mt-1")}>
<Image src={barcodeDataUrl} style={tw("max-w-[50%]")} />
</View>
@@ -111,7 +111,7 @@ export function LineItemsBlock({
<Text style={tw("w-2/12 text-right text-gray-600")}>
{`${line.shippedQuantity} / ${line.orderQuantity} ${line.unitOfMeasure}`}
</Text>
- {hasTrackedEntities && (
+ {hasTrackedEntities ? (
<View style={tw("w-5/12 flex flex-col gap-1 items-end")}>
{trackedEntitiesForLine.map((entity) => {
const qrCodeDataUrl = generateQRCode(entity.id, 8);
@@ -131,7 +131,7 @@ export function LineItemsBlock({
);
})}
</View>
- )}
+ ) : null}
</View>
);
})}
diff --git a/packages/documents/src/pdf/blocks/packingSlip/PartiesBlock.tsx b/packages/documents/src/pdf/blocks/packingSlip/PartiesBlock.tsx
index 92bded5bff..8c6f5a43da 100644
--- a/packages/documents/src/pdf/blocks/packingSlip/PartiesBlock.tsx
+++ b/packages/documents/src/pdf/blocks/packingSlip/PartiesBlock.tsx
@@ -32,18 +32,20 @@ export function PartiesBlock({ data }: { data: PackingSlipData }) {
Ship To
</Text>
<View style={tw("text-[10px] text-gray-800")}>
- {customer.name && (
+ {customer.name ? (
<Text style={tw("font-bold")}>{customer.name}</Text>
- )}
- {addressLine1 && <Text style={tw("mt-1")}>{addressLine1}</Text>}
- {addressLine2 && <Text>{addressLine2}</Text>}
- {city && <Text>{city}</Text>}
- {(stateProvince || postalCode) && (
+ ) : null}
+ {addressLine1 ? (
+ <Text style={tw("mt-1")}>{addressLine1}</Text>
+ ) : null}
+ {addressLine2 ? <Text>{addressLine2}</Text> : null}
+ {city ? <Text>{city}</Text> : null}
+ {stateProvince || postalCode ? (
<Text>
{[stateProvince, postalCode].filter(Boolean).join(" ")}
</Text>
- )}
- {countryCode && <Text>{countryCode}</Text>}
+ ) : null}
+ {countryCode ? <Text>{countryCode}</Text> : null}
</View>
</View>
<View style={tw("w-1/2 p-3")}>
@@ -51,22 +53,22 @@ export function PartiesBlock({ data }: { data: PackingSlipData }) {
Shipment Details
</Text>
<View style={tw("text-[10px] text-gray-800")}>
- {shipment?.postingDate && (
+ {shipment?.postingDate ? (
<Text>
Date: {formatDate(shipment.postingDate, undefined, locale)}
</Text>
- )}
- {sourceDocument && sourceDocumentId && (
+ ) : null}
+ {sourceDocument && sourceDocumentId ? (
<Text>
{sourceDocument}: {sourceDocumentId}
</Text>
- )}
- {customerReference && (
+ ) : null}
+ {customerReference ? (
<Text>Customer PO #: {customerReference}</Text>
- )}
- {shipment?.trackingNumber && (
+ ) : null}
+ {shipment?.trackingNumber ? (
<Text>Tracking: {shipment.trackingNumber}</Text>
- )}
+ ) : null}
</View>
</View>
</View>
diff --git a/packages/documents/src/pdf/blocks/purchaseOrder/LineItemsBlock.tsx b/packages/documents/src/pdf/blocks/purchaseOrder/LineItemsBlock.tsx
index 289bfdca01..5886d53b0a 100644
--- a/packages/documents/src/pdf/blocks/purchaseOrder/LineItemsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/purchaseOrder/LineItemsBlock.tsx
@@ -117,29 +117,29 @@ export function LineItemsBlock({
</>
)}
{purchaseOrder.purchaseOrderType === "Outside Processing" &&
- line.jobOperationDescription && (
- <Text style={tw("text-[7px] text-gray-600 mt-0.5")}>
- {line.jobOperationDescription}
- </Text>
- )}
+ line.jobOperationDescription ? (
+ <Text style={tw("text-[7px] text-gray-600 mt-0.5")}>
+ {line.jobOperationDescription}
+ </Text>
+ ) : null}
{opts.showThumbnails &&
- thumbnails &&
- line.id &&
- line.id in thumbnails &&
- thumbnails[line.id] && (
- <View style={tw("mt-1 w-16")}>
- <Image
- src={thumbnails[line.id]!}
- style={tw("w-full h-auto")}
- />
- </View>
- )}
- {(line.supplierShippingCost ?? 0) > 0 && (
+ thumbnails &&
+ line.id &&
+ line.id in thumbnails &&
+ thumbnails[line.id] ? (
+ <View style={tw("mt-1 w-16")}>
+ <Image
+ src={thumbnails[line.id]!}
+ style={tw("w-full h-auto")}
+ />
+ </View>
+ ) : null}
+ {(line.supplierShippingCost ?? 0) > 0 ? (
<Text style={tw("text-[7px] text-gray-600 mt-0.5")}>
Shipping:{" "}
{numberFormatter.format(line.supplierShippingCost ?? 0)}
</Text>
- )}
+ ) : null}
</View>
<Text style={tw("w-[8%] text-center text-gray-600")}>
{line.purchaseOrderLineType === "Comment"
@@ -168,18 +168,18 @@ export function LineItemsBlock({
: numberFormatter.format(netValue)}
</Text>
<View style={tw("w-[12%]")}>
- {line.purchaseOrderLineType !== "Comment" && (
+ {line.purchaseOrderLineType !== "Comment" ? (
<View style={tw("flex flex-col items-center")}>
<Text style={tw("text-gray-600")}>
{numberFormatter.format(line.supplierTaxAmount ?? 0)}
</Text>
- {taxPercentLabel && (
+ {taxPercentLabel ? (
<Text style={tw("text-[6px] text-gray-400")}>
{taxPercentLabel}
</Text>
- )}
+ ) : null}
</View>
- )}
+ ) : null}
</View>
<Text
style={tw("w-[13%] text-center text-gray-800 font-medium")}
@@ -190,14 +190,14 @@ export function LineItemsBlock({
</Text>
</View>
</View>
- {Object.keys(line.externalNotes ?? {}).length > 0 && (
+ {Object.keys(line.externalNotes ?? {}).length > 0 ? (
<View style={tw("px-3 py-2 border-b border-gray-200")}>
<Note
key={`${line.id}-notes`}
content={line.externalNotes as JSONContent}
/>
</View>
- )}
+ ) : null}
</View>
);
})}
diff --git a/packages/documents/src/pdf/blocks/purchaseOrder/PartiesBlock.tsx b/packages/documents/src/pdf/blocks/purchaseOrder/PartiesBlock.tsx
index c2610c1705..a96b4fcbfc 100644
--- a/packages/documents/src/pdf/blocks/purchaseOrder/PartiesBlock.tsx
+++ b/packages/documents/src/pdf/blocks/purchaseOrder/PartiesBlock.tsx
@@ -86,21 +86,21 @@ export function PartiesBlock({ data }: { data: PurchaseOrderData }) {
country={supplierCountryName ?? supplierCountryCode}
/>
{purchaseOrderLocations.supplierTaxId &&
- !isEoriCountry(supplierCountryCode) && (
- <Text>Tax ID: {purchaseOrderLocations.supplierTaxId}</Text>
- )}
- {purchaseOrderLocations.supplierVatNumber && (
+ !isEoriCountry(supplierCountryCode) ? (
+ <Text>Tax ID: {purchaseOrderLocations.supplierTaxId}</Text>
+ ) : null}
+ {purchaseOrderLocations.supplierVatNumber ? (
<Text>VAT: {purchaseOrderLocations.supplierVatNumber}</Text>
- )}
- {purchaseOrderLocations.supplierEori && (
+ ) : null}
+ {purchaseOrderLocations.supplierEori ? (
<Text>EORI: {purchaseOrderLocations.supplierEori}</Text>
- )}
- {purchaseOrderLocations.supplierContactName && (
+ ) : null}
+ {purchaseOrderLocations.supplierContactName ? (
<Text>Contact: {purchaseOrderLocations.supplierContactName}</Text>
- )}
- {purchaseOrderLocations.supplierContactEmail && (
+ ) : null}
+ {purchaseOrderLocations.supplierContactEmail ? (
<Text>Email: {purchaseOrderLocations.supplierContactEmail}</Text>
- )}
+ ) : null}
</View>
</View>
@@ -113,19 +113,19 @@ export function PartiesBlock({ data }: { data: PurchaseOrderData }) {
Order Info
</Text>
<View style={tw("text-[9px] text-gray-800")}>
- {purchaseOrder?.purchaseOrderId && (
+ {purchaseOrder?.purchaseOrderId ? (
<Text>PO Number: {purchaseOrder.purchaseOrderId}</Text>
- )}
- {purchaseOrder?.orderDate && (
+ ) : null}
+ {purchaseOrder?.orderDate ? (
<Text>
Date: {formatDate(purchaseOrder.orderDate, undefined, locale)}
</Text>
- )}
+ ) : null}
<Text>Currency: {currencyCode}</Text>
- {purchaseOrder?.supplierReference && (
+ {purchaseOrder?.supplierReference ? (
<Text>Reference: {purchaseOrder.supplierReference}</Text>
- )}
- {purchaseOrder?.receiptRequestedDate && (
+ ) : null}
+ {purchaseOrder?.receiptRequestedDate ? (
<Text>
Requested:{" "}
{formatDate(
@@ -134,8 +134,8 @@ export function PartiesBlock({ data }: { data: PurchaseOrderData }) {
locale
)}
</Text>
- )}
- {purchaseOrder?.receiptPromisedDate && (
+ ) : null}
+ {purchaseOrder?.receiptPromisedDate ? (
<Text>
Promised:{" "}
{formatDate(
@@ -144,21 +144,23 @@ export function PartiesBlock({ data }: { data: PurchaseOrderData }) {
locale
)}
</Text>
- )}
- {paymentTerm && <Text>Payment Terms: {paymentTerm.name}</Text>}
- {purchaseOrder?.incoterm && (
+ ) : null}
+ {paymentTerm ? (
+ <Text>Payment Terms: {paymentTerm.name}</Text>
+ ) : null}
+ {purchaseOrder?.incoterm ? (
<Text>
Incoterm: {purchaseOrder.incoterm}
{purchaseOrder.incotermLocation
? ` — ${purchaseOrder.incotermLocation}`
: ""}
</Text>
- )}
+ ) : null}
</View>
<View style={tw("h-[1px] bg-gray-200 my-2")} />
<View style={tw("text-[9px] text-gray-800")}>
- {company.vatNumber && <Text>VAT: {company.vatNumber}</Text>}
- {company.eori && <Text>EORI: {company.eori}</Text>}
+ {company.vatNumber ? <Text>VAT: {company.vatNumber}</Text> : null}
+ {company.eori ? <Text>EORI: {company.eori}</Text> : null}
{(() => {
const name =
purchaseOrder.assigneeFullName ??
@@ -174,13 +176,13 @@ export function PartiesBlock({ data }: { data: PurchaseOrderData }) {
purchaseOrder.createdByPhone;
return (
<>
- {name && <Text>Contact: {name}</Text>}
- {email && <Text>Email: {email}</Text>}
- {phone && <Text>Phone: {phone}</Text>}
+ {name ? <Text>Contact: {name}</Text> : null}
+ {email ? <Text>Email: {email}</Text> : null}
+ {phone ? <Text>Phone: {phone}</Text> : null}
</>
);
})()}
- {accountsPayableBillingAddress?.email && (
+ {accountsPayableBillingAddress?.email ? (
<>
<Text style={tw("font-bold mt-1")}>
Billing documents and enquiries:
@@ -189,7 +191,7 @@ export function PartiesBlock({ data }: { data: PurchaseOrderData }) {
{accountsPayableBillingAddress.email}
</Text>
</>
- )}
+ ) : null}
</View>
</View>
diff --git a/packages/documents/src/pdf/blocks/purchaseOrder/SummaryBlock.tsx b/packages/documents/src/pdf/blocks/purchaseOrder/SummaryBlock.tsx
index 1e6a1e209e..02e9262df4 100644
--- a/packages/documents/src/pdf/blocks/purchaseOrder/SummaryBlock.tsx
+++ b/packages/documents/src/pdf/blocks/purchaseOrder/SummaryBlock.tsx
@@ -45,7 +45,7 @@ export function SummaryBlock({
</Text>
</View>
- {shippingCost > 0 && (
+ {shippingCost > 0 ? (
<View
style={[
tw("flex flex-row py-1.5 px-3 text-[9px]"),
@@ -59,9 +59,9 @@ export function SummaryBlock({
{numberFormatter.format(shippingCost)}
</Text>
</View>
- )}
+ ) : null}
- {taxAmount > 0 && (
+ {taxAmount > 0 ? (
<View
style={[
tw("flex flex-row py-1.5 px-3 text-[9px]"),
@@ -75,7 +75,7 @@ export function SummaryBlock({
{numberFormatter.format(taxAmount)}
</Text>
</View>
- )}
+ ) : null}
<View style={tw("h-[1px] bg-gray-200")} />
<View style={tw("flex flex-row py-2 px-3 text-[9px]")}>
diff --git a/packages/documents/src/pdf/blocks/purchaseReturnOrder/LineItemsBlock.tsx b/packages/documents/src/pdf/blocks/purchaseReturnOrder/LineItemsBlock.tsx
index 3db086cb51..190b70ced5 100644
--- a/packages/documents/src/pdf/blocks/purchaseReturnOrder/LineItemsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/purchaseReturnOrder/LineItemsBlock.tsx
@@ -68,7 +68,7 @@ export function LineItemsBlock({
<Text style={{ ...tw("text-gray-800"), ...overflow }}>
{line.item?.readableIdWithRevision ?? ""}
</Text>
- {line.item?.name && (
+ {line.item?.name ? (
<Text
style={{
...tw("text-[9px] text-gray-600 mt-0.5"),
@@ -77,7 +77,7 @@ export function LineItemsBlock({
>
{line.item.name}
</Text>
- )}
+ ) : null}
</View>
<Text style={tw("w-[16%] text-center text-gray-600")}>
{`${line.quantity ?? 0} ${line.unitOfMeasureCode ?? "EA"}`}
@@ -91,7 +91,7 @@ export function LineItemsBlock({
</View>
))}
- {total > 0 && (
+ {total > 0 ? (
<View style={tw("flex flex-row py-2 px-3 text-[9px]")}>
<Text style={tw("w-[62%] text-right pr-3 text-gray-800 font-bold")}>
{currencyCode ? `Total (${currencyCode})` : "Total"}
@@ -101,7 +101,7 @@ export function LineItemsBlock({
</Text>
<Text style={tw("w-[20%]")} />
</View>
- )}
+ ) : null}
</View>
);
}
diff --git a/packages/documents/src/pdf/blocks/purchaseReturnOrder/PartiesBlock.tsx b/packages/documents/src/pdf/blocks/purchaseReturnOrder/PartiesBlock.tsx
index 3edffe10b7..6883eef666 100644
--- a/packages/documents/src/pdf/blocks/purchaseReturnOrder/PartiesBlock.tsx
+++ b/packages/documents/src/pdf/blocks/purchaseReturnOrder/PartiesBlock.tsx
@@ -45,23 +45,23 @@ export function PartiesBlock({ data }: { data: PurchaseReturnOrderData }) {
Return Details
</Text>
<View style={tw("text-[9px] text-gray-800")}>
- {purchaseReturnOrder?.purchaseReturnOrderId && (
+ {purchaseReturnOrder?.purchaseReturnOrderId ? (
<Text>
Return Number: {purchaseReturnOrder.purchaseReturnOrderId}
</Text>
- )}
- {purchaseReturnOrder?.supplierReference && (
+ ) : null}
+ {purchaseReturnOrder?.supplierReference ? (
<Text>
Supplier RMA #: {purchaseReturnOrder.supplierReference}
</Text>
- )}
- {purchaseReturnOrder?.orderDate && (
+ ) : null}
+ {purchaseReturnOrder?.orderDate ? (
<Text>
Date:{" "}
{formatDate(purchaseReturnOrder.orderDate, undefined, locale)}
</Text>
- )}
- {purchaseReturnOrder?.expirationDate && (
+ ) : null}
+ {purchaseReturnOrder?.expirationDate ? (
<Text>
Expires:{" "}
{formatDate(
@@ -70,7 +70,7 @@ export function PartiesBlock({ data }: { data: PurchaseReturnOrderData }) {
locale
)}
</Text>
- )}
+ ) : null}
</View>
</View>
diff --git a/packages/documents/src/pdf/blocks/quote/LineItemsBlock.tsx b/packages/documents/src/pdf/blocks/quote/LineItemsBlock.tsx
index 8e58b02efe..ca49babbd1 100644
--- a/packages/documents/src/pdf/blocks/quote/LineItemsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/quote/LineItemsBlock.tsx
@@ -78,12 +78,12 @@ export function LineItemsBlock({
<View style={tw("w-2/3 flex flex-row items-center")}>
<Text style={tw(`${colWidth} text-center pr-3`)}>Qty</Text>
<Text style={tw(`${colWidth} text-center pr-3`)}>Unit Price</Text>
- {!hasSinglePricePerLine && (
+ {!hasSinglePricePerLine ? (
<Text style={tw(`${colWidth} text-center pr-3`)}>Tax & Fees</Text>
- )}
- {hasAnyLeadTime && (
+ ) : null}
+ {hasAnyLeadTime ? (
<Text style={tw(`${colWidth} text-center pr-3`)}>Lead Time</Text>
- )}
+ ) : null}
<Text style={tw(`${colWidth} text-center`)}>Total</Text>
</View>
</View>
@@ -156,7 +156,7 @@ export function LineItemsBlock({
]}
>
<View style={tw("w-1/3 pr-2")}>
- {index === 0 && (
+ {index === 0 ? (
<>
<Text
style={{ ...tw("text-gray-800"), ...overflow }}
@@ -172,17 +172,17 @@ export function LineItemsBlock({
{getLineDescriptionDetails(line)}
</Text>
{opts.showThumbnails &&
- thumbnails &&
- line.id != null &&
- thumbnails[line.id] && (
- <View style={tw("mt-2")}>
- <Image
- src={thumbnails[line.id]!}
- style={{ width: 60, height: 60 }}
- />
- </View>
- )}
- {totalTaxAndFees > 0 && (
+ thumbnails &&
+ line.id != null &&
+ thumbnails[line.id] ? (
+ <View style={tw("mt-2")}>
+ <Image
+ src={thumbnails[line.id]!}
+ style={{ width: 60, height: 60 }}
+ />
+ </View>
+ ) : null}
+ {totalTaxAndFees > 0 ? (
<View style={tw("mt-1")}>
<Text
style={tw(
@@ -191,7 +191,7 @@ export function LineItemsBlock({
>
Tax & Fees
</Text>
- {(price?.convertedShippingCost ?? 0) > 0 && (
+ {(price?.convertedShippingCost ?? 0) > 0 ? (
<View
style={tw(
"flex flex-row justify-between"
@@ -212,7 +212,7 @@ export function LineItemsBlock({
)}
</Text>
</View>
- )}
+ ) : null}
{Object.values(additionalCharges)
.filter(
(charge) =>
@@ -253,7 +253,7 @@ export function LineItemsBlock({
</View>
);
})}
- {taxPercent > 0 && (
+ {taxPercent > 0 ? (
<View
style={tw(
"flex flex-row justify-between"
@@ -273,11 +273,11 @@ export function LineItemsBlock({
{numberFormatter.format(taxAmount)}
</Text>
</View>
- )}
+ ) : null}
</View>
- )}
+ ) : null}
</>
- )}
+ ) : null}
</View>
<View style={tw("w-2/3 flex flex-row")}>
<Text
@@ -296,7 +296,7 @@ export function LineItemsBlock({
? unitPriceNumberFormatter.format(unitPrice)
: "-"}
</Text>
- {!hasSinglePricePerLine && (
+ {!hasSinglePricePerLine ? (
<Text
style={tw(
`${colWidth} text-center text-gray-600 pr-3`
@@ -306,8 +306,8 @@ export function LineItemsBlock({
? numberFormatter.format(totalTaxAndFees)
: "-"}
</Text>
- )}
- {hasAnyLeadTime && (
+ ) : null}
+ {hasAnyLeadTime ? (
<Text
style={tw(
`${colWidth} text-center text-gray-600 pr-3`
@@ -317,7 +317,7 @@ export function LineItemsBlock({
? `${leadTime} ${pluralize(leadTime, "day")}`
: "-"}
</Text>
- )}
+ ) : null}
<Text
style={tw(
`${colWidth} text-center text-gray-800 font-medium`
@@ -335,14 +335,14 @@ export function LineItemsBlock({
</View>
);
})}
- {Object.keys(line.externalNotes ?? {}).length > 0 && (
+ {Object.keys(line.externalNotes ?? {}).length > 0 ? (
<View style={tw("px-3 py-2 border-b border-gray-200")}>
<Note
key={`${line.id}-notes`}
content={line.externalNotes as JSONContent}
/>
</View>
- )}
+ ) : null}
</>
) : (
<View
diff --git a/packages/documents/src/pdf/blocks/quote/PartiesBlock.tsx b/packages/documents/src/pdf/blocks/quote/PartiesBlock.tsx
index 82a1f7653d..fae8f3d1e2 100644
--- a/packages/documents/src/pdf/blocks/quote/PartiesBlock.tsx
+++ b/packages/documents/src/pdf/blocks/quote/PartiesBlock.tsx
@@ -54,13 +54,13 @@ export function PartiesBlock({ data }: { data: QuoteData }) {
postalCode={customerPostalCode}
country={customerCountryName ?? customerCountryCode}
/>
- {customerTaxId && !isEoriCountry(customerCountryCode) && (
+ {customerTaxId && !isEoriCountry(customerCountryCode) ? (
<Text>Tax ID: {customerTaxId}</Text>
- )}
- {customerVatNumber && <Text>VAT: {customerVatNumber}</Text>}
- {customerEori && <Text>EORI: {customerEori}</Text>}
- {contactName && <Text>Contact: {contactName}</Text>}
- {contactEmail && <Text>Email: {contactEmail}</Text>}
+ ) : null}
+ {customerVatNumber ? <Text>VAT: {customerVatNumber}</Text> : null}
+ {customerEori ? <Text>EORI: {customerEori}</Text> : null}
+ {contactName ? <Text>Contact: {contactName}</Text> : null}
+ {contactEmail ? <Text>Email: {contactEmail}</Text> : null}
</View>
</View>
@@ -78,28 +78,30 @@ export function PartiesBlock({ data }: { data: QuoteData }) {
locale
)}
</Text>
- {quote.expirationDate && (
+ {quote.expirationDate ? (
<Text style={tw("font-bold")}>
Expires: {formatDate(quote.expirationDate, undefined, locale)}
</Text>
- )}
- {quote.customerReference && (
+ ) : null}
+ {quote.customerReference ? (
<Text>Reference: {quote.customerReference}</Text>
- )}
- {maxLeadTime > 0 && (
+ ) : null}
+ {maxLeadTime > 0 ? (
<Text>
Max Lead Time: {maxLeadTime} {pluralize(maxLeadTime, "day")}
</Text>
- )}
- {paymentTerm && <Text>Payment Terms: {paymentTerm.name}</Text>}
- {shipment?.incoterm && (
+ ) : null}
+ {paymentTerm ? (
+ <Text>Payment Terms: {paymentTerm.name}</Text>
+ ) : null}
+ {shipment?.incoterm ? (
<Text>
Incoterm: {shipment.incoterm}
{shipment.incotermLocation
? ` — ${shipment.incotermLocation}`
: ""}
</Text>
- )}
+ ) : null}
</View>
</View>
</View>
diff --git a/packages/documents/src/pdf/blocks/quote/SummaryBlock.tsx b/packages/documents/src/pdf/blocks/quote/SummaryBlock.tsx
index 3cc2615403..9829da01db 100644
--- a/packages/documents/src/pdf/blocks/quote/SummaryBlock.tsx
+++ b/packages/documents/src/pdf/blocks/quote/SummaryBlock.tsx
@@ -31,7 +31,7 @@ export function QuoteSummaryBlock({ data }: { data: QuoteData }) {
{numberFormatter.format(totals.shipping)}
</Text>
</View>
- {totals.fees > 0 && (
+ {totals.fees > 0 ? (
<View style={ROW}>
<Text style={tw("w-5/6 text-right pr-3 text-gray-600")}>
Fees ({currencyCode})
@@ -40,7 +40,7 @@ export function QuoteSummaryBlock({ data }: { data: QuoteData }) {
{numberFormatter.format(totals.fees)}
</Text>
</View>
- )}
+ ) : null}
<View style={ROW}>
<Text style={tw("w-5/6 text-right pr-3 text-gray-600")}>
Taxes ({currencyCode})
diff --git a/packages/documents/src/pdf/blocks/salesOrder/LineItemsBlock.tsx b/packages/documents/src/pdf/blocks/salesOrder/LineItemsBlock.tsx
index 5c19edc7c0..5e18cbc019 100644
--- a/packages/documents/src/pdf/blocks/salesOrder/LineItemsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/salesOrder/LineItemsBlock.tsx
@@ -96,73 +96,73 @@ export function LineItemsBlock({
{getLineDescriptionDetails(line)}
</Text>
{opts.showThumbnails &&
- thumbnails &&
- line.id &&
- line.id in thumbnails &&
- thumbnails[line.id] && (
- <View style={tw("mt-1 w-16")}>
- <Image
- src={thumbnails[line.id]!}
- style={tw("w-full h-auto")}
- />
- </View>
- )}
+ thumbnails &&
+ line.id &&
+ line.id in thumbnails &&
+ thumbnails[line.id] ? (
+ <View style={tw("mt-1 w-16")}>
+ <Image
+ src={thumbnails[line.id]!}
+ style={tw("w-full h-auto")}
+ />
+ </View>
+ ) : null}
{line.salesOrderLineType !== "Comment" &&
- totalTaxAndFees > 0 && (
- <View style={tw("mt-1")}>
- <Text style={tw("text-[9px] text-gray-600 font-bold")}>
- Tax & Fees
- </Text>
- {lineShippingCost > 0 && (
- <View style={tw("flex flex-row justify-between")}>
- <Text
- style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
- >
- - Shipping
- </Text>
- <Text style={tw("text-[9px] text-gray-600")}>
- {numberFormatter.format(lineShippingCost)}
- </Text>
- </View>
- )}
- {lineAddOnCost > 0 && (
- <View style={tw("flex flex-row justify-between")}>
- <Text
- style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
- >
- - Add-On
- </Text>
- <Text style={tw("text-[9px] text-gray-600")}>
- {numberFormatter.format(lineAddOnCost)}
- </Text>
- </View>
- )}
- {lineNonTaxableAddOnCost > 0 && (
- <View style={tw("flex flex-row justify-between")}>
- <Text
- style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
- >
- - Non-Taxable Add-On
- </Text>
- <Text style={tw("text-[9px] text-gray-600")}>
- {numberFormatter.format(lineNonTaxableAddOnCost)}
- </Text>
- </View>
- )}
- {lineTaxPercent > 0 && (
- <View style={tw("flex flex-row justify-between")}>
- <Text
- style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
- >
- - Tax ({formatPercent(lineTaxPercent, locale)})
- </Text>
- <Text style={tw("text-[9px] text-gray-600")}>
- {numberFormatter.format(lineTaxAmount)}
- </Text>
- </View>
- )}
- </View>
- )}
+ totalTaxAndFees > 0 ? (
+ <View style={tw("mt-1")}>
+ <Text style={tw("text-[9px] text-gray-600 font-bold")}>
+ Tax & Fees
+ </Text>
+ {lineShippingCost > 0 ? (
+ <View style={tw("flex flex-row justify-between")}>
+ <Text
+ style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
+ >
+ - Shipping
+ </Text>
+ <Text style={tw("text-[9px] text-gray-600")}>
+ {numberFormatter.format(lineShippingCost)}
+ </Text>
+ </View>
+ ) : null}
+ {lineAddOnCost > 0 ? (
+ <View style={tw("flex flex-row justify-between")}>
+ <Text
+ style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
+ >
+ - Add-On
+ </Text>
+ <Text style={tw("text-[9px] text-gray-600")}>
+ {numberFormatter.format(lineAddOnCost)}
+ </Text>
+ </View>
+ ) : null}
+ {lineNonTaxableAddOnCost > 0 ? (
+ <View style={tw("flex flex-row justify-between")}>
+ <Text
+ style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
+ >
+ - Non-Taxable Add-On
+ </Text>
+ <Text style={tw("text-[9px] text-gray-600")}>
+ {numberFormatter.format(lineNonTaxableAddOnCost)}
+ </Text>
+ </View>
+ ) : null}
+ {lineTaxPercent > 0 ? (
+ <View style={tw("flex flex-row justify-between")}>
+ <Text
+ style={tw("text-[9px] text-gray-600 flex-1 pr-2")}
+ >
+ - Tax ({formatPercent(lineTaxPercent, locale)})
+ </Text>
+ <Text style={tw("text-[9px] text-gray-600")}>
+ {numberFormatter.format(lineTaxAmount)}
+ </Text>
+ </View>
+ ) : null}
+ </View>
+ ) : null}
</View>
<Text style={tw("w-1/6 text-center text-gray-600")}>
{line.salesOrderLineType === "Comment"
@@ -180,14 +180,14 @@ export function LineItemsBlock({
: numberFormatter.format(getLineTotal(line))}
</Text>
</View>
- {Object.keys(line.externalNotes ?? {}).length > 0 && (
+ {Object.keys(line.externalNotes ?? {}).length > 0 ? (
<View style={tw("px-3 py-2 border-b border-gray-200")}>
<Note
key={`${line.id}-notes`}
content={line.externalNotes as JSONContent}
/>
</View>
- )}
+ ) : null}
</View>
);
})}
diff --git a/packages/documents/src/pdf/blocks/salesOrder/PartiesBlock.tsx b/packages/documents/src/pdf/blocks/salesOrder/PartiesBlock.tsx
index f38d0e489b..4270b6de2f 100644
--- a/packages/documents/src/pdf/blocks/salesOrder/PartiesBlock.tsx
+++ b/packages/documents/src/pdf/blocks/salesOrder/PartiesBlock.tsx
@@ -58,11 +58,11 @@ export function PartiesBlock({ data }: { data: SalesOrderData }) {
postalCode={customerPostalCode}
country={customerCountryName}
/>
- {customerTaxId && !isEoriCountry(customerCountryName) && (
+ {customerTaxId && !isEoriCountry(customerCountryName) ? (
<Text>Tax ID: {customerTaxId}</Text>
- )}
- {customerVatNumber && <Text>VAT: {customerVatNumber}</Text>}
- {customerEori && <Text>EORI: {customerEori}</Text>}
+ ) : null}
+ {customerVatNumber ? <Text>VAT: {customerVatNumber}</Text> : null}
+ {customerEori ? <Text>EORI: {customerEori}</Text> : null}
</View>
</View>
@@ -79,15 +79,15 @@ export function PartiesBlock({ data }: { data: SalesOrderData }) {
Order Details
</Text>
<View style={tw("text-[9px] text-gray-800")}>
- {salesOrder?.orderDate && (
+ {salesOrder?.orderDate ? (
<Text>
Date: {formatDate(salesOrder.orderDate, undefined, locale)}
</Text>
- )}
- {salesOrder?.customerReference && (
+ ) : null}
+ {salesOrder?.customerReference ? (
<Text>Customer Ref: {salesOrder.customerReference}</Text>
- )}
- {salesOrder?.receiptRequestedDate && (
+ ) : null}
+ {salesOrder?.receiptRequestedDate ? (
<Text>
Requested:{" "}
{formatDate(
@@ -96,8 +96,8 @@ export function PartiesBlock({ data }: { data: SalesOrderData }) {
locale
)}
</Text>
- )}
- {salesOrder?.receiptPromisedDate && (
+ ) : null}
+ {salesOrder?.receiptPromisedDate ? (
<Text>
Promised:{" "}
{formatDate(
@@ -106,24 +106,28 @@ export function PartiesBlock({ data }: { data: SalesOrderData }) {
locale
)}
</Text>
- )}
- {paymentTerm && <Text>Payment Terms: {paymentTerm.name}</Text>}
- {shippingMethod && <Text>Shipping: {shippingMethod.name}</Text>}
- {salesOrder?.shippingTermName && (
+ ) : null}
+ {paymentTerm ? (
+ <Text>Payment Terms: {paymentTerm.name}</Text>
+ ) : null}
+ {shippingMethod ? (
+ <Text>Shipping: {shippingMethod.name}</Text>
+ ) : null}
+ {salesOrder?.shippingTermName ? (
<Text>Shipping Terms: {salesOrder.shippingTermName}</Text>
- )}
- {salesOrder?.incoterm && (
+ ) : null}
+ {salesOrder?.incoterm ? (
<Text>
Incoterm: {salesOrder.incoterm}
{salesOrder.incotermLocation
? ` — ${salesOrder.incotermLocation}`
: ""}
</Text>
- )}
+ ) : null}
</View>
</View>
- {paymentCustomerName && (
+ {paymentCustomerName ? (
<View style={tw("p-3")}>
<Text
style={tw("text-[9px] font-bold text-gray-600 mb-1 uppercase")}
@@ -142,7 +146,7 @@ export function PartiesBlock({ data }: { data: SalesOrderData }) {
/>
</View>
</View>
- )}
+ ) : null}
</View>
</View>
</View>
diff --git a/packages/documents/src/pdf/blocks/salesOrder/SummaryBlock.tsx b/packages/documents/src/pdf/blocks/salesOrder/SummaryBlock.tsx
index a86f4a15d9..437725806b 100644
--- a/packages/documents/src/pdf/blocks/salesOrder/SummaryBlock.tsx
+++ b/packages/documents/src/pdf/blocks/salesOrder/SummaryBlock.tsx
@@ -45,7 +45,7 @@ export function SummaryBlock({
(line) =>
(line.convertedAddOnCost ?? 0) > 0 ||
(line.convertedNonTaxableAddOnCost ?? 0) > 0
- ) && (
+ ) ? (
<View
style={[
tw("flex flex-row py-1.5 px-3 text-[9px]"),
@@ -67,7 +67,7 @@ export function SummaryBlock({
)}
</Text>
</View>
- )}
+ ) : null}
{(() => {
const lineShipping = salesOrderLines.reduce(
@@ -94,7 +94,7 @@ export function SummaryBlock({
) : null;
})()}
- {salesOrderLines.some((line) => (line.taxPercent ?? 0) > 0) && (
+ {salesOrderLines.some((line) => (line.taxPercent ?? 0) > 0) ? (
<View
style={[
tw("flex flex-row py-1.5 px-3 text-[9px]"),
@@ -113,7 +113,7 @@ export function SummaryBlock({
)}
</Text>
</View>
- )}
+ ) : null}
<View style={tw("h-[1px] bg-gray-200")} />
<View style={tw("flex flex-row py-2 px-3 text-[9px]")}>
diff --git a/packages/documents/src/pdf/blocks/salesReturnOrder/LineItemsBlock.tsx b/packages/documents/src/pdf/blocks/salesReturnOrder/LineItemsBlock.tsx
index f4920d703e..65aed93b2f 100644
--- a/packages/documents/src/pdf/blocks/salesReturnOrder/LineItemsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/salesReturnOrder/LineItemsBlock.tsx
@@ -68,7 +68,7 @@ export function LineItemsBlock({
<Text style={{ ...tw("text-gray-800"), ...overflow }}>
{line.item?.readableIdWithRevision ?? ""}
</Text>
- {line.item?.name && (
+ {line.item?.name ? (
<Text
style={{
...tw("text-[9px] text-gray-600 mt-0.5"),
@@ -77,7 +77,7 @@ export function LineItemsBlock({
>
{line.item.name}
</Text>
- )}
+ ) : null}
</View>
<Text style={tw("w-[16%] text-center text-gray-600")}>
{`${line.quantity ?? 0} ${line.unitOfMeasureCode ?? "EA"}`}
@@ -91,7 +91,7 @@ export function LineItemsBlock({
</View>
))}
- {total > 0 && (
+ {total > 0 ? (
<View style={tw("flex flex-row py-2 px-3 text-[9px]")}>
<Text style={tw("w-[62%] text-right pr-3 text-gray-800 font-bold")}>
{currencyCode ? `Total (${currencyCode})` : "Total"}
@@ -101,7 +101,7 @@ export function LineItemsBlock({
</Text>
<Text style={tw("w-[20%]")} />
</View>
- )}
+ ) : null}
</View>
);
}
diff --git a/packages/documents/src/pdf/blocks/salesReturnOrder/PartiesBlock.tsx b/packages/documents/src/pdf/blocks/salesReturnOrder/PartiesBlock.tsx
index 440b8021d2..cfa96d2f03 100644
--- a/packages/documents/src/pdf/blocks/salesReturnOrder/PartiesBlock.tsx
+++ b/packages/documents/src/pdf/blocks/salesReturnOrder/PartiesBlock.tsx
@@ -44,16 +44,16 @@ export function PartiesBlock({ data }: { data: SalesReturnOrderData }) {
Return Details
</Text>
<View style={tw("text-[9px] text-gray-800")}>
- {salesReturnOrder?.salesReturnOrderId && (
+ {salesReturnOrder?.salesReturnOrderId ? (
<Text>RMA Number: {salesReturnOrder.salesReturnOrderId}</Text>
- )}
- {salesReturnOrder?.orderDate && (
+ ) : null}
+ {salesReturnOrder?.orderDate ? (
<Text>
Date:{" "}
{formatDate(salesReturnOrder.orderDate, undefined, locale)}
</Text>
- )}
- {salesReturnOrder?.expirationDate && (
+ ) : null}
+ {salesReturnOrder?.expirationDate ? (
<Text>
Expires:{" "}
{formatDate(
@@ -62,10 +62,10 @@ export function PartiesBlock({ data }: { data: SalesReturnOrderData }) {
locale
)}
</Text>
- )}
- {salesReturnOrder?.customerReference && (
+ ) : null}
+ {salesReturnOrder?.customerReference ? (
<Text>Customer Ref: {salesReturnOrder.customerReference}</Text>
- )}
+ ) : null}
</View>
</View>
diff --git a/packages/documents/src/pdf/blocks/stockTransfer/LineItemsBlock.tsx b/packages/documents/src/pdf/blocks/stockTransfer/LineItemsBlock.tsx
index de53e89d5f..d94fb9ab19 100644
--- a/packages/documents/src/pdf/blocks/stockTransfer/LineItemsBlock.tsx
+++ b/packages/documents/src/pdf/blocks/stockTransfer/LineItemsBlock.tsx
@@ -82,17 +82,17 @@ export function LineItemsBlock({
{line.itemReadableId}
</Text>
{opts.showThumbnails &&
- thumbnails &&
- line.id != null &&
- line.id in thumbnails &&
- thumbnails[line.id] && (
- <View style={tw("mt-2 mb-2")}>
- <Image
- src={thumbnails[line.id]!}
- style={tw("w-1/4 h-auto max-w-[25%]")}
- />
- </View>
- )}
+ thumbnails &&
+ line.id != null &&
+ line.id in thumbnails &&
+ thumbnails[line.id] ? (
+ <View style={tw("mt-2 mb-2")}>
+ <Image
+ src={thumbnails[line.id]!}
+ style={tw("w-1/4 h-auto max-w-[25%]")}
+ />
+ </View>
+ ) : null}
<Image src={barcodeDataUrl} style={tw("max-w-[50%]")} />
</View>
diff --git a/packages/documents/src/pdf/components/AddressBlock.tsx b/packages/documents/src/pdf/components/AddressBlock.tsx
index bc8b6bcbbb..c4f8cd6af9 100644
--- a/packages/documents/src/pdf/components/AddressBlock.tsx
+++ b/packages/documents/src/pdf/components/AddressBlock.tsx
@@ -37,12 +37,12 @@ const AddressBlock = ({
const stateAndPostal = [stateProvince, postalCode].filter(Boolean).join(" ");
return (
<>
- {name && <Text style={tw("font-bold")}>{name}</Text>}
- {addressLine1 && <Text>{addressLine1}</Text>}
- {addressLine2 && <Text>{addressLine2}</Text>}
- {city && <Text>{city}</Text>}
- {stateAndPostal && <Text>{stateAndPostal}</Text>}
- {country && <Text>{country}</Text>}
+ {name ? <Text style={tw("font-bold")}>{name}</Text> : null}
+ {addressLine1 ? <Text>{addressLine1}</Text> : null}
+ {addressLine2 ? <Text>{addressLine2}</Text> : null}
+ {city ? <Text>{city}</Text> : null}
+ {stateAndPostal ? <Text>{stateAndPostal}</Text> : null}
+ {country ? <Text>{country}</Text> : null}
</>
);
};
diff --git a/packages/documents/src/pdf/components/Footer.tsx b/packages/documents/src/pdf/components/Footer.tsx
index 86c52f3402..36c994daca 100644
--- a/packages/documents/src/pdf/components/Footer.tsx
+++ b/packages/documents/src/pdf/components/Footer.tsx
@@ -44,11 +44,11 @@ const Footer = ({
]}
fixed
>
- {hasContent && (
+ {hasContent ? (
<View style={tw("text-[8px] text-gray-500 mb-2 px-1")}>
<Note content={content} />
</View>
- )}
+ ) : null}
<View style={tw("border-t border-gray-200 pt-3")}>
<View
style={tw(
@@ -56,7 +56,7 @@ const Footer = ({
)}
>
<Text>{showRegistrationLine ? (label ?? "") : ""}</Text>
- {showPageNumbers && (
+ {showPageNumbers ? (
<Text
render={({ pageNumber, totalPages }) =>
`${documentId ? `${documentId} ` : ""}Page ${pageNumber}${
@@ -64,7 +64,7 @@ const Footer = ({
}`
}
/>
- )}
+ ) : null}
</View>
</View>
</View>
diff --git a/packages/documents/src/pdf/components/Header.tsx b/packages/documents/src/pdf/components/Header.tsx
index f207da4ef7..ef4e4032a9 100644
--- a/packages/documents/src/pdf/components/Header.tsx
+++ b/packages/documents/src/pdf/components/Header.tsx
@@ -62,14 +62,14 @@ const Header = ({
{company.name}
</Text>
) : null}
- {opts.showCompanyDetails && (
+ {opts.showCompanyDetails ? (
<View style={tw("flex flex-col text-[9px] text-gray-800")}>
- {company.name && (
+ {company.name ? (
<Text style={tw("font-bold")}>{company.name}</Text>
- )}
- {company.addressLine1 && <Text>{company.addressLine1}</Text>}
- {company.addressLine2 && <Text>{company.addressLine2}</Text>}
- {(company.city || company.stateProvince || company.postalCode) && (
+ ) : null}
+ {company.addressLine1 ? <Text>{company.addressLine1}</Text> : null}
+ {company.addressLine2 ? <Text>{company.addressLine2}</Text> : null}
+ {company.city || company.stateProvince || company.postalCode ? (
<Text>
{formatCityStatePostalCode(
company.city,
@@ -77,9 +77,9 @@ const Header = ({
company.postalCode
)}
</Text>
- )}
+ ) : null}
</View>
- )}
+ ) : null}
</View>
{/* `shrink` (not `shrink-0`) so a long title — "Return Merchandise
Authorization" — wraps inside its 55% bound instead of overflowing
@@ -87,21 +87,21 @@ const Header = ({
<View
style={tw("flex flex-col items-end justify-start shrink max-w-[55%]")}
>
- {opts.showDocumentTitle && (
+ {opts.showDocumentTitle ? (
<Text style={tw("text-2xl font-bold text-gray-800 text-right")}>
{title}
</Text>
- )}
- {opts.showDocumentId && documentId && (
+ ) : null}
+ {opts.showDocumentId && documentId ? (
<Text style={tw("text-sm font-bold text-gray-600 -mt-4")}>
{documentId}
</Text>
- )}
- {documentSubId && (
+ ) : null}
+ {documentSubId ? (
<Text style={tw("text-[8px] font-bold text-gray-600")}>
{documentSubId}
</Text>
- )}
+ ) : null}
</View>
</View>
);
diff --git a/packages/documents/src/pdf/components/Note.tsx b/packages/documents/src/pdf/components/Note.tsx
index 7b4c3dfa3d..c60523797b 100644
--- a/packages/documents/src/pdf/components/Note.tsx
+++ b/packages/documents/src/pdf/components/Note.tsx
@@ -18,11 +18,11 @@ function makeConvert(theme: DocumentTheme) {
case "doc":
return (
<View style={{ fontSize: 9, width: "100%" }}>
- {args?.title && (
+ {args?.title ? (
<View style={[styles.thead, { color: theme.heading }]}>
<Text>{args.title}</Text>
</View>
- )}
+ ) : null}
{node?.content?.map((child) => convert(child))}
</View>
);
diff --git a/packages/documents/src/pdf/components/Summary.tsx b/packages/documents/src/pdf/components/Summary.tsx
index d209f3d19f..3802afa1c4 100644
--- a/packages/documents/src/pdf/components/Summary.tsx
+++ b/packages/documents/src/pdf/components/Summary.tsx
@@ -60,19 +60,19 @@ const Summary = ({ company, items }: SummaryProps) => {
<View style={styles.summary}>
<View style={styles.companyDetails}>
<Text style={styles.companyName}>{company.name}</Text>
- {company.addressLine1 && <Text>{company.addressLine1}</Text>}
- {company.addressLine2 && <Text>{company.addressLine2}</Text>}
- {company.city && <Text>{company.city}</Text>}
- {(company.stateProvince || company.postalCode) && (
+ {company.addressLine1 ? <Text>{company.addressLine1}</Text> : null}
+ {company.addressLine2 ? <Text>{company.addressLine2}</Text> : null}
+ {company.city ? <Text>{company.city}</Text> : null}
+ {company.stateProvince || company.postalCode ? (
<Text>
{[company.stateProvince, company.postalCode]
.filter(Boolean)
.join(" ")}
</Text>
- )}
- {company.phone && <Text>Phone: {company.phone}</Text>}
- {company.email && <Text>Email: {company.email}</Text>}
- {company.website && <Text>Website: {company.website}</Text>}
+ ) : null}
+ {company.phone ? <Text>Phone: {company.phone}</Text> : null}
+ {company.email ? <Text>Email: {company.email}</Text> : null}
+ {company.website ? <Text>Website: {company.website}</Text> : null}
</View>
<View style={styles.documentSummary}>
{items.map((item) => (
diff --git a/packages/documents/src/pdf/components/Template.tsx b/packages/documents/src/pdf/components/Template.tsx
index bcc1f78c83..5a9f348cfc 100644
--- a/packages/documents/src/pdf/components/Template.tsx
+++ b/packages/documents/src/pdf/components/Template.tsx
@@ -74,13 +74,13 @@ const Template = ({
>
<Page size="A4" style={styles.body}>
<DocStyleProvider value={docStyle}>
- {hasHeader && (
+ {hasHeader ? (
<View fixed style={{ marginBottom: 8 }}>
<Note content={headerContent} />
</View>
- )}
+ ) : null}
{children}
- {showFooter && (
+ {showFooter ? (
<Footer
label={footerLabel}
documentId={footerDocumentId}
@@ -89,7 +89,7 @@ const Template = ({
pageNumberFormat={pageNumberFormat}
showRegistrationLine={showRegistrationLine}
/>
- )}
+ ) : null}
</DocStyleProvider>
</Page>
</Document>
diff --git a/packages/files/src/storage.test.ts b/packages/files/src/storage.test.ts
index 1b1a987951..ec2229996e 100644
--- a/packages/files/src/storage.test.ts
+++ b/packages/files/src/storage.test.ts
@@ -3,11 +3,13 @@ import { describe, expect, it, vi } from "vitest";
import {
getCompanyPrivateBucket,
hasCompanyPrivateObjectPathPrefix,
+ isStorageNotFound,
isUnsafeStoragePath,
LEGACY_PRIVATE_BUCKET,
normalizeStorageSegment,
safeStorageFileName,
- storage
+ storage,
+ storageErrorStatus
} from "./storage";
const ok = <T>(data: T) => Promise.resolve({ data, error: null });
@@ -497,3 +499,75 @@ describe("move falls back to a cross-bucket move out of the legacy bucket", () =
expect(companyMove).not.toHaveBeenCalled();
});
});
+
+describe("storageErrorStatus", () => {
+ it("reads the status off a download's wrapped response", async () => {
+ const { StorageUnknownError } = await import("@supabase/storage-js");
+ const error = new StorageUnknownError(
+ "{}",
+ new Response(null, { status: 400 })
+ );
+ expect(storageErrorStatus(error)).toBe(400);
+ });
+
+ it("reads an API error's own status", async () => {
+ const { StorageApiError } = await import("@supabase/storage-js");
+ expect(storageErrorStatus(new StorageApiError("nope", 404, "404"))).toBe(
+ 404
+ );
+ });
+
+ it("is undefined when there is no status", () => {
+ expect(storageErrorStatus(new Error("offline"))).toBeUndefined();
+ expect(storageErrorStatus(null)).toBeUndefined();
+ });
+});
+
+describe("isStorageNotFound", () => {
+ // The shapes local storage actually returns from download(): HTTP 400 with
+ // the real code in a body download() leaves unread.
+ const downloadError = async (status: number, body?: unknown) => {
+ const { StorageUnknownError } = await import("@supabase/storage-js");
+ return new StorageUnknownError(
+ "{}",
+ new Response(body === undefined ? null : JSON.stringify(body), {
+ status
+ })
+ );
+ };
+
+ it("treats a 400 whose body says 404 as a miss (object or bucket)", async () => {
+ for (const error of ["not_found", "Bucket not found"]) {
+ expect(
+ await isStorageNotFound(
+ await downloadError(400, { statusCode: "404", error })
+ )
+ ).toBe(true);
+ }
+ });
+
+ it("treats a plain 404 as a miss", async () => {
+ expect(await isStorageNotFound(await downloadError(404))).toBe(true);
+ const { StorageApiError } = await import("@supabase/storage-js");
+ expect(
+ await isStorageNotFound(new StorageApiError("gone", 400, "404"))
+ ).toBe(true);
+ });
+
+ it("does not treat an invalid key or request (400) as a miss", async () => {
+ expect(
+ await isStorageNotFound(
+ await downloadError(400, { statusCode: "400", error: "InvalidKey" })
+ )
+ ).toBe(false);
+ expect(await isStorageNotFound(await downloadError(400))).toBe(false);
+ });
+
+ it("does not treat server, auth or status-less errors as a miss", async () => {
+ for (const status of [401, 403, 500, 503]) {
+ expect(await isStorageNotFound(await downloadError(status))).toBe(false);
+ }
+ expect(await isStorageNotFound(new Error("offline"))).toBe(false);
+ expect(await isStorageNotFound(null)).toBe(false);
+ });
+});
diff --git a/packages/files/src/storage.ts b/packages/files/src/storage.ts
index 4a6343adf8..3751dadda4 100644
--- a/packages/files/src/storage.ts
+++ b/packages/files/src/storage.ts
@@ -155,6 +155,47 @@ export type CarbonStorage = {
company(companyId: string): CompanyBucket;
};
+/**
+ * The HTTP status behind a storage error. `download()` skips reading the
+ * error body, so a 400/404 arrives as `StorageUnknownError("{}")` with the
+ * status only on the raw response in `originalError`.
+ */
+export function storageErrorStatus(error: unknown): number | undefined {
+ if (!error || typeof error !== "object") return undefined;
+ const { status, originalError } = error as {
+ status?: unknown;
+ originalError?: { status?: unknown };
+ };
+ if (typeof status === "number") return status;
+ return typeof originalError?.status === "number"
+ ? originalError.status
+ : undefined;
+}
+
+/**
+ * Whether a storage error means the object (or bucket) is not there. Storage
+ * answers a miss with HTTP 400 and `"statusCode":"404"` in the body, the same
+ * status it uses for an invalid key or request — so a 400 counts only when
+ * its body says 404. `download()` never reads that body, so it is still
+ * unread on `originalError`.
+ */
+export async function isStorageNotFound(error: unknown): Promise<boolean> {
+ if (!error || typeof error !== "object") return false;
+ const { statusCode, originalError } = error as {
+ statusCode?: unknown;
+ originalError?: unknown;
+ };
+ if (statusCode === "404" || storageErrorStatus(error) === 404) return true;
+ if (!(originalError instanceof Response) || originalError.status !== 400) {
+ return false;
+ }
+ const body = await originalError
+ .clone()
+ .json()
+ .catch(() => null);
+ return body?.statusCode === "404";
+}
+
export function storage(client: { storage: StorageClient }): CarbonStorage {
return {
from: (bucket) => client.storage.from(bucket),
diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.po
index 166f7feddd..08c6da6a15 100644
--- a/packages/locale/locales/de/erp.po
+++ b/packages/locale/locales/de/erp.po
@@ -3838,6 +3838,9 @@ msgstr "Personal ausblenden"
msgid "Collapse Machine"
msgstr "Maschine einklappen"
+msgid "Collapse row"
+msgstr "Zeile einklappen"
+
msgid "Collapse Setup"
msgstr "Rüsten einklappen"
@@ -7291,6 +7294,9 @@ msgstr "Personal erweitern"
msgid "Expand Machine"
msgstr "Maschine ausklappen"
+msgid "Expand row"
+msgstr "Zeile ausklappen"
+
msgid "Expand Setup"
msgstr "Rüsten ausklappen"
@@ -8743,6 +8749,9 @@ msgstr "Ich arbeite noch"
msgid "IBAN"
msgstr "IBAN"
+msgid "IC Transaction"
+msgstr "Intercompany-Transaktion"
+
msgid "Id"
msgstr "ID"
diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.po
index 93481bef3c..096705fc0f 100644
--- a/packages/locale/locales/en/erp.po
+++ b/packages/locale/locales/en/erp.po
@@ -3838,6 +3838,9 @@ msgstr "Collapse Labor"
msgid "Collapse Machine"
msgstr "Collapse Machine"
+msgid "Collapse row"
+msgstr "Collapse row"
+
msgid "Collapse Setup"
msgstr "Collapse Setup"
@@ -7291,6 +7294,9 @@ msgstr "Expand Labor"
msgid "Expand Machine"
msgstr "Expand Machine"
+msgid "Expand row"
+msgstr "Expand row"
+
msgid "Expand Setup"
msgstr "Expand Setup"
@@ -8743,6 +8749,9 @@ msgstr "I'm Still Working"
msgid "IBAN"
msgstr "IBAN"
+msgid "IC Transaction"
+msgstr "IC Transaction"
+
msgid "Id"
msgstr "Id"
diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.po
index 4d1175b88a..bea0c9c773 100644
--- a/packages/locale/locales/es/erp.po
+++ b/packages/locale/locales/es/erp.po
@@ -3838,6 +3838,9 @@ msgstr "Contraer mano de obra"
msgid "Collapse Machine"
msgstr "Contraer máquina"
+msgid "Collapse row"
+msgstr "Contraer fila"
+
msgid "Collapse Setup"
msgstr "Contraer preparación"
@@ -7291,6 +7294,9 @@ msgstr "Expandir mano de obra"
msgid "Expand Machine"
msgstr "Expandir máquina"
+msgid "Expand row"
+msgstr "Expandir fila"
+
msgid "Expand Setup"
msgstr "Expandir preparación"
@@ -8743,6 +8749,9 @@ msgstr "Todavía estoy trabajando"
msgid "IBAN"
msgstr "IBAN"
+msgid "IC Transaction"
+msgstr "Transacción intercompañía"
+
msgid "Id"
msgstr "Id"
diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.po
index 28c64001e2..7bb30de65b 100644
--- a/packages/locale/locales/fr/erp.po
+++ b/packages/locale/locales/fr/erp.po
@@ -3838,6 +3838,9 @@ msgstr "Réduire la main-d'œuvre"
msgid "Collapse Machine"
msgstr "Réduire Machine"
+msgid "Collapse row"
+msgstr "Réduire la ligne"
+
msgid "Collapse Setup"
msgstr "Réduire la configuration"
@@ -7291,6 +7294,9 @@ msgstr "Développer Main-d'œuvre"
msgid "Expand Machine"
msgstr "Développer Machine"
+msgid "Expand row"
+msgstr "Développer la ligne"
+
msgid "Expand Setup"
msgstr "Développer Configuration"
@@ -8743,6 +8749,9 @@ msgstr "Je travaille toujours"
msgid "IBAN"
msgstr "IBAN"
+msgid "IC Transaction"
+msgstr "Transaction intersociétés"
+
msgid "Id"
msgstr "Id"
diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.po
index 77fee1cf65..c9c471575c 100644
--- a/packages/locale/locales/hi/erp.po
+++ b/packages/locale/locales/hi/erp.po
@@ -3838,6 +3838,9 @@ msgstr "श्रम को संक्षिप्त करें"
msgid "Collapse Machine"
msgstr "मशीन को संक्षिप्त करें"
+msgid "Collapse row"
+msgstr "पंक्ति संक्षिप्त करें"
+
msgid "Collapse Setup"
msgstr "सेटअप को संक्षिप्त करें"
@@ -7291,6 +7294,9 @@ msgstr "श्रम विस्तृत करें"
msgid "Expand Machine"
msgstr "मशीन का विस्तार करें"
+msgid "Expand row"
+msgstr "पंक्ति का विस्तार करें"
+
msgid "Expand Setup"
msgstr "सेटअप विस्तृत करें"
@@ -8743,6 +8749,9 @@ msgstr "मैं अभी भी काम कर रहा हूँ"
msgid "IBAN"
msgstr "IBAN"
+msgid "IC Transaction"
+msgstr "अंतरकंपनी लेनदेन"
+
msgid "Id"
msgstr "आईडी"
diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.po
index a7736a476c..7c39d3caf7 100644
--- a/packages/locale/locales/it/erp.po
+++ b/packages/locale/locales/it/erp.po
@@ -3838,6 +3838,9 @@ msgstr "Comprimi manodopera"
msgid "Collapse Machine"
msgstr "Comprimi macchina"
+msgid "Collapse row"
+msgstr "Comprimi riga"
+
msgid "Collapse Setup"
msgstr "Comprimi preparazione"
@@ -7291,6 +7294,9 @@ msgstr "Espandi manodopera"
msgid "Expand Machine"
msgstr "Espandi macchina"
+msgid "Expand row"
+msgstr "Espandi riga"
+
msgid "Expand Setup"
msgstr "Espandi preparazione"
@@ -8743,6 +8749,9 @@ msgstr "Sto ancora lavorando"
msgid "IBAN"
msgstr "IBAN"
+msgid "IC Transaction"
+msgstr "Transazione interaziendale"
+
msgid "Id"
msgstr "ID"
diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.po
index f9d613fbb9..0325565f63 100644
--- a/packages/locale/locales/ja/erp.po
+++ b/packages/locale/locales/ja/erp.po
@@ -3838,6 +3838,9 @@ msgstr "労務を折りたたみ"
msgid "Collapse Machine"
msgstr "機械を折りたたむ"
+msgid "Collapse row"
+msgstr "行を折りたたむ"
+
msgid "Collapse Setup"
msgstr "段取りを折りたたむ"
@@ -7291,6 +7294,9 @@ msgstr "労務を展開"
msgid "Expand Machine"
msgstr "機械を展開"
+msgid "Expand row"
+msgstr "行を展開"
+
msgid "Expand Setup"
msgstr "段取りを展開"
@@ -8743,6 +8749,9 @@ msgstr "まだ働いています"
msgid "IBAN"
msgstr "IBAN"
+msgid "IC Transaction"
+msgstr "企業間取引"
+
msgid "Id"
msgstr "ID"
diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.po
index 3a84442bd5..90ffedf7dc 100644
--- a/packages/locale/locales/ko/erp.po
+++ b/packages/locale/locales/ko/erp.po
@@ -3838,6 +3838,9 @@ msgstr "노무 접기"
msgid "Collapse Machine"
msgstr "기계 접기"
+msgid "Collapse row"
+msgstr "행 접기"
+
msgid "Collapse Setup"
msgstr "셋업 접기"
@@ -7291,6 +7294,9 @@ msgstr "노무 펼치기"
msgid "Expand Machine"
msgstr "기계 펼치기"
+msgid "Expand row"
+msgstr "행 펼치기"
+
msgid "Expand Setup"
msgstr "셋업 펼치기"
@@ -8743,6 +8749,9 @@ msgstr "아직 작업 중입니다"
msgid "IBAN"
msgstr "IBAN"
+msgid "IC Transaction"
+msgstr "회사 간 거래"
+
msgid "Id"
msgstr "Id"
diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.po
index 160a162427..ec28ddc1d7 100644
--- a/packages/locale/locales/pl/erp.po
+++ b/packages/locale/locales/pl/erp.po
@@ -3838,6 +3838,9 @@ msgstr "Zwiń robociznę"
msgid "Collapse Machine"
msgstr "Zwiń maszynę"
+msgid "Collapse row"
+msgstr "Zwiń wiersz"
+
msgid "Collapse Setup"
msgstr "Zwiń Setup"
@@ -7291,6 +7294,9 @@ msgstr "Rozwiń Robociznę"
msgid "Expand Machine"
msgstr "Rozwiń Maszynę"
+msgid "Expand row"
+msgstr "Rozwiń wiersz"
+
msgid "Expand Setup"
msgstr "Rozwiń Setup"
@@ -8743,6 +8749,9 @@ msgstr "Wciąż pracuję"
msgid "IBAN"
msgstr "IBAN"
+msgid "IC Transaction"
+msgstr "Transakcja międzyfirmowa"
+
msgid "Id"
msgstr "Id"
diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.po
index 062bb7b10b..2ff6f688a0 100644
--- a/packages/locale/locales/pt/erp.po
+++ b/packages/locale/locales/pt/erp.po
@@ -3838,6 +3838,9 @@ msgstr "Recolher Mão de obra"
msgid "Collapse Machine"
msgstr "Recolher Máquina"
+msgid "Collapse row"
+msgstr "Recolher linha"
+
msgid "Collapse Setup"
msgstr "Recolher Configuração"
@@ -7291,6 +7294,9 @@ msgstr "Expandir Mão de obra"
msgid "Expand Machine"
msgstr "Expandir Máquina"
+msgid "Expand row"
+msgstr "Expandir linha"
+
msgid "Expand Setup"
msgstr "Expandir Configuração"
@@ -8743,6 +8749,9 @@ msgstr "Ainda estou trabalhando"
msgid "IBAN"
msgstr "IBAN"
+msgid "IC Transaction"
+msgstr "Transação intercompanhia"
+
msgid "Id"
msgstr "Id"
diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.po
index 71076f4109..773ad815fc 100644
--- a/packages/locale/locales/ru/erp.po
+++ b/packages/locale/locales/ru/erp.po
@@ -3838,6 +3838,9 @@ msgstr "Свернуть Труд"
msgid "Collapse Machine"
msgstr "Свернуть станок"
+msgid "Collapse row"
+msgstr "Свернуть строку"
+
msgid "Collapse Setup"
msgstr "Свернуть настройку"
@@ -7291,6 +7294,9 @@ msgstr "Развернуть Труд"
msgid "Expand Machine"
msgstr "Развернуть Станок"
+msgid "Expand row"
+msgstr "Развернуть строку"
+
msgid "Expand Setup"
msgstr "Развернуть Setup"
@@ -8743,6 +8749,9 @@ msgstr "Я всё ещё работаю"
msgid "IBAN"
msgstr "IBAN"
+msgid "IC Transaction"
+msgstr "Межкомпанийная операция"
+
msgid "Id"
msgstr "ID"
diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.po
index 4913602dca..5de6ceb226 100644
--- a/packages/locale/locales/tr/erp.po
+++ b/packages/locale/locales/tr/erp.po
@@ -3838,6 +3838,9 @@ msgstr "İşçilik Süresini Daralt"
msgid "Collapse Machine"
msgstr "Makineyi Daralt"
+msgid "Collapse row"
+msgstr "Satırı Daralt"
+
msgid "Collapse Setup"
msgstr "Kurulumu Daralt"
@@ -7291,6 +7294,9 @@ msgstr "İşçilik Genişlet"
msgid "Expand Machine"
msgstr "Makineyi Genişlet"
+msgid "Expand row"
+msgstr "Satırı Genişlet"
+
msgid "Expand Setup"
msgstr "Kurulumu Genişlet"
@@ -8743,6 +8749,9 @@ msgstr "Hala Çalışıyorum"
msgid "IBAN"
msgstr "IBAN"
+msgid "IC Transaction"
+msgstr "Şirketler Arası İşlem"
+
msgid "Id"
msgstr "Id"
diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.po
index 35fd0c82bc..03f03d69c4 100644
--- a/packages/locale/locales/zh/erp.po
+++ b/packages/locale/locales/zh/erp.po
@@ -3838,6 +3838,9 @@ msgstr "折叠人工"
msgid "Collapse Machine"
msgstr "折叠机器"
+msgid "Collapse row"
+msgstr "折叠行"
+
msgid "Collapse Setup"
msgstr "收起换型"
@@ -7291,6 +7294,9 @@ msgstr "展开人工"
msgid "Expand Machine"
msgstr "展开机器"
+msgid "Expand row"
+msgstr "展开行"
+
msgid "Expand Setup"
msgstr "展开 换型"
@@ -8743,6 +8749,9 @@ msgstr "我仍在工作"
msgid "IBAN"
msgstr "IBAN"
+msgid "IC Transaction"
+msgstr "公司间交易"
+
msgid "Id"
msgstr "ID"