@feedmepos/mf-inventory-portal 1.8.0-dev.2 → 1.8.0-dev.20

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 (248) hide show
  1. package/dist/App-5GYyCfFq.js +1445 -0
  2. package/dist/{ApprovalView-RaXuWWSu.js → ApprovalView-DY1ayl1W.js} +26 -25
  3. package/dist/{BindingsDialog-DomvXijP.js → BindingsDialog-Dm7uKMfV.js} +2 -2
  4. package/dist/{BindingsPicker-DGnzxEs7.js → BindingsPicker-DhnMlj4x.js} +2 -2
  5. package/dist/{BindingsTable-DfG9kWrv.js → BindingsTable-Cxibcjka.js} +10 -10
  6. package/dist/BulkReceiveRequestPage-w4AA6BxB.js +2839 -0
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-CVekIoiN.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-B3ESPbQp.js} +1 -1
  8. package/dist/{ClosingDraftView-C3n66bbh.js → ClosingDraftView-DMaONEZ7.js} +748 -746
  9. package/dist/ClosingHistoryView-BBYruOux.js +769 -0
  10. package/dist/{ClosingTemplateView-DwGloYxn.js → ClosingTemplateView-DcwgokRl.js} +22 -21
  11. package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-9eY_r8LF.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-a72IldDO.js} +1 -1
  12. package/dist/{DefaultView-JC_e4xgC.js → DefaultView-BVr_7JDn.js} +2 -2
  13. package/dist/{DeliveryOrderPrintPreview-BBCvI67S.js → DeliveryOrderPrintPreview-BXZFD3D5.js} +15 -15
  14. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-H4FWc9ga.js → EmailDialog.vue_vue_type_script_setup_true_lang-Dne_9P3j.js} +10077 -9950
  15. package/dist/FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-CYkPbFSA.js +48 -0
  16. package/dist/FeatureCapabilityGate-DK_rTVyJ.js +82 -0
  17. package/dist/FeaturePageGate.vue_vue_type_script_setup_true_lang-DIhV51l7.js +189 -0
  18. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-Q8Mptiv3.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-B80EHMBT.js} +1 -1
  19. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CE1_yyHe.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C94IFGoH.js} +2 -2
  20. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CGJi3f86.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-COZPDuAM.js} +2 -2
  21. package/dist/{FmMultiselectDialog-DCaRlBIy.js → FmMultiselectDialog-C1P22sj2.js} +2 -2
  22. package/dist/FmMultiselectDialog-Kb3IftHf.js +123 -0
  23. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-ClaLVtpK.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BqB71yfu.js} +105 -99
  24. package/dist/ImportView-EJ4u8NHM.js +1540 -0
  25. package/dist/{IngredientsView-DPj9lBTK.js → IngredientsView-Bxsgm4E7.js} +691 -689
  26. package/dist/{IntegrationExplorerView-CO2wpUR_.js → IntegrationExplorerView-owEaOVeG.js} +1537 -1620
  27. package/dist/IntegrationPlatformView-BuptPyjg.js +13385 -0
  28. package/dist/{IntegrationView-DIeZoey0.js → IntegrationView-DAcdY_d_.js} +2604 -2565
  29. package/dist/{InventoryBindingForm-Cj4_Chue.js → InventoryBindingForm-BvjY4zrn.js} +1 -1
  30. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-DhbF-jgN.js +472 -0
  31. package/dist/{InventoryBindingSummary-yzGzd7jJ.js → InventoryBindingSummary-DPqm94GX.js} +1 -1
  32. package/dist/JsonViewer.vue_vue_type_script_setup_true_lang-C_hg75l0.js +25 -0
  33. package/dist/NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DDsigNJ4.js +79 -0
  34. package/dist/PlanTierBadge.vue_vue_type_script_setup_true_lang-CM3gtYZo.js +19 -0
  35. package/dist/PlanUpgradeDialog.vue_vue_type_script_setup_true_lang-0F-yOcPC.js +79 -0
  36. package/dist/PremiumUpgradePage.vue_vue_type_script_setup_true_lang-DGAxPOEh.js +58 -0
  37. package/dist/ProductionRunDetailPage-BaPCJUqT.js +2317 -0
  38. package/dist/{ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-BYyiiAWb.js → ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-CNRX3MYt.js} +3053 -3163
  39. package/dist/ProductionRunPage-B6Jsv9Hh.js +954 -0
  40. package/dist/{PublishView-CPK9NeVF.js → PublishView-DonUv6nP.js} +3 -3
  41. package/dist/{PurchaseOrderPrintPreview-DosqWQeN.js → PurchaseOrderPrintPreview-CK3Cqdwp.js} +17 -17
  42. package/dist/{ReceiveRequestView-BxSkpK2t.js → ReceiveRequestView-CMAnKxzm.js} +17 -16
  43. package/dist/RecipeView-Bx13Bckq.js +3272 -0
  44. package/dist/SettingsView-D1MiAkD8.js +1005 -0
  45. package/dist/StockView-CsxTjVEd.js +3003 -0
  46. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-GdGJCuc0.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BT73j9SA.js} +1 -1
  47. package/dist/{SupplierView-BKxKoi_0.js → SupplierView-CFACoZya.js} +304 -301
  48. package/dist/{SurchargeView-Db4cwhZv.js → SurchargeView-CShhZa3x.js} +7 -7
  49. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CpkF77Ow.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-B2OdmdI_.js} +2 -2
  50. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-gJQQKKAC.js +71 -0
  51. package/dist/TemplatePublishDialog.vue_vue_type_script_setup_true_lang-x3N2Oypo.js +332 -0
  52. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BISmGBJE.js +4953 -0
  53. package/dist/TransferTemplateView-kx2IPqEv.js +2347 -0
  54. package/dist/{UnitCostHistoryView-CqcyjCCd.js → UnitCostHistoryView-DgPWsXaB.js} +4 -4
  55. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-DO80_8SZ.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-BtfJJgIP.js} +4 -4
  56. package/dist/{UnitView-BqdK1AM_.js → UnitView-aupXLRMk.js} +111 -106
  57. package/dist/{WarehouseView-COJM9IXM.js → WarehouseView-MTvbY4n4.js} +12 -11
  58. package/dist/{WastageTemplateView-DW3viTHN.js → WastageTemplateView-Bs9HL-LK.js} +19 -18
  59. package/dist/api/bill.d.ts +4 -2
  60. package/dist/api/bill.spec.d.ts +1 -0
  61. package/dist/api/closing.d.ts +1 -0
  62. package/dist/api/feature-flags.d.ts +4 -0
  63. package/dist/api/integration-sync-log.d.ts +0 -13
  64. package/dist/api/license.d.ts +0 -2
  65. package/dist/api/netsuite-explorer.d.ts +1 -0
  66. package/dist/api/stock.d.ts +1 -1
  67. package/dist/{app-yvK__CBL.js → app-D38sV2ls.js} +10177 -10126
  68. package/dist/app.d.ts +151 -164
  69. package/dist/app.js +1 -1
  70. package/dist/bulk-edit-simulation.helper-DgniL8FN.js +178 -0
  71. package/dist/{closing-template-DezidSM0.js → closing-template-D_NAj_mU.js} +4 -4
  72. package/dist/components/FeatureCapabilityBadge.vue.d.ts +4 -0
  73. package/dist/components/FeatureCapabilityGate.spec.d.ts +1 -0
  74. package/dist/components/FeatureCapabilityGate.vue.d.ts +5 -0
  75. package/dist/components/FeatureGateLayout.vue.d.ts +11 -0
  76. package/dist/components/FeaturePageGate.spec.d.ts +1 -0
  77. package/dist/components/FeaturePageGate.vue.d.ts +34 -0
  78. package/dist/components/FmAdminCollapsiblePanel.vue.d.ts +1 -1
  79. package/dist/components/FmDroppableField.vue.d.ts +1 -1
  80. package/dist/components/FmInventoryTableToolbar.vue.d.ts +2 -2
  81. package/dist/components/FmUnitInputProps.d.ts +1 -0
  82. package/dist/components/FmUnitInputRules.d.ts +1 -1
  83. package/dist/components/HrmPermissionGuard.vue.d.ts +1 -1
  84. package/dist/components/NumberPrecisionInput.spec.d.ts +1 -0
  85. package/dist/{views/ingredient-group/IngredientGroupView.vue.d.ts → components/PremiumUpgradePage.vue.d.ts} +0 -1
  86. package/dist/components/TemplatePublishDialog.d.ts +2 -0
  87. package/dist/components/TemplatePublishDialog.spec.d.ts +1 -0
  88. package/dist/composable/defineApi.d.ts +1 -1
  89. package/dist/{date2-2XjepIqc.js → date2-CvgxwuM1.js} +1 -1
  90. package/dist/{dayjs.min-CNp5DLBB.js → dayjs.min-BOKV8T5Q.js} +1 -1
  91. package/dist/{decimal-Z7oJdGk8.js → decimal-5xyg1WLu.js} +2 -2
  92. package/dist/{defineDeepModel-CMxJn_H2.js → defineDeepModel-BwB9XcMu.js} +5 -5
  93. package/dist/{duplicate-template-BetV5oy_.js → duplicate-template-DvIgjm4K.js} +1 -1
  94. package/dist/{feature-CkWaZ-5K.js → feature-CsPbMoeJ.js} +2088 -2853
  95. package/dist/feature-flags/core.d.ts +3 -2
  96. package/dist/feature-flags/portal-feature-catalog.d.ts +1 -6
  97. package/dist/feature-flags/portal-feature-catalog.spec.d.ts +1 -0
  98. package/dist/feature-flags/vue.d.ts +24 -1
  99. package/dist/feature-flags/vue.spec.d.ts +1 -0
  100. package/dist/{format-time-from-id-DatSI9uD.js → format-time-from-id-DD6Ik9EK.js} +1 -1
  101. package/dist/{format-unit-display-DM5We5cx.js → format-unit-display-DG564AN3.js} +209 -208
  102. package/dist/helper/country.spec.d.ts +1 -0
  103. package/dist/helper/menu-usage-module.d.ts +2 -1
  104. package/dist/helper/number.d.ts +5 -1
  105. package/dist/helper/rules.d.ts +1 -1
  106. package/dist/{id-to-date-Dxw2jKhy.js → id-to-date-DoN7OM21.js} +1 -1
  107. package/dist/{import-export.helper-BOmADwUw.js → import-export.helper-CevBRFTZ.js} +17 -17
  108. package/dist/{index-7fz5sGDO.js → index-BIh1oTQH.js} +3 -3
  109. package/dist/{index-CIH9NCvs.js → index-BP3Avix6.js} +1 -1
  110. package/dist/{JsonViewer.vue_vue_type_script_setup_true_lang-ig2zSXAB.js → index-C25C1Dg7.js} +1074 -1066
  111. package/dist/index-eGvSlWMU.js +1892 -0
  112. package/dist/{index-ClYgfwW7.js → index-mzXhLwrZ.js} +2234 -2163
  113. package/dist/layout/SingleColumnLayout.vue.d.ts +1 -1
  114. package/dist/{lz-string-CCsc2X7t.js → lz-string-DMjWYCk6.js} +1 -1
  115. package/dist/menu-usage-module-Bq_KLsO4.js +74 -0
  116. package/dist/{netsuite-COumFXC2.js → netsuite-ZtoZBFBX.js} +254 -263
  117. package/dist/netsuite-explorer-h_vID_ao.js +79 -0
  118. package/dist/{predefined-templates-Bw9A9LNA.js → predefined-templates-CdurFRJ4.js} +1 -1
  119. package/dist/production-run-list-DR1WsaBR.js +61 -0
  120. package/dist/{purchase-order-template-BaZjdGq8.js → purchase-order-template-BVdCftEo.js} +1 -1
  121. package/dist/{recalculationUtils-t32wAurN.js → recalculationUtils-DBG8HGiJ.js} +1 -1
  122. package/dist/router/name.d.ts +2 -2
  123. package/dist/{row-action.enum-BDeudY4d.js → row-action.enum-CGyAg4dC.js} +1 -1
  124. package/dist/rules-DbFiOzUd.js +243 -0
  125. package/dist/{stock-B59sfN28.js → stock-BATH4SoA.js} +1 -1
  126. package/dist/stock-DXxsDPEO.js +78 -0
  127. package/dist/stores/feature.d.ts +40 -10
  128. package/dist/stores/feature.load-state.spec.d.ts +1 -0
  129. package/dist/stores/inventory.d.ts +0 -47
  130. package/dist/stores/inventory.no-location.spec.d.ts +1 -0
  131. package/dist/stores/supplier.d.ts +1 -1
  132. package/dist/stores/warehouse.d.ts +1 -1
  133. package/dist/style.css +1 -1
  134. package/dist/{supplier-DnbLJ_cS.js → supplier-CKXQmBZn.js} +2 -2
  135. package/dist/{surcharge-C1uE3uQa.js → surcharge-qupRJjjO.js} +1 -1
  136. package/dist/tsconfig.app.tsbuildinfo +1 -1
  137. package/dist/{uom-rules-DjfyrFHJ.js → uom-rules-ALtgjANX.js} +1 -1
  138. package/dist/{use-ingredient-select-dialog-7A7fWyEH.js → use-ingredient-select-dialog-C1sJpjfV.js} +2 -2
  139. package/dist/use-inventory-binding-dialog-tl7-epun.js +113 -0
  140. package/dist/{use-template-enabled-locations-C-Hqqgzt.js → use-template-enabled-locations-DWk2ndDC.js} +2 -2
  141. package/dist/{use-transfer-locations-CqsXvOI2.js → use-transfer-locations-CsdYY996.js} +14 -14
  142. package/dist/{useHrmPermission-BzwD3Ctc.js → useHrmPermission-BtuqUrwj.js} +1 -1
  143. package/dist/{useNavigationMenu-PrZg9HS7.js → useNavigationMenu-DKxKXykI.js} +111 -117
  144. package/dist/{useSseClient-FCyLWq8k.js → useSseClient-CRfpltKK.js} +1 -1
  145. package/dist/views/changelog/composables/use-snapshot-diff.d.ts +2 -2
  146. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +1 -1
  147. package/dist/views/closing-draft/helpers/draft-status-to-class-name.helper.d.ts +1 -1
  148. package/dist/views/import/helper/submit-rows.d.ts +1 -1
  149. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -1
  150. package/dist/views/ingredients/components/inventory-binding/composables/use-inventory-binding-dialog.d.ts +0 -1
  151. package/dist/views/ingredients/components/inventory-binding/recipe-amount-validation.spec.d.ts +1 -0
  152. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -1
  153. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +0 -1
  154. package/dist/views/ingredients/helper/is-linked-ingredient-error.d.ts +3 -1
  155. package/dist/views/{ingredient-group/components/ingredient-group-rule-field/IngredientGroupRuleField.vue.d.ts → integration/IntegrationPlatformView.vue.d.ts} +11 -24
  156. package/dist/views/integration/components/Synergy/importFn.spec.d.ts +1 -0
  157. package/dist/views/integration/components/Xilnex/importFn.spec.d.ts +1 -0
  158. package/dist/views/integration/helper/opening-balance.d.ts +22 -0
  159. package/dist/views/integration/helper/opening-balance.spec.d.ts +1 -0
  160. package/dist/views/production-run/ProductionRunDetailPage.spec.d.ts +1 -0
  161. package/dist/views/{integration/components/IntegrationSyncLogTab.vue.d.ts → production-run/ProductionRunDetailPage.vue.d.ts} +2 -2
  162. package/dist/views/production-run/ProductionRunPage.vue.d.ts +2 -0
  163. package/dist/views/production-run/features/detail/ProductionRunItemsTable.vue.d.ts +2 -2
  164. package/dist/views/production-run/features/detail/ProductionRunOverviewTab.vue.d.ts +4 -4
  165. package/dist/views/production-run/features/detail/use-production-run-detail.d.ts +19 -9
  166. package/dist/views/production-run/features/lifecycle/CancelRunDialog.vue.d.ts +4 -4
  167. package/dist/views/production-run/features/lifecycle/CloseRunDialog.vue.d.ts +4 -4
  168. package/dist/views/production-run/features/lifecycle/ProductionRunLifecycleDialogs.vue.d.ts +14 -14
  169. package/dist/views/production-run/features/lifecycle/TargetReachedDialog.vue.d.ts +4 -4
  170. package/dist/views/production-run/features/planning/ProductionRunFormDialog.vue.d.ts +4 -4
  171. package/dist/views/production-run/features/planning/ProductionRunPlanner.vue.d.ts +1 -1
  172. package/dist/views/production-run/features/planning/use-production-run-duplicate-sources.d.ts +6 -6
  173. package/dist/views/production-run/shared/helpers/production-run-navigation.d.ts +0 -1
  174. package/dist/views/production-run/shared/model/production-run-list.d.ts +1 -1
  175. package/dist/views/production-run/shared/ui/ProductionRunInfoBadge.vue.d.ts +1 -1
  176. package/dist/views/production-run/shared/ui/ProductionRunInfoText.vue.d.ts +1 -1
  177. package/dist/views/production-run/shared/ui/ProductionRunScrollHint.vue.d.ts +2 -2
  178. package/dist/views/production-run/shared/ui/ProductionRunTextarea.vue.d.ts +3 -3
  179. package/dist/views/receive-request/composables/netsuite-order-label.d.ts +11 -0
  180. package/dist/views/receive-request/composables/netsuite-order-label.spec.d.ts +1 -0
  181. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +1 -1
  182. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +9 -9
  183. package/dist/views/receive-request/composables/use-receive-request-form.spec.d.ts +1 -0
  184. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +7 -7
  185. package/dist/views/receive-request/import/export.spec.d.ts +1 -0
  186. package/dist/views/receive-request-bulk/BulkReceiveRequestPage.vue.d.ts +2 -0
  187. package/dist/views/receive-request-bulk/components/CreateTransferWizard.spec.d.ts +1 -0
  188. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.d.ts +20 -20
  189. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.readiness.spec.d.ts +1 -0
  190. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-table.d.ts +2 -2
  191. package/dist/views/recipe/components/recipe-bulk-editor/components/ModificationCard.spec.d.ts +1 -0
  192. package/dist/views/recipe/helper/bulk-edit-simulation.helper.d.ts +0 -1
  193. package/dist/views/recipe/helper/import-recipe.d.ts +32 -2
  194. package/dist/views/recipe/helper/import-recipe.spec.d.ts +1 -0
  195. package/dist/views/settings/PlanLicenseDisplay.spec.d.ts +1 -0
  196. package/dist/views/settings/PlanLicenseDisplay.vue.d.ts +2 -0
  197. package/dist/views/stock/components/StockRecordCard.spec.d.ts +1 -0
  198. package/dist/views/stock/components/StockRecordCard.vue.d.ts +19 -865
  199. package/dist/views/stock/components/dialog/AmendAdjustmentForm.spec.d.ts +1 -0
  200. package/dist/views/stock/components/dialog/BillInventoryInfoDialog.spec.d.ts +1 -0
  201. package/dist/views/stock/components/dialog/BillInventoryInfoDialog.vue.d.ts +36 -0
  202. package/dist/views/stock/components/dialog/ConvertSkuDialog.spec.d.ts +1 -0
  203. package/dist/views/stock/composables/use-last-closing-summary.d.ts +4 -0
  204. package/dist/views/stock/composables/use-last-closing-summary.spec.d.ts +1 -0
  205. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.spec.d.ts +1 -0
  206. package/dist/views/transfer-template/helpers/template-item.error.helper.spec.d.ts +1 -0
  207. package/dist/views/unit/composables/use-unit-form.spec.d.ts +1 -0
  208. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +2 -2
  209. package/dist/vue-CVco8McV.js +290 -0
  210. package/dist/{vue-i18n-C34f-Tph.js → vue-i18n-C443zpcA.js} +450 -450
  211. package/dist/{xlsx.util-X4amwe_k.js → xlsx.util-5_47Kslf.js} +2 -2
  212. package/package.json +71 -66
  213. package/dist/App-DVHgBTHP.js +0 -1499
  214. package/dist/BulkReceiveRequestView-DxHWrfbi.js +0 -2656
  215. package/dist/ClosingHistoryView-kdpYGy1Y.js +0 -761
  216. package/dist/DeprecateSoonWarningDialog.vue_vue_type_script_setup_true_lang-5Cc08Svt.js +0 -58
  217. package/dist/FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-C1C8aDA6.js +0 -61
  218. package/dist/FmMultiselectDialog-yVPY5aBV.js +0 -77
  219. package/dist/ImportView-DQrVMzxN.js +0 -1302
  220. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-7lT5UZc8.js +0 -51
  221. package/dist/IngredientGroupView-BMUnEaY7.js +0 -1000
  222. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-CaBOK7NC.js +0 -563
  223. package/dist/NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DzzTPdyF.js +0 -72
  224. package/dist/ProductionRunDetailView-Cw-ecaey.js +0 -2312
  225. package/dist/ProductionRunView-C11eseXQ.js +0 -930
  226. package/dist/RecipeView-oHDWsT0P.js +0 -3624
  227. package/dist/SettingsView-QlUNwFhM.js +0 -983
  228. package/dist/StockView-a8LbVZ_7.js +0 -2614
  229. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js +0 -84
  230. package/dist/TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CCCj4WVF.js +0 -299
  231. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CFNPXqt5.js +0 -4796
  232. package/dist/TransferTemplateView-CzwxOBMQ.js +0 -2326
  233. package/dist/menu-usage-module-BdjYEk3s.js +0 -57
  234. package/dist/number-gSLvxNqA.js +0 -138
  235. package/dist/portal-feature-catalog-yGIESKTc.js +0 -246
  236. package/dist/random-CSbEbElR.js +0 -10
  237. package/dist/rules-C1btu0Md.js +0 -98
  238. package/dist/stock-BF86TMW0.js +0 -75
  239. package/dist/use-inventory-binding-dialog-Cc1tjTfV.js +0 -152
  240. package/dist/usePromise-CbVUCxhj.js +0 -29
  241. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +0 -31
  242. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +0 -10
  243. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +0 -21
  244. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +0 -12
  245. package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +0 -24
  246. package/dist/views/ingredient-group/composables/use-ingredient-group-rule-item.d.ts +0 -31
  247. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +0 -77
  248. package/dist/views/integration/composables/use-integration-sync-log.d.ts +0 -45
@@ -0,0 +1,2317 @@
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-DIhV51l7.js";
4
+ import { u as Ae, n as tt } from "./app-D38sV2ls.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-CNRX3MYt.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-DbFiOzUd.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
+ };