@feedmepos/mf-inventory-portal 0.0.22-dev.48 → 0.0.22-dev.49

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 (49) hide show
  1. package/dist/{ApprovalView-Bq8HizIk.js → ApprovalView-_zqKZVLP.js} +3 -3
  2. package/dist/{BindingsDialog-B5B9LNjS.js → BindingsDialog-DVNvDggj.js} +1 -1
  3. package/dist/{BindingsPicker-BiiBXcfu.js → BindingsPicker-X0gHMpoC.js} +1 -1
  4. package/dist/{BindingsTable-CRUkZ1ou.js → BindingsTable-A1rulbsH.js} +1 -1
  5. package/dist/{ClosingTemplateView-DIdaXdId.js → ClosingTemplateView-C5gyaMQ6.js} +7 -7
  6. package/dist/{FmDroppableField-Bl1XIyOu.js → FmDroppableField-awnhf8Iy.js} +1 -1
  7. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CdZuOJ4V.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DUu4Lct2.js} +3 -3
  8. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CmfjbJ0t.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-By4CpWf9.js} +1 -1
  9. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BuNop0gk.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-0wL--d6P.js} +1 -1
  10. package/dist/{IngredientGroupView-DD90Fmrx.js → IngredientGroupView-D2VWxA2W.js} +3 -3
  11. package/dist/{IngredientsView-Bp4GZox8.js → IngredientsView-lAvLVm6U.js} +5 -5
  12. package/dist/IntegrationView-Bt5uM4Ob.js +1225 -0
  13. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang--RjTe01A.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B18g5kUq.js} +1 -1
  14. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DkEyqrlM.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DfjyTcqY.js} +2 -2
  15. package/dist/{PurchaseOrderPrintPreview-CjRMox7T.js → PurchaseOrderPrintPreview-QlrdWyMl.js} +1 -1
  16. package/dist/{ReceiveRequestView-DqppWyj-.js → ReceiveRequestView-0bkndBTv.js} +520 -520
  17. package/dist/{RecipeView-CHsDHwoo.js → RecipeView-BBYjB0Qi.js} +4 -4
  18. package/dist/{StockView-ACFikzri.js → StockView-_hp_aOyJ.js} +5 -5
  19. package/dist/{SupplierView-zdJEksIO.js → SupplierView-BWNuU67v.js} +5 -5
  20. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Boqgacto.js → TransferDetails.vue_vue_type_script_setup_true_lang-DieihSRc.js} +5 -5
  21. package/dist/{TransferTemplateView-BB9qQ71s.js → TransferTemplateView-BkYZthsf.js} +8 -8
  22. package/dist/{UnitView-Ta-Vt5dh.js → UnitView-BYvUDDku.js} +4 -4
  23. package/dist/{WarehouseView-DCCyFVlT.js → WarehouseView-BYivfyV4.js} +2 -2
  24. package/dist/api/netsuite.d.ts +13 -2
  25. package/dist/{app-BqLAVk-L.js → app-fxdtGGFC.js} +5130 -5079
  26. package/dist/app.d.ts +8 -0
  27. package/dist/app.js +1 -1
  28. package/dist/{decimal-D1NE-J_K.js → decimal-DFc3K2Se.js} +1 -1
  29. package/dist/{defineDeepModel-Bh0i7x-r.js → defineDeepModel-D45rDjY3.js} +1 -1
  30. package/dist/{format-time-from-id-plSsZrYn.js → format-time-from-id-Crz-gXY8.js} +1 -1
  31. package/dist/{format-unit-display-Dzdy7cNO.js → format-unit-display-BwfbuC6u.js} +5 -5
  32. package/dist/stores/integration/foodmarkethub.d.ts +391 -0
  33. package/dist/stores/integration/index.d.ts +7 -0
  34. package/dist/stores/{netsuite.d.ts → integration/netsuite.d.ts} +20 -2
  35. package/dist/{supplier-aIh1pXP3.js → supplier-0-yQ7lYD.js} +1 -1
  36. package/dist/tsconfig.app.tsbuildinfo +1 -1
  37. package/dist/{use-template-enabled-locations-2-Cpg220vD.js → use-template-enabled-locations-2-DLHLCnlP.js} +1 -1
  38. package/dist/views/integration/FoodMarketHub.vue.d.ts +2 -0
  39. package/dist/views/integration/NetSuite.vue.d.ts +2 -0
  40. package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +7 -7
  41. package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +7 -7
  42. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +2 -0
  43. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +6 -0
  44. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +9 -0
  45. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +9 -0
  46. package/dist/{xlsx-D2Zb812D.js → xlsx-4TFi1Lrp.js} +1 -1
  47. package/dist/{xlsx.util-BlUzHgYg.js → xlsx.util-DEiKUcnj.js} +1 -1
  48. package/package.json +1 -1
  49. package/dist/IntegrationView-B_f-yMDb.js +0 -1141
@@ -1,1141 +0,0 @@
1
- import { defineComponent as z, mergeModels as re, useModel as ae, onMounted as de, ref as j, computed as D, resolveComponent as I, openBlock as M, createElementBlock as A, createElementVNode as c, toDisplayString as K, unref as $, createVNode as V, createBlock as U, withCtx as N, Fragment as E, renderList as W, normalizeClass as T, normalizeStyle as ue, createSlots as ce, createCommentVNode as O, withModifiers as fe, reactive as Q, watch as X, isRef as ee, Teleport as me } from "vue";
2
- import { E as pe } from "./empty-placeholder-wf6-BWE8.js";
3
- import { ax as te, an as ve, c as q, i as ge, ay as ye } from "./app-BqLAVk-L.js";
4
- import { useDialogChild as be, useDialog as ne, useProxiedModel as oe, useSnackbar as he, useBreakpoints as _e } from "@feedmepos/ui-library";
5
- import { useI18n as R, useCoreStore as Ce } from "@feedmepos/mf-common";
6
- import { _ as xe, a as He } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CmfjbJ0t.js";
7
- const Fe = "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";
8
- function J(b, y) {
9
- return te.filter(b, y).length > 0;
10
- }
11
- function ke(b, y) {
12
- if (!b)
13
- return {
14
- label: y,
15
- segments: [
16
- {
17
- isMatch: !1,
18
- segment: y
19
- }
20
- ],
21
- matched: !1
22
- };
23
- const [s] = te.filter(b.toLocaleLowerCase(), [y], {
24
- pre: "|",
25
- post: "|"
26
- });
27
- if (!s)
28
- return {
29
- label: y,
30
- segments: [{ segment: y, isMatch: !1 }],
31
- matched: !1
32
- };
33
- const v = s.string.toString().replace(/\|\|/g, "").split("|").reduce((r, g, h) => (r.push({
34
- segment: g,
35
- isMatch: h % 2 !== 0
36
- //e.g. index 1, 3, 5, ...
37
- }), r), new Array());
38
- return {
39
- label: y,
40
- segments: v,
41
- matched: !0
42
- };
43
- }
44
- function P(b) {
45
- return Object.prototype.hasOwnProperty.call(b, "children");
46
- }
47
- const Me = { class: "flex flex-col gap-12 h-[350px]" }, $e = { class: "flex items-center" }, we = {
48
- class: "flex-1",
49
- "data-cy": "items-selected"
50
- }, Ve = {
51
- class: "flex-1",
52
- "data-cy": "filter-field"
53
- }, Se = ["data-cy"], Ae = { class: "flex flex-col" }, Be = { class: "fm-typo-en-body-md-400" }, Ie = {
54
- key: 1,
55
- class: "w-full py-16 text-fm-color-typo-disabled fm-typo-en-body-md-400 text-center"
56
- }, ie = /* @__PURE__ */ z({
57
- __name: "FmNestedMultiselectDialog",
58
- props: /* @__PURE__ */ re({
59
- modelValue: {}
60
- }, {
61
- modelValue: {},
62
- modelModifiers: {}
63
- }),
64
- emits: ["update:modelValue"],
65
- setup(b) {
66
- const y = ae(b, "modelValue"), s = be();
67
- de(() => {
68
- s.emitData(y.value);
69
- });
70
- const v = j(""), { t: r } = R();
71
- function g(e) {
72
- return J(
73
- v.value,
74
- e.sublabel ? [e.label, e.sublabel] : [e.label]
75
- );
76
- }
77
- function h(e) {
78
- return g(e) ? !0 : P(e) ? e.children.some(h) : !1;
79
- }
80
- function S(e, i) {
81
- if (!v.value)
82
- return !0;
83
- const [l, ...F] = e;
84
- if (typeof l != "number")
85
- return !1;
86
- const u = i[l];
87
- return J(
88
- v.value,
89
- u.sublabel ? [u.label, u.sublabel] : [u.label]
90
- ) ? !0 : F.length === 0 ? h(u) : P(u) ? S(F, u.children) : !1;
91
- }
92
- function B(e, i, l = 0, F = !1) {
93
- if (P(e) && e.children.length) {
94
- const { children: u, ...L } = e, Z = u.flatMap(
95
- (k, G) => B(k, [...i, G], l + 1, F || e.disabled)
96
- );
97
- return [
98
- {
99
- ...L,
100
- keys: i,
101
- indent: l,
102
- collapsible: !0,
103
- disabled: F || e.disabled
104
- },
105
- ...Z
106
- ];
107
- }
108
- return [
109
- {
110
- ...e,
111
- keys: i,
112
- indent: l,
113
- collapsible: !1,
114
- disabled: F || e.disabled
115
- }
116
- ];
117
- }
118
- const w = D(() => y.value.flatMap(
119
- (e, i) => B(e, [i]).filter((l) => S(l.keys, y.value))
120
- ));
121
- function H(e) {
122
- if (P(e)) {
123
- if (h(e)) {
124
- const i = g(e) ? e.children : e.children.filter(h);
125
- return i.length === 0 ? !1 : i.every(H);
126
- }
127
- return e.children.every(H);
128
- }
129
- return e.active ?? !1;
130
- }
131
- function f(e, i) {
132
- const [l, ...F] = e;
133
- if (typeof l != "number")
134
- return !1;
135
- const u = i[l];
136
- return F.length === 0 ? H(u ?? []) : P(u) ? f(F, u.children ?? []) : !1;
137
- }
138
- function _(e) {
139
- if (P(e)) {
140
- if (h(e)) {
141
- const i = g(e) ? e.children : e.children.filter(h);
142
- return i.length === 0 ? !1 : i.some(H) && !i.every(H);
143
- }
144
- return !1;
145
- }
146
- return !1;
147
- }
148
- function m(e, i) {
149
- const [l, ...F] = e;
150
- if (typeof l != "number")
151
- return !1;
152
- const u = i[l];
153
- return F.length === 0 ? _(u ?? []) : P(u) ? m(F, (u == null ? void 0 : u.children) ?? []) : !1;
154
- }
155
- function C(e, i) {
156
- if (e.disabled)
157
- return e;
158
- if (P(e)) {
159
- if (h(e)) {
160
- const l = g(e) ? e.children : e.children.filter(h);
161
- return {
162
- ...e,
163
- children: e.children.map((F) => l.find((L) => ve(L.value, F.value)) ? C(F, i) : F)
164
- };
165
- }
166
- return {
167
- ...e,
168
- children: e.children.map((l) => C(l, i))
169
- };
170
- }
171
- return {
172
- ...e,
173
- active: i
174
- };
175
- }
176
- function x(e, i, l) {
177
- const [F, ...u] = e;
178
- return typeof F != "number" ? i : u.length === 0 ? i.map((L, Z) => F !== Z ? L : C(L, l)) : i.map(
179
- (L, Z) => F === Z && P(L) ? {
180
- ...L,
181
- children: x(u, L.children, l)
182
- } : L
183
- );
184
- }
185
- const o = j(new Array());
186
- function t(e) {
187
- const i = e.join();
188
- return o.value.find((l) => i === l);
189
- }
190
- function n(e) {
191
- const i = e.join();
192
- t(e) ? o.value = o.value.filter((l) => l !== i) : o.value = [...o.value, i];
193
- }
194
- function a(e) {
195
- const i = e.join();
196
- return o.value.find((l) => i.startsWith(l) && i !== l);
197
- }
198
- const p = D(
199
- () => w.value.filter((e) => S(e.keys, y.value) && e.active).length
200
- );
201
- function d(e, i, l) {
202
- y.value = x(e, i, l), s.emitData(y.value);
203
- }
204
- return (e, i) => {
205
- const l = I("FmSearch"), F = I("FmCheckbox"), u = I("FmButton"), L = I("FmListItem"), Z = I("FmList");
206
- return M(), A("div", Me, [
207
- c("div", $e, [
208
- c("div", we, K($(r)("inventory.formField.itemsSelected", { count: p.value })), 1),
209
- c("div", Ve, [
210
- V(l, {
211
- modelValue: v.value,
212
- "onUpdate:modelValue": i[0] || (i[0] = (k) => v.value = k),
213
- placeholder: $(r)("inventory.formField.filterItems")
214
- }, null, 8, ["modelValue", "placeholder"])
215
- ])
216
- ]),
217
- w.value.length ? (M(), U(Z, {
218
- key: 0,
219
- class: "flex-1 overflow-y-auto"
220
- }, {
221
- default: N(() => [
222
- (M(!0), A(E, null, W(w.value, (k) => (M(), A("div", {
223
- key: k.keys.join(),
224
- class: T([
225
- "transition-all overflow-y-clip",
226
- a(k.keys) ? "max-h-0 opacity-0" : "max-h-[50px] opacity-100"
227
- ]),
228
- "data-cy": `nested-${k.keys.join("-")}-${k.label}`
229
- }, [
230
- V(L, {
231
- clickable: k.selectable !== !1,
232
- onClick: () => k.selectable === !1 || k.disabled || d(k.keys, y.value, !f(k.keys, y.value)),
233
- style: ue({
234
- paddingLeft: `${16 + k.indent * 16}px`,
235
- paddingTop: "4px",
236
- paddingBottom: "4px"
237
- }),
238
- disabled: k.selectable !== !1 && k.disabled
239
- }, ce({
240
- default: N(() => [
241
- c("div", Ae, [
242
- c("div", Be, [
243
- (M(!0), A(E, null, W($(ke)(v.value, k.label).segments, (G, le) => (M(), A("span", {
244
- key: le,
245
- class: T({
246
- "font-bold": G.isMatch
247
- })
248
- }, K(G.segment), 3))), 128))
249
- ]),
250
- k.sublabel ? (M(), A("div", {
251
- key: 0,
252
- class: T([
253
- "fm-typo-en-body-sm-400",
254
- k.disabled ? "" : "text-fm-color-typo-secondary"
255
- ])
256
- }, K(k.sublabel), 3)) : O("", !0)
257
- ])
258
- ]),
259
- _: 2
260
- }, [
261
- k.selectable !== !1 ? {
262
- name: "prepend",
263
- fn: N(() => [
264
- V(F, {
265
- disabled: k.disabled,
266
- "model-value": f(k.keys, y.value),
267
- value: k.keys,
268
- indeterminate: m(k.keys, y.value)
269
- }, null, 8, ["disabled", "model-value", "value", "indeterminate"])
270
- ]),
271
- key: "0"
272
- } : void 0,
273
- k.collapsible ? {
274
- name: "append",
275
- fn: N(() => [
276
- V(u, {
277
- "prepend-icon": t(k.keys) ? "expand_less" : "expand_more",
278
- size: "md",
279
- variant: "tertiary",
280
- onClick: fe(() => n(k.keys), ["stop"])
281
- }, null, 8, ["prepend-icon", "onClick"])
282
- ]),
283
- key: "1"
284
- } : void 0
285
- ]), 1032, ["clickable", "onClick", "style", "disabled"])
286
- ], 10, Se))), 128))
287
- ]),
288
- _: 1
289
- })) : (M(), A("div", Ie, K($(r)("inventory.formField.noItemsFound")), 1))
290
- ]);
291
- };
292
- }
293
- }), Le = { class: "flex flex-col rounded border border-fm-color-neutral-gray-100 px-5 py-5 gap-5" }, Ke = { class: "flex items-center" }, De = { class: "text-lg font-bold flex-grow" }, Ze = {
294
- key: 0,
295
- class: "table-auto w-full"
296
- }, Ne = { class: "text-left" }, Pe = { class: "min-w-64" }, je = { class: "flex flex-col" }, Ue = { class: "fm-typo-en-body-md-400" }, qe = {
297
- key: 0,
298
- class: "fm-typo-en-body-sm-400 text-fm-color-neutral-gray-400"
299
- }, Ee = { class: "w-1" }, Oe = /* @__PURE__ */ z({
300
- __name: "ApplyAddon",
301
- props: {
302
- groups: {
303
- type: Array,
304
- required: !0
305
- },
306
- modifiers: {
307
- type: Array,
308
- required: !0
309
- },
310
- items: {
311
- type: Array,
312
- required: !0
313
- },
314
- loading: {
315
- type: Boolean
316
- }
317
- },
318
- emits: ["update:modifiers"],
319
- setup(b, { emit: y }) {
320
- const s = b, v = y, r = ne(), g = D(() => {
321
- const f = s.groups.flatMap((_) => _.items.map((m) => {
322
- const C = s.items.find((x) => x._id === m._id);
323
- return {
324
- ...m,
325
- groupName: _.name,
326
- name: m.name ?? (C == null ? void 0 : C.name) ?? "-"
327
- };
328
- }));
329
- return s.modifiers.map((_) => {
330
- const m = f.find((o) => o.selection === _.selection), C = (m == null ? void 0 : m.name) ?? "-", x = (m == null ? void 0 : m.groupName) ?? "";
331
- return {
332
- ..._,
333
- name: C,
334
- groupName: x
335
- };
336
- });
337
- }), h = D(() => s.groups.flatMap((f) => f.items.map((_) => ({ ..._, groupId: f._id }))));
338
- function S({ selection: f }) {
339
- v(
340
- "update:modifiers",
341
- s.modifiers.filter((_) => _.selection !== f)
342
- );
343
- }
344
- function B({ selection: f }, _) {
345
- const m = s.modifiers.find((C) => C.selection === f);
346
- m && (m.code = _);
347
- }
348
- function w() {
349
- let f = [];
350
- s.groups.forEach((m) => {
351
- let C = !1;
352
- m.items.every((x) => x._id.startsWith("item")) && (C = !0), f.push({
353
- label: m.name,
354
- sublabel: "Group",
355
- value: m._id,
356
- disabled: C,
357
- children: m.items.reduce((x, o) => {
358
- var a;
359
- const t = s.items.find((p) => p._id === o._id), n = (a = t == null ? void 0 : t.variant) == null ? void 0 : a.variantCombinations.find(
360
- (p) => p.combinationKey === (o == null ? void 0 : o.combinationKey)
361
- );
362
- return [
363
- ...x,
364
- {
365
- label: `${o.name ?? (t == null ? void 0 : t.name)} ${n ? `(${n.name})` : ""}`,
366
- value: `${o.selection}${n ? `/${n == null ? void 0 : n.combinationKey}` : ""}`,
367
- disabled: C,
368
- active: !!s.modifiers.find(({ selection: p }) => p === o.selection)
369
- }
370
- ];
371
- }, [])
372
- });
373
- });
374
- const _ = {
375
- modelValue: f
376
- };
377
- r.open({
378
- title: "Select Addons",
379
- contentComponent: ie,
380
- contentComponentProps: _,
381
- primaryActions: {
382
- text: "Confirm",
383
- close: !0
384
- }
385
- }).onPrimary((m) => {
386
- const C = q(s.modifiers);
387
- let x = [];
388
- function o(t, n) {
389
- if (n(t), P(t))
390
- for (let a of t.children)
391
- o(a, n);
392
- }
393
- m.forEach((t) => {
394
- o(t, (n) => {
395
- var e;
396
- if (s.groups.find(({ _id: i }) => i === n.value)) return;
397
- const p = h.value.find(({ selection: i }) => i === n.value), d = x.find(({ selection: i }) => n.value === i);
398
- !P(n) && n.active && d === void 0 && x.push({
399
- addonGroupId: (p == null ? void 0 : p.groupId) ?? "",
400
- selection: n.value,
401
- code: ((e = C.find(({ selection: i }) => n.value === i)) == null ? void 0 : e.code) ?? ""
402
- });
403
- });
404
- }), v("update:modifiers", x);
405
- });
406
- }
407
- const { t: H } = R();
408
- return (f, _) => {
409
- const m = I("FmButton"), C = I("FmTextField");
410
- return M(), A("div", Le, [
411
- c("div", Ke, [
412
- c("div", De, K($(H)("inventory.integration.apply.addons")), 1),
413
- V(m, {
414
- type: "button",
415
- variant: "plain",
416
- size: "md",
417
- icon: "link",
418
- label: $(H)("inventory.integration.apply.applyAddon"),
419
- onClick: _[0] || (_[0] = (x) => w())
420
- }, null, 8, ["label"])
421
- ]),
422
- c("div", null, [
423
- g.value.length > 0 ? (M(), A("table", Ze, [
424
- c("tr", Ne, [
425
- c("th", Pe, K($(H)("inventory.integration.apply.name")), 1),
426
- c("th", null, K($(H)("inventory.integration.apply.code")), 1),
427
- _[1] || (_[1] = c("th", { class: "w-1" }, " ", -1))
428
- ]),
429
- (M(!0), A(E, null, W(g.value, (x, o) => (M(), A(E, { key: o }, [
430
- _[2] || (_[2] = c("tr", { class: "block h-8" }, null, -1)),
431
- c("tr", null, [
432
- c("td", null, [
433
- c("div", je, [
434
- c("div", Ue, K(x.name), 1),
435
- x.groupName ? (M(), A("div", qe, K(x.groupName), 1)) : O("", !0)
436
- ])
437
- ]),
438
- c("td", null, [
439
- V(C, {
440
- disabled: b.loading,
441
- "model-value": x.code,
442
- "onUpdate:modelValue": [(t) => x.code = t, (t) => B(x, t)],
443
- rules: [
444
- function(n) {
445
- return !!n || "Required";
446
- }
447
- ]
448
- }, null, 8, ["disabled", "model-value", "onUpdate:modelValue", "rules"])
449
- ]),
450
- c("td", Ee, [
451
- V(m, {
452
- disabled: b.loading,
453
- type: "button",
454
- variant: "tertiary",
455
- icon: "delete",
456
- "icon-color": "#000000",
457
- size: "md",
458
- onClick: (t) => S(x)
459
- }, null, 8, ["disabled", "onClick"])
460
- ])
461
- ])
462
- ], 64))), 128))
463
- ])) : O("", !0)
464
- ])
465
- ]);
466
- };
467
- }
468
- });
469
- function ze(b, y = []) {
470
- const s = y.map((r) => b.find((g) => g._id === r)).filter((r) => !!r);
471
- return Te(s).reduce((r, g) => (r[g.combinationKey] = g.selectionName.join(" / "), r), {});
472
- }
473
- function Re(b, y, s) {
474
- const v = s.reduce((g, h) => {
475
- var H, f, _;
476
- const S = h.category || "", B = ze(y, (H = h.variant) == null ? void 0 : H.variantGroupIds), w = {
477
- ...h,
478
- codeName: [h.code, h.name].filter((m) => !!m).join(" "),
479
- variant: {
480
- variantGroupIds: ((f = h.variant) == null ? void 0 : f.variantGroupIds) || [],
481
- variantCombinations: (((_ = h.variant) == null ? void 0 : _.variantCombinations) || []).map((m) => {
482
- const C = m.code, x = m.name || B[m.combinationKey || ""];
483
- return {
484
- ...m,
485
- codeName: [C, x].filter((o) => !!o).join(" ").trim() || "-"
486
- };
487
- })
488
- }
489
- };
490
- return g[S] = g[S] ? [...g[S], w] : [w], g;
491
- }, {}), r = Object.values(v)[0];
492
- return b.length === 0 && r ? r.map((g) => ({
493
- id: g._id,
494
- name: g.name ?? "",
495
- items: v[g._id || ""] || []
496
- })) || [] : b.map((g) => ({
497
- id: g._id,
498
- name: g.name ?? "",
499
- items: v[g._id || ""] || []
500
- }));
501
- }
502
- function se(b, y) {
503
- if (b.length == 1)
504
- return b[0];
505
- const s = b[0], v = b.slice(1, b.length), r = se(v, y);
506
- return s.reduce((h, S) => [...h, ...r.map((B) => y(S, B))], new Array());
507
- }
508
- function Te(b) {
509
- if (b.length === 0) return [];
510
- const y = b.map(
511
- (v) => (v.options ?? []).map(
512
- (r) => ({
513
- combinationKey: [`${v._id}/${r._id}`],
514
- selectionName: [r.name ?? ""]
515
- })
516
- )
517
- );
518
- return se(y, (v, r) => ({
519
- combinationKey: [...v.combinationKey, ...r.combinationKey],
520
- selectionName: [...v.selectionName, ...r.selectionName]
521
- })).map((v) => {
522
- const r = [...v.combinationKey];
523
- return r.sort(), {
524
- combinationKey: r.join("/"),
525
- active: !0,
526
- selectionName: v.selectionName
527
- };
528
- });
529
- }
530
- const Ge = { class: "flex flex-col rounded border border-fm-color-neutral-gray-100 px-5 py-5 gap-5 mb-3" }, We = { class: "flex items-center" }, Ye = { class: "text-lg font-bold flex-grow" }, Je = {
531
- key: 0,
532
- class: "table-auto w-full"
533
- }, Qe = { class: "text-left" }, Xe = { class: "min-w-64" }, et = { class: "flex flex-col" }, tt = { class: "fm-typo-en-body-md-400" }, nt = {
534
- key: 0,
535
- class: "fm-typo-en-body-sm-400 text-fm-color-neutral-gray-400"
536
- }, ot = { class: "w-1" }, Y = /* @__PURE__ */ z({
537
- __name: "ApplyProduct",
538
- props: {
539
- isAddon: {
540
- type: Boolean,
541
- default: !1
542
- },
543
- bindings: {
544
- type: Array,
545
- required: !0
546
- },
547
- categories: {
548
- type: Array,
549
- required: !0
550
- },
551
- variants: {
552
- type: Object,
553
- required: !0
554
- },
555
- menus: {
556
- type: Array,
557
- required: !0
558
- }
559
- },
560
- emits: ["update:bindings"],
561
- setup(b, { emit: y }) {
562
- const s = b, v = y, r = ne(), g = D(() => s.isAddon ? "Addons" : "Products"), h = D(() => s.isAddon ? [] : s.categories), S = D(
563
- () => Re(h.value, s.variants, s.menus)
564
- ), B = D(() => {
565
- if (s.isAddon)
566
- return s.bindings.map((n) => {
567
- const a = s.menus.find((d) => d._id === n.productId), p = (a == null ? void 0 : a.name) ?? "-";
568
- return {
569
- ...n,
570
- name: p,
571
- itemCode: (a == null ? void 0 : a.code) ?? "-"
572
- };
573
- });
574
- const t = S.value.flatMap((n) => n.items);
575
- return s.bindings.map((n) => {
576
- var i;
577
- const a = t.find((l) => l._id === n.productId), p = (a == null ? void 0 : a.name) ?? "-";
578
- let d = (a == null ? void 0 : a.code) ?? "-", e;
579
- if (n.combinationKey) {
580
- const l = (((i = a == null ? void 0 : a.variant) == null ? void 0 : i.variantCombinations) || []).find(
581
- (F) => F.combinationKey === n.combinationKey
582
- );
583
- e = (l == null ? void 0 : l.name) ?? (l == null ? void 0 : l.codeName) ?? "", d = (l == null ? void 0 : l.code) ?? d;
584
- }
585
- return {
586
- ...n,
587
- name: p,
588
- itemCode: d,
589
- variantName: e
590
- };
591
- });
592
- });
593
- function w(t) {
594
- v(
595
- "update:bindings",
596
- s.bindings.filter(
597
- (n) => n.productId !== t.productId || n.combinationKey !== t.combinationKey
598
- )
599
- );
600
- }
601
- function H({ productId: t, combinationKey: n }, a) {
602
- const p = s.bindings.find(
603
- (d) => d.productId === t && d.combinationKey === n
604
- );
605
- p && (p.code = a);
606
- }
607
- function f() {
608
- return S.value.map((t) => ({
609
- label: t.name,
610
- sublabel: "Category",
611
- value: t.name,
612
- disabled: !1,
613
- children: t.items.map((n) => {
614
- var p;
615
- const a = (p = n.variant) == null ? void 0 : p.variantCombinations;
616
- return a != null && a.length ? {
617
- label: n.name ?? "",
618
- value: n._id,
619
- sublabel: "Product",
620
- children: [
621
- {
622
- label: n.codeName ?? "",
623
- value: {
624
- productId: n._id
625
- },
626
- active: !!s.bindings.find(
627
- ({ productId: d, combinationKey: e }) => n._id === d && !e
628
- )
629
- },
630
- ...a.map((d) => ({
631
- label: d.codeName ?? "",
632
- value: {
633
- productId: n._id,
634
- combinationKey: d.combinationKey
635
- },
636
- sublabel: "Variant",
637
- active: !!s.bindings.find(
638
- ({ productId: e, combinationKey: i }) => n._id === e && d.combinationKey === i
639
- )
640
- }))
641
- ]
642
- } : {
643
- label: n.codeName ?? "",
644
- value: {
645
- productId: n._id
646
- },
647
- active: !!s.bindings.find(
648
- ({ productId: d, combinationKey: e }) => n._id === d && !e
649
- )
650
- };
651
- })
652
- }));
653
- }
654
- function _() {
655
- return s.menus.map((t) => ({
656
- label: t.name,
657
- value: { productId: t._id },
658
- active: !!s.bindings.find(
659
- ({ productId: n, combinationKey: a }) => t._id === n && !a
660
- )
661
- }));
662
- }
663
- function m(t) {
664
- const n = q(s.bindings);
665
- return t.flatMap((a) => a.children.flatMap((p) => {
666
- var e;
667
- if (P(p))
668
- return p.children.filter((i) => i.active).map((i) => {
669
- var u, L;
670
- const { productId: l, combinationKey: F } = i.value;
671
- return F ? {
672
- productId: l,
673
- combinationKey: F,
674
- code: ((u = n.find(
675
- ({ productId: Z, combinationKey: k }) => l === Z && F === k
676
- )) == null ? void 0 : u.code) ?? ""
677
- } : {
678
- productId: l,
679
- code: ((L = n.find(({ productId: Z, combinationKey: k }) => l === Z && !k)) == null ? void 0 : L.code) ?? ""
680
- };
681
- });
682
- if (!p.active)
683
- return [];
684
- const { productId: d } = p.value;
685
- return [
686
- {
687
- productId: d,
688
- code: ((e = n.find(({ productId: i, combinationKey: l }) => d === i && !l)) == null ? void 0 : e.code) ?? ""
689
- }
690
- ];
691
- }));
692
- }
693
- function C(t) {
694
- const n = q(s.bindings);
695
- return t.filter((a) => a.active).map(
696
- (a) => {
697
- var p;
698
- return {
699
- productId: a.value.productId,
700
- code: ((p = n.find(({ productId: d }) => d === a.value.productId)) == null ? void 0 : p.code) ?? ""
701
- };
702
- }
703
- );
704
- }
705
- function x() {
706
- let t;
707
- s.isAddon ? t = _() : t = f();
708
- const n = {
709
- modelValue: t
710
- };
711
- r.open({
712
- title: `Select ${g.value}`,
713
- contentComponent: ie,
714
- contentComponentProps: n,
715
- primaryActions: {
716
- text: "Confirm",
717
- close: !0
718
- }
719
- }).onPrimary((a) => {
720
- let p;
721
- s.isAddon ? p = C(a) : p = m(a), v("update:bindings", p);
722
- });
723
- }
724
- const { t: o } = R();
725
- return (t, n) => {
726
- const a = I("FmButton"), p = I("FmTextField");
727
- return M(), A("div", Ge, [
728
- c("div", We, [
729
- c("div", Ye, K(b.isAddon ? $(o)("inventory.integration.apply.addons") : $(o)("inventory.integration.apply.products")), 1),
730
- V(a, {
731
- type: "button",
732
- variant: "plain",
733
- size: "md",
734
- icon: "link",
735
- label: b.isAddon ? $(o)("inventory.integration.apply.applyAddon") : $(o)("inventory.integration.apply.applyProduct"),
736
- onClick: n[0] || (n[0] = (d) => x())
737
- }, null, 8, ["label"])
738
- ]),
739
- c("div", null, [
740
- B.value.length > 0 ? (M(), A("table", Je, [
741
- c("tr", Qe, [
742
- c("th", Xe, K($(o)("inventory.integration.apply.name")), 1),
743
- c("th", null, K($(o)("inventory.integration.apply.code")), 1),
744
- n[1] || (n[1] = c("th", { class: "w-1" }, " ", -1))
745
- ]),
746
- (M(!0), A(E, null, W(B.value, (d, e) => (M(), A(E, { key: e }, [
747
- n[2] || (n[2] = c("tr", { class: "block h-8" }, null, -1)),
748
- c("tr", null, [
749
- c("td", null, [
750
- c("div", et, [
751
- c("div", tt, K(d.itemCode) + " " + K(d.name), 1),
752
- d.variantName ? (M(), A("div", nt, K(d.variantName), 1)) : O("", !0)
753
- ])
754
- ]),
755
- c("td", null, [
756
- V(p, {
757
- "model-value": d.code,
758
- "onUpdate:modelValue": [(i) => d.code = i, (i) => H(d, i)],
759
- rules: [
760
- function(l) {
761
- return !!l || "Required";
762
- }
763
- ]
764
- }, null, 8, ["model-value", "onUpdate:modelValue", "rules"])
765
- ]),
766
- c("td", ot, [
767
- V(a, {
768
- type: "button",
769
- variant: "tertiary",
770
- icon: "delete",
771
- "icon-color": "#000000",
772
- size: "md",
773
- onClick: (i) => w(d)
774
- }, null, 8, ["onClick"])
775
- ])
776
- ])
777
- ], 64))), 128))
778
- ])) : O("", !0)
779
- ])
780
- ]);
781
- };
782
- }
783
- }), it = { class: "flex flex-col gap-8 w-full" }, st = /* @__PURE__ */ z({
784
- __name: "ApplyProductDialog",
785
- props: {
786
- categories: { default: () => [] },
787
- variants: { default: () => [] },
788
- menus: { default: () => [] },
789
- groups: { default: () => [] },
790
- setting: {},
791
- show: { type: Boolean },
792
- loading: { type: Boolean }
793
- },
794
- emits: ["update:setting", "update:show", "submit"],
795
- setup(b, { emit: y }) {
796
- const s = b, v = y, r = Q(q(s.setting));
797
- X([() => s.show], ([H]) => {
798
- if (H)
799
- for (const f of Object.keys(s.setting))
800
- r[f] = s.setting[f];
801
- });
802
- const g = j(), h = oe(s, "show");
803
- function S() {
804
- var H, f;
805
- (f = (H = g.value) == null ? void 0 : H.validateInputs) == null || f.call(H);
806
- }
807
- function B() {
808
- v("update:setting", q(r)), v("submit");
809
- }
810
- const { t: w } = R();
811
- return (H, f) => {
812
- const _ = I("FmChip"), m = I("FmForm"), C = I("FmButton"), x = I("FmSideSheet");
813
- return M(), U(x, {
814
- modelValue: $(h),
815
- "onUpdate:modelValue": f[4] || (f[4] = (o) => ee(h) ? h.value = o : null),
816
- header: $(w)("inventory.integration.apply.title"),
817
- "dismiss-away": "",
818
- "close-button": "",
819
- "max-width": 500
820
- }, {
821
- default: N(() => [
822
- c("div", it, [
823
- c("div", null, [
824
- V(_, { label: "Menu v3" })
825
- ]),
826
- V(m, {
827
- ref_key: "formRef",
828
- ref: g,
829
- onValidationSuccess: f[2] || (f[2] = (o) => B())
830
- }, {
831
- default: N(() => [
832
- V(Y, {
833
- bindings: r.bindings,
834
- categories: H.categories,
835
- variants: H.variants,
836
- menus: H.menus,
837
- "onUpdate:bindings": f[0] || (f[0] = (o) => r.bindings = o)
838
- }, null, 8, ["bindings", "categories", "variants", "menus"]),
839
- V(Oe, {
840
- form: g.value,
841
- modifiers: r.modifiers ?? [],
842
- groups: H.groups ?? [],
843
- items: H.menus ?? [],
844
- "onUpdate:modifiers": f[1] || (f[1] = (o) => r.modifiers = o)
845
- }, null, 8, ["form", "modifiers", "groups", "items"])
846
- ]),
847
- _: 1
848
- }, 512)
849
- ])
850
- ]),
851
- "side-sheet-footer": N(() => [
852
- V(C, {
853
- loading: H.loading,
854
- type: "submit",
855
- label: $(w)("common.confirm"),
856
- onClick: f[3] || (f[3] = (o) => S())
857
- }, null, 8, ["loading", "label"])
858
- ]),
859
- _: 1
860
- }, 8, ["modelValue", "header"]);
861
- };
862
- }
863
- }), lt = { class: "flex flex-col gap-8 w-full" }, rt = /* @__PURE__ */ z({
864
- __name: "ApplyProductDialogV4",
865
- props: {
866
- categories: { default: () => [] },
867
- variants: { default: () => [] },
868
- menus: { default: () => [] },
869
- groups: { default: () => [] },
870
- setting: {},
871
- show: { type: Boolean },
872
- loading: { type: Boolean }
873
- },
874
- emits: ["update:setting", "update:show", "submit"],
875
- setup(b, { emit: y }) {
876
- const s = b, v = y, r = Q(q(s.setting));
877
- X([() => s.show], ([o]) => {
878
- if (o)
879
- for (const t of Object.keys(s.setting))
880
- r[t] = s.setting[t];
881
- });
882
- const g = D(() => s.menus.filter((o) => (o == null ? void 0 : o.category) === null)), h = D(() => r.bindings.filter((o) => {
883
- const t = s.menus.find((n) => n._id === o.productId);
884
- return t ? (t == null ? void 0 : t.category) === null : !1;
885
- })), S = D(() => s.menus.filter((o) => (o == null ? void 0 : o.category) !== null)), B = D(() => r.bindings.filter((o) => {
886
- const t = s.menus.find((n) => n._id === o.productId);
887
- return t ? (t == null ? void 0 : t.category) !== null : !1;
888
- }));
889
- function w(o) {
890
- r.bindings = [...h.value, ...o];
891
- }
892
- function H(o) {
893
- r.bindings = [...B.value, ...o];
894
- }
895
- const f = j(), _ = oe(s, "show");
896
- function m() {
897
- var o, t;
898
- (t = (o = f.value) == null ? void 0 : o.validateInputs) == null || t.call(o);
899
- }
900
- function C() {
901
- v("update:setting", q(r)), v("submit");
902
- }
903
- const { t: x } = R();
904
- return (o, t) => {
905
- const n = I("FmChip"), a = I("FmForm"), p = I("FmButton"), d = I("FmSideSheet");
906
- return M(), U(d, {
907
- modelValue: $(_),
908
- "onUpdate:modelValue": t[4] || (t[4] = (e) => ee(_) ? _.value = e : null),
909
- header: $(x)("inventory.integration.apply.title"),
910
- "dismiss-away": "",
911
- "close-button": "",
912
- "max-width": 500
913
- }, {
914
- default: N(() => [
915
- c("div", lt, [
916
- c("div", null, [
917
- V(n, { label: "Menu v4" })
918
- ]),
919
- V(a, {
920
- ref_key: "formRef",
921
- ref: f,
922
- onValidationSuccess: t[2] || (t[2] = (e) => C())
923
- }, {
924
- default: N(() => [
925
- V(Y, {
926
- categories: o.categories,
927
- variants: o.variants,
928
- bindings: B.value,
929
- menus: S.value,
930
- "onUpdate:bindings": t[0] || (t[0] = (e) => w(e))
931
- }, null, 8, ["categories", "variants", "bindings", "menus"]),
932
- V(Y, {
933
- "is-addon": !0,
934
- categories: [],
935
- variants: o.variants,
936
- bindings: h.value,
937
- menus: g.value,
938
- "onUpdate:bindings": t[1] || (t[1] = (e) => H(e))
939
- }, null, 8, ["variants", "bindings", "menus"])
940
- ]),
941
- _: 1
942
- }, 512)
943
- ])
944
- ]),
945
- "side-sheet-footer": N(() => [
946
- V(p, {
947
- loading: o.loading,
948
- type: "submit",
949
- label: $(x)("common.confirm"),
950
- onClick: t[3] || (t[3] = (e) => m())
951
- }, null, 8, ["loading", "label"])
952
- ]),
953
- _: 1
954
- }, 8, ["modelValue", "header"]);
955
- };
956
- }
957
- }), at = { key: 0 }, dt = {
958
- key: 1,
959
- class: "flex flex-col items-center my-10 gap-5"
960
- }, ut = ["src"], ct = {
961
- class: "text-xs text-neutral-400 text-center",
962
- style: { "max-width": "25rem" }
963
- }, ft = { key: 2 }, mt = { class: "flex justify-center" }, pt = ["src"], vt = { class: "flex flex-col items-center gap-2" }, gt = { class: "text-lg font-bold" }, yt = { class: "text-fm-color-neutral-gray-300" }, bt = { key: 0 }, kt = /* @__PURE__ */ z({
964
- __name: "IntegrationView",
965
- setup(b) {
966
- const y = Ce(), s = he(), v = ge(), r = j(!1), g = j(), h = j(), S = j(), B = j(), w = j(), H = D(() => {
967
- var d;
968
- return ((d = w.value) == null ? void 0 : d.enable) ?? !1;
969
- }), f = ye(), _ = D(() => {
970
- var d;
971
- return (d = y.currentBusiness.value) == null ? void 0 : d.menuVersion;
972
- });
973
- v.watchLocation(m);
974
- async function m(d) {
975
- var e, i, l, F;
976
- if (!d) {
977
- const u = {
978
- _id: "",
979
- enable: !1,
980
- bindings: [],
981
- uniqueCode: "",
982
- branchCode: "",
983
- server: {
984
- password: "",
985
- host: "",
986
- username: "",
987
- port: "",
988
- directory: ""
989
- },
990
- histories: [],
991
- modifiers: [],
992
- exportAsJson: !1
993
- };
994
- w.value = u;
995
- return;
996
- }
997
- r.value = !0;
998
- try {
999
- const u = await f.readMenu();
1000
- g.value = ((e = u.modules) == null ? void 0 : e.item) ?? [], h.value = ((i = u.modules) == null ? void 0 : i.group) ?? [], S.value = ((l = u.modules) == null ? void 0 : l.variant) ?? [];
1001
- const L = (((F = u.modules) == null ? void 0 : F.category) ?? []).map((Z) => ({
1002
- ...Z,
1003
- _id: Z._id === void 0 ? null : Z._id
1004
- }));
1005
- B.value = L, w.value = await f.readSetting();
1006
- } catch (u) {
1007
- s.open({
1008
- title: "Something went wrong",
1009
- message: "Cannot fetch integration info. Please try again.",
1010
- type: "error"
1011
- }), console.error("Error at fetching integration info", u);
1012
- } finally {
1013
- r.value = !1;
1014
- }
1015
- }
1016
- const C = j(!1);
1017
- async function x() {
1018
- C.value = !0;
1019
- }
1020
- const { breakpoints: o } = _e(), t = D(() => o.value.xs || o.value.sm), n = D(() => t.value);
1021
- async function a() {
1022
- const d = w.value;
1023
- if (d) {
1024
- r.value = !0;
1025
- try {
1026
- await f.updateSetting(d), s.open({
1027
- title: "Success",
1028
- message: "Your changes has been saved",
1029
- type: "success"
1030
- }), C.value = !1, await m(v.currentLocation);
1031
- return;
1032
- } catch (e) {
1033
- s.open({
1034
- title: "Something went wrong",
1035
- message: "Cannot update integration info. Please try again.",
1036
- type: "error"
1037
- }), console.error("Error at updating integration info", e);
1038
- } finally {
1039
- r.value = !1;
1040
- }
1041
- }
1042
- }
1043
- const { t: p } = R();
1044
- return (d, e) => {
1045
- const i = I("FmCircularProgress"), l = I("FmCardSection"), F = I("FmCard");
1046
- return M(), U(xe, {
1047
- title: $(p)("inventory.integration.title")
1048
- }, {
1049
- default: N(() => [
1050
- c("div", {
1051
- class: T([
1052
- "flex flex-col gap-8 max-h-full",
1053
- {
1054
- "p-0": t.value,
1055
- "px-24 ": !t.value
1056
- }
1057
- ])
1058
- }, [
1059
- V(He, { "change-location": "" }),
1060
- !$(v)._currentLocation || r.value ? (M(), A("div", at, [
1061
- V(i, { size: "lg" })
1062
- ])) : H.value ? (M(), A("div", ft, [
1063
- V(F, {
1064
- class: T({
1065
- "w-full": n.value,
1066
- "w-1/2": !n.value,
1067
- border: !0,
1068
- "border-fm-color-neutral-gray-100": !0,
1069
- "cursor-pointer": !0,
1070
- "hover:border-fm-color-primary": !0
1071
- }),
1072
- onClick: e[0] || (e[0] = (u) => x())
1073
- }, {
1074
- default: N(() => [
1075
- V(l, null, {
1076
- default: N(() => [
1077
- c("div", mt, [
1078
- c("img", {
1079
- src: $(Fe),
1080
- alt: "Food Market Hub"
1081
- }, null, 8, pt)
1082
- ]),
1083
- c("div", vt, [
1084
- c("div", gt, K($(p)("inventory.integration.fmh.title")), 1),
1085
- c("div", yt, K($(p)("inventory.integration.fmh.description")), 1)
1086
- ])
1087
- ]),
1088
- _: 1
1089
- })
1090
- ]),
1091
- _: 1
1092
- }, 8, ["class"])
1093
- ])) : (M(), A("div", dt, [
1094
- c("div", null, [
1095
- c("img", {
1096
- src: $(pe),
1097
- alt: "List is empty"
1098
- }, null, 8, ut)
1099
- ]),
1100
- e[7] || (e[7] = c("div", { class: "font-bold text-lg" }, "Integration", -1)),
1101
- c("div", ct, K($(p)("inventory.integration.description")), 1)
1102
- ]))
1103
- ], 2),
1104
- w.value ? (M(), A("div", bt, [
1105
- (M(), U(me, { to: "body" }, [
1106
- _.value === "v3" ? (M(), U(st, {
1107
- key: 0,
1108
- menus: g.value,
1109
- variants: S.value,
1110
- categories: B.value,
1111
- setting: w.value,
1112
- "onUpdate:setting": e[1] || (e[1] = (u) => w.value = u),
1113
- show: C.value,
1114
- "onUpdate:show": e[2] || (e[2] = (u) => C.value = u),
1115
- groups: h.value,
1116
- loading: r.value,
1117
- onSubmit: e[3] || (e[3] = (u) => a())
1118
- }, null, 8, ["menus", "variants", "categories", "setting", "show", "groups", "loading"])) : (M(), U(rt, {
1119
- key: 1,
1120
- menus: g.value,
1121
- variants: S.value,
1122
- categories: B.value,
1123
- setting: w.value,
1124
- "onUpdate:setting": e[4] || (e[4] = (u) => w.value = u),
1125
- show: C.value,
1126
- "onUpdate:show": e[5] || (e[5] = (u) => C.value = u),
1127
- groups: h.value,
1128
- loading: r.value,
1129
- onSubmit: e[6] || (e[6] = (u) => a())
1130
- }, null, 8, ["menus", "variants", "categories", "setting", "show", "groups", "loading"]))
1131
- ]))
1132
- ])) : O("", !0)
1133
- ]),
1134
- _: 1
1135
- }, 8, ["title"]);
1136
- };
1137
- }
1138
- });
1139
- export {
1140
- kt as default
1141
- };