@flowselections/floriday-verkoop-module 1.0.140 → 1.0.141
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 +2 -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 +78 -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 +50 -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 +36 -12
- 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 +6 -0
- package/dist-lib/components/verkoop/v3/OrderStepper.d.ts.map +1 -0
- package/dist-lib/components/verkoop/v3/OrderStepper.js +76 -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/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-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.server.d.ts.map +1 -1
- package/dist-lib/lib/salesorders-list.server.js +3 -3
- package/dist-lib/lib/useBufferEvents.js +1 -1
- package/dist-lib/lib/useSalesOrdersQuery.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { ChevronDown } from "lucide-react";
|
|
4
|
+
/**
|
|
5
|
+
* Kaart in de orderdetail-stijl: icoon + titel, optionele actie rechts.
|
|
6
|
+
* Op telefoon in te klappen, behalve als `attention` aan staat (een
|
|
7
|
+
* openstaande actie of probleem wordt nooit verborgen).
|
|
8
|
+
*/
|
|
9
|
+
export function InfoCard({ icon, title, action, children, attention = false, className = "", bodyClassName = "", }) {
|
|
10
|
+
const [collapsed, setCollapsed] = useState(false);
|
|
11
|
+
const isCollapsed = collapsed && !attention;
|
|
12
|
+
return (_jsxs("section", { className: "min-w-0 rounded-xl border border-border bg-card shadow-sm " + className, children: [_jsxs("header", { className: "flex min-h-12 items-center gap-3 border-b border-border px-4 py-3 sm:px-5", children: [icon && (_jsx("span", { className: "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary [&_svg]:h-4 [&_svg]:w-4", "aria-hidden": true, children: icon })), _jsx("h2", { className: "min-w-0 flex-1 truncate text-base font-semibold text-foreground", children: title }), action, !attention && (_jsx("button", { type: "button", onClick: () => setCollapsed((v) => !v), "aria-expanded": !isCollapsed, "aria-label": isCollapsed ? "Uitklappen" : "Inklappen", className: "inline-flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring md:hidden", children: _jsx(ChevronDown, { className: "h-4 w-4 transition-transform " + (isCollapsed ? "-rotate-90" : "") }) }))] }), _jsx("div", { className: (isCollapsed ? "hidden md:block " : "") + "px-4 py-3 sm:px-5 " + bodyClassName, children: children })] }));
|
|
13
|
+
}
|
|
14
|
+
/** Label-waarde-regel binnen een InfoCard. */
|
|
15
|
+
export function InfoRow({ label, children }) {
|
|
16
|
+
return (_jsxs("div", { className: "grid grid-cols-[120px_minmax(0,1fr)] items-start gap-3 border-b border-border/60 py-2 text-sm last:border-b-0", children: [_jsx("div", { className: "text-muted-foreground", children: label }), _jsx("div", { className: "min-w-0 break-words text-foreground", children: children })] }));
|
|
17
|
+
}
|
|
18
|
+
/** Kerntegel boven de kaarten. */
|
|
19
|
+
export function FactTile({ icon, label, value, sub }) {
|
|
20
|
+
return (_jsxs("div", { className: "flex min-w-0 items-start gap-3 rounded-xl border border-border bg-card p-5 shadow-sm", children: [_jsx("span", { className: "mt-0.5 inline-flex shrink-0 text-primary [&_svg]:h-6 [&_svg]:w-6", "aria-hidden": true, children: icon }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "text-xs text-muted-foreground", children: label }), _jsx("div", { className: "mt-0.5 break-words text-lg font-bold leading-snug text-foreground", children: value }), sub && _jsx("div", { className: "mt-0.5 text-xs text-muted-foreground", children: sub })] })] }));
|
|
21
|
+
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export interface KpiTrend {
|
|
3
|
+
/** Procentuele wijziging t.o.v. de vorige periode (null = geen vergelijking). */
|
|
4
|
+
pct: number | null;
|
|
5
|
+
label: string;
|
|
6
|
+
/** Hoger is beter (omzet) of slechter (actie nodig). */
|
|
7
|
+
goodWhenUp?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** KPI-tegel: icoon, label, groot getal, subregel en optionele trend. Alleen weergave. */
|
|
10
|
+
export declare function KpiTile({ title, value, sub, icon, tone, loading, onClick, active, trend, }: {
|
|
4
11
|
title: string;
|
|
5
12
|
value: ReactNode;
|
|
6
13
|
sub?: ReactNode;
|
|
@@ -9,5 +16,6 @@ export declare function KpiTile({ title, value, sub, icon, tone, loading, onClic
|
|
|
9
16
|
loading?: boolean;
|
|
10
17
|
onClick?: () => void;
|
|
11
18
|
active?: boolean;
|
|
19
|
+
trend?: KpiTrend | null;
|
|
12
20
|
}): import("react").JSX.Element;
|
|
13
21
|
//# sourceMappingURL=KpiTile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KpiTile.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/v3/KpiTile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"KpiTile.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/v3/KpiTile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,MAAM,WAAW,QAAQ;IACvB,iFAAiF;IACjF,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAoCD,0FAA0F;AAC1F,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,KAAK,EACL,GAAG,EACH,IAAI,EACJ,IAAgB,EAChB,OAAO,EACP,OAAO,EACP,MAAM,EACN,KAAK,GACN,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CACzB,+BA4DA"}
|
|
@@ -1,8 +1,40 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Card, Skeleton } from "@flowselections/core";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { ChevronRight, Minus, TrendingDown, TrendingUp } from "lucide-react";
|
|
4
|
+
function Trend({ trend }) {
|
|
5
|
+
if (trend.pct == null)
|
|
6
|
+
return null;
|
|
7
|
+
const flat = Math.abs(trend.pct) < 0.5;
|
|
8
|
+
const up = trend.pct > 0;
|
|
9
|
+
const good = flat ? null : up === (trend.goodWhenUp ?? true);
|
|
10
|
+
const Icon = flat ? Minus : up ? TrendingUp : TrendingDown;
|
|
11
|
+
const tone = good == null ? "text-muted-foreground" : good ? "text-primary" : "text-destructive";
|
|
12
|
+
return (_jsxs("span", { className: "inline-flex min-w-0 items-center gap-1 whitespace-nowrap text-xs font-medium tabular-nums " + tone, title: trend.label, children: [_jsx(Icon, { className: "h-3.5 w-3.5", "aria-hidden": true }), flat ? "0%" : `${up ? "+" : ""}${Math.round(trend.pct)}%`, _jsx("span", { className: "truncate font-normal text-muted-foreground", children: trend.label })] }));
|
|
13
|
+
}
|
|
14
|
+
/** Klein trendlijntje van vorige naar huidige periode (alleen weergave). */
|
|
15
|
+
function Spark({ trend }) {
|
|
16
|
+
if (trend.pct == null)
|
|
17
|
+
return null;
|
|
18
|
+
const up = trend.pct > 0.5;
|
|
19
|
+
const down = trend.pct < -0.5;
|
|
20
|
+
const good = up || down ? up === (trend.goodWhenUp ?? true) : null;
|
|
21
|
+
const tone = good == null ? "text-muted-foreground" : good ? "text-primary" : "text-destructive";
|
|
22
|
+
const y0 = up ? 26 : down ? 6 : 16;
|
|
23
|
+
const y1 = up ? 6 : down ? 26 : 16;
|
|
24
|
+
const mid = (y0 + y1) / 2;
|
|
25
|
+
const d = `M2 ${y0} C 14 ${y0}, 18 ${mid + (up ? 4 : down ? -4 : 0)}, 28 ${mid} S 44 ${mid - (up ? 6 : down ? -6 : 0)}, 50 ${(mid + y1) / 2} S 58 ${y1}, 62 ${y1}`;
|
|
26
|
+
return (_jsx("svg", { viewBox: "0 0 64 32", className: "hidden h-8 w-16 shrink-0 self-end sm:block " + tone, "aria-hidden": true, children: _jsx("path", { d: d, fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }));
|
|
27
|
+
}
|
|
28
|
+
/** KPI-tegel: icoon, label, groot getal, subregel en optionele trend. Alleen weergave. */
|
|
29
|
+
export function KpiTile({ title, value, sub, icon, tone = "default", loading, onClick, active, trend, }) {
|
|
30
|
+
const body = (_jsxs("div", { className: "flex items-center gap-3 sm:gap-4", children: [icon && (_jsx("span", { className: "inline-flex h-10 w-10 sm:h-12 sm:w-12 shrink-0 items-center justify-center rounded-xl [&_svg]:h-5 [&_svg]:w-5 sm:[&_svg]:h-6 sm:[&_svg]:w-6 " +
|
|
31
|
+
(tone === "warning" ? "bg-warning-soft text-warning-soft-foreground" : "bg-primary/10 text-primary"), "aria-hidden": true, children: icon })), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "truncate text-[11px] font-semibold uppercase tracking-wider text-muted-foreground", children: title }), _jsx("div", { className: "mt-0.5 text-2xl font-semibold leading-tight tabular-nums text-foreground", children: loading ? _jsx(Skeleton, { className: "h-7 w-24" }) : value }), _jsx("div", { className: "mt-1 flex min-h-4 flex-col gap-0.5 text-xs text-muted-foreground", children: loading ? _jsx(Skeleton, { className: "h-3 w-32" }) : (_jsxs(_Fragment, { children: [_jsx("div", { className: "truncate", children: sub }), trend && _jsx(Trend, { trend: trend })] })) })] }), !loading && trend && _jsx(Spark, { trend: trend }), onClick && tone === "warning" && _jsx(ChevronRight, { className: "h-5 w-5 shrink-0 text-muted-foreground", "aria-hidden": true })] }));
|
|
32
|
+
return (_jsx(Card, { className: "h-full p-4 sm:p-5 transition-shadow " +
|
|
33
|
+
(onClick ? "hover:border-ring/50 hover:shadow-md " : "") +
|
|
34
|
+
(active ? "ring-2 ring-ring" : ""), children: onClick ? (_jsx("div", { role: "button", tabIndex: 0, onClick: onClick, onKeyDown: (e) => {
|
|
35
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
onClick();
|
|
38
|
+
}
|
|
39
|
+
}, className: "block w-full cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: body })) : (body) }));
|
|
8
40
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoticeBar.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/v3/NoticeBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGjD,+DAA+D;AAC/D,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,SAAS,EAAE,CAAA;CAAE,sCA2B1D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { ChevronDown, Info } from "lucide-react";
|
|
4
|
+
/** Eén inklapbare balk voor alle meldingen ("2 meldingen"). */
|
|
5
|
+
export function NoticeBar({ items }) {
|
|
6
|
+
const [open, setOpen] = useState(false);
|
|
7
|
+
if (items.length === 0)
|
|
8
|
+
return null;
|
|
9
|
+
return (_jsxs("div", { className: "shrink-0 rounded-lg border border-border bg-warning-soft text-sm text-warning-soft-foreground", children: [_jsxs("button", { type: "button", "aria-expanded": open, onClick: () => setOpen((o) => !o), className: "flex w-full items-center gap-2 px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-lg", children: [_jsx(Info, { className: "h-4 w-4 shrink-0", "aria-hidden": true }), _jsxs("span", { className: "font-medium", children: [items.length, " ", items.length === 1 ? "melding" : "meldingen"] }), !open && _jsx("span", { className: "min-w-0 flex-1 truncate opacity-80", children: typeof items[0] === "string" ? items[0] : "" }), _jsx(ChevronDown, { className: "ml-auto h-4 w-4 shrink-0 transition-transform " + (open ? "rotate-180" : ""), "aria-hidden": true })] }), open && (_jsx("ul", { className: "space-y-1 border-t border-border/60 px-3 py-2 pl-9", children: items.map((it, i) => (_jsx("li", { children: it }, i))) }))] }));
|
|
10
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderProgress.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/v3/OrderProgress.tsx"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEpB,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"OrderProgress.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/v3/OrderProgress.tsx"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEpB,MAAM,6BAA6B,CAAC;AAkLrC,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,+BAcA"}
|
|
@@ -105,6 +105,13 @@ function invoiceText(m, f) {
|
|
|
105
105
|
return `${nr} · ${inv.status ?? "in behandeling"}${priceNote ? `\n${priceNote}` : ""}`;
|
|
106
106
|
}
|
|
107
107
|
// ---- Weergave -------------------------------------------------------------
|
|
108
|
+
/** Tooltiptekst "a · b · c" als nette regels: eerste regel is de kern, de rest eronder. */
|
|
109
|
+
function TipLines({ text }) {
|
|
110
|
+
const lines = text.split(/\n| · /).map((l) => l.trim()).filter(Boolean);
|
|
111
|
+
const [head, ...rest] = lines;
|
|
112
|
+
const cap = (l) => l.charAt(0).toUpperCase() + l.slice(1);
|
|
113
|
+
return (_jsxs("div", { className: "space-y-0.5", children: [head && _jsx("div", { className: "text-foreground/90", children: cap(head) }), rest.map((l, i) => (_jsxs("div", { className: "flex gap-1.5 text-muted-foreground", children: [_jsx("span", { "aria-hidden": true, className: "mt-1.5 h-1 w-1 shrink-0 rounded-full bg-muted-foreground/50" }), _jsx("span", { children: cap(l) })] }, i)))] }));
|
|
114
|
+
}
|
|
108
115
|
function StepIcon({ title, icon, state, members, textOf, doneOf, align = "center", }) {
|
|
109
116
|
if (state === "hidden")
|
|
110
117
|
return _jsx("span", { className: "inline-block h-7 w-7", "aria-hidden": true });
|
|
@@ -113,7 +120,7 @@ function StepIcon({ title, icon, state, members, textOf, doneOf, align = "center
|
|
|
113
120
|
const doneCount = list.filter(doneOf).length;
|
|
114
121
|
const { shown, more } = limitMembers(list);
|
|
115
122
|
const label = `${title}: ${STATE_WORD[state]}${multi ? ` (${doneCount} van ${list.length})` : ""}`;
|
|
116
|
-
const content = (_jsxs("div", { className: "space-y-
|
|
123
|
+
const content = (_jsxs("div", { className: "space-y-2 leading-snug", children: [_jsxs("div", { className: "flex min-h-5 items-center justify-between gap-3 border-b border-border pb-2", children: [_jsx("span", { className: "text-[13px] font-semibold text-foreground", children: title }), multi && (_jsxs("span", { className: "rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium tabular-nums text-muted-foreground", children: [doneCount, " van ", list.length] }))] }), multi ? (_jsxs("ul", { className: "divide-y divide-border/60", children: [shown.map((m) => (_jsxs("li", { className: "space-y-0.5 py-2 first:pt-0 last:pb-0", children: [_jsx("div", { className: "font-medium tabular-nums text-foreground", children: m.orderNumber }), _jsx(TipLines, { text: textOf(m) })] }, m.orderNumber))), more > 0 && _jsxs("li", { className: "pt-2 text-muted-foreground", children: ["+", more, " meer"] })] })) : (_jsx(TipLines, { text: list[0] ? textOf(list[0]) : "—" }))] }));
|
|
117
124
|
return (_jsx(HoverTip, { label: label, content: content, align: align, className: "h-7 w-7 transition-colors duration-[120ms] ease-out hover:bg-muted focus-visible:bg-muted motion-reduce:transition-none", children: _jsxs("span", { className: "relative inline-flex h-7 w-7 items-center justify-center " + STATE_CLASS[state], children: [icon, DOT_CLASS[state] && (_jsx("span", { className: "absolute right-0.5 top-0.5 h-2 w-2 rounded-full ring-2 ring-card " + DOT_CLASS[state], "aria-hidden": true }))] }) }));
|
|
118
125
|
}
|
|
119
126
|
/** Vier statusiconen: Ontvangen, Gepickt, Verzonden, Gefactureerd. */
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ProgressFeatures, type ProgressMember } from "../../../lib/order-progress.js";
|
|
2
|
+
export declare function OrderStepper({ members, features }: {
|
|
3
|
+
members: ProgressMember[];
|
|
4
|
+
features: ProgressFeatures;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=OrderStepper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrderStepper.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/v3/OrderStepper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEpB,MAAM,sBAAsB,CAAC;AA0B9B,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;IAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAA;CAAE,+BAgF5G"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Check, FileCheck, Package, ReceiptText, Truck, AlertTriangle, Clock } from "lucide-react";
|
|
3
|
+
import { rowSteps, } from "../../../lib/order-progress.js";
|
|
4
|
+
/**
|
|
5
|
+
* Voortgangsbalk voor het orderdetail. Zelfde vier stappen, namen en
|
|
6
|
+
* kleurregels als de statusiconen in de lijst (rowSteps); alleen weergave.
|
|
7
|
+
* Een tijd per stap staat er alleen als die bekend is.
|
|
8
|
+
*/
|
|
9
|
+
function fmt(iso) {
|
|
10
|
+
if (!iso)
|
|
11
|
+
return null;
|
|
12
|
+
const d = new Date(iso);
|
|
13
|
+
if (Number.isNaN(d.getTime()))
|
|
14
|
+
return null;
|
|
15
|
+
return d.toLocaleString("nl-NL", { day: "numeric", month: "short", hour: "2-digit", minute: "2-digit" });
|
|
16
|
+
}
|
|
17
|
+
const latest = (xs) => xs.filter((x) => !!x).sort().at(-1) ?? null;
|
|
18
|
+
const STATE_TEXT = {
|
|
19
|
+
done: "Klaar",
|
|
20
|
+
todo: "Nog niet",
|
|
21
|
+
late: "Te laat",
|
|
22
|
+
error: "Fout",
|
|
23
|
+
attention: "Aandacht nodig",
|
|
24
|
+
hidden: "",
|
|
25
|
+
};
|
|
26
|
+
export function OrderStepper({ members, features }) {
|
|
27
|
+
const active = members.filter((m) => !m.cancelled);
|
|
28
|
+
if (active.length === 0) {
|
|
29
|
+
return (_jsx("div", { className: "rounded-xl border border-border bg-card px-5 py-4 text-sm text-muted-foreground shadow-sm", children: "Deze order is geannuleerd." }));
|
|
30
|
+
}
|
|
31
|
+
const s = rowSteps(members, features);
|
|
32
|
+
const allDone = (st) => st === "done";
|
|
33
|
+
const steps = [
|
|
34
|
+
{
|
|
35
|
+
key: "received",
|
|
36
|
+
title: "Order ontvangen",
|
|
37
|
+
icon: _jsx(FileCheck, { className: "h-4 w-4" }),
|
|
38
|
+
state: s.received,
|
|
39
|
+
at: allDone(s.received) ? latest(active.map((m) => m.orderedAt)) : null,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
key: "picked",
|
|
43
|
+
title: "Gepickt",
|
|
44
|
+
icon: _jsx(Package, { className: "h-4 w-4" }),
|
|
45
|
+
state: s.picked,
|
|
46
|
+
at: allDone(s.picked) ? latest(active.map((m) => m.pickProgress?.lastScannedAt ?? m.controlledAt)) : null,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key: "shipped",
|
|
50
|
+
title: "Aangemeld bij vervoerder",
|
|
51
|
+
icon: _jsx(Truck, { className: "h-4 w-4" }),
|
|
52
|
+
state: s.shipped,
|
|
53
|
+
at: allDone(s.shipped) ? latest(active.map((m) => m.shippedAt)) : null,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: "invoiced",
|
|
57
|
+
title: active.some((m) => m.invoiceRoute === "floriday") ? "Gefactureerd via Floriday" : "Gefactureerd",
|
|
58
|
+
icon: _jsx(ReceiptText, { className: "h-4 w-4" }),
|
|
59
|
+
state: s.invoiced,
|
|
60
|
+
at: allDone(s.invoiced) ? latest(active.map((m) => m.erpInvoice?.sentAt ?? null)) : null,
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
const shown = steps.filter((st) => st.state !== "hidden");
|
|
64
|
+
return (_jsx("ol", { "aria-label": "Voortgang", className: "grid gap-3 rounded-xl border border-border bg-card px-4 py-4 shadow-sm sm:px-6", style: { gridTemplateColumns: `repeat(${shown.length}, minmax(0, 1fr))` }, children: shown.map((st, i) => {
|
|
65
|
+
const tone = st.state === "done"
|
|
66
|
+
? "bg-primary text-primary-foreground border-primary"
|
|
67
|
+
: st.state === "error" || st.state === "late"
|
|
68
|
+
? "bg-destructive-soft text-destructive border-destructive/40"
|
|
69
|
+
: st.state === "attention"
|
|
70
|
+
? "bg-warning-soft text-warning-soft-foreground border-warning/40"
|
|
71
|
+
: "bg-muted text-muted-foreground border-border";
|
|
72
|
+
const Icon = st.state === "done" ? _jsx(Check, { className: "h-4 w-4" }) : st.state === "error" ? _jsx(AlertTriangle, { className: "h-4 w-4" }) : st.state === "late" ? _jsx(Clock, { className: "h-4 w-4" }) : st.icon;
|
|
73
|
+
const nextDone = shown[i + 1]?.state === "done";
|
|
74
|
+
return (_jsxs("li", { className: "relative flex min-w-0 flex-col items-center text-center", children: [i < shown.length - 1 && (_jsx("span", { "aria-hidden": true, className: "absolute left-[calc(50%+1.25rem)] right-[calc(-50%+1.25rem)] top-4 " + (st.state === "done" && nextDone ? "h-0.5 rounded-full bg-primary" : "border-t-2 border-dashed border-border") })), _jsx("span", { className: "relative z-10 inline-flex h-8 w-8 items-center justify-center rounded-full border " + tone, children: Icon }), _jsx("span", { className: "mt-2 text-xs font-medium leading-tight sm:text-sm " + (st.state === "todo" ? "text-muted-foreground" : "text-foreground"), children: st.title }), _jsx("span", { className: "mt-0.5 text-[11px] tabular-nums " + (st.state === "error" || st.state === "late" ? "text-destructive" : "text-muted-foreground"), children: st.state === "done" ? (fmt(st.at) ?? STATE_TEXT.done) : STATE_TEXT[st.state] })] }, st.key));
|
|
75
|
+
}) }));
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShortcutHelp.d.ts","sourceRoot":"","sources":["../../../../src/components/verkoop/v3/ShortcutHelp.tsx"],"names":[],"mappings":"AAWA,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;CAAE,+BA2BzG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@flowselections/core";
|
|
3
|
+
const SHORTCUTS = [
|
|
4
|
+
[["/"], "Zoeken"],
|
|
5
|
+
[["N"], "Nieuwe order"],
|
|
6
|
+
[["J", "K"], "Volgende / vorige order"],
|
|
7
|
+
[["Enter"], "Geselecteerde order openen"],
|
|
8
|
+
[["Esc"], "Zoeken wissen / sluiten"],
|
|
9
|
+
[["?"], "Dit overzicht"],
|
|
10
|
+
];
|
|
11
|
+
export function ShortcutHelp({ open, onOpenChange }) {
|
|
12
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "max-w-sm", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: "Sneltoetsen" }) }), _jsx("ul", { className: "divide-y divide-border text-sm", children: SHORTCUTS.map(([keys, label]) => (_jsxs("li", { className: "flex items-center justify-between py-2", children: [_jsx("span", { className: "text-foreground", children: label }), _jsx("span", { className: "flex gap-1", children: keys.map((k) => (_jsx("kbd", { className: "inline-flex h-6 min-w-6 items-center justify-center rounded border border-border bg-muted px-1.5 font-mono text-[11px] text-muted-foreground", children: k }, k))) })] }, label))) })] }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ArticlePreview } from "./order-articles.server.js";
|
|
2
|
+
export type { ArticlePreview, ArticlePreviewItem } from "./order-articles.server.js";
|
|
3
|
+
/** Eerste artikelen (naam, stuks, afbeelding) van een lijstrij; alleen lezen. */
|
|
4
|
+
export declare const getOrderArticlesPreview: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
5
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
6
|
+
userId: string;
|
|
7
|
+
claims: import("@supabase/auth-js").User;
|
|
8
|
+
}, undefined, undefined, undefined>], (d: unknown) => {
|
|
9
|
+
ids: string[];
|
|
10
|
+
}, Promise<ArticlePreview>>;
|
|
11
|
+
//# sourceMappingURL=order-articles.functions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-articles.functions.d.ts","sourceRoot":"","sources":["../../src/lib/order-articles.functions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElF,iFAAiF;AACjF,eAAO,MAAM,uBAAuB;;;;0CAEd,OAAO;;2BAIzB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createServerFn } from "@tanstack/react-start";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
|
|
4
|
+
/** Eerste artikelen (naam, stuks, afbeelding) van een lijstrij; alleen lezen. */
|
|
5
|
+
export const getOrderArticlesPreview = createServerFn({ method: "POST" })
|
|
6
|
+
.middleware([requireSupabaseAuth])
|
|
7
|
+
.inputValidator((d) => z.object({ ids: z.array(z.string().min(1)).min(1).max(50) }).parse(d))
|
|
8
|
+
.handler(async ({ data, context }) => {
|
|
9
|
+
const { loadArticlePreview } = await import("./order-articles.server.js");
|
|
10
|
+
return loadArticlePreview(context.supabase, data.ids);
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ArticlePreviewItem {
|
|
2
|
+
name: string;
|
|
3
|
+
pieces: number;
|
|
4
|
+
imageUrl: string | null;
|
|
5
|
+
}
|
|
6
|
+
export interface ArticlePreview {
|
|
7
|
+
items: ArticlePreviewItem[];
|
|
8
|
+
total: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function loadArticlePreview(supabase: any, rowIds: string[]): Promise<ArticlePreview>;
|
|
11
|
+
//# sourceMappingURL=order-articles.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-articles.server.d.ts","sourceRoot":"","sources":["../../src/lib/order-articles.server.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AACD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAeD,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAuEjG"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Artikel-voorvertoning voor de orderlijst (hover op "N artikelen").
|
|
2
|
+
// Alleen lezen, onder RLS van de ingelogde gebruiker; quarantaineregels
|
|
3
|
+
// worden overgeslagen. Afbeeldingen komen uit floriday_trade_items_cache.
|
|
4
|
+
import { parseOrderRowId } from "./salesorders-mapping.js";
|
|
5
|
+
const UUID_RE = /^[0-9a-f-]{36}$/i;
|
|
6
|
+
const MAX_ITEMS = 3;
|
|
7
|
+
function str(v) {
|
|
8
|
+
return typeof v === "string" && v.trim() ? v.trim() : null;
|
|
9
|
+
}
|
|
10
|
+
function firstPhoto(d) {
|
|
11
|
+
const photos = d?.photos ?? d?.images ?? d?.tradeItemPhotos ?? [];
|
|
12
|
+
if (!Array.isArray(photos) || !photos.length)
|
|
13
|
+
return null;
|
|
14
|
+
const p = photos[0];
|
|
15
|
+
return str(p?.url ?? p?.imageUrl ?? p?.href ?? p);
|
|
16
|
+
}
|
|
17
|
+
export async function loadArticlePreview(supabase, rowIds) {
|
|
18
|
+
const localIds = [];
|
|
19
|
+
const foIds = [];
|
|
20
|
+
for (const id of rowIds.slice(0, 50)) {
|
|
21
|
+
const p = parseOrderRowId(id);
|
|
22
|
+
if (!p)
|
|
23
|
+
continue;
|
|
24
|
+
if (p.kind === "order")
|
|
25
|
+
localIds.push(p.uuid);
|
|
26
|
+
else if (p.kind === "floriday")
|
|
27
|
+
foIds.push(p.uuid);
|
|
28
|
+
}
|
|
29
|
+
const sel = "id, floriday_sales_order_id, order_items(product_id, product_name, quantity, source_line_key, quarantined_at)";
|
|
30
|
+
const [byId, byFo] = await Promise.all([
|
|
31
|
+
localIds.length ? supabase.from("orders").select(sel).in("id", localIds) : Promise.resolve({ data: [] }),
|
|
32
|
+
foIds.length ? supabase.from("orders").select(sel).in("floriday_sales_order_id", foIds) : Promise.resolve({ data: [] }),
|
|
33
|
+
]);
|
|
34
|
+
const orders = [...(byId.data ?? []), ...(byFo.data ?? [])];
|
|
35
|
+
const raws = [];
|
|
36
|
+
const coveredFo = new Set();
|
|
37
|
+
for (const o of orders) {
|
|
38
|
+
const active = (o.order_items ?? []).filter((it) => !it?.quarantined_at);
|
|
39
|
+
if (o.floriday_sales_order_id)
|
|
40
|
+
coveredFo.add(String(o.floriday_sales_order_id));
|
|
41
|
+
for (const it of active) {
|
|
42
|
+
const key = String(it?.source_line_key ?? "");
|
|
43
|
+
raws.push({
|
|
44
|
+
name: str(it?.product_name),
|
|
45
|
+
pieces: Number(it?.quantity) || 0,
|
|
46
|
+
foId: UUID_RE.test(key) ? key : o.floriday_sales_order_id ? String(o.floriday_sales_order_id) : null,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Floriday-orders zonder eigen orderrij: één regel uit de cache.
|
|
51
|
+
for (const f of foIds)
|
|
52
|
+
if (!coveredFo.has(f))
|
|
53
|
+
raws.push({ name: null, pieces: 0, foId: f });
|
|
54
|
+
// Floriday-order → tradeItemId → naam/afbeelding.
|
|
55
|
+
const needFo = Array.from(new Set(raws.map((r) => r.foId).filter(Boolean))).slice(0, 100);
|
|
56
|
+
const foTrade = new Map();
|
|
57
|
+
if (needFo.length) {
|
|
58
|
+
const r = await supabase.from("floriday_salesorders_cache").select("floriday_id, data").in("floriday_id", needFo);
|
|
59
|
+
for (const row of (r.data ?? [])) {
|
|
60
|
+
const d = row.data ?? {};
|
|
61
|
+
foTrade.set(String(row.floriday_id), {
|
|
62
|
+
tradeItemId: String(d.tradeItemId ?? ""),
|
|
63
|
+
pieces: Number(d.numberOfPieces ?? d.quantity ?? 0) || 0,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const tiIds = Array.from(new Set(Array.from(foTrade.values()).map((v) => v.tradeItemId).filter(Boolean)));
|
|
68
|
+
const ti = new Map();
|
|
69
|
+
if (tiIds.length) {
|
|
70
|
+
const r = await supabase.from("floriday_trade_items_cache").select("floriday_id, data").in("floriday_id", tiIds);
|
|
71
|
+
for (const row of (r.data ?? [])) {
|
|
72
|
+
const d = row.data ?? {};
|
|
73
|
+
ti.set(String(row.floriday_id), {
|
|
74
|
+
name: str(d.name) ?? str(d.productName) ?? str(d.tradeItemName),
|
|
75
|
+
imageUrl: firstPhoto(d),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const items = raws.map((r) => {
|
|
80
|
+
const t = r.foId ? foTrade.get(r.foId) : undefined;
|
|
81
|
+
const info = t ? ti.get(t.tradeItemId) : undefined;
|
|
82
|
+
return {
|
|
83
|
+
name: r.name ?? info?.name ?? "Onbekend artikel",
|
|
84
|
+
pieces: r.pieces || t?.pieces || 0,
|
|
85
|
+
imageUrl: info?.imageUrl ?? null,
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
return { items: items.slice(0, MAX_ITEMS), total: items.length };
|
|
89
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-nav.check.d.ts","sourceRoot":"","sources":["../../src/lib/order-nav.check.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
const store = new Map();
|
|
3
|
+
globalThis.window = { sessionStorage: { getItem: (k) => store.get(k) ?? null, setItem: (k, v) => store.set(k, v) } };
|
|
4
|
+
const { saveListNav, neighbours, listHref } = await import("./order-nav.js");
|
|
5
|
+
assert.equal(neighbours("x"), null, "directe link zonder lijst: geen vorige/volgende");
|
|
6
|
+
saveListNav("/floriday-verkoop/verkooporders?periode=week", [
|
|
7
|
+
{ id: "a", memberIds: ["a"] },
|
|
8
|
+
{ id: "b", memberIds: ["b", "b2"] },
|
|
9
|
+
{ id: "c", memberIds: ["c"] },
|
|
10
|
+
]);
|
|
11
|
+
assert.equal(listHref(), "/floriday-verkoop/verkooporders?periode=week", "terug naar exact hetzelfde lijstadres");
|
|
12
|
+
assert.deepEqual(neighbours("a"), { prev: null, next: "b" }, "eerste rij: geen vorige");
|
|
13
|
+
assert.deepEqual(neighbours("c"), { prev: "b", next: null }, "laatste rij: geen volgende (nooit een lege order)");
|
|
14
|
+
assert.deepEqual(neighbours("b2"), { prev: "a", next: "c" }, "order binnen samengevoegde rij volgt de lijstrij");
|
|
15
|
+
assert.equal(neighbours("onbekend"), null, "order niet in de lijst: knoppen verborgen");
|
|
16
|
+
console.log("order-nav: ok");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface OrderNavRow {
|
|
2
|
+
/** Adres-id van de rij (zoals de lijst hem opent). */
|
|
3
|
+
id: string;
|
|
4
|
+
/** Alle orders in deze rij (bij een samengevoegde rij meer dan één). */
|
|
5
|
+
memberIds: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface OrderNavState {
|
|
8
|
+
href: string;
|
|
9
|
+
rows: OrderNavRow[];
|
|
10
|
+
scrollY: number;
|
|
11
|
+
restore?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function saveListNav(href: string, rows: OrderNavRow[]): void;
|
|
14
|
+
export declare function saveListScroll(scrollY: number): void;
|
|
15
|
+
export declare function markRestore(): void;
|
|
16
|
+
/** Eenmalig: scrollpositie terugzetten als we via "Terug" kwamen. */
|
|
17
|
+
export declare function takeRestoreScroll(href: string): number | null;
|
|
18
|
+
export declare function listHref(): string | null;
|
|
19
|
+
/** Vorige/volgende rij rond de geopende order, of null als die niet in de bewaarde lijst staat. */
|
|
20
|
+
export declare function neighbours(currentId: string): {
|
|
21
|
+
prev: string | null;
|
|
22
|
+
next: string | null;
|
|
23
|
+
} | null;
|
|
24
|
+
//# sourceMappingURL=order-nav.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-nav.d.ts","sourceRoot":"","sources":["../../src/lib/order-nav.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,WAAW;IAC1B,sDAAsD;IACtD,EAAE,EAAE,MAAM,CAAC;IACX,wEAAwE;IACxE,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAoBD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,QAG5D;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,QAG7C;AAED,wBAAgB,WAAW,SAG1B;AAED,qEAAqE;AACrE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK7D;AAED,wBAAgB,QAAQ,IAAI,MAAM,GAAG,IAAI,CAExC;AAED,mGAAmG;AACnG,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAMjG"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigatie tussen orderlijst en orderdetail (alleen browser, sessionStorage).
|
|
3
|
+
* De lijst bewaart haar volledige adres (periode, tabblad, filters, zoekterm),
|
|
4
|
+
* de volgorde van de zichtbare rijen en de scrollpositie. Het detail gebruikt
|
|
5
|
+
* dat voor "Terug", Vorige en Volgende. Zonder bewaarde lijst (directe link)
|
|
6
|
+
* zijn Vorige/Volgende verborgen.
|
|
7
|
+
*/
|
|
8
|
+
const KEY = "verkoop:order-nav";
|
|
9
|
+
function read() {
|
|
10
|
+
if (typeof window === "undefined")
|
|
11
|
+
return null;
|
|
12
|
+
try {
|
|
13
|
+
const raw = window.sessionStorage.getItem(KEY);
|
|
14
|
+
return raw ? JSON.parse(raw) : null;
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function write(s) {
|
|
21
|
+
try {
|
|
22
|
+
window.sessionStorage.setItem(KEY, JSON.stringify(s));
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
/* opslag vol of uit: navigatie valt terug op de standaardlijst */
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function saveListNav(href, rows) {
|
|
29
|
+
const prev = read();
|
|
30
|
+
write({ href, rows, scrollY: prev?.href === href ? prev.scrollY : 0 });
|
|
31
|
+
}
|
|
32
|
+
export function saveListScroll(scrollY) {
|
|
33
|
+
const prev = read();
|
|
34
|
+
if (prev)
|
|
35
|
+
write({ ...prev, scrollY });
|
|
36
|
+
}
|
|
37
|
+
export function markRestore() {
|
|
38
|
+
const prev = read();
|
|
39
|
+
if (prev)
|
|
40
|
+
write({ ...prev, restore: true });
|
|
41
|
+
}
|
|
42
|
+
/** Eenmalig: scrollpositie terugzetten als we via "Terug" kwamen. */
|
|
43
|
+
export function takeRestoreScroll(href) {
|
|
44
|
+
const prev = read();
|
|
45
|
+
if (!prev?.restore || prev.href !== href)
|
|
46
|
+
return null;
|
|
47
|
+
write({ ...prev, restore: false });
|
|
48
|
+
return prev.scrollY;
|
|
49
|
+
}
|
|
50
|
+
export function listHref() {
|
|
51
|
+
return read()?.href ?? null;
|
|
52
|
+
}
|
|
53
|
+
/** Vorige/volgende rij rond de geopende order, of null als die niet in de bewaarde lijst staat. */
|
|
54
|
+
export function neighbours(currentId) {
|
|
55
|
+
const s = read();
|
|
56
|
+
if (!s)
|
|
57
|
+
return null;
|
|
58
|
+
const i = s.rows.findIndex((r) => r.id === currentId || r.memberIds.includes(currentId));
|
|
59
|
+
if (i < 0)
|
|
60
|
+
return null;
|
|
61
|
+
return { prev: s.rows[i - 1]?.id ?? null, next: s.rows[i + 1]?.id ?? null };
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-search.check.d.ts","sourceRoot":"","sources":["../../src/lib/order-search.check.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { normalizeSearch, orderMatches, searchTokens } from "./order-search.js";
|
|
2
|
+
const fail = (m) => {
|
|
3
|
+
throw new Error("order-search: " + m);
|
|
4
|
+
};
|
|
5
|
+
if (normalizeSearch(" Café JANSEN ") !== "cafe jansen")
|
|
6
|
+
fail("normalisatie");
|
|
7
|
+
if (searchTokens("a").length !== 0)
|
|
8
|
+
fail("1 letter mag niet zoeken");
|
|
9
|
+
if (searchTokens("7").join() !== "7")
|
|
10
|
+
fail("1 cijfer moet zoeken");
|
|
11
|
+
const o = { orderNumber: "HO-2601412", customer: { name: "Jansen Bloemen" } };
|
|
12
|
+
if (!orderMatches(o, searchTokens("12 jansen")))
|
|
13
|
+
fail("woorden in willekeurige volgorde");
|
|
14
|
+
if (orderMatches(o, searchTokens("jansen 99")))
|
|
15
|
+
fail("alle woorden verplicht");
|
|
16
|
+
console.log("order-search: ok");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Gedeelde zoekregels voor de orderlijst (client en server gelijk). */
|
|
2
|
+
export declare function normalizeSearch(s: string | null | undefined): string;
|
|
3
|
+
/** Zoekwoorden; leeg als de term te kort is (min 2 tekens, cijfers vanaf 1). */
|
|
4
|
+
export declare function searchTokens(term: string | null | undefined): string[];
|
|
5
|
+
/** Alle woorden moeten voorkomen, in willekeurige volgorde. */
|
|
6
|
+
export declare function matchesTokens(haystackNormalized: string, tokens: string[]): boolean;
|
|
7
|
+
export type SearchableOrder = {
|
|
8
|
+
productName?: string | null;
|
|
9
|
+
sku?: string | null;
|
|
10
|
+
orderNumber?: string | null;
|
|
11
|
+
customer?: {
|
|
12
|
+
name?: string | null;
|
|
13
|
+
} | null;
|
|
14
|
+
customerReference?: string | null;
|
|
15
|
+
};
|
|
16
|
+
export declare function orderHaystack(o: SearchableOrder): string;
|
|
17
|
+
export declare function orderMatches(o: SearchableOrder, tokens: string[]): boolean;
|
|
18
|
+
//# sourceMappingURL=order-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-search.d.ts","sourceRoot":"","sources":["../../src/lib/order-search.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAOpE;AAED,gFAAgF;AAChF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAAE,CAKtE;AAED,+DAA+D;AAC/D,wBAAgB,aAAa,CAAC,kBAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAGnF;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IAC3C,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,CAAC;AAGF,wBAAgB,aAAa,CAAC,CAAC,EAAE,eAAe,GAAG,MAAM,CAQxD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAE1E"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Gedeelde zoekregels voor de orderlijst (client en server gelijk). */
|
|
2
|
+
export function normalizeSearch(s) {
|
|
3
|
+
return (s ?? "")
|
|
4
|
+
.normalize("NFD")
|
|
5
|
+
.replace(/[\u0300-\u036f]/g, "")
|
|
6
|
+
.toLowerCase()
|
|
7
|
+
.replace(/\s+/g, " ")
|
|
8
|
+
.trim();
|
|
9
|
+
}
|
|
10
|
+
/** Zoekwoorden; leeg als de term te kort is (min 2 tekens, cijfers vanaf 1). */
|
|
11
|
+
export function searchTokens(term) {
|
|
12
|
+
const n = normalizeSearch(term);
|
|
13
|
+
if (!n)
|
|
14
|
+
return [];
|
|
15
|
+
if (n.length < 2 && !/^\d$/.test(n))
|
|
16
|
+
return [];
|
|
17
|
+
return n.split(" ").filter(Boolean);
|
|
18
|
+
}
|
|
19
|
+
/** Alle woorden moeten voorkomen, in willekeurige volgorde. */
|
|
20
|
+
export function matchesTokens(haystackNormalized, tokens) {
|
|
21
|
+
for (const t of tokens)
|
|
22
|
+
if (!haystackNormalized.includes(t))
|
|
23
|
+
return false;
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
const cache = new WeakMap();
|
|
27
|
+
export function orderHaystack(o) {
|
|
28
|
+
const hit = cache.get(o);
|
|
29
|
+
if (hit !== undefined)
|
|
30
|
+
return hit;
|
|
31
|
+
const h = normalizeSearch(`${o.productName ?? ""} ${o.sku ?? ""} ${o.orderNumber ?? ""} ${o.customer?.name ?? ""} ${o.customerReference ?? ""}`);
|
|
32
|
+
cache.set(o, h);
|
|
33
|
+
return h;
|
|
34
|
+
}
|
|
35
|
+
export function orderMatches(o, tokens) {
|
|
36
|
+
return tokens.length === 0 || matchesTokens(orderHaystack(o), tokens);
|
|
37
|
+
}
|