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

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-BNC_VGLY.js} +3 -3
  2. package/dist/{ApprovalView-C1LYZkbH.js → ApprovalView-C3-qwfBy.js} +5 -5
  3. package/dist/{BindingsDialog-D4zUelDu.js → BindingsDialog-DJYcwvLj.js} +2 -2
  4. package/dist/{BindingsPicker-DV1XU3sF.js → BindingsPicker-BfjaThga.js} +2 -2
  5. package/dist/{BindingsTable-DfQHmg73.js → BindingsTable-CxsJ7J29.js} +3 -3
  6. package/dist/{ClosingDraftView-DBu5Z4sF.js → ClosingDraftView-lWH-HNt8.js} +8 -8
  7. package/dist/ClosingHistoryView-tDq0ShBo.js +391 -0
  8. package/dist/{ClosingTemplateView-iTaF92io.js → ClosingTemplateView-VDIoPSGE.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-C1U0WfYR.js → DeliveryOrderPrintPreview-BB57thjw.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-BFJquom_.js} +5 -5
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BzCuh3H7.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D6nFHej1.js} +2 -2
  12. package/dist/{FmMultiselectDialog-6SDLa-Z9.js → FmMultiselectDialog-ByhflquX.js} +2 -2
  13. package/dist/{FmMultiselectDialog-D8qV-hIU.js → FmMultiselectDialog-pbQjC6ox.js} +1 -1
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-7Kgt9eQq.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BVkl9ATd.js} +3 -3
  15. package/dist/{ImportView-CWJMxSX9.js → ImportView-BESMNYR1.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BdFvHGhO.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-6nCLOWwx.js} +1 -1
  17. package/dist/{IngredientGroupView-DMlmPiIK.js → IngredientGroupView-JdgXfEsA.js} +5 -5
  18. package/dist/{IngredientsView-DH76XhKg.js → IngredientsView-Btcmhy3H.js} +14 -14
  19. package/dist/IntegrationView-CxHNZ7E3.js +4488 -0
  20. package/dist/{InventoryBindingForm-DDemfucz.js → InventoryBindingForm-CpLif5mq.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Bw8rk2WN.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-B2AQxOn1.js} +4 -4
  22. package/dist/{InventoryBindingSummary-DtmhsP7w.js → InventoryBindingSummary-DGBAel1C.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CHhLYVJc.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-oQlPxFAX.js} +1 -1
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BrjIsILE.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DuWFQ6Q0.js} +2 -2
  25. package/dist/{PublishView-O8bEpfge.js → PublishView-C-UiGWym.js} +3 -3
  26. package/dist/{PurchaseOrderPrintPreview-7uwMWjKM.js → PurchaseOrderPrintPreview-mO_oxnft.js} +1 -1
  27. package/dist/{ReceiveRequestView-DL6Ft9Dv.js → ReceiveRequestView-Cr6Xrv4Q.js} +19 -19
  28. package/dist/{RecipeView-BGDhOL4y.js → RecipeView-Bk9O5UiN.js} +8 -8
  29. package/dist/{StockView-BdNL7YNV.js → StockView-C2op154q.js} +15 -15
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-OZQshfHV.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CntpgdYL.js} +1 -1
  31. package/dist/{SupplierView-C4uH2a2V.js → SupplierView-2qjnAlnU.js} +11 -11
  32. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-6jvM7q55.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DqdgsUES.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-CbSWd397.js} +1 -1
  34. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-COmk372G.js → TransferDetails.vue_vue_type_script_setup_true_lang-U5KJ5_b2.js} +14 -14
  35. package/dist/{TransferTemplateView-CW443auS.js → TransferTemplateView-Dw4Ukcce.js} +15 -15
  36. package/dist/{UnitView-D55gcEz3.js → UnitView-H4Sgdzg5.js} +6 -6
  37. package/dist/{WarehouseView-D0XPLYF_.js → WarehouseView-DzR1A-Cr.js} +5 -5
  38. package/dist/{WastageTemplateView-Bjxe8lP5.js → WastageTemplateView-Sb2KtrF3.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-Cnok7m8q.js} +11 -7
  42. package/dist/app.js +1 -1
  43. package/dist/{closing-template-DBpMfcLc.js → closing-template-u2ACSj7R.js} +1 -1
  44. package/dist/{date2-ryyCvQfl.js → date2-DtnfdJTF.js} +1 -1
  45. package/dist/{dayjs.min-ZUp_XvV7.js → dayjs.min-DcraCntx.js} +1 -1
  46. package/dist/{decimal-BJzO4UcJ.js → decimal-CIJMix9a.js} +2 -2
  47. package/dist/{defineDeepModel-xjt5D_Xm.js → defineDeepModel-LcFLGZe5.js} +1 -1
  48. package/dist/{duplicate-template-DEf57E6E.js → duplicate-template-Btr1_Yzf.js} +1 -1
  49. package/dist/{feature-B3Lwp9eP.js → feature-DSy7PE3I.js} +2 -2
  50. package/dist/{format-time-from-id-DiJOY9Yx.js → format-time-from-id-Dh_SXggJ.js} +1 -1
  51. package/dist/{format-unit-display-DU9lxbEz.js → format-unit-display-BZ9AAp4V.js} +10 -10
  52. package/dist/{import-export.helper-Dva61rf6.js → import-export.helper-C3aWPNyJ.js} +5 -5
  53. package/dist/{index-CFubRGrG.js → index-BTM5svgh.js} +1 -1
  54. package/dist/{index-CaCMjerv.js → index-DbWKRddg.js} +3 -3
  55. package/dist/{index-CUTZhcVh.js → index-eN7NxI-_.js} +1 -1
  56. package/dist/{lodash-llvwR05O.js → lodash-DUlA5LSE.js} +1 -1
  57. package/dist/{netsuite-C78BfNM5.js → netsuite-ekrD_FS6.js} +947 -921
  58. package/dist/{purchase-order-template-LWFeGIIb.js → purchase-order-template-C4S6XRoE.js} +1 -1
  59. package/dist/{rules-LeeMnkxz.js → rules-Buw1aczb.js} +3 -3
  60. package/dist/{stock-B2Pm8UCL.js → stock-CLvc2DUC.js} +3 -3
  61. package/dist/{stock-A8xFNXcU.js → stock-DqZP0ldB.js} +1 -1
  62. package/dist/stores/integration/netsuite.d.ts +13 -0
  63. package/dist/{supplier-BeAA-Fya.js → supplier-BA4riI7a.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-BFI0Mdnw.js} +2 -2
  66. package/dist/{use-inventory-binding-dialog-DWbUUSbg.js → use-inventory-binding-dialog-BIqgx607.js} +2 -2
  67. package/dist/{use-template-enabled-locations-2-IaeBxdZP.js → use-template-enabled-locations-2-CyBo9a3I.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-C62Txccp.js} +230 -230
  71. package/dist/{xlsx-BSjnIEh7.js → xlsx-Cmu71X0Z.js} +1 -1
  72. package/dist/{xlsx.util-1XyVyRFC.js → xlsx.util-DI9MSTQE.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,4488 @@
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 Be, 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 Ce, C as Ve, t as me } from "./app-Cnok7m8q.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-D6nFHej1.js";
8
+ import { u as nt, a as ot, b as st, c as at } from "./index-DbWKRddg.js";
9
+ import { u as oe, a as pe } from "./netsuite-ekrD_FS6.js";
10
+ import { b as lt, a as it } from "./FmMultiselectDialog-ByhflquX.js";
11
+ import { R as rt, a as ut } from "./rules-Buw1aczb.js";
12
+ import { N as Ne, H as Le, b as De } from "./app-uBuHtW8m.js";
13
+ import { u as dt } from "./supplier-BA4riI7a.js";
14
+ import { u as ve } from "./vue-i18n-C62Txccp.js";
15
+ import { _ as ct, a as mt } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-BVkl9ATd.js";
16
+ import { a as he, f as Te } from "./date2-DtnfdJTF.js";
17
+ import { u as Re } from "./feature-DSy7PE3I.js";
18
+ import { F as Me } from "./FmDroppableField-J0xUsOTV.js";
19
+ import { r as Oe, u as ze } from "./xlsx-Cmu71X0Z.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 B = 0; B < f; B++)
36
+ S = t[B], x[B] === 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 [C, ...D] = u;
134
+ if (typeof C != "number")
135
+ return !1;
136
+ const M = b[C];
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, C = 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], C + 1, D || u.disabled)
146
+ );
147
+ return [
148
+ {
149
+ ...X,
150
+ keys: b,
151
+ indent: C,
152
+ collapsible: !0,
153
+ disabled: D || u.disabled
154
+ },
155
+ ...T
156
+ ];
157
+ }
158
+ return [
159
+ {
160
+ ...u,
161
+ keys: b,
162
+ indent: C,
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((C) => n(C.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 [C, ...D] = u;
183
+ if (typeof C != "number")
184
+ return !1;
185
+ const M = b[C];
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 [C, ...D] = u;
200
+ if (typeof C != "number")
201
+ return !1;
202
+ const M = b[C];
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 C = s(u) ? u.children : u.children.filter(i);
211
+ return {
212
+ ...u,
213
+ children: u.children.map((D) => C.find((X) => Ze(X.value, D.value)) ? S(D, b) : D)
214
+ };
215
+ }
216
+ return {
217
+ ...u,
218
+ children: u.children.map((C) => S(C, b))
219
+ };
220
+ }
221
+ return {
222
+ ...u,
223
+ active: b
224
+ };
225
+ }
226
+ function B(u, b, C) {
227
+ const [D, ...M] = u;
228
+ return typeof D != "number" ? b : M.length === 0 ? b.map((X, T) => D !== T ? X : S(X, C)) : b.map(
229
+ (X, T) => D === T && G(X) ? {
230
+ ...X,
231
+ children: B(M, X.children, C)
232
+ } : X
233
+ );
234
+ }
235
+ const c = L(new Array());
236
+ function e(u) {
237
+ const b = u.join();
238
+ return c.value.find((C) => b === C);
239
+ }
240
+ function v(u) {
241
+ const b = u.join();
242
+ e(u) ? c.value = c.value.filter((C) => C !== b) : c.value = [...c.value, b];
243
+ }
244
+ function w(u) {
245
+ const b = u.join();
246
+ return c.value.find((C) => b.startsWith(C) && b !== C);
247
+ }
248
+ const p = O(
249
+ () => A.value.filter((u) => n(u.keys, h.value) && u.active).length
250
+ );
251
+ function l(u, b, C) {
252
+ h.value = B(u, b, C), o.emitData(h.value);
253
+ }
254
+ return (u, b) => {
255
+ const C = 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(C, {
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" }, Bt = {
344
+ key: 0,
345
+ class: "table-auto w-full"
346
+ }, Ct = { 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((B) => B._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) ?? "-", B = (x == null ? void 0 : x.groupName) ?? "";
381
+ return {
382
+ ...g,
383
+ name: S,
384
+ groupName: B
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((B) => B._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((B, 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
+ ...B,
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 B = [];
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 = B.find(({ selection: b }) => v.value === b);
448
+ !G(v) && v.active && l === void 0 && B.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", B);
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] = (B) => A())
470
+ }, null, 8, ["label"])
471
+ ]),
472
+ r("div", null, [
473
+ s.value.length > 0 ? (I(), E("table", Bt, [
474
+ r("tr", Ct, [
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, (B, 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(B.name), 1),
485
+ B.groupName ? (I(), E("div", Nt, R(B.groupName), 1)) : j("", !0)
486
+ ])
487
+ ]),
488
+ r("td", null, [
489
+ y(S, {
490
+ disabled: _.loading,
491
+ "model-value": B.code,
492
+ "onUpdate:modelValue": [(e) => B.code = e, (e) => f(B, 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(B)
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, B = x.name || f[x.combinationKey || ""];
533
+ return {
534
+ ...x,
535
+ codeName: [S, B].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((C) => C._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 C = (((b = w == null ? void 0 : w.variant) == null ? void 0 : b.variantCombinations) || []).find(
631
+ (D) => D.combinationKey === v.combinationKey
632
+ );
633
+ u = (C == null ? void 0 : C.name) ?? (C == null ? void 0 : C.codeName) ?? "", l = (C == null ? void 0 : C.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: C, combinationKey: D } = b.value;
721
+ return D ? {
722
+ productId: C,
723
+ combinationKey: D,
724
+ code: ((M = v.find(
725
+ ({ productId: T, combinationKey: z }) => C === T && D === z
726
+ )) == null ? void 0 : M.code) ?? ""
727
+ } : {
728
+ productId: C,
729
+ code: ((X = v.find(({ productId: T, combinationKey: z }) => C === 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: C }) => l === b && !C)) == 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 B() {
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) => B())
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(C) {
814
+ return !!C || "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
+ Be([() => 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"), B = k("FmSideSheet");
867
+ return I(), H(B, {
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
+ Be([() => 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: B } = 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(B)("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(B)("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(), B = O(() => S.value.xs || S.value.sm), c = O(() => B.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/4WQuygS6f2tKVNNf5ubm5f4fOrxqIudzFTeoXDe5Nc0UbCnDlfPYCq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iAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARIAJEgAgQASJABIgAESACRIAIEAEiQASIABEgAkSACBABIkAEiAARyCTAMi/onAgQgWwCra2th6mqulBTlEWKYjRyVZ2nKspcnHPO1bjCjW0IsVvhbKvO2OvDw8NbBwcH38iOha6IABEgAqUnULUGvb390DlcmXEbMrCQK8wwUWncPEv9DegKvycS6bk/5eLRSbC99VKmqKcgujEzSpv0GVd4zFD0qyOR/hdMOae/HStWLGW1tfcoijUjukMQmBoXB5TJOrjNE8AZV3Ujfnk0OvD3LGFctLW1BX2qcgtTmB+Xltis0t5f5+pvkwEFDwRjXwyHwy+61SAYDAY0wzhS0dT3KIwfh3wuRxww5ooM6L1AspVz5WXG2J+4zp8Z1fWe/v7+/UXocaimql9HuIMY56nnG9cBQH+4OxL5lts43cqvWLGipq6u5ivg0AEV4iK8eL7xzPjwT7/Oey+ORtPPvlP8TU1NtbNmNIh42g2FJeIRsoxxHzdYH3h9NhqNpt4hazzt7cGPI9mz4T5m835Zxct2DZ1qUKG7vzva+/18iXaEgncj78sYT+c9n7xXfniPxX0a3LV7z2e2bds25FW8FE/lEvBVrmr5NTOMmTWqppwEqQW2RXpGcJUrHe3tK18Ihwf6MpwnfArjciRTlbcVighGAf+pdxSSS/hrWgNKOuQLxUXWUSiXWcKOF9ZY7Ay60NbHVFuDgQdmLozVaY4JlNgjV3+rS1IBZhjfcKmK1hEM/pui8ovA/1iGGwaT4zIK5SCEOQhhgwh4GtOYUqv6utqDbU/AkN0Ho9UjGyGa/zMheyo0EM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E5Sn1zppusn+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"), B = k("FmFormGroup");
1138
+ return I(), H(B, {
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, B = 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
+ B,
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, B = n.value[S.dbName], c = Object.entries(n.value).some(
1327
+ ([e, v]) => e !== S.dbName && v.netsuiteId === (B == null ? void 0 : B.netsuiteId)
1328
+ );
1329
+ return F(hn, {
1330
+ isDuplicate: c,
1331
+ nsLocationOptions: m.value,
1332
+ modelValue: B,
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 B = 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(B, {
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
+ )), B = () => {
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: B
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" }, Bn = {
1565
+ key: 0,
1566
+ class: "text-xs text-red-500 mt-2"
1567
+ }, Cn = {
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", Bn, " NetSuite vendor being used by another FeedMe supplier. ")) : j("", !0),
1610
+ d.value.netsuiteId ? (I(), E("div", Cn, [
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, B = 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
+ B,
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, B = n.value[S._id], c = Object.entries(n.value).some(
1682
+ ([e, v]) => e !== S._id && v.netsuiteId === (B == null ? void 0 : B.netsuiteId)
1683
+ );
1684
+ return F(Ln, {
1685
+ isDuplicate: c,
1686
+ nsVendorOptions: m.value,
1687
+ modelValue: B,
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(() => {
1704
+ const x = s.nsVendorsNotBeingUsed.filter((S) => !S.name);
1705
+ return x.length > 0 && console.log("Vendors without name:", x), s.nsVendorsNotBeingUsed.filter((S) => S.name).map((S) => ({
1706
+ label: S.name,
1707
+ value: S
1708
+ }));
1709
+ }), a = O(() => Object.values(n.value).length === 0 || Object.values(n.value).some(
1710
+ (x) => Object.values(n.value).filter((S) => S.netsuiteId === x.netsuiteId).length > 1
1711
+ ));
1712
+ async function g() {
1713
+ try {
1714
+ i("update:loading", !0), await o.updateSupplierConfigs(n.value), d.open({
1715
+ message: "Vendors updated successfully",
1716
+ type: "success"
1717
+ }), i("update:showDialog", !1), n.value = {};
1718
+ } catch {
1719
+ d.open({
1720
+ message: "Failed to update vendors. Please try again.",
1721
+ type: "error"
1722
+ });
1723
+ } finally {
1724
+ i("update:loading", !1);
1725
+ }
1726
+ }
1727
+ return (x, S) => {
1728
+ const B = k("FmSpinner"), c = k("FmTable"), e = k("FmForm"), v = k("FmSpacer"), w = k("FmButton"), p = k("FmDialog");
1729
+ return I(), H(p, {
1730
+ modelValue: _.showDialog,
1731
+ "onUpdate:modelValue": S[2] || (S[2] = (l) => x.$emit("update:showDialog", l)),
1732
+ overlay: !0,
1733
+ "max-width": "900px"
1734
+ }, {
1735
+ "dialog-header": N(() => S[3] || (S[3] = [
1736
+ r("div", null, "Add vendors", -1)
1737
+ ])),
1738
+ "dialog-footer": N(() => [
1739
+ y(v, { class: "sm:hidden xs:hidden" }),
1740
+ y(w, {
1741
+ class: "sm:w-full xs:w-full",
1742
+ label: "Submit",
1743
+ size: "md",
1744
+ disabled: a.value,
1745
+ onClick: g
1746
+ }, null, 8, ["disabled"])
1747
+ ]),
1748
+ default: N(() => [
1749
+ s.nsVendorsLoading ? (I(), E("div", Dn, [
1750
+ y(B, { size: "lg" }),
1751
+ S[4] || (S[4] = r("span", { class: "ml-3 text-gray-500" }, "Loading NetSuite vendors...", -1))
1752
+ ])) : (I(), H(e, {
1753
+ key: 1,
1754
+ ref: "formRef",
1755
+ class: "mb-4",
1756
+ "model-value": f.value,
1757
+ "onUpdate:modelValue": S[1] || (S[1] = (l) => f.value = l)
1758
+ }, {
1759
+ default: N(() => [
1760
+ y(c, {
1761
+ modelValue: f.value,
1762
+ "onUpdate:modelValue": S[0] || (S[0] = (l) => f.value = l),
1763
+ "row-data": s.fmSuppliersNotYetConfigured,
1764
+ "column-defs": t,
1765
+ "search-value": A.value,
1766
+ "shrink-at": !1
1767
+ }, null, 8, ["modelValue", "row-data", "search-value"])
1768
+ ]),
1769
+ _: 1
1770
+ }, 8, ["model-value"]))
1771
+ ]),
1772
+ _: 1
1773
+ }, 8, ["modelValue"]);
1774
+ };
1775
+ }
1776
+ }), Rn = { class: "p-8 flex items-center justify-between" }, Mn = { class: "flex items-center gap-2" }, On = {
1777
+ key: 0,
1778
+ class: "text-sm text-gray-500"
1779
+ }, zn = {
1780
+ key: 1,
1781
+ class: "text-sm text-red-500"
1782
+ }, jn = /* @__PURE__ */ Y({
1783
+ __name: "VendorsTab",
1784
+ setup(_) {
1785
+ const h = dt(), o = oe(), d = $(), t = L(""), s = L(!1), i = L([]), n = L(!1), f = L(null), A = L(null);
1786
+ de(async () => {
1787
+ if (h.suppliers.length === 0)
1788
+ try {
1789
+ await h.readSuppliers();
1790
+ } catch {
1791
+ d.open({ message: "Failed to fetch suppliers", type: "error" });
1792
+ }
1793
+ if (o.isReady && o.isEnabled) {
1794
+ n.value = !0, f.value = null;
1795
+ try {
1796
+ i.value = await o.getNetSuiteVendorOptions();
1797
+ } catch {
1798
+ f.value = "Failed to fetch NetSuite vendors", d.open({ message: "Failed to fetch NetSuite vendors", type: "error" });
1799
+ } finally {
1800
+ n.value = !1;
1801
+ }
1802
+ }
1803
+ });
1804
+ const m = O(() => o.state.setting.vendors), a = [
1805
+ {
1806
+ id: "vendor",
1807
+ header: () => "FeedMe Supplier",
1808
+ accessorFn: (c) => {
1809
+ const e = h.suppliers.find((v) => v._id === c.id);
1810
+ return `${(e == null ? void 0 : e.name) || ""} ${(e == null ? void 0 : e._id) || ""}`;
1811
+ },
1812
+ cell(c) {
1813
+ const e = c.row.original, v = h.suppliers.find(
1814
+ (p) => p._id === e.id
1815
+ );
1816
+ if (!v)
1817
+ return F("div", "Unknown Supplier");
1818
+ const w = F(J.FmIcon, {
1819
+ name: "apartment",
1820
+ color: "neutral-gray-400",
1821
+ size: "md",
1822
+ class: "mr-2",
1823
+ outline: !0
1824
+ });
1825
+ return F("div", { class: "flex items-center" }, [
1826
+ w,
1827
+ F("div", { class: "flex flex-col" }, [
1828
+ F("span", { class: "font-medium" }, v.name),
1829
+ F("span", { class: "text-xs text-gray-400" }, v._id)
1830
+ ])
1831
+ ]);
1832
+ }
1833
+ },
1834
+ {
1835
+ id: "netsuite",
1836
+ header: () => "NetSuite Vendor",
1837
+ accessorFn: (c) => {
1838
+ var v;
1839
+ const e = (v = i.value.find(
1840
+ (w) => w.subsidiaryId === c.subsidiaryId
1841
+ )) == null ? void 0 : v.subsidiaryName;
1842
+ return `${c.name} ${c.netSuiteId} ${e || ""}`;
1843
+ },
1844
+ cell(c) {
1845
+ var p;
1846
+ const e = c.row.original, v = (p = i.value.find(
1847
+ (l) => l.subsidiaryId === e.subsidiaryId
1848
+ )) == null ? void 0 : p.subsidiaryName, w = F(J.FmIcon, {
1849
+ name: "cloud",
1850
+ color: "neutral-gray-400",
1851
+ size: "md",
1852
+ class: "mr-2",
1853
+ outline: !0
1854
+ });
1855
+ return F("div", { class: "flex items-center" }, [
1856
+ w,
1857
+ F("div", { class: "flex flex-col" }, [
1858
+ F("span", { class: "font-medium" }, e.name),
1859
+ F("span", { class: "text-xs text-gray-400" }, `ID: ${e.netSuiteId}`),
1860
+ F("span", { class: "text-xs text-gray-400" }, `Subsidiary: ${v || "N/A"}`)
1861
+ ])
1862
+ ]);
1863
+ }
1864
+ }
1865
+ ], g = O(() => h.suppliers.filter(
1866
+ (c) => !o.state.setting.vendors.some((e) => e.id === c._id)
1867
+ )), x = O(() => i.value.filter(
1868
+ (c) => !o.state.setting.vendors.some(
1869
+ (e) => e.netSuiteId === c.netsuiteId
1870
+ )
1871
+ )), S = () => {
1872
+ s.value = !0;
1873
+ }, B = O(() => !n.value && !f.value && i.value.length > 0);
1874
+ return (c, e) => {
1875
+ const v = k("FmSearch"), w = k("FmButton"), p = k("FmTable");
1876
+ return I(), E("div", null, [
1877
+ r("div", Rn, [
1878
+ y(v, {
1879
+ placeholder: "Search by Vendor",
1880
+ class: "w-[300px]",
1881
+ modelValue: t.value,
1882
+ "onUpdate:modelValue": e[0] || (e[0] = (l) => t.value = l)
1883
+ }, null, 8, ["modelValue"]),
1884
+ r("div", Mn, [
1885
+ n.value ? (I(), E("span", On, "Loading vendors...")) : f.value ? (I(), E("span", zn, R(f.value), 1)) : j("", !0),
1886
+ y(w, {
1887
+ label: "Add vendor",
1888
+ onClick: S,
1889
+ disabled: !B.value
1890
+ }, null, 8, ["disabled"])
1891
+ ])
1892
+ ]),
1893
+ y(p, {
1894
+ autoResetPageIndex: !0,
1895
+ "row-data": m.value,
1896
+ "column-defs": a,
1897
+ "shrink-at": !1,
1898
+ "search-value": t.value
1899
+ }, null, 8, ["row-data", "search-value"]),
1900
+ y(Tn, {
1901
+ "show-dialog": s.value,
1902
+ "onUpdate:showDialog": [
1903
+ e[1] || (e[1] = (l) => s.value = l),
1904
+ e[2] || (e[2] = (l) => s.value = l)
1905
+ ],
1906
+ formRef: A.value,
1907
+ fmSuppliersNotYetConfigured: g.value,
1908
+ nsVendorsNotBeingUsed: x.value,
1909
+ nsVendorsLoading: n.value
1910
+ }, null, 8, ["show-dialog", "formRef", "fmSuppliersNotYetConfigured", "nsVendorsNotBeingUsed", "nsVendorsLoading"])
1911
+ ]);
1912
+ };
1913
+ }
1914
+ }), Un = { class: "p-8 flex gap-4" }, Hn = /* @__PURE__ */ Y({
1915
+ __name: "ItemsTab",
1916
+ setup(_) {
1917
+ const h = ce(), o = oe(), d = L(), t = L(""), s = L(null), i = [
1918
+ {
1919
+ key: "itemType",
1920
+ type: "string",
1921
+ entity: "item",
1922
+ values: Object.values(ge.Values)
1923
+ }
1924
+ ], n = O(() => {
1925
+ let A = o.state.setting.items;
1926
+ if (!s.value)
1927
+ return A;
1928
+ const m = Ne.build(s.value);
1929
+ return A.filter(
1930
+ (a) => Le(
1931
+ {
1932
+ itemType: a.itemType || ge.Enum.InvtPart
1933
+ },
1934
+ m
1935
+ )
1936
+ );
1937
+ }), f = [
1938
+ {
1939
+ id: "item",
1940
+ header: () => "FeedMe Ingredient",
1941
+ accessorFn: (A) => {
1942
+ const m = h.skuById[A.id];
1943
+ return `${(m == null ? void 0 : m.name) || ""} ${(m == null ? void 0 : m._id) || ""} ${(m == null ? void 0 : m.code) || ""}`;
1944
+ },
1945
+ cell(A) {
1946
+ const m = A.row.original, a = h.skuById[m.id];
1947
+ if (!a)
1948
+ return F("div", "Unknown Ingredient");
1949
+ const g = F(J.FmIcon, {
1950
+ name: "grocery",
1951
+ color: "neutral-gray-400",
1952
+ size: "md",
1953
+ class: "mr-2",
1954
+ outline: !0
1955
+ });
1956
+ return F("div", { class: "flex items-center" }, [
1957
+ g,
1958
+ F("div", { class: "flex flex-col" }, [
1959
+ F("span", { class: "font-medium" }, a.name),
1960
+ F("span", { class: "text-xs text-gray-400" }, `ID: ${a._id}`),
1961
+ F("span", { class: "text-xs text-gray-400" }, `Code: ${a.code}`)
1962
+ ])
1963
+ ]);
1964
+ }
1965
+ },
1966
+ {
1967
+ id: "netsuite",
1968
+ header: () => "NetSuite Item",
1969
+ accessorFn: (A) => {
1970
+ const m = o.state.setting.units.find(
1971
+ (a) => a.netSuiteId === A.unitTypeId
1972
+ );
1973
+ return `${A.name} ${A.netSuiteId} ${(m == null ? void 0 : m.netSuiteId) || ""}`;
1974
+ },
1975
+ cell(A) {
1976
+ const m = A.row.original, a = o.state.setting.units.find(
1977
+ (x) => x.netSuiteId === m.unitTypeId
1978
+ ), g = F(J.FmIcon, {
1979
+ name: "cloud",
1980
+ color: "neutral-gray-400",
1981
+ size: "md",
1982
+ class: "mr-2",
1983
+ outline: !0
1984
+ });
1985
+ return F("div", { class: "flex items-center" }, [
1986
+ g,
1987
+ F("div", { class: "flex flex-col" }, [
1988
+ F("span", { class: "font-medium" }, m.name || "N/A"),
1989
+ F("span", { class: "text-xs text-gray-400" }, `ID: ${m.netSuiteId}`),
1990
+ F(
1991
+ "span",
1992
+ { class: "text-xs text-gray-400" },
1993
+ `Unit Type: ${(a == null ? void 0 : a.netSuiteId) || "N/A"}`
1994
+ ),
1995
+ F(
1996
+ "span",
1997
+ { class: "text-xs text-gray-400" },
1998
+ `Unit of Measure (Base): ${(a == null ? void 0 : a.baseUnitUnitOfMeasureId) || "N/A"}`
1999
+ ),
2000
+ F(
2001
+ "span",
2002
+ { class: "text-xs text-gray-400" },
2003
+ `Type: ${m.itemType || ge.Enum.InvtPart}`
2004
+ )
2005
+ ])
2006
+ ]);
2007
+ }
2008
+ }
2009
+ ];
2010
+ return (A, m) => {
2011
+ const a = k("FmSearch"), g = k("FmTable");
2012
+ return I(), E("div", null, [
2013
+ r("div", Un, [
2014
+ y(a, {
2015
+ placeholder: "Search by Item",
2016
+ class: "w-[300px]",
2017
+ modelValue: t.value,
2018
+ "onUpdate:modelValue": m[0] || (m[0] = (x) => t.value = x)
2019
+ }, null, 8, ["modelValue"]),
2020
+ y(V(De), {
2021
+ modelValue: s.value,
2022
+ "onUpdate:modelValue": m[1] || (m[1] = (x) => s.value = x),
2023
+ attributes: i
2024
+ }, null, 8, ["modelValue"])
2025
+ ]),
2026
+ y(g, {
2027
+ modelValue: d.value,
2028
+ "onUpdate:modelValue": m[2] || (m[2] = (x) => d.value = x),
2029
+ "row-data": n.value,
2030
+ "column-defs": f,
2031
+ "shrink-at": !1,
2032
+ "search-value": t.value,
2033
+ autoResetPageIndex: !0
2034
+ }, null, 8, ["modelValue", "row-data", "search-value"])
2035
+ ]);
2036
+ };
2037
+ }
2038
+ }), Xn = { class: "p-8" }, Yn = /* @__PURE__ */ Y({
2039
+ __name: "UnitTypesTab",
2040
+ setup(_) {
2041
+ const h = ce(), o = oe(), d = L(), t = L(""), s = O(() => o.state.setting.units), i = [
2042
+ {
2043
+ id: "unit",
2044
+ header: () => "FeedMe Unit",
2045
+ accessorFn: (n) => {
2046
+ const f = h.units.find((A) => A._id === n.id);
2047
+ return `${(f == null ? void 0 : f.name) || ""} ${(f == null ? void 0 : f._id) || ""} ${(f == null ? void 0 : f.abbrev) || ""}`;
2048
+ },
2049
+ cell(n) {
2050
+ var a;
2051
+ const f = n.row.original, A = h.units.find((g) => g._id === f.id);
2052
+ if (!A)
2053
+ return F("div", "Unknown Unit");
2054
+ const m = F(J.FmIcon, {
2055
+ name: "measuring_tape",
2056
+ color: "neutral-gray-400",
2057
+ size: "md",
2058
+ class: "mr-2",
2059
+ outline: !0
2060
+ });
2061
+ return F("div", { class: "flex items-center" }, [
2062
+ m,
2063
+ F("div", { class: "flex flex-col" }, [
2064
+ F("span", { class: "font-medium" }, A.name),
2065
+ F("span", { class: "text-xs text-gray-400" }, `ID: ${A._id}`),
2066
+ F("span", { class: "text-xs text-gray-400" }, `Abbrev: ${A.abbrev}`),
2067
+ F(
2068
+ "span",
2069
+ { class: "text-xs text-gray-400" },
2070
+ `Measurements: ${((a = A.measurements) == null ? void 0 : a.length) || 0}`
2071
+ )
2072
+ ])
2073
+ ]);
2074
+ }
2075
+ },
2076
+ {
2077
+ id: "netsuite",
2078
+ header: () => "NetSuite Unit Type",
2079
+ accessorFn: (n) => `${n.netSuiteId} ${n.baseUnitUnitOfMeasureId || ""}`,
2080
+ cell(n) {
2081
+ const f = n.row.original, A = F(J.FmIcon, {
2082
+ name: "cloud",
2083
+ color: "neutral-gray-400",
2084
+ size: "md",
2085
+ class: "mr-2",
2086
+ outline: !0
2087
+ });
2088
+ return F("div", { class: "flex items-center" }, [
2089
+ A,
2090
+ F("div", { class: "flex flex-col" }, [
2091
+ F("span", { class: "font-medium" }, `Unit Type ID: ${f.netSuiteId}`),
2092
+ F(
2093
+ "span",
2094
+ { class: "text-xs text-gray-400" },
2095
+ `Base Unit of Measure: ${f.baseUnitUnitOfMeasureId || "N/A"}`
2096
+ ),
2097
+ F(
2098
+ "span",
2099
+ { class: "text-xs text-gray-400" },
2100
+ `Measurements: ${f.measurements.length}`
2101
+ )
2102
+ ])
2103
+ ]);
2104
+ }
2105
+ }
2106
+ ];
2107
+ return (n, f) => {
2108
+ const A = k("FmSearch"), m = k("FmTable");
2109
+ return I(), E("div", null, [
2110
+ r("div", Xn, [
2111
+ y(A, {
2112
+ placeholder: "Search by Unit Type",
2113
+ class: "w-[300px]",
2114
+ modelValue: t.value,
2115
+ "onUpdate:modelValue": f[0] || (f[0] = (a) => t.value = a)
2116
+ }, null, 8, ["modelValue"])
2117
+ ]),
2118
+ y(m, {
2119
+ modelValue: d.value,
2120
+ "onUpdate:modelValue": f[1] || (f[1] = (a) => d.value = a),
2121
+ "row-data": s.value,
2122
+ "column-defs": i,
2123
+ "shrink-at": !1,
2124
+ "search-value": t.value,
2125
+ autoResetPageIndex: !0
2126
+ }, null, 8, ["modelValue", "row-data", "search-value"])
2127
+ ]);
2128
+ };
2129
+ }
2130
+ }), Qn = { key: 0 }, Pn = {
2131
+ key: 1,
2132
+ class: "flex flex-col gap-8 w-full"
2133
+ }, Jn = { class: "flex gap-2 flex-wrap" }, Kn = { class: "flex gap-8 items-center justify-start" }, qn = /* @__PURE__ */ Y({
2134
+ __name: "BusinessNetSuiteSideSheet",
2135
+ props: {
2136
+ show: { type: Boolean },
2137
+ loading: { type: Boolean }
2138
+ },
2139
+ emits: ["update:show", "update:loading"],
2140
+ setup(_, { emit: h }) {
2141
+ const o = le(), d = _, t = h, s = re(d, "show"), i = L(
2142
+ "locations"
2143
+ /* LOCATIONS */
2144
+ ), n = [
2145
+ { value: "locations", label: "Locations" },
2146
+ { value: "vendors", label: "Vendors" },
2147
+ { value: "items", label: "Items" },
2148
+ { value: "unitTypes", label: "Unit Types" }
2149
+ ], { t: f } = ee(), A = [
2150
+ "Unit Type",
2151
+ "Inventory Item",
2152
+ "Location",
2153
+ "Vendor",
2154
+ "Subsidiary",
2155
+ "Purchase Order",
2156
+ "Transfer Order",
2157
+ "Inventory Transfer"
2158
+ ];
2159
+ return (m, a) => {
2160
+ const g = k("FmChip"), x = k("FmTabs"), S = k("FmButton"), B = k("FmSideSheet");
2161
+ return I(), H(B, {
2162
+ modelValue: V(s),
2163
+ "onUpdate:modelValue": a[2] || (a[2] = (c) => ie(s) ? s.value = c : null),
2164
+ header: V(f)("inventory.integration.netsuite.title"),
2165
+ "dismiss-away": "",
2166
+ "close-button": "",
2167
+ "max-width": 800
2168
+ }, {
2169
+ default: N(() => {
2170
+ var c;
2171
+ return [
2172
+ (c = V(o).sessionUser.value) != null && c.role.isAdmin ? (I(), E("div", Pn, [
2173
+ a[3] || (a[3] = r("div", { class: "text-sm" }, " This integration keeps your FeedMe system and NetSuite in sync for the following modules: ", -1)),
2174
+ r("div", Jn, [
2175
+ (I(), E(Q, null, W(A, (e) => y(g, {
2176
+ key: e,
2177
+ label: e,
2178
+ compact: ""
2179
+ }, null, 8, ["label"])), 64))
2180
+ ]),
2181
+ 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)),
2182
+ a[5] || (a[5] = r("hr", { class: "my-3" }, null, -1)),
2183
+ y(x, {
2184
+ "model-value": i.value,
2185
+ "onUpdate:modelValue": a[0] || (a[0] = (e) => i.value = e),
2186
+ items: n
2187
+ }, null, 8, ["model-value"]),
2188
+ i.value === "locations" ? (I(), H(wn, { key: 0 })) : j("", !0),
2189
+ i.value === "vendors" ? (I(), H(jn, { key: 1 })) : j("", !0),
2190
+ i.value === "items" ? (I(), H(Hn, { key: 2 })) : j("", !0),
2191
+ i.value === "unitTypes" ? (I(), H(Yn, { key: 3 })) : j("", !0)
2192
+ ])) : (I(), E("div", Qn, " Please contact your administrator to apply the changes. "))
2193
+ ];
2194
+ }),
2195
+ "side-sheet-footer": N(() => [
2196
+ r("div", Kn, [
2197
+ y(S, {
2198
+ variant: "tertiary",
2199
+ label: V(f)("common.close"),
2200
+ onClick: a[1] || (a[1] = (c) => t("update:show", !1))
2201
+ }, null, 8, ["label"])
2202
+ ])
2203
+ ]),
2204
+ _: 1
2205
+ }, 8, ["modelValue", "header"]);
2206
+ };
2207
+ }
2208
+ }), Gn = /* @__PURE__ */ Y({
2209
+ __name: "InventoryTransferIngredientTable",
2210
+ props: {
2211
+ modelValue: { default: [] },
2212
+ modelModifiers: {}
2213
+ },
2214
+ emits: ["update:modelValue"],
2215
+ setup(_) {
2216
+ const { t: h } = ve(), o = ke(_, "modelValue"), d = [
2217
+ {
2218
+ id: "Code",
2219
+ header: () => h("inventory.transfer.form.items.table.Code"),
2220
+ accessorKey: "code",
2221
+ size: 200,
2222
+ cell(t) {
2223
+ const s = t.row.original;
2224
+ return F(
2225
+ J.FmTooltip,
2226
+ {
2227
+ content: s.code,
2228
+ placement: "top",
2229
+ variant: "plain",
2230
+ zIndex: 50
2231
+ },
2232
+ F(
2233
+ "span",
2234
+ {
2235
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
2236
+ },
2237
+ s.code
2238
+ )
2239
+ );
2240
+ },
2241
+ enableSorting: !1
2242
+ },
2243
+ {
2244
+ id: "Name",
2245
+ header: () => h("inventory.transfer.form.items.table.Name"),
2246
+ minSize: 300,
2247
+ cell(t) {
2248
+ const s = t.row.original;
2249
+ return F(
2250
+ J.FmTooltip,
2251
+ {
2252
+ content: s.name,
2253
+ placement: "top",
2254
+ variant: "plain",
2255
+ zIndex: 50
2256
+ },
2257
+ F(
2258
+ "span",
2259
+ {
2260
+ class: "flex-auto line-clamp-2 text-ellipsis break-all"
2261
+ },
2262
+ s.name
2263
+ )
2264
+ );
2265
+ },
2266
+ enableSorting: !1
2267
+ },
2268
+ {
2269
+ id: "Amount",
2270
+ header: () => h("inventory.transfer.form.items.table.Amount"),
2271
+ minSize: 200,
2272
+ cell(t) {
2273
+ const s = t.row.original, i = t.row.index;
2274
+ return F(ct, {
2275
+ style: {
2276
+ flex: "1 1 0%"
2277
+ },
2278
+ modelValue: {
2279
+ amount: s.quantity ?? { amount: 1, precision: 0 },
2280
+ measurement: s.measurement ?? null
2281
+ },
2282
+ key: s.sku._id,
2283
+ unit: s.sku.unit,
2284
+ "onUpdate:modelValue": (n) => {
2285
+ if (!n) return;
2286
+ const f = {
2287
+ ...s,
2288
+ quantity: n.amount,
2289
+ measurement: n.measurement
2290
+ };
2291
+ o.value = [
2292
+ ...o.value.slice(0, i),
2293
+ f,
2294
+ ...o.value.slice(i + 1)
2295
+ ];
2296
+ },
2297
+ rules: [mt(+ut({ amount: 1, precision: 0 }))],
2298
+ applyDefaultRules: !0
2299
+ });
2300
+ },
2301
+ enableSorting: !1
2302
+ },
2303
+ {
2304
+ id: "Delete",
2305
+ header: "",
2306
+ cell(t) {
2307
+ const s = t.row.original, i = t.row.index;
2308
+ return F("div", { class: "flex justify-end" }, [
2309
+ F(J.FmButton, {
2310
+ key: s.sku._id,
2311
+ class: "delete-button",
2312
+ type: "button",
2313
+ icon: "delete",
2314
+ variant: "tertiary",
2315
+ size: "md",
2316
+ onClick: () => {
2317
+ o.value = [...o.value.slice(0, i), ...o.value.slice(i + 1)];
2318
+ }
2319
+ })
2320
+ ]);
2321
+ },
2322
+ enableSorting: !1,
2323
+ size: 40,
2324
+ meta: {
2325
+ cellClass: "",
2326
+ headerClass: ""
2327
+ }
2328
+ }
2329
+ ];
2330
+ return (t, s) => {
2331
+ const i = k("FmTable");
2332
+ return I(), H(i, {
2333
+ "column-defs": d,
2334
+ "row-data": o.value,
2335
+ "row-key": (n) => n.sku._id,
2336
+ "empty-text": V(h)("inventory.transfer.form.items.table.empty"),
2337
+ pagination: !1,
2338
+ "virtual-scroll": { enabled: !0, itemSize: 48 }
2339
+ }, null, 8, ["row-data", "row-key", "empty-text"]);
2340
+ };
2341
+ }
2342
+ }), Zn = { class: "flex items-center gap-8 mb-8" }, Wn = /* @__PURE__ */ Y({
2343
+ __name: "InventoryTransferOutTable",
2344
+ setup(_) {
2345
+ const h = L([]), o = pe(), d = L(!1), t = L(!1), s = $(), i = ne();
2346
+ de(async () => {
2347
+ const m = /* @__PURE__ */ new Date(), a = /* @__PURE__ */ new Date();
2348
+ a.setDate(a.getDate() - 30), d.value = !0;
2349
+ try {
2350
+ const g = await o.getInventoryTransferHistory(
2351
+ i.currentLocationDBName,
2352
+ a,
2353
+ m
2354
+ );
2355
+ h.value = g;
2356
+ } catch (g) {
2357
+ console.error("Error fetching inventory transfer history:", g);
2358
+ } finally {
2359
+ d.value = !1;
2360
+ }
2361
+ });
2362
+ async function n() {
2363
+ try {
2364
+ t.value = !0, await o.manualSyncInventoryTransfer(i.currentLocationDBName), s == null || s.open({
2365
+ title: "Sync Started",
2366
+ message: "Inventory transfers sync queued successfully.",
2367
+ type: "success"
2368
+ });
2369
+ } catch (m) {
2370
+ s == null || s.open({
2371
+ title: "Sync Failed",
2372
+ message: `Failed to queue inventory transfers sync. ${m == null ? void 0 : m.message}`,
2373
+ type: "error"
2374
+ });
2375
+ } finally {
2376
+ t.value = !1;
2377
+ }
2378
+ }
2379
+ const f = [
2380
+ // {
2381
+ // id: 'type',
2382
+ // header: 'Type',
2383
+ // cell: (props: any) => {
2384
+ // return props.row.original.type ? sentenceCase(props.row.original.type) : 'N/A'
2385
+ // }
2386
+ // },
2387
+ {
2388
+ id: "destinationLocation",
2389
+ header: "Destination Location",
2390
+ cell: (m) => {
2391
+ const a = m.row.original.destinationLocation.netSuiteName;
2392
+ return a ? F(
2393
+ J.FmTooltip,
2394
+ { zIndex: 51 },
2395
+ {
2396
+ content() {
2397
+ return a;
2398
+ },
2399
+ default() {
2400
+ return F("div", { class: "line-clamp-2 fm-typo-en-body-sm-400" }, a);
2401
+ }
2402
+ }
2403
+ ) : "N/A";
2404
+ }
2405
+ },
2406
+ {
2407
+ id: "netsuite",
2408
+ header: () => "NetSuite",
2409
+ cell(m) {
2410
+ return F("div", { class: "flex flex-col" }, [
2411
+ F(
2412
+ "span",
2413
+ { class: "fm-typo-en-body-sm-400" },
2414
+ `ID: ${m.row.original.netsuiteId ?? "N/A"}`
2415
+ ),
2416
+ F(
2417
+ "span",
2418
+ { class: "fm-typo-en-body-sm-400" },
2419
+ `Transaction ID: ${m.row.original.netsuiteTranId ?? "N/A"}`
2420
+ ),
2421
+ F(
2422
+ "span",
2423
+ { class: "fm-typo-en-body-sm-400" },
2424
+ `Transaction Date: ${m.row.original.netsuiteTranDate ?? "N/A"}`
2425
+ )
2426
+ ]);
2427
+ }
2428
+ },
2429
+ {
2430
+ id: "adjustment",
2431
+ header: () => "Adjustment (FeedMe)",
2432
+ cell(m) {
2433
+ const a = m.row.original.adjustmentId;
2434
+ return F("div", { class: "flex flex-col" }, [
2435
+ F("span", { class: "fm-typo-en-body-sm-400" }, `ID: ${a ?? "N/A"}`),
2436
+ F(
2437
+ "span",
2438
+ { class: "fm-typo-en-body-sm-400" },
2439
+ `Date: ${a ? he(Ae(a)) : "N/A"}`
2440
+ )
2441
+ ]);
2442
+ }
2443
+ },
2444
+ {
2445
+ id: "items",
2446
+ header: () => "Items",
2447
+ cell(m) {
2448
+ const a = m.row.original.items;
2449
+ return F(
2450
+ "div",
2451
+ { class: "overflow-auto" },
2452
+ F("ul", { class: "list-disc pl-5" }, [
2453
+ a == null ? void 0 : a.map(
2454
+ (g) => F(
2455
+ "li",
2456
+ { class: "fm-typo-en-body-sm-400" },
2457
+ `[${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"}`
2458
+ )
2459
+ )
2460
+ ])
2461
+ );
2462
+ },
2463
+ size: 150
2464
+ }
2465
+ ], A = L();
2466
+ return (m, a) => {
2467
+ const g = k("FmButton"), x = k("FmTable");
2468
+ return I(), E(Q, null, [
2469
+ r("div", Zn, [
2470
+ a[1] || (a[1] = r("span", null, "Last 30 Days:", -1)),
2471
+ y(g, {
2472
+ "prepend-icon": "sync",
2473
+ variant: "secondary",
2474
+ label: "Sync",
2475
+ loading: t.value,
2476
+ "text-color": "primary",
2477
+ "bg-color": "transparent",
2478
+ "border-color": "primary",
2479
+ onClick: n
2480
+ }, null, 8, ["loading"])
2481
+ ]),
2482
+ y(x, {
2483
+ modelValue: A.value,
2484
+ "onUpdate:modelValue": a[0] || (a[0] = (S) => A.value = S),
2485
+ "row-data": h.value,
2486
+ "column-defs": f,
2487
+ loading: d.value
2488
+ }, null, 8, ["modelValue", "row-data", "loading"])
2489
+ ], 64);
2490
+ };
2491
+ }
2492
+ }), $n = { class: "flex flex-col gap-8" }, eo = {
2493
+ key: 0,
2494
+ class: "flex flex-col gap-4"
2495
+ }, to = { class: "flex gap-2" }, no = {
2496
+ key: 1,
2497
+ class: "flex items-center my-2 border rounded-lg p-2"
2498
+ }, 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 = {
2499
+ key: 1,
2500
+ class: "flex flex-col"
2501
+ }, co = {
2502
+ key: 1,
2503
+ class: "flex flex-col"
2504
+ }, mo = /* @__PURE__ */ Y({
2505
+ __name: "InventoryTransfer",
2506
+ props: {
2507
+ nsLocations: {},
2508
+ currentLocationSetting: {},
2509
+ currentLocationSubsidiary: {}
2510
+ },
2511
+ setup(_) {
2512
+ 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(() => {
2513
+ const p = o.currentLocationSetting, l = o.configuredLocations;
2514
+ return x.nsLocations.map((u) => ({
2515
+ label: u.name,
2516
+ value: u,
2517
+ disabled: l.some((b) => b.netSuiteId === u.netsuiteId) || u.subsidiaryId !== (p == null ? void 0 : p.subsidiaryId)
2518
+ }));
2519
+ }), B = O({
2520
+ get() {
2521
+ return a.value ? a.value.toISOString().slice(0, 10) : "";
2522
+ },
2523
+ set(p) {
2524
+ if (!p) {
2525
+ a.value = null;
2526
+ return;
2527
+ }
2528
+ const l = a.value ?? /* @__PURE__ */ new Date(), u = new Date(p);
2529
+ l.setFullYear(u.getFullYear(), u.getMonth(), u.getDate()), a.value = new Date(l);
2530
+ }
2531
+ }), c = O({
2532
+ get() {
2533
+ if (!a.value) return null;
2534
+ const p = String(a.value.getHours()).padStart(2, "0"), l = String(a.value.getMinutes()).padStart(2, "0");
2535
+ return `${p}:${l}`;
2536
+ },
2537
+ set(p) {
2538
+ if (!p) return;
2539
+ const [l, u] = p.split(":").map(Number), b = a.value ?? /* @__PURE__ */ new Date();
2540
+ b.setHours(l, u), a.value = new Date(b);
2541
+ }
2542
+ }), e = O(() => B.value && c.value && g.value && n.value.length > 0 && !m.value);
2543
+ async function v() {
2544
+ if (e.value) {
2545
+ if (!x.currentLocationSetting) {
2546
+ s.open({
2547
+ message: "Current location setting is not available",
2548
+ type: "error"
2549
+ });
2550
+ return;
2551
+ }
2552
+ m.value = !0;
2553
+ try {
2554
+ const p = {
2555
+ items: n.value,
2556
+ date: a.value.toISOString(),
2557
+ netsuiteLocationId: g.value.netsuiteId,
2558
+ netsuiteLocationName: g.value.name
2559
+ }, l = `${x.currentLocationSetting.type}_${x.currentLocationSetting.id}`;
2560
+ await t.createInventoryTransfer(l, p), n.value = [], a.value = null, g.value = null, s.open({
2561
+ message: "Inventort transfer created successfully",
2562
+ type: "success"
2563
+ });
2564
+ } catch {
2565
+ s.open({
2566
+ message: "Failed to create inventory transfer",
2567
+ type: "error"
2568
+ });
2569
+ } finally {
2570
+ m.value = !1;
2571
+ }
2572
+ }
2573
+ }
2574
+ function w() {
2575
+ 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(
2576
+ (D) => ({
2577
+ label: D.name,
2578
+ sublabel: D.code,
2579
+ value: D,
2580
+ disabled: !u.includes(D._id)
2581
+ })
2582
+ ), C = b.filter((D) => {
2583
+ var M;
2584
+ return (M = n.value) == null ? void 0 : M.find((X) => X.sku._id === D.value._id);
2585
+ }).map((D) => D.value);
2586
+ h.open({
2587
+ title: i("inventory.transfer.form.items.selectItem"),
2588
+ closeButton: !0,
2589
+ contentComponent: it,
2590
+ contentComponentProps: {
2591
+ modelValue: C,
2592
+ items: b,
2593
+ virtualScroll: !0
2594
+ },
2595
+ primaryActions: {
2596
+ text: i("common.confirm"),
2597
+ close: !0
2598
+ },
2599
+ secondaryActions: {
2600
+ text: i("common.close"),
2601
+ close: !0,
2602
+ variant: "tertiary"
2603
+ }
2604
+ }).onPrimary((D) => {
2605
+ const M = n.value, X = D.map((T) => {
2606
+ const z = M.find((ue) => ue.sku._id === T._id);
2607
+ return z || {
2608
+ sku: T,
2609
+ code: T.code,
2610
+ name: T.name,
2611
+ quantity: {
2612
+ amount: 1,
2613
+ precision: 0
2614
+ }
2615
+ };
2616
+ });
2617
+ X.sort((T, z) => T.sku.code.localeCompare(z.sku.code)), n.value = X;
2618
+ });
2619
+ }
2620
+ return (p, l) => {
2621
+ const u = k("FmButtonGroup"), b = k("FmLabel"), C = k("FmField"), D = k("FmSimpleDatePicker"), M = k("FmTimePicker"), X = k("FmSelect"), T = k("FmIcon"), z = k("FmButton");
2622
+ return I(), E("div", $n, [
2623
+ y(u, {
2624
+ modelValue: A.value,
2625
+ "onUpdate:modelValue": l[0] || (l[0] = (U) => A.value = U),
2626
+ items: f
2627
+ }, null, 8, ["modelValue"]),
2628
+ A.value.label === "Transfer Out" ? (I(), E(Q, { key: 0 }, [
2629
+ V(o).inventoryTransferOutEnabled ? (I(), E("div", eo, [
2630
+ y(b, { class: "fm-typo-en-body-md-600" }, {
2631
+ default: N(() => l[6] || (l[6] = [
2632
+ K("Type")
2633
+ ])),
2634
+ _: 1
2635
+ }),
2636
+ y(C, {
2637
+ class: "my-4",
2638
+ disabled: "",
2639
+ "prepend-icon": "lock"
2640
+ }, {
2641
+ default: N(() => l[7] || (l[7] = [
2642
+ K("Transfer out")
2643
+ ])),
2644
+ _: 1
2645
+ }),
2646
+ y(b, { class: "fm-typo-en-body-md-600" }, {
2647
+ default: N(() => l[8] || (l[8] = [
2648
+ K("Subsidiary")
2649
+ ])),
2650
+ _: 1
2651
+ }),
2652
+ y(C, {
2653
+ class: "my-4",
2654
+ disabled: "",
2655
+ "prepend-icon": "lock"
2656
+ }, {
2657
+ default: N(() => [
2658
+ K(R(p.currentLocationSubsidiary.fullName), 1)
2659
+ ]),
2660
+ _: 1
2661
+ }),
2662
+ y(b, { class: "fm-typo-en-body-md-600" }, {
2663
+ default: N(() => l[9] || (l[9] = [
2664
+ K("Transaction date")
2665
+ ])),
2666
+ _: 1
2667
+ }),
2668
+ y(D, {
2669
+ modelValue: B.value,
2670
+ "onUpdate:modelValue": l[1] || (l[1] = (U) => B.value = U)
2671
+ }, null, 8, ["modelValue"]),
2672
+ y(b, { class: "fm-typo-en-body-md-600" }, {
2673
+ default: N(() => l[10] || (l[10] = [
2674
+ K("Transaction time")
2675
+ ])),
2676
+ _: 1
2677
+ }),
2678
+ y(M, {
2679
+ modelValue: c.value,
2680
+ "onUpdate:modelValue": l[2] || (l[2] = (U) => c.value = U)
2681
+ }, null, 8, ["modelValue"]),
2682
+ y(b, { class: "fm-typo-en-body-md-600" }, {
2683
+ default: N(() => l[11] || (l[11] = [
2684
+ K("NetSuite Location")
2685
+ ])),
2686
+ _: 1
2687
+ }),
2688
+ r("div", to, [
2689
+ g.value ? j("", !0) : (I(), H(X, {
2690
+ key: 0,
2691
+ class: "my-4 w-full",
2692
+ modelValue: g.value,
2693
+ "onUpdate:modelValue": l[3] || (l[3] = (U) => g.value = U),
2694
+ searchable: "",
2695
+ searchTarget: "label",
2696
+ items: S.value
2697
+ }, null, 8, ["modelValue", "items"])),
2698
+ g.value ? (I(), E("div", no, [
2699
+ y(T, {
2700
+ name: "cloud",
2701
+ color: "neutral-gray-400",
2702
+ size: "md",
2703
+ class: "mr-2",
2704
+ outline: ""
2705
+ }),
2706
+ r("div", oo, [
2707
+ r("span", so, R(g.value.name), 1),
2708
+ r("span", ao, "ID: " + R(g.value.netsuiteId), 1),
2709
+ r("span", lo, "Subsidiary: " + R(g.value.subsidiaryName), 1)
2710
+ ]),
2711
+ y(z, {
2712
+ class: "ml-2",
2713
+ variant: "secondary",
2714
+ label: "Clear",
2715
+ onClick: l[4] || (l[4] = (U) => g.value = null)
2716
+ })
2717
+ ])) : j("", !0)
2718
+ ]),
2719
+ r("div", io, [
2720
+ y(z, {
2721
+ class: "ml-auto",
2722
+ variant: "secondary",
2723
+ "prepend-icon": "add",
2724
+ label: "Ingredients",
2725
+ onClick: w
2726
+ })
2727
+ ]),
2728
+ y(Gn, {
2729
+ modelValue: n.value,
2730
+ "onUpdate:modelValue": l[5] || (l[5] = (U) => n.value = U)
2731
+ }, null, 8, ["modelValue"]),
2732
+ r("div", ro, [
2733
+ y(z, {
2734
+ class: "ml-auto mt-4",
2735
+ variant: "primary",
2736
+ "prepend-icon": "add",
2737
+ label: "Create",
2738
+ disabled: !e.value,
2739
+ loading: m.value,
2740
+ onClick: v
2741
+ }, null, 8, ["disabled", "loading"])
2742
+ ])
2743
+ ])) : (I(), E("div", uo, [
2744
+ y(b, { class: "fm-typo-en-body-md-600" }, {
2745
+ default: N(() => l[12] || (l[12] = [
2746
+ K(" Feature is not enabled. Please contact your administrator. ")
2747
+ ])),
2748
+ _: 1
2749
+ })
2750
+ ]))
2751
+ ], 64)) : j("", !0),
2752
+ A.value.label === "History" ? (I(), E("div", co, [
2753
+ y(Wn)
2754
+ ])) : j("", !0)
2755
+ ]);
2756
+ };
2757
+ }
2758
+ }), fo = { class: "flex flex-col gap-8" }, po = {
2759
+ key: 0,
2760
+ class: "flex flex-col gap-4"
2761
+ }, 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({
2762
+ __name: "TransferOrder",
2763
+ props: {
2764
+ currentLocationSetting: {}
2765
+ },
2766
+ setup(_) {
2767
+ 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 = [
2768
+ { value: Z.enum[1], label: "Version 1" },
2769
+ {
2770
+ value: Z.enum[2],
2771
+ label: "Version 2",
2772
+ subLabel: "Supports duplicate skus"
2773
+ }
2774
+ ], a = O(() => i.value.length > 0 && n.value.size === i.value.length), g = O(() => n.value.size > 0 && n.value.size < i.value.length);
2775
+ function x(p) {
2776
+ p ? n.value = new Set(i.value.map((l) => l.id)) : n.value = /* @__PURE__ */ new Set();
2777
+ }
2778
+ function S(p, l) {
2779
+ l ? n.value.add(p) : n.value.delete(p), n.value = new Set(n.value);
2780
+ }
2781
+ function B(p) {
2782
+ return n.value.has(p);
2783
+ }
2784
+ async function c() {
2785
+ var p;
2786
+ t.value = !0;
2787
+ try {
2788
+ const l = ((p = s.currentLocationSetting) == null ? void 0 : p.id) || "", u = await o.getUnSyncTransferInOrders(l);
2789
+ i.value = u, n.value = /* @__PURE__ */ new Set(), d.open({
2790
+ message: "Check unsync transfer in order successfully",
2791
+ type: "success"
2792
+ });
2793
+ } catch {
2794
+ d.open({
2795
+ message: "Failed to check unsync transfer in order",
2796
+ type: "error"
2797
+ });
2798
+ } finally {
2799
+ t.value = !1;
2800
+ }
2801
+ }
2802
+ async function e() {
2803
+ if (n.value.size === 0) {
2804
+ d.open({
2805
+ message: "No transfer orders selected",
2806
+ type: "info"
2807
+ });
2808
+ return;
2809
+ }
2810
+ A.value = Z.enum[1], f.value = !0;
2811
+ }
2812
+ async function v() {
2813
+ f.value = !1;
2814
+ const p = A.value === Z.enum[2] ? Z.enum[2] : void 0;
2815
+ await w(p);
2816
+ }
2817
+ async function w(p) {
2818
+ t.value = !0;
2819
+ try {
2820
+ const l = Array.from(n.value);
2821
+ await o.manualSyncMultipleTransferInOrders({ netsuiteIds: l, version: p }), await new Promise((u) => setTimeout(u, 5e3)), d.open({
2822
+ message: "Sync transfer orders request sent successfully",
2823
+ type: "success"
2824
+ });
2825
+ } catch (l) {
2826
+ console.log(l), d.open({
2827
+ message: "Failed to sync transfer orders",
2828
+ type: "error"
2829
+ });
2830
+ } finally {
2831
+ t.value = !1;
2832
+ }
2833
+ }
2834
+ return (p, l) => {
2835
+ var X;
2836
+ const u = k("FmButton"), b = k("FmCheckbox"), C = k("FmRadio"), D = k("FmRadioGroup"), M = k("FmDialog");
2837
+ return I(), E("div", fo, [
2838
+ r("span", null, "Current date and time: " + R((/* @__PURE__ */ new Date()).toLocaleString()), 1),
2839
+ y(u, {
2840
+ label: "Check Unsync Transfer Order (Last 2 months)",
2841
+ variant: "primary",
2842
+ onClick: c,
2843
+ disabled: t.value,
2844
+ loading: t.value
2845
+ }, null, 8, ["disabled", "loading"]),
2846
+ i.value.length > 0 ? (I(), E("div", po, [
2847
+ l[3] || (l[3] = r("p", null, "Transfer Order NetSuite ID not match with existing orders", -1)),
2848
+ r("div", vo, [
2849
+ (X = V(h).sessionUser.value) != null && X.role.isAdmin ? (I(), H(b, {
2850
+ key: 0,
2851
+ label: "Select All",
2852
+ value: "all",
2853
+ modelValue: a.value,
2854
+ indeterminate: g.value,
2855
+ "onUpdate:modelValue": x
2856
+ }, null, 8, ["modelValue", "indeterminate"])) : j("", !0),
2857
+ r("ul", go, [
2858
+ (I(!0), E(Q, null, W(i.value, (T) => {
2859
+ var z;
2860
+ return I(), E("li", {
2861
+ key: T.id,
2862
+ class: "flex items-center"
2863
+ }, [
2864
+ (z = V(h).sessionUser.value) != null && z.role.isAdmin ? (I(), H(b, {
2865
+ key: 0,
2866
+ label: `${T.id} (${T.tranid})`,
2867
+ value: T.id,
2868
+ modelValue: B(T.id),
2869
+ "onUpdate:modelValue": (U) => S(T.id, U)
2870
+ }, null, 8, ["label", "value", "modelValue", "onUpdate:modelValue"])) : (I(), E("span", yo, R(T.id) + " (" + R(T.tranid) + ")", 1))
2871
+ ]);
2872
+ }), 128))
2873
+ ])
2874
+ ]),
2875
+ r("div", Ao, [
2876
+ y(Ee, null, {
2877
+ default: N(() => [
2878
+ i.value.length > 0 ? (I(), H(u, {
2879
+ key: 0,
2880
+ label: `Sync Selected (${n.value.size})`,
2881
+ variant: "destructive",
2882
+ onClick: e,
2883
+ disabled: t.value || n.value.size === 0,
2884
+ loading: t.value
2885
+ }, null, 8, ["label", "disabled", "loading"])) : j("", !0)
2886
+ ]),
2887
+ _: 1
2888
+ })
2889
+ ])
2890
+ ])) : j("", !0),
2891
+ y(M, {
2892
+ modelValue: f.value,
2893
+ "onUpdate:modelValue": l[2] || (l[2] = (T) => f.value = T),
2894
+ overlay: !0
2895
+ }, {
2896
+ "dialog-header": N(() => l[4] || (l[4] = [
2897
+ r("span", { class: "fm-typo-en-heading-lg-700" }, "Select Sync Version", -1)
2898
+ ])),
2899
+ "dialog-footer": N(() => [
2900
+ r("div", ho, [
2901
+ y(u, {
2902
+ label: "Not now",
2903
+ variant: "secondary",
2904
+ onClick: l[1] || (l[1] = (T) => f.value = !1)
2905
+ }),
2906
+ y(u, {
2907
+ label: "Confirm",
2908
+ variant: "primary",
2909
+ onClick: v
2910
+ })
2911
+ ])
2912
+ ]),
2913
+ default: N(() => [
2914
+ r("div", bo, [
2915
+ r("p", null, " Choose which purchase order version to use for syncing " + R(n.value.size) + " selected transfer orders: ", 1),
2916
+ y(D, {
2917
+ modelValue: A.value,
2918
+ "onUpdate:modelValue": l[0] || (l[0] = (T) => A.value = T)
2919
+ }, {
2920
+ default: N(() => [
2921
+ (I(), E(Q, null, W(m, (T) => y(C, {
2922
+ key: T.value,
2923
+ value: T.value,
2924
+ label: T.label,
2925
+ sublabel: T.subLabel
2926
+ }, null, 8, ["value", "label", "sublabel"])), 64))
2927
+ ]),
2928
+ _: 1
2929
+ }, 8, ["modelValue"])
2930
+ ])
2931
+ ]),
2932
+ _: 1
2933
+ }, 8, ["modelValue"])
2934
+ ]);
2935
+ };
2936
+ }
2937
+ }), Io = { class: "flex flex-col gap-8" }, So = {
2938
+ key: 0,
2939
+ class: "flex flex-col gap-4"
2940
+ }, wo = { class: "flex flex-col gap-2" }, ko = { class: "flex flex-col gap-2 pl-6" }, Fo = { key: 1 }, Bo = { class: "flex justify-end" }, Co = { class: "flex flex-col gap-4" }, Vo = { class: "ml-auto flex gap-4" }, _o = /* @__PURE__ */ Y({
2941
+ __name: "PurchaseOrder",
2942
+ props: {
2943
+ currentLocationSetting: {}
2944
+ },
2945
+ setup(_) {
2946
+ 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 = [
2947
+ { value: Z.enum[1], label: "Version 1" },
2948
+ {
2949
+ value: Z.enum[2],
2950
+ label: "Version 2",
2951
+ subLabel: "Supports duplicate skus"
2952
+ }
2953
+ ], a = O(() => i.value.length > 0 && n.value.size === i.value.length), g = O(() => n.value.size > 0 && n.value.size < i.value.length);
2954
+ function x(p) {
2955
+ p ? n.value = new Set(i.value) : n.value = /* @__PURE__ */ new Set();
2956
+ }
2957
+ function S(p, l) {
2958
+ l ? n.value.add(p) : n.value.delete(p), n.value = new Set(n.value);
2959
+ }
2960
+ function B(p) {
2961
+ return n.value.has(p);
2962
+ }
2963
+ async function c() {
2964
+ var p;
2965
+ t.value = !0;
2966
+ try {
2967
+ const l = ((p = s.currentLocationSetting) == null ? void 0 : p.id) || "", u = await o.getUnSyncPurchaseOrders(l);
2968
+ i.value = u, n.value = /* @__PURE__ */ new Set(), d.open({
2969
+ message: "Check unsync purchase order successfully",
2970
+ type: "success"
2971
+ });
2972
+ } catch {
2973
+ d.open({
2974
+ message: "Failed to check unsync purchase order",
2975
+ type: "error"
2976
+ });
2977
+ } finally {
2978
+ t.value = !1;
2979
+ }
2980
+ }
2981
+ async function e() {
2982
+ if (n.value.size === 0) {
2983
+ d.open({
2984
+ message: "No purchase orders selected",
2985
+ type: "info"
2986
+ });
2987
+ return;
2988
+ }
2989
+ A.value = Z.enum[1], f.value = !0;
2990
+ }
2991
+ async function v() {
2992
+ f.value = !1;
2993
+ const p = A.value === Z.enum[2] ? Z.enum[2] : void 0;
2994
+ await w(p);
2995
+ }
2996
+ async function w(p) {
2997
+ t.value = !0;
2998
+ try {
2999
+ const l = Array.from(n.value);
3000
+ await o.manualSyncMultiplePurchaseOrders({ netsuiteIds: l, version: p }), await new Promise((u) => setTimeout(u, 5e3)), d.open({
3001
+ message: "Sync purchase orders request sent successfully",
3002
+ type: "success"
3003
+ });
3004
+ } catch (l) {
3005
+ console.log(l), d.open({
3006
+ message: "Failed to sync purchase orders",
3007
+ type: "error"
3008
+ });
3009
+ } finally {
3010
+ t.value = !1;
3011
+ }
3012
+ }
3013
+ return (p, l) => {
3014
+ var X;
3015
+ const u = k("FmButton"), b = k("FmCheckbox"), C = k("FmRadio"), D = k("FmRadioGroup"), M = k("FmDialog");
3016
+ return I(), E("div", Io, [
3017
+ r("span", null, "Current date and time: " + R((/* @__PURE__ */ new Date()).toLocaleString()), 1),
3018
+ y(u, {
3019
+ label: "Check Unsync Purchase Order (Last 2 months)",
3020
+ variant: "primary",
3021
+ onClick: c,
3022
+ disabled: t.value,
3023
+ loading: t.value
3024
+ }, null, 8, ["disabled", "loading"]),
3025
+ i.value.length > 0 ? (I(), E("div", So, [
3026
+ l[3] || (l[3] = r("p", null, "Purchase Order NetSuite ID not match with existing orders", -1)),
3027
+ r("div", wo, [
3028
+ (X = V(h).sessionUser.value) != null && X.role.isAdmin ? (I(), H(b, {
3029
+ key: 0,
3030
+ label: "Select All",
3031
+ value: "all",
3032
+ modelValue: a.value,
3033
+ indeterminate: g.value,
3034
+ "onUpdate:modelValue": x
3035
+ }, null, 8, ["modelValue", "indeterminate"])) : j("", !0),
3036
+ r("ul", ko, [
3037
+ (I(!0), E(Q, null, W(i.value, (T) => {
3038
+ var z;
3039
+ return I(), E("li", {
3040
+ key: T,
3041
+ class: "flex items-center"
3042
+ }, [
3043
+ (z = V(h).sessionUser.value) != null && z.role.isAdmin ? (I(), H(b, {
3044
+ key: 0,
3045
+ label: T,
3046
+ value: T,
3047
+ modelValue: B(T),
3048
+ "onUpdate:modelValue": (U) => S(T, U)
3049
+ }, null, 8, ["label", "value", "modelValue", "onUpdate:modelValue"])) : (I(), E("span", Fo, R(T), 1))
3050
+ ]);
3051
+ }), 128))
3052
+ ])
3053
+ ]),
3054
+ r("div", Bo, [
3055
+ y(Ee, null, {
3056
+ default: N(() => [
3057
+ i.value.length > 0 ? (I(), H(u, {
3058
+ key: 0,
3059
+ label: `Sync Selected (${n.value.size})`,
3060
+ variant: "destructive",
3061
+ onClick: e,
3062
+ disabled: t.value || n.value.size === 0,
3063
+ loading: t.value
3064
+ }, null, 8, ["label", "disabled", "loading"])) : j("", !0)
3065
+ ]),
3066
+ _: 1
3067
+ })
3068
+ ])
3069
+ ])) : j("", !0),
3070
+ y(M, {
3071
+ modelValue: f.value,
3072
+ "onUpdate:modelValue": l[2] || (l[2] = (T) => f.value = T),
3073
+ overlay: !0
3074
+ }, {
3075
+ "dialog-header": N(() => l[4] || (l[4] = [
3076
+ r("span", { class: "fm-typo-en-heading-lg-700" }, "Select Sync Version", -1)
3077
+ ])),
3078
+ "dialog-footer": N(() => [
3079
+ r("div", Vo, [
3080
+ y(u, {
3081
+ label: "Not now",
3082
+ variant: "secondary",
3083
+ onClick: l[1] || (l[1] = (T) => f.value = !1)
3084
+ }),
3085
+ y(u, {
3086
+ label: "Confirm",
3087
+ variant: "primary",
3088
+ onClick: v
3089
+ })
3090
+ ])
3091
+ ]),
3092
+ default: N(() => [
3093
+ r("div", Co, [
3094
+ r("p", null, " Choose which purchase order version to use for syncing " + R(n.value.size) + " selected purchase orders: ", 1),
3095
+ y(D, {
3096
+ modelValue: A.value,
3097
+ "onUpdate:modelValue": l[0] || (l[0] = (T) => A.value = T)
3098
+ }, {
3099
+ default: N(() => [
3100
+ (I(), E(Q, null, W(m, (T) => y(C, {
3101
+ key: T.value,
3102
+ value: T.value,
3103
+ label: T.label,
3104
+ sublabel: T.subLabel
3105
+ }, null, 8, ["value", "label", "sublabel"])), 64))
3106
+ ]),
3107
+ _: 1
3108
+ }, 8, ["modelValue"])
3109
+ ])
3110
+ ]),
3111
+ _: 1
3112
+ }, 8, ["modelValue"])
3113
+ ]);
3114
+ };
3115
+ }
3116
+ }), 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({
3117
+ __name: "NetSuiteSideSheet",
3118
+ props: {
3119
+ nsLocations: {},
3120
+ show: { type: Boolean },
3121
+ loading: { type: Boolean }
3122
+ },
3123
+ emits: ["update:show"],
3124
+ setup(_, { emit: h }) {
3125
+ var B;
3126
+ const o = le(), d = oe(), t = _, s = re(t, "show"), { t: i } = ee(), n = h, f = ne(), A = ((B = f._currentLocation) == null ? void 0 : B.type) || "", m = [
3127
+ {
3128
+ label: "Inventory Transfer (Out)",
3129
+ value: "inventoryTransfer"
3130
+ /* INVENTORY_TRANSFER */
3131
+ },
3132
+ {
3133
+ label: "Transfer Order",
3134
+ value: "transferOrder"
3135
+ /* TRANSFER_ORDER */
3136
+ },
3137
+ {
3138
+ label: "Purchase Order",
3139
+ value: "purchaseOrder"
3140
+ /* PURCHASE_ORDER */
3141
+ }
3142
+ ], a = L(m[0].value), g = O(() => d.currentLocationSubsidiary()), x = O(() => d.currentLocationSetting), S = O(() => t.nsLocations.filter(
3143
+ (c) => c.subsidiaryId === g.value.id || c.netsuiteId === g.value.id
3144
+ ));
3145
+ return (c, e) => {
3146
+ var u;
3147
+ const v = k("FmIcon"), w = k("FmTabs"), p = k("FmButton"), l = k("FmSideSheet");
3148
+ return I(), H(l, {
3149
+ modelValue: V(s),
3150
+ "onUpdate:modelValue": e[2] || (e[2] = (b) => ie(s) ? s.value = b : null),
3151
+ header: "Data migration (Xilnex)",
3152
+ "dismiss-away": "",
3153
+ "close-button": "",
3154
+ "max-width": 800
3155
+ }, se({
3156
+ default: N(() => [
3157
+ V(d).isCurrentLocationBindedToNetSuite ? (I(), E(Q, { key: 1 }, [
3158
+ a.value === "inventoryTransfer" ? (I(), H(mo, {
3159
+ key: 0,
3160
+ currentLocationSetting: x.value,
3161
+ nsLocations: S.value,
3162
+ currentLocationSubsidiary: g.value
3163
+ }, null, 8, ["currentLocationSetting", "nsLocations", "currentLocationSubsidiary"])) : j("", !0),
3164
+ a.value === "transferOrder" ? (I(), H(xo, {
3165
+ key: 1,
3166
+ currentLocationSetting: x.value
3167
+ }, null, 8, ["currentLocationSetting"])) : j("", !0),
3168
+ a.value === "purchaseOrder" ? (I(), H(_o, {
3169
+ key: 2,
3170
+ currentLocationSetting: x.value
3171
+ }, null, 8, ["currentLocationSetting"])) : j("", !0)
3172
+ ], 64)) : (I(), E("div", To, " Netsuite is not configured for this location. Please contact your administrator. "))
3173
+ ]),
3174
+ "side-sheet-footer": N(() => [
3175
+ r("div", Ro, [
3176
+ y(p, {
3177
+ variant: "tertiary",
3178
+ label: V(i)("common.close"),
3179
+ onClick: e[1] || (e[1] = (b) => n("update:show", !1))
3180
+ }, null, 8, ["label"])
3181
+ ])
3182
+ ]),
3183
+ _: 2
3184
+ }, [
3185
+ (u = V(o).sessionUser.value) != null && u.role.isAdmin ? {
3186
+ name: "side-sheet-header",
3187
+ fn: N(() => {
3188
+ var b;
3189
+ return [
3190
+ r("div", Eo, [
3191
+ r("div", No, [
3192
+ e[3] || (e[3] = r("div", { class: "fm-typo-en-title-md-600" }, "NetSuite Integration", -1)),
3193
+ r("div", Lo, [
3194
+ y(v, {
3195
+ name: V(A),
3196
+ size: "sm"
3197
+ }, null, 8, ["name"]),
3198
+ r("div", Do, R((b = V(f)._currentLocation) == null ? void 0 : b.name), 1)
3199
+ ])
3200
+ ]),
3201
+ y(w, {
3202
+ "model-value": a.value,
3203
+ "onUpdate:modelValue": e[0] || (e[0] = (C) => a.value = C),
3204
+ items: m
3205
+ }, null, 8, ["model-value"])
3206
+ ])
3207
+ ];
3208
+ }),
3209
+ key: "0"
3210
+ } : void 0
3211
+ ]), 1032, ["modelValue"]);
3212
+ };
3213
+ }
3214
+ }), 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({
3215
+ __name: "NetSuite",
3216
+ setup(_) {
3217
+ const h = oe(), o = $(), d = L(!1), t = L(!1);
3218
+ async function s() {
3219
+ t.value = !0;
3220
+ }
3221
+ const i = L([]);
3222
+ Ke(async () => {
3223
+ if (h.isReady && h.isEnabled && !h.isBusinessLocation) {
3224
+ d.value = !0;
3225
+ try {
3226
+ const f = await h.getNetSuiteLocationOptions();
3227
+ i.value = f;
3228
+ } catch {
3229
+ o.open({
3230
+ message: "Failed to fetch NetSuite locations",
3231
+ type: "error"
3232
+ });
3233
+ } finally {
3234
+ d.value = !1;
3235
+ }
3236
+ }
3237
+ });
3238
+ const { t: n } = ee();
3239
+ return (f, A) => {
3240
+ const m = k("FmCardSection"), a = k("FmCard");
3241
+ return V(h).isEnabled ? (I(), E(Q, { key: 0 }, [
3242
+ y(a, {
3243
+ class: q({
3244
+ "w-full": !0,
3245
+ border: !0,
3246
+ "border-fm-color-neutral-gray-100": !0,
3247
+ "cursor-pointer": !0,
3248
+ "hover:border-fm-color-primary": !0
3249
+ }),
3250
+ onClick: A[0] || (A[0] = (g) => s())
3251
+ }, {
3252
+ default: N(() => [
3253
+ y(m, null, {
3254
+ default: N(() => [
3255
+ r("div", Oo, [
3256
+ r("img", {
3257
+ src: V(ln),
3258
+ alt: "NetSuite"
3259
+ }, null, 8, zo)
3260
+ ]),
3261
+ r("div", jo, [
3262
+ r("div", Uo, R(V(n)("inventory.integration.netsuite.title")), 1),
3263
+ r("div", Ho, R(V(n)("inventory.integration.netsuite.description")), 1)
3264
+ ])
3265
+ ]),
3266
+ _: 1
3267
+ })
3268
+ ]),
3269
+ _: 1
3270
+ }),
3271
+ V(h).state.setting ? (I(), H(fe, {
3272
+ key: 0,
3273
+ to: "body"
3274
+ }, [
3275
+ V(h).isBusinessLocation ? (I(), H(qn, {
3276
+ key: 0,
3277
+ show: t.value,
3278
+ "onUpdate:show": [
3279
+ A[1] || (A[1] = (g) => t.value = g),
3280
+ A[2] || (A[2] = (g) => t.value = g)
3281
+ ],
3282
+ loading: d.value,
3283
+ "onUpdate:loading": A[3] || (A[3] = (g) => d.value = g)
3284
+ }, null, 8, ["show", "loading"])) : (I(), H(Mo, {
3285
+ key: 1,
3286
+ setting: V(h).state.setting,
3287
+ "onUpdate:setting": A[4] || (A[4] = (g) => V(h).state.setting = g),
3288
+ nsLocations: i.value,
3289
+ "onUpdate:nsLocations": A[5] || (A[5] = (g) => i.value = g),
3290
+ show: t.value,
3291
+ "onUpdate:show": [
3292
+ A[6] || (A[6] = (g) => t.value = g),
3293
+ A[7] || (A[7] = (g) => t.value = g)
3294
+ ],
3295
+ loading: d.value,
3296
+ "onUpdate:loading": A[8] || (A[8] = (g) => d.value = g)
3297
+ }, null, 8, ["setting", "nsLocations", "show", "loading"]))
3298
+ ])) : j("", !0)
3299
+ ], 64)) : j("", !0);
3300
+ };
3301
+ }
3302
+ }), Se = [
3303
+ "store",
3304
+ "issueBy",
3305
+ "verifiedBy",
3306
+ "stockTakeId",
3307
+ "date",
3308
+ "status",
3309
+ "c_field",
3310
+ "itemCode",
3311
+ "itemName",
3312
+ "physicalQty",
3313
+ "ohQty",
3314
+ "customCost",
3315
+ "totalPhysicalCustomCost",
3316
+ "schemeFranchiseePrice",
3317
+ "physicalSchemeTotalFranchiseePrice"
3318
+ ];
3319
+ async function Yo(_, h, o) {
3320
+ var i;
3321
+ const d = await Qo(o), t = [], s = {};
3322
+ for (const n in d) {
3323
+ const f = d[n];
3324
+ for (let A = 0; A < f.length; A++) {
3325
+ const m = f[A], a = m.itemCode, g = m.itemName, x = m.physicalQty, S = m.customCost;
3326
+ if (a === "" || a === "undefined") {
3327
+ t.push({
3328
+ row: m.excelRow,
3329
+ itemCode: a,
3330
+ itemName: g,
3331
+ message: "Item code is empty or undefined"
3332
+ });
3333
+ continue;
3334
+ }
3335
+ const B = h.find((p) => p.code === a);
3336
+ if (!B) {
3337
+ t.push({
3338
+ row: m.excelRow,
3339
+ itemCode: a,
3340
+ itemName: g,
3341
+ qty: x,
3342
+ message: "Item not found in inventory"
3343
+ }), console.error(`${m.excelRow} Item not found: ${a} ${g} ${x}`);
3344
+ continue;
3345
+ }
3346
+ let c = Number(m.totalPhysicalCustomCost);
3347
+ const e = _[B._id];
3348
+ e && (c = e * Number(x));
3349
+ const v = te.fromNumber(Number(x)), w = {
3350
+ amount: v,
3351
+ cost: {
3352
+ ...te.fromNumber(Number(c)),
3353
+ currency: "MYR"
3354
+ }
3355
+ };
3356
+ x != "0" && S == "0" && console.warn(`Item ${a} ${g} has 0 cost.`), s[i = B._id] ?? (s[i] = {
3357
+ skuAdjustment: {
3358
+ sku: B,
3359
+ fromBalance: te.fromNumber(0),
3360
+ amounts: [
3361
+ {
3362
+ _id: null,
3363
+ type: Ce.Enum.CLOSING,
3364
+ remark: "Opening Balance",
3365
+ amount: v,
3366
+ measurement: null,
3367
+ // always the smallest unit
3368
+ cost: w.cost
3369
+ }
3370
+ ],
3371
+ toBalance: v,
3372
+ toCostBalances: [w]
3373
+ },
3374
+ skuBalance: {
3375
+ id: B._id,
3376
+ balance: v,
3377
+ costs: [w]
3378
+ }
3379
+ });
3380
+ }
3381
+ }
3382
+ return {
3383
+ errors: t,
3384
+ rows: s
3385
+ };
3386
+ }
3387
+ async function Qo(_) {
3388
+ const h = await new Promise((s, i) => {
3389
+ const n = new FileReader();
3390
+ n.onload = (f) => s(f.target.result), n.onerror = i, n.readAsArrayBuffer(_);
3391
+ }), o = Oe(h, { type: "array" }), d = o.SheetNames, t = {};
3392
+ for (const s of d) {
3393
+ const i = await Po(o.Sheets[s]);
3394
+ t[s] = i;
3395
+ }
3396
+ return t;
3397
+ }
3398
+ async function Po(_) {
3399
+ const h = ze.sheet_to_json(_, {
3400
+ header: Se,
3401
+ range: 12
3402
+ }), o = [];
3403
+ for (let d = 0; d < h.length; d++) {
3404
+ const t = h[d], s = {};
3405
+ for (const i of Se)
3406
+ s[i] = String(t[i]).trim();
3407
+ o.push({
3408
+ ...s,
3409
+ excelRow: d + 13
3410
+ // Excel rows start from 1, and we skip the first 12 rows
3411
+ });
3412
+ }
3413
+ return o;
3414
+ }
3415
+ const Jo = { class: "flex flex-col gap-4" }, Ko = { class: "flex flex-col" }, qo = {
3416
+ key: 0,
3417
+ class: "flex flex-col gap-4 my-5"
3418
+ }, Go = { class: "flex flex-col gap-8" }, Zo = { class: "flex flex-col gap-8" }, Wo = {
3419
+ class: /* @__PURE__ */ q(["fm-corner-radius-md p-16 flex items-center gap-16"])
3420
+ }, $o = {
3421
+ class: /* @__PURE__ */ q(["fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center gap-3"])
3422
+ }, 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 = {
3423
+ key: 0,
3424
+ class: "rounded border-1 border-gray-200 p-2 flex items-center"
3425
+ }, 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 = {
3426
+ key: 1,
3427
+ class: "flex flex-col gap-2"
3428
+ }, ms = /* @__PURE__ */ Y({
3429
+ __name: "XilnexOpeningImport",
3430
+ setup(_) {
3431
+ const h = ot(), o = oe(), d = ce(), t = Ve(), s = $(), i = ne(), n = O(() => [
3432
+ {
3433
+ value: "xilnex",
3434
+ label: "Xilnex",
3435
+ subLabel: "Based on Xilnex's item cost from excel file"
3436
+ },
3437
+ ...o.isEnabled ? [
3438
+ {
3439
+ value: "netsuite",
3440
+ label: "NetSuite",
3441
+ subLabel: "Based on NetSuite's item current average cost by location. If not available, it will fallback to excel's cost",
3442
+ disabled: !o.isCurrentLocationBindedToNetSuite,
3443
+ disabledReason: "Current location is not binded to NetSuite"
3444
+ }
3445
+ ] : []
3446
+ ]), f = L(n.value[0].value), { t: A } = ve(), m = L(null), a = L(), g = L(""), x = L([]), S = L([]), B = [
3447
+ {
3448
+ id: "ingredient",
3449
+ header: () => "Ingredient",
3450
+ cell(b) {
3451
+ const C = b.row.original;
3452
+ return F("div", { class: "flex flex-col" }, [
3453
+ F("span", { class: "font-medium" }, C.skuAdjustment.sku.name),
3454
+ F("span", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, [
3455
+ C.skuAdjustment.sku.code
3456
+ ])
3457
+ ]);
3458
+ }
3459
+ },
3460
+ {
3461
+ id: "openingBalance",
3462
+ header: () => "Opening Balance",
3463
+ cell(b) {
3464
+ const C = b.row.original;
3465
+ return F("div", { class: "flex flex-col" }, [
3466
+ F(
3467
+ "span",
3468
+ { class: "font-medium" },
3469
+ te.toFormatString({
3470
+ value: C.skuAdjustment.amounts[0].amount
3471
+ })
3472
+ )
3473
+ ]);
3474
+ }
3475
+ },
3476
+ {
3477
+ id: "unit",
3478
+ header: () => "Unit",
3479
+ cell(b) {
3480
+ const C = b.row.original, D = !C.skuAdjustment.amounts[0].measurement;
3481
+ let M = C.skuAdjustment.sku.unit.name;
3482
+ if (!D) {
3483
+ const X = C.skuAdjustment.sku.unit.measurements.find(
3484
+ (T) => T.id === C.skuAdjustment.amounts[0].measurement.id
3485
+ );
3486
+ M = X ? X.name : "Error: Measurement not found";
3487
+ }
3488
+ return F("div", { class: "flex flex-col" }, [
3489
+ F("span", { class: "font-medium" }, M),
3490
+ D ? null : F("span", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, [
3491
+ `Base unit: ${C.skuAdjustment.sku.unit.name}`
3492
+ ])
3493
+ ]);
3494
+ }
3495
+ },
3496
+ {
3497
+ id: "totalCost",
3498
+ header: () => "Total Cost",
3499
+ cell(b) {
3500
+ const C = b.row.original, { currency: D, ...M } = C.skuAdjustment.amounts[0].cost ?? {
3501
+ amount: 0,
3502
+ precision: 0,
3503
+ currency: ""
3504
+ };
3505
+ return F("div", { class: "flex flex-col" }, [
3506
+ F(
3507
+ "span",
3508
+ { class: "font-medium" },
3509
+ te.toFormatString({
3510
+ value: M
3511
+ })
3512
+ )
3513
+ ]);
3514
+ }
3515
+ }
3516
+ ], c = [
3517
+ {
3518
+ accessorKey: "row",
3519
+ header: "Row"
3520
+ },
3521
+ {
3522
+ accessorKey: "itemCode",
3523
+ header: "Item Code"
3524
+ },
3525
+ {
3526
+ accessorKey: "itemName",
3527
+ header: "Item Name"
3528
+ },
3529
+ {
3530
+ accessorKey: "qty",
3531
+ header: "Quantity"
3532
+ },
3533
+ {
3534
+ accessorKey: "message",
3535
+ header: "Error Message"
3536
+ }
3537
+ ], e = L(!1);
3538
+ async function v() {
3539
+ if (m.value) {
3540
+ e.value = !0;
3541
+ try {
3542
+ let b = {};
3543
+ f.value === "netsuite" && (b = await o.getItemAverageCosts());
3544
+ const { errors: C, rows: D } = await Yo(
3545
+ b,
3546
+ d.skus,
3547
+ m.value
3548
+ );
3549
+ x.value = C, S.value = Object.values(D);
3550
+ } catch {
3551
+ s.open({
3552
+ message: "Error verifying file",
3553
+ type: "error"
3554
+ });
3555
+ } finally {
3556
+ e.value = !1;
3557
+ }
3558
+ }
3559
+ }
3560
+ async function w() {
3561
+ if (m.value) {
3562
+ e.value = !0;
3563
+ try {
3564
+ if (!l.value) {
3565
+ s.open({
3566
+ message: "Please select a date for the opening balance",
3567
+ type: "error"
3568
+ });
3569
+ return;
3570
+ }
3571
+ await t.setOpeningBalance({
3572
+ effectiveAt: l.value,
3573
+ skuAdjustments: S.value.map((b) => b.skuAdjustment),
3574
+ skuBalances: S.value.map((b) => b.skuBalance)
3575
+ }), s.open({
3576
+ message: "Opening balance imported successfully",
3577
+ type: "success"
3578
+ }), await h.fetchClosingDocumentId();
3579
+ } catch {
3580
+ s.open({
3581
+ message: "Error importing opening balance",
3582
+ type: "error"
3583
+ });
3584
+ } finally {
3585
+ e.value = !1;
3586
+ }
3587
+ }
3588
+ }
3589
+ const p = L(""), l = O({
3590
+ get() {
3591
+ return p.value;
3592
+ },
3593
+ set(b) {
3594
+ p.value = `${b}T15:59:59.999Z`;
3595
+ }
3596
+ }), u = O(() => {
3597
+ if (!p.value) return null;
3598
+ const b = new Date(p.value);
3599
+ return isNaN(b.getTime()) ? null : he(b);
3600
+ });
3601
+ return (b, C) => {
3602
+ 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");
3603
+ return I(), E("div", Jo, [
3604
+ r("div", Ko, [
3605
+ y(D, { label: "Latest closing" })
3606
+ ]),
3607
+ y(M, {
3608
+ "prepend-icon": "lock_outline",
3609
+ disabled: ""
3610
+ }, {
3611
+ default: N(() => [
3612
+ K(R(V(h).state.closingDocumentId ? `${V(Te)(new Date(V(Ae)(V(h).state.closingDocumentId)))}` : "No closing found"), 1)
3613
+ ]),
3614
+ _: 1
3615
+ }),
3616
+ V(h).state.closingDocumentId ? (I(), E("div", cs, [
3617
+ C[6] || (C[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)),
3618
+ V(i)._currentLocation ? (I(), E(Q, { key: 0 }, [
3619
+ y(D, { label: "Location ID" }),
3620
+ y(M, {
3621
+ "prepend-icon": "lock_outline",
3622
+ disabled: ""
3623
+ }, {
3624
+ default: N(() => [
3625
+ K(R(V(i)._currentLocation.dbName.split("_")[1]), 1)
3626
+ ]),
3627
+ _: 1
3628
+ })
3629
+ ], 64)) : j("", !0)
3630
+ ])) : (I(), E("div", qo, [
3631
+ y(X, {
3632
+ modelValue: l.value,
3633
+ "onUpdate:modelValue": C[0] || (C[0] = (P) => l.value = P),
3634
+ label: "Last closing time"
3635
+ }, {
3636
+ "trigger-button": N(() => [
3637
+ y(M, {
3638
+ "prepend-icon": "calendar_today",
3639
+ readonly: "",
3640
+ label: "Last closing time"
3641
+ }, {
3642
+ default: N(() => [
3643
+ K(R(u.value), 1)
3644
+ ]),
3645
+ _: 1
3646
+ })
3647
+ ]),
3648
+ _: 1
3649
+ }, 8, ["modelValue"]),
3650
+ r("div", Go, [
3651
+ y(D, { label: "Stock take file" })
3652
+ ]),
3653
+ y(Me, {
3654
+ onFileUpload: C[1] || (C[1] = (P) => {
3655
+ P && (m.value = P);
3656
+ }),
3657
+ accept: ".xlsx, .xls, .csv"
3658
+ }, se({ _: 2 }, [
3659
+ m.value ? {
3660
+ name: "default",
3661
+ fn: N(({ openFileDialog: P }) => [
3662
+ r("div", Zo, [
3663
+ r("div", Wo, [
3664
+ r("div", $o, [
3665
+ r("div", es, R(m.value.name), 1),
3666
+ y(T, {
3667
+ label: V(A)("inventory.ingredient.import.replaceFile"),
3668
+ variant: "secondary",
3669
+ "prepend-icon": "autorenew",
3670
+ onClick: P
3671
+ }, null, 8, ["label", "onClick"])
3672
+ ])
3673
+ ])
3674
+ ])
3675
+ ]),
3676
+ key: "0"
3677
+ } : void 0
3678
+ ]), 1024),
3679
+ y(ue, {
3680
+ modelValue: f.value,
3681
+ "onUpdate:modelValue": C[2] || (C[2] = (P) => f.value = P),
3682
+ label: "Retrieve cost from",
3683
+ class: "my-5"
3684
+ }, {
3685
+ default: N(() => [
3686
+ (I(!0), E(Q, null, W(n.value, (P) => (I(), H(U, {
3687
+ key: P.value,
3688
+ value: P.value,
3689
+ label: P.label,
3690
+ sublabel: P.subLabel,
3691
+ disabled: P.disabled
3692
+ }, {
3693
+ label: N(() => [
3694
+ r("div", ts, [
3695
+ r("span", ns, R(P.label), 1),
3696
+ r("span", os, R(P.disabled ? P.disabledReason : P.subLabel), 1)
3697
+ ]),
3698
+ P.value === "netsuite" && V(o).currentLocationSetting ? (I(), E("div", ss, [
3699
+ y(z, {
3700
+ name: "cloud",
3701
+ color: "neutral-gray-400",
3702
+ size: "md",
3703
+ class: "mr-2",
3704
+ outline: !0
3705
+ }),
3706
+ r("div", as, [
3707
+ r("span", ls, R(V(o).currentLocationSetting.name), 1),
3708
+ r("span", is, "ID: " + R(V(o).currentLocationSetting.netSuiteId), 1),
3709
+ r("span", rs, "Subsidiary: " + R(V(o).getSubsidiaryFullName(
3710
+ V(o).currentLocationSetting.subsidiaryId
3711
+ ).fullName), 1)
3712
+ ])
3713
+ ])) : j("", !0)
3714
+ ]),
3715
+ _: 2
3716
+ }, 1032, ["value", "label", "sublabel", "disabled"]))), 128))
3717
+ ]),
3718
+ _: 1
3719
+ }, 8, ["modelValue"]),
3720
+ r("div", us, [
3721
+ y(T, {
3722
+ class: "ml-auto mt-4",
3723
+ variant: "secondary",
3724
+ "prepend-icon": "troubleshoot",
3725
+ label: "Verify",
3726
+ disabled: !m.value && !e.value,
3727
+ loading: e.value,
3728
+ onClick: v
3729
+ }, null, 8, ["disabled", "loading"])
3730
+ ]),
3731
+ m.value && S.value.length > 0 ? (I(), E(Q, { key: 0 }, [
3732
+ C[4] || (C[4] = r("h2", { class: "fm-typo-en-title-md-800 mt-8 mb-4" }, "Results", -1)),
3733
+ y(xe, {
3734
+ modelValue: a.value,
3735
+ "onUpdate:modelValue": C[3] || (C[3] = (P) => a.value = P),
3736
+ "row-data": S.value,
3737
+ "column-defs": B,
3738
+ "shrink-at": !1,
3739
+ "search-value": g.value
3740
+ }, null, 8, ["modelValue", "row-data", "search-value"])
3741
+ ], 64)) : j("", !0),
3742
+ x.value.length > 0 ? (I(), E(Q, { key: 1 }, [
3743
+ C[5] || (C[5] = r("h2", { class: "fm-typo-en-title-md-800 mt-8 mb-4 text-red-600" }, "Errors", -1)),
3744
+ y(xe, {
3745
+ "row-data": x.value,
3746
+ "column-defs": c
3747
+ }, null, 8, ["row-data"])
3748
+ ], 64)) : j("", !0),
3749
+ r("div", ds, [
3750
+ S.value.length > 0 && !V(h).state.closingDocumentId ? (I(), H(T, {
3751
+ key: 0,
3752
+ class: "ml-auto mt-4",
3753
+ "prepend-icon": "file_upload",
3754
+ variant: "primary",
3755
+ label: "Import Opening Balance",
3756
+ disabled: !m.value || e.value,
3757
+ onClick: w
3758
+ }, null, 8, ["disabled"])) : j("", !0)
3759
+ ])
3760
+ ]))
3761
+ ]);
3762
+ };
3763
+ }
3764
+ }), 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 = {
3765
+ key: 1,
3766
+ class: "flex flex-col gap-8 w-full"
3767
+ }, bs = { key: 1 }, hs = { class: "flex gap-8 items-center justify-start" }, xs = /* @__PURE__ */ Y({
3768
+ __name: "XilnexSideSheet",
3769
+ props: {
3770
+ show: { type: Boolean },
3771
+ loading: { type: Boolean }
3772
+ },
3773
+ emits: ["update:show"],
3774
+ setup(_, { emit: h }) {
3775
+ var a;
3776
+ const o = le(), t = re(_, "show"), { t: s } = ee(), i = h, n = ne(), f = ((a = n._currentLocation) == null ? void 0 : a.type) || "", A = [
3777
+ { label: me(
3778
+ "openingBalance"
3779
+ /* OPENING_BALANCE */
3780
+ ) },
3781
+ { label: me(
3782
+ "transferNote"
3783
+ /* TRANSFER_NOTE */
3784
+ ) }
3785
+ ], m = L(A[0]);
3786
+ return (g, x) => {
3787
+ var v;
3788
+ const S = k("FmIcon"), B = k("FmButtonGroup"), c = k("FmButton"), e = k("FmSideSheet");
3789
+ return I(), H(e, {
3790
+ modelValue: V(t),
3791
+ "onUpdate:modelValue": x[2] || (x[2] = (w) => ie(t) ? t.value = w : null),
3792
+ header: "Data migration (Xilnex)",
3793
+ "dismiss-away": "",
3794
+ "close-button": "",
3795
+ "max-width": 800
3796
+ }, se({
3797
+ default: N(() => {
3798
+ var w;
3799
+ return [
3800
+ (w = V(o).sessionUser.value) != null && w.role.isAdmin ? (I(), E("div", As, [
3801
+ m.value.label === V(me)(
3802
+ "openingBalance"
3803
+ /* OPENING_BALANCE */
3804
+ ) ? (I(), H(ms, { key: 0 })) : j("", !0),
3805
+ m.value.label === V(me)(
3806
+ "transferNote"
3807
+ /* TRANSFER_NOTE */
3808
+ ) ? (I(), E("div", bs, " Not available yet. ")) : j("", !0)
3809
+ ])) : (I(), E("div", ys, " Please contact your administrator to apply the changes. "))
3810
+ ];
3811
+ }),
3812
+ "side-sheet-footer": N(() => [
3813
+ r("div", hs, [
3814
+ y(c, {
3815
+ variant: "tertiary",
3816
+ label: V(s)("common.close"),
3817
+ onClick: x[1] || (x[1] = (w) => i("update:show", !1))
3818
+ }, null, 8, ["label"])
3819
+ ])
3820
+ ]),
3821
+ _: 2
3822
+ }, [
3823
+ (v = V(o).sessionUser.value) != null && v.role.isAdmin ? {
3824
+ name: "side-sheet-header",
3825
+ fn: N(() => {
3826
+ var w;
3827
+ return [
3828
+ r("div", fs, [
3829
+ r("div", ps, [
3830
+ x[3] || (x[3] = r("div", { class: "fm-typo-en-title-md-600" }, "Data migration (Xilnex)", -1)),
3831
+ r("div", vs, [
3832
+ y(S, {
3833
+ name: V(f),
3834
+ size: "sm"
3835
+ }, null, 8, ["name"]),
3836
+ r("div", gs, R((w = V(n)._currentLocation) == null ? void 0 : w.name), 1)
3837
+ ])
3838
+ ]),
3839
+ y(B, {
3840
+ modelValue: m.value,
3841
+ "onUpdate:modelValue": x[0] || (x[0] = (p) => m.value = p),
3842
+ items: A
3843
+ }, null, 8, ["modelValue"])
3844
+ ])
3845
+ ];
3846
+ }),
3847
+ key: "0"
3848
+ } : void 0
3849
+ ]), 1032, ["modelValue"]);
3850
+ };
3851
+ }
3852
+ }), Is = /* @__PURE__ */ Y({
3853
+ __name: "XilnexView",
3854
+ setup(_) {
3855
+ const h = Re(), o = ne(), d = L(!1);
3856
+ async function t() {
3857
+ d.value = !0, console.log("Opening Xilnex migration dialog");
3858
+ }
3859
+ return (s, i) => {
3860
+ const n = k("FmCardSection"), f = k("FmCard");
3861
+ return V(h).enabledXilnexOpeningMigration && !V(o).businessLevel ? (I(), E(Q, { key: 0 }, [
3862
+ y(f, {
3863
+ class: q({
3864
+ "w-full": !0,
3865
+ border: !0,
3866
+ "border-fm-color-neutral-gray-100": !0,
3867
+ "cursor-pointer": !0,
3868
+ "hover:border-fm-color-primary": !0
3869
+ }),
3870
+ onClick: i[0] || (i[0] = (A) => t())
3871
+ }, {
3872
+ default: N(() => [
3873
+ y(n, null, {
3874
+ default: N(() => i[2] || (i[2] = [
3875
+ r("div", { class: "flex justify-center" }, [
3876
+ r("div", { class: "size-[100px] bg-gray-200 rounded-lg flex items-center justify-center" }, [
3877
+ r("span", { class: "text-lg font-bold text-gray-600" }, "Xilnex")
3878
+ ])
3879
+ ], -1),
3880
+ r("div", { class: "flex flex-col items-center gap-2" }, [
3881
+ r("div", { class: "text-lg font-bold" }, "Xilnex"),
3882
+ r("div", { class: "text-fm-color-neutral-gray-300" }, "Data migration from Xilnex")
3883
+ ], -1)
3884
+ ])),
3885
+ _: 1
3886
+ })
3887
+ ]),
3888
+ _: 1
3889
+ }),
3890
+ (I(), H(fe, { to: "body" }, [
3891
+ y(xs, {
3892
+ show: d.value,
3893
+ "onUpdate:show": i[1] || (i[1] = (A) => d.value = A)
3894
+ }, null, 8, ["show"])
3895
+ ]))
3896
+ ], 64)) : j("", !0);
3897
+ };
3898
+ }
3899
+ }), we = [
3900
+ "bin",
3901
+ "group",
3902
+ "code",
3903
+ "description",
3904
+ "unitcost",
3905
+ "convertUom",
3906
+ "quantity",
3907
+ "total"
3908
+ ];
3909
+ async function Ss(_, h, o) {
3910
+ var f;
3911
+ const d = await ws(o), t = [], s = {}, i = Object.keys(d)[0], n = d[i];
3912
+ for (let A = 0; A < n.length; A++) {
3913
+ const m = n[A], a = m.code, g = m.description, x = m.quantity, S = m.unitcost;
3914
+ if (a === "" || a === "undefined") {
3915
+ t.push({
3916
+ row: m.excelRow,
3917
+ itemCode: a,
3918
+ itemName: g,
3919
+ message: "Item code is empty or undefined"
3920
+ });
3921
+ continue;
3922
+ }
3923
+ const B = h.find((p) => p.code === a);
3924
+ if (!B) {
3925
+ t.push({
3926
+ row: m.excelRow,
3927
+ itemCode: a,
3928
+ itemName: g,
3929
+ qty: x,
3930
+ message: "Item not found in inventory"
3931
+ }), console.error(`${m.excelRow} Item not found: ${a} ${g} ${x}`);
3932
+ continue;
3933
+ }
3934
+ let c = Number(m.total);
3935
+ const e = _[B._id];
3936
+ e && (c = e * Number(x));
3937
+ const v = te.fromNumber(Number(x)), w = {
3938
+ amount: v,
3939
+ cost: {
3940
+ ...te.fromNumber(Number(c)),
3941
+ currency: "MYR"
3942
+ }
3943
+ };
3944
+ x != "0" && S == "0" && console.warn(`Item ${a} ${g} has 0 cost.`), s[f = B._id] ?? (s[f] = {
3945
+ skuAdjustment: {
3946
+ sku: B,
3947
+ fromBalance: te.fromNumber(0),
3948
+ amounts: [
3949
+ {
3950
+ _id: null,
3951
+ type: Ce.Enum.CLOSING,
3952
+ remark: "Opening Balance",
3953
+ amount: v,
3954
+ measurement: null,
3955
+ // always the smallest unit
3956
+ cost: w.cost
3957
+ }
3958
+ ],
3959
+ toBalance: v,
3960
+ toCostBalances: [w]
3961
+ },
3962
+ skuBalance: {
3963
+ id: B._id,
3964
+ balance: v,
3965
+ costs: [w]
3966
+ }
3967
+ });
3968
+ }
3969
+ return {
3970
+ errors: t,
3971
+ rows: s
3972
+ };
3973
+ }
3974
+ async function ws(_) {
3975
+ const h = await new Promise((s, i) => {
3976
+ const n = new FileReader();
3977
+ n.onload = (f) => s(f.target.result), n.onerror = i, n.readAsArrayBuffer(_);
3978
+ }), o = Oe(h, { type: "array" }), d = o.SheetNames, t = {};
3979
+ for (const s of d) {
3980
+ const i = await ks(o.Sheets[s]);
3981
+ t[s] = i;
3982
+ }
3983
+ return t;
3984
+ }
3985
+ async function ks(_) {
3986
+ const h = ze.sheet_to_json(_, {
3987
+ header: we,
3988
+ range: 1
3989
+ }), o = [];
3990
+ for (let d = 0; d < h.length; d++) {
3991
+ const t = h[d], s = {};
3992
+ for (const i of we)
3993
+ s[i] = String(t[i]).trim();
3994
+ o.push({
3995
+ ...s,
3996
+ excelRow: d + 2
3997
+ // Excel rows start from 1, and we skip the first row
3998
+ });
3999
+ }
4000
+ return o;
4001
+ }
4002
+ const Fs = { class: "flex flex-col gap-4" }, Bs = { class: "flex flex-col" }, Cs = {
4003
+ key: 0,
4004
+ class: "flex flex-col gap-4 my-5"
4005
+ }, Vs = { class: "flex flex-col gap-8" }, _s = { class: "flex flex-col gap-8" }, Es = {
4006
+ class: /* @__PURE__ */ q(["fm-corner-radius-md p-16 flex items-center gap-16"])
4007
+ }, Ns = {
4008
+ class: /* @__PURE__ */ q(["fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center gap-3"])
4009
+ }, 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({
4010
+ __name: "SynergyOpeningImport",
4011
+ setup(_) {
4012
+ const h = st(), o = ce(), d = Ve(), t = $(), s = O(() => [
4013
+ {
4014
+ value: "synergy",
4015
+ label: "Synergy",
4016
+ subLabel: "Based on Synergy's item cost from excel file"
4017
+ }
4018
+ ]), i = L(s.value[0].value), { t: n } = ve(), f = L(null), A = L(), m = L(""), a = L([]), g = L([]), x = [
4019
+ {
4020
+ id: "ingredient",
4021
+ header: () => "Ingredient",
4022
+ cell(l) {
4023
+ const u = l.row.original;
4024
+ return F("div", { class: "flex flex-col" }, [
4025
+ F("span", { class: "font-medium" }, u.skuAdjustment.sku.name),
4026
+ F("span", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, [
4027
+ u.skuAdjustment.sku.code
4028
+ ])
4029
+ ]);
4030
+ }
4031
+ },
4032
+ {
4033
+ id: "openingBalance",
4034
+ header: () => "Opening Balance",
4035
+ cell(l) {
4036
+ const u = l.row.original;
4037
+ return F("div", { class: "flex flex-col" }, [
4038
+ F(
4039
+ "span",
4040
+ { class: "font-medium" },
4041
+ te.toFormatString({
4042
+ value: u.skuAdjustment.amounts[0].amount
4043
+ })
4044
+ )
4045
+ ]);
4046
+ }
4047
+ },
4048
+ {
4049
+ id: "unit",
4050
+ header: () => "Unit",
4051
+ cell(l) {
4052
+ const u = l.row.original, b = !u.skuAdjustment.amounts[0].measurement;
4053
+ let C = u.skuAdjustment.sku.unit.name;
4054
+ if (!b) {
4055
+ const D = u.skuAdjustment.sku.unit.measurements.find(
4056
+ (M) => M.id === u.skuAdjustment.amounts[0].measurement.id
4057
+ );
4058
+ C = D ? D.name : "Error: Measurement not found";
4059
+ }
4060
+ return F("div", { class: "flex flex-col" }, [
4061
+ F("span", { class: "font-medium" }, C),
4062
+ b ? null : F("span", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, [
4063
+ `Base unit: ${u.skuAdjustment.sku.unit.name}`
4064
+ ])
4065
+ ]);
4066
+ }
4067
+ },
4068
+ {
4069
+ id: "totalCost",
4070
+ header: () => "Total Cost",
4071
+ cell(l) {
4072
+ const u = l.row.original, { currency: b, ...C } = u.skuAdjustment.amounts[0].cost ?? {
4073
+ amount: 0,
4074
+ precision: 0,
4075
+ currency: ""
4076
+ };
4077
+ return F("div", { class: "flex flex-col" }, [
4078
+ F(
4079
+ "span",
4080
+ { class: "font-medium" },
4081
+ te.toFormatString({
4082
+ value: C
4083
+ })
4084
+ )
4085
+ ]);
4086
+ }
4087
+ }
4088
+ ], S = [
4089
+ {
4090
+ accessorKey: "row",
4091
+ header: "Row"
4092
+ },
4093
+ {
4094
+ accessorKey: "itemCode",
4095
+ header: "Item Code"
4096
+ },
4097
+ {
4098
+ accessorKey: "itemName",
4099
+ header: "Item Name"
4100
+ },
4101
+ {
4102
+ accessorKey: "qty",
4103
+ header: "Quantity"
4104
+ },
4105
+ {
4106
+ accessorKey: "message",
4107
+ header: "Error Message"
4108
+ }
4109
+ ], B = L(!1);
4110
+ async function c() {
4111
+ if (f.value) {
4112
+ B.value = !0;
4113
+ try {
4114
+ let l = {};
4115
+ const { errors: u, rows: b } = await Ss(
4116
+ l,
4117
+ o.skus,
4118
+ f.value
4119
+ );
4120
+ a.value = u, g.value = Object.values(b);
4121
+ } catch {
4122
+ t.open({
4123
+ message: "Error verifying file",
4124
+ type: "error"
4125
+ });
4126
+ } finally {
4127
+ B.value = !1;
4128
+ }
4129
+ }
4130
+ }
4131
+ async function e() {
4132
+ if (f.value) {
4133
+ B.value = !0;
4134
+ try {
4135
+ if (!w.value) {
4136
+ t.open({
4137
+ message: "Please select a date for the opening balance",
4138
+ type: "error"
4139
+ });
4140
+ return;
4141
+ }
4142
+ await d.setOpeningBalance({
4143
+ effectiveAt: w.value,
4144
+ skuAdjustments: g.value.map((l) => l.skuAdjustment),
4145
+ skuBalances: g.value.map((l) => l.skuBalance)
4146
+ }), t.open({
4147
+ message: "Opening balance imported successfully",
4148
+ type: "success"
4149
+ }), await h.fetchClosingDocumentId();
4150
+ } catch {
4151
+ t.open({
4152
+ message: "Error importing opening balance",
4153
+ type: "error"
4154
+ });
4155
+ } finally {
4156
+ B.value = !1;
4157
+ }
4158
+ }
4159
+ }
4160
+ const v = L(""), w = O({
4161
+ get() {
4162
+ return v.value;
4163
+ },
4164
+ set(l) {
4165
+ v.value = `${l}T15:59:59.999Z`;
4166
+ }
4167
+ }), p = O(() => {
4168
+ if (!v.value) return null;
4169
+ const l = new Date(v.value);
4170
+ return isNaN(l.getTime()) ? null : he(l);
4171
+ });
4172
+ return (l, u) => {
4173
+ const b = k("FmLabel"), C = k("FmField"), D = k("FmSimpleDatePicker"), M = k("FmButton"), X = k("FmRadio"), T = k("FmRadioGroup"), z = k("FmTable");
4174
+ return I(), E("div", Fs, [
4175
+ r("div", Bs, [
4176
+ y(b, { label: "Latest closing" })
4177
+ ]),
4178
+ y(C, {
4179
+ "prepend-icon": "lock_outline",
4180
+ disabled: ""
4181
+ }, {
4182
+ default: N(() => [
4183
+ K(R(V(h).state.closingDocumentId ? `${V(Te)(new Date(V(Ae)(V(h).state.closingDocumentId)))}` : "No closing found"), 1)
4184
+ ]),
4185
+ _: 1
4186
+ }),
4187
+ V(h).state.closingDocumentId ? (I(), E("div", zs, u[6] || (u[6] = [
4188
+ 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)
4189
+ ]))) : (I(), E("div", Cs, [
4190
+ y(D, {
4191
+ modelValue: w.value,
4192
+ "onUpdate:modelValue": u[0] || (u[0] = (U) => w.value = U),
4193
+ label: "Last closing time"
4194
+ }, {
4195
+ "trigger-button": N(() => [
4196
+ y(C, {
4197
+ "prepend-icon": "calendar_today",
4198
+ readonly: "",
4199
+ label: "Last closing time"
4200
+ }, {
4201
+ default: N(() => [
4202
+ K(R(p.value), 1)
4203
+ ]),
4204
+ _: 1
4205
+ })
4206
+ ]),
4207
+ _: 1
4208
+ }, 8, ["modelValue"]),
4209
+ r("div", Vs, [
4210
+ y(b, { label: "Stock take file" })
4211
+ ]),
4212
+ y(Me, {
4213
+ onFileUpload: u[1] || (u[1] = (U) => {
4214
+ U && (f.value = U);
4215
+ }),
4216
+ accept: ".xlsx, .xls, .csv"
4217
+ }, se({ _: 2 }, [
4218
+ f.value ? {
4219
+ name: "default",
4220
+ fn: N(({ openFileDialog: U }) => [
4221
+ r("div", _s, [
4222
+ r("div", Es, [
4223
+ r("div", Ns, [
4224
+ r("div", Ls, R(f.value.name), 1),
4225
+ y(M, {
4226
+ label: V(n)("inventory.ingredient.import.replaceFile"),
4227
+ variant: "secondary",
4228
+ "prepend-icon": "autorenew",
4229
+ onClick: U
4230
+ }, null, 8, ["label", "onClick"])
4231
+ ])
4232
+ ])
4233
+ ])
4234
+ ]),
4235
+ key: "0"
4236
+ } : void 0
4237
+ ]), 1024),
4238
+ y(T, {
4239
+ modelValue: i.value,
4240
+ "onUpdate:modelValue": u[2] || (u[2] = (U) => i.value = U),
4241
+ label: "Retrieve cost from",
4242
+ class: "my-5"
4243
+ }, {
4244
+ default: N(() => [
4245
+ (I(!0), E(Q, null, W(s.value, (U) => (I(), H(X, {
4246
+ key: U.value,
4247
+ value: U.value,
4248
+ label: U.label,
4249
+ sublabel: U.subLabel,
4250
+ disabled: U.disabled
4251
+ }, {
4252
+ label: N(() => [
4253
+ r("div", Ds, [
4254
+ r("span", Ts, R(U.label), 1),
4255
+ r("span", Rs, R(U.disabled ? U.disabledReason : U.subLabel), 1)
4256
+ ])
4257
+ ]),
4258
+ _: 2
4259
+ }, 1032, ["value", "label", "sublabel", "disabled"]))), 128))
4260
+ ]),
4261
+ _: 1
4262
+ }, 8, ["modelValue"]),
4263
+ r("div", Ms, [
4264
+ y(M, {
4265
+ class: "ml-auto mt-4",
4266
+ variant: "secondary",
4267
+ "prepend-icon": "troubleshoot",
4268
+ label: "Verify",
4269
+ disabled: !f.value && !B.value,
4270
+ loading: B.value,
4271
+ onClick: c
4272
+ }, null, 8, ["disabled", "loading"])
4273
+ ]),
4274
+ f.value && g.value.length > 0 ? (I(), E(Q, { key: 0 }, [
4275
+ u[4] || (u[4] = r("h2", { class: "fm-typo-en-title-md-800 mt-8 mb-4" }, "Results", -1)),
4276
+ y(z, {
4277
+ modelValue: A.value,
4278
+ "onUpdate:modelValue": u[3] || (u[3] = (U) => A.value = U),
4279
+ "row-data": g.value,
4280
+ "column-defs": x,
4281
+ "shrink-at": !1,
4282
+ "search-value": m.value
4283
+ }, null, 8, ["modelValue", "row-data", "search-value"])
4284
+ ], 64)) : j("", !0),
4285
+ a.value.length > 0 ? (I(), E(Q, { key: 1 }, [
4286
+ u[5] || (u[5] = r("h2", { class: "fm-typo-en-title-md-800 mt-8 mb-4 text-red-600" }, "Errors", -1)),
4287
+ y(z, {
4288
+ "row-data": a.value,
4289
+ "column-defs": S
4290
+ }, null, 8, ["row-data"])
4291
+ ], 64)) : j("", !0),
4292
+ r("div", Os, [
4293
+ g.value.length > 0 && !V(h).state.closingDocumentId ? (I(), H(M, {
4294
+ key: 0,
4295
+ class: "ml-auto mt-4",
4296
+ "prepend-icon": "file_upload",
4297
+ variant: "primary",
4298
+ label: "Import Opening Balance",
4299
+ disabled: !f.value || B.value,
4300
+ onClick: e
4301
+ }, null, 8, ["disabled"])) : j("", !0)
4302
+ ])
4303
+ ]))
4304
+ ]);
4305
+ };
4306
+ }
4307
+ }), 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 = {
4308
+ key: 1,
4309
+ class: "flex flex-col gap-8 w-full"
4310
+ }, Js = { class: "flex gap-8 items-center justify-start" }, Ks = /* @__PURE__ */ Y({
4311
+ __name: "SynergySideSheet",
4312
+ props: {
4313
+ show: { type: Boolean },
4314
+ loading: { type: Boolean }
4315
+ },
4316
+ emits: ["update:show"],
4317
+ setup(_, { emit: h }) {
4318
+ var A;
4319
+ const o = le(), t = re(_, "show"), { t: s } = ee(), i = h, n = ne(), f = ((A = n._currentLocation) == null ? void 0 : A.type) || "";
4320
+ return (m, a) => {
4321
+ var B;
4322
+ const g = k("FmIcon"), x = k("FmButton"), S = k("FmSideSheet");
4323
+ return I(), H(S, {
4324
+ modelValue: V(t),
4325
+ "onUpdate:modelValue": a[1] || (a[1] = (c) => ie(t) ? t.value = c : null),
4326
+ header: "Data migration (Synergy)",
4327
+ "dismiss-away": "",
4328
+ "close-button": "",
4329
+ "max-width": 800
4330
+ }, se({
4331
+ default: N(() => {
4332
+ var c;
4333
+ return [
4334
+ (c = V(o).sessionUser.value) != null && c.role.isAdmin ? (I(), E("div", Ps, [
4335
+ y(js)
4336
+ ])) : (I(), E("div", Qs, " Please contact your administrator to apply the changes. "))
4337
+ ];
4338
+ }),
4339
+ "side-sheet-footer": N(() => [
4340
+ r("div", Js, [
4341
+ y(x, {
4342
+ variant: "tertiary",
4343
+ label: V(s)("common.close"),
4344
+ onClick: a[0] || (a[0] = (c) => i("update:show", !1))
4345
+ }, null, 8, ["label"])
4346
+ ])
4347
+ ]),
4348
+ _: 2
4349
+ }, [
4350
+ (B = V(o).sessionUser.value) != null && B.role.isAdmin ? {
4351
+ name: "side-sheet-header",
4352
+ fn: N(() => {
4353
+ var c;
4354
+ return [
4355
+ r("div", Us, [
4356
+ r("div", Hs, [
4357
+ a[2] || (a[2] = r("div", { class: "fm-typo-en-title-md-600" }, "Data migration (Synergy)", -1)),
4358
+ r("div", Xs, [
4359
+ y(g, {
4360
+ name: V(f),
4361
+ size: "sm"
4362
+ }, null, 8, ["name"]),
4363
+ r("div", Ys, R((c = V(n)._currentLocation) == null ? void 0 : c.name), 1)
4364
+ ])
4365
+ ])
4366
+ ])
4367
+ ];
4368
+ }),
4369
+ key: "0"
4370
+ } : void 0
4371
+ ]), 1032, ["modelValue"]);
4372
+ };
4373
+ }
4374
+ }), qs = /* @__PURE__ */ Y({
4375
+ __name: "SynergyView",
4376
+ setup(_) {
4377
+ const h = Re(), o = ne(), d = L(!1);
4378
+ async function t() {
4379
+ d.value = !0, console.log("Opening Synergy migration dialog");
4380
+ }
4381
+ return (s, i) => {
4382
+ const n = k("FmCardSection"), f = k("FmCard");
4383
+ return V(h).enabledSynergyOpeningMigration && !V(o).businessLevel ? (I(), E(Q, { key: 0 }, [
4384
+ y(f, {
4385
+ class: q({
4386
+ "w-full": !0,
4387
+ border: !0,
4388
+ "border-fm-color-neutral-gray-100": !0,
4389
+ "cursor-pointer": !0,
4390
+ "hover:border-fm-color-primary": !0
4391
+ }),
4392
+ onClick: i[0] || (i[0] = (A) => t())
4393
+ }, {
4394
+ default: N(() => [
4395
+ y(n, null, {
4396
+ default: N(() => i[2] || (i[2] = [
4397
+ r("div", { class: "flex justify-center" }, [
4398
+ r("div", { class: "size-[100px] bg-gray-200 rounded-lg flex items-center justify-center" }, [
4399
+ r("span", { class: "text-lg font-bold text-gray-600" }, "Synergy")
4400
+ ])
4401
+ ], -1),
4402
+ r("div", { class: "flex flex-col items-center gap-2" }, [
4403
+ r("div", { class: "text-lg font-bold" }, "Synergy"),
4404
+ r("div", { class: "text-fm-color-neutral-gray-300" }, "Data migration from Synergy")
4405
+ ], -1)
4406
+ ])),
4407
+ _: 1
4408
+ })
4409
+ ]),
4410
+ _: 1
4411
+ }),
4412
+ (I(), H(fe, { to: "body" }, [
4413
+ y(Ks, {
4414
+ show: d.value,
4415
+ "onUpdate:show": i[1] || (i[1] = (A) => d.value = A)
4416
+ }, null, 8, ["show"])
4417
+ ]))
4418
+ ], 64)) : j("", !0);
4419
+ };
4420
+ }
4421
+ }), Gs = { key: 0 }, Zs = {
4422
+ key: 1,
4423
+ class: "flex flex-col items-center my-10 gap-5"
4424
+ }, Ws = ["src"], $s = {
4425
+ class: "text-xs text-neutral-400 text-center",
4426
+ style: { "max-width": "25rem" }
4427
+ }, ea = {
4428
+ key: 2,
4429
+ class: "grid grid-cols-2 gap-5"
4430
+ }, ha = /* @__PURE__ */ Y({
4431
+ __name: "IntegrationView",
4432
+ setup(_) {
4433
+ const h = ne(), o = L(!1), d = at(), { breakpoints: t } = _e(), s = O(() => t.value.xs || t.value.sm), { t: i } = ee();
4434
+ return de(async () => {
4435
+ if (h._currentLocation) {
4436
+ o.value = !0;
4437
+ try {
4438
+ await d.fetchFoodMarketHubSetting(), await d.fetchNetSuiteSetting();
4439
+ } finally {
4440
+ o.value = !1;
4441
+ }
4442
+ }
4443
+ }), (n, f) => {
4444
+ const A = k("FmCircularProgress");
4445
+ return I(), H(et, {
4446
+ title: V(i)("inventory.integration.title")
4447
+ }, {
4448
+ default: N(() => [
4449
+ r("div", {
4450
+ class: q([
4451
+ "flex flex-col gap-8 max-h-full",
4452
+ {
4453
+ "p-0": s.value,
4454
+ "px-24 ": !s.value
4455
+ }
4456
+ ])
4457
+ }, [
4458
+ y(tt, {
4459
+ "change-location": "",
4460
+ showBusiness: ""
4461
+ }),
4462
+ !V(h)._currentLocation || o.value ? (I(), E("div", Gs, [
4463
+ y(A, { size: "lg" })
4464
+ ])) : V(d).enabledIntegrations == 0 ? (I(), E("div", Zs, [
4465
+ r("div", null, [
4466
+ r("img", {
4467
+ src: V(qe),
4468
+ alt: "List is empty"
4469
+ }, null, 8, Ws)
4470
+ ]),
4471
+ f[0] || (f[0] = r("div", { class: "font-bold text-lg" }, "Integration", -1)),
4472
+ r("div", $s, R(V(i)("inventory.integration.description")), 1)
4473
+ ])) : (I(), E("div", ea, [
4474
+ y(Xo),
4475
+ y(an),
4476
+ y(Is),
4477
+ y(qs)
4478
+ ]))
4479
+ ], 2)
4480
+ ]),
4481
+ _: 1
4482
+ }, 8, ["title"]);
4483
+ };
4484
+ }
4485
+ });
4486
+ export {
4487
+ ha as default
4488
+ };