@feedmepos/mf-inventory-portal 1.8.0-dev.8 → 1.8.0

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