@flowselections/pick-schermen-kwekers 1.0.10 → 1.0.12
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/README.md +24 -24
- package/dist-lib/components/PickPublicPage.js +1 -1
- package/dist-lib/components/PickstationsPage.d.ts.map +1 -1
- package/dist-lib/components/PickstationsPage.js +23 -8
- package/dist-lib/components/TemplateModulePage.d.ts +2 -0
- package/dist-lib/components/TemplateModulePage.d.ts.map +1 -0
- package/dist-lib/components/TemplateModulePage.js +44 -0
- package/dist-lib/components/pick/LanguageTiles.d.ts.map +1 -1
- package/dist-lib/components/pick/LanguageTiles.js +3 -3
- package/dist-lib/components/pick/PickScherm.d.ts.map +1 -1
- package/dist-lib/components/pick/PickScherm.js +73 -11
- package/dist-lib/components/pick/QueueTable.d.ts.map +1 -1
- package/dist-lib/components/pick/QueueTable.js +22 -12
- package/dist-lib/hooks/usePickConfig.d.ts +6 -0
- package/dist-lib/hooks/usePickConfig.d.ts.map +1 -1
- package/dist-lib/hooks/usePickConfig.js +19 -0
- package/dist-lib/hooks/usePickQueue.d.ts +4 -0
- package/dist-lib/hooks/usePickQueue.d.ts.map +1 -1
- package/dist-lib/hooks/usePickQueue.js +38 -7
- package/dist-lib/hooks/usePrintJob.d.ts.map +1 -1
- package/dist-lib/hooks/usePrintJob.js +13 -2
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +2084 -310
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +2084 -310
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.js +2 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +2084 -310
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/previewAuthStorage.d.ts +6 -0
- package/dist-lib/integrations/supabase/previewAuthStorage.d.ts.map +1 -0
- package/dist-lib/integrations/supabase/previewAuthStorage.js +92 -0
- package/dist-lib/integrations/supabase/types.d.ts +2168 -351
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.js +3 -0
- package/dist-lib/lib/layoutMaker/pakbonHtml.js +49 -49
- package/dist-lib/lib/layoutRenderer.js +17 -17
- package/dist-lib/lib/pickApi.d.ts +20 -5
- package/dist-lib/lib/pickApi.d.ts.map +1 -1
- package/dist-lib/lib/pickApi.js +76 -17
- package/dist-lib/lib/pickTypes.d.ts +15 -0
- package/dist-lib/lib/pickTypes.d.ts.map +1 -1
- package/dist-lib/lib/pickUiText.d.ts +29 -0
- package/dist-lib/lib/pickUiText.d.ts.map +1 -0
- package/dist-lib/lib/pickUiText.js +71 -0
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ export const defaultFilters = {
|
|
|
7
7
|
search: "",
|
|
8
8
|
documentTypeId: null,
|
|
9
9
|
urgentOnly: false,
|
|
10
|
+
onlyPending: false,
|
|
10
11
|
page: 0,
|
|
11
12
|
pageSize: 25,
|
|
12
13
|
sortRules: [],
|
|
@@ -56,7 +57,7 @@ export function usePickQueue(args) {
|
|
|
56
57
|
search: filters.search.trim() || undefined,
|
|
57
58
|
documentTypeId: filters.documentTypeId,
|
|
58
59
|
urgentOnly: filters.urgentOnly,
|
|
59
|
-
includeDone:
|
|
60
|
+
includeDone: !filters.onlyPending,
|
|
60
61
|
pickDay,
|
|
61
62
|
sortRules: filters.sortRules,
|
|
62
63
|
page: filters.page,
|
|
@@ -68,27 +69,55 @@ export function usePickQueue(args) {
|
|
|
68
69
|
enabled: enabled && !pickDayQuery.isLoading,
|
|
69
70
|
queryFn: () => pickApi.dayCounts({ stationId, screenId, pickDay }),
|
|
70
71
|
});
|
|
72
|
+
// Locks komen primair via realtime binnen; deze poll is alleen terugval.
|
|
71
73
|
const locksQuery = useQuery({
|
|
72
74
|
queryKey: ["pick", "locks", stationId ?? "-"],
|
|
73
75
|
enabled,
|
|
74
76
|
queryFn: () => pickApi.locks(stationId),
|
|
75
|
-
refetchInterval:
|
|
77
|
+
refetchInterval: 20000,
|
|
76
78
|
});
|
|
77
|
-
const
|
|
79
|
+
const invalidateNow = useCallback(() => {
|
|
78
80
|
queryClient.invalidateQueries({ queryKey: ["pick", "queue"] });
|
|
79
81
|
queryClient.invalidateQueries({ queryKey: ["pick", "locks"] });
|
|
80
82
|
queryClient.invalidateQueries({ queryKey: ["pick", "dayCounts"] });
|
|
81
83
|
queryClient.invalidateQueries({ queryKey: ["pick", "countryCounts"] });
|
|
82
84
|
queryClient.invalidateQueries({ queryKey: ["pick", "dashboard"] });
|
|
83
85
|
}, [queryClient]);
|
|
86
|
+
/**
|
|
87
|
+
* Realtime-meldingen komen bij een Engine-sync in tientallen tegelijk binnen.
|
|
88
|
+
* Samenvoegen tot één herlaadslag houdt het scherm rustig en snel.
|
|
89
|
+
*/
|
|
90
|
+
const debounceTimer = useRef(null);
|
|
91
|
+
const invalidate = useCallback(() => {
|
|
92
|
+
if (debounceTimer.current)
|
|
93
|
+
clearTimeout(debounceTimer.current);
|
|
94
|
+
debounceTimer.current = setTimeout(() => {
|
|
95
|
+
debounceTimer.current = null;
|
|
96
|
+
invalidateNow();
|
|
97
|
+
}, 400);
|
|
98
|
+
}, [invalidateNow]);
|
|
99
|
+
useEffect(() => () => {
|
|
100
|
+
if (debounceTimer.current)
|
|
101
|
+
clearTimeout(debounceTimer.current);
|
|
102
|
+
}, []);
|
|
103
|
+
const [realtimeOk, setRealtimeOk] = useState(true);
|
|
84
104
|
useEffect(() => {
|
|
85
105
|
if (!enabled)
|
|
86
106
|
return;
|
|
107
|
+
// Alleen meldingen van dit station: andere stations mogen dit scherm niet belasten.
|
|
108
|
+
const queueFilter = stationId
|
|
109
|
+
? { event: "*", schema: "public", table: "pick_queue", filter: `station_id=eq.${stationId}` }
|
|
110
|
+
: { event: "*", schema: "public", table: "pick_queue" };
|
|
111
|
+
const lockFilter = stationId
|
|
112
|
+
? { event: "*", schema: "public", table: "pick_queue_locks", filter: `station_id=eq.${stationId}` }
|
|
113
|
+
: { event: "*", schema: "public", table: "pick_queue_locks" };
|
|
87
114
|
const channel = pickDb
|
|
88
115
|
.channel(`pick-queue-${stationId ?? "all"}`)
|
|
89
|
-
.on("postgres_changes",
|
|
90
|
-
.on("postgres_changes",
|
|
91
|
-
.subscribe()
|
|
116
|
+
.on("postgres_changes", queueFilter, invalidate)
|
|
117
|
+
.on("postgres_changes", lockFilter, invalidate)
|
|
118
|
+
.subscribe((status) => {
|
|
119
|
+
setRealtimeOk(status === "SUBSCRIBED");
|
|
120
|
+
});
|
|
92
121
|
return () => {
|
|
93
122
|
pickDb.removeChannel(channel);
|
|
94
123
|
};
|
|
@@ -100,10 +129,12 @@ export function usePickQueue(args) {
|
|
|
100
129
|
pickDay,
|
|
101
130
|
pendingCount: countsQuery.data?.pending ?? 0,
|
|
102
131
|
printedCount: countsQuery.data?.printed ?? 0,
|
|
132
|
+
urgentCount: countsQuery.data?.urgent ?? 0,
|
|
103
133
|
loading: queueQuery.isLoading,
|
|
104
134
|
error: queueQuery.error instanceof Error ? queueQuery.error.message : null,
|
|
105
135
|
lockedIds,
|
|
106
|
-
|
|
136
|
+
realtimeOk,
|
|
137
|
+
refresh: invalidateNow,
|
|
107
138
|
};
|
|
108
139
|
}
|
|
109
140
|
/** Houdt bij dat dit scherm online is en ruimt verlopen locks op. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePrintJob.d.ts","sourceRoot":"","sources":["../../src/hooks/usePrintJob.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,GAAG,EAAE,YAAY,GAAG,IAAI,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,WAAW;;kBAKhB;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;;
|
|
1
|
+
{"version":3,"file":"usePrintJob.d.ts","sourceRoot":"","sources":["../../src/hooks/usePrintJob.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,GAAG,EAAE,YAAY,GAAG,IAAI,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,WAAW;;kBAKhB;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;;EA2D/E"}
|
|
@@ -21,26 +21,37 @@ export function usePrintJob() {
|
|
|
21
21
|
if (!jobId)
|
|
22
22
|
return;
|
|
23
23
|
let stopped = false;
|
|
24
|
+
let timer = null;
|
|
25
|
+
const stopPolling = () => {
|
|
26
|
+
if (timer !== null) {
|
|
27
|
+
window.clearInterval(timer);
|
|
28
|
+
timer = null;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
24
31
|
const read = async () => {
|
|
25
32
|
try {
|
|
26
33
|
const job = await pickApi.printJobStatus(jobId);
|
|
27
34
|
if (stopped || jobIdRef.current !== jobId)
|
|
28
35
|
return;
|
|
29
36
|
setTracked((prev) => (prev && prev.jobId === jobId ? { ...prev, job } : prev));
|
|
37
|
+
// Eindstatus bereikt: niet meer blijven pollen.
|
|
38
|
+
if (job && ["voltooid", "mislukt", "geannuleerd"].includes(job.status))
|
|
39
|
+
stopPolling();
|
|
30
40
|
}
|
|
31
41
|
catch {
|
|
32
42
|
// status tijdelijk niet leesbaar; volgende poging volgt
|
|
33
43
|
}
|
|
34
44
|
};
|
|
35
45
|
void read();
|
|
36
|
-
|
|
46
|
+
// Realtime is de bron; de poll is alleen terugval als er niets binnenkomt.
|
|
47
|
+
timer = window.setInterval(read, 10000);
|
|
37
48
|
const channel = pickDb
|
|
38
49
|
.channel(`print_job_${jobId}`)
|
|
39
50
|
.on("postgres_changes", { event: "*", schema: "public", table: "print_jobs", filter: `id=eq.${jobId}` }, () => void read())
|
|
40
51
|
.subscribe();
|
|
41
52
|
return () => {
|
|
42
53
|
stopped = true;
|
|
43
|
-
|
|
54
|
+
stopPolling();
|
|
44
55
|
pickDb.removeChannel(channel);
|
|
45
56
|
};
|
|
46
57
|
}, [jobId]);
|