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

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