@flowselections/floriday-klanten-module 1.0.80 → 1.0.82

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":"DeliveryLocationsTab.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/DeliveryLocationsTab.tsx"],"names":[],"mappings":"AAgFA,wBAAgB,oBAAoB,CAAC,EACnC,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,WAAW,GACZ,EAAE;IACD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,+BA8jBA"}
1
+ {"version":3,"file":"DeliveryLocationsTab.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/DeliveryLocationsTab.tsx"],"names":[],"mappings":"AAiFA,wBAAgB,oBAAoB,CAAC,EACnC,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,WAAW,GACZ,EAAE;IACD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,+BA2kBA"}
@@ -9,7 +9,8 @@ import { MapPin, Plus, Pencil, Trash2, Truck, Sparkles, PackageCheck, Download }
9
9
  import { listDeliveryLocations, upsertDeliveryLocation, deleteDeliveryLocation, importFloridayDeliveryLocations, setPrimaryDeliveryLocation, } from "../../lib/delivery-locations.functions.js";
10
10
  import { CarrierPicker, ProposalLine, useCarrierOptions, useCarrierProposals } from "./CarrierPicker.js";
11
11
  import { SearchableSelect } from "./SearchableSelect.js";
12
- import { LocationGlnList, DuplicateNotice, useLocationGlns } from "./LocationGlns.js";
12
+ import { LocationGlnList, LocationGlnEditor, DuplicateNotice, useLocationGlns } from "./LocationGlns.js";
13
+ import { emptyPending } from "../../lib/delivery-gln.js";
13
14
  import { duplicateGroups } from "../../lib/delivery-gln.js";
14
15
  import { locationShipmentCount } from "../../lib/delivery-locations.functions.js";
15
16
  import { choiceFromLocation, locationCarrierFields, proposalText, ENGINE_MISSING_TEXT, } from "../../lib/carrier-choice.js";
@@ -144,7 +145,9 @@ export function DeliveryLocationsTab({ customerId, groupKey, externalProvider, e
144
145
  ? `Automatisch (${ENGINE_MISSING_TEXT.toLowerCase()})`
145
146
  : `Automatisch (voorstel: ${proposalText(formProposalResult.proposal)})`;
146
147
  const carrierName = (id) => carriers.find((c) => c.id === id)?.name ?? "—";
147
- const resetValidation = () => { setTouched({}); setSubmitted(false); };
148
+ const resetValidation = () => { setTouched({}); setSubmitted(false); setPendingGlns(emptyPending()); };
149
+ const [pendingGlns, setPendingGlns] = useState(emptyPending());
150
+ const currentGlns = form.id ? (glnsByLoc.get(form.id) ?? []) : [];
148
151
  const startNew = () => {
149
152
  setForm({ ...EMPTY, country: toIsoCountry(cd.defaults?.country ?? "") ?? "" });
150
153
  resetValidation();
@@ -171,11 +174,14 @@ export function DeliveryLocationsTab({ customerId, groupKey, externalProvider, e
171
174
  setOpen(true);
172
175
  };
173
176
  const saveMut = useMutation({
174
- mutationFn: () => upsertFn({ data: { ...form, ...owner } }),
177
+ mutationFn: () => upsertFn({ data: { ...form, ...owner, ...(customerId ? { gln_changes: { ...pendingGlns } } : {}) } }),
175
178
  onSuccess: () => {
176
179
  toast.success(form.id ? "Locatie bijgewerkt" : "Locatie toegevoegd");
177
180
  qc.invalidateQueries({ queryKey: ["delivery-locations", ownerKey] });
178
181
  qc.invalidateQueries({ queryKey: ["customer", ownerKey] });
182
+ qc.invalidateQueries({ queryKey: ["location-glns"] });
183
+ qc.invalidateQueries({ queryKey: ["available-glns"] });
184
+ setPendingGlns(emptyPending());
179
185
  setOpen(false);
180
186
  },
181
187
  onError: (e) => toast.error(friendlyError(e, "Opslaan mislukt")),
@@ -220,7 +226,7 @@ export function DeliveryLocationsTab({ customerId, groupKey, externalProvider, e
220
226
  const street = [loc.street, loc.house_number].filter(Boolean).join(" ") || loc.raw?.address?.addressLine || loc.address_line || "";
221
227
  return (_jsx(Card, { children: _jsxs(CardContent, { className: "pt-5 space-y-3", children: [_jsxs("div", { className: "flex items-start justify-between gap-2", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "font-semibold flex items-center gap-2", children: [_jsx(MapPin, { className: "h-4 w-4 text-muted-foreground" }), loc.name || street || "Afleverlocatie"] }), _jsxs("div", { className: "text-sm text-muted-foreground mt-0.5", children: [loc.name ? street : "", loc.name && street && (loc.postal_code || loc.city) ? ", " : "", [loc.postal_code, loc.city].filter(Boolean).join(" "), loc.province ? ` · ${loc.province}` : "", loc.country ? (_jsxs("span", { className: "inline-flex items-center gap-1 ml-1", children: [_jsx("span", { className: "text-base", "aria-hidden": "true", children: countryNameToFlag(loc.country) ?? "🌐" }), _jsx("span", { children: toIsoCountry(loc.country) ? countryNameFromIso(toIsoCountry(loc.country)) : loc.country })] })) : null] })] }), _jsxs("div", { className: "flex gap-1", children: [_jsx(Button, { variant: "ghost", size: "icon", onClick: () => startEdit(loc), children: _jsx(Pencil, { className: "h-4 w-4" }) }), _jsx(Button, { variant: "ghost", size: "icon", title: "Locatie verwijderen", onClick: () => askDelete(loc.id), children: _jsx(Trash2, { className: "h-4 w-4" }) })] })] }), _jsxs("div", { className: "flex items-center gap-2 flex-wrap text-sm", children: [loc.self_pickup ? (_jsxs(_Fragment, { children: [_jsx(PackageCheck, { className: "h-4 w-4 text-muted-foreground" }), _jsx("span", { className: "font-medium", children: "Klant haalt zelf op" })] })) : loc.carrier_assignment_source === "manual" && loc.carrier_id ? (_jsxs(_Fragment, { children: [_jsx(Truck, { className: "h-4 w-4 text-muted-foreground" }), _jsx("span", { className: "font-medium", children: carrierName(loc.carrier_id) }), _jsx(Badge, { variant: "outline", children: "Gekozen bij deze locatie" })] })) : (_jsxs("span", { className: "inline-flex items-center gap-2 flex-wrap", children: [_jsxs(Badge, { variant: "secondary", className: "gap-1", children: [_jsx(Sparkles, { className: "h-3 w-3" }), "Automatisch"] }), _jsx(ProposalLine, { result: proposals.data?.[loc.id], loading: proposals.isLoading, error: proposals.error, onRetry: () => proposals.refetch() })] })), loc.external_provider === "floriday" && (_jsx(Badge, { variant: "outline", className: "text-success-soft-foreground border-success", children: "Floriday" })), !customerId && loc.gln && _jsxs(Badge, { variant: "secondary", children: ["GLN ", loc.gln] }), loc.is_primary && _jsx(Badge, { children: "Vaste afleverlocatie" }), loc.external_provider === "floriday" && loc.raw?.isDefault === true && (_jsx(Badge, { variant: "outline", children: "Standaard in Floriday" })), !loc.is_primary && (_jsx(Button, { size: "sm", variant: "outline", className: "h-7", disabled: primaryMut.isPending, onClick: () => primaryMut.mutate(loc.id), title: loc.external_provider === "floriday"
222
228
  ? "Dit verandert niets in Floriday; de koper kiest daar zelf zijn standaard."
223
- : undefined, children: "Maak vaste afleverlocatie" }))] }), customerId && (_jsx(LocationGlnList, { locationId: loc.id, glns: glnsByLoc.get(loc.id) ?? [], onChanged: refreshAll }))] }) }, loc.id));
229
+ : undefined, children: "Maak vaste afleverlocatie" }))] }), customerId && (_jsx(LocationGlnList, { customerId: customerId, locationId: loc.id, locationGln: loc.gln ?? null, glns: glnsByLoc.get(loc.id) ?? [], onChanged: refreshAll }))] }) }, loc.id));
224
230
  }) })), _jsx(Dialog, { open: open, onOpenChange: setOpen, children: _jsxs(DialogContent, { className: "max-w-2xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: form.id ? "Locatie bewerken" : "Nieuwe locatie" }), _jsx(DialogDescription, { children: "Kies \"Automatisch\" om de vervoerder steeds door de Logistieke Engine te laten bepalen." })] }), _jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [_jsxs("div", { className: "md:col-span-2", children: [_jsx(Label, { children: "Locatienaam (optioneel)" }), _jsx(Input, { value: form.name, onChange: (e) => setForm({ ...form, name: e.target.value }) })] }), _jsxs("div", { className: "md:col-span-2 grid grid-cols-3 gap-3", children: [_jsxs("div", { className: "col-span-2", children: [_jsxs(Label, { children: ["Straat ", req && _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { ref: fieldRefs.street, value: form.street, onChange: (e) => setForm({ ...form, street: e.target.value }), onBlur: () => markTouched("street"), "aria-invalid": !!showError("street"), className: showError("street") ? "border-destructive" : undefined }), showError("street") && _jsx("p", { className: "mt-1 text-xs text-destructive", children: showError("street") })] }), _jsxs("div", { children: [_jsxs(Label, { children: ["Huisnummer ", req && _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { ref: fieldRefs.house_number, value: form.house_number, onChange: (e) => setForm({ ...form, house_number: e.target.value }), onBlur: () => markTouched("house_number"), "aria-invalid": !!showError("house_number"), className: showError("house_number") ? "border-destructive" : undefined }), showError("house_number") && _jsx("p", { className: "mt-1 text-xs text-destructive", children: showError("house_number") })] })] }), _jsxs("div", { children: [_jsxs(Label, { children: ["Postcode ", req && _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx(Input, { ref: fieldRefs.postal_code, value: form.postal_code, onChange: (e) => setForm({ ...form, postal_code: e.target.value }), onBlur: () => {
225
231
  markTouched("postal_code");
226
232
  setForm((f) => ({ ...f, postal_code: normalizePostalCode(f.postal_code, f.country) }));
@@ -231,7 +237,7 @@ export function DeliveryLocationsTab({ customerId, groupKey, externalProvider, e
231
237
  })), placeholder: form.country && !COUNTRY_NAMES[form.country] ? `Onbekend land: ${form.country}` : "Kies een land", triggerClassName: `w-full ${showError("country") ? "border-destructive" : ""}` }), showError("country") && _jsx("p", { className: "mt-1 text-xs text-destructive", children: showError("country") })] }), _jsxs("div", { ref: fieldRefs.province, tabIndex: -1, children: [_jsxs(Label, { children: ["Provincie ", req && _jsx("span", { className: "text-destructive", children: "*" })] }), (() => {
232
238
  const provinces = findCountry(form.country)?.provinces ?? [];
233
239
  return provinces.length > 0 ? (_jsxs(Select, { value: form.province || "", onValueChange: (v) => { markTouched("province"); setForm({ ...form, province: v }); }, children: [_jsx(SelectTrigger, { className: showError("province") ? "border-destructive" : undefined, children: _jsx(SelectValue, { placeholder: "Kies een provincie" }) }), _jsx(SelectContent, { children: provinces.map((p) => (_jsx(SelectItem, { value: p, children: p }, p))) })] })) : (_jsx(Input, { value: form.province, onChange: (e) => setForm({ ...form, province: e.target.value }), onBlur: () => markTouched("province"), placeholder: "Kies eerst een land", disabled: !form.country, "aria-invalid": !!showError("province"), className: showError("province") ? "border-destructive" : undefined }));
234
- })(), showError("province") && _jsx("p", { className: "mt-1 text-xs text-destructive", children: showError("province") })] }), _jsxs("div", { className: "md:col-span-2 space-y-2", children: [_jsx(Label, { children: "Vervoerder" }), _jsx(CarrierPicker, { variant: "location", value: choiceFromLocation(form), onChange: (choice) => setForm({ ...form, ...locationCarrierFields(choice) }), autoLabel: autoLabel }), formProposal.error && (_jsx(ProposalLine, { result: undefined, error: formProposal.error, onRetry: () => formProposal.refetch() })), form.self_pickup ? (_jsx("div", { className: "text-xs text-muted-foreground", children: "De klant komt zelf de karren ophalen. Er wordt geen vervoerder gekoppeld." })) : choiceFromLocation(form).kind === "auto" ? (_jsx("div", { className: "text-xs text-muted-foreground", children: "Er wordt geen vervoerder vastgelegd; het voorstel wordt steeds opnieuw bepaald." })) : null] }), _jsxs("label", { className: "md:col-span-2 flex items-start gap-2 text-sm", children: [_jsx("input", { type: "checkbox", className: "mt-1", checked: form.is_primary, onChange: (e) => setForm({ ...form, is_primary: e.target.checked }) }), _jsxs("span", { children: ["Vaste afleverlocatie", _jsx("span", { className: "block text-xs text-muted-foreground", children: "Wordt bij nieuwe orders vooraf gekozen. Een eventuele andere vaste locatie van deze klant vervalt." })] })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => setOpen(false), children: "Annuleren" }), _jsx(Button, { onClick: handleSubmit, disabled: saveMut.isPending, children: form.id ? "Opslaan" : "Toevoegen" })] })] }) }), _jsx(Dialog, { open: importOpen, onOpenChange: setImportOpen, children: _jsxs(DialogContent, { className: "max-w-3xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Afleverlocaties importeren uit Floriday" }), _jsx(DialogDescription, { children: "Controleer de locaties voordat je importeert. Adres, plaats, land en GLN-code komen uit Floriday. Nieuwe locaties krijgen de vervoerder \"Automatisch\"; bestaande keuzes blijven staan." })] }), _jsx("div", { className: "max-h-[50vh] overflow-auto rounded-md border", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { className: "bg-muted/50 text-left", children: _jsxs("tr", { children: [_jsx("th", { className: "px-3 py-2 font-medium", children: "Locatie" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Klant" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Adres" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "GLN" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Actie" })] }) }), _jsxs("tbody", { children: [(importPreview?.items ?? []).map((it) => (_jsxs("tr", { className: "border-t", children: [_jsx("td", { className: "px-3 py-2", children: it.name }), _jsx("td", { className: "px-3 py-2", children: it.customer_name ?? "—" }), _jsx("td", { className: "px-3 py-2 text-muted-foreground", children: it.address || "—" }), _jsx("td", { className: "px-3 py-2 text-muted-foreground", children: it.gln ?? "—" }), _jsxs("td", { className: "px-3 py-2", children: [it.action === "create" && _jsx(Badge, { children: "Nieuw" }), it.action === "update" && _jsx(Badge, { variant: "secondary", children: "Bijwerken" }), it.action === "known" && _jsx(Badge, { variant: "outline", children: "Al bekend" }), it.action === "no_customer" && (_jsx(Badge, { variant: "outline", className: "text-warning-soft-foreground border-warning bg-warning-soft", children: "Geen klant gevonden" }))] })] }, it.floriday_id))), (importPreview?.items ?? []).length === 0 && (_jsx("tr", { children: _jsx("td", { colSpan: 5, className: "px-3 py-6 text-center text-muted-foreground", children: "Geen locaties gevonden in Floriday." }) }))] })] }) }), _jsxs("div", { className: "text-sm text-muted-foreground", children: [importPreview?.created ?? 0, " nieuw \u00B7 ", importPreview?.updated ?? 0, " bijwerken", (importPreview?.skipped ?? 0) > 0
240
+ })(), showError("province") && _jsx("p", { className: "mt-1 text-xs text-destructive", children: showError("province") })] }), customerId && (_jsxs("div", { className: "md:col-span-2 space-y-2", children: [_jsx(Label, { children: "GLN-codes" }), _jsx(LocationGlnEditor, { customerId: customerId, locationId: form.id ?? null, current: currentGlns, pending: pendingGlns, onChange: setPendingGlns })] })), _jsxs("div", { className: "md:col-span-2 space-y-2", children: [_jsx(Label, { children: "Vervoerder" }), _jsx(CarrierPicker, { variant: "location", value: choiceFromLocation(form), onChange: (choice) => setForm({ ...form, ...locationCarrierFields(choice) }), autoLabel: autoLabel }), formProposal.error && (_jsx(ProposalLine, { result: undefined, error: formProposal.error, onRetry: () => formProposal.refetch() })), form.self_pickup ? (_jsx("div", { className: "text-xs text-muted-foreground", children: "De klant komt zelf de karren ophalen. Er wordt geen vervoerder gekoppeld." })) : choiceFromLocation(form).kind === "auto" ? (_jsx("div", { className: "text-xs text-muted-foreground", children: "Er wordt geen vervoerder vastgelegd; het voorstel wordt steeds opnieuw bepaald." })) : null] }), _jsxs("label", { className: "md:col-span-2 flex items-start gap-2 text-sm", children: [_jsx("input", { type: "checkbox", className: "mt-1", checked: form.is_primary, onChange: (e) => setForm({ ...form, is_primary: e.target.checked }) }), _jsxs("span", { children: ["Vaste afleverlocatie", _jsx("span", { className: "block text-xs text-muted-foreground", children: "Wordt bij nieuwe orders vooraf gekozen. Een eventuele andere vaste locatie van deze klant vervalt." })] })] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => setOpen(false), children: "Annuleren" }), _jsx(Button, { onClick: handleSubmit, disabled: saveMut.isPending, children: form.id ? "Opslaan" : "Toevoegen" })] })] }) }), _jsx(Dialog, { open: importOpen, onOpenChange: setImportOpen, children: _jsxs(DialogContent, { className: "max-w-3xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Afleverlocaties importeren uit Floriday" }), _jsx(DialogDescription, { children: "Controleer de locaties voordat je importeert. Adres, plaats, land en GLN-code komen uit Floriday. Nieuwe locaties krijgen de vervoerder \"Automatisch\"; bestaande keuzes blijven staan." })] }), _jsx("div", { className: "max-h-[50vh] overflow-auto rounded-md border", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { className: "bg-muted/50 text-left", children: _jsxs("tr", { children: [_jsx("th", { className: "px-3 py-2 font-medium", children: "Locatie" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Klant" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Adres" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "GLN" }), _jsx("th", { className: "px-3 py-2 font-medium", children: "Actie" })] }) }), _jsxs("tbody", { children: [(importPreview?.items ?? []).map((it) => (_jsxs("tr", { className: "border-t", children: [_jsx("td", { className: "px-3 py-2", children: it.name }), _jsx("td", { className: "px-3 py-2", children: it.customer_name ?? "—" }), _jsx("td", { className: "px-3 py-2 text-muted-foreground", children: it.address || "—" }), _jsx("td", { className: "px-3 py-2 text-muted-foreground", children: it.gln ?? "—" }), _jsxs("td", { className: "px-3 py-2", children: [it.action === "create" && _jsx(Badge, { children: "Nieuw" }), it.action === "update" && _jsx(Badge, { variant: "secondary", children: "Bijwerken" }), it.action === "known" && _jsx(Badge, { variant: "outline", children: "Al bekend" }), it.action === "no_customer" && (_jsx(Badge, { variant: "outline", className: "text-warning-soft-foreground border-warning bg-warning-soft", children: "Geen klant gevonden" }))] })] }, it.floriday_id))), (importPreview?.items ?? []).length === 0 && (_jsx("tr", { children: _jsx("td", { colSpan: 5, className: "px-3 py-6 text-center text-muted-foreground", children: "Geen locaties gevonden in Floriday." }) }))] })] }) }), _jsxs("div", { className: "text-sm text-muted-foreground", children: [importPreview?.created ?? 0, " nieuw \u00B7 ", importPreview?.updated ?? 0, " bijwerken", (importPreview?.skipped ?? 0) > 0
235
241
  ? ` · ${importPreview?.skipped} overgeslagen omdat de Floriday-organisatie niet aan een klant gekoppeld is`
236
242
  : ""] }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: () => setImportOpen(false), children: "Afbreken" }), _jsx(Button, { onClick: () => importMut.mutate(), disabled: importMut.isPending || ((importPreview?.created ?? 0) + (importPreview?.updated ?? 0)) === 0, children: importMut.isPending ? "Importeren…" : "Importeren" })] })] }) })] }));
237
243
  }
@@ -1,15 +1,33 @@
1
1
  import { type LocationGln } from "../../lib/delivery-locations.functions.js";
2
- import { type DupLocation } from "../../lib/delivery-gln.js";
2
+ import { type DupLocation, type GlnAdd, type LinkedGln, type PendingGlns } from "../../lib/delivery-gln.js";
3
3
  export declare function useLocationGlns(locationIds: string[]): import("@tanstack/react-query").UseQueryResult<{
4
4
  glns: LocationGln[];
5
5
  mergeEnabled: boolean;
6
6
  }, Error>;
7
- /** GLN-badges bij één locatie: toevoegen, verwijderen en primair maken. */
8
- export declare function LocationGlnList({ locationId, glns, onChanged }: {
7
+ /** Zoekbare keuzelijst "GLN koppelen…": vrije GLN's van deze klant + "Andere GLN invoeren…". */
8
+ export declare function GlnPicker({ customerId, locationId, exclude, onPick, busy }: {
9
+ customerId: string;
10
+ locationId: string | null;
11
+ exclude: string[];
12
+ busy?: boolean;
13
+ onPick: (a: GlnAdd) => void;
14
+ }): import("react").JSX.Element;
15
+ /** Op de locatiekaart: wijzigingen direct uitvoeren. Zonder GLN-rijen de oude waarde als badge. */
16
+ export declare function LocationGlnList({ customerId, locationId, locationGln, glns, onChanged }: {
17
+ customerId: string;
9
18
  locationId: string;
19
+ locationGln: string | null;
10
20
  glns: LocationGln[];
11
21
  onChanged: () => void;
12
22
  }): import("react").JSX.Element;
23
+ /** In "Locatie bewerken": wijzigingen blijven openstaan tot Opslaan. */
24
+ export declare function LocationGlnEditor({ customerId, locationId, current, pending, onChange }: {
25
+ customerId: string;
26
+ locationId: string | null;
27
+ current: LinkedGln[];
28
+ pending: PendingGlns;
29
+ onChange: (p: PendingGlns) => void;
30
+ }): import("react").JSX.Element;
13
31
  /** Melding + samenvoegen voor locaties met hetzelfde adres en dezelfde (of een lege) naam. */
14
32
  export declare function DuplicateNotice<T extends DupLocation>({ group, label, mergeEnabled, onMerged }: {
15
33
  group: T[];
@@ -1 +1 @@
1
- {"version":3,"file":"LocationGlns.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/LocationGlns.tsx"],"names":[],"mappings":"AASA,OAAO,EAEiC,KAAK,WAAW,EACvD,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAElF,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE;;;UAOpD;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IAC/D,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,IAAI,CAAC;CAChE,+BAuEA;AAED,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE;IAC/F,KAAK,EAAE,CAAC,EAAE,CAAC;IAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;CAClF,+BA+DA"}
1
+ {"version":3,"file":"LocationGlns.d.ts","sourceRoot":"","sources":["../../../src/components/klanten/LocationGlns.tsx"],"names":[],"mappings":"AAUA,OAAO,EAEoD,KAAK,WAAW,EAC1E,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAGL,KAAK,WAAW,EAAqB,KAAK,MAAM,EAAe,KAAK,SAAS,EAAE,KAAK,WAAW,EAChG,MAAM,wBAAwB,CAAC;AAEhC,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE;;;UAOpD;AAID,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;IAC3E,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACjF,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B,+BAiFA;AAoCD,mGAAmG;AACnG,wBAAgB,eAAe,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;IACxF,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,WAAW,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,IAAI,CAAC;CAChH,+BAmCA;AAED,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;IACxF,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,SAAS,EAAE,CAAC;IAAC,OAAO,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,IAAI,CAAC;CAC/H,+BAiBA;AAED,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE;IAC/F,KAAK,EAAE,CAAC,EAAE,CAAC;IAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;CAClF,+BA+DA"}
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { friendlyError } from "../../lib/errors.js";
3
3
  import { useState } from "react";
4
- import { useMutation, useQuery } from "@tanstack/react-query";
4
+ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
5
5
  import { useServerFn } from "@tanstack/react-start";
6
- import { Button, Input, toast, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@flowselections/core";
7
- import { Plus, Star, X, Merge, AlertTriangle } from "lucide-react";
8
- import { addLocationGln, removeLocationGln, setPrimaryLocationGln, listLocationGlns, previewLocationMerge, mergeLocations, } from "../../lib/delivery-locations.functions.js";
9
- import { glnError, mergeSummary } from "../../lib/delivery-gln.js";
6
+ import { Button, Input, toast, Popover, PopoverContent, PopoverTrigger, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@flowselections/core";
7
+ import { Plus, Star, Merge, AlertTriangle, MoreHorizontal, Search } from "lucide-react";
8
+ import { addLocationGln, removeLocationGln, setPrimaryLocationGln, listLocationGlns, previewLocationMerge, mergeLocations, listAvailableGlns, } from "../../lib/delivery-locations.functions.js";
9
+ import { glnError, mergeSummary, normalizeAvailable, filterAvailable, sourceLabel, shortAddress, cardGlns, pendingView, pendingAdd, pendingRemove, pendingSetPrimary, hasPending, } from "../../lib/delivery-gln.js";
10
10
  export function useLocationGlns(locationIds) {
11
11
  const fn = useServerFn(listLocationGlns);
12
12
  return useQuery({
@@ -15,52 +15,84 @@ export function useLocationGlns(locationIds) {
15
15
  enabled: locationIds.length > 0,
16
16
  });
17
17
  }
18
- /** GLN-badges bij één locatie: toevoegen, verwijderen en primair maken. */
19
- export function LocationGlnList({ locationId, glns, onChanged }) {
20
- const [adding, setAdding] = useState(false);
18
+ const SOURCE_LABEL = { floriday: "Floriday", manual: "Handmatig", merge: "Samengevoegd", legacy: "Nog niet overgenomen" };
19
+ /** Zoekbare keuzelijst "GLN koppelen…": vrije GLN's van deze klant + "Andere GLN invoeren…". */
20
+ export function GlnPicker({ customerId, locationId, exclude, onPick, busy }) {
21
+ const [open, setOpen] = useState(false);
22
+ const [query, setQuery] = useState("");
23
+ const [manual, setManual] = useState(false);
21
24
  const [value, setValue] = useState("");
22
25
  const [err, setErr] = useState(null);
26
+ const fn = useServerFn(listAvailableGlns);
27
+ const avail = useQuery({
28
+ queryKey: ["available-glns", customerId, locationId],
29
+ queryFn: () => fn({ data: { customer_id: customerId, location_id: locationId } }),
30
+ enabled: open,
31
+ });
32
+ const rows = filterAvailable(normalizeAvailable(avail.data ?? []).filter((r) => !exclude.includes(r.gln)), query);
33
+ const same = rows.filter((r) => r.same_address), other = rows.filter((r) => !r.same_address);
34
+ const close = () => { setOpen(false); setQuery(""); setManual(false); setValue(""); setErr(null); };
35
+ const pick = (r) => {
36
+ onPick({ gln: r.gln, source: r.sources[0] === "floriday" ? "floriday" : "manual", floriday_location_id: r.sources[0] === "floriday" ? r.floriday_location_id : null });
37
+ close();
38
+ };
39
+ const submitManual = () => {
40
+ const e = glnError(value);
41
+ if (e) {
42
+ setErr(e);
43
+ return;
44
+ }
45
+ const v = value.trim().replace(/\s/g, "");
46
+ if (exclude.includes(v)) {
47
+ setErr("Deze GLN staat al bij deze locatie");
48
+ return;
49
+ }
50
+ onPick({ gln: v, source: "manual", floriday_location_id: null });
51
+ close();
52
+ };
53
+ const option = (r) => (_jsxs("button", { type: "button", onClick: () => pick(r), className: "flex w-full flex-col items-start rounded-lg px-2 py-1.5 text-left text-sm transition-colors duration-150 hover:bg-muted focus-visible:bg-muted focus-visible:outline-none", children: [_jsxs("span", { className: "flex w-full items-center gap-2", children: [_jsx("span", { className: "font-mono tabular-nums", children: r.gln }), _jsx("span", { className: "truncate", children: r.name ?? "" }), _jsx("span", { className: "ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground", children: sourceLabel(r) })] }), shortAddress(r) && _jsx("span", { className: "text-xs text-muted-foreground", children: shortAddress(r) })] }, r.gln));
54
+ return (_jsxs(Popover, { open: open, onOpenChange: (o) => (o ? setOpen(true) : close()), children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { size: "sm", variant: "outline", className: "h-8", disabled: busy, children: [_jsx(Plus, { className: "mr-1 h-4 w-4" }), " GLN koppelen\u2026"] }) }), _jsx(PopoverContent, { align: "start", className: "w-[360px] p-2", children: manual ? (_jsxs("div", { className: "space-y-2 p-1", children: [_jsx(Input, { autoFocus: true, value: value, inputMode: "numeric", placeholder: "13 cijfers", className: "h-9 font-mono tabular-nums", onChange: (e) => { setValue(e.target.value); setErr(null); }, onKeyDown: (e) => { if (e.key === "Enter")
55
+ submitManual(); if (e.key === "Escape")
56
+ setManual(false); } }), err && _jsx("p", { className: "text-xs text-destructive", children: err }), _jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(Button, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setManual(false), children: "Terug" }), _jsx(Button, { size: "sm", className: "h-8", onClick: submitManual, children: "Koppelen" })] })] })) : (_jsxs("div", { className: "space-y-1", children: [_jsxs("div", { className: "relative", children: [_jsx(Search, { className: "pointer-events-none absolute left-2 top-2.5 h-4 w-4 text-muted-foreground" }), _jsx(Input, { autoFocus: true, value: query, onChange: (e) => setQuery(e.target.value), placeholder: "Zoek op GLN, naam of plaats", className: "h-9 pl-8" })] }), _jsxs("div", { className: "max-h-72 overflow-y-auto", children: [avail.isLoading && _jsx("p", { className: "p-2 text-sm text-muted-foreground", children: "Laden\u2026" }), avail.error && _jsx("p", { className: "p-2 text-sm text-destructive", children: friendlyError(avail.error, "Laden mislukt") }), avail.data && rows.length === 0 && _jsx("p", { className: "p-2 text-sm text-muted-foreground", children: "Geen losse GLN's gevonden voor deze klant" }), same.length > 0 && _jsx("p", { className: "px-2 pt-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Zelfde adres" }), same.map(option), other.length > 0 && _jsx("p", { className: "px-2 pt-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Overige GLN's van deze klant" }), other.map(option)] }), _jsx("button", { type: "button", onClick: () => setManual(true), className: "w-full rounded-lg border-t border-border px-2 py-2 text-left text-sm text-primary transition-colors duration-150 hover:bg-muted", children: "Andere GLN invoeren\u2026" })] })) })] }));
57
+ }
58
+ /** Eén GLN-regel: GLN, ster bij primaire, bronlabel en menu. */
59
+ function GlnLine({ row, onlyOne, onPrimary, onRemove, disabled }) {
60
+ const legacy = row.source === "legacy";
61
+ return (_jsxs("span", { className: "inline-flex items-center gap-1.5 rounded-full border border-border bg-muted px-2 py-0.5 text-xs", children: [row.is_primary && _jsx(Star, { className: "h-3 w-3 fill-primary text-primary", "aria-label": "Primaire GLN" }), _jsx("span", { className: "font-mono tabular-nums", children: row.gln }), _jsxs("span", { className: "text-muted-foreground", children: ["\u00B7 ", SOURCE_LABEL[row.source]] }), row.isNew && _jsx("span", { className: "rounded-full bg-primary px-1.5 text-[10px] text-primary-foreground", children: "nieuw" }), legacy && _jsx("span", { className: "text-warning", title: "Nog niet overgenomen, controleer", children: "\u00B7 controleer" }), !legacy && (onPrimary || onRemove) && (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label": "GLN-acties", disabled: disabled, className: "rounded text-muted-foreground transition-colors duration-150 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: _jsx(MoreHorizontal, { className: "h-3.5 w-3.5" }) }) }), _jsxs(DropdownMenuContent, { align: "start", children: [_jsx(DropdownMenuItem, { disabled: row.is_primary, onSelect: onPrimary, children: "Primair maken" }), _jsx(DropdownMenuItem, { disabled: onlyOne, onSelect: onRemove, className: onlyOne ? undefined : "text-destructive", title: onlyOne ? "Een locatie houdt minimaal één GLN" : undefined, children: onlyOne ? "Verwijderen (laatste GLN)" : "Verwijderen" })] })] }))] }));
62
+ }
63
+ /** Op de locatiekaart: wijzigingen direct uitvoeren. Zonder GLN-rijen de oude waarde als badge. */
64
+ export function LocationGlnList({ customerId, locationId, locationGln, glns, onChanged }) {
23
65
  const addFn = useServerFn(addLocationGln);
24
66
  const removeFn = useServerFn(removeLocationGln);
25
67
  const primaryFn = useServerFn(setPrimaryLocationGln);
68
+ const qc = useQueryClient();
69
+ const done = (msg) => { toast.success(msg); qc.invalidateQueries({ queryKey: ["available-glns"] }); onChanged(); };
26
70
  const addMut = useMutation({
27
- mutationFn: (gln) => addFn({ data: { location_id: locationId, gln } }),
28
- onSuccess: (res) => {
29
- if ("conflict" in res) {
30
- setErr(res.message);
31
- return;
32
- }
33
- toast.success("GLN toegevoegd");
34
- setValue("");
35
- setAdding(false);
36
- setErr(null);
37
- onChanged();
38
- },
39
- onError: (e) => setErr(friendlyError(e, "Toevoegen mislukt")),
71
+ mutationFn: (a) => addFn({ data: { location_id: locationId, ...a } }),
72
+ onSuccess: (res) => { if ("conflict" in res) {
73
+ toast.error(res.message);
74
+ return;
75
+ } done("GLN gekoppeld"); },
76
+ onError: (e) => toast.error(friendlyError(e, "Koppelen mislukt")),
40
77
  });
41
78
  const removeMut = useMutation({
42
79
  mutationFn: (id) => removeFn({ data: { id } }),
43
- onSuccess: () => { toast.success("GLN verwijderd. Een import zet hem niet terug."); onChanged(); },
80
+ onSuccess: () => done("GLN verwijderd. Een import zet hem niet terug."),
44
81
  onError: (e) => toast.error(friendlyError(e, "Verwijderen mislukt")),
45
82
  });
46
83
  const primaryMut = useMutation({
47
84
  mutationFn: (id) => primaryFn({ data: { id } }),
48
- onSuccess: () => { toast.success("Dit is nu de hoofd-GLN"); onChanged(); },
85
+ onSuccess: () => done("Dit is nu de primaire GLN"),
49
86
  onError: (e) => toast.error(friendlyError(e, "Wijzigen mislukt")),
50
87
  });
51
- const submit = () => {
52
- const e = glnError(value);
53
- if (e) {
54
- setErr(e);
55
- return;
56
- }
57
- addMut.mutate(value.trim().replace(/\s/g, ""));
58
- };
59
- return (_jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [glns.map((g) => (_jsxs("span", { className: "inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-xs tabular-nums", children: [g.is_primary ? (_jsx(Star, { className: "h-3 w-3 text-primary", "aria-label": "Hoofd-GLN" })) : (_jsx("button", { type: "button", title: "Maak hoofd-GLN", className: "text-muted-foreground transition-colors duration-150 hover:text-primary", disabled: primaryMut.isPending, onClick: () => primaryMut.mutate(g.id), children: _jsx(Star, { className: "h-3 w-3" }) })), "GLN ", g.gln, g.source === "floriday" && _jsx("span", { className: "text-muted-foreground", children: "\u00B7 Floriday" }), _jsx("button", { type: "button", title: "GLN verwijderen", className: "text-muted-foreground transition-colors duration-150 hover:text-destructive", disabled: removeMut.isPending, onClick: () => removeMut.mutate(g.id), children: _jsx(X, { className: "h-3 w-3" }) })] }, g.id))), adding ? (_jsxs("span", { className: "inline-flex flex-col gap-1", children: [_jsxs("span", { className: "inline-flex items-center gap-1", children: [_jsx(Input, { autoFocus: true, value: value, inputMode: "numeric", placeholder: "13 cijfers", className: "h-8 w-40 tabular-nums", onChange: (e) => { setValue(e.target.value); setErr(null); }, onKeyDown: (e) => { if (e.key === "Enter")
60
- submit(); if (e.key === "Escape") {
61
- setAdding(false);
62
- setErr(null);
63
- } } }), _jsx(Button, { size: "sm", className: "h-8", disabled: addMut.isPending, onClick: submit, children: "Toevoegen" })] }), err && _jsx("span", { className: "text-xs text-destructive", children: err })] })) : (_jsxs(Button, { size: "sm", variant: "ghost", className: "h-7 px-2 text-xs", onClick: () => setAdding(true), children: [_jsx(Plus, { className: "mr-1 h-3 w-3" }), " GLN"] }))] }));
88
+ const busy = addMut.isPending || removeMut.isPending || primaryMut.isPending;
89
+ const shown = cardGlns(locationGln, glns);
90
+ return (_jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [shown.map((g) => "legacy" in g ? (_jsx(GlnLine, { onlyOne: true, row: { key: "legacy", id: null, gln: g.gln, is_primary: false, source: "legacy", isNew: false } }, "legacy")) : (_jsx(GlnLine, { onlyOne: glns.length <= 1, disabled: busy, row: { key: g.id, id: g.id, gln: g.gln, is_primary: g.is_primary, source: g.source, isNew: false }, onPrimary: () => primaryMut.mutate(g.id), onRemove: () => removeMut.mutate(g.id) }, g.id))), _jsx(GlnPicker, { customerId: customerId, locationId: locationId, exclude: glns.map((g) => g.gln), busy: busy, onPick: (a) => addMut.mutate(a) })] }));
91
+ }
92
+ /** In "Locatie bewerken": wijzigingen blijven openstaan tot Opslaan. */
93
+ export function LocationGlnEditor({ customerId, locationId, current, pending, onChange }) {
94
+ const rows = pendingView(current, pending);
95
+ return (_jsxs("div", { className: "space-y-2", children: [rows.length === 0 && _jsx("p", { className: "text-sm text-muted-foreground", children: "Nog geen GLN gekoppeld." }), _jsx("div", { className: "flex flex-wrap items-center gap-1.5", children: rows.map((r) => (_jsx(GlnLine, { row: r, onlyOne: rows.length <= 1, onPrimary: () => onChange(pendingSetPrimary(pending, r.gln)), onRemove: () => onChange(pendingRemove(pending, r)) }, r.key))) }), _jsx(GlnPicker, { customerId: customerId, locationId: locationId, exclude: rows.map((r) => r.gln), onPick: (a) => onChange(pendingAdd(pending, current, a)) }), hasPending(pending) && _jsx("p", { className: "text-xs text-muted-foreground", children: "Wijzigingen worden opgeslagen bij Opslaan." })] }));
64
96
  }
65
97
  /** Melding + samenvoegen voor locaties met hetzelfde adres en dezelfde (of een lege) naam. */
66
98
  export function DuplicateNotice({ group, label, mergeEnabled, onMerged }) {
@@ -22084,6 +22084,7 @@ export type Database = {
22084
22084
  mislukte_wakeups: number;
22085
22085
  module_versie: string | null;
22086
22086
  tick_sleutel: string;
22087
+ tick_sleutel_hash: string | null;
22087
22088
  updated_at: string;
22088
22089
  };
22089
22090
  Insert: {
@@ -22100,6 +22101,7 @@ export type Database = {
22100
22101
  mislukte_wakeups?: number;
22101
22102
  module_versie?: string | null;
22102
22103
  tick_sleutel?: string;
22104
+ tick_sleutel_hash?: string | null;
22103
22105
  updated_at?: string;
22104
22106
  };
22105
22107
  Update: {
@@ -22116,6 +22118,7 @@ export type Database = {
22116
22118
  mislukte_wakeups?: number;
22117
22119
  module_versie?: string | null;
22118
22120
  tick_sleutel?: string;
22121
+ tick_sleutel_hash?: string | null;
22119
22122
  updated_at?: string;
22120
22123
  };
22121
22124
  Relationships: [];
@@ -32230,6 +32233,14 @@ export type Database = {
32230
32233
  p_location_id: string;
32231
32234
  };
32232
32235
  Returns: Json;
32236
+ } | {
32237
+ Args: {
32238
+ p_floriday_location_id: string;
32239
+ p_gln: string;
32240
+ p_location_id: string;
32241
+ p_source: string;
32242
+ };
32243
+ Returns: Json;
32233
32244
  };
32234
32245
  afh_assert_ingelogd: {
32235
32246
  Args: never;
@@ -35146,6 +35157,16 @@ export type Database = {
35146
35157
  };
35147
35158
  Returns: boolean;
35148
35159
  };
35160
+ klanten_adres_sleutel: {
35161
+ Args: {
35162
+ p_country: string;
35163
+ p_house: string;
35164
+ p_line: string;
35165
+ p_postal: string;
35166
+ p_street: string;
35167
+ };
35168
+ Returns: string;
35169
+ };
35149
35170
  klanten_auto_promote_status: {
35150
35171
  Args: never;
35151
35172
  Returns: Json;
@@ -35423,6 +35444,13 @@ export type Database = {
35423
35444
  Args: never;
35424
35445
  Returns: Json;
35425
35446
  };
35447
+ list_available_glns_for_customer: {
35448
+ Args: {
35449
+ p_customer_id: string;
35450
+ p_location_id?: string;
35451
+ };
35452
+ Returns: Json;
35453
+ };
35426
35454
  list_medewerkers: {
35427
35455
  Args: never;
35428
35456
  Returns: {
@@ -42595,6 +42623,12 @@ export type Database = {
42595
42623
  };
42596
42624
  Returns: undefined;
42597
42625
  };
42626
+ print_runner_zoek: {
42627
+ Args: {
42628
+ p_sleutel: string;
42629
+ };
42630
+ Returns: string;
42631
+ };
42598
42632
  print_shell_url: {
42599
42633
  Args: never;
42600
42634
  Returns: string;
@@ -43266,6 +43300,17 @@ export type Database = {
43266
43300
  };
43267
43301
  Returns: Json;
43268
43302
  };
43303
+ save_delivery_location_with_glns: {
43304
+ Args: {
43305
+ p_add: Json;
43306
+ p_fields: Json;
43307
+ p_location_id: string;
43308
+ p_make_primary: boolean;
43309
+ p_primary_gln: string;
43310
+ p_remove: string[];
43311
+ };
43312
+ Returns: Json;
43313
+ };
43269
43314
  save_product_group: {
43270
43315
  Args: {
43271
43316
  p_description: string;
@@ -45307,6 +45352,16 @@ export type Database = {
45307
45352
  };
45308
45353
  Returns: string;
45309
45354
  };
45355
+ voorraad_afboeken: {
45356
+ Args: {
45357
+ p_aantal: number;
45358
+ p_connection_id: string;
45359
+ p_notitie?: string;
45360
+ p_reden: string;
45361
+ p_trade_item_key: string;
45362
+ };
45363
+ Returns: Json;
45364
+ };
45310
45365
  voorraad_alert_floriday_not_updated: {
45311
45366
  Args: {
45312
45367
  p_key: string;
@@ -45456,6 +45511,12 @@ export type Database = {
45456
45511
  };
45457
45512
  Returns: Json;
45458
45513
  };
45514
+ voorraad_correctie_1140: {
45515
+ Args: {
45516
+ p_uitvoeren?: boolean;
45517
+ };
45518
+ Returns: Json;
45519
+ };
45459
45520
  voorraad_correctie_status: {
45460
45521
  Args: {
45461
45522
  p_correctie?: string;
@@ -45472,6 +45533,10 @@ export type Database = {
45472
45533
  };
45473
45534
  Returns: string[];
45474
45535
  };
45536
+ voorraad_floriday_klaarzetten_toegestaan: {
45537
+ Args: never;
45538
+ Returns: boolean;
45539
+ };
45475
45540
  voorraad_floriday_leads_key: {
45476
45541
  Args: {
45477
45542
  p_key: string;
@@ -45560,6 +45625,12 @@ export type Database = {
45560
45625
  };
45561
45626
  Returns: string;
45562
45627
  };
45628
+ voorraad_overzicht_orderregel_koppeling: {
45629
+ Args: {
45630
+ p_voorbeelden?: number;
45631
+ };
45632
+ Returns: Json;
45633
+ };
45563
45634
  voorraad_packing_from_floriday: {
45564
45635
  Args: {
45565
45636
  p_product_id: string;
@@ -45609,6 +45680,20 @@ export type Database = {
45609
45680
  };
45610
45681
  Returns: undefined;
45611
45682
  };
45683
+ voorraad_voorraad_opslaan: {
45684
+ Args: {
45685
+ p_artikel_notitie?: string;
45686
+ p_artikel_notitie_wijzigen?: boolean;
45687
+ p_connection_id: string;
45688
+ p_incoming_stock: number;
45689
+ p_minimum_stock: number;
45690
+ p_physical_stock: number;
45691
+ p_product_id: string;
45692
+ p_trade_item_key: string;
45693
+ p_wijziging_notitie?: string;
45694
+ };
45695
+ Returns: Json;
45696
+ };
45612
45697
  voorraad_week_is_past: {
45613
45698
  Args: {
45614
45699
  p_week: number;