@flowselections/floriday-klanten-module 1.0.100 → 1.0.101
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/integrations/supabase/types.d.ts +3162 -144
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- 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/package.json +1 -1
- package/schema/klanten.sql +17 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type StickerFilter = "alles" | "nog" | "gekoppeld";
|
|
2
|
+
type Koppelbaar = {
|
|
3
|
+
tradeItemKey: string | null;
|
|
4
|
+
};
|
|
5
|
+
/** Aantallen per filterknop; gekoppeld = er is een product gekozen. */
|
|
6
|
+
export declare function telStickerFilters(rows: readonly Koppelbaar[]): Record<StickerFilter, number>;
|
|
7
|
+
export declare function filterStickerRows<T extends Koppelbaar>(rows: readonly T[], filter: StickerFilter): T[];
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=sticker-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sticker-filter.d.ts","sourceRoot":"","sources":["../../src/lib/sticker-filter.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,WAAW,CAAC;AAE1D,KAAK,UAAU,GAAG;IAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAElD,uEAAuE;AACvE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAG5F;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,UAAU,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,aAAa,GAAG,CAAC,EAAE,CAItG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Aantallen per filterknop; gekoppeld = er is een product gekozen. */
|
|
2
|
+
export function telStickerFilters(rows) {
|
|
3
|
+
const gekoppeld = rows.filter((r) => !!r.tradeItemKey).length;
|
|
4
|
+
return { alles: rows.length, nog: rows.length - gekoppeld, gekoppeld };
|
|
5
|
+
}
|
|
6
|
+
export function filterStickerRows(rows, filter) {
|
|
7
|
+
if (filter === "nog")
|
|
8
|
+
return rows.filter((r) => !r.tradeItemKey);
|
|
9
|
+
if (filter === "gekoppeld")
|
|
10
|
+
return rows.filter((r) => !!r.tradeItemKey);
|
|
11
|
+
return [...rows];
|
|
12
|
+
}
|
package/package.json
CHANGED
package/schema/klanten.sql
CHANGED
|
@@ -436,6 +436,16 @@ SELECT pg_temp.klanten_try($klanten_stmt$CREATE INDEX IF NOT EXISTS idx_customer
|
|
|
436
436
|
SELECT pg_temp.klanten_try($klanten_stmt$CREATE INDEX IF NOT EXISTS customer_audit_log_customer_id_idx ON public.customer_audit_log USING btree (customer_id)$klanten_stmt$, 'CREATE INDEX IF NOT EXISTS customer_audit_log_customer_id_idx ON public.customer_audit_log USING btr');
|
|
437
437
|
SELECT pg_temp.klanten_try($klanten_stmt$CREATE UNIQUE INDEX IF NOT EXISTS cdl_one_primary_per_group ON public.customer_delivery_locations USING btree (group_key) WHERE (is_primary AND (customer_id IS NULL) AND (group_key IS NOT NULL))$klanten_stmt$, 'CREATE UNIQUE INDEX IF NOT EXISTS cdl_one_primary_per_group ON public.customer_delivery_locations US');
|
|
438
438
|
SELECT pg_temp.klanten_try($klanten_stmt$CREATE INDEX IF NOT EXISTS idx_cdl_gln ON public.customer_delivery_locations USING btree (gln)$klanten_stmt$, 'CREATE INDEX IF NOT EXISTS idx_cdl_gln ON public.customer_delivery_locations USING btree (gln)');
|
|
439
|
+
SELECT pg_temp.klanten_try($klanten_stmt$DO $c$ BEGIN
|
|
440
|
+
IF NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname='pg_trgm') THEN
|
|
441
|
+
RAISE WARNING 'Klanten: pg_trgm ontbreekt; zoekindexen afleveradressen overgeslagen. Installeer pg_trgm en voer het schema opnieuw uit.';
|
|
442
|
+
RETURN;
|
|
443
|
+
END IF;
|
|
444
|
+
CREATE INDEX IF NOT EXISTS idx_cdl_name_trgm ON public.customer_delivery_locations USING gin (name gin_trgm_ops);
|
|
445
|
+
CREATE INDEX IF NOT EXISTS idx_cdl_city_trgm ON public.customer_delivery_locations USING gin (city gin_trgm_ops);
|
|
446
|
+
CREATE INDEX IF NOT EXISTS idx_cdl_address_line_trgm ON public.customer_delivery_locations USING gin (address_line gin_trgm_ops);
|
|
447
|
+
CREATE INDEX IF NOT EXISTS idx_cdl_gln_prefix ON public.customer_delivery_locations (gln text_pattern_ops);
|
|
448
|
+
END $c$$klanten_stmt$, 'DO $c$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname=''pg_trgm'') THEN RAISE WARNING ''');
|
|
439
449
|
SELECT pg_temp.klanten_try($klanten_stmt$CREATE UNIQUE INDEX IF NOT EXISTS cdl_one_primary_per_customer ON public.customer_delivery_locations USING btree (customer_id) WHERE (is_primary AND (customer_id IS NOT NULL))$klanten_stmt$, 'CREATE UNIQUE INDEX IF NOT EXISTS cdl_one_primary_per_customer ON public.customer_delivery_locations');
|
|
440
450
|
SELECT pg_temp.klanten_try($klanten_stmt$CREATE INDEX IF NOT EXISTS idx_twinfield_push_log_customer ON public.twinfield_push_log USING btree (customer_id, created_at DESC)$klanten_stmt$, 'CREATE INDEX IF NOT EXISTS idx_twinfield_push_log_customer ON public.twinfield_push_log USING btree ');
|
|
441
451
|
SELECT pg_temp.klanten_try($klanten_stmt$CREATE UNIQUE INDEX IF NOT EXISTS customer_price_groups_external_id_uidx ON public.customer_price_groups USING btree (external_id) WHERE ((source = 'floriday'::text) AND (external_id IS NOT NULL))$klanten_stmt$, 'CREATE UNIQUE INDEX IF NOT EXISTS customer_price_groups_external_id_uidx ON public.customer_price_gr');
|
|
@@ -1067,7 +1077,7 @@ SELECT pg_temp.klanten_try($klanten_stmt$CREATE OR REPLACE FUNCTION public.klant
|
|
|
1067
1077
|
STABLE SECURITY DEFINER
|
|
1068
1078
|
SET search_path TO 'public'
|
|
1069
1079
|
AS $function$
|
|
1070
|
-
DECLARE _missing text[] := '{}'; _o text; _res jsonb := '{}'::jsonb; _f jsonb := '[]'::jsonb; _t jsonb := '[]'::jsonb; _p jsonb := '[]'::jsonb; _r record;
|
|
1080
|
+
DECLARE _missing text[] := '{}'; _o text; _res jsonb := '{}'::jsonb; _f jsonb := '[]'::jsonb; _t jsonb := '[]'::jsonb; _p jsonb := '[]'::jsonb; _i jsonb := '[]'::jsonb; _r record;
|
|
1071
1081
|
BEGIN
|
|
1072
1082
|
PERFORM public.klanten_toegang('ingelogd');
|
|
1073
1083
|
FOREACH _o IN ARRAY ARRAY['customers','customer_delivery_locations','customer_match_suggestions','floriday_customers_cache',
|
|
@@ -1100,6 +1110,10 @@ BEGIN
|
|
|
1100
1110
|
FOREACH _o IN ARRAY ARRAY['Authenticated can delete customer_contacts|customer_contacts','Authenticated can delete customer_delivery_locations|customer_delivery_locations','Authenticated can delete customer_selected_assortment|customer_selected_assortment','Authenticated can delete customer_trade_settings|customer_trade_settings','Authenticated can insert customer_contacts|customer_contacts','Authenticated can insert customer_delivery_locations|customer_delivery_locations','Authenticated can insert customer_selected_assortment|customer_selected_assortment','Authenticated can insert customer_trade_settings|customer_trade_settings','Authenticated can manage customer assortment|customer_assortment_items','Authenticated can read customer_contacts|customer_contacts','Authenticated can read customer_delivery_locations|customer_delivery_locations','Authenticated can read customer_selected_assortment|customer_selected_assortment','Authenticated can read customer_trade_settings|customer_trade_settings','Authenticated can update customer_contacts|customer_contacts','Authenticated can update customer_delivery_locations|customer_delivery_locations','Authenticated can update customer_selected_assortment|customer_selected_assortment','Authenticated can update customer_trade_settings|customer_trade_settings','Authenticated users can delete customers|customers','Authenticated users can insert customers|customers','Authenticated users can read customers|customers','Authenticated users can update customers|customers','External customer providers are readable by authenticated users|external_customer_providers','Ingelogd beoordelen voorstellen|customer_match_suggestions','Ingelogd lezen voorstellen|customer_match_suggestions','Ingelogde gebruikers beheren klantstickers|customer_product_stickers','Ingelogde gebruikers beheren stickerinstellingen|customer_sticker_settings','Ingelogde gebruikers beheren fuststickers|customer_fust_stickers','auth can read cls|customer_logistics_strategy','auth can write cls|customer_logistics_strategy','auth manage customer notes|customer_notes','auth manage local agreements|local_customer_agreements','auth manage local price groups|local_customer_price_groups','auth manage local sales strategies|local_customer_sales_strategies','own pg members - delete|customer_price_group_members','own pg members - insert|customer_price_group_members','own pg members - select|customer_price_group_members','own pg members - update|customer_price_group_members','own price groups - delete|customer_price_groups','own price groups - insert|customer_price_groups','own price groups - select|customer_price_groups','own price groups - update|customer_price_groups','service role only|twinfield_push_log','Beheerders lezen correctielog|klanten_correctie_log'] LOOP
|
|
1101
1111
|
_p := _p || jsonb_build_object('policy', split_part(_o,'|',1), 'tabel', split_part(_o,'|',2),
|
|
1102
1112
|
'aanwezig', EXISTS (SELECT 1 FROM pg_policies WHERE schemaname='public' AND policyname = split_part(_o,'|',1) AND tablename = split_part(_o,'|',2)));
|
|
1113
|
+
END LOOP;
|
|
1114
|
+
FOREACH _o IN ARRAY ARRAY['idx_cdl_name_trgm','idx_cdl_city_trgm','idx_cdl_address_line_trgm','idx_cdl_gln_prefix'] LOOP
|
|
1115
|
+
_i := _i || jsonb_build_object('index', _o,
|
|
1116
|
+
'aanwezig', EXISTS (SELECT 1 FROM pg_indexes WHERE schemaname='public' AND indexname = _o));
|
|
1103
1117
|
END LOOP;
|
|
1104
1118
|
_o := NULL;
|
|
1105
1119
|
IF to_regclass('cron.job') IS NOT NULL THEN
|
|
@@ -1115,6 +1129,8 @@ BEGIN
|
|
|
1115
1129
|
_res := _res || jsonb_build_object('ontbreekt', to_jsonb(_missing),
|
|
1116
1130
|
'cron_promote', EXISTS (SELECT 1 FROM pg_extension WHERE extname='pg_cron'),
|
|
1117
1131
|
'functies', _f, 'triggers', _t, 'policies', _p,
|
|
1132
|
+
'indexen', _i,
|
|
1133
|
+
'indexen_ontbreken', (SELECT COALESCE(jsonb_agg(x->>'index'), '[]'::jsonb) FROM jsonb_array_elements(_i) x WHERE NOT (x->>'aanwezig')::boolean),
|
|
1118
1134
|
'functies_zonder_controle', (SELECT COALESCE(jsonb_agg(x->>'functie'), '[]'::jsonb) FROM jsonb_array_elements(_f) x WHERE (x->>'interne_controle') = 'false'),
|
|
1119
1135
|
'triggers_ontbreken', (SELECT COALESCE(jsonb_agg(x->>'trigger'), '[]'::jsonb) FROM jsonb_array_elements(_t) x WHERE NOT (x->>'aanwezig')::boolean),
|
|
1120
1136
|
'policies_ontbreken', (SELECT COALESCE(jsonb_agg(x->>'policy'), '[]'::jsonb) FROM jsonb_array_elements(_p) x WHERE NOT (x->>'aanwezig')::boolean));
|