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 shipping cost to purhcase orders

Brad Barbinb961bf8618e2
diff --git a/apps/erp/app/components/Form/Item.tsx b/apps/erp/app/components/Form/Item.tsx
index 539263fbb2..584c2cf311 100644
--- a/apps/erp/app/components/Form/Item.tsx
+++ b/apps/erp/app/components/Form/Item.tsx
@@ -172,12 +172,9 @@ const Item = ({
id={typeFieldName}
value={type}
/>
- <div className="flex flex-grow items-start min-w-0">
+ <div className="flex flex-grow items-start min-w-0 relative">
<CreatableCombobox
- className={cn(
- "flex-grow min-w-0",
- canSwitchItemType && "rounded-r-none"
- )}
+ className={cn("flex-grow min-w-0")}
ref={triggerRef}
options={options}
{...props}
@@ -209,6 +206,7 @@ const Item = ({
type="button"
aria-label="Change Type"
className={cn(
+ "absolute right-0 top-0",
props.inline === true
? "ml-1"
: "bg-transparent flex-shrink-0 h-10 w-10 px-3 rounded-l-none before:rounded-l-none !border-l-0 border -ml-px shadow-none hover:shadow-button-base"
diff --git a/apps/erp/app/components/ItemThumbnail.tsx b/apps/erp/app/components/ItemThumbnail.tsx
index 09a473cee2..c48fb60e08 100644
--- a/apps/erp/app/components/ItemThumbnail.tsx
+++ b/apps/erp/app/components/ItemThumbnail.tsx
@@ -11,40 +11,43 @@ interface ItemThumbnailProps {
size?: "sm" | "md" | "lg";
}
-const itemVariants = cva("bg-muted rounded-lg border-2 border-transparent", {
- variants: {
- size: {
- sm: "w-7 h-7",
- md: "w-9 h-9",
- lg: "w-11 h-11 bg-gradient-to-bl from-muted to-muted/40 ",
- },
- withPadding: {
- true: "",
- false: "p-0",
- },
- },
- compoundVariants: [
- {
- withPadding: true,
- size: "sm",
- class: "p-1",
+const itemVariants = cva(
+ "bg-muted rounded-lg flex items-center justify-center",
+ {
+ variants: {
+ size: {
+ sm: "w-7 h-7",
+ md: "w-9 h-9",
+ lg: "w-11 h-11 bg-gradient-to-bl from-muted to-muted/40",
+ },
+ withPadding: {
+ true: "",
+ false: "p-0",
+ },
},
- {
- withPadding: true,
+ compoundVariants: [
+ {
+ withPadding: true,
+ size: "sm",
+ class: "p-1",
+ },
+ {
+ withPadding: true,
+ size: "md",
+ class: "p-1.5",
+ },
+ {
+ withPadding: true,
+ size: "lg",
+ class: "p-2",
+ },
+ ],
+ defaultVariants: {
size: "md",
- class: "p-1.5",
- },
- {
withPadding: true,
- size: "lg",
- class: "p-2",
},
- ],
- defaultVariants: {
- size: "md",
- withPadding: true,
- },
-});
+ }
+);
const iconVariants = cva("text-muted-foreground", {
variants: {
diff --git a/apps/erp/app/modules/invoicing/invoicing.models.ts b/apps/erp/app/modules/invoicing/invoicing.models.ts
index 58a2e1c6cd..e50d318665 100644
--- a/apps/erp/app/modules/invoicing/invoicing.models.ts
+++ b/apps/erp/app/modules/invoicing/invoicing.models.ts
@@ -38,6 +38,7 @@ export const purchaseInvoiceValidator = z.object({
invoiceSupplierLocationId: zfd.text(z.string().optional()),
dateIssued: zfd.text(z.string().optional()),
dateDue: zfd.text(z.string().optional()),
+ supplierShippingCost: zfd.numeric(z.number().optional()),
exchangeRate: zfd.numeric(z.number().optional()),
exchangeRateUpdatedAt: zfd.text(z.string().optional()),
});
diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceExplorer.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceExplorer.tsx
index 24c36c69d6..cb3bfa6f0b 100644
--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceExplorer.tsx
+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceExplorer.tsx
@@ -180,19 +180,19 @@ function PurchaseInvoiceLineItem({
<VStack spacing={0}>
<Link
to={path.to.purchaseInvoiceLine(invoiceId, line.id!)}
- // prefetch="intent"
+ prefetch="intent"
className="w-full"
>
<HStack
className={cn(
- "w-full p-2 items-center justify-between hover:bg-accent/30 cursor-pointer",
+ "group w-full p-2 items-center hover:bg-accent/30 cursor-pointer relative",
"border-b border-border",
isSelected && "bg-accent/60 hover:bg-accent/50 shadow-inner"
)}
>
- <HStack spacing={2}>
+ <HStack spacing={2} className="flex-grow min-w-0 pr-10">
<ItemThumbnail thumbnailPath={line.thumbnailPath} type="Part" />
- <VStack spacing={0}>
+ <VStack spacing={0} className="min-w-0">
<span className="font-semibold line-clamp-1">
{line.itemReadableId}
</span>
@@ -201,13 +201,14 @@ function PurchaseInvoiceLineItem({
</span>
</VStack>
</HStack>
- <HStack spacing={0}>
+ <div className="absolute right-2">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton
aria-label="More"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100"
icon={<LuEllipsisVertical />}
- variant="ghost"
+ variant="solid"
onClick={(e) => e.stopPropagation()}
/>
</DropdownMenuTrigger>
@@ -241,7 +242,7 @@ function PurchaseInvoiceLineItem({
)}
</DropdownMenuContent>
</DropdownMenu>
- </HStack>
+ </div>
</HStack>
</Link>
</VStack>
diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceForm.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceForm.tsx
index 01a9462468..0ca244a563 100644
--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceForm.tsx
+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceForm.tsx
@@ -21,6 +21,7 @@ import {
Hidden,
Input,
Location,
+ Number,
Submit,
Supplier,
SupplierContact,
@@ -208,7 +209,14 @@ const PurchaseInvoiceForm = ({ initialValues }: PurchaseInvoiceFormProps) => {
<DatePicker name="dateDue" label="Due Date" />
<DatePicker name="dateIssued" label="Date Issued" />
-
+ <Number
+ name="supplierShippingCost"
+ label="Shipping Cost"
+ formatOptions={{
+ style: "currency",
+ currency: invoiceSupplier?.currencyCode,
+ }}
+ />
<PaymentTerm
name="paymentTermId"
label="Payment Terms"
diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceSummary.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceSummary.tsx
index 1378c1a773..b226d14c6e 100644
--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceSummary.tsx
+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceSummary.tsx
@@ -85,11 +85,11 @@ const LineItems = ({
{line.thumbnailPath ? (
<img
alt={line.itemReadableId!}
- className="w-24 h-24 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent"
+ className="w-24 h-24 bg-gradient-to-bl from-muted to-muted/40 rounded-lg"
src={getPrivateUrl(line.thumbnailPath)}
/>
) : (
- <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent p-2">
+ <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-2">
<LuImage className="w-16 h-16 text-muted-foreground" />
</div>
)}
diff --git a/apps/erp/app/modules/purchasing/purchasing.models.ts b/apps/erp/app/modules/purchasing/purchasing.models.ts
index f00677094c..a7078f21b2 100644
--- a/apps/erp/app/modules/purchasing/purchasing.models.ts
+++ b/apps/erp/app/modules/purchasing/purchasing.models.ts
@@ -80,6 +80,7 @@ export const purchaseOrderDeliveryValidator = z
dropShipment: zfd.checkbox(),
customerId: zfd.text(z.string().optional()),
customerLocationId: zfd.text(z.string().optional()),
+ supplierShippingCost: zfd.numeric(z.number().optional()),
notes: zfd.text(z.string().optional()),
})
.refine(
diff --git a/apps/erp/app/modules/purchasing/types.ts b/apps/erp/app/modules/purchasing/types.ts
index f850579e00..5c823d3523 100644
--- a/apps/erp/app/modules/purchasing/types.ts
+++ b/apps/erp/app/modules/purchasing/types.ts
@@ -1,6 +1,7 @@
import type { Database } from "@carbon/database";
import type { FileObject } from "@supabase/storage-js";
import type {
+ getPurchaseOrderDelivery,
getPurchaseOrderLines,
getPurchaseOrders,
getSupplier,
@@ -22,6 +23,10 @@ export type PurchaseOrder = NonNullable<
Awaited<ReturnType<typeof getPurchaseOrders>>["data"]
>[number];
+export type PurchaseOrderDelivery = NonNullable<
+ Awaited<ReturnType<typeof getPurchaseOrderDelivery>>["data"]
+>;
+
export type PurchaseOrderLine = NonNullable<
Awaited<ReturnType<typeof getPurchaseOrderLines>>["data"]
>[number];
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm.tsx
index ffd051a8be..152c956c4f 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderDeliveryForm.tsx
@@ -18,6 +18,7 @@ import {
Hidden,
Input,
Location,
+ Number,
ShippingMethod,
Submit,
} from "~/components/Form";
@@ -28,11 +29,12 @@ import { path } from "~/utils/path";
type PurchaseOrderDeliveryFormProps = {
initialValues: z.infer<typeof purchaseOrderDeliveryValidator>;
- // shippingTerms: ListItem[];
+ currencyCode: string;
};
const PurchaseOrderDeliveryForm = ({
initialValues,
+ currencyCode,
}: // shippingTerms,
PurchaseOrderDeliveryFormProps) => {
const { orderId } = useParams();
@@ -66,6 +68,14 @@ PurchaseOrderDeliveryFormProps) => {
<CardContent>
<Hidden name="id" />
<div className="grid grid-cols-1 lg:grid-cols-3 gap-x-8 gap-y-4 w-full">
+ <Number
+ name="supplierShippingCost"
+ label="Shipping Cost"
+ formatOptions={{
+ style: "currency",
+ currency: currencyCode,
+ }}
+ />
<Location
name="locationId"
label="Delivery Location"
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderExplorer.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderExplorer.tsx
index be0afd10d8..9fb7b803c4 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderExplorer.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderExplorer.tsx
@@ -185,18 +185,18 @@ function PurchaseOrderLineItem({
>
<HStack
className={cn(
- "w-full p-2 items-center justify-between hover:bg-accent/30 cursor-pointer",
+ "group w-full p-2 items-center hover:bg-accent/30 cursor-pointer relative",
!disclosure.isOpen && "border-b border-border",
isSelected && "bg-accent/60 hover:bg-accent/50 shadow-inner"
)}
>
- <HStack spacing={2}>
+ <HStack spacing={2} className="flex-grow min-w-0 pr-10">
<ItemThumbnail
thumbnailPath={line.thumbnailPath}
type="Part" // TODO
/>
- <VStack spacing={0}>
+ <VStack spacing={0} className="min-w-0">
<span className="font-semibold line-clamp-1">
{line.itemReadableId}
</span>
@@ -205,13 +205,14 @@ function PurchaseOrderLineItem({
</span>
</VStack>
</HStack>
- <HStack spacing={0}>
+ <div className="absolute right-2">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton
aria-label="More"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100"
icon={<LuEllipsisVertical />}
- variant="ghost"
+ variant="solid"
onClick={(e) => e.stopPropagation()}
/>
</DropdownMenuTrigger>
@@ -245,7 +246,7 @@ function PurchaseOrderLineItem({
)}
</DropdownMenuContent>
</DropdownMenu>
- </HStack>
+ </div>
</HStack>
</Link>
</VStack>
diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsx
index 32e9793b84..84e1cd0d83 100644
--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsx
+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderSummary.tsx
@@ -28,7 +28,12 @@ import {
useUser,
} from "~/hooks";
import { getPrivateUrl, path } from "~/utils/path";
-import type { PurchaseOrder, PurchaseOrderLine, Supplier } from "../../types";
+import type {
+ PurchaseOrder,
+ PurchaseOrderDelivery,
+ PurchaseOrderLine,
+ Supplier,
+} from "../../types";
const LineItems = ({
currencyCode,
@@ -85,11 +90,11 @@ const LineItems = ({
{line.thumbnailPath ? (
<img
alt={line.itemReadableId!}
- className="w-24 h-24 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent"
+ className="w-24 h-24 bg-gradient-to-bl from-muted to-muted/40 rounded-lg"
src={getPrivateUrl(line.thumbnailPath)}
/>
) : (
- <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent p-2">
+ <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-2">
<LuImage className="w-16 h-16 text-muted-foreground" />
</div>
)}
@@ -289,6 +294,7 @@ const PurchaseOrderSummary = () => {
const routeData = useRouteData<{
purchaseOrder: PurchaseOrder;
lines: PurchaseOrderLine[];
+ purchaseOrderDelivery: PurchaseOrderDelivery;
supplier: Supplier;
}>(path.to.purchaseOrder(orderId));
@@ -305,16 +311,28 @@ const PurchaseOrderSummary = () => {
const subtotal =
routeData?.lines?.reduce((acc, line) => {
const lineTotal = (line.unitPrice ?? 0) * (line.purchaseQuantity ?? 0);
- const addOns = line.shippingCost ?? 0;
- return acc + lineTotal + addOns;
+
+ return acc + lineTotal;
}, 0) ?? 0;
+ const supplierShippingCost =
+ (routeData?.lines?.reduce((acc, line) => {
+ return acc + (line.supplierShippingCost ?? 0);
+ }, 0) ?? 0) + (routeData?.purchaseOrderDelivery?.supplierShippingCost ?? 0);
+
+ const shippingCost =
+ (routeData?.lines?.reduce((acc, line) => {
+ return acc + (line.shippingCost ?? 0);
+ }, 0) ?? 0) +
+ (routeData?.purchaseOrderDelivery?.supplierShippingCost ?? 0) *
+ (routeData?.purchaseOrder?.exchangeRate ?? 1);
+
const supplierSubtotal =
routeData?.lines?.reduce((acc, line) => {
const lineTotal =
(line.supplierUnitPrice ?? 0) * (line.purchaseQuantity ?? 0);
- const addOns = line.supplierShippingCost ?? 0;
- return acc + lineTotal + addOns;
+
+ return acc + lineTotal;
}, 0) ?? 0;
const tax =
@@ -327,8 +345,8 @@ const PurchaseOrderSummary = () => {
return acc + (line.supplierTaxAmount ?? 0);
}, 0) ?? 0;
- const total = subtotal + tax;
- const supplierTotal = supplierSubtotal + supplierTax;
+ const total = subtotal + tax + shippingCost;
+ const supplierTotal = supplierSubtotal + supplierTax + supplierShippingCost;
return (
<Card>
@@ -384,6 +402,18 @@ const PurchaseOrderSummary = () => {
</VStack>
</HStack>
+ <HStack className="justify-between text-base text-muted-foreground w-full">
+ <span>Shipping:</span>
+ <VStack spacing={0} className="items-end">
+ <span>{formatter.format(shippingCost)}</span>
+ {shouldConvertCurrency && (
+ <span className="text-sm">
+ {presentationCurrencyFormatter.format(supplierShippingCost)}
+ </span>
+ )}
+ </VStack>
+ </HStack>
+
<HStack className="justify-between text-xl font-bold w-full">
<span>Total:</span>
<VStack spacing={0} className="items-end">
diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteExplorer.tsx b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteExplorer.tsx
index c65a9d7819..08a030bc97 100644
--- a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteExplorer.tsx
+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteExplorer.tsx
@@ -185,18 +185,18 @@ function SupplierQuoteLineItem({
>
<HStack
className={cn(
- "w-full p-2 items-center justify-between hover:bg-accent/30 cursor-pointer",
+ "group w-full p-2 items-center hover:bg-accent/30 cursor-pointer relative",
!disclosure.isOpen && "border-b border-border",
isSelected && "bg-accent/60 hover:bg-accent/50 shadow-inner"
)}
>
- <HStack spacing={2}>
+ <HStack spacing={2} className="flex-grow min-w-0 pr-10">
<ItemThumbnail
thumbnailPath={line.thumbnailPath}
type="Part" // TODO
/>
- <VStack spacing={0}>
+ <VStack spacing={0} className="min-w-0">
<span className="font-semibold line-clamp-1">
{line.itemReadableId}
</span>
@@ -205,13 +205,14 @@ function SupplierQuoteLineItem({
</span>
</VStack>
</HStack>
- <HStack spacing={0}>
+ <div className="absolute right-2">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton
aria-label="More"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100"
icon={<LuEllipsisVertical />}
- variant="ghost"
+ variant="solid"
onClick={(e) => e.stopPropagation()}
/>
</DropdownMenuTrigger>
@@ -243,7 +244,7 @@ function SupplierQuoteLineItem({
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
- </HStack>
+ </div>
</HStack>
</Link>
</VStack>
diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteSummary.tsx b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteSummary.tsx
index 592d72fd70..5c9f6a0e43 100644
--- a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteSummary.tsx
+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteSummary.tsx
@@ -103,11 +103,11 @@ const LineItems = ({
{line.thumbnailPath ? (
<img
alt={line.itemReadableId!}
- className="w-24 h-24 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent"
+ className="w-24 h-24 bg-gradient-to-bl from-muted to-muted/40 rounded-lg"
src={getPrivateUrl(line.thumbnailPath)}
/>
) : (
- <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent p-2">
+ <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-2">
<LuImage className="w-16 h-16 text-muted-foreground" />
</div>
)}
diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteToOrderDrawer.tsx b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteToOrderDrawer.tsx
index e4aa4d24fa..4efc6c2b5f 100644
--- a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteToOrderDrawer.tsx
+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteToOrderDrawer.tsx
@@ -178,11 +178,11 @@ const LinePricingForm = ({
{line.thumbnailPath ? (
<img
alt={line.itemReadableId!}
- className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent"
+ className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg"
src={getPrivateUrl(line.thumbnailPath)}
/>
) : (
- <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent p-2">
+ <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-2">
<LuImage className="w-16 h-16 text-muted-foreground" />
</div>
)}
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsx
index 92ee4b6562..e76b29d625 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteExplorer.tsx
@@ -230,19 +230,19 @@ function QuoteLineItem({
<VStack spacing={0}>
<HStack
className={cn(
- "w-full p-2 items-center justify-between hover:bg-accent/30 cursor-pointer",
+ "group w-full p-2 items-center hover:bg-accent/30 cursor-pointer relative",
!disclosure.isOpen && "border-b border-border",
isSelected && "bg-accent/60 hover:bg-accent/50 shadow-inner"
)}
onClick={() => onLineClick(line)}
>
- <HStack spacing={2}>
+ <HStack spacing={2} className="flex-grow min-w-0 pr-10">
<ItemThumbnail
thumbnailPath={line.thumbnailPath}
type={line.itemType as MethodItemType}
/>
- <VStack spacing={0}>
+ <VStack spacing={0} className="min-w-0">
<HStack>
<span className="font-semibold line-clamp-1">
{line.itemReadableId}
@@ -257,64 +257,70 @@ function QuoteLineItem({
</span>
</VStack>
</HStack>
- <HStack spacing={0}>
- {line.methodType === "Make" &&
- permissions.can("update", "sales") &&
- line.status !== "No Quote" && (
- <IconButton
- aria-label={disclosure.isOpen ? "Hide" : "Show"}
- className={cn("animate", disclosure.isOpen && "-rotate-180")}
- icon={<LuChevronDown />}
- size="sm"
- variant="ghost"
- onClick={(e) => {
- e.stopPropagation();
- disclosure.onToggle();
- }}
- />
- )}
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton
- aria-label="More"
- icon={<LuEllipsisVertical />}
- size="sm"
- variant="ghost"
- onClick={(e) => e.stopPropagation()}
- />
- </DropdownMenuTrigger>
- <DropdownMenuContent>
- <DropdownMenuItem
- destructive
- disabled={isDisabled || !permissions.can("update", "sales")}
- onClick={(e) => {
- e.stopPropagation();
- onDelete(line);
- }}
- >
- <DropdownMenuIcon icon={<LuTrash />} />
- Delete Line
- </DropdownMenuItem>
- <DropdownMenuItem asChild>
- <Link
- to={getLinkToItemDetails(
- line.itemType as MethodItemType,
- line.itemId!
+ <div className="absolute right-2">
+ <HStack spacing={1}>
+ {line.methodType === "Make" &&
+ permissions.can("update", "sales") &&
+ line.status !== "No Quote" && (
+ <IconButton
+ aria-label={disclosure.isOpen ? "Hide" : "Show"}
+ className={cn(
+ "animate opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100",
+ disclosure.isOpen && "-rotate-180"
)}
+ icon={<LuChevronDown />}
+ size="md"
+ variant="solid"
+ onClick={(e) => {
+ e.stopPropagation();
+ disclosure.onToggle();
+ }}
+ />
+ )}
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <IconButton
+ aria-label="More"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100"
+ icon={<LuEllipsisVertical />}
+ size="md"
+ variant="solid"
+ onClick={(e) => e.stopPropagation()}
+ />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent>
+ <DropdownMenuItem
+ destructive
+ disabled={isDisabled || !permissions.can("update", "sales")}
+ onClick={(e) => {
+ e.stopPropagation();
+ onDelete(line);
+ }}
>
- <DropdownMenuIcon
- icon={
- <MethodItemTypeIcon
- type={line.itemType as MethodItemType}
- />
- }
- />
- View Item Master
- </Link>
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </HStack>
+ <DropdownMenuIcon icon={<LuTrash />} />
+ Delete Line
+ </DropdownMenuItem>
+ <DropdownMenuItem asChild>
+ <Link
+ to={getLinkToItemDetails(
+ line.itemType as MethodItemType,
+ line.itemId!
+ )}
+ >
+ <DropdownMenuIcon
+ icon={
+ <MethodItemTypeIcon
+ type={line.itemType as MethodItemType}
+ />
+ }
+ />
+ View Item Master
+ </Link>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </HStack>
+ </div>
</HStack>
{disclosure.isOpen &&
line.methodType === "Make" &&
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx
index 54e944d24b..36baa17229 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteSummary.tsx
@@ -139,11 +139,11 @@ const LineItems = ({
{line.thumbnailPath ? (
<img
alt={line.itemReadableId!}
- className="w-24 h-24 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent"
+ className="w-24 h-24 bg-gradient-to-bl from-muted to-muted/40 rounded-lg"
src={getPrivateUrl(line.thumbnailPath)}
/>
) : (
- <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent p-2">
+ <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-2">
<LuImage className="w-16 h-16 text-muted-foreground" />
</div>
)}
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteToOrderDrawer.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteToOrderDrawer.tsx
index 26b4993ef4..5a14119378 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteToOrderDrawer.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteToOrderDrawer.tsx
@@ -374,11 +374,11 @@ const LinePricingForm = ({
{line.thumbnailPath ? (
<img
alt={line.itemReadableId!}
- className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent"
+ className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg"
src={getPrivateUrl(line.thumbnailPath)}
/>
) : (
- <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent p-2">
+ <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-2">
<LuImage className="w-16 h-16 text-muted-foreground" />
</div>
)}
diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderExplorer.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderExplorer.tsx
index ef36b5cae2..c388cf3dc9 100644
--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderExplorer.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderExplorer.tsx
@@ -191,18 +191,18 @@ function SalesOrderLineItem({
>
<HStack
className={cn(
- "w-full p-2 items-center justify-between hover:bg-accent/30 cursor-pointer",
+ "group w-full p-2 items-center hover:bg-accent/30 cursor-pointer relative",
!disclosure.isOpen && "border-b border-border",
isSelected && "bg-accent/60 hover:bg-accent/50 shadow-inner"
)}
>
- <HStack spacing={2}>
+ <HStack spacing={2} className="flex-grow min-w-0 pr-10">
<ItemThumbnail
thumbnailPath={line.thumbnailPath}
type="Part" // TODO
/>
- <VStack spacing={0}>
+ <VStack spacing={0} className="min-w-0">
<span className="font-semibold line-clamp-1">
{line.itemReadableId}
</span>
@@ -211,13 +211,14 @@ function SalesOrderLineItem({
</span>
</VStack>
</HStack>
- <HStack spacing={0}>
+ <div className="absolute right-2">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton
aria-label="More"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100"
icon={<LuEllipsisVertical />}
- variant="ghost"
+ variant="solid"
onClick={(e) => e.stopPropagation()}
/>
</DropdownMenuTrigger>
@@ -251,7 +252,7 @@ function SalesOrderLineItem({
)}
</DropdownMenuContent>
</DropdownMenu>
- </HStack>
+ </div>
</HStack>
</Link>
</VStack>
diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsx
index 054e0d786e..b518830fe8 100644
--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsx
@@ -64,11 +64,11 @@ const LineItems = ({
{line.thumbnailPath ? (
<img
alt={line.itemReadableId!}
- className="w-24 h-24 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent"
+ className="w-24 h-24 bg-gradient-to-bl from-muted to-muted/40 rounded-lg"
src={getPrivateUrl(line.thumbnailPath)}
/>
) : (
- <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent p-2">
+ <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-2">
<LuImage className="w-16 h-16 text-muted-foreground" />
</div>
)}
diff --git a/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQExplorer.tsx b/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQExplorer.tsx
index 7ed599d427..fe4bb8f715 100644
--- a/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQExplorer.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesRFQ/SalesRFQExplorer.tsx
@@ -210,7 +210,7 @@ function OptimisticSalesRFQLineItem({
<VStack spacing={0} className="border-b border-border">
<HStack className="w-full p-2 items-center justify-between hover:bg-accent/30 cursor-pointer">
<HStack spacing={2}>
- <div className="w-10 h-10 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent p-2">
+ <div className="w-10 h-10 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-2">
<Spinner className="w-6 h-6 text-muted-foreground" />
</div>
@@ -271,7 +271,7 @@ function SalesRFQLineItem({
const isSelected = lineId === line.id;
return (
- <VStack spacing={0} className="border-b border-border">
+ <VStack spacing={0}>
<Link
className="w-full"
prefetch="intent"
@@ -279,19 +279,18 @@ function SalesRFQLineItem({
>
<HStack
className={cn(
- "w-full p-2 items-center justify-between hover:bg-accent/30 cursor-pointer",
+ "group w-full p-2 items-center hover:bg-accent/30 cursor-pointer relative",
isSelected && "bg-accent/60 hover:bg-accent/50 shadow-inner"
)}
>
- <HStack spacing={2}>
+ <HStack spacing={2} className="flex-grow min-w-0 pr-10">
<ItemThumbnail
thumbnailPath={line.thumbnailPath}
type={line.itemType as MethodItemType}
/>
- <VStack spacing={0}>
+ <VStack spacing={0} className="min-w-0">
<span className="font-semibold line-clamp-1">
- {" "}
{line.customerPartId}
{line.customerPartRevision && `-${line.customerPartRevision}`}
</span>
@@ -300,13 +299,14 @@ function SalesRFQLineItem({
</span>
</VStack>
</HStack>
- <HStack spacing={0}>
+ <div className="absolute right-2">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton
aria-label="More"
+ className="opacity-0 group-hover:opacity-100 group-active:opacity-100 data-[state=open]:opacity-100"
icon={<LuEllipsisVertical />}
- variant="ghost"
+ variant="solid"
onClick={(e) => e.stopPropagation()}
/>
</DropdownMenuTrigger>
@@ -324,7 +324,7 @@ function SalesRFQLineItem({
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
- </HStack>
+ </div>
</HStack>
</Link>
</VStack>
diff --git a/apps/erp/app/routes/share+/quote.$id.tsx b/apps/erp/app/routes/share+/quote.$id.tsx
index 3b92205809..944c47c4d7 100644
--- a/apps/erp/app/routes/share+/quote.$id.tsx
+++ b/apps/erp/app/routes/share+/quote.$id.tsx
@@ -483,11 +483,11 @@ const LineItems = ({
{thumbnails[line.id!] ? (
<img
alt={line.itemReadableId!}
- className="w-24 h-24 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent"
+ className="w-24 h-24 bg-gradient-to-bl from-muted to-muted/40 rounded-lg"
src={thumbnails[line.id!] ?? undefined}
/>
) : (
- <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent p-2">
+ <div className="w-20 h-20 bg-gradient-to-bl from-muted to-muted/40 rounded-lg p-2">
<LuImage className="w-16 h-16 text-muted-foreground" />
</div>
)}
diff --git a/apps/erp/app/routes/x+/purchase-order+/$orderId.details.tsx b/apps/erp/app/routes/x+/purchase-order+/$orderId.details.tsx
index 389c62b2f2..878d1fbeec 100644
--- a/apps/erp/app/routes/x+/purchase-order+/$orderId.details.tsx
+++ b/apps/erp/app/routes/x+/purchase-order+/$orderId.details.tsx
@@ -10,10 +10,13 @@ import type { ActionFunctionArgs, LoaderFunctionArgs } from "@vercel/remix";
import { json, redirect } from "@vercel/remix";
import { Suspense } from "react";
import { useRouteData } from "~/hooks";
-import type { PurchaseOrder, PurchaseOrderLine } from "~/modules/purchasing";
+import type {
+ PurchaseOrder,
+ PurchaseOrderDelivery,
+ PurchaseOrderLine,
+} from "~/modules/purchasing";
import {
getPurchaseOrder,
- getPurchaseOrderDelivery,
getPurchaseOrderPayment,
purchaseOrderValidator,
upsertPurchaseOrder,
@@ -38,25 +41,10 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const { orderId } = params;
if (!orderId) throw new Error("Could not find orderId");
- const [purchaseOrder, purchaseOrderDelivery, purchaseOrderPayment] =
- await Promise.all([
- getPurchaseOrder(client, orderId),
- getPurchaseOrderDelivery(client, orderId),
- getPurchaseOrderPayment(client, orderId),
- ]);
-
- if (purchaseOrderDelivery.error) {
- throw redirect(
- path.to.purchaseOrders,
- await flash(
- request,
- error(
- purchaseOrderDelivery.error,
- "Failed to load purchase order delivery"
- )
- )
- );
- }
+ const [purchaseOrder, purchaseOrderPayment] = await Promise.all([
+ getPurchaseOrder(client, orderId),
+ getPurchaseOrderPayment(client, orderId),
+ ]);
if (purchaseOrderPayment.error) {
throw redirect(
@@ -72,7 +60,6 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
}
return json({
- purchaseOrderDelivery: purchaseOrderDelivery.data,
purchaseOrderPayment: purchaseOrderPayment.data,
internalNotes: (purchaseOrder.data?.internalNotes ?? {}) as JSONContent,
externalNotes: (purchaseOrder.data?.externalNotes ?? {}) as JSONContent,
@@ -122,17 +109,14 @@ export async function action({ request, params }: ActionFunctionArgs) {
}
export default function PurchaseOrderBasicRoute() {
- const {
- purchaseOrderDelivery,
- purchaseOrderPayment,
- internalNotes,
- externalNotes,
- } = useLoaderData<typeof loader>();
+ const { purchaseOrderPayment, internalNotes, externalNotes } =
+ useLoaderData<typeof loader>();
const { orderId } = useParams();
if (!orderId) throw new Error("Could not find orderId");
const orderData = useRouteData<{
purchaseOrder: PurchaseOrder;
+ purchaseOrderDelivery: PurchaseOrderDelivery;
lines: PurchaseOrderLine[];
files: Promise<FileObject[]>;
}>(path.to.purchaseOrder(orderId));
@@ -155,19 +139,24 @@ export default function PurchaseOrderBasicRoute() {
};
const deliveryInitialValues = {
- id: purchaseOrderDelivery.id,
- locationId: purchaseOrderDelivery.locationId ?? "",
- shippingMethodId: purchaseOrderDelivery.shippingMethodId ?? "",
- shippingTermId: purchaseOrderDelivery.shippingTermId ?? "",
- trackingNumber: purchaseOrderDelivery.trackingNumber ?? "",
- receiptRequestedDate: purchaseOrderDelivery.receiptRequestedDate ?? "",
- receiptPromisedDate: purchaseOrderDelivery.receiptPromisedDate ?? "",
- deliveryDate: purchaseOrderDelivery.deliveryDate ?? "",
- notes: purchaseOrderDelivery.notes ?? "",
- dropShipment: purchaseOrderDelivery.dropShipment ?? false,
- customerId: purchaseOrderDelivery.customerId ?? "",
- customerLocationId: purchaseOrderDelivery.customerLocationId ?? "",
- ...getCustomFields(purchaseOrderDelivery.customFields),
+ id: orderData?.purchaseOrderDelivery.id,
+ locationId: orderData?.purchaseOrderDelivery.locationId ?? "",
+ supplierShippingCost:
+ orderData?.purchaseOrderDelivery.supplierShippingCost ?? 0,
+ shippingMethodId: orderData?.purchaseOrderDelivery.shippingMethodId ?? "",
+ shippingTermId: orderData?.purchaseOrderDelivery.shippingTermId ?? "",
+ trackingNumber: orderData?.purchaseOrderDelivery.trackingNumber ?? "",
+ receiptRequestedDate:
+ orderData?.purchaseOrderDelivery.receiptRequestedDate ?? "",
+ receiptPromisedDate:
+ orderData?.purchaseOrderDelivery.receiptPromisedDate ?? "",
+ deliveryDate: orderData?.purchaseOrderDelivery.deliveryDate ?? "",
+ notes: orderData?.purchaseOrderDelivery.notes ?? "",
+ dropShipment: orderData?.purchaseOrderDelivery.dropShipment ?? false,
+ customerId: orderData?.purchaseOrderDelivery.customerId ?? "",
+ customerLocationId:
+ orderData?.purchaseOrderDelivery.customerLocationId ?? "",
+ ...getCustomFields(orderData?.purchaseOrderDelivery.customFields),
};
const paymentInitialValues = {
id: purchaseOrderPayment.id,
@@ -214,6 +203,7 @@ export default function PurchaseOrderBasicRoute() {
<PurchaseOrderDeliveryForm
key={`delivery-${orderId}`}
initialValues={deliveryInitialValues}
+ currencyCode={initialValues.currencyCode}
/>
<PurchaseOrderPaymentForm
diff --git a/apps/erp/app/routes/x+/purchase-order+/$orderId.tsx b/apps/erp/app/routes/x+/purchase-order+/$orderId.tsx
index 6fda174a2e..e98587c877 100644
--- a/apps/erp/app/routes/x+/purchase-order+/$orderId.tsx
+++ b/apps/erp/app/routes/x+/purchase-order+/$orderId.tsx
@@ -8,6 +8,7 @@ import { defer, redirect } from "@vercel/remix";
import { PanelProvider, ResizablePanels } from "~/components/Layout/Panels";
import {
getPurchaseOrder,
+ getPurchaseOrderDelivery,
getPurchaseOrderLines,
getSupplier,
getSupplierInteractionDocuments,
@@ -37,9 +38,10 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
const { orderId } = params;
if (!orderId) throw new Error("Could not find orderId");
- const [purchaseOrder, lines] = await Promise.all([
+ const [purchaseOrder, lines, purchaseOrderDelivery] = await Promise.all([
getPurchaseOrder(client, orderId),
getPurchaseOrderLines(client, orderId),
+ getPurchaseOrderDelivery(client, orderId),
]);
if (purchaseOrder.data?.companyId !== companyId) {
@@ -80,6 +82,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
return defer({
purchaseOrder: purchaseOrder.data,
+ purchaseOrderDelivery: purchaseOrderDelivery.data,
lines: lines.data ?? [],
files: getSupplierInteractionDocuments(
client,
diff --git a/apps/mes/app/components/ItemThumbnail.tsx b/apps/mes/app/components/ItemThumbnail.tsx
index dd1a2c40a1..7ac17e308f 100644
--- a/apps/mes/app/components/ItemThumbnail.tsx
+++ b/apps/mes/app/components/ItemThumbnail.tsx
@@ -7,7 +7,7 @@ interface ItemThumbnailProps {
}
const itemVariants = cva(
- "bg-gradient-to-bl from-muted to-muted/40 rounded-lg border-2 border-transparent",
+ "bg-gradient-to-bl from-muted to-muted/40 rounded-lg",
{
variants: {
size: {
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 84ee859da4..5cfc28ce4f 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -14413,6 +14413,7 @@ export type Database = {
receiptRequestedDate: string | null
shippingMethodId: string | null
shippingTermId: string | null
+ supplierShippingCost: number
tags: string[] | null
trackingNumber: string | null
updatedAt: string | null
@@ -14432,6 +14433,7 @@ export type Database = {
receiptRequestedDate?: string | null
shippingMethodId?: string | null
shippingTermId?: string | null
+ supplierShippingCost?: number
tags?: string[] | null
trackingNumber?: string | null
updatedAt?: string | null
@@ -14451,6 +14453,7 @@ export type Database = {
receiptRequestedDate?: string | null
shippingMethodId?: string | null
shippingTermId?: string | null
+ supplierShippingCost?: number
tags?: string[] | null
trackingNumber?: string | null
updatedAt?: string | null
@@ -28698,6 +28701,7 @@ export type Database = {
supplierInteractionId: string | null
supplierLocationId: string | null
supplierReference: string | null
+ supplierShippingCost: number | null
tags: string[] | null
thumbnailPath: string | null
updatedAt: string | null
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 84ee859da4..5cfc28ce4f 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -14413,6 +14413,7 @@ export type Database = {
receiptRequestedDate: string | null
shippingMethodId: string | null
shippingTermId: string | null
+ supplierShippingCost: number
tags: string[] | null
trackingNumber: string | null
updatedAt: string | null
@@ -14432,6 +14433,7 @@ export type Database = {
receiptRequestedDate?: string | null
shippingMethodId?: string | null
shippingTermId?: string | null
+ supplierShippingCost?: number
tags?: string[] | null
trackingNumber?: string | null
updatedAt?: string | null
@@ -14451,6 +14453,7 @@ export type Database = {
receiptRequestedDate?: string | null
shippingMethodId?: string | null
shippingTermId?: string | null
+ supplierShippingCost?: number
tags?: string[] | null
trackingNumber?: string | null
updatedAt?: string | null
@@ -28698,6 +28701,7 @@ export type Database = {
supplierInteractionId: string | null
supplierLocationId: string | null
supplierReference: string | null
+ supplierShippingCost: number | null
tags: string[] | null
thumbnailPath: string | null
updatedAt: string | null
diff --git a/packages/database/supabase/migrations/20250116182231_shipping-cost-on-purchase-order.sql b/packages/database/supabase/migrations/20250116182231_shipping-cost-on-purchase-order.sql
new file mode 100644
index 0000000000..c8054b583a
--- /dev/null
+++ b/packages/database/supabase/migrations/20250116182231_shipping-cost-on-purchase-order.sql
@@ -0,0 +1,41 @@
+ALTER TABLE "purchaseOrderDelivery"
+ADD COLUMN "supplierShippingCost" NUMERIC NOT NULL DEFAULT 0;
+
+
+DROP VIEW IF EXISTS "purchaseOrders";
+CREATE OR REPLACE VIEW "purchaseOrders" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ p.*,
+ pl."thumbnailPath",
+ pl."itemType",
+ pl."orderTotal",
+ pd."supplierShippingCost",
+ pd."shippingMethodId",
+ pd."shippingTermId",
+ pd."receiptRequestedDate",
+ pd."receiptPromisedDate",
+ pd."deliveryDate",
+ pd."dropShipment",
+ pp."paymentTermId",
+ l."id" AS "locationId",
+ l."name" AS "locationName"
+ FROM "purchaseOrder" p
+ LEFT JOIN (
+ SELECT
+ pol."purchaseOrderId",
+ MIN(CASE
+ WHEN i."thumbnailPath" IS NULL AND mu."thumbnailPath" IS NOT NULL THEN mu."thumbnailPath"
+ ELSE i."thumbnailPath"
+ END) AS "thumbnailPath",
+ SUM(COALESCE(pol."purchaseQuantity", 0)*(COALESCE(pol."unitPrice", 0)) + COALESCE(pol."shippingCost", 0) + COALESCE(pol."taxAmount", 0)) AS "orderTotal",
+ MIN(i."type") AS "itemType"
+ FROM "purchaseOrderLine" pol
+ LEFT JOIN "item" i
+ ON i."id" = pol."itemId"
+ LEFT JOIN "modelUpload" mu ON mu.id = i."modelUploadId"
+ GROUP BY pol."purchaseOrderId"
+ ) pl ON pl."purchaseOrderId" = p."id"
+ LEFT JOIN "purchaseOrderDelivery" pd ON pd."id" = p."id"
+ LEFT JOIN "shippingTerm" st ON st."id" = pd."shippingTermId"
+ LEFT JOIN "purchaseOrderPayment" pp ON pp."id" = p."id"
+ LEFT JOIN "location" l ON l."id" = pd."locationId";
\ No newline at end of file
diff --git a/packages/documents/src/pdf/PurchaseOrderPDF.tsx b/packages/documents/src/pdf/PurchaseOrderPDF.tsx
index edc78db8f5..300524f972 100644
--- a/packages/documents/src/pdf/PurchaseOrderPDF.tsx
+++ b/packages/documents/src/pdf/PurchaseOrderPDF.tsx
@@ -78,6 +78,8 @@ const PurchaseOrderPDF = ({
0
);
+ const shippingCost = purchaseOrder?.supplierShippingCost ?? 0;
+
return (
<Template
title={title}
@@ -241,11 +243,23 @@ const PurchaseOrderPDF = ({
)}
>
<Text>Tax</Text>
- <Text style={tw(" text-gray-500")}>
+ <Text style={tw("font-normal text-gray-500")}>
{formatter.format(taxAmount)}
</Text>
</View>
)}
+ {shippingCost > 0 && (
+ <View
+ style={tw(
+ "flex flex-row justify-between items-center py-3 px-[6px] border-b border-gray-300 font-bold uppercase"
+ )}
+ >
+ <Text>Shipping</Text>
+ <Text style={tw("font-normal text-gray-500")}>
+ {formatter.format(shippingCost)}
+ </Text>
+ </View>
+ )}
<View
style={tw(
"flex flex-row justify-between items-center py-3 px-[6px] border-b border-gray-300 font-bold uppercase"
diff --git a/packages/react/src/Date/DatePicker.tsx b/packages/react/src/Date/DatePicker.tsx
index 1294355487..bc4688098b 100644
--- a/packages/react/src/Date/DatePicker.tsx
+++ b/packages/react/src/Date/DatePicker.tsx
@@ -60,7 +60,7 @@ const DatePicker = (
<InputGroup
{...groupProps}
ref={ref}
- className="w-full inline-flex rounded-r-none"
+ className="w-full inline-flex"
>
<div className="flex w-full px-4 py-2">
<DateField {...fieldProps} />
@@ -68,10 +68,12 @@ const DatePicker = (
<LuBan className="!text-destructive-foreground absolute right-[12px] top-[12px]" />
)}
</div>
+ <div className="flex-shrink-0 -mt-px">
+ <PopoverTrigger>
+ <FieldButton {...buttonProps} isPressed={state.isOpen} />
+ </PopoverTrigger>
+ </div>
</InputGroup>
- <PopoverTrigger>
- <FieldButton {...buttonProps} isPressed={state.isOpen} />
- </PopoverTrigger>
</>
)}
</HStack>