@feedmepos/mf-inventory-portal 0.0.19-dev.2 → 0.0.19-dev.4

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