@flowselections/floriday-verkoop-module 1.0.159 → 1.0.160

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.
@@ -1 +1 @@
1
- {"version":3,"file":"VerkoopOrdersPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/VerkoopOrdersPage.tsx"],"names":[],"mappings":"AAmRA,wBAAgB,iBAAiB,gCA0iChC"}
1
+ {"version":3,"file":"VerkoopOrdersPage.d.ts","sourceRoot":"","sources":["../../../src/components/verkoop/VerkoopOrdersPage.tsx"],"names":[],"mappings":"AAqRA,wBAAgB,iBAAiB,gCAyjChC"}
@@ -13,6 +13,8 @@ import { saveListNav, saveListScroll, takeRestoreScroll } from "../../lib/order-
13
13
  import { useQuery, useQueryClient } from "@tanstack/react-query";
14
14
  import { supabase } from "../../integrations/supabase/client.js";
15
15
  import { getFloridaySyncHealth } from "../../lib/salesorders.functions.js";
16
+ import { getVerkoopSyncMelding } from "../../lib/sync-melding.functions.js";
17
+ import { syncMeldingTekst } from "../../lib/sync-melding.js";
16
18
  import { amsterdamYmd, periodFromSearch, periodRange, periodToSearch, shiftPeriod, ymdString } from "../../lib/period-range.js";
17
19
  import { isSessionError } from "../../lib/session-error.js";
18
20
  import { animateIn, transitionStyle } from "../../lib/motion.js";
@@ -216,6 +218,14 @@ export function VerkoopOrdersPage() {
216
218
  refetchInterval: 120000,
217
219
  retry: 1,
218
220
  });
221
+ const fetchSyncMelding = useServerFn(getVerkoopSyncMelding);
222
+ const { data: syncMelding } = useQuery({
223
+ queryKey: ["verkoop-sync-melding"],
224
+ queryFn: () => fetchSyncMelding(),
225
+ refetchInterval: 120000,
226
+ retry: 1,
227
+ });
228
+ const syncMeldingZin = syncMeldingTekst(syncMelding);
219
229
  const triggerDeleteOrder = useServerFn(deleteLocalOrder);
220
230
  const triggerCancelOrder = useServerFn(cancelLocalOrder);
221
231
  const triggerMarkShipped = useServerFn(markOrdersShipped);
@@ -630,7 +640,7 @@ export function VerkoopOrdersPage() {
630
640
  ? fmtNLDefault(syncHealth.lastSuccessAt)
631
641
  : "nog nooit", syncHealth.lastError ? ` — ${syncHealth.lastError}` : "", syncHealth.failingComponents && syncHealth.failingComponents.length > 0
632
642
  ? ` — onderdelen die stilliggen: ${syncHealth.failingComponents.join(", ")}`
633
- : ""] })] }), _jsx(ChevronDown, { className: "h-4 w-4 shrink-0 text-muted-foreground transition-transform md:hidden " + (syncOpen ? "rotate-180" : ""), "aria-hidden": true }), _jsx("span", { className: (syncOpen ? "block " : "hidden ") + "w-full text-xs text-muted-foreground md:inline md:w-auto", children: "Handmatig ophalen kan via Instellingen \u203A Floriday." })] })), _jsxs("section", { "aria-label": "Kerncijfers", className: KPI_GRID_CLASS, children: [_jsx(KpiTile, { title: "Omzet", loading: isLoading, icon: _jsx(Euro, { className: "h-5 w-5" }), value: _jsx(Crossfade, { value: eur0(totals.revenue) }), sub: `excl. btw · gem. ${eur0(totals.orderCount ? totals.revenue / totals.orderCount : 0)} per order`, trend: tab === "all" && !kpi ? trendOf(totals.revenue, prevData?.totals?.revenue) : null }), _jsx(KpiTile, { title: "Orders", loading: isLoading, icon: _jsx(ShoppingCart, { className: "h-5 w-5" }), value: _jsx(Crossfade, { value: Math.max(0, kpiCounts.all - kpiCounts.cancelled).toLocaleString("nl-NL") }), sub: `${kpiCounts.incoming} inkomend · ${kpiCounts.topick} te picken`, trend: trendOf(Math.max(0, kpiCounts.all - kpiCounts.cancelled), prevData?.statusCounts ? Math.max(0, (prevData.statusCounts.all ?? 0) - (prevData.statusCounts.cancelled ?? 0)) : undefined), onClick: () => setTab("all") }), _jsx(KpiTile, { title: "Fust", loading: isLoading, icon: _jsx(Layers, { className: "h-5 w-5" }), value: _jsx(Crossfade, { value: totals.fustCount.toLocaleString("nl-NL") }), sub: tab === "all" ? "in deze periode" : "in dit tabblad", trend: tab === "all" && !kpi ? trendOf(totals.fustCount, prevData?.totals?.fustCount) : null }), _jsx(KpiTile, { title: "Actie nodig", loading: isLoading, icon: _jsx(AlertTriangle, { className: "h-5 w-5" }), tone: "warning", active: tab === "backlog" || tab === "problem", onClick: () => toggleTab(kpiCounts.backlog > 0 || !features.pickProgress ? "backlog" : "problem"), value: _jsx(Crossfade, { value: (kpiCounts.backlog + kpiCounts.problem).toLocaleString("nl-NL") }), sub: _jsxs("span", { className: "flex flex-wrap items-center gap-x-1", children: [_jsxs("button", { type: "button", "aria-pressed": tab === "backlog", onClick: (e) => {
643
+ : ""] })] }), _jsx(ChevronDown, { className: "h-4 w-4 shrink-0 text-muted-foreground transition-transform md:hidden " + (syncOpen ? "rotate-180" : ""), "aria-hidden": true }), _jsx("span", { className: (syncOpen ? "block " : "hidden ") + "w-full text-xs text-muted-foreground md:inline md:w-auto", children: "Handmatig ophalen kan via Instellingen \u203A Floriday." })] })), syncMeldingZin && !syncHealth?.stale && (_jsxs("div", { role: "alert", className: "shrink-0 flex items-start gap-3 rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3 text-sm", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0 text-destructive", "aria-hidden": true }), _jsx("span", { className: "min-w-0 flex-1 font-semibold", children: syncMeldingZin })] })), _jsxs("section", { "aria-label": "Kerncijfers", className: KPI_GRID_CLASS, children: [_jsx(KpiTile, { title: "Omzet", loading: isLoading, icon: _jsx(Euro, { className: "h-5 w-5" }), value: _jsx(Crossfade, { value: eur0(totals.revenue) }), sub: `excl. btw · gem. ${eur0(totals.orderCount ? totals.revenue / totals.orderCount : 0)} per order`, trend: tab === "all" && !kpi ? trendOf(totals.revenue, prevData?.totals?.revenue) : null }), _jsx(KpiTile, { title: "Orders", loading: isLoading, icon: _jsx(ShoppingCart, { className: "h-5 w-5" }), value: _jsx(Crossfade, { value: Math.max(0, kpiCounts.all - kpiCounts.cancelled).toLocaleString("nl-NL") }), sub: `${kpiCounts.incoming} inkomend · ${kpiCounts.topick} te picken`, trend: trendOf(Math.max(0, kpiCounts.all - kpiCounts.cancelled), prevData?.statusCounts ? Math.max(0, (prevData.statusCounts.all ?? 0) - (prevData.statusCounts.cancelled ?? 0)) : undefined), onClick: () => setTab("all") }), _jsx(KpiTile, { title: "Fust", loading: isLoading, icon: _jsx(Layers, { className: "h-5 w-5" }), value: _jsx(Crossfade, { value: totals.fustCount.toLocaleString("nl-NL") }), sub: tab === "all" ? "in deze periode" : "in dit tabblad", trend: tab === "all" && !kpi ? trendOf(totals.fustCount, prevData?.totals?.fustCount) : null }), _jsx(KpiTile, { title: "Actie nodig", loading: isLoading, icon: _jsx(AlertTriangle, { className: "h-5 w-5" }), tone: "warning", active: tab === "backlog" || tab === "problem", onClick: () => toggleTab(kpiCounts.backlog > 0 || !features.pickProgress ? "backlog" : "problem"), value: _jsx(Crossfade, { value: (kpiCounts.backlog + kpiCounts.problem).toLocaleString("nl-NL") }), sub: _jsxs("span", { className: "flex flex-wrap items-center gap-x-1", children: [_jsxs("button", { type: "button", "aria-pressed": tab === "backlog", onClick: (e) => {
634
644
  e.stopPropagation();
635
645
  toggleTab("backlog");
636
646
  }, className: "rounded-sm font-medium text-destructive underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: [kpiCounts.backlog, " te laat"] }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsx("button", { type: "button", "aria-pressed": tab === "problem", onClick: (e) => {