@feedmepos/mf-inventory-portal 1.9.3-dev.0 → 1.10.0-dev.1

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 (121) hide show
  1. package/dist/{App-CiOQuHhw.js → App-Dh-kak5M.js} +10 -10
  2. package/dist/{ApprovalView-C69CJTQj.js → ApprovalView-CQX3SsKB.js} +9 -9
  3. package/dist/{BindingsDialog-BI6xhJIE.js → BindingsDialog-gu29ZfJG.js} +2 -2
  4. package/dist/{BindingsPicker-CsofUw7f.js → BindingsPicker-D-OQFQKj.js} +2 -2
  5. package/dist/{BindingsTable-CGqaAZdg.js → BindingsTable-BoyC_OGE.js} +4 -4
  6. package/dist/{BulkReceiveRequestPage-C1m_p636.js → BulkReceiveRequestPage-CG1tJiPv.js} +19 -19
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-BAl8fTbk.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-hwA8FeAr.js} +1 -1
  8. package/dist/{ClosingDraftView-Ch2zpgwQ.js → ClosingDraftView-BzSFe5xy.js} +19 -19
  9. package/dist/{ClosingHistoryView-BwrEDI87.js → ClosingHistoryView-CL9wEpk4.js} +7 -7
  10. package/dist/{ClosingTemplateView-D8LeWon8.js → ClosingTemplateView-DU5pmH7f.js} +18 -18
  11. package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-DJ7DJJ7r.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-8Gs3fabn.js} +1 -1
  12. package/dist/{DefaultView-y3LsWxu2.js → DefaultView-QC__zfSG.js} +2 -2
  13. package/dist/{DeliveryOrderPrintPreview-B7TU851r.js → DeliveryOrderPrintPreview-Br1-XWrD.js} +2 -2
  14. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-DaYXvUzy.js → EmailDialog.vue_vue_type_script_setup_true_lang-7O63bX20.js} +23 -23
  15. package/dist/{FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-BXVHbxri.js → FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-pwAMIprj.js} +1 -1
  16. package/dist/{FeatureCapabilityGate-BtSsonTW.js → FeatureCapabilityGate-BlJTbmsn.js} +2 -2
  17. package/dist/{FeaturePageGate.vue_vue_type_script_setup_true_lang-BxeC99Sg.js → FeaturePageGate.vue_vue_type_script_setup_true_lang-C-wsskNh.js} +1 -1
  18. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-DaScMVvk.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-DJBUQ-kR.js} +1 -1
  19. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DXoImNxb.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CE7AGfPC.js} +2 -2
  20. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-C96aUMR0.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BxPPEvtB.js} +2 -2
  21. package/dist/{FmMultiselectDialog-FNx_49Vd.js → FmMultiselectDialog-BJqR7vhA.js} +2 -2
  22. package/dist/{FmMultiselectDialog-B4-3K0fn.js → FmMultiselectDialog-C5FLM0Gh.js} +2 -2
  23. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BQ7zvVhF.js → FmUnitInput.vue_vue_type_script_setup_true_lang-D5LL15Um.js} +5 -5
  24. package/dist/{ImportView-CWBDYeHh.js → ImportView-C2X3208X.js} +7 -7
  25. package/dist/{IngredientsView-C0X8c_0v.js → IngredientsView-CHWaXQlL.js} +15 -15
  26. package/dist/{IntegrationExplorerView-YWCS-Rr-.js → IntegrationExplorerView-t1J4l6Id.js} +6 -6
  27. package/dist/{IntegrationPlatformView-DUtta7MJ.js → IntegrationPlatformView-BYA6Tkst.js} +1606 -1590
  28. package/dist/{IntegrationView-C3GUvk9o.js → IntegrationView-CsJTx007.js} +15 -15
  29. package/dist/{InventoryBindingForm-Do329DkB.js → InventoryBindingForm-ho7g7G7Q.js} +1 -1
  30. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-B-6fV7fu.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-B_qROp0_.js} +4 -4
  31. package/dist/{InventoryBindingSummary-COB3W5cb.js → InventoryBindingSummary-fmA89SF4.js} +1 -1
  32. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CPwjN7Y4.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BwwlcRgG.js} +2 -2
  33. package/dist/ProductionRunDetailPage-BrJn9FLp.js +2335 -0
  34. package/dist/{ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-BWBXX4SU.js → ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-DpnHaoe1.js} +6870 -6281
  35. package/dist/{ProductionRunPage-DkQjat-b.js → ProductionRunPage-H26MFgS2.js} +4 -4
  36. package/dist/{PublishView-B0tpsVGk.js → PublishView-CSrSkoWX.js} +5 -5
  37. package/dist/{PurchaseOrderPrintPreview-CEMExbly.js → PurchaseOrderPrintPreview-DoNXyUAq.js} +2 -2
  38. package/dist/{ReceiveRequestView-CsDnM11Q.js → ReceiveRequestView-Wb7YJX63.js} +14 -14
  39. package/dist/{RecipeView-BPD7Y9I0.js → RecipeView-KCQpJ7SS.js} +16 -16
  40. package/dist/{SettingsView-BYNYWMKW.js → SettingsView-DoG_F33c.js} +7 -7
  41. package/dist/{StockView-DXg1cc3t.js → StockView-B4HZXRN8.js} +21 -21
  42. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CBS2nasQ.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-ryrooMzm.js} +1 -1
  43. package/dist/{SupplierView-DbQF6Uyz.js → SupplierView-CtTB7Lpn.js} +13 -13
  44. package/dist/{SurchargeView-DbdHhrLf.js → SurchargeView-zgXKeGMc.js} +7 -7
  45. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BvNSFmMe.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-JpxxNRit.js} +2 -2
  46. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-MejrG1jm.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BZ5blyev.js} +1 -1
  47. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-JS7yBums.js → TransferDetails.vue_vue_type_script_setup_true_lang-ByNBMoFV.js} +21 -21
  48. package/dist/{TransferTemplateView-B8on3zV0.js → TransferTemplateView-CO6FrzLy.js} +19 -19
  49. package/dist/{UnitCostHistoryView-i51A-5cK.js → UnitCostHistoryView-D7TbmKZD.js} +4 -4
  50. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-DXQvpWHC.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DFXdIqSl.js} +4 -4
  51. package/dist/{UnitView-DsvJqbId.js → UnitView-BgqDqxfJ.js} +7 -7
  52. package/dist/{WarehouseView-CN_ahRSa.js → WarehouseView-BaieJUXC.js} +8 -8
  53. package/dist/{WastageTemplateView-DuCU_nBJ.js → WastageTemplateView-BYadevlz.js} +15 -15
  54. package/dist/api/netsuite.d.ts +8 -14
  55. package/dist/api/production-run-error.d.ts +26 -1
  56. package/dist/{app-6I8ZFr27.js → app-Dq9I3XI4.js} +9203 -9392
  57. package/dist/app.d.ts +328 -248
  58. package/dist/app.js +1 -1
  59. package/dist/{bulk-edit-simulation.helper-DDgaZf_R.js → bulk-edit-simulation.helper-LRxVzNpt.js} +2 -2
  60. package/dist/{closing-template-BSsPxnVF.js → closing-template-Dq0lVYML.js} +1 -1
  61. package/dist/{date2-GOP7g_bU.js → date2-C9a2hGF2.js} +1 -1
  62. package/dist/{dayjs.min-DEbDvLfu.js → dayjs.min-Boe04IJA.js} +1 -1
  63. package/dist/{decimal-I8CLMbAA.js → decimal-CapXS7w9.js} +2 -2
  64. package/dist/{defineDeepModel-CVn-T1iW.js → defineDeepModel-BCkw0D6y.js} +1 -1
  65. package/dist/{duplicate-template-CnIO7Xsj.js → duplicate-template-CDPD2O_k.js} +1 -1
  66. package/dist/{feature-zHW3ip-x.js → feature-CQUUcJxS.js} +21 -25
  67. package/dist/{format-time-from-id-DddiiGNz.js → format-time-from-id-BwhlcY5A.js} +1 -1
  68. package/dist/{format-unit-display-wDV9J26j.js → format-unit-display-D_DT29Nz.js} +12 -12
  69. package/dist/{id-to-date-D4JNCgjx.js → id-to-date-BhRK-01j.js} +1 -1
  70. package/dist/{import-export.helper-D7Uznl2F.js → import-export.helper-CixS7WaZ.js} +5 -5
  71. package/dist/{index-DqBH6CEX.js → index-CnZ9aT0W.js} +3 -3
  72. package/dist/{index-qe8J3LVW.js → index-DeOfF5Tt.js} +1 -1
  73. package/dist/{index-BP0BliuR.js → index-v4n0mtqr.js} +1 -1
  74. package/dist/{lz-string-nJvgtabI.js → lz-string-CIIInye8.js} +1 -1
  75. package/dist/{netsuite-CmBb3aml.js → netsuite-C54-843n.js} +2 -2
  76. package/dist/{netsuite-explorer-C_4qkkqX.js → netsuite-explorer-CgZteVAI.js} +1 -1
  77. package/dist/{predefined-templates-8sXIcivc.js → predefined-templates-C1I7RY5M.js} +1 -1
  78. package/dist/{publish-versions-DGvcQiOp.js → publish-versions-CZhfCqmR.js} +1 -1
  79. package/dist/{purchase-order-template-CdMWIXpQ.js → purchase-order-template-CQwJPOSt.js} +1 -1
  80. package/dist/{recalculationUtils-DXb7x3Xk.js → recalculationUtils-CV6n3RIc.js} +1 -1
  81. package/dist/{row-action.enum-BzbzZ5bN.js → row-action.enum-CfQIiMG1.js} +1 -1
  82. package/dist/{rules-BK5Dul4y.js → rules-BegeNAnD.js} +3 -3
  83. package/dist/{stock-C10cihjj.js → stock-BRjx4AbX.js} +1 -1
  84. package/dist/{stock-BknAZQ48.js → stock-DlDmFyoj.js} +2 -2
  85. package/dist/stores/inventory.d.ts +8 -10
  86. package/dist/stores/stock.d.ts +8 -10
  87. package/dist/style.css +1 -1
  88. package/dist/{supplier-5m-phEol.js → supplier-C-b_06_2.js} +2 -2
  89. package/dist/{surcharge-D7OCkL0j.js → surcharge-DZLtgZPI.js} +1 -1
  90. package/dist/tsconfig.app.tsbuildinfo +1 -1
  91. package/dist/{uom-rules-CyvlOZPO.js → uom-rules-9RjY5mdp.js} +1 -1
  92. package/dist/{use-ingredient-select-dialog-HhCypq52.js → use-ingredient-select-dialog-BCXNckRG.js} +2 -2
  93. package/dist/{use-inventory-binding-dialog-BMiNYNXV.js → use-inventory-binding-dialog-C2jghyFw.js} +2 -2
  94. package/dist/{use-template-enabled-locations-xqWZsGTv.js → use-template-enabled-locations-LVGn5xj5.js} +2 -2
  95. package/dist/{use-transfer-locations-yDC04RRt.js → use-transfer-locations-CuaqR9iW.js} +2 -2
  96. package/dist/{useHrmPermission-slYF_cER.js → useHrmPermission-C_aX175n.js} +1 -1
  97. package/dist/{useNavigationMenu-DI7vTxwl.js → useNavigationMenu-DMXSWSlw.js} +5 -5
  98. package/dist/{useSseClient-BWIU-WLd.js → useSseClient-BM0l1uNj.js} +1 -1
  99. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.vue.d.ts +16 -20
  100. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +32 -40
  101. package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupDetailSideSheet.vue.d.ts +16 -20
  102. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +48 -60
  103. package/dist/views/closing-draft/composables/use-closing-draft-import.d.ts +8 -10
  104. package/dist/views/production-run/features/output/use-production-run-record-output.d.ts +3 -1
  105. package/dist/views/production-run/features/planning/use-production-run-form.d.ts +19 -0
  106. package/dist/views/production-run/features/prepare/PrepareRunConfirmationDialog.vue.d.ts +2 -0
  107. package/dist/views/production-run/shared/model/production-run-plan-problem.d.ts +20 -0
  108. package/dist/views/production-run/shared/model/production-run-plan-problem.spec.d.ts +1 -0
  109. package/dist/views/production-run/shared/model/production-run-refusal.d.ts +23 -0
  110. package/dist/views/production-run/shared/model/use-production-run-actions.d.ts +2 -0
  111. package/dist/views/production-run/shared/model/use-production-run-ingredients.d.ts +24 -42
  112. package/dist/views/production-run/shared/ui/ProductionRunProjectionFeedback.vue.d.ts +13 -0
  113. package/dist/views/production-run/test-support/production-run.fixture.d.ts +4 -25
  114. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +8 -12
  115. package/dist/views/stock/components/dialog/AmendAdjustmentForm.vue.d.ts +0 -2
  116. package/dist/{vue-jN_8HeeE.js → vue-ZvgRmbwh.js} +2 -2
  117. package/dist/{vue-i18n-jmTuXNbR.js → vue-i18n-Q96C38GI.js} +169 -169
  118. package/dist/{xlsx.util-BPevMvrr.js → xlsx.util-568g2puT.js} +2 -2
  119. package/package.json +4 -4
  120. package/dist/ProductionRunDetailPage-DpyTf2_6.js +0 -2317
  121. package/dist/views/production-run/shared/ui/ProductionRunCostingUnavailable.vue.d.ts +0 -2
@@ -1,2317 +0,0 @@
1
- import { defineComponent as K, computed as $, ref as j, resolveComponent as te, createElementBlock as m, openBlock as s, Fragment as H, createElementVNode as n, createBlock as B, createCommentVNode as R, createVNode as P, withCtx as ne, createTextVNode as ie, toDisplayString as p, unref as e, renderList as oe, Teleport as Ce, normalizeClass as U, watch as ae, renderSlot as me, createSlots as Ye, nextTick as Ie, toValue as fe, onBeforeUnmount as Xe } from "vue";
2
- import { useRouter as Se } from "vue-router";
3
- import { _ as re, a as et } from "./FeaturePageGate.vue_vue_type_script_setup_true_lang-BxeC99Sg.js";
4
- import { u as Ae, n as tt } from "./app-6I8ZFr27.js";
5
- import { useBreakpoints as nt, useDialog as ot } from "@feedmepos/ui-library";
6
- import { useI18n as Y } from "@feedmepos/mf-common";
7
- import { c as de, b as at, _ as rt, h as Le, m as st, n as Ee, o as De, r as Me, s as it, q as Ve, t as Ue, v as He, N as le, f as E, w as ze, x as We, y as lt, z as he, A as ut, B as dt, C as ct, D as pt, E as Ge, F as mt, a as bt, G as Ne, H as vt, I as yt, J as ft, u as Ke, K as ht, L as we, M as gt, O as _t, Q as kt, i as $t, p as xt, j as be, R as Pe, d as wt, e as It, S as Rt, T as St, U as At, V as Lt, g as Pt, l as qt } from "./ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-BWBXX4SU.js";
8
- import { p as Tt } from "./production-run-list-DR1WsaBR.js";
9
- import { _ as ce } from "./_plugin-vue_export-helper-CHgC5LLL.js";
10
- import { g as Oe } from "./rules-BK5Dul4y.js";
11
- const Bt = { class: "flex flex-col gap-12" }, Ct = {
12
- "data-testid": "production-run-header-layout",
13
- class: "relative flex flex-col items-stretch gap-16 lg:flex-row lg:items-start"
14
- }, Nt = {
15
- "data-testid": "production-run-header-copy",
16
- class: "grow min-w-0 flex flex-col gap-4"
17
- }, Ot = { class: "fm-typo-en-title-lg-600 break-words text-fm-color-typo-primary" }, Ft = {
18
- "data-testid": "production-run-caption",
19
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
20
- }, jt = { class: "mt-4 flex items-center" }, Et = {
21
- "data-testid": "production-run-header-actions",
22
- class: "flex shrink-0 flex-wrap items-center justify-start gap-8 lg:justify-end"
23
- }, Dt = { key: 0 }, Mt = {
24
- key: 0,
25
- "data-testid": "production-run-header-overflow"
26
- }, Vt = ["data-testid"], Ut = {
27
- key: 2,
28
- "data-testid": "production-run-header-secondary-print"
29
- }, Ht = { class: "fixed bottom-64 right-16 z-40" }, Fe = "__print_prepare_sheet__", zt = /* @__PURE__ */ K({
30
- __name: "ProductionRunHeader",
31
- props: {
32
- run: {},
33
- locationName: {},
34
- primaryAction: {},
35
- secondaryActions: {},
36
- dangerActions: {},
37
- canPrintPrepareSheet: { type: Boolean },
38
- backTo: {},
39
- backLabel: {},
40
- statusDescription: {},
41
- targetReached: { type: Boolean },
42
- busy: { type: Boolean }
43
- },
44
- emits: ["action", "print-prepare-sheet"],
45
- setup(L, { emit: c }) {
46
- const t = L, _ = c, { t: l } = Y(), { breakpoints: u } = nt(), w = $(() => u.value.xs), f = $(() => u.value.sm || u.value.md), x = j(!1), a = $(
47
- () => Tt(t.run, l("inventory.production.run.list.untitled"))
48
- ), h = $(() => {
49
- const v = t.run.activityLogs, S = v.length ? v[v.length - 1] : null, y = (S == null ? void 0 : S.performedAt) ?? t.run.createdAt, C = S && S.action !== "create" ? l("inventory.production.run.list.columns.updated") : l("inventory.production.run.detail.created"), N = [`# ${t.run.runNo}`, t.locationName].filter(Boolean);
50
- return y && N.push(`${C} ${de(y)}`), N.join(" · ");
51
- }), I = (v) => v === "complete" && Le(t.run) ? l("inventory.production.run.detail.pendingStock.resume") : v === "complete" && t.targetReached ? l("inventory.production.run.detail.action.recordAdditionalOutput") : l(`inventory.production.run.detail.action.${v}`, st[v]), i = $(() => t.dangerActions.length > 0), r = $(
52
- () => t.dangerActions.map((v) => ({
53
- id: v,
54
- label: I(v),
55
- destructive: !0,
56
- disabled: t.busy
57
- }))
58
- ), k = $(() => [
59
- ...t.secondaryActions.map((v) => ({
60
- id: v,
61
- label: I(v),
62
- disabled: t.busy
63
- })),
64
- ...t.canPrintPrepareSheet ? [
65
- {
66
- id: Fe,
67
- label: l("inventory.production.run.detail.printPrepareSheet"),
68
- disabled: t.busy
69
- }
70
- ] : [],
71
- ...r.value
72
- ]), o = $(
73
- () => k.value.map(
74
- (v) => ({
75
- label: v.label,
76
- value: v.id,
77
- disabled: v.disabled
78
- })
79
- )
80
- ), d = $(() => {
81
- const v = i.value ? [{ key: "overflow", kind: "overflow" }] : [], S = t.secondaryActions.map((N) => ({
82
- key: `secondary-${N}`,
83
- kind: "lifecycle",
84
- action: N,
85
- variant: "secondary"
86
- })), y = t.canPrintPrepareSheet ? [{ key: "print", kind: "print" }] : [], C = t.primaryAction ? [
87
- {
88
- key: `primary-${t.primaryAction}`,
89
- kind: "lifecycle",
90
- action: t.primaryAction,
91
- variant: "primary"
92
- }
93
- ] : [];
94
- return f.value ? [...C, ...S, ...y, ...v] : [...v, ...S, ...y, ...C];
95
- });
96
- function b(v) {
97
- _("action", v);
98
- }
99
- function T(v) {
100
- if (!t.busy) {
101
- if (x.value = !1, v === Fe) {
102
- _("print-prepare-sheet");
103
- return;
104
- }
105
- b(v);
106
- }
107
- }
108
- const O = $(() => l(`inventory.production.run.list.status.${t.run.status}`)), D = $(
109
- () => l("inventory.production.run.detail.statusHelp", { status: O.value })
110
- );
111
- return (v, S) => {
112
- const y = te("FmIcon"), C = te("RouterLink"), N = te("FmButton"), X = te("FmCollapsibleTabs"), z = te("FmBottomSheet");
113
- return s(), m(H, null, [
114
- n("header", Bt, [
115
- P(C, {
116
- to: v.backTo,
117
- "data-testid": "production-run-back",
118
- class: "-ml-12 inline-flex h-32 w-fit items-center gap-4 rounded-md px-12 fm-typo-en-body-sm-600 leading-[18px] text-fm-color-typo-secondary hover:bg-fm-color-opacity-sm hover:text-fm-color-typo-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-fm-color-primary print:hidden"
119
- }, {
120
- default: ne(() => [
121
- P(y, {
122
- name: "arrow_back",
123
- size: "sm",
124
- "aria-hidden": "true"
125
- }),
126
- ie(" " + p(v.backLabel ?? e(l)("inventory.production.run.detail.back")), 1)
127
- ]),
128
- _: 1
129
- }, 8, ["to"]),
130
- n("div", Ct, [
131
- n("div", Nt, [
132
- n("h1", Ot, p(a.value), 1),
133
- n("p", Ft, p(h.value), 1),
134
- n("div", jt, [
135
- P(at, {
136
- status: v.run.status,
137
- tooltip: v.statusDescription,
138
- "accessible-label": D.value,
139
- "help-icon": ""
140
- }, null, 8, ["status", "tooltip", "accessible-label"])
141
- ])
142
- ]),
143
- n("div", Et, [
144
- w.value && k.value.length ? (s(), m("div", Dt, [
145
- P(N, {
146
- type: "button",
147
- variant: "tertiary",
148
- "prepend-icon": "more_vert",
149
- "aria-label": e(l)("inventory.production.run.detail.moreActions"),
150
- disabled: v.busy,
151
- "data-testid": "production-run-detail-mobile-more",
152
- onClick: S[0] || (S[0] = (F) => x.value = !0)
153
- }, null, 8, ["aria-label", "disabled"])
154
- ])) : R("", !0),
155
- (s(!0), m(H, null, oe(w.value ? [] : d.value, (F) => (s(), m(H, {
156
- key: F.key
157
- }, [
158
- F.kind === "overflow" ? (s(), m("div", Mt, [
159
- P(rt, {
160
- items: r.value,
161
- placement: "bottom-end",
162
- "accessible-label": e(l)("inventory.production.run.detail.moreActions"),
163
- disabled: v.busy,
164
- onSelect: b
165
- }, null, 8, ["items", "accessible-label", "disabled"])
166
- ])) : F.kind === "lifecycle" ? (s(), m("div", {
167
- key: 1,
168
- "data-testid": `production-run-header-${F.variant}-${F.action}`
169
- }, [
170
- P(N, {
171
- variant: F.variant,
172
- label: I(F.action),
173
- disabled: v.busy,
174
- loading: F.variant === "primary" && v.busy,
175
- onClick: (Z) => _("action", F.action)
176
- }, null, 8, ["variant", "label", "disabled", "loading", "onClick"])
177
- ], 8, Vt)) : (s(), m("div", Ut, [
178
- P(N, {
179
- variant: "secondary",
180
- icon: "print",
181
- label: e(l)("inventory.production.run.detail.printPrepareSheet"),
182
- disabled: v.busy,
183
- onClick: S[1] || (S[1] = (Z) => _("print-prepare-sheet"))
184
- }, null, 8, ["label", "disabled"])
185
- ]))
186
- ], 64))), 128))
187
- ])
188
- ])
189
- ]),
190
- w.value && v.primaryAction ? (s(), B(Ce, {
191
- key: 0,
192
- to: "body"
193
- }, [
194
- n("div", Ht, [
195
- P(N, {
196
- "data-testid": "production-run-detail-mobile-primary",
197
- variant: "fab",
198
- label: I(v.primaryAction),
199
- "prepend-icon": v.primaryAction === "complete" ? "add" : void 0,
200
- loading: v.busy,
201
- onClick: S[2] || (S[2] = (F) => _("action", v.primaryAction))
202
- }, null, 8, ["label", "prepend-icon", "loading"])
203
- ])
204
- ])) : R("", !0),
205
- w.value && k.value.length ? (s(), B(Ce, {
206
- key: 1,
207
- to: "body"
208
- }, [
209
- P(z, {
210
- modelValue: x.value,
211
- "onUpdate:modelValue": S[3] || (S[3] = (F) => x.value = F),
212
- "dismiss-away": "",
213
- "no-header": ""
214
- }, {
215
- default: ne(() => [
216
- P(X, {
217
- class: "pb-8",
218
- items: o.value,
219
- "data-testid": "production-run-detail-mobile-menu",
220
- "onUpdate:modelValue": T
221
- }, null, 8, ["items"])
222
- ]),
223
- _: 1
224
- }, 8, ["modelValue"])
225
- ])) : R("", !0)
226
- ], 64);
227
- };
228
- }
229
- }), Wt = /* @__PURE__ */ ce(zt, [["__scopeId", "data-v-9715608c"]]), Gt = ["aria-labelledby"], Kt = { class: "flex min-h-56 items-center px-16 py-12" }, Qt = ["id"], Zt = ["aria-label"], Jt = { key: 0 }, Yt = { class: "border-y border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100" }, Xt = { class: "production-run-table-header h-40 border-b border-fm-color-neutral-gray-200 fm-typo-en-body-sm-600 text-fm-color-typo-secondary" }, en = { class: "text-left px-16 py-8 font-inherit" }, tn = {
230
- key: 0,
231
- class: "text-right px-16 py-8 font-inherit"
232
- }, nn = { class: "px-16 py-12 align-top fm-typo-en-body-md-400 text-fm-color-typo-primary" }, on = { class: "block fm-typo-en-body-md-600" }, an = {
233
- key: 0,
234
- class: "px-16 py-12 text-right fm-typo-en-body-md-400 text-fm-color-typo-secondary tabular-nums"
235
- }, rn = { key: 0 }, sn = {
236
- key: 1,
237
- class: "text-fm-color-typo-disabled"
238
- }, ln = { key: 0 }, un = {
239
- key: 1,
240
- class: "text-fm-color-typo-success"
241
- }, dn = { key: 0 }, cn = ["colspan"], pn = { class: "production-run-items-bindings-sticky bg-fm-color-surface-primary px-16 pb-12 pt-4" }, mn = {
242
- key: 0,
243
- "data-testid": "unattributed-issued-ingredients",
244
- class: "border-t border-fm-color-border-default bg-fm-color-surface-secondary px-16 py-12"
245
- }, bn = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-warning" }, vn = { class: "mt-2 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, yn = /* @__PURE__ */ K({
246
- __name: "ProductionRunItemsTable",
247
- props: {
248
- run: {},
249
- names: {},
250
- ingredientContributions: { default: () => ({}) },
251
- unattributedIngredients: { default: () => [] },
252
- unissuedSkuIds: { default: () => [] },
253
- titleKey: { default: "inventory.production.run.detail.items.title" },
254
- presentation: { default: "review" }
255
- },
256
- setup(L) {
257
- const c = L, { t } = Y(), _ = j(/* @__PURE__ */ new Set()), l = $(() => c.presentation === "preparing"), u = $(
258
- () => {
259
- var o;
260
- return /* @__PURE__ */ new Set([
261
- ...((o = c.run.plan.requirements) == null ? void 0 : o.skippedSkuIds) ?? [],
262
- ...c.run.preparation.issuances.flatMap((d) => d.skippedSkuIds ?? [])
263
- ]);
264
- }
265
- ), w = $(() => new Set(c.unissuedSkuIds));
266
- function f(o) {
267
- return l.value ? u.value.has(o) ? !0 : !c.run.plan.requirements && c.unattributedIngredients.length === 0 && w.value.has(o) : !1;
268
- }
269
- function x(o) {
270
- return c.ingredientContributions[o] ?? [];
271
- }
272
- function a(o, d) {
273
- return d > 0 ? o.issued / d : o.issued;
274
- }
275
- function h(o) {
276
- return `production-run-output-ingredients-${o}`;
277
- }
278
- function I(o) {
279
- const d = new Set(_.value);
280
- d.has(o) ? d.delete(o) : d.add(o), _.value = d;
281
- }
282
- function i(o) {
283
- return x(o.skuId).map((d) => ({
284
- id: d.skuId,
285
- name: d.name,
286
- amount: a(d, o.committed),
287
- unit: d.unit ?? ""
288
- }));
289
- }
290
- function r(o) {
291
- return `production-run-committed-description-${o.replace(/[^a-zA-Z0-9_-]/g, "-")}`;
292
- }
293
- const k = $(() => {
294
- var D;
295
- const o = Ee(c.run), d = De(c.run), b = Me(c.run), T = {}, O = /* @__PURE__ */ new Set();
296
- for (const v of c.run.plan.items) {
297
- const S = (D = c.run.preparation.issuances.flatMap((C) => C.items).find((C) => C.sku._id === v.skuId)) == null ? void 0 : D.sku.unit, y = S ? it(v.measurement, S) : null;
298
- if (!y) {
299
- O.add(v.skuId), T[v.skuId] = null;
300
- continue;
301
- }
302
- O.has(v.skuId) || (T[v.skuId] = (T[v.skuId] ?? 0) + Ve(v.requestedAmount, y));
303
- }
304
- return Object.keys(o).map((v) => {
305
- var S, y;
306
- return {
307
- skuId: v,
308
- name: ((S = c.names[v]) == null ? void 0 : S.name) ?? v,
309
- unit: ((y = c.names[v]) == null ? void 0 : y.unit) ?? null,
310
- requested: T[v] ?? null,
311
- committed: o[v] ?? 0,
312
- produced: d[v] ?? 0,
313
- remaining: b[v] ?? 0
314
- };
315
- });
316
- });
317
- return (o, d) => (s(), m("section", {
318
- class: "border border-fm-color-neutral-gray-200 fm-corner-radius-md overflow-hidden bg-fm-color-surface-primary",
319
- "aria-labelledby": l.value ? "items-to-produce-title" : void 0
320
- }, [
321
- n("header", Kt, [
322
- n("h2", {
323
- id: l.value ? "items-to-produce-title" : void 0,
324
- class: "fm-typo-en-body-lg-600"
325
- }, [
326
- ie(p(e(t)(o.titleKey)), 1),
327
- l.value ? (s(), m(H, { key: 0 }, [
328
- ie(" (" + p(k.value.length) + ")", 1)
329
- ], 64)) : R("", !0)
330
- ], 8, Qt)
331
- ]),
332
- n("div", {
333
- "data-testid": "production-run-items-scroll",
334
- class: "production-run-items-scroll overflow-x-auto",
335
- role: "region",
336
- tabindex: "0",
337
- "aria-label": e(t)(o.titleKey)
338
- }, [
339
- n("table", {
340
- class: U(["w-full min-w-[44rem]", { "table-fixed": l.value }])
341
- }, [
342
- l.value ? (s(), m("colgroup", Jt, d[0] || (d[0] = [
343
- n("col", null, null, -1),
344
- n("col", { class: "w-36" }, null, -1),
345
- n("col", { class: "w-36" }, null, -1),
346
- n("col", { class: "w-36" }, null, -1)
347
- ]))) : R("", !0),
348
- n("thead", Yt, [
349
- n("tr", Xt, [
350
- n("th", en, p(e(t)("inventory.production.run.detail.items.item")), 1),
351
- l.value ? R("", !0) : (s(), m("th", tn, p(e(t)("inventory.production.run.detail.items.requested")), 1)),
352
- n("th", {
353
- class: U([l.value ? "text-center" : "text-right", "px-16 py-8 font-inherit"])
354
- }, p(e(t)(
355
- l.value ? "inventory.production.run.detail.preparing.toProduce" : "inventory.production.run.detail.items.committed"
356
- )), 3),
357
- n("th", {
358
- class: U([l.value ? "text-center" : "text-right", "px-16 py-8 font-inherit"])
359
- }, p(e(t)(
360
- l.value ? "inventory.production.run.detail.preparing.recorded" : "inventory.production.run.detail.items.produced"
361
- )), 3),
362
- n("th", {
363
- class: U([l.value ? "text-center" : "text-right", "px-16 py-8 font-inherit"])
364
- }, p(e(t)(
365
- l.value ? "inventory.production.run.detail.preparing.remaining" : "inventory.production.run.detail.items.left"
366
- )), 3)
367
- ])
368
- ]),
369
- (s(!0), m(H, null, oe(k.value, (b) => (s(), m("tbody", {
370
- key: b.skuId,
371
- class: "border-b border-fm-color-neutral-gray-200 last:border-b-0"
372
- }, [
373
- n("tr", {
374
- class: U({ "production-run-preparing-row": l.value })
375
- }, [
376
- n("td", nn, [
377
- n("span", on, p(b.name), 1),
378
- x(b.skuId).length ? (s(), B(Ue, {
379
- key: 0,
380
- class: "mt-[2px]",
381
- count: x(b.skuId).length,
382
- controls: h(b.skuId),
383
- expanded: _.value.has(b.skuId),
384
- testid: `output-ingredient-disclosure-${b.skuId}`,
385
- onToggle: (T) => I(b.skuId)
386
- }, null, 8, ["count", "controls", "expanded", "testid", "onToggle"])) : f(b.skuId) ? (s(), B(He, {
387
- key: 1,
388
- "item-name": b.name
389
- }, null, 8, ["item-name"])) : R("", !0)
390
- ]),
391
- l.value ? R("", !0) : (s(), m("td", an, p(b.requested === null ? e(le) : e(E)(b.requested, b.unit)), 1)),
392
- n("td", {
393
- class: U(["px-16 py-12 fm-typo-en-body-md-400 tabular-nums", [
394
- l.value ? "text-center" : "text-right",
395
- b.requested !== null && b.committed !== b.requested ? "text-fm-color-typo-warning fm-typo-en-body-md-600" : "text-fm-color-typo-primary"
396
- ]])
397
- }, [
398
- n("span", {
399
- class: U(["inline-flex items-center gap-2", l.value ? "justify-center" : "justify-end"])
400
- }, [
401
- n("span", null, p(e(E)(b.committed, b.unit)), 1),
402
- !l.value && b.requested !== null && b.committed !== b.requested ? (s(), B(ze, {
403
- key: 0,
404
- "description-id": r(b.skuId),
405
- "trigger-label": e(t)("inventory.production.run.detail.items.committedHelpLabel"),
406
- description: e(t)("inventory.production.run.detail.items.committedHelp", {
407
- requested: e(E)(b.requested, b.unit)
408
- }),
409
- testid: `committed-quantity-help-${b.skuId}`,
410
- compact: ""
411
- }, null, 8, ["description-id", "trigger-label", "description", "testid"])) : R("", !0)
412
- ], 2)
413
- ], 2),
414
- n("td", {
415
- class: U(["px-16 py-12 fm-typo-en-body-md-400 tabular-nums", l.value ? "text-center" : "text-right"])
416
- }, [
417
- l.value || b.produced > 0 ? (s(), m("span", rn, p(e(E)(b.produced, b.unit)), 1)) : (s(), m("span", sn, p(e(le)), 1))
418
- ], 2),
419
- n("td", {
420
- class: U([
421
- "px-16 py-12 tabular-nums",
422
- l.value ? "text-center fm-typo-en-body-md-600" : "text-right fm-typo-en-body-md-400"
423
- ])
424
- }, [
425
- l.value || b.remaining > 0 ? (s(), m("span", ln, p(e(E)(b.remaining, b.unit)), 1)) : (s(), m("span", un, p(e(t)("inventory.production.run.detail.items.done")), 1))
426
- ], 2)
427
- ], 2),
428
- _.value.has(b.skuId) ? (s(), m("tr", dn, [
429
- n("td", {
430
- colspan: l.value ? 4 : 5,
431
- class: "production-run-items-bindings-cell"
432
- }, [
433
- n("div", pn, [
434
- P(We, {
435
- id: h(b.skuId),
436
- testid: "production-run-output-ingredient-list",
437
- count: x(b.skuId).length,
438
- unit: b.unit ?? "",
439
- lines: i(b),
440
- "item-name": b.name
441
- }, null, 8, ["id", "count", "unit", "lines", "item-name"])
442
- ])
443
- ], 8, cn)
444
- ])) : R("", !0)
445
- ]))), 128))
446
- ], 2)
447
- ], 8, Zt),
448
- o.unattributedIngredients.length ? (s(), m("div", mn, [
449
- n("p", bn, p(e(t)("inventory.production.run.detail.items.unattributedTitle")), 1),
450
- n("p", vn, p(e(t)("inventory.production.run.detail.items.unattributedMessage")), 1)
451
- ])) : R("", !0)
452
- ], 8, Gt));
453
- }
454
- }), Qe = /* @__PURE__ */ ce(yn, [["__scopeId", "data-v-b5fad4a9"]]), fn = {
455
- "data-testid": "closed-production-result",
456
- class: "min-w-0 overflow-hidden border border-fm-color-neutral-gray-200 fm-corner-radius-md bg-fm-color-surface-primary",
457
- "aria-labelledby": "production-run-result-title"
458
- }, hn = { class: "flex h-56 items-center justify-between gap-16 border-b border-fm-color-neutral-gray-200 px-16 py-12" }, gn = {
459
- id: "production-run-result-title",
460
- class: "fm-typo-en-body-lg-600"
461
- }, _n = {
462
- "data-testid": "closed-targets-reached",
463
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
464
- }, kn = ["aria-label"], $n = ["aria-label"], xn = { class: "bg-fm-color-neutral-gray-100" }, wn = { class: "h-40 border-b border-fm-color-neutral-gray-200 fm-typo-en-body-sm-600 text-fm-color-typo-secondary" }, In = { class: "whitespace-nowrap px-16 py-8 text-left font-inherit" }, Rn = { class: "whitespace-nowrap px-8 py-8 text-center font-inherit" }, Sn = { class: "whitespace-nowrap px-8 py-8 text-center font-inherit" }, An = { class: "min-w-0 px-16 py-12" }, Ln = ["title"], Pn = {
465
- "data-testid": "closed-item-yield",
466
- class: "whitespace-nowrap px-8 py-12 text-center tabular-nums"
467
- }, qn = { class: "block fm-typo-en-body-md-400" }, Tn = {
468
- "data-testid": "closed-item-variance",
469
- class: "whitespace-nowrap px-8 py-12 text-center tabular-nums"
470
- }, ee = "inventory.production.run.detail.result", Bn = /* @__PURE__ */ K({
471
- __name: "ProductionRunResultTable",
472
- props: {
473
- run: {},
474
- names: {}
475
- },
476
- setup(L) {
477
- const c = L, { t } = Y(), _ = $(() => {
478
- const x = Ee(c.run), a = De(c.run);
479
- return Object.keys(x).map((h) => {
480
- var o, d, b;
481
- const I = x[h] ?? 0, i = a[h] ?? 0, r = i - I, k = I > 0 ? Math.round(i / I * 1e8) / 1e6 : null;
482
- return {
483
- skuId: h,
484
- name: ((o = c.names[h]) == null ? void 0 : o.name) ?? h,
485
- unit: ((d = c.names[h]) == null ? void 0 : d.unit) ?? null,
486
- precision: ((b = c.names[h]) == null ? void 0 : b.precision) ?? null,
487
- target: I,
488
- produced: i,
489
- variance: r,
490
- rate: k,
491
- reached: i >= I
492
- };
493
- });
494
- }), l = $(() => _.value.filter((x) => x.reached).length);
495
- function u(x) {
496
- return x === null ? "—" : `${E(x)}%`;
497
- }
498
- function w(x, a, h) {
499
- if (x === 0) return E(0, a, { precision: h });
500
- const I = E(Math.abs(x), a, { precision: h });
501
- return x > 0 ? `+${I}` : `−${I}`;
502
- }
503
- function f(x, a) {
504
- if (x === 0) return t(`${ee}.atTarget`);
505
- if (a <= 0) return x > 0 ? t(`${ee}.aboveTarget`) : t(`${ee}.belowTarget`);
506
- const h = E(Math.abs(x / a) * 100);
507
- return t(`${ee}.${x > 0 ? "above" : "below"}`, { percent: h });
508
- }
509
- return (x, a) => (s(), m("section", fn, [
510
- n("header", hn, [
511
- n("h2", gn, p(e(t)(`${ee}.title`)), 1),
512
- n("span", _n, p(e(t)(`${ee}.targetsReached`, { reached: l.value, total: _.value.length })), 1)
513
- ]),
514
- n("div", {
515
- class: "overflow-x-auto focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-fm-color-border-focused",
516
- role: "region",
517
- "aria-label": e(t)(`${ee}.ledger`),
518
- tabindex: "0"
519
- }, [
520
- n("table", {
521
- "aria-label": e(t)(`${ee}.title`),
522
- class: "min-w-[24rem] w-full table-fixed"
523
- }, [
524
- a[0] || (a[0] = n("colgroup", null, [
525
- n("col"),
526
- n("col", { class: "w-96" }),
527
- n("col", { class: "w-112" })
528
- ], -1)),
529
- n("thead", xn, [
530
- n("tr", wn, [
531
- n("th", In, p(e(t)(`${ee}.item`)), 1),
532
- n("th", Rn, p(e(t)(`${ee}.yield`)), 1),
533
- n("th", Sn, p(e(t)(`${ee}.variance`)), 1)
534
- ])
535
- ]),
536
- n("tbody", null, [
537
- (s(!0), m(H, null, oe(_.value, (h) => (s(), m("tr", {
538
- key: h.skuId,
539
- class: "border-b border-fm-color-neutral-gray-200 fm-typo-en-body-md-400 last:border-b-0"
540
- }, [
541
- n("td", An, [
542
- n("strong", {
543
- class: "block break-words fm-typo-en-body-md-600",
544
- title: h.name
545
- }, p(h.name), 9, Ln)
546
- ]),
547
- n("td", Pn, [
548
- n("span", qn, p(e(E)(h.produced, h.unit, { precision: h.precision })), 1),
549
- n("span", {
550
- "data-testid": "closed-item-rate",
551
- class: U([
552
- "block fm-typo-en-body-sm-400",
553
- h.rate !== null && h.rate !== 100 ? "text-fm-color-typo-warning" : "text-fm-color-typo-secondary"
554
- ])
555
- }, p(u(h.rate)), 3)
556
- ]),
557
- n("td", Tn, [
558
- n("strong", {
559
- class: U(["block fm-typo-en-body-md-600", h.variance === 0 ? "" : "text-fm-color-typo-warning"])
560
- }, p(w(h.variance, h.unit, h.precision)), 3),
561
- n("span", {
562
- class: U([
563
- "block fm-typo-en-body-sm-400",
564
- h.variance === 0 ? "text-fm-color-typo-secondary" : "text-fm-color-typo-warning"
565
- ])
566
- }, p(f(h.variance, h.target)), 3)
567
- ])
568
- ]))), 128))
569
- ])
570
- ], 8, $n)
571
- ], 8, kn)
572
- ]));
573
- }
574
- }), Cn = ["id", "aria-label"], Nn = { class: "flex min-w-[680px] flex-col gap-8" }, On = {
575
- "data-testid": "batch-wastage-headings",
576
- role: "row",
577
- class: "production-run-batch-wastage-headings grid min-h-40 grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1.2fr)] items-center gap-12 border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100 px-12 py-8 fm-typo-en-body-sm-600 text-fm-color-typo-secondary"
578
- }, Fn = { role: "columnheader" }, jn = {
579
- role: "columnheader",
580
- class: "text-center"
581
- }, En = { role: "columnheader" }, Dn = { role: "columnheader" }, Mn = {
582
- role: "rowgroup",
583
- class: "flex flex-col gap-8"
584
- }, Vn = {
585
- role: "cell",
586
- class: "min-w-0"
587
- }, Un = ["title"], Hn = {
588
- role: "cell",
589
- class: "min-w-0"
590
- }, zn = {
591
- "data-testid": "batch-wastage-quantity",
592
- class: "production-run-batch-wastage-quantity block whitespace-nowrap text-center tabular-nums"
593
- }, Wn = {
594
- role: "cell",
595
- class: "min-w-0"
596
- }, Gn = {
597
- "data-testid": "batch-wastage-reason",
598
- class: "break-words text-fm-color-typo-primary"
599
- }, Kn = {
600
- role: "cell",
601
- class: "min-w-0"
602
- }, Qn = {
603
- "data-testid": "batch-wastage-remark",
604
- class: "whitespace-pre-wrap break-words text-fm-color-typo-primary"
605
- }, ge = /* @__PURE__ */ K({
606
- __name: "ProductionRunBatchWastageDetails",
607
- props: {
608
- id: {},
609
- label: {},
610
- lines: {},
611
- names: {}
612
- },
613
- setup(L) {
614
- const { t: c } = Y();
615
- function t(_) {
616
- const l = lt(_);
617
- return l ? c(l) : le;
618
- }
619
- return (_, l) => (s(), m("div", {
620
- id: _.id,
621
- tabindex: "0",
622
- role: "table",
623
- "aria-label": _.label,
624
- class: "overflow-x-auto overscroll-x-contain pb-12"
625
- }, [
626
- n("div", Nn, [
627
- n("div", On, [
628
- n("span", Fn, p(e(c)("inventory.production.run.detail.batch.ingredient")), 1),
629
- n("span", jn, p(e(c)("inventory.production.run.detail.batch.quantityLost")), 1),
630
- n("span", En, p(e(c)("inventory.production.run.detail.batch.reason")), 1),
631
- n("span", Dn, p(e(c)("inventory.production.run.detail.batch.remark")), 1)
632
- ]),
633
- n("div", Mn, [
634
- (s(!0), m(H, null, oe(_.lines, (u, w) => {
635
- var f, x, a, h, I;
636
- return s(), m("div", {
637
- key: `${u.skuId}-${w}`,
638
- "data-testid": "batch-wastage-line",
639
- role: "row",
640
- class: "production-run-batch-wastage-row grid grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1.2fr)] items-start gap-12 fm-corner-radius-md bg-fm-color-surface-secondary p-12 fm-typo-en-body-sm-400"
641
- }, [
642
- n("div", Vn, [
643
- n("span", {
644
- "data-testid": "batch-wastage-ingredient",
645
- class: "production-run-batch-wastage-ingredient block truncate",
646
- title: ((f = _.names[u.skuId]) == null ? void 0 : f.name) ?? u.skuId
647
- }, p(((x = _.names[u.skuId]) == null ? void 0 : x.name) ?? u.skuId), 9, Un)
648
- ]),
649
- n("div", Hn, [
650
- n("span", zn, p(e(E)(
651
- e(Ve)(u.amount, u.measurement),
652
- ((a = _.names[u.skuId]) == null ? void 0 : a.unit) ?? null,
653
- { precision: ((h = _.names[u.skuId]) == null ? void 0 : h.precision) ?? null }
654
- )), 1)
655
- ]),
656
- n("div", Wn, [
657
- n("span", Gn, p(t(u.reason)), 1)
658
- ]),
659
- n("div", Kn, [
660
- n("span", Qn, p(((I = u.remark) == null ? void 0 : I.trim()) || e(le)), 1)
661
- ])
662
- ]);
663
- }), 128))
664
- ])
665
- ])
666
- ], 8, Cn));
667
- }
668
- }), Zn = {
669
- key: 0,
670
- "data-testid": "batch-stock-pending",
671
- role: "status",
672
- class: "border-b border-fm-color-border-default bg-fm-color-surface-secondary px-16 py-8 fm-typo-en-body-sm-600 text-fm-color-typo-warning"
673
- }, Jn = {
674
- key: 1,
675
- class: "flex items-start justify-between gap-12 px-16 pt-12"
676
- }, Yn = { class: "min-w-0" }, Xn = {
677
- "data-testid": "batch-title",
678
- class: "fm-typo-en-body-md-600"
679
- }, eo = ["title"], to = {
680
- key: 2,
681
- class: "flex items-center gap-8 flex-wrap px-16 py-12 border-b border-fm-color-border-default"
682
- }, no = { class: "fm-typo-en-body-md-600" }, oo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ao = {
683
- key: 0,
684
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary bg-fm-color-surface-secondary px-8 py-2 fm-corner-radius-sm"
685
- }, ro = ["aria-label"], so = { class: "p-12 max-w-[320px] fm-typo-en-body-sm-400 text-fm-color-typo-primary" }, io = {
686
- key: 3,
687
- class: "overflow-x-auto px-16 pb-12"
688
- }, lo = {
689
- key: 0,
690
- "data-testid": "batch-note",
691
- class: "mt-12 whitespace-pre-wrap break-words fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
692
- }, uo = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" }, co = ["aria-label"], po = { class: "border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100" }, mo = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary" }, bo = { class: "px-12 py-8 text-left font-semibold" }, vo = { class: "px-12 py-8 text-center font-semibold" }, yo = { class: "px-12 py-8 align-top" }, fo = ["data-testid", "title"], ho = ["data-testid"], go = { key: 0 }, _o = {
693
- colspan: "2",
694
- class: "px-16"
695
- }, ko = { key: 0 }, $o = {
696
- colspan: "2",
697
- class: "border-t border-fm-color-neutral-gray-200 px-16 py-8 text-center"
698
- }, xo = {
699
- key: 4,
700
- class: "flex flex-col px-16"
701
- }, wo = { class: "flex items-start justify-between gap-12 py-12" }, Io = { class: "min-w-0 flex-1" }, Ro = ["data-testid", "title"], So = { class: "fm-typo-en-body-md-400 tabular-nums shrink-0" }, Ao = {
702
- key: 0,
703
- class: "border-t border-fm-color-border-default py-8 text-center"
704
- }, Lo = {
705
- key: 5,
706
- "data-testid": "batch-note",
707
- class: "px-16 py-10 border-t border-fm-color-border-default fm-typo-en-body-sm-400 text-fm-color-typo-secondary whitespace-pre-wrap break-words"
708
- }, Po = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-primary" }, qo = {
709
- key: 6,
710
- class: "flex items-center justify-between gap-12 px-16 py-8 border-t border-fm-color-border-default fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
711
- }, To = { key: 0 }, Re = /* @__PURE__ */ K({
712
- __name: "ProductionRunBatchCard",
713
- props: {
714
- batch: {},
715
- names: {},
716
- summary: {},
717
- total: {},
718
- presentation: { default: "overview" }
719
- },
720
- setup(L) {
721
- const c = L, { t } = Y(), _ = $(() => c.presentation === "output"), l = $(() => {
722
- var o;
723
- return ((o = c.batch.remark) == null ? void 0 : o.trim()) ?? "";
724
- }), u = j(/* @__PURE__ */ new Set()), w = $(() => {
725
- var D;
726
- const o = /* @__PURE__ */ new Map(), d = new Set(c.batch.items.map((v) => v.skuId)), b = c.batch.items.length === 1 ? (D = c.batch.items[0]) == null ? void 0 : D.skuId : void 0;
727
- for (const v of c.batch.wastages) {
728
- const y = v.itemSkuId ?? b, C = y && d.has(y) ? y : "unattributed";
729
- o.set(C, [...o.get(C) ?? [], v]);
730
- }
731
- const T = c.batch.items.flatMap((v) => {
732
- const S = o.get(v.skuId);
733
- return S != null && S.length ? [{ key: v.skuId, lines: S }] : [];
734
- }), O = o.get("unattributed");
735
- return O != null && O.length ? [...T, { key: "unattributed", lines: O }] : T;
736
- });
737
- ae(
738
- () => c.batch.id,
739
- () => {
740
- u.value = /* @__PURE__ */ new Set();
741
- }
742
- );
743
- function f(o) {
744
- return w.value.find((d) => d.key === o);
745
- }
746
- function x(o) {
747
- return `batch-${c.batch.id}-wastage-${o}`;
748
- }
749
- function a(o) {
750
- var d;
751
- return t("inventory.production.run.detail.batch.wastage", {
752
- count: ((d = f(o)) == null ? void 0 : d.lines.length) ?? 0
753
- });
754
- }
755
- function h(o) {
756
- var d;
757
- return `${a(o)}: ${((d = c.names[o]) == null ? void 0 : d.name) ?? o}`;
758
- }
759
- function I(o) {
760
- return u.value.has(o);
761
- }
762
- function i(o) {
763
- const d = new Set(u.value);
764
- d.has(o) ? d.delete(o) : d.add(o), u.value = d;
765
- }
766
- const r = $(() => {
767
- var b;
768
- if (!c.summary) return null;
769
- const o = (b = c.batch.items[0]) == null ? void 0 : b.skuId, d = o ? c.names[o] : void 0;
770
- return {
771
- ...c.summary,
772
- unit: (d == null ? void 0 : d.unit) ?? null,
773
- precision: (d == null ? void 0 : d.precision) ?? null,
774
- percent: c.summary.committed > 0 ? Math.round(c.summary.cumulative / c.summary.committed * 100) : null
775
- };
776
- }), k = $(
777
- () => c.batch.isBackdated ? t("inventory.production.run.detail.batch.hintBackdated", {
778
- name: c.batch.recordedBy,
779
- at: de(c.batch.recordedAt)
780
- }) : t("inventory.production.run.detail.batch.hint", {
781
- name: c.batch.recordedBy,
782
- at: de(c.batch.recordedAt)
783
- })
784
- );
785
- return (o, d) => {
786
- var O, D, v, S;
787
- const b = te("FmIcon"), T = te("FmPopover");
788
- return s(), m("article", {
789
- class: U([
790
- "border fm-corner-radius-md overflow-hidden bg-fm-color-surface-primary",
791
- _.value ? "border-fm-color-neutral-gray-200" : "border-fm-color-border-default"
792
- ])
793
- }, [
794
- o.batch.stockApplicationStatus === "PENDING" ? (s(), m("p", Zn, p(e(t)("inventory.production.run.detail.pendingStock.title")), 1)) : R("", !0),
795
- _.value ? (s(), m("header", Jn, [
796
- n("div", Yn, [
797
- n("h2", Xn, [
798
- me(o.$slots, "title", {}, () => [
799
- ie(p(e(t)("inventory.production.run.detail.batch.shortTitle", { index: o.batch.index })), 1)
800
- ])
801
- ]),
802
- n("p", {
803
- "data-testid": "batch-provenance",
804
- class: "mt-1 fm-typo-en-body-sm-400 text-fm-color-typo-secondary",
805
- title: o.batch.isBackdated ? k.value : void 0
806
- }, p(e(t)("inventory.production.run.detail.batch.provenance", {
807
- at: e(de)(o.batch.producedAt),
808
- name: o.batch.recordedBy
809
- })), 9, eo)
810
- ]),
811
- me(o.$slots, "nav")
812
- ])) : (s(), m("header", to, [
813
- n("span", no, p(e(t)("inventory.production.run.detail.batch.title", { index: o.batch.index, total: o.total })), 1),
814
- n("span", oo, p(e(de)(o.batch.producedAt)), 1),
815
- o.batch.isBackdated ? (s(), m("span", ao, p(e(t)("inventory.production.run.detail.batch.entered", {
816
- at: e(de)(o.batch.recordedAt)
817
- })), 1)) : R("", !0),
818
- P(T, { placement: "bottom-start" }, {
819
- "popover-button": ne(() => [
820
- n("button", {
821
- type: "button",
822
- class: "flex text-fm-color-typo-disabled hover:text-fm-color-typo-primary",
823
- "aria-label": e(t)("inventory.production.run.detail.moreDetail")
824
- }, [
825
- P(b, {
826
- name: "info",
827
- size: "sm",
828
- outline: ""
829
- })
830
- ], 8, ro)
831
- ]),
832
- default: ne(() => [
833
- n("p", so, p(k.value), 1)
834
- ]),
835
- _: 1
836
- }),
837
- d[2] || (d[2] = n("span", { class: "grow" }, null, -1)),
838
- me(o.$slots, "nav")
839
- ])),
840
- _.value ? (s(), m("div", io, [
841
- l.value ? (s(), m("p", lo, [
842
- n("span", uo, p(e(t)("inventory.production.run.detail.batch.batchNote")), 1),
843
- ie(" " + p(l.value), 1)
844
- ])) : R("", !0),
845
- n("table", {
846
- class: "mt-12 w-full table-fixed",
847
- "aria-label": e(t)("inventory.production.run.detail.batch.outputTableLabel", { index: o.batch.index })
848
- }, [
849
- d[3] || (d[3] = n("colgroup", null, [
850
- n("col"),
851
- n("col", { class: "w-[144px]" })
852
- ], -1)),
853
- n("thead", po, [
854
- n("tr", mo, [
855
- n("th", bo, p(e(t)("inventory.production.run.detail.items.item")), 1),
856
- n("th", vo, p(e(t)("inventory.production.run.detail.batch.yield")), 1)
857
- ])
858
- ]),
859
- (s(!0), m(H, null, oe(o.batch.items, (y) => {
860
- var C, N, X, z, F, Z;
861
- return s(), m("tbody", {
862
- key: y.skuId,
863
- class: "border-b border-fm-color-neutral-gray-200 last:border-b-0"
864
- }, [
865
- n("tr", null, [
866
- n("td", yo, [
867
- n("span", {
868
- "data-testid": `batch-output-name-${y.skuId}`,
869
- class: "block truncate fm-typo-en-body-md-400",
870
- title: ((C = o.names[y.skuId]) == null ? void 0 : C.name) ?? y.skuId
871
- }, p(((N = o.names[y.skuId]) == null ? void 0 : N.name) ?? y.skuId), 9, fo),
872
- f(y.skuId) ? (s(), B(he, {
873
- key: 0,
874
- "data-testid": `batch-wastage-toggle-${y.skuId}`,
875
- class: "mt-2",
876
- expanded: I(y.skuId),
877
- controls: x(y.skuId),
878
- label: a(y.skuId),
879
- "aria-label": h(y.skuId),
880
- onToggle: (pe) => i(y.skuId)
881
- }, null, 8, ["data-testid", "expanded", "controls", "label", "aria-label", "onToggle"])) : R("", !0)
882
- ]),
883
- n("td", {
884
- "data-testid": `batch-output-yield-${y.skuId}`,
885
- class: "whitespace-nowrap px-12 py-8 text-center align-top fm-typo-en-body-md-400 tabular-nums"
886
- }, [
887
- n("span", null, p(e(E)(y.amount, ((X = o.names[y.skuId]) == null ? void 0 : X.unit) ?? null, {
888
- precision: ((z = o.names[y.skuId]) == null ? void 0 : z.precision) ?? null
889
- })), 1)
890
- ], 8, ho)
891
- ]),
892
- f(y.skuId) && I(y.skuId) ? (s(), m("tr", go, [
893
- n("td", _o, [
894
- P(ge, {
895
- id: x(y.skuId),
896
- label: e(t)("inventory.production.run.detail.batch.wastageFor", {
897
- name: ((F = o.names[y.skuId]) == null ? void 0 : F.name) ?? y.skuId
898
- }),
899
- lines: ((Z = f(y.skuId)) == null ? void 0 : Z.lines) ?? [],
900
- names: o.names
901
- }, null, 8, ["id", "label", "lines", "names"])
902
- ])
903
- ])) : R("", !0)
904
- ]);
905
- }), 128)),
906
- f("unattributed") ? (s(), m("tbody", ko, [
907
- n("tr", null, [
908
- n("td", $o, [
909
- P(he, {
910
- "data-testid": "batch-wastage-toggle-unattributed",
911
- expanded: I("unattributed"),
912
- controls: x("unattributed"),
913
- label: e(t)("inventory.production.run.detail.batch.unattributedWastage", {
914
- count: ((O = f("unattributed")) == null ? void 0 : O.lines.length) ?? 0
915
- }),
916
- onToggle: d[0] || (d[0] = (y) => i("unattributed"))
917
- }, null, 8, ["expanded", "controls", "label"]),
918
- I("unattributed") ? (s(), B(ge, {
919
- key: 0,
920
- id: x("unattributed"),
921
- label: e(t)("inventory.production.run.detail.batch.unattributedWastageLabel"),
922
- lines: ((D = f("unattributed")) == null ? void 0 : D.lines) ?? [],
923
- names: o.names,
924
- class: "mt-8 text-left"
925
- }, null, 8, ["id", "label", "lines", "names"])) : R("", !0)
926
- ])
927
- ])
928
- ])) : R("", !0)
929
- ], 8, co)
930
- ])) : (s(), m("div", xo, [
931
- (s(!0), m(H, null, oe(o.batch.items, (y) => {
932
- var C, N, X, z, F, Z;
933
- return s(), m("div", {
934
- key: y.skuId,
935
- class: "border-b border-fm-color-border-default last:border-b-0"
936
- }, [
937
- n("div", wo, [
938
- n("div", Io, [
939
- n("span", {
940
- "data-testid": `batch-output-name-${y.skuId}`,
941
- class: "block break-words fm-typo-en-body-md-600 sm:truncate",
942
- title: ((C = o.names[y.skuId]) == null ? void 0 : C.name) ?? y.skuId
943
- }, p(((N = o.names[y.skuId]) == null ? void 0 : N.name) ?? y.skuId), 9, Ro),
944
- f(y.skuId) ? (s(), B(he, {
945
- key: 0,
946
- "data-testid": `batch-wastage-toggle-${y.skuId}`,
947
- class: "mt-2",
948
- expanded: I(y.skuId),
949
- controls: x(y.skuId),
950
- label: a(y.skuId),
951
- "aria-label": h(y.skuId),
952
- onToggle: (pe) => i(y.skuId)
953
- }, null, 8, ["data-testid", "expanded", "controls", "label", "aria-label", "onToggle"])) : R("", !0)
954
- ]),
955
- n("span", So, p(e(E)(y.amount, ((X = o.names[y.skuId]) == null ? void 0 : X.unit) ?? null, {
956
- precision: ((z = o.names[y.skuId]) == null ? void 0 : z.precision) ?? null
957
- })), 1)
958
- ]),
959
- f(y.skuId) && I(y.skuId) ? (s(), B(ge, {
960
- key: 0,
961
- id: x(y.skuId),
962
- label: e(t)("inventory.production.run.detail.batch.wastageFor", {
963
- name: ((F = o.names[y.skuId]) == null ? void 0 : F.name) ?? y.skuId
964
- }),
965
- lines: ((Z = f(y.skuId)) == null ? void 0 : Z.lines) ?? [],
966
- names: o.names
967
- }, null, 8, ["id", "label", "lines", "names"])) : R("", !0)
968
- ]);
969
- }), 128)),
970
- f("unattributed") ? (s(), m("div", Ao, [
971
- P(he, {
972
- "data-testid": "batch-wastage-toggle-unattributed",
973
- expanded: I("unattributed"),
974
- controls: x("unattributed"),
975
- label: e(t)("inventory.production.run.detail.batch.unattributedWastage", {
976
- count: ((v = f("unattributed")) == null ? void 0 : v.lines.length) ?? 0
977
- }),
978
- onToggle: d[1] || (d[1] = (y) => i("unattributed"))
979
- }, null, 8, ["expanded", "controls", "label"]),
980
- I("unattributed") ? (s(), B(ge, {
981
- key: 0,
982
- id: x("unattributed"),
983
- label: e(t)("inventory.production.run.detail.batch.unattributedWastageLabel"),
984
- lines: ((S = f("unattributed")) == null ? void 0 : S.lines) ?? [],
985
- names: o.names,
986
- class: "mt-8 text-left"
987
- }, null, 8, ["id", "label", "lines", "names"])) : R("", !0)
988
- ])) : R("", !0)
989
- ])),
990
- l.value && !_.value ? (s(), m("p", Lo, [
991
- n("span", Po, p(e(t)("inventory.production.run.detail.batch.batchNote")), 1),
992
- ie(" " + p(l.value), 1)
993
- ])) : R("", !0),
994
- r.value && !_.value ? (s(), m("footer", qo, [
995
- n("span", null, p(e(t)("inventory.production.run.detail.batch.ofCommitted", {
996
- amount: e(E)(r.value.amount, r.value.unit, {
997
- precision: r.value.precision
998
- }),
999
- committed: e(E)(r.value.committed, r.value.unit, {
1000
- precision: r.value.precision
1001
- })
1002
- })), 1),
1003
- r.value.percent !== null ? (s(), m("span", To, p(e(t)("inventory.production.run.detail.batch.cumulative", { percent: r.value.percent })), 1)) : R("", !0)
1004
- ])) : R("", !0)
1005
- ], 2);
1006
- };
1007
- }
1008
- }), Bo = { class: "flex flex-col gap-16" }, Co = {
1009
- key: 2,
1010
- "data-testid": "production-run-last-output",
1011
- class: "flex min-w-0 flex-col gap-8",
1012
- "aria-labelledby": "production-run-last-output-title"
1013
- }, No = { class: "flex items-center justify-between gap-12" }, Oo = {
1014
- id: "production-run-last-output-title",
1015
- class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary"
1016
- }, Fo = {
1017
- key: 3,
1018
- class: "production-run-review-layout grid grid-cols-1 gap-16 items-start"
1019
- }, jo = { class: "flex flex-col gap-16 min-w-0" }, Eo = { class: "flex items-center justify-between fm-typo-en-body-sm-500 uppercase tracking-wider text-fm-color-typo-secondary" }, Do = { class: "flex items-center gap-4" }, Mo = /* @__PURE__ */ K({
1020
- __name: "ProductionRunOverviewTab",
1021
- props: {
1022
- run: {},
1023
- names: {},
1024
- batches: {},
1025
- committed: {},
1026
- unit: {},
1027
- hasIssuance: { type: Boolean },
1028
- operational: { type: Boolean, default: !1 }
1029
- },
1030
- emits: ["view-all"],
1031
- setup(L, { emit: c }) {
1032
- const t = L, _ = c, { t: l } = Y(), u = j(null), w = $(() => {
1033
- if (!t.batches.length) return null;
1034
- const i = t.batches.length - 1, r = u.value === null || u.value >= t.batches.length ? i : u.value;
1035
- return { batch: t.batches[r], i: r };
1036
- }), f = $(() => {
1037
- const i = t.batches.length - 1;
1038
- return i >= 0 ? { batch: t.batches[i], i } : null;
1039
- }), x = $(() => {
1040
- const i = new Set(
1041
- t.run.preparation.issuances.flatMap((r) => r.items.map((k) => k.sku._id))
1042
- );
1043
- return i.size === 1 ? [...i][0] : null;
1044
- });
1045
- function a(i) {
1046
- const r = t.committed;
1047
- if (!i || x.value === null || r === null) return null;
1048
- const k = x.value;
1049
- if (t.batches.some((b) => b.items.some((T) => T.skuId !== k))) return null;
1050
- const o = i.batch.items.reduce((b, T) => b + T.amount, 0), d = t.batches.slice(0, i.i + 1).reduce(
1051
- (b, T) => b + T.items.reduce((O, D) => O + D.amount, 0),
1052
- 0
1053
- );
1054
- return { amount: o, cumulative: d, committed: r };
1055
- }
1056
- const h = $(() => a(w.value)), I = $(() => t.run.status === "CLOSED");
1057
- return (i, r) => {
1058
- const k = te("FmButton");
1059
- return s(), m("div", Bo, [
1060
- i.operational ? me(i.$slots, "operational", { key: 0 }, void 0, !0) : me(i.$slots, "planner", { key: 1 }, void 0, !0),
1061
- i.operational && i.run.status === "PREPARING" && f.value ? (s(), m("section", Co, [
1062
- n("header", No, [
1063
- n("h2", Oo, p(e(l)("inventory.production.run.detail.output.lastOutput")), 1),
1064
- P(k, {
1065
- variant: "secondary",
1066
- label: e(l)("inventory.production.run.detail.output.viewAllOutput"),
1067
- onClick: r[0] || (r[0] = (o) => _("view-all"))
1068
- }, null, 8, ["label"])
1069
- ]),
1070
- P(Re, {
1071
- batch: f.value.batch,
1072
- names: i.names,
1073
- summary: null,
1074
- total: i.batches.length,
1075
- presentation: "output"
1076
- }, {
1077
- title: ne(() => [
1078
- ie(p(e(l)("inventory.production.run.detail.batch.title", {
1079
- index: f.value.batch.index,
1080
- total: i.batches.length
1081
- })), 1)
1082
- ]),
1083
- _: 1
1084
- }, 8, ["batch", "names", "total"])
1085
- ])) : R("", !0),
1086
- !i.operational && i.hasIssuance ? (s(), m("div", Fo, [
1087
- n("div", jo, [
1088
- I.value ? (s(), B(Bn, {
1089
- key: 0,
1090
- run: i.run,
1091
- names: i.names
1092
- }, null, 8, ["run", "names"])) : (s(), m(H, { key: 1 }, [
1093
- P(Qe, {
1094
- run: i.run,
1095
- names: i.names
1096
- }, null, 8, ["run", "names"]),
1097
- w.value ? (s(), m(H, { key: 0 }, [
1098
- n("div", Eo, [
1099
- n("span", null, p(e(l)("inventory.production.run.detail.output.recorded")), 1),
1100
- n("span", null, p(e(l)("inventory.production.run.detail.output.count", { count: i.batches.length })), 1)
1101
- ]),
1102
- P(Re, {
1103
- batch: w.value.batch,
1104
- names: i.names,
1105
- summary: h.value,
1106
- total: i.batches.length
1107
- }, Ye({ _: 2 }, [
1108
- i.batches.length > 1 ? {
1109
- name: "nav",
1110
- fn: ne(() => [
1111
- n("div", Do, [
1112
- P(k, {
1113
- variant: "tertiary",
1114
- icon: "chevron_left",
1115
- disabled: w.value.i === 0,
1116
- "aria-label": e(l)("inventory.production.run.detail.output.previous"),
1117
- onClick: r[1] || (r[1] = (o) => u.value = w.value.i - 1)
1118
- }, null, 8, ["disabled", "aria-label"]),
1119
- P(k, {
1120
- variant: "tertiary",
1121
- icon: "chevron_right",
1122
- disabled: w.value.i === i.batches.length - 1,
1123
- "aria-label": e(l)("inventory.production.run.detail.output.next"),
1124
- onClick: r[2] || (r[2] = (o) => u.value = w.value.i + 1)
1125
- }, null, 8, ["disabled", "aria-label"]),
1126
- P(k, {
1127
- variant: "tertiary",
1128
- label: e(l)("inventory.production.run.detail.output.viewAll"),
1129
- onClick: r[3] || (r[3] = (o) => _("view-all"))
1130
- }, null, 8, ["label"])
1131
- ])
1132
- ]),
1133
- key: "0"
1134
- } : void 0
1135
- ]), 1032, ["batch", "names", "summary", "total"])
1136
- ], 64)) : R("", !0)
1137
- ], 64))
1138
- ]),
1139
- P(ut)
1140
- ])) : R("", !0)
1141
- ]);
1142
- };
1143
- }
1144
- }), Vo = /* @__PURE__ */ ce(Mo, [["__scopeId", "data-v-844d1a9b"]]), Uo = { class: "flex flex-col gap-16" }, Ho = {
1145
- key: 0,
1146
- class: "border border-dashed border-fm-color-border-default fm-corner-radius-md px-16 py-24 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1147
- }, zo = /* @__PURE__ */ K({
1148
- __name: "ProductionRunOutputTab",
1149
- props: {
1150
- batches: {},
1151
- names: {}
1152
- },
1153
- setup(L) {
1154
- const { t: c } = Y();
1155
- return (t, _) => (s(), m("div", Uo, [
1156
- t.batches.length ? (s(!0), m(H, { key: 1 }, oe(t.batches, (l) => (s(), B(Re, {
1157
- key: l.id,
1158
- batch: l,
1159
- names: t.names,
1160
- summary: null,
1161
- total: t.batches.length,
1162
- presentation: "output"
1163
- }, null, 8, ["batch", "names", "total"]))), 128)) : (s(), m("p", Ho, p(e(c)("inventory.production.run.detail.output.empty")), 1))
1164
- ]));
1165
- }
1166
- }), Wo = ["aria-label"], Go = {
1167
- key: 0,
1168
- role: "status",
1169
- class: "border border-dashed border-fm-color-border-default px-16 py-24 fm-corner-radius-md fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1170
- }, Ko = {
1171
- key: 1,
1172
- class: "border border-dashed border-fm-color-border-default px-16 py-24 fm-corner-radius-md fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1173
- }, Qo = {
1174
- key: 2,
1175
- class: "border border-dashed border-fm-color-border-default px-16 py-24 fm-corner-radius-md fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1176
- }, Zo = {
1177
- key: 3,
1178
- "data-testid": "ingredient-issue-card",
1179
- class: "overflow-hidden border border-fm-color-neutral-gray-200 bg-fm-color-surface-primary fm-corner-radius-md"
1180
- }, Jo = ["aria-label"], Yo = ["aria-label"], Xo = { class: "ingredient-ledger__head bg-fm-color-neutral-gray-100" }, ea = { class: "h-40 fm-typo-en-body-sm-600 text-fm-color-typo-secondary" }, ta = { class: "px-16 py-8 text-left" }, na = { class: "whitespace-nowrap px-8 py-8 text-center" }, oa = { class: "whitespace-nowrap px-8 py-8 text-center" }, aa = ["data-testid"], ra = { class: "ingredient-ledger__ingredient col-span-1 min-w-0 px-16 py-8 align-top" }, sa = ["data-testid"], ia = ["title"], la = ["data-testid"], ua = ["data-testid"], da = ["data-testid"], ca = {
1181
- key: 0,
1182
- class: "ingredient-ledger__contributors-row"
1183
- }, pa = {
1184
- colspan: "3",
1185
- class: "px-0 pb-0 pt-0"
1186
- }, ma = {
1187
- "data-testid": "issued-ingredient-contributors-width",
1188
- class: "max-w-full"
1189
- }, ba = {
1190
- "data-testid": "issued-ingredient-contributors-content",
1191
- class: "ingredient-ledger__contributors-content w-3/5"
1192
- }, G = "inventory.production.run.detail.ingredients", va = /* @__PURE__ */ K({
1193
- __name: "ProductionRunIngredientsTab",
1194
- props: {
1195
- runId: {},
1196
- loading: { type: Boolean },
1197
- snapshotAvailable: { type: Boolean },
1198
- lines: {},
1199
- ingredientContributions: {},
1200
- outputNames: {},
1201
- unattributedIngredients: {}
1202
- },
1203
- setup(L) {
1204
- const c = L, { t } = Y(), _ = j(/* @__PURE__ */ new Set()), l = $(() => {
1205
- var r, k, o;
1206
- const i = {};
1207
- for (const [d, b] of Object.entries(c.ingredientContributions ?? {}))
1208
- for (const T of b)
1209
- (i[r = T.skuId] ?? (i[r] = [])).push({
1210
- outputSkuId: d,
1211
- outputName: ((o = (k = c.outputNames) == null ? void 0 : k[d]) == null ? void 0 : o.name) ?? d,
1212
- issued: T.issued,
1213
- unit: T.unit
1214
- });
1215
- return i;
1216
- }), u = $(
1217
- () => new Set(
1218
- Object.entries(l.value).filter(([, i]) => i.length > 0).map(([i]) => i)
1219
- )
1220
- );
1221
- ae(
1222
- () => c.runId,
1223
- () => _.value = /* @__PURE__ */ new Set()
1224
- ), ae(
1225
- () => [...u.value].sort().join("|"),
1226
- () => {
1227
- _.value = new Set(
1228
- [..._.value].filter((i) => u.value.has(i))
1229
- );
1230
- }
1231
- );
1232
- function w(i) {
1233
- return l.value[i] ?? [];
1234
- }
1235
- function f(i) {
1236
- return `production-run-ingredient-contributors-${c.runId}-${i}`;
1237
- }
1238
- function x(i) {
1239
- const r = new Set(_.value);
1240
- r.has(i) ? r.delete(i) : r.add(i), _.value = r;
1241
- }
1242
- function a(i) {
1243
- const r = w(i).length;
1244
- return t(r === 1 ? `${G}.acrossItem` : `${G}.acrossItems`, { count: r });
1245
- }
1246
- function h(i) {
1247
- return w(i).map((r) => ({
1248
- key: r.outputSkuId,
1249
- label: r.outputName,
1250
- value: E(r.issued, r.unit)
1251
- }));
1252
- }
1253
- function I(i) {
1254
- if (i.stockBefore === null || i.stockAfter === null) return le;
1255
- const r = E(i.stockBefore, i.unit);
1256
- if (i.stockAfter >= 0) return `${r} → ${E(i.stockAfter, i.unit)}`;
1257
- const k = t("inventory.production.run.form.commits.shortBy", {
1258
- amount: `−${E(Math.abs(i.stockAfter), i.unit)}`
1259
- });
1260
- return `${r} → ${k}`;
1261
- }
1262
- return (i, r) => {
1263
- var k;
1264
- return s(), m("section", {
1265
- class: "flex flex-col gap-16",
1266
- "aria-label": e(t)(`${G}.title`)
1267
- }, [
1268
- i.loading ? (s(), m("p", Go, p(e(t)(`${G}.loading`)), 1)) : i.snapshotAvailable ? i.lines.length ? (s(), m("div", Zo, [
1269
- n("div", {
1270
- "data-testid": "ingredient-ledger-scroll",
1271
- class: "overflow-x-auto overscroll-x-contain",
1272
- role: "region",
1273
- tabindex: "0",
1274
- "aria-label": e(t)(`${G}.tableLabel`)
1275
- }, [
1276
- n("table", {
1277
- class: "ingredient-ledger w-full min-w-[44rem]",
1278
- "aria-label": e(t)(`${G}.tableLabel`)
1279
- }, [
1280
- r[0] || (r[0] = n("colgroup", { class: "ingredient-ledger__columns" }, [
1281
- n("col"),
1282
- n("col", { class: "w-36" }),
1283
- n("col", { class: "w-36" })
1284
- ], -1)),
1285
- n("thead", Xo, [
1286
- n("tr", ea, [
1287
- n("th", ta, p(e(t)(`${G}.ingredient`)), 1),
1288
- n("th", na, p(e(t)(`${G}.requestedQty`)), 1),
1289
- n("th", oa, p(e(t)(`${G}.committedQty`)), 1)
1290
- ])
1291
- ]),
1292
- (s(!0), m(H, null, oe(i.lines, (o) => (s(), m("tbody", {
1293
- key: o.skuId,
1294
- class: "ingredient-ledger__body"
1295
- }, [
1296
- n("tr", {
1297
- "data-testid": `ingredient-row-${o.skuId}`,
1298
- class: "ingredient-ledger__row border-t border-fm-color-neutral-gray-200"
1299
- }, [
1300
- n("td", ra, [
1301
- n("div", {
1302
- "data-testid": `issued-ingredient-identity-${o.skuId}`,
1303
- class: "flex min-w-0 flex-col items-start gap-0"
1304
- }, [
1305
- n("strong", {
1306
- class: "ingredient-ledger__identity-name block max-w-full truncate fm-typo-en-body-md-600",
1307
- title: o.name
1308
- }, p(o.name), 9, ia),
1309
- o.stockAfter !== null && o.stockAfter < 0 ? (s(), B(dt, {
1310
- key: 0,
1311
- class: "ingredient-ledger__identity-stock",
1312
- testid: `ingredient-stock-${o.skuId}`,
1313
- "help-testid": `ingredient-stock-help-${o.skuId}`,
1314
- type: "hint",
1315
- "icon-placement": "trailing",
1316
- variant: "danger",
1317
- size: "sm",
1318
- text: `${e(t)(`${G}.stock`)} ${I(o)}`,
1319
- "accessible-label": e(t)("inventory.production.run.detail.ingredients.negativeStockHelp"),
1320
- tooltip: e(t)("inventory.production.run.detail.ingredients.negativeStockHelp")
1321
- }, null, 8, ["testid", "help-testid", "text", "accessible-label", "tooltip"])) : (s(), m("p", {
1322
- key: 1,
1323
- "data-testid": `ingredient-stock-${o.skuId}`,
1324
- class: "ingredient-ledger__identity-stock fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1325
- }, p(e(t)(`${G}.stock`)) + " " + p(I(o)), 9, la)),
1326
- u.value.has(o.skuId) ? (s(), B(ct, {
1327
- key: 2,
1328
- class: "ingredient-ledger__disclosure mt-[2px] w-fit",
1329
- testid: `ingredient-contributor-disclosure-${o.skuId}`,
1330
- controls: f(o.skuId),
1331
- expanded: _.value.has(o.skuId),
1332
- label: a(o.skuId),
1333
- onToggle: (d) => x(o.skuId)
1334
- }, null, 8, ["testid", "controls", "expanded", "label", "onToggle"])) : R("", !0)
1335
- ], 8, sa)
1336
- ]),
1337
- n("td", {
1338
- "data-testid": `ingredient-requested-${o.skuId}`,
1339
- class: U([
1340
- "ingredient-ledger__value ingredient-ledger__requested px-8 py-8 text-center align-middle fm-typo-en-body-md-400 tabular-nums",
1341
- o.requested === null ? "text-fm-color-typo-secondary" : "text-fm-color-typo-primary"
1342
- ])
1343
- }, p(o.requested === null ? e(le) : e(E)(o.requested, o.unit)), 11, ua),
1344
- n("td", {
1345
- "data-testid": `ingredient-committed-${o.skuId}`,
1346
- class: "ingredient-ledger__value ingredient-ledger__committed px-8 py-8 text-center align-middle fm-typo-en-body-md-400 text-fm-color-typo-primary tabular-nums"
1347
- }, p(e(E)(o.issued, o.unit)), 9, da)
1348
- ], 8, aa),
1349
- u.value.has(o.skuId) && _.value.has(o.skuId) ? (s(), m("tr", ca, [
1350
- n("td", pa, [
1351
- n("div", ma, [
1352
- n("div", ba, [
1353
- P(pt, {
1354
- id: f(o.skuId),
1355
- role: "list",
1356
- "aria-label": e(t)(`${G}.contributorsFor`, { name: o.name }),
1357
- entries: h(o.skuId),
1358
- class: "ml-[22px] mr-[8px]"
1359
- }, null, 8, ["id", "aria-label", "entries"])
1360
- ])
1361
- ])
1362
- ])
1363
- ])) : R("", !0)
1364
- ]))), 128))
1365
- ], 8, Yo)
1366
- ], 8, Jo)
1367
- ])) : (s(), m("p", Qo, p(e(t)(`${G}.noBindings`)), 1)) : (s(), m("p", Ko, p(e(t)(`${G}.snapshotUnavailable`)), 1)),
1368
- (k = i.unattributedIngredients) != null && k.length ? (s(), B(re, {
1369
- key: 4,
1370
- "data-testid": "unattributed-issued-ingredients",
1371
- tone: "warn",
1372
- title: e(t)("inventory.production.run.detail.items.unattributedTitle"),
1373
- message: e(t)("inventory.production.run.detail.items.unattributedMessage")
1374
- }, null, 8, ["title", "message"])) : R("", !0)
1375
- ], 8, Wo);
1376
- };
1377
- }
1378
- }), ya = /* @__PURE__ */ ce(va, [["__scopeId", "data-v-2a6f6173"]]), fa = { "aria-labelledby": "activity-title" }, ha = { class: "flex items-center gap-8" }, ga = {
1379
- id: "activity-title",
1380
- class: "text-[18px] font-semibold leading-[28px]"
1381
- }, _a = {
1382
- key: 0,
1383
- class: "mt-[20px] space-y-16"
1384
- }, ka = {
1385
- class: "mt-[2px] grid size-24 place-items-center rounded-full bg-fm-color-system-success-100 text-fm-color-system-success-400",
1386
- "aria-hidden": "true"
1387
- }, $a = { class: "min-w-0" }, xa = {
1388
- "data-testid": "activity-title",
1389
- class: "text-[14px] font-medium leading-[18px] text-fm-color-typo-primary"
1390
- }, wa = {
1391
- key: 0,
1392
- "data-testid": "activity-description",
1393
- class: "mt-4 text-[14px] font-normal leading-[20px] text-fm-color-typo-secondary"
1394
- }, Ia = {
1395
- "data-testid": "activity-meta",
1396
- class: "mt-4 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1397
- }, Ra = {
1398
- key: 1,
1399
- class: "mt-[20px] fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1400
- }, Sa = /* @__PURE__ */ K({
1401
- __name: "ProductionRunActivityTab",
1402
- props: {
1403
- run: {}
1404
- },
1405
- setup(L) {
1406
- const c = L, { t } = Y(), _ = $(
1407
- () => [...c.run.activityLogs].reverse().map((l, u) => {
1408
- var w;
1409
- return {
1410
- key: `${l.action}-${l.performedAt}-${u}`,
1411
- label: l.action === "close" && Ge(c.run) === "below-target" ? t("inventory.production.run.list.activity.closeBelowTarget") : t(`inventory.production.run.list.activity.${l.action}`),
1412
- description: l.remark,
1413
- meta: [de(l.performedAt), (w = l.performedBy) == null ? void 0 : w.name].filter(Boolean).join(" · ")
1414
- };
1415
- })
1416
- );
1417
- return (l, u) => {
1418
- const w = te("FmIcon");
1419
- return s(), m("section", fa, [
1420
- n("header", ha, [
1421
- P(w, {
1422
- name: "history",
1423
- size: "sm",
1424
- "aria-hidden": "true",
1425
- class: "production-run-activity-history"
1426
- }),
1427
- n("h2", ga, p(e(t)("inventory.production.run.detail.tab.activity")), 1)
1428
- ]),
1429
- _.value.length ? (s(), m("ol", _a, [
1430
- (s(!0), m(H, null, oe(_.value, (f) => (s(), m("li", {
1431
- key: f.key,
1432
- class: "grid grid-cols-[24px_1fr] gap-12"
1433
- }, [
1434
- n("span", ka, [
1435
- P(w, {
1436
- name: "check_circle",
1437
- size: "sm",
1438
- class: "production-run-activity-check"
1439
- })
1440
- ]),
1441
- n("div", $a, [
1442
- n("div", xa, p(f.label), 1),
1443
- f.description ? (s(), m("p", wa, p(f.description), 1)) : R("", !0),
1444
- n("p", Ia, p(f.meta), 1)
1445
- ])
1446
- ]))), 128))
1447
- ])) : (s(), m("p", Ra, p(e(t)("inventory.production.run.list.activity.none")), 1))
1448
- ]);
1449
- };
1450
- }
1451
- }), Aa = /* @__PURE__ */ ce(Sa, [["__scopeId", "data-v-ea0bca54"]]), La = { class: "production-run-requested-layout grid grid-cols-1 items-start gap-16" }, Pa = {
1452
- "data-testid": "production-run-requested-left",
1453
- class: "flex min-w-0 flex-col gap-16"
1454
- }, qa = {
1455
- "data-stage-card": "items",
1456
- class: "overflow-hidden border border-fm-color-neutral-gray-200 bg-fm-color-surface-primary fm-corner-radius-md"
1457
- }, Ta = { class: "flex min-h-[60px] items-center border-b border-fm-color-neutral-gray-200 px-16 py-12" }, Ba = { class: "inline-flex items-center gap-4 fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Ca = { "data-output-count": "" }, Na = { class: "grid grid-cols-[minmax(0,1fr)_auto] gap-x-12 px-16 py-12" }, Oa = { class: "fm-typo-en-body-md-600 truncate text-fm-color-typo-primary" }, Fa = {
1458
- "data-requested-quantity": "",
1459
- class: "fm-typo-en-body-md-600 justify-self-end text-right tabular-nums text-fm-color-typo-primary"
1460
- }, ja = {
1461
- key: 0,
1462
- "data-output-stock": "",
1463
- "data-output-stock-transition": "",
1464
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1465
- }, Ea = /* @__PURE__ */ K({
1466
- __name: "ProductionRunRequestedOverview",
1467
- props: {
1468
- run: {},
1469
- items: {},
1470
- ingredients: {},
1471
- refreshable: { type: Boolean, default: !1 },
1472
- refreshing: { type: Boolean, default: !1 },
1473
- showStockProjection: { type: Boolean, default: !0 }
1474
- },
1475
- emits: ["refresh"],
1476
- setup(L, { emit: c }) {
1477
- const t = L, _ = c, { t: l } = Y(), u = $(() => new Map(t.items.map((r) => [r.skuId, r]))), w = $(() => {
1478
- var r;
1479
- return new Set(((r = t.run.plan.requirements) == null ? void 0 : r.skippedSkuIds) ?? []);
1480
- }), f = $(() => mt(t.run.plan)), x = j(/* @__PURE__ */ new Set());
1481
- ae(
1482
- () => t.run._id,
1483
- () => x.value = /* @__PURE__ */ new Set()
1484
- );
1485
- function a(r) {
1486
- return `requested-item-ingredients-${t.run._id}-${r}`.replace(/[^a-zA-Z0-9_-]/g, "-");
1487
- }
1488
- function h(r) {
1489
- const k = new Set(x.value);
1490
- k.has(r) ? k.delete(r) : k.add(r), x.value = k;
1491
- }
1492
- const I = $(
1493
- () => [...w.value].map((r) => {
1494
- var k;
1495
- return ((k = u.value.get(r)) == null ? void 0 : k.name) ?? r;
1496
- })
1497
- ), i = $(
1498
- () => t.run.plan.items.map((r) => {
1499
- const k = u.value.get(r.skuId), o = bt(r.measurement) ? r.measurement : null;
1500
- return {
1501
- skuId: r.skuId,
1502
- name: (k == null ? void 0 : k.name) ?? r.skuId,
1503
- stock: (k == null ? void 0 : k.onHand) != null && o && k.sku && k.baseQuantity != null && k.baseUnit ? `${l("inventory.production.run.form.items.columns.inStock")} ${E(
1504
- k.onHand,
1505
- null,
1506
- {
1507
- precision: Ne(k.sku)
1508
- }
1509
- )} → ${E(k.onHand + k.baseQuantity, k.baseUnit, {
1510
- precision: Ne(k.sku)
1511
- })}` : le,
1512
- // Read-only history renders its own structurally valid frozen snapshot.
1513
- // Catalogue compatibility is checked only before a new write.
1514
- requested: o ? E(r.requestedAmount, o.abbrev, {
1515
- precision: r.requestedAmount.precision
1516
- }) : le,
1517
- ingredientBreakdown: f.value.get(r.skuId) ?? null,
1518
- hasNoBindings: w.value.has(r.skuId)
1519
- };
1520
- })
1521
- );
1522
- return (r, k) => {
1523
- var o;
1524
- return s(), m("div", La, [
1525
- n("div", Pa, [
1526
- P(vt, {
1527
- instructions: r.run.instructions
1528
- }, null, 8, ["instructions"]),
1529
- P(yt, {
1530
- "data-stage-card": "ingredients",
1531
- mode: "requested",
1532
- rows: r.ingredients,
1533
- "no-items": !((o = r.run.plan.requirements) != null && o.ingredients.length),
1534
- "unbound-names": I.value,
1535
- refreshable: r.refreshable && r.showStockProjection,
1536
- refreshing: r.refreshing,
1537
- "show-stock-projection": r.showStockProjection,
1538
- onRefresh: k[0] || (k[0] = (d) => _("refresh"))
1539
- }, null, 8, ["rows", "no-items", "unbound-names", "refreshable", "refreshing", "show-stock-projection"])
1540
- ]),
1541
- n("section", qa, [
1542
- n("header", Ta, [
1543
- n("h2", Ba, [
1544
- ie(p(e(l)("inventory.production.run.form.items.title")) + " ", 1),
1545
- n("span", Ca, "(" + p(i.value.length) + ")", 1),
1546
- P(ze, {
1547
- "description-id": "requested-quantity-help",
1548
- testid: "requested-quantity-help-trigger",
1549
- "trigger-label": e(l)("inventory.production.run.detail.requested.quantityHelpLabel"),
1550
- description: e(l)("inventory.production.run.detail.requested.quantityHelp")
1551
- }, null, 8, ["trigger-label", "description"])
1552
- ])
1553
- ]),
1554
- (s(!0), m(H, null, oe(i.value, (d) => {
1555
- var b, T;
1556
- return s(), m("div", {
1557
- key: d.skuId,
1558
- class: "border-b border-fm-color-neutral-gray-200 last:border-b-0"
1559
- }, [
1560
- n("div", Na, [
1561
- n("span", Oa, p(d.name), 1),
1562
- n("span", Fa, p(d.requested), 1),
1563
- r.showStockProjection ? (s(), m("span", ja, p(d.stock), 1)) : R("", !0),
1564
- n("span", {
1565
- "data-requested-label": "",
1566
- class: U(["fm-typo-en-body-sm-400 text-right text-fm-color-typo-secondary", r.showStockProjection ? "" : "col-start-2"])
1567
- }, p(e(l)("inventory.production.run.detail.items.requested")), 3),
1568
- d.hasNoBindings ? (s(), B(He, {
1569
- key: 1,
1570
- class: "col-span-2 mt-4",
1571
- "item-name": d.name
1572
- }, null, 8, ["item-name"])) : (b = d.ingredientBreakdown) != null && b.lines.length ? (s(), B(Ue, {
1573
- key: 2,
1574
- class: "col-span-2 mt-4",
1575
- testid: "requested-item-ingredients-toggle",
1576
- count: d.ingredientBreakdown.lines.length,
1577
- controls: a(d.skuId),
1578
- expanded: x.value.has(d.skuId),
1579
- onToggle: (O) => h(d.skuId)
1580
- }, null, 8, ["count", "controls", "expanded", "onToggle"])) : R("", !0)
1581
- ]),
1582
- x.value.has(d.skuId) && ((T = d.ingredientBreakdown) != null && T.lines.length) ? (s(), B(We, {
1583
- key: 0,
1584
- id: a(d.skuId),
1585
- testid: "requested-item-ingredients-list",
1586
- class: "px-16 pb-12",
1587
- count: d.ingredientBreakdown.lines.length,
1588
- unit: d.ingredientBreakdown.basisUnit,
1589
- lines: d.ingredientBreakdown.lines,
1590
- "item-name": d.name
1591
- }, null, 8, ["id", "count", "unit", "lines", "item-name"])) : R("", !0)
1592
- ]);
1593
- }), 128))
1594
- ])
1595
- ]);
1596
- };
1597
- }
1598
- }), Da = /* @__PURE__ */ ce(Ea, [["__scopeId", "data-v-ff35cbd5"]]), Ma = ["aria-label"], Va = { class: "flex min-w-max items-center gap-8" }, Ua = ["id", "aria-selected", "aria-controls", "tabindex", "onClick", "onKeydown"], Ha = /* @__PURE__ */ K({
1599
- __name: "ProductionRunDetailTabs",
1600
- props: {
1601
- items: {},
1602
- modelValue: {},
1603
- ariaLabel: {}
1604
- },
1605
- emits: ["update:modelValue"],
1606
- setup(L, { emit: c }) {
1607
- const t = L, _ = c, l = j([]);
1608
- function u(f, x = !1) {
1609
- const a = t.items[f];
1610
- a && (_("update:modelValue", a.value), x && Ie(() => {
1611
- var h;
1612
- return (h = l.value[f]) == null ? void 0 : h.focus();
1613
- }));
1614
- }
1615
- function w(f, x) {
1616
- let a = null;
1617
- f.key === "ArrowRight" && (a = (x + 1) % t.items.length), f.key === "ArrowLeft" && (a = (x - 1 + t.items.length) % t.items.length), f.key === "Home" && (a = 0), f.key === "End" && (a = t.items.length - 1), a !== null && (f.preventDefault(), u(a, !0));
1618
- }
1619
- return ae(
1620
- () => t.modelValue,
1621
- async (f) => {
1622
- var a, h;
1623
- await Ie();
1624
- const x = t.items.findIndex((I) => I.value === f);
1625
- (h = (a = l.value[x]) == null ? void 0 : a.scrollIntoView) == null || h.call(a, { block: "nearest", inline: "nearest" });
1626
- },
1627
- { immediate: !0 }
1628
- ), (f, x) => (s(), m("nav", {
1629
- role: "tablist",
1630
- "aria-label": f.ariaLabel,
1631
- class: "overflow-x-auto print:hidden"
1632
- }, [
1633
- n("div", Va, [
1634
- (s(!0), m(H, null, oe(f.items, (a, h) => (s(), m("button", {
1635
- id: a.id,
1636
- key: a.value,
1637
- ref_for: !0,
1638
- ref: (I) => l.value[h] = I,
1639
- type: "button",
1640
- role: "tab",
1641
- "aria-selected": f.modelValue === a.value,
1642
- "aria-controls": a.controls,
1643
- tabindex: f.modelValue === a.value ? 0 : -1,
1644
- class: U(["flex h-40 shrink-0 items-center gap-[6px] border-b-2 px-12 text-[14px] leading-[18px] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-fm-color-border-focused", [
1645
- f.modelValue === a.value ? "border-fm-color-primary font-semibold text-fm-color-primary" : "border-transparent font-normal text-fm-color-typo-secondary hover:text-fm-color-typo-primary"
1646
- ]]),
1647
- onClick: (I) => u(h),
1648
- onKeydown: (I) => w(I, h)
1649
- }, [
1650
- n("span", null, p(a.label), 1)
1651
- ], 42, Ua))), 128))
1652
- ])
1653
- ], 8, Ma));
1654
- }
1655
- }), za = {
1656
- key: 0,
1657
- "data-testid": "production-run-close-remark"
1658
- }, Wa = /* @__PURE__ */ K({
1659
- __name: "ProductionRunTerminalNotice",
1660
- props: {
1661
- run: {}
1662
- },
1663
- setup(L) {
1664
- const c = L, { t } = Y(), _ = $(() => ft(c.run)), l = $(
1665
- () => {
1666
- var u, w;
1667
- return ((w = (u = [...c.run.activityLogs].reverse().find((f) => f.action === "close")) == null ? void 0 : u.remark) == null ? void 0 : w.trim()) || null;
1668
- }
1669
- );
1670
- return (u, w) => _.value === "above-target" ? (s(), B(re, {
1671
- key: 0,
1672
- "data-testid": "closed-run-notice",
1673
- role: "note",
1674
- tone: "warn",
1675
- title: e(t)("inventory.production.run.detail.banner.closedAbove.title")
1676
- }, null, 8, ["title"])) : _.value === "below-target" ? (s(), B(re, {
1677
- key: 1,
1678
- "data-testid": "closed-run-notice",
1679
- role: "note",
1680
- tone: "warn",
1681
- title: e(t)("inventory.production.run.detail.banner.closed.title")
1682
- }, {
1683
- default: ne(() => [
1684
- l.value ? (s(), m("p", za, p(l.value), 1)) : R("", !0)
1685
- ]),
1686
- _: 1
1687
- }, 8, ["title"])) : u.run.status === "CANCEL" ? (s(), B(re, {
1688
- key: 2,
1689
- "data-testid": "cancelled-run-notice",
1690
- role: "note",
1691
- tone: "critical",
1692
- title: e(t)("inventory.production.run.detail.banner.cancelled.title"),
1693
- message: u.run.cancelReason || void 0
1694
- }, null, 8, ["title", "message"])) : R("", !0);
1695
- }
1696
- }), je = {
1697
- failed: 4,
1698
- unavailable: 3,
1699
- unknown: 2,
1700
- dispatched: 1
1701
- };
1702
- function Ga(L) {
1703
- switch (L.stockRecalculationDispatch) {
1704
- case "failed":
1705
- return "failed";
1706
- case "dispatched":
1707
- return "dispatched";
1708
- case "unavailable":
1709
- return "unavailable";
1710
- case "not-required":
1711
- return null;
1712
- default:
1713
- return L.stockRecalculationRequired ? "unknown" : null;
1714
- }
1715
- }
1716
- function Ka(L, { leaveOnLocationChange: c = !0 } = {}) {
1717
- const t = Ke(), _ = Ae(), l = Se(), u = j(null), w = j("waitingForLocation"), f = j(null), x = j("overview"), a = j(null), h = $(() => a.value !== null);
1718
- let I = null, i = 0, r = null;
1719
- async function k() {
1720
- const A = ++i;
1721
- r = null;
1722
- const M = _._currentLocation;
1723
- if (!M) {
1724
- w.value = "waitingForLocation";
1725
- return;
1726
- }
1727
- if (I && I !== M.dbName) {
1728
- u.value = null, c ? (I = null, await l.replace(Pe())) : w.value = "loading";
1729
- return;
1730
- }
1731
- const W = fe(L);
1732
- if (!W) {
1733
- w.value = "error";
1734
- return;
1735
- }
1736
- w.value = "loading", f.value = null, r = { dbName: M.dbName, id: W };
1737
- try {
1738
- const se = await t.read(W);
1739
- if (A !== i) return;
1740
- r = null, u.value = se, I = M.dbName, w.value = "ready";
1741
- } catch (se) {
1742
- if (A !== i) return;
1743
- r = null;
1744
- const ye = be(se);
1745
- w.value = ye.kind === "notFound" ? "notInLocation" : "error", f.value = ye.message, u.value = null;
1746
- }
1747
- }
1748
- async function o() {
1749
- const A = fe(L);
1750
- if (!A || !_._currentLocation) return;
1751
- const M = ++i;
1752
- r = null;
1753
- try {
1754
- const W = await t.read(A);
1755
- if (M !== i) return;
1756
- u.value = W, w.value = "ready";
1757
- } catch (W) {
1758
- if (M !== i) return;
1759
- const se = be(W);
1760
- w.value = se.kind === "notFound" ? "notInLocation" : "error", f.value = se.message;
1761
- }
1762
- }
1763
- async function d() {
1764
- var M;
1765
- const A = (M = _._currentLocation) == null ? void 0 : M.dbName;
1766
- A && A === I && w.value !== "waitingForLocation" || A && w.value === "loading" && (r == null ? void 0 : r.dbName) === A && r.id === fe(L) || await k();
1767
- }
1768
- _.watchLocation(d), ae(
1769
- () => fe(L),
1770
- (A, M) => {
1771
- !A || A === M || (u.value = null, x.value = "overview", a.value = null, k());
1772
- }
1773
- );
1774
- function b(A) {
1775
- if (!("run" in A)) {
1776
- u.value = A;
1777
- return;
1778
- }
1779
- u.value = A.run;
1780
- const M = Ga(A);
1781
- if (!M) return;
1782
- const W = a.value;
1783
- (!W || je[M] > je[W]) && (a.value = M);
1784
- }
1785
- const T = $(() => {
1786
- var A;
1787
- return ((A = _._currentLocation) == null ? void 0 : A.name) ?? "";
1788
- }), O = $(() => {
1789
- var A;
1790
- return (((A = u.value) == null ? void 0 : A.preparation.issuances.length) ?? 0) > 0;
1791
- }), D = $(
1792
- () => u.value ? ht(u.value) : []
1793
- ), v = $(() => O.value ? D.value.length > 0 || !!u.value && we(u.value) ? ["overview", "output", "ingredients", "activity"] : ["overview", "ingredients", "activity"] : ["overview", "activity"]), S = $(() => !!u.value && !gt(u.value)), y = $(() => u.value && S.value ? _t(u.value) : null), C = $(() => u.value && S.value ? kt(u.value) : null), N = $(
1794
- () => u.value && S.value ? Object.values(Me(u.value)).reduce((A, M) => A + M, 0) : null
1795
- ), X = $(() => y.value === null || C.value === null ? null : y.value > 0 && C.value > 0 ? C.value / y.value * 100 : u.value && we(u.value) ? 0 : null), z = $(() => !!u.value && $t(u.value)), F = $(
1796
- () => z.value && !!u.value && !we(u.value) && !Le(u.value)
1797
- ), Z = $(() => u.value ? Ge(u.value) : null), pe = $(() => u.value ? xt(u.value) : []), _e = $(() => pe.value.map((A) => A.action));
1798
- function ue(A) {
1799
- return _e.value.includes(A);
1800
- }
1801
- const ve = $(() => {
1802
- if (F.value && ue("close")) return "close";
1803
- for (const A of ["complete", "prepare", "request"])
1804
- if (ue(A)) return A;
1805
- return null;
1806
- }), ke = $(
1807
- () => ["complete", "close", "update"].filter(
1808
- (A) => ue(A) && A !== ve.value
1809
- )
1810
- ), $e = $(
1811
- () => ["cancel"].filter((A) => ue(A))
1812
- );
1813
- return {
1814
- run: u,
1815
- phase: w,
1816
- errorMessage: f,
1817
- activeTab: x,
1818
- tabs: v,
1819
- locationName: T,
1820
- stockRecalculation: a,
1821
- stockRecalculationRequired: h,
1822
- /** The one way to take a stock-moving write's answer onto the page. */
1823
- adoptWriteResult: b,
1824
- hasIssuance: O,
1825
- batches: D,
1826
- committed: y,
1827
- produced: C,
1828
- remaining: N,
1829
- attainmentPercent: X,
1830
- atTarget: z,
1831
- targetReachedOpen: F,
1832
- outcome: Z,
1833
- summable: S,
1834
- legalActions: pe,
1835
- /** Legality asked as a question, so callers never re-derive the table. */
1836
- can: ue,
1837
- primaryAction: ve,
1838
- secondaryActions: ke,
1839
- dangerActions: $e,
1840
- load: k,
1841
- reload: o
1842
- };
1843
- }
1844
- function Qa(L) {
1845
- const c = j([]), t = j(null), _ = j(!1), l = j(!1), u = j(null);
1846
- let w = 0;
1847
- const f = $(() => ({
1848
- loading: _.value,
1849
- loaded: l.value,
1850
- hasMore: t.value !== null,
1851
- error: u.value
1852
- }));
1853
- function x() {
1854
- w++, c.value = [], t.value = null, _.value = !1, l.value = !1, u.value = null;
1855
- }
1856
- async function a(i) {
1857
- const r = w, k = L.runId(), o = L.locationId(), d = () => r === w && L.runId() === k && L.locationId() === o;
1858
- _.value = !0, u.value = null;
1859
- try {
1860
- const b = await L.list(i);
1861
- if (!d()) return;
1862
- if (i && b.nextCursor === i)
1863
- throw new Error(
1864
- "The next page could not be advanced. Reopen the editor to refresh history."
1865
- );
1866
- const T = new Set(c.value.map((O) => O._id));
1867
- c.value = [...c.value, ...b.items.filter((O) => !T.has(O._id))], t.value = b.nextCursor, l.value = !0;
1868
- } catch (b) {
1869
- d() && (u.value = be(b).message);
1870
- } finally {
1871
- d() && (_.value = !1);
1872
- }
1873
- }
1874
- async function h() {
1875
- x(), await a();
1876
- }
1877
- async function I() {
1878
- if (!_.value) {
1879
- if (!l.value) return await h();
1880
- t.value !== null && await a(t.value);
1881
- }
1882
- }
1883
- return { sources: c, state: f, load: h, loadMore: I, invalidate: x };
1884
- }
1885
- const Za = { class: "flex flex-col w-full h-full bg-fm-color-surface-primary overflow-y-auto" }, Ja = {
1886
- key: 0,
1887
- class: "flex flex-col gap-16 p-24"
1888
- }, Ya = {
1889
- key: 1,
1890
- class: "flex flex-col gap-16 p-24 max-w-[640px]"
1891
- }, Xa = {
1892
- key: 2,
1893
- class: "flex flex-col gap-16 p-24 max-w-[640px]"
1894
- }, er = {
1895
- key: 1,
1896
- class: "flex justify-center py-32"
1897
- }, tr = /* @__PURE__ */ K({
1898
- __name: "ProductionRunDetailView",
1899
- props: {
1900
- id: {}
1901
- },
1902
- setup(L) {
1903
- const c = L, { t } = Y(), _ = Se(), l = ot(), u = tt(), w = Ke(), f = Ae(), x = $(() => Pe());
1904
- wt();
1905
- const a = Ka(() => c.id, { leaveOnLocationChange: !1 }), h = It(() => a.run.value), I = Qa({
1906
- list: (g) => w.list(g ? { cursor: g } : {}),
1907
- runId: () => c.id,
1908
- locationId: () => f.currentLocationId
1909
- }), i = I.sources, r = Rt(), k = j(!1), o = $(
1910
- () => a.run.value ? r.requestedIngredientRows(a.run.value) : []
1911
- );
1912
- async function d() {
1913
- if (!a.run.value) return;
1914
- const g = c.id;
1915
- if (a.run.value.status === "CANCEL") {
1916
- k.value = !0, await r.loadCatalogue();
1917
- return;
1918
- }
1919
- !await r.load({ livePlan: a.run.value.status === "DRAFT" }) || g !== c.id || !a.run.value || (r.seedFrom(a.run.value), k.value = !0);
1920
- }
1921
- const b = $(() => {
1922
- const g = a.run.value, q = g == null ? void 0 : g.status;
1923
- return q === "DRAFT" ? "draft" : q === "REQUESTING" ? "requested" : q === "PREPARING" ? "preparing" : q === "CANCEL" ? g != null && g.plan.requirements ? "requested" : "draft" : "review";
1924
- }), T = $(() => {
1925
- var g;
1926
- return ((g = a.run.value) == null ? void 0 : g.status) !== "CANCEL";
1927
- }), O = $(() => {
1928
- const g = a.run.value;
1929
- return g && g.status === "CANCEL" ? r.historicalItems(g) : void 0;
1930
- });
1931
- ae(
1932
- () => [a.phase.value, a.hasIssuance.value],
1933
- async ([g, q]) => {
1934
- g !== "ready" || q || k.value || !a.run.value || await d();
1935
- },
1936
- { immediate: !0 }
1937
- );
1938
- const D = j(null);
1939
- let v = null;
1940
- const S = j("review"), y = j(!1), C = j(null);
1941
- let N = 0;
1942
- Xe(() => {
1943
- N++;
1944
- }), ae(
1945
- () => c.id,
1946
- () => {
1947
- I.invalidate(), k.value = !1, M.value = !1, D.value = null, N++, y.value = !1;
1948
- }
1949
- );
1950
- const X = $(() => a.run.value ? St(a.run.value) : null), z = $(() => {
1951
- var q, V;
1952
- const g = {};
1953
- for (const J of ((q = a.run.value) == null ? void 0 : q.preparation.issuances) ?? [])
1954
- for (const Q of J.items)
1955
- g[Q.sku._id] = {
1956
- name: Q.sku.name,
1957
- unit: ((V = Q.sku.unit) == null ? void 0 : V.abbrev) ?? null,
1958
- precision: Q.sku.unit ? Oe(Q.sku.unit) : null
1959
- };
1960
- for (const J of h.ingredientLines.value)
1961
- g[J.skuId] || (g[J.skuId] = {
1962
- name: J.name,
1963
- unit: J.unit,
1964
- precision: J.unitRef ? Oe(J.unitRef) : null
1965
- });
1966
- return g;
1967
- }), F = $(
1968
- () => a.tabs.value.map((g) => ({
1969
- label: t(`inventory.production.run.detail.tab.${g}`),
1970
- value: g,
1971
- id: `production-run-tab-${g}`,
1972
- controls: `production-run-panel-${g}`
1973
- }))
1974
- ), Z = $(
1975
- () => !!a.run.value && Le(a.run.value)
1976
- ), pe = $(() => {
1977
- const g = a.run.value;
1978
- if (!g) return "";
1979
- if (Z.value) return t("inventory.production.run.detail.pendingStock.message");
1980
- let q;
1981
- switch (g.status) {
1982
- case "REQUESTING":
1983
- q = "requested";
1984
- break;
1985
- case "PREPARING":
1986
- q = g.batches.length > 0 ? "issuedWithOutput" : "issued";
1987
- break;
1988
- case "CLOSED":
1989
- q = "closed";
1990
- break;
1991
- case "CANCEL":
1992
- q = "cancelled";
1993
- break;
1994
- default:
1995
- q = "draft";
1996
- }
1997
- return t(`inventory.production.run.detail.next.${q}`);
1998
- }), _e = $(
1999
- () => h.ingredientLines.value.map((g) => ({
2000
- skuId: g.skuId,
2001
- name: g.name,
2002
- unit: g.unit,
2003
- unitRef: g.unitRef,
2004
- outputSkuIds: g.outputSkuIds
2005
- }))
2006
- );
2007
- function ue(g) {
2008
- var q;
2009
- if (a.can(g)) {
2010
- if (g === "update") {
2011
- D.value = "update", I.load();
2012
- return;
2013
- }
2014
- if (g === "request") {
2015
- const V = (q = a.run.value) == null ? void 0 : q._id, J = f.currentLocationDBName, Q = N;
2016
- l.open(qt(t)).onPrimary(() => {
2017
- var Be;
2018
- Q !== N || V !== ((Be = a.run.value) == null ? void 0 : Be._id) || J !== f.currentLocationDBName || ke();
2019
- });
2020
- return;
2021
- }
2022
- g === "prepare" && (S.value = "review"), v = document.activeElement instanceof HTMLElement ? document.activeElement : null, D.value = g;
2023
- }
2024
- }
2025
- function ve() {
2026
- a.can("prepare") && (S.value = "print", v = document.activeElement instanceof HTMLElement ? document.activeElement : null, D.value = "prepare");
2027
- }
2028
- async function ke() {
2029
- if (!a.can("request")) return;
2030
- const g = a.run.value;
2031
- if (!g) return;
2032
- const q = ++N;
2033
- y.value = !0;
2034
- try {
2035
- const V = await w.request(g._id);
2036
- if (q !== N) return;
2037
- a.run.value = V, u.success(t("inventory.production.run.detail.toast.requested"));
2038
- } catch (V) {
2039
- if (q !== N) return;
2040
- u.error(be(V).message);
2041
- } finally {
2042
- q === N && (y.value = !1);
2043
- }
2044
- }
2045
- function $e(g) {
2046
- a.adoptWriteResult(g), u.success(t("inventory.production.run.detail.toast.issued"));
2047
- }
2048
- function A(g) {
2049
- a.adoptWriteResult(g), h.refresh(), u.success(t("inventory.production.run.detail.toast.recorded")), M.value = a.can("close") && a.atTarget.value;
2050
- }
2051
- const M = j(!1), W = $(() => {
2052
- const g = a.stockRecalculation.value;
2053
- return g ? {
2054
- tone: g === "dispatched" ? "info" : "warn",
2055
- key: `inventory.production.run.detail.recalculation.${g}`
2056
- } : null;
2057
- }), se = $(() => {
2058
- const g = a.locationName.value;
2059
- return g ? t("inventory.production.run.detail.notInLocation.title", { location: g }) : t("inventory.production.run.detail.notInLocation.titleUnknown");
2060
- });
2061
- function ye(g) {
2062
- D.value = null, I.invalidate(), xe(g), k.value && r.seedFrom(g), h.refresh();
2063
- }
2064
- function qe() {
2065
- a.reload(), h.refresh();
2066
- }
2067
- ae(
2068
- () => a.activeTab.value,
2069
- (g, q) => {
2070
- g === "ingredients" && q !== "ingredients" && qe();
2071
- }
2072
- );
2073
- async function Te() {
2074
- try {
2075
- await r.refreshStock();
2076
- } catch (g) {
2077
- u.error(be(g).message);
2078
- }
2079
- }
2080
- async function Ze(g) {
2081
- var q;
2082
- if (g === null) {
2083
- const V = v;
2084
- v = null, D.value = null, I.invalidate(), await Ie(), V != null && V.isConnected ? V.focus() : (q = C.value) == null || q.focus();
2085
- }
2086
- }
2087
- function xe(g) {
2088
- a.run.value = g;
2089
- }
2090
- function Je() {
2091
- _.push(x.value);
2092
- }
2093
- return (g, q) => {
2094
- const V = te("FmButton"), J = te("FmCircularProgress");
2095
- return s(), m("div", Za, [
2096
- e(a).phase.value === "waitingForLocation" || e(a).phase.value === "loading" ? (s(), m("div", Ja, q[3] || (q[3] = [
2097
- n("div", { class: "h-24 w-1/3 rounded bg-fm-color-neutral-gray-100 animate-pulse" }, null, -1),
2098
- n("div", { class: "h-16 w-1/2 rounded bg-fm-color-neutral-gray-100 animate-pulse" }, null, -1),
2099
- n("div", { class: "h-[240px] rounded bg-fm-color-neutral-gray-100 animate-pulse" }, null, -1)
2100
- ]))) : e(a).phase.value === "notInLocation" ? (s(), m("div", Ya, [
2101
- P(re, {
2102
- tone: "warn",
2103
- title: se.value,
2104
- message: e(t)("inventory.production.run.detail.notInLocation.message")
2105
- }, {
2106
- actions: ne(() => [
2107
- P(V, {
2108
- variant: "secondary",
2109
- label: e(t)("inventory.production.run.detail.notInLocation.action"),
2110
- onClick: Je
2111
- }, null, 8, ["label"])
2112
- ]),
2113
- _: 1
2114
- }, 8, ["title", "message"])
2115
- ])) : e(a).phase.value === "error" ? (s(), m("div", Xa, [
2116
- P(re, {
2117
- role: "alert",
2118
- tone: "critical",
2119
- title: e(t)("inventory.production.run.detail.error.title"),
2120
- message: e(a).errorMessage.value ?? void 0
2121
- }, {
2122
- actions: ne(() => [
2123
- P(V, {
2124
- variant: "secondary",
2125
- label: e(t)("inventory.production.run.detail.error.retry"),
2126
- onClick: q[0] || (q[0] = (Q) => e(a).load())
2127
- }, null, 8, ["label"])
2128
- ]),
2129
- _: 1
2130
- }, 8, ["title", "message"])
2131
- ])) : e(a).run.value ? (s(), m("div", {
2132
- key: 3,
2133
- ref_key: "detailContent",
2134
- ref: C,
2135
- tabindex: "-1",
2136
- "data-testid": "production-run-detail-content",
2137
- class: "production-run-detail-content mx-auto flex w-full max-w-[1228px] flex-col gap-16"
2138
- }, [
2139
- P(Wt, {
2140
- run: e(a).run.value,
2141
- "location-name": e(a).locationName.value,
2142
- "back-to": x.value,
2143
- "primary-action": e(a).primaryAction.value,
2144
- "secondary-actions": e(a).secondaryActions.value,
2145
- "danger-actions": e(a).dangerActions.value,
2146
- "can-print-prepare-sheet": e(a).primaryAction.value === "prepare",
2147
- "status-description": pe.value,
2148
- "target-reached": e(a).targetReachedOpen.value,
2149
- busy: y.value,
2150
- onAction: ue,
2151
- onPrintPrepareSheet: ve
2152
- }, null, 8, ["run", "location-name", "back-to", "primary-action", "secondary-actions", "danger-actions", "can-print-prepare-sheet", "status-description", "target-reached", "busy"]),
2153
- Z.value ? (s(), B(re, {
2154
- key: 0,
2155
- "data-testid": "production-run-pending-stock",
2156
- role: "status",
2157
- tone: "warn",
2158
- title: e(t)("inventory.production.run.detail.pendingStock.title"),
2159
- message: e(t)("inventory.production.run.detail.pendingStock.message")
2160
- }, null, 8, ["title", "message"])) : R("", !0),
2161
- W.value ? (s(), B(re, {
2162
- key: 1,
2163
- tone: W.value.tone,
2164
- title: e(t)(`${W.value.key}.title`),
2165
- message: e(t)(`${W.value.key}.message`)
2166
- }, null, 8, ["tone", "title", "message"])) : R("", !0),
2167
- M.value && e(a).targetReachedOpen.value ? (s(), B(re, {
2168
- key: 2,
2169
- "data-testid": "target-reached-notice",
2170
- tone: "info",
2171
- title: e(t)("inventory.production.run.detail.targetOffer.title"),
2172
- message: e(t)("inventory.production.run.detail.targetOffer.message")
2173
- }, null, 8, ["title", "message"])) : R("", !0),
2174
- P(Wa, {
2175
- run: e(a).run.value
2176
- }, null, 8, ["run"]),
2177
- P(Ha, {
2178
- modelValue: e(a).activeTab.value,
2179
- "onUpdate:modelValue": q[1] || (q[1] = (Q) => e(a).activeTab.value = Q),
2180
- class: "mb-4",
2181
- items: F.value,
2182
- ariaLabel: e(t)("inventory.production.run.detail.tabsLabel")
2183
- }, null, 8, ["modelValue", "items", "ariaLabel"]),
2184
- e(a).activeTab.value === "overview" ? (s(), B(Vo, {
2185
- key: 3,
2186
- id: "production-run-panel-overview",
2187
- role: "tabpanel",
2188
- "aria-labelledby": "production-run-tab-overview",
2189
- run: e(a).run.value,
2190
- names: z.value,
2191
- batches: e(a).batches.value,
2192
- committed: e(a).committed.value,
2193
- unit: X.value,
2194
- "has-issuance": e(a).hasIssuance.value,
2195
- operational: b.value !== "review",
2196
- onViewAll: q[2] || (q[2] = (Q) => e(a).activeTab.value = "output")
2197
- }, {
2198
- operational: ne(() => [
2199
- T.value && b.value !== "preparing" && (e(r).loadFailure.value || e(r).projectionFailed.value) ? (s(), B(At, {
2200
- key: 0,
2201
- "load-failure": e(r).loadFailure.value,
2202
- "projection-failed": e(r).projectionFailed.value,
2203
- onRetryLoad: d,
2204
- onRetryProjection: e(r).retryProjection
2205
- }, null, 8, ["load-failure", "projection-failed", "onRetryProjection"])) : T.value && b.value !== "preparing" && e(r).loading.value ? (s(), m("div", er, [
2206
- P(J, { size: "lg" })
2207
- ])) : b.value === "draft" && k.value ? (s(), B(Lt, {
2208
- key: 2,
2209
- items: e(r).items.value,
2210
- "historical-items": O.value,
2211
- commits: e(r).commits.value,
2212
- instructions: e(a).run.value.instructions,
2213
- editable: !1,
2214
- refreshable: T.value,
2215
- refreshing: e(r).refreshingStock.value,
2216
- "show-stock-projection": T.value,
2217
- onRefresh: Te
2218
- }, null, 8, ["items", "historical-items", "commits", "instructions", "refreshable", "refreshing", "show-stock-projection"])) : b.value === "requested" && k.value ? (s(), B(Da, {
2219
- key: 3,
2220
- run: e(a).run.value,
2221
- items: O.value ?? e(r).items.value,
2222
- ingredients: o.value,
2223
- refreshable: T.value,
2224
- refreshing: e(r).refreshingStock.value,
2225
- "show-stock-projection": T.value,
2226
- onRefresh: Te
2227
- }, null, 8, ["run", "items", "ingredients", "refreshable", "refreshing", "show-stock-projection"])) : b.value === "preparing" ? (s(), B(Qe, {
2228
- key: 4,
2229
- run: e(a).run.value,
2230
- names: z.value,
2231
- "ingredient-contributions": e(h).ingredientContributions.value,
2232
- "unattributed-ingredients": e(h).unattributedIngredientLines.value,
2233
- "unissued-sku-ids": e(h).unissuedOutputs.value.map((Q) => Q.skuId),
2234
- "title-key": "inventory.production.run.form.items.title",
2235
- presentation: "preparing"
2236
- }, null, 8, ["run", "names", "ingredient-contributions", "unattributed-ingredients", "unissued-sku-ids"])) : R("", !0)
2237
- ]),
2238
- _: 1
2239
- }, 8, ["run", "names", "batches", "committed", "unit", "has-issuance", "operational"])) : e(a).activeTab.value === "output" ? (s(), B(zo, {
2240
- key: 4,
2241
- id: "production-run-panel-output",
2242
- role: "tabpanel",
2243
- "aria-labelledby": "production-run-tab-output",
2244
- batches: e(a).batches.value,
2245
- names: z.value
2246
- }, null, 8, ["batches", "names"])) : e(a).activeTab.value === "ingredients" ? (s(), B(ya, {
2247
- key: 5,
2248
- id: "production-run-panel-ingredients",
2249
- role: "tabpanel",
2250
- "aria-labelledby": "production-run-tab-ingredients",
2251
- "run-id": e(a).run.value._id,
2252
- loading: e(h).loading.value,
2253
- "snapshot-available": e(h).adjustment.value !== null,
2254
- lines: e(h).ingredientLines.value,
2255
- "ingredient-contributions": e(h).ingredientContributions.value,
2256
- "output-names": z.value,
2257
- "unattributed-ingredients": e(h).unattributedIngredientLines.value
2258
- }, null, 8, ["run-id", "loading", "snapshot-available", "lines", "ingredient-contributions", "output-names", "unattributed-ingredients"])) : (s(), B(Aa, {
2259
- key: 6,
2260
- id: "production-run-panel-activity",
2261
- role: "tabpanel",
2262
- "aria-labelledby": "production-run-tab-activity",
2263
- run: e(a).run.value
2264
- }, null, 8, ["run"])),
2265
- P(Pt, {
2266
- action: D.value,
2267
- run: e(a).run.value,
2268
- "location-name": e(a).locationName.value,
2269
- "duplicate-sources": e(i),
2270
- "duplicate-source-state": e(I).state.value,
2271
- onLoadMoreDuplicateSources: e(I).loadMore,
2272
- "prepare-initial-view": S.value,
2273
- "at-target": e(a).atTarget.value,
2274
- ingredients: _e.value,
2275
- "onUpdate:action": Ze,
2276
- onEdited: ye,
2277
- onIssued: $e,
2278
- onRecorded: A,
2279
- onClosed: xe,
2280
- onCancelled: xe,
2281
- onReload: qe
2282
- }, null, 8, ["action", "run", "location-name", "duplicate-sources", "duplicate-source-state", "onLoadMoreDuplicateSources", "prepare-initial-view", "at-target", "ingredients"])
2283
- ], 512)) : R("", !0)
2284
- ]);
2285
- };
2286
- }
2287
- }), nr = /* @__PURE__ */ ce(tr, [["__scopeId", "data-v-19386a44"]]), mr = /* @__PURE__ */ K({
2288
- __name: "ProductionRunDetailPage",
2289
- props: {
2290
- id: {}
2291
- },
2292
- setup(L) {
2293
- var w;
2294
- const c = L, t = Se(), _ = Ae(), l = j(!1);
2295
- let u = (w = _._currentLocation) == null ? void 0 : w.dbName;
2296
- return ae(
2297
- () => {
2298
- var f;
2299
- return (f = _._currentLocation) == null ? void 0 : f.dbName;
2300
- },
2301
- (f) => {
2302
- !f || l.value || (u && f !== u && (l.value = !0, t.replace(Pe())), u = f);
2303
- }
2304
- ), (f, x) => (s(), B(et, { "feature-key": "production-runs" }, {
2305
- default: ne(() => [
2306
- l.value ? R("", !0) : (s(), B(nr, {
2307
- key: 0,
2308
- id: c.id
2309
- }, null, 8, ["id"]))
2310
- ]),
2311
- _: 1
2312
- }));
2313
- }
2314
- });
2315
- export {
2316
- mr as default
2317
- };