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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/dist/{App-C8i7vBxz.js → App-BPdZMhM8.js} +515 -536
  2. package/dist/{ApprovalView-GHgTeCBV.js → ApprovalView-UzjSuZ2L.js} +26 -25
  3. package/dist/{BindingsDialog-C4-S2CWk.js → BindingsDialog-Cb6WRlKq.js} +2 -2
  4. package/dist/{BindingsPicker-C7YUArBj.js → BindingsPicker-CtD4U4lv.js} +2 -2
  5. package/dist/{BindingsTable-1Zoqi4ZS.js → BindingsTable-CX-3403K.js} +10 -10
  6. package/dist/BulkReceiveRequestPage-CUq1Lmww.js +2839 -0
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DFSg0-gv.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-C5cA-lGH.js} +1 -1
  8. package/dist/{ClosingDraftView-CnWFyWSE.js → ClosingDraftView-Ca_SvdWQ.js} +748 -746
  9. package/dist/{ClosingHistoryView-Bkm0voU6.js → ClosingHistoryView-DzkeJYoe.js} +7 -7
  10. package/dist/{ClosingTemplateView-Bz81JTsg.js → ClosingTemplateView-DSrelbso.js} +22 -21
  11. package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-6s-24euf.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-BuOuXPy1.js} +1 -1
  12. package/dist/{DefaultView-1RRzbPB3.js → DefaultView-Dw-7Y8vD.js} +2 -2
  13. package/dist/{DeliveryOrderPrintPreview-KcLqjOj1.js → DeliveryOrderPrintPreview-C5qJsv_O.js} +15 -15
  14. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-r0Q0qhoK.js → EmailDialog.vue_vue_type_script_setup_true_lang-D8od7aKT.js} +9847 -9723
  15. package/dist/{FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-Cwmk3NLS.js → FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-ChekXW32.js} +11 -10
  16. package/dist/FeatureCapabilityGate-C-IM5_7n.js +82 -0
  17. package/dist/FeaturePageGate.vue_vue_type_script_setup_true_lang-DEDU1XUC.js +189 -0
  18. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-pzIzIWpX.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-B861gqIJ.js} +1 -1
  19. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B6cFB4vX.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Ckli_nZx.js} +2 -2
  20. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D_o6pX9i.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BEjFoMJJ.js} +2 -2
  21. package/dist/{FmMultiselectDialog-CC_Na_p1.js → FmMultiselectDialog-CShFKSIW.js} +2 -2
  22. package/dist/{FmMultiselectDialog-D0GhmOQ9.js → FmMultiselectDialog-Ci-6NMsV.js} +2 -2
  23. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DQlSMRoB.js → FmUnitInput.vue_vue_type_script_setup_true_lang-Dkx5vVap.js} +105 -99
  24. package/dist/ImportView-7ij7RUHI.js +1540 -0
  25. package/dist/{IngredientsView-B2I2OPSb.js → IngredientsView-fIPtTyFD.js} +367 -365
  26. package/dist/{IntegrationExplorerView-WK1EmwLA.js → IntegrationExplorerView-DLYT4T-I.js} +1537 -1620
  27. package/dist/IntegrationPlatformView-CwywuK_y.js +13385 -0
  28. package/dist/{IntegrationView-CeaL92Yj.js → IntegrationView-DnyVHXge.js} +2380 -2340
  29. package/dist/{InventoryBindingForm-DgtaDM0I.js → InventoryBindingForm-BBs8v7CL.js} +1 -1
  30. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CqDN355J.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang--pI5wz_M.js} +134 -134
  31. package/dist/{InventoryBindingSummary-C_W456aj.js → InventoryBindingSummary-CwIrQ8lG.js} +1 -1
  32. package/dist/JsonViewer.vue_vue_type_script_setup_true_lang-C_hg75l0.js +25 -0
  33. package/dist/NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DJSbskyn.js +79 -0
  34. package/dist/PlanTierBadge.vue_vue_type_script_setup_true_lang-CM3gtYZo.js +19 -0
  35. package/dist/{PlanUpgradeDialog.vue_vue_type_script_setup_true_lang-D6-lo7iI.js → PlanUpgradeDialog.vue_vue_type_script_setup_true_lang-0F-yOcPC.js} +1 -1
  36. package/dist/PremiumUpgradePage.vue_vue_type_script_setup_true_lang-DGAxPOEh.js +58 -0
  37. package/dist/ProductionRunDetailPage-C_WC4qfP.js +2317 -0
  38. package/dist/{ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-DwBY6gIb.js → ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-BIkoMOM2.js} +3051 -3161
  39. package/dist/ProductionRunPage-DuzVrjbZ.js +954 -0
  40. package/dist/{PublishView-Dv-W6ntx.js → PublishView-BVg44yke.js} +3 -3
  41. package/dist/{PurchaseOrderPrintPreview-D1TAnJd_.js → PurchaseOrderPrintPreview-CNx6unyj.js} +17 -17
  42. package/dist/{ReceiveRequestView-Rc_uw_Ad.js → ReceiveRequestView-DeNrYOUt.js} +17 -16
  43. package/dist/RecipeView-De3pLsPR.js +3272 -0
  44. package/dist/{SettingsView-K5wAt8oo.js → SettingsView-B5ud0KtI.js} +398 -425
  45. package/dist/StockView-4N3NRjY8.js +3003 -0
  46. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CsRLy0xI.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DvlRRKdt.js} +1 -1
  47. package/dist/{SupplierView-CLVupRN0.js → SupplierView-fC9oe5nu.js} +21 -20
  48. package/dist/{SurchargeView-CToB_z5v.js → SurchargeView-H6rv7u8A.js} +7 -7
  49. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CvqIw9q6.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DFdrmR2Z.js} +2 -2
  50. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-gJQQKKAC.js +71 -0
  51. package/dist/TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BivHE94R.js +332 -0
  52. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Df01LqHp.js +4953 -0
  53. package/dist/TransferTemplateView-CVUnofkI.js +2347 -0
  54. package/dist/{UnitCostHistoryView-BMB2MeTh.js → UnitCostHistoryView-DjD2WAFI.js} +4 -4
  55. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-Dn8Y8zfp.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-CE0zHU6c.js} +4 -4
  56. package/dist/{UnitView-Bl8jws6R.js → UnitView-DCfsbE8e.js} +111 -106
  57. package/dist/{WarehouseView-BurSM1jg.js → WarehouseView-BCebmbcj.js} +12 -11
  58. package/dist/{WastageTemplateView-DRfJ9LGR.js → WastageTemplateView-BXYNMBun.js} +19 -18
  59. package/dist/api/bill.d.ts +4 -2
  60. package/dist/api/bill.spec.d.ts +1 -0
  61. package/dist/api/closing.d.ts +1 -0
  62. package/dist/api/feature-flags.d.ts +2 -0
  63. package/dist/api/integration-sync-log.d.ts +0 -13
  64. package/dist/api/inventory.d.ts +9 -9
  65. package/dist/api/license.d.ts +0 -1
  66. package/dist/api/netsuite-explorer.d.ts +1 -0
  67. package/dist/api/stock.d.ts +1 -1
  68. package/dist/{app-Duum3eHx.js → app-VtVYHCDF.js} +9785 -9546
  69. package/dist/app.d.ts +151 -14
  70. package/dist/app.js +1 -1
  71. package/dist/bulk-edit-simulation.helper-Nd6CtWGf.js +178 -0
  72. package/dist/{closing-template-BE41yfue.js → closing-template-LCe0U9w9.js} +4 -4
  73. package/dist/components/FeatureCapabilityGate.vue.d.ts +3 -0
  74. package/dist/components/FeatureGateLayout.vue.d.ts +11 -0
  75. package/dist/components/FeaturePageGate.spec.d.ts +1 -0
  76. package/dist/components/FeaturePageGate.vue.d.ts +34 -0
  77. package/dist/components/FmAdminCollapsiblePanel.vue.d.ts +1 -1
  78. package/dist/components/FmDroppableField.vue.d.ts +1 -1
  79. package/dist/components/FmInventoryTableToolbar.vue.d.ts +2 -2
  80. package/dist/components/FmUnitInputProps.d.ts +1 -0
  81. package/dist/components/FmUnitInputRules.d.ts +1 -1
  82. package/dist/components/HrmPermissionGuard.vue.d.ts +1 -1
  83. package/dist/components/MultiLocationSelector.vue.d.ts +6 -6
  84. package/dist/components/NumberPrecisionInput.spec.d.ts +1 -0
  85. package/dist/components/PremiumUpgradePage.vue.d.ts +2 -0
  86. package/dist/components/TemplatePublishDialog.d.ts +2 -0
  87. package/dist/components/TemplatePublishDialog.spec.d.ts +1 -0
  88. package/dist/composable/defineApi.d.ts +1 -1
  89. package/dist/{date2-DrhO3BxU.js → date2-Cfb6DXM4.js} +1 -1
  90. package/dist/{dayjs.min-CQp6EpOp.js → dayjs.min-BOndKK7B.js} +1 -1
  91. package/dist/{decimal-Cq0qUT4r.js → decimal-nbuisP61.js} +2 -2
  92. package/dist/{defineDeepModel-DRC39nJs.js → defineDeepModel-DKySrdwp.js} +5 -5
  93. package/dist/{duplicate-template-j2ymeDNH.js → duplicate-template-BxcKb3Jp.js} +1 -1
  94. package/dist/{feature-C0hQza5A.js → feature-VDUlSvM1.js} +435 -359
  95. package/dist/feature-flags/core.d.ts +1 -0
  96. package/dist/feature-flags/vue.d.ts +22 -1
  97. package/dist/{format-time-from-id-BmJoI3jT.js → format-time-from-id-CfVH4LZ_.js} +1 -1
  98. package/dist/{format-unit-display-CRgIMXsD.js → format-unit-display-BjTeAtgS.js} +209 -208
  99. package/dist/helper/country.spec.d.ts +1 -0
  100. package/dist/helper/menu-usage-module.d.ts +2 -1
  101. package/dist/helper/number.d.ts +5 -1
  102. package/dist/helper/rules.d.ts +1 -1
  103. package/dist/{id-to-date-CuFZDvIr.js → id-to-date-Jr9SlHLO.js} +1 -1
  104. package/dist/{import-export.helper-B43zbsbj.js → import-export.helper-FT9Wbigh.js} +17 -17
  105. package/dist/{index-BYDjs08n.js → index-BV9b3Ulp.js} +2234 -2163
  106. package/dist/{index-DXNYZeq3.js → index-By5-VjVg.js} +1 -1
  107. package/dist/{JsonViewer.vue_vue_type_script_setup_true_lang-ig2zSXAB.js → index-C25C1Dg7.js} +1074 -1066
  108. package/dist/{index-Cwvg7EHd.js → index-DXHVgUHU.js} +3 -3
  109. package/dist/index-eGvSlWMU.js +1892 -0
  110. package/dist/layout/SingleColumnLayout.vue.d.ts +1 -1
  111. package/dist/{lz-string-6DgW1cPF.js → lz-string-BAzqO9xf.js} +1 -1
  112. package/dist/menu-usage-module-Bq_KLsO4.js +74 -0
  113. package/dist/{netsuite-BSpmyaE1.js → netsuite-BhGuduqd.js} +254 -263
  114. package/dist/netsuite-explorer-9Qj7qAum.js +79 -0
  115. package/dist/{predefined-templates-C0jtb4T7.js → predefined-templates-BlRafgnc.js} +1 -1
  116. package/dist/production-run-list-DR1WsaBR.js +61 -0
  117. package/dist/{purchase-order-template-B5Pjddfi.js → purchase-order-template-By_Zxu1b.js} +1 -1
  118. package/dist/{recalculationUtils-DtJWwWSj.js → recalculationUtils-VsBar7jB.js} +1 -1
  119. package/dist/router/name.d.ts +2 -1
  120. package/dist/{row-action.enum-BDDJNSi0.js → row-action.enum-76yLYmPA.js} +1 -1
  121. package/dist/rules-fOcvgt4t.js +243 -0
  122. package/dist/{stock-BKMDvf5S.js → stock-C-dQaxY2.js} +1 -1
  123. package/dist/stock-Dh0KXA1P.js +78 -0
  124. package/dist/stores/feature.d.ts +26 -2
  125. package/dist/stores/feature.load-state.spec.d.ts +1 -0
  126. package/dist/stores/integration/netsuite.d.ts +2 -2
  127. package/dist/stores/inventory.no-location.spec.d.ts +1 -0
  128. package/dist/stores/location.d.ts +42 -42
  129. package/dist/stores/supplier.d.ts +48 -48
  130. package/dist/stores/warehouse.d.ts +2 -2
  131. package/dist/style.css +1 -1
  132. package/dist/{supplier-Cv8HRNou.js → supplier-XHHHN8vZ.js} +2 -2
  133. package/dist/{surcharge-ktE1pRyy.js → surcharge-0-oBiYoF.js} +1 -1
  134. package/dist/tsconfig.app.tsbuildinfo +1 -1
  135. package/dist/{uom-rules-DCnXmEkb.js → uom-rules-DrRuSFgM.js} +1 -1
  136. package/dist/{use-ingredient-select-dialog-CYUUVrCI.js → use-ingredient-select-dialog-mQ7aQChK.js} +2 -2
  137. package/dist/{use-inventory-binding-dialog-Dugj9i-6.js → use-inventory-binding-dialog-5Wu0ItnH.js} +2 -2
  138. package/dist/{use-template-enabled-locations-BlZ7WAqX.js → use-template-enabled-locations-CgpPMl8g.js} +2 -2
  139. package/dist/{use-transfer-locations-CUDFnsVH.js → use-transfer-locations-DZ6B7eMT.js} +14 -14
  140. package/dist/{useHrmPermission-BOwmXi9H.js → useHrmPermission-BaGxz4EV.js} +1 -1
  141. package/dist/{useNavigationMenu-CbNKFBwx.js → useNavigationMenu-CyP39v3U.js} +39 -39
  142. package/dist/{useSseClient-CdyQh47h.js → useSseClient-CaD4MVg0.js} +1 -1
  143. package/dist/views/adjustment-template/wastage-template/actions.d.ts +36 -36
  144. package/dist/views/adjustment-template/wastage-template/table.d.ts +36 -36
  145. package/dist/views/changelog/composables/use-snapshot-diff.d.ts +2 -2
  146. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.vue.d.ts +6 -6
  147. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +12 -12
  148. package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupDetailSideSheet.vue.d.ts +6 -6
  149. package/dist/views/closing-draft/composables/use-closing-draft-import.d.ts +3 -3
  150. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +19 -19
  151. package/dist/views/closing-draft/helpers/draft-status-to-class-name.helper.d.ts +1 -1
  152. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +45 -45
  153. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +36 -36
  154. package/dist/views/import/helper/submit-rows.d.ts +1 -1
  155. package/dist/views/ingredients/components/inventory-binding/recipe-amount-validation.spec.d.ts +1 -0
  156. package/dist/views/ingredients/helper/is-linked-ingredient-error.d.ts +3 -1
  157. package/dist/views/integration/IntegrationPlatformView.vue.d.ts +24 -0
  158. package/dist/views/integration/components/IntegrationCard.vue.d.ts +3 -3
  159. package/dist/views/integration/components/Synergy/importFn.spec.d.ts +1 -0
  160. package/dist/views/integration/components/Xilnex/importFn.spec.d.ts +1 -0
  161. package/dist/views/integration/components/netsuite/business/AddLocationDialog.vue.d.ts +36 -36
  162. package/dist/views/integration/components/netsuite/business/AddVendorDialog.vue.d.ts +24 -24
  163. package/dist/views/integration/helper/opening-balance.d.ts +22 -0
  164. package/dist/views/integration/helper/opening-balance.spec.d.ts +1 -0
  165. package/dist/views/production-run/ProductionRunDetailPage.spec.d.ts +1 -0
  166. package/dist/views/{integration/components/IntegrationSyncLogTab.vue.d.ts → production-run/ProductionRunDetailPage.vue.d.ts} +2 -2
  167. package/dist/views/production-run/ProductionRunPage.vue.d.ts +2 -0
  168. package/dist/views/production-run/features/detail/ProductionRunItemsTable.vue.d.ts +2 -2
  169. package/dist/views/production-run/features/detail/ProductionRunOverviewTab.vue.d.ts +4 -4
  170. package/dist/views/production-run/features/detail/use-production-run-detail.d.ts +19 -9
  171. package/dist/views/production-run/features/lifecycle/CancelRunDialog.vue.d.ts +4 -4
  172. package/dist/views/production-run/features/lifecycle/CloseRunDialog.vue.d.ts +4 -4
  173. package/dist/views/production-run/features/lifecycle/ProductionRunLifecycleDialogs.vue.d.ts +14 -14
  174. package/dist/views/production-run/features/lifecycle/TargetReachedDialog.vue.d.ts +4 -4
  175. package/dist/views/production-run/features/planning/ProductionRunFormDialog.vue.d.ts +4 -4
  176. package/dist/views/production-run/features/planning/ProductionRunPlanner.vue.d.ts +1 -1
  177. package/dist/views/production-run/features/planning/use-production-run-duplicate-sources.d.ts +6 -6
  178. package/dist/views/production-run/shared/helpers/production-run-navigation.d.ts +0 -1
  179. package/dist/views/production-run/shared/model/production-run-list.d.ts +1 -1
  180. package/dist/views/production-run/shared/ui/ProductionRunInfoBadge.vue.d.ts +1 -1
  181. package/dist/views/production-run/shared/ui/ProductionRunInfoText.vue.d.ts +1 -1
  182. package/dist/views/production-run/shared/ui/ProductionRunScrollHint.vue.d.ts +2 -2
  183. package/dist/views/production-run/shared/ui/ProductionRunTextarea.vue.d.ts +3 -3
  184. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +5 -5
  185. package/dist/views/receive-request/composables/netsuite-order-label.d.ts +11 -0
  186. package/dist/views/receive-request/composables/netsuite-order-label.spec.d.ts +1 -0
  187. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +6 -6
  188. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +48 -48
  189. package/dist/views/receive-request/composables/use-receive-request-form.spec.d.ts +1 -0
  190. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +42 -42
  191. package/dist/views/receive-request/import/export.spec.d.ts +1 -0
  192. package/dist/views/receive-request-bulk/BulkReceiveRequestPage.vue.d.ts +2 -0
  193. package/dist/views/receive-request-bulk/components/CreateTransferWizard.spec.d.ts +1 -0
  194. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.d.ts +54 -54
  195. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.readiness.spec.d.ts +1 -0
  196. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-table.d.ts +8 -8
  197. package/dist/views/recipe/components/recipe-bulk-editor/components/ModificationCard.spec.d.ts +1 -0
  198. package/dist/views/recipe/helper/import-recipe.d.ts +30 -0
  199. package/dist/views/recipe/helper/import-recipe.spec.d.ts +1 -0
  200. package/dist/views/settings/PlanLicenseDisplay.vue.d.ts +1 -14
  201. package/dist/views/stock/components/StockRecordCard.spec.d.ts +1 -0
  202. package/dist/views/stock/components/StockRecordCard.vue.d.ts +19 -865
  203. package/dist/views/stock/components/dialog/AmendAdjustmentForm.spec.d.ts +1 -0
  204. package/dist/views/stock/components/dialog/BillInventoryInfoDialog.spec.d.ts +1 -0
  205. package/dist/views/stock/components/dialog/BillInventoryInfoDialog.vue.d.ts +36 -0
  206. package/dist/views/stock/components/dialog/ConvertSkuDialog.spec.d.ts +1 -0
  207. package/dist/views/stock/composables/use-last-closing-summary.d.ts +4 -0
  208. package/dist/views/stock/composables/use-last-closing-summary.spec.d.ts +1 -0
  209. package/dist/views/supplier/components/SupplierForm.vue.d.ts +4 -4
  210. package/dist/views/supplier/composables/use-supplier-table.d.ts +2 -2
  211. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +8 -8
  212. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +4 -4
  213. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.spec.d.ts +1 -0
  214. package/dist/views/transfer-template/composables/use-template-item-bulk-editor.d.ts +24 -24
  215. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +48 -48
  216. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +48 -48
  217. package/dist/views/transfer-template/helpers/template-item.error.helper.spec.d.ts +1 -0
  218. package/dist/views/unit/composables/use-unit-form.spec.d.ts +1 -0
  219. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +4 -4
  220. package/dist/{PlanTierBadge.vue_vue_type_script_setup_true_lang-BSR_nyHY.js → vue-KHCpiw_e.js} +101 -80
  221. package/dist/{vue-i18n-dSKy66Jh.js → vue-i18n-D6btLtve.js} +513 -513
  222. package/dist/{xlsx.util-pjzuMquw.js → xlsx.util-Dr5i_LBa.js} +2 -2
  223. package/package.json +71 -66
  224. package/dist/BulkReceiveRequestView-Lakk8011.js +0 -2656
  225. package/dist/FeatureCapabilityGate-C6t1VwKD.js +0 -74
  226. package/dist/ImportView-DCcdEvy4.js +0 -1291
  227. package/dist/NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BMDjCk9T.js +0 -72
  228. package/dist/ProductionRunDetailView-C9rxLBbL.js +0 -2312
  229. package/dist/ProductionRunView-DvMdVGz1.js +0 -930
  230. package/dist/RecipeView-ByUaGc4w.js +0 -3428
  231. package/dist/StockView-B3EjdjVx.js +0 -2615
  232. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js +0 -84
  233. package/dist/TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BGPuaJlU.js +0 -299
  234. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-8ydaQEw-.js +0 -4836
  235. package/dist/TransferTemplateView-BnfALwmw.js +0 -2326
  236. package/dist/menu-usage-module-BdjYEk3s.js +0 -57
  237. package/dist/number-5ZeFx-wN.js +0 -138
  238. package/dist/rules-CinZKpvV.js +0 -98
  239. package/dist/stock-1n-4iyqz.js +0 -75
  240. package/dist/views/integration/composables/use-integration-sync-log.d.ts +0 -45
@@ -0,0 +1,2347 @@
1
+ import { defineComponent as ae, onMounted as Ve, computed as M, ref as H, watch as Fe, inject as _t, resolveComponent as E, createElementBlock as C, openBlock as S, createElementVNode as t, createVNode as u, withCtx as P, renderSlot as He, withDirectives as We, normalizeClass as oe, vModelText as Ye, reactive as Te, h as K, createCommentVNode as j, toDisplayString as F, unref as e, Fragment as re, normalizeStyle as Me, renderList as ye, createBlock as se, mergeProps as Ee, createTextVNode as ie, mergeModels as Ke, useModel as gt, isRef as tt, withModifiers as xt, Teleport as kt, normalizeProps as $t, guardReactiveProps as Ft } from "vue";
2
+ import { u as St, _ as wt } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DpwneGOV.js";
3
+ import { useI18n as pe, useCoreStore as It } from "@feedmepos/mf-common";
4
+ import { f as Tt, t as Ct, u as Se, g as Ot, a as Ge, b as Mt } from "./format-unit-display-BjTeAtgS.js";
5
+ import { R as Ze } from "./row-action.enum-76yLYmPA.js";
6
+ import { a as we, q as Vt, r as X, s as fe, u as ot, t as Et, k as xe } from "./app-VtVYHCDF.js";
7
+ import { _ as Dt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BEjFoMJJ.js";
8
+ import { components as ue, useSnackbar as At, useProxiedModel as st, useDialog as qt, useBreakpoints as Ut } from "@feedmepos/ui-library";
9
+ import { defineStore as Rt, storeToRefs as Je } from "pinia";
10
+ import { F as me } from "./form-mode.enum-BKiNVH6A.js";
11
+ import { u as Ce, I as ve, t as Xe, b as Bt, n as Pt, a as Q, c as Nt, R as ce, g as de, A as ke, M as nt, d as Lt } from "./rules-fOcvgt4t.js";
12
+ import { d as lt } from "./defineDeepModel-DKySrdwp.js";
13
+ import { _ as rt, F as at, a as it, b as dt } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-Dkx5vVap.js";
14
+ import { F as Oe, u as $e } from "./feature-VDUlSvM1.js";
15
+ import { u as De, _ as Qt } from "./netsuite-BhGuduqd.js";
16
+ import { u as zt } from "./supplier-XHHHN8vZ.js";
17
+ import { u as jt } from "./use-ingredient-select-dialog-mQ7aQChK.js";
18
+ import { _ as ut } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-gJQQKKAC.js";
19
+ import { F as le } from "./index-eGvSlWMU.js";
20
+ import { u as Ht } from "./use-template-enabled-locations-CgpPMl8g.js";
21
+ import { u as Wt } from "./use-transfer-locations-DZ6B7eMT.js";
22
+ import { _ as mt } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Ckli_nZx.js";
23
+ import { u as Yt } from "./purchase-order-template-By_Zxu1b.js";
24
+ import { _ as Kt } from "./FmConfirmationButton.vue_vue_type_script_setup_true_lang-Vg8U7WMZ.js";
25
+ import { f as Gt } from "./format-time-from-id-CfVH4LZ_.js";
26
+ import { f as ct } from "./date2-Cfb6DXM4.js";
27
+ import { u as Ie } from "./vue-i18n-D6btLtve.js";
28
+ import { t as Zt, a as Jt, d as Xt } from "./xlsx.util-Dr5i_LBa.js";
29
+ const eo = { class: "flex flex-col" }, to = { class: "flex flex-col" }, oo = { class: "flex-1" }, so = { class: "flex items-center" }, no = { class: "flex-1" }, lo = { class: "flex-1" }, pt = /* @__PURE__ */ ae({
30
+ __name: "FmMinMaxInput",
31
+ props: {
32
+ rules: {},
33
+ label: {},
34
+ minPlaceholder: {},
35
+ maxPlaceholder: {},
36
+ modelValue: {},
37
+ precision: {},
38
+ minLength: {},
39
+ maxLength: {},
40
+ inputmode: {},
41
+ type: {},
42
+ readonly: { type: Boolean },
43
+ labelMark: {},
44
+ prependIcon: {},
45
+ appendIcon: {},
46
+ showValidBorder: { type: Boolean },
47
+ labelInfo: {},
48
+ showWordCount: { type: Boolean },
49
+ invalid: { type: Boolean },
50
+ autofocus: { type: Boolean },
51
+ formatter: { type: Function },
52
+ decimal: {},
53
+ datalist: {},
54
+ shiftDatalist: { type: Boolean },
55
+ datalistMaxHeight: {},
56
+ datalistMinHeight: {},
57
+ offsetDatalist: {},
58
+ datalistPlacement: {},
59
+ datalistZIndex: {},
60
+ datalistWidth: {},
61
+ disabled: { type: Boolean },
62
+ focused: { type: Boolean },
63
+ helperText: {},
64
+ helperState: {}
65
+ },
66
+ setup($) {
67
+ const d = $, n = lt("modelValue"), r = ve();
68
+ Ve(() => {
69
+ const { min: _, max: c } = n ?? {};
70
+ if (!(!_ || !c) && _.precision !== c.precision) {
71
+ const g = Math.max(_.precision, c.precision), v = Ce(_, g), l = Ce(c, g);
72
+ n.min = v, n.max = l;
73
+ }
74
+ });
75
+ const o = M(() => {
76
+ const { min: _, max: c } = n ?? {};
77
+ return Math.max((_ == null ? void 0 : _.precision) ?? 0, (c == null ? void 0 : c.precision) ?? 0, d.precision ?? 0);
78
+ }), a = (_) => {
79
+ if (!_) return "";
80
+ const c = Bt(_), g = o.value, v = Ce(c, g);
81
+ return Pt(
82
+ +Q(v),
83
+ v.precision
84
+ );
85
+ }, h = H(a(n.min)), b = H(a(n.max));
86
+ Fe([h, b], ([_, c]) => {
87
+ const g = n ?? {}, v = r(_), l = r(c), f = o.value;
88
+ if (_ !== "" && v === !0) {
89
+ const w = Xe(+_, f);
90
+ g.min = w;
91
+ } else
92
+ g.min = null;
93
+ if (c !== "" && l === !0) {
94
+ const w = Xe(+c, f);
95
+ g.max = w;
96
+ } else
97
+ g.max = null;
98
+ n.min = g.min, n.max = g.max;
99
+ });
100
+ const T = Symbol.for("fm:form-state"), k = _t(T, null), O = M(() => d.disabled ?? (k == null ? void 0 : k.getDisabled()) ?? !1), V = H(), m = H(), s = H(!1), i = H(!1), p = M(() => s.value || i.value), D = M(() => [...[
101
+ function() {
102
+ return typeof r(h.value) == "string" || typeof r(b.value) == "string" ? "Must be a number" : !0;
103
+ },
104
+ function(g) {
105
+ return !g || !g.min || !g.max ? !0 : +Q(g.min) > +Q(g.max) ? "Min must be less than or equal to max" : !0;
106
+ }
107
+ ], ...d.rules ?? []]);
108
+ return (_, c) => {
109
+ const g = E("FmLabel"), v = E("FmField"), l = E("FmFormGroup");
110
+ return S(), C("div", eo, [
111
+ t("div", to, [
112
+ t("div", oo, [
113
+ u(g, {
114
+ label: _.label,
115
+ disabled: _.disabled,
116
+ required: _.labelMark === "required",
117
+ optional: _.labelMark === "optional"
118
+ }, null, 8, ["label", "disabled", "required", "optional"])
119
+ ]),
120
+ u(v, { focused: p.value }, {
121
+ default: P(() => [
122
+ t("div", so, [
123
+ He(_.$slots, "prepend"),
124
+ c[6] || (c[6] = t("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Min.", -1)),
125
+ t("div", no, [
126
+ We(t("input", {
127
+ type: "text",
128
+ ref_key: "minInputRef",
129
+ ref: V,
130
+ onFocus: c[0] || (c[0] = () => s.value = !0),
131
+ onBlur: c[1] || (c[1] = () => s.value = !1),
132
+ "onUpdate:modelValue": c[2] || (c[2] = (f) => h.value = f),
133
+ class: oe({
134
+ "fm-text-field--input fm-typo-en-body-lg-400": !0,
135
+ "text-fm-color-typo-primary": !O.value,
136
+ "text-fm-color-typo-disabled": O.value
137
+ })
138
+ }, null, 34), [
139
+ [Ye, h.value]
140
+ ])
141
+ ]),
142
+ c[7] || (c[7] = t("div", { class: "block h-32 mx-4 w-[1px] bg-fm-color-neutral-gray-200" }, null, -1)),
143
+ c[8] || (c[8] = t("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Max.", -1)),
144
+ t("div", lo, [
145
+ We(t("input", {
146
+ type: "text",
147
+ ref_key: "maxInputRef",
148
+ ref: m,
149
+ onFocus: c[3] || (c[3] = () => i.value = !0),
150
+ onBlur: c[4] || (c[4] = () => i.value = !1),
151
+ "onUpdate:modelValue": c[5] || (c[5] = (f) => b.value = f),
152
+ class: oe({
153
+ "fm-text-field--input fm-typo-en-body-lg-400": !0,
154
+ "text-fm-color-typo-primary": !O.value,
155
+ "text-fm-color-typo-disabled": O.value
156
+ })
157
+ }, null, 34), [
158
+ [Ye, b.value]
159
+ ])
160
+ ]),
161
+ He(_.$slots, "append")
162
+ ])
163
+ ]),
164
+ _: 3
165
+ }, 8, ["focused"])
166
+ ]),
167
+ u(l, {
168
+ class: "flex-1",
169
+ "model-value": _.modelValue,
170
+ info: _.labelInfo,
171
+ rules: D.value,
172
+ "helper-text": _.helperText,
173
+ "helper-state": _.helperState
174
+ }, null, 8, ["model-value", "info", "rules", "helper-text", "helper-state"])
175
+ ]);
176
+ };
177
+ }
178
+ });
179
+ function ft({ min: $, max: d } = { min: !0, max: !0 }) {
180
+ return function(r) {
181
+ return !r || !r.min && $ != !1 || !r.max && d != !1 ? "Required" : !0;
182
+ };
183
+ }
184
+ function yt($, d) {
185
+ return function(r) {
186
+ return !r || !r.min || !r.max ? !0 : +Q(r.min) < $ ? `Must be between ${$} and ${d}` : +Q(r.max) > d ? `Must be between ${$} and ${d}` : !0;
187
+ };
188
+ }
189
+ function vt($) {
190
+ const d = Nt($), n = Q($);
191
+ return function(o) {
192
+ const a = !(o != null && o.min) || d(o.min) === !0, h = !(o != null && o.max) || d(o.max) === !0;
193
+ return !a && !h ? `Min & max must be a multiple of ${n}` : a ? h ? !0 : `Max must be a multiple of ${n}` : `Min must be a multiple of ${n}`;
194
+ };
195
+ }
196
+ const bt = Rt("netsuite-custom-field-helper", () => {
197
+ const $ = De();
198
+ function d(n, r, o, a, h) {
199
+ var k, O, V;
200
+ if (!o) {
201
+ h == null || h("Unit is not valid");
202
+ return;
203
+ }
204
+ let b = n.code;
205
+ if (((k = n.measurement) == null ? void 0 : k.id) !== ((O = o.measurement) == null ? void 0 : O.id) && $.isEnabled) {
206
+ const m = $.getItemCustomCode(r, (V = o.measurement) == null ? void 0 : V.id);
207
+ m && (b = m);
208
+ }
209
+ a({
210
+ ...n,
211
+ quantity: o.amount,
212
+ measurement: o.measurement ?? null,
213
+ code: b
214
+ });
215
+ }
216
+ return {
217
+ validateUnitInput: d
218
+ };
219
+ });
220
+ var Z = /* @__PURE__ */ (($) => ($.Code = "Code", $.Name = "Name", $.DefaultAmount = "DefaultAmount", $.Limit = "Limit", $.Step = "Step", $.Cost = "Cost", $.Delete = "Delete", $))(Z || {});
221
+ function ro($, d = {}) {
222
+ const { t: n } = pe(), r = we(), o = $e(), a = Te({}), h = Te({}), b = (m) => m.id ?? m.sku._id, T = Te(/* @__PURE__ */ new Set()), k = bt();
223
+ Ve(() => {
224
+ for (const m of $.items) {
225
+ if (!m.totalCost)
226
+ continue;
227
+ const { cost: s } = Oe.calculateDefaultCost({
228
+ item: m.sku,
229
+ amount: m.quantity,
230
+ measurement: m.measurement,
231
+ overrides: {
232
+ supplier: $.supplier
233
+ },
234
+ defaultCurrency: Vt()
235
+ }), i = m.totalCost ?? Oe.reset();
236
+ s ? a[m.sku._id] = s.amount !== i.amount || s.precision !== i.precision : a[m.sku._id] = !0;
237
+ }
238
+ });
239
+ const O = [
240
+ {
241
+ id: "Code",
242
+ header: () => K("div", { class: "flex-col" }, [
243
+ K("div", n("inventory.transfer.form.items.table.Code")),
244
+ K(
245
+ "div",
246
+ { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
247
+ "(original code)"
248
+ )
249
+ ]),
250
+ accessorKey: "code",
251
+ size: 180,
252
+ cell(m) {
253
+ const s = m.row.original;
254
+ return K("div", [
255
+ K(ue.FmTextField, {
256
+ modelValue: s.code,
257
+ "onUpdate:modelValue": (i) => {
258
+ $.updateItem({
259
+ ...s,
260
+ code: i
261
+ });
262
+ },
263
+ helperText: s.sku.code,
264
+ key: s.sku._id,
265
+ rules: [ce()],
266
+ labelMark: "required"
267
+ })
268
+ ]);
269
+ },
270
+ enableSorting: !1
271
+ },
272
+ {
273
+ id: "Name",
274
+ header: () => K("div", { class: "flex-col" }, [
275
+ K("div", n("inventory.transfer.form.items.table.Name")),
276
+ K(
277
+ "div",
278
+ { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
279
+ "(original name)"
280
+ )
281
+ ]),
282
+ minSize: 300,
283
+ cell(m) {
284
+ const s = m.row.original;
285
+ return K("div", [
286
+ K(ue.FmTextField, {
287
+ modelValue: s.name,
288
+ "onUpdate:modelValue": (i) => {
289
+ $.updateItem({
290
+ ...s,
291
+ name: i
292
+ });
293
+ },
294
+ helperText: s.sku.name,
295
+ key: s.sku._id,
296
+ rules: [ce()],
297
+ labelMark: "required"
298
+ })
299
+ ]);
300
+ },
301
+ enableSorting: !1
302
+ },
303
+ {
304
+ id: "DefaultAmount",
305
+ header: () => n("inventory.transfer.form.items.table.DefaultAmount"),
306
+ minSize: 200,
307
+ cell(m) {
308
+ const s = m.row.original, i = r.skuById[s.sku._id], p = s.id ?? s.sku._id, D = r.unitById[i.unit._id], _ = D ?? i.unit, c = !D && !T.has(p), g = `Unit "${i.unit.name}" (${i.unit.abbrev}) no longer exists in inventory units. Please reselect unit.`, v = _.measurements.find((f) => {
309
+ var w;
310
+ return ((w = s.measurement) == null ? void 0 : w.id) === f.id;
311
+ }), l = s.sku.unit._id !== i.unit._id || c || s.measurement && !v;
312
+ return K(rt, {
313
+ style: {
314
+ flex: "1 1 0%"
315
+ },
316
+ modelValue: {
317
+ amount: s.quantity ?? { amount: 1, precision: 0 },
318
+ // NOTE: leave this reading from row.sku.unit and row.measurement instead,
319
+ measurement: c ? { ...i.unit, id: "", abbrev: "", conversion: { amount: 1, precision: 0 } } : s.measurement ?? (s.sku.unit._id !== i.unit._id ? { ...s.sku.unit, id: "", conversion: { amount: 1, precision: 0 } } : null)
320
+ },
321
+ disabled: $.disabled,
322
+ key: s.sku._id,
323
+ unit: _,
324
+ helperText: c ? g : "",
325
+ helperState: c ? "error" : "none",
326
+ "onUpdate:measurement": () => {
327
+ T.add(p);
328
+ },
329
+ "onUpdate:modelValue": (f) => {
330
+ k.validateUnitInput(
331
+ s,
332
+ i,
333
+ f,
334
+ (w) => {
335
+ $.updateItem({
336
+ ...s,
337
+ code: w.code,
338
+ quantity: w.quantity,
339
+ measurement: w.measurement
340
+ });
341
+ }
342
+ );
343
+ },
344
+ rules: [
345
+ at(s.quantityStep),
346
+ ...+Q(s.quantity) ? [
347
+ it(
348
+ +Q(
349
+ s.minimumQuantity ?? {
350
+ amount: 1,
351
+ // NOTE: leave this reading from row.sku.unit and row.measurement instead,
352
+ precision: de(s.sku.unit, s.measurement)
353
+ }
354
+ )
355
+ )
356
+ ] : [],
357
+ dt(
358
+ s.maximumQuantity ? +Q(s.maximumQuantity) : 1 / 0
359
+ ),
360
+ function(w) {
361
+ return c ? g : l ? "This item is no longer valid due to change in unit. Please reapply unit." : !0;
362
+ }
363
+ ],
364
+ applyDefaultRules: !0
365
+ });
366
+ },
367
+ enableSorting: !1
368
+ },
369
+ {
370
+ id: "Limit",
371
+ header: () => "Limit",
372
+ // TODO: i18n,
373
+ minSize: 280,
374
+ cell(m) {
375
+ const s = m.row.original;
376
+ return K(pt, {
377
+ style: {
378
+ flex: "1 1 0%"
379
+ },
380
+ modelValue: {
381
+ min: s.minimumQuantity,
382
+ max: s.maximumQuantity
383
+ },
384
+ disabled: $.disabled,
385
+ key: s.sku._id,
386
+ unit: s.sku.unit,
387
+ "onUpdate:modelValue": (i) => {
388
+ const p = { ...s };
389
+ i != null && i.min ? p.minimumQuantity = i.min : p.minimumQuantity = null, i != null && i.max ? p.maximumQuantity = i.max : p.maximumQuantity = null, $.updateItem(p);
390
+ },
391
+ rules: [
392
+ ft({ max: !1 }),
393
+ vt(s.quantityStep),
394
+ yt(
395
+ +Q({
396
+ amount: 0,
397
+ precision: de(s.sku.unit, s.measurement)
398
+ }),
399
+ 1 / 0
400
+ )
401
+ ],
402
+ disableUnit: !0,
403
+ applyDefaultRules: !0
404
+ });
405
+ }
406
+ },
407
+ {
408
+ id: "Step",
409
+ header: () => n("inventory.transfer.form.items.table.Step"),
410
+ minSize: 100,
411
+ cell(m) {
412
+ const s = m.row.original;
413
+ return K(ue.FmTextField, {
414
+ modelValue: h[b(s)] ?? Q(s.quantityStep ?? Oe.reset(), !1),
415
+ key: s.sku._id,
416
+ "onUpdate:modelValue": (i) => {
417
+ if (ve()(i) !== !0) {
418
+ h[b(s)] = i;
419
+ return;
420
+ }
421
+ delete h[b(s)], $.updateItem({
422
+ ...s,
423
+ quantityStep: fe.fromNumber(+i)
424
+ });
425
+ },
426
+ rules: [
427
+ ve(),
428
+ ke({
429
+ amount: 1,
430
+ precision: de(s.sku.unit, s.measurement)
431
+ }),
432
+ nt(s.sku.unit, s.measurement)
433
+ ]
434
+ });
435
+ },
436
+ enableSorting: !1
437
+ },
438
+ {
439
+ id: "Delete",
440
+ header: "",
441
+ cell(m) {
442
+ const s = m.row.original;
443
+ return K("div", { class: "flex items-center" }, [
444
+ o.usePurchaseOrderV2 ? K(
445
+ ue.FmTooltip,
446
+ {
447
+ zIndex: 50,
448
+ placement: "left"
449
+ },
450
+ {
451
+ default() {
452
+ return K(ue.FmButton, {
453
+ key: s.sku._id,
454
+ type: "button",
455
+ icon: "add_circle",
456
+ variant: "tertiary",
457
+ size: "md",
458
+ disabled: $.disabled,
459
+ onClick: async () => {
460
+ const i = {
461
+ id: crypto.randomUUID(),
462
+ sku: s.sku,
463
+ code: s.sku.code,
464
+ name: s.sku.name,
465
+ quantity: fe.fromNumber(1),
466
+ quantityStep: fe.fromNumber(1),
467
+ minimumQuantity: fe.fromNumber(1)
468
+ };
469
+ k.validateUnitInput(
470
+ i,
471
+ s.sku,
472
+ {
473
+ amount: i.quantity,
474
+ measurement: null
475
+ },
476
+ (p) => {
477
+ i.code = p.code;
478
+ }
479
+ ), $.duplicateItem(i);
480
+ }
481
+ });
482
+ },
483
+ content() {
484
+ return "Duplicate entry";
485
+ }
486
+ }
487
+ ) : null,
488
+ K(ue.FmButton, {
489
+ class: "delete-button",
490
+ key: s.sku._id,
491
+ type: "button",
492
+ icon: "delete",
493
+ variant: "tertiary",
494
+ size: "md",
495
+ disabled: $.disabled,
496
+ onClick: () => {
497
+ delete h[b(s)], $.deleteItem(s);
498
+ }
499
+ })
500
+ ]);
501
+ },
502
+ enableSorting: !1,
503
+ size: 40,
504
+ meta: {
505
+ cellClass: "",
506
+ headerClass: ""
507
+ }
508
+ }
509
+ ];
510
+ return {
511
+ columnDefs: M(() => {
512
+ const m = $e(), s = [...O];
513
+ if (Object.keys(d).length > 0)
514
+ for (const [i, p] of Object.entries(d))
515
+ s.splice(Number(i), 0, {
516
+ ...p,
517
+ id: i
518
+ });
519
+ return m.enableTotalCost && $.transferType === X.enum.purchase ? s : s.filter((i) => i.id !== "Cost");
520
+ })
521
+ };
522
+ }
523
+ const ao = { class: "flex flex-col gap-8 py-16" }, io = { class: "flex items-center" }, uo = { class: "flex-1 flex gap-1 items-center" }, mo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, co = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, po = { class: "flex gap-8 w-full" }, fo = { class: "flex-1 flex flex-col gap-4" }, yo = { class: "flex-1 flex flex-col gap-4" }, vo = {
524
+ key: 0,
525
+ class: "flex gap-8 w-full"
526
+ }, bo = { class: "flex-1 flex flex-col gap-4" }, ho = { class: "flex-1 flex flex-col gap-4" }, _o = { class: "flex gap-8 w-full" }, go = { class: "flex-1 flex flex-col gap-4" }, xo = /* @__PURE__ */ ae({
527
+ __name: "TransferTemplateItem",
528
+ props: {
529
+ cellByColId: {},
530
+ row: {}
531
+ },
532
+ setup($) {
533
+ const { t: d } = pe();
534
+ function n(r) {
535
+ return r;
536
+ }
537
+ return (r, o) => {
538
+ var h, b, T, k, O, V, m, s, i, p, D, _, c, g, v, l, f, w, I, R, ee, te, A, N, y, x, q, L, W, J;
539
+ const a = E("FmLabel");
540
+ return S(), C("div", ao, [
541
+ t("div", io, [
542
+ t("div", uo, [
543
+ t("span", mo, " (" + F(r.row.original.sku.code) + ") ", 1),
544
+ t("span", co, F(r.row.original.sku.name), 1)
545
+ ]),
546
+ t("div", null, [
547
+ u(e(le), {
548
+ render: (T = (b = (h = r.cellByColId.Delete) == null ? void 0 : h.column) == null ? void 0 : b.columnDef) == null ? void 0 : T.cell,
549
+ props: (O = (k = r.cellByColId.Delete) == null ? void 0 : k.getContext) == null ? void 0 : O.call(k)
550
+ }, null, 8, ["render", "props"])
551
+ ])
552
+ ]),
553
+ t("div", po, [
554
+ t("div", fo, [
555
+ u(a, {
556
+ label: e(d)(`inventory.transfer.form.items.table.${e(Z).Code}`)
557
+ }, null, 8, ["label"]),
558
+ u(e(le), {
559
+ render: (s = (m = (V = r.cellByColId[e(Z).Code]) == null ? void 0 : V.column) == null ? void 0 : m.columnDef) == null ? void 0 : s.cell,
560
+ props: (p = (i = r.cellByColId[e(Z).Code]) == null ? void 0 : i.getContext) == null ? void 0 : p.call(i)
561
+ }, null, 8, ["render", "props"]),
562
+ o[0] || (o[0] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
563
+ ]),
564
+ t("div", yo, [
565
+ u(a, {
566
+ label: e(d)(`inventory.transfer.form.items.table.${e(Z).Name}`)
567
+ }, null, 8, ["label"]),
568
+ u(e(le), {
569
+ render: (c = (_ = (D = r.cellByColId[e(Z).Name]) == null ? void 0 : D.column) == null ? void 0 : _.columnDef) == null ? void 0 : c.cell,
570
+ props: (v = (g = r.cellByColId[e(Z).Name]) == null ? void 0 : g.getContext) == null ? void 0 : v.call(g)
571
+ }, null, 8, ["render", "props"]),
572
+ o[1] || (o[1] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
573
+ ])
574
+ ]),
575
+ r.row.original ? (S(), C("div", vo, [
576
+ t("div", bo, [
577
+ u(a, {
578
+ label: e(d)(`inventory.transfer.form.items.table.${e(Z).DefaultAmount}`)
579
+ }, null, 8, ["label"]),
580
+ u(e(le), {
581
+ render: (w = (f = (l = r.cellByColId[e(Z).DefaultAmount]) == null ? void 0 : l.column) == null ? void 0 : f.columnDef) == null ? void 0 : w.cell,
582
+ props: (R = (I = r.cellByColId[e(Z).DefaultAmount]) == null ? void 0 : I.getContext) == null ? void 0 : R.call(I)
583
+ }, null, 8, ["render", "props"]),
584
+ o[2] || (o[2] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
585
+ ]),
586
+ t("div", ho, [
587
+ u(a, {
588
+ label: e(d)(`inventory.transfer.form.items.table.${e(Z).Step}`)
589
+ }, null, 8, ["label"]),
590
+ u(e(le), {
591
+ render: (A = (te = (ee = r.cellByColId[e(Z).Step]) == null ? void 0 : ee.column) == null ? void 0 : te.columnDef) == null ? void 0 : A.cell,
592
+ props: (y = (N = r.cellByColId[e(Z).Step]) == null ? void 0 : N.getContext) == null ? void 0 : y.call(N)
593
+ }, null, 8, ["render", "props"]),
594
+ o[3] || (o[3] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
595
+ ])
596
+ ])) : j("", !0),
597
+ t("div", _o, [
598
+ t("div", go, [
599
+ u(a, {
600
+ label: e(d)(`inventory.transfer.form.items.table.${e(Z).Limit}`)
601
+ }, null, 8, ["label"]),
602
+ u(e(le), {
603
+ render: (L = (q = (x = r.cellByColId[e(Z).Limit]) == null ? void 0 : x.column) == null ? void 0 : q.columnDef) == null ? void 0 : L.cell,
604
+ props: (J = (W = r.cellByColId[e(Z).Limit]) == null ? void 0 : W.getContext) == null ? void 0 : J.call(W)
605
+ }, null, 8, ["render", "props"]),
606
+ o[4] || (o[4] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
607
+ ])
608
+ ])
609
+ ]);
610
+ };
611
+ }
612
+ }), ko = { class: "fm-typo-en-body-md-400 line-clamp-2 w-full" }, $o = { key: 0 }, Fo = ["colspan"], So = /* @__PURE__ */ ae({
613
+ __name: "TransferTemplateItemTable",
614
+ props: {
615
+ row: {},
616
+ disabled: { type: Boolean },
617
+ errorMessage: {}
618
+ },
619
+ emits: ["update:item"],
620
+ setup($) {
621
+ function d(n) {
622
+ return n.column.columnDef.meta;
623
+ }
624
+ return (n, r) => (S(), C(re, null, [
625
+ t("tr", {
626
+ class: "hover:bg-fm-color-opacity-sm border-b border-fm-color-neutral-gray-100",
627
+ style: Me({ backgroundColor: n.errorMessage ? "#ffd6d6" : void 0 })
628
+ }, [
629
+ (S(!0), C(re, null, ye(n.row.getVisibleCells(), (o) => {
630
+ var a, h, b, T, k;
631
+ return S(), C("td", {
632
+ key: o.id,
633
+ class: oe(["text-fm-color-typo-primary", ((a = d(o)) == null ? void 0 : a.cellClass) ?? "px-16", "py-2"]),
634
+ style: Me({
635
+ width: (h = d(o)) != null && h.width ? (b = d(o)) == null ? void 0 : b.width : o.column.getSize() !== 0 ? `${o.column.getSize()}px` : void 0,
636
+ maxWidth: (T = d(o)) == null ? void 0 : T.maxWidth,
637
+ textAlign: ((k = d(o)) == null ? void 0 : k.textAlign) ?? "left"
638
+ })
639
+ }, [
640
+ t("span", ko, [
641
+ u(e(le), {
642
+ props: o.getContext(),
643
+ render: o.column.columnDef.cell
644
+ }, null, 8, ["props", "render"])
645
+ ])
646
+ ], 6);
647
+ }), 128))
648
+ ], 4),
649
+ n.errorMessage ? (S(), C("tr", $o, [
650
+ t("td", {
651
+ colspan: n.row.getVisibleCells().length,
652
+ class: "text-red-600 px-16 py-2"
653
+ }, F(n.errorMessage), 9, Fo)
654
+ ])) : j("", !0)
655
+ ], 64));
656
+ }
657
+ }), wo = { class: "flex flex-col gap-16" }, Io = { class: "flex flex-col gap-24" }, To = { class: "flex flex-col gap-16" }, Co = { class: "flex items-center" }, Oo = { class: "flex flex-col" }, Mo = { class: "flex flex-col gap-16" }, Vo = { class: "flex gap-3" }, Eo = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, Do = {
658
+ key: 0,
659
+ class: "border rounded-sm px-8 py-2 bg-fm-color-system-warning-100 fm-typo-en-body-lg-400"
660
+ }, Ao = { class: "border rounded-sm px-8 py-2 bg-fm-color-system-info-100 fm-typo-en-body-lg-400" }, qo = { class: "mb-2" }, Uo = /* @__PURE__ */ ae({
661
+ __name: "TransferTemplateForm",
662
+ props: {
663
+ modelValue: {},
664
+ disabled: { type: Boolean }
665
+ },
666
+ emits: ["update:disabled"],
667
+ setup($, { expose: d, emit: n }) {
668
+ const r = $, o = n, a = lt(), { t: h } = pe(), b = H({}), T = ot(), k = we(), O = zt(), V = $e(), m = De(), s = bt();
669
+ Fe(
670
+ () => a.purchaseOrder.items.length,
671
+ () => {
672
+ b.value = {};
673
+ }
674
+ ), T.watchLocation(async () => {
675
+ location && (a.purchaseOrder.supplier || (a.purchaseOrder.supplier = O.suppliers.find((y) => y) ?? a.purchaseOrder.supplier));
676
+ });
677
+ const i = Wt(
678
+ () => a.purchaseOrder,
679
+ (y) => {
680
+ a.purchaseOrder = {
681
+ ...a.purchaseOrder,
682
+ supplier: y.supplier ?? (a == null ? void 0 : a.purchaseOrder.supplier)
683
+ };
684
+ }
685
+ ), p = M({
686
+ get() {
687
+ var y, x;
688
+ return typeof ((x = (y = a.purchaseOrder) == null ? void 0 : y.supplier) == null ? void 0 : x.internal) == "string" ? X.enum.transfer : X.enum.purchase;
689
+ },
690
+ set(y) {
691
+ var q, L;
692
+ const x = typeof ((L = (q = a.purchaseOrder) == null ? void 0 : q.supplier) == null ? void 0 : L.internal) == "string" ? X.enum.transfer : X.enum.purchase;
693
+ y !== x && (a.purchaseOrder.supplier = y === X.enum.purchase ? i.locationOptionsTypePurchase.value[0] : i.locationOptionsTypeTransfer.value[0]);
694
+ }
695
+ }), D = M(() => i.transferLocationOptions.value), _ = M({
696
+ get() {
697
+ var y;
698
+ return (y = a.purchaseOrder.supplier) == null ? void 0 : y._id;
699
+ },
700
+ set(y) {
701
+ i.transferLocationModel.value = y;
702
+ }
703
+ });
704
+ async function c() {
705
+ const y = await m.checkCustomFieldCodes({
706
+ beforeStart: async () => {
707
+ o("update:disabled", !0);
708
+ },
709
+ templateItems: a.purchaseOrder.items
710
+ });
711
+ b.value = y, o("update:disabled", !1);
712
+ }
713
+ const {
714
+ promptSelectLocations: g,
715
+ columnDefs: v,
716
+ rowData: l
717
+ } = Ht({
718
+ getLocations() {
719
+ return a.locations;
720
+ },
721
+ setLocations(y) {
722
+ a.locations = y;
723
+ }
724
+ });
725
+ function f() {
726
+ var y, x;
727
+ return (y = a.locations) != null && y.find((q) => {
728
+ var L, W;
729
+ return ((L = q.doc) == null ? void 0 : L._id) === ((W = a.purchaseOrder.supplier) == null ? void 0 : W._id);
730
+ }) ? `Location ${(x = a.purchaseOrder.supplier) == null ? void 0 : x.name} must be removed because template cannot be used to transfer to itself.` : !0;
731
+ }
732
+ const w = M({
733
+ get() {
734
+ return a.purchaseOrder.remark ?? void 0;
735
+ },
736
+ set(y) {
737
+ a.purchaseOrder.remark = y;
738
+ }
739
+ }), I = H();
740
+ d({
741
+ validateInputs: () => {
742
+ var y, x;
743
+ (x = (y = I.value) == null ? void 0 : y.validateInputs) == null || x.call(y);
744
+ },
745
+ resetInputsValidation: () => {
746
+ var y, x;
747
+ (x = (y = I.value) == null ? void 0 : y.resetInputsValidation) == null || x.call(y);
748
+ },
749
+ resetInputs: () => {
750
+ var y, x;
751
+ (x = (y = I.value) == null ? void 0 : y.resetInputs) == null || x.call(y);
752
+ }
753
+ });
754
+ const R = M(() => ({
755
+ duplicateItem: (y) => {
756
+ a.purchaseOrder.items = [
757
+ ...a.purchaseOrder.items,
758
+ {
759
+ ...y
760
+ }
761
+ ];
762
+ },
763
+ updateItem: (y) => {
764
+ let x = [];
765
+ y.id ? x = a.purchaseOrder.items.map((q) => q.id !== y.id ? q : y) : x = a.purchaseOrder.items.map((q) => q.sku._id !== y.sku._id ? q : y), a.purchaseOrder.items = x;
766
+ },
767
+ deleteItem: (y) => {
768
+ console.log(y.id);
769
+ let x = [];
770
+ y.id ? x = a.purchaseOrder.items.filter((q) => q.id !== y.id) : x = a.purchaseOrder.items.filter((q) => q.sku._id !== y.sku._id), a.purchaseOrder.items = x;
771
+ }
772
+ })), ee = ro(
773
+ {
774
+ duplicateItem: R.value.duplicateItem,
775
+ updateItem: R.value.updateItem,
776
+ deleteItem: R.value.deleteItem,
777
+ get supplier() {
778
+ return a.purchaseOrder.supplier;
779
+ },
780
+ get items() {
781
+ return a.purchaseOrder.items;
782
+ },
783
+ get transferType() {
784
+ return X.enum.purchase;
785
+ },
786
+ get disabled() {
787
+ return r.disabled;
788
+ }
789
+ },
790
+ m.transferTemplateColumnDefs({
791
+ onUpdate: (y, x, q, L) => {
792
+ if (y < 0 || y >= a.purchaseOrder.items.length) return;
793
+ const W = a.purchaseOrder.items[y];
794
+ W && R.value.updateItem({
795
+ ...W,
796
+ sku: x,
797
+ // Sku might be outdated, so we need to update it
798
+ code: q,
799
+ measurement: L
800
+ });
801
+ }
802
+ })
803
+ ), te = M(() => ee.columnDefs.value), { promptSelectIngredients: A } = jt();
804
+ async function N() {
805
+ const x = k.skus.map((B) => ({
806
+ label: B.name,
807
+ sublabel: B.code,
808
+ value: B
809
+ })).filter((B) => {
810
+ var z;
811
+ return (z = a.purchaseOrder.items) == null ? void 0 : z.find((G) => G.sku._id === B.value._id);
812
+ }).map((B) => B.value), q = a.purchaseOrder.items ?? [], L = await A(
813
+ x.map((B) => B._id),
814
+ (B) => {
815
+ const z = k.skuById[B], G = q.find((Y) => Y.sku._id === z._id);
816
+ if (G)
817
+ return G;
818
+ const ne = { amount: 1, precision: de(z.unit) };
819
+ let U = {
820
+ id: V.usePurchaseOrderV2 ? crypto.randomUUID() : void 0,
821
+ sku: z,
822
+ code: z.code,
823
+ name: z.name,
824
+ quantity: ne,
825
+ minimumQuantity: ne,
826
+ // maximumQuantity: adjustmentAmountMultiplyDecimal(minimumQuantity, {
827
+ // amount: 100,
828
+ // precision: 0
829
+ // }),
830
+ quantityStep: ne
831
+ };
832
+ return s.validateUnitInput(
833
+ U,
834
+ z,
835
+ {
836
+ amount: ne,
837
+ measurement: null
838
+ },
839
+ (Y) => {
840
+ U.code = Y.code;
841
+ }
842
+ ), U;
843
+ }
844
+ );
845
+ if (!L) return;
846
+ const W = L.map((B) => B.sku._id), J = [];
847
+ for (const B of W) {
848
+ const z = q.filter((G) => G.sku._id === B);
849
+ if (z.length > 0)
850
+ J.push(...z);
851
+ else {
852
+ const G = L.find((ne) => ne.sku._id === B);
853
+ G && J.push(G);
854
+ }
855
+ }
856
+ J.sort((B, z) => B.sku.code.localeCompare(z.sku.code)), a.purchaseOrder.items = J;
857
+ }
858
+ return (y, x) => {
859
+ const q = E("FmTextField"), L = E("FmSelect"), W = E("FmTextarea"), J = E("FmButton"), B = E("FmTable"), z = E("FmFormGroup"), G = E("FmForm");
860
+ return S(), se(G, {
861
+ ref_key: "formRef",
862
+ ref: I,
863
+ class: "flex flex-col gap-32",
864
+ disabled: y.disabled
865
+ }, {
866
+ default: P(() => {
867
+ var ne;
868
+ return [
869
+ t("div", wo, [
870
+ t("div", Io, [
871
+ u(q, {
872
+ label: e(h)("inventory.transfer.form.name"),
873
+ "label-mark": "required",
874
+ modelValue: e(a).name,
875
+ "onUpdate:modelValue": x[0] || (x[0] = (U) => e(a).name = U),
876
+ rules: [e(ce)()]
877
+ }, null, 8, ["label", "modelValue", "rules"]),
878
+ u(L, {
879
+ label: e(h)("inventory.transfer.form.type.title"),
880
+ "model-value": p.value,
881
+ "onUpdate:modelValue": x[1] || (x[1] = (U) => p.value = U),
882
+ items: [
883
+ {
884
+ label: e(h)("inventory.transfer.form.type.purchase"),
885
+ value: e(X).enum.purchase,
886
+ disabled: !e(i).locationOptionsTypePurchase.value.length,
887
+ sublabel: e(i).locationOptionsTypePurchase.value.length ? void 0 : e(h)("inventory.transfer.form.noSupplierAvailable")
888
+ },
889
+ {
890
+ label: e(h)("inventory.transfer.form.type.transfer"),
891
+ value: e(X).enum.transfer,
892
+ disabled: !e(i).locationOptionsTypeTransfer.value.length,
893
+ sublabel: e(i).locationOptionsTypeTransfer.value.length ? void 0 : e(h)("inventory.transfer.form.noLocationAvailable")
894
+ }
895
+ ],
896
+ rules: [e(ke)(1)(D.value)]
897
+ }, {
898
+ default: P(() => [
899
+ t("span", {
900
+ class: oe([
901
+ "line-clamp-1 fm-typo-en-body-lg-400",
902
+ y.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
903
+ ])
904
+ }, F(e(Et)(p.value)), 3)
905
+ ]),
906
+ _: 1
907
+ }, 8, ["label", "model-value", "items", "rules"]),
908
+ u(L, {
909
+ label: p.value === e(X).enum.purchase ? e(h)("inventory.transfer.form.purchaseFrom") : e(h)("inventory.transfer.form.transferFrom"),
910
+ modelValue: _.value,
911
+ "onUpdate:modelValue": x[2] || (x[2] = (U) => _.value = U),
912
+ items: D.value
913
+ }, {
914
+ "menu-wrapper": P((U) => {
915
+ var Y;
916
+ return [
917
+ u(mt, Ee(U, {
918
+ items: D.value,
919
+ "model-value": (Y = y.modelValue.purchaseOrder.supplier) == null ? void 0 : Y._id
920
+ }), null, 16, ["items", "model-value"])
921
+ ];
922
+ }),
923
+ default: P(() => {
924
+ var U;
925
+ return [
926
+ t("span", {
927
+ class: oe([
928
+ "line-clamp-1 fm-typo-en-body-lg-400",
929
+ y.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
930
+ ])
931
+ }, F((U = D.value.find((Y) => Y.value === _.value)) == null ? void 0 : U.label), 3)
932
+ ];
933
+ }),
934
+ _: 1
935
+ }, 8, ["label", "modelValue", "items"]),
936
+ u(q, {
937
+ label: e(h)("inventory.transfer.form.reference"),
938
+ "label-mark": "optional",
939
+ modelValue: e(a).purchaseOrder.ref,
940
+ "onUpdate:modelValue": x[3] || (x[3] = (U) => e(a).purchaseOrder.ref = U)
941
+ }, null, 8, ["label", "modelValue"]),
942
+ u(W, {
943
+ label: e(h)("inventory.transfer.form.remark"),
944
+ "label-mark": "optional",
945
+ "max-length": 240,
946
+ modelValue: w.value,
947
+ "onUpdate:modelValue": x[4] || (x[4] = (U) => w.value = U),
948
+ class: oe({ "text-fm-color-typo-disabled": y.disabled })
949
+ }, null, 8, ["label", "modelValue", "class"])
950
+ ])
951
+ ]),
952
+ t("div", To, [
953
+ t("div", Co, [
954
+ x[8] || (x[8] = t("div", { class: "flex-1 fm-typo-en-title-sm-600" }, "Locations", -1)),
955
+ u(J, {
956
+ disabled: y.disabled,
957
+ label: "Select location",
958
+ "prepend-icon": "add",
959
+ variant: "plain",
960
+ class: "border-2 rounded-lg border-fm-color-primary",
961
+ onClick: e(g)
962
+ }, null, 8, ["disabled", "onClick"])
963
+ ]),
964
+ u(B, {
965
+ "column-defs": e(v),
966
+ "row-data": e(l),
967
+ "shrink-at": 9999,
968
+ onRowClick: e(g),
969
+ "hide-footer": ""
970
+ }, null, 8, ["column-defs", "row-data", "onRowClick"]),
971
+ t("div", Oo, [
972
+ u(z, {
973
+ "model-value": [
974
+ (ne = r.modelValue.purchaseOrder.supplier) == null ? void 0 : ne._id,
975
+ ...r.modelValue.locations ?? []
976
+ ].join(","),
977
+ rules: [f]
978
+ }, null, 8, ["model-value", "rules"])
979
+ ])
980
+ ]),
981
+ t("div", Mo, [
982
+ t("div", Vo, [
983
+ t("div", Eo, F(e(h)("inventory.transfer.form.items.title")), 1),
984
+ e(m).isEnabled ? (S(), se(J, {
985
+ key: 0,
986
+ label: "Check NetSuite",
987
+ "prepend-icon": "troubleshoot",
988
+ variant: "secondary",
989
+ onClick: c,
990
+ size: "md"
991
+ })) : j("", !0),
992
+ u(J, {
993
+ disabled: y.disabled,
994
+ label: e(h)("inventory.transfer.form.items.addItem"),
995
+ "prepend-icon": "add",
996
+ variant: "plain",
997
+ class: "border-2 rounded-lg border-fm-color-primary",
998
+ onClick: x[5] || (x[5] = (U) => N()),
999
+ size: "md"
1000
+ }, null, 8, ["disabled", "label"])
1001
+ ]),
1002
+ e(m).isEnabled ? (S(), C("div", Do, x[9] || (x[9] = [
1003
+ ie(" NetSuite is enabled. "),
1004
+ t("ul", { style: { "list-style": "initial", "margin-left": "20px" } }, [
1005
+ t("li", null, ' When adding new item or changing UOM, the first match available custom code (if any) will be applied to "Code" for each item by default. '),
1006
+ t("li", null, ' You can also choose to change the code by selecting from the "NetSuite" button in each row. ')
1007
+ ], -1),
1008
+ t("p", { class: "fm-typo-en-body-lg-600 mt-2" }, " If you use custom code for certain items, please make sure that the custom code is correct before saving the template. ", -1)
1009
+ ]))) : j("", !0),
1010
+ t("div", Ao, [
1011
+ t("p", qo, [
1012
+ ie(' Set "' + F(e(h)("inventory.transfer.form.items.table.DefaultAmount")) + '" to "0" to mark the item as ', 1),
1013
+ x[10] || (x[10] = t("b", null, "optional", -1)),
1014
+ x[11] || (x[11] = ie(" when creating an order request. "))
1015
+ ]),
1016
+ x[12] || (x[12] = t("p", null, ' You can leave "Max" empty to remove the limit on the maximum quantity of the item when creating an order request. ', -1))
1017
+ ]),
1018
+ (S(), se(B, {
1019
+ "column-defs": te.value,
1020
+ "row-data": e(a).purchaseOrder.items,
1021
+ key: e(a).purchaseOrder.items.map((U) => U.sku._id).join("."),
1022
+ "hide-footer": "",
1023
+ "page-size": e(a).purchaseOrder.items.length
1024
+ }, {
1025
+ "table-row": P((U) => [
1026
+ u(So, {
1027
+ row: U,
1028
+ errorMessage: b.value[U.index],
1029
+ "onUpdate:item": x[6] || (x[6] = (Y) => R.value.updateItem(Y)),
1030
+ disabled: y.disabled
1031
+ }, null, 8, ["row", "errorMessage", "disabled"])
1032
+ ]),
1033
+ "list-row": P((U) => [
1034
+ (S(), se(ut, {
1035
+ row: U,
1036
+ key: e(a).purchaseOrder.items.map((Y) => Y.sku._id).join(".")
1037
+ }, {
1038
+ default: P((Y) => [
1039
+ u(xo, {
1040
+ row: U,
1041
+ "cell-by-col-id": Y,
1042
+ "onUpdate:item": x[7] || (x[7] = (be) => R.value.updateItem(be)),
1043
+ disabled: y.disabled
1044
+ }, null, 8, ["row", "cell-by-col-id", "disabled"])
1045
+ ]),
1046
+ _: 2
1047
+ }, 1032, ["row"]))
1048
+ ]),
1049
+ _: 1
1050
+ }, 8, ["column-defs", "row-data", "page-size"])),
1051
+ u(z, {
1052
+ "model-value": e(a).purchaseOrder.items.length,
1053
+ rules: [e(ke)(1)]
1054
+ }, null, 8, ["model-value", "rules"])
1055
+ ])
1056
+ ];
1057
+ }),
1058
+ _: 1
1059
+ }, 8, ["disabled"]);
1060
+ };
1061
+ }
1062
+ }), Ro = { class: "flex items-center" }, Bo = { class: "fm-typo-en-title-md-800" }, Po = { class: "flex gap-4" }, No = /* @__PURE__ */ ae({
1063
+ __name: "TransferTemplateDialog",
1064
+ props: /* @__PURE__ */ Ke({
1065
+ mode: {},
1066
+ modelValue: {},
1067
+ show: { type: Boolean }
1068
+ }, {
1069
+ disabled: { type: Boolean },
1070
+ disabledModifiers: {}
1071
+ }),
1072
+ emits: /* @__PURE__ */ Ke(["update:show", "submitted"], ["update:disabled"]),
1073
+ setup($, { expose: d, emit: n }) {
1074
+ var g;
1075
+ const r = $, o = n, a = Yt(), h = At(), { t: b } = pe(), T = st(r, "show");
1076
+ function k() {
1077
+ return {
1078
+ _id: "",
1079
+ name: "",
1080
+ purchaseOrder: {
1081
+ remark: void 0,
1082
+ ref: void 0,
1083
+ items: [],
1084
+ supplier: {
1085
+ _rev: void 0,
1086
+ email: void 0,
1087
+ internal: void 0,
1088
+ contactName: void 0,
1089
+ phoneNumber: void 0,
1090
+ registrationNumber: void 0,
1091
+ supplyItems: void 0,
1092
+ _id: "",
1093
+ name: "",
1094
+ address: {
1095
+ line2: void 0,
1096
+ line1: "",
1097
+ state: "",
1098
+ city: "",
1099
+ postcode: "",
1100
+ country: ""
1101
+ }
1102
+ }
1103
+ }
1104
+ };
1105
+ }
1106
+ const O = H(r.modelValue ?? k()), V = H(((g = r.modelValue) == null ? void 0 : g._id) ?? `${Math.random()}`);
1107
+ Fe(
1108
+ () => r.show,
1109
+ (v) => {
1110
+ var l;
1111
+ v && (O.value = r.modelValue ?? k(), V.value = `${((l = r.modelValue) == null ? void 0 : l._id) ?? ""}-${Math.random()}`);
1112
+ }
1113
+ );
1114
+ const m = gt($, "disabled"), s = M(() => {
1115
+ switch (r.mode) {
1116
+ case me.READ:
1117
+ return "";
1118
+ case me.CREATE:
1119
+ return b("inventory.transfer.template.create.title");
1120
+ case me.UPDATE:
1121
+ return b("inventory.transfer.template.update.title");
1122
+ }
1123
+ return "";
1124
+ }), i = H();
1125
+ d({
1126
+ validateInputs: () => {
1127
+ var v, l;
1128
+ (l = (v = i.value) == null ? void 0 : v.validateInputs) == null || l.call(v);
1129
+ },
1130
+ resetInputsValidation: () => {
1131
+ var v, l;
1132
+ (l = (v = i.value) == null ? void 0 : v.resetInputsValidation) == null || l.call(v);
1133
+ },
1134
+ resetInputs: () => {
1135
+ var v, l;
1136
+ (l = (v = i.value) == null ? void 0 : v.resetInputs) == null || l.call(v);
1137
+ }
1138
+ });
1139
+ async function p() {
1140
+ var l, f;
1141
+ const v = O.value;
1142
+ if (v) {
1143
+ m.value = !0, (((l = v.purchaseOrder.supplier) == null ? void 0 : l.internal) === xe.enum.warehouse || ((f = v.purchaseOrder.supplier) == null ? void 0 : f.internal) === xe.enum.restaurant) && (v.purchaseOrder.items = v.purchaseOrder.items.map(
1144
+ ({ totalCost: w, ...I }) => I
1145
+ ));
1146
+ try {
1147
+ await a.createTemplate(v), await new Promise((w) => setTimeout(w, 1e3)), h.open({
1148
+ title: b("inventory.transfer.template.create.success"),
1149
+ message: b("inventory.transfer.template.create.successMessage"),
1150
+ type: "success"
1151
+ }), o("update:show", !1), o("submitted");
1152
+ } catch (w) {
1153
+ h.open({
1154
+ title: b("inventory.transfer.template.create.error"),
1155
+ message: b("inventory.transfer.template.create.errorMessage"),
1156
+ type: "error"
1157
+ }), console.error("Error in creating transfer template", w);
1158
+ } finally {
1159
+ m.value = !1;
1160
+ }
1161
+ }
1162
+ }
1163
+ async function D() {
1164
+ var l, f;
1165
+ const v = O.value;
1166
+ if (v) {
1167
+ m.value = !0, (((l = v.purchaseOrder.supplier) == null ? void 0 : l.internal) === xe.enum.warehouse || ((f = v.purchaseOrder.supplier) == null ? void 0 : f.internal) === xe.enum.restaurant) && (v.purchaseOrder.items = v.purchaseOrder.items.map(
1168
+ ({ totalCost: w, ...I }) => I
1169
+ ));
1170
+ try {
1171
+ await a.updateTemplate(v), await new Promise((w) => setTimeout(w, 1e3)), h.open({
1172
+ title: b("inventory.transfer.template.update.success"),
1173
+ message: b("inventory.transfer.template.update.successMessage"),
1174
+ type: "success"
1175
+ }), o("update:show", !1), o("submitted");
1176
+ } catch (w) {
1177
+ h.open({
1178
+ title: b("inventory.transfer.template.update.error"),
1179
+ message: b("inventory.transfer.template.update.errorMessage"),
1180
+ type: "error"
1181
+ }), console.error("Error in updating transfer template", w);
1182
+ } finally {
1183
+ m.value = !1;
1184
+ }
1185
+ }
1186
+ }
1187
+ function _() {
1188
+ switch (r.mode) {
1189
+ case me.CREATE:
1190
+ return p();
1191
+ case me.UPDATE:
1192
+ return D();
1193
+ }
1194
+ }
1195
+ function c() {
1196
+ var v, l;
1197
+ (l = (v = i.value) == null ? void 0 : v.validateInputs) == null || l.call(v);
1198
+ }
1199
+ return (v, l) => {
1200
+ const f = E("FmButton"), w = E("FmSideSheet");
1201
+ return S(), se(w, {
1202
+ modelValue: e(T),
1203
+ "onUpdate:modelValue": l[3] || (l[3] = (I) => tt(T) ? T.value = I : null),
1204
+ "dismiss-away": "",
1205
+ "close-button": "",
1206
+ "max-width": 1600
1207
+ }, {
1208
+ "side-sheet-header": P(() => [
1209
+ t("div", Ro, [
1210
+ t("div", Bo, F(s.value), 1)
1211
+ ])
1212
+ ]),
1213
+ default: P(() => [
1214
+ (S(), se(Uo, {
1215
+ class: "w-full",
1216
+ ref_key: "formRef",
1217
+ ref: i,
1218
+ onValidationSuccess: _,
1219
+ "model-value": O.value,
1220
+ "onUpdate:modelValue": l[0] || (l[0] = (I) => O.value = I),
1221
+ disabled: m.value,
1222
+ "onUpdate:disabled": l[1] || (l[1] = (I) => m.value = I),
1223
+ key: V.value
1224
+ }, null, 8, ["model-value", "disabled"]))
1225
+ ]),
1226
+ "side-sheet-footer": P(() => [
1227
+ t("div", Po, [
1228
+ u(Kt, {
1229
+ loading: m.value,
1230
+ label: e(b)("common.save"),
1231
+ "confirm-title": `Save ${r.mode === e(me).CREATE ? "Template" : "Changes"}`,
1232
+ onConfirm: c
1233
+ }, {
1234
+ "dialog-content": P(() => l[4] || (l[4] = [
1235
+ t("div", { class: "fm-typo-en-body-md-400 bg-fm-color-primary-oats p-8 rounded" }, [
1236
+ ie(" Warning: This action "),
1237
+ t("span", { class: "text-fm-color-system-error-300" }, "will not"),
1238
+ ie(" create or update any order request, but only a template. ")
1239
+ ], -1)
1240
+ ])),
1241
+ _: 1
1242
+ }, 8, ["loading", "label", "confirm-title"]),
1243
+ u(f, {
1244
+ disabled: m.value,
1245
+ variant: "tertiary",
1246
+ label: e(b)("common.close"),
1247
+ onClick: l[2] || (l[2] = (I) => o("update:show", !1))
1248
+ }, null, 8, ["disabled", "label"])
1249
+ ])
1250
+ ]),
1251
+ _: 1
1252
+ }, 8, ["modelValue"]);
1253
+ };
1254
+ }
1255
+ }), Lo = { class: "flex flex-col gap-16 w-full h-full overflow-y-auto" }, Qo = { class: "flex justify-between" }, zo = { class: "fm-typo-en-body-lg-600" }, jo = { class: "fm-status-badge fm-status-badge-info-secondary" }, Ho = { class: "flex flex-col gap-8" }, Wo = { class: "flex flex-col gap-4" }, Yo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ko = { class: "flex gap-1" }, Go = { class: "fm-typo-en-body-lg-600" }, Zo = {
1256
+ key: 0,
1257
+ class: "flex flex-col gap-4"
1258
+ }, Jo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Xo = { class: "flex gap-1" }, es = { class: "fm-typo-en-body-lg-600" }, ts = {
1259
+ key: 1,
1260
+ class: "flex flex-col gap-4"
1261
+ }, os = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ss = { class: "fm-typo-en-body-lg-600" }, ns = {
1262
+ key: 2,
1263
+ class: "flex flex-col gap-4"
1264
+ }, ls = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, rs = { class: "fm-typo-en-body-lg-600" }, as = {
1265
+ key: 3,
1266
+ class: "flex flex-col gap-4"
1267
+ }, is = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ds = { class: "fm-typo-en-body-lg-600" }, us = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, ms = { class: "flex flex-col gap-8" }, cs = { class: "fm-typo-en-body-lg-600" }, ps = { class: "flex w-full gap-4" }, fs = { class: "grow fm-typo-en-body-lg-400 line-clamp-2" }, ys = { class: "fm-typo-en-body-lg-600 shrink-0" }, vs = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, bs = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, hs = {
1268
+ key: 0,
1269
+ class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1270
+ }, _s = {
1271
+ key: 0,
1272
+ class: "flex gap-4 items-center"
1273
+ }, gs = { class: "flex flex-col gap-12" }, xs = { class: "flex flex-col gap-8" }, ks = { class: "flex gap-8 xs:flex-col" }, $s = /* @__PURE__ */ ae({
1274
+ __name: "TransferTemplateDetails",
1275
+ props: {
1276
+ template: {},
1277
+ show: { type: Boolean }
1278
+ },
1279
+ emits: ["update:show", "action:edit"],
1280
+ setup($, { emit: d }) {
1281
+ const n = $, r = d, o = $e(), { t: a } = pe(), h = M(() => {
1282
+ var m;
1283
+ return (m = n.template) == null ? void 0 : m.purchaseOrder;
1284
+ }), b = [
1285
+ { accessorKey: "name", header: () => "Name" },
1286
+ { accessorKey: "type", header: () => "Type" }
1287
+ ], T = H(""), k = M(
1288
+ () => {
1289
+ var m, s, i, p;
1290
+ return ((s = (m = h.value) == null ? void 0 : m.supplier) == null ? void 0 : s.internal) === "restaurant" || ((p = (i = h.value) == null ? void 0 : i.supplier) == null ? void 0 : p.internal) === "warehouse" ? X.enum.transfer : X.enum.purchase;
1291
+ }
1292
+ ), O = H(!0), V = st(n, "show");
1293
+ return (m, s) => {
1294
+ var l;
1295
+ const i = E("FmMenuDivider"), p = E("FmCard"), D = E("FmIcon"), _ = E("FmTextField"), c = E("FmTable"), g = E("FmButton"), v = E("FmSideSheet");
1296
+ return S(), se(v, {
1297
+ header: e(a)("inventory.transfer.template.details.view", { template: (l = m.template) == null ? void 0 : l.name }),
1298
+ modelValue: e(V),
1299
+ "onUpdate:modelValue": s[2] || (s[2] = (f) => tt(V) ? V.value = f : null),
1300
+ "dismiss-away": O.value,
1301
+ "close-button": "",
1302
+ "max-width": 1200
1303
+ }, {
1304
+ default: P(() => {
1305
+ var f, w;
1306
+ return [
1307
+ t("div", Lo, [
1308
+ t("div", null, [
1309
+ u(p, {
1310
+ variant: "outlined",
1311
+ class: "flex flex-col gap-8 px-12 py-16"
1312
+ }, {
1313
+ default: P(() => {
1314
+ var I, R, ee, te, A, N, y, x, q;
1315
+ return [
1316
+ t("div", Qo, [
1317
+ t("div", zo, F(e(a)("inventory.transfer.template.details.templateSummary")), 1),
1318
+ t("div", jo, F(e(a)(
1319
+ `inventory.transfer.receiveRequest.details.type.${k.value.toLocaleLowerCase("en-US")}`
1320
+ )), 1)
1321
+ ]),
1322
+ u(i),
1323
+ t("div", Ho, [
1324
+ t("div", Wo, [
1325
+ t("div", Yo, [
1326
+ t("div", Ko, F(e(a)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1327
+ ]),
1328
+ t("div", Go, F(e(Gt)(((I = m.template) == null ? void 0 : I._id) ?? "")), 1)
1329
+ ]),
1330
+ (R = m.template) != null && R.updatedAt ? (S(), C("div", Zo, [
1331
+ t("div", Jo, [
1332
+ t("div", Xo, F(e(a)("inventory.transfer.receiveRequest.details.updatedAt")), 1)
1333
+ ]),
1334
+ t("div", es, [
1335
+ ie(F(e(ct)(new Date(m.template.updatedAt))) + " ", 1),
1336
+ (ee = m.template.updatedBy) != null && ee.name ? (S(), C(re, { key: 0 }, [
1337
+ ie(" (" + F(m.template.updatedBy.name) + ") ", 1)
1338
+ ], 64)) : j("", !0)
1339
+ ])
1340
+ ])) : j("", !0),
1341
+ (A = (te = h.value) == null ? void 0 : te.supplier) != null && A.name ? (S(), C("div", ts, [
1342
+ t("div", os, F(e(a)("inventory.transfer.receiveRequest.details.from")), 1),
1343
+ t("div", ss, F((y = (N = h.value) == null ? void 0 : N.supplier) == null ? void 0 : y.name), 1)
1344
+ ])) : j("", !0),
1345
+ (x = h.value) != null && x.ref ? (S(), C("div", ns, [
1346
+ t("div", ls, F(e(a)("inventory.transfer.receiveRequest.details.reference")), 1),
1347
+ t("div", rs, F(h.value.ref), 1)
1348
+ ])) : j("", !0),
1349
+ (q = h.value) != null && q.remark ? (S(), C("div", as, [
1350
+ t("div", is, F(e(a)("inventory.transfer.receiveRequest.details.remark")), 1),
1351
+ t("div", ds, F(h.value.remark), 1)
1352
+ ])) : j("", !0)
1353
+ ])
1354
+ ];
1355
+ }),
1356
+ _: 1
1357
+ })
1358
+ ]),
1359
+ t("div", us, [
1360
+ t("div", ms, [
1361
+ t("div", cs, F(e(a)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
1362
+ (S(!0), C(re, null, ye(((f = h.value) == null ? void 0 : f.items) ?? [], (I) => (S(), C("div", {
1363
+ key: I.code,
1364
+ class: "flex flex-col"
1365
+ }, [
1366
+ t("div", ps, [
1367
+ t("div", fs, F(I.name), 1),
1368
+ s[3] || (s[3] = t("div", { class: "flex-1 min-w-32" }, null, -1)),
1369
+ t("div", ys, F(e(Tt)(I.quantity, I.sku.unit, I.measurement)), 1)
1370
+ ]),
1371
+ t("div", vs, [
1372
+ t("div", bs, F(I.code), 1),
1373
+ I.totalCost && e(o).enableTotalCost ? (S(), C("div", hs, " (" + F(e(Lt)(I.totalCost)) + ") ", 1)) : j("", !0)
1374
+ ]),
1375
+ e(Ct)(I) ? (S(), C("div", _s, [
1376
+ u(D, {
1377
+ name: "error",
1378
+ color: "system-error-300",
1379
+ size: "sm"
1380
+ }),
1381
+ s[4] || (s[4] = t("div", { class: "fm-typo-en-body-sm-400 text-fm-color-system-error-400" }, " This item has invalid unit configuration. Apply update on this item. ", -1))
1382
+ ])) : j("", !0)
1383
+ ]))), 128))
1384
+ ])
1385
+ ]),
1386
+ s[6] || (s[6] = t("div", null, null, -1)),
1387
+ s[7] || (s[7] = t("div", null, null, -1)),
1388
+ t("div", gs, [
1389
+ s[5] || (s[5] = t("div", { class: "flex flex-col" }, [
1390
+ t("div", { class: "fm-typo-en-body-lg-600" }, "Enabled locations"),
1391
+ t("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " This template is only usable for the following locations. ")
1392
+ ], -1)),
1393
+ t("div", xs, [
1394
+ u(_, {
1395
+ modelValue: T.value,
1396
+ "onUpdate:modelValue": s[0] || (s[0] = (I) => T.value = I),
1397
+ placeholder: "Filter locations",
1398
+ "prepend-icon": "search"
1399
+ }, null, 8, ["modelValue"]),
1400
+ u(c, {
1401
+ "hide-footer": "",
1402
+ style: { height: "500px" },
1403
+ "column-defs": b,
1404
+ "search-value": T.value,
1405
+ "row-data": ((w = n.template) == null ? void 0 : w.locations) ?? [{ name: "All locations" }]
1406
+ }, null, 8, ["search-value", "row-data"])
1407
+ ])
1408
+ ])
1409
+ ])
1410
+ ];
1411
+ }),
1412
+ "side-sheet-footer": P(() => [
1413
+ t("div", ks, [
1414
+ u(g, {
1415
+ label: e(a)("common.edit"),
1416
+ onClick: s[1] || (s[1] = (f) => r("action:edit")),
1417
+ variant: "tertiary"
1418
+ }, null, 8, ["label"])
1419
+ ])
1420
+ ]),
1421
+ _: 1
1422
+ }, 8, ["header", "modelValue", "dismiss-away"]);
1423
+ };
1424
+ }
1425
+ }), Fs = { class: "flex flex-col h-full overflow-hidden" }, Ss = {
1426
+ class: "flex flex-col gap-16 p-20 border-b border-fm-color-border-default overflow-y-auto",
1427
+ style: { flex: "0 0 30%", "max-height": "30%" }
1428
+ }, ws = { class: "fm-typo-en-heading-sm-700 text-fm-color-typo-primary" }, Is = { class: "flex-1 flex flex-col overflow-hidden" }, Ts = {
1429
+ key: 0,
1430
+ class: "flex-1 flex items-center justify-center"
1431
+ }, Cs = { class: "text-center px-32" }, Os = { class: "fm-typo-en-body-md-400 text-fm-color-typo-placeholder" }, Ms = { class: "flex items-center justify-between px-16 py-12 border-b border-fm-color-border-default shrink-0" }, Vs = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, Es = { class: "flex-1 overflow-y-auto divide-y divide-fm-color-border-default" }, Ds = ["onClick"], As = { class: "flex-1 min-w-0" }, qs = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary truncate" }, Us = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mt-2" }, Rs = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary shrink-0" }, Bs = { class: "px-16 py-10 border-t border-fm-color-border-default bg-fm-color-surface-secondary shrink-0" }, Ps = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ns = /* @__PURE__ */ ae({
1432
+ __name: "TemplateItemBulkEditorStep1",
1433
+ setup($) {
1434
+ const { t: d } = Ie(), n = we(), r = Se(), o = M(
1435
+ () => n.skus.map((T) => ({
1436
+ label: T.name,
1437
+ sublabel: T.code,
1438
+ value: T._id
1439
+ }))
1440
+ ), a = M({
1441
+ get: () => {
1442
+ var T;
1443
+ return ((T = r.selectedSku) == null ? void 0 : T._id) ?? null;
1444
+ },
1445
+ set: (T) => {
1446
+ if (!T) {
1447
+ r.selectedSku = null, r.deselectAllTemplates();
1448
+ return;
1449
+ }
1450
+ r.selectedSku = n.skuById[T] ?? null, r.selectAllTemplates();
1451
+ }
1452
+ }), h = M(
1453
+ () => r.candidateTemplates.length > 0 && r.candidateTemplates.every((T) => r.selectedTemplateIds.includes(T._id))
1454
+ );
1455
+ function b() {
1456
+ h.value ? r.deselectAllTemplates() : r.selectAllTemplates();
1457
+ }
1458
+ return (T, k) => {
1459
+ var i;
1460
+ const O = E("FmSelect"), V = E("FmIcon"), m = E("FmButton"), s = E("FmCheckbox");
1461
+ return S(), C("div", Fs, [
1462
+ t("div", Ss, [
1463
+ t("div", null, [
1464
+ t("p", ws, F(e(d)("inventory.transfer.template.bulkEditor.step1.title")), 1)
1465
+ ]),
1466
+ u(O, {
1467
+ modelValue: a.value,
1468
+ "onUpdate:modelValue": k[0] || (k[0] = (p) => a.value = p),
1469
+ items: o.value,
1470
+ placeholder: e(d)("inventory.transfer.template.bulkEditor.step1.skuPlaceholder"),
1471
+ clearable: ""
1472
+ }, {
1473
+ "menu-wrapper": P((p) => [
1474
+ u(mt, Ee(p, {
1475
+ items: o.value,
1476
+ "model-value": a.value
1477
+ }), null, 16, ["items", "model-value"])
1478
+ ]),
1479
+ _: 1
1480
+ }, 8, ["modelValue", "items", "placeholder"])
1481
+ ]),
1482
+ t("div", Is, [
1483
+ !e(r).selectedSku || e(r).candidateTemplates.length === 0 ? (S(), C("div", Ts, [
1484
+ t("div", Cs, [
1485
+ u(V, {
1486
+ name: "list_alt",
1487
+ size: "lg",
1488
+ class: "text-fm-color-typo-placeholder mb-12"
1489
+ }),
1490
+ t("p", Os, F(e(r).selectedSku ? e(d)("inventory.transfer.template.bulkEditor.step1.emptyNoMatch") : e(d)("inventory.transfer.template.bulkEditor.step1.emptyNoSku")), 1)
1491
+ ])
1492
+ ])) : (S(), C(re, { key: 1 }, [
1493
+ t("div", Ms, [
1494
+ t("span", Vs, F(e(d)("inventory.transfer.template.bulkEditor.step1.templatesContain", { count: e(r).candidateTemplates.length, sku: (i = e(r).selectedSku) == null ? void 0 : i.name }, e(r).candidateTemplates.length)), 1),
1495
+ u(m, {
1496
+ label: h.value ? e(d)("inventory.transfer.template.bulkEditor.step1.deselectAll") : e(d)("inventory.transfer.template.bulkEditor.step1.selectAll"),
1497
+ variant: "tertiary",
1498
+ size: "md",
1499
+ onClick: b
1500
+ }, null, 8, ["label"])
1501
+ ]),
1502
+ t("div", Es, [
1503
+ (S(!0), C(re, null, ye(e(r).candidateTemplates, (p) => (S(), C("div", {
1504
+ key: p._id,
1505
+ class: "flex items-center gap-12 px-16 py-12 hover:bg-fm-color-surface-hover transition-colors cursor-pointer",
1506
+ onClick: (D) => e(r).toggleTemplate(p._id)
1507
+ }, [
1508
+ u(s, {
1509
+ value: !0,
1510
+ "model-value": e(r).selectedTemplateIds.includes(p._id),
1511
+ "onUpdate:modelValue": (D) => e(r).toggleTemplate(p._id),
1512
+ onClick: k[1] || (k[1] = xt(() => {
1513
+ }, ["stop"]))
1514
+ }, null, 8, ["model-value", "onUpdate:modelValue"]),
1515
+ t("div", As, [
1516
+ t("div", qs, F(p.name), 1),
1517
+ t("div", Us, [
1518
+ ie(F(e(d)("inventory.transfer.template.bulkEditor.step1.from")) + " " + F(p.purchaseOrder.supplier.name) + " ", 1),
1519
+ p.purchaseOrder.ref ? (S(), C(re, { key: 0 }, [
1520
+ ie(" · " + F(e(d)("inventory.transfer.template.bulkEditor.step1.ref")) + " " + F(p.purchaseOrder.ref), 1)
1521
+ ], 64)) : j("", !0)
1522
+ ])
1523
+ ]),
1524
+ t("span", Rs, F(e(d)("inventory.transfer.template.bulkEditor.step1.items", { count: p.purchaseOrder.items.length }, p.purchaseOrder.items.length)), 1)
1525
+ ], 8, Ds))), 128))
1526
+ ]),
1527
+ t("div", Bs, [
1528
+ t("span", Ps, F(e(d)("inventory.transfer.template.bulkEditor.step1.selectedCount", { selected: e(r).selectedTemplateIds.length, total: e(r).candidateTemplates.length })), 1)
1529
+ ])
1530
+ ], 64))
1531
+ ])
1532
+ ]);
1533
+ };
1534
+ }
1535
+ }), Ls = { class: "flex flex-col gap-20 p-24 h-full overflow-y-auto" }, Qs = { class: "fm-typo-en-heading-sm-700 text-fm-color-typo-primary" }, zs = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mt-4" }, js = {
1536
+ key: 0,
1537
+ class: "flex flex-col gap-16"
1538
+ }, Hs = { class: "rounded-lg border border-fm-color-border-default bg-fm-color-surface-secondary px-16 py-10 flex items-center gap-12" }, Ws = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, Ys = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary ml-8" }, Ks = {
1539
+ key: 0,
1540
+ class: "ml-auto"
1541
+ }, Gs = { class: "grid grid-cols-2 gap-12" }, Zs = { class: "flex flex-col gap-4" }, Js = { class: "flex items-center gap-8" }, Xs = { class: "flex flex-col gap-4" }, en = { class: "flex items-center gap-8" }, tn = { class: "grid grid-cols-2 gap-12" }, on = { class: "flex flex-col gap-4" }, sn = { class: "flex items-center gap-8" }, nn = { class: "flex flex-col gap-4" }, ln = { class: "flex items-center gap-8" }, rn = { class: "flex flex-col gap-4" }, an = { class: "flex items-center gap-8" }, dn = /* @__PURE__ */ ae({
1542
+ __name: "TemplateItemBulkEditorStep2",
1543
+ emits: ["validation-success"],
1544
+ setup($, { expose: d, emit: n }) {
1545
+ const { t: r } = Ie(), o = Se(), a = De(), h = we(), b = M(
1546
+ () => o.selectedSku ? h.skuById[o.selectedSku._id] ?? o.selectedSku : null
1547
+ ), T = M(() => {
1548
+ var l, f;
1549
+ return (f = (l = b.value) == null ? void 0 : l.unit) != null && f._id ? h.unitById[b.value.unit._id] ?? null : null;
1550
+ }), k = M({
1551
+ get: () => o.editedItem.code ?? "",
1552
+ set: (l) => {
1553
+ o.editedItem = { ...o.editedItem, code: l };
1554
+ }
1555
+ }), O = M({
1556
+ get: () => o.editedItem.name ?? "",
1557
+ set: (l) => {
1558
+ o.editedItem = { ...o.editedItem, name: l };
1559
+ }
1560
+ }), V = M({
1561
+ get: () => ({
1562
+ amount: o.editedItem.quantity ?? { amount: 1, precision: 0 },
1563
+ measurement: o.editedItem.measurement ?? null
1564
+ }),
1565
+ set: (l) => {
1566
+ l && (o.editedItem = {
1567
+ ...o.editedItem,
1568
+ quantity: l.amount,
1569
+ measurement: l.measurement ?? void 0
1570
+ });
1571
+ }
1572
+ }), m = H(null);
1573
+ Fe(() => {
1574
+ var l;
1575
+ return (l = b.value) == null ? void 0 : l._id;
1576
+ }, () => {
1577
+ m.value = null;
1578
+ });
1579
+ const s = M({
1580
+ get: () => m.value ?? Q(o.editedItem.quantityStep ?? { amount: 1, precision: 0 }, !1),
1581
+ set: (l) => {
1582
+ if (l.trim() === "" || ve()(l) !== !0) {
1583
+ m.value = l;
1584
+ return;
1585
+ }
1586
+ m.value = null, o.editedItem = { ...o.editedItem, quantityStep: fe.fromNumber(+l) };
1587
+ }
1588
+ }), i = M({
1589
+ get: () => ({
1590
+ min: o.editedItem.minimumQuantity ?? void 0,
1591
+ max: o.editedItem.maximumQuantity ?? void 0
1592
+ }),
1593
+ set: (l) => {
1594
+ o.editedItem = {
1595
+ ...o.editedItem,
1596
+ minimumQuantity: (l == null ? void 0 : l.min) ?? null,
1597
+ maximumQuantity: (l == null ? void 0 : l.max) ?? null
1598
+ };
1599
+ }
1600
+ }), p = M(() => {
1601
+ var I;
1602
+ const l = o.editedItem, f = l.quantityStep ?? { amount: 1, precision: 0 }, w = (I = b.value) == null ? void 0 : I.unit;
1603
+ return w ? [
1604
+ at(f),
1605
+ ...+(Q(l.quantity ?? { amount: 0, precision: 0 }) ?? 0) > 0 ? [
1606
+ it(
1607
+ +(Q(
1608
+ l.minimumQuantity ?? {
1609
+ amount: 1,
1610
+ precision: de(w, l.measurement)
1611
+ }
1612
+ ) ?? 0)
1613
+ )
1614
+ ] : [],
1615
+ dt(
1616
+ l.maximumQuantity ? +(Q(l.maximumQuantity) ?? 1 / 0) : 1 / 0
1617
+ )
1618
+ ] : [];
1619
+ }), D = M(() => b.value ? [
1620
+ ce(),
1621
+ ve(),
1622
+ ke({
1623
+ amount: 1,
1624
+ precision: de(b.value.unit, o.editedItem.measurement)
1625
+ }),
1626
+ nt(b.value.unit, o.editedItem.measurement)
1627
+ ] : []), _ = M(() => b.value ? [
1628
+ ft({ max: !1 }),
1629
+ vt(o.editedItem.quantityStep ?? { amount: 1, precision: 0 }),
1630
+ yt(
1631
+ +(Q({
1632
+ amount: 0,
1633
+ precision: de(b.value.unit, o.editedItem.measurement)
1634
+ }) ?? 0),
1635
+ 1 / 0
1636
+ )
1637
+ ] : []), c = n, g = H();
1638
+ d({
1639
+ validateInputs: () => {
1640
+ var l, f;
1641
+ return (f = (l = g.value) == null ? void 0 : l.validateInputs) == null ? void 0 : f.call(l);
1642
+ }
1643
+ });
1644
+ function v(l, f, w) {
1645
+ o.editedItem = {
1646
+ ...o.editedItem,
1647
+ sku: l,
1648
+ code: f,
1649
+ measurement: w ?? o.editedItem.measurement
1650
+ };
1651
+ const I = ["code"];
1652
+ w !== void 0 && I.push("defaultAmount"), o.autoSelectFields(I);
1653
+ }
1654
+ return (l, f) => {
1655
+ const w = E("FmIcon"), I = E("FmCheckbox"), R = E("FmLabel"), ee = E("FmTextField"), te = E("FmForm");
1656
+ return S(), C("div", Ls, [
1657
+ t("div", null, [
1658
+ t("p", Qs, F(e(r)("inventory.transfer.template.bulkEditor.step2.title")), 1),
1659
+ t("p", zs, F(e(r)("inventory.transfer.template.bulkEditor.step2.subtitle", { count: e(o).selectedTemplateIds.length }, e(o).selectedTemplateIds.length)), 1)
1660
+ ]),
1661
+ u(te, {
1662
+ ref_key: "formRef",
1663
+ ref: g,
1664
+ onValidationSuccess: f[10] || (f[10] = (A) => c("validation-success"))
1665
+ }, {
1666
+ default: P(() => [
1667
+ b.value ? (S(), C("div", js, [
1668
+ t("div", Hs, [
1669
+ u(w, {
1670
+ name: "inventory_2",
1671
+ size: "sm",
1672
+ class: "text-fm-color-typo-secondary"
1673
+ }),
1674
+ t("div", null, [
1675
+ t("span", Ws, F(b.value.name), 1),
1676
+ t("span", Ys, "(" + F(b.value.code) + ")", 1)
1677
+ ]),
1678
+ e(a).isEnabled ? (S(), C("div", Ks, [
1679
+ u(Qt, {
1680
+ sku: b.value,
1681
+ "setting-options": e(a).skuSettingOptions,
1682
+ "onUpdate:modelValue": v
1683
+ }, null, 8, ["sku", "setting-options"])
1684
+ ])) : j("", !0)
1685
+ ]),
1686
+ t("div", Gs, [
1687
+ t("div", Zs, [
1688
+ t("div", Js, [
1689
+ u(I, {
1690
+ value: !0,
1691
+ "model-value": e(o).selectedFields.has("code"),
1692
+ "onUpdate:modelValue": f[0] || (f[0] = (A) => e(o).toggleField("code"))
1693
+ }, null, 8, ["model-value"]),
1694
+ u(R, {
1695
+ label: e(r)("inventory.transfer.template.bulkEditor.step2.fieldCode"),
1696
+ mark: e(o).selectedFields.has("code") ? "required" : void 0
1697
+ }, null, 8, ["label", "mark"])
1698
+ ]),
1699
+ t("div", {
1700
+ class: oe(e(o).selectedFields.has("code") ? "" : "pointer-events-none select-none opacity-40")
1701
+ }, [
1702
+ u(ee, {
1703
+ modelValue: k.value,
1704
+ "onUpdate:modelValue": f[1] || (f[1] = (A) => k.value = A),
1705
+ "helper-text": b.value.code,
1706
+ rules: e(o).selectedFields.has("code") ? [e(ce)()] : [],
1707
+ disabled: !e(o).selectedFields.has("code")
1708
+ }, null, 8, ["modelValue", "helper-text", "rules", "disabled"])
1709
+ ], 2)
1710
+ ]),
1711
+ t("div", Xs, [
1712
+ t("div", en, [
1713
+ u(I, {
1714
+ value: !0,
1715
+ "model-value": e(o).selectedFields.has("name"),
1716
+ "onUpdate:modelValue": f[2] || (f[2] = (A) => e(o).toggleField("name"))
1717
+ }, null, 8, ["model-value"]),
1718
+ u(R, {
1719
+ label: e(r)("inventory.transfer.template.bulkEditor.step2.fieldName"),
1720
+ mark: e(o).selectedFields.has("name") ? "required" : void 0
1721
+ }, null, 8, ["label", "mark"])
1722
+ ]),
1723
+ t("div", {
1724
+ class: oe(e(o).selectedFields.has("name") ? "" : "pointer-events-none select-none opacity-40")
1725
+ }, [
1726
+ u(ee, {
1727
+ modelValue: O.value,
1728
+ "onUpdate:modelValue": f[3] || (f[3] = (A) => O.value = A),
1729
+ "helper-text": b.value.name,
1730
+ rules: e(o).selectedFields.has("name") ? [e(ce)()] : [],
1731
+ disabled: !e(o).selectedFields.has("name")
1732
+ }, null, 8, ["modelValue", "helper-text", "rules", "disabled"])
1733
+ ], 2)
1734
+ ])
1735
+ ]),
1736
+ t("div", tn, [
1737
+ t("div", on, [
1738
+ t("div", sn, [
1739
+ u(I, {
1740
+ value: !0,
1741
+ "model-value": e(o).selectedFields.has("defaultAmount"),
1742
+ "onUpdate:modelValue": f[4] || (f[4] = (A) => e(o).toggleField("defaultAmount"))
1743
+ }, null, 8, ["model-value"]),
1744
+ u(R, {
1745
+ label: e(r)("inventory.transfer.template.bulkEditor.step2.fieldDefaultAmount"),
1746
+ mark: e(o).selectedFields.has("defaultAmount") ? "required" : void 0
1747
+ }, null, 8, ["label", "mark"])
1748
+ ]),
1749
+ t("div", {
1750
+ class: oe(e(o).selectedFields.has("defaultAmount") ? "" : "pointer-events-none select-none opacity-40")
1751
+ }, [
1752
+ T.value ? (S(), se(rt, {
1753
+ key: 0,
1754
+ modelValue: V.value,
1755
+ "onUpdate:modelValue": f[5] || (f[5] = (A) => V.value = A),
1756
+ unit: T.value,
1757
+ rules: e(o).selectedFields.has("defaultAmount") ? p.value : [],
1758
+ disabled: !e(o).selectedFields.has("defaultAmount"),
1759
+ "apply-default-rules": ""
1760
+ }, null, 8, ["modelValue", "unit", "rules", "disabled"])) : j("", !0)
1761
+ ], 2)
1762
+ ]),
1763
+ t("div", nn, [
1764
+ t("div", ln, [
1765
+ u(I, {
1766
+ value: !0,
1767
+ "model-value": e(o).selectedFields.has("step"),
1768
+ "onUpdate:modelValue": f[6] || (f[6] = (A) => e(o).toggleField("step"))
1769
+ }, null, 8, ["model-value"]),
1770
+ u(R, {
1771
+ label: e(r)("inventory.transfer.template.bulkEditor.step2.fieldStep")
1772
+ }, null, 8, ["label"])
1773
+ ]),
1774
+ t("div", {
1775
+ class: oe(e(o).selectedFields.has("step") ? "" : "pointer-events-none select-none opacity-40")
1776
+ }, [
1777
+ u(ee, {
1778
+ modelValue: s.value,
1779
+ "onUpdate:modelValue": f[7] || (f[7] = (A) => s.value = A),
1780
+ rules: e(o).selectedFields.has("step") ? D.value : [],
1781
+ disabled: !e(o).selectedFields.has("step")
1782
+ }, null, 8, ["modelValue", "rules", "disabled"])
1783
+ ], 2)
1784
+ ])
1785
+ ]),
1786
+ t("div", rn, [
1787
+ t("div", an, [
1788
+ u(I, {
1789
+ value: !0,
1790
+ "model-value": e(o).selectedFields.has("limit"),
1791
+ "onUpdate:modelValue": f[8] || (f[8] = (A) => e(o).toggleField("limit"))
1792
+ }, null, 8, ["model-value"]),
1793
+ u(R, {
1794
+ label: e(r)("inventory.transfer.template.bulkEditor.step2.fieldLimit")
1795
+ }, null, 8, ["label"])
1796
+ ]),
1797
+ t("div", {
1798
+ class: oe(e(o).selectedFields.has("limit") ? "" : "pointer-events-none select-none opacity-40")
1799
+ }, [
1800
+ b.value.unit ? (S(), se(pt, {
1801
+ key: 0,
1802
+ modelValue: i.value,
1803
+ "onUpdate:modelValue": f[9] || (f[9] = (A) => i.value = A),
1804
+ unit: b.value.unit,
1805
+ rules: e(o).selectedFields.has("limit") ? _.value : [],
1806
+ disabled: !e(o).selectedFields.has("limit"),
1807
+ "disable-unit": "",
1808
+ "apply-default-rules": ""
1809
+ }, null, 8, ["modelValue", "unit", "rules", "disabled"])) : j("", !0)
1810
+ ], 2)
1811
+ ])
1812
+ ])) : j("", !0)
1813
+ ]),
1814
+ _: 1
1815
+ }, 512)
1816
+ ]);
1817
+ };
1818
+ }
1819
+ }), et = { amount: 0, precision: 0 };
1820
+ function un($) {
1821
+ var n;
1822
+ const d = $.sku;
1823
+ return {
1824
+ code: d.code,
1825
+ overrideCode: $.code,
1826
+ name: $.name ?? d.name,
1827
+ unit: ((n = d.unit.measurements.find((r) => r.id === d.trackingMeasurement)) == null ? void 0 : n.abbrev) ?? d.unit.abbrev,
1828
+ defaultQuantity: +Q($.quantity),
1829
+ minimumQuantity: +Q($.minimumQuantity ?? et),
1830
+ maximumQuantity: +Q($.maximumQuantity ?? et),
1831
+ quantityStep: +Q($.quantityStep)
1832
+ };
1833
+ }
1834
+ function mn($) {
1835
+ var T;
1836
+ const n = It().currentBusiness.value, r = Ot(), a = (T = $.map((k) => {
1837
+ var i;
1838
+ const O = k.purchaseOrder.items.map((p) => un(p)), V = [
1839
+ ["Template ID", k._id],
1840
+ ["Template name", k.name],
1841
+ ["Business name", n == null ? void 0 : n.name],
1842
+ ["Business ID", n == null ? void 0 : n._id],
1843
+ ["Menu version", n == null ? void 0 : n.menuVersion],
1844
+ [
1845
+ "Purchase/Transfer",
1846
+ typeof k.purchaseOrder.supplier.internal == "string" ? X.enum.transfer : X.enum.purchase
1847
+ ],
1848
+ [
1849
+ "Transfer from",
1850
+ `${k.purchaseOrder.supplier.name} (${[
1851
+ k.purchaseOrder.supplier.internal,
1852
+ k.purchaseOrder.supplier._id
1853
+ ].filter((p) => p).join("_")})`
1854
+ ],
1855
+ [
1856
+ "Locations",
1857
+ ...(i = k.locations) != null && i.length ? k.locations.map((p) => `${p.name} (${p.dbName})`) : ["All"]
1858
+ ],
1859
+ ["Reference", k.purchaseOrder.ref ?? ""],
1860
+ ["Remark", k.purchaseOrder.remark ?? ""],
1861
+ [],
1862
+ r.map((p) => p.name),
1863
+ ...O.map((p) => r.map((D) => p[D.id]))
1864
+ ], m = r.map((p) => `system:${p.id}`), s = Zt(V, m);
1865
+ return { name: k.name, sheet: s };
1866
+ }).reduce(
1867
+ (k, O) => {
1868
+ var m;
1869
+ const V = O.name.slice(0, 28);
1870
+ return (m = k.sheetOccurence)[V] ?? (m[V] = 0), k.sheetOccurence[V] += 1, k.sheets[`${V} (${k.sheetOccurence[V]})`] = O.sheet, k;
1871
+ },
1872
+ {
1873
+ sheets: {},
1874
+ sheetOccurence: {}
1875
+ }
1876
+ )) == null ? void 0 : T.sheets, h = `${n == null ? void 0 : n.name} transfer templates bulk edit (${ct(/* @__PURE__ */ new Date())}).xlsx`, b = Jt(a);
1877
+ Xt(b, h);
1878
+ }
1879
+ const cn = { class: "flex flex-col gap-16" }, pn = { class: "rounded-lg border border-fm-color-border-default bg-fm-color-surface-secondary p-16" }, fn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary mb-8" }, yn = { class: "flex flex-wrap gap-12 items-center" }, vn = { class: "flex items-center gap-6" }, bn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, hn = { class: "flex items-center gap-6" }, _n = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, gn = { class: "text-fm-color-typo-primary" }, xn = { class: "text-fm-color-typo-placeholder ml-4" }, kn = { class: "mt-12" }, $n = ["onClick"], Fn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary flex-1 truncate" }, Sn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, wn = {
1880
+ key: 0,
1881
+ class: "px-12 py-8 border-b border-fm-color-border-default"
1882
+ }, In = {
1883
+ key: 1,
1884
+ class: "divide-y divide-fm-color-border-default"
1885
+ }, Tn = { class: "fm-typo-en-body-sm-600 text-fm-color-typo-secondary w-28 shrink-0" }, Cn = { class: "fm-typo-en-body-sm-400 line-through text-fm-color-error" }, On = { class: "fm-typo-en-body-sm-400 text-fm-color-success font-medium" }, Mn = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Vn = { class: "fm-typo-en-body-xs-400 text-fm-color-typo-placeholder ml-4 italic" }, En = /* @__PURE__ */ ae({
1886
+ __name: "TemplateItemBulkEditorStep3",
1887
+ setup($) {
1888
+ const { t: d } = Ie(), n = Se(), r = H(/* @__PURE__ */ new Set());
1889
+ function o(s) {
1890
+ return r.value.has(s);
1891
+ }
1892
+ function a(s) {
1893
+ const i = new Set(r.value);
1894
+ i.has(s) ? i.delete(s) : i.add(s), r.value = i;
1895
+ }
1896
+ const h = M(() => {
1897
+ const s = /* @__PURE__ */ new Map();
1898
+ for (const i of n.selectedTemplates)
1899
+ s.set(i._id, i);
1900
+ return s;
1901
+ });
1902
+ function b(s) {
1903
+ var f;
1904
+ const i = (f = n.selectedSku) == null ? void 0 : f._id;
1905
+ if (!i) return [];
1906
+ const p = h.value.get(s), D = n.reviewPayloads.find((w) => w._id === s);
1907
+ if (!p || !D) return [];
1908
+ const _ = p.purchaseOrder.items.find((w) => w.sku._id === i), c = D.purchaseOrder.items.find((w) => w.sku._id === i);
1909
+ if (!_ || !c) return [];
1910
+ const g = (w) => w != null ? Q(w) : "—", v = n.selectedFields;
1911
+ return [
1912
+ {
1913
+ group: "code",
1914
+ label: d("inventory.transfer.template.bulkEditor.step3.fieldCode"),
1915
+ before: _.code ?? "—",
1916
+ after: c.code ?? "—",
1917
+ changed: _.code !== c.code
1918
+ },
1919
+ {
1920
+ group: "name",
1921
+ label: d("inventory.transfer.template.bulkEditor.step3.fieldName"),
1922
+ before: _.name ?? "—",
1923
+ after: c.name ?? "—",
1924
+ changed: _.name !== c.name
1925
+ },
1926
+ {
1927
+ group: "defaultAmount",
1928
+ label: d("inventory.transfer.template.bulkEditor.step3.fieldDefaultAmount"),
1929
+ before: g(_.quantity),
1930
+ after: g(c.quantity),
1931
+ changed: g(_.quantity) !== g(c.quantity)
1932
+ },
1933
+ {
1934
+ group: "step",
1935
+ label: d("inventory.transfer.template.bulkEditor.step3.fieldStep"),
1936
+ before: g(_.quantityStep),
1937
+ after: g(c.quantityStep),
1938
+ changed: g(_.quantityStep) !== g(c.quantityStep)
1939
+ },
1940
+ {
1941
+ group: "limit",
1942
+ label: d("inventory.transfer.template.bulkEditor.step3.fieldMin"),
1943
+ before: g(_.minimumQuantity),
1944
+ after: g(c.minimumQuantity),
1945
+ changed: g(_.minimumQuantity) !== g(c.minimumQuantity)
1946
+ },
1947
+ {
1948
+ group: "limit",
1949
+ label: d("inventory.transfer.template.bulkEditor.step3.fieldMax"),
1950
+ before: g(_.maximumQuantity),
1951
+ after: g(c.maximumQuantity),
1952
+ changed: g(_.maximumQuantity) !== g(c.maximumQuantity)
1953
+ }
1954
+ ].filter((w) => v.has(w.group));
1955
+ }
1956
+ function T() {
1957
+ mn(n.reviewPayloads);
1958
+ }
1959
+ function k(s) {
1960
+ return n.succeededIds.has(s) ? "updated" : n.applyErrors.has(s) ? "failed" : "pending";
1961
+ }
1962
+ const O = {
1963
+ updated: "success",
1964
+ failed: "critical",
1965
+ pending: "success"
1966
+ }, V = {
1967
+ updated: "inventory.transfer.template.bulkEditor.step3.updatedChip",
1968
+ failed: "inventory.transfer.template.bulkEditor.step3.failedChip",
1969
+ pending: "inventory.transfer.template.bulkEditor.step3.willUpdateChip"
1970
+ }, m = M(() => n.reviewPayloads.length);
1971
+ return (s, i) => {
1972
+ var g, v;
1973
+ const p = E("FmChip"), D = E("FmButton"), _ = E("FmIcon"), c = E("FmBanner");
1974
+ return S(), C("div", cn, [
1975
+ t("div", pn, [
1976
+ t("p", fn, F(e(d)("inventory.transfer.template.bulkEditor.step3.title")), 1),
1977
+ t("div", yn, [
1978
+ t("div", vn, [
1979
+ u(p, {
1980
+ size: "sm",
1981
+ label: String(m.value),
1982
+ variant: "success"
1983
+ }, null, 8, ["label"]),
1984
+ t("span", bn, F(e(d)("inventory.transfer.template.bulkEditor.step3.willUpdate", { count: m.value }, m.value)), 1)
1985
+ ]),
1986
+ t("div", hn, [
1987
+ t("span", _n, [
1988
+ ie(F(e(d)("inventory.transfer.template.bulkEditor.step3.item")) + " ", 1),
1989
+ t("strong", gn, F((g = e(n).selectedSku) == null ? void 0 : g.name), 1),
1990
+ t("span", xn, "(" + F((v = e(n).selectedSku) == null ? void 0 : v.code) + ")", 1)
1991
+ ])
1992
+ ])
1993
+ ]),
1994
+ t("div", kn, [
1995
+ u(D, {
1996
+ label: e(d)("inventory.transfer.template.bulkEditor.step3.export"),
1997
+ variant: "secondary",
1998
+ size: "md",
1999
+ onClick: T
2000
+ }, null, 8, ["label"])
2001
+ ])
2002
+ ]),
2003
+ (S(!0), C(re, null, ye(e(n).reviewPayloads, (l) => (S(), C("div", {
2004
+ key: l._id,
2005
+ class: "rounded-lg border border-fm-color-border-default overflow-hidden"
2006
+ }, [
2007
+ t("button", {
2008
+ type: "button",
2009
+ class: oe(["w-full flex items-center gap-8 px-12 py-10 bg-fm-color-surface-secondary text-left cursor-pointer", { "border-b border-fm-color-border-default": o(l._id) }]),
2010
+ onClick: (f) => a(l._id)
2011
+ }, [
2012
+ u(_, {
2013
+ name: o(l._id) ? "expand_less" : "expand_more",
2014
+ size: "sm",
2015
+ class: "text-fm-color-typo-secondary flex-shrink-0"
2016
+ }, null, 8, ["name"]),
2017
+ t("span", Fn, F(l.name), 1),
2018
+ t("span", Sn, F(e(d)("inventory.transfer.template.bulkEditor.step1.from")) + " " + F(l.purchaseOrder.supplier.name), 1),
2019
+ u(p, {
2020
+ size: "sm",
2021
+ label: e(d)(V[k(l._id)]),
2022
+ variant: O[k(l._id)]
2023
+ }, null, 8, ["label", "variant"])
2024
+ ], 10, $n),
2025
+ e(n).applyErrors.has(l._id) ? (S(), C("div", wn, [
2026
+ u(c, {
2027
+ type: "error",
2028
+ message: e(n).applyErrors.get(l._id)
2029
+ }, null, 8, ["message"])
2030
+ ])) : j("", !0),
2031
+ o(l._id) ? (S(), C("div", In, [
2032
+ (S(!0), C(re, null, ye(b(l._id), (f) => (S(), C("div", {
2033
+ key: f.label,
2034
+ class: "flex items-center gap-8 px-12 py-8"
2035
+ }, [
2036
+ t("span", Tn, F(f.label), 1),
2037
+ f.changed ? (S(), C(re, { key: 0 }, [
2038
+ t("span", Cn, F(f.before), 1),
2039
+ u(_, {
2040
+ name: "arrow_forward",
2041
+ size: "sm",
2042
+ class: "text-fm-color-typo-placeholder shrink-0"
2043
+ }),
2044
+ t("span", On, F(f.after), 1)
2045
+ ], 64)) : (S(), C(re, { key: 1 }, [
2046
+ t("span", Mn, F(f.before), 1),
2047
+ t("span", Vn, F(e(d)("inventory.transfer.template.bulkEditor.step3.unchanged")), 1)
2048
+ ], 64))
2049
+ ]))), 128))
2050
+ ])) : j("", !0)
2051
+ ]))), 128))
2052
+ ]);
2053
+ };
2054
+ }
2055
+ }), Dn = { class: "flex items-center gap-12" }, An = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, qn = {
2056
+ key: 0,
2057
+ class: "h-[calc(98vh-120px)] overflow-hidden flex flex-col"
2058
+ }, Un = {
2059
+ key: 1,
2060
+ class: "h-[calc(98vh-120px)] overflow-hidden flex flex-col"
2061
+ }, Rn = {
2062
+ key: 2,
2063
+ class: "h-[calc(98vh-120px)] overflow-y-auto px-24 py-20"
2064
+ }, Bn = {
2065
+ key: 0,
2066
+ class: "flex items-center gap-8 px-4"
2067
+ }, Pn = {
2068
+ key: 1,
2069
+ class: "flex items-center gap-8 px-4"
2070
+ }, Nn = /* @__PURE__ */ ae({
2071
+ __name: "TemplateItemBulkEditorDialog",
2072
+ setup($) {
2073
+ const { t: d } = Ie(), n = Se(), r = qt(), o = H(), a = M(() => n.currentStep === 1), h = M(() => n.currentStep === 2), b = M(() => n.currentStep === 3);
2074
+ function T() {
2075
+ var p;
2076
+ n.currentStep === 1 ? n.goToStep2() : n.currentStep === 2 && ((p = o.value) == null || p.validateInputs());
2077
+ }
2078
+ function k() {
2079
+ n.goToStep3();
2080
+ }
2081
+ function O() {
2082
+ n.back();
2083
+ }
2084
+ function V() {
2085
+ n.show = !1, n.reset();
2086
+ }
2087
+ function m() {
2088
+ var p;
2089
+ r.open({
2090
+ title: d("inventory.transfer.template.bulkEditor.confirm.title"),
2091
+ message: d("inventory.transfer.template.bulkEditor.confirm.message", {
2092
+ sku: (p = n.selectedSku) == null ? void 0 : p.name,
2093
+ count: n.reviewPayloads.length
2094
+ }, n.reviewPayloads.length),
2095
+ primaryActions: {
2096
+ text: d("inventory.transfer.template.bulkEditor.confirm.confirm"),
2097
+ variant: "primary",
2098
+ close: !0
2099
+ },
2100
+ secondaryActions: {
2101
+ text: d("inventory.transfer.template.bulkEditor.confirm.cancel"),
2102
+ close: !0
2103
+ }
2104
+ }).onPrimary(async () => {
2105
+ await n.confirmAndApply();
2106
+ });
2107
+ }
2108
+ const s = M(() => n.currentStep === 2 ? d("inventory.transfer.template.bulkEditor.review") : d("inventory.transfer.template.bulkEditor.next")), i = M(() => n.currentStep === 1 ? !n.canGoToStep2 : n.currentStep === 2 ? !n.canGoToStep3 : !1);
2109
+ return (p, D) => {
2110
+ const _ = E("FmChip"), c = E("FmButton"), g = E("FmDialog");
2111
+ return S(), se(g, {
2112
+ modelValue: e(n).show,
2113
+ "onUpdate:modelValue": [
2114
+ D[0] || (D[0] = (v) => e(n).show = v),
2115
+ D[1] || (D[1] = (v) => {
2116
+ v || e(n).reset();
2117
+ })
2118
+ ],
2119
+ overlay: !0,
2120
+ "close-button": "",
2121
+ "max-width": "98vw",
2122
+ "max-height": "98vh"
2123
+ }, {
2124
+ "dialog-header": P(() => [
2125
+ t("div", Dn, [
2126
+ t("span", An, F(e(d)("inventory.transfer.template.bulkEditor.dialogTitle")), 1),
2127
+ u(_, {
2128
+ size: "sm",
2129
+ label: e(d)("inventory.transfer.template.bulkEditor.stepChip", { step: e(n).currentStep }),
2130
+ variant: "neutral"
2131
+ }, null, 8, ["label"])
2132
+ ])
2133
+ ]),
2134
+ "dialog-footer": P(() => [
2135
+ b.value ? (S(), C("div", Pn, [
2136
+ u(c, {
2137
+ label: e(d)("inventory.transfer.template.bulkEditor.confirmAndUpdate"),
2138
+ disabled: e(n).isSaving,
2139
+ loading: e(n).isSaving,
2140
+ onClick: m
2141
+ }, null, 8, ["label", "disabled", "loading"]),
2142
+ u(c, {
2143
+ label: e(d)("inventory.transfer.template.bulkEditor.back"),
2144
+ variant: "secondary",
2145
+ disabled: e(n).isSaving,
2146
+ onClick: O
2147
+ }, null, 8, ["label", "disabled"]),
2148
+ u(c, {
2149
+ label: e(d)("inventory.transfer.template.bulkEditor.close"),
2150
+ variant: "tertiary",
2151
+ disabled: e(n).isSaving,
2152
+ onClick: V
2153
+ }, null, 8, ["label", "disabled"])
2154
+ ])) : (S(), C("div", Bn, [
2155
+ u(c, {
2156
+ label: s.value,
2157
+ disabled: i.value,
2158
+ onClick: T
2159
+ }, null, 8, ["label", "disabled"]),
2160
+ e(n).currentStep > 1 ? (S(), se(c, {
2161
+ key: 0,
2162
+ label: e(d)("inventory.transfer.template.bulkEditor.back"),
2163
+ variant: "secondary",
2164
+ onClick: O
2165
+ }, null, 8, ["label"])) : j("", !0),
2166
+ u(c, {
2167
+ label: e(d)("inventory.transfer.template.bulkEditor.close"),
2168
+ variant: "tertiary",
2169
+ onClick: V
2170
+ }, null, 8, ["label"])
2171
+ ]))
2172
+ ]),
2173
+ default: P(() => [
2174
+ a.value ? (S(), C("div", qn, [
2175
+ u(Ns)
2176
+ ])) : h.value ? (S(), C("div", Un, [
2177
+ u(dn, {
2178
+ ref_key: "step2Ref",
2179
+ ref: o,
2180
+ onValidationSuccess: k
2181
+ }, null, 512)
2182
+ ])) : b.value ? (S(), C("div", Rn, [
2183
+ u(En)
2184
+ ])) : j("", !0)
2185
+ ]),
2186
+ _: 1
2187
+ }, 8, ["modelValue"]);
2188
+ };
2189
+ }
2190
+ }), Ln = { class: "flex-1 flex flex-col gap-8" }, Qn = { class: "flex flex-col" }, zn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, jn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Hn = { class: "fm-typo-en-body-lg-400" }, Wn = { class: "fm-typo-en-body-lg-400 line-clamp-1" }, Yn = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, $l = /* @__PURE__ */ ae({
2191
+ __name: "TransferTemplateView",
2192
+ setup($) {
2193
+ const { t: d } = pe(), { createTemplate: n, viewTemplate: r, importTemplates: o, exportTemplates: a, openBulkItemEditor: h } = Ge(), { templateDialogProps: b, templateDetailsProps: T } = Je(Ge()), k = Mt(), { loading: O, templates: V } = Je(k), m = H(!1), s = St(), i = ot(), { breakpoints: p } = Ut();
2194
+ Ve(k.fetchTemplates);
2195
+ const D = M(
2196
+ () => m.value || O.value || !i._currentLocation
2197
+ ), _ = M(() => V.value), c = H(""), g = M(() => p.value.xs || p.value.sm), v = M(() => g.value ? 10 : 20);
2198
+ function l(I) {
2199
+ switch (I) {
2200
+ case Ze.Add:
2201
+ return n();
2202
+ case "refresh":
2203
+ return k.fetchTemplates();
2204
+ case "import":
2205
+ return o();
2206
+ case "export":
2207
+ return a();
2208
+ case "bulk-edit-items":
2209
+ return h();
2210
+ }
2211
+ }
2212
+ function f(I) {
2213
+ return I;
2214
+ }
2215
+ const w = M(() => [
2216
+ {
2217
+ label: d("inventory.closing.template.create.title"),
2218
+ value: Ze.Add,
2219
+ isPrimary: !0,
2220
+ prependIcon: "add"
2221
+ },
2222
+ {
2223
+ label: d("inventory.common.refresh"),
2224
+ value: "refresh",
2225
+ isPrimary: !1
2226
+ },
2227
+ {
2228
+ label: d("inventory.common.import"),
2229
+ value: "import",
2230
+ isPrimary: !1
2231
+ },
2232
+ {
2233
+ label: d("inventory.common.export"),
2234
+ value: "export",
2235
+ isPrimary: !1
2236
+ },
2237
+ {
2238
+ label: d("inventory.transfer.template.bulkEditor.pageAction"),
2239
+ value: "bulk-edit-items",
2240
+ isPrimary: !1
2241
+ }
2242
+ ]);
2243
+ return (I, R) => {
2244
+ const ee = E("FmTable");
2245
+ return S(), C(re, null, [
2246
+ u(wt, {
2247
+ title: e(d)("inventory.transfer.template.title2"),
2248
+ actions: w.value,
2249
+ "onClick:action": l
2250
+ }, {
2251
+ default: P(() => {
2252
+ var te;
2253
+ return [
2254
+ t("div", {
2255
+ class: oe([
2256
+ "flex flex-col gap-8 max-h-full",
2257
+ {
2258
+ "p-0": g.value,
2259
+ "px-24 ": !g.value
2260
+ }
2261
+ ])
2262
+ }, [
2263
+ u(Dt, {
2264
+ searchable: "",
2265
+ search: c.value,
2266
+ "onUpdate:search": R[0] || (R[0] = (A) => c.value = A)
2267
+ }, null, 8, ["search"]),
2268
+ (S(), se(ee, {
2269
+ style: Me(e(s).tableHeight),
2270
+ "column-defs": e(k).columnDefs,
2271
+ "row-data": _.value,
2272
+ "search-value": c.value,
2273
+ loading: D.value,
2274
+ key: (te = e(i)._currentLocation) == null ? void 0 : te.dbName,
2275
+ onRowClick: R[1] || (R[1] = (A) => e(r)(A.original)),
2276
+ "page-size": v.value
2277
+ }, {
2278
+ "list-row": P((A) => [
2279
+ u(ut, {
2280
+ row: A,
2281
+ onRowClick: (N) => e(r)(N)
2282
+ }, {
2283
+ default: P((N) => {
2284
+ var y, x, q, L, W, J, B, z, G, ne, U, Y, be, he, Ae, qe, Ue, Re, Be, Pe, _e, Ne, Le, Qe, ze, ge, je;
2285
+ return [
2286
+ t("div", Ln, [
2287
+ t("div", Qn, [
2288
+ t("div", zn, [
2289
+ u(e(le), {
2290
+ render: (q = (x = (y = N._id) == null ? void 0 : y.column) == null ? void 0 : x.columnDef) == null ? void 0 : q.cell,
2291
+ props: (W = (L = N._id) == null ? void 0 : L.getContext) == null ? void 0 : W.call(L)
2292
+ }, null, 8, ["render", "props"])
2293
+ ]),
2294
+ t("div", jn, [
2295
+ u(e(le), {
2296
+ render: (z = (B = (J = N.name) == null ? void 0 : J.column) == null ? void 0 : B.columnDef) == null ? void 0 : z.cell,
2297
+ props: (ne = (G = N.name) == null ? void 0 : G.getContext) == null ? void 0 : ne.call(G)
2298
+ }, null, 8, ["render", "props"])
2299
+ ]),
2300
+ t("div", Hn, [
2301
+ u(e(le), {
2302
+ render: (be = (Y = (U = N.supplier) == null ? void 0 : U.column) == null ? void 0 : Y.columnDef) == null ? void 0 : be.cell,
2303
+ props: (Ae = (he = N.supplier) == null ? void 0 : he.getContext) == null ? void 0 : Ae.call(he)
2304
+ }, null, 8, ["render", "props"])
2305
+ ]),
2306
+ t("div", null, F((qe = A.original.locations) != null && qe.length ? `Enabled for ${(Ue = A.original.locations) == null ? void 0 : Ue.length} outlets` : "Enabled for all outlets"), 1),
2307
+ t("div", Wn, F(A.original.purchaseOrder.items.length ? A.original.purchaseOrder.items.map((ht) => ht.name).join(", ") : "No items"), 1),
2308
+ t("div", Yn, [
2309
+ u(e(le), {
2310
+ render: (Pe = (Be = (Re = N.ref) == null ? void 0 : Re.column) == null ? void 0 : Be.columnDef) == null ? void 0 : Pe.cell,
2311
+ props: (Ne = (_e = N.ref) == null ? void 0 : _e.getContext) == null ? void 0 : Ne.call(_e)
2312
+ }, null, 8, ["render", "props"])
2313
+ ])
2314
+ ]),
2315
+ t("div", null, [
2316
+ u(e(le), {
2317
+ render: (ze = (Qe = (Le = N.type) == null ? void 0 : Le.column) == null ? void 0 : Qe.columnDef) == null ? void 0 : ze.cell,
2318
+ props: (je = (ge = N.type) == null ? void 0 : ge.getContext) == null ? void 0 : je.call(ge)
2319
+ }, null, 8, ["render", "props"])
2320
+ ])
2321
+ ])
2322
+ ];
2323
+ }),
2324
+ _: 2
2325
+ }, 1032, ["row", "onRowClick"])
2326
+ ]),
2327
+ _: 1
2328
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
2329
+ ], 2)
2330
+ ];
2331
+ }),
2332
+ _: 1
2333
+ }, 8, ["title", "actions"]),
2334
+ (S(), se(kt, { to: "body" }, [
2335
+ u($s, $t(Ft(e(T))), null, 16),
2336
+ u(No, Ee(e(b), {
2337
+ onSubmitted: R[2] || (R[2] = (te) => e(k).fetchTemplates())
2338
+ }), null, 16),
2339
+ u(Nn)
2340
+ ]))
2341
+ ], 64);
2342
+ };
2343
+ }
2344
+ });
2345
+ export {
2346
+ $l as default
2347
+ };