@feedmepos/mf-inventory-portal 1.8.0-dev.0 → 1.8.0-dev.10

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