@flowselections/floriday-afhandeling-module 1.0.25 → 1.0.27

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.
Files changed (123) hide show
  1. package/dist-lib/components/afhandeling/CapacityWarning.d.ts +10 -0
  2. package/dist-lib/components/afhandeling/CapacityWarning.d.ts.map +1 -0
  3. package/dist-lib/components/afhandeling/CapacityWarning.js +12 -0
  4. package/dist-lib/components/afhandeling/ControlePage.d.ts.map +1 -1
  5. package/dist-lib/components/afhandeling/ControlePage.js +7 -2
  6. package/dist-lib/components/afhandeling/DagDetailDialog.d.ts.map +1 -1
  7. package/dist-lib/components/afhandeling/DagDetailDialog.js +158 -62
  8. package/dist-lib/components/afhandeling/LeveringenPage.d.ts.map +1 -1
  9. package/dist-lib/components/afhandeling/LeveringenPage.js +2 -10
  10. package/dist-lib/components/afhandeling/PickAgendaView.d.ts.map +1 -1
  11. package/dist-lib/components/afhandeling/PickAgendaView.js +4 -11
  12. package/dist-lib/components/afhandeling/VervoerdersPage.d.ts.map +1 -1
  13. package/dist-lib/components/afhandeling/VervoerdersPage.js +2 -5
  14. package/dist-lib/components/afhandeling/VerzetOrderDialog.d.ts +14 -0
  15. package/dist-lib/components/afhandeling/VerzetOrderDialog.d.ts.map +1 -0
  16. package/dist-lib/components/afhandeling/VerzetOrderDialog.js +203 -0
  17. package/dist-lib/components/afhandeling/WeekAgendaView.d.ts.map +1 -1
  18. package/dist-lib/components/afhandeling/WeekAgendaView.js +7 -3
  19. package/dist-lib/components/pickstation/PickstationPage.d.ts.map +1 -1
  20. package/dist-lib/components/pickstation/PickstationPage.js +1 -0
  21. package/dist-lib/components/settings/VervoerdersSettingsCard.d.ts.map +1 -1
  22. package/dist-lib/components/settings/VervoerdersSettingsCard.js +2 -5
  23. package/dist-lib/hooks/useCapacityCheck.d.ts +10 -0
  24. package/dist-lib/hooks/useCapacityCheck.d.ts.map +1 -0
  25. package/dist-lib/hooks/useCapacityCheck.js +22 -0
  26. package/dist-lib/hooks/useEngineTasks.d.ts +14 -0
  27. package/dist-lib/hooks/useEngineTasks.d.ts.map +1 -0
  28. package/dist-lib/hooks/useEngineTasks.js +49 -0
  29. package/dist-lib/hooks/useOrderPlanning.d.ts +8 -2
  30. package/dist-lib/hooks/useOrderPlanning.d.ts.map +1 -1
  31. package/dist-lib/hooks/useOrderPlanning.js +95 -93
  32. package/dist-lib/index.d.ts +0 -3
  33. package/dist-lib/index.d.ts.map +1 -1
  34. package/dist-lib/index.js +1 -5
  35. package/dist-lib/integrations/supabase/auth-middleware.d.ts +9010 -5433
  36. package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
  37. package/dist-lib/integrations/supabase/client.d.ts +9010 -5433
  38. package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
  39. package/dist-lib/integrations/supabase/client.server.d.ts +9010 -5433
  40. package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
  41. package/dist-lib/integrations/supabase/types.d.ts +9184 -5544
  42. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  43. package/dist-lib/lib/afhandelingSettings.functions.d.ts +7186 -32
  44. package/dist-lib/lib/afhandelingSettings.functions.d.ts.map +1 -1
  45. package/dist-lib/lib/carriers.functions.d.ts +17965 -80
  46. package/dist-lib/lib/carriers.functions.d.ts.map +1 -1
  47. package/dist-lib/lib/cartAssignments.functions.d.ts +17965 -80
  48. package/dist-lib/lib/cartAssignments.functions.d.ts.map +1 -1
  49. package/dist-lib/lib/cartControl.functions.d.ts +35962 -170
  50. package/dist-lib/lib/cartControl.functions.d.ts.map +1 -1
  51. package/dist-lib/lib/cartControl.functions.js +103 -13
  52. package/dist-lib/lib/floriday.functions.d.ts +9010 -5433
  53. package/dist-lib/lib/floriday.functions.d.ts.map +1 -1
  54. package/dist-lib/lib/logisticsEngine/capacity.d.ts +19 -0
  55. package/dist-lib/lib/logisticsEngine/capacity.d.ts.map +1 -0
  56. package/dist-lib/lib/logisticsEngine/capacity.js +91 -0
  57. package/dist-lib/lib/logisticsEngine/engine.d.ts +99 -0
  58. package/dist-lib/lib/logisticsEngine/engine.d.ts.map +1 -0
  59. package/dist-lib/lib/logisticsEngine/engine.js +102 -0
  60. package/dist-lib/lib/logisticsEngine/reschedule.d.ts +65 -0
  61. package/dist-lib/lib/logisticsEngine/reschedule.d.ts.map +1 -0
  62. package/dist-lib/lib/logisticsEngine/reschedule.js +86 -0
  63. package/dist-lib/lib/logisticsEngine/staffPlanning.d.ts +37 -0
  64. package/dist-lib/lib/logisticsEngine/staffPlanning.d.ts.map +1 -0
  65. package/dist-lib/lib/logisticsEngine/staffPlanning.js +100 -0
  66. package/dist-lib/lib/serverFnError.d.ts +10 -0
  67. package/dist-lib/lib/serverFnError.d.ts.map +1 -0
  68. package/dist-lib/lib/serverFnError.js +29 -0
  69. package/dist-lib/lib/serverRoutes/index.d.ts +0 -1
  70. package/dist-lib/lib/serverRoutes/index.d.ts.map +1 -1
  71. package/dist-lib/lib/serverRoutes/index.js +0 -1
  72. package/dist-lib/lib/timezone.d.ts +27 -0
  73. package/dist-lib/lib/timezone.d.ts.map +1 -0
  74. package/dist-lib/lib/timezone.js +68 -0
  75. package/package.json +6 -21
  76. package/dist-lib/components/engine/CapaciteitsmaatregelenPage.d.ts +0 -2
  77. package/dist-lib/components/engine/CapaciteitsmaatregelenPage.d.ts.map +0 -1
  78. package/dist-lib/components/engine/CapaciteitsmaatregelenPage.js +0 -40
  79. package/dist-lib/components/engine/CapaciteitsmonitorPage.d.ts +0 -2
  80. package/dist-lib/components/engine/CapaciteitsmonitorPage.d.ts.map +0 -1
  81. package/dist-lib/components/engine/CapaciteitsmonitorPage.js +0 -49
  82. package/dist-lib/components/engine/FormulesPage.d.ts +0 -2
  83. package/dist-lib/components/engine/FormulesPage.d.ts.map +0 -1
  84. package/dist-lib/components/engine/FormulesPage.js +0 -252
  85. package/dist-lib/components/engine/PlaceholderPage.d.ts +0 -6
  86. package/dist-lib/components/engine/PlaceholderPage.d.ts.map +0 -1
  87. package/dist-lib/components/engine/PlaceholderPage.js +0 -6
  88. package/dist-lib/components/engine/StrategieenPage.d.ts +0 -2
  89. package/dist-lib/components/engine/StrategieenPage.d.ts.map +0 -1
  90. package/dist-lib/components/engine/StrategieenPage.js +0 -80
  91. package/dist-lib/lib/logisticsEngine/capacity.functions.d.ts +0 -64978
  92. package/dist-lib/lib/logisticsEngine/capacity.functions.d.ts.map +0 -1
  93. package/dist-lib/lib/logisticsEngine/capacity.functions.js +0 -90
  94. package/dist-lib/lib/logisticsEngine/config.d.ts +0 -140
  95. package/dist-lib/lib/logisticsEngine/config.d.ts.map +0 -1
  96. package/dist-lib/lib/logisticsEngine/config.js +0 -488
  97. package/dist-lib/lib/logisticsEngine/enginePickTime.d.ts +0 -29
  98. package/dist-lib/lib/logisticsEngine/enginePickTime.d.ts.map +0 -1
  99. package/dist-lib/lib/logisticsEngine/enginePickTime.js +0 -136
  100. package/dist-lib/lib/logisticsEngine/evaluate.functions.d.ts +0 -16278
  101. package/dist-lib/lib/logisticsEngine/evaluate.functions.d.ts.map +0 -1
  102. package/dist-lib/lib/logisticsEngine/evaluate.functions.js +0 -104
  103. package/dist-lib/lib/logisticsEngine/expression.d.ts +0 -21
  104. package/dist-lib/lib/logisticsEngine/expression.d.ts.map +0 -1
  105. package/dist-lib/lib/logisticsEngine/expression.js +0 -263
  106. package/dist-lib/lib/logisticsEngine/formulas.functions.d.ts +0 -32512
  107. package/dist-lib/lib/logisticsEngine/formulas.functions.d.ts.map +0 -1
  108. package/dist-lib/lib/logisticsEngine/formulas.functions.js +0 -58
  109. package/dist-lib/lib/logisticsEngine/safetyLayer.d.ts +0 -83
  110. package/dist-lib/lib/logisticsEngine/safetyLayer.d.ts.map +0 -1
  111. package/dist-lib/lib/logisticsEngine/safetyLayer.js +0 -182
  112. package/dist-lib/lib/logisticsEngine/strategies.functions.d.ts +0 -129961
  113. package/dist-lib/lib/logisticsEngine/strategies.functions.d.ts.map +0 -1
  114. package/dist-lib/lib/logisticsEngine/strategies.functions.js +0 -176
  115. package/dist-lib/lib/logisticsEngine/variables.d.ts +0 -29
  116. package/dist-lib/lib/logisticsEngine/variables.d.ts.map +0 -1
  117. package/dist-lib/lib/logisticsEngine/variables.js +0 -144
  118. package/dist-lib/lib/logisticsEngine/wizard.functions.d.ts +0 -64976
  119. package/dist-lib/lib/logisticsEngine/wizard.functions.d.ts.map +0 -1
  120. package/dist-lib/lib/logisticsEngine/wizard.functions.js +0 -175
  121. package/dist-lib/lib/serverRoutes/logisticsTick.handler.d.ts +0 -3
  122. package/dist-lib/lib/serverRoutes/logisticsTick.handler.d.ts.map +0 -1
  123. package/dist-lib/lib/serverRoutes/logisticsTick.handler.js +0 -42
@@ -1,176 +0,0 @@
1
- import { createServerFn } from "@tanstack/react-start";
2
- import { requireSupabaseAuth } from "../../integrations/supabase/auth-middleware";
3
- export const listStrategies = createServerFn({ method: "GET" })
4
- .middleware([requireSupabaseAuth])
5
- .handler(async ({ context }) => {
6
- const supabase = context.supabase;
7
- const { data, error } = await supabase
8
- .from("logistics_strategies")
9
- .select("*")
10
- .eq("user_id", context.userId)
11
- .order("priority", { ascending: false })
12
- .order("created_at", { ascending: false });
13
- if (error)
14
- throw new Error(error.message);
15
- return { strategies: (data ?? []) };
16
- });
17
- export const saveStrategy = createServerFn({ method: "POST" })
18
- .middleware([requireSupabaseAuth])
19
- .inputValidator((d) => ({
20
- id: d.id,
21
- name: String(d.name ?? "").trim().slice(0, 120) || "Naamloze strategie",
22
- description: d.description ? String(d.description).slice(0, 1000) : null,
23
- priority: Math.max(0, Math.min(9999, Math.floor(Number(d.priority ?? 100)))),
24
- color: (d.color ?? "#3b82f6").slice(0, 20),
25
- }))
26
- .handler(async ({ data, context }) => {
27
- const supabase = context.supabase;
28
- if (data.id) {
29
- const { data: row, error } = await supabase
30
- .from("logistics_strategies")
31
- .update({
32
- name: data.name,
33
- description: data.description,
34
- priority: data.priority,
35
- color: data.color,
36
- updated_by: context.userId,
37
- })
38
- .eq("id", data.id)
39
- .eq("user_id", context.userId)
40
- .select("*")
41
- .single();
42
- if (error)
43
- throw new Error(error.message);
44
- return { strategy: row };
45
- }
46
- const { data: row, error } = await supabase
47
- .from("logistics_strategies")
48
- .insert({
49
- user_id: context.userId,
50
- name: data.name,
51
- description: data.description,
52
- priority: data.priority,
53
- color: data.color,
54
- updated_by: context.userId,
55
- })
56
- .select("*")
57
- .single();
58
- if (error)
59
- throw new Error(error.message);
60
- return { strategy: row };
61
- });
62
- export const deleteStrategy = createServerFn({ method: "POST" })
63
- .middleware([requireSupabaseAuth])
64
- .inputValidator((d) => ({ id: String(d.id) }))
65
- .handler(async ({ data, context }) => {
66
- const supabase = context.supabase;
67
- const { error } = await supabase
68
- .from("logistics_strategies")
69
- .delete()
70
- .eq("id", data.id)
71
- .eq("user_id", context.userId);
72
- if (error)
73
- throw new Error(error.message);
74
- return { ok: true };
75
- });
76
- export const activateStrategy = createServerFn({ method: "POST" })
77
- .middleware([requireSupabaseAuth])
78
- .inputValidator((d) => ({ id: String(d.id) }))
79
- .handler(async ({ data, context }) => {
80
- const supabase = context.supabase;
81
- // Deactiveer eerst alles, dan activeer de nieuwe
82
- const { error: e1 } = await supabase
83
- .from("logistics_strategies")
84
- .update({ is_active: false })
85
- .eq("user_id", context.userId)
86
- .neq("id", data.id);
87
- if (e1)
88
- throw new Error(e1.message);
89
- const { error: e2 } = await supabase
90
- .from("logistics_strategies")
91
- .update({ is_active: true, updated_by: context.userId })
92
- .eq("id", data.id)
93
- .eq("user_id", context.userId);
94
- if (e2)
95
- throw new Error(e2.message);
96
- return { ok: true };
97
- });
98
- export const deactivateAllStrategies = createServerFn({ method: "POST" })
99
- .middleware([requireSupabaseAuth])
100
- .handler(async ({ context }) => {
101
- const supabase = context.supabase;
102
- const { error } = await supabase
103
- .from("logistics_strategies")
104
- .update({ is_active: false })
105
- .eq("user_id", context.userId);
106
- if (error)
107
- throw new Error(error.message);
108
- return { ok: true };
109
- });
110
- export const listSchedules = createServerFn({ method: "GET" })
111
- .middleware([requireSupabaseAuth])
112
- .handler(async ({ context }) => {
113
- const supabase = context.supabase;
114
- const { data, error } = await supabase
115
- .from("logistics_strategy_schedules")
116
- .select("*")
117
- .eq("user_id", context.userId)
118
- .order("priority", { ascending: false });
119
- if (error)
120
- throw new Error(error.message);
121
- return { schedules: (data ?? []) };
122
- });
123
- export const saveSchedule = createServerFn({ method: "POST" })
124
- .middleware([requireSupabaseAuth])
125
- .inputValidator((d) => ({
126
- id: d.id,
127
- strategy_id: String(d.strategy_id),
128
- rule_type: d.rule_type === "condition" ? "condition" : "date_range",
129
- start_date: d.start_date || null,
130
- end_date: d.end_date || null,
131
- condition_expression: d.condition_expression ? String(d.condition_expression).slice(0, 2000) : null,
132
- priority: Math.max(0, Math.min(9999, Math.floor(Number(d.priority ?? 100)))),
133
- is_enabled: d.is_enabled === undefined ? true : Boolean(d.is_enabled),
134
- }))
135
- .handler(async ({ data, context }) => {
136
- const supabase = context.supabase;
137
- const payload = {
138
- user_id: context.userId,
139
- strategy_id: data.strategy_id,
140
- rule_type: data.rule_type,
141
- start_date: data.start_date,
142
- end_date: data.end_date,
143
- condition_expression: data.condition_expression,
144
- priority: data.priority,
145
- is_enabled: data.is_enabled,
146
- };
147
- if (data.id) {
148
- const { error } = await supabase
149
- .from("logistics_strategy_schedules")
150
- .update(payload)
151
- .eq("id", data.id)
152
- .eq("user_id", context.userId);
153
- if (error)
154
- throw new Error(error.message);
155
- }
156
- else {
157
- const { error } = await supabase.from("logistics_strategy_schedules").insert(payload);
158
- if (error)
159
- throw new Error(error.message);
160
- }
161
- return { ok: true };
162
- });
163
- export const deleteSchedule = createServerFn({ method: "POST" })
164
- .middleware([requireSupabaseAuth])
165
- .inputValidator((d) => ({ id: String(d.id) }))
166
- .handler(async ({ data, context }) => {
167
- const supabase = context.supabase;
168
- const { error } = await supabase
169
- .from("logistics_strategy_schedules")
170
- .delete()
171
- .eq("id", data.id)
172
- .eq("user_id", context.userId);
173
- if (error)
174
- throw new Error(error.message);
175
- return { ok: true };
176
- });
@@ -1,29 +0,0 @@
1
- /**
2
- * Beschikbare (builtin) variabelen en functies voor formules.
3
- * Wordt gebruikt in de Formule Editor UI en als default context in de evaluator.
4
- */
5
- export interface BuiltinVariable {
6
- key: string;
7
- label: string;
8
- category: string;
9
- type: "number" | "boolean" | "string";
10
- description?: string;
11
- exampleValue: number | boolean | string;
12
- }
13
- export declare const BUILTIN_VARIABLES: BuiltinVariable[];
14
- export declare const BUILTIN_FUNCTIONS: {
15
- name: string;
16
- signature: string;
17
- description: string;
18
- }[];
19
- export interface FormulaSlot {
20
- key: string;
21
- step: number;
22
- label: string;
23
- description: string;
24
- expects: "boolean" | "number";
25
- defaultExpression?: string;
26
- }
27
- export declare const FORMULA_SLOTS: FormulaSlot[];
28
- export declare function buildExampleContext(): Record<string, number | string | boolean>;
29
- //# sourceMappingURL=variables.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../../src/lib/logisticsEngine/variables.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;CACzC;AAED,eAAO,MAAM,iBAAiB,EAAE,eAAe,EAwD9C,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,EAUvF,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,aAAa,EAAE,WAAW,EAiEtC,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAI/E"}
@@ -1,144 +0,0 @@
1
- /**
2
- * Beschikbare (builtin) variabelen en functies voor formules.
3
- * Wordt gebruikt in de Formule Editor UI en als default context in de evaluator.
4
- */
5
- export const BUILTIN_VARIABLES = [
6
- // Tijd
7
- { key: "nowMs", label: "Huidige tijd (ms)", category: "Tijd", type: "number", exampleValue: Date.now() },
8
- { key: "hourOfDay", label: "Uur van de dag (0-23)", category: "Tijd", type: "number", exampleValue: 9 },
9
- { key: "isoWeekday", label: "Dag van de week (1=ma..7=zo)", category: "Tijd", type: "number", exampleValue: 2 },
10
- { key: "isWeekend", label: "Is weekend", category: "Tijd", type: "boolean", exampleValue: false },
11
- { key: "isHoliday", label: "Is feestdag", category: "Tijd", type: "boolean", exampleValue: false },
12
- { key: "leverdatum", label: "Leverdatum (ms)", category: "Tijd", type: "number", exampleValue: Date.now() + 86400000 },
13
- { key: "ophaaltijdVervoerder", label: "Ophaaltijd vervoerder (ms)", category: "Tijd", type: "number", exampleValue: Date.now() + 7200000 },
14
- { key: "nogBeschikbarePicktijd", label: "Nog beschikbare picktijd (uur)", category: "Tijd", type: "number", exampleValue: 4 },
15
- // Capaciteit
16
- { key: "pickCapacityPerHour", label: "Pickcapaciteit per uur (karren/uur)", category: "Capaciteit", type: "number", exampleValue: 10 },
17
- { key: "maxOpenCarts", label: "Max aantal open karren", category: "Capaciteit", type: "number", exampleValue: 60 },
18
- { key: "freeCapacity", label: "Vrije capaciteit (karren)", category: "Capaciteit", type: "number", exampleValue: 20 },
19
- { key: "beschikbareCapaciteit", label: "Beschikbare capaciteit (karren)", category: "Capaciteit", type: "number", description: "nogBeschikbarePicktijd × pickCapacityPerHour", exampleValue: 40 },
20
- { key: "benodigdeCapaciteit", label: "Benodigde capaciteit (karren)", category: "Capaciteit", type: "number", description: "volleKarren + verwachteOpenKarren", exampleValue: 32 },
21
- { key: "logistiekeDruk", label: "Logistieke druk (0-1)", category: "Capaciteit", type: "number", description: "benodigdeCapaciteit / beschikbareCapaciteit", exampleValue: 0.8 },
22
- { key: "veiligheidsBuffer", label: "Veiligheidsbuffer (0-1)", category: "Capaciteit", type: "number", exampleValue: 0.1 },
23
- { key: "sluitDrempel", label: "Sluitdrempel druk (0-1)", category: "Capaciteit", type: "number", exampleValue: 0.9 },
24
- { key: "drukRustig", label: "Grens rustig (0-1)", category: "Capaciteit", type: "number", exampleValue: 0.7 },
25
- { key: "drukNormaal", label: "Grens normaal (0-1)", category: "Capaciteit", type: "number", exampleValue: 0.9 },
26
- { key: "drukDruk", label: "Grens druk (0-1)", category: "Capaciteit", type: "number", exampleValue: 1.0 },
27
- // Orders
28
- { key: "orderCount", label: "Aantal open orders", category: "Orders", type: "number", exampleValue: 50 },
29
- { key: "customerCount", label: "Aantal klanten", category: "Orders", type: "number", exampleValue: 12 },
30
- { key: "deliveryLocationCount", label: "Aantal afleverlocaties", category: "Orders", type: "number", exampleValue: 14 },
31
- { key: "orderType", label: "Ordertype (veiling/bvo/handmatig)", category: "Orders", type: "string", exampleValue: "veiling" },
32
- { key: "layerCount", label: "Aantal lagen order", category: "Orders", type: "number", exampleValue: 3 },
33
- { key: "crateCount", label: "Aantal fusten", category: "Orders", type: "number", exampleValue: 24 },
34
- { key: "hasStickers", label: "Stickers aanwezig", category: "Orders", type: "boolean", exampleValue: false },
35
- { key: "prioriteit", label: "Prioriteit order (1-10)", category: "Orders", type: "number", exampleValue: 5 },
36
- { key: "fusttype", label: "Fusttype", category: "Orders", type: "string", exampleValue: "DC" },
37
- // Karren
38
- { key: "openCarts", label: "Aantal open karren", category: "Karren", type: "number", exampleValue: 28 },
39
- { key: "volleKarren", label: "Volle karren", category: "Karren", type: "number", exampleValue: 5 },
40
- { key: "halfvolleKarren", label: "Halfvolle karren", category: "Karren", type: "number", exampleValue: 8 },
41
- { key: "verwachteOpenKarren", label: "Verwachte nog te openen karren", category: "Karren", type: "number", exampleValue: 12 },
42
- { key: "avgFilling", label: "Gemiddelde vulling (%)", category: "Karren", type: "number", exampleValue: 72 },
43
- { key: "cartMaxLayers", label: "Maximale lagen per kar", category: "Karren", type: "number", exampleValue: 5 },
44
- { key: "cartMaxWeight", label: "Maximaal gewicht per kar (kg)", category: "Karren", type: "number", exampleValue: 350 },
45
- { key: "cartWeight", label: "Huidig gewicht kar (kg)", category: "Karren", type: "number", exampleValue: 200 },
46
- { key: "cartFillPct", label: "Kar vulpercentage (%)", category: "Karren", type: "number", exampleValue: 85 },
47
- { key: "maxKlantenPerKar", label: "Max klanten per kar", category: "Karren", type: "number", exampleValue: 3 },
48
- { key: "maxLagenPerKlantCombi", label: "Max lagen per klant om te combineren", category: "Karren", type: "number", exampleValue: 3 },
49
- // Transport
50
- { key: "carrierName", label: "Vervoerder", category: "Transport", type: "string", exampleValue: "" },
51
- { key: "country", label: "Land", category: "Transport", type: "string", exampleValue: "NL" },
52
- { key: "route", label: "Route", category: "Transport", type: "string", exampleValue: "R1" },
53
- { key: "leadtimeMinutes", label: "Leadtime (minuten)", category: "Transport", type: "number", exampleValue: 60 },
54
- // Status
55
- { key: "packingSlipReady", label: "Pakbon gemaakt", category: "Documenten", type: "boolean", exampleValue: true },
56
- { key: "auctionLetterReady", label: "Veilingbrief gemaakt", category: "Documenten", type: "boolean", exampleValue: true },
57
- { key: "deliveryNoteReady", label: "Afleverbrief gemaakt", category: "Documenten", type: "boolean", exampleValue: false },
58
- { key: "batchClosed", label: "Batch gesloten", category: "Documenten", type: "boolean", exampleValue: false },
59
- { key: "plannerApproved", label: "Planner akkoord", category: "Documenten", type: "boolean", exampleValue: false },
60
- { key: "cartChecked", label: "Kar gecontroleerd", category: "Documenten", type: "boolean", exampleValue: false },
61
- ];
62
- export const BUILTIN_FUNCTIONS = [
63
- { name: "IF", signature: "IF(cond, a, b)", description: "Kies a als cond waar is, anders b" },
64
- { name: "min", signature: "min(a, b, ...)", description: "Kleinste waarde" },
65
- { name: "max", signature: "max(a, b, ...)", description: "Grootste waarde" },
66
- { name: "abs", signature: "abs(x)", description: "Absolute waarde" },
67
- { name: "round", signature: "round(x)", description: "Afronden" },
68
- { name: "floor", signature: "floor(x)", description: "Naar beneden afronden" },
69
- { name: "ceil", signature: "ceil(x)", description: "Naar boven afronden" },
70
- { name: "now", signature: "now()", description: "Huidige tijd in ms" },
71
- { name: "minutesBetween", signature: "minutesBetween(a, b)", description: "Minuten tussen twee tijden" },
72
- ];
73
- export const FORMULA_SLOTS = [
74
- {
75
- key: "beschikbare_capaciteit",
76
- step: 2,
77
- label: "Stap 2 — Beschikbare pickcapaciteit",
78
- description: "Hoeveel karren kunnen we nog picken? Standaard: nogBeschikbarePicktijd × pickCapacityPerHour.",
79
- expects: "number",
80
- defaultExpression: "nogBeschikbarePicktijd * pickCapacityPerHour",
81
- },
82
- {
83
- key: "benodigde_capaciteit",
84
- step: 3,
85
- label: "Stap 3 — Benodigde capaciteit",
86
- description: "Hoeveel karren moeten we nog verwerken? Standaard: volleKarren + verwachteOpenKarren.",
87
- expects: "number",
88
- defaultExpression: "volleKarren + verwachteOpenKarren",
89
- },
90
- {
91
- key: "logistieke_druk",
92
- step: 4,
93
- label: "Stap 4 — Logistieke druk",
94
- description: "Druk = benodigd / beschikbaar. <70% rustig · 70-90% normaal · 90-100% druk · >100% overcapaciteit.",
95
- expects: "number",
96
- defaultExpression: "benodigdeCapaciteit / beschikbareCapaciteit",
97
- },
98
- {
99
- key: "sluit_batch",
100
- step: 5,
101
- label: "Stap 5 — Sluit batch",
102
- description: "TRUE = huidige batch wordt afgesloten en karren worden opgebouwd.",
103
- expects: "boolean",
104
- defaultExpression: "logistiekeDruk >= sluitDrempel",
105
- },
106
- {
107
- key: "cart_full",
108
- step: 8,
109
- label: "Stap 8 — Kar is vol",
110
- description: "TRUE = kar wordt automatisch afgesloten (capaciteit / gewicht / lagen / eigen regel).",
111
- expects: "boolean",
112
- defaultExpression: "cartFillPct >= 100 OR cartWeight >= cartMaxWeight OR layerCount >= cartMaxLayers",
113
- },
114
- {
115
- key: "may_combine",
116
- step: 7,
117
- label: "Stap 7 — Mag combineren",
118
- description: "TRUE = deze order mag met andere kleine orders op één kar. Zet voorwaarden aan/uit door ze weg te laten.",
119
- expects: "boolean",
120
- defaultExpression: "orderType == \"veiling\" AND layerCount <= maxLagenPerKlantCombi",
121
- },
122
- {
123
- key: "pickstation_visible",
124
- step: 10,
125
- label: "Stap 10 — Kar zichtbaar op Pickstation",
126
- description: "TRUE = kar mag getoond worden aan medewerker. Combineer batch/documenten/planner/controle.",
127
- expects: "boolean",
128
- defaultExpression: "batchClosed AND packingSlipReady",
129
- },
130
- {
131
- key: "start_moment",
132
- step: 6,
133
- label: "Stap 6 — Startmoment picken (min. voor vertrek)",
134
- description: "Aantal minuten vóór ophaaltijd waarop picken moet starten.",
135
- expects: "number",
136
- defaultExpression: "leadtimeMinutes + 30",
137
- },
138
- ];
139
- export function buildExampleContext() {
140
- const ctx = {};
141
- for (const v of BUILTIN_VARIABLES)
142
- ctx[v.key] = v.exampleValue;
143
- return ctx;
144
- }