@propeller-commerce/propeller-v2-react-ui 0.23.1 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/index.cjs +12 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1542,9 +1542,9 @@ interface QuickOrderMatch {
|
|
|
1542
1542
|
name: string;
|
|
1543
1543
|
/** The product SKU/code (canonical, from the API). */
|
|
1544
1544
|
sku: string;
|
|
1545
|
-
/**
|
|
1545
|
+
/** Unit price incl. VAT. */
|
|
1546
1546
|
netPrice: number;
|
|
1547
|
-
/**
|
|
1547
|
+
/** Unit price excl. VAT. */
|
|
1548
1548
|
grossPrice: number;
|
|
1549
1549
|
/** Minimum order quantity (defaults to 1). */
|
|
1550
1550
|
minQuantity: number;
|
|
@@ -5926,6 +5926,8 @@ interface QuickOrderProps {
|
|
|
5926
5926
|
};
|
|
5927
5927
|
/** Tax zone for price calculation. Defaults to `'NL'`. */
|
|
5928
5928
|
taxZone?: string;
|
|
5929
|
+
/** Show tax-inclusive prices. Resolves from `<PropellerProvider>`. */
|
|
5930
|
+
includeTax?: boolean;
|
|
5929
5931
|
/** Orderlist (contract) ids to scope the catalogue by. */
|
|
5930
5932
|
orderlistIds?: number[];
|
|
5931
5933
|
/** Set `false` to ignore `orderlistIds`. Defaults to true when ids are given. */
|
|
@@ -5976,6 +5978,7 @@ interface QuickOrderProps {
|
|
|
5976
5978
|
colCode?: string;
|
|
5977
5979
|
colName?: string;
|
|
5978
5980
|
colPrice?: string;
|
|
5981
|
+
colPriceInclVat?: string;
|
|
5979
5982
|
colQuantity?: string;
|
|
5980
5983
|
colTotal?: string;
|
|
5981
5984
|
addRow?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1542,9 +1542,9 @@ interface QuickOrderMatch {
|
|
|
1542
1542
|
name: string;
|
|
1543
1543
|
/** The product SKU/code (canonical, from the API). */
|
|
1544
1544
|
sku: string;
|
|
1545
|
-
/**
|
|
1545
|
+
/** Unit price incl. VAT. */
|
|
1546
1546
|
netPrice: number;
|
|
1547
|
-
/**
|
|
1547
|
+
/** Unit price excl. VAT. */
|
|
1548
1548
|
grossPrice: number;
|
|
1549
1549
|
/** Minimum order quantity (defaults to 1). */
|
|
1550
1550
|
minQuantity: number;
|
|
@@ -5926,6 +5926,8 @@ interface QuickOrderProps {
|
|
|
5926
5926
|
};
|
|
5927
5927
|
/** Tax zone for price calculation. Defaults to `'NL'`. */
|
|
5928
5928
|
taxZone?: string;
|
|
5929
|
+
/** Show tax-inclusive prices. Resolves from `<PropellerProvider>`. */
|
|
5930
|
+
includeTax?: boolean;
|
|
5929
5931
|
/** Orderlist (contract) ids to scope the catalogue by. */
|
|
5930
5932
|
orderlistIds?: number[];
|
|
5931
5933
|
/** Set `false` to ignore `orderlistIds`. Defaults to true when ids are given. */
|
|
@@ -5976,6 +5978,7 @@ interface QuickOrderProps {
|
|
|
5976
5978
|
colCode?: string;
|
|
5977
5979
|
colName?: string;
|
|
5978
5980
|
colPrice?: string;
|
|
5981
|
+
colPriceInclVat?: string;
|
|
5979
5982
|
colQuantity?: string;
|
|
5980
5983
|
colTotal?: string;
|
|
5981
5984
|
addRow?: string;
|
package/dist/index.js
CHANGED
|
@@ -14377,6 +14377,7 @@ function blankRow() {
|
|
|
14377
14377
|
productId: null,
|
|
14378
14378
|
name: "",
|
|
14379
14379
|
netPrice: 0,
|
|
14380
|
+
grossPrice: 0,
|
|
14380
14381
|
quantity: 1,
|
|
14381
14382
|
minQuantity: 1,
|
|
14382
14383
|
matches: [],
|
|
@@ -14407,6 +14408,7 @@ function QuickOrderInner(props) {
|
|
|
14407
14408
|
const graphqlClient = props.graphqlClient;
|
|
14408
14409
|
const displayPrice = (n) => props.formatPrice ? props.formatPrice(n) : formatPrice(n, { symbol: currency, locale: localeForLanguage(props.language) });
|
|
14409
14410
|
const L = (key, fallback) => getLabel(labels, key, fallback);
|
|
14411
|
+
const rowPrice = (r) => props.includeTax ? r.netPrice : r.grossPrice;
|
|
14410
14412
|
const { submitting, searchProducts, submit } = useQuickOrder({
|
|
14411
14413
|
graphqlClient,
|
|
14412
14414
|
user,
|
|
@@ -14433,7 +14435,7 @@ function QuickOrderInner(props) {
|
|
|
14433
14435
|
}, []);
|
|
14434
14436
|
const onCodeInput = useCallback(
|
|
14435
14437
|
(key, value) => {
|
|
14436
|
-
patchRow(key, { code: value, productId: null, name: "", netPrice: 0, searched: false });
|
|
14438
|
+
patchRow(key, { code: value, productId: null, name: "", netPrice: 0, grossPrice: 0, searched: false });
|
|
14437
14439
|
setNotice(null);
|
|
14438
14440
|
const timers = searchTimers.current;
|
|
14439
14441
|
if (timers[key]) clearTimeout(timers[key]);
|
|
@@ -14454,7 +14456,7 @@ function QuickOrderInner(props) {
|
|
|
14454
14456
|
const dup = rows.some((r) => r.key !== key && r.productId && r.code === match.sku);
|
|
14455
14457
|
if (dup) {
|
|
14456
14458
|
setNotice(L("alreadyInList", "Product is already in the list"));
|
|
14457
|
-
patchRow(key, { code: "", matches: [], productId: null, name: "", netPrice: 0, searched: false });
|
|
14459
|
+
patchRow(key, { code: "", matches: [], productId: null, name: "", netPrice: 0, grossPrice: 0, searched: false });
|
|
14458
14460
|
return;
|
|
14459
14461
|
}
|
|
14460
14462
|
patchRow(key, {
|
|
@@ -14463,6 +14465,7 @@ function QuickOrderInner(props) {
|
|
|
14463
14465
|
clusterId: match.clusterId,
|
|
14464
14466
|
name: match.name,
|
|
14465
14467
|
netPrice: match.netPrice,
|
|
14468
|
+
grossPrice: match.grossPrice,
|
|
14466
14469
|
quantity: match.minQuantity,
|
|
14467
14470
|
minQuantity: match.minQuantity,
|
|
14468
14471
|
matches: [],
|
|
@@ -14524,6 +14527,7 @@ function QuickOrderInner(props) {
|
|
|
14524
14527
|
clusterId: exact.clusterId,
|
|
14525
14528
|
name: exact.name,
|
|
14526
14529
|
netPrice: exact.netPrice,
|
|
14530
|
+
grossPrice: exact.grossPrice,
|
|
14527
14531
|
quantity: Math.max(exact.minQuantity, line.quantity),
|
|
14528
14532
|
minQuantity: exact.minQuantity
|
|
14529
14533
|
});
|
|
@@ -14593,7 +14597,7 @@ function QuickOrderInner(props) {
|
|
|
14593
14597
|
/* @__PURE__ */ jsxs("div", { className: "hidden md:grid grid-cols-12 gap-2 px-2 pb-2 text-xs font-medium text-muted-foreground border-b border-border", children: [
|
|
14594
14598
|
/* @__PURE__ */ jsx("div", { className: "col-span-3", children: L("colCode", "Article no. / SKU") }),
|
|
14595
14599
|
/* @__PURE__ */ jsx("div", { className: "col-span-3", children: L("colName", "Product name") }),
|
|
14596
|
-
/* @__PURE__ */ jsx("div", { className: "col-span-2", children: L("colPrice", "excl. VAT") }),
|
|
14600
|
+
/* @__PURE__ */ jsx("div", { className: "col-span-2", children: props.includeTax ? L("colPriceInclVat", "incl. VAT") : L("colPrice", "excl. VAT") }),
|
|
14597
14601
|
/* @__PURE__ */ jsx("div", { className: "col-span-1", children: L("colQuantity", "Qty") }),
|
|
14598
14602
|
/* @__PURE__ */ jsx("div", { className: "col-span-2 text-right", children: L("colTotal", "Total") }),
|
|
14599
14603
|
/* @__PURE__ */ jsx("div", { className: "col-span-1" })
|
|
@@ -14646,7 +14650,7 @@ function QuickOrderInner(props) {
|
|
|
14646
14650
|
"input",
|
|
14647
14651
|
{
|
|
14648
14652
|
type: "text",
|
|
14649
|
-
value: r.productId ? displayPrice(r
|
|
14653
|
+
value: r.productId ? displayPrice(rowPrice(r)) : "",
|
|
14650
14654
|
disabled: true,
|
|
14651
14655
|
className: "w-full rounded border border-input bg-muted/40 px-2 py-1.5 text-sm text-muted-foreground"
|
|
14652
14656
|
}
|
|
@@ -14666,7 +14670,7 @@ function QuickOrderInner(props) {
|
|
|
14666
14670
|
className: "w-full rounded border border-input bg-background px-2 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-ring disabled:bg-muted/40"
|
|
14667
14671
|
}
|
|
14668
14672
|
) }),
|
|
14669
|
-
/* @__PURE__ */ jsx("div", { className: "col-span-9 md:col-span-2 text-right text-sm text-foreground whitespace-nowrap", children: r.productId ? displayPrice(r
|
|
14673
|
+
/* @__PURE__ */ jsx("div", { className: "col-span-9 md:col-span-2 text-right text-sm text-foreground whitespace-nowrap", children: r.productId ? displayPrice(rowPrice(r) * r.quantity) : "" }),
|
|
14670
14674
|
/* @__PURE__ */ jsx("div", { className: "col-span-3 md:col-span-1 flex justify-end", children: /* @__PURE__ */ jsx(
|
|
14671
14675
|
"button",
|
|
14672
14676
|
{
|
|
@@ -17706,8 +17710,8 @@ function PurchaseAuthorizationRequests(rawProps) {
|
|
|
17706
17710
|
/* @__PURE__ */ jsx("thead", { className: "bg-muted/50 border-b border-border", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
17707
17711
|
/* @__PURE__ */ jsx("th", { className: "text-left px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemProduct", "Product") }),
|
|
17708
17712
|
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemQty", "Qty") }),
|
|
17709
|
-
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemUnitPrice", "Unit price") }),
|
|
17710
|
-
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemTotal", "Total") })
|
|
17713
|
+
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemUnitPrice", "Unit price excl. VAT") }),
|
|
17714
|
+
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-2 font-medium text-muted-foreground", children: getLabel(props.labels, "itemTotal", "Total excl. VAT") })
|
|
17711
17715
|
] }) }),
|
|
17712
17716
|
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-border", children: getModalItems().map((item, idx) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
17713
17717
|
/* @__PURE__ */ jsx("td", { className: "px-3 py-2", children: getProductName5(item) }),
|
|
@@ -17715,7 +17719,7 @@ function PurchaseAuthorizationRequests(rawProps) {
|
|
|
17715
17719
|
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right", children: formatPrice17(
|
|
17716
17720
|
(item.quantity ?? 0) > 0 ? (item.totalSum ?? 0) / (item.quantity ?? 1) : 0
|
|
17717
17721
|
) }),
|
|
17718
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right font-medium", children: formatPrice17(item.
|
|
17722
|
+
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-right font-medium", children: formatPrice17(item.totalSum ?? 0) })
|
|
17719
17723
|
] }, idx)) })
|
|
17720
17724
|
] }) })
|
|
17721
17725
|
] }),
|