@flowselections/floriday-verkoop-module 1.0.140 → 1.0.142
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/OrderAfleverbrievenCard.d.ts.map +1 -1
- package/dist-lib/components/verkoop/OrderAfleverbrievenCard.js +15 -2
- package/dist-lib/components/verkoop/OrderCarrierPicker.d.ts +3 -1
- package/dist-lib/components/verkoop/OrderCarrierPicker.d.ts.map +1 -1
- package/dist-lib/components/verkoop/OrderCarrierPicker.js +6 -2
- package/dist-lib/components/verkoop/OrderControlStatusCard.d.ts.map +1 -1
- package/dist-lib/components/verkoop/OrderControlStatusCard.js +2 -2
- package/dist-lib/components/verkoop/SalesOrderDetailPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SalesOrderDetailPage.js +95 -35
- package/dist-lib/components/verkoop/SalesOrderDetailView.d.ts +6 -0
- package/dist-lib/components/verkoop/SalesOrderDetailView.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SalesOrderDetailView.js +67 -34
- package/dist-lib/components/verkoop/SalesOrdersFilters.d.ts +3 -1
- package/dist-lib/components/verkoop/SalesOrdersFilters.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SalesOrdersFilters.js +77 -8
- package/dist-lib/components/verkoop/SalesOrdersTable.d.ts +7 -1
- package/dist-lib/components/verkoop/SalesOrdersTable.d.ts.map +1 -1
- package/dist-lib/components/verkoop/SalesOrdersTable.js +39 -26
- package/dist-lib/components/verkoop/VerkoopOrdersPage.d.ts.map +1 -1
- package/dist-lib/components/verkoop/VerkoopOrdersPage.js +214 -38
- package/dist-lib/components/verkoop/v3/ArticlesHover.d.ts +8 -0
- package/dist-lib/components/verkoop/v3/ArticlesHover.d.ts.map +1 -0
- package/dist-lib/components/verkoop/v3/ArticlesHover.js +48 -0
- package/dist-lib/components/verkoop/v3/EmptyState.d.ts +9 -0
- package/dist-lib/components/verkoop/v3/EmptyState.d.ts.map +1 -0
- package/dist-lib/components/verkoop/v3/EmptyState.js +5 -0
- package/dist-lib/components/verkoop/v3/HoverTip.d.ts.map +1 -1
- package/dist-lib/components/verkoop/v3/HoverTip.js +1 -1
- package/dist-lib/components/verkoop/v3/InfoCard.d.ts +28 -0
- package/dist-lib/components/verkoop/v3/InfoCard.d.ts.map +1 -0
- package/dist-lib/components/verkoop/v3/InfoCard.js +21 -0
- package/dist-lib/components/verkoop/v3/KpiTile.d.ts +10 -2
- package/dist-lib/components/verkoop/v3/KpiTile.d.ts.map +1 -1
- package/dist-lib/components/verkoop/v3/KpiTile.js +37 -5
- package/dist-lib/components/verkoop/v3/NoticeBar.d.ts +6 -0
- package/dist-lib/components/verkoop/v3/NoticeBar.d.ts.map +1 -0
- package/dist-lib/components/verkoop/v3/NoticeBar.js +10 -0
- package/dist-lib/components/verkoop/v3/OrderProgress.d.ts.map +1 -1
- package/dist-lib/components/verkoop/v3/OrderProgress.js +8 -1
- package/dist-lib/components/verkoop/v3/OrderStepper.d.ts +7 -0
- package/dist-lib/components/verkoop/v3/OrderStepper.d.ts.map +1 -0
- package/dist-lib/components/verkoop/v3/OrderStepper.js +77 -0
- package/dist-lib/components/verkoop/v3/ShortcutHelp.d.ts +5 -0
- package/dist-lib/components/verkoop/v3/ShortcutHelp.d.ts.map +1 -0
- package/dist-lib/components/verkoop/v3/ShortcutHelp.js +13 -0
- package/dist-lib/lib/delivery-format.check.d.ts +2 -0
- package/dist-lib/lib/delivery-format.check.d.ts.map +1 -0
- package/dist-lib/lib/delivery-format.check.js +28 -0
- package/dist-lib/lib/delivery-format.d.ts +17 -0
- package/dist-lib/lib/delivery-format.d.ts.map +1 -0
- package/dist-lib/lib/delivery-format.js +42 -0
- package/dist-lib/lib/order-articles.functions.d.ts +11 -0
- package/dist-lib/lib/order-articles.functions.d.ts.map +1 -0
- package/dist-lib/lib/order-articles.functions.js +11 -0
- package/dist-lib/lib/order-articles.server.d.ts +11 -0
- package/dist-lib/lib/order-articles.server.d.ts.map +1 -0
- package/dist-lib/lib/order-articles.server.js +89 -0
- package/dist-lib/lib/order-nav.check.d.ts +2 -0
- package/dist-lib/lib/order-nav.check.d.ts.map +1 -0
- package/dist-lib/lib/order-nav.check.js +16 -0
- package/dist-lib/lib/order-nav.d.ts +24 -0
- package/dist-lib/lib/order-nav.d.ts.map +1 -0
- package/dist-lib/lib/order-nav.js +62 -0
- package/dist-lib/lib/order-progress.server.d.ts +23 -0
- package/dist-lib/lib/order-progress.server.d.ts.map +1 -1
- package/dist-lib/lib/order-progress.server.js +25 -0
- package/dist-lib/lib/order-search.check.d.ts +2 -0
- package/dist-lib/lib/order-search.check.d.ts.map +1 -0
- package/dist-lib/lib/order-search.check.js +16 -0
- package/dist-lib/lib/order-search.d.ts +18 -0
- package/dist-lib/lib/order-search.d.ts.map +1 -0
- package/dist-lib/lib/order-search.js +37 -0
- package/dist-lib/lib/salesorders-list.functions.d.ts +20 -0
- package/dist-lib/lib/salesorders-list.functions.d.ts.map +1 -1
- package/dist-lib/lib/salesorders-list.functions.js +24 -0
- package/dist-lib/lib/salesorders-list.server.d.ts.map +1 -1
- package/dist-lib/lib/salesorders-list.server.js +4 -3
- package/dist-lib/lib/salesorders-mapping.d.ts +2 -0
- package/dist-lib/lib/salesorders-mapping.d.ts.map +1 -1
- package/dist-lib/lib/salesorders-mapping.js +1 -0
- package/dist-lib/lib/salesorders.functions.d.ts +8 -0
- package/dist-lib/lib/salesorders.functions.d.ts.map +1 -1
- package/dist-lib/lib/salesorders.functions.js +23 -3
- package/dist-lib/lib/useBufferEvents.js +1 -1
- package/dist-lib/lib/useDetailProgressFallback.d.ts +17 -0
- package/dist-lib/lib/useDetailProgressFallback.d.ts.map +1 -0
- package/dist-lib/lib/useDetailProgressFallback.js +28 -0
- package/dist-lib/lib/useLocalSalesOrderDetailQuery.d.ts +1 -0
- package/dist-lib/lib/useLocalSalesOrderDetailQuery.d.ts.map +1 -1
- package/dist-lib/lib/useSalesOrdersQuery.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SalesOrdersFilters.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrdersFilters.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SalesOrdersFilters.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrdersFilters.tsx"],"names":[],"mappings":"AA8BA,MAAM,WAAW,OAAO;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACnE;AA6BD,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,IAAa,EACb,IAAY,GACb,EAAE;IACD,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAClC,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACpC,6DAA6D;IAC7D,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,+BA6TA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, Input, Popover, PopoverContent, PopoverTrigger, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@flowselections/core";
|
|
4
|
-
import { ChevronDown, ChevronLeft, ChevronRight, MoreVertical, Search, } from "lucide-react";
|
|
4
|
+
import { ChevronDown, ChevronLeft, ChevronRight, MoreVertical, Search, X, } from "lucide-react";
|
|
5
5
|
import { WeekCalendar } from "./WeekCalendar.js";
|
|
6
6
|
import { amsterdamYmd, isoWeekOf, shiftPeriod as shiftPeriodRange, ymdString } from "../../lib/period-range.js";
|
|
7
7
|
// Huidige week/maand/dag altijd in Europe/Amsterdam (period-range.ts).
|
|
@@ -27,7 +27,7 @@ function generateMonthOptions() {
|
|
|
27
27
|
}
|
|
28
28
|
return options;
|
|
29
29
|
}
|
|
30
|
-
export function SalesOrdersFilters({ value, onChange, part = "both", }) {
|
|
30
|
+
export function SalesOrdersFilters({ value, onChange, part = "both", busy = false, }) {
|
|
31
31
|
const currentWeek = getCurrentWeek();
|
|
32
32
|
const week = value.week ?? currentWeek.week;
|
|
33
33
|
const year = value.year ?? currentWeek.year;
|
|
@@ -38,6 +38,65 @@ export function SalesOrdersFilters({ value, onChange, part = "both", }) {
|
|
|
38
38
|
const todayYmd = ymdString(amsterdamYmd());
|
|
39
39
|
const day = value.day ?? todayYmd;
|
|
40
40
|
const [search, setSearch] = useState(value.search ?? "");
|
|
41
|
+
const inputRef = useRef(null);
|
|
42
|
+
// Focus is zichtbaar via de ring om het hele vak; de algemene focusrand
|
|
43
|
+
// (met !important) zou een tweede rand binnenin tekenen.
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
inputRef.current?.style.setProperty("outline", "none", "important");
|
|
46
|
+
}, []);
|
|
47
|
+
// Laadbalkje alleen als de server langer dan 150 ms nodig heeft.
|
|
48
|
+
const [showBusy, setShowBusy] = useState(false);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (!busy) {
|
|
51
|
+
setShowBusy(false);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const t = setTimeout(() => setShowBusy(true), 150);
|
|
55
|
+
return () => clearTimeout(t);
|
|
56
|
+
}, [busy]);
|
|
57
|
+
const valueRef = useRef(value);
|
|
58
|
+
valueRef.current = value;
|
|
59
|
+
// Van buitenaf gewist/gewijzigd (Alles wissen, terug-knop): veld bijwerken.
|
|
60
|
+
const lastSent = useRef(value.search ?? "");
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
const ext = value.search ?? "";
|
|
63
|
+
if (ext !== lastSent.current) {
|
|
64
|
+
lastSent.current = ext;
|
|
65
|
+
setSearch(ext);
|
|
66
|
+
}
|
|
67
|
+
}, [value.search]);
|
|
68
|
+
// Zoeken tijdens typen: 250 ms na de laatste toets.
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (search === lastSent.current)
|
|
71
|
+
return;
|
|
72
|
+
const t = setTimeout(() => {
|
|
73
|
+
lastSent.current = search;
|
|
74
|
+
onChange({ ...valueRef.current, search: search || undefined });
|
|
75
|
+
}, 250);
|
|
76
|
+
return () => clearTimeout(t);
|
|
77
|
+
}, [search]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
78
|
+
// "/" zet de cursor in het zoekveld (niet tijdens typen elders).
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (part === "period")
|
|
81
|
+
return;
|
|
82
|
+
const onKey = (e) => {
|
|
83
|
+
if (e.key !== "/" || e.metaKey || e.ctrlKey || e.altKey)
|
|
84
|
+
return;
|
|
85
|
+
const el = e.target;
|
|
86
|
+
if (el && (el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName)))
|
|
87
|
+
return;
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
inputRef.current?.focus();
|
|
90
|
+
};
|
|
91
|
+
window.addEventListener("keydown", onKey);
|
|
92
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
93
|
+
}, [part]);
|
|
94
|
+
const clearSearch = () => {
|
|
95
|
+
setSearch("");
|
|
96
|
+
lastSent.current = "";
|
|
97
|
+
onChange({ ...valueRef.current, search: undefined });
|
|
98
|
+
inputRef.current?.focus();
|
|
99
|
+
};
|
|
41
100
|
const monthOptions = generateMonthOptions();
|
|
42
101
|
const formatDayNL = (ymd) => {
|
|
43
102
|
const [y, m, d] = ymd.split("-").map(Number);
|
|
@@ -86,11 +145,21 @@ export function SalesOrdersFilters({ value, onChange, part = "both", }) {
|
|
|
86
145
|
return `Week ${week}, ${year}`;
|
|
87
146
|
};
|
|
88
147
|
const showArrows = period === "week" || period === "month" || period === "day";
|
|
89
|
-
return (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [part !== "search" && (_jsxs("div", { className: "flex h-
|
|
148
|
+
return (_jsxs("div", { className: "flex w-full flex-wrap items-center gap-2 sm:w-auto", children: [part !== "search" && (_jsxs("div", { className: "flex h-10 w-full items-center justify-between gap-1 rounded-md border border-border bg-card px-1 sm:h-9 sm:w-auto sm:justify-start", children: [showArrows && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: () => shiftPeriod(-1), className: "inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": "Vorige", children: _jsx(ChevronLeft, { className: "h-4 w-4" }) }), _jsx("button", { type: "button", onClick: () => shiftPeriod(1), className: "inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": "Volgende", children: _jsx(ChevronRight, { className: "h-4 w-4" }) })] })), period === "month" ? (_jsxs(Select, { value: `${monthYear}-${month}`, onValueChange: (v) => {
|
|
90
149
|
const [y, m] = v.split("-").map(Number);
|
|
91
150
|
onChange({ ...value, month: m, monthYear: y });
|
|
92
|
-
}, children: [_jsx(SelectTrigger, { className: "h-7 w-36 border-0 bg-transparent px-2 text-sm font-medium text-foreground shadow-none focus:ring-0", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: monthOptions.map((opt) => (_jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value))) })] })) : period === "day" ? (_jsx(Input, { type: "date", value: day, onChange: (e) => onChange({ ...value, day: e.target.value }), className: "h-7 w-40 border-0 bg-transparent px-2 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" })) : period === "custom" ? (_jsxs("div", { className: "flex items-center gap-1 px-2", children: [_jsx(Input, { type: "date", value: value.customFrom ?? todayYmd, onChange: (e) => onChange({ ...value, customFrom: e.target.value }), className: "h-7 w-36 border-0 bg-transparent px-1 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" }), _jsx("span", { className: "text-muted-foreground", children: "\u2013" }), _jsx(Input, { type: "date", value: value.customTo ?? todayYmd, onChange: (e) => onChange({ ...value, customTo: e.target.value }), className: "h-7 w-36 border-0 bg-transparent px-1 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" })] })) : period === "last7" || period === "last30" ? (_jsx("span", { className: "px-2 text-sm font-medium text-foreground whitespace-nowrap", children: period === "last7" ? "Afgelopen 7 dagen" : "Afgelopen 30 dagen" })) : (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", className: "px-2 text-sm font-medium text-foreground whitespace-nowrap rounded hover:bg-accent h-7", "aria-label": "Kies week", children: ["Week ", week, " - ", year] }) }), _jsx(PopoverContent, { className: "w-auto p-0 pointer-events-auto", align: "start", children: _jsx(WeekCalendar, { week: week, year: year, onSelect: (w, y) => onChange({ ...value, week: w, year: y }) }) })] })), (value.dateField ?? "delivery") === "ordered" && (_jsx("span", { className: "pr-1 text-sm text-muted-foreground whitespace-nowrap", "aria-label": "Periode op besteldatum", children: "\u00B7 besteldatum" })), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": "Periode-opties", children: _jsx(MoreVertical, { className: "h-4 w-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-56", children: [_jsxs(DropdownMenuRadioGroup, { value: period, onValueChange: (v) => handlePeriodChange(v), children: [_jsx(DropdownMenuRadioItem, { value: "day", children: "Dag" }), _jsx(DropdownMenuRadioItem, { value: "week", children: "Week" }), _jsx(DropdownMenuRadioItem, { value: "month", children: "Maand" }), _jsx(DropdownMenuRadioItem, { value: "last7", children: "Afgelopen 7 dagen" }), _jsx(DropdownMenuRadioItem, { value: "last30", children: "Afgelopen 30 dagen" }), _jsx(DropdownMenuRadioItem, { value: "custom", children: "Aangepast tijdsbestek" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuRadioGroup, { value: value.dateField ?? "delivery", onValueChange: (v) => onChange({ ...value, dateField: v === "ordered" ? "ordered" : "delivery" }), children: [_jsx(DropdownMenuRadioItem, { value: "delivery", children: "Op leverdatum" }), _jsx(DropdownMenuRadioItem, { value: "ordered", children: "Op besteldatum" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs("div", { className: "px-2 py-1.5 text-sm text-muted-foreground inline-flex items-center gap-1", children: [periodLabel(), (value.dateField ?? "delivery") === "ordered" ? " · besteldatum" : "", _jsx(ChevronDown, { className: "h-3.5 w-3.5" })] })] })] })] })), part !== "period" && (_jsxs("div", { className: "flex h-9 w-full items-center overflow-hidden rounded-md border border-border bg-card
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
151
|
+
}, children: [_jsx(SelectTrigger, { className: "h-7 w-36 border-0 bg-transparent px-2 text-sm font-medium text-foreground shadow-none focus:ring-0", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: monthOptions.map((opt) => (_jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value))) })] })) : period === "day" ? (_jsx(Input, { type: "date", value: day, onChange: (e) => onChange({ ...value, day: e.target.value }), className: "h-7 w-40 border-0 bg-transparent px-2 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" })) : period === "custom" ? (_jsxs("div", { className: "flex items-center gap-1 px-2", children: [_jsx(Input, { type: "date", value: value.customFrom ?? todayYmd, onChange: (e) => onChange({ ...value, customFrom: e.target.value }), className: "h-7 w-36 border-0 bg-transparent px-1 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" }), _jsx("span", { className: "text-muted-foreground", children: "\u2013" }), _jsx(Input, { type: "date", value: value.customTo ?? todayYmd, onChange: (e) => onChange({ ...value, customTo: e.target.value }), className: "h-7 w-36 border-0 bg-transparent px-1 text-sm font-medium text-foreground shadow-none focus-visible:ring-0" })] })) : period === "last7" || period === "last30" ? (_jsx("span", { className: "px-2 text-sm font-medium text-foreground whitespace-nowrap", children: period === "last7" ? "Afgelopen 7 dagen" : "Afgelopen 30 dagen" })) : (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("button", { type: "button", className: "px-2 text-sm font-medium text-foreground whitespace-nowrap rounded hover:bg-accent h-7", "aria-label": "Kies week", children: ["Week ", week, " - ", year] }) }), _jsx(PopoverContent, { className: "w-auto p-0 pointer-events-auto", align: "start", children: _jsx(WeekCalendar, { week: week, year: year, onSelect: (w, y) => onChange({ ...value, week: w, year: y }) }) })] })), (value.dateField ?? "delivery") === "ordered" && (_jsx("span", { className: "pr-1 text-sm text-muted-foreground whitespace-nowrap", "aria-label": "Periode op besteldatum", children: "\u00B7 besteldatum" })), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": "Periode-opties", children: _jsx(MoreVertical, { className: "h-4 w-4" }) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-56", children: [_jsxs(DropdownMenuRadioGroup, { value: period, onValueChange: (v) => handlePeriodChange(v), children: [_jsx(DropdownMenuRadioItem, { value: "day", children: "Dag" }), _jsx(DropdownMenuRadioItem, { value: "week", children: "Week" }), _jsx(DropdownMenuRadioItem, { value: "month", children: "Maand" }), _jsx(DropdownMenuRadioItem, { value: "last7", children: "Afgelopen 7 dagen" }), _jsx(DropdownMenuRadioItem, { value: "last30", children: "Afgelopen 30 dagen" }), _jsx(DropdownMenuRadioItem, { value: "custom", children: "Aangepast tijdsbestek" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuRadioGroup, { value: value.dateField ?? "delivery", onValueChange: (v) => onChange({ ...value, dateField: v === "ordered" ? "ordered" : "delivery" }), children: [_jsx(DropdownMenuRadioItem, { value: "delivery", children: "Op leverdatum" }), _jsx(DropdownMenuRadioItem, { value: "ordered", children: "Op besteldatum" })] }), _jsx(DropdownMenuSeparator, {}), _jsxs("div", { className: "px-2 py-1.5 text-sm text-muted-foreground inline-flex items-center gap-1", children: [periodLabel(), (value.dateField ?? "delivery") === "ordered" ? " · besteldatum" : "", _jsx(ChevronDown, { className: "h-3.5 w-3.5" })] })] })] })] })), part !== "period" && (_jsxs("div", { className: "group relative flex h-10 sm:h-9 w-full items-center overflow-hidden rounded-md border border-border bg-card " +
|
|
152
|
+
"transition-[box-shadow,border-color,width] duration-[180ms] ease-out motion-reduce:transition-none " +
|
|
153
|
+
"focus-within:border-primary focus-within:ring-[3px] focus-within:ring-ring/20 " +
|
|
154
|
+
(part === "search" ? "sm:w-80 sm:focus-within:w-[400px]" : ""), children: [_jsx(Search, { className: "ml-3 h-4 w-4 shrink-0 text-muted-foreground transition-colors duration-[120ms] group-focus-within:text-primary", "aria-hidden": true }), _jsx("input", { ref: inputRef, type: "search", placeholder: part === "search" ? "Zoek op ordernummer, klant, artikel of referentie" : "Op briefnummer zoeken", "aria-label": "Zoeken", value: search, maxLength: 100, autoComplete: "off", spellCheck: false, onChange: (e) => setSearch(e.target.value), onKeyDown: (e) => {
|
|
155
|
+
if (e.key === "Escape" && search) {
|
|
156
|
+
e.preventDefault();
|
|
157
|
+
clearSearch();
|
|
158
|
+
}
|
|
159
|
+
}, className: "h-full min-w-0 flex-1 appearance-none border-0 bg-transparent px-2 text-base sm:text-sm text-foreground outline-none ring-0 shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0 " +
|
|
160
|
+
"placeholder:text-muted-foreground [&::-webkit-search-cancel-button]:hidden " +
|
|
161
|
+
(part === "search" ? "" : "w-56") }), _jsxs("span", { className: "relative mr-1.5 flex h-7 w-7 shrink-0 items-center justify-center", children: [_jsx("kbd", { className: "pointer-events-none absolute rounded border border-border px-1.5 font-mono text-[11px] leading-5 text-muted-foreground transition-opacity duration-[120ms] " +
|
|
162
|
+
(search ? "opacity-0" : "opacity-100 group-focus-within:opacity-0"), "aria-hidden": true, children: "/" }), _jsx("button", { type: "button", onClick: clearSearch, tabIndex: search ? 0 : -1, className: "absolute inline-flex h-7 w-7 items-center justify-center rounded text-muted-foreground transition-[opacity,transform,background-color] duration-[120ms] ease-out hover:bg-muted hover:text-foreground " +
|
|
163
|
+
(search ? "scale-100 opacity-100" : "pointer-events-none scale-90 opacity-0"), "aria-label": "Zoekterm wissen", children: _jsx(X, { className: "h-4 w-4" }) })] }), _jsx("span", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-0.5 origin-left bg-primary transition-opacity duration-[180ms] " +
|
|
164
|
+
(showBusy ? "opacity-70 motion-safe:animate-pulse" : "opacity-0"), "aria-hidden": true })] }))] }));
|
|
96
165
|
}
|
|
@@ -3,7 +3,7 @@ import type { SalesOrderDTO } from "../../lib/salesorders-mapping.js";
|
|
|
3
3
|
import { type ProgressFeatures } from "../../lib/order-progress.js";
|
|
4
4
|
/** Stabiele rij-id: buffers zijn serverside al samengevouwen tot één rij. */
|
|
5
5
|
export declare function salesOrderRowId(row: SalesOrderDTO): string;
|
|
6
|
-
export declare function SalesOrdersTable({ orders, loading, onSelectOrder, onDeleteOrder, onEditOrder, onFulfillOrder, fulfillingId, selectedIds, onSelectionChange, features, emptyText, onClearFilters, skeletonRows, fadeKey, quiet, highlightIds, topSlot, }: {
|
|
6
|
+
export declare function SalesOrdersTable({ orders, loading, onSelectOrder, onDeleteOrder, onEditOrder, onFulfillOrder, fulfillingId, selectedIds, onSelectionChange, features, emptyText, onClearFilters, skeletonRows, fadeKey, quiet, highlightIds, topSlot, emptySlot, focusedId, rowHeight, }: {
|
|
7
7
|
orders: SalesOrderDTO[];
|
|
8
8
|
loading?: boolean;
|
|
9
9
|
onSelectOrder?: (order: SalesOrderDTO) => void;
|
|
@@ -26,5 +26,11 @@ export declare function SalesOrdersTable({ orders, loading, onSelectOrder, onDel
|
|
|
26
26
|
highlightIds?: string[];
|
|
27
27
|
/** Ruimte boven de tabel (bijv. "2 nieuwe orders · Tonen"). */
|
|
28
28
|
topSlot?: ReactNode;
|
|
29
|
+
/** Eigen lege toestand (vervangt emptyText). */
|
|
30
|
+
emptySlot?: ReactNode;
|
|
31
|
+
/** Rij met toetsenbordfocus (J/K). */
|
|
32
|
+
focusedId?: string | null;
|
|
33
|
+
/** Rijhoogte in px (60 comfortabel, 48 compact). */
|
|
34
|
+
rowHeight?: number;
|
|
29
35
|
}): import("react").JSX.Element;
|
|
30
36
|
//# sourceMappingURL=SalesOrdersTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SalesOrdersTable.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrdersTable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SalesOrdersTable.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/SalesOrdersTable.tsx"],"names":[],"mappings":"AACA,OAAO,EAA8C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAWnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAGL,KAAK,gBAAgB,EAEtB,MAAM,0BAA0B,CAAC;AAuBlC,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAG1D;AAuXD,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,OAAO,EACP,aAAa,EACb,aAAa,EACb,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,QAA2B,EAC3B,SAAmC,EACnC,cAAc,EACd,YAAgB,EAChB,OAAO,EACP,KAAa,EACb,YAAY,EACZ,OAAO,EACP,SAAS,EACT,SAAS,EACT,SAAc,GACf,EAAE;IACD,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAChD,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,uFAAuF;IACvF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,gDAAgD;IAChD,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,+BAmJA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { formatDelivery, deliveryHasTimeFor } from "../../lib/delivery-format.js";
|
|
2
3
|
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
|
3
4
|
import { Checkbox, Skeleton, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@flowselections/core";
|
|
4
|
-
import { ArrowDown, SearchX } from "lucide-react";
|
|
5
|
+
import { AlertCircle, ArrowDown, Clock, Eye, SearchX } from "lucide-react";
|
|
5
6
|
import { articlesLabel, toProgressMember, } from "../../lib/order-progress.js";
|
|
6
7
|
import { animateIn, flashBackground, prefersReducedMotion, transitionStyle } from "../../lib/motion.js";
|
|
7
8
|
import { SourceIcon } from "./v3/SourceIcon.js";
|
|
@@ -9,6 +10,7 @@ import { OrderProgress } from "./v3/OrderProgress.js";
|
|
|
9
10
|
import { RowMenu } from "./v3/RowMenu.js";
|
|
10
11
|
import { CustomerName, useHasCustomerRoute } from "./v3/CustomerName.js";
|
|
11
12
|
import { HoverTip } from "./v3/HoverTip.js";
|
|
13
|
+
import { ArticlesHover } from "./v3/ArticlesHover.js";
|
|
12
14
|
const amount = (n) => (n ?? 0).toLocaleString("nl-NL", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
13
15
|
function fmtOrdered(iso) {
|
|
14
16
|
if (!iso)
|
|
@@ -21,18 +23,6 @@ function fmtOrdered(iso) {
|
|
|
21
23
|
time: d.toLocaleTimeString("nl-NL", { hour: "2-digit", minute: "2-digit", timeZone: "Europe/Amsterdam" }),
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
|
-
function fmtDelivery(iso) {
|
|
25
|
-
if (!iso)
|
|
26
|
-
return { date: "—", time: "" };
|
|
27
|
-
const dateOnly = /^\d{4}-\d{2}-\d{2}$/.test(iso.trim());
|
|
28
|
-
const d = new Date(dateOnly ? `${iso.trim()}T00:00:00` : iso);
|
|
29
|
-
if (Number.isNaN(d.getTime()))
|
|
30
|
-
return { date: iso, time: "" };
|
|
31
|
-
return {
|
|
32
|
-
date: d.toLocaleDateString("nl-NL", { weekday: "short", day: "numeric", month: "short" }),
|
|
33
|
-
time: dateOnly ? "" : d.toLocaleTimeString("nl-NL", { hour: "2-digit", minute: "2-digit", timeZone: "Europe/Amsterdam" }),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
26
|
/** Stabiele rij-id: buffers zijn serverside al samengevouwen tot één rij. */
|
|
37
27
|
export function salesOrderRowId(row) {
|
|
38
28
|
const bufferSize = row.bufferSize ?? 1;
|
|
@@ -69,13 +59,26 @@ function deliveryLine2(row, time) {
|
|
|
69
59
|
return { text: time ? `${time} · te laat` : "te laat", late: true };
|
|
70
60
|
return { text: time, late: false };
|
|
71
61
|
}
|
|
72
|
-
/** Bedrag
|
|
62
|
+
/** Bedrag links uitgelijnd, met het euroteken direct voor het bedrag. */
|
|
73
63
|
function Money({ value }) {
|
|
74
64
|
const v = amount(value);
|
|
75
|
-
return (_jsxs("span", { className: "inline-flex
|
|
65
|
+
return (_jsxs("span", { className: "inline-flex justify-start gap-1 tabular-nums", title: `€ ${v}`, children: [_jsx("span", { children: "\u20AC" }), _jsx("span", { children: v })] }));
|
|
76
66
|
}
|
|
77
|
-
|
|
67
|
+
/** Initialen van een klantnaam voor de avatar. */
|
|
68
|
+
function initials(name) {
|
|
69
|
+
const parts = (name || "").replace(/[^\p{L}\p{N}\s]/gu, " ").trim().split(/\s+/).filter(Boolean);
|
|
70
|
+
if (!parts.length)
|
|
71
|
+
return "?";
|
|
72
|
+
return ((parts[0][0] ?? "") + (parts.length > 1 ? parts[parts.length - 1][0] : parts[0][1] ?? "")).toUpperCase();
|
|
73
|
+
}
|
|
74
|
+
const DesktopRow = memo(function DesktopRow({ row, rowId, selected, leaving, highlight, features, linkable, fulfillingId, handlers, focused, rowHeight = 60, }) {
|
|
78
75
|
const ref = useRef(null);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (focused)
|
|
78
|
+
ref.current?.scrollIntoView({ block: "nearest" });
|
|
79
|
+
}, [focused]);
|
|
80
|
+
// Nieuw verschenen rij (bijv. nieuwe zoektreffer): zacht infaden; bestaande rijen staan stil.
|
|
81
|
+
useEffect(() => animateIn(ref.current, { duration: 120 }), []);
|
|
79
82
|
useEffect(() => {
|
|
80
83
|
if (highlight)
|
|
81
84
|
flashBackground(ref.current, accentColor());
|
|
@@ -84,19 +87,24 @@ const DesktopRow = memo(function DesktopRow({ row, rowId, selected, leaving, hig
|
|
|
84
87
|
const isBuffer = !!row.bufferId && size > 1;
|
|
85
88
|
const members = membersOf(row);
|
|
86
89
|
const ordered = fmtOrdered(row.orderedAt);
|
|
87
|
-
const delivery =
|
|
90
|
+
const delivery = formatDelivery(row.deliveryAt, deliveryHasTimeFor(row));
|
|
88
91
|
const d2 = deliveryLine2(row, delivery.time);
|
|
89
92
|
const cancelled = row.stage === "cancelled";
|
|
90
93
|
const place = row.customer.city || row.deliveryLocationLabel || "—";
|
|
91
94
|
const h = handlers.current;
|
|
92
|
-
return (_jsxs(TableRow, { ref: ref, "data-state": selected ? "selected" : undefined,
|
|
95
|
+
return (_jsxs(TableRow, { ref: ref, "data-state": selected ? "selected" : undefined, "data-focused": focused ? "true" : undefined, className: "group cursor-pointer " +
|
|
96
|
+
(focused ? "bg-muted/60 " : "") +
|
|
97
|
+
(cancelled ? "text-muted-foreground" : ""), style: { ...transitionStyle("background-color, opacity", leaving ? 150 : 120), opacity: leaving ? 0 : 1, height: rowHeight }, onClick: () => handlers.current.onSelectOrder?.(row), children: [_jsxs(TableCell, { className: "relative py-0", onClick: (e) => e.stopPropagation(), children: [(selected || focused) && (_jsx("span", { "aria-hidden": true, className: "absolute inset-y-0 left-0 w-[3px] " + (selected ? "bg-primary" : "bg-primary/40") })), _jsx(Checkbox, { "aria-label": `Selecteer ${row.orderNumber || "order"}`, checked: selected, onCheckedChange: () => handlers.current.toggle(rowId) })] }), _jsx(TableCell, { className: "py-0", children: _jsx(SourceIcon, { sources: members.map((m) => m.source) }) }), _jsxs(TableCell, { className: "py-0", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("button", { type: "button", title: row.orderNumber || undefined, onClick: (e) => {
|
|
93
98
|
e.stopPropagation();
|
|
94
99
|
handlers.current.onSelectOrder?.(row);
|
|
95
100
|
}, className: "min-w-0 truncate rounded-sm font-medium tabular-nums focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring " +
|
|
96
|
-
(cancelled ? "line-through" : "text-foreground"), children: row.orderNumber || "—" }), _jsx("span", { className: "shrink-0", children: _jsx(BufferChip, { row: row }) })] }), row.customerReference ? (_jsx(Line, { text: `Ref. ${row.customerReference}`, className: "text-xs text-muted-foreground" })) : null] }),
|
|
101
|
+
(cancelled ? "line-through" : "text-foreground"), children: row.orderNumber || "—" }), _jsx("span", { className: "shrink-0", children: _jsx(BufferChip, { row: row }) })] }), row.customerReference ? (_jsx(Line, { text: `Ref. ${row.customerReference}`, className: "text-xs text-muted-foreground" })) : null] }), _jsx(TableCell, { className: "min-w-0 py-0", children: _jsxs("div", { className: "flex min-w-0 items-center gap-2.5", children: [_jsx("span", { "aria-hidden": true, className: "hidden h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary/10 text-[11px] font-semibold text-primary lg:inline-flex", children: initials(row.customer.name) }), _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "truncate font-medium", title: row.customer.name || undefined, children: _jsx(CustomerName, { name: row.customer.name, customerId: row.customerId, linkable: linkable }) }), _jsx(Line, { text: place, className: "text-xs text-muted-foreground" })] })] }) }), _jsxs(TableCell, { className: "py-0", children: [_jsx(Line, { text: ordered.date, className: "text-sm text-foreground" }), _jsx(Line, { text: ordered.time, className: "text-xs text-muted-foreground tabular-nums" })] }), _jsxs(TableCell, { className: "py-0 text-left", children: [_jsx(ArticlesHover, { ids: row.bufferOrderIds?.length ? row.bufferOrderIds : [row.id], count: row.articleCount ?? 1, children: _jsx("span", { className: "text-sm text-foreground", children: `${articlesLabel(row.articleCount ?? 1)} · ${row.fustCount} fust` }) }), _jsx("div", { className: "text-xs text-muted-foreground", children: _jsx(Money, { value: row.revenue ?? 0 }) })] }), _jsxs(TableCell, { className: "py-0", children: [_jsx(Line, { text: delivery.date, className: "text-sm text-foreground" }), d2.text ? (_jsxs("div", { className: "flex min-w-0 items-center gap-1 text-xs tabular-nums " + (d2.late ? "font-medium text-destructive" : "text-muted-foreground"), children: [d2.late ? _jsx(AlertCircle, { className: "h-3 w-3 shrink-0", "aria-hidden": true }) : _jsx(Clock, { className: "h-3 w-3 shrink-0", "aria-hidden": true }), _jsx("span", { className: "truncate", children: d2.text })] })) : (_jsx("div", { children: "\u00a0" }))] }), _jsx(TableCell, { className: "py-0", onClick: (e) => e.stopPropagation(), children: _jsx(OrderProgress, { members: members, features: features }) }), _jsx(TableCell, { className: "py-0", onClick: (e) => e.stopPropagation(), children: _jsxs("div", { className: "flex items-center justify-end gap-0.5", children: [_jsx("button", { type: "button", "aria-label": `Open ${row.orderNumber || "order"}`, title: "Openen", onClick: () => handlers.current.onSelectOrder?.(row), className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover:opacity-100 " +
|
|
102
|
+
(focused ? "opacity-100" : "opacity-0"), children: _jsx(Eye, { className: "h-4 w-4", "aria-hidden": true }) }), _jsx(RowMenu, { row: row, rowId: rowId, isBuffer: isBuffer, fulfillingId: fulfillingId, onEdit: h.onEditOrder ? (o) => handlers.current.onEditOrder?.(o) : undefined, onDetails: h.onSelectOrder ? (o) => handlers.current.onSelectOrder?.(o) : undefined, onFulfill: h.onFulfillOrder ? (o) => handlers.current.onFulfillOrder?.(o) : undefined, onDelete: h.onDeleteOrder ? (o) => handlers.current.onDeleteOrder?.(o) : undefined })] }) })] }));
|
|
97
103
|
});
|
|
98
104
|
const MobileCard = memo(function MobileCard({ row, rowId, selected, leaving, highlight, features, linkable, fulfillingId, handlers, }) {
|
|
99
105
|
const ref = useRef(null);
|
|
106
|
+
// Nieuw verschenen rij (bijv. nieuwe zoektreffer): zacht infaden; bestaande rijen staan stil.
|
|
107
|
+
useEffect(() => animateIn(ref.current, { duration: 120 }), []);
|
|
100
108
|
useEffect(() => {
|
|
101
109
|
if (highlight)
|
|
102
110
|
flashBackground(ref.current, accentColor());
|
|
@@ -104,11 +112,11 @@ const MobileCard = memo(function MobileCard({ row, rowId, selected, leaving, hig
|
|
|
104
112
|
const size = row.bufferSize ?? 1;
|
|
105
113
|
const isBuffer = !!row.bufferId && size > 1;
|
|
106
114
|
const members = membersOf(row);
|
|
107
|
-
const delivery =
|
|
115
|
+
const delivery = formatDelivery(row.deliveryAt, deliveryHasTimeFor(row));
|
|
108
116
|
const d2 = deliveryLine2(row, delivery.time);
|
|
109
117
|
const cancelled = row.stage === "cancelled";
|
|
110
118
|
const h = handlers.current;
|
|
111
|
-
return (_jsxs("li", { ref: ref, className: "flex w-full min-w-0 gap-3
|
|
119
|
+
return (_jsxs("li", { ref: ref, className: "flex w-full min-w-0 cursor-pointer gap-3 px-3 py-3.5 transition-colors active:bg-muted/70 " + (selected ? "bg-muted/50" : ""), style: { ...transitionStyle("opacity", 150), opacity: leaving ? 0 : 1 }, onClick: () => handlers.current.onSelectOrder?.(row), children: [_jsxs("div", { className: "flex shrink-0 flex-col items-center gap-2", onClick: (e) => e.stopPropagation(), children: [_jsx(Checkbox, { "aria-label": `Selecteer ${row.orderNumber || "order"}`, checked: selected, onCheckedChange: () => handlers.current.toggle(rowId) }), _jsx(SourceIcon, { sources: members.map((m) => m.source) })] }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_auto] items-start gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("span", { className: "truncate font-medium tabular-nums " + (cancelled ? "line-through text-muted-foreground" : "text-foreground"), title: row.orderNumber || undefined, children: row.orderNumber || "—" }), _jsx("span", { className: "shrink-0", children: _jsx(BufferChip, { row: row }) })] }), _jsxs("div", { className: "truncate text-sm", title: row.customer.name || undefined, children: [_jsx(CustomerName, { name: row.customer.name, customerId: row.customerId, linkable: linkable }), row.customer.city && _jsxs("span", { className: "text-muted-foreground", children: [" \u00B7 ", row.customer.city] })] })] }), _jsx("div", { onClick: (e) => e.stopPropagation(), children: _jsx(RowMenu, { row: row, rowId: rowId, isBuffer: isBuffer, fulfillingId: fulfillingId, onEdit: h.onEditOrder ? (o) => handlers.current.onEditOrder?.(o) : undefined, onDetails: h.onSelectOrder ? (o) => handlers.current.onSelectOrder?.(o) : undefined, onFulfill: h.onFulfillOrder ? (o) => handlers.current.onFulfillOrder?.(o) : undefined, onDelete: h.onDeleteOrder ? (o) => handlers.current.onDeleteOrder?.(o) : undefined }) })] }), _jsxs("div", { className: "mt-1 flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground", children: [_jsxs("span", { className: "truncate", children: [articlesLabel(row.articleCount ?? 1), " \u00B7 ", row.fustCount, " fust"] }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { className: "shrink-0 font-medium tabular-nums text-foreground", children: ["\u20AC ", amount(row.revenue ?? 0)] })] }), _jsxs("div", { className: "mt-2.5 flex min-w-0 flex-nowrap items-center justify-between gap-2", children: [_jsxs("div", { className: "min-w-0 truncate text-xs text-foreground", children: [delivery.date, d2.text ? (_jsxs("span", { className: d2.late ? "font-medium text-destructive" : "text-muted-foreground", children: [" ", d2.text] })) : null] }), _jsx("div", { className: "shrink-0", onClick: (e) => e.stopPropagation(), children: _jsx(OrderProgress, { members: members, features: features }) })] })] })] }));
|
|
112
120
|
});
|
|
113
121
|
/**
|
|
114
122
|
* Houdt bij een achtergrondverversing verdwenen rijen 150 ms zichtbaar
|
|
@@ -138,8 +146,11 @@ function useLeavingRows(orders, quiet) {
|
|
|
138
146
|
}, [orders, quiet]);
|
|
139
147
|
return state ?? { shown: orders, leaving: new Set() };
|
|
140
148
|
}
|
|
141
|
-
|
|
142
|
-
|
|
149
|
+
// Alle kolommen hebben een vaste basisbreedte; bij een bredere of smallere
|
|
150
|
+
// tabel groeien of krimpen ze evenredig mee (table-fixed), zodat geen enkele
|
|
151
|
+
// kolom alle ruimte pakt en de verhoudingen altijd kloppen.
|
|
152
|
+
const COLS = [36, 40, 140, 220, 104, 164, 132, 144, 76];
|
|
153
|
+
export function SalesOrdersTable({ orders, loading, onSelectOrder, onDeleteOrder, onEditOrder, onFulfillOrder, fulfillingId, selectedIds, onSelectionChange, features = DEFAULT_FEATURES, emptyText = "Geen orders gevonden.", onClearFilters, skeletonRows = 8, fadeKey, quiet = false, highlightIds, topSlot, emptySlot, focusedId, rowHeight = 60, }) {
|
|
143
154
|
const [internalSelected, setInternalSelected] = useState([]);
|
|
144
155
|
const selected = useMemo(() => new Set(selectedIds ?? internalSelected), [selectedIds, internalSelected]);
|
|
145
156
|
const { shown, leaving } = useLeavingRows(orders, quiet);
|
|
@@ -181,7 +192,7 @@ export function SalesOrdersTable({ orders, loading, onSelectOrder, onDeleteOrder
|
|
|
181
192
|
animateIn(bodyRef.current, { duration: 120 });
|
|
182
193
|
animateIn(listRef.current, { duration: 120 });
|
|
183
194
|
}, [fadeKey, loading]);
|
|
184
|
-
const empty = (_jsxs("div", { className: "flex flex-col items-center gap-2 py-12 text-center text-sm text-muted-foreground", children: [_jsx(SearchX, { className: "h-6 w-6", "aria-hidden": true }), _jsx("div", { children: emptyText }), onClearFilters && (_jsx("button", { type: "button", onClick: onClearFilters, className: "text-primary underline-offset-2 hover:underline", children: "Filters wissen" }))] }));
|
|
195
|
+
const empty = emptySlot ?? (_jsxs("div", { className: "flex flex-col items-center gap-2 py-12 text-center text-sm text-muted-foreground", children: [_jsx(SearchX, { className: "h-6 w-6", "aria-hidden": true }), _jsx("div", { children: emptyText }), onClearFilters && (_jsx("button", { type: "button", onClick: onClearFilters, className: "text-primary underline-offset-2 hover:underline", children: "Filters wissen" }))] }));
|
|
185
196
|
const rowProps = (row) => {
|
|
186
197
|
const rowId = salesOrderRowId(row);
|
|
187
198
|
return {
|
|
@@ -194,8 +205,10 @@ export function SalesOrdersTable({ orders, loading, onSelectOrder, onDeleteOrder
|
|
|
194
205
|
linkable,
|
|
195
206
|
fulfillingId,
|
|
196
207
|
handlers,
|
|
208
|
+
focused: focusedId === rowId,
|
|
209
|
+
rowHeight,
|
|
197
210
|
};
|
|
198
211
|
};
|
|
199
|
-
return (_jsxs("div", { className: "w-full min-w-0 rounded-
|
|
200
|
-
Array.from({ length: skeletonRows }).map((_, i) => (_jsx(TableRow, { className: "
|
|
212
|
+
return (_jsxs("div", { className: "w-full min-w-0 overflow-clip rounded-xl border border-border bg-card shadow-sm", children: [topSlot, _jsx("div", { className: "hidden max-h-[calc(100dvh-7rem)] overflow-auto md:block xl:max-h-none xl:overflow-visible", children: _jsxs("table", { className: "w-full [&_thead_th]:h-10 [&_thead_th]:text-[11px] [&_thead_th]:font-semibold [&_thead_th]:uppercase [&_thead_th]:tracking-wide [&_thead_th]:text-muted-foreground min-w-[900px] table-fixed caption-bottom text-sm [&_thead_th]:sticky [&_thead_th]:top-0 [&_thead_th]:z-10 [&_thead_th]:bg-card [&_tbody_tr]:transition-colors", children: [_jsx("colgroup", { children: COLS.map((w, i) => (_jsx("col", { style: w ? { width: `${w}px` } : undefined }, i))) }), _jsx(TableHeader, { children: _jsxs(TableRow, { className: "hover:bg-transparent", children: [_jsx(TableHead, { children: _jsx(Checkbox, { "aria-label": "Alle orders op deze pagina selecteren", checked: allChecked ? true : someChecked ? "indeterminate" : false, onCheckedChange: (v) => applySelection(v === true ? rowIds : []) }) }), _jsx(TableHead, { children: _jsx("span", { className: "sr-only", children: "Bron" }) }), _jsx(TableHead, { children: "Ordernummer" }), _jsx(TableHead, { children: "Klant" }), _jsx(TableHead, { children: _jsxs("span", { className: "inline-flex items-center gap-1", children: ["Bestelmoment ", _jsx(ArrowDown, { className: "h-3 w-3", "aria-hidden": true })] }) }), _jsx(TableHead, { className: "text-left", children: "Artikelen / fust" }), _jsx(TableHead, { children: "Levermoment" }), _jsx(TableHead, { children: "Status" }), _jsx(TableHead, { children: _jsx("span", { className: "sr-only", children: "Acties" }) })] }) }), _jsxs(TableBody, { ref: bodyRef, children: [loading &&
|
|
213
|
+
Array.from({ length: skeletonRows }).map((_, i) => (_jsx(TableRow, { className: "hover:bg-transparent", style: { height: rowHeight }, children: COLS.map((__, j) => (_jsx(TableCell, { className: "py-0", children: _jsx(Skeleton, { className: "h-4 w-full animate-pulse" }) }, j))) }, `s-${i}`))), !loading && shown.length === 0 && (_jsx(TableRow, { className: "hover:bg-transparent", children: _jsx(TableCell, { colSpan: COLS.length, children: empty }) })), !loading && shown.map((row) => _jsx(DesktopRow, { ...rowProps(row) }, salesOrderRowId(row)))] })] }) }), _jsxs("div", { className: "w-full min-w-0 md:hidden", children: [loading && (_jsx("div", { className: "space-y-2 p-3", children: Array.from({ length: Math.min(skeletonRows, 6) }).map((_, i) => (_jsx(Skeleton, { className: "h-28 w-full animate-pulse" }, i))) })), !loading && shown.length === 0 && empty, !loading && (_jsx("ul", { ref: listRef, className: "w-full divide-y divide-border", children: shown.map((row) => (_jsx(MobileCard, { ...rowProps(row) }, salesOrderRowId(row)))) }))] })] }));
|
|
201
214
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VerkoopOrdersPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/VerkoopOrdersPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VerkoopOrdersPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/VerkoopOrdersPage.tsx"],"names":[],"mappings":"AAwPA,wBAAgB,iBAAiB,gCAw+BhC"}
|