@flowselections/pick-schermen-kwekers 1.0.62 → 1.0.66
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/pick/PickScherm.d.ts.map +1 -1
- package/dist-lib/components/pick/PickScherm.js +22 -7
- package/dist-lib/components/pick/QueueTable.d.ts +5 -1
- package/dist-lib/components/pick/QueueTable.d.ts.map +1 -1
- package/dist-lib/components/pick/QueueTable.js +14 -31
- package/dist-lib/components/pick/StickerReprintButton.d.ts.map +1 -1
- package/dist-lib/components/pick/StickerReprintButton.js +2 -1
- package/dist-lib/components/pick/StickerState.d.ts.map +1 -1
- package/dist-lib/components/pick/StickerState.js +7 -5
- package/dist-lib/hooks/useCartStickerStates.d.ts +8 -0
- package/dist-lib/hooks/useCartStickerStates.d.ts.map +1 -0
- package/dist-lib/hooks/useCartStickerStates.js +41 -0
- package/dist-lib/hooks/usePickPrintStatus.d.ts +14 -0
- package/dist-lib/hooks/usePickPrintStatus.d.ts.map +1 -0
- package/dist-lib/hooks/usePickPrintStatus.js +47 -0
- package/dist-lib/hooks/usePickQueue.d.ts +2 -0
- package/dist-lib/hooks/usePickQueue.d.ts.map +1 -1
- package/dist-lib/hooks/usePickQueue.js +29 -8
- package/dist-lib/integrations/supabase/types.d.ts +585 -2
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.js +1 -0
- package/dist-lib/lib/__tests__/pick143.test.js +1 -1
- package/dist-lib/lib/__tests__/pick163.test.d.ts +2 -0
- package/dist-lib/lib/__tests__/pick163.test.d.ts.map +1 -0
- package/dist-lib/lib/__tests__/pick163.test.js +68 -0
- package/dist-lib/lib/__tests__/pickStickerBundle.test.d.ts +2 -0
- package/dist-lib/lib/__tests__/pickStickerBundle.test.d.ts.map +1 -0
- package/dist-lib/lib/__tests__/pickStickerBundle.test.js +27 -0
- package/dist-lib/lib/pick143.d.ts +7 -2
- package/dist-lib/lib/pick143.d.ts.map +1 -1
- package/dist-lib/lib/pick143.js +24 -5
- package/dist-lib/lib/pick159.js +1 -1
- package/dist-lib/lib/pickPerf.d.ts +11 -0
- package/dist-lib/lib/pickPerf.d.ts.map +1 -0
- package/dist-lib/lib/pickPerf.js +35 -0
- package/dist-lib/lib/pickPrintStatus.d.ts +36 -0
- package/dist-lib/lib/pickPrintStatus.d.ts.map +1 -0
- package/dist-lib/lib/pickPrintStatus.js +98 -0
- package/dist-lib/lib/pickRowState.d.ts +2 -1
- package/dist-lib/lib/pickRowState.d.ts.map +1 -1
- package/dist-lib/lib/pickRowState.js +4 -2
- package/dist-lib/lib/pickStickerBundle.d.ts +16 -0
- package/dist-lib/lib/pickStickerBundle.d.ts.map +1 -0
- package/dist-lib/lib/pickStickerBundle.js +36 -0
- package/package.json +7 -2
- package/schema/pickschermen.sql +5315 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
3
|
import { pickApi, pickDb } from "../lib/pickApi.js";
|
|
4
4
|
import { safeArray } from "../lib/pickTypes.js";
|
|
5
|
+
import { isRowOpen } from "../lib/pick143.js";
|
|
6
|
+
import { pickMark, pickMeasure } from "../lib/pickPerf.js";
|
|
5
7
|
export const defaultFilters = {
|
|
6
8
|
country: null,
|
|
7
9
|
search: "",
|
|
@@ -64,7 +66,7 @@ export function usePickQueue(args) {
|
|
|
64
66
|
const pickDayQuery = useQuery({
|
|
65
67
|
queryKey: ["pick", "pickDay"],
|
|
66
68
|
enabled: enabled && !syncQuery.isLoading,
|
|
67
|
-
queryFn: () => pickApi.currentPickDay(),
|
|
69
|
+
queryFn: () => pickMeasure("pickdag", () => pickApi.currentPickDay()),
|
|
68
70
|
staleTime: 30000,
|
|
69
71
|
});
|
|
70
72
|
const pickDay = pickDayOverride ?? pickDayQuery.data ?? null;
|
|
@@ -96,7 +98,7 @@ export function usePickQueue(args) {
|
|
|
96
98
|
queryKey: key,
|
|
97
99
|
// Pas laden als de pickdag bekend is, anders flitst een oude lijst.
|
|
98
100
|
enabled: enabled && (pickDayOverride != null || pickDayQuery.isFetched),
|
|
99
|
-
queryFn: () => pickApi.queue({
|
|
101
|
+
queryFn: () => pickMeasure("wachtrij", () => pickApi.queue({
|
|
100
102
|
stationId,
|
|
101
103
|
screenId,
|
|
102
104
|
country: filters.country,
|
|
@@ -108,15 +110,16 @@ export function usePickQueue(args) {
|
|
|
108
110
|
sortRules: filters.sortRules,
|
|
109
111
|
page: filters.page,
|
|
110
112
|
pageSize: filters.pageSize,
|
|
111
|
-
}),
|
|
113
|
+
})),
|
|
112
114
|
// Vorige lijst alleen vasthouden bij filteren/bladeren binnen hetzelfde station en dezelfde pickdag.
|
|
113
115
|
placeholderData: (prev, prevQuery) => (prevQuery && sameQueueScope(prevQuery.queryKey, key) ? prev : undefined),
|
|
114
116
|
});
|
|
115
117
|
const countsQuery = useQuery({
|
|
116
118
|
queryKey: ["pick", "dayCounts", stationId ?? "-", screenId ?? "-", pickDay ?? "-"],
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
// 1.0.63: pas tellen als de pickdag bekend is (anders telt de database alle
|
|
120
|
+
// dagen en springt de kopregel), en geen oude telling van een andere dag tonen.
|
|
121
|
+
enabled: enabled && pickDay != null,
|
|
122
|
+
queryFn: () => pickMeasure("dagtelling", () => pickApi.dayCounts({ stationId, screenId, pickDay })),
|
|
120
123
|
});
|
|
121
124
|
// Locks komen primair via realtime binnen; deze poll is alleen terugval.
|
|
122
125
|
const locksQuery = useQuery({
|
|
@@ -131,6 +134,7 @@ export function usePickQueue(args) {
|
|
|
131
134
|
queryClient.invalidateQueries({ queryKey: ["pick", "dayCounts"] });
|
|
132
135
|
queryClient.invalidateQueries({ queryKey: ["pick", "countryCounts"] });
|
|
133
136
|
queryClient.invalidateQueries({ queryKey: ["pick", "dashboard"] });
|
|
137
|
+
queryClient.invalidateQueries({ queryKey: ["pick", "printStatus"] });
|
|
134
138
|
}, [queryClient]);
|
|
135
139
|
/**
|
|
136
140
|
* Realtime-meldingen komen bij een Engine-sync in tientallen tegelijk binnen.
|
|
@@ -175,14 +179,31 @@ export function usePickQueue(args) {
|
|
|
175
179
|
pickDb.removeChannel(channel);
|
|
176
180
|
};
|
|
177
181
|
}, [enabled, stationId, invalidate]);
|
|
182
|
+
// Laadtijd: van openen tot de eerste lijst binnen is.
|
|
183
|
+
useEffect(() => {
|
|
184
|
+
if (enabled)
|
|
185
|
+
pickMark("start");
|
|
186
|
+
}, [enabled]);
|
|
187
|
+
const firstReady = useRef(false);
|
|
188
|
+
useEffect(() => {
|
|
189
|
+
if (!firstReady.current && queueQuery.isSuccess) {
|
|
190
|
+
firstReady.current = true;
|
|
191
|
+
pickMark("lijst-klaar");
|
|
192
|
+
}
|
|
193
|
+
}, [queueQuery.isSuccess]);
|
|
194
|
+
// Afgeronde of geannuleerde rijen (bv. na een kar-vervanging) nooit tonen,
|
|
195
|
+
// ook niet uit de vastgehouden vorige lijst.
|
|
196
|
+
const openItems = useMemo(() => safeArray(queueQuery.data?.items).filter((i) => isRowOpen(i)), [queueQuery.data]);
|
|
178
197
|
const lockedIds = useMemo(() => new Set(safeArray(locksQuery.data).map((l) => l.queue_item_id)), [locksQuery.data]);
|
|
179
198
|
return {
|
|
180
|
-
items:
|
|
199
|
+
items: openItems,
|
|
181
200
|
total: queueQuery.data?.total ?? 0,
|
|
182
201
|
pickDay,
|
|
183
202
|
pendingCount: countsQuery.data?.pending ?? 0,
|
|
184
203
|
printedCount: countsQuery.data?.printed ?? 0,
|
|
185
204
|
urgentCount: countsQuery.data?.urgent ?? 0,
|
|
205
|
+
/** Tellingen nog niet geladen: kopregel toont "…". */
|
|
206
|
+
countsLoading: countsQuery.data === undefined,
|
|
186
207
|
loading: queueQuery.isPending,
|
|
187
208
|
error: queueQuery.error instanceof Error ? queueQuery.error.message : null,
|
|
188
209
|
lockedIds,
|