@feedmepos/mf-inventory-portal 1.2.37-dev.1 → 1.2.37-dev.3

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