Skip to content

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

feat: add supplier part to search, autofocus number, and use four digits for currency

Brad Barbin8584dafc414d
diff --git a/apps/carbon/app/components/Layout/Topbar/Search.tsx b/apps/carbon/app/components/Layout/Topbar/Search.tsx
index bd834f51a2..27b4e6a472 100644
--- a/apps/carbon/app/components/Layout/Topbar/Search.tsx
+++ b/apps/carbon/app/components/Layout/Topbar/Search.tsx
@@ -190,7 +190,7 @@ const SearchModal = ({
// append with : so we're not sharing a value with a static result
value={`:${result.to}`}
>
- <RxMagnifyingGlass className="w-4 h-4 mr-2" />
+ <RxMagnifyingGlass className="w-4 h-4 flex-shrink-0 mr-2" />
{result.name}
</CommandItem>
))}
@@ -208,7 +208,7 @@ const SearchModal = ({
value={`${module} ${submodule.name}`}
>
{submodule.icon && (
- <submodule.icon className="w-4 h-4 mr-2" />
+ <submodule.icon className="w-4 h-4 flex-shrink-0 mr-2" />
)}
<span>{submodule.name}</span>
</CommandItem>
@@ -255,33 +255,40 @@ const SearchModal = ({
function ResultIcon({ entity }: { entity: SearchResult["entity"] | "Module" }) {
switch (entity) {
case "Customer":
- return <LuUserSquare className="w-4 h-4 mr-2" />;
+ return <LuUserSquare className="w-4 h-4 flex-shrink-0 mr-2" />;
case "Document":
- return <HiOutlineDocumentDuplicate className="w-4 h-4 mr-2" />;
+ return (
+ <HiOutlineDocumentDuplicate className="w-4 h-4 flex-shrink-0 mr-2" />
+ );
case "Job":
- return <LuHardHat className="w-4 h-4 mr-2" />;
+ return <LuHardHat className="w-4 h-4 flex-shrink-0 mr-2" />;
case "Part":
case "Material":
case "Tool":
case "Fixture":
case "Consumable":
- return <MethodItemTypeIcon type={entity} className="w-4 h-4 mr-2" />;
+ return (
+ <MethodItemTypeIcon
+ type={entity}
+ className="w-4 h-4 flex-shrink-0 mr-2"
+ />
+ );
case "Person":
- return <LuUser className="w-4 h-4 mr-2" />;
+ return <LuUser className="w-4 h-4 flex-shrink-0 mr-2" />;
case "Resource":
- return <LuWrench className="w-4 h-4 mr-2" />;
+ return <LuWrench className="w-4 h-4 flex-shrink-0 mr-2" />;
case "Purchase Order":
- return <LuShoppingCart className="w-4 h-4 mr-2" />;
+ return <LuShoppingCart className="w-4 h-4 flex-shrink-0 mr-2" />;
case "Opportunity":
case "Lead":
case "Sales RFQ":
- return <RiProgress2Line className="w-4 h-4 mr-2" />;
+ return <RiProgress2Line className="w-4 h-4 flex-shrink-0 mr-2" />;
case "Quotation":
- return <RiProgress4Line className="w-4 h-4 mr-2" />;
+ return <RiProgress4Line className="w-4 h-4 flex-shrink-0 mr-2" />;
case "Sales Order":
- return <RiProgress8Line className="w-4 h-4 mr-2" />;
+ return <RiProgress8Line className="w-4 h-4 flex-shrink-0 mr-2" />;
case "Supplier":
- return <PiShareNetworkFill className="w-4 h-4 mr-2" />;
+ return <PiShareNetworkFill className="w-4 h-4 flex-shrink-0 mr-2" />;
default:
return null;
}
diff --git a/apps/carbon/app/hooks/useCurrencyFormatter.tsx b/apps/carbon/app/hooks/useCurrencyFormatter.tsx
index 4a00584fe5..2773031830 100644
--- a/apps/carbon/app/hooks/useCurrencyFormatter.tsx
+++ b/apps/carbon/app/hooks/useCurrencyFormatter.tsx
@@ -12,6 +12,7 @@ export function useCurrencyFormatter(currencyCode?: string) {
new Intl.NumberFormat(locale, {
style: "currency",
currency: currency,
+ maximumFractionDigits: 4,
}),
[locale, currency]
);
diff --git a/apps/carbon/app/modules/account/ui/Profile/ProfilePhotoForm.tsx b/apps/carbon/app/modules/account/ui/Profile/ProfilePhotoForm.tsx
index cd56f033f6..c390944043 100644
--- a/apps/carbon/app/modules/account/ui/Profile/ProfilePhotoForm.tsx
+++ b/apps/carbon/app/modules/account/ui/Profile/ProfilePhotoForm.tsx
@@ -1,5 +1,5 @@
-import { useCarbon } from "@carbon/auth";
-import { Button, File, VStack, toast } from "@carbon/react";
+import { SUPABASE_API_URL, useCarbon } from "@carbon/auth";
+import { Button, File as FileUpload, VStack, toast } from "@carbon/react";
import { useSubmit } from "@remix-run/react";
import type { ChangeEvent } from "react";
import { Avatar } from "~/components";
@@ -16,11 +16,39 @@ const ProfilePhotoForm = ({ user }: ProfilePhotoFormProps) => {
const uploadImage = async (e: ChangeEvent<HTMLInputElement>) => {
if (e.target.files && carbon) {
- const avatarFile = e.target.files[0];
+ let avatarFile = e.target.files[0];
const fileExtension = avatarFile.name.substring(
avatarFile.name.lastIndexOf(".") + 1
);
+ const formData = new FormData();
+ formData.append("file", avatarFile);
+
+ try {
+ const response = await fetch(
+ `${SUPABASE_API_URL}/functions/v1/image-resizer`,
+ {
+ method: "POST",
+ body: formData,
+ }
+ );
+
+ if (!response.ok) {
+ throw new Error("Failed to resize image");
+ }
+
+ const blob = await response.blob();
+ const resizedFile = new File([blob], `${user.id}.${fileExtension}`, {
+ type: "image/png",
+ });
+
+ avatarFile = resizedFile;
+ } catch (error) {
+ console.error(error);
+ toast.error("Failed to resize image");
+ return;
+ }
+
const imageUpload = await carbon.storage
.from("avatars")
.upload(`${user.id}.${fileExtension}`, avatarFile, {
@@ -71,9 +99,9 @@ const ProfilePhotoForm = ({ user }: ProfilePhotoFormProps) => {
path={user?.avatarUrl}
name={user?.fullName ?? undefined}
/>
- <File accept="image/*" onChange={uploadImage}>
+ <FileUpload accept="image/*" onChange={uploadImage}>
{user.avatarUrl ? "Change" : "Upload"}
- </File>
+ </FileUpload>
{user.avatarUrl && (
<Button variant="secondary" onClick={deleteImage}>
diff --git a/apps/carbon/app/modules/items/items.service.ts b/apps/carbon/app/modules/items/items.service.ts
index 4c00a207a4..fac50e553f 100644
--- a/apps/carbon/app/modules/items/items.service.ts
+++ b/apps/carbon/app/modules/items/items.service.ts
@@ -160,7 +160,7 @@ export async function getConsumables(
if (args.search) {
query = query.or(
- `id.ilike.%${args.search}%,name.ilike.%${args.search}%,description.ilike.%${args.search}%`
+ `id.ilike.%${args.search}%,name.ilike.%${args.search}%,description.ilike.%${args.search}%,supplierIds.ilike.%${args.search}%`
);
}
@@ -228,7 +228,7 @@ export async function getFixtures(
if (args.search) {
query = query.or(
- `id.ilike.%${args.search}%,name.ilike.%${args.search}%,description.ilike.%${args.search}%`
+ `id.ilike.%${args.search}%,name.ilike.%${args.search}%,description.ilike.%${args.search}%,supplierIds.ilike.%${args.search}%`
);
}
@@ -481,7 +481,7 @@ export async function getMaterials(
if (args.search) {
query = query.or(
- `id.ilike.%${args.search}%,name.ilike.%${args.search}%,description.ilike.%${args.search}%`
+ `id.ilike.%${args.search}%,name.ilike.%${args.search}%,description.ilike.%${args.search}%,supplierIds.ilike.%${args.search}%`
);
}
@@ -790,7 +790,7 @@ export async function getParts(
if (args.search) {
query = query.or(
- `id.ilike.%${args.search}%,name.ilike.%${args.search}%,description.ilike.%${args.search}%`
+ `id.ilike.%${args.search}%,name.ilike.%${args.search}%,description.ilike.%${args.search}%,supplierIds.ilike.%${args.search}%`
);
}
@@ -962,7 +962,7 @@ export async function getTools(
if (args.search) {
query = query.or(
- `id.ilike.%${args.search}%,name.ilike.%${args.search}%,description.ilike.%${args.search}%`
+ `id.ilike.%${args.search}%,name.ilike.%${args.search}%,description.ilike.%${args.search}%,supplierIds.ilike.%${args.search}%`
);
}
diff --git a/apps/carbon/app/modules/items/ui/Fixtures/FixtureForm.tsx b/apps/carbon/app/modules/items/ui/Fixtures/FixtureForm.tsx
index a305198d36..0b0102e133 100644
--- a/apps/carbon/app/modules/items/ui/Fixtures/FixtureForm.tsx
+++ b/apps/carbon/app/modules/items/ui/Fixtures/FixtureForm.tsx
@@ -182,6 +182,7 @@ const FixtureForm = ({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
minValue={0}
/>
diff --git a/apps/carbon/app/modules/items/ui/Item/BuyMethodForm.tsx b/apps/carbon/app/modules/items/ui/Item/BuyMethodForm.tsx
index 483c9e2b62..2081196316 100644
--- a/apps/carbon/app/modules/items/ui/Item/BuyMethodForm.tsx
+++ b/apps/carbon/app/modules/items/ui/Item/BuyMethodForm.tsx
@@ -23,7 +23,7 @@ import {
Supplier,
UnitOfMeasure,
} from "~/components/Form";
-import { usePermissions, useRouteData } from "~/hooks";
+import { usePermissions, useRouteData, useUser } from "~/hooks";
import type { PartSummary } from "~/modules/items";
import { buyMethodValidator } from "~/modules/items";
import { path } from "~/utils/path";
@@ -36,6 +36,10 @@ type BuyMethodFormProps = {
const BuyMethodForm = ({ initialValues, type }: BuyMethodFormProps) => {
const permissions = usePermissions();
const navigate = useNavigate();
+
+ const { company } = useUser();
+ const baseCurrency = company?.baseCurrencyCode ?? "USD";
+
const { itemId } = useParams();
if (!itemId) throw new Error("itemId not found");
@@ -80,7 +84,16 @@ const BuyMethodForm = ({ initialValues, type }: BuyMethodFormProps) => {
<VStack spacing={4}>
<Supplier name="supplierId" label="Supplier" />
<Input name="supplierPartId" label="Supplier Part ID" />
- <Number name="unitPrice" label="Unit Price" minValue={0} />
+ <Number
+ name="unitPrice"
+ label="Unit Price"
+ minValue={0}
+ formatOptions={{
+ style: "currency",
+ currency: baseCurrency,
+ maximumFractionDigits: 4,
+ }}
+ />
<UnitOfMeasure
name="supplierUnitOfMeasureCode"
label="Unit of Measure"
diff --git a/apps/carbon/app/modules/items/ui/Item/ItemCostingForm.tsx b/apps/carbon/app/modules/items/ui/Item/ItemCostingForm.tsx
index b164f7dd86..e8449b056f 100644
--- a/apps/carbon/app/modules/items/ui/Item/ItemCostingForm.tsx
+++ b/apps/carbon/app/modules/items/ui/Item/ItemCostingForm.tsx
@@ -68,6 +68,7 @@ const ItemCostingForm = ({ initialValues }: ItemCostingFormProps) => {
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
isReadOnly={partCostingMethod !== "Standard"}
/>
@@ -78,6 +79,7 @@ const ItemCostingForm = ({ initialValues }: ItemCostingFormProps) => {
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
/>
@@ -87,6 +89,7 @@ const ItemCostingForm = ({ initialValues }: ItemCostingFormProps) => {
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
isReadOnly
/>
diff --git a/apps/carbon/app/modules/items/ui/Item/ItemSalePriceForm.tsx b/apps/carbon/app/modules/items/ui/Item/ItemSalePriceForm.tsx
index 2ca6cb0cc8..b56ae1406a 100644
--- a/apps/carbon/app/modules/items/ui/Item/ItemSalePriceForm.tsx
+++ b/apps/carbon/app/modules/items/ui/Item/ItemSalePriceForm.tsx
@@ -48,6 +48,7 @@ const ItemSalePriceForm = ({ initialValues }: ItemSalePriceFormProps) => {
formatOptions={{
style: "currency",
currency,
+ maximumFractionDigits: 4,
}}
/>
<Currency
diff --git a/apps/carbon/app/modules/items/ui/Materials/MaterialForm.tsx b/apps/carbon/app/modules/items/ui/Materials/MaterialForm.tsx
index c04dcfb67a..941050149b 100644
--- a/apps/carbon/app/modules/items/ui/Materials/MaterialForm.tsx
+++ b/apps/carbon/app/modules/items/ui/Materials/MaterialForm.tsx
@@ -179,6 +179,7 @@ const MaterialForm = ({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
minValue={0}
/>
diff --git a/apps/carbon/app/modules/items/ui/Parts/PartForm.tsx b/apps/carbon/app/modules/items/ui/Parts/PartForm.tsx
index 74201a86c1..f5ec55fc7c 100644
--- a/apps/carbon/app/modules/items/ui/Parts/PartForm.tsx
+++ b/apps/carbon/app/modules/items/ui/Parts/PartForm.tsx
@@ -180,6 +180,7 @@ const PartForm = ({ initialValues, type = "card", onClose }: PartFormProps) => {
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
minValue={0}
/>
diff --git a/apps/carbon/app/modules/items/ui/Tools/ToolForm.tsx b/apps/carbon/app/modules/items/ui/Tools/ToolForm.tsx
index 2a18eadc94..4c9f9a12e5 100644
--- a/apps/carbon/app/modules/items/ui/Tools/ToolForm.tsx
+++ b/apps/carbon/app/modules/items/ui/Tools/ToolForm.tsx
@@ -156,6 +156,7 @@ const ToolForm = ({ initialValues, type = "card", onClose }: ToolFormProps) => {
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
minValue={0}
/>
diff --git a/apps/carbon/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx b/apps/carbon/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
index 0d91268de1..0ed20af5bb 100644
--- a/apps/carbon/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
+++ b/apps/carbon/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
@@ -595,6 +595,7 @@ function MaterialForm({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
/>
)}
diff --git a/apps/carbon/app/modules/production/ui/Jobs/JobBillOfProcess.tsx b/apps/carbon/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
index 319ed06897..1eb54712a8 100644
--- a/apps/carbon/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
+++ b/apps/carbon/app/modules/production/ui/Jobs/JobBillOfProcess.tsx
@@ -961,6 +961,7 @@ function OperationForm({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
onChange={(newValue) =>
setProcessData((d) => ({
@@ -977,6 +978,7 @@ function OperationForm({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
onChange={(newValue) =>
setProcessData((d) => ({
@@ -1254,6 +1256,7 @@ function OperationForm({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
onChange={(newValue) =>
setProcessData((d) => ({
@@ -1270,6 +1273,7 @@ function OperationForm({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
onChange={(newValue) =>
setProcessData((d) => ({
@@ -1286,6 +1290,7 @@ function OperationForm({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
onChange={(newValue) =>
setProcessData((d) => ({
diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierProcessForm.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierProcessForm.tsx
index ceea70c632..f9ddc4aeee 100644
--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierProcessForm.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierProcessForm.tsx
@@ -119,6 +119,7 @@ const SupplierProcessForm = ({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
minValue={0}
/>
@@ -128,6 +129,7 @@ const SupplierProcessForm = ({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
minValue={0}
/>
diff --git a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierProcesses.tsx b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierProcesses.tsx
index d862c96d15..c28e4dfbff 100644
--- a/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierProcesses.tsx
+++ b/apps/carbon/app/modules/purchasing/ui/Supplier/SupplierProcesses.tsx
@@ -137,10 +137,18 @@ const SupplierProccesses = ({ processes }: SupplierProccessesProps) => {
const editableComponents = useMemo(
() => ({
minimumCost: EditableNumber(onCellEdit, {
- formatOptions: { style: "currency", currency: baseCurrency },
+ formatOptions: {
+ style: "currency",
+ currency: baseCurrency,
+ maximumFractionDigits: 4,
+ },
}),
unitCost: EditableNumber(onCellEdit, {
- formatOptions: { style: "currency", currency: baseCurrency },
+ formatOptions: {
+ style: "currency",
+ currency: baseCurrency,
+ maximumFractionDigits: 4,
+ },
}),
leadTime: EditableNumber(onCellEdit),
}),
diff --git a/apps/carbon/app/modules/resources/ui/WorkCenters/WorkCenterForm.tsx b/apps/carbon/app/modules/resources/ui/WorkCenters/WorkCenterForm.tsx
index 6da5e455c2..7c11ca6976 100644
--- a/apps/carbon/app/modules/resources/ui/WorkCenters/WorkCenterForm.tsx
+++ b/apps/carbon/app/modules/resources/ui/WorkCenters/WorkCenterForm.tsx
@@ -114,6 +114,7 @@ const WorkCenterForm = ({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
/>
<Number
@@ -122,6 +123,7 @@ const WorkCenterForm = ({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
/>
<Number
@@ -130,6 +132,7 @@ const WorkCenterForm = ({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
/>
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
index 13c7d7da50..97bcff758c 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
@@ -596,6 +596,7 @@ function MaterialForm({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
/>
)}
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
index c1d73f9f41..8a38a4a106 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx
@@ -838,6 +838,7 @@ function OperationForm({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
onChange={(newValue) =>
setProcessData((d) => ({
@@ -854,6 +855,7 @@ function OperationForm({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
onChange={(newValue) =>
setProcessData((d) => ({
@@ -1131,6 +1133,7 @@ function OperationForm({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
onChange={(newValue) =>
setProcessData((d) => ({
@@ -1147,6 +1150,7 @@ function OperationForm({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
onChange={(newValue) =>
setProcessData((d) => ({
@@ -1163,6 +1167,7 @@ function OperationForm({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
onChange={(newValue) =>
setProcessData((d) => ({
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx
index 92f11b1d0f..749ccff1d6 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx
@@ -394,6 +394,7 @@ const QuoteLinePricing = ({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
minValue={0}
onChange={(value) => {
@@ -476,6 +477,7 @@ const QuoteLinePricing = ({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
minValue={0}
onChange={(value) => {
@@ -676,6 +678,7 @@ const QuoteLinePricing = ({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
onChange={(value) => {
if (
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteToOrderModal.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteToOrderModal.tsx
index cfbe8d5a21..20208cd676 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteToOrderModal.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteToOrderModal.tsx
@@ -634,6 +634,7 @@ const LinePricingOptions = ({
formatOptions={{
style: "currency",
currency: quoteCurrency,
+ maximumFractionDigits: 4,
}}
onChange={(netUnitPrice) =>
setOverridePricing((v) => ({
@@ -664,6 +665,7 @@ const LinePricingOptions = ({
formatOptions={{
style: "currency",
currency: quoteCurrency,
+ maximumFractionDigits: 4,
}}
onChange={(addOn) =>
setOverridePricing((v) => ({
diff --git a/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx b/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx
index 2c953eb522..510691123e 100644
--- a/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx
@@ -318,6 +318,7 @@ const SalesOrderLineForm = ({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
onChange={(value) =>
setItemData((d) => ({
@@ -332,6 +333,7 @@ const SalesOrderLineForm = ({
formatOptions={{
style: "currency",
currency: baseCurrency,
+ maximumFractionDigits: 4,
}}
/>
diff --git a/packages/auth/src/lib/supabase/provider.tsx b/packages/auth/src/lib/supabase/provider.tsx
index 935eb38aea..6dfa06342a 100644
--- a/packages/auth/src/lib/supabase/provider.tsx
+++ b/packages/auth/src/lib/supabase/provider.tsx
@@ -28,7 +28,7 @@ export const CarbonProvider = ({
}: PropsWithChildren<{
session: Partial<AuthSession>;
}>) => {
- const { accessToken, refreshToken, expiresIn, expiresAt } = session;
+ const { accessToken, refreshToken, expiresAt } = session;
const initialLoad = useRef(true);
const authenticatedClientLoaded = useRef(false);
const [carbon, setCarbon] = useState<SupabaseClient<Database> | undefined>(
@@ -40,6 +40,25 @@ export const CarbonProvider = ({
);
const refresh = useFetcher<{}>();
+ useEffect(() => {
+ const handleFocus = () => {
+ refresh.submit(null, {
+ method: "post",
+ action: path.to.refreshSession,
+ });
+ };
+
+ if (isBrowser) {
+ window.addEventListener("focus", handleFocus);
+ }
+
+ return () => {
+ if (isBrowser) {
+ window.removeEventListener("focus", handleFocus);
+ }
+ };
+ }, [refresh]);
+
useInterval(() => {
// refresh ten minutes before expiry
const shouldRefresh = expiresAt - 60 * 10 < Date.now() / 1000;
@@ -52,7 +71,7 @@ export const CarbonProvider = ({
}
initialLoad.current = false;
- }, expiresIn);
+ }, 15000);
if (isBrowser && accessToken && !authenticatedClientLoaded.current) {
// recreate a carbon client to force provider's consumer to rerender
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 8523a936ac..d3ecfa3c87 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -22439,7 +22439,7 @@ export type Database = {
replenishmentSystem:
| Database["public"]["Enums"]["itemReplenishmentSystem"]
| null
- supplierIds: string[] | null
+ supplierIds: string | null
thumbnailPath: string | null
unitOfMeasure: string | null
unitOfMeasureCode: string | null
@@ -23273,7 +23273,7 @@ export type Database = {
replenishmentSystem:
| Database["public"]["Enums"]["itemReplenishmentSystem"]
| null
- supplierIds: string[] | null
+ supplierIds: string | null
thumbnailPath: string | null
unitOfMeasureCode: string | null
updatedAt: string | null
@@ -24364,7 +24364,7 @@ export type Database = {
replenishmentSystem:
| Database["public"]["Enums"]["itemReplenishmentSystem"]
| null
- supplierIds: string[] | null
+ supplierIds: string | null
thumbnailPath: string | null
unitOfMeasure: string | null
unitOfMeasureCode: string | null
@@ -24738,7 +24738,7 @@ export type Database = {
replenishmentSystem:
| Database["public"]["Enums"]["itemReplenishmentSystem"]
| null
- supplierIds: string[] | null
+ supplierIds: string | null
thumbnailPath: string | null
toDate: string | null
unitOfMeasure: string | null
@@ -28777,7 +28777,7 @@ export type Database = {
replenishmentSystem:
| Database["public"]["Enums"]["itemReplenishmentSystem"]
| null
- supplierIds: string[] | null
+ supplierIds: string | null
thumbnailPath: string | null
unitOfMeasure: string | null
unitOfMeasureCode: string | null
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 8523a936ac..d3ecfa3c87 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -22439,7 +22439,7 @@ export type Database = {
replenishmentSystem:
| Database["public"]["Enums"]["itemReplenishmentSystem"]
| null
- supplierIds: string[] | null
+ supplierIds: string | null
thumbnailPath: string | null
unitOfMeasure: string | null
unitOfMeasureCode: string | null
@@ -23273,7 +23273,7 @@ export type Database = {
replenishmentSystem:
| Database["public"]["Enums"]["itemReplenishmentSystem"]
| null
- supplierIds: string[] | null
+ supplierIds: string | null
thumbnailPath: string | null
unitOfMeasureCode: string | null
updatedAt: string | null
@@ -24364,7 +24364,7 @@ export type Database = {
replenishmentSystem:
| Database["public"]["Enums"]["itemReplenishmentSystem"]
| null
- supplierIds: string[] | null
+ supplierIds: string | null
thumbnailPath: string | null
unitOfMeasure: string | null
unitOfMeasureCode: string | null
@@ -24738,7 +24738,7 @@ export type Database = {
replenishmentSystem:
| Database["public"]["Enums"]["itemReplenishmentSystem"]
| null
- supplierIds: string[] | null
+ supplierIds: string | null
thumbnailPath: string | null
toDate: string | null
unitOfMeasure: string | null
@@ -28777,7 +28777,7 @@ export type Database = {
replenishmentSystem:
| Database["public"]["Enums"]["itemReplenishmentSystem"]
| null
- supplierIds: string[] | null
+ supplierIds: string | null
thumbnailPath: string | null
unitOfMeasure: string | null
unitOfMeasureCode: string | null
diff --git a/packages/database/supabase/migrations/20241022111319_search-by-supplier-part-number.sql b/packages/database/supabase/migrations/20241022111319_search-by-supplier-part-number.sql
new file mode 100644
index 0000000000..3f6ecda3e1
--- /dev/null
+++ b/packages/database/supabase/migrations/20241022111319_search-by-supplier-part-number.sql
@@ -0,0 +1,147 @@
+-- Update parts view
+DROP VIEW IF EXISTS "parts";
+CREATE OR REPLACE VIEW "parts" WITH (SECURITY_INVOKER=true) AS
+SELECT
+ i."active",
+ i."assignee",
+ i."defaultMethodType",
+ i."description",
+ i."itemTrackingType",
+ i."name",
+ i."replenishmentSystem",
+ i."unitOfMeasureCode",
+ COALESCE(i."thumbnailPath", mu."thumbnailPath") as "thumbnailPath",
+ mu.id as "modelId",
+ mu."autodeskUrn",
+ mu."modelPath",
+ mu."name" as "modelName",
+ mu."size" as "modelSize",
+ p.*,
+ ps."supplierIds",
+ uom.name as "unitOfMeasure"
+FROM "part" p
+INNER JOIN "item" i ON i.id = p."itemId"
+LEFT JOIN (
+ SELECT
+ "itemId",
+ string_agg(ps."supplierPartId", ',') AS "supplierIds"
+ FROM "buyMethod" ps
+ GROUP BY "itemId"
+) ps ON ps."itemId" = p."itemId"
+LEFT JOIN "modelUpload" mu ON mu.id = i."modelUploadId"
+LEFT JOIN "unitOfMeasure" uom ON uom.code = i."unitOfMeasureCode" AND uom."companyId" = i."companyId";
+
+DROP VIEW IF EXISTS "fixtures";
+CREATE OR REPLACE VIEW "fixtures" WITH (SECURITY_INVOKER=true) AS
+SELECT
+ i."active",
+ i."assignee",
+ i."defaultMethodType",
+ i."description",
+ i."itemTrackingType",
+ i."name",
+ i."replenishmentSystem",
+ i."unitOfMeasureCode",
+ COALESCE(i."thumbnailPath", mu."thumbnailPath") as "thumbnailPath",
+ f.*,
+ mu.id as "modelId",
+ mu."autodeskUrn",
+ mu."modelPath",
+ mu."name" as "modelName",
+ mu."size" as "modelSize",
+ s."supplierIds",
+ c.name as "customer"
+FROM "fixture" f
+INNER JOIN "item" i ON i.id = f."itemId"
+LEFT JOIN (
+ SELECT
+ "itemId",
+ string_agg(s."supplierPartId", ',') AS "supplierIds"
+ FROM "buyMethod" s
+ GROUP BY "itemId"
+) s ON s."itemId" = f."itemId"
+LEFT JOIN "modelUpload" mu ON mu.id = i."modelUploadId"
+LEFT JOIN "customer" c ON c.id = f."customerId";
+
+DROP VIEW IF EXISTS "materials";
+CREATE OR REPLACE VIEW "materials" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ i."active",
+ i."assignee",
+ i."defaultMethodType",
+ i."description",
+ i."itemTrackingType",
+ i."name",
+ i."replenishmentSystem",
+ i."thumbnailPath",
+ i."unitOfMeasureCode",
+ m.*,
+ mf."name" AS "materialForm",
+ ms."name" AS "materialSubstance",
+ s."supplierIds",
+ uom.name as "unitOfMeasure"
+ FROM "material" m
+ INNER JOIN "item" i ON i.id = m."itemId"
+ LEFT JOIN (
+ SELECT
+ "itemId",
+ string_agg(s."supplierPartId", ',') AS "supplierIds"
+ FROM "buyMethod" s
+ GROUP BY "itemId"
+ ) s ON s."itemId" = m."itemId"
+ LEFT JOIN "materialForm" mf ON mf.id = m."materialFormId"
+ LEFT JOIN "materialSubstance" ms ON ms.id = m."materialSubstanceId"
+ LEFT JOIN "unitOfMeasure" uom ON uom.code = i."unitOfMeasureCode" AND uom."companyId" = i."companyId";
+
+
+DROP VIEW IF EXISTS "tools";
+CREATE OR REPLACE VIEW "tools" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ i."active",
+ i."assignee",
+ i."defaultMethodType",
+ i."description",
+ i."itemTrackingType",
+ i."name",
+ i."replenishmentSystem",
+ i."thumbnailPath",
+ i."unitOfMeasureCode",
+ t.*,
+ s."supplierIds",
+ uom.name as "unitOfMeasure"
+ FROM "tool" t
+ INNER JOIN "item" i ON i.id = t."itemId"
+ LEFT JOIN (
+ SELECT
+ "itemId",
+ string_agg(s."supplierPartId", ',') AS "supplierIds"
+ FROM "buyMethod" s
+ GROUP BY "itemId"
+ ) s ON s."itemId" = t."itemId"
+ LEFT JOIN "unitOfMeasure" uom ON uom.code = i."unitOfMeasureCode" AND uom."companyId" = i."companyId";
+
+DROP VIEW IF EXISTS "consumables";
+CREATE OR REPLACE VIEW "consumables" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ i."active",
+ i."assignee",
+ i."defaultMethodType",
+ i."description",
+ i."itemTrackingType",
+ i."name",
+ i."replenishmentSystem",
+ i."thumbnailPath",
+ i."unitOfMeasureCode",
+ c.*,
+ s."supplierIds",
+ uom.name as "unitOfMeasure"
+ FROM "consumable" c
+ INNER JOIN "item" i ON i.id = c."itemId"
+ LEFT JOIN (
+ SELECT
+ "itemId",
+ string_agg(s."supplierPartId", ',') AS "supplierIds"
+ FROM "buyMethod" s
+ GROUP BY "itemId"
+ ) s ON s."itemId" = c."itemId"
+ LEFT JOIN "unitOfMeasure" uom ON uom.code = i."unitOfMeasureCode" AND uom."companyId" = i."companyId";
diff --git a/packages/documents/src/utils/shared.ts b/packages/documents/src/utils/shared.ts
index a74df188b5..2f2ce99245 100644
--- a/packages/documents/src/utils/shared.ts
+++ b/packages/documents/src/utils/shared.ts
@@ -5,5 +5,6 @@ export const getCurrencyFormatter = (
return new Intl.NumberFormat(locale, {
style: "currency",
currency: baseCurrencyCode,
+ maximumFractionDigits: 4,
});
};
diff --git a/packages/react/src/Number.tsx b/packages/react/src/Number.tsx
index 1a8b9ed8c0..b295938367 100644
--- a/packages/react/src/Number.tsx
+++ b/packages/react/src/Number.tsx
@@ -31,7 +31,29 @@ const NumberInputStepper = ({
};
const NumberInput = ({ className, ...props }: InputProps) => {
- return <Input className={cn("pr-6", className)} {...props} />;
+ return (
+ <Input
+ ref={(input) => {
+ if (input) {
+ const handleFocus = () => input.select();
+
+ // Check if the event listener is already added
+ if (!input.hasAttribute("data-focus-listener")) {
+ input.addEventListener("focus", handleFocus);
+ input.setAttribute("data-focus-listener", "true");
+
+ // Remove the event listener when the component unmounts
+ return () => {
+ input.removeEventListener("focus", handleFocus);
+ input.removeAttribute("data-focus-listener");
+ };
+ }
+ }
+ }}
+ className={cn("pr-6", className)}
+ {...props}
+ />
+ );
};
const NumberIncrementStepper = ({