@flowselections/pick-schermen-kwekers 1.0.55 → 1.0.57

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":"PickstationsPage.d.ts","sourceRoot":"","sources":["../../src/components/PickstationsPage.tsx"],"names":[],"mappings":"AAiGA,wBAAgB,gBAAgB,gCA2L/B"}
1
+ {"version":3,"file":"PickstationsPage.d.ts","sourceRoot":"","sources":["../../src/components/PickstationsPage.tsx"],"names":[],"mappings":"AAkGA,wBAAgB,gBAAgB,gCA4L/B"}
@@ -7,6 +7,7 @@ import { pickApi } from "../lib/pickApi.js";
7
7
  import { usePickStations } from "../hooks/usePickConfig.js";
8
8
  import { useKoppelingVoorBron } from "../hooks/useKoppelingVoorBron.js";
9
9
  import { ReferentiedataBanner } from "./pick/ReferentiedataBanner.js";
10
+ import { DOCUMENT_AUTO_TEXT } from "../lib/pick156.js";
10
11
  const emptyDraft = { name: "", description: "", active: true };
11
12
  function publicUrl(slug) {
12
13
  const origin = typeof window !== "undefined" ? window.location.origin : "";
@@ -60,7 +61,7 @@ export function PickstationsPage() {
60
61
  return (_jsxs("main", { className: "space-y-6 p-6", children: [_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-2xl font-bold text-foreground", children: "Pickstations" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "Beheer je pickstations en de link die je met de medewerkers deelt." })] }), _jsxs(Button, { onClick: () => setDraft({ ...emptyDraft }), children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), " Nieuw pickstation"] })] }), _jsx(ReferentiedataBanner, {}), isLoading ? (_jsxs("div", { className: "flex items-center gap-2 text-muted-foreground", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin" }), " Laden..."] })) : safeStations.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "Nog geen pickstations." })) : (_jsx("div", { className: "grid gap-4 sm:grid-cols-2 xl:grid-cols-3", children: safeStations.map((station) => (_jsx(Card, { className: "border-2", children: _jsxs(CardContent, { className: "space-y-4 p-6", children: [_jsxs("div", { className: "flex items-start justify-between gap-2", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-lg font-semibold text-foreground", children: station.name }), _jsx("p", { className: "text-sm text-muted-foreground", children: station.description })] }), _jsx("span", { className: "rounded-full px-2 py-1 text-xs font-medium " +
61
62
  (station.active
62
63
  ? "bg-primary/10 text-primary"
63
- : "bg-muted text-muted-foreground"), children: station.active ? "Actief" : "Inactief" })] }), _jsx("code", { className: "block truncate rounded bg-muted px-2 py-1 text-xs text-muted-foreground", children: publicUrl(station.slug) }), _jsx(StationPrintplek, { station: station }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsx(Button, { className: "flex-1", asChild: true, children: _jsxs("a", { href: publicUrl(station.slug), target: "_blank", rel: "noreferrer", children: [_jsx(ExternalLink, { className: "mr-2 h-4 w-4" }), " Open pickstation"] }) }), _jsxs(Button, { variant: "outline", onClick: () => copyLink(station), children: [_jsx(Copy, { className: "mr-2 h-4 w-4" }), " Link kopi\u00EBren"] })] }), _jsxs("div", { className: "flex gap-2", children: [_jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setDraft({
64
+ : "bg-muted text-muted-foreground"), children: station.active ? "Actief" : "Inactief" })] }), _jsx("code", { className: "block truncate rounded bg-muted px-2 py-1 text-xs text-muted-foreground", children: publicUrl(station.slug) }), _jsx(StationPrintplek, { station: station }), _jsx("p", { className: "text-sm text-muted-foreground", children: DOCUMENT_AUTO_TEXT }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsx(Button, { className: "flex-1", asChild: true, children: _jsxs("a", { href: publicUrl(station.slug), target: "_blank", rel: "noreferrer", children: [_jsx(ExternalLink, { className: "mr-2 h-4 w-4" }), " Open pickstation"] }) }), _jsxs(Button, { variant: "outline", onClick: () => copyLink(station), children: [_jsx(Copy, { className: "mr-2 h-4 w-4" }), " Link kopi\u00EBren"] })] }), _jsxs("div", { className: "flex gap-2", children: [_jsxs(Button, { variant: "ghost", size: "sm", onClick: () => setDraft({
64
65
  id: station.id,
65
66
  name: station.name,
66
67
  description: station.description ?? "",
@@ -0,0 +1,12 @@
1
+ import { type DocumentChoice } from "../../lib/pick156.js";
2
+ export declare function useDocumentChoice(params: {
3
+ queueItemId: string | null;
4
+ payload: unknown;
5
+ documentType: string;
6
+ slug: string | null;
7
+ }): import("@tanstack/react-query").UseQueryResult<DocumentChoice, Error>;
8
+ export declare function DocumentChoiceMelding({ choice, isError }: {
9
+ choice: DocumentChoice | undefined;
10
+ isError: boolean;
11
+ }): import("react").JSX.Element | null;
12
+ //# sourceMappingURL=DocumentChoiceMelding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentChoiceMelding.d.ts","sourceRoot":"","sources":["../../../src/components/pick/DocumentChoiceMelding.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAgD,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEtG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,yEAeA;AAED,wBAAgB,qBAAqB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;IAAE,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,sCAclH"}
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { AlertTriangle } from "lucide-react";
4
+ import { DOCUMENT_CHOICE_UNKNOWN, fetchDocumentChoice } from "../../lib/pick156.js";
5
+ export function useDocumentChoice(params) {
6
+ return useQuery({
7
+ queryKey: ["pick", "document-choice", params.queueItemId, params.documentType, params.slug],
8
+ queryFn: () => fetchDocumentChoice({
9
+ queueItemId: params.queueItemId,
10
+ payload: params.payload,
11
+ documentType: params.documentType,
12
+ slug: params.slug,
13
+ }),
14
+ enabled: Boolean(params.queueItemId),
15
+ refetchInterval: 30000,
16
+ placeholderData: (prev) => prev,
17
+ retry: 1,
18
+ });
19
+ }
20
+ export function DocumentChoiceMelding({ choice, isError }) {
21
+ if (isError || choice?.state === "unknown") {
22
+ return _jsx("p", { className: "mb-3 text-xs text-muted-foreground", children: DOCUMENT_CHOICE_UNKNOWN });
23
+ }
24
+ if (choice?.state !== "blocked")
25
+ return null;
26
+ return (_jsxs("div", { role: "alert", className: "mb-3 flex items-start gap-2 rounded-md border-2 border-destructive/50 bg-destructive/10 p-2 text-sm text-foreground", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0 text-destructive" }), _jsxs("div", { children: [_jsx("p", { children: choice.reden }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Dit document wordt niet geprint. De rest van de order gaat gewoon door." })] })] }));
27
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"PickScherm.d.ts","sourceRoot":"","sources":["../../../src/components/pick/PickScherm.tsx"],"names":[],"mappings":"AA0DA,OAAO,EAaL,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAC;AAyD7B,UAAU,KAAK;IACb,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAwBD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,+BA2pEpD"}
1
+ {"version":3,"file":"PickScherm.d.ts","sourceRoot":"","sources":["../../../src/components/pick/PickScherm.tsx"],"names":[],"mappings":"AA0DA,OAAO,EAaL,KAAK,WAAW,EACjB,MAAM,qBAAqB,CAAC;AA2D7B,UAAU,KAAK;IACb,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAwBD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,+BAkqEpD"}
@@ -13,7 +13,7 @@ import { ShippingNoteScan } from "./ShippingNoteScan.js";
13
13
  import { getSessionId, pickApi } from "../../lib/pickApi.js";
14
14
  import { sendLogisticsEvent } from "../../lib/logisticsApi.js";
15
15
  import { CART_PLAN_MISMATCH_MESSAGE, formatSiteTime, WORKDAYS_UNKNOWN, autoSendMessage, fetchAutoSend, isPickWorkday, mismatchReason, nextWorkday, printErrorText, PRINT_FAILED_HINT, printStageLabel, siteTimeZone, siteToday, } from "../../lib/pick142.js";
16
- import { completeLogisticsTaskForItem } from "../../lib/pickPrint.js";
16
+ import { completeLogisticsTaskForItem, documentTypeOf } from "../../lib/pickPrint.js";
17
17
  import { cartRowOf, isPdfOnlyFailure, pickReadiness, printedCartIdsOf, pdfSaveWarning, unitRefOf, statusRefOf, unitTitleOf, } from "../../lib/pickTypes.js";
18
18
  import { rowFingerprint, rowsToVerify } from "../../lib/pickVerify.js";
19
19
  import { alreadyPrintedResults, CART_MISSING_MESSAGE, cartResultLine, cartsForRow, isCartMissingError, reprintCartsIndividually, resettableJobs, runExclusive, resultsFromBatch, resultsFromBatchError, summarizeCartResults, trackableJobs, } from "../../lib/pickCartResults.js";
@@ -29,6 +29,8 @@ import { CartItemRows, PlanWarnings } from "./CartItemRows.js";
29
29
  import { CartStickerState, OrderStickerMeldingen, StickerFitMeldingen } from "./StickerState.js";
30
30
  import { StickerReprintButton } from "./StickerReprintButton.js";
31
31
  import { isJobFailed } from "../../lib/pick142.js";
32
+ import { isPrintBlocked } from "../../lib/pick156.js";
33
+ import { DocumentChoiceMelding, useDocumentChoice } from "./DocumentChoiceMelding.js";
32
34
  import { isWaitingShippingNote, shippingNoteMessage, shippingNoteSourceLabel, } from "../../lib/shippingNoteStatus.js";
33
35
  const LANG_STORAGE_KEY = "pick.language";
34
36
  /** Melding als de planning voor deze order geen karren heeft vastgelegd. */
@@ -61,6 +63,12 @@ export function PickScherm({ station, onBack }) {
61
63
  const [busyId, setBusyId] = useState(null);
62
64
  const [pending, setPending] = useState(null);
63
65
  const [cartPlan, setCartPlan] = useState(null);
66
+ const documentChoice = useDocumentChoice({
67
+ queueItemId: pending?.id ?? null,
68
+ payload: pending?.payload ?? null,
69
+ documentType: pending ? documentTypeOf(pending) : "",
70
+ slug: station.slug ?? null,
71
+ });
64
72
  const [planReason, setPlanReason] = useState(null);
65
73
  const [planStatus, setPlanStatus] = useState(null);
66
74
  const [fetchingData, setFetchingData] = useState(false);
@@ -1367,7 +1375,7 @@ export function PickScherm({ station, onBack }) {
1367
1375
  ? "De pakbon wordt opgevraagd. Zodra alles compleet is, verschijnt de printknop weer."
1368
1376
  : planReason
1369
1377
  ? `${planReason} Klik op "Pakbon ophalen" om hem op te vragen.`
1370
- : NOT_READY_NOTICE })] }) })), cartPlan && (_jsxs(CardContent, { className: "border-t p-4 sm:p-5", children: [_jsx(OrderStickerMeldingen, { orderId: cartPlan.orderId, slug: station.slug ?? null }), _jsx("div", { className: "mb-3 empty:hidden", children: _jsx(PlanWarnings, { warnings: cartPlan.warnings }) }), _jsxs("div", { className: "grid gap-3 lg:grid-cols-[minmax(0,0.8fr)_minmax(0,1.2fr)]", children: [_jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-sm font-semibold text-foreground", children: "Karren van deze order" }), _jsx("div", { className: "max-h-72 space-y-2 overflow-y-auto rounded-md border p-2", children: cartPlan.carts.map((cart) => {
1378
+ : NOT_READY_NOTICE })] }) })), cartPlan && (_jsxs(CardContent, { className: "border-t p-4 sm:p-5", children: [_jsx(DocumentChoiceMelding, { choice: documentChoice.data, isError: documentChoice.isError }), _jsx(OrderStickerMeldingen, { orderId: cartPlan.orderId, slug: station.slug ?? null }), _jsx("div", { className: "mb-3 empty:hidden", children: _jsx(PlanWarnings, { warnings: cartPlan.warnings }) }), _jsxs("div", { className: "grid gap-3 lg:grid-cols-[minmax(0,0.8fr)_minmax(0,1.2fr)]", children: [_jsxs("div", { className: "space-y-2", children: [_jsx("p", { className: "text-sm font-semibold text-foreground", children: "Karren van deze order" }), _jsx("div", { className: "max-h-72 space-y-2 overflow-y-auto rounded-md border p-2", children: cartPlan.carts.map((cart) => {
1371
1379
  const done = printedCartIdsOf(pending).includes(cart.cartId);
1372
1380
  const active = cart.cartId === activeCartId;
1373
1381
  return (_jsxs("div", { role: "button", tabIndex: 0, onClick: () => setActiveCartId(cart.cartId), onKeyDown: (event) => {
@@ -1376,7 +1384,7 @@ export function PickScherm({ station, onBack }) {
1376
1384
  setActiveCartId(cart.cartId);
1377
1385
  }
1378
1386
  }, className: "flex w-full cursor-pointer items-center justify-between gap-2 rounded-md border p-3 text-left transition hover:bg-muted/50 " +
1379
- (active ? "border-primary bg-primary/5" : ""), children: [_jsxs("div", { className: "min-w-0", children: [_jsx("p", { className: "truncate text-sm font-semibold text-foreground", children: cart.cartLabel }), _jsxs("p", { className: "text-xs text-muted-foreground", children: [cart.isFullCart ? "Volle kar" : "Halve kar", " · ", cart.items.length, " ", cart.items.length === 1 ? "product" : "producten", cart.isShared ? " · gedeelde kar" : "", done ? " · geprint" : ""] })] }), _jsxs(Button, { type: "button", variant: done ? "outline" : "secondary", size: "sm", disabled: (busyId !== null || actionBusy), onClick: (event) => {
1387
+ (active ? "border-primary bg-primary/5" : ""), children: [_jsxs("div", { className: "min-w-0", children: [_jsx("p", { className: "truncate text-sm font-semibold text-foreground", children: cart.cartLabel }), _jsxs("p", { className: "text-xs text-muted-foreground", children: [cart.isFullCart ? "Volle kar" : "Halve kar", " · ", cart.items.length, " ", cart.items.length === 1 ? "product" : "producten", cart.isShared ? " · gedeelde kar" : "", done ? " · geprint" : ""] })] }), _jsxs(Button, { type: "button", variant: done ? "outline" : "secondary", size: "sm", disabled: busyId !== null || actionBusy || isPrintBlocked(documentChoice.data, done), onClick: (event) => {
1380
1388
  event.stopPropagation();
1381
1389
  setActiveCartId(cart.cartId);
1382
1390
  void printSingleCart(pending, cart);
@@ -30,4 +30,6 @@ export { CartStickerState, OrderStickerMeldingen } from './components/pick/Stick
30
30
  export * from "./lib/pick145.js";
31
31
  export * from "./lib/pick150.js";
32
32
  export * from "./lib/pick152.js";
33
+ export * from "./lib/pick156.js";
34
+ export { DocumentChoiceMelding, useDocumentChoice } from "./components/pick/DocumentChoiceMelding.js";
33
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGvD,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB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ACjE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC9F,OAAO,EAAE,gCAAgC,EAAE,MAAM,wDAAwD,CAAC;AAC1G,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAE9E,eAAO,MAAM,kBAAkB,EAAE,UAYhC,CAAC;AAEF,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACzF,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC"}
package/dist-lib/index.js CHANGED
@@ -55,3 +55,5 @@ export { CartStickerState, OrderStickerMeldingen } from './components/pick/Stick
55
55
  export * from "./lib/pick145.js";
56
56
  export * from "./lib/pick150.js";
57
57
  export * from "./lib/pick152.js";
58
+ export * from "./lib/pick156.js";
59
+ export { DocumentChoiceMelding, useDocumentChoice } from "./components/pick/DocumentChoiceMelding.js";