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

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