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

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