@flowselections/floriday-klanten-module 1.0.100 → 1.0.103
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/klanten/BulkStickerUploadDialog.d.ts.map +1 -1
- package/dist-lib/components/klanten/BulkStickerUploadDialog.js +28 -19
- package/dist-lib/components/klanten/CustomerArticleAliasDialog.d.ts +14 -0
- package/dist-lib/components/klanten/CustomerArticleAliasDialog.d.ts.map +1 -0
- package/dist-lib/components/klanten/CustomerArticleAliasDialog.js +47 -0
- package/dist-lib/components/klanten/CustomerAssortmentTab.d.ts +3 -1
- package/dist-lib/components/klanten/CustomerAssortmentTab.d.ts.map +1 -1
- package/dist-lib/components/klanten/CustomerAssortmentTab.js +23 -3
- package/dist-lib/components/klanten/CustomerLogisticsCard.d.ts +5 -0
- package/dist-lib/components/klanten/CustomerLogisticsCard.d.ts.map +1 -0
- package/dist-lib/components/klanten/CustomerLogisticsCard.js +92 -0
- package/dist-lib/components/klanten/KlantDetail.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantDetail.js +25 -3
- package/dist-lib/components/klanten/KlantenOverzicht.d.ts.map +1 -1
- package/dist-lib/components/klanten/KlantenOverzicht.js +26 -7
- package/dist-lib/index.d.ts +1 -0
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/index.js +1 -0
- package/dist-lib/integrations/supabase/types.d.ts +4196 -25
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/customer-archief.d.ts +25 -0
- package/dist-lib/lib/customer-archief.d.ts.map +1 -0
- package/dist-lib/lib/customer-archief.functions.d.ts +31 -0
- package/dist-lib/lib/customer-archief.functions.d.ts.map +1 -0
- package/dist-lib/lib/customer-archief.functions.js +35 -0
- package/dist-lib/lib/customer-archief.js +31 -0
- package/dist-lib/lib/customer-assortment.functions.d.ts +4 -0
- package/dist-lib/lib/customer-assortment.functions.d.ts.map +1 -1
- package/dist-lib/lib/customer-assortment.functions.js +7 -1
- package/dist-lib/lib/customer-schemas.d.ts +6 -1
- package/dist-lib/lib/customer-schemas.d.ts.map +1 -1
- package/dist-lib/lib/customer-schemas.js +2 -0
- package/dist-lib/lib/customers.functions.d.ts +2 -1
- package/dist-lib/lib/customers.functions.d.ts.map +1 -1
- package/dist-lib/lib/customers.functions.js +6 -2
- package/dist-lib/lib/klant-artikel-alias.d.ts +20 -0
- package/dist-lib/lib/klant-artikel-alias.d.ts.map +1 -0
- package/dist-lib/lib/klant-artikel-alias.functions.d.ts +50 -0
- package/dist-lib/lib/klant-artikel-alias.functions.d.ts.map +1 -0
- package/dist-lib/lib/klant-artikel-alias.functions.js +66 -0
- package/dist-lib/lib/klant-artikel-alias.js +48 -0
- package/dist-lib/lib/klanten-overzicht.d.ts +3 -1
- package/dist-lib/lib/klanten-overzicht.d.ts.map +1 -1
- package/dist-lib/lib/klanten-overzicht.js +6 -1
- package/dist-lib/lib/labels.d.ts +6 -0
- package/dist-lib/lib/labels.d.ts.map +1 -1
- package/dist-lib/lib/labels.js +2 -0
- package/dist-lib/lib/lijst-stand.d.ts +2 -0
- package/dist-lib/lib/lijst-stand.d.ts.map +1 -1
- package/dist-lib/lib/lijst-stand.js +4 -0
- package/dist-lib/lib/logistiek-uitzonderingen.functions.d.ts +61 -0
- package/dist-lib/lib/logistiek-uitzonderingen.functions.d.ts.map +1 -0
- package/dist-lib/lib/logistiek-uitzonderingen.functions.js +81 -0
- package/dist-lib/lib/sticker-filter.d.ts +9 -0
- package/dist-lib/lib/sticker-filter.d.ts.map +1 -0
- package/dist-lib/lib/sticker-filter.js +12 -0
- package/dist-lib/lib/voorraad-assortiment.d.ts +2 -0
- package/dist-lib/lib/voorraad-assortiment.d.ts.map +1 -1
- package/dist-lib/lib/voorraad-assortiment.js +2 -0
- package/package.json +1 -1
- package/schema/klanten.sql +177 -5
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type ArchiefFilter = "actief" | "gearchiveerd" | "alles";
|
|
2
|
+
export declare const ARCHIEF_FILTERS: readonly ArchiefFilter[];
|
|
3
|
+
type LeesClient = {
|
|
4
|
+
from: (t: string) => {
|
|
5
|
+
select: (c: string) => {
|
|
6
|
+
order: (c: string) => {
|
|
7
|
+
range: (a: number, b: number) => PromiseLike<{
|
|
8
|
+
data: unknown[] | null;
|
|
9
|
+
error: unknown;
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Alle gearchiveerde klant-id's, in porties van 1000. Ontbreekt de tabel
|
|
17
|
+
* customer_archief (oudere installatie), dan is niemand gearchiveerd.
|
|
18
|
+
*/
|
|
19
|
+
export declare function leesGearchiveerdeKlantIds(supabase: LeesClient): Promise<string[]>;
|
|
20
|
+
/** Zelfde regel als klanten_overzicht_rijen: standaard 'actief'. */
|
|
21
|
+
export declare function filterOpArchief<T extends {
|
|
22
|
+
id?: string | null;
|
|
23
|
+
}>(rows: T[], filter: ArchiefFilter | undefined, gearchiveerd: ReadonlySet<string>): T[];
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=customer-archief.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customer-archief.d.ts","sourceRoot":"","sources":["../../src/lib/customer-archief.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,cAAc,GAAG,OAAO,CAAC;AAChE,eAAO,MAAM,eAAe,EAAE,SAAS,aAAa,EAAwC,CAAC;AAE7F,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK;QACnB,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK;YAAE,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK;gBAAE,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,WAAW,CAAC;oBAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;oBAAC,KAAK,EAAE,OAAO,CAAA;iBAAE,CAAC,CAAA;aAAE,CAAA;SAAE,CAAC;KAC/I,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,wBAAsB,yBAAyB,CAAC,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAcvF;AAED,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,CAAC,SAAS;IAAE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,aAAa,GAAG,SAAS,EAAE,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAItJ"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Archiveert een klant, alleen voor het scherm: voegt een rij toe in customer_archief; customers blijft ongewijzigd. */
|
|
2
|
+
export declare const archiveerKlant: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
3
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
4
|
+
userId: string;
|
|
5
|
+
claims: import("@supabase/auth-js").JwtPayload;
|
|
6
|
+
}, undefined, undefined, undefined>], (input: {
|
|
7
|
+
customerId: string;
|
|
8
|
+
}) => {
|
|
9
|
+
customerId: string;
|
|
10
|
+
}, Promise<{
|
|
11
|
+
ok: true;
|
|
12
|
+
}>>;
|
|
13
|
+
/** Zet een gearchiveerde klant terug: verwijdert alleen de rij in customer_archief. */
|
|
14
|
+
export declare const herstelKlant: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
15
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
16
|
+
userId: string;
|
|
17
|
+
claims: import("@supabase/auth-js").JwtPayload;
|
|
18
|
+
}, undefined, undefined, undefined>], (input: {
|
|
19
|
+
customerId: string;
|
|
20
|
+
}) => {
|
|
21
|
+
customerId: string;
|
|
22
|
+
}, Promise<{
|
|
23
|
+
ok: true;
|
|
24
|
+
}>>;
|
|
25
|
+
/** Id's van gearchiveerde klanten; lege lijst als customer_archief ontbreekt. */
|
|
26
|
+
export declare const listGearchiveerdeKlantIds: import("@tanstack/start-client-core").OptionalFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
27
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
28
|
+
userId: string;
|
|
29
|
+
claims: import("@supabase/auth-js").JwtPayload;
|
|
30
|
+
}, undefined, undefined, undefined>], undefined, Promise<string[]>>;
|
|
31
|
+
//# sourceMappingURL=customer-archief.functions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customer-archief.functions.d.ts","sourceRoot":"","sources":["../../src/lib/customer-archief.functions.ts"],"names":[],"mappings":"AAOA,yHAAyH;AACzH,eAAO,MAAM,cAAc;;;;8CAED;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE;;;;GAU5C,CAAC;AAEL,uFAAuF;AACvF,eAAO,MAAM,YAAY;;;;8CAEC;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE;;;;GAQ5C,CAAC;AAEL,iFAAiF;AACjF,eAAO,MAAM,yBAAyB;;;;mEAE+C,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createServerFn } from "@tanstack/react-start";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
|
|
4
|
+
import { leesGearchiveerdeKlantIds } from "./customer-archief.js";
|
|
5
|
+
const idSchema = z.object({ customerId: z.string().uuid() });
|
|
6
|
+
/** Archiveert een klant, alleen voor het scherm: voegt een rij toe in customer_archief; customers blijft ongewijzigd. */
|
|
7
|
+
export const archiveerKlant = createServerFn({ method: "POST" })
|
|
8
|
+
.middleware([requireSupabaseAuth])
|
|
9
|
+
.inputValidator((input) => idSchema.parse(input))
|
|
10
|
+
.handler(async ({ data, context }) => {
|
|
11
|
+
const { error } = await context.supabase
|
|
12
|
+
.from("customer_archief")
|
|
13
|
+
.upsert({ customer_id: data.customerId, gearchiveerd_door: context.userId }, { onConflict: "customer_id", ignoreDuplicates: true });
|
|
14
|
+
if (error) {
|
|
15
|
+
console.error("[klanten] archiveren mislukt", error);
|
|
16
|
+
throw new Error("Archiveren is niet gelukt. Probeer het opnieuw of neem contact op met de beheerder.");
|
|
17
|
+
}
|
|
18
|
+
return { ok: true };
|
|
19
|
+
});
|
|
20
|
+
/** Zet een gearchiveerde klant terug: verwijdert alleen de rij in customer_archief. */
|
|
21
|
+
export const herstelKlant = createServerFn({ method: "POST" })
|
|
22
|
+
.middleware([requireSupabaseAuth])
|
|
23
|
+
.inputValidator((input) => idSchema.parse(input))
|
|
24
|
+
.handler(async ({ data, context }) => {
|
|
25
|
+
const { error } = await context.supabase.from("customer_archief").delete().eq("customer_id", data.customerId);
|
|
26
|
+
if (error) {
|
|
27
|
+
console.error("[klanten] terugzetten mislukt", error);
|
|
28
|
+
throw new Error("Terugzetten is niet gelukt. Probeer het opnieuw of neem contact op met de beheerder.");
|
|
29
|
+
}
|
|
30
|
+
return { ok: true };
|
|
31
|
+
});
|
|
32
|
+
/** Id's van gearchiveerde klanten; lege lijst als customer_archief ontbreekt. */
|
|
33
|
+
export const listGearchiveerdeKlantIds = createServerFn({ method: "POST" })
|
|
34
|
+
.middleware([requireSupabaseAuth])
|
|
35
|
+
.handler(async ({ context }) => leesGearchiveerdeKlantIds(context.supabase));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { isTabelOntbreekt } from "./tabel-ontbreekt.js";
|
|
2
|
+
export const ARCHIEF_FILTERS = ["actief", "gearchiveerd", "alles"];
|
|
3
|
+
/**
|
|
4
|
+
* Alle gearchiveerde klant-id's, in porties van 1000. Ontbreekt de tabel
|
|
5
|
+
* customer_archief (oudere installatie), dan is niemand gearchiveerd.
|
|
6
|
+
*/
|
|
7
|
+
export async function leesGearchiveerdeKlantIds(supabase) {
|
|
8
|
+
const ids = [];
|
|
9
|
+
for (let from = 0;; from += 1000) {
|
|
10
|
+
const { data, error } = await supabase.from("customer_archief").select("customer_id").order("customer_id").range(from, from + 999);
|
|
11
|
+
if (error) {
|
|
12
|
+
if (isTabelOntbreekt(error))
|
|
13
|
+
return [];
|
|
14
|
+
console.error("[klanten] archief lezen mislukt", error);
|
|
15
|
+
throw new Error("Het archief kon niet worden geladen. Probeer het opnieuw.");
|
|
16
|
+
}
|
|
17
|
+
const rows = (data ?? []);
|
|
18
|
+
for (const r of rows)
|
|
19
|
+
ids.push(r.customer_id);
|
|
20
|
+
if (rows.length < 1000)
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
return ids;
|
|
24
|
+
}
|
|
25
|
+
/** Zelfde regel als klanten_overzicht_rijen: standaard 'actief'. */
|
|
26
|
+
export function filterOpArchief(rows, filter, gearchiveerd) {
|
|
27
|
+
const f = filter ?? "actief";
|
|
28
|
+
if (f === "alles")
|
|
29
|
+
return rows;
|
|
30
|
+
return rows.filter((r) => gearchiveerd.has(r.id ?? "") === (f === "gearchiveerd"));
|
|
31
|
+
}
|
|
@@ -22,6 +22,10 @@ export type CustomerAssortmentItem = {
|
|
|
22
22
|
floriday_source: "price_group" | "contract" | null;
|
|
23
23
|
floriday_source_label: string | null;
|
|
24
24
|
in_assortment: boolean;
|
|
25
|
+
/** Laagste products.id van deze regel (null = niet in de voorraad). */
|
|
26
|
+
product_id: string | null;
|
|
27
|
+
/** Alle products.id's van deze samengevoegde regel. */
|
|
28
|
+
product_ids: string[];
|
|
25
29
|
};
|
|
26
30
|
export type CustomerAssortmentResult = {
|
|
27
31
|
items: CustomerAssortmentItem[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer-assortment.functions.d.ts","sourceRoot":"","sources":["../../src/lib/customer-assortment.functions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"customer-assortment.functions.d.ts","sourceRoot":"","sources":["../../src/lib/customer-assortment.functions.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,sBAAsB,GAAG;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,aAAa,GAAG,UAAU,GAAG,IAAI,CAAC;IACnD,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,aAAa,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,uDAAuD;IACvD,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAGF,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,UAAU,EAAE;QACV,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;QAC/B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,IAAI,CAAC;IACT,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;KAC/B,CAAC;IACF,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;IAC9B,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAAC;CACvC,CAAC;AAuCF,eAAO,MAAM,sBAAsB;;;;8CAET,OAAO;;;qCAoV7B,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { computePrice } from "./pricing.js";
|
|
|
6
6
|
import { loadFloridayCatalogPrices } from "./floriday-catalog-prices.js";
|
|
7
7
|
import { isTabelOntbreekt } from "./tabel-ontbreekt.js";
|
|
8
8
|
import { laadVoorraadAssortiment } from "./voorraad-assortiment.js";
|
|
9
|
+
import { productIdsPerSleutel } from "./klant-artikel-alias.js";
|
|
9
10
|
function str(...vals) {
|
|
10
11
|
for (const v of vals) {
|
|
11
12
|
if (typeof v === "string" && v.trim())
|
|
@@ -176,6 +177,8 @@ export const listCustomerAssortment = createServerFn({ method: "POST" })
|
|
|
176
177
|
floriday_source: null,
|
|
177
178
|
floriday_source_label: null,
|
|
178
179
|
in_assortment: ownAssortment.has(r.key),
|
|
180
|
+
product_id: r.product_ids[0] ?? null,
|
|
181
|
+
product_ids: r.product_ids,
|
|
179
182
|
};
|
|
180
183
|
});
|
|
181
184
|
vItems.sort((a, b) => a.name.localeCompare(b.name, "nl"));
|
|
@@ -203,7 +206,8 @@ export const listCustomerAssortment = createServerFn({ method: "POST" })
|
|
|
203
206
|
// 4) Basisprijzen uit eigen producten (gekoppeld op trade item)
|
|
204
207
|
const { data: prods } = await sb
|
|
205
208
|
.from("products")
|
|
206
|
-
.select("
|
|
209
|
+
.select("*");
|
|
210
|
+
const idsPerSleutel = productIdsPerSleutel(prods);
|
|
207
211
|
const productPrice = new Map();
|
|
208
212
|
for (const p of prods ?? []) {
|
|
209
213
|
const price = p?.sale_price != null ? Number(p.sale_price) : null;
|
|
@@ -350,6 +354,8 @@ export const listCustomerAssortment = createServerFn({ method: "POST" })
|
|
|
350
354
|
floriday_source: fl?.source ?? null,
|
|
351
355
|
floriday_source_label: fl?.label ?? null,
|
|
352
356
|
in_assortment: ownAssortment.has(id) || restricted,
|
|
357
|
+
product_id: (idsPerSleutel.get(id) ?? [])[0] ?? null,
|
|
358
|
+
product_ids: idsPerSleutel.get(id) ?? [],
|
|
353
359
|
});
|
|
354
360
|
}
|
|
355
361
|
items.sort((a, b) => a.name.localeCompare(b.name, "nl"));
|
|
@@ -393,9 +393,14 @@ export declare const listFiltersSchema: z.ZodObject<{
|
|
|
393
393
|
inactive: "inactive";
|
|
394
394
|
}>>>;
|
|
395
395
|
source: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
396
|
+
floriday: "floriday";
|
|
396
397
|
all: "all";
|
|
397
398
|
local: "local";
|
|
398
|
-
|
|
399
|
+
}>>>;
|
|
400
|
+
archief: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
401
|
+
gearchiveerd: "gearchiveerd";
|
|
402
|
+
actief: "actief";
|
|
403
|
+
alles: "alles";
|
|
399
404
|
}>>>;
|
|
400
405
|
since: z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AAM,iBAAiB;;;;;;;;;;;;;;;;;;;;iBAU5B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -328,6 +328,8 @@ export const listFiltersSchema = z.object({
|
|
|
328
328
|
country: z.string().trim().max(64).optional().default(""),
|
|
329
329
|
is_active: z.enum(["all", "active", "inactive"]).optional().default("all"),
|
|
330
330
|
source: z.enum(["all", "local", "floriday"]).optional().default("all"),
|
|
331
|
+
/** Archief (alleen weergave): standaard verborgen. */
|
|
332
|
+
archief: z.enum(["actief", "gearchiveerd", "alles"]).optional().default("actief"),
|
|
331
333
|
/** Alleen rijen die na dit tijdstip zijn gewijzigd (delta-verversing). */
|
|
332
334
|
since: z.string().datetime({ offset: true }).optional(),
|
|
333
335
|
});
|
|
@@ -62,7 +62,8 @@ export declare const listCustomers: import("@tanstack/start-client-core").Requir
|
|
|
62
62
|
customer_class: string;
|
|
63
63
|
country: string;
|
|
64
64
|
is_active: "active" | "all" | "inactive";
|
|
65
|
-
source: "
|
|
65
|
+
source: "floriday" | "all" | "local";
|
|
66
|
+
archief: "gearchiveerd" | "actief" | "alles";
|
|
66
67
|
since?: string | undefined;
|
|
67
68
|
}, Promise<{
|
|
68
69
|
customers: any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customers.functions.d.ts","sourceRoot":"","sources":["../../src/lib/customers.functions.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"customers.functions.d.ts","sourceRoot":"","sources":["../../src/lib/customers.functions.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAO5B,KAAK,cAAc,GAAG;IAC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,EAAE,MAAM,CAAA;KAAE,CAAC;GAqCtE,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { buildPriceGroupsMap } from "./price-groups.functions.js";
|
|
|
6
6
|
import { buildCustomerInsertRow } from "./customer-insert.js";
|
|
7
7
|
import { friendlyError } from "./errors.js";
|
|
8
8
|
import { markTwinfieldRequested } from "./twinfield-enqueue-rule.js";
|
|
9
|
+
import { filterOpArchief, leesGearchiveerdeKlantIds } from "./customer-archief.js";
|
|
9
10
|
function checkTwinfieldReady(draft) {
|
|
10
11
|
const missing = [];
|
|
11
12
|
if (!draft.company_name?.trim())
|
|
@@ -125,16 +126,19 @@ export const listCustomers = createServerFn({ method: "POST" })
|
|
|
125
126
|
};
|
|
126
127
|
// Geen maximum: lees in blokken van 1000 door tot het volledige
|
|
127
128
|
// klantenbestand binnen is (Postgres levert nooit meer per aanvraag).
|
|
128
|
-
const
|
|
129
|
+
const alle = [];
|
|
129
130
|
for (let offset = 0;; offset += 1000) {
|
|
130
131
|
const { data: rows, error } = await build().range(offset, offset + 999);
|
|
131
132
|
if (error)
|
|
132
133
|
throw new Error(friendlyError(error, "Klanten laden mislukt."));
|
|
133
134
|
const chunk = rows ?? [];
|
|
134
|
-
|
|
135
|
+
alle.push(...chunk);
|
|
135
136
|
if (chunk.length < 1000)
|
|
136
137
|
break;
|
|
137
138
|
}
|
|
139
|
+
// Gearchiveerde klanten (alleen weergave) standaard weglaten.
|
|
140
|
+
const gearchiveerd = data.archief === "alles" ? new Set() : new Set(await leesGearchiveerdeKlantIds(supabase));
|
|
141
|
+
const list = filterOpArchief(alle, data.archief, gearchiveerd);
|
|
138
142
|
const orgIds = list
|
|
139
143
|
.map((r) => r.floriday_organization_id)
|
|
140
144
|
.filter((v) => typeof v === "string" && !!v);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Klantartikelcodes: pure hulpfuncties (gedeeld door server en scherm). */
|
|
2
|
+
export type KlantArtikelAlias = {
|
|
3
|
+
product_id: string;
|
|
4
|
+
customer_article_code: string | null;
|
|
5
|
+
customer_article_name: string | null;
|
|
6
|
+
source: "handmatig" | "mailbox" | string;
|
|
7
|
+
times_confirmed: number;
|
|
8
|
+
updated_at: string;
|
|
9
|
+
};
|
|
10
|
+
/** Alle products.id's per trade-item-sleutel (trade_item_key en floriday_trade_item_id), oplopend gesorteerd. */
|
|
11
|
+
export declare function productIdsPerSleutel(products: unknown): Map<string, string[]>;
|
|
12
|
+
/** Een klantcode kan bij elk product_id van een samengevoegde regel staan: neem de meest recente. */
|
|
13
|
+
export declare function kiesAlias(aliases: KlantArtikelAlias[], productIds: string[]): KlantArtikelAlias | null;
|
|
14
|
+
/** Bestaat de code al bij een artikel buiten deze regel? Geeft dat product_id terug. */
|
|
15
|
+
export declare function zoekCodeConflict(aliases: {
|
|
16
|
+
product_id: string;
|
|
17
|
+
customer_article_code: string | null;
|
|
18
|
+
}[], code: string | null, productIds: string[]): string | null;
|
|
19
|
+
export declare function conflictMelding(code: string, artikelNaam: string): string;
|
|
20
|
+
//# sourceMappingURL=klant-artikel-alias.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"klant-artikel-alias.d.ts","sourceRoot":"","sources":["../../src/lib/klant-artikel-alias.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;IACzC,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,iHAAiH;AACjH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAe7E;AAED,qGAAqG;AACrG,wBAAgB,SAAS,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,iBAAiB,GAAG,IAAI,CAStG;AAED,wFAAwF;AACxF,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAAE,EACvE,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,UAAU,EAAE,MAAM,EAAE,GACnB,MAAM,GAAG,IAAI,CAMf;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAEzE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type KlantArtikelAlias } from "./klant-artikel-alias.js";
|
|
3
|
+
export declare const listKlantArtikelAliases: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
4
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
5
|
+
userId: string;
|
|
6
|
+
claims: import("@supabase/auth-js").JwtPayload;
|
|
7
|
+
}, undefined, undefined, undefined>], (d: {
|
|
8
|
+
customer_id: string;
|
|
9
|
+
}) => {
|
|
10
|
+
customer_id: string;
|
|
11
|
+
}, Promise<KlantArtikelAlias[]>>;
|
|
12
|
+
declare const opslaanSchema: z.ZodObject<{
|
|
13
|
+
customer_id: z.ZodString;
|
|
14
|
+
product_id: z.ZodString;
|
|
15
|
+
product_ids: z.ZodArray<z.ZodString>;
|
|
16
|
+
code: z.ZodNullable<z.ZodString>;
|
|
17
|
+
naam: z.ZodNullable<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
/** Opslaan op product_id (laagste id van de regel); codes bij de andere partijen van dezelfde regel worden verwijderd. */
|
|
20
|
+
export declare const saveKlantArtikelAlias: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
21
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
22
|
+
userId: string;
|
|
23
|
+
claims: import("@supabase/auth-js").JwtPayload;
|
|
24
|
+
}, undefined, undefined, undefined>], (d: z.input<typeof opslaanSchema>) => {
|
|
25
|
+
customer_id: string;
|
|
26
|
+
product_id: string;
|
|
27
|
+
product_ids: string[];
|
|
28
|
+
code: string | null;
|
|
29
|
+
naam: string | null;
|
|
30
|
+
}, Promise<{
|
|
31
|
+
ok: true;
|
|
32
|
+
} | {
|
|
33
|
+
ok: false;
|
|
34
|
+
fout: string;
|
|
35
|
+
}>>;
|
|
36
|
+
export declare const deleteKlantArtikelAlias: import("@tanstack/start-client-core").RequiredFetcher<readonly [import("@tanstack/start-client-core").FunctionMiddlewareAfterServer<{}, unknown, undefined, {
|
|
37
|
+
supabase: import("../integrations/supabase/auth-middleware.js").AuthedSupabaseClient;
|
|
38
|
+
userId: string;
|
|
39
|
+
claims: import("@supabase/auth-js").JwtPayload;
|
|
40
|
+
}, undefined, undefined, undefined>], (d: {
|
|
41
|
+
customer_id: string;
|
|
42
|
+
product_ids: string[];
|
|
43
|
+
}) => {
|
|
44
|
+
customer_id: string;
|
|
45
|
+
product_ids: string[];
|
|
46
|
+
}, Promise<{
|
|
47
|
+
ok: true;
|
|
48
|
+
}>>;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=klant-artikel-alias.functions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"klant-artikel-alias.functions.d.ts","sourceRoot":"","sources":["../../src/lib/klant-artikel-alias.functions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAqC,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAIlG,eAAO,MAAM,uBAAuB;;;;0CAEd;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE;;gCAMzC,CAAC;AAEL,QAAA,MAAM,aAAa;;;;;;iBAMjB,CAAC;AAQH,0HAA0H;AAC1H,eAAO,MAAM,qBAAqB;;;;0CAEZ,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC;;;;;;;QACC,IAAI;;QAAW,KAAK;UAAQ,MAAM;GAoBlF,CAAC;AAEL,eAAO,MAAM,uBAAuB;;;;0CAEd;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE;;;;;GAOhE,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { createServerFn } from "@tanstack/react-start";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { requireSupabaseAuth } from "../integrations/supabase/auth-middleware.js";
|
|
4
|
+
import { conflictMelding, zoekCodeConflict } from "./klant-artikel-alias.js";
|
|
5
|
+
const KOLOMMEN = "product_id, customer_article_code, customer_article_name, source, times_confirmed, updated_at";
|
|
6
|
+
export const listKlantArtikelAliases = createServerFn({ method: "POST" })
|
|
7
|
+
.middleware([requireSupabaseAuth])
|
|
8
|
+
.inputValidator((d) => z.object({ customer_id: z.string().uuid() }).parse(d))
|
|
9
|
+
.handler(async ({ data, context }) => {
|
|
10
|
+
const sb = context.supabase;
|
|
11
|
+
const r = await sb.from("customer_article_aliases").select(KOLOMMEN).eq("customer_id", data.customer_id).limit(10000);
|
|
12
|
+
if (r.error)
|
|
13
|
+
throw new Error(r.error.message);
|
|
14
|
+
return r.data ?? [];
|
|
15
|
+
});
|
|
16
|
+
const opslaanSchema = z.object({
|
|
17
|
+
customer_id: z.string().uuid(),
|
|
18
|
+
product_id: z.string().uuid(),
|
|
19
|
+
product_ids: z.array(z.string().uuid()).min(1),
|
|
20
|
+
code: z.string().max(100).nullable(),
|
|
21
|
+
naam: z.string().max(200).nullable(),
|
|
22
|
+
});
|
|
23
|
+
async function artikelNaam(sb, id) {
|
|
24
|
+
const r = await sb.from("products").select("product, article_number").eq("id", id).maybeSingle();
|
|
25
|
+
if (r.error)
|
|
26
|
+
console.error("Artikelnaam lezen mislukt", r.error);
|
|
27
|
+
return r.data?.product || r.data?.article_number || "een ander artikel";
|
|
28
|
+
}
|
|
29
|
+
/** Opslaan op product_id (laagste id van de regel); codes bij de andere partijen van dezelfde regel worden verwijderd. */
|
|
30
|
+
export const saveKlantArtikelAlias = createServerFn({ method: "POST" })
|
|
31
|
+
.middleware([requireSupabaseAuth])
|
|
32
|
+
.inputValidator((d) => opslaanSchema.parse(d))
|
|
33
|
+
.handler(async ({ data, context }) => {
|
|
34
|
+
const sb = context.supabase;
|
|
35
|
+
const code = data.code?.trim() || null;
|
|
36
|
+
const naam = data.naam?.trim() || null;
|
|
37
|
+
const ids = [...new Set([data.product_id, ...data.product_ids])];
|
|
38
|
+
if (code) {
|
|
39
|
+
const bestaand = await sb.from("customer_article_aliases").select("product_id, customer_article_code")
|
|
40
|
+
.eq("customer_id", data.customer_id).not("customer_article_code", "is", null).limit(10000);
|
|
41
|
+
if (bestaand.error)
|
|
42
|
+
throw new Error(bestaand.error.message);
|
|
43
|
+
const ander = zoekCodeConflict(bestaand.data ?? [], code, ids);
|
|
44
|
+
if (ander)
|
|
45
|
+
return { ok: false, fout: conflictMelding(code, await artikelNaam(sb, ander)) };
|
|
46
|
+
}
|
|
47
|
+
const up = await sb.rpc("save_customer_article_alias", {
|
|
48
|
+
p_customer_id: data.customer_id, p_product_id: data.product_id, p_product_ids: ids, p_code: code, p_naam: naam,
|
|
49
|
+
});
|
|
50
|
+
if (up.error) {
|
|
51
|
+
if (up.error.code === "23505" && code)
|
|
52
|
+
return { ok: false, fout: `Klantcode ${code} wordt al gebruikt bij een ander artikel van deze klant.` };
|
|
53
|
+
throw new Error(up.error.message);
|
|
54
|
+
}
|
|
55
|
+
return { ok: true };
|
|
56
|
+
});
|
|
57
|
+
export const deleteKlantArtikelAlias = createServerFn({ method: "POST" })
|
|
58
|
+
.middleware([requireSupabaseAuth])
|
|
59
|
+
.inputValidator((d) => z.object({ customer_id: z.string().uuid(), product_ids: z.array(z.string().uuid()).min(1) }).parse(d))
|
|
60
|
+
.handler(async ({ data, context }) => {
|
|
61
|
+
const sb = context.supabase;
|
|
62
|
+
const del = await sb.from("customer_article_aliases").delete().eq("customer_id", data.customer_id).in("product_id", data.product_ids);
|
|
63
|
+
if (del.error)
|
|
64
|
+
throw new Error(del.error.message);
|
|
65
|
+
return { ok: true };
|
|
66
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** Alle products.id's per trade-item-sleutel (trade_item_key en floriday_trade_item_id), oplopend gesorteerd. */
|
|
2
|
+
export function productIdsPerSleutel(products) {
|
|
3
|
+
const m = new Map();
|
|
4
|
+
for (const p of (Array.isArray(products) ? products : [])) {
|
|
5
|
+
if (!p?.id)
|
|
6
|
+
continue;
|
|
7
|
+
if (p.gearchiveerd_at != null && p.gearchiveerd_at !== "")
|
|
8
|
+
continue;
|
|
9
|
+
for (const k of [p.trade_item_key, p.floriday_trade_item_id]) {
|
|
10
|
+
if (k == null || k === "")
|
|
11
|
+
continue;
|
|
12
|
+
const key = String(k);
|
|
13
|
+
if (!m.has(key))
|
|
14
|
+
m.set(key, new Set());
|
|
15
|
+
m.get(key).add(String(p.id));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const out = new Map();
|
|
19
|
+
for (const [k, v] of m)
|
|
20
|
+
out.set(k, [...v].sort());
|
|
21
|
+
return out;
|
|
22
|
+
}
|
|
23
|
+
/** Een klantcode kan bij elk product_id van een samengevoegde regel staan: neem de meest recente. */
|
|
24
|
+
export function kiesAlias(aliases, productIds) {
|
|
25
|
+
const ids = new Set(productIds);
|
|
26
|
+
let beste = null;
|
|
27
|
+
for (const a of aliases) {
|
|
28
|
+
if (!ids.has(a.product_id))
|
|
29
|
+
continue;
|
|
30
|
+
if (!a.customer_article_code && !a.customer_article_name)
|
|
31
|
+
continue;
|
|
32
|
+
if (!beste || a.updated_at > beste.updated_at)
|
|
33
|
+
beste = a;
|
|
34
|
+
}
|
|
35
|
+
return beste;
|
|
36
|
+
}
|
|
37
|
+
/** Bestaat de code al bij een artikel buiten deze regel? Geeft dat product_id terug. */
|
|
38
|
+
export function zoekCodeConflict(aliases, code, productIds) {
|
|
39
|
+
const c = code?.trim().toLowerCase();
|
|
40
|
+
if (!c)
|
|
41
|
+
return null;
|
|
42
|
+
const eigen = new Set(productIds);
|
|
43
|
+
const hit = aliases.find((a) => !eigen.has(a.product_id) && a.customer_article_code?.trim().toLowerCase() === c);
|
|
44
|
+
return hit?.product_id ?? null;
|
|
45
|
+
}
|
|
46
|
+
export function conflictMelding(code, artikelNaam) {
|
|
47
|
+
return `Klantcode ${code} hoort al bij ${artikelNaam}. Kies een andere code of pas dat artikel aan.`;
|
|
48
|
+
}
|
|
@@ -36,6 +36,8 @@ export type OverviewFilters = {
|
|
|
36
36
|
countries?: string[];
|
|
37
37
|
channels?: string[];
|
|
38
38
|
payments?: string[];
|
|
39
|
+
/** Alleen weergave; standaard 'actief' (gearchiveerde klanten verborgen). */
|
|
40
|
+
archief?: "actief" | "gearchiveerd" | "alles";
|
|
39
41
|
};
|
|
40
42
|
export type OverviewSort = {
|
|
41
43
|
col: "company_name" | "country";
|
|
@@ -60,5 +62,5 @@ export declare function overviewOptions(rows: OverviewRow[]): {
|
|
|
60
62
|
channels: string[];
|
|
61
63
|
payments: string[];
|
|
62
64
|
};
|
|
63
|
-
export declare function filterSortOverview(rows: OverviewRow[], f: OverviewFilters, search: string, sort: OverviewSort): OverviewRow[];
|
|
65
|
+
export declare function filterSortOverview(rows: OverviewRow[], f: OverviewFilters, search: string, sort: OverviewSort, gearchiveerd?: ReadonlySet<string>): OverviewRow[];
|
|
64
66
|
//# sourceMappingURL=klanten-overzicht.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"klanten-overzicht.d.ts","sourceRoot":"","sources":["../../src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,WAAW,CAAC,MAAM,CAAa,GAC5C,WAAW,EAAE,CAuCf"}
|
|
@@ -139,8 +139,13 @@ export function overviewOptions(rows) {
|
|
|
139
139
|
});
|
|
140
140
|
return { countries: [...countries].sort(), channels: [...channels].sort(), payments: [...payments].sort() };
|
|
141
141
|
}
|
|
142
|
-
export function filterSortOverview(rows, f, search, sort) {
|
|
142
|
+
export function filterSortOverview(rows, f, search, sort, gearchiveerd = new Set()) {
|
|
143
143
|
const view = f.view ?? "all";
|
|
144
|
+
const archief = f.archief ?? "actief";
|
|
145
|
+
if (archief === "actief")
|
|
146
|
+
rows = rows.filter((c) => !gearchiveerd.has(c.id ?? ""));
|
|
147
|
+
if (archief === "gearchiveerd")
|
|
148
|
+
rows = rows.filter((c) => gearchiveerd.has(c.id ?? ""));
|
|
144
149
|
const selectedCountries = f.countries ?? [];
|
|
145
150
|
const selectedChannels = f.channels ?? [];
|
|
146
151
|
const selectedPayments = f.payments ?? [];
|
package/dist-lib/lib/labels.d.ts
CHANGED
|
@@ -33,4 +33,10 @@ export declare const LABELS: {
|
|
|
33
33
|
};
|
|
34
34
|
export type LabelGroup = keyof typeof LABELS;
|
|
35
35
|
export declare function label(group: LabelGroup, value: string | null | undefined): string;
|
|
36
|
+
/** Archieffilter in het klantenoverzicht. */
|
|
37
|
+
export declare const ARCHIEF_LABELS: {
|
|
38
|
+
readonly actief: "Actief";
|
|
39
|
+
readonly gearchiveerd: "Gearchiveerd";
|
|
40
|
+
readonly alles: "Alles";
|
|
41
|
+
};
|
|
36
42
|
//# sourceMappingURL=labels.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/lib/labels.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCT,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,MAAM,CAAC;AAI7C,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAWjF"}
|
|
1
|
+
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../src/lib/labels.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCT,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,MAAM,CAAC;AAI7C,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAWjF;AAED,6CAA6C;AAC7C,eAAO,MAAM,cAAc;;;;CAA8E,CAAC"}
|
package/dist-lib/lib/labels.js
CHANGED
|
@@ -44,6 +44,8 @@ export type KlantenLijstFilter = {
|
|
|
44
44
|
kanalen: string[];
|
|
45
45
|
betaalvormen: string[];
|
|
46
46
|
bron: "all" | "floriday" | "buiten";
|
|
47
|
+
/** Ontbreekt in oudere standen: dan 'actief'. */
|
|
48
|
+
archief?: "actief" | "gearchiveerd" | "alles";
|
|
47
49
|
};
|
|
48
50
|
export declare const KLANTEN_LIJST_SCHEMA: LijstStandSchema<KlantenLijstFilter>;
|
|
49
51
|
export type PrijsgroepenLijstFilter = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lijst-stand.d.ts","sourceRoot":"","sources":["../../src/lib/lijst-stand.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,oDAAoD;AACpD,eAAO,MAAM,kBAAkB,QAAiB,CAAC;AAEjD,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAC1B,CAAC,EAAE,CAAC,CAAC;IACL,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,CAAC,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ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= {
|
|
|
116
116
|
const betaalvormen = stringLijst(raw.betaalvormen);
|
|
117
117
|
if (!landen || !kanalen || !betaalvormen)
|
|
118
118
|
return null;
|
|
119
|
+
const archief = raw.archief ?? "actief";
|
|
120
|
+
if (archief !== "actief" && archief !== "gearchiveerd" && archief !== "alles")
|
|
121
|
+
return null;
|
|
119
122
|
return {
|
|
123
|
+
archief,
|
|
120
124
|
tab: raw.tab,
|
|
121
125
|
bron: raw.bron,
|
|
122
126
|
landen,
|