@naisys/erp 3.0.0-beta.46 → 3.0.0-beta.48

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 (62) hide show
  1. package/client-dist/assets/{index-BWVp_WEm.js → index-Bu_bS_Vd.js} +723 -698
  2. package/client-dist/index.html +1 -1
  3. package/dist/{erpDb.js → database/erpDb.js} +1 -1
  4. package/dist/erpRoutes.js +28 -28
  5. package/dist/erpServer.js +7 -7
  6. package/dist/{auth-middleware.js → middleware/auth-middleware.js} +1 -1
  7. package/dist/route-helpers.js +2 -2
  8. package/dist/routes/admin.js +3 -3
  9. package/dist/routes/audit.js +1 -1
  10. package/dist/routes/{item-fields.js → items/item-fields.js} +7 -7
  11. package/dist/routes/{item-instances.js → items/item-instances.js} +7 -7
  12. package/dist/routes/{items.js → items/items.js} +5 -5
  13. package/dist/routes/{operation-dependencies.js → operations/operation-dependencies.js} +6 -6
  14. package/dist/routes/{operation-field-refs.js → operations/operation-field-refs.js} +6 -6
  15. package/dist/routes/{operation-run-comments.js → operations/operation-run-comments.js} +5 -5
  16. package/dist/routes/{operation-run-transitions.js → operations/operation-run-transitions.js} +6 -6
  17. package/dist/routes/{operation-runs.js → operations/operation-runs.js} +5 -5
  18. package/dist/routes/{operations.js → operations/operations.js} +6 -6
  19. package/dist/routes/{order-revision-transitions.js → orders/order-revision-transitions.js} +4 -4
  20. package/dist/routes/{order-revisions.js → orders/order-revisions.js} +6 -6
  21. package/dist/routes/{order-run-transitions.js → orders/order-run-transitions.js} +4 -4
  22. package/dist/routes/{order-runs.js → orders/order-runs.js} +5 -5
  23. package/dist/routes/{orders.js → orders/orders.js} +5 -5
  24. package/dist/routes/{dispatch.js → production/dispatch.js} +3 -3
  25. package/dist/routes/{inventory.js → production/inventory.js} +3 -3
  26. package/dist/routes/{labor-tickets.js → production/labor-tickets.js} +5 -5
  27. package/dist/routes/{work-centers.js → production/work-centers.js} +5 -5
  28. package/dist/routes/root.js +1 -1
  29. package/dist/routes/{step-field-attachments.js → steps/step-field-attachments.js} +8 -8
  30. package/dist/routes/{step-fields.js → steps/step-fields.js} +6 -6
  31. package/dist/routes/{step-run-fields.js → steps/step-run-fields.js} +9 -9
  32. package/dist/routes/{step-run-transitions.js → steps/step-run-transitions.js} +6 -6
  33. package/dist/routes/{step-runs.js → steps/step-runs.js} +7 -7
  34. package/dist/routes/{steps.js → steps/steps.js} +5 -5
  35. package/dist/routes/{auth.js → users/auth.js} +4 -4
  36. package/dist/routes/{user-permissions.js → users/user-permissions.js} +4 -4
  37. package/dist/routes/{users.js → users/users.js} +5 -5
  38. package/dist/services/attachment-service.js +1 -1
  39. package/dist/services/{item-instance-service.js → inventory/item-instance-service.js} +2 -2
  40. package/dist/services/{item-service.js → inventory/item-service.js} +2 -2
  41. package/dist/services/{operation-dependency-service.js → operations/operation-dependency-service.js} +1 -1
  42. package/dist/services/{operation-run-comment-service.js → operations/operation-run-comment-service.js} +1 -1
  43. package/dist/services/{operation-run-service.js → operations/operation-run-service.js} +3 -3
  44. package/dist/services/{operation-service.js → operations/operation-service.js} +2 -2
  45. package/dist/services/{step-run-service.js → operations/step-run-service.js} +1 -1
  46. package/dist/services/{step-service.js → operations/step-service.js} +2 -2
  47. package/dist/services/{order-revision-service.js → orders/order-revision-service.js} +2 -2
  48. package/dist/services/{order-run-service.js → orders/order-run-service.js} +2 -2
  49. package/dist/services/{order-service.js → orders/order-service.js} +2 -2
  50. package/dist/services/{revision-diff-service.js → orders/revision-diff-service.js} +1 -1
  51. package/dist/services/{field-ref-service.js → production/field-ref-service.js} +1 -1
  52. package/dist/services/{field-service.js → production/field-service.js} +2 -2
  53. package/dist/services/{field-value-service.js → production/field-value-service.js} +1 -1
  54. package/dist/services/{labor-ticket-service.js → production/labor-ticket-service.js} +1 -1
  55. package/dist/services/{work-center-service.js → production/work-center-service.js} +2 -2
  56. package/dist/services/user-service.js +84 -1
  57. package/npm-shrinkwrap.json +28 -28
  58. package/package.json +6 -6
  59. package/dist/userService.js +0 -87
  60. /package/dist/{dbConfig.js → database/dbConfig.js} +0 -0
  61. /package/dist/{supervisorAuth.js → middleware/supervisorAuth.js} +0 -0
  62. /package/dist/{audit.js → services/audit.js} +0 -0
@@ -31,11 +31,36 @@ import { $ as string, $t as Popover, A as IconPlus, At as Modal, B as IconCheck,
31
31
  }
32
32
  })();
33
33
  //#endregion
34
- //#region ../../../packages/common/dist/constants.js
34
+ //#region ../../../packages/common/dist/auth/urlSafeKey.js
35
35
  var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
36
36
  var import_client = /* @__PURE__ */ __toESM(require_client(), 1);
37
+ /** Characters allowed in URL path segments used as database keys (usernames, hostnames). */
38
+ var URL_SAFE_KEY_REGEX = /^[a-zA-Z0-9_-]+$/;
39
+ var URL_SAFE_KEY_MESSAGE = "Must contain only letters, numbers, hyphens, and underscores";
40
+ //#endregion
41
+ //#region ../../../packages/common/dist/config/constants.js
42
+ /** Target megapixels for screenshots sent to LLMs during computer use */
43
+ var TARGET_MEGAPIXELS = 1.1;
44
+ //#endregion
45
+ //#region ../../../packages/common/dist/agent/agentConfigFile.js
46
+ var commandProtectionValues = [
47
+ "none",
48
+ "manual",
49
+ "semi-auto",
50
+ "auto"
51
+ ];
52
+ var continuityValues = [
53
+ "fresh",
54
+ "summary",
55
+ "full"
56
+ ];
57
+ object({ continuity: string().optional() }).loose();
37
58
  object({
38
- username: string().min(1, "Username is required").regex(/^[a-zA-Z0-9_-]+$/, "Must contain only letters, numbers, hyphens, and underscores").describe("The name the agent identifies itself with when communicating with other agents"),
59
+ spendLimitDollars: number().optional(),
60
+ spendLimitHours: number().optional()
61
+ }).loose();
62
+ object({
63
+ username: string().min(1, "Username is required").regex(URL_SAFE_KEY_REGEX, URL_SAFE_KEY_MESSAGE).describe("The name the agent identifies itself with when communicating with other agents"),
39
64
  title: string().describe("Displayed to other agents to give context about this agent's role in the system"),
40
65
  agentPrompt: string().min(1, "Agent prompt is required").describe("Gives the agent instructions and/or purpose when starting up. Supports ${agent.*} and ${env.*} template variables"),
41
66
  spendLimitDollars: number().min(0, "Must be non-negative").optional().describe("Spend limit in dollars for this agent. When set, this agent is exempt from the global spend limit. Defaults to the SPEND_LIMIT_DOLLARS variable"),
@@ -43,27 +68,97 @@ object({
43
68
  tokenMax: number().int("Must be a whole number").min(1, "Must be at least 1").describe("How many tokens this agent is allocated per session before it must end or compact the context"),
44
69
  shellModel: string().min(1, "Shell model is required").describe("Primary LLM used for shell interactions"),
45
70
  imageModel: string().optional().describe("Model used for image generation"),
46
- mailEnabled: boolean().optional().describe("Show mail commands to the agent. Mail encourages verbose communication which can be distracting"),
71
+ mailEnabled: boolean().optional().describe("Legacy: Mail encourages more verbose communication, but is more confusing to follow, especially when combined with chat"),
47
72
  chatEnabled: boolean().optional().describe("Show chat commands to the agent. Chat encourages more concise communication"),
48
73
  webEnabled: boolean().optional().describe("Allow agent to browse the web with a context-optimized text browser built on Lynx. Javascript not supported. Requires `lynx` on the host (e.g. `apt install lynx`)"),
49
74
  browserEnabled: boolean().optional().describe("Allow agent to browse the web with a real headless Chromium browser via Playwright. Vision-capable models see screenshots; others fall back to a text/selector mode. Requires `npx playwright install chromium` on the host"),
50
- completeSessionEnabled: boolean().optional().describe("Allow the agent to end its session. Once ended, it can only be restarted explicitly or via chat/mail if wakeOnMessage is enabled. Disable on root agents to prevent the system from going unresponsive"),
75
+ completeSessionEnabled: boolean().optional().describe("Allow the agent to end its own session. Once ended, it can only be restarted explicitly or via chat/mail if wakeOnMessage is enabled. Turn off for agents you've instructed to wake periodically. The auto-compact advanced setting can be used to minimize idling costs."),
51
76
  debugPauseSeconds: number().int("Must be a whole number").min(0, "Must be non-negative").optional().describe("Seconds to wait at the debug prompt before auto-continuing, only applies when the agent's console is in focus. Set to 0 to continue immediately. Unset waits indefinitely for manual input"),
52
77
  wakeOnMessage: boolean().optional().describe("When mail or chat is received, start the agent automatically, or wake it from its wait state"),
53
- commandProtection: _enum([
54
- "none",
55
- "manual",
56
- "semi-auto",
57
- "auto"
58
- ]).optional().describe("None allows the LLM to run any command, Manual requires user confirmation for each command, and Auto uses a secondary LLM to try to validate a command is safe"),
78
+ commandProtection: _enum(commandProtectionValues).optional().describe("Only works in standalone mode. None allows the LLM to run any command, Manual requires user confirmation for each command, and Auto uses a secondary LLM to try to validate a command is safe"),
79
+ autoCompact: boolean().optional().describe("Automatically compact the session after five minutes of idle time to save on API costs by avoiding cache-miss reads. Good for agents that idle for long periods."),
80
+ continuity: _enum(continuityValues).optional().describe("How a new run starts: 'fresh' begins with no prior context, 'summary' restores from a compacted summary saved before the previous run ended, 'full' restores the entire prior context and only compacts when explicitly called"),
59
81
  initialCommands: array(string()).optional().describe("Shell commands to run at session start before the first LLM prompt, providing additional context to the agent"),
60
- multipleCommandsEnabled: boolean().optional().describe("Allow the LLM to run multiple commands per turn. Faster but the LLM may get ahead of itself and produce errors"),
82
+ multipleCommandsEnabled: boolean().optional().describe("Allow the LLM to run multiple commands per turn. Faster but the LLM may get ahead of itself and produce errors. Disable for weaker LLMs."),
61
83
  workspacesEnabled: boolean().optional().describe("Experimental: Allows the LLM to pin files to the end of the context. Each turn the agent sees the latest version without old versions taking up context space"),
62
- controlDesktop: boolean().optional().describe(`Allow the agent to operate the desktop GUI. Requires a vision-capable model; computer-use models are ideal. Screens over 1.1MP will be downscaled.`),
84
+ controlDesktop: boolean().optional().describe(`Allow the agent to operate the desktop GUI. Requires a vision-capable model; computer-use models are ideal. Screens over ${TARGET_MEGAPIXELS}MP will be downscaled.`),
63
85
  supervisorApiHints: boolean().optional().describe("Tell the agent in its system message how to call the supervisor API to manage NAISYS agents, hosts, variables, models, users, etc. Useful for admin / assistant agents")
64
86
  });
65
87
  //#endregion
66
- //#region ../../../packages/common/dist/modelTypes.js
88
+ //#region ../../../packages/common/dist/auth/codexOAuth.js
89
+ var CODEX_RESPONSES_BASE_URL = "https://chatgpt.com/backend-api/codex";
90
+ var CODEX_REFRESH_TOKEN_VAR = "CODEX_REFRESH_TOKEN";
91
+ //#endregion
92
+ //#region ../../../packages/common/dist/http/hateoas.js
93
+ /**
94
+ * Returns the action if it exists and is enabled.
95
+ * Pass `{ includeDisabled: true }` to also return disabled actions
96
+ * (e.g. when rendering a disabled button with a tooltip).
97
+ */
98
+ function hasAction(actions, rel, opts) {
99
+ const a = actions?.find((a) => a.rel === rel);
100
+ if (!a) return void 0;
101
+ if (a.disabled && !opts?.includeDisabled) return void 0;
102
+ return a;
103
+ }
104
+ function hasActionTemplate(templates, rel, opts) {
105
+ const t = templates?.find((t) => t.rel === rel);
106
+ if (!t) return void 0;
107
+ if (t.disabled && !opts?.includeDisabled) return void 0;
108
+ return t;
109
+ }
110
+ /** Normalize a `disabledReason` (string | string[] | undefined) to a single display string. */
111
+ function formatDisabledReason(reason) {
112
+ if (!reason) return void 0;
113
+ return Array.isArray(reason) ? reason.join("\n") : reason;
114
+ }
115
+ //#endregion
116
+ //#region ../../../packages/common/dist/http/hateoas-types.js
117
+ var HateoasLinkSchema = object({
118
+ rel: string(),
119
+ href: string(),
120
+ method: string().optional(),
121
+ title: string().optional(),
122
+ schema: string().optional()
123
+ });
124
+ var AlternateEncodingSchema = object({
125
+ contentType: string(),
126
+ description: string().optional(),
127
+ fileFields: array(string())
128
+ });
129
+ var HateoasActionSchema = object({
130
+ rel: string(),
131
+ href: string(),
132
+ method: string(),
133
+ title: string().optional(),
134
+ schema: string().optional(),
135
+ body: record(string(), unknown()).optional(),
136
+ alternateEncoding: AlternateEncodingSchema.optional(),
137
+ disabled: boolean().optional(),
138
+ disabledReason: union([string(), array(string())]).optional()
139
+ });
140
+ var HateoasActionTemplateSchema = object({
141
+ rel: string(),
142
+ hrefTemplate: string(),
143
+ method: string(),
144
+ title: string().optional(),
145
+ schema: string().optional(),
146
+ body: record(string(), unknown()).optional(),
147
+ alternateEncoding: AlternateEncodingSchema.optional(),
148
+ disabled: boolean().optional(),
149
+ disabledReason: union([string(), array(string())]).optional()
150
+ });
151
+ var HateoasLinkTemplateSchema = object({
152
+ rel: string(),
153
+ hrefTemplate: string(),
154
+ title: string().optional()
155
+ });
156
+ object({
157
+ _links: array(HateoasLinkSchema),
158
+ _actions: array(HateoasActionSchema).optional()
159
+ });
160
+ //#endregion
161
+ //#region ../../../packages/common/dist/models/modelTypes.js
67
162
  var LlmApiType;
68
163
  (function(LlmApiType) {
69
164
  LlmApiType["OpenAI"] = "openai";
@@ -94,6 +189,7 @@ var LlmModelSchema = object({
94
189
  cacheWriteCost: number().optional(),
95
190
  cacheReadCost: number().optional(),
96
191
  cacheTtlSeconds: number().int().min(300).optional(),
192
+ supportsToolUse: boolean().optional(),
97
193
  supportsVision: boolean().optional(),
98
194
  supportsHearing: boolean().optional(),
99
195
  supportsComputerUse: boolean().optional(),
@@ -141,6 +237,7 @@ object({
141
237
  cacheWriteCost: number().optional(),
142
238
  cacheReadCost: number().optional(),
143
239
  cacheTtlSeconds: number().int().min(300).optional(),
240
+ supportsToolUse: boolean().optional(),
144
241
  supportsVision: boolean().optional(),
145
242
  supportsHearing: boolean().optional(),
146
243
  supportsComputerUse: boolean().optional(),
@@ -160,52 +257,49 @@ object({
160
257
  ]).optional()
161
258
  });
162
259
  //#endregion
163
- //#region ../../../packages/common/dist/openAiOAuth.js
164
- var OPENAI_CODEX_RESPONSES_BASE_URL = "https://chatgpt.com/backend-api/codex";
165
- var OPENAI_CODEX_ACCESS_TOKEN_VAR = "OPENAI_CODEX_ACCESS_TOKEN";
166
- //#endregion
167
- //#region ../../../packages/common/dist/builtInModels.js
168
- function openAiCodexOAuthModel(params) {
260
+ //#region ../../../packages/common/dist/models/builtInModels.js
261
+ function codexOAuthModel(params) {
169
262
  return {
170
263
  key: params.key,
171
264
  label: params.label,
172
265
  versionName: params.versionName,
173
- baseUrl: OPENAI_CODEX_RESPONSES_BASE_URL,
266
+ baseUrl: CODEX_RESPONSES_BASE_URL,
174
267
  apiType: LlmApiType.OpenAIOAuth,
175
- apiKeyVar: OPENAI_CODEX_ACCESS_TOKEN_VAR,
268
+ apiKeyVar: CODEX_REFRESH_TOKEN_VAR,
176
269
  maxTokens: 4e5,
177
270
  inputCost: 0,
178
271
  outputCost: 0,
179
272
  cacheWriteCost: 0,
180
273
  cacheReadCost: 0,
181
274
  cacheTtlSeconds: 300,
275
+ supportsToolUse: true,
182
276
  supportsVision: true,
183
277
  reasoningLevel: params.reasoningLevel
184
278
  };
185
279
  }
186
- LlmApiType.None, LlmApiType.None, LlmApiType.None, LlmApiType.Mock, LlmApiType.Mock, LlmApiType.Mock, LlmApiType.OpenAICompatible, LlmApiType.OpenAICompatible, LlmApiType.OpenAICompatible, LlmApiType.OpenAI, LlmApiType.OpenAI, LlmApiType.OpenAI, openAiCodexOAuthModel({
280
+ LlmApiType.None, LlmApiType.None, LlmApiType.None, LlmApiType.Mock, LlmApiType.Mock, LlmApiType.Mock, LlmApiType.OpenAICompatible, LlmApiType.OpenAICompatible, LlmApiType.OpenAICompatible, LlmApiType.OpenAI, LlmApiType.OpenAI, LlmApiType.OpenAI, codexOAuthModel({
187
281
  key: "gpt55oauth",
188
282
  label: "GPT 5.5 Codex OAuth",
189
283
  versionName: "gpt-5.5",
190
284
  reasoningLevel: "medium"
191
- }), openAiCodexOAuthModel({
285
+ }), codexOAuthModel({
192
286
  key: "gpt5oauth",
193
287
  label: "GPT 5.4 Codex OAuth",
194
288
  versionName: "gpt-5.4",
195
289
  reasoningLevel: "medium"
196
- }), openAiCodexOAuthModel({
290
+ }), codexOAuthModel({
197
291
  key: "gpt54minioauth",
198
292
  label: "GPT 5.4 Mini Codex OAuth",
199
293
  versionName: "gpt-5.4-mini",
200
294
  reasoningLevel: "medium"
201
- }), openAiCodexOAuthModel({
295
+ }), codexOAuthModel({
202
296
  key: "gpt52oauth",
203
297
  label: "GPT 5.2 Codex OAuth",
204
298
  versionName: "gpt-5.2",
205
299
  reasoningLevel: "medium"
206
300
  }), LlmApiType.Google, LlmApiType.Google, LlmApiType.Google, LlmApiType.Anthropic, LlmApiType.Anthropic, LlmApiType.Anthropic;
207
301
  //#endregion
208
- //#region ../../../packages/common/dist/formatFileSize.js
302
+ //#region ../../../packages/common/dist/utils/formatFileSize.js
209
303
  /** Format a byte count into a human-readable size string (e.g. "1.2 KB") */
210
304
  function formatFileSize(bytes) {
211
305
  if (bytes < 1024) return `${bytes} B`;
@@ -213,7 +307,7 @@ function formatFileSize(bytes) {
213
307
  return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
214
308
  }
215
309
  //#endregion
216
- //#region ../../../packages/common/dist/formatVersion.js
310
+ //#region ../../../packages/common/dist/utils/formatVersion.js
217
311
  var import_semver = /* @__PURE__ */ __toESM(require_semver(), 1);
218
312
  /**
219
313
  * Parse a version string that may contain ">=" operator and/or "/commitHash".
@@ -269,76 +363,7 @@ function versionsMatch(instanceVersion, targetVersion) {
269
363
  return instance.npm === target.npm;
270
364
  }
271
365
  //#endregion
272
- //#region ../../../packages/common/dist/hateoas.js
273
- /**
274
- * Returns the action if it exists and is enabled.
275
- * Pass `{ includeDisabled: true }` to also return disabled actions
276
- * (e.g. when rendering a disabled button with a tooltip).
277
- */
278
- function hasAction(actions, rel, opts) {
279
- const a = actions?.find((a) => a.rel === rel);
280
- if (!a) return void 0;
281
- if (a.disabled && !opts?.includeDisabled) return void 0;
282
- return a;
283
- }
284
- function hasActionTemplate(templates, rel, opts) {
285
- const t = templates?.find((t) => t.rel === rel);
286
- if (!t) return void 0;
287
- if (t.disabled && !opts?.includeDisabled) return void 0;
288
- return t;
289
- }
290
- /** Normalize a `disabledReason` (string | string[] | undefined) to a single display string. */
291
- function formatDisabledReason(reason) {
292
- if (!reason) return void 0;
293
- return Array.isArray(reason) ? reason.join("\n") : reason;
294
- }
295
- //#endregion
296
- //#region ../../../packages/common/dist/hateoas-types.js
297
- var HateoasLinkSchema = object({
298
- rel: string(),
299
- href: string(),
300
- method: string().optional(),
301
- title: string().optional(),
302
- schema: string().optional()
303
- });
304
- var AlternateEncodingSchema = object({
305
- contentType: string(),
306
- description: string().optional(),
307
- fileFields: array(string())
308
- });
309
- var HateoasActionSchema = object({
310
- rel: string(),
311
- href: string(),
312
- method: string(),
313
- title: string().optional(),
314
- schema: string().optional(),
315
- body: record(string(), unknown()).optional(),
316
- alternateEncoding: AlternateEncodingSchema.optional(),
317
- disabled: boolean().optional(),
318
- disabledReason: union([string(), array(string())]).optional()
319
- });
320
- var HateoasActionTemplateSchema = object({
321
- rel: string(),
322
- hrefTemplate: string(),
323
- method: string(),
324
- title: string().optional(),
325
- schema: string().optional(),
326
- body: record(string(), unknown()).optional(),
327
- alternateEncoding: AlternateEncodingSchema.optional(),
328
- disabled: boolean().optional(),
329
- disabledReason: union([string(), array(string())]).optional()
330
- });
331
- var HateoasLinkTemplateSchema = object({
332
- rel: string(),
333
- hrefTemplate: string(),
334
- title: string().optional()
335
- });
336
- object({
337
- _links: array(HateoasLinkSchema),
338
- _actions: array(HateoasActionSchema).optional()
339
- });
340
- //#endregion
341
- //#region ../../../packages/common/dist/mimeTypes.js
366
+ //#region ../../../packages/common/dist/utils/mimeTypes.js
342
367
  var MIME_TYPES = {
343
368
  ".jpg": "image/jpeg",
344
369
  ".jpeg": "image/jpeg",
@@ -564,7 +589,7 @@ function useAuth() {
564
589
  return ctx;
565
590
  }
566
591
  //#endregion
567
- //#region src/components/RouteErrorPage.tsx
592
+ //#region src/components/error/RouteErrorPage.tsx
568
593
  var RouteErrorPage = ({ error }) => {
569
594
  const navigate = useNavigate();
570
595
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Container, {
@@ -595,7 +620,7 @@ var RouteErrorPage = ({ error }) => {
595
620
  });
596
621
  };
597
622
  //#endregion
598
- //#region src/components/ErrorBoundary.tsx
623
+ //#region src/components/error/ErrorBoundary.tsx
599
624
  var ErrorBoundary = class extends import_react.Component {
600
625
  state = { error: null };
601
626
  static getDerivedStateFromError(error) {
@@ -1164,75 +1189,34 @@ object$1({
1164
1189
  entityType: string$1(),
1165
1190
  entityId: number$1().int()
1166
1191
  });
1167
- //#endregion
1168
- //#region ../shared/dist/auth-types.js
1169
- var LoginRequestSchema = object$1({
1170
- username: string$1().min(1),
1171
- password: string$1().min(1)
1172
- }).strict();
1173
- object$1({ user: object$1({
1174
- id: number$2(),
1175
- username: string$1(),
1176
- permissions: array$1(string$1()).optional()
1177
- }) });
1178
1192
  object$1({
1179
1193
  statusCode: number$2().int(),
1180
1194
  error: string$1(),
1181
1195
  message: string$1(),
1182
1196
  missingPermission: string$1().optional()
1183
1197
  });
1184
- //#endregion
1185
- //#region ../shared/dist/field-types.js
1186
- var FieldTypeEnum = _enum$1([
1187
- "string",
1188
- "number",
1189
- "date",
1190
- "datetime",
1191
- "yesNo",
1192
- "checkbox",
1193
- "attachment"
1194
- ]);
1195
- var FieldType = FieldTypeEnum.enum;
1196
- var FieldSchema = object$1({
1197
- id: number$2(),
1198
- fieldSetId: number$2(),
1199
- seqNo: number$2(),
1200
- label: string$1(),
1201
- type: FieldTypeEnum,
1202
- isArray: boolean$1(),
1203
- required: boolean$1(),
1204
- createdAt: datetime(),
1205
- createdBy: string$1(),
1206
- updatedAt: datetime(),
1207
- updatedBy: string$1(),
1208
- _links: array$1(HateoasLinkSchema).optional(),
1209
- _actions: array$1(HateoasActionSchema).optional()
1198
+ object$1({
1199
+ ...paginationQuery(),
1200
+ search: string$1().optional()
1210
1201
  });
1211
- var CreateFieldSchema = object$1({
1212
- seqNo: number$2().int().min(1).optional(),
1213
- label: string$1().min(1).max(200),
1214
- type: FieldTypeEnum.optional(),
1215
- isArray: boolean$1().optional(),
1216
- required: boolean$1().optional()
1217
- }).strict();
1218
- object$1({ items: array$1(CreateFieldSchema).min(1).max(100) });
1219
- var UpdateFieldSchema = object$1({
1220
- seqNo: number$2().int().min(1).optional(),
1221
- label: string$1().min(1).max(200).optional(),
1222
- type: FieldTypeEnum.optional(),
1223
- isArray: boolean$1().optional(),
1224
- required: boolean$1().optional()
1225
- }).strict();
1226
- var FieldListResponseSchema = object$1({
1227
- items: array$1(FieldSchema),
1202
+ object$1({
1203
+ items: array$1(object$1({
1204
+ id: number$2(),
1205
+ itemKey: string$1(),
1206
+ key: string$1(),
1207
+ quantity: number$2().nullable(),
1208
+ orderKey: string$1().nullable(),
1209
+ orderRunNo: number$2().nullable(),
1210
+ createdAt: datetime()
1211
+ })),
1228
1212
  total: number$2(),
1229
- nextSeqNo: number$2(),
1213
+ page: number$2(),
1214
+ pageSize: number$2(),
1230
1215
  _links: array$1(HateoasLinkSchema),
1231
- _linkTemplates: array$1(HateoasLinkTemplateSchema).optional(),
1232
- _actions: array$1(HateoasActionSchema).optional()
1216
+ _actionTemplates: array$1(HateoasActionTemplateSchema).optional()
1233
1217
  });
1234
1218
  //#endregion
1235
- //#region ../shared/dist/step-run-types.js
1219
+ //#region ../shared/dist/steps/step-run-types.js
1236
1220
  var FieldValidationSchema = object$1({
1237
1221
  valid: boolean$1(),
1238
1222
  error: string$1().optional()
@@ -1323,113 +1307,98 @@ object$1({
1323
1307
  _actions: array$1(HateoasActionSchema).optional()
1324
1308
  });
1325
1309
  //#endregion
1326
- //#region ../shared/dist/field-ref-types.js
1327
- var FieldRefFieldSchema = object$1({
1328
- seqNo: number$2(),
1329
- label: string$1(),
1330
- type: FieldTypeEnum
1331
- });
1332
- var FieldRefSchema = object$1({
1310
+ //#region ../shared/dist/items/item-instance-types.js
1311
+ var ItemInstanceSchema = object$1({
1333
1312
  id: number$2(),
1334
- seqNo: number$2(),
1335
- title: string$1(),
1336
- sourceOpSeqNo: number$2(),
1337
- sourceOpTitle: string$1(),
1338
- sourceStepSeqNo: number$2(),
1339
- sourceStepTitle: string$1(),
1340
- fields: array$1(FieldRefFieldSchema),
1341
- createdAt: datetime(),
1313
+ itemKey: string$1(),
1314
+ orderKey: string$1().nullable(),
1315
+ orderRunNo: number$2().nullable(),
1316
+ key: string$1(),
1317
+ quantity: number$2().nullable(),
1318
+ fieldValues: array$1(FieldValueEntrySchema),
1342
1319
  createdBy: string$1(),
1320
+ createdAt: datetime(),
1321
+ updatedBy: string$1(),
1322
+ updatedAt: datetime(),
1343
1323
  _links: array$1(HateoasLinkSchema).optional(),
1344
- _actions: array$1(HateoasActionSchema).optional()
1324
+ _actions: array$1(HateoasActionSchema).optional(),
1325
+ _actionTemplates: array$1(HateoasActionTemplateSchema).optional()
1345
1326
  });
1346
1327
  object$1({
1347
- seqNo: number$2().int().min(1).optional(),
1348
- title: string$1().min(1).max(200),
1349
- sourceOpSeqNo: number$2().int().min(1),
1350
- sourceStepSeqNo: number$2().int().min(1)
1328
+ key: string$1().min(1).max(200),
1329
+ quantity: number$2().nullable().optional(),
1330
+ orderRunId: number$2().nullable().optional()
1351
1331
  }).strict();
1352
1332
  object$1({
1353
- items: array$1(FieldRefSchema),
1354
- total: number$2(),
1355
- nextSeqNo: number$2(),
1356
- _links: array$1(HateoasLinkSchema),
1357
- _linkTemplates: array$1(HateoasLinkTemplateSchema).optional(),
1358
- _actions: array$1(HateoasActionSchema).optional()
1359
- });
1360
- var FieldRefValueSummarySchema = object$1({
1361
- seqNo: number$2(),
1362
- title: string$1(),
1363
- sourceOpSeqNo: number$2(),
1364
- sourceOpTitle: string$1(),
1365
- sourceStepSeqNo: number$2(),
1366
- sourceStepTitle: string$1(),
1367
- multiSet: boolean$1(),
1368
- fieldValues: array$1(FieldValueEntrySchema)
1369
- });
1333
+ key: string$1().min(1).max(200).optional(),
1334
+ quantity: number$2().nullable().optional(),
1335
+ orderRunId: number$2().nullable().optional()
1336
+ }).strict();
1370
1337
  object$1({
1371
1338
  ...paginationQuery(),
1372
1339
  search: string$1().optional()
1373
1340
  });
1374
1341
  object$1({
1375
- items: array$1(object$1({
1376
- id: number$2(),
1377
- itemKey: string$1(),
1378
- key: string$1(),
1379
- quantity: number$2().nullable(),
1380
- orderKey: string$1().nullable(),
1381
- orderRunNo: number$2().nullable(),
1382
- createdAt: datetime()
1383
- })),
1342
+ items: array$1(ItemInstanceSchema),
1384
1343
  total: number$2(),
1385
1344
  page: number$2(),
1386
1345
  pageSize: number$2(),
1387
1346
  _links: array$1(HateoasLinkSchema),
1388
- _actionTemplates: array$1(HateoasActionTemplateSchema).optional()
1347
+ _linkTemplates: array$1(HateoasLinkTemplateSchema).optional(),
1348
+ _actions: array$1(HateoasActionSchema).optional()
1389
1349
  });
1390
1350
  //#endregion
1391
- //#region ../shared/dist/item-instance-types.js
1392
- var ItemInstanceSchema = object$1({
1351
+ //#region ../shared/dist/production/field-types.js
1352
+ var FieldTypeEnum = _enum$1([
1353
+ "string",
1354
+ "number",
1355
+ "date",
1356
+ "datetime",
1357
+ "yesNo",
1358
+ "checkbox",
1359
+ "attachment"
1360
+ ]);
1361
+ var FieldType = FieldTypeEnum.enum;
1362
+ var FieldSchema = object$1({
1393
1363
  id: number$2(),
1394
- itemKey: string$1(),
1395
- orderKey: string$1().nullable(),
1396
- orderRunNo: number$2().nullable(),
1397
- key: string$1(),
1398
- quantity: number$2().nullable(),
1399
- fieldValues: array$1(FieldValueEntrySchema),
1400
- createdBy: string$1(),
1364
+ fieldSetId: number$2(),
1365
+ seqNo: number$2(),
1366
+ label: string$1(),
1367
+ type: FieldTypeEnum,
1368
+ isArray: boolean$1(),
1369
+ required: boolean$1(),
1401
1370
  createdAt: datetime(),
1402
- updatedBy: string$1(),
1371
+ createdBy: string$1(),
1403
1372
  updatedAt: datetime(),
1373
+ updatedBy: string$1(),
1404
1374
  _links: array$1(HateoasLinkSchema).optional(),
1405
- _actions: array$1(HateoasActionSchema).optional(),
1406
- _actionTemplates: array$1(HateoasActionTemplateSchema).optional()
1375
+ _actions: array$1(HateoasActionSchema).optional()
1407
1376
  });
1408
- object$1({
1409
- key: string$1().min(1).max(200),
1410
- quantity: number$2().nullable().optional(),
1411
- orderRunId: number$2().nullable().optional()
1377
+ var CreateFieldSchema = object$1({
1378
+ seqNo: number$2().int().min(1).optional(),
1379
+ label: string$1().min(1).max(200),
1380
+ type: FieldTypeEnum.optional(),
1381
+ isArray: boolean$1().optional(),
1382
+ required: boolean$1().optional()
1412
1383
  }).strict();
1413
- object$1({
1414
- key: string$1().min(1).max(200).optional(),
1415
- quantity: number$2().nullable().optional(),
1416
- orderRunId: number$2().nullable().optional()
1384
+ object$1({ items: array$1(CreateFieldSchema).min(1).max(100) });
1385
+ var UpdateFieldSchema = object$1({
1386
+ seqNo: number$2().int().min(1).optional(),
1387
+ label: string$1().min(1).max(200).optional(),
1388
+ type: FieldTypeEnum.optional(),
1389
+ isArray: boolean$1().optional(),
1390
+ required: boolean$1().optional()
1417
1391
  }).strict();
1418
- object$1({
1419
- ...paginationQuery(),
1420
- search: string$1().optional()
1421
- });
1422
- object$1({
1423
- items: array$1(ItemInstanceSchema),
1392
+ var FieldListResponseSchema = object$1({
1393
+ items: array$1(FieldSchema),
1424
1394
  total: number$2(),
1425
- page: number$2(),
1426
- pageSize: number$2(),
1395
+ nextSeqNo: number$2(),
1427
1396
  _links: array$1(HateoasLinkSchema),
1428
1397
  _linkTemplates: array$1(HateoasLinkTemplateSchema).optional(),
1429
1398
  _actions: array$1(HateoasActionSchema).optional()
1430
1399
  });
1431
1400
  //#endregion
1432
- //#region ../shared/dist/item-types.js
1401
+ //#region ../shared/dist/items/item-types.js
1433
1402
  var ItemSchema = object$1({
1434
1403
  id: number$2(),
1435
1404
  key: string$1(),
@@ -1464,36 +1433,52 @@ object$1({
1464
1433
  _actions: array$1(HateoasActionSchema).optional()
1465
1434
  });
1466
1435
  //#endregion
1467
- //#region ../shared/dist/labor-ticket-types.js
1468
- var LaborTicketSchema = object$1({
1436
+ //#region ../shared/dist/production/field-ref-types.js
1437
+ var FieldRefFieldSchema = object$1({
1438
+ seqNo: number$2(),
1439
+ label: string$1(),
1440
+ type: FieldTypeEnum
1441
+ });
1442
+ var FieldRefSchema = object$1({
1469
1443
  id: number$2(),
1470
- operationRunId: number$2(),
1471
- userId: number$2(),
1472
- username: string$1(),
1473
- runId: number$2().nullable(),
1474
- clockIn: datetime(),
1475
- clockOut: datetime().nullable(),
1476
- cost: number$2().nullable(),
1444
+ seqNo: number$2(),
1445
+ title: string$1(),
1446
+ sourceOpSeqNo: number$2(),
1447
+ sourceOpTitle: string$1(),
1448
+ sourceStepSeqNo: number$2(),
1449
+ sourceStepTitle: string$1(),
1450
+ fields: array$1(FieldRefFieldSchema),
1477
1451
  createdAt: datetime(),
1478
1452
  createdBy: string$1(),
1479
- updatedAt: datetime(),
1480
- updatedBy: string$1(),
1481
- _links: array$1(HateoasLinkSchema).optional()
1453
+ _links: array$1(HateoasLinkSchema).optional(),
1454
+ _actions: array$1(HateoasActionSchema).optional()
1482
1455
  });
1483
1456
  object$1({
1484
- userId: number$2().int().optional(),
1485
- ticketId: number$2().int().optional()
1457
+ seqNo: number$2().int().min(1).optional(),
1458
+ title: string$1().min(1).max(200),
1459
+ sourceOpSeqNo: number$2().int().min(1),
1460
+ sourceStepSeqNo: number$2().int().min(1)
1486
1461
  }).strict();
1487
1462
  object$1({
1488
- items: array$1(LaborTicketSchema),
1463
+ items: array$1(FieldRefSchema),
1489
1464
  total: number$2(),
1465
+ nextSeqNo: number$2(),
1490
1466
  _links: array$1(HateoasLinkSchema),
1491
1467
  _linkTemplates: array$1(HateoasLinkTemplateSchema).optional(),
1492
- _actions: array$1(HateoasActionSchema).optional(),
1493
- _actionTemplates: array$1(HateoasActionTemplateSchema).optional()
1468
+ _actions: array$1(HateoasActionSchema).optional()
1469
+ });
1470
+ var FieldRefValueSummarySchema = object$1({
1471
+ seqNo: number$2(),
1472
+ title: string$1(),
1473
+ sourceOpSeqNo: number$2(),
1474
+ sourceOpTitle: string$1(),
1475
+ sourceStepSeqNo: number$2(),
1476
+ sourceStepTitle: string$1(),
1477
+ multiSet: boolean$1(),
1478
+ fieldValues: array$1(FieldValueEntrySchema)
1494
1479
  });
1495
1480
  //#endregion
1496
- //#region ../shared/dist/operation-types.js
1481
+ //#region ../shared/dist/operations/operation-types.js
1497
1482
  var OperationPredecessorSchema = object$1({
1498
1483
  seqNo: number$2(),
1499
1484
  title: string$1()
@@ -1541,7 +1526,7 @@ object$1({
1541
1526
  _actions: array$1(HateoasActionSchema).optional()
1542
1527
  });
1543
1528
  //#endregion
1544
- //#region ../shared/dist/operation-run-types.js
1529
+ //#region ../shared/dist/operations/operation-run-types.js
1545
1530
  var StepRunSummarySchema = object$1({
1546
1531
  seqNo: number$2(),
1547
1532
  title: string$1(),
@@ -1607,7 +1592,7 @@ object$1({
1607
1592
  _actions: array$1(HateoasActionSchema).optional()
1608
1593
  });
1609
1594
  //#endregion
1610
- //#region ../shared/dist/order-revision-types.js
1595
+ //#region ../shared/dist/orders/order-revision-types.js
1611
1596
  var RevisionOperationSummarySchema = object$1({
1612
1597
  seqNo: number$2(),
1613
1598
  title: string$1()
@@ -1657,7 +1642,7 @@ object$1({
1657
1642
  _actions: array$1(HateoasActionSchema).optional()
1658
1643
  });
1659
1644
  //#endregion
1660
- //#region ../shared/dist/order-run-types.js
1645
+ //#region ../shared/dist/orders/order-run-types.js
1661
1646
  var OperationRunSummarySchema = object$1({
1662
1647
  seqNo: number$2(),
1663
1648
  title: string$1(),
@@ -1849,7 +1834,7 @@ object$1({
1849
1834
  _actions: array$1(HateoasActionSchema).optional()
1850
1835
  });
1851
1836
  //#endregion
1852
- //#region ../shared/dist/operation-dependency-types.js
1837
+ //#region ../shared/dist/operations/operation-dependency-types.js
1853
1838
  var OperationDependencySchema = object$1({
1854
1839
  id: number$2(),
1855
1840
  predecessorSeqNo: number$2(),
@@ -1866,7 +1851,7 @@ object$1({
1866
1851
  _actionTemplates: array$1(HateoasActionTemplateSchema).optional()
1867
1852
  });
1868
1853
  //#endregion
1869
- //#region ../shared/dist/operation-run-comment-types.js
1854
+ //#region ../shared/dist/operations/operation-run-comment-types.js
1870
1855
  var OperationRunCommentTypeEnum = _enum$1([
1871
1856
  "note",
1872
1857
  "issue",
@@ -1894,7 +1879,7 @@ object$1({
1894
1879
  _actions: array$1(HateoasActionSchema).optional()
1895
1880
  });
1896
1881
  //#endregion
1897
- //#region ../shared/dist/order-types.js
1882
+ //#region ../shared/dist/orders/order-types.js
1898
1883
  var OrderStatusEnum = _enum$1(["active", "archived"]);
1899
1884
  var OrderStatus = OrderStatusEnum.enum;
1900
1885
  var OrderSchema = object$1({
@@ -1937,6 +1922,58 @@ object$1({
1937
1922
  _actions: array$1(HateoasActionSchema).optional()
1938
1923
  });
1939
1924
  //#endregion
1925
+ //#region ../shared/dist/production/work-center-types.js
1926
+ var WorkCenterUserSchema = object$1({
1927
+ userId: number$2(),
1928
+ username: string$1(),
1929
+ createdAt: string$1(),
1930
+ createdBy: string$1().nullable(),
1931
+ _actions: array$1(HateoasActionSchema).optional()
1932
+ });
1933
+ object$1({
1934
+ id: number$2(),
1935
+ key: string$1(),
1936
+ description: string$1(),
1937
+ userAssignments: array$1(WorkCenterUserSchema),
1938
+ createdAt: datetime(),
1939
+ createdBy: string$1(),
1940
+ updatedAt: datetime(),
1941
+ updatedBy: string$1(),
1942
+ _links: array$1(HateoasLinkSchema),
1943
+ _actions: array$1(HateoasActionSchema).optional()
1944
+ });
1945
+ object$1({
1946
+ key: string$1().min(1).max(100).regex(/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/, "Key must be alphanumeric with hyphens"),
1947
+ description: string$1().max(2e3).optional().default("")
1948
+ }).strict();
1949
+ object$1({
1950
+ key: string$1().min(1).max(100).regex(/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/, "Key must be alphanumeric with hyphens").optional(),
1951
+ description: string$1().max(2e3).optional()
1952
+ }).strict();
1953
+ object$1({ username: string$1().min(1) }).strict();
1954
+ object$1({
1955
+ ...paginationQuery(),
1956
+ search: string$1().optional()
1957
+ });
1958
+ object$1({
1959
+ items: array$1(object$1({
1960
+ id: number$2(),
1961
+ key: string$1(),
1962
+ description: string$1(),
1963
+ userCount: number$2(),
1964
+ createdAt: datetime(),
1965
+ createdBy: string$1(),
1966
+ updatedAt: datetime(),
1967
+ updatedBy: string$1()
1968
+ })),
1969
+ total: number$2(),
1970
+ page: number$2(),
1971
+ pageSize: number$2(),
1972
+ _links: array$1(HateoasLinkSchema),
1973
+ _linkTemplates: array$1(HateoasLinkTemplateSchema).optional(),
1974
+ _actions: array$1(HateoasActionSchema).optional()
1975
+ });
1976
+ //#endregion
1940
1977
  //#region ../shared/dist/revision-diff-types.js
1941
1978
  var PropertyChangeSchema = object$1({
1942
1979
  field: string$1(),
@@ -2000,7 +2037,36 @@ object$1({
2000
2037
  to: number$1().int().min(1)
2001
2038
  });
2002
2039
  //#endregion
2003
- //#region ../shared/dist/step-types.js
2040
+ //#region ../shared/dist/steps/labor-ticket-types.js
2041
+ var LaborTicketSchema = object$1({
2042
+ id: number$2(),
2043
+ operationRunId: number$2(),
2044
+ userId: number$2(),
2045
+ username: string$1(),
2046
+ runId: number$2().nullable(),
2047
+ clockIn: datetime(),
2048
+ clockOut: datetime().nullable(),
2049
+ cost: number$2().nullable(),
2050
+ createdAt: datetime(),
2051
+ createdBy: string$1(),
2052
+ updatedAt: datetime(),
2053
+ updatedBy: string$1(),
2054
+ _links: array$1(HateoasLinkSchema).optional()
2055
+ });
2056
+ object$1({
2057
+ userId: number$2().int().optional(),
2058
+ ticketId: number$2().int().optional()
2059
+ }).strict();
2060
+ object$1({
2061
+ items: array$1(LaborTicketSchema),
2062
+ total: number$2(),
2063
+ _links: array$1(HateoasLinkSchema),
2064
+ _linkTemplates: array$1(HateoasLinkTemplateSchema).optional(),
2065
+ _actions: array$1(HateoasActionSchema).optional(),
2066
+ _actionTemplates: array$1(HateoasActionTemplateSchema).optional()
2067
+ });
2068
+ //#endregion
2069
+ //#region ../shared/dist/steps/step-types.js
2004
2070
  var StepSchema = object$1({
2005
2071
  id: number$2(),
2006
2072
  operationId: number$2(),
@@ -2039,7 +2105,18 @@ object$1({
2039
2105
  _actions: array$1(HateoasActionSchema).optional()
2040
2106
  });
2041
2107
  //#endregion
2042
- //#region ../shared/dist/user-types.js
2108
+ //#region ../shared/dist/users/auth-types.js
2109
+ var LoginRequestSchema = object$1({
2110
+ username: string$1().min(1),
2111
+ password: string$1().min(1)
2112
+ }).strict();
2113
+ object$1({ user: object$1({
2114
+ id: number$2(),
2115
+ username: string$1(),
2116
+ permissions: array$1(string$1()).optional()
2117
+ }) });
2118
+ //#endregion
2119
+ //#region ../shared/dist/users/user-types.js
2043
2120
  var ErpPermissionEnum = _enum$1([
2044
2121
  "erp_admin",
2045
2122
  "order_planner",
@@ -2097,59 +2174,7 @@ object$1({
2097
2174
  search: string$1().optional()
2098
2175
  });
2099
2176
  //#endregion
2100
- //#region ../shared/dist/work-center-types.js
2101
- var WorkCenterUserSchema = object$1({
2102
- userId: number$2(),
2103
- username: string$1(),
2104
- createdAt: string$1(),
2105
- createdBy: string$1().nullable(),
2106
- _actions: array$1(HateoasActionSchema).optional()
2107
- });
2108
- object$1({
2109
- id: number$2(),
2110
- key: string$1(),
2111
- description: string$1(),
2112
- userAssignments: array$1(WorkCenterUserSchema),
2113
- createdAt: datetime(),
2114
- createdBy: string$1(),
2115
- updatedAt: datetime(),
2116
- updatedBy: string$1(),
2117
- _links: array$1(HateoasLinkSchema),
2118
- _actions: array$1(HateoasActionSchema).optional()
2119
- });
2120
- object$1({
2121
- key: string$1().min(1).max(100).regex(/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/, "Key must be alphanumeric with hyphens"),
2122
- description: string$1().max(2e3).optional().default("")
2123
- }).strict();
2124
- object$1({
2125
- key: string$1().min(1).max(100).regex(/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/, "Key must be alphanumeric with hyphens").optional(),
2126
- description: string$1().max(2e3).optional()
2127
- }).strict();
2128
- object$1({ username: string$1().min(1) }).strict();
2129
- object$1({
2130
- ...paginationQuery(),
2131
- search: string$1().optional()
2132
- });
2133
- object$1({
2134
- items: array$1(object$1({
2135
- id: number$2(),
2136
- key: string$1(),
2137
- description: string$1(),
2138
- userCount: number$2(),
2139
- createdAt: datetime(),
2140
- createdBy: string$1(),
2141
- updatedAt: datetime(),
2142
- updatedBy: string$1()
2143
- })),
2144
- total: number$2(),
2145
- page: number$2(),
2146
- pageSize: number$2(),
2147
- _links: array$1(HateoasLinkSchema),
2148
- _linkTemplates: array$1(HateoasLinkTemplateSchema).optional(),
2149
- _actions: array$1(HateoasActionSchema).optional()
2150
- });
2151
- //#endregion
2152
- //#region src/components/LoginModal.tsx
2177
+ //#region src/components/forms/LoginModal.tsx
2153
2178
  var LoginModal = ({ opened, onClose }) => {
2154
2179
  const { login } = useAuth();
2155
2180
  const [submitting, setSubmitting] = (0, import_react.useState)(false);
@@ -2492,7 +2517,7 @@ var AppLayout = ({ supervisorAuth }) => {
2492
2517
  });
2493
2518
  };
2494
2519
  //#endregion
2495
- //#region src/components/RootErrorPage.tsx
2520
+ //#region src/components/error/RootErrorPage.tsx
2496
2521
  var RootErrorPage = ({ error }) => {
2497
2522
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Container, {
2498
2523
  size: "sm",
@@ -3506,7 +3531,7 @@ var MetadataTooltip = ({ createdBy, createdAt, updatedBy, updatedAt }) => {
3506
3531
  });
3507
3532
  };
3508
3533
  //#endregion
3509
- //#region src/components/FieldDefList.tsx
3534
+ //#region src/components/lists/FieldDefList.tsx
3510
3535
  var TYPE_LABELS = {
3511
3536
  string: "String",
3512
3537
  number: "Number",
@@ -3930,7 +3955,7 @@ var ItemDetail = () => {
3930
3955
  });
3931
3956
  };
3932
3957
  //#endregion
3933
- //#region src/components/FieldValueList.tsx
3958
+ //#region src/components/lists/FieldValueList.tsx
3934
3959
  function formatDate$1(d) {
3935
3960
  return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
3936
3961
  }
@@ -5081,7 +5106,7 @@ var LoginPage = () => {
5081
5106
  });
5082
5107
  };
5083
5108
  //#endregion
5084
- //#region src/components/OrderForm.tsx
5109
+ //#region src/components/forms/OrderForm.tsx
5085
5110
  var OrderForm = ({ initialData, isEdit, onSubmit, onCancel }) => {
5086
5111
  const schema = isEdit ? UpdateOrderSchema : CreateOrderSchema;
5087
5112
  const form = useForm({
@@ -5202,7 +5227,7 @@ var OrderCreate = () => {
5202
5227
  });
5203
5228
  };
5204
5229
  //#endregion
5205
- //#region src/components/OrderRevisions.tsx
5230
+ //#region src/components/lists/OrderRevisions.tsx
5206
5231
  var STATUS_COLORS$6 = {
5207
5232
  [RevisionStatus.draft]: "blue",
5208
5233
  [RevisionStatus.approved]: "green",
@@ -5751,402 +5776,111 @@ var OrderList = () => {
5751
5776
  });
5752
5777
  };
5753
5778
  //#endregion
5754
- //#region src/components/OperationSummaryTable.tsx
5755
- var OperationSummaryTable = ({ items, loading, linkBuilder }) => {
5756
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
5757
- fw: 600,
5758
- children: "OPERATIONS"
5759
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
5760
- withBorder: true,
5761
- p: "lg",
5762
- children: loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Stack, {
5763
- align: "center",
5764
- py: "sm",
5765
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loader, { size: "sm" })
5766
- }) : !items || items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
5767
- c: "dimmed",
5768
- size: "sm",
5769
- children: "No operations defined."
5770
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Table, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Thead, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Table.Tr, { children: [
5771
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Th, { children: "Seq" }),
5772
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Th, { children: "Title" }),
5773
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Th, { children: "Prerequisites" }),
5774
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Th, { children: "Steps" }),
5775
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Th, { children: "Cost" })
5776
- ] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Tbody, { children: items.map((op) => {
5777
- const opLink = linkBuilder(op.seqNo);
5778
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Table.Tr, {
5779
- style: { cursor: "pointer" },
5780
- children: [
5781
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Td, {
5782
- style: { padding: 0 },
5783
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
5784
- to: opLink,
5785
- style: cellLinkStyle,
5786
- children: op.seqNo
5787
- })
5788
- }),
5789
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Td, {
5790
- style: { padding: 0 },
5791
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
5792
- to: opLink,
5793
- style: cellLinkStyle,
5794
- children: op.title
5795
- })
5796
- }),
5797
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Td, {
5798
- style: { padding: 0 },
5799
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
5800
- to: opLink,
5801
- style: cellLinkStyle,
5802
- children: op.predecessors && op.predecessors.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Group, {
5803
- gap: 4,
5804
- children: op.predecessors.map((p) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Badge, {
5805
- variant: "light",
5806
- size: "sm",
5807
- children: [
5808
- p.seqNo,
5809
- ". ",
5810
- p.title
5811
- ]
5812
- }, p.seqNo))
5813
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
5814
- c: "dimmed",
5815
- size: "sm",
5816
- children: "None"
5817
- })
5818
- })
5819
- }),
5820
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Td, {
5821
- style: { padding: 0 },
5822
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
5823
- to: opLink,
5824
- style: cellLinkStyle,
5825
- children: op.stepCount ?? 0
5826
- })
5827
- }),
5828
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Td, {
5829
- style: { padding: 0 },
5830
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
5831
- to: opLink,
5832
- style: cellLinkStyle,
5833
- children: op.cost ? `$${op.cost.toFixed(2)}` : "—"
5834
- })
5835
- })
5836
- ]
5837
- }, op.id);
5838
- }) })] })
5839
- })] });
5779
+ //#region src/components/WorkCenterAutocomplete.tsx
5780
+ var WorkCenterAutocomplete = ({ value, onChange, ...rest }) => {
5781
+ const [debouncedValue] = useDebouncedValue(value, 300);
5782
+ const [options, setOptions] = (0, import_react.useState)([]);
5783
+ const fetchOptions = (0, import_react.useCallback)(async (search) => {
5784
+ try {
5785
+ const params = new URLSearchParams();
5786
+ params.set("pageSize", "10");
5787
+ if (search) params.set("search", search);
5788
+ setOptions((await api.get(`${apiEndpoints.workCenters}?${params}`)).items.map((wc) => wc.key));
5789
+ } catch {
5790
+ setOptions([]);
5791
+ }
5792
+ }, []);
5793
+ (0, import_react.useEffect)(() => {
5794
+ fetchOptions(debouncedValue);
5795
+ }, [debouncedValue, fetchOptions]);
5796
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Autocomplete, {
5797
+ data: options,
5798
+ value,
5799
+ onChange,
5800
+ ...rest
5801
+ });
5840
5802
  };
5841
5803
  //#endregion
5842
- //#region src/pages/orders/revs/HeaderDetail.tsx
5843
- var HeaderDetail = () => {
5844
- const { orderKey, revNo } = useParams();
5845
- const [revision, setRevision] = (0, import_react.useState)(null);
5804
+ //#region src/pages/orders/revs/lists/DependencyList.tsx
5805
+ var DependencyList = ({ orderKey, revNo, opSeqNo, showTitle = true }) => {
5806
+ const [deps, setDeps] = (0, import_react.useState)(null);
5846
5807
  const [loading, setLoading] = (0, import_react.useState)(true);
5847
- const [editing, setEditing] = (0, import_react.useState)(false);
5808
+ const [adding, setAdding] = (0, import_react.useState)(false);
5848
5809
  const [saving, setSaving] = (0, import_react.useState)(false);
5849
- const form = useForm({
5850
- initialValues: {
5851
- description: "",
5852
- changeSummary: ""
5853
- },
5854
- validate: zodResolver(UpdateOrderRevisionSchema)
5810
+ const [loadedOpSeqNo, setLoadedOpSeqNo] = (0, import_react.useState)(opSeqNo);
5811
+ if (opSeqNo !== loadedOpSeqNo) {
5812
+ setLoadedOpSeqNo(opSeqNo);
5813
+ setDeps(null);
5814
+ setLoading(true);
5815
+ setAdding(false);
5816
+ }
5817
+ const createForm = useForm({
5818
+ initialValues: { predecessorSeqNo: 10 },
5819
+ validate: zodResolver(CreateOperationDependencySchema)
5855
5820
  });
5856
- const [operations, setOperations] = (0, import_react.useState)(null);
5857
- const [opsLoading, setOpsLoading] = (0, import_react.useState)(true);
5858
- const fetchRevision = (0, import_react.useCallback)(async () => {
5859
- if (!orderKey || !revNo) return;
5821
+ const fetchDeps = (0, import_react.useCallback)(async () => {
5860
5822
  setLoading(true);
5861
5823
  try {
5862
- setRevision(await api.get(apiEndpoints.orderRev(orderKey, revNo)));
5824
+ setDeps(await api.get(apiEndpoints.orderRevOpDeps(orderKey, revNo, opSeqNo)));
5863
5825
  } catch (err) {
5864
5826
  showErrorNotification(err);
5865
5827
  } finally {
5866
5828
  setLoading(false);
5867
5829
  }
5868
- }, [orderKey, revNo]);
5869
- const fetchOperations = (0, import_react.useCallback)(async () => {
5870
- if (!orderKey || !revNo) return;
5871
- setOpsLoading(true);
5830
+ }, [
5831
+ orderKey,
5832
+ revNo,
5833
+ opSeqNo
5834
+ ]);
5835
+ (0, import_react.useEffect)(() => {
5836
+ fetchDeps();
5837
+ }, [fetchDeps]);
5838
+ const handleCreate = async (values) => {
5839
+ if (!deps) return;
5840
+ setSaving(true);
5872
5841
  try {
5873
- setOperations(await api.get(apiEndpoints.orderRevOps(orderKey, revNo)));
5842
+ const created = await api.post(apiEndpoints.orderRevOpDeps(orderKey, revNo, opSeqNo), values);
5843
+ setAdding(false);
5844
+ setDeps({
5845
+ ...deps,
5846
+ items: [...deps.items, created].sort((a, b) => a.predecessorSeqNo - b.predecessorSeqNo),
5847
+ total: deps.total + 1
5848
+ });
5874
5849
  } catch (err) {
5875
5850
  showErrorNotification(err);
5876
5851
  } finally {
5877
- setOpsLoading(false);
5852
+ setSaving(false);
5878
5853
  }
5879
- }, [orderKey, revNo]);
5880
- (0, import_react.useEffect)(() => {
5881
- fetchRevision();
5882
- fetchOperations();
5883
- }, [fetchRevision, fetchOperations]);
5884
- const startEditing = () => {
5885
- if (!revision) return;
5886
- form.setValues({
5887
- description: revision.description || "",
5888
- changeSummary: revision.changeSummary || ""
5889
- });
5890
- setEditing(true);
5891
5854
  };
5892
- const handleSave = async (values) => {
5893
- if (!revision) return;
5894
- setSaving(true);
5855
+ const handleDelete = async (dep) => {
5856
+ if (!deps) return;
5895
5857
  try {
5896
- setRevision(await api.put(apiEndpoints.orderRev(orderKey, revNo), values));
5897
- setEditing(false);
5858
+ await api.delete(apiEndpoints.orderRevOpDep(orderKey, revNo, opSeqNo, dep.predecessorSeqNo));
5859
+ setDeps({
5860
+ ...deps,
5861
+ items: deps.items.filter((d) => d.id !== dep.id),
5862
+ total: deps.total - 1
5863
+ });
5898
5864
  } catch (err) {
5899
5865
  showErrorNotification(err);
5900
- } finally {
5901
- setSaving(false);
5902
5866
  }
5903
5867
  };
5904
- if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Stack, {
5905
- align: "center",
5906
- py: "xl",
5907
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loader, {})
5908
- });
5909
- if (!revision) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Stack, {
5910
- p: "md",
5911
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Revision not found." })
5912
- });
5913
- const canEdit = hasAction(revision._actions, "update");
5914
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Container, {
5915
- size: "md",
5916
- py: "xl",
5917
- w: "100%",
5918
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Stack, {
5919
- gap: "md",
5920
- children: [
5921
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Group, {
5922
- justify: "space-between",
5923
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Group, {
5924
- gap: "xs",
5925
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
5926
- fw: 600,
5927
- children: "HEADER"
5928
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MetadataTooltip, {
5929
- createdBy: revision.createdBy,
5930
- createdAt: revision.createdAt,
5931
- updatedBy: revision.updatedBy,
5932
- updatedAt: revision.updatedAt
5933
- })]
5934
- }), canEdit && !editing && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
5935
- size: "xs",
5936
- variant: "light",
5937
- onClick: startEditing,
5938
- children: "Edit"
5939
- })]
5940
- }),
5941
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
5942
- withBorder: true,
5943
- p: "lg",
5944
- children: editing ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", {
5945
- onSubmit: form.onSubmit(handleSave),
5946
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Stack, {
5947
- gap: "sm",
5948
- children: [
5949
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Textarea, {
5950
- label: "Description",
5951
- placeholder: "Revision description...",
5952
- autosize: true,
5953
- minRows: 3,
5954
- ...form.getInputProps("description")
5955
- }),
5956
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Textarea, {
5957
- label: "Change Summary",
5958
- placeholder: "What changed in this revision...",
5959
- autosize: true,
5960
- minRows: 3,
5961
- ...form.getInputProps("changeSummary")
5962
- }),
5963
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Group, {
5964
- justify: "flex-end",
5965
- mt: "xs",
5966
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
5967
- variant: "subtle",
5968
- size: "xs",
5969
- onClick: () => setEditing(false),
5970
- children: "Cancel"
5971
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
5972
- type: "submit",
5973
- size: "xs",
5974
- loading: saving,
5975
- children: "Save"
5976
- })]
5977
- })
5978
- ]
5979
- })
5980
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Stack, {
5981
- gap: "md",
5982
- children: [
5983
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
5984
- size: "sm",
5985
- fw: 500,
5986
- mb: 4,
5987
- children: "Produces Item"
5988
- }), revision.itemKey ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
5989
- component: Link,
5990
- to: `/items/${revision.itemKey}`,
5991
- size: "sm",
5992
- c: "blue",
5993
- style: { textDecoration: "none" },
5994
- children: revision.itemKey
5995
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
5996
- c: "dimmed",
5997
- children: "None"
5998
- })] }),
5999
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6000
- size: "sm",
6001
- fw: 500,
6002
- mb: 4,
6003
- children: "Description"
6004
- }), revision.description ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompactMarkdown, { children: revision.description }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6005
- c: "dimmed",
6006
- children: "No description"
6007
- })] }),
6008
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
6009
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6010
- size: "sm",
6011
- fw: 500,
6012
- mb: 4,
6013
- children: "Change Summary"
6014
- }),
6015
- revision.changeSummary ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompactMarkdown, { children: revision.changeSummary }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6016
- c: "dimmed",
6017
- children: "No change summary"
6018
- }),
6019
- Number(revNo) > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6020
- component: Link,
6021
- to: `/orders/${orderKey}/revs/diff?from=${Number(revNo) - 1}&to=${revNo}`,
6022
- size: "xs",
6023
- c: "blue",
6024
- mt: "xs",
6025
- style: {
6026
- textDecoration: "none",
6027
- display: "inline-block"
6028
- },
6029
- children: "Diff with previous revision"
6030
- })
6031
- ] })
6032
- ]
6033
- })
6034
- }),
6035
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OperationSummaryTable, {
6036
- items: operations?.items ?? null,
6037
- loading: opsLoading,
6038
- linkBuilder: (seqNo) => `/orders/${orderKey}/revs/${revNo}/ops/${seqNo}`
6039
- })
6040
- ]
6041
- })
6042
- });
6043
- };
6044
- //#endregion
6045
- //#region src/components/WorkCenterAutocomplete.tsx
6046
- var WorkCenterAutocomplete = ({ value, onChange, ...rest }) => {
6047
- const [debouncedValue] = useDebouncedValue(value, 300);
6048
- const [options, setOptions] = (0, import_react.useState)([]);
6049
- const fetchOptions = (0, import_react.useCallback)(async (search) => {
6050
- try {
6051
- const params = new URLSearchParams();
6052
- params.set("pageSize", "10");
6053
- if (search) params.set("search", search);
6054
- setOptions((await api.get(`${apiEndpoints.workCenters}?${params}`)).items.map((wc) => wc.key));
6055
- } catch {
6056
- setOptions([]);
6057
- }
6058
- }, []);
6059
- (0, import_react.useEffect)(() => {
6060
- fetchOptions(debouncedValue);
6061
- }, [debouncedValue, fetchOptions]);
6062
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Autocomplete, {
6063
- data: options,
6064
- value,
6065
- onChange,
6066
- ...rest
6067
- });
6068
- };
6069
- //#endregion
6070
- //#region src/pages/orders/revs/DependencyList.tsx
6071
- var DependencyList = ({ orderKey, revNo, opSeqNo, showTitle = true }) => {
6072
- const [deps, setDeps] = (0, import_react.useState)(null);
6073
- const [loading, setLoading] = (0, import_react.useState)(true);
6074
- const [adding, setAdding] = (0, import_react.useState)(false);
6075
- const [saving, setSaving] = (0, import_react.useState)(false);
6076
- const [loadedOpSeqNo, setLoadedOpSeqNo] = (0, import_react.useState)(opSeqNo);
6077
- if (opSeqNo !== loadedOpSeqNo) {
6078
- setLoadedOpSeqNo(opSeqNo);
6079
- setDeps(null);
6080
- setLoading(true);
6081
- setAdding(false);
6082
- }
6083
- const createForm = useForm({
6084
- initialValues: { predecessorSeqNo: 10 },
6085
- validate: zodResolver(CreateOperationDependencySchema)
6086
- });
6087
- const fetchDeps = (0, import_react.useCallback)(async () => {
6088
- setLoading(true);
6089
- try {
6090
- setDeps(await api.get(apiEndpoints.orderRevOpDeps(orderKey, revNo, opSeqNo)));
6091
- } catch (err) {
6092
- showErrorNotification(err);
6093
- } finally {
6094
- setLoading(false);
6095
- }
6096
- }, [
6097
- orderKey,
6098
- revNo,
6099
- opSeqNo
6100
- ]);
6101
- (0, import_react.useEffect)(() => {
6102
- fetchDeps();
6103
- }, [fetchDeps]);
6104
- const handleCreate = async (values) => {
6105
- if (!deps) return;
6106
- setSaving(true);
6107
- try {
6108
- const created = await api.post(apiEndpoints.orderRevOpDeps(orderKey, revNo, opSeqNo), values);
6109
- setAdding(false);
6110
- setDeps({
6111
- ...deps,
6112
- items: [...deps.items, created].sort((a, b) => a.predecessorSeqNo - b.predecessorSeqNo),
6113
- total: deps.total + 1
6114
- });
6115
- } catch (err) {
6116
- showErrorNotification(err);
6117
- } finally {
6118
- setSaving(false);
6119
- }
6120
- };
6121
- const handleDelete = async (dep) => {
6122
- if (!deps) return;
6123
- try {
6124
- await api.delete(apiEndpoints.orderRevOpDep(orderKey, revNo, opSeqNo, dep.predecessorSeqNo));
6125
- setDeps({
6126
- ...deps,
6127
- items: deps.items.filter((d) => d.id !== dep.id),
6128
- total: deps.total - 1
6129
- });
6130
- } catch (err) {
6131
- showErrorNotification(err);
6132
- }
6133
- };
6134
- const isEmpty = !loading && deps !== null && deps.items.length === 0 && !adding;
6135
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Group, {
6136
- justify: "space-between",
6137
- children: [showTitle && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Title, {
6138
- order: 5,
6139
- children: "Dependencies"
6140
- }), hasAction(deps?._actions, "create") && !adding && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
6141
- size: "xs",
6142
- variant: "light",
6143
- onClick: () => {
6144
- createForm.reset();
6145
- setAdding(true);
6146
- },
6147
- children: "Add Dependency"
6148
- })]
6149
- }), loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Stack, {
5868
+ const isEmpty = !loading && deps !== null && deps.items.length === 0 && !adding;
5869
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Group, {
5870
+ justify: "space-between",
5871
+ children: [showTitle && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Title, {
5872
+ order: 5,
5873
+ children: "Dependencies"
5874
+ }), hasAction(deps?._actions, "create") && !adding && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
5875
+ size: "xs",
5876
+ variant: "light",
5877
+ onClick: () => {
5878
+ createForm.reset();
5879
+ setAdding(true);
5880
+ },
5881
+ children: "Add Dependency"
5882
+ })]
5883
+ }), loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Stack, {
6150
5884
  align: "center",
6151
5885
  py: "sm",
6152
5886
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loader, { size: "sm" })
@@ -6200,7 +5934,7 @@ var DependencyList = ({ orderKey, revNo, opSeqNo, showTitle = true }) => {
6200
5934
  })] });
6201
5935
  };
6202
5936
  //#endregion
6203
- //#region src/pages/orders/revs/FieldRefList.tsx
5937
+ //#region src/pages/orders/revs/lists/FieldRefList.tsx
6204
5938
  var FieldRefList = ({ orderKey, revNo, opSeqNo }) => {
6205
5939
  const [data, setData] = (0, import_react.useState)(null);
6206
5940
  const [loading, setLoading] = (0, import_react.useState)(true);
@@ -6453,7 +6187,7 @@ var FieldRefList = ({ orderKey, revNo, opSeqNo }) => {
6453
6187
  ] });
6454
6188
  };
6455
6189
  //#endregion
6456
- //#region src/pages/orders/revs/StepList.tsx
6190
+ //#region src/pages/orders/revs/lists/StepList.tsx
6457
6191
  var StepList = ({ orderKey, revNo, opSeqNo }) => {
6458
6192
  const [steps, setSteps] = (0, import_react.useState)(null);
6459
6193
  const [loading, setLoading] = (0, import_react.useState)(true);
@@ -6755,7 +6489,7 @@ var StepList = ({ orderKey, revNo, opSeqNo }) => {
6755
6489
  })] });
6756
6490
  };
6757
6491
  //#endregion
6758
- //#region src/pages/orders/revs/OperationDetail.tsx
6492
+ //#region src/pages/orders/revs/operation/OperationDetail.tsx
6759
6493
  var OperationDetail = () => {
6760
6494
  const { orderKey, revNo, seqNo } = useParams();
6761
6495
  const navigate = useNavigate();
@@ -6966,7 +6700,298 @@ var OperationDetail = () => {
6966
6700
  });
6967
6701
  };
6968
6702
  //#endregion
6969
- //#region src/pages/orders/revs/RevisionDiff.tsx
6703
+ //#region src/components/lists/OperationSummaryTable.tsx
6704
+ var OperationSummaryTable = ({ items, loading, linkBuilder }) => {
6705
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6706
+ fw: 600,
6707
+ children: "OPERATIONS"
6708
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
6709
+ withBorder: true,
6710
+ p: "lg",
6711
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Stack, {
6712
+ align: "center",
6713
+ py: "sm",
6714
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loader, { size: "sm" })
6715
+ }) : !items || items.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6716
+ c: "dimmed",
6717
+ size: "sm",
6718
+ children: "No operations defined."
6719
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Table, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Thead, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Table.Tr, { children: [
6720
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Th, { children: "Seq" }),
6721
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Th, { children: "Title" }),
6722
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Th, { children: "Prerequisites" }),
6723
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Th, { children: "Steps" }),
6724
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Th, { children: "Cost" })
6725
+ ] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Tbody, { children: items.map((op) => {
6726
+ const opLink = linkBuilder(op.seqNo);
6727
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Table.Tr, {
6728
+ style: { cursor: "pointer" },
6729
+ children: [
6730
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Td, {
6731
+ style: { padding: 0 },
6732
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
6733
+ to: opLink,
6734
+ style: cellLinkStyle,
6735
+ children: op.seqNo
6736
+ })
6737
+ }),
6738
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Td, {
6739
+ style: { padding: 0 },
6740
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
6741
+ to: opLink,
6742
+ style: cellLinkStyle,
6743
+ children: op.title
6744
+ })
6745
+ }),
6746
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Td, {
6747
+ style: { padding: 0 },
6748
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
6749
+ to: opLink,
6750
+ style: cellLinkStyle,
6751
+ children: op.predecessors && op.predecessors.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Group, {
6752
+ gap: 4,
6753
+ children: op.predecessors.map((p) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Badge, {
6754
+ variant: "light",
6755
+ size: "sm",
6756
+ children: [
6757
+ p.seqNo,
6758
+ ". ",
6759
+ p.title
6760
+ ]
6761
+ }, p.seqNo))
6762
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6763
+ c: "dimmed",
6764
+ size: "sm",
6765
+ children: "None"
6766
+ })
6767
+ })
6768
+ }),
6769
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Td, {
6770
+ style: { padding: 0 },
6771
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
6772
+ to: opLink,
6773
+ style: cellLinkStyle,
6774
+ children: op.stepCount ?? 0
6775
+ })
6776
+ }),
6777
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table.Td, {
6778
+ style: { padding: 0 },
6779
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
6780
+ to: opLink,
6781
+ style: cellLinkStyle,
6782
+ children: op.cost ? `$${op.cost.toFixed(2)}` : "—"
6783
+ })
6784
+ })
6785
+ ]
6786
+ }, op.id);
6787
+ }) })] })
6788
+ })] });
6789
+ };
6790
+ //#endregion
6791
+ //#region src/pages/orders/revs/revision/HeaderDetail.tsx
6792
+ var HeaderDetail = () => {
6793
+ const { orderKey, revNo } = useParams();
6794
+ const [revision, setRevision] = (0, import_react.useState)(null);
6795
+ const [loading, setLoading] = (0, import_react.useState)(true);
6796
+ const [editing, setEditing] = (0, import_react.useState)(false);
6797
+ const [saving, setSaving] = (0, import_react.useState)(false);
6798
+ const form = useForm({
6799
+ initialValues: {
6800
+ description: "",
6801
+ changeSummary: ""
6802
+ },
6803
+ validate: zodResolver(UpdateOrderRevisionSchema)
6804
+ });
6805
+ const [operations, setOperations] = (0, import_react.useState)(null);
6806
+ const [opsLoading, setOpsLoading] = (0, import_react.useState)(true);
6807
+ const fetchRevision = (0, import_react.useCallback)(async () => {
6808
+ if (!orderKey || !revNo) return;
6809
+ setLoading(true);
6810
+ try {
6811
+ setRevision(await api.get(apiEndpoints.orderRev(orderKey, revNo)));
6812
+ } catch (err) {
6813
+ showErrorNotification(err);
6814
+ } finally {
6815
+ setLoading(false);
6816
+ }
6817
+ }, [orderKey, revNo]);
6818
+ const fetchOperations = (0, import_react.useCallback)(async () => {
6819
+ if (!orderKey || !revNo) return;
6820
+ setOpsLoading(true);
6821
+ try {
6822
+ setOperations(await api.get(apiEndpoints.orderRevOps(orderKey, revNo)));
6823
+ } catch (err) {
6824
+ showErrorNotification(err);
6825
+ } finally {
6826
+ setOpsLoading(false);
6827
+ }
6828
+ }, [orderKey, revNo]);
6829
+ (0, import_react.useEffect)(() => {
6830
+ fetchRevision();
6831
+ fetchOperations();
6832
+ }, [fetchRevision, fetchOperations]);
6833
+ const startEditing = () => {
6834
+ if (!revision) return;
6835
+ form.setValues({
6836
+ description: revision.description || "",
6837
+ changeSummary: revision.changeSummary || ""
6838
+ });
6839
+ setEditing(true);
6840
+ };
6841
+ const handleSave = async (values) => {
6842
+ if (!revision) return;
6843
+ setSaving(true);
6844
+ try {
6845
+ setRevision(await api.put(apiEndpoints.orderRev(orderKey, revNo), values));
6846
+ setEditing(false);
6847
+ } catch (err) {
6848
+ showErrorNotification(err);
6849
+ } finally {
6850
+ setSaving(false);
6851
+ }
6852
+ };
6853
+ if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Stack, {
6854
+ align: "center",
6855
+ py: "xl",
6856
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loader, {})
6857
+ });
6858
+ if (!revision) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Stack, {
6859
+ p: "md",
6860
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: "Revision not found." })
6861
+ });
6862
+ const canEdit = hasAction(revision._actions, "update");
6863
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Container, {
6864
+ size: "md",
6865
+ py: "xl",
6866
+ w: "100%",
6867
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Stack, {
6868
+ gap: "md",
6869
+ children: [
6870
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Group, {
6871
+ justify: "space-between",
6872
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Group, {
6873
+ gap: "xs",
6874
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6875
+ fw: 600,
6876
+ children: "HEADER"
6877
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MetadataTooltip, {
6878
+ createdBy: revision.createdBy,
6879
+ createdAt: revision.createdAt,
6880
+ updatedBy: revision.updatedBy,
6881
+ updatedAt: revision.updatedAt
6882
+ })]
6883
+ }), canEdit && !editing && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
6884
+ size: "xs",
6885
+ variant: "light",
6886
+ onClick: startEditing,
6887
+ children: "Edit"
6888
+ })]
6889
+ }),
6890
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
6891
+ withBorder: true,
6892
+ p: "lg",
6893
+ children: editing ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", {
6894
+ onSubmit: form.onSubmit(handleSave),
6895
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Stack, {
6896
+ gap: "sm",
6897
+ children: [
6898
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Textarea, {
6899
+ label: "Description",
6900
+ placeholder: "Revision description...",
6901
+ autosize: true,
6902
+ minRows: 3,
6903
+ ...form.getInputProps("description")
6904
+ }),
6905
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Textarea, {
6906
+ label: "Change Summary",
6907
+ placeholder: "What changed in this revision...",
6908
+ autosize: true,
6909
+ minRows: 3,
6910
+ ...form.getInputProps("changeSummary")
6911
+ }),
6912
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Group, {
6913
+ justify: "flex-end",
6914
+ mt: "xs",
6915
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
6916
+ variant: "subtle",
6917
+ size: "xs",
6918
+ onClick: () => setEditing(false),
6919
+ children: "Cancel"
6920
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
6921
+ type: "submit",
6922
+ size: "xs",
6923
+ loading: saving,
6924
+ children: "Save"
6925
+ })]
6926
+ })
6927
+ ]
6928
+ })
6929
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Stack, {
6930
+ gap: "md",
6931
+ children: [
6932
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6933
+ size: "sm",
6934
+ fw: 500,
6935
+ mb: 4,
6936
+ children: "Produces Item"
6937
+ }), revision.itemKey ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6938
+ component: Link,
6939
+ to: `/items/${revision.itemKey}`,
6940
+ size: "sm",
6941
+ c: "blue",
6942
+ style: { textDecoration: "none" },
6943
+ children: revision.itemKey
6944
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6945
+ c: "dimmed",
6946
+ children: "None"
6947
+ })] }),
6948
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6949
+ size: "sm",
6950
+ fw: 500,
6951
+ mb: 4,
6952
+ children: "Description"
6953
+ }), revision.description ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompactMarkdown, { children: revision.description }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6954
+ c: "dimmed",
6955
+ children: "No description"
6956
+ })] }),
6957
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
6958
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6959
+ size: "sm",
6960
+ fw: 500,
6961
+ mb: 4,
6962
+ children: "Change Summary"
6963
+ }),
6964
+ revision.changeSummary ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompactMarkdown, { children: revision.changeSummary }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6965
+ c: "dimmed",
6966
+ children: "No change summary"
6967
+ }),
6968
+ Number(revNo) > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
6969
+ component: Link,
6970
+ to: `/orders/${orderKey}/revs/diff?from=${Number(revNo) - 1}&to=${revNo}`,
6971
+ size: "xs",
6972
+ c: "blue",
6973
+ mt: "xs",
6974
+ style: {
6975
+ textDecoration: "none",
6976
+ display: "inline-block"
6977
+ },
6978
+ children: "Diff with previous revision"
6979
+ })
6980
+ ] })
6981
+ ]
6982
+ })
6983
+ }),
6984
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OperationSummaryTable, {
6985
+ items: operations?.items ?? null,
6986
+ loading: opsLoading,
6987
+ linkBuilder: (seqNo) => `/orders/${orderKey}/revs/${revNo}/ops/${seqNo}`
6988
+ })
6989
+ ]
6990
+ })
6991
+ });
6992
+ };
6993
+ //#endregion
6994
+ //#region src/pages/orders/revs/revision/RevisionDiff.tsx
6970
6995
  var STATUS_COLORS$5 = {
6971
6996
  added: "green",
6972
6997
  removed: "red",
@@ -7240,7 +7265,7 @@ var RevisionDiff = () => {
7240
7265
  });
7241
7266
  };
7242
7267
  //#endregion
7243
- //#region src/pages/orders/revs/OperationSidebar.tsx
7268
+ //#region src/pages/orders/revs/operation/OperationSidebar.tsx
7244
7269
  var OperationSidebar = ({ orderKey, revNo, refreshKey }) => {
7245
7270
  const navigate = useNavigate();
7246
7271
  const location = useLocation();
@@ -7421,7 +7446,7 @@ var OperationSidebar = ({ orderKey, revNo, refreshKey }) => {
7421
7446
  })] });
7422
7447
  };
7423
7448
  //#endregion
7424
- //#region src/pages/orders/revs/RevisionHeader.tsx
7449
+ //#region src/pages/orders/revs/revision/RevisionHeader.tsx
7425
7450
  var STATUS_COLORS$4 = {
7426
7451
  [RevisionStatus.draft]: "blue",
7427
7452
  [RevisionStatus.approved]: "green",
@@ -7549,7 +7574,7 @@ var RevisionHeader = ({ revision, orderKey, revNo, onRefresh, onOpenOperations }
7549
7574
  });
7550
7575
  };
7551
7576
  //#endregion
7552
- //#region src/pages/orders/revs/RevisionLayout.tsx
7577
+ //#region src/pages/orders/revs/revision/RevisionLayout.tsx
7553
7578
  var SIDEBAR_WIDTH$1 = 260;
7554
7579
  var RevisionLayout = () => {
7555
7580
  const { orderKey, revNo } = useParams();
@@ -7684,7 +7709,7 @@ var RevisionLayout = () => {
7684
7709
  });
7685
7710
  };
7686
7711
  //#endregion
7687
- //#region src/components/OrderRunForm.tsx
7712
+ //#region src/components/forms/OrderRunForm.tsx
7688
7713
  function todayStr() {
7689
7714
  return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
7690
7715
  }