@feedmepos/mf-inventory-portal 0.0.21-dev.4 → 0.0.21-dev.5

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