@flowselections/floriday-verkoop-module 1.0.158 → 1.0.159
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/dist-lib/components/verkoop/CreateOrderPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/CreateOrderPage.js +5 -1
- package/dist-lib/components/verkoop/SalesOrderDetailPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SalesOrderDetailPage.js +40 -2
- package/dist-lib/components/verkoop/klok/KlokOrderPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/klok/KlokOrderPage.js +3 -1
- package/dist-lib/components/verkoop/klok/KlokOrdersList.d.ts.map +1 -1
- package/dist-lib/components/verkoop/klok/KlokOrdersList.js +2 -2
- package/dist-lib/components/verkoop/v3/RowMenu.js +1 -1
- package/dist-lib/lib/create-order-form.d.ts +6 -0
- package/dist-lib/lib/create-order-form.d.ts.map +1 -1
- package/dist-lib/lib/create-order-form.js +8 -0
- package/dist-lib/lib/create-order.functions.d.ts.map +1 -1
- package/dist-lib/lib/create-order.functions.js +25 -4
- package/dist-lib/lib/klok-labels.d.ts +13 -0
- package/dist-lib/lib/klok-labels.d.ts.map +1 -1
- package/dist-lib/lib/klok-labels.js +8 -0
- package/dist-lib/lib/klok-list.d.ts +2 -0
- package/dist-lib/lib/klok-list.d.ts.map +1 -1
- package/dist-lib/lib/klok-list.js +4 -0
- package/dist-lib/lib/order-cancel-view.d.ts +25 -0
- package/dist-lib/lib/order-cancel-view.d.ts.map +1 -1
- package/dist-lib/lib/order-cancel-view.js +13 -0
- package/dist-lib/lib/product-group-lines.server.d.ts +7 -0
- package/dist-lib/lib/product-group-lines.server.d.ts.map +1 -0
- package/dist-lib/lib/product-group-lines.server.js +26 -0
- package/dist-lib/lib/salesorders-list.server.d.ts.map +1 -1
- package/dist-lib/lib/salesorders-list.server.js +4 -4
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateOrderPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/CreateOrderPage.tsx"],"names":[],"mappings":"AAuGA,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"CreateOrderPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/CreateOrderPage.tsx"],"names":[],"mappings":"AAuGA,wBAAgB,eAAe,gCAi0C9B"}
|
|
@@ -11,7 +11,7 @@ import { Link, useBlocker, useNavigate } from "@tanstack/react-router";
|
|
|
11
11
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
12
12
|
import { AlertTriangle, ArrowLeft, CheckCircle2, ChevronUp, Loader2, Plus, Trash2 } from "lucide-react";
|
|
13
13
|
import { isOwnTransportKind, ownPickupLabel, OWN_PICKUP_MISSING_TEXT } from "../../lib/own-transport.js";
|
|
14
|
-
import { missingItems, lineTotal, dateWithWeekday, eur, attentionItems, selectionKey, resetOnSelectionChange, applyFirstFeasible, prijsSleutel, PRIJS_FOUT_TEXT, PRIJS_ONBEKEND_TEXT, bekendePrijs, regelMistPrijs, groepLeden } from "../../lib/create-order-form.js";
|
|
14
|
+
import { missingItems, lineTotal, dateWithWeekday, eur, attentionItems, selectionKey, resetOnSelectionChange, applyFirstFeasible, prijsSleutel, PRIJS_FOUT_TEXT, PRIJS_ONBEKEND_TEXT, bekendePrijs, regelMistPrijs, groepLeden, groepZonderLedenTekst } from "../../lib/create-order-form.js";
|
|
15
15
|
import { useServerFn } from "@tanstack/react-start";
|
|
16
16
|
import { SearchableSelect } from "./SearchableSelect.js";
|
|
17
17
|
import { toISODate } from "../../lib/carrier-availability.js";
|
|
@@ -812,6 +812,10 @@ export function CreateOrderPage() {
|
|
|
812
812
|
const gekozen = v ? products.find((x) => x.id === v) : null;
|
|
813
813
|
if (gekozen?.source === "group") {
|
|
814
814
|
// Productgroep: eerst een artikel uit de groep kiezen (een groep heeft geen eigen voorraad).
|
|
815
|
+
if (groepLeden(gekozen, products).length === 0) {
|
|
816
|
+
toast.error(groepZonderLedenTekst(gekozen.product));
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
815
819
|
setGroepKeuze({ idx, groep: gekozen });
|
|
816
820
|
return;
|
|
817
821
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SalesOrderDetailPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SalesOrderDetailPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrderDetailPage.tsx"],"names":[],"mappings":"AA8HA,wBAAgB,oBAAoB,gCAsWnC"}
|
|
@@ -33,6 +33,11 @@ import { OrderStepper } from "./v3/OrderStepper.js";
|
|
|
33
33
|
import { NavigationTooltip } from "./v3/NavigationTooltip.js";
|
|
34
34
|
import { FactTile, InfoCard, InfoRow } from "./v3/InfoCard.js";
|
|
35
35
|
import { PickupDeliveryLine } from "./OrderTransportCard.js";
|
|
36
|
+
import { groepZonderGeannuleerd, kanLidAnnuleren } from "../../lib/order-cancel-view.js";
|
|
37
|
+
import { geannuleerdMelding } from "../../lib/order-terugdraaien.js";
|
|
38
|
+
import { cancelLocalOrder } from "../../lib/create-order.functions.js";
|
|
39
|
+
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, toast } from "@flowselections/core";
|
|
40
|
+
import { Loader2 } from "lucide-react";
|
|
36
41
|
const eur = new Intl.NumberFormat("nl-NL", { style: "currency", currency: "EUR", minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
37
42
|
function fmtDT(iso) {
|
|
38
43
|
if (!iso)
|
|
@@ -131,7 +136,7 @@ export function SalesOrderDetailPage() {
|
|
|
131
136
|
const all = listQuery.data?.orders ?? [];
|
|
132
137
|
return all.find((o) => o.id === salesOrderId)?.bufferId ?? null;
|
|
133
138
|
}, [isFloriday, isLocal, detailQuery.data?.bufferId, localDetailQuery.data?.bufferId, primary, listQuery.data?.orders, salesOrderId]);
|
|
134
|
-
const
|
|
139
|
+
const bufferOrdersRaw = useMemo(() => {
|
|
135
140
|
if (!bufferId)
|
|
136
141
|
return primary ? [primary] : [];
|
|
137
142
|
const head = primary;
|
|
@@ -159,6 +164,8 @@ export function SalesOrderDetailPage() {
|
|
|
159
164
|
const localHead = primary ?? siblings.find((o) => o.id === salesOrderId) ?? siblings[0];
|
|
160
165
|
return [localHead, ...rest];
|
|
161
166
|
}, [primary, bufferId, isFloriday, isLocal, detailQuery.data?.bufferSiblings, localDetailQuery.data?.bufferSiblings, listQuery.data?.orders, salesOrderId]);
|
|
167
|
+
// Geannuleerde orders zijn nooit lid van een groep (de getoonde order zelf blijft staan).
|
|
168
|
+
const bufferOrders = useMemo(() => groepZonderGeannuleerd(bufferOrdersRaw, primary?.id ?? null), [bufferOrdersRaw, primary?.id]);
|
|
162
169
|
const inGroup = bufferOrders.length > 1;
|
|
163
170
|
// Losse order uit een groep (?weergave=order): toon alleen die order.
|
|
164
171
|
const isBuffer = inGroup && !singleInGroup;
|
|
@@ -253,5 +260,36 @@ export function SalesOrderDetailPage() {
|
|
|
253
260
|
function BufferOrderRow({ order, member, sellerFallback }) {
|
|
254
261
|
const [open, setOpen] = useState(false);
|
|
255
262
|
const bufferInvoiceId = orderUuid(order.orderRowId ?? order.id);
|
|
256
|
-
return (_jsxs("div", { className: "overflow-hidden rounded-lg border border-border", children: [_jsxs("div", { className: "flex items-center gap-3 p-3", children: [_jsx("button", { type: "button", onClick: () => setOpen((v) => !v), "aria-expanded": open, "aria-label": open ? "Details verbergen" : "Details tonen", className: "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted", children: open ? _jsx(ChevronDown, { className: "h-4 w-4" }) : _jsx(ChevronRight, { className: "h-4 w-4" }) }), _jsx("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted", children: order.imageUrl ? _jsx("img", { src: order.imageUrl, alt: "", className: "h-full w-full object-cover" }) : _jsx(ImageIcon, { className: "h-5 w-5 text-muted-foreground" }) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "font-semibold tabular-nums text-foreground", children: order.orderNumber || "—" }), _jsx("span", { className: "text-xs text-muted-foreground", children: sourceLabel(order.source ?? (order.isLocal ? "manual" : "floriday")) })] }), _jsx("div", { className: "truncate text-sm text-foreground", children: order.productName }), _jsxs("div", { className: "flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-muted-foreground", children: [_jsxs("span", { children: [formatLoadUnits(order.karCount, order.cartTypeName), " karren", order.karShared ? " (gedeeld)" : ""] }), _jsxs("span", { children: [formatLoadUnits(order.fustCount, order.mixedPacking ? null : order.crateTypeName), " fust"] }), order.mixedPacking && (order.articleCount ?? 0) > 1 && _jsxs("span", { children: ["Gemengd (", order.articleCount, " artikelen)"] }), _jsx("span", { className: "tabular-nums", children: eur.format(order.revenue ?? 0) })] })] }), _jsx(Button, { asChild: true, variant: "outline", size: "sm", className: "shrink-0", children: _jsx(Link, { to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: order.id }, search: { weergave: "order" }, children: "Open order" }) })] }), _jsx("div", { className: "border-t border-border px-3 py-2 text-sm", children: member.invoiceRoute === "floriday" ? (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsx("span", { className: "text-muted-foreground", children: "Factuur via Floriday (Royal FloraHolland)" }), _jsxs("span", { className: "tabular-nums", children: ["Afgemeld: ", member.floridayDone, " van ", member.floridayTotal] })] })) : (bufferInvoiceId && !open && _jsx(OrderInvoiceCard, { orderId: bufferInvoiceId })) }), open && (_jsx("div", { className: "border-t border-border bg-background p-4", children: _jsx(SalesOrderDetailView, { order: order, sellerFallback: sellerFallback ?? null, hideKarindeling: true }) }))] }));
|
|
263
|
+
return (_jsxs("div", { className: "overflow-hidden rounded-lg border border-border", children: [_jsxs("div", { className: "flex items-center gap-3 p-3", children: [_jsx("button", { type: "button", onClick: () => setOpen((v) => !v), "aria-expanded": open, "aria-label": open ? "Details verbergen" : "Details tonen", className: "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted", children: open ? _jsx(ChevronDown, { className: "h-4 w-4" }) : _jsx(ChevronRight, { className: "h-4 w-4" }) }), _jsx("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted", children: order.imageUrl ? _jsx("img", { src: order.imageUrl, alt: "", className: "h-full w-full object-cover" }) : _jsx(ImageIcon, { className: "h-5 w-5 text-muted-foreground" }) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "font-semibold tabular-nums text-foreground", children: order.orderNumber || "—" }), _jsx("span", { className: "text-xs text-muted-foreground", children: sourceLabel(order.source ?? (order.isLocal ? "manual" : "floriday")) })] }), _jsx("div", { className: "truncate text-sm text-foreground", children: order.productName }), _jsxs("div", { className: "flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-muted-foreground", children: [_jsxs("span", { children: [formatLoadUnits(order.karCount, order.cartTypeName), " karren", order.karShared ? " (gedeeld)" : ""] }), _jsxs("span", { children: [formatLoadUnits(order.fustCount, order.mixedPacking ? null : order.crateTypeName), " fust"] }), order.mixedPacking && (order.articleCount ?? 0) > 1 && _jsxs("span", { children: ["Gemengd (", order.articleCount, " artikelen)"] }), _jsx("span", { className: "tabular-nums", children: eur.format(order.revenue ?? 0) })] })] }), kanLidAnnuleren(order) && _jsx(AnnuleerLidKnop, { order: order }), _jsx(Button, { asChild: true, variant: "outline", size: "sm", className: "shrink-0", children: _jsx(Link, { to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: order.id }, search: { weergave: "order" }, children: "Open order" }) })] }), _jsx("div", { className: "border-t border-border px-3 py-2 text-sm", children: member.invoiceRoute === "floriday" ? (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [_jsx("span", { className: "text-muted-foreground", children: "Factuur via Floriday (Royal FloraHolland)" }), _jsxs("span", { className: "tabular-nums", children: ["Afgemeld: ", member.floridayDone, " van ", member.floridayTotal] })] })) : (bufferInvoiceId && !open && _jsx(OrderInvoiceCard, { orderId: bufferInvoiceId })) }), open && (_jsx("div", { className: "border-t border-border bg-background p-4", children: _jsx(SalesOrderDetailView, { order: order, sellerFallback: sellerFallback ?? null, hideKarindeling: true }) }))] }));
|
|
264
|
+
}
|
|
265
|
+
/** Eén order uit een gecombineerde order annuleren (voorraad terug via voorraad_order_terugdraaien op de server). */
|
|
266
|
+
function AnnuleerLidKnop({ order }) {
|
|
267
|
+
const [open, setOpen] = useState(false);
|
|
268
|
+
const [bezig, setBezig] = useState(false);
|
|
269
|
+
const bezigRef = useRef(false);
|
|
270
|
+
const qc = useQueryClient();
|
|
271
|
+
const cancel = useServerFn(cancelLocalOrder);
|
|
272
|
+
const orderId = orderUuid(order.orderRowId ?? order.id);
|
|
273
|
+
const bevestig = async () => {
|
|
274
|
+
if (bezigRef.current || !orderId)
|
|
275
|
+
return;
|
|
276
|
+
bezigRef.current = true;
|
|
277
|
+
setBezig(true);
|
|
278
|
+
try {
|
|
279
|
+
await cancel({ data: { orderId } });
|
|
280
|
+
toast.success(geannuleerdMelding(order.orderNumber));
|
|
281
|
+
setOpen(false);
|
|
282
|
+
await qc.invalidateQueries();
|
|
283
|
+
}
|
|
284
|
+
catch (e) {
|
|
285
|
+
console.error("[AnnuleerLidKnop]", e);
|
|
286
|
+
toast.error(String(e?.message ?? "") || "De order kon niet worden geannuleerd. Probeer het opnieuw of neem contact op met de beheerder.");
|
|
287
|
+
}
|
|
288
|
+
finally {
|
|
289
|
+
bezigRef.current = false;
|
|
290
|
+
setBezig(false);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", size: "sm", className: "shrink-0 text-destructive", onClick: () => setOpen(true), children: "Annuleren" }), _jsx(Dialog, { open: open, onOpenChange: (o) => { if (!bezig)
|
|
294
|
+
setOpen(o); }, children: _jsxs(DialogContent, { className: "sm:max-w-md", children: [_jsxs(DialogHeader, { children: [_jsxs(DialogTitle, { children: [order.orderNumber || "Order", " annuleren?"] }), _jsx(DialogDescription, { children: "Alleen deze order wordt geannuleerd; de voorraad komt weer vrij. De andere orders in de groep blijven staan." })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", disabled: bezig, onClick: () => setOpen(false), children: "Terug" }), _jsxs(Button, { variant: "destructive", disabled: bezig, onClick: bevestig, children: [bezig && _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), "Order annuleren"] })] })] }) })] }));
|
|
257
295
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KlokOrderPage.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/klok/KlokOrderPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"KlokOrderPage.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/klok/KlokOrderPage.tsx"],"names":[],"mappings":"AA8EA,wBAAgB,aAAa,gCA0uB5B"}
|
|
@@ -8,7 +8,7 @@ import { ArrowLeft, ChevronDown, Eye, Loader2, Package, Plus, Repeat, RotateCcw,
|
|
|
8
8
|
import { listProductsForCreateOrder } from "../../../lib/create-order.functions.js";
|
|
9
9
|
import { deleteKlokOrder, getKlokArtikelen, getKlokLijsten, getKlokOrder, listKlokSjablonen, repeatKlokOrder, resendKlokOrder, saveKlokConcept, saveKlokSjabloon, sendKlokOrder, refreshKlokStatus, retryKlokAnnuleren, } from "../../../lib/klok.functions.js";
|
|
10
10
|
import { klokFoutLijst, klokOntbreekt, klokOntbreektVelden, LEGE_KOP, neemPrijsOver, regelMetArtikel, regelNaArtikelwissel } from "../../../lib/klok-form.js";
|
|
11
|
-
import { KLOK_LIJST_LEEG_TEXT, KEURCODE_GROEPEN, keurcodeLabel, klokAlleenLezen, klokAnnulerenOpenstaand, klokKanVerwijderen, klokTellers, tellersTekst, volgendeVeildag, klokLijstWeergave, klokLocatieKnoppen, prijsTekst, } from "../../../lib/klok-labels.js";
|
|
11
|
+
import { KLOK_LIJST_LEEG_TEXT, KEURCODE_GROEPEN, keurcodeLabel, klokAlleenLezen, klokAnnulerenOpenstaand, klokKanVerwijderen, klokTellers, tellersTekst, volgendeVeildag, klokLijstWeergave, klokLocatieKnoppen, prijsTekst, klokRegelKwaliteitFout, } from "../../../lib/klok-labels.js";
|
|
12
12
|
import { fmtNL } from "../../../lib/nl-datetime.js";
|
|
13
13
|
import { amsterdamYmd, ymdString } from "../../../lib/period-range.js";
|
|
14
14
|
import { SearchableSelect } from "../SearchableSelect.js";
|
|
@@ -398,6 +398,8 @@ export function KlokOrderPage() {
|
|
|
398
398
|
const doorStuks = resultaten.filter((r) => r.doorgedraaid).reduce((s, r) => s + Number(r.stuks || 0), 0);
|
|
399
399
|
return (_jsxs("main", { className: "flex w-full min-w-0 flex-col gap-4 overflow-x-clip p-4 pb-40 sm:p-6 sm:pb-32", children: [_jsxs("header", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(Button, { variant: "ghost", size: "sm", className: "h-9 w-9 p-0", "aria-label": "Terug", onClick: () => navigate({ to: "/floriday-verkoop/klok" }), children: _jsx(ArrowLeft, { className: "h-4 w-4" }) }), _jsxs("div", { className: "min-w-0", children: [_jsx("h1", { className: "truncate text-xl font-bold tracking-tight sm:text-2xl", children: row ? `Veilbrief ${row.klok_nummer}` : "Klokorder (veilbrief)" }), row && (_jsxs("div", { className: "flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground", children: [_jsx(KlokStatusBadge, { status: status, detail: row.status_detail }), row.status_detail && _jsx("span", { children: row.status_detail }), orderQ.data?.orderNumber && _jsxs("span", { children: ["Order ", orderQ.data.orderNumber] })] }))] })] }), row && (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs(Button, { variant: "outline", size: "sm", onClick: onHerhalen, children: [_jsx(Repeat, { className: "mr-2 h-4 w-4" }), " Herhalen"] }), klokKanVerwijderen(status) && !bewerken && (_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setBevestigVerwijder(true), disabled: !!bezig || !!blokkade, title: blokkade ?? undefined, children: [_jsx(Trash2, { className: "mr-2 h-4 w-4" }), " Verwijderen"] })), annulerenOpen && (_jsxs(Button, { size: "sm", variant: "outline", onClick: onOpnieuwAnnuleren, disabled: !!bezig, "aria-busy": bezig === "retry" || undefined, children: [bezig === "retry" ? _jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": true }) : _jsx(RotateCcw, { className: "mr-2 h-4 w-4" }), " Order annuleren opnieuw proberen"] })), klokKanVerwijderen(status) && !bewerken && (_jsx(Button, { size: "sm", onClick: () => setBewerken(true), disabled: !!blokkade, title: blokkade ?? undefined, children: "Wijzigen en opnieuw versturen" }))] }))] }), _jsx(KlokNotice, {}), fout && (_jsxs("div", { role: "alert", className: "flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive-soft px-3 py-2 text-sm text-destructive-soft-foreground", children: [fouten.length > 1 || (fouten.length === 1 && fouten[0].tekst !== fout) ? (_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "font-medium", children: fouten.length === 1 ? "Er is 1 punt om op te lossen:" : `Er zijn ${fouten.length} punten om op te lossen:` }), _jsx("ul", { className: "mt-1 list-disc space-y-0.5 pl-5", children: fouten.map((f, i) => _jsx("li", { children: f.tekst }, i)) })] })) : (_jsx("span", { className: "min-w-0 flex-1", children: fout })), _jsx("button", { type: "button", "aria-label": "Sluiten", onClick: () => setFout(null), children: _jsx(X, { className: "h-4 w-4" }) })] })), row?.laatste_fout && !fout && (_jsx("div", { className: "rounded-lg border border-border bg-warning-soft px-3 py-2 text-sm text-warning-soft-foreground", children: row.laatste_fout })), _jsx("section", { className: "rounded-xl border border-border bg-card p-4 shadow-sm sm:p-5", children: _jsxs("div", { className: "grid gap-4 [@container(min-width:48rem)]:grid-cols-2 md:grid-cols-2", children: [_jsxs("div", { className: "md:col-span-2 rounded-lg" + (foutVelden.has("veillocatie") ? " p-1 ring-1 ring-destructive" : ""), children: [_jsxs("div", { className: "mb-1.5 text-sm font-medium", children: ["Veillocatie ", _jsx("span", { className: "text-destructive", children: "*" })] }), laden ? (_jsxs("div", { className: "flex gap-2", children: [_jsx(Skeleton, { className: "h-9 w-28" }), _jsx(Skeleton, { className: "h-9 w-28" }), _jsx(Skeleton, { className: "h-9 w-28" })] })) : locaties.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: leegTekst ?? lijsten?.locaties?.message ?? lijsten?.locaties?.error ?? (kop.veillocatie_naam || "Geen veillocaties gevonden.") })) : (_jsxs("div", { className: "flex flex-wrap gap-2", children: [toonKnoppen.map((l) => (_jsx(Button, { type: "button", variant: kop.veillocatie_id === l.id ? "default" : "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: alleenLezen, onClick: () => setKop((k) => ({ ...k, ...locFields(l), veilgroep: k.veillocatie_id === l.id ? k.veilgroep : null })), children: l.displayName ?? l.name }, l.id))), toonMeer.length > 0 && !alleenLezen && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", children: ["Meer ", _jsx(ChevronDown, { className: "ml-1 h-4 w-4" })] }) }), _jsx(DropdownMenuContent, { children: toonMeer.map((l) => (_jsx(DropdownMenuItem, { onClick: () => setKop((k) => ({ ...k, ...locFields(l), veilgroep: null })), children: l.displayName ?? l.name }, l.id))) })] }))] }))] }), _jsxs("label", { className: "block", children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Veildatum ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { type: "date", value: kop.veildatum ?? "", disabled: alleenLezen, className: "h-9 [@media(pointer:coarse)]:h-11" + rood("veildatum"), onChange: (e) => setKop((k) => ({ ...k, veildatum: e.target.value || null })) }), kop.veildatum && _jsx("span", { className: "mt-1 block text-xs text-muted-foreground", children: fmtNL(kop.veildatum, { weekday: "long", day: "numeric", month: "long" }) })] }), _jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Veilgroep ", _jsx("span", { className: "text-destructive", children: "*" })] }), laden ? (_jsx(Skeleton, { className: "h-9 w-full" })) : eigenGroep || groepOpties.length === 0 ? (_jsxs("div", { className: "flex gap-2", children: [_jsx(Input, { inputMode: "numeric", placeholder: groepOpties.length === 0 && leegTekst ? leegTekst : "Veilgroep (cijfers)", value: kop.veilgroep ?? "", disabled: alleenLezen, className: "h-9 [@media(pointer:coarse)]:h-11" + rood("veilgroep"), onChange: (e) => setKop((k) => ({ ...k, veilgroep: e.target.value.replace(/\D/g, "") || null })) }), groepOpties.length > 0 && !alleenLezen && _jsx(Button, { variant: "ghost", size: "sm", className: "h-9", onClick: () => setEigenGroep(false), children: "Kies uit lijst" })] })) : (_jsxs("div", { className: "flex gap-2", children: [_jsx(SearchableSelect, { value: kop.veilgroep, options: groepOpties, placeholder: "Zoek veilgroep", allowClear: true, clearLabel: "\u2014 Geen \u2014", disabled: alleenLezen, className: "min-h-9 flex-1 [@media(pointer:coarse)]:min-h-11" + rood("veilgroep"), onChange: (v) => setKop((k) => ({ ...k, veilgroep: v })) }), !alleenLezen && _jsx(Button, { variant: "ghost", size: "sm", className: "h-9", onClick: () => setEigenGroep(true), children: "Zelf invullen" })] }))] }), laden && (_jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Verzendlocatie ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Skeleton, { className: "h-9 w-full" })] })), !laden && verzend.length > 1 && (_jsxs("div", { children: [_jsxs("span", { className: "mb-1.5 block text-sm font-medium", children: ["Verzendlocatie ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(SearchableSelect, { value: kop.verzendlocatie_id, disabled: alleenLezen, allowClear: false, options: verzend.map((v) => ({ value: v.id, label: v.name, badge: v.isDefault ? "Standaard" : v.isExternal ? "Extern" : null })), className: "min-h-9 w-full [@media(pointer:coarse)]:min-h-11" + rood("verzendlocatie"), onChange: (v) => setKop((k) => ({ ...k, verzendlocatie_id: v, verzendlocatie_naam: verzend.find((x) => x.id === v)?.name ?? null })) })] })), !laden && verzend.length === 0 && !kop.verzendlocatie_id && leegTekst && (_jsxs("div", { children: [_jsx("span", { className: "mb-1.5 block text-sm font-medium", children: "Verzendlocatie" }), _jsx("p", { className: "text-sm text-muted-foreground", children: leegTekst })] })), _jsxs("div", { children: [_jsx("span", { className: "mb-1.5 block text-sm font-medium", children: "Vervoer" }), _jsx("div", { className: "flex gap-2", children: VERVOER.map((v) => (_jsx(Button, { type: "button", size: "sm", variant: kop.vervoer === v.id ? "default" : "outline", disabled: alleenLezen, className: "h-9 [@media(pointer:coarse)]:h-11", onClick: () => setKop((k) => ({ ...k, vervoer: v.id })), children: v.label }, v.id))) })] })] }) }), _jsxs("section", { className: "rounded-xl border border-border bg-card shadow-sm", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3 sm:px-5", children: [_jsx("h2", { className: "text-sm font-semibold", children: "Regels" }), !alleenLezen && (_jsxs("div", { className: "flex flex-wrap gap-2", children: [sjablonen.length > 0 && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", children: ["Kies sjabloon ", _jsx(ChevronDown, { className: "ml-1 h-4 w-4" })] }) }), _jsx(DropdownMenuContent, { children: sjablonen.map((s) => _jsx(DropdownMenuItem, { onClick: () => kiesSjabloon(s), children: s.naam }, s.id)) })] })), _jsx(Button, { variant: "outline", size: "sm", disabled: !kop.veillocatie_id, onClick: () => setSjabloonNaam(""), children: "Opslaan als sjabloon" })] }))] }), _jsx("ul", { className: "divide-y divide-border", children: regels.map((r, i) => {
|
|
400
400
|
const km = kenmerken[r.key];
|
|
401
|
+
const kwFout = alleenLezen ? null : klokRegelKwaliteitFout(r, km);
|
|
402
|
+
const kwRood = regelRood(r.key, "kwaliteit") || !!kwFout;
|
|
401
403
|
return (_jsxs("li", { className: "space-y-3 px-4 py-4 sm:px-5", children: [_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("span", { className: "mt-2 w-6 shrink-0 text-xs text-muted-foreground tabular-nums", children: i + 1 }), _jsx("div", { className: "min-w-0 flex-1", children: alleenLezen ? (_jsx("div", { className: "py-1.5 text-sm font-medium", children: r.product_name || "Onbekend artikel" })) : (_jsx(SearchableSelect, { value: r.product_id, options: productOpties(false), showImages: true, placeholder: "Kies artikel", allowClear: false, className: "min-h-9 w-full [@media(pointer:coarse)]:min-h-11" + (regelRood(r.key, "artikel") || regelRood(r.key, "fust") ? " border-destructive ring-1 ring-destructive" : ""), onChange: (v) => kiesProduct(r.key, v) })) }), !alleenLezen && (_jsx(Button, { variant: "ghost", size: "sm", className: "h-9 w-9 shrink-0 p-0 [@media(pointer:coarse)]:h-11 [@media(pointer:coarse)]:w-11", "aria-label": "Regel verwijderen", onClick: () => setRegels((rs) => (rs.length > 1 ? rs.filter((x) => x.key !== r.key) : [legeRegel()])), children: _jsx(Trash2, { className: "h-4 w-4" }) }))] }), _jsxs("div", { className: "grid grid-cols-2 gap-3 pl-8 sm:grid-cols-3 lg:grid-cols-6", children: [_jsx(NumField, { label: "Fusten", req: true, fout: regelRood(r.key, "fusten"), value: r.fusten, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { fusten: v }) }), _jsx(NumField, { label: "Stuks/fust", req: true, fout: regelRood(r.key, "stuks"), value: r.stuks_per_fust, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { stuks_per_fust: v }) }), _jsx(NumField, { label: "Fust/laag", value: r.fust_per_laag, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { fust_per_laag: v }) }), _jsx(NumField, { label: "Lagen/kar", value: r.lagen_per_kar, disabled: alleenLezen, inputMode: "numeric", onChange: (v) => setRegel(r.key, { lagen_per_kar: v }) }), _jsxs("div", { children: [_jsx(NumField, { label: "Minimumprijs", req: true, fout: regelRood(r.key, "prijs"), value: r.min_prijs, disabled: alleenLezen, inputMode: "decimal", muted: !r.prijs_bevestigd, onChange: (v) => setRegel(r.key, { min_prijs: v, prijs_bevestigd: true, prijs_at: null }) }), !r.prijs_bevestigd && r.min_prijs != null && !alleenLezen && (_jsx("button", { type: "button", className: "mt-1 text-xs font-medium text-primary hover:underline", onClick: () => setRegel(r.key, { prijs_bevestigd: true }), children: "Voorstel bevestigen" }))] }), _jsx(NumField, { label: "Klokvoorverkoop", value: r.voorverkoop_prijs, disabled: alleenLezen, inputMode: "decimal", onChange: (v) => setRegel(r.key, { voorverkoop_prijs: v }) })] }), _jsxs("div", { className: "pl-8", children: [_jsxs("button", { type: "button", className: "text-xs font-medium text-muted-foreground hover:text-foreground", onClick: () => setMeerOpen((m) => ({ ...m, [r.key]: !m[r.key] })), children: [meerOpen[r.key] ? "Minder" : "Meer", ": opmerking, kwaliteit en keurcodes"] }), (meerOpen[r.key] || regelRood(r.key, "kwaliteit")) && (_jsxs("div", { className: "mt-3 grid gap-3 sm:grid-cols-2", children: [_jsxs("label", { className: "block sm:col-span-2", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground", children: "Opmerking voor de veiling" }), _jsx(Input, { value: r.veil_opmerking ?? "", disabled: alleenLezen, onChange: (e) => setRegel(r.key, { veil_opmerking: e.target.value || null }) })] }), _jsxs("label", { className: "block", children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground", children: "Kwaliteit (S98)" }), _jsxs("select", { className: "h-9 w-full rounded-lg border border-input bg-background px-2 text-sm disabled:cursor-not-allowed disabled:opacity-70 [@media(pointer:coarse)]:h-11" + (regelRood(r.key, "kwaliteit") ? " border-destructive ring-1 ring-destructive" : ""), "aria-invalid": regelRood(r.key, "kwaliteit") || undefined, value: r.kwaliteit ?? "", disabled: alleenLezen, onChange: (e) => setRegel(r.key, { kwaliteit: e.target.value || null }), children: [_jsx("option", { value: "", children: km?.kwaliteit ? `Artikel: ${km.kwaliteit}` : kwaliteitCodes.length ? "Kenmerk van het artikel" : (leegTekst ?? "Kenmerk van het artikel") }), kwaliteitCodes.filter((c) => c?.vbnCode === "S98").map((c) => (_jsxs("option", { value: c.vbnValueCode, children: [c.vbnValueCode, c.description ? ` · ${c.description}` : ""] }, c.vbnValueCode)))] })] }), _jsxs("div", { children: [_jsx("span", { className: "mb-1 block text-xs text-muted-foreground", children: "Keurcodes (K01/K02, P01/P02)" }), _jsx(KeurcodeVeld, { codes: kwaliteitCodes.filter((c) => /^(K01|K02|P01|P02)$/.test(String(c?.vbnCode))), waarde: r.keurcodes, voorinvulling: km?.keurcodes ?? [], leegTekst: leegTekst, disabled: alleenLezen, fout: regelRood(r.key, "kwaliteit"), onChange: (v) => setRegel(r.key, { keurcodes: v }) })] })] }))] })] }, r.key));
|
|
402
404
|
}) }), !alleenLezen && (_jsxs("div", { className: "flex flex-wrap gap-2 border-t border-border px-4 py-3 sm:px-5", children: [_jsxs(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", onClick: () => setRegels((rs) => [...rs, legeRegel()]), children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), " Artikel toevoegen"] }), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", children: [_jsx(Package, { className: "mr-2 h-4 w-4" }), " Uit voorraad"] }) }), _jsxs(DropdownMenuContent, { className: "max-h-80 overflow-y-auto", children: [productOpties(true).length === 0 && _jsx(DropdownMenuItem, { disabled: true, children: "Geen artikelen op voorraad" }), productOpties(true).slice(0, 100).map((o) => (_jsxs(DropdownMenuItem, { onClick: () => { const n = legeRegel(); setRegels((rs) => [...rs.filter((x) => x.product_id || x.product_name), n]); void kiesProduct(n.key, o.value); }, children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: o.label }), _jsx("span", { className: "ml-3 text-xs text-muted-foreground", children: o.hint })] }, o.value)))] })] })] }))] }), resultaten.length > 0 && (_jsxs("section", { className: "rounded-xl border border-border bg-card p-4 shadow-sm sm:p-5", children: [_jsx("h2", { className: "mb-3 text-sm font-semibold", children: "Verkocht" }), _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { children: _jsxs("tr", { className: "text-left text-[11px] font-semibold uppercase tracking-wider text-muted-foreground", children: [_jsx("th", { className: "py-1", children: "Koper" }), _jsx("th", { className: "py-1", children: "Stuks" }), _jsx("th", { className: "py-1", children: "Prijs" }), _jsx("th", { className: "py-1", children: "Bedrag" })] }) }), _jsx("tbody", { className: "divide-y divide-border", children: resultaten.filter((x) => !x.doorgedraaid).map((x) => (_jsxs("tr", { children: [_jsx("td", { className: "py-2", children: x.koper_naam }), _jsx("td", { className: "py-2 tabular-nums", children: Number(x.stuks || 0).toLocaleString("nl-NL") }), _jsx("td", { className: "py-2 tabular-nums", children: x.prijs != null ? eur(Number(x.prijs)) : "—" }), _jsx("td", { className: "py-2 tabular-nums", children: x.bedrag != null ? eur(Number(x.bedrag)) : "—" })] }, x.id))) })] }), _jsxs("div", { className: "mt-3 flex flex-wrap gap-x-6 gap-y-1 border-t border-border pt-3 text-sm", children: [_jsxs("span", { children: ["Totaal: ", _jsxs("strong", { className: "tabular-nums", children: [verkochtStuks.toLocaleString("nl-NL"), " stuks \u00B7 ", eur(verkochtBedrag)] })] }), _jsxs("span", { className: "text-muted-foreground", children: ["Doorgedraaid: ", _jsxs("span", { className: "tabular-nums", children: [doorStuks.toLocaleString("nl-NL"), " stuks"] })] })] })] })), !alleenLezen && (_jsx("div", { className: "sticky bottom-0 z-20 -mx-4 border-t border-border bg-background/95 px-4 pt-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] backdrop-blur sm:-mx-6 sm:px-6", children: _jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { className: "text-sm tabular-nums", children: [_jsx("span", { className: "font-medium", children: tellersTekst(tellers) }), totaal > 0 && _jsxs("span", { className: "ml-2 text-muted-foreground", children: ["\u00B7 min. ", eur(totaal)] }), ontbreekt.length > 0 && _jsxs("span", { className: "ml-2 text-xs text-muted-foreground", title: ontbreekt.join(", "), children: ["\u00B7 ", ontbreekt.length, " ontbreekt nog"] })] }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsxs(Button, { variant: "ghost", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", onClick: () => setVoorbeeld(true), children: [_jsx(Eye, { className: "mr-2 h-4 w-4" }), " Voorbeeld"] }), bewerken ? (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", onClick: () => { setBewerken(false); geladen.current = null; qc.invalidateQueries({ queryKey: ["klok-order", klokId] }); }, children: "Annuleren" }), _jsxs(Button, { size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig || !!blokkade || ontbreekt.length > 0, title: blokkade ?? (ontbreekt.length ? `Nog nodig: ${ontbreekt.join(", ")}` : undefined), onClick: () => setBevestigWijzig(true), children: [_jsx(Send, { className: "mr-2 h-4 w-4" }), " Opnieuw versturen"] })] })) : (_jsxs(_Fragment, { children: [_jsxs(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig, onClick: onOpslaan, children: [_jsx(Save, { className: "mr-2 h-4 w-4" }), " Opslaan als concept"] }), _jsx(Button, { variant: "outline", size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig || !!blokkade || ontbreekt.length > 0, title: blokkade ?? (ontbreekt.length ? `Nog nodig: ${ontbreekt.join(", ")}` : undefined), onClick: () => onVersturen(true), children: "Versturen en nieuwe" }), _jsxs(Button, { size: "sm", className: "h-9 [@media(pointer:coarse)]:h-11", disabled: !!bezig || !!blokkade || ontbreekt.length > 0, title: blokkade ?? (ontbreekt.length ? `Nog nodig: ${ontbreekt.join(", ")}` : undefined), onClick: () => onVersturen(false), children: [_jsx(Send, { className: "mr-2 h-4 w-4" }), " ", bezig === "send" ? "Bezig…" : "Versturen naar veiling"] })] }))] })] }) })), voorbeeld && (_jsxs(Dialoog, { titel: "Voorbeeld veilbrief", onClose: () => setVoorbeeld(false), children: [_jsxs("dl", { className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm", children: [_jsx("dt", { className: "text-muted-foreground", children: "Veillocatie" }), _jsx("dd", { children: kop.veillocatie_naam ?? "—" }), _jsx("dt", { className: "text-muted-foreground", children: "Veildatum" }), _jsx("dd", { children: kop.veildatum ? fmtNL(kop.veildatum, { weekday: "short", day: "numeric", month: "short" }) : "—" }), _jsx("dt", { className: "text-muted-foreground", children: "Veilgroep" }), _jsx("dd", { children: kop.veilgroep ?? "—" }), _jsx("dt", { className: "text-muted-foreground", children: "Verzendlocatie" }), _jsx("dd", { children: kop.verzendlocatie_naam ?? "—" }), _jsx("dt", { className: "text-muted-foreground", children: "Vervoer" }), _jsx("dd", { children: VERVOER.find((v) => v.id === kop.vervoer)?.label })] }), _jsx("ul", { className: "mt-3 divide-y divide-border text-sm", children: regels.filter((r) => r.product_name).map((r) => (_jsxs("li", { className: "flex justify-between gap-3 py-1.5", children: [_jsx("span", { className: "min-w-0 truncate", children: r.product_name }), _jsxs("span", { className: "shrink-0 tabular-nums text-muted-foreground", children: [r.fusten ?? 0, " \u00D7 ", r.stuks_per_fust ?? 0, " \u00B7 min. ", r.min_prijs != null ? eur(r.min_prijs) : "—"] })] }, r.key))) }), _jsx("p", { className: "mt-3 text-sm font-medium tabular-nums", children: tellersTekst(tellers) }), ontbreekt.length > 0 && _jsxs("p", { className: "mt-2 text-sm text-muted-foreground", children: ["Ontbreekt nog: ", ontbreekt.join(", ")] })] })), bevestigWijzig && (_jsxs(Dialoog, { titel: "Wijzigen en opnieuw versturen?", onClose: () => setBevestigWijzig(false), children: [_jsx("p", { className: "text-sm text-muted-foreground", children: "De huidige veilbrief wordt bij de veiling verwijderd en opnieuw verstuurd. Doorgaan?" }), _jsxs("div", { className: "mt-5 flex justify-end gap-2", children: [_jsx(Button, { variant: "ghost", onClick: () => setBevestigWijzig(false), children: "Annuleren" }), _jsx(Button, { onClick: onWijzigEnVerstuur, disabled: !!bezig, children: "Doorgaan" })] })] })), bevestigVerwijder && (_jsxs(Dialoog, { titel: `Veilbrief ${row?.klok_nummer ?? ""} verwijderen?`, onClose: () => !bezig && setBevestigVerwijder(false), children: [_jsx("p", { className: "text-sm text-muted-foreground", children: VERWIJDER_BEVESTIG_TEXT }), _jsxs("div", { className: "mt-5 flex justify-end gap-2", children: [_jsx(Button, { variant: "ghost", onClick: () => setBevestigVerwijder(false), disabled: !!bezig, children: "Annuleren" }), _jsx(Button, { className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", onClick: onVerwijderen, disabled: !!bezig, "aria-busy": bezig === "delete" || undefined, children: bezig === "delete" ? _jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": true }), " Bezig met verwijderen\u2026"] }) : "Verwijderen" })] })] })), sjabloonNaam != null && (_jsxs(Dialoog, { titel: "Opslaan als sjabloon", onClose: () => setSjabloonNaam(null), children: [_jsxs("label", { className: "block text-sm", children: [_jsxs("span", { className: "mb-1 block", children: ["Naam ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { autoFocus: true, value: sjabloonNaam, maxLength: 80, onChange: (e) => setSjabloonNaam(e.target.value) })] }), _jsxs("p", { className: "mt-2 text-xs text-muted-foreground", children: ["Voor ", kop.veillocatie_naam, ". Prijzen ouder dan 14 dagen worden later als voorstel getoond."] }), _jsxs("div", { className: "mt-5 flex justify-end gap-2", children: [_jsx(Button, { variant: "ghost", onClick: () => setSjabloonNaam(null), children: "Annuleren" }), _jsx(Button, { onClick: bewaarSjabloon, disabled: !sjabloonNaam.trim(), children: "Opslaan" })] })] }))] }));
|
|
403
405
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KlokOrdersList.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/klok/KlokOrdersList.tsx"],"names":[],"mappings":"AAgBA,OAAO,
|
|
1
|
+
{"version":3,"file":"KlokOrdersList.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/klok/KlokOrdersList.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAqC,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAMlG,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,UAAO;;;;;;;UASpE;AAED,eAAO,MAAM,uBAAuB,sFAAsF,CAAC;AAK3H,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GACpC,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,sEAAsE;IACtE,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,+BAiOA"}
|
|
@@ -7,7 +7,7 @@ import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMe
|
|
|
7
7
|
import { FileText, Gavel, Loader2, MoreHorizontal, Printer, Repeat, RotateCcw, Trash2 } from "lucide-react";
|
|
8
8
|
import { deleteKlokOrder, getKlokAfleverbrief, listKlokOrders, repeatKlokOrder, retryKlokAnnuleren } from "../../../lib/klok.functions.js";
|
|
9
9
|
import { KLOK_AFLEVERBRIEF_UIT_TEXT, klokAnnulerenOpenstaand, klokKanVerwijderen, klokTellers, volgendeVeildag } from "../../../lib/klok-labels.js";
|
|
10
|
-
import { KLOK_PAGE_SIZE } from "../../../lib/klok-list.js";
|
|
10
|
+
import { KLOK_PAGE_SIZE, klokOrderDetailId } from "../../../lib/klok-list.js";
|
|
11
11
|
import { fmtNL } from "../../../lib/nl-datetime.js";
|
|
12
12
|
import { amsterdamYmd, ymdString } from "../../../lib/period-range.js";
|
|
13
13
|
import { EmptyState } from "../v3/EmptyState.js";
|
|
@@ -140,7 +140,7 @@ export function KlokOrdersList({ from, to, params, focusedId, onPage, }) {
|
|
|
140
140
|
const regels = (o.regels ?? []);
|
|
141
141
|
const t = klokTellers(regels);
|
|
142
142
|
const prijzen = regels.map((r) => Number(r.min_prijs)).filter((n) => n > 0);
|
|
143
|
-
return (_jsxs("tr", { "data-klok-id": o.id, "aria-selected": focusedId === o.id || undefined, className: "h-[60px] cursor-pointer border-b border-border last:border-0 hover:bg-muted/50 " + (focusedId === o.id ? "bg-muted/60 outline outline-2 -outline-offset-2 outline-ring" : ""), onClick: () => open(o.id), children: [_jsx("td", { className: "px-4 font-medium tabular-nums", children: o.klok_nummer }), _jsx("td", { className: "px-3", children: o.veillocatie_naam ?? "—" }), _jsx("td", { className: "px-3 tabular-nums", children: o.veilgroep ?? "—" }), _jsxs("td", { className: "px-3 tabular-nums", children: [t.fusten, " \u00B7 ", t.stuks] }), _jsx("td", { className: "px-3 tabular-nums", children: prijzen.length ? `€ ${Math.min(...prijzen).toFixed(2).replace(".", ",")}${prijzen.length > 1 && Math.max(...prijzen) !== Math.min(...prijzen) ? ` – ${Math.max(...prijzen).toFixed(2).replace(".", ",")}` : ""}` : "—" }), _jsx("td", { className: "px-3", children: _jsx(KlokStatusBadge, { status: o.status, detail: o.status_detail ?? o.laatste_fout }) }), _jsx("td", { className: "px-3", onClick: (e) => e.stopPropagation(), children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", "aria-label": "Acties", disabled: bezig === o.id, children: _jsx(MoreHorizontal, { className: "h-4 w-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsxs(DropdownMenuItem, { onClick: () => herhaal(o), children: [_jsx(Repeat, { className: "mr-2 h-4 w-4" }), " Herhalen"] }), (o.afleverbrieven ?? []).length ? (_jsxs(DropdownMenuItem, { onClick: () => afleverbrief(o), children: [_jsx(FileText, { className: "mr-2 h-4 w-4" }), " Afleverbrief"] })) : (_jsx("div", { title: KLOK_AFLEVERBRIEF_UIT_TEXT, "aria-label": `Afleverbrief: ${KLOK_AFLEVERBRIEF_UIT_TEXT}`, children: _jsxs(DropdownMenuItem, { disabled: true, children: [_jsx(FileText, { className: "mr-2 h-4 w-4" }), " Afleverbrief"] }) })), _jsxs(DropdownMenuItem, { disabled: !o.order_id, onClick: () => o.order_id && navigate({ to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: o.order_id } }), children: [_jsx(Printer, { className: "mr-2 h-4 w-4" }), " Stickers printen"] }), klokAnnulerenOpenstaand(o) && (_jsxs(DropdownMenuItem, { onClick: () => opnieuwAnnuleren(o), children: [_jsx(RotateCcw, { className: "mr-2 h-4 w-4" }), " Order annuleren opnieuw proberen"] })), klokKanVerwijderen(o.status) && (_jsxs(DropdownMenuItem, { className: "text-destructive", onClick: () => setTeVerwijderen(o), children: [_jsx(Trash2, { className: "mr-2 h-4 w-4" }), " Verwijderen"] }))] })] }) })] }, o.id));
|
|
143
|
+
return (_jsxs("tr", { "data-klok-id": o.id, "aria-selected": focusedId === o.id || undefined, className: "h-[60px] cursor-pointer border-b border-border last:border-0 hover:bg-muted/50 " + (focusedId === o.id ? "bg-muted/60 outline outline-2 -outline-offset-2 outline-ring" : ""), onClick: () => open(o.id), children: [_jsx("td", { className: "px-4 font-medium tabular-nums", children: o.klok_nummer }), _jsx("td", { className: "px-3", children: o.veillocatie_naam ?? "—" }), _jsx("td", { className: "px-3 tabular-nums", children: o.veilgroep ?? "—" }), _jsxs("td", { className: "px-3 tabular-nums", children: [t.fusten, " \u00B7 ", t.stuks] }), _jsx("td", { className: "px-3 tabular-nums", children: prijzen.length ? `€ ${Math.min(...prijzen).toFixed(2).replace(".", ",")}${prijzen.length > 1 && Math.max(...prijzen) !== Math.min(...prijzen) ? ` – ${Math.max(...prijzen).toFixed(2).replace(".", ",")}` : ""}` : "—" }), _jsx("td", { className: "px-3", children: _jsx(KlokStatusBadge, { status: o.status, detail: o.status_detail ?? o.laatste_fout }) }), _jsx("td", { className: "px-3", onClick: (e) => e.stopPropagation(), children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", "aria-label": "Acties", disabled: bezig === o.id, children: _jsx(MoreHorizontal, { className: "h-4 w-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", children: [_jsxs(DropdownMenuItem, { onClick: () => herhaal(o), children: [_jsx(Repeat, { className: "mr-2 h-4 w-4" }), " Herhalen"] }), (o.afleverbrieven ?? []).length ? (_jsxs(DropdownMenuItem, { onClick: () => afleverbrief(o), children: [_jsx(FileText, { className: "mr-2 h-4 w-4" }), " Afleverbrief"] })) : (_jsx("div", { title: KLOK_AFLEVERBRIEF_UIT_TEXT, "aria-label": `Afleverbrief: ${KLOK_AFLEVERBRIEF_UIT_TEXT}`, children: _jsxs(DropdownMenuItem, { disabled: true, children: [_jsx(FileText, { className: "mr-2 h-4 w-4" }), " Afleverbrief"] }) })), _jsxs(DropdownMenuItem, { disabled: !o.order_id, onClick: () => o.order_id && navigate({ to: "/floriday-verkoop/verkooporders/$salesOrderId", params: { salesOrderId: klokOrderDetailId(o.order_id) } }), children: [_jsx(Printer, { className: "mr-2 h-4 w-4" }), " Stickers printen"] }), klokAnnulerenOpenstaand(o) && (_jsxs(DropdownMenuItem, { onClick: () => opnieuwAnnuleren(o), children: [_jsx(RotateCcw, { className: "mr-2 h-4 w-4" }), " Order annuleren opnieuw proberen"] })), klokKanVerwijderen(o.status) && (_jsxs(DropdownMenuItem, { className: "text-destructive", onClick: () => setTeVerwijderen(o), children: [_jsx(Trash2, { className: "mr-2 h-4 w-4" }), " Verwijderen"] }))] })] }) })] }, o.id));
|
|
144
144
|
}) }, dag || "geen"))) })] }), params && pages > 1 && (_jsxs("div", { className: "flex items-center justify-between gap-2 border-t border-border px-4 py-3 text-sm", children: [_jsxs("span", { className: "text-muted-foreground tabular-nums", children: [(page - 1) * KLOK_PAGE_SIZE + 1, "\u2013", Math.min(total, page * KLOK_PAGE_SIZE), " van ", total] }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { variant: "outline", size: "sm", disabled: page <= 1, onClick: () => onPage?.(page - 1), children: "Vorige" }), _jsx(Button, { variant: "outline", size: "sm", disabled: page >= pages, onClick: () => onPage?.(page + 1), children: "Volgende" })] })] })), teVerwijderen && (_jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-foreground/40 p-4", onClick: () => !bezig && setTeVerwijderen(null), children: _jsxs("div", { className: "w-full max-w-md rounded-lg border border-border bg-card p-6 shadow-lg", onClick: (e) => e.stopPropagation(), children: [_jsxs("h2", { className: "text-lg font-semibold", children: ["Veilbrief ", teVerwijderen.klok_nummer, " verwijderen?"] }), _jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: VERWIJDER_BEVESTIG_TEXT }), _jsxs("div", { className: "mt-5 flex justify-end gap-2", children: [_jsx(Button, { variant: "ghost", onClick: () => setTeVerwijderen(null), disabled: !!bezig, children: "Annuleren" }), _jsx(Button, { className: "bg-destructive text-destructive-foreground hover:bg-destructive/90", onClick: () => verwijder(teVerwijderen), disabled: !!bezig, "aria-busy": !!bezig || undefined, children: bezig ? _jsxs(_Fragment, { children: [_jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin", "aria-hidden": true }), " Bezig met verwijderen\u2026"] }) : "Verwijderen" })] })] }) }))] }));
|
|
145
145
|
}
|
|
146
146
|
function FragmentGroep({ label, count, children }) {
|
|
@@ -12,6 +12,6 @@ export function RowMenu({ row, rowId, isBuffer, fulfillingId, onEdit, onDetails,
|
|
|
12
12
|
: row.stage === "shipped"
|
|
13
13
|
? "Al afgehandeld"
|
|
14
14
|
: "Afhandelen (verzonden)" }), !isBuffer && row.isLocal ? (_jsx(DropdownMenuItem, { className: "text-destructive focus:text-destructive", onClick: () => onDelete?.(row), children: row.stage === "cancelled" ? "Definitief verwijderen" : "Annuleren" })) : (_jsxs(DropdownMenuItem, { disabled: true, title: isBuffer
|
|
15
|
-
? "Een gecombineerde order kun je niet in één keer annuleren."
|
|
15
|
+
? "Een gecombineerde order kun je niet in één keer annuleren. Open de order en annuleer per order."
|
|
16
16
|
: "Floriday-orders annuleer of wijzig je in Floriday.", children: ["Annuleren", isBuffer ? "" : " (FO)"] }))] })] }));
|
|
17
17
|
}
|
|
@@ -101,6 +101,12 @@ export interface GroepLid {
|
|
|
101
101
|
export declare function groepLeden(groep: {
|
|
102
102
|
member_ids?: string[] | null;
|
|
103
103
|
} | null | undefined, products: any[]): GroepLid[];
|
|
104
|
+
/** Artikel met soort GROEP (hoofdartikel van een productgroep) geldt als productgroep. */
|
|
105
|
+
export declare function isGroepArtikel(row: {
|
|
106
|
+
batch?: string | null;
|
|
107
|
+
} | null | undefined): boolean;
|
|
108
|
+
/** Melding als een gekozen groep geen artikelen heeft. */
|
|
109
|
+
export declare function groepZonderLedenTekst(groep: string | null | undefined): string;
|
|
104
110
|
/** Server: een regel met een productgroep wordt geweigerd. */
|
|
105
111
|
export declare function groepRegelFout(lines: {
|
|
106
112
|
product_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file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;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,aAAa,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,GAAG,MAAM,GAAG,IAAI,CAU5I;AAID,MAAM,WAAW,QAAQ;IAAG,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE;AAElI,mGAAmG;AACnG,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,QAAQ,EAAE,CASlH;AAED,0FAA0F;AAC1F,wBAAgB,cAAc,CAAC,GAAG,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAEzF;AAED,0DAA0D;AAC1D,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAE9E;AAED,8DAA8D;AAC9D,wBAAgB,cAAc,CAAC,KAAK,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAMvH"}
|
|
@@ -161,6 +161,14 @@ export function groepLeden(groep, products) {
|
|
|
161
161
|
}
|
|
162
162
|
return out;
|
|
163
163
|
}
|
|
164
|
+
/** Artikel met soort GROEP (hoofdartikel van een productgroep) geldt als productgroep. */
|
|
165
|
+
export function isGroepArtikel(row) {
|
|
166
|
+
return String(row?.batch ?? "").trim().toUpperCase() === "GROEP";
|
|
167
|
+
}
|
|
168
|
+
/** Melding als een gekozen groep geen artikelen heeft. */
|
|
169
|
+
export function groepZonderLedenTekst(groep) {
|
|
170
|
+
return `${String(groep ?? "").replace(/^\s*\[Groep\]\s*/i, "").trim() || "Deze productgroep"} heeft nog geen artikelen; kies een artikel.`;
|
|
171
|
+
}
|
|
164
172
|
/** Server: een regel met een productgroep wordt geweigerd. */
|
|
165
173
|
export function groepRegelFout(lines, groepNaam) {
|
|
166
174
|
for (const l of lines) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-order.functions.d.ts","sourceRoot":"","sources":["../../src/lib/create-order.functions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-order.functions.d.ts","sourceRoot":"","sources":["../../src/lib/create-order.functions.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,2BAA2B;;;;;;YAwBpB,MAAM;sBACc,MAAM,GAAG,IAAI;yBACG,MAAM,GAAG,IAAI;cACnC,MAAM,GAAG,IAAI;eACX,MAAM,GAAG,IAAI;wBACK,MAAM,GAAG,IAAI;gBACvC,MAAM;;;GAkB9B,CAAC;AAIL,eAAO,MAAM,2BAA2B;;;;0CAElB,OAAO;;;;GAoDzB,CAAC;AAWL,eAAO,MAAM,0BAA0B;;;;;;;;YAuE7B,MAAM;iBACD,MAAM;sBACD,MAAM,GAAG,IAAI;cACrB,MAAM;oBACA,MAAM,GAAG,IAAI;0BACP,MAAM,GAAG,IAAI;0BACb,MAAM,GAAG,IAAI;yBACd,MAAM,GAAG,IAAI;wBACd,MAAM;wBACN,MAAM;yBACL,MAAM;kBACb,OAAO;gBACT,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS;QAClD,mFAAmF;qBACtE,MAAM,EAAE;;GAmUvB,CAAC;AAGL,eAAO,MAAM,kCAAkC;;;;0CAEzB,OAAO;;;;;;;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7B,CAAC;AAML,eAAO,MAAM,2BAA2B;;;;8CAEd,OAAO;;;;gBAIgC,MAAM,EAAE;GAoCrE,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { createServerFn } from "@tanstack/react-start";
|
|
|
7
7
|
import { shippedLockReason } from "./order-price-lock.js";
|
|
8
8
|
import { productNameForStorage } from "./product-name.js";
|
|
9
9
|
import { twinfieldOnlyRows } from "./create-order-customers.js";
|
|
10
|
+
import { isGroepArtikel } from "./create-order-form.js";
|
|
10
11
|
import { z } from "zod";
|
|
11
12
|
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
|
|
12
13
|
// ─── Klanten ────────────────────────────────────────────────────────────────
|
|
@@ -147,9 +148,20 @@ export const listProductsForCreateOrder = createServerFn({ method: "GET" })
|
|
|
147
148
|
.range(0, 9999),
|
|
148
149
|
context.supabase
|
|
149
150
|
.from("products")
|
|
150
|
-
.select("id, product, unit, sale_price, plants_per_crate, crates_per_layer, layers_per_cart, quantity, custom_fields, trade_item_key, floriday_trade_item_id, image_url, plant_height_cm")
|
|
151
|
+
.select("id, product, unit, sale_price, plants_per_crate, crates_per_layer, layers_per_cart, quantity, custom_fields, trade_item_key, floriday_trade_item_id, image_url, plant_height_cm, batch")
|
|
151
152
|
.range(0, 4999),
|
|
152
153
|
]);
|
|
154
|
+
// Alle groepen (ook inactief) per hoofdartikel: een artikel met soort GROEP wijst naar zijn groep.
|
|
155
|
+
const { data: alleGroepen, error: alleGroepenErr } = await context.supabase
|
|
156
|
+
.from("product_groups")
|
|
157
|
+
.select("id, head_product_id")
|
|
158
|
+
.range(0, 4999);
|
|
159
|
+
if (alleGroepenErr)
|
|
160
|
+
console.error("[listProducts] productgroepen", alleGroepenErr);
|
|
161
|
+
const groepVanHoofd = new Map();
|
|
162
|
+
for (const g of (alleGroepen ?? []))
|
|
163
|
+
if (g.head_product_id)
|
|
164
|
+
groepVanHoofd.set(String(g.head_product_id), String(g.id));
|
|
153
165
|
// Supabase geeft standaard max. 1000 rijen terug. Voor productgroepen kan de
|
|
154
166
|
// relevante voorraad op een member-key verderop in trade_item_stock staan,
|
|
155
167
|
// dus voorraad pagineren we expliciet volledig uit.
|
|
@@ -476,7 +488,12 @@ export const listProductsForCreateOrder = createServerFn({ method: "GET" })
|
|
|
476
488
|
reserved_stock: reserved,
|
|
477
489
|
available_stock: available,
|
|
478
490
|
in_stock: available > 0,
|
|
479
|
-
|
|
491
|
+
...(isGroepArtikel(r)
|
|
492
|
+
? {
|
|
493
|
+
source: "group",
|
|
494
|
+
member_ids: (groupItemsByGroup.get(groepVanHoofd.get(id) ?? "") ?? []).map((m) => m.trade_item_id).filter((m) => m !== id),
|
|
495
|
+
}
|
|
496
|
+
: { source: "product" }),
|
|
480
497
|
});
|
|
481
498
|
registerIdentity(id, name, articleCode);
|
|
482
499
|
}
|
|
@@ -950,7 +967,9 @@ export const createManualOrder = createServerFn({ method: "POST" })
|
|
|
950
967
|
// Een productgroep heeft geen eigen voorraad en kan geen orderregel zijn: eerst een artikel uit de groep kiezen.
|
|
951
968
|
{
|
|
952
969
|
const { groepRegelFout } = await import("./create-order-form.js");
|
|
953
|
-
const
|
|
970
|
+
const { groepNamenVoorIds } = await import("./product-group-lines.server.js");
|
|
971
|
+
const groepNamen = await groepNamenVoorIds(supabaseAdmin, productIds);
|
|
972
|
+
const fout = groepRegelFout(data.lines, (id) => groepNamen.get(id) ?? null);
|
|
954
973
|
if (fout)
|
|
955
974
|
throw stockError(fout);
|
|
956
975
|
}
|
|
@@ -1609,7 +1628,9 @@ export const updateLocalOrder = createServerFn({ method: "POST" })
|
|
|
1609
1628
|
const groupById = new Map((groups ?? []).map((g) => [g.id, g.name]));
|
|
1610
1629
|
{
|
|
1611
1630
|
const { groepRegelFout } = await import("./create-order-form.js");
|
|
1612
|
-
const
|
|
1631
|
+
const { groepNamenVoorIds } = await import("./product-group-lines.server.js");
|
|
1632
|
+
const groepNamen = await groepNamenVoorIds(supabaseAdmin, newItems.map((n) => n.productId));
|
|
1633
|
+
const fout = groepRegelFout(newItems.map((n) => ({ product_id: n.productId })), (id) => groepNamen.get(id) ?? null);
|
|
1613
1634
|
if (fout)
|
|
1614
1635
|
throw stockError(fout);
|
|
1615
1636
|
}
|
|
@@ -81,6 +81,19 @@ export declare function klokKwaliteitFout(r: {
|
|
|
81
81
|
vbnCode: string;
|
|
82
82
|
}[] | null;
|
|
83
83
|
}): string | null;
|
|
84
|
+
/** Live controle per regel: eigen keuze, anders het kenmerk van het artikel. */
|
|
85
|
+
export declare function klokRegelKwaliteitFout(r: {
|
|
86
|
+
product_name?: string | null;
|
|
87
|
+
kwaliteit?: string | null;
|
|
88
|
+
keurcodes?: {
|
|
89
|
+
vbnCode: string;
|
|
90
|
+
}[] | null;
|
|
91
|
+
}, km?: {
|
|
92
|
+
kwaliteit?: string | null;
|
|
93
|
+
keurcodes?: {
|
|
94
|
+
vbnCode: string;
|
|
95
|
+
}[] | null;
|
|
96
|
+
} | null): string | null;
|
|
84
97
|
export declare function klokKwaliteitZin(artikel: string | null | undefined, kwaliteit: string | null | undefined): string;
|
|
85
98
|
/** Keurcode in de keuzelijst: "108 · enkele afwijkende bloem/bloeiwijze". */
|
|
86
99
|
export declare function keurcodeLabel(c: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"klok-labels.d.ts","sourceRoot":"","sources":["../../src/lib/klok-labels.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,WAAW,GACX,UAAU,GACV,YAAY,GACZ,SAAS,GACT,cAAc,GACd,cAAc,GACd,QAAQ,GACR,YAAY,GACZ,MAAM,CAAC;AAEX,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAWxD,CAAC;AAEF,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAEpE;AAiBD,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI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AC,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,KAAK,MAAM,CAAA;CAAE,EAa/G,CAAC;AAIF,+GAA+G;AAC/G,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,GAAE,eAAoB,GAAG,MAAM,CAO9E;AAID,6FAA6F;AAC7F,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,UAAQ,GAAG,OAAO,CAI5F;AAED,iHAAiH;AACjH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAE7H;AACD,eAAO,MAAM,yBAAyB,8GAA8G,CAAC"}
|
|
@@ -182,6 +182,14 @@ export function klokKwaliteitFout(r) {
|
|
|
182
182
|
return null;
|
|
183
183
|
return klokKwaliteitZin(r.product_name, r.kwaliteit);
|
|
184
184
|
}
|
|
185
|
+
/** Live controle per regel: eigen keuze, anders het kenmerk van het artikel. */
|
|
186
|
+
export function klokRegelKwaliteitFout(r, km) {
|
|
187
|
+
return klokKwaliteitFout({
|
|
188
|
+
product_name: r.product_name,
|
|
189
|
+
kwaliteit: r.kwaliteit ?? km?.kwaliteit ?? null,
|
|
190
|
+
keurcodes: r.keurcodes?.length ? r.keurcodes : km?.keurcodes ?? [],
|
|
191
|
+
});
|
|
192
|
+
}
|
|
185
193
|
export function klokKwaliteitZin(artikel, kwaliteit) {
|
|
186
194
|
return `Bij ${artikel?.trim() || "dit artikel"} is de kwaliteit ${kwaliteit?.trim() || "niet ingevuld"}; een afwijking (K01/K02) kan alleen bij A2 of B1.`;
|
|
187
195
|
}
|
|
@@ -32,4 +32,6 @@ export declare function klokKpiKlik(huidig: {
|
|
|
32
32
|
/** Pijltjes / J-K door de lijst; Enter opent. Geeft de nieuwe focus terug. */
|
|
33
33
|
export declare function klokVolgendeFocus(ids: string[], huidig: string | null, toets: string): string | null;
|
|
34
34
|
export declare const KLOK_SNELTOETSEN: [string[], string][];
|
|
35
|
+
/** Detail-id van de ERP-order achter een veilbrief: zelfde opbouw als de orderlijst ("local:<id>"). */
|
|
36
|
+
export declare function klokOrderDetailId(orderId: string): string;
|
|
35
37
|
//# sourceMappingURL=klok-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"klok-list.d.ts","sourceRoot":"","sources":["../../src/lib/klok-list.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,qBAAqB,gDAAgD,CAAC;AAEnF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,uGAAuG;AACvG,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAAE,CAQ1E;AAED,kEAAkE;AAClE,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAE9D;AAED,MAAM,WAAW,QAAQ;IAAG,OAAO,EAAE,MAAM,gBAAgB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAE5E,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,CAAC,EAAE,gBAAgB,EAAE,KAAK,GAAE;IAAE,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;CAAO,GAAG,QAAQ,EAAE,CAOrK;AAED,mEA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AA;CAAE;AAE5E,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,CAAC,EAAE,gBAAgB,EAAE,KAAK,GAAE;IAAE,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;CAAO,GAAG,QAAQ,EAAE,CAOrK;AAED,mEAAmE;AACnE,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAAC;AAClE,wBAAgB,WAAW,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,aAAa,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG;IAAE,GAAG,EAAE,aAAa,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAKzJ;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMpG;AAED,eAAO,MAAM,gBAAgB,EAAE,CAAC,MAAM,EAAE,EAAE,MAAM,CAAC,EAOhD,CAAC;AAEF,uGAAuG;AACvG,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD"}
|
|
@@ -58,3 +58,7 @@ export const KLOK_SNELTOETSEN = [
|
|
|
58
58
|
[["Esc"], "Zoeken wissen / sluiten"],
|
|
59
59
|
[["?"], "Dit overzicht"],
|
|
60
60
|
];
|
|
61
|
+
/** Detail-id van de ERP-order achter een veilbrief: zelfde opbouw als de orderlijst ("local:<id>"). */
|
|
62
|
+
export function klokOrderDetailId(orderId) {
|
|
63
|
+
return orderId.startsWith("local:") ? orderId : `local:${orderId}`;
|
|
64
|
+
}
|
|
@@ -5,4 +5,29 @@ export declare function markeerGeannuleerd<T extends {
|
|
|
5
5
|
} | null | undefined>(data: T, orderIds: string[]): T;
|
|
6
6
|
/** Geannuleerde orders tellen niet mee in de KPI's Omzet en Orders (zoals elders). */
|
|
7
7
|
export declare function zonderGeannuleerd<G>(groups: G[], stageOf: (g: G) => string): G[];
|
|
8
|
+
/** Groepsleden zonder geannuleerde orders; de getoonde order zelf blijft altijd staan. */
|
|
9
|
+
export declare function groepZonderGeannuleerd<T extends {
|
|
10
|
+
id: string;
|
|
11
|
+
stage?: string | null;
|
|
12
|
+
status?: {
|
|
13
|
+
isCancelled?: boolean;
|
|
14
|
+
} | null;
|
|
15
|
+
}>(leden: T[], eigenId?: string | null): T[];
|
|
16
|
+
/** Groepssleutel voor de lijst: een geannuleerde order is nooit lid van een groep. */
|
|
17
|
+
export declare function groepSleutel(o: {
|
|
18
|
+
id: string;
|
|
19
|
+
bufferId?: string | null;
|
|
20
|
+
stage?: string | null;
|
|
21
|
+
status?: {
|
|
22
|
+
isCancelled?: boolean;
|
|
23
|
+
} | null;
|
|
24
|
+
}, grootte: number): string;
|
|
25
|
+
/** Eén order uit een groep annuleren: alleen een eigen (lokale) order die nog niet verzonden of geannuleerd is. */
|
|
26
|
+
export declare function kanLidAnnuleren(o: {
|
|
27
|
+
isLocal?: boolean;
|
|
28
|
+
stage?: string | null;
|
|
29
|
+
status?: {
|
|
30
|
+
isCancelled?: boolean;
|
|
31
|
+
} | null;
|
|
32
|
+
}): boolean;
|
|
8
33
|
//# sourceMappingURL=order-cancel-view.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order-cancel-view.d.ts","sourceRoot":"","sources":["../../src/lib/order-cancel-view.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAO3D,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAAC,CAAC,SAAS;IAAE,IAAI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AE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAA;CAAE,EAC7G,OAAO,EAAE,MAAM,GACd,MAAM,CAER;AAED,mHAAmH;AACnH,wBAAgB,eAAe,CAAC,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAA;CAAE,GAAG,OAAO,CAEnI"}
|
|
@@ -20,3 +20,16 @@ export function markeerGeannuleerd(data, orderIds) {
|
|
|
20
20
|
export function zonderGeannuleerd(groups, stageOf) {
|
|
21
21
|
return groups.filter((g) => stageOf(g) !== "cancelled");
|
|
22
22
|
}
|
|
23
|
+
const isGeannuleerd = (o) => o.stage === "cancelled" || o.status?.isCancelled === true;
|
|
24
|
+
/** Groepsleden zonder geannuleerde orders; de getoonde order zelf blijft altijd staan. */
|
|
25
|
+
export function groepZonderGeannuleerd(leden, eigenId) {
|
|
26
|
+
return leden.filter((o) => o.id === eigenId || !isGeannuleerd(o));
|
|
27
|
+
}
|
|
28
|
+
/** Groepssleutel voor de lijst: een geannuleerde order is nooit lid van een groep. */
|
|
29
|
+
export function groepSleutel(o, grootte) {
|
|
30
|
+
return o.bufferId && grootte > 1 && !isGeannuleerd(o) ? `buf:${o.bufferId}` : `one:${o.id}`;
|
|
31
|
+
}
|
|
32
|
+
/** Eén order uit een groep annuleren: alleen een eigen (lokale) order die nog niet verzonden of geannuleerd is. */
|
|
33
|
+
export function kanLidAnnuleren(o) {
|
|
34
|
+
return !!o.isLocal && !isGeannuleerd(o) && o.stage !== "shipped";
|
|
35
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Productgroepen onder de gevraagde ids: echte groepen (product_groups.id) en
|
|
3
|
+
* artikelen met soort GROEP (products.batch = 'GROEP', het hoofdartikel van een groep).
|
|
4
|
+
* Geeft id → groepsnaam. Fout bij lezen → gooien (nooit stil doorlaten).
|
|
5
|
+
*/
|
|
6
|
+
export declare function groepNamenVoorIds(sb: any, ids: string[]): Promise<Map<string, string>>;
|
|
7
|
+
//# sourceMappingURL=product-group-lines.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-group-lines.server.d.ts","sourceRoot":"","sources":["../../src/lib/product-group-lines.server.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAe5F"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isGroepArtikel } from "./create-order-form.js";
|
|
2
|
+
/**
|
|
3
|
+
* Productgroepen onder de gevraagde ids: echte groepen (product_groups.id) en
|
|
4
|
+
* artikelen met soort GROEP (products.batch = 'GROEP', het hoofdartikel van een groep).
|
|
5
|
+
* Geeft id → groepsnaam. Fout bij lezen → gooien (nooit stil doorlaten).
|
|
6
|
+
*/
|
|
7
|
+
export async function groepNamenVoorIds(sb, ids) {
|
|
8
|
+
const out = new Map();
|
|
9
|
+
const uniek = Array.from(new Set(ids.filter(Boolean)));
|
|
10
|
+
if (uniek.length === 0)
|
|
11
|
+
return out;
|
|
12
|
+
const [g, p] = await Promise.all([
|
|
13
|
+
sb.from("product_groups").select("id, name").in("id", uniek),
|
|
14
|
+
sb.from("products").select("id, product, batch").in("id", uniek),
|
|
15
|
+
]);
|
|
16
|
+
if (g.error || p.error) {
|
|
17
|
+
console.error("[groepNamenVoorIds]", g.error ?? p.error);
|
|
18
|
+
throw new Error("Kon niet controleren of een regel een productgroep is. Probeer het opnieuw.");
|
|
19
|
+
}
|
|
20
|
+
for (const r of g.data ?? [])
|
|
21
|
+
out.set(String(r.id), String(r.name ?? ""));
|
|
22
|
+
for (const r of p.data ?? [])
|
|
23
|
+
if (isGroepArtikel(r))
|
|
24
|
+
out.set(String(r.id), String(r.product ?? ""));
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"salesorders-list.server.d.ts","sourceRoot":"","sources":["../../src/lib/salesorders-list.server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"salesorders-list.server.d.ts","sourceRoot":"","sources":["../../src/lib/salesorders-list.server.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAML,KAAK,aAAa,EAClB,KAAK,iBAAiB,EAEvB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAAiB,KAAK,mBAAmB,EAAE,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAGxG,OAAO,EAAkC,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjF,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAI1B,4EAA4E;AAC5E,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,UAAU,GAAG,SAAS,GAAG,cAAc,GAAG,UAAU,GAAG,SAAS,CAAC;AAEjG,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,SAAS,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QA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wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,UAAU,EAClB,kBAAkB,GAAE,cAAyB,GAC5C,OAAO,CAAC,UAAU,CAAC,CAm1CrB;AAyDD,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,EAAE,EACb,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACzC,KAAK,EAAE,MAAM,GAAG,IAAI,GACnB,qBAAqB,CAIvB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { groepSleutel } from "./order-cancel-view.js";
|
|
1
2
|
import { zonderGeannuleerd } from "./order-cancel-view.js";
|
|
2
3
|
import { composeLocalDelivery } from "./delivery-format.js";
|
|
3
4
|
import { orderMatches, searchTokens, articleLinesOf } from "./order-search.js";
|
|
@@ -1017,7 +1018,8 @@ export async function buildSalesOrdersList(supabase, params, connectionSupabase
|
|
|
1017
1018
|
});
|
|
1018
1019
|
const sizeByBuffer = new Map();
|
|
1019
1020
|
for (const o of all) {
|
|
1020
|
-
|
|
1021
|
+
// Geannuleerde orders zijn nooit lid van een groep.
|
|
1022
|
+
if (o.bufferId && o.stage !== "cancelled" && !o.status?.isCancelled)
|
|
1021
1023
|
sizeByBuffer.set(o.bufferId, (sizeByBuffer.get(o.bufferId) ?? 0) + 1);
|
|
1022
1024
|
}
|
|
1023
1025
|
for (const o of all)
|
|
@@ -1027,9 +1029,7 @@ export async function buildSalesOrdersList(supabase, params, connectionSupabase
|
|
|
1027
1029
|
const groups = [];
|
|
1028
1030
|
const groupIndex = new Map();
|
|
1029
1031
|
for (const o of all) {
|
|
1030
|
-
const key =
|
|
1031
|
-
? `buf:${o.bufferId}`
|
|
1032
|
-
: `one:${o.id}`;
|
|
1032
|
+
const key = params.localOrderId ? `one:${o.id}` : groepSleutel(o, o.bufferSize ?? 1);
|
|
1033
1033
|
const idx = groupIndex.get(key);
|
|
1034
1034
|
if (idx === undefined) {
|
|
1035
1035
|
groupIndex.set(key, groups.length);
|