@flowselections/floriday-voorraad 1.0.27 → 1.0.28
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/voorraad/ArtikelWizard.d.ts.map +1 -1
- package/dist-lib/components/voorraad/ArtikelWizard.js +21 -8
- package/dist-lib/components/voorraad/EditArtikelPage.d.ts.map +1 -1
- package/dist-lib/components/voorraad/EditArtikelPage.js +3 -2
- package/dist-lib/components/voorraad/ProductCustomFieldsCard.d.ts +5 -0
- package/dist-lib/components/voorraad/ProductCustomFieldsCard.d.ts.map +1 -0
- package/dist-lib/components/voorraad/ProductCustomFieldsCard.js +65 -0
- package/dist-lib/components/voorraad/StockBulkButtons.d.ts.map +1 -1
- package/dist-lib/components/voorraad/StockBulkButtons.js +65 -2
- package/dist-lib/components/voorraad/ValidationOverviewTable.d.ts.map +1 -1
- package/dist-lib/components/voorraad/ValidationOverviewTable.js +8 -2
- package/dist-lib/components/voorraad/VoorraadDashboard.d.ts.map +1 -1
- package/dist-lib/components/voorraad/VoorraadDashboard.js +4 -1
- package/dist-lib/components/voorraad/VoorraadTable.d.ts.map +1 -1
- package/dist-lib/components/voorraad/VoorraadTable.js +10 -2
- package/dist-lib/components/voorraad/VoorraadVeldenCard.d.ts +2 -0
- package/dist-lib/components/voorraad/VoorraadVeldenCard.d.ts.map +1 -0
- package/dist-lib/components/voorraad/VoorraadVeldenCard.js +97 -0
- package/dist-lib/hooks/useLocalTradeItems.d.ts +4 -4
- package/dist-lib/hooks/useLocalTradeItems.d.ts.map +1 -1
- package/dist-lib/hooks/useLocalTradeItems.js +59 -35
- package/dist-lib/hooks/useVoorraadCustomFields.d.ts +9 -0
- package/dist-lib/hooks/useVoorraadCustomFields.d.ts.map +1 -0
- package/dist-lib/hooks/useVoorraadCustomFields.js +26 -0
- package/dist-lib/index.d.ts +2 -0
- package/dist-lib/index.d.ts.map +1 -1
- package/dist-lib/index.js +4 -1
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +2358 -177
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +2358 -177
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +2358 -177
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +2428 -174
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.js +49 -0
- package/dist-lib/lib/floricode-required-features.functions.d.ts +2358 -177
- package/dist-lib/lib/floricode-required-features.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-customer-offer.functions.d.ts +2358 -177
- package/dist-lib/lib/floriday-customer-offer.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-gateway.functions.d.ts +49617 -38712
- package/dist-lib/lib/floriday-gateway.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-vbn-required.functions.d.ts +13843 -9481
- package/dist-lib/lib/floriday-vbn-required.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-warehouse.functions.d.ts +25719 -19176
- package/dist-lib/lib/floriday-warehouse.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-writes.functions.d.ts +13826 -9464
- package/dist-lib/lib/floriday-writes.functions.d.ts.map +1 -1
- package/dist-lib/lib/voorraad-custom-fields.d.ts +22 -0
- package/dist-lib/lib/voorraad-custom-fields.d.ts.map +1 -0
- package/dist-lib/lib/voorraad-custom-fields.js +71 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type VoorraadFieldType = "text" | "number" | "date" | "select" | "boolean";
|
|
2
|
+
export interface VoorraadCustomField {
|
|
3
|
+
id: string;
|
|
4
|
+
field_key: string;
|
|
5
|
+
field_label: string;
|
|
6
|
+
field_type: VoorraadFieldType;
|
|
7
|
+
options: string[];
|
|
8
|
+
show_in_template: boolean;
|
|
9
|
+
show_in_columns: boolean;
|
|
10
|
+
show_in_detail: boolean;
|
|
11
|
+
sort_order: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function slugifyFieldKey(label: string): string;
|
|
14
|
+
export declare function fetchVoorraadCustomFields(): Promise<VoorraadCustomField[]>;
|
|
15
|
+
export declare function createVoorraadCustomField(input: Omit<VoorraadCustomField, "id">): Promise<void>;
|
|
16
|
+
export declare function updateVoorraadCustomField(id: string, patch: Partial<Omit<VoorraadCustomField, "id">>): Promise<void>;
|
|
17
|
+
export declare function deleteVoorraadCustomField(id: string): Promise<void>;
|
|
18
|
+
/** Waarden van eigen velden staan in `products.custom_fields` (jsonb). */
|
|
19
|
+
export declare function fetchProductCustomValues(productId: string): Promise<Record<string, unknown>>;
|
|
20
|
+
export declare function saveProductCustomValues(productId: string, values: Record<string, unknown>): Promise<void>;
|
|
21
|
+
export declare function formatCustomValue(value: unknown): string;
|
|
22
|
+
//# sourceMappingURL=voorraad-custom-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voorraad-custom-fields.d.ts","sourceRoot":"","sources":["../../src/lib/voorraad-custom-fields.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElF,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,iBAAiB,CAAC;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB;AAOD,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQrD;AAED,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAWhF;AAED,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,GACrC,OAAO,CAAC,IAAI,CAAC,CAGf;AAED,wBAAsB,yBAAyB,CAC7C,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC,GAC9C,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,yBAAyB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGzE;AAED,0EAA0E;AAC1E,wBAAsB,wBAAwB,CAC5C,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CASlC;AAED,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAIxD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { supabase } from "../integrations/supabase/client";
|
|
2
|
+
const TABLE = "voorraad_custom_fields";
|
|
3
|
+
const SELECT = "id,field_key,field_label,field_type,options,show_in_template,show_in_columns,show_in_detail,sort_order";
|
|
4
|
+
export function slugifyFieldKey(label) {
|
|
5
|
+
return label
|
|
6
|
+
.toLowerCase()
|
|
7
|
+
.normalize("NFD")
|
|
8
|
+
.replace(/[\u0300-\u036f]/g, "")
|
|
9
|
+
.replace(/[^a-z0-9]+/g, "_")
|
|
10
|
+
.replace(/^_+|_+$/g, "")
|
|
11
|
+
.slice(0, 48);
|
|
12
|
+
}
|
|
13
|
+
export async function fetchVoorraadCustomFields() {
|
|
14
|
+
const { data, error } = await supabase
|
|
15
|
+
.from(TABLE)
|
|
16
|
+
.select(SELECT)
|
|
17
|
+
.order("sort_order", { ascending: true })
|
|
18
|
+
.order("created_at", { ascending: true });
|
|
19
|
+
if (error)
|
|
20
|
+
throw new Error(error.message);
|
|
21
|
+
return (data ?? []).map((f) => ({
|
|
22
|
+
...f,
|
|
23
|
+
options: Array.isArray(f.options) ? f.options : [],
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
export async function createVoorraadCustomField(input) {
|
|
27
|
+
const { error } = await supabase.from(TABLE).insert(input);
|
|
28
|
+
if (error)
|
|
29
|
+
throw new Error(error.message);
|
|
30
|
+
}
|
|
31
|
+
export async function updateVoorraadCustomField(id, patch) {
|
|
32
|
+
const { error } = await supabase
|
|
33
|
+
.from(TABLE)
|
|
34
|
+
.update(patch)
|
|
35
|
+
.eq("id", id);
|
|
36
|
+
if (error)
|
|
37
|
+
throw new Error(error.message);
|
|
38
|
+
}
|
|
39
|
+
export async function deleteVoorraadCustomField(id) {
|
|
40
|
+
const { error } = await supabase.from(TABLE).delete().eq("id", id);
|
|
41
|
+
if (error)
|
|
42
|
+
throw new Error(error.message);
|
|
43
|
+
}
|
|
44
|
+
/** Waarden van eigen velden staan in `products.custom_fields` (jsonb). */
|
|
45
|
+
export async function fetchProductCustomValues(productId) {
|
|
46
|
+
const { data, error } = await supabase
|
|
47
|
+
.from("products")
|
|
48
|
+
.select("custom_fields")
|
|
49
|
+
.eq("id", productId)
|
|
50
|
+
.maybeSingle();
|
|
51
|
+
if (error)
|
|
52
|
+
throw new Error(error.message);
|
|
53
|
+
const cf = data?.custom_fields;
|
|
54
|
+
return cf && typeof cf === "object" && !Array.isArray(cf) ? cf : {};
|
|
55
|
+
}
|
|
56
|
+
export async function saveProductCustomValues(productId, values) {
|
|
57
|
+
const current = await fetchProductCustomValues(productId);
|
|
58
|
+
const { error } = await supabase
|
|
59
|
+
.from("products")
|
|
60
|
+
.update({ custom_fields: { ...current, ...values } })
|
|
61
|
+
.eq("id", productId);
|
|
62
|
+
if (error)
|
|
63
|
+
throw new Error(error.message);
|
|
64
|
+
}
|
|
65
|
+
export function formatCustomValue(value) {
|
|
66
|
+
if (value === null || value === undefined || value === "")
|
|
67
|
+
return "—";
|
|
68
|
+
if (typeof value === "boolean")
|
|
69
|
+
return value ? "Ja" : "Nee";
|
|
70
|
+
return String(value);
|
|
71
|
+
}
|