@feedmepos/mf-inventory-portal 1.5.12-dev.0 → 1.5.13

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 (111) hide show
  1. package/dist/{App-ym7zoIt4.js → App-DqGcS6Gm.js} +4 -4
  2. package/dist/{ApprovalView-DS1cgEM3.js → ApprovalView-BpLssvwC.js} +7 -7
  3. package/dist/{BindingsDialog-pA-lQ0Qx.js → BindingsDialog-Bjca56rZ.js} +2 -2
  4. package/dist/{BindingsPicker-D-lS8rtE.js → BindingsPicker-D3bSjNn3.js} +2 -2
  5. package/dist/{BindingsTable-CCG83TCM.js → BindingsTable-b8uwBXvE.js} +3 -3
  6. package/dist/{ClosingDraftView-BI6RvZMJ.js → ClosingDraftView-DufSupv2.js} +15 -15
  7. package/dist/{ClosingHistoryView-CzSQ7tNH.js → ClosingHistoryView-C3V5brh9.js} +86 -85
  8. package/dist/{ClosingTemplateView-By2oAuyO.js → ClosingTemplateView-B6hpp5B8.js} +14 -14
  9. package/dist/{DefaultView-eHfv7jOS.js → DefaultView-DeN96J1z.js} +2 -2
  10. package/dist/{DeliveryOrderPrintPreview-59gPCEN9.js → DeliveryOrderPrintPreview-EnFKjxtA.js} +2 -2
  11. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DJnbYUPk.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-6M_CG9Xi.js} +2 -2
  12. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BmoeRycM.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-RH37--FG.js} +2 -2
  13. package/dist/{FmMultiselectDialog-y6iFhI-b.js → FmMultiselectDialog-6mShWQom.js} +1 -1
  14. package/dist/{FmMultiselectDialog-BQct_7_1.js → FmMultiselectDialog-CfjwOjv0.js} +2 -2
  15. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-5FB2Q2M7.js → FmUnitInput.vue_vue_type_script_setup_true_lang-ILexyjQI.js} +5 -5
  16. package/dist/{ImportView-CFhTlC6A.js → ImportView-Aksgpj3u.js} +6 -6
  17. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang--lvhU0IL.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BVa8U4y-.js} +1 -1
  18. package/dist/{IngredientGroupView-98vFl0cv.js → IngredientGroupView-BbJFosjR.js} +5 -5
  19. package/dist/{IngredientsView-DOyC-80n.js → IngredientsView-CN933oCR.js} +15 -15
  20. package/dist/{IntegrationExplorerView-yqqhYVKa.js → IntegrationExplorerView-CAjxn-PC.js} +352 -352
  21. package/dist/IntegrationView-w4fp4oT4.js +4586 -0
  22. package/dist/{InventoryBindingForm-TOMIZzTV.js → InventoryBindingForm-EBJ3QGaU.js} +1 -1
  23. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CCwsG2nZ.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CoUtIP_H.js} +5 -5
  24. package/dist/{InventoryBindingSummary-Kq71Npw5.js → InventoryBindingSummary-DqplMp3W.js} +1 -1
  25. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BpqRkOKa.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DtBoicPG.js} +1 -1
  26. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BXQXxebS.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DsYsq73l.js} +1 -1
  27. package/dist/{PublishView-B3iAIUeC.js → PublishView-BJIsXl8d.js} +3 -3
  28. package/dist/{PurchaseOrderPrintPreview-C7BYCDq4.js → PurchaseOrderPrintPreview-C7HgcwTx.js} +2 -2
  29. package/dist/{ReceiveRequestView-C0RZHVVz.js → ReceiveRequestView-BKfE6CFa.js} +26 -26
  30. package/dist/{RecipeView-CGMCm-6C.js → RecipeView-CIcat7Oq.js} +1117 -1104
  31. package/dist/{SettingsView-Dy36ihuC.js → SettingsView-DAg0_Cxw.js} +4 -4
  32. package/dist/{StockView-DG8gGcR6.js → StockView-DkkBhXdb.js} +19 -19
  33. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-7jJ-_TKD.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-B_7-SpUx.js} +1 -1
  34. package/dist/{SupplierView-DkXdKVSS.js → SupplierView-DdBM6_mn.js} +12 -12
  35. package/dist/{SurchargeView-CnQFI8Np.js → SurchargeView-DO7ccJw4.js} +6 -6
  36. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CjxxSwOw.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CnmxlHSe.js} +2 -2
  37. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CgxcV8uB.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CsxPLRxW.js} +1 -1
  38. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-P4wynSco.js → TransferDetails.vue_vue_type_script_setup_true_lang-UAe7BwyU.js} +20 -20
  39. package/dist/TransferTemplateView-DwNMWpQG.js +1564 -0
  40. package/dist/{UnitCostHistoryView-lq-q2AHS.js → UnitCostHistoryView-BR_DzquD.js} +4 -4
  41. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-DSlyQqSb.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-1frVLUSk.js} +5 -5
  42. package/dist/{UnitView-d_Imf603.js → UnitView-DHhs6eAM.js} +7 -7
  43. package/dist/{WarehouseView-61nx-AdI.js → WarehouseView-BncF3L-E.js} +5 -5
  44. package/dist/{WastageTemplateView-CjFGIKQo.js → WastageTemplateView-e3ixwHt1.js} +14 -14
  45. package/dist/api/inventory.d.ts +0 -1
  46. package/dist/api/netsuite.d.ts +4 -5
  47. package/dist/api/surcharge.d.ts +0 -1
  48. package/dist/{app-vpgIgmf7.js → app-BM6mngFA.js} +4141 -4438
  49. package/dist/app.d.ts +0 -268
  50. package/dist/app.js +1 -1
  51. package/dist/{closing-template-Dq6tC4Zx.js → closing-template-BD6V7qLl.js} +1 -1
  52. package/dist/{date2-Bdr9V2CH.js → date2-DDlrt2dw.js} +1 -1
  53. package/dist/{dayjs.min-DyMZZmIx.js → dayjs.min-CRtl6lAo.js} +1 -1
  54. package/dist/{decimal-naJvMnG2.js → decimal-C05Zbycy.js} +2 -2
  55. package/dist/{defineDeepModel-33cmeIFu.js → defineDeepModel-B0S3YXv1.js} +1 -1
  56. package/dist/{duplicate-template-DSu6924D.js → duplicate-template-DLoKowb8.js} +1 -1
  57. package/dist/{feature-yi8Tnb7H.js → feature-Hkq4qHGO.js} +2 -2
  58. package/dist/{format-time-from-id-Dq0qIwbK.js → format-time-from-id-BsGskcws.js} +1 -1
  59. package/dist/format-unit-display-Dbb2764O.js +1268 -0
  60. package/dist/{import-export.helper-DDiyb9cx.js → import-export.helper-CwHS2Pr0.js} +6 -6
  61. package/dist/{index-B4vbL-WN.js → index-BosCKut7.js} +1 -1
  62. package/dist/index-C-Z_O_57.js +164 -0
  63. package/dist/{index-Dmrgz0N_.js → index-DOZ0kYer.js} +1 -1
  64. package/dist/{inventory-core-dart.default-DzEwllSu.js → inventory-core-dart.default-DsrlA0VP.js} +1 -1
  65. package/dist/{lz-string-DECQ92Sb.js → lz-string-jug66pQ2.js} +1 -1
  66. package/dist/modules/print-template/api/print-template.d.ts +0 -1
  67. package/dist/{netsuite-CKOqNFIz.js → netsuite-CM1xsb3Q.js} +2 -2
  68. package/dist/{number-CwVsldWr.js → number-B1kR4U7C.js} +3 -3
  69. package/dist/{predefined-templates-7P8LQiMs.js → predefined-templates-B3VXqLxq.js} +1 -1
  70. package/dist/{purchase-order-template-CFGG5iZS.js → purchase-order-template-BZ7ubNPM.js} +1 -1
  71. package/dist/{recalculationUtils-CxUnAgYt.js → recalculationUtils-DT_K_oBV.js} +1 -1
  72. package/dist/{rules-C-5mKwH6.js → rules-DXN5yNM9.js} +2 -2
  73. package/dist/{stock-B_XDv328.js → stock-Cwp99-w7.js} +1 -1
  74. package/dist/stores/api.d.ts +0 -1
  75. package/dist/stores/helper/generate-backend-urls.d.ts +0 -1
  76. package/dist/stores/integration/index.d.ts +1 -4
  77. package/dist/{supplier-BDDyN8pD.js → supplier-CNblYzcC.js} +2 -2
  78. package/dist/{surcharge-9qVO99TB.js → surcharge-DiXkOxK8.js} +1 -1
  79. package/dist/tsconfig.app.tsbuildinfo +1 -1
  80. package/dist/{uom-rules-2xdoSjfc.js → uom-rules-B0cj4nFH.js} +1 -1
  81. package/dist/{use-ingredient-select-dialog-BHgTuz0K.js → use-ingredient-select-dialog-CHqjDEzy.js} +2 -2
  82. package/dist/{use-inventory-binding-dialog-CVpVEZ-n.js → use-inventory-binding-dialog-CqKj6_hT.js} +2 -2
  83. package/dist/use-template-enabled-locations-CZf0oezR.js +146 -0
  84. package/dist/{use-transfer-locations-CMPfQCpO.js → use-transfer-locations-BTRfRrp8.js} +2 -2
  85. package/dist/{useHrmPermission-BfjsEgXe.js → useHrmPermission-CYeY_uQ0.js} +1 -1
  86. package/dist/{useNavigationMenu-DQV4rPXu.js → useNavigationMenu-D2DBZszb.js} +2 -2
  87. package/dist/{useSseClient-DyY87MX7.js → useSseClient-DNe-54JD.js} +3 -3
  88. package/dist/views/recipe/composables/use-recipe-bulk-editor.d.ts +3 -3
  89. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1 -4
  90. package/dist/{vue-i18n-WjLZbUYJ.js → vue-i18n-CRix8f2i.js} +419 -419
  91. package/dist/{xlsx-BoG4Nhqx.js → xlsx-4npyDw84.js} +398 -398
  92. package/dist/{xlsx.util-BSJ5fdz4.js → xlsx.util-C-DEH9b0.js} +3 -3
  93. package/package.json +4 -4
  94. package/dist/IntegrationView-BR7yLMpk.js +0 -5100
  95. package/dist/TransferTemplateView-D6dO4-GT.js +0 -2327
  96. package/dist/api/codemax.d.ts +0 -11
  97. package/dist/format-unit-display-dtvjecol.js +0 -1432
  98. package/dist/index-B4O6YlPQ.js +0 -257
  99. package/dist/stores/integration/codemax.d.ts +0 -432
  100. package/dist/use-template-enabled-locations-esKf16CY.js +0 -132
  101. package/dist/views/integration/Codemax.vue.d.ts +0 -2
  102. package/dist/views/integration/components/ApplyProductCodemax.vue.d.ts +0 -341
  103. package/dist/views/integration/components/ApplyProductDialogCodemax.vue.d.ts +0 -298
  104. package/dist/views/integration/components/ApplyProductDialogPropsCodemax.d.ts +0 -17
  105. package/dist/views/integration/components/CodemaxDialog.vue.d.ts +0 -519
  106. package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorDialog.vue.d.ts +0 -2
  107. package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorStep1.vue.d.ts +0 -2
  108. package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorStep2.vue.d.ts +0 -8
  109. package/dist/views/transfer-template/components/template-item-bulk-editor/TemplateItemBulkEditorStep3.vue.d.ts +0 -2
  110. package/dist/views/transfer-template/composables/use-template-item-bulk-editor.d.ts +0 -3225
  111. package/dist/views/transfer-template/helpers/template-item-bulk-editor-export.d.ts +0 -9
@@ -0,0 +1,4586 @@
1
+ import { defineComponent as Y, mergeModels as Pe, useModel as ke, onMounted as ie, ref as L, computed as O, resolveComponent as F, openBlock as x, createElementBlock as E, createElementVNode as l, toDisplayString as R, unref as V, createVNode as A, createBlock as H, withCtx as N, Fragment as P, renderList as ee, normalizeClass as q, normalizeStyle as Qe, createSlots as oe, createCommentVNode as j, withModifiers as Je, reactive as Fe, watch as Ce, isRef as re, Teleport as pe, h as k, createTextVNode as K, watchEffect as Ke } from "vue";
2
+ import { _ as qe } from "./empty-placeholder-B0QU467o.js";
3
+ import { y as Ge, z as Ze, c as ae, u as se, A as We, a as ce, N as ge, B as Ae, C as $, w as ne, D as Be, E as Ve, s as fe } from "./app-BM6mngFA.js";
4
+ import { useDialogChild as $e, useDialog as be, useProxiedModel as ue, useSnackbar as G, useBreakpoints as _e, components as J } from "@feedmepos/ui-library";
5
+ import { _ as et } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
6
+ import { useI18n as Z, useCoreStore as le } from "@feedmepos/mf-common";
7
+ import { _ as tt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-RH37--FG.js";
8
+ import { u as nt, a as st, b as ot, c as at } from "./index-C-Z_O_57.js";
9
+ import { u as te, a as me } from "./netsuite-CM1xsb3Q.js";
10
+ import { b as lt, a as it } from "./FmMultiselectDialog-CfjwOjv0.js";
11
+ import { R as rt } from "./rules-DXN5yNM9.js";
12
+ import { P as Ee, J as Ne, D as Le } from "./app-DiX-EfV6.js";
13
+ import { u as ut } from "./supplier-CNblYzcC.js";
14
+ import { u as ve } from "./vue-i18n-CRix8f2i.js";
15
+ import { _ as dt, a as ct } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-ILexyjQI.js";
16
+ import { a as mt } from "./number-B1kR4U7C.js";
17
+ import { a as he, f as De } from "./date2-DDlrt2dw.js";
18
+ import { F as Te } from "./FmAdminBadge-DjnBAgyv.js";
19
+ import { u as Re } from "./feature-Hkq4qHGO.js";
20
+ import { F as Oe } from "./FmDroppableField-J0xUsOTV.js";
21
+ import { r as Me, u as ze } from "./xlsx-4npyDw84.js";
22
+ const ft = "data:image/svg+xml,%3csvg%20width='200'%20height='101'%20viewBox='0%200%20200%20101'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M98.9161%2038.4456V24.1772H108.527V27.1988H102.12V30.2202H107.347V32.7382H102.12V38.4456H98.9161Z'%20fill='%235D5359'/%3e%3cpath%20d='M110.382%2031.2276C110.382%2027.5345%20113.249%2024.1772%20117.127%2024.1772C121.174%2024.1772%20123.872%2027.7024%20123.872%2031.3953C123.872%2035.0884%20121.005%2038.6133%20117.127%2038.6133C113.08%2038.4456%20110.382%2034.9204%20110.382%2031.2276ZM117.127%2035.5919C119.487%2035.5919%20120.499%2033.4096%20120.499%2031.2276C120.499%2029.0452%20119.319%2027.0309%20117.127%2027.0309C114.935%2027.0309%20113.754%2029.213%20113.754%2031.2276C113.754%2033.5776%20114.935%2035.5919%20117.127%2035.5919Z'%20fill='%235D5359'/%3e%3cpath%20d='M126.232%2031.2276C126.232%2027.5345%20129.099%2024.1772%20132.977%2024.1772C137.024%2024.1772%20139.722%2027.7024%20139.722%2031.3953C139.722%2035.0884%20136.855%2038.6133%20132.977%2038.6133C128.93%2038.4456%20126.232%2034.9204%20126.232%2031.2276ZM132.977%2035.5919C135.337%2035.5919%20136.349%2033.4096%20136.349%2031.2276C136.349%2029.0452%20135.169%2027.0309%20132.977%2027.0309C130.785%2027.0309%20129.604%2029.213%20129.604%2031.2276C129.604%2033.5776%20130.785%2035.5919%20132.977%2035.5919Z'%20fill='%235D5359'/%3e%3cpath%20d='M142.926%2038.4455V24.345H148.153C152.874%2024.345%20155.235%2027.5343%20155.235%2031.3952C155.235%2035.5918%20152.368%2038.4455%20148.153%2038.4455H142.926ZM148.153%2027.0308H146.129V35.4238H148.153C150.513%2035.4238%20151.862%2033.5775%20151.862%2031.2272C151.862%2028.8773%20150.513%2027.0308%20148.153%2027.0308Z'%20fill='%235D5359'/%3e%3cpath%20d='M110.045%2057.5607V49.1676L107.009%2055.2107H105.324L102.12%2049.1676V57.5607H98.9161V43.4604H102.457L106.167%2050.8465L109.876%2043.4604H113.417V57.5607H110.045Z'%20fill='%235D5359'/%3e%3cpath%20d='M115.947%2057.5607L121.342%2043.4604H124.04L129.436%2057.5607H125.895L124.715%2054.3716H120.331L119.319%2057.5607H115.947ZM122.691%2046.9856L121.005%2052.1893H124.378L122.691%2046.9856Z'%20fill='%235D5359'/%3e%3cpath%20d='M131.965%2057.5607V43.4604H138.373C141.07%2043.4604%20142.925%2045.8105%20142.925%2048.1605C142.925%2049.8393%20142.082%2051.5179%20140.565%2052.1893L143.768%2057.393H140.059L137.192%2052.8607H135V57.393H131.965V57.5607ZM135.169%2050.175H138.204C139.047%2050.175%20139.553%2049.3356%20139.553%2048.1605C139.553%2046.9856%20138.71%2046.3142%20138.035%2046.3142H135.169V50.175Z'%20fill='%235D5359'/%3e%3cpath%20d='M146.635%2057.5607V43.4604H150.007V49.8393L155.403%2043.4604H158.776L153.548%2049.6713L159.281%2057.5607H155.74L151.693%2051.5179L150.007%2053.3642V57.5607H146.635Z'%20fill='%235D5359'/%3e%3cpath%20d='M171.422%2054.7073V57.5607H161.474V43.4604H171.253V46.3142H164.677V48.9999H170.242V51.6856H164.677V54.7073H171.422Z'%20fill='%235D5359'/%3e%3cpath%20d='M185.417%2046.3142H181.202V57.5607H177.829V46.3142H173.614V43.4604H185.417V46.3142Z'%20fill='%235D5359'/%3e%3cpath%20d='M111.057%2062.5967V76.6973H107.853V70.9898H102.12V76.6973H98.9161V62.5967H102.12V68.1361H107.853V62.5967H111.057Z'%20fill='%235D5359'/%3e%3cpath%20d='M124.04%2069.815V62.5967H127.244V69.815C127.244%2073.6758%20125.389%2076.865%20121.005%2076.865C116.453%2076.865%20114.766%2073.5078%20114.766%2069.815V62.5967H117.97V69.815C117.97%2071.997%20118.813%2074.0115%20121.005%2074.0115C123.366%2074.0115%20124.04%2071.997%20124.04%2069.815Z'%20fill='%235D5359'/%3e%3cpath%20d='M138.036%2076.6973H131.122V62.5967H139.047C141.071%2062.5967%20142.251%2064.4433%20142.251%2066.2898C142.251%2067.6327%20141.576%2068.9755%20140.228%2069.4793C141.914%2069.9827%20142.926%2071.1578%20142.926%2073.1721C142.757%2075.5221%20140.733%2076.6973%20138.036%2076.6973ZM134.326%2065.4504V68.3041H137.53C138.204%2068.3041%20138.879%2067.8004%20138.879%2066.7933C138.879%2065.7861%20138.373%2065.2827%20137.698%2065.2827H134.326V65.4504ZM138.204%2070.8221H134.494V73.8435H138.204C139.047%2073.8435%20139.722%2073.1721%20139.722%2072.3327C139.553%2071.6613%20138.879%2070.8221%20138.204%2070.8221Z'%20fill='%235D5359'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M73.4753%2051.4994C78.7281%2050.5396%2082.8911%2046.4891%2083.9954%2041.3137L84.1232%2040.7134L83.9445%2040.1256C80.5804%2029.066%2071.9945%2020.2704%2061.0373%2016.5726C57.4%2015.3451%2053.5046%2014.6804%2049.458%2014.6804C45.4112%2014.6804%2041.5158%2015.3451%2037.8784%2016.5726C26.9214%2020.2704%2018.3354%2029.066%2014.9712%2040.1256L14.7924%2040.7134L14.9206%2041.3137C16.0247%2046.4891%2020.1875%2050.5396%2025.4405%2051.4994V58.8839H14.4183C14.6758%2059.9557%2014.9818%2061.0088%2015.3337%2062.0411C20.1553%2076.1811%2033.6083%2086.3619%2049.458%2086.3619C65.3074%2086.3619%2078.7606%2076.1811%2083.5822%2062.0411C83.9342%2061.0088%2084.2399%2059.9557%2084.4974%2058.8839H73.4753V51.4994ZM41.0517%2020.5973V38.5742C41.0517%2043.1931%2044.8155%2046.9371%2049.458%2046.9371C54.1005%2046.9371%2057.8641%2043.1931%2057.8641%2038.5742V20.5973C55.1919%2019.856%2052.3732%2019.4592%2049.458%2019.4592C46.5428%2019.4592%2043.7241%2019.856%2041.0517%2020.5973ZM62.6675%2022.3673V38.5742C62.6675%2043.1931%2066.431%2046.9371%2071.0735%2046.9371C74.9051%2046.9371%2078.1425%2044.3848%2079.1528%2040.8942C76.4672%2032.6902%2070.4379%2025.9824%2062.6675%2022.3673ZM60.2658%2046.1322C57.8753%2049.5094%2053.9255%2051.7159%2049.458%2051.7159C44.9902%2051.7159%2041.0408%2049.5094%2038.65%2046.1322C36.6982%2048.8894%2033.7074%2050.8662%2030.2439%2051.4994V58.8839H68.6718V51.4994C65.2083%2050.8662%2062.2175%2048.8894%2060.2658%2046.1322ZM21.1583%2063.6628C26.1349%2074.2514%2036.9382%2081.5834%2049.458%2081.5834C61.9776%2081.5834%2072.781%2074.2514%2077.7574%2063.6628H21.1583ZM36.2482%2038.5742V22.3673C28.4779%2025.9824%2022.4486%2032.6902%2019.7631%2040.8942C20.7733%2044.3848%2024.0106%2046.9371%2027.8422%2046.9371C32.4847%2046.9371%2036.2482%2043.1931%2036.2482%2038.5742Z'%20fill='%23FFC35D'/%3e%3c/svg%3e";
23
+ var je = { exports: {} };
24
+ (function(_, h) {
25
+ (function() {
26
+ var o = {};
27
+ _.exports = o, o.simpleFilter = function(d, s) {
28
+ return s.filter(function(i) {
29
+ return o.test(d, i);
30
+ });
31
+ }, o.test = function(d, s) {
32
+ return o.match(d, s) !== null;
33
+ }, o.match = function(d, s, i) {
34
+ i = i || {};
35
+ var r = 0, t = [], p = s.length, S = 0, I = 0, f = i.pre || "", g = i.post || "", y = i.caseSensitive && s || s.toLowerCase(), w;
36
+ d = i.caseSensitive && d || d.toLowerCase();
37
+ for (var C = 0; C < p; C++)
38
+ w = s[C], y[C] === d[r] ? (w = f + w + g, r += 1, I += 1 + I) : I = 0, S += I, t[t.length] = w;
39
+ return r === d.length ? (S = y === d ? 1 / 0 : S, { rendered: t.join(""), score: S }) : null;
40
+ }, o.filter = function(d, s, i) {
41
+ return !s || s.length === 0 ? [] : typeof d != "string" ? s : (i = i || {}, s.reduce(function(r, t, p, S) {
42
+ var I = t;
43
+ i.extract && (I = i.extract(t));
44
+ var f = o.match(d, I, i);
45
+ return f != null && (r[r.length] = {
46
+ string: f.rendered,
47
+ score: f.score,
48
+ index: p,
49
+ original: t
50
+ }), r;
51
+ }, []).sort(function(r, t) {
52
+ var p = t.score - r.score;
53
+ return p || r.index - t.index;
54
+ }));
55
+ };
56
+ })();
57
+ })(je);
58
+ var pt = je.exports;
59
+ const Ue = /* @__PURE__ */ Ge(pt);
60
+ function Ie(_, h) {
61
+ return Ue.filter(_, h).length > 0;
62
+ }
63
+ function vt(_, h) {
64
+ if (!_)
65
+ return {
66
+ label: h,
67
+ segments: [
68
+ {
69
+ isMatch: !1,
70
+ segment: h
71
+ }
72
+ ],
73
+ matched: !1
74
+ };
75
+ const [o] = Ue.filter(_.toLocaleLowerCase(), [h], {
76
+ pre: "|",
77
+ post: "|"
78
+ });
79
+ if (!o)
80
+ return {
81
+ label: h,
82
+ segments: [{ segment: h, isMatch: !1 }],
83
+ matched: !1
84
+ };
85
+ const d = o.string.toString().replace(/\|\|/g, "").split("|").reduce((s, i, r) => (s.push({
86
+ segment: i,
87
+ isMatch: r % 2 !== 0
88
+ //e.g. index 1, 3, 5, ...
89
+ }), s), new Array());
90
+ return {
91
+ label: h,
92
+ segments: d,
93
+ matched: !0
94
+ };
95
+ }
96
+ function W(_) {
97
+ return Object.prototype.hasOwnProperty.call(_, "children");
98
+ }
99
+ const gt = { class: "flex flex-col gap-12 h-[350px]" }, yt = { class: "flex items-center" }, At = {
100
+ class: "flex-1",
101
+ "data-cy": "items-selected"
102
+ }, bt = {
103
+ class: "flex-1",
104
+ "data-cy": "filter-field"
105
+ }, ht = ["data-cy"], xt = { class: "flex flex-col" }, It = { class: "fm-typo-en-body-md-400" }, St = {
106
+ key: 1,
107
+ class: "w-full py-16 text-fm-color-typo-disabled fm-typo-en-body-md-400 text-center"
108
+ }, He = /* @__PURE__ */ Y({
109
+ __name: "FmNestedMultiselectDialog",
110
+ props: /* @__PURE__ */ Pe({
111
+ modelValue: {}
112
+ }, {
113
+ modelValue: {},
114
+ modelModifiers: {}
115
+ }),
116
+ emits: ["update:modelValue"],
117
+ setup(_) {
118
+ const h = ke(_, "modelValue"), o = $e();
119
+ ie(() => {
120
+ o.emitData(h.value);
121
+ });
122
+ const d = L(""), { t: s } = Z();
123
+ function i(u) {
124
+ return Ie(
125
+ d.value,
126
+ u.sublabel ? [u.label, u.sublabel] : [u.label]
127
+ );
128
+ }
129
+ function r(u) {
130
+ return i(u) ? !0 : W(u) ? u.children.some(r) : !1;
131
+ }
132
+ function t(u, b) {
133
+ if (!d.value)
134
+ return !0;
135
+ const [B, ...T] = u;
136
+ if (typeof B != "number")
137
+ return !1;
138
+ const M = b[B];
139
+ return Ie(
140
+ d.value,
141
+ M.sublabel ? [M.label, M.sublabel] : [M.label]
142
+ ) ? !0 : T.length === 0 ? r(M) : W(M) ? t(T, M.children) : !1;
143
+ }
144
+ function p(u, b, B = 0, T = !1) {
145
+ if (W(u) && u.children.length) {
146
+ const { children: M, ...X } = u, D = M.flatMap(
147
+ (z, U) => p(z, [...b, U], B + 1, T || u.disabled)
148
+ );
149
+ return [
150
+ {
151
+ ...X,
152
+ keys: b,
153
+ indent: B,
154
+ collapsible: !0,
155
+ disabled: T || u.disabled
156
+ },
157
+ ...D
158
+ ];
159
+ }
160
+ return [
161
+ {
162
+ ...u,
163
+ keys: b,
164
+ indent: B,
165
+ collapsible: !1,
166
+ disabled: T || u.disabled
167
+ }
168
+ ];
169
+ }
170
+ const S = O(() => h.value.flatMap(
171
+ (u, b) => p(u, [b]).filter((B) => t(B.keys, h.value))
172
+ ));
173
+ function I(u) {
174
+ if (W(u)) {
175
+ if (r(u)) {
176
+ const b = i(u) ? u.children : u.children.filter(r);
177
+ return b.length === 0 ? !1 : b.every(I);
178
+ }
179
+ return u.children.every(I);
180
+ }
181
+ return u.active ?? !1;
182
+ }
183
+ function f(u, b) {
184
+ const [B, ...T] = u;
185
+ if (typeof B != "number")
186
+ return !1;
187
+ const M = b[B];
188
+ return T.length === 0 ? I(M ?? []) : W(M) ? f(T, M.children ?? []) : !1;
189
+ }
190
+ function g(u) {
191
+ if (W(u)) {
192
+ if (r(u)) {
193
+ const b = i(u) ? u.children : u.children.filter(r);
194
+ return b.length === 0 ? !1 : b.some(I) && !b.every(I);
195
+ }
196
+ return !1;
197
+ }
198
+ return !1;
199
+ }
200
+ function y(u, b) {
201
+ const [B, ...T] = u;
202
+ if (typeof B != "number")
203
+ return !1;
204
+ const M = b[B];
205
+ return T.length === 0 ? g(M ?? []) : W(M) ? y(T, (M == null ? void 0 : M.children) ?? []) : !1;
206
+ }
207
+ function w(u, b) {
208
+ if (u.disabled)
209
+ return u;
210
+ if (W(u)) {
211
+ if (r(u)) {
212
+ const B = i(u) ? u.children : u.children.filter(r);
213
+ return {
214
+ ...u,
215
+ children: u.children.map((T) => B.find((X) => Ze(X.value, T.value)) ? w(T, b) : T)
216
+ };
217
+ }
218
+ return {
219
+ ...u,
220
+ children: u.children.map((B) => w(B, b))
221
+ };
222
+ }
223
+ return {
224
+ ...u,
225
+ active: b
226
+ };
227
+ }
228
+ function C(u, b, B) {
229
+ const [T, ...M] = u;
230
+ return typeof T != "number" ? b : M.length === 0 ? b.map((X, D) => T !== D ? X : w(X, B)) : b.map(
231
+ (X, D) => T === D && W(X) ? {
232
+ ...X,
233
+ children: C(M, X.children, B)
234
+ } : X
235
+ );
236
+ }
237
+ const c = L(new Array());
238
+ function e(u) {
239
+ const b = u.join();
240
+ return c.value.find((B) => b === B);
241
+ }
242
+ function n(u) {
243
+ const b = u.join();
244
+ e(u) ? c.value = c.value.filter((B) => B !== b) : c.value = [...c.value, b];
245
+ }
246
+ function v(u) {
247
+ const b = u.join();
248
+ return c.value.find((B) => b.startsWith(B) && b !== B);
249
+ }
250
+ const m = O(
251
+ () => S.value.filter((u) => t(u.keys, h.value) && u.active).length
252
+ );
253
+ function a(u, b, B) {
254
+ h.value = C(u, b, B), o.emitData(h.value);
255
+ }
256
+ return (u, b) => {
257
+ const B = F("FmSearch"), T = F("FmCheckbox"), M = F("FmButton"), X = F("FmListItem"), D = F("FmList");
258
+ return x(), E("div", gt, [
259
+ l("div", yt, [
260
+ l("div", At, R(V(s)("inventory.formField.itemsSelected", { count: m.value })), 1),
261
+ l("div", bt, [
262
+ A(B, {
263
+ modelValue: d.value,
264
+ "onUpdate:modelValue": b[0] || (b[0] = (z) => d.value = z),
265
+ placeholder: V(s)("inventory.formField.filterItems")
266
+ }, null, 8, ["modelValue", "placeholder"])
267
+ ])
268
+ ]),
269
+ S.value.length ? (x(), H(D, {
270
+ key: 0,
271
+ class: "flex-1 overflow-y-auto"
272
+ }, {
273
+ default: N(() => [
274
+ (x(!0), E(P, null, ee(S.value, (z) => (x(), E("div", {
275
+ key: z.keys.join(),
276
+ class: q([
277
+ "transition-all overflow-y-clip",
278
+ v(z.keys) ? "max-h-0 opacity-0" : "max-h-[50px] opacity-100"
279
+ ]),
280
+ "data-cy": `nested-${z.keys.join("-")}-${z.label}`
281
+ }, [
282
+ A(X, {
283
+ clickable: z.selectable !== !1,
284
+ onClick: () => z.selectable === !1 || z.disabled || a(z.keys, h.value, !f(z.keys, h.value)),
285
+ style: Qe({
286
+ paddingLeft: `${16 + z.indent * 16}px`,
287
+ paddingTop: "4px",
288
+ paddingBottom: "4px"
289
+ }),
290
+ disabled: z.selectable !== !1 && z.disabled
291
+ }, oe({
292
+ default: N(() => [
293
+ l("div", xt, [
294
+ l("div", It, [
295
+ (x(!0), E(P, null, ee(V(vt)(d.value, z.label).segments, (U, de) => (x(), E("span", {
296
+ key: de,
297
+ class: q({
298
+ "font-bold": U.isMatch
299
+ })
300
+ }, R(U.segment), 3))), 128))
301
+ ]),
302
+ z.sublabel ? (x(), E("div", {
303
+ key: 0,
304
+ class: q([
305
+ "fm-typo-en-body-sm-400",
306
+ z.disabled ? "" : "text-fm-color-typo-secondary"
307
+ ])
308
+ }, R(z.sublabel), 3)) : j("", !0)
309
+ ])
310
+ ]),
311
+ _: 2
312
+ }, [
313
+ z.selectable !== !1 ? {
314
+ name: "prepend",
315
+ fn: N(() => [
316
+ A(T, {
317
+ disabled: z.disabled,
318
+ "model-value": f(z.keys, h.value),
319
+ value: z.keys,
320
+ indeterminate: y(z.keys, h.value)
321
+ }, null, 8, ["disabled", "model-value", "value", "indeterminate"])
322
+ ]),
323
+ key: "0"
324
+ } : void 0,
325
+ z.collapsible ? {
326
+ name: "append",
327
+ fn: N(() => [
328
+ A(M, {
329
+ "prepend-icon": e(z.keys) ? "expand_less" : "expand_more",
330
+ size: "md",
331
+ variant: "tertiary",
332
+ onClick: Je(() => n(z.keys), ["stop"])
333
+ }, null, 8, ["prepend-icon", "onClick"])
334
+ ]),
335
+ key: "1"
336
+ } : void 0
337
+ ]), 1032, ["clickable", "onClick", "style", "disabled"])
338
+ ], 10, ht))), 128))
339
+ ]),
340
+ _: 1
341
+ })) : (x(), E("div", St, R(V(s)("inventory.formField.noItemsFound")), 1))
342
+ ]);
343
+ };
344
+ }
345
+ }), wt = { class: "flex flex-col rounded border border-fm-color-neutral-gray-100 px-5 py-5 gap-5" }, kt = { class: "flex items-center" }, Ft = { class: "text-lg font-bold flex-grow" }, Ct = {
346
+ key: 0,
347
+ class: "table-auto w-full"
348
+ }, Bt = { class: "text-left" }, Vt = { class: "min-w-64" }, _t = { class: "flex flex-col" }, Et = { class: "fm-typo-en-body-md-400" }, Nt = {
349
+ key: 0,
350
+ class: "fm-typo-en-body-sm-400 text-fm-color-neutral-gray-400"
351
+ }, Lt = { class: "w-1" }, Dt = /* @__PURE__ */ Y({
352
+ __name: "ApplyAddon",
353
+ props: {
354
+ groups: {
355
+ type: Array,
356
+ required: !0
357
+ },
358
+ modifiers: {
359
+ type: Array,
360
+ required: !0
361
+ },
362
+ items: {
363
+ type: Array,
364
+ required: !0
365
+ },
366
+ loading: {
367
+ type: Boolean
368
+ }
369
+ },
370
+ emits: ["update:modifiers"],
371
+ setup(_, { emit: h }) {
372
+ const o = _, d = h, s = be(), i = O(() => {
373
+ const f = o.groups.flatMap((g) => g.items.map((y) => {
374
+ const w = o.items.find((C) => C._id === y._id);
375
+ return {
376
+ ...y,
377
+ groupName: g.name,
378
+ name: y.name ?? (w == null ? void 0 : w.name) ?? "-"
379
+ };
380
+ }));
381
+ return o.modifiers.map((g) => {
382
+ const y = f.find((c) => c.selection === g.selection), w = (y == null ? void 0 : y.name) ?? "-", C = (y == null ? void 0 : y.groupName) ?? "";
383
+ return {
384
+ ...g,
385
+ name: w,
386
+ groupName: C
387
+ };
388
+ });
389
+ }), r = O(() => o.groups.flatMap((f) => f.items.map((g) => ({ ...g, groupId: f._id }))));
390
+ function t({ selection: f }) {
391
+ d(
392
+ "update:modifiers",
393
+ o.modifiers.filter((g) => g.selection !== f)
394
+ );
395
+ }
396
+ function p({ selection: f }, g) {
397
+ const y = o.modifiers.find((w) => w.selection === f);
398
+ y && (y.code = g);
399
+ }
400
+ function S() {
401
+ let f = [];
402
+ o.groups.forEach((y) => {
403
+ let w = !1;
404
+ y.items.every((C) => C._id.startsWith("item")) && (w = !0), f.push({
405
+ label: y.name,
406
+ sublabel: "Group",
407
+ value: y._id,
408
+ disabled: w,
409
+ children: y.items.reduce((C, c) => {
410
+ var v;
411
+ const e = o.items.find((m) => m._id === c._id), n = (v = e == null ? void 0 : e.variant) == null ? void 0 : v.variantCombinations.find(
412
+ (m) => m.combinationKey === (c == null ? void 0 : c.combinationKey)
413
+ );
414
+ return [
415
+ ...C,
416
+ {
417
+ label: `${c.name ?? (e == null ? void 0 : e.name)} ${n ? `(${n.name})` : ""}`,
418
+ value: `${c.selection}${n ? `/${n == null ? void 0 : n.combinationKey}` : ""}`,
419
+ disabled: w,
420
+ active: !!o.modifiers.find(({ selection: m }) => m === c.selection)
421
+ }
422
+ ];
423
+ }, [])
424
+ });
425
+ });
426
+ const g = {
427
+ modelValue: f
428
+ };
429
+ s.open({
430
+ title: "Select Addons",
431
+ contentComponent: He,
432
+ contentComponentProps: g,
433
+ primaryActions: {
434
+ text: "Confirm",
435
+ close: !0
436
+ }
437
+ }).onPrimary((y) => {
438
+ const w = ae(o.modifiers);
439
+ let C = [];
440
+ function c(e, n) {
441
+ if (n(e), W(e))
442
+ for (let v of e.children)
443
+ c(v, n);
444
+ }
445
+ y.forEach((e) => {
446
+ c(e, (n) => {
447
+ var u;
448
+ if (o.groups.find(({ _id: b }) => b === n.value)) return;
449
+ const m = r.value.find(({ selection: b }) => b === n.value), a = C.find(({ selection: b }) => n.value === b);
450
+ !W(n) && n.active && a === void 0 && C.push({
451
+ addonGroupId: (m == null ? void 0 : m.groupId) ?? "",
452
+ selection: n.value,
453
+ code: ((u = w.find(({ selection: b }) => n.value === b)) == null ? void 0 : u.code) ?? ""
454
+ });
455
+ });
456
+ }), d("update:modifiers", C);
457
+ });
458
+ }
459
+ const { t: I } = Z();
460
+ return (f, g) => {
461
+ const y = F("FmButton"), w = F("FmTextField");
462
+ return x(), E("div", wt, [
463
+ l("div", kt, [
464
+ l("div", Ft, R(V(I)("inventory.integration.apply.addons")), 1),
465
+ A(y, {
466
+ type: "button",
467
+ variant: "plain",
468
+ size: "md",
469
+ icon: "link",
470
+ label: V(I)("inventory.integration.apply.applyAddon"),
471
+ onClick: g[0] || (g[0] = (C) => S())
472
+ }, null, 8, ["label"])
473
+ ]),
474
+ l("div", null, [
475
+ i.value.length > 0 ? (x(), E("table", Ct, [
476
+ l("tr", Bt, [
477
+ l("th", Vt, R(V(I)("inventory.integration.apply.name")), 1),
478
+ l("th", null, R(V(I)("inventory.integration.apply.code")), 1),
479
+ g[1] || (g[1] = l("th", { class: "w-1" }, " ", -1))
480
+ ]),
481
+ (x(!0), E(P, null, ee(i.value, (C, c) => (x(), E(P, { key: c }, [
482
+ g[2] || (g[2] = l("tr", { class: "block h-8" }, null, -1)),
483
+ l("tr", null, [
484
+ l("td", null, [
485
+ l("div", _t, [
486
+ l("div", Et, R(C.name), 1),
487
+ C.groupName ? (x(), E("div", Nt, R(C.groupName), 1)) : j("", !0)
488
+ ])
489
+ ]),
490
+ l("td", null, [
491
+ A(w, {
492
+ disabled: _.loading,
493
+ "model-value": C.code,
494
+ "onUpdate:modelValue": [(e) => C.code = e, (e) => p(C, e)],
495
+ rules: [
496
+ function(n) {
497
+ return !!n || "Required";
498
+ }
499
+ ]
500
+ }, null, 8, ["disabled", "model-value", "onUpdate:modelValue", "rules"])
501
+ ]),
502
+ l("td", Lt, [
503
+ A(y, {
504
+ disabled: _.loading,
505
+ type: "button",
506
+ variant: "tertiary",
507
+ icon: "delete",
508
+ "icon-color": "#000000",
509
+ size: "md",
510
+ onClick: (e) => t(C)
511
+ }, null, 8, ["disabled", "onClick"])
512
+ ])
513
+ ])
514
+ ], 64))), 128))
515
+ ])) : j("", !0)
516
+ ])
517
+ ]);
518
+ };
519
+ }
520
+ });
521
+ function Tt(_, h = []) {
522
+ const o = h.map((s) => _.find((i) => i._id === s)).filter((s) => !!s);
523
+ return Ot(o).reduce((s, i) => (s[i.combinationKey] = i.selectionName.join(" / "), s), {});
524
+ }
525
+ function Rt(_, h, o) {
526
+ const d = o.reduce((i, r) => {
527
+ var I, f, g;
528
+ const t = r.category || "", p = Tt(h, (I = r.variant) == null ? void 0 : I.variantGroupIds), S = {
529
+ ...r,
530
+ codeName: [r.code, r.name].filter((y) => !!y).join(" "),
531
+ variant: {
532
+ variantGroupIds: ((f = r.variant) == null ? void 0 : f.variantGroupIds) || [],
533
+ variantCombinations: (((g = r.variant) == null ? void 0 : g.variantCombinations) || []).map((y) => {
534
+ const w = y.code, C = y.name || p[y.combinationKey || ""];
535
+ return {
536
+ ...y,
537
+ codeName: [w, C].filter((c) => !!c).join(" ").trim() || "-"
538
+ };
539
+ })
540
+ }
541
+ };
542
+ return i[t] = i[t] ? [...i[t], S] : [S], i;
543
+ }, {}), s = Object.values(d)[0];
544
+ return _.length === 0 && s ? s.map((i) => ({
545
+ id: i._id,
546
+ name: i.name ?? "",
547
+ items: d[i._id || ""] || []
548
+ })) || [] : _.map((i) => ({
549
+ id: i._id,
550
+ name: i.name ?? "",
551
+ items: d[i._id || ""] || []
552
+ }));
553
+ }
554
+ function Xe(_, h) {
555
+ if (_.length == 1)
556
+ return _[0];
557
+ const o = _[0], d = _.slice(1, _.length), s = Xe(d, h);
558
+ return o.reduce((r, t) => [...r, ...s.map((p) => h(t, p))], new Array());
559
+ }
560
+ function Ot(_) {
561
+ if (_.length === 0) return [];
562
+ const h = _.map(
563
+ (d) => (d.options ?? []).map(
564
+ (s) => ({
565
+ combinationKey: [`${d._id}/${s._id}`],
566
+ selectionName: [s.name ?? ""]
567
+ })
568
+ )
569
+ );
570
+ return Xe(h, (d, s) => ({
571
+ combinationKey: [...d.combinationKey, ...s.combinationKey],
572
+ selectionName: [...d.selectionName, ...s.selectionName]
573
+ })).map((d) => {
574
+ const s = [...d.combinationKey];
575
+ return s.sort(), {
576
+ combinationKey: s.join("/"),
577
+ active: !0,
578
+ selectionName: d.selectionName
579
+ };
580
+ });
581
+ }
582
+ const Mt = { class: "flex flex-col rounded border border-fm-color-neutral-gray-100 px-5 py-5 gap-5 mb-3" }, zt = { class: "flex items-center" }, jt = { class: "text-lg font-bold flex-grow" }, Ut = {
583
+ key: 0,
584
+ class: "table-auto w-full"
585
+ }, Ht = { class: "text-left" }, Xt = { class: "min-w-64" }, Yt = { class: "flex flex-col" }, Pt = { class: "fm-typo-en-body-md-400" }, Qt = {
586
+ key: 0,
587
+ class: "fm-typo-en-body-sm-400 text-fm-color-neutral-gray-400"
588
+ }, Jt = { class: "w-1" }, ye = /* @__PURE__ */ Y({
589
+ __name: "ApplyProduct",
590
+ props: {
591
+ isAddon: {
592
+ type: Boolean,
593
+ default: !1
594
+ },
595
+ bindings: {
596
+ type: Array,
597
+ required: !0
598
+ },
599
+ categories: {
600
+ type: Array,
601
+ required: !0
602
+ },
603
+ variants: {
604
+ type: Object,
605
+ required: !0
606
+ },
607
+ menus: {
608
+ type: Array,
609
+ required: !0
610
+ }
611
+ },
612
+ emits: ["update:bindings"],
613
+ setup(_, { emit: h }) {
614
+ const o = _, d = h, s = be(), i = O(() => o.isAddon ? "Addons" : "Products"), r = O(() => o.isAddon ? [] : o.categories), t = O(
615
+ () => Rt(r.value, o.variants, o.menus)
616
+ ), p = O(() => {
617
+ if (o.isAddon)
618
+ return o.bindings.map((n) => {
619
+ const v = o.menus.find((a) => a._id === n.productId), m = (v == null ? void 0 : v.name) ?? "-";
620
+ return {
621
+ ...n,
622
+ name: m,
623
+ itemCode: (v == null ? void 0 : v.code) ?? "-"
624
+ };
625
+ });
626
+ const e = t.value.flatMap((n) => n.items);
627
+ return o.bindings.map((n) => {
628
+ var b;
629
+ const v = e.find((B) => B._id === n.productId), m = (v == null ? void 0 : v.name) ?? "-";
630
+ let a = (v == null ? void 0 : v.code) ?? "-", u;
631
+ if (n.combinationKey) {
632
+ const B = (((b = v == null ? void 0 : v.variant) == null ? void 0 : b.variantCombinations) || []).find(
633
+ (T) => T.combinationKey === n.combinationKey
634
+ );
635
+ u = (B == null ? void 0 : B.name) ?? (B == null ? void 0 : B.codeName) ?? "", a = (B == null ? void 0 : B.code) ?? a;
636
+ }
637
+ return {
638
+ ...n,
639
+ name: m,
640
+ itemCode: a,
641
+ variantName: u
642
+ };
643
+ });
644
+ });
645
+ function S(e) {
646
+ d(
647
+ "update:bindings",
648
+ o.bindings.filter(
649
+ (n) => n.productId !== e.productId || n.combinationKey !== e.combinationKey
650
+ )
651
+ );
652
+ }
653
+ function I({ productId: e, combinationKey: n }, v) {
654
+ const m = o.bindings.find(
655
+ (a) => a.productId === e && a.combinationKey === n
656
+ );
657
+ m && (m.code = v);
658
+ }
659
+ function f() {
660
+ return t.value.map((e) => ({
661
+ label: e.name,
662
+ sublabel: "Category",
663
+ value: e.name,
664
+ disabled: !1,
665
+ children: e.items.map((n) => {
666
+ var m;
667
+ const v = (m = n.variant) == null ? void 0 : m.variantCombinations;
668
+ return v != null && v.length ? {
669
+ label: n.name ?? "",
670
+ value: n._id,
671
+ sublabel: "Product",
672
+ children: [
673
+ {
674
+ label: n.codeName ?? "",
675
+ value: {
676
+ productId: n._id
677
+ },
678
+ active: !!o.bindings.find(
679
+ ({ productId: a, combinationKey: u }) => n._id === a && !u
680
+ )
681
+ },
682
+ ...v.map((a) => ({
683
+ label: a.codeName ?? "",
684
+ value: {
685
+ productId: n._id,
686
+ combinationKey: a.combinationKey
687
+ },
688
+ sublabel: "Variant",
689
+ active: !!o.bindings.find(
690
+ ({ productId: u, combinationKey: b }) => n._id === u && a.combinationKey === b
691
+ )
692
+ }))
693
+ ]
694
+ } : {
695
+ label: n.codeName ?? "",
696
+ value: {
697
+ productId: n._id
698
+ },
699
+ active: !!o.bindings.find(
700
+ ({ productId: a, combinationKey: u }) => n._id === a && !u
701
+ )
702
+ };
703
+ })
704
+ }));
705
+ }
706
+ function g() {
707
+ return o.menus.map((e) => ({
708
+ label: e.name,
709
+ value: { productId: e._id },
710
+ active: !!o.bindings.find(
711
+ ({ productId: n, combinationKey: v }) => e._id === n && !v
712
+ )
713
+ }));
714
+ }
715
+ function y(e) {
716
+ const n = ae(o.bindings);
717
+ return e.flatMap((v) => v.children.flatMap((m) => {
718
+ var u;
719
+ if (W(m))
720
+ return m.children.filter((b) => b.active).map((b) => {
721
+ var M, X;
722
+ const { productId: B, combinationKey: T } = b.value;
723
+ return T ? {
724
+ productId: B,
725
+ combinationKey: T,
726
+ code: ((M = n.find(
727
+ ({ productId: D, combinationKey: z }) => B === D && T === z
728
+ )) == null ? void 0 : M.code) ?? ""
729
+ } : {
730
+ productId: B,
731
+ code: ((X = n.find(({ productId: D, combinationKey: z }) => B === D && !z)) == null ? void 0 : X.code) ?? ""
732
+ };
733
+ });
734
+ if (!m.active)
735
+ return [];
736
+ const { productId: a } = m.value;
737
+ return [
738
+ {
739
+ productId: a,
740
+ code: ((u = n.find(({ productId: b, combinationKey: B }) => a === b && !B)) == null ? void 0 : u.code) ?? ""
741
+ }
742
+ ];
743
+ }));
744
+ }
745
+ function w(e) {
746
+ const n = ae(o.bindings);
747
+ return e.filter((v) => v.active).map(
748
+ (v) => {
749
+ var m;
750
+ return {
751
+ productId: v.value.productId,
752
+ code: ((m = n.find(({ productId: a }) => a === v.value.productId)) == null ? void 0 : m.code) ?? ""
753
+ };
754
+ }
755
+ );
756
+ }
757
+ function C() {
758
+ let e;
759
+ o.isAddon ? e = g() : e = f();
760
+ const n = {
761
+ modelValue: e
762
+ };
763
+ s.open({
764
+ title: `Select ${i.value}`,
765
+ contentComponent: He,
766
+ contentComponentProps: n,
767
+ primaryActions: {
768
+ text: "Confirm",
769
+ close: !0
770
+ }
771
+ }).onPrimary((v) => {
772
+ let m;
773
+ o.isAddon ? m = w(v) : m = y(v), d("update:bindings", m);
774
+ });
775
+ }
776
+ const { t: c } = Z();
777
+ return (e, n) => {
778
+ const v = F("FmButton"), m = F("FmTextField");
779
+ return x(), E("div", Mt, [
780
+ l("div", zt, [
781
+ l("div", jt, R(_.isAddon ? V(c)("inventory.integration.apply.addons") : V(c)("inventory.integration.apply.products")), 1),
782
+ A(v, {
783
+ type: "button",
784
+ variant: "plain",
785
+ size: "md",
786
+ icon: "link",
787
+ label: _.isAddon ? V(c)("inventory.integration.apply.applyAddon") : V(c)("inventory.integration.apply.applyProduct"),
788
+ onClick: n[0] || (n[0] = (a) => C())
789
+ }, null, 8, ["label"])
790
+ ]),
791
+ l("div", null, [
792
+ p.value.length > 0 ? (x(), E("table", Ut, [
793
+ l("thead", null, [
794
+ l("tr", Ht, [
795
+ l("th", Xt, R(V(c)("inventory.integration.apply.name")), 1),
796
+ l("th", null, R(V(c)("inventory.integration.apply.code")), 1),
797
+ n[1] || (n[1] = l("th", { class: "w-1" }, " ", -1))
798
+ ])
799
+ ]),
800
+ l("tbody", null, [
801
+ (x(!0), E(P, null, ee(p.value, (a, u) => (x(), E(P, { key: u }, [
802
+ n[2] || (n[2] = l("tr", { class: "block h-8" }, null, -1)),
803
+ l("tr", null, [
804
+ l("td", null, [
805
+ l("div", Yt, [
806
+ l("div", Pt, R(a.itemCode) + " " + R(a.name), 1),
807
+ a.variantName ? (x(), E("div", Qt, R(a.variantName), 1)) : j("", !0)
808
+ ])
809
+ ]),
810
+ l("td", null, [
811
+ A(m, {
812
+ "model-value": a.code,
813
+ "onUpdate:modelValue": [(b) => a.code = b, (b) => I(a, b)],
814
+ rules: [
815
+ function(B) {
816
+ return !!B || "Required";
817
+ }
818
+ ]
819
+ }, null, 8, ["model-value", "onUpdate:modelValue", "rules"])
820
+ ]),
821
+ l("td", Jt, [
822
+ A(v, {
823
+ type: "button",
824
+ variant: "tertiary",
825
+ icon: "delete",
826
+ "icon-color": "#000000",
827
+ size: "md",
828
+ onClick: (b) => S(a)
829
+ }, null, 8, ["onClick"])
830
+ ])
831
+ ])
832
+ ], 64))), 128))
833
+ ])
834
+ ])) : j("", !0)
835
+ ])
836
+ ]);
837
+ };
838
+ }
839
+ }), Kt = { class: "flex flex-col gap-8 w-full" }, qt = /* @__PURE__ */ Y({
840
+ __name: "ApplyProductDialog",
841
+ props: {
842
+ categories: { default: () => [] },
843
+ variants: { default: () => [] },
844
+ menus: { default: () => [] },
845
+ groups: { default: () => [] },
846
+ setting: {},
847
+ show: { type: Boolean },
848
+ loading: { type: Boolean }
849
+ },
850
+ emits: ["update:setting", "update:show", "submit"],
851
+ setup(_, { emit: h }) {
852
+ const o = _, d = h, s = Fe(ae(o.setting));
853
+ Ce([() => o.show], ([I]) => {
854
+ if (I)
855
+ for (const f of Object.keys(o.setting))
856
+ s[f] = o.setting[f];
857
+ });
858
+ const i = L(), r = ue(o, "show");
859
+ function t() {
860
+ var I, f;
861
+ (f = (I = i.value) == null ? void 0 : I.validateInputs) == null || f.call(I);
862
+ }
863
+ function p() {
864
+ d("update:setting", ae(s)), d("submit");
865
+ }
866
+ const { t: S } = Z();
867
+ return (I, f) => {
868
+ const g = F("FmChip"), y = F("FmForm"), w = F("FmButton"), C = F("FmSideSheet");
869
+ return x(), H(C, {
870
+ modelValue: V(r),
871
+ "onUpdate:modelValue": f[4] || (f[4] = (c) => re(r) ? r.value = c : null),
872
+ header: V(S)("inventory.integration.apply.title"),
873
+ "dismiss-away": "",
874
+ "close-button": "",
875
+ "max-width": 500
876
+ }, {
877
+ default: N(() => [
878
+ l("div", Kt, [
879
+ l("div", null, [
880
+ A(g, { label: "Menu v3" })
881
+ ]),
882
+ A(y, {
883
+ ref_key: "formRef",
884
+ ref: i,
885
+ onValidationSuccess: f[2] || (f[2] = (c) => p())
886
+ }, {
887
+ default: N(() => [
888
+ A(ye, {
889
+ bindings: s.bindings,
890
+ categories: I.categories,
891
+ variants: I.variants,
892
+ menus: I.menus,
893
+ "onUpdate:bindings": f[0] || (f[0] = (c) => s.bindings = c)
894
+ }, null, 8, ["bindings", "categories", "variants", "menus"]),
895
+ A(Dt, {
896
+ form: i.value,
897
+ modifiers: s.modifiers ?? [],
898
+ groups: I.groups ?? [],
899
+ items: I.menus ?? [],
900
+ "onUpdate:modifiers": f[1] || (f[1] = (c) => s.modifiers = c)
901
+ }, null, 8, ["form", "modifiers", "groups", "items"])
902
+ ]),
903
+ _: 1
904
+ }, 512)
905
+ ])
906
+ ]),
907
+ "side-sheet-footer": N(() => [
908
+ A(w, {
909
+ loading: I.loading,
910
+ type: "submit",
911
+ label: V(S)("common.confirm"),
912
+ onClick: f[3] || (f[3] = (c) => t())
913
+ }, null, 8, ["loading", "label"])
914
+ ]),
915
+ _: 1
916
+ }, 8, ["modelValue", "header"]);
917
+ };
918
+ }
919
+ }), Gt = { class: "flex flex-col gap-8 w-full" }, Zt = /* @__PURE__ */ Y({
920
+ __name: "ApplyProductDialogV4",
921
+ props: {
922
+ categories: { default: () => [] },
923
+ variants: { default: () => [] },
924
+ menus: { default: () => [] },
925
+ groups: { default: () => [] },
926
+ setting: {},
927
+ show: { type: Boolean },
928
+ loading: { type: Boolean }
929
+ },
930
+ emits: ["update:setting", "update:show", "submit"],
931
+ setup(_, { emit: h }) {
932
+ const o = _, d = h, s = Fe(ae(o.setting));
933
+ Ce([() => o.show], ([c]) => {
934
+ if (c)
935
+ for (const e of Object.keys(o.setting))
936
+ s[e] = o.setting[e];
937
+ });
938
+ const i = O(() => o.menus.filter((c) => !(c != null && c.category))), r = O(() => s.bindings.filter((c) => {
939
+ const e = o.menus.find((n) => n._id === c.productId);
940
+ return e ? !(e != null && e.category) : !1;
941
+ })), t = O(() => o.menus.filter((c) => !!(c != null && c.category))), p = O(() => s.bindings.filter((c) => {
942
+ const e = o.menus.find((n) => n._id === c.productId);
943
+ return e ? !!(e != null && e.category) : !1;
944
+ }));
945
+ function S(c) {
946
+ s.bindings = [...r.value, ...c];
947
+ }
948
+ function I(c) {
949
+ s.bindings = [...p.value, ...c];
950
+ }
951
+ const f = L(), g = ue(o, "show");
952
+ function y() {
953
+ var c, e;
954
+ (e = (c = f.value) == null ? void 0 : c.validateInputs) == null || e.call(c);
955
+ }
956
+ function w() {
957
+ d("update:setting", ae(s)), d("submit");
958
+ }
959
+ const { t: C } = Z();
960
+ return (c, e) => {
961
+ const n = F("FmChip"), v = F("FmForm"), m = F("FmButton"), a = F("FmSideSheet");
962
+ return x(), H(a, {
963
+ modelValue: V(g),
964
+ "onUpdate:modelValue": e[4] || (e[4] = (u) => re(g) ? g.value = u : null),
965
+ header: V(C)("inventory.integration.apply.title"),
966
+ "dismiss-away": "",
967
+ "close-button": "",
968
+ "max-width": 500
969
+ }, {
970
+ default: N(() => [
971
+ l("div", Gt, [
972
+ l("div", null, [
973
+ A(n, { label: "Menu v4" })
974
+ ]),
975
+ A(v, {
976
+ ref_key: "formRef",
977
+ ref: f,
978
+ onValidationSuccess: e[2] || (e[2] = (u) => w())
979
+ }, {
980
+ default: N(() => [
981
+ A(ye, {
982
+ categories: c.categories,
983
+ variants: c.variants,
984
+ bindings: p.value,
985
+ menus: t.value,
986
+ "onUpdate:bindings": e[0] || (e[0] = (u) => S(u))
987
+ }, null, 8, ["categories", "variants", "bindings", "menus"]),
988
+ A(ye, {
989
+ "is-addon": !0,
990
+ categories: [],
991
+ variants: c.variants,
992
+ bindings: r.value,
993
+ menus: i.value,
994
+ "onUpdate:bindings": e[1] || (e[1] = (u) => I(u))
995
+ }, null, 8, ["variants", "bindings", "menus"])
996
+ ]),
997
+ _: 1
998
+ }, 512)
999
+ ])
1000
+ ]),
1001
+ "side-sheet-footer": N(() => [
1002
+ A(m, {
1003
+ loading: c.loading,
1004
+ type: "submit",
1005
+ label: V(C)("common.confirm"),
1006
+ onClick: e[3] || (e[3] = (u) => y())
1007
+ }, null, 8, ["loading", "label"])
1008
+ ]),
1009
+ _: 1
1010
+ }, 8, ["modelValue", "header"]);
1011
+ };
1012
+ }
1013
+ }), Wt = { key: 0 }, $t = { class: "flex justify-center" }, en = ["src"], tn = { class: "flex flex-col items-center gap-2" }, nn = { class: "text-lg font-bold" }, sn = { class: "text-fm-color-neutral-gray-300" }, on = { key: 0 }, an = /* @__PURE__ */ Y({
1014
+ __name: "FoodMarketHub",
1015
+ setup(_) {
1016
+ const h = le(), o = G(), d = se(), s = L(!1), i = nt(), r = O(() => i.state.menu ?? []), t = O(() => i.state.group ?? []), p = O(() => i.state.variants ?? []), S = O(() => i.state.categories ?? []), I = We(), f = O(() => {
1017
+ var v;
1018
+ return (v = h.currentBusiness.value) == null ? void 0 : v.menuVersion;
1019
+ });
1020
+ d.watchLocation(i.init);
1021
+ const g = L(!1);
1022
+ async function y() {
1023
+ g.value = !0;
1024
+ }
1025
+ const { breakpoints: w } = _e(), C = O(() => w.value.xs || w.value.sm), c = O(() => C.value);
1026
+ async function e() {
1027
+ const v = i.state.setting;
1028
+ if (v) {
1029
+ s.value = !0;
1030
+ try {
1031
+ await I.updateSetting(v), o.open({
1032
+ title: "Success",
1033
+ message: "Your changes has been saved",
1034
+ type: "success"
1035
+ }), g.value = !1, await i.init();
1036
+ return;
1037
+ } catch (m) {
1038
+ o.open({
1039
+ title: "Something went wrong",
1040
+ message: "Cannot update integration info. Please try again.",
1041
+ type: "error"
1042
+ }), console.error("Error at updating integration info", m);
1043
+ } finally {
1044
+ s.value = !1;
1045
+ }
1046
+ }
1047
+ }
1048
+ const { t: n } = Z();
1049
+ return (v, m) => {
1050
+ const a = F("FmCardSection"), u = F("FmCard");
1051
+ return V(i).isEnabled && !V(i).isBusinessLocation ? (x(), E("div", Wt, [
1052
+ A(u, {
1053
+ class: q({
1054
+ "w-full": c.value,
1055
+ "w-1/2": !c.value,
1056
+ border: !0,
1057
+ "border-fm-color-neutral-gray-100": !0,
1058
+ "cursor-pointer": !0,
1059
+ "hover:border-fm-color-primary": !0
1060
+ }),
1061
+ onClick: m[0] || (m[0] = (b) => y())
1062
+ }, {
1063
+ default: N(() => [
1064
+ A(a, null, {
1065
+ default: N(() => [
1066
+ l("div", $t, [
1067
+ l("img", {
1068
+ src: V(ft),
1069
+ alt: "Food Market Hub"
1070
+ }, null, 8, en)
1071
+ ]),
1072
+ l("div", tn, [
1073
+ l("div", nn, R(V(n)("inventory.integration.fmh.title")), 1),
1074
+ l("div", sn, R(V(n)("inventory.integration.fmh.description")), 1)
1075
+ ])
1076
+ ]),
1077
+ _: 1
1078
+ })
1079
+ ]),
1080
+ _: 1
1081
+ }, 8, ["class"]),
1082
+ V(i).state.setting ? (x(), E("div", on, [
1083
+ (x(), H(pe, { to: "body" }, [
1084
+ f.value === "v3" ? (x(), H(qt, {
1085
+ key: 0,
1086
+ menus: r.value,
1087
+ variants: p.value,
1088
+ categories: S.value,
1089
+ setting: V(i).state.setting,
1090
+ "onUpdate:setting": m[1] || (m[1] = (b) => V(i).state.setting = b),
1091
+ show: g.value,
1092
+ "onUpdate:show": m[2] || (m[2] = (b) => g.value = b),
1093
+ groups: t.value,
1094
+ loading: s.value,
1095
+ onSubmit: m[3] || (m[3] = (b) => e())
1096
+ }, null, 8, ["menus", "variants", "categories", "setting", "show", "groups", "loading"])) : (x(), H(Zt, {
1097
+ key: 1,
1098
+ menus: r.value,
1099
+ variants: p.value,
1100
+ categories: S.value,
1101
+ setting: V(i).state.setting,
1102
+ "onUpdate:setting": m[4] || (m[4] = (b) => V(i).state.setting = b),
1103
+ show: g.value,
1104
+ "onUpdate:show": m[5] || (m[5] = (b) => g.value = b),
1105
+ groups: t.value,
1106
+ loading: s.value,
1107
+ onSubmit: m[6] || (m[6] = (b) => e())
1108
+ }, null, 8, ["menus", "variants", "categories", "setting", "show", "groups", "loading"]))
1109
+ ]))
1110
+ ])) : j("", !0)
1111
+ ])) : j("", !0);
1112
+ };
1113
+ }
1114
+ }), ln = "data:image/svg+xml,%3csvg%20width='200'%20height='100'%20viewBox='0%200%20200%20100'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3crect%20width='200'%20height='100'%20fill='url(%23pattern0_1500_58879)'/%3e%3cdefs%3e%3cpattern%20id='pattern0_1500_58879'%20patternContentUnits='objectBoundingBox'%20width='1'%20height='1'%3e%3cuse%20xlink:href='%23image0_1500_58879'%20transform='matrix(0.002%200%200%200.004%200%200.046)'/%3e%3c/pattern%3e%3cimage%20id='image0_1500_58879'%20width='500'%20height='227'%20xlink:href='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAADjCAYAAABzcuYdAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAB9KADAAQAAAABAAAA4wAAAABu8la3AABAAElEQVR4Ae2dCYAcVZnH61V191w5yDU5CDAkIXN0z0wC7C4uAorKpeyysugiuLqKooKIBwsCcguCFwoogqwrIHhzLIKigDeIQDLT3XMlmYSQBHKQhITM1V319v+6p/qorup+1VPd0z3zFXSm6r3vvfe9X1W9792lKHQQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIgMKIAREgApVLoKmp6aCGhoZZqrp/fzi8eU/lakqaEQEiMNkEp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y/8koh09AGSyGRZcjflfvrtf8rPnHOz2Gvrt3dvf0/MnLvJcrrmlh0DNhihnMjI0uVBTfIZxpR6iGMQfLQ5eIBwvd2BLNb6uILEIznL08vg+O59zYjw2ZtkPiNV2JrddGjVexM9Or0E3PzEMpzlGYY0c09SRmxBOrBaz78wizjvkGGh7212L4MMf4uulSqOIqTuzkdjrGdE/DfizSjARrJFKjcCOC3c/uwHksFGp9N3YcPwP3YLSQAhwPDioEO9iu12+ppmVqhfIFfw29FNg4hC2V4QmONYaiPxGJ9P1SIm5bkdDhhy/019fPQ0F6BN6QQ/EWzMFfvJ8y76JtlK4crc95IjBnPsNQngj39DziKjKUIVjueCyeoxPAEPv55uYhVT92GXGpxK35F8823vQtMOZfQZrS75Rb/VpaWuZhB7ZGZvibUCk/DK3ieRhzX2LHLDNur/ll55/58Rw+73VFJlN/OicCRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARyCTAMi/onAgQgWwCra2th6mqulBTlEWKYjRyVZ2nKspcnHPO1bjCjW0IsVvhbKvO2OvDw8NbBwcH38iOha6IABEgAqUnULUGvb390DlcmXEbMrCQK8wwUWncPEv9DegKvycS6bk/5eLRSbC99VKmqKcgujEzSpv0GVd4zFD0qyOR/hdMOae/HStW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IEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiIBHBP4fA65iItIh5WIAAAAASUVORK5CYII='/%3e%3c/defs%3e%3c/svg%3e", rn = {
1115
+ key: 0,
1116
+ class: "line-clamp-1 text-ellipsis"
1117
+ }, un = {
1118
+ key: 1,
1119
+ class: "line-clamp-1 text-ellipsis text-fm-color-typo-tertiary"
1120
+ }, dn = { class: "flex flex-col gap-5" }, cn = { class: "overflow-x-hidden overflow-y-auto max-h-[300px]" }, Ye = /* @__PURE__ */ Y({
1121
+ __name: "FmEnhancedSelect",
1122
+ props: {
1123
+ placeholder: {},
1124
+ items: {},
1125
+ label: {},
1126
+ searchTarget: {},
1127
+ disabled: { type: Boolean },
1128
+ modelValue: {}
1129
+ },
1130
+ emits: ["update:modelValue"],
1131
+ setup(_, { emit: h }) {
1132
+ const o = _, d = h, s = L(""), i = O(
1133
+ () => new lt(
1134
+ o.items,
1135
+ (t) => [t.label ?? "", t.sublabel ?? "", ...t.value[o.searchTarget]].filter((p) => p)
1136
+ )
1137
+ ), r = O(() => i.value.search(s.value));
1138
+ return (t, p) => {
1139
+ const S = F("FmLabel"), I = F("FmField"), f = F("FmIcon"), g = F("FmTextField"), y = F("FmMenuItem"), w = F("FmMenu"), C = F("FmFormGroup");
1140
+ return x(), H(C, {
1141
+ "model-value": t.modelValue,
1142
+ rules: [V(rt)()],
1143
+ "label-mark": "required"
1144
+ }, oe({
1145
+ default: N(({ invalid: c }) => [
1146
+ A(w, null, {
1147
+ "menu-button": N(() => [
1148
+ A(I, {
1149
+ class: q([
1150
+ "fm-typo-en-body-lg-400",
1151
+ {
1152
+ "text-fm-color-typo-primary": !t.disabled,
1153
+ "text-fm-color-typo-disabled": t.disabled
1154
+ }
1155
+ ]),
1156
+ invalid: c,
1157
+ "append-icon": "expand_more"
1158
+ }, {
1159
+ default: N(() => [
1160
+ t.modelValue[o.searchTarget] ? (x(), E("span", rn, R(t.modelValue[o.searchTarget]), 1)) : (x(), E("span", un, R(t.placeholder || "Select an option"), 1))
1161
+ ]),
1162
+ _: 2
1163
+ }, 1032, ["class", "invalid"])
1164
+ ]),
1165
+ default: N(() => [
1166
+ l("div", dn, [
1167
+ A(g, {
1168
+ modelValue: s.value,
1169
+ "onUpdate:modelValue": p[1] || (p[1] = (e) => s.value = e),
1170
+ placeholder: "Filter options"
1171
+ }, oe({
1172
+ prepend: N(() => [
1173
+ A(f, { name: "search" })
1174
+ ]),
1175
+ _: 2
1176
+ }, [
1177
+ s.value.length ? {
1178
+ name: "append",
1179
+ fn: N(() => [
1180
+ A(f, {
1181
+ class: "cursor-pointer",
1182
+ name: "close",
1183
+ onClick: p[0] || (p[0] = (e) => s.value = "")
1184
+ })
1185
+ ]),
1186
+ key: "0"
1187
+ } : void 0
1188
+ ]), 1032, ["modelValue"]),
1189
+ l("div", cn, [
1190
+ (x(!0), E(P, null, ee(r.value, (e, n) => {
1191
+ var v, m;
1192
+ return x(), H(y, {
1193
+ key: n,
1194
+ label: e.label,
1195
+ "model-value": e.value[o.searchTarget] === ((v = t.modelValue) == null ? void 0 : v[o.searchTarget]),
1196
+ onClick: (a) => d("update:modelValue", e.value),
1197
+ "x-should-scroll-into": `${e.value[o.searchTarget] === ((m = t.modelValue) == null ? void 0 : m[o.searchTarget])}`
1198
+ }, null, 8, ["label", "model-value", "onClick", "x-should-scroll-into"]);
1199
+ }), 128))
1200
+ ])
1201
+ ])
1202
+ ]),
1203
+ _: 2
1204
+ }, 1024)
1205
+ ]),
1206
+ _: 2
1207
+ }, [
1208
+ t.label ? {
1209
+ name: "label",
1210
+ fn: N(() => [
1211
+ A(S, { label: t.label }, null, 8, ["label"])
1212
+ ]),
1213
+ key: "0"
1214
+ } : void 0
1215
+ ]), 1032, ["model-value", "rules"]);
1216
+ };
1217
+ }
1218
+ }), mn = { class: "flex-col items-center" }, fn = { class: "flex gap-2" }, pn = {
1219
+ key: 0,
1220
+ class: "text-xs text-red-500 mt-2"
1221
+ }, vn = {
1222
+ key: 1,
1223
+ class: "flex items-center mt-2"
1224
+ }, gn = { class: "flex flex-col" }, yn = { class: "font-medium" }, An = { class: "text-xs text-gray-400" }, bn = { class: "text-xs text-gray-400" }, hn = { class: "text-xs text-gray-400" }, xn = /* @__PURE__ */ Y({
1225
+ __name: "NetSuiteLocationField",
1226
+ props: {
1227
+ isDuplicate: { type: Boolean, default: !1 },
1228
+ nsLocationOptions: {},
1229
+ fmLocation: {},
1230
+ modelValue: { default: () => ({
1231
+ netsuiteId: "",
1232
+ name: "",
1233
+ subsidiaryName: "",
1234
+ subsidiaryId: "",
1235
+ isinactive: !1
1236
+ }) }
1237
+ },
1238
+ emits: ["update:modelValue"],
1239
+ setup(_, { emit: h }) {
1240
+ const o = _, d = O(() => o.modelValue), s = h;
1241
+ return (i, r) => {
1242
+ const t = F("FmButton"), p = F("FmIcon");
1243
+ return x(), E("div", mn, [
1244
+ l("div", fn, [
1245
+ A(Ye, {
1246
+ placeholder: "Select NetSuite Location",
1247
+ items: i.nsLocationOptions,
1248
+ searchTarget: "name",
1249
+ "model-value": d.value,
1250
+ "onUpdate:modelValue": r[0] || (r[0] = (S) => s("update:modelValue", S))
1251
+ }, null, 8, ["items", "model-value"]),
1252
+ d.value.netsuiteId ? (x(), H(t, {
1253
+ key: 0,
1254
+ variant: "secondary",
1255
+ label: "Clear",
1256
+ onClick: r[1] || (r[1] = (S) => s("update:modelValue", {
1257
+ netsuiteId: "",
1258
+ name: "",
1259
+ subsidiaryName: "",
1260
+ subsidiaryId: ""
1261
+ }))
1262
+ })) : j("", !0)
1263
+ ]),
1264
+ i.isDuplicate ? (x(), E("div", pn, " NetSuite location being used by another FeedMe location. ")) : j("", !0),
1265
+ d.value.netsuiteId ? (x(), E("div", vn, [
1266
+ A(p, {
1267
+ name: "cloud",
1268
+ color: "neutral-gray-400",
1269
+ size: "md",
1270
+ class: "mr-2",
1271
+ outline: ""
1272
+ }),
1273
+ l("div", gn, [
1274
+ l("span", yn, R(d.value.name), 1),
1275
+ l("span", An, "ID: " + R(d.value.netsuiteId), 1),
1276
+ l("span", bn, "Subsidiary: " + R(d.value.subsidiaryName), 1),
1277
+ l("span", hn, "Inactive: " + R(d.value.isinactive ? "Yes" : "No"), 1)
1278
+ ])
1279
+ ])) : j("", !0)
1280
+ ]);
1281
+ };
1282
+ }
1283
+ }), In = /* @__PURE__ */ Y({
1284
+ __name: "AddLocationDialog",
1285
+ props: {
1286
+ showDialog: {
1287
+ type: Boolean,
1288
+ required: !0
1289
+ },
1290
+ fmLocationNotYetConfigured: {
1291
+ type: Array,
1292
+ required: !0
1293
+ },
1294
+ nsLocationsNotBeingUsed: {
1295
+ type: Array,
1296
+ required: !0
1297
+ },
1298
+ formRef: {
1299
+ type: Object,
1300
+ default: null
1301
+ }
1302
+ },
1303
+ emits: ["update:loading", "update:showDialog"],
1304
+ setup(_, { emit: h }) {
1305
+ const o = te(), d = G(), s = [
1306
+ {
1307
+ id: "fmLocation",
1308
+ header: "FeedMe Location",
1309
+ cell(y) {
1310
+ const w = y.row.original, C = k(J.FmIcon, {
1311
+ name: w.type,
1312
+ color: "neutral-gray-400",
1313
+ size: "md",
1314
+ class: "mr-2",
1315
+ outline: !0
1316
+ });
1317
+ return k("div", { class: "flex items-center" }, [
1318
+ C,
1319
+ k("div", { class: "flex flex-col" }, [
1320
+ k("span", { class: "font-medium" }, w.name),
1321
+ k("span", { class: "text-xs text-gray-400" }, w.doc._id)
1322
+ ])
1323
+ ]);
1324
+ }
1325
+ },
1326
+ {
1327
+ id: "nsLocation",
1328
+ header: "NetSuite Location",
1329
+ cell(y) {
1330
+ const w = y.row.original, C = t.value[w.dbName], c = Object.entries(t.value).some(
1331
+ ([e, n]) => e !== w.dbName && n.netsuiteId === (C == null ? void 0 : C.netsuiteId)
1332
+ );
1333
+ return k(xn, {
1334
+ isDuplicate: c,
1335
+ nsLocationOptions: I.value,
1336
+ modelValue: C,
1337
+ fmLocation: w,
1338
+ "onUpdate:modelValue": (e) => {
1339
+ e.netsuiteId ? t.value = {
1340
+ ...t.value,
1341
+ [w.dbName]: {
1342
+ netsuiteId: e.netsuiteId,
1343
+ name: e.name,
1344
+ subsidiaryName: e.subsidiaryName,
1345
+ subsidiaryId: e.subsidiaryId
1346
+ }
1347
+ } : delete t.value[w.dbName];
1348
+ }
1349
+ });
1350
+ }
1351
+ }
1352
+ ], i = _, r = h, t = L({}), p = L(), S = L(""), I = O(() => i.nsLocationsNotBeingUsed.map((y) => ({
1353
+ label: y.name,
1354
+ value: y
1355
+ }))), f = O(() => Object.values(t.value).length === 0 || Object.values(t.value).some(
1356
+ (y) => Object.values(t.value).filter((w) => w.netsuiteId === y.netsuiteId).length > 1
1357
+ ));
1358
+ async function g() {
1359
+ try {
1360
+ r("update:loading", !0), await o.updateLocationConfigs(t.value), d.open({
1361
+ message: "Locations updated successfully",
1362
+ type: "success"
1363
+ }), r("update:showDialog", !1), t.value = {};
1364
+ } catch {
1365
+ d.open({
1366
+ message: "Failed to update locations. Please try again.",
1367
+ type: "error"
1368
+ });
1369
+ } finally {
1370
+ r("update:loading", !1);
1371
+ }
1372
+ }
1373
+ return (y, w) => {
1374
+ const C = F("FmTable"), c = F("FmForm"), e = F("FmSpacer"), n = F("FmButton"), v = F("FmDialog");
1375
+ return x(), H(v, {
1376
+ modelValue: _.showDialog,
1377
+ "onUpdate:modelValue": w[2] || (w[2] = (m) => y.$emit("update:showDialog", m)),
1378
+ overlay: !0,
1379
+ "max-width": "900px"
1380
+ }, {
1381
+ "dialog-header": N(() => w[3] || (w[3] = [
1382
+ l("div", null, "Add locations", -1)
1383
+ ])),
1384
+ "dialog-footer": N(() => [
1385
+ A(e, { class: "sm:hidden xs:hidden" }),
1386
+ A(n, {
1387
+ class: "sm:w-full xs:w-full",
1388
+ label: "Submit",
1389
+ size: "md",
1390
+ disabled: f.value,
1391
+ onClick: g
1392
+ }, null, 8, ["disabled"])
1393
+ ]),
1394
+ default: N(() => [
1395
+ A(c, {
1396
+ ref: "formRef",
1397
+ class: "mb-4",
1398
+ "model-value": p.value,
1399
+ "onUpdate:modelValue": w[1] || (w[1] = (m) => p.value = m)
1400
+ }, {
1401
+ default: N(() => [
1402
+ A(C, {
1403
+ modelValue: p.value,
1404
+ "onUpdate:modelValue": w[0] || (w[0] = (m) => p.value = m),
1405
+ "row-data": i.fmLocationNotYetConfigured,
1406
+ "column-defs": s,
1407
+ "search-value": S.value,
1408
+ "shrink-at": !1
1409
+ }, null, 8, ["modelValue", "row-data", "search-value"])
1410
+ ]),
1411
+ _: 1
1412
+ }, 8, ["model-value"])
1413
+ ]),
1414
+ _: 1
1415
+ }, 8, ["modelValue"]);
1416
+ };
1417
+ }
1418
+ }), Sn = { class: "p-8 flex items-center justify-between" }, wn = { class: "flex gap-4" }, kn = /* @__PURE__ */ Y({
1419
+ __name: "LocationsTab",
1420
+ setup(_) {
1421
+ const h = se(), o = te(), d = G(), s = L(!1), i = L(), r = L(""), t = L(null), p = L([]), S = L(null), I = [
1422
+ {
1423
+ key: "type",
1424
+ type: "string",
1425
+ entity: "item",
1426
+ values: ["warehouse", "restaurant"]
1427
+ }
1428
+ ];
1429
+ ie(async () => {
1430
+ if (o.isReady && o.isEnabled)
1431
+ try {
1432
+ p.value = await o.getNetSuiteLocationOptions();
1433
+ } catch {
1434
+ d.open({ message: "Failed to fetch NetSuite locations", type: "error" });
1435
+ }
1436
+ });
1437
+ const f = O(() => {
1438
+ let c = o.state.setting.locations;
1439
+ if (!t.value)
1440
+ return c;
1441
+ const e = Ee.build(t.value);
1442
+ return c.filter(
1443
+ (n) => Ne(
1444
+ {
1445
+ type: n.type
1446
+ },
1447
+ e
1448
+ )
1449
+ );
1450
+ }), g = [
1451
+ {
1452
+ id: "location",
1453
+ header: () => "FeedMe Location",
1454
+ accessorFn: (c) => {
1455
+ const e = h.locations.find(
1456
+ (n) => n.type === c.type && n.doc._id === c.id
1457
+ );
1458
+ return `${(e == null ? void 0 : e.name) || ""} ${(e == null ? void 0 : e.doc._id) || ""}`;
1459
+ },
1460
+ cell(c) {
1461
+ const e = c.row.original, n = h.locations.find(
1462
+ (m) => m.type === e.type && m.doc._id === e.id
1463
+ );
1464
+ if (!n)
1465
+ return k("div", "Unknown Location");
1466
+ const v = k(J.FmIcon, {
1467
+ name: n.type,
1468
+ color: "neutral-gray-400",
1469
+ size: "md",
1470
+ class: "mr-2",
1471
+ outline: !0
1472
+ });
1473
+ return k("div", { class: "flex items-center" }, [
1474
+ v,
1475
+ k("div", { class: "flex flex-col" }, [
1476
+ k("span", { class: "font-medium" }, n.name),
1477
+ k("span", { class: "text-xs text-gray-400" }, n.doc._id)
1478
+ ])
1479
+ ]);
1480
+ }
1481
+ },
1482
+ {
1483
+ id: "netsuite",
1484
+ header: () => "NetSuite Location",
1485
+ accessorFn: (c) => {
1486
+ var n;
1487
+ const e = (n = p.value.find(
1488
+ (v) => v.netsuiteId === c.netSuiteId
1489
+ )) == null ? void 0 : n.subsidiaryName;
1490
+ return `${c.name} ${c.netSuiteId} ${e || ""}`;
1491
+ },
1492
+ cell(c) {
1493
+ var m;
1494
+ const e = c.row.original, n = (m = p.value.find(
1495
+ (a) => a.netsuiteId === e.netSuiteId
1496
+ )) == null ? void 0 : m.subsidiaryName, v = k(J.FmIcon, {
1497
+ name: "cloud",
1498
+ color: "neutral-gray-400",
1499
+ size: "md",
1500
+ class: "mr-2",
1501
+ outline: !0
1502
+ });
1503
+ return k("div", { class: "flex items-center" }, [
1504
+ v,
1505
+ k("div", { class: "flex flex-col" }, [
1506
+ k("span", { class: "font-medium" }, e.name),
1507
+ k("span", { class: "text-xs text-gray-400" }, `ID: ${e.netSuiteId}`),
1508
+ k("span", { class: "text-xs text-gray-400" }, `Subsidiary: ${n}`)
1509
+ ])
1510
+ ]);
1511
+ }
1512
+ }
1513
+ ], y = O(() => h.locations.filter(
1514
+ (c) => !o.state.setting.locations.some(
1515
+ (e) => e.id === c.doc._id && e.type === c.type
1516
+ )
1517
+ )), w = O(() => p.value.filter(
1518
+ (c) => !o.state.setting.locations.some(
1519
+ (e) => e.netSuiteId === c.netsuiteId
1520
+ )
1521
+ )), C = () => {
1522
+ s.value = !0;
1523
+ };
1524
+ return (c, e) => {
1525
+ const n = F("FmSearch"), v = F("FmButton"), m = F("FmTable");
1526
+ return x(), E("div", null, [
1527
+ l("div", Sn, [
1528
+ l("div", wn, [
1529
+ A(n, {
1530
+ placeholder: "Search by Location",
1531
+ class: "w-[300px]",
1532
+ modelValue: r.value,
1533
+ "onUpdate:modelValue": e[0] || (e[0] = (a) => r.value = a)
1534
+ }, null, 8, ["modelValue"]),
1535
+ A(V(Le), {
1536
+ modelValue: t.value,
1537
+ "onUpdate:modelValue": e[1] || (e[1] = (a) => t.value = a),
1538
+ attributes: I
1539
+ }, null, 8, ["modelValue"])
1540
+ ]),
1541
+ A(v, {
1542
+ label: "Add location",
1543
+ onClick: C
1544
+ })
1545
+ ]),
1546
+ A(m, {
1547
+ modelValue: i.value,
1548
+ "onUpdate:modelValue": e[2] || (e[2] = (a) => i.value = a),
1549
+ "row-data": f.value,
1550
+ "column-defs": g,
1551
+ "shrink-at": !1,
1552
+ "search-value": r.value,
1553
+ autoResetPageIndex: !0
1554
+ }, null, 8, ["modelValue", "row-data", "search-value"]),
1555
+ A(In, {
1556
+ "show-dialog": s.value,
1557
+ "onUpdate:showDialog": [
1558
+ e[3] || (e[3] = (a) => s.value = a),
1559
+ e[4] || (e[4] = (a) => s.value = a)
1560
+ ],
1561
+ formRef: S.value,
1562
+ fmLocationNotYetConfigured: y.value,
1563
+ nsLocationsNotBeingUsed: w.value
1564
+ }, null, 8, ["show-dialog", "formRef", "fmLocationNotYetConfigured", "nsLocationsNotBeingUsed"])
1565
+ ]);
1566
+ };
1567
+ }
1568
+ }), Fn = { class: "flex-col items-center" }, Cn = { class: "flex gap-2" }, Bn = {
1569
+ key: 0,
1570
+ class: "text-xs text-red-500 mt-2"
1571
+ }, Vn = {
1572
+ key: 1,
1573
+ class: "flex items-center mt-2"
1574
+ }, _n = { class: "flex flex-col" }, En = { class: "font-medium" }, Nn = { class: "text-xs text-gray-400" }, Ln = { class: "text-xs text-gray-400" }, Dn = /* @__PURE__ */ Y({
1575
+ __name: "NetSuiteVendorField",
1576
+ props: {
1577
+ isDuplicate: { type: Boolean, default: !1 },
1578
+ nsVendorOptions: {},
1579
+ fmSupplier: {},
1580
+ modelValue: { default: () => ({
1581
+ netsuiteId: "",
1582
+ name: "",
1583
+ subsidiaryName: "",
1584
+ subsidiaryId: ""
1585
+ }) }
1586
+ },
1587
+ emits: ["update:modelValue"],
1588
+ setup(_, { emit: h }) {
1589
+ const o = _, d = O(() => o.modelValue), s = h;
1590
+ return (i, r) => {
1591
+ const t = F("FmButton"), p = F("FmIcon");
1592
+ return x(), E("div", Fn, [
1593
+ l("div", Cn, [
1594
+ A(Ye, {
1595
+ placeholder: "Select NetSuite Vendor",
1596
+ items: i.nsVendorOptions,
1597
+ searchTarget: "name",
1598
+ "model-value": d.value,
1599
+ "onUpdate:modelValue": r[0] || (r[0] = (S) => s("update:modelValue", S))
1600
+ }, null, 8, ["items", "model-value"]),
1601
+ d.value.netsuiteId ? (x(), H(t, {
1602
+ key: 0,
1603
+ variant: "secondary",
1604
+ label: "Clear",
1605
+ onClick: r[1] || (r[1] = (S) => s("update:modelValue", {
1606
+ netsuiteId: "",
1607
+ name: "",
1608
+ subsidiaryName: "",
1609
+ subsidiaryId: ""
1610
+ }))
1611
+ })) : j("", !0)
1612
+ ]),
1613
+ i.isDuplicate ? (x(), E("div", Bn, " NetSuite vendor being used by another FeedMe supplier. ")) : j("", !0),
1614
+ d.value.netsuiteId ? (x(), E("div", Vn, [
1615
+ A(p, {
1616
+ name: "cloud",
1617
+ color: "neutral-gray-400",
1618
+ size: "md",
1619
+ class: "mr-2",
1620
+ outline: ""
1621
+ }),
1622
+ l("div", _n, [
1623
+ l("span", En, R(d.value.name), 1),
1624
+ l("span", Nn, "ID: " + R(d.value.netsuiteId), 1),
1625
+ l("span", Ln, "Subsidiary: " + R(d.value.subsidiaryName), 1)
1626
+ ])
1627
+ ])) : j("", !0)
1628
+ ]);
1629
+ };
1630
+ }
1631
+ }), Tn = {
1632
+ key: 0,
1633
+ class: "flex items-center justify-center py-12"
1634
+ }, Rn = /* @__PURE__ */ Y({
1635
+ __name: "AddVendorDialog",
1636
+ props: {
1637
+ showDialog: {
1638
+ type: Boolean,
1639
+ required: !0
1640
+ },
1641
+ fmSuppliersNotYetConfigured: {
1642
+ type: Array,
1643
+ required: !0
1644
+ },
1645
+ nsVendorsNotBeingUsed: {
1646
+ type: Array,
1647
+ required: !0
1648
+ },
1649
+ nsVendorsLoading: {
1650
+ type: Boolean,
1651
+ default: !1
1652
+ },
1653
+ formRef: {
1654
+ type: Object,
1655
+ default: null
1656
+ }
1657
+ },
1658
+ emits: ["update:loading", "update:showDialog"],
1659
+ setup(_, { emit: h }) {
1660
+ const o = te(), d = G(), s = [
1661
+ {
1662
+ id: "fmSupplier",
1663
+ header: "FeedMe Supplier",
1664
+ cell(y) {
1665
+ const w = y.row.original, C = k(J.FmIcon, {
1666
+ name: "apartment",
1667
+ color: "neutral-gray-400",
1668
+ size: "md",
1669
+ class: "mr-2",
1670
+ outline: !0
1671
+ });
1672
+ return k("div", { class: "flex items-center" }, [
1673
+ C,
1674
+ k("div", { class: "flex flex-col" }, [
1675
+ k("span", { class: "font-medium" }, w.name),
1676
+ k("span", { class: "text-xs text-gray-400" }, w._id)
1677
+ ])
1678
+ ]);
1679
+ }
1680
+ },
1681
+ {
1682
+ id: "nsVendor",
1683
+ header: "NetSuite Vendor",
1684
+ cell(y) {
1685
+ const w = y.row.original, C = t.value[w._id], c = Object.entries(t.value).some(
1686
+ ([e, n]) => e !== w._id && n.netsuiteId === (C == null ? void 0 : C.netsuiteId)
1687
+ );
1688
+ return k(Dn, {
1689
+ isDuplicate: c,
1690
+ nsVendorOptions: I.value,
1691
+ modelValue: C,
1692
+ fmSupplier: w,
1693
+ "onUpdate:modelValue": (e) => {
1694
+ e.netsuiteId ? t.value = {
1695
+ ...t.value,
1696
+ [w._id]: {
1697
+ netsuiteId: e.netsuiteId,
1698
+ name: e.name,
1699
+ subsidiaryName: e.subsidiaryName,
1700
+ subsidiaryId: e.subsidiaryId
1701
+ }
1702
+ } : delete t.value[w._id];
1703
+ }
1704
+ });
1705
+ }
1706
+ }
1707
+ ], i = _, r = h, t = L({}), p = L(), S = L(""), I = O(() => i.nsVendorsNotBeingUsed.filter((y) => y.name).map((y) => ({
1708
+ label: y.name,
1709
+ value: y
1710
+ }))), f = O(() => Object.values(t.value).length === 0 || Object.values(t.value).some(
1711
+ (y) => Object.values(t.value).filter((w) => w.netsuiteId === y.netsuiteId).length > 1
1712
+ ));
1713
+ async function g() {
1714
+ try {
1715
+ r("update:loading", !0), await o.updateSupplierConfigs(t.value), d.open({
1716
+ message: "Vendors updated successfully",
1717
+ type: "success"
1718
+ }), r("update:showDialog", !1), t.value = {};
1719
+ } catch {
1720
+ d.open({
1721
+ message: "Failed to update vendors. Please try again.",
1722
+ type: "error"
1723
+ });
1724
+ } finally {
1725
+ r("update:loading", !1);
1726
+ }
1727
+ }
1728
+ return (y, w) => {
1729
+ const C = F("FmSpinner"), c = F("FmTable"), e = F("FmForm"), n = F("FmSpacer"), v = F("FmButton"), m = F("FmDialog");
1730
+ return x(), H(m, {
1731
+ modelValue: _.showDialog,
1732
+ "onUpdate:modelValue": w[2] || (w[2] = (a) => y.$emit("update:showDialog", a)),
1733
+ overlay: !0,
1734
+ "max-width": "900px"
1735
+ }, {
1736
+ "dialog-header": N(() => w[3] || (w[3] = [
1737
+ l("div", null, "Add vendors", -1)
1738
+ ])),
1739
+ "dialog-footer": N(() => [
1740
+ A(n, { class: "sm:hidden xs:hidden" }),
1741
+ A(v, {
1742
+ class: "sm:w-full xs:w-full",
1743
+ label: "Submit",
1744
+ size: "md",
1745
+ disabled: f.value,
1746
+ onClick: g
1747
+ }, null, 8, ["disabled"])
1748
+ ]),
1749
+ default: N(() => [
1750
+ i.nsVendorsLoading ? (x(), E("div", Tn, [
1751
+ A(C, { size: "lg" }),
1752
+ w[4] || (w[4] = l("span", { class: "ml-3 text-gray-500" }, "Loading NetSuite vendors...", -1))
1753
+ ])) : (x(), H(e, {
1754
+ key: 1,
1755
+ ref: "formRef",
1756
+ class: "mb-4",
1757
+ "model-value": p.value,
1758
+ "onUpdate:modelValue": w[1] || (w[1] = (a) => p.value = a)
1759
+ }, {
1760
+ default: N(() => [
1761
+ A(c, {
1762
+ modelValue: p.value,
1763
+ "onUpdate:modelValue": w[0] || (w[0] = (a) => p.value = a),
1764
+ "row-data": i.fmSuppliersNotYetConfigured,
1765
+ "column-defs": s,
1766
+ "search-value": S.value,
1767
+ "shrink-at": !1
1768
+ }, null, 8, ["modelValue", "row-data", "search-value"])
1769
+ ]),
1770
+ _: 1
1771
+ }, 8, ["model-value"]))
1772
+ ]),
1773
+ _: 1
1774
+ }, 8, ["modelValue"]);
1775
+ };
1776
+ }
1777
+ }), On = { class: "p-8 flex items-center justify-between" }, Mn = { class: "flex items-center gap-2" }, zn = {
1778
+ key: 0,
1779
+ class: "text-sm text-gray-500"
1780
+ }, jn = {
1781
+ key: 1,
1782
+ class: "text-sm text-red-500"
1783
+ }, Un = /* @__PURE__ */ Y({
1784
+ __name: "VendorsTab",
1785
+ setup(_) {
1786
+ const h = ut(), o = te(), d = G(), s = L(""), i = L(!1), r = L([]), t = L(!1), p = L(null), S = L(null);
1787
+ ie(async () => {
1788
+ if (h.suppliers.length === 0)
1789
+ try {
1790
+ await h.readSuppliers();
1791
+ } catch {
1792
+ d.open({ message: "Failed to fetch suppliers", type: "error" });
1793
+ }
1794
+ if (o.isReady && o.isEnabled) {
1795
+ t.value = !0, p.value = null;
1796
+ try {
1797
+ r.value = await o.getNetSuiteVendorOptions();
1798
+ } catch {
1799
+ p.value = "Failed to fetch NetSuite vendors", d.open({ message: "Failed to fetch NetSuite vendors", type: "error" });
1800
+ } finally {
1801
+ t.value = !1;
1802
+ }
1803
+ }
1804
+ });
1805
+ const I = O(() => o.state.setting.vendors), f = [
1806
+ {
1807
+ id: "vendor",
1808
+ header: () => "FeedMe Supplier",
1809
+ accessorFn: (c) => {
1810
+ const e = h.suppliers.find((n) => n._id === c.id);
1811
+ return `${(e == null ? void 0 : e.name) || ""} ${(e == null ? void 0 : e._id) || ""}`;
1812
+ },
1813
+ cell(c) {
1814
+ const e = c.row.original, n = h.suppliers.find(
1815
+ (m) => m._id === e.id
1816
+ );
1817
+ if (!n)
1818
+ return k("div", "Unknown Supplier");
1819
+ const v = k(J.FmIcon, {
1820
+ name: "apartment",
1821
+ color: "neutral-gray-400",
1822
+ size: "md",
1823
+ class: "mr-2",
1824
+ outline: !0
1825
+ });
1826
+ return k("div", { class: "flex items-center" }, [
1827
+ v,
1828
+ k("div", { class: "flex flex-col" }, [
1829
+ k("span", { class: "font-medium" }, n.name),
1830
+ k("span", { class: "text-xs text-gray-400" }, n._id)
1831
+ ])
1832
+ ]);
1833
+ }
1834
+ },
1835
+ {
1836
+ id: "netsuite",
1837
+ header: () => "NetSuite Vendor",
1838
+ accessorFn: (c) => {
1839
+ var n;
1840
+ const e = (n = r.value.find(
1841
+ (v) => v.subsidiaryId === c.subsidiaryId
1842
+ )) == null ? void 0 : n.subsidiaryName;
1843
+ return `${c.name} ${c.netSuiteId} ${e || ""}`;
1844
+ },
1845
+ cell(c) {
1846
+ var m;
1847
+ const e = c.row.original, n = (m = r.value.find(
1848
+ (a) => a.subsidiaryId === e.subsidiaryId
1849
+ )) == null ? void 0 : m.subsidiaryName, v = k(J.FmIcon, {
1850
+ name: "cloud",
1851
+ color: "neutral-gray-400",
1852
+ size: "md",
1853
+ class: "mr-2",
1854
+ outline: !0
1855
+ });
1856
+ return k("div", { class: "flex items-center" }, [
1857
+ v,
1858
+ k("div", { class: "flex flex-col" }, [
1859
+ k("span", { class: "font-medium" }, e.name),
1860
+ k("span", { class: "text-xs text-gray-400" }, `ID: ${e.netSuiteId}`),
1861
+ k("span", { class: "text-xs text-gray-400" }, `Subsidiary: ${n || "N/A"}`)
1862
+ ])
1863
+ ]);
1864
+ }
1865
+ }
1866
+ ], g = O(() => h.suppliers.filter(
1867
+ (c) => !o.state.setting.vendors.some((e) => e.id === c._id)
1868
+ )), y = O(() => r.value.filter(
1869
+ (c) => !o.state.setting.vendors.some(
1870
+ (e) => e.netSuiteId === c.netsuiteId
1871
+ )
1872
+ )), w = () => {
1873
+ i.value = !0;
1874
+ }, C = O(() => !t.value && !p.value && r.value.length > 0);
1875
+ return (c, e) => {
1876
+ const n = F("FmSearch"), v = F("FmButton"), m = F("FmTable");
1877
+ return x(), E("div", null, [
1878
+ l("div", On, [
1879
+ A(n, {
1880
+ placeholder: "Search by Vendor",
1881
+ class: "w-[300px]",
1882
+ modelValue: s.value,
1883
+ "onUpdate:modelValue": e[0] || (e[0] = (a) => s.value = a)
1884
+ }, null, 8, ["modelValue"]),
1885
+ l("div", Mn, [
1886
+ t.value ? (x(), E("span", zn, "Loading vendors...")) : p.value ? (x(), E("span", jn, R(p.value), 1)) : j("", !0),
1887
+ A(v, {
1888
+ label: "Add vendor",
1889
+ onClick: w,
1890
+ disabled: !C.value
1891
+ }, null, 8, ["disabled"])
1892
+ ])
1893
+ ]),
1894
+ A(m, {
1895
+ autoResetPageIndex: !0,
1896
+ "row-data": I.value,
1897
+ "column-defs": f,
1898
+ "shrink-at": !1,
1899
+ "search-value": s.value
1900
+ }, null, 8, ["row-data", "search-value"]),
1901
+ A(Rn, {
1902
+ "show-dialog": i.value,
1903
+ "onUpdate:showDialog": [
1904
+ e[1] || (e[1] = (a) => i.value = a),
1905
+ e[2] || (e[2] = (a) => i.value = a)
1906
+ ],
1907
+ formRef: S.value,
1908
+ fmSuppliersNotYetConfigured: g.value,
1909
+ nsVendorsNotBeingUsed: y.value,
1910
+ nsVendorsLoading: t.value
1911
+ }, null, 8, ["show-dialog", "formRef", "fmSuppliersNotYetConfigured", "nsVendorsNotBeingUsed", "nsVendorsLoading"])
1912
+ ]);
1913
+ };
1914
+ }
1915
+ }), Hn = { class: "p-8 flex flex-col gap-4" }, Xn = { class: "flex gap-4 items-center" }, Yn = /* @__PURE__ */ Y({
1916
+ __name: "ItemsTab",
1917
+ setup(_) {
1918
+ const h = ce(), o = te(), d = me(), s = G(), { t: i } = Z();
1919
+ ie(async () => {
1920
+ o.state.isReady && o.state.itemReplicas.length === 0 && await o.getAllItemReplicas();
1921
+ });
1922
+ const r = (e) => {
1923
+ if (!e) return !0;
1924
+ const n = o.state.setting.syncedAt;
1925
+ return n ? new Date(e) > new Date(n) : !1;
1926
+ }, t = (e) => {
1927
+ if (e.parentNetSuiteId) return null;
1928
+ const n = e.skuCache;
1929
+ return n ? h.skuById[n._id] ? null : "new" : null;
1930
+ }, p = O(() => o.state.itemReplicas.some(
1931
+ (e) => r(e.syncedAt) || t(e) === "new"
1932
+ )), S = L(!1), I = async () => {
1933
+ S.value = !0;
1934
+ try {
1935
+ await d.publishItemsToInventory(), s.open({
1936
+ title: "Success",
1937
+ message: i("Items published to inventory successfully."),
1938
+ type: "success"
1939
+ }), await Promise.all([o.getAllItemReplicas(), h.fetchInventory()]);
1940
+ } catch (e) {
1941
+ s.open({
1942
+ title: "Error",
1943
+ message: `Failed to publish items to inventory. ${e.message}`,
1944
+ type: "error"
1945
+ });
1946
+ } finally {
1947
+ S.value = !1;
1948
+ }
1949
+ }, f = L(), g = L(""), y = L(null), w = [
1950
+ {
1951
+ key: "itemType",
1952
+ type: "string",
1953
+ entity: "item",
1954
+ values: Object.values(ge.Values)
1955
+ },
1956
+ {
1957
+ key: "isParent",
1958
+ type: "string",
1959
+ entity: "item",
1960
+ values: ["true", "false"]
1961
+ }
1962
+ ], C = O(() => {
1963
+ let e = o.state.itemReplicas;
1964
+ if (!y.value)
1965
+ return e;
1966
+ const n = Ee.build(y.value);
1967
+ return e.filter(
1968
+ (v) => Ne(
1969
+ {
1970
+ itemType: v.itemType || ge.Enum.InvtPart,
1971
+ isParent: v.parentNetSuiteId ? "false" : "true"
1972
+ },
1973
+ n
1974
+ )
1975
+ );
1976
+ }), c = [
1977
+ {
1978
+ id: "status",
1979
+ header: () => "Status",
1980
+ accessorFn: (e) => t(e) || "",
1981
+ cell(e) {
1982
+ const n = e.row.original, v = t(n);
1983
+ return v === "new" ? k(
1984
+ "span",
1985
+ { class: "px-2 py-1 text-xs font-medium rounded-full bg-green-100 text-green-800" },
1986
+ "New"
1987
+ ) : v === "invalid" ? k(
1988
+ "span",
1989
+ { class: "px-2 py-1 text-xs font-medium rounded-full bg-red-100 text-red-800" },
1990
+ "Invalid"
1991
+ ) : k("span", { class: "text-gray-400" }, "-");
1992
+ }
1993
+ },
1994
+ {
1995
+ id: "item",
1996
+ header: () => "FeedMe Ingredient",
1997
+ accessorFn: (e) => {
1998
+ if (e.parentNetSuiteId)
1999
+ return "Child Item";
2000
+ const n = e.skuCache;
2001
+ return `${(n == null ? void 0 : n.name) || ""} ${(n == null ? void 0 : n._id) || ""} ${(n == null ? void 0 : n.code) || ""}`;
2002
+ },
2003
+ cell(e) {
2004
+ const n = e.row.original;
2005
+ if (n.parentNetSuiteId)
2006
+ return k("div", { class: "text-gray-400" }, "Child Item");
2007
+ const v = n.skuCache;
2008
+ if (!v)
2009
+ return k("div", "Unknown Ingredient");
2010
+ const m = k(J.FmIcon, {
2011
+ name: "grocery",
2012
+ color: "neutral-gray-400",
2013
+ size: "md",
2014
+ class: "mr-2",
2015
+ outline: !0
2016
+ });
2017
+ return k("div", { class: "flex items-center" }, [
2018
+ m,
2019
+ k("div", { class: "flex flex-col" }, [
2020
+ k("span", { class: "font-medium" }, v.name),
2021
+ k("span", { class: "text-xs text-gray-400" }, `ID: ${v._id}`),
2022
+ k("span", { class: "text-xs text-gray-400" }, `Code: ${v.code}`)
2023
+ ])
2024
+ ]);
2025
+ }
2026
+ },
2027
+ {
2028
+ id: "netsuite",
2029
+ header: () => "NetSuite Item",
2030
+ accessorFn: (e) => {
2031
+ const n = o.state.setting.units.find(
2032
+ (v) => v.netSuiteId === e.unitTypeId
2033
+ );
2034
+ return `${e.name} ${e.netSuiteId} ${(n == null ? void 0 : n.netSuiteId) || ""}`;
2035
+ },
2036
+ cell(e) {
2037
+ const n = e.row.original, v = o.state.setting.units.find(
2038
+ (a) => a.netSuiteId === n.unitTypeId
2039
+ ), m = k(J.FmIcon, {
2040
+ name: "cloud",
2041
+ color: "neutral-gray-400",
2042
+ size: "md",
2043
+ class: "mr-2",
2044
+ outline: !0
2045
+ });
2046
+ return k("div", { class: "flex items-center" }, [
2047
+ m,
2048
+ k("div", { class: "flex flex-col" }, [
2049
+ k("span", { class: "font-medium" }, n.name || "N/A"),
2050
+ k("span", { class: "text-xs text-gray-400" }, `ID: ${n.netSuiteId}`),
2051
+ k(
2052
+ "span",
2053
+ { class: "text-xs text-gray-400" },
2054
+ `Unit Type: ${(v == null ? void 0 : v.netSuiteId) || "N/A"}`
2055
+ ),
2056
+ k(
2057
+ "span",
2058
+ { class: "text-xs text-gray-400" },
2059
+ `Unit of Measure (Base): ${(v == null ? void 0 : v.baseUnitUnitOfMeasureId) || "N/A"}`
2060
+ ),
2061
+ k(
2062
+ "span",
2063
+ { class: "text-xs text-gray-400" },
2064
+ `Type: ${n.itemType || ge.Enum.InvtPart}`
2065
+ )
2066
+ ])
2067
+ ]);
2068
+ }
2069
+ },
2070
+ {
2071
+ id: "lastSync",
2072
+ header: () => "Last Sync",
2073
+ accessorFn: (e) => e.syncedAt || "",
2074
+ cell(e) {
2075
+ const v = e.row.original.syncedAt, m = r(v);
2076
+ return v ? k("div", { class: "flex items-center gap-2" }, [
2077
+ k("span", new Date(v).toLocaleString()),
2078
+ m ? k(J.FmIcon, { name: "warning", color: "warning", size: "md" }) : null
2079
+ ]) : k("div", { class: "flex items-center gap-2" }, [
2080
+ k("span", { class: "text-gray-400" }, "Never"),
2081
+ k(J.FmIcon, { name: "warning", color: "warning", size: "md" })
2082
+ ]);
2083
+ }
2084
+ }
2085
+ ];
2086
+ return (e, n) => {
2087
+ const v = F("FmSearch"), m = F("FmButton"), a = F("FmTable");
2088
+ return x(), E("div", null, [
2089
+ l("div", Hn, [
2090
+ l("div", Xn, [
2091
+ A(v, {
2092
+ placeholder: "Search by Item",
2093
+ class: "w-[300px]",
2094
+ modelValue: g.value,
2095
+ "onUpdate:modelValue": n[0] || (n[0] = (u) => g.value = u)
2096
+ }, null, 8, ["modelValue"]),
2097
+ A(V(Le), {
2098
+ modelValue: y.value,
2099
+ "onUpdate:modelValue": n[1] || (n[1] = (u) => y.value = u),
2100
+ attributes: w
2101
+ }, null, 8, ["modelValue"]),
2102
+ A(m, {
2103
+ class: "ml-auto",
2104
+ onClick: I,
2105
+ label: "Publish to inventory",
2106
+ disabled: !p.value,
2107
+ loading: S.value
2108
+ }, null, 8, ["disabled", "loading"])
2109
+ ])
2110
+ ]),
2111
+ A(a, {
2112
+ modelValue: f.value,
2113
+ "onUpdate:modelValue": n[2] || (n[2] = (u) => f.value = u),
2114
+ "row-data": C.value,
2115
+ "column-defs": c,
2116
+ "shrink-at": !1,
2117
+ "search-value": g.value,
2118
+ autoResetPageIndex: !0
2119
+ }, null, 8, ["modelValue", "row-data", "search-value"])
2120
+ ]);
2121
+ };
2122
+ }
2123
+ }), Pn = { class: "p-8" }, Qn = /* @__PURE__ */ Y({
2124
+ __name: "UnitTypesTab",
2125
+ setup(_) {
2126
+ const h = ce(), o = te(), d = L(), s = L(""), i = O(() => o.state.setting.units), r = [
2127
+ {
2128
+ id: "unit",
2129
+ header: () => "FeedMe Unit",
2130
+ accessorFn: (t) => {
2131
+ const p = h.units.find((S) => S._id === t.id);
2132
+ return `${(p == null ? void 0 : p.name) || ""} ${(p == null ? void 0 : p._id) || ""} ${(p == null ? void 0 : p.abbrev) || ""}`;
2133
+ },
2134
+ cell(t) {
2135
+ var f;
2136
+ const p = t.row.original, S = h.units.find((g) => g._id === p.id);
2137
+ if (!S)
2138
+ return k("div", "Unknown Unit");
2139
+ const I = k(J.FmIcon, {
2140
+ name: "measuring_tape",
2141
+ color: "neutral-gray-400",
2142
+ size: "md",
2143
+ class: "mr-2",
2144
+ outline: !0
2145
+ });
2146
+ return k("div", { class: "flex items-center" }, [
2147
+ I,
2148
+ k("div", { class: "flex flex-col" }, [
2149
+ k("span", { class: "font-medium" }, S.name),
2150
+ k("span", { class: "text-xs text-gray-400" }, `ID: ${S._id}`),
2151
+ k("span", { class: "text-xs text-gray-400" }, `Abbrev: ${S.abbrev}`),
2152
+ k(
2153
+ "span",
2154
+ { class: "text-xs text-gray-400" },
2155
+ `Measurements: ${((f = S.measurements) == null ? void 0 : f.length) || 0}`
2156
+ )
2157
+ ])
2158
+ ]);
2159
+ }
2160
+ },
2161
+ {
2162
+ id: "netsuite",
2163
+ header: () => "NetSuite Unit Type",
2164
+ accessorFn: (t) => `${t.netSuiteId} ${t.baseUnitUnitOfMeasureId || ""}`,
2165
+ cell(t) {
2166
+ const p = t.row.original, S = k(J.FmIcon, {
2167
+ name: "cloud",
2168
+ color: "neutral-gray-400",
2169
+ size: "md",
2170
+ class: "mr-2",
2171
+ outline: !0
2172
+ });
2173
+ return k("div", { class: "flex items-center" }, [
2174
+ S,
2175
+ k("div", { class: "flex flex-col" }, [
2176
+ k("span", { class: "font-medium" }, `Unit Type ID: ${p.netSuiteId}`),
2177
+ k(
2178
+ "span",
2179
+ { class: "text-xs text-gray-400" },
2180
+ `Base Unit of Measure: ${p.baseUnitUnitOfMeasureId || "N/A"}`
2181
+ ),
2182
+ k(
2183
+ "span",
2184
+ { class: "text-xs text-gray-400" },
2185
+ `Measurements: ${p.measurements.length}`
2186
+ )
2187
+ ])
2188
+ ]);
2189
+ }
2190
+ }
2191
+ ];
2192
+ return (t, p) => {
2193
+ const S = F("FmSearch"), I = F("FmTable");
2194
+ return x(), E("div", null, [
2195
+ l("div", Pn, [
2196
+ A(S, {
2197
+ placeholder: "Search by Unit Type",
2198
+ class: "w-[300px]",
2199
+ modelValue: s.value,
2200
+ "onUpdate:modelValue": p[0] || (p[0] = (f) => s.value = f)
2201
+ }, null, 8, ["modelValue"])
2202
+ ]),
2203
+ A(I, {
2204
+ modelValue: d.value,
2205
+ "onUpdate:modelValue": p[1] || (p[1] = (f) => d.value = f),
2206
+ "row-data": i.value,
2207
+ "column-defs": r,
2208
+ "shrink-at": !1,
2209
+ "search-value": s.value,
2210
+ autoResetPageIndex: !0
2211
+ }, null, 8, ["modelValue", "row-data", "search-value"])
2212
+ ]);
2213
+ };
2214
+ }
2215
+ }), Jn = { key: 0 }, Kn = {
2216
+ key: 1,
2217
+ class: "flex flex-col gap-8 w-full"
2218
+ }, qn = { class: "flex gap-2 flex-wrap" }, Gn = { class: "flex items-center gap-2 text-sm text-gray-500" }, Zn = { class: "font-medium" }, Wn = { class: "flex gap-8 items-center justify-start" }, $n = /* @__PURE__ */ Y({
2219
+ __name: "BusinessNetSuiteSideSheet",
2220
+ props: {
2221
+ show: { type: Boolean },
2222
+ loading: { type: Boolean }
2223
+ },
2224
+ emits: ["update:show", "update:loading"],
2225
+ setup(_, { emit: h }) {
2226
+ const o = le(), d = te(), s = _, i = h, r = ue(s, "show"), t = L(
2227
+ "locations"
2228
+ /* LOCATIONS */
2229
+ ), p = [
2230
+ { value: "locations", label: "Locations" },
2231
+ { value: "vendors", label: "Vendors" },
2232
+ { value: "items", label: "Items" },
2233
+ { value: "unitTypes", label: "Unit Types" }
2234
+ ], { t: S } = Z(), I = O(() => {
2235
+ const g = d.state.setting.syncedAt;
2236
+ return g ? new Date(g).toLocaleString() : "Never";
2237
+ }), f = [
2238
+ "Unit Type",
2239
+ "Inventory Item",
2240
+ "Location",
2241
+ "Vendor",
2242
+ "Subsidiary",
2243
+ "Purchase Order",
2244
+ "Transfer Order",
2245
+ "Inventory Transfer"
2246
+ ];
2247
+ return (g, y) => {
2248
+ const w = F("FmChip"), C = F("FmTabs"), c = F("FmButton"), e = F("FmSideSheet");
2249
+ return x(), H(e, {
2250
+ modelValue: V(r),
2251
+ "onUpdate:modelValue": y[2] || (y[2] = (n) => re(r) ? r.value = n : null),
2252
+ header: V(S)("inventory.integration.netsuite.title"),
2253
+ "dismiss-away": "",
2254
+ "close-button": "",
2255
+ "max-width": 800
2256
+ }, {
2257
+ default: N(() => {
2258
+ var n;
2259
+ return [
2260
+ (n = V(o).sessionUser.value) != null && n.role.isAdmin ? (x(), E("div", Kn, [
2261
+ y[4] || (y[4] = l("div", { class: "text-sm" }, " This integration keeps your FeedMe system and NetSuite in sync for the following modules: ", -1)),
2262
+ l("div", qn, [
2263
+ (x(), E(P, null, ee(f, (v) => A(w, {
2264
+ key: v,
2265
+ label: v,
2266
+ compact: ""
2267
+ }, null, 8, ["label"])), 64))
2268
+ ]),
2269
+ y[5] || (y[5] = l("div", { class: "text-xs mt-2" }, " Changes made in FeedMe or NetSuite will be reflected in both systems, ensuring data consistency and streamlined operations. ", -1)),
2270
+ l("div", Gn, [
2271
+ y[3] || (y[3] = l("span", null, "NetSuite Last Sync:", -1)),
2272
+ l("span", Zn, R(I.value), 1)
2273
+ ]),
2274
+ y[6] || (y[6] = l("hr", { class: "my-3" }, null, -1)),
2275
+ A(C, {
2276
+ "model-value": t.value,
2277
+ "onUpdate:modelValue": y[0] || (y[0] = (v) => t.value = v),
2278
+ items: p
2279
+ }, null, 8, ["model-value"]),
2280
+ t.value === "locations" ? (x(), H(kn, { key: 0 })) : j("", !0),
2281
+ t.value === "vendors" ? (x(), H(Un, { key: 1 })) : j("", !0),
2282
+ t.value === "items" ? (x(), H(Yn, { key: 2 })) : j("", !0),
2283
+ t.value === "unitTypes" ? (x(), H(Qn, { key: 3 })) : j("", !0)
2284
+ ])) : (x(), E("div", Jn, " Please contact your administrator to apply the changes. "))
2285
+ ];
2286
+ }),
2287
+ "side-sheet-footer": N(() => [
2288
+ l("div", Wn, [
2289
+ A(c, {
2290
+ variant: "tertiary",
2291
+ label: V(S)("common.close"),
2292
+ onClick: y[1] || (y[1] = (n) => i("update:show", !1))
2293
+ }, null, 8, ["label"])
2294
+ ])
2295
+ ]),
2296
+ _: 1
2297
+ }, 8, ["modelValue", "header"]);
2298
+ };
2299
+ }
2300
+ }), es = /* @__PURE__ */ Y({
2301
+ __name: "InventoryTransferIngredientTable",
2302
+ props: {
2303
+ modelValue: { default: [] },
2304
+ modelModifiers: {}
2305
+ },
2306
+ emits: ["update:modelValue"],
2307
+ setup(_) {
2308
+ const { t: h } = ve(), o = ke(_, "modelValue"), d = [
2309
+ {
2310
+ id: "Code",
2311
+ header: () => h("inventory.transfer.form.items.table.Code"),
2312
+ accessorKey: "code",
2313
+ size: 200,
2314
+ cell(s) {
2315
+ const i = s.row.original;
2316
+ return k(
2317
+ J.FmTooltip,
2318
+ {
2319
+ content: i.code,
2320
+ placement: "top",
2321
+ variant: "plain",
2322
+ zIndex: 50
2323
+ },
2324
+ k(
2325
+ "span",
2326
+ {
2327
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
2328
+ },
2329
+ i.code
2330
+ )
2331
+ );
2332
+ },
2333
+ enableSorting: !1
2334
+ },
2335
+ {
2336
+ id: "Name",
2337
+ header: () => h("inventory.transfer.form.items.table.Name"),
2338
+ minSize: 300,
2339
+ cell(s) {
2340
+ const i = s.row.original;
2341
+ return k(
2342
+ J.FmTooltip,
2343
+ {
2344
+ content: i.name,
2345
+ placement: "top",
2346
+ variant: "plain",
2347
+ zIndex: 50
2348
+ },
2349
+ k(
2350
+ "span",
2351
+ {
2352
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
2353
+ },
2354
+ i.name
2355
+ )
2356
+ );
2357
+ },
2358
+ enableSorting: !1
2359
+ },
2360
+ {
2361
+ id: "Amount",
2362
+ header: () => h("inventory.transfer.form.items.table.Amount"),
2363
+ minSize: 200,
2364
+ cell(s) {
2365
+ const i = s.row.original, r = s.row.index;
2366
+ return k(dt, {
2367
+ style: {
2368
+ flex: "1 1 0%"
2369
+ },
2370
+ modelValue: {
2371
+ amount: i.quantity ?? { amount: 1, precision: 0 },
2372
+ measurement: i.measurement ?? null
2373
+ },
2374
+ key: i.sku._id,
2375
+ unit: i.sku.unit,
2376
+ "onUpdate:modelValue": (t) => {
2377
+ if (!t) return;
2378
+ const p = {
2379
+ ...i,
2380
+ quantity: t.amount,
2381
+ measurement: t.measurement
2382
+ };
2383
+ o.value = [
2384
+ ...o.value.slice(0, r),
2385
+ p,
2386
+ ...o.value.slice(r + 1)
2387
+ ];
2388
+ },
2389
+ rules: [ct(+mt({ amount: 1, precision: 0 }))],
2390
+ applyDefaultRules: !0
2391
+ });
2392
+ },
2393
+ enableSorting: !1
2394
+ },
2395
+ {
2396
+ id: "Delete",
2397
+ header: "",
2398
+ cell(s) {
2399
+ const i = s.row.original, r = s.row.index;
2400
+ return k("div", { class: "flex justify-end" }, [
2401
+ k(J.FmButton, {
2402
+ key: i.sku._id,
2403
+ class: "delete-button",
2404
+ type: "button",
2405
+ icon: "delete",
2406
+ variant: "tertiary",
2407
+ size: "md",
2408
+ onClick: () => {
2409
+ o.value = [...o.value.slice(0, r), ...o.value.slice(r + 1)];
2410
+ }
2411
+ })
2412
+ ]);
2413
+ },
2414
+ enableSorting: !1,
2415
+ size: 40,
2416
+ meta: {
2417
+ cellClass: "",
2418
+ headerClass: ""
2419
+ }
2420
+ }
2421
+ ];
2422
+ return (s, i) => {
2423
+ const r = F("FmTable");
2424
+ return x(), H(r, {
2425
+ "column-defs": d,
2426
+ "row-data": o.value,
2427
+ "row-key": (t) => t.sku._id,
2428
+ "empty-text": V(h)("inventory.transfer.form.items.table.empty"),
2429
+ pagination: !1,
2430
+ "virtual-scroll": { enabled: !0, itemSize: 48 }
2431
+ }, null, 8, ["row-data", "row-key", "empty-text"]);
2432
+ };
2433
+ }
2434
+ }), ts = { class: "flex items-center gap-8 mb-8" }, ns = /* @__PURE__ */ Y({
2435
+ __name: "InventoryTransferOutTable",
2436
+ setup(_) {
2437
+ const h = L([]), o = me(), d = L(!1), s = L(!1), i = G(), r = se();
2438
+ ie(async () => {
2439
+ const I = /* @__PURE__ */ new Date(), f = /* @__PURE__ */ new Date();
2440
+ f.setDate(f.getDate() - 30), d.value = !0;
2441
+ try {
2442
+ const g = await o.getInventoryTransferHistory(
2443
+ r.currentLocationDBName,
2444
+ f,
2445
+ I
2446
+ );
2447
+ h.value = g;
2448
+ } catch (g) {
2449
+ console.error("Error fetching inventory transfer history:", g);
2450
+ } finally {
2451
+ d.value = !1;
2452
+ }
2453
+ });
2454
+ async function t() {
2455
+ try {
2456
+ s.value = !0, await o.manualSyncInventoryTransfer(r.currentLocationDBName), i == null || i.open({
2457
+ title: "Sync Started",
2458
+ message: "Inventory transfers sync queued successfully.",
2459
+ type: "success"
2460
+ });
2461
+ } catch (I) {
2462
+ i == null || i.open({
2463
+ title: "Sync Failed",
2464
+ message: `Failed to queue inventory transfers sync. ${I == null ? void 0 : I.message}`,
2465
+ type: "error"
2466
+ });
2467
+ } finally {
2468
+ s.value = !1;
2469
+ }
2470
+ }
2471
+ const p = [
2472
+ // {
2473
+ // id: 'type',
2474
+ // header: 'Type',
2475
+ // cell: (props: any) => {
2476
+ // return props.row.original.type ? sentenceCase(props.row.original.type) : 'N/A'
2477
+ // }
2478
+ // },
2479
+ {
2480
+ id: "destinationLocation",
2481
+ header: "Destination Location",
2482
+ cell: (I) => {
2483
+ const f = I.row.original.destinationLocation.netSuiteName;
2484
+ return f ? k(
2485
+ J.FmTooltip,
2486
+ { zIndex: 51 },
2487
+ {
2488
+ content() {
2489
+ return f;
2490
+ },
2491
+ default() {
2492
+ return k("div", { class: "line-clamp-2 fm-typo-en-body-sm-400" }, f);
2493
+ }
2494
+ }
2495
+ ) : "N/A";
2496
+ }
2497
+ },
2498
+ {
2499
+ id: "netsuite",
2500
+ header: () => "NetSuite",
2501
+ cell(I) {
2502
+ return k("div", { class: "flex flex-col" }, [
2503
+ k(
2504
+ "span",
2505
+ { class: "fm-typo-en-body-sm-400" },
2506
+ `ID: ${I.row.original.netsuiteId ?? "N/A"}`
2507
+ ),
2508
+ k(
2509
+ "span",
2510
+ { class: "fm-typo-en-body-sm-400" },
2511
+ `Transaction ID: ${I.row.original.netsuiteTranId ?? "N/A"}`
2512
+ ),
2513
+ k(
2514
+ "span",
2515
+ { class: "fm-typo-en-body-sm-400" },
2516
+ `Transaction Date: ${I.row.original.netsuiteTranDate ?? "N/A"}`
2517
+ )
2518
+ ]);
2519
+ }
2520
+ },
2521
+ {
2522
+ id: "adjustment",
2523
+ header: () => "Adjustment (FeedMe)",
2524
+ cell(I) {
2525
+ const f = I.row.original.adjustmentId;
2526
+ return k("div", { class: "flex flex-col" }, [
2527
+ k("span", { class: "fm-typo-en-body-sm-400" }, `ID: ${f ?? "N/A"}`),
2528
+ k(
2529
+ "span",
2530
+ { class: "fm-typo-en-body-sm-400" },
2531
+ `Date: ${f ? he(Ae(f)) : "N/A"}`
2532
+ )
2533
+ ]);
2534
+ }
2535
+ },
2536
+ {
2537
+ id: "items",
2538
+ header: () => "Items",
2539
+ cell(I) {
2540
+ const f = I.row.original.items;
2541
+ return k(
2542
+ "div",
2543
+ { class: "overflow-auto" },
2544
+ k("ul", { class: "list-disc pl-5" }, [
2545
+ f == null ? void 0 : f.map(
2546
+ (g) => k(
2547
+ "li",
2548
+ { class: "fm-typo-en-body-sm-400" },
2549
+ `[${g == null ? void 0 : g.itemId}] ${g == null ? void 0 : g.itemName}: ${g == null ? void 0 : g.quantity} ${(g == null ? void 0 : g.uomName) ?? "N/A"}`
2550
+ )
2551
+ )
2552
+ ])
2553
+ );
2554
+ },
2555
+ size: 150
2556
+ }
2557
+ ], S = L();
2558
+ return (I, f) => {
2559
+ const g = F("FmButton"), y = F("FmTable");
2560
+ return x(), E(P, null, [
2561
+ l("div", ts, [
2562
+ f[1] || (f[1] = l("span", null, "Last 30 Days:", -1)),
2563
+ A(g, {
2564
+ "prepend-icon": "sync",
2565
+ variant: "secondary",
2566
+ label: "Sync",
2567
+ loading: s.value,
2568
+ "text-color": "primary",
2569
+ "bg-color": "transparent",
2570
+ "border-color": "primary",
2571
+ onClick: t
2572
+ }, null, 8, ["loading"])
2573
+ ]),
2574
+ A(y, {
2575
+ modelValue: S.value,
2576
+ "onUpdate:modelValue": f[0] || (f[0] = (w) => S.value = w),
2577
+ "row-data": h.value,
2578
+ "column-defs": p,
2579
+ loading: d.value
2580
+ }, null, 8, ["modelValue", "row-data", "loading"])
2581
+ ], 64);
2582
+ };
2583
+ }
2584
+ }), ss = { class: "flex flex-col gap-8" }, os = {
2585
+ key: 0,
2586
+ class: "flex flex-col gap-4"
2587
+ }, as = { class: "flex gap-2" }, ls = {
2588
+ key: 1,
2589
+ class: "flex items-center my-2 border rounded-lg p-2"
2590
+ }, is = { class: "flex flex-col" }, rs = { class: "font-medium" }, us = { class: "text-xs text-gray-400" }, ds = { class: "text-xs text-gray-400" }, cs = { class: "flex my-4" }, ms = { class: "flex" }, fs = {
2591
+ key: 1,
2592
+ class: "flex flex-col"
2593
+ }, ps = {
2594
+ key: 1,
2595
+ class: "flex flex-col"
2596
+ }, vs = /* @__PURE__ */ Y({
2597
+ __name: "InventoryTransfer",
2598
+ props: {
2599
+ nsLocations: {},
2600
+ currentLocationSetting: {},
2601
+ currentLocationSubsidiary: {}
2602
+ },
2603
+ setup(_) {
2604
+ const h = be(), o = te(), d = ce(), s = me(), i = G(), { t: r } = ve(), t = L([]), p = [{ label: "Transfer Out" }, { label: "History" }], S = L(p[0]), I = L(!1), f = L(null), g = L(null), y = _, w = O(() => {
2605
+ const m = o.currentLocationSetting, a = o.configuredLocations;
2606
+ return y.nsLocations.map((u) => ({
2607
+ label: u.name,
2608
+ value: u,
2609
+ disabled: a.some((b) => b.netSuiteId === u.netsuiteId) || u.subsidiaryId !== (m == null ? void 0 : m.subsidiaryId)
2610
+ }));
2611
+ }), C = O({
2612
+ get() {
2613
+ return f.value ? f.value.toISOString().slice(0, 10) : "";
2614
+ },
2615
+ set(m) {
2616
+ if (!m) {
2617
+ f.value = null;
2618
+ return;
2619
+ }
2620
+ const a = f.value ?? /* @__PURE__ */ new Date(), u = new Date(m);
2621
+ a.setFullYear(u.getFullYear(), u.getMonth(), u.getDate()), f.value = new Date(a);
2622
+ }
2623
+ }), c = O({
2624
+ get() {
2625
+ if (!f.value) return null;
2626
+ const m = String(f.value.getHours()).padStart(2, "0"), a = String(f.value.getMinutes()).padStart(2, "0");
2627
+ return `${m}:${a}`;
2628
+ },
2629
+ set(m) {
2630
+ if (!m) return;
2631
+ const [a, u] = m.split(":").map(Number), b = f.value ?? /* @__PURE__ */ new Date();
2632
+ b.setHours(a, u), f.value = new Date(b);
2633
+ }
2634
+ }), e = O(() => C.value && c.value && g.value && t.value.length > 0 && !I.value);
2635
+ async function n() {
2636
+ if (e.value) {
2637
+ if (!y.currentLocationSetting) {
2638
+ i.open({
2639
+ message: "Current location setting is not available",
2640
+ type: "error"
2641
+ });
2642
+ return;
2643
+ }
2644
+ I.value = !0;
2645
+ try {
2646
+ const m = {
2647
+ items: t.value,
2648
+ date: f.value.toISOString(),
2649
+ netsuiteLocationId: g.value.netsuiteId,
2650
+ netsuiteLocationName: g.value.name
2651
+ }, a = `${y.currentLocationSetting.type}_${y.currentLocationSetting.id}`;
2652
+ await s.createInventoryTransfer(a, m), t.value = [], f.value = null, g.value = null, i.open({
2653
+ message: "Inventort transfer created successfully",
2654
+ type: "success"
2655
+ });
2656
+ } catch {
2657
+ i.open({
2658
+ message: "Failed to create inventory transfer",
2659
+ type: "error"
2660
+ });
2661
+ } finally {
2662
+ I.value = !1;
2663
+ }
2664
+ }
2665
+ }
2666
+ function v() {
2667
+ const m = o.currentLocationSubsidiary(), a = o.getAvailableItems(m.id), u = d.skus.filter((T) => a.includes(T._id)).map((T) => T._id), b = d.skus.map(
2668
+ (T) => ({
2669
+ label: T.name,
2670
+ sublabel: T.code,
2671
+ value: T,
2672
+ disabled: !u.includes(T._id)
2673
+ })
2674
+ ), B = b.filter((T) => {
2675
+ var M;
2676
+ return (M = t.value) == null ? void 0 : M.find((X) => X.sku._id === T.value._id);
2677
+ }).map((T) => T.value);
2678
+ h.open({
2679
+ title: r("inventory.transfer.form.items.selectItem"),
2680
+ closeButton: !0,
2681
+ contentComponent: it,
2682
+ contentComponentProps: {
2683
+ modelValue: B,
2684
+ items: b,
2685
+ virtualScroll: !0
2686
+ },
2687
+ primaryActions: {
2688
+ text: r("common.confirm"),
2689
+ close: !0
2690
+ },
2691
+ secondaryActions: {
2692
+ text: r("common.close"),
2693
+ close: !0,
2694
+ variant: "tertiary"
2695
+ }
2696
+ }).onPrimary((T) => {
2697
+ const M = t.value, X = T.map((D) => {
2698
+ const z = M.find((de) => de.sku._id === D._id);
2699
+ return z || {
2700
+ sku: D,
2701
+ code: D.code,
2702
+ name: D.name,
2703
+ quantity: {
2704
+ amount: 1,
2705
+ precision: 0
2706
+ }
2707
+ };
2708
+ });
2709
+ X.sort((D, z) => D.sku.code.localeCompare(z.sku.code)), t.value = X;
2710
+ });
2711
+ }
2712
+ return (m, a) => {
2713
+ const u = F("FmButtonGroup"), b = F("FmLabel"), B = F("FmField"), T = F("FmSimpleDatePicker"), M = F("FmTimePicker"), X = F("FmSelect"), D = F("FmIcon"), z = F("FmButton");
2714
+ return x(), E("div", ss, [
2715
+ A(u, {
2716
+ modelValue: S.value,
2717
+ "onUpdate:modelValue": a[0] || (a[0] = (U) => S.value = U),
2718
+ items: p
2719
+ }, null, 8, ["modelValue"]),
2720
+ S.value.label === "Transfer Out" ? (x(), E(P, { key: 0 }, [
2721
+ V(o).inventoryTransferOutEnabled ? (x(), E("div", os, [
2722
+ A(b, { class: "fm-typo-en-body-md-600" }, {
2723
+ default: N(() => a[6] || (a[6] = [
2724
+ K("Type")
2725
+ ])),
2726
+ _: 1
2727
+ }),
2728
+ A(B, {
2729
+ class: "my-4",
2730
+ disabled: "",
2731
+ "prepend-icon": "lock"
2732
+ }, {
2733
+ default: N(() => a[7] || (a[7] = [
2734
+ K("Transfer out")
2735
+ ])),
2736
+ _: 1
2737
+ }),
2738
+ A(b, { class: "fm-typo-en-body-md-600" }, {
2739
+ default: N(() => a[8] || (a[8] = [
2740
+ K("Subsidiary")
2741
+ ])),
2742
+ _: 1
2743
+ }),
2744
+ A(B, {
2745
+ class: "my-4",
2746
+ disabled: "",
2747
+ "prepend-icon": "lock"
2748
+ }, {
2749
+ default: N(() => [
2750
+ K(R(m.currentLocationSubsidiary.fullName), 1)
2751
+ ]),
2752
+ _: 1
2753
+ }),
2754
+ A(b, { class: "fm-typo-en-body-md-600" }, {
2755
+ default: N(() => a[9] || (a[9] = [
2756
+ K("Transaction date")
2757
+ ])),
2758
+ _: 1
2759
+ }),
2760
+ A(T, {
2761
+ modelValue: C.value,
2762
+ "onUpdate:modelValue": a[1] || (a[1] = (U) => C.value = U)
2763
+ }, null, 8, ["modelValue"]),
2764
+ A(b, { class: "fm-typo-en-body-md-600" }, {
2765
+ default: N(() => a[10] || (a[10] = [
2766
+ K("Transaction time")
2767
+ ])),
2768
+ _: 1
2769
+ }),
2770
+ A(M, {
2771
+ modelValue: c.value,
2772
+ "onUpdate:modelValue": a[2] || (a[2] = (U) => c.value = U)
2773
+ }, null, 8, ["modelValue"]),
2774
+ A(b, { class: "fm-typo-en-body-md-600" }, {
2775
+ default: N(() => a[11] || (a[11] = [
2776
+ K("NetSuite Location")
2777
+ ])),
2778
+ _: 1
2779
+ }),
2780
+ l("div", as, [
2781
+ g.value ? j("", !0) : (x(), H(X, {
2782
+ key: 0,
2783
+ class: "my-4 w-full",
2784
+ modelValue: g.value,
2785
+ "onUpdate:modelValue": a[3] || (a[3] = (U) => g.value = U),
2786
+ searchable: "",
2787
+ searchTarget: "label",
2788
+ items: w.value
2789
+ }, null, 8, ["modelValue", "items"])),
2790
+ g.value ? (x(), E("div", ls, [
2791
+ A(D, {
2792
+ name: "cloud",
2793
+ color: "neutral-gray-400",
2794
+ size: "md",
2795
+ class: "mr-2",
2796
+ outline: ""
2797
+ }),
2798
+ l("div", is, [
2799
+ l("span", rs, R(g.value.name), 1),
2800
+ l("span", us, "ID: " + R(g.value.netsuiteId), 1),
2801
+ l("span", ds, "Subsidiary: " + R(g.value.subsidiaryName), 1)
2802
+ ]),
2803
+ A(z, {
2804
+ class: "ml-2",
2805
+ variant: "secondary",
2806
+ label: "Clear",
2807
+ onClick: a[4] || (a[4] = (U) => g.value = null)
2808
+ })
2809
+ ])) : j("", !0)
2810
+ ]),
2811
+ l("div", cs, [
2812
+ A(z, {
2813
+ class: "ml-auto",
2814
+ variant: "secondary",
2815
+ "prepend-icon": "add",
2816
+ label: "Ingredients",
2817
+ onClick: v
2818
+ })
2819
+ ]),
2820
+ A(es, {
2821
+ modelValue: t.value,
2822
+ "onUpdate:modelValue": a[5] || (a[5] = (U) => t.value = U)
2823
+ }, null, 8, ["modelValue"]),
2824
+ l("div", ms, [
2825
+ A(z, {
2826
+ class: "ml-auto mt-4",
2827
+ variant: "primary",
2828
+ "prepend-icon": "add",
2829
+ label: "Create",
2830
+ disabled: !e.value,
2831
+ loading: I.value,
2832
+ onClick: n
2833
+ }, null, 8, ["disabled", "loading"])
2834
+ ])
2835
+ ])) : (x(), E("div", fs, [
2836
+ A(b, { class: "fm-typo-en-body-md-600" }, {
2837
+ default: N(() => a[12] || (a[12] = [
2838
+ K(" Feature is not enabled. Please contact your administrator. ")
2839
+ ])),
2840
+ _: 1
2841
+ })
2842
+ ]))
2843
+ ], 64)) : j("", !0),
2844
+ S.value.label === "History" ? (x(), E("div", ps, [
2845
+ A(ns)
2846
+ ])) : j("", !0)
2847
+ ]);
2848
+ };
2849
+ }
2850
+ }), gs = { class: "flex flex-col gap-8" }, ys = {
2851
+ key: 0,
2852
+ class: "flex flex-col gap-4"
2853
+ }, As = { class: "flex flex-col gap-2" }, bs = { class: "flex flex-col gap-2 pl-6" }, hs = { key: 1 }, xs = { class: "flex justify-end" }, Is = { class: "flex flex-col gap-4" }, Ss = { class: "ml-auto flex gap-4" }, ws = /* @__PURE__ */ Y({
2854
+ __name: "TransferOrder",
2855
+ props: {
2856
+ currentLocationSetting: {}
2857
+ },
2858
+ setup(_) {
2859
+ const h = le(), o = me(), d = G(), s = L(!1), i = _, r = L([]), t = L(/* @__PURE__ */ new Set()), p = L(!1), S = L($.enum[1]), I = [
2860
+ { value: $.enum[1], label: "Version 1" },
2861
+ {
2862
+ value: $.enum[2],
2863
+ label: "Version 2",
2864
+ subLabel: "Supports duplicate skus"
2865
+ }
2866
+ ], f = O(() => r.value.length > 0 && t.value.size === r.value.length), g = O(() => t.value.size > 0 && t.value.size < r.value.length);
2867
+ function y(m) {
2868
+ m ? t.value = new Set(r.value.map((a) => a.id)) : t.value = /* @__PURE__ */ new Set();
2869
+ }
2870
+ function w(m, a) {
2871
+ a ? t.value.add(m) : t.value.delete(m), t.value = new Set(t.value);
2872
+ }
2873
+ function C(m) {
2874
+ return t.value.has(m);
2875
+ }
2876
+ async function c() {
2877
+ var m;
2878
+ s.value = !0;
2879
+ try {
2880
+ const a = ((m = i.currentLocationSetting) == null ? void 0 : m.id) || "", u = await o.getUnSyncTransferInOrders(a);
2881
+ r.value = u, t.value = /* @__PURE__ */ new Set(), d.open({
2882
+ message: "Check unsync transfer in order successfully",
2883
+ type: "success"
2884
+ });
2885
+ } catch {
2886
+ d.open({
2887
+ message: "Failed to check unsync transfer in order",
2888
+ type: "error"
2889
+ });
2890
+ } finally {
2891
+ s.value = !1;
2892
+ }
2893
+ }
2894
+ async function e() {
2895
+ if (t.value.size === 0) {
2896
+ d.open({
2897
+ message: "No transfer orders selected",
2898
+ type: "info"
2899
+ });
2900
+ return;
2901
+ }
2902
+ S.value = $.enum[1], p.value = !0;
2903
+ }
2904
+ async function n() {
2905
+ p.value = !1;
2906
+ const m = S.value === $.enum[2] ? $.enum[2] : void 0;
2907
+ await v(m);
2908
+ }
2909
+ async function v(m) {
2910
+ s.value = !0;
2911
+ try {
2912
+ const a = Array.from(t.value);
2913
+ await o.manualSyncMultipleTransferInOrders({ netsuiteIds: a, version: m }), await new Promise((u) => setTimeout(u, 5e3)), r.value = r.value.filter((u) => !t.value.has(u.id)), t.value = /* @__PURE__ */ new Set(), d.open({
2914
+ message: "Sync transfer orders request sent successfully",
2915
+ type: "success"
2916
+ });
2917
+ } catch {
2918
+ d.open({
2919
+ message: "Failed to sync transfer orders",
2920
+ type: "error"
2921
+ });
2922
+ } finally {
2923
+ s.value = !1;
2924
+ }
2925
+ }
2926
+ return (m, a) => {
2927
+ var X;
2928
+ const u = F("FmButton"), b = F("FmCheckbox"), B = F("FmRadio"), T = F("FmRadioGroup"), M = F("FmDialog");
2929
+ return x(), E("div", gs, [
2930
+ l("span", null, "Current date and time: " + R((/* @__PURE__ */ new Date()).toLocaleString()), 1),
2931
+ A(u, {
2932
+ label: "Check Unsync Transfer Order (Last 2 months)",
2933
+ variant: "primary",
2934
+ onClick: c,
2935
+ disabled: s.value,
2936
+ loading: s.value
2937
+ }, null, 8, ["disabled", "loading"]),
2938
+ r.value.length > 0 ? (x(), E("div", ys, [
2939
+ a[3] || (a[3] = l("p", null, "Transfer Order NetSuite ID not match with existing orders", -1)),
2940
+ l("div", As, [
2941
+ (X = V(h).sessionUser.value) != null && X.role.isAdmin ? (x(), H(b, {
2942
+ key: 0,
2943
+ label: "Select All",
2944
+ value: "all",
2945
+ modelValue: f.value,
2946
+ indeterminate: g.value,
2947
+ disabled: s.value,
2948
+ "onUpdate:modelValue": y
2949
+ }, null, 8, ["modelValue", "indeterminate", "disabled"])) : j("", !0),
2950
+ l("ul", bs, [
2951
+ (x(!0), E(P, null, ee(r.value, (D) => {
2952
+ var z;
2953
+ return x(), E("li", {
2954
+ key: D.id,
2955
+ class: "flex items-center"
2956
+ }, [
2957
+ (z = V(h).sessionUser.value) != null && z.role.isAdmin ? (x(), H(b, {
2958
+ key: 0,
2959
+ label: `${D.id} (${D.tranid})`,
2960
+ value: D.id,
2961
+ modelValue: C(D.id),
2962
+ disabled: s.value,
2963
+ "onUpdate:modelValue": (U) => w(D.id, U)
2964
+ }, null, 8, ["label", "value", "modelValue", "disabled", "onUpdate:modelValue"])) : (x(), E("span", hs, R(D.id) + " (" + R(D.tranid) + ")", 1))
2965
+ ]);
2966
+ }), 128))
2967
+ ])
2968
+ ]),
2969
+ l("div", xs, [
2970
+ A(Te, null, {
2971
+ default: N(() => [
2972
+ r.value.length > 0 ? (x(), H(u, {
2973
+ key: 0,
2974
+ label: `Sync Selected (${t.value.size})`,
2975
+ variant: "destructive",
2976
+ onClick: e,
2977
+ disabled: s.value || t.value.size === 0,
2978
+ loading: s.value
2979
+ }, null, 8, ["label", "disabled", "loading"])) : j("", !0)
2980
+ ]),
2981
+ _: 1
2982
+ })
2983
+ ])
2984
+ ])) : j("", !0),
2985
+ A(M, {
2986
+ modelValue: p.value,
2987
+ "onUpdate:modelValue": a[2] || (a[2] = (D) => p.value = D),
2988
+ overlay: !0
2989
+ }, {
2990
+ "dialog-header": N(() => a[4] || (a[4] = [
2991
+ l("span", { class: "fm-typo-en-heading-lg-700" }, "Select Sync Version", -1)
2992
+ ])),
2993
+ "dialog-footer": N(() => [
2994
+ l("div", Ss, [
2995
+ A(u, {
2996
+ label: "Not now",
2997
+ variant: "secondary",
2998
+ onClick: a[1] || (a[1] = (D) => p.value = !1)
2999
+ }),
3000
+ A(u, {
3001
+ label: "Confirm",
3002
+ variant: "primary",
3003
+ onClick: n
3004
+ })
3005
+ ])
3006
+ ]),
3007
+ default: N(() => [
3008
+ l("div", Is, [
3009
+ l("p", null, " Choose which order version to use for syncing " + R(t.value.size) + " selected transfer orders: ", 1),
3010
+ A(T, {
3011
+ modelValue: S.value,
3012
+ "onUpdate:modelValue": a[0] || (a[0] = (D) => S.value = D)
3013
+ }, {
3014
+ default: N(() => [
3015
+ (x(), E(P, null, ee(I, (D) => A(B, {
3016
+ key: D.value,
3017
+ value: D.value,
3018
+ label: D.label,
3019
+ sublabel: D.subLabel
3020
+ }, null, 8, ["value", "label", "sublabel"])), 64))
3021
+ ]),
3022
+ _: 1
3023
+ }, 8, ["modelValue"])
3024
+ ])
3025
+ ]),
3026
+ _: 1
3027
+ }, 8, ["modelValue"])
3028
+ ]);
3029
+ };
3030
+ }
3031
+ }), ks = { class: "flex flex-col gap-8" }, Fs = {
3032
+ key: 0,
3033
+ class: "flex flex-col gap-4"
3034
+ }, Cs = { class: "flex flex-col gap-2" }, Bs = { class: "flex flex-col gap-2 pl-6" }, Vs = { key: 1 }, _s = { class: "flex justify-end" }, Es = { class: "flex flex-col gap-4" }, Ns = { class: "ml-auto flex gap-4" }, Ls = /* @__PURE__ */ Y({
3035
+ __name: "PurchaseOrder",
3036
+ props: {
3037
+ currentLocationSetting: {}
3038
+ },
3039
+ setup(_) {
3040
+ const h = le(), o = me(), d = G(), s = L(!1), i = _, r = L([]), t = L(/* @__PURE__ */ new Set()), p = L(!1), S = L($.enum[1]), I = [
3041
+ { value: $.enum[1], label: "Version 1" },
3042
+ {
3043
+ value: $.enum[2],
3044
+ label: "Version 2",
3045
+ subLabel: "Supports duplicate skus"
3046
+ }
3047
+ ], f = O(() => r.value.length > 0 && t.value.size === r.value.length), g = O(() => t.value.size > 0 && t.value.size < r.value.length);
3048
+ function y(m) {
3049
+ m ? t.value = new Set(r.value.map((a) => a.id)) : t.value = /* @__PURE__ */ new Set();
3050
+ }
3051
+ function w(m, a) {
3052
+ a ? t.value.add(m) : t.value.delete(m), t.value = new Set(t.value);
3053
+ }
3054
+ function C(m) {
3055
+ return t.value.has(m);
3056
+ }
3057
+ async function c() {
3058
+ var m;
3059
+ s.value = !0;
3060
+ try {
3061
+ const a = ((m = i.currentLocationSetting) == null ? void 0 : m.id) || "", u = await o.getUnSyncPurchaseOrders(a);
3062
+ r.value = u, t.value = /* @__PURE__ */ new Set(), d.open({
3063
+ message: "Check unsync purchase order successfully",
3064
+ type: "success"
3065
+ });
3066
+ } catch {
3067
+ d.open({
3068
+ message: "Failed to check unsync purchase order",
3069
+ type: "error"
3070
+ });
3071
+ } finally {
3072
+ s.value = !1;
3073
+ }
3074
+ }
3075
+ async function e() {
3076
+ if (t.value.size === 0) {
3077
+ d.open({
3078
+ message: "No purchase orders selected",
3079
+ type: "info"
3080
+ });
3081
+ return;
3082
+ }
3083
+ S.value = $.enum[1], p.value = !0;
3084
+ }
3085
+ async function n() {
3086
+ p.value = !1;
3087
+ const m = S.value === $.enum[2] ? $.enum[2] : void 0;
3088
+ await v(m);
3089
+ }
3090
+ async function v(m) {
3091
+ s.value = !0;
3092
+ try {
3093
+ const a = Array.from(t.value);
3094
+ await o.manualSyncMultiplePurchaseOrders({ netsuiteIds: a, version: m }), await new Promise((u) => setTimeout(u, 5e3)), r.value = r.value.filter((u) => !t.value.has(u.id)), t.value = /* @__PURE__ */ new Set(), d.open({
3095
+ message: "Sync purchase orders request sent successfully",
3096
+ type: "success"
3097
+ });
3098
+ } catch {
3099
+ d.open({
3100
+ message: "Failed to sync purchase orders",
3101
+ type: "error"
3102
+ });
3103
+ } finally {
3104
+ s.value = !1;
3105
+ }
3106
+ }
3107
+ return (m, a) => {
3108
+ var X;
3109
+ const u = F("FmButton"), b = F("FmCheckbox"), B = F("FmRadio"), T = F("FmRadioGroup"), M = F("FmDialog");
3110
+ return x(), E("div", ks, [
3111
+ l("span", null, "Current date and time: " + R((/* @__PURE__ */ new Date()).toLocaleString()), 1),
3112
+ A(u, {
3113
+ label: "Check Unsync Purchase Order (Last 2 months)",
3114
+ variant: "primary",
3115
+ onClick: c,
3116
+ disabled: s.value,
3117
+ loading: s.value
3118
+ }, null, 8, ["disabled", "loading"]),
3119
+ r.value.length > 0 ? (x(), E("div", Fs, [
3120
+ a[3] || (a[3] = l("p", null, "Purchase Order NetSuite ID not match with existing orders", -1)),
3121
+ l("div", Cs, [
3122
+ (X = V(h).sessionUser.value) != null && X.role.isAdmin ? (x(), H(b, {
3123
+ key: 0,
3124
+ label: "Select All",
3125
+ value: "all",
3126
+ modelValue: f.value,
3127
+ indeterminate: g.value,
3128
+ disabled: s.value,
3129
+ "onUpdate:modelValue": y
3130
+ }, null, 8, ["modelValue", "indeterminate", "disabled"])) : j("", !0),
3131
+ l("ul", Bs, [
3132
+ (x(!0), E(P, null, ee(r.value, (D) => {
3133
+ var z;
3134
+ return x(), E("li", {
3135
+ key: D.id,
3136
+ class: "flex items-center"
3137
+ }, [
3138
+ (z = V(h).sessionUser.value) != null && z.role.isAdmin ? (x(), H(b, {
3139
+ key: 0,
3140
+ label: `${D.id} (${D.tranid}) [${D.entity.id} (${D.entity.name})]`,
3141
+ value: D.id,
3142
+ modelValue: C(D.id),
3143
+ disabled: s.value,
3144
+ "onUpdate:modelValue": (U) => w(D.id, U)
3145
+ }, null, 8, ["label", "value", "modelValue", "disabled", "onUpdate:modelValue"])) : (x(), E("div", Vs, [
3146
+ l("span", null, R(D.id) + " (" + R(D.tranid) + ") [" + R(D.entity.id) + " (" + R(D.entity.name) + ")] ", 1)
3147
+ ]))
3148
+ ]);
3149
+ }), 128))
3150
+ ])
3151
+ ]),
3152
+ l("div", _s, [
3153
+ A(Te, null, {
3154
+ default: N(() => [
3155
+ r.value.length > 0 ? (x(), H(u, {
3156
+ key: 0,
3157
+ label: `Sync Selected (${t.value.size})`,
3158
+ variant: "destructive",
3159
+ onClick: e,
3160
+ disabled: s.value || t.value.size === 0,
3161
+ loading: s.value
3162
+ }, null, 8, ["label", "disabled", "loading"])) : j("", !0)
3163
+ ]),
3164
+ _: 1
3165
+ })
3166
+ ])
3167
+ ])) : j("", !0),
3168
+ A(M, {
3169
+ modelValue: p.value,
3170
+ "onUpdate:modelValue": a[2] || (a[2] = (D) => p.value = D),
3171
+ overlay: !0
3172
+ }, {
3173
+ "dialog-header": N(() => a[4] || (a[4] = [
3174
+ l("span", { class: "fm-typo-en-heading-lg-700" }, "Select Sync Version", -1)
3175
+ ])),
3176
+ "dialog-footer": N(() => [
3177
+ l("div", Ns, [
3178
+ A(u, {
3179
+ label: "Not now",
3180
+ variant: "secondary",
3181
+ onClick: a[1] || (a[1] = (D) => p.value = !1)
3182
+ }),
3183
+ A(u, {
3184
+ label: "Confirm",
3185
+ variant: "primary",
3186
+ onClick: n
3187
+ })
3188
+ ])
3189
+ ]),
3190
+ default: N(() => [
3191
+ l("div", Es, [
3192
+ l("p", null, " Choose which order version to use for syncing " + R(t.value.size) + " selected purchase orders: ", 1),
3193
+ A(T, {
3194
+ modelValue: S.value,
3195
+ "onUpdate:modelValue": a[0] || (a[0] = (D) => S.value = D)
3196
+ }, {
3197
+ default: N(() => [
3198
+ (x(), E(P, null, ee(I, (D) => A(B, {
3199
+ key: D.value,
3200
+ value: D.value,
3201
+ label: D.label,
3202
+ sublabel: D.subLabel
3203
+ }, null, 8, ["value", "label", "sublabel"])), 64))
3204
+ ]),
3205
+ _: 1
3206
+ }, 8, ["modelValue"])
3207
+ ])
3208
+ ]),
3209
+ _: 1
3210
+ }, 8, ["modelValue"])
3211
+ ]);
3212
+ };
3213
+ }
3214
+ }), Ds = { class: "flex flex-col gap-8 w-full" }, Ts = { class: "flex gap-4 justify-between" }, Rs = { class: "inline-flex rounded-md items-center gap-4 justify-center h-[30px] px-8 py-4 bg-fm-color-neutral-gray-100 text-fm-color-neutral-gray-400" }, Os = { class: "fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap" }, Ms = { key: 0 }, zs = { class: "flex gap-8 items-center justify-start" }, js = /* @__PURE__ */ Y({
3215
+ __name: "NetSuiteSideSheet",
3216
+ props: {
3217
+ nsLocations: {},
3218
+ show: { type: Boolean },
3219
+ loading: { type: Boolean }
3220
+ },
3221
+ emits: ["update:show"],
3222
+ setup(_, { emit: h }) {
3223
+ var C;
3224
+ const o = le(), d = te(), s = _, i = ue(s, "show"), { t: r } = Z(), t = h, p = se(), S = ((C = p._currentLocation) == null ? void 0 : C.type) || "", I = [
3225
+ {
3226
+ label: "Inventory Transfer (Out)",
3227
+ value: "inventoryTransfer"
3228
+ /* INVENTORY_TRANSFER */
3229
+ },
3230
+ {
3231
+ label: "Transfer Order",
3232
+ value: "transferOrder"
3233
+ /* TRANSFER_ORDER */
3234
+ },
3235
+ {
3236
+ label: "Purchase Order",
3237
+ value: "purchaseOrder"
3238
+ /* PURCHASE_ORDER */
3239
+ }
3240
+ ], f = L(I[0].value), g = O(() => d.currentLocationSubsidiary()), y = O(() => d.currentLocationSetting), w = O(() => s.nsLocations.filter(
3241
+ (c) => c.subsidiaryId === g.value.id || c.netsuiteId === g.value.id
3242
+ ));
3243
+ return (c, e) => {
3244
+ var u;
3245
+ const n = F("FmIcon"), v = F("FmTabs"), m = F("FmButton"), a = F("FmSideSheet");
3246
+ return x(), H(a, {
3247
+ modelValue: V(i),
3248
+ "onUpdate:modelValue": e[2] || (e[2] = (b) => re(i) ? i.value = b : null),
3249
+ header: "Data migration (Xilnex)",
3250
+ "dismiss-away": "",
3251
+ "close-button": "",
3252
+ "max-width": 800
3253
+ }, oe({
3254
+ default: N(() => [
3255
+ V(d).isCurrentLocationBindedToNetSuite ? (x(), E(P, { key: 1 }, [
3256
+ f.value === "inventoryTransfer" ? (x(), H(vs, {
3257
+ key: 0,
3258
+ currentLocationSetting: y.value,
3259
+ nsLocations: w.value,
3260
+ currentLocationSubsidiary: g.value
3261
+ }, null, 8, ["currentLocationSetting", "nsLocations", "currentLocationSubsidiary"])) : j("", !0),
3262
+ f.value === "transferOrder" ? (x(), H(ws, {
3263
+ key: 1,
3264
+ currentLocationSetting: y.value
3265
+ }, null, 8, ["currentLocationSetting"])) : j("", !0),
3266
+ f.value === "purchaseOrder" ? (x(), H(Ls, {
3267
+ key: 2,
3268
+ currentLocationSetting: y.value
3269
+ }, null, 8, ["currentLocationSetting"])) : j("", !0)
3270
+ ], 64)) : (x(), E("div", Ms, " Netsuite is not configured for this location. Please contact your administrator. "))
3271
+ ]),
3272
+ "side-sheet-footer": N(() => [
3273
+ l("div", zs, [
3274
+ A(m, {
3275
+ variant: "tertiary",
3276
+ label: V(r)("common.close"),
3277
+ onClick: e[1] || (e[1] = (b) => t("update:show", !1))
3278
+ }, null, 8, ["label"])
3279
+ ])
3280
+ ]),
3281
+ _: 2
3282
+ }, [
3283
+ (u = V(o).sessionUser.value) != null && u.role.isAdmin ? {
3284
+ name: "side-sheet-header",
3285
+ fn: N(() => {
3286
+ var b;
3287
+ return [
3288
+ l("div", Ds, [
3289
+ l("div", Ts, [
3290
+ e[3] || (e[3] = l("div", { class: "fm-typo-en-title-md-600" }, "NetSuite Integration", -1)),
3291
+ l("div", Rs, [
3292
+ A(n, {
3293
+ name: V(S),
3294
+ size: "sm"
3295
+ }, null, 8, ["name"]),
3296
+ l("div", Os, R((b = V(p)._currentLocation) == null ? void 0 : b.name), 1)
3297
+ ])
3298
+ ]),
3299
+ A(v, {
3300
+ "model-value": f.value,
3301
+ "onUpdate:modelValue": e[0] || (e[0] = (B) => f.value = B),
3302
+ items: I
3303
+ }, null, 8, ["model-value"])
3304
+ ])
3305
+ ];
3306
+ }),
3307
+ key: "0"
3308
+ } : void 0
3309
+ ]), 1032, ["modelValue"]);
3310
+ };
3311
+ }
3312
+ }), Us = { class: "flex justify-center" }, Hs = ["src"], Xs = { class: "flex flex-col items-center gap-2" }, Ys = { class: "text-lg font-bold" }, Ps = { class: "text-fm-color-neutral-gray-300" }, Qs = /* @__PURE__ */ Y({
3313
+ __name: "NetSuite",
3314
+ setup(_) {
3315
+ const h = te(), o = G(), d = L(!1), s = L(!1);
3316
+ async function i() {
3317
+ s.value = !0;
3318
+ }
3319
+ const r = L([]);
3320
+ Ke(async () => {
3321
+ if (h.isReady && h.isEnabled && !h.isBusinessLocation) {
3322
+ d.value = !0;
3323
+ try {
3324
+ const p = await h.getNetSuiteLocationOptions();
3325
+ r.value = p;
3326
+ } catch {
3327
+ o.open({
3328
+ message: "Failed to fetch NetSuite locations",
3329
+ type: "error"
3330
+ });
3331
+ } finally {
3332
+ d.value = !1;
3333
+ }
3334
+ }
3335
+ });
3336
+ const { t } = Z();
3337
+ return (p, S) => {
3338
+ const I = F("FmCardSection"), f = F("FmCard");
3339
+ return V(h).isEnabled ? (x(), E(P, { key: 0 }, [
3340
+ A(f, {
3341
+ class: q({
3342
+ "w-full": !0,
3343
+ border: !0,
3344
+ "border-fm-color-neutral-gray-100": !0,
3345
+ "cursor-pointer": !0,
3346
+ "hover:border-fm-color-primary": !0
3347
+ }),
3348
+ onClick: S[0] || (S[0] = (g) => i())
3349
+ }, {
3350
+ default: N(() => [
3351
+ A(I, null, {
3352
+ default: N(() => [
3353
+ l("div", Us, [
3354
+ l("img", {
3355
+ src: V(ln),
3356
+ alt: "NetSuite"
3357
+ }, null, 8, Hs)
3358
+ ]),
3359
+ l("div", Xs, [
3360
+ l("div", Ys, R(V(t)("inventory.integration.netsuite.title")), 1),
3361
+ l("div", Ps, R(V(t)("inventory.integration.netsuite.description")), 1)
3362
+ ])
3363
+ ]),
3364
+ _: 1
3365
+ })
3366
+ ]),
3367
+ _: 1
3368
+ }),
3369
+ V(h).state.setting ? (x(), H(pe, {
3370
+ key: 0,
3371
+ to: "body"
3372
+ }, [
3373
+ V(h).isBusinessLocation ? (x(), H($n, {
3374
+ key: 0,
3375
+ show: s.value,
3376
+ "onUpdate:show": [
3377
+ S[1] || (S[1] = (g) => s.value = g),
3378
+ S[2] || (S[2] = (g) => s.value = g)
3379
+ ],
3380
+ loading: d.value,
3381
+ "onUpdate:loading": S[3] || (S[3] = (g) => d.value = g)
3382
+ }, null, 8, ["show", "loading"])) : (x(), H(js, {
3383
+ key: 1,
3384
+ setting: V(h).state.setting,
3385
+ "onUpdate:setting": S[4] || (S[4] = (g) => V(h).state.setting = g),
3386
+ nsLocations: r.value,
3387
+ "onUpdate:nsLocations": S[5] || (S[5] = (g) => r.value = g),
3388
+ show: s.value,
3389
+ "onUpdate:show": [
3390
+ S[6] || (S[6] = (g) => s.value = g),
3391
+ S[7] || (S[7] = (g) => s.value = g)
3392
+ ],
3393
+ loading: d.value,
3394
+ "onUpdate:loading": S[8] || (S[8] = (g) => d.value = g)
3395
+ }, null, 8, ["setting", "nsLocations", "show", "loading"]))
3396
+ ])) : j("", !0)
3397
+ ], 64)) : j("", !0);
3398
+ };
3399
+ }
3400
+ }), Se = [
3401
+ "store",
3402
+ "issueBy",
3403
+ "verifiedBy",
3404
+ "stockTakeId",
3405
+ "date",
3406
+ "status",
3407
+ "c_field",
3408
+ "itemCode",
3409
+ "itemName",
3410
+ "physicalQty",
3411
+ "ohQty",
3412
+ "customCost",
3413
+ "totalPhysicalCustomCost",
3414
+ "schemeFranchiseePrice",
3415
+ "physicalSchemeTotalFranchiseePrice"
3416
+ ];
3417
+ async function Js(_, h, o) {
3418
+ var r;
3419
+ const d = await Ks(o), s = [], i = {};
3420
+ for (const t in d) {
3421
+ const p = d[t];
3422
+ for (let S = 0; S < p.length; S++) {
3423
+ const I = p[S], f = I.itemCode, g = I.itemName, y = I.physicalQty, w = I.customCost;
3424
+ if (f === "" || f === "undefined") {
3425
+ s.push({
3426
+ row: I.excelRow,
3427
+ itemCode: f,
3428
+ itemName: g,
3429
+ message: "Item code is empty or undefined"
3430
+ });
3431
+ continue;
3432
+ }
3433
+ const C = h.find((m) => m.code === f);
3434
+ if (!C) {
3435
+ s.push({
3436
+ row: I.excelRow,
3437
+ itemCode: f,
3438
+ itemName: g,
3439
+ qty: y,
3440
+ message: "Item not found in inventory"
3441
+ }), console.error(`${I.excelRow} Item not found: ${f} ${g} ${y}`);
3442
+ continue;
3443
+ }
3444
+ let c = Number(I.totalPhysicalCustomCost);
3445
+ const e = _[C._id];
3446
+ e && (c = e * Number(y));
3447
+ const n = ne.fromNumber(Number(y)), v = {
3448
+ amount: n,
3449
+ cost: {
3450
+ ...ne.fromNumber(Number(c)),
3451
+ currency: "MYR"
3452
+ }
3453
+ };
3454
+ y != "0" && w == "0" && console.warn(`Item ${f} ${g} has 0 cost.`), i[r = C._id] ?? (i[r] = {
3455
+ skuAdjustment: {
3456
+ sku: C,
3457
+ fromBalance: ne.fromNumber(0),
3458
+ amounts: [
3459
+ {
3460
+ _id: null,
3461
+ type: Be.Enum.CLOSING,
3462
+ remark: "Opening Balance",
3463
+ amount: n,
3464
+ measurement: null,
3465
+ // always the smallest unit
3466
+ cost: v.cost
3467
+ }
3468
+ ],
3469
+ toBalance: n,
3470
+ toCostBalances: [v]
3471
+ },
3472
+ skuBalance: {
3473
+ id: C._id,
3474
+ balance: n,
3475
+ costs: [v]
3476
+ }
3477
+ });
3478
+ }
3479
+ }
3480
+ return {
3481
+ errors: s,
3482
+ rows: i
3483
+ };
3484
+ }
3485
+ async function Ks(_) {
3486
+ const h = await new Promise((i, r) => {
3487
+ const t = new FileReader();
3488
+ t.onload = (p) => i(p.target.result), t.onerror = r, t.readAsArrayBuffer(_);
3489
+ }), o = Me(h, { type: "array" }), d = o.SheetNames, s = {};
3490
+ for (const i of d) {
3491
+ const r = await qs(o.Sheets[i]);
3492
+ s[i] = r;
3493
+ }
3494
+ return s;
3495
+ }
3496
+ async function qs(_) {
3497
+ const h = ze.sheet_to_json(_, {
3498
+ header: Se,
3499
+ range: 12
3500
+ }), o = [];
3501
+ for (let d = 0; d < h.length; d++) {
3502
+ const s = h[d], i = {};
3503
+ for (const r of Se)
3504
+ i[r] = String(s[r]).trim();
3505
+ o.push({
3506
+ ...i,
3507
+ excelRow: d + 13
3508
+ // Excel rows start from 1, and we skip the first 12 rows
3509
+ });
3510
+ }
3511
+ return o;
3512
+ }
3513
+ const Gs = { class: "flex flex-col gap-4" }, Zs = { class: "flex flex-col" }, Ws = {
3514
+ key: 0,
3515
+ class: "flex flex-col gap-4 my-5"
3516
+ }, $s = { class: "flex flex-col gap-8" }, eo = { class: "flex flex-col gap-8" }, to = {
3517
+ class: /* @__PURE__ */ q(["fm-corner-radius-md p-16 flex items-center gap-16"])
3518
+ }, no = {
3519
+ class: /* @__PURE__ */ q(["fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center gap-3"])
3520
+ }, so = { class: "line-clamp-2 text-ellipsis break-all" }, oo = { class: "flex flex-col" }, ao = { class: "font-medium" }, lo = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, io = {
3521
+ key: 0,
3522
+ class: "rounded border-1 border-gray-200 p-2 flex items-center"
3523
+ }, ro = { class: "flex flex-col" }, uo = { class: "font-medium" }, co = { class: "text-xs text-gray-400" }, mo = { class: "text-xs text-gray-400" }, fo = { class: "flex" }, po = { class: "flex" }, vo = {
3524
+ key: 1,
3525
+ class: "flex flex-col gap-2"
3526
+ }, go = /* @__PURE__ */ Y({
3527
+ __name: "XilnexOpeningImport",
3528
+ setup(_) {
3529
+ const h = st(), o = te(), d = ce(), s = Ve(), i = G(), r = se(), t = O(() => [
3530
+ {
3531
+ value: "xilnex",
3532
+ label: "Xilnex",
3533
+ subLabel: "Based on Xilnex's item cost from excel file"
3534
+ },
3535
+ ...o.isEnabled ? [
3536
+ {
3537
+ value: "netsuite",
3538
+ label: "NetSuite",
3539
+ subLabel: "Based on NetSuite's item current average cost by location. If not available, it will fallback to excel's cost",
3540
+ disabled: !o.isCurrentLocationBindedToNetSuite,
3541
+ disabledReason: "Current location is not binded to NetSuite"
3542
+ }
3543
+ ] : []
3544
+ ]), p = L(t.value[0].value), { t: S } = ve(), I = L(null), f = L(), g = L(""), y = L([]), w = L([]), C = [
3545
+ {
3546
+ id: "ingredient",
3547
+ header: () => "Ingredient",
3548
+ cell(b) {
3549
+ const B = b.row.original;
3550
+ return k("div", { class: "flex flex-col" }, [
3551
+ k("span", { class: "font-medium" }, B.skuAdjustment.sku.name),
3552
+ k("span", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, [
3553
+ B.skuAdjustment.sku.code
3554
+ ])
3555
+ ]);
3556
+ }
3557
+ },
3558
+ {
3559
+ id: "openingBalance",
3560
+ header: () => "Opening Balance",
3561
+ cell(b) {
3562
+ const B = b.row.original;
3563
+ return k("div", { class: "flex flex-col" }, [
3564
+ k(
3565
+ "span",
3566
+ { class: "font-medium" },
3567
+ ne.toFormatString({
3568
+ value: B.skuAdjustment.amounts[0].amount
3569
+ })
3570
+ )
3571
+ ]);
3572
+ }
3573
+ },
3574
+ {
3575
+ id: "unit",
3576
+ header: () => "Unit",
3577
+ cell(b) {
3578
+ const B = b.row.original, T = !B.skuAdjustment.amounts[0].measurement;
3579
+ let M = B.skuAdjustment.sku.unit.name;
3580
+ if (!T) {
3581
+ const X = B.skuAdjustment.sku.unit.measurements.find(
3582
+ (D) => D.id === B.skuAdjustment.amounts[0].measurement.id
3583
+ );
3584
+ M = X ? X.name : "Error: Measurement not found";
3585
+ }
3586
+ return k("div", { class: "flex flex-col" }, [
3587
+ k("span", { class: "font-medium" }, M),
3588
+ T ? null : k("span", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, [
3589
+ `Base unit: ${B.skuAdjustment.sku.unit.name}`
3590
+ ])
3591
+ ]);
3592
+ }
3593
+ },
3594
+ {
3595
+ id: "totalCost",
3596
+ header: () => "Total Cost",
3597
+ cell(b) {
3598
+ const B = b.row.original, { currency: T, ...M } = B.skuAdjustment.amounts[0].cost ?? {
3599
+ amount: 0,
3600
+ precision: 0,
3601
+ currency: ""
3602
+ };
3603
+ return k("div", { class: "flex flex-col" }, [
3604
+ k(
3605
+ "span",
3606
+ { class: "font-medium" },
3607
+ ne.toFormatString({
3608
+ value: M
3609
+ })
3610
+ )
3611
+ ]);
3612
+ }
3613
+ }
3614
+ ], c = [
3615
+ {
3616
+ accessorKey: "row",
3617
+ header: "Row"
3618
+ },
3619
+ {
3620
+ accessorKey: "itemCode",
3621
+ header: "Item Code"
3622
+ },
3623
+ {
3624
+ accessorKey: "itemName",
3625
+ header: "Item Name"
3626
+ },
3627
+ {
3628
+ accessorKey: "qty",
3629
+ header: "Quantity"
3630
+ },
3631
+ {
3632
+ accessorKey: "message",
3633
+ header: "Error Message"
3634
+ }
3635
+ ], e = L(!1);
3636
+ async function n() {
3637
+ if (I.value) {
3638
+ e.value = !0;
3639
+ try {
3640
+ let b = {};
3641
+ p.value === "netsuite" && (b = await o.getItemAverageCosts());
3642
+ const { errors: B, rows: T } = await Js(
3643
+ b,
3644
+ d.skus,
3645
+ I.value
3646
+ );
3647
+ y.value = B, w.value = Object.values(T);
3648
+ } catch {
3649
+ i.open({
3650
+ message: "Error verifying file",
3651
+ type: "error"
3652
+ });
3653
+ } finally {
3654
+ e.value = !1;
3655
+ }
3656
+ }
3657
+ }
3658
+ async function v() {
3659
+ if (I.value) {
3660
+ e.value = !0;
3661
+ try {
3662
+ if (!a.value) {
3663
+ i.open({
3664
+ message: "Please select a date for the opening balance",
3665
+ type: "error"
3666
+ });
3667
+ return;
3668
+ }
3669
+ await s.setOpeningBalance({
3670
+ effectiveAt: a.value,
3671
+ skuAdjustments: w.value.map((b) => b.skuAdjustment),
3672
+ skuBalances: w.value.map((b) => b.skuBalance)
3673
+ }), i.open({
3674
+ message: "Opening balance imported successfully",
3675
+ type: "success"
3676
+ }), await h.fetchClosingDocumentId();
3677
+ } catch {
3678
+ i.open({
3679
+ message: "Error importing opening balance",
3680
+ type: "error"
3681
+ });
3682
+ } finally {
3683
+ e.value = !1;
3684
+ }
3685
+ }
3686
+ }
3687
+ const m = L(""), a = O({
3688
+ get() {
3689
+ return m.value;
3690
+ },
3691
+ set(b) {
3692
+ m.value = `${b}T15:59:59.999Z`;
3693
+ }
3694
+ }), u = O(() => {
3695
+ if (!m.value) return null;
3696
+ const b = new Date(m.value);
3697
+ return isNaN(b.getTime()) ? null : he(b);
3698
+ });
3699
+ return (b, B) => {
3700
+ const T = F("FmLabel"), M = F("FmField"), X = F("FmSimpleDatePicker"), D = F("FmButton"), z = F("FmIcon"), U = F("FmRadio"), de = F("FmRadioGroup"), xe = F("FmTable");
3701
+ return x(), E("div", Gs, [
3702
+ l("div", Zs, [
3703
+ A(T, { label: "Latest closing" })
3704
+ ]),
3705
+ A(M, {
3706
+ "prepend-icon": "lock_outline",
3707
+ disabled: ""
3708
+ }, {
3709
+ default: N(() => [
3710
+ K(R(V(h).state.closingDocumentId ? `${V(De)(new Date(V(Ae)(V(h).state.closingDocumentId)))}` : "No closing found"), 1)
3711
+ ]),
3712
+ _: 1
3713
+ }),
3714
+ V(h).state.closingDocumentId ? (x(), E("div", vo, [
3715
+ B[6] || (B[6] = l("span", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, " Not able to import opening balance as closing document already exists. ", -1)),
3716
+ V(r)._currentLocation ? (x(), E(P, { key: 0 }, [
3717
+ A(T, { label: "Location ID" }),
3718
+ A(M, {
3719
+ "prepend-icon": "lock_outline",
3720
+ disabled: ""
3721
+ }, {
3722
+ default: N(() => [
3723
+ K(R(V(r)._currentLocation.dbName.split("_")[1]), 1)
3724
+ ]),
3725
+ _: 1
3726
+ })
3727
+ ], 64)) : j("", !0)
3728
+ ])) : (x(), E("div", Ws, [
3729
+ A(X, {
3730
+ modelValue: a.value,
3731
+ "onUpdate:modelValue": B[0] || (B[0] = (Q) => a.value = Q),
3732
+ label: "Last closing time"
3733
+ }, {
3734
+ "trigger-button": N(() => [
3735
+ A(M, {
3736
+ "prepend-icon": "calendar_today",
3737
+ readonly: "",
3738
+ label: "Last closing time"
3739
+ }, {
3740
+ default: N(() => [
3741
+ K(R(u.value), 1)
3742
+ ]),
3743
+ _: 1
3744
+ })
3745
+ ]),
3746
+ _: 1
3747
+ }, 8, ["modelValue"]),
3748
+ l("div", $s, [
3749
+ A(T, { label: "Stock take file" })
3750
+ ]),
3751
+ A(Oe, {
3752
+ onFileUpload: B[1] || (B[1] = (Q) => {
3753
+ Q && (I.value = Q);
3754
+ }),
3755
+ accept: ".xlsx, .xls, .csv"
3756
+ }, oe({ _: 2 }, [
3757
+ I.value ? {
3758
+ name: "default",
3759
+ fn: N(({ openFileDialog: Q }) => [
3760
+ l("div", eo, [
3761
+ l("div", to, [
3762
+ l("div", no, [
3763
+ l("div", so, R(I.value.name), 1),
3764
+ A(D, {
3765
+ label: V(S)("inventory.ingredient.import.replaceFile"),
3766
+ variant: "secondary",
3767
+ "prepend-icon": "autorenew",
3768
+ onClick: Q
3769
+ }, null, 8, ["label", "onClick"])
3770
+ ])
3771
+ ])
3772
+ ])
3773
+ ]),
3774
+ key: "0"
3775
+ } : void 0
3776
+ ]), 1024),
3777
+ A(de, {
3778
+ modelValue: p.value,
3779
+ "onUpdate:modelValue": B[2] || (B[2] = (Q) => p.value = Q),
3780
+ label: "Retrieve cost from",
3781
+ class: "my-5"
3782
+ }, {
3783
+ default: N(() => [
3784
+ (x(!0), E(P, null, ee(t.value, (Q) => (x(), H(U, {
3785
+ key: Q.value,
3786
+ value: Q.value,
3787
+ label: Q.label,
3788
+ sublabel: Q.subLabel,
3789
+ disabled: Q.disabled
3790
+ }, {
3791
+ label: N(() => [
3792
+ l("div", oo, [
3793
+ l("span", ao, R(Q.label), 1),
3794
+ l("span", lo, R(Q.disabled ? Q.disabledReason : Q.subLabel), 1)
3795
+ ]),
3796
+ Q.value === "netsuite" && V(o).currentLocationSetting ? (x(), E("div", io, [
3797
+ A(z, {
3798
+ name: "cloud",
3799
+ color: "neutral-gray-400",
3800
+ size: "md",
3801
+ class: "mr-2",
3802
+ outline: !0
3803
+ }),
3804
+ l("div", ro, [
3805
+ l("span", uo, R(V(o).currentLocationSetting.name), 1),
3806
+ l("span", co, "ID: " + R(V(o).currentLocationSetting.netSuiteId), 1),
3807
+ l("span", mo, "Subsidiary: " + R(V(o).getSubsidiaryFullName(
3808
+ V(o).currentLocationSetting.subsidiaryId
3809
+ ).fullName), 1)
3810
+ ])
3811
+ ])) : j("", !0)
3812
+ ]),
3813
+ _: 2
3814
+ }, 1032, ["value", "label", "sublabel", "disabled"]))), 128))
3815
+ ]),
3816
+ _: 1
3817
+ }, 8, ["modelValue"]),
3818
+ l("div", fo, [
3819
+ A(D, {
3820
+ class: "ml-auto mt-4",
3821
+ variant: "secondary",
3822
+ "prepend-icon": "troubleshoot",
3823
+ label: "Verify",
3824
+ disabled: !I.value && !e.value,
3825
+ loading: e.value,
3826
+ onClick: n
3827
+ }, null, 8, ["disabled", "loading"])
3828
+ ]),
3829
+ I.value && w.value.length > 0 ? (x(), E(P, { key: 0 }, [
3830
+ B[4] || (B[4] = l("h2", { class: "fm-typo-en-title-md-800 mt-8 mb-4" }, "Results", -1)),
3831
+ A(xe, {
3832
+ modelValue: f.value,
3833
+ "onUpdate:modelValue": B[3] || (B[3] = (Q) => f.value = Q),
3834
+ "row-data": w.value,
3835
+ "column-defs": C,
3836
+ "shrink-at": !1,
3837
+ "search-value": g.value
3838
+ }, null, 8, ["modelValue", "row-data", "search-value"])
3839
+ ], 64)) : j("", !0),
3840
+ y.value.length > 0 ? (x(), E(P, { key: 1 }, [
3841
+ B[5] || (B[5] = l("h2", { class: "fm-typo-en-title-md-800 mt-8 mb-4 text-red-600" }, "Errors", -1)),
3842
+ A(xe, {
3843
+ "row-data": y.value,
3844
+ "column-defs": c
3845
+ }, null, 8, ["row-data"])
3846
+ ], 64)) : j("", !0),
3847
+ l("div", po, [
3848
+ w.value.length > 0 && !V(h).state.closingDocumentId ? (x(), H(D, {
3849
+ key: 0,
3850
+ class: "ml-auto mt-4",
3851
+ "prepend-icon": "file_upload",
3852
+ variant: "primary",
3853
+ label: "Import Opening Balance",
3854
+ disabled: !I.value || e.value,
3855
+ onClick: v
3856
+ }, null, 8, ["disabled"])) : j("", !0)
3857
+ ])
3858
+ ]))
3859
+ ]);
3860
+ };
3861
+ }
3862
+ }), yo = { class: "flex flex-col gap-8 w-full" }, Ao = { class: "flex gap-4 justify-between" }, bo = { class: "inline-flex rounded-md items-center gap-4 justify-center h-[30px] px-8 py-4 bg-fm-color-neutral-gray-100 text-fm-color-neutral-gray-400" }, ho = { class: "fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap" }, xo = { key: 0 }, Io = {
3863
+ key: 1,
3864
+ class: "flex flex-col gap-8 w-full"
3865
+ }, So = { key: 1 }, wo = { class: "flex gap-8 items-center justify-start" }, ko = /* @__PURE__ */ Y({
3866
+ __name: "XilnexSideSheet",
3867
+ props: {
3868
+ show: { type: Boolean },
3869
+ loading: { type: Boolean }
3870
+ },
3871
+ emits: ["update:show"],
3872
+ setup(_, { emit: h }) {
3873
+ var f;
3874
+ const o = le(), s = ue(_, "show"), { t: i } = Z(), r = h, t = se(), p = ((f = t._currentLocation) == null ? void 0 : f.type) || "", S = [
3875
+ { label: fe(
3876
+ "openingBalance"
3877
+ /* OPENING_BALANCE */
3878
+ ) },
3879
+ { label: fe(
3880
+ "transferNote"
3881
+ /* TRANSFER_NOTE */
3882
+ ) }
3883
+ ], I = L(S[0]);
3884
+ return (g, y) => {
3885
+ var n;
3886
+ const w = F("FmIcon"), C = F("FmButtonGroup"), c = F("FmButton"), e = F("FmSideSheet");
3887
+ return x(), H(e, {
3888
+ modelValue: V(s),
3889
+ "onUpdate:modelValue": y[2] || (y[2] = (v) => re(s) ? s.value = v : null),
3890
+ header: "Data migration (Xilnex)",
3891
+ "dismiss-away": "",
3892
+ "close-button": "",
3893
+ "max-width": 800
3894
+ }, oe({
3895
+ default: N(() => {
3896
+ var v;
3897
+ return [
3898
+ (v = V(o).sessionUser.value) != null && v.role.isAdmin ? (x(), E("div", Io, [
3899
+ I.value.label === V(fe)(
3900
+ "openingBalance"
3901
+ /* OPENING_BALANCE */
3902
+ ) ? (x(), H(go, { key: 0 })) : j("", !0),
3903
+ I.value.label === V(fe)(
3904
+ "transferNote"
3905
+ /* TRANSFER_NOTE */
3906
+ ) ? (x(), E("div", So, " Not available yet. ")) : j("", !0)
3907
+ ])) : (x(), E("div", xo, " Please contact your administrator to apply the changes. "))
3908
+ ];
3909
+ }),
3910
+ "side-sheet-footer": N(() => [
3911
+ l("div", wo, [
3912
+ A(c, {
3913
+ variant: "tertiary",
3914
+ label: V(i)("common.close"),
3915
+ onClick: y[1] || (y[1] = (v) => r("update:show", !1))
3916
+ }, null, 8, ["label"])
3917
+ ])
3918
+ ]),
3919
+ _: 2
3920
+ }, [
3921
+ (n = V(o).sessionUser.value) != null && n.role.isAdmin ? {
3922
+ name: "side-sheet-header",
3923
+ fn: N(() => {
3924
+ var v;
3925
+ return [
3926
+ l("div", yo, [
3927
+ l("div", Ao, [
3928
+ y[3] || (y[3] = l("div", { class: "fm-typo-en-title-md-600" }, "Data migration (Xilnex)", -1)),
3929
+ l("div", bo, [
3930
+ A(w, {
3931
+ name: V(p),
3932
+ size: "sm"
3933
+ }, null, 8, ["name"]),
3934
+ l("div", ho, R((v = V(t)._currentLocation) == null ? void 0 : v.name), 1)
3935
+ ])
3936
+ ]),
3937
+ A(C, {
3938
+ modelValue: I.value,
3939
+ "onUpdate:modelValue": y[0] || (y[0] = (m) => I.value = m),
3940
+ items: S
3941
+ }, null, 8, ["modelValue"])
3942
+ ])
3943
+ ];
3944
+ }),
3945
+ key: "0"
3946
+ } : void 0
3947
+ ]), 1032, ["modelValue"]);
3948
+ };
3949
+ }
3950
+ }), Fo = /* @__PURE__ */ Y({
3951
+ __name: "XilnexView",
3952
+ setup(_) {
3953
+ const h = Re(), o = se(), d = L(!1);
3954
+ async function s() {
3955
+ d.value = !0, console.log("Opening Xilnex migration dialog");
3956
+ }
3957
+ return (i, r) => {
3958
+ const t = F("FmCardSection"), p = F("FmCard");
3959
+ return V(h).enabledXilnexOpeningMigration && !V(o).businessLevel ? (x(), E(P, { key: 0 }, [
3960
+ A(p, {
3961
+ class: q({
3962
+ "w-full": !0,
3963
+ border: !0,
3964
+ "border-fm-color-neutral-gray-100": !0,
3965
+ "cursor-pointer": !0,
3966
+ "hover:border-fm-color-primary": !0
3967
+ }),
3968
+ onClick: r[0] || (r[0] = (S) => s())
3969
+ }, {
3970
+ default: N(() => [
3971
+ A(t, null, {
3972
+ default: N(() => r[2] || (r[2] = [
3973
+ l("div", { class: "flex justify-center" }, [
3974
+ l("div", { class: "size-[100px] bg-gray-200 rounded-lg flex items-center justify-center" }, [
3975
+ l("span", { class: "text-lg font-bold text-gray-600" }, "Xilnex")
3976
+ ])
3977
+ ], -1),
3978
+ l("div", { class: "flex flex-col items-center gap-2" }, [
3979
+ l("div", { class: "text-lg font-bold" }, "Xilnex"),
3980
+ l("div", { class: "text-fm-color-neutral-gray-300" }, "Data migration from Xilnex")
3981
+ ], -1)
3982
+ ])),
3983
+ _: 1
3984
+ })
3985
+ ]),
3986
+ _: 1
3987
+ }),
3988
+ (x(), H(pe, { to: "body" }, [
3989
+ A(ko, {
3990
+ show: d.value,
3991
+ "onUpdate:show": r[1] || (r[1] = (S) => d.value = S)
3992
+ }, null, 8, ["show"])
3993
+ ]))
3994
+ ], 64)) : j("", !0);
3995
+ };
3996
+ }
3997
+ }), we = [
3998
+ "bin",
3999
+ "group",
4000
+ "code",
4001
+ "description",
4002
+ "unitcost",
4003
+ "convertUom",
4004
+ "quantity",
4005
+ "total"
4006
+ ];
4007
+ async function Co(_, h, o) {
4008
+ var p;
4009
+ const d = await Bo(o), s = [], i = {}, r = Object.keys(d)[0], t = d[r];
4010
+ for (let S = 0; S < t.length; S++) {
4011
+ const I = t[S], f = I.code, g = I.description, y = I.quantity, w = I.unitcost;
4012
+ if (f === "" || f === "undefined") {
4013
+ s.push({
4014
+ row: I.excelRow,
4015
+ itemCode: f,
4016
+ itemName: g,
4017
+ message: "Item code is empty or undefined"
4018
+ });
4019
+ continue;
4020
+ }
4021
+ const C = h.find((m) => m.code === f);
4022
+ if (!C) {
4023
+ s.push({
4024
+ row: I.excelRow,
4025
+ itemCode: f,
4026
+ itemName: g,
4027
+ qty: y,
4028
+ message: "Item not found in inventory"
4029
+ }), console.error(`${I.excelRow} Item not found: ${f} ${g} ${y}`);
4030
+ continue;
4031
+ }
4032
+ let c = Number(I.total);
4033
+ const e = _[C._id];
4034
+ e && (c = e * Number(y));
4035
+ const n = ne.fromNumber(Number(y)), v = {
4036
+ amount: n,
4037
+ cost: {
4038
+ ...ne.fromNumber(Number(c)),
4039
+ currency: "MYR"
4040
+ }
4041
+ };
4042
+ y != "0" && w == "0" && console.warn(`Item ${f} ${g} has 0 cost.`), i[p = C._id] ?? (i[p] = {
4043
+ skuAdjustment: {
4044
+ sku: C,
4045
+ fromBalance: ne.fromNumber(0),
4046
+ amounts: [
4047
+ {
4048
+ _id: null,
4049
+ type: Be.Enum.CLOSING,
4050
+ remark: "Opening Balance",
4051
+ amount: n,
4052
+ measurement: null,
4053
+ // always the smallest unit
4054
+ cost: v.cost
4055
+ }
4056
+ ],
4057
+ toBalance: n,
4058
+ toCostBalances: [v]
4059
+ },
4060
+ skuBalance: {
4061
+ id: C._id,
4062
+ balance: n,
4063
+ costs: [v]
4064
+ }
4065
+ });
4066
+ }
4067
+ return {
4068
+ errors: s,
4069
+ rows: i
4070
+ };
4071
+ }
4072
+ async function Bo(_) {
4073
+ const h = await new Promise((i, r) => {
4074
+ const t = new FileReader();
4075
+ t.onload = (p) => i(p.target.result), t.onerror = r, t.readAsArrayBuffer(_);
4076
+ }), o = Me(h, { type: "array" }), d = o.SheetNames, s = {};
4077
+ for (const i of d) {
4078
+ const r = await Vo(o.Sheets[i]);
4079
+ s[i] = r;
4080
+ }
4081
+ return s;
4082
+ }
4083
+ async function Vo(_) {
4084
+ const h = ze.sheet_to_json(_, {
4085
+ header: we,
4086
+ range: 1
4087
+ }), o = [];
4088
+ for (let d = 0; d < h.length; d++) {
4089
+ const s = h[d], i = {};
4090
+ for (const r of we)
4091
+ i[r] = String(s[r]).trim();
4092
+ o.push({
4093
+ ...i,
4094
+ excelRow: d + 2
4095
+ // Excel rows start from 1, and we skip the first row
4096
+ });
4097
+ }
4098
+ return o;
4099
+ }
4100
+ const _o = { class: "flex flex-col gap-4" }, Eo = { class: "flex flex-col" }, No = {
4101
+ key: 0,
4102
+ class: "flex flex-col gap-4 my-5"
4103
+ }, Lo = { class: "flex flex-col gap-8" }, Do = { class: "flex flex-col gap-8" }, To = {
4104
+ class: /* @__PURE__ */ q(["fm-corner-radius-md p-16 flex items-center gap-16"])
4105
+ }, Ro = {
4106
+ class: /* @__PURE__ */ q(["fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center gap-3"])
4107
+ }, Oo = { class: "line-clamp-2 text-ellipsis break-all" }, Mo = { class: "flex flex-col" }, zo = { class: "font-medium" }, jo = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, Uo = { class: "flex" }, Ho = { class: "flex" }, Xo = { key: 1 }, Yo = /* @__PURE__ */ Y({
4108
+ __name: "SynergyOpeningImport",
4109
+ setup(_) {
4110
+ const h = ot(), o = ce(), d = Ve(), s = G(), i = O(() => [
4111
+ {
4112
+ value: "synergy",
4113
+ label: "Synergy",
4114
+ subLabel: "Based on Synergy's item cost from excel file"
4115
+ }
4116
+ ]), r = L(i.value[0].value), { t } = ve(), p = L(null), S = L(), I = L(""), f = L([]), g = L([]), y = [
4117
+ {
4118
+ id: "ingredient",
4119
+ header: () => "Ingredient",
4120
+ cell(a) {
4121
+ const u = a.row.original;
4122
+ return k("div", { class: "flex flex-col" }, [
4123
+ k("span", { class: "font-medium" }, u.skuAdjustment.sku.name),
4124
+ k("span", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, [
4125
+ u.skuAdjustment.sku.code
4126
+ ])
4127
+ ]);
4128
+ }
4129
+ },
4130
+ {
4131
+ id: "openingBalance",
4132
+ header: () => "Opening Balance",
4133
+ cell(a) {
4134
+ const u = a.row.original;
4135
+ return k("div", { class: "flex flex-col" }, [
4136
+ k(
4137
+ "span",
4138
+ { class: "font-medium" },
4139
+ ne.toFormatString({
4140
+ value: u.skuAdjustment.amounts[0].amount
4141
+ })
4142
+ )
4143
+ ]);
4144
+ }
4145
+ },
4146
+ {
4147
+ id: "unit",
4148
+ header: () => "Unit",
4149
+ cell(a) {
4150
+ const u = a.row.original, b = !u.skuAdjustment.amounts[0].measurement;
4151
+ let B = u.skuAdjustment.sku.unit.name;
4152
+ if (!b) {
4153
+ const T = u.skuAdjustment.sku.unit.measurements.find(
4154
+ (M) => M.id === u.skuAdjustment.amounts[0].measurement.id
4155
+ );
4156
+ B = T ? T.name : "Error: Measurement not found";
4157
+ }
4158
+ return k("div", { class: "flex flex-col" }, [
4159
+ k("span", { class: "font-medium" }, B),
4160
+ b ? null : k("span", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, [
4161
+ `Base unit: ${u.skuAdjustment.sku.unit.name}`
4162
+ ])
4163
+ ]);
4164
+ }
4165
+ },
4166
+ {
4167
+ id: "totalCost",
4168
+ header: () => "Total Cost",
4169
+ cell(a) {
4170
+ const u = a.row.original, { currency: b, ...B } = u.skuAdjustment.amounts[0].cost ?? {
4171
+ amount: 0,
4172
+ precision: 0,
4173
+ currency: ""
4174
+ };
4175
+ return k("div", { class: "flex flex-col" }, [
4176
+ k(
4177
+ "span",
4178
+ { class: "font-medium" },
4179
+ ne.toFormatString({
4180
+ value: B
4181
+ })
4182
+ )
4183
+ ]);
4184
+ }
4185
+ }
4186
+ ], w = [
4187
+ {
4188
+ accessorKey: "row",
4189
+ header: "Row"
4190
+ },
4191
+ {
4192
+ accessorKey: "itemCode",
4193
+ header: "Item Code"
4194
+ },
4195
+ {
4196
+ accessorKey: "itemName",
4197
+ header: "Item Name"
4198
+ },
4199
+ {
4200
+ accessorKey: "qty",
4201
+ header: "Quantity"
4202
+ },
4203
+ {
4204
+ accessorKey: "message",
4205
+ header: "Error Message"
4206
+ }
4207
+ ], C = L(!1);
4208
+ async function c() {
4209
+ if (p.value) {
4210
+ C.value = !0;
4211
+ try {
4212
+ let a = {};
4213
+ const { errors: u, rows: b } = await Co(
4214
+ a,
4215
+ o.skus,
4216
+ p.value
4217
+ );
4218
+ f.value = u, g.value = Object.values(b);
4219
+ } catch {
4220
+ s.open({
4221
+ message: "Error verifying file",
4222
+ type: "error"
4223
+ });
4224
+ } finally {
4225
+ C.value = !1;
4226
+ }
4227
+ }
4228
+ }
4229
+ async function e() {
4230
+ if (p.value) {
4231
+ C.value = !0;
4232
+ try {
4233
+ if (!v.value) {
4234
+ s.open({
4235
+ message: "Please select a date for the opening balance",
4236
+ type: "error"
4237
+ });
4238
+ return;
4239
+ }
4240
+ await d.setOpeningBalance({
4241
+ effectiveAt: v.value,
4242
+ skuAdjustments: g.value.map((a) => a.skuAdjustment),
4243
+ skuBalances: g.value.map((a) => a.skuBalance)
4244
+ }), s.open({
4245
+ message: "Opening balance imported successfully",
4246
+ type: "success"
4247
+ }), await h.fetchClosingDocumentId();
4248
+ } catch {
4249
+ s.open({
4250
+ message: "Error importing opening balance",
4251
+ type: "error"
4252
+ });
4253
+ } finally {
4254
+ C.value = !1;
4255
+ }
4256
+ }
4257
+ }
4258
+ const n = L(""), v = O({
4259
+ get() {
4260
+ return n.value;
4261
+ },
4262
+ set(a) {
4263
+ n.value = `${a}T15:59:59.999Z`;
4264
+ }
4265
+ }), m = O(() => {
4266
+ if (!n.value) return null;
4267
+ const a = new Date(n.value);
4268
+ return isNaN(a.getTime()) ? null : he(a);
4269
+ });
4270
+ return (a, u) => {
4271
+ const b = F("FmLabel"), B = F("FmField"), T = F("FmSimpleDatePicker"), M = F("FmButton"), X = F("FmRadio"), D = F("FmRadioGroup"), z = F("FmTable");
4272
+ return x(), E("div", _o, [
4273
+ l("div", Eo, [
4274
+ A(b, { label: "Latest closing" })
4275
+ ]),
4276
+ A(B, {
4277
+ "prepend-icon": "lock_outline",
4278
+ disabled: ""
4279
+ }, {
4280
+ default: N(() => [
4281
+ K(R(V(h).state.closingDocumentId ? `${V(De)(new Date(V(Ae)(V(h).state.closingDocumentId)))}` : "No closing found"), 1)
4282
+ ]),
4283
+ _: 1
4284
+ }),
4285
+ V(h).state.closingDocumentId ? (x(), E("div", Xo, u[6] || (u[6] = [
4286
+ l("span", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, " Not able to import opening balance as closing document already exists. ", -1)
4287
+ ]))) : (x(), E("div", No, [
4288
+ A(T, {
4289
+ modelValue: v.value,
4290
+ "onUpdate:modelValue": u[0] || (u[0] = (U) => v.value = U),
4291
+ label: "Last closing time"
4292
+ }, {
4293
+ "trigger-button": N(() => [
4294
+ A(B, {
4295
+ "prepend-icon": "calendar_today",
4296
+ readonly: "",
4297
+ label: "Last closing time"
4298
+ }, {
4299
+ default: N(() => [
4300
+ K(R(m.value), 1)
4301
+ ]),
4302
+ _: 1
4303
+ })
4304
+ ]),
4305
+ _: 1
4306
+ }, 8, ["modelValue"]),
4307
+ l("div", Lo, [
4308
+ A(b, { label: "Stock take file" })
4309
+ ]),
4310
+ A(Oe, {
4311
+ onFileUpload: u[1] || (u[1] = (U) => {
4312
+ U && (p.value = U);
4313
+ }),
4314
+ accept: ".xlsx, .xls, .csv"
4315
+ }, oe({ _: 2 }, [
4316
+ p.value ? {
4317
+ name: "default",
4318
+ fn: N(({ openFileDialog: U }) => [
4319
+ l("div", Do, [
4320
+ l("div", To, [
4321
+ l("div", Ro, [
4322
+ l("div", Oo, R(p.value.name), 1),
4323
+ A(M, {
4324
+ label: V(t)("inventory.ingredient.import.replaceFile"),
4325
+ variant: "secondary",
4326
+ "prepend-icon": "autorenew",
4327
+ onClick: U
4328
+ }, null, 8, ["label", "onClick"])
4329
+ ])
4330
+ ])
4331
+ ])
4332
+ ]),
4333
+ key: "0"
4334
+ } : void 0
4335
+ ]), 1024),
4336
+ A(D, {
4337
+ modelValue: r.value,
4338
+ "onUpdate:modelValue": u[2] || (u[2] = (U) => r.value = U),
4339
+ label: "Retrieve cost from",
4340
+ class: "my-5"
4341
+ }, {
4342
+ default: N(() => [
4343
+ (x(!0), E(P, null, ee(i.value, (U) => (x(), H(X, {
4344
+ key: U.value,
4345
+ value: U.value,
4346
+ label: U.label,
4347
+ sublabel: U.subLabel,
4348
+ disabled: U.disabled
4349
+ }, {
4350
+ label: N(() => [
4351
+ l("div", Mo, [
4352
+ l("span", zo, R(U.label), 1),
4353
+ l("span", jo, R(U.disabled ? U.disabledReason : U.subLabel), 1)
4354
+ ])
4355
+ ]),
4356
+ _: 2
4357
+ }, 1032, ["value", "label", "sublabel", "disabled"]))), 128))
4358
+ ]),
4359
+ _: 1
4360
+ }, 8, ["modelValue"]),
4361
+ l("div", Uo, [
4362
+ A(M, {
4363
+ class: "ml-auto mt-4",
4364
+ variant: "secondary",
4365
+ "prepend-icon": "troubleshoot",
4366
+ label: "Verify",
4367
+ disabled: !p.value && !C.value,
4368
+ loading: C.value,
4369
+ onClick: c
4370
+ }, null, 8, ["disabled", "loading"])
4371
+ ]),
4372
+ p.value && g.value.length > 0 ? (x(), E(P, { key: 0 }, [
4373
+ u[4] || (u[4] = l("h2", { class: "fm-typo-en-title-md-800 mt-8 mb-4" }, "Results", -1)),
4374
+ A(z, {
4375
+ modelValue: S.value,
4376
+ "onUpdate:modelValue": u[3] || (u[3] = (U) => S.value = U),
4377
+ "row-data": g.value,
4378
+ "column-defs": y,
4379
+ "shrink-at": !1,
4380
+ "search-value": I.value
4381
+ }, null, 8, ["modelValue", "row-data", "search-value"])
4382
+ ], 64)) : j("", !0),
4383
+ f.value.length > 0 ? (x(), E(P, { key: 1 }, [
4384
+ u[5] || (u[5] = l("h2", { class: "fm-typo-en-title-md-800 mt-8 mb-4 text-red-600" }, "Errors", -1)),
4385
+ A(z, {
4386
+ "row-data": f.value,
4387
+ "column-defs": w
4388
+ }, null, 8, ["row-data"])
4389
+ ], 64)) : j("", !0),
4390
+ l("div", Ho, [
4391
+ g.value.length > 0 && !V(h).state.closingDocumentId ? (x(), H(M, {
4392
+ key: 0,
4393
+ class: "ml-auto mt-4",
4394
+ "prepend-icon": "file_upload",
4395
+ variant: "primary",
4396
+ label: "Import Opening Balance",
4397
+ disabled: !p.value || C.value,
4398
+ onClick: e
4399
+ }, null, 8, ["disabled"])) : j("", !0)
4400
+ ])
4401
+ ]))
4402
+ ]);
4403
+ };
4404
+ }
4405
+ }), Po = { class: "flex flex-col gap-8 w-full" }, Qo = { class: "flex gap-4 justify-between" }, Jo = { class: "inline-flex rounded-md items-center gap-4 justify-center h-[30px] px-8 py-4 bg-fm-color-neutral-gray-100 text-fm-color-neutral-gray-400" }, Ko = { class: "fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap" }, qo = { key: 0 }, Go = {
4406
+ key: 1,
4407
+ class: "flex flex-col gap-8 w-full"
4408
+ }, Zo = { class: "flex gap-8 items-center justify-start" }, Wo = /* @__PURE__ */ Y({
4409
+ __name: "SynergySideSheet",
4410
+ props: {
4411
+ show: { type: Boolean },
4412
+ loading: { type: Boolean }
4413
+ },
4414
+ emits: ["update:show"],
4415
+ setup(_, { emit: h }) {
4416
+ var S;
4417
+ const o = le(), s = ue(_, "show"), { t: i } = Z(), r = h, t = se(), p = ((S = t._currentLocation) == null ? void 0 : S.type) || "";
4418
+ return (I, f) => {
4419
+ var C;
4420
+ const g = F("FmIcon"), y = F("FmButton"), w = F("FmSideSheet");
4421
+ return x(), H(w, {
4422
+ modelValue: V(s),
4423
+ "onUpdate:modelValue": f[1] || (f[1] = (c) => re(s) ? s.value = c : null),
4424
+ header: "Data migration (Synergy)",
4425
+ "dismiss-away": "",
4426
+ "close-button": "",
4427
+ "max-width": 800
4428
+ }, oe({
4429
+ default: N(() => {
4430
+ var c;
4431
+ return [
4432
+ (c = V(o).sessionUser.value) != null && c.role.isAdmin ? (x(), E("div", Go, [
4433
+ A(Yo)
4434
+ ])) : (x(), E("div", qo, " Please contact your administrator to apply the changes. "))
4435
+ ];
4436
+ }),
4437
+ "side-sheet-footer": N(() => [
4438
+ l("div", Zo, [
4439
+ A(y, {
4440
+ variant: "tertiary",
4441
+ label: V(i)("common.close"),
4442
+ onClick: f[0] || (f[0] = (c) => r("update:show", !1))
4443
+ }, null, 8, ["label"])
4444
+ ])
4445
+ ]),
4446
+ _: 2
4447
+ }, [
4448
+ (C = V(o).sessionUser.value) != null && C.role.isAdmin ? {
4449
+ name: "side-sheet-header",
4450
+ fn: N(() => {
4451
+ var c;
4452
+ return [
4453
+ l("div", Po, [
4454
+ l("div", Qo, [
4455
+ f[2] || (f[2] = l("div", { class: "fm-typo-en-title-md-600" }, "Data migration (Synergy)", -1)),
4456
+ l("div", Jo, [
4457
+ A(g, {
4458
+ name: V(p),
4459
+ size: "sm"
4460
+ }, null, 8, ["name"]),
4461
+ l("div", Ko, R((c = V(t)._currentLocation) == null ? void 0 : c.name), 1)
4462
+ ])
4463
+ ])
4464
+ ])
4465
+ ];
4466
+ }),
4467
+ key: "0"
4468
+ } : void 0
4469
+ ]), 1032, ["modelValue"]);
4470
+ };
4471
+ }
4472
+ }), $o = /* @__PURE__ */ Y({
4473
+ __name: "SynergyView",
4474
+ setup(_) {
4475
+ const h = Re(), o = se(), d = L(!1);
4476
+ async function s() {
4477
+ d.value = !0, console.log("Opening Synergy migration dialog");
4478
+ }
4479
+ return (i, r) => {
4480
+ const t = F("FmCardSection"), p = F("FmCard");
4481
+ return V(h).enabledSynergyOpeningMigration && !V(o).businessLevel ? (x(), E(P, { key: 0 }, [
4482
+ A(p, {
4483
+ class: q({
4484
+ "w-full": !0,
4485
+ border: !0,
4486
+ "border-fm-color-neutral-gray-100": !0,
4487
+ "cursor-pointer": !0,
4488
+ "hover:border-fm-color-primary": !0
4489
+ }),
4490
+ onClick: r[0] || (r[0] = (S) => s())
4491
+ }, {
4492
+ default: N(() => [
4493
+ A(t, null, {
4494
+ default: N(() => r[2] || (r[2] = [
4495
+ l("div", { class: "flex justify-center" }, [
4496
+ l("div", { class: "size-[100px] bg-gray-200 rounded-lg flex items-center justify-center" }, [
4497
+ l("span", { class: "text-lg font-bold text-gray-600" }, "Synergy")
4498
+ ])
4499
+ ], -1),
4500
+ l("div", { class: "flex flex-col items-center gap-2" }, [
4501
+ l("div", { class: "text-lg font-bold" }, "Synergy"),
4502
+ l("div", { class: "text-fm-color-neutral-gray-300" }, "Data migration from Synergy")
4503
+ ], -1)
4504
+ ])),
4505
+ _: 1
4506
+ })
4507
+ ]),
4508
+ _: 1
4509
+ }),
4510
+ (x(), H(pe, { to: "body" }, [
4511
+ A(Wo, {
4512
+ show: d.value,
4513
+ "onUpdate:show": r[1] || (r[1] = (S) => d.value = S)
4514
+ }, null, 8, ["show"])
4515
+ ]))
4516
+ ], 64)) : j("", !0);
4517
+ };
4518
+ }
4519
+ }), ea = { key: 0 }, ta = {
4520
+ key: 1,
4521
+ class: "flex flex-col items-center my-10 gap-5"
4522
+ }, na = ["src"], sa = {
4523
+ class: "text-xs text-neutral-400 text-center",
4524
+ style: { "max-width": "25rem" }
4525
+ }, oa = {
4526
+ key: 2,
4527
+ class: "grid grid-cols-2 gap-5"
4528
+ }, Fa = /* @__PURE__ */ Y({
4529
+ __name: "IntegrationView",
4530
+ setup(_) {
4531
+ const h = se(), o = L(!1), d = at(), { breakpoints: s } = _e(), i = O(() => s.value.xs || s.value.sm), { t: r } = Z();
4532
+ return ie(async () => {
4533
+ if (h._currentLocation) {
4534
+ o.value = !0;
4535
+ try {
4536
+ await d.fetchFoodMarketHubSetting(), await d.fetchNetSuiteSetting();
4537
+ } finally {
4538
+ o.value = !1;
4539
+ }
4540
+ }
4541
+ }), (t, p) => {
4542
+ const S = F("FmCircularProgress");
4543
+ return x(), H(et, {
4544
+ title: V(r)("inventory.integration.title")
4545
+ }, {
4546
+ default: N(() => [
4547
+ l("div", {
4548
+ class: q([
4549
+ "flex flex-col gap-8 max-h-full",
4550
+ {
4551
+ "p-0": i.value,
4552
+ "px-24 ": !i.value
4553
+ }
4554
+ ])
4555
+ }, [
4556
+ A(tt, {
4557
+ "change-location": "",
4558
+ showBusiness: ""
4559
+ }),
4560
+ !V(h)._currentLocation || o.value ? (x(), E("div", ea, [
4561
+ A(S, { size: "lg" })
4562
+ ])) : V(d).enabledIntegrations == 0 ? (x(), E("div", ta, [
4563
+ l("div", null, [
4564
+ l("img", {
4565
+ src: V(qe),
4566
+ alt: "List is empty"
4567
+ }, null, 8, na)
4568
+ ]),
4569
+ p[0] || (p[0] = l("div", { class: "font-bold text-lg" }, "Integration", -1)),
4570
+ l("div", sa, R(V(r)("inventory.integration.description")), 1)
4571
+ ])) : (x(), E("div", oa, [
4572
+ A(Qs),
4573
+ A(an),
4574
+ A(Fo),
4575
+ A($o)
4576
+ ]))
4577
+ ], 2)
4578
+ ]),
4579
+ _: 1
4580
+ }, 8, ["title"]);
4581
+ };
4582
+ }
4583
+ });
4584
+ export {
4585
+ Fa as default
4586
+ };