@feedmepos/mf-order-setting 0.0.88 → 0.0.89

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 (44) hide show
  1. package/dist/{DisplaySystemView-BiKFL6UY.js → DisplaySystemView-BA-5JObJ.js} +1 -1
  2. package/dist/{KioskDevicesView-DQPue13D.js → KioskDevicesView-CgdnW9N9.js} +1 -1
  3. package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-BAe1eQvx.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-C9X9ziUm.js} +3 -3
  4. package/dist/KioskSettingView-CVck01e7.js +860 -0
  5. package/dist/{KioskView-BfTNsmN1.js → KioskView-DKY2QEh5.js} +54 -48
  6. package/dist/{OrderSettingsView-CowX8_oN.js → OrderSettingsView-CEPIZmHA.js} +774 -768
  7. package/dist/{app-DgZSoUgk.js → app-C9nnuR9O.js} +206 -190
  8. package/dist/app.js +1 -1
  9. package/dist/frontend/mf-order/src/app.d.ts +16 -0
  10. package/dist/frontend/mf-order/src/main.d.ts +16 -0
  11. package/dist/frontend/mf-order/src/modules/order-setting/kiosk/interface.d.ts +2 -0
  12. package/dist/frontend/mf-order/src/stores/order-setting/index.d.ts +6 -0
  13. package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
  14. package/dist/{index-CGJIcLNE.js → index-BaC_Douy.js} +2 -2
  15. package/dist/{index-CWm0u6lo.js → index-DGAU5Dhc.js} +1 -1
  16. package/dist/{index-DzmXxFJu.js → index-Gk7389CW.js} +1 -1
  17. package/dist/{order.dto-DQWf-RVV.js → order.dto-CfCfBJYu.js} +43 -6
  18. package/dist/package/entity/food-court/food-court.dto.d.ts +51 -121
  19. package/dist/package/entity/incoming-order/incoming-order-to-bill.dto.d.ts +10 -0
  20. package/dist/package/entity/kiosk/kiosk.do.d.ts +16 -16
  21. package/dist/package/entity/kiosk/kiosk.dto.d.ts +19 -19
  22. package/dist/package/entity/order/order-item/order-item.dto.d.ts +20 -0
  23. package/dist/package/entity/order/order.do.d.ts +19 -3
  24. package/dist/package/entity/order/order.dto.d.ts +107 -91
  25. package/dist/package/entity/order/order.enum.d.ts +1 -1
  26. package/dist/package/entity/order-setting/kiosk/kiosk.do.d.ts +3 -0
  27. package/dist/package/entity/order-setting/kiosk/kiosk.dto.d.ts +6 -0
  28. package/dist/package/entity/order-setting/order-setting.do.d.ts +5 -0
  29. package/dist/package/entity/order-setting/order-setting.dto.d.ts +13 -0
  30. package/dist/package/entity/queue/queue.dto.d.ts +23 -36
  31. package/dist/package/entity/restaurant/restaurant.dto.d.ts +10 -15
  32. package/dist/package/entity/websocket/websocket.dto.d.ts +12 -0
  33. package/package.json +1 -1
  34. package/src/locales/en-US.json +4 -0
  35. package/src/locales/ja-JP.json +4 -0
  36. package/src/locales/th-TH.json +4 -0
  37. package/src/locales/zh-CN.json +4 -0
  38. package/src/modules/order-setting/kiosk/interface.ts +10 -0
  39. package/src/stores/order-setting/mapper.spec.ts +21 -0
  40. package/src/stores/order-setting/mapper.ts +8 -2
  41. package/src/views/kiosk/settings/KioskSettingView.vue +37 -0
  42. package/src/views/order-settings/delivery/delivery.spec.ts +23 -3
  43. package/src/views/order-settings/delivery/delivery.ts +4 -0
  44. package/dist/KioskSettingView-M3pBFSwt.js +0 -839
@@ -0,0 +1,860 @@
1
+ import { defineComponent as fe, computed as x, ref as Y, onMounted as Ee, resolveComponent as V, openBlock as w, createBlock as oe, withCtx as R, createVNode as i, unref as a, createElementVNode as d, withDirectives as F, vShow as N, toDisplayString as v, watch as Ue, createElementBlock as E, createCommentVNode as B, Fragment as te, renderList as ne, normalizeClass as Fe } from "vue";
2
+ import { e as me, b as be, s as ge, d as Ne, r as pe, f as ce, h as Oe } from "./app-C9nnuR9O.js";
3
+ import { c as f, K as Le, d as Me } from "./order.dto-CfCfBJYu.js";
4
+ import { _ as We, u as De, a as $e } from "./index-BaC_Douy.js";
5
+ import { useI18n as he, FeedMeAuth as Ie, useCoreStore as Ye } from "@feedmepos/mf-common";
6
+ import { useSnackbar as Ge } from "@feedmepos/ui-library";
7
+ const Ke = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary ml-7" }, je = { class: "ml-7" }, qe = { class: "ml-7" }, Be = { class: "flex flex-row gap-9" }, He = /* @__PURE__ */ fe({
8
+ __name: "KioskPaymentTypeSection",
9
+ props: {
10
+ paymentTypes: {
11
+ type: Array,
12
+ required: !0
13
+ },
14
+ offlinePaymentTypes: {
15
+ type: Array,
16
+ required: !0
17
+ },
18
+ allowEPayment: {
19
+ type: [Boolean, String],
20
+ required: !0
21
+ },
22
+ allowCredit: {
23
+ type: [Boolean, String],
24
+ default: !1
25
+ },
26
+ ePaymentTypes: {
27
+ type: Object,
28
+ required: !0
29
+ }
30
+ },
31
+ emits: ["update:paymentTypes", "update:offlinePaymentTypes", "update:ePaymentTypes"],
32
+ setup(o, { emit: s }) {
33
+ const { t: e } = he(), u = o, h = s, _ = x(() => (u.paymentTypes || []).includes(me.F_ORDER_PAYMENT_TYPE.enum.ePayment)), I = Y(), g = Y([]), l = Y(!1), U = Y(!1), A = Y(!1), G = () => {
34
+ Object.keys(u.ePaymentTypes).length !== 0 && (u.ePaymentTypes.terminal && (U.value = !0), u.ePaymentTypes.card.terminal ? (I.value = f.enum.TERMINAL, l.value = !0) : u.ePaymentTypes.card.nfc && (I.value = f.enum.NFC, l.value = !0), u.ePaymentTypes.eWallet.qrPay && (g.value.push(f.enum.QRPAY), A.value = !0), u.ePaymentTypes.eWallet.scanPay && (g.value.push(f.enum.SCANPAY), A.value = !0));
35
+ };
36
+ G();
37
+ const Z = (b) => {
38
+ const m = {
39
+ terminal: !1,
40
+ card: {
41
+ terminal: !1,
42
+ nfc: !1
43
+ },
44
+ eWallet: {
45
+ qrPay: !1,
46
+ scanPay: !1
47
+ }
48
+ };
49
+ _.value && (b == f.enum.TERMINAL && (m.card.terminal = !0), b == f.enum.NFC && (m.card.nfc = !0), g.value.length > 0 && (g.value.includes(f.enum.QRPAY) && (m.eWallet.qrPay = !0), g.value.includes(f.enum.SCANPAY) && (m.eWallet.scanPay = !0))), U.value && (m.terminal = !0), h("update:ePaymentTypes", m);
50
+ }, T = () => {
51
+ const b = {
52
+ terminal: !1,
53
+ card: {
54
+ terminal: !1,
55
+ nfc: !1
56
+ },
57
+ eWallet: {
58
+ qrPay: !1,
59
+ scanPay: !1,
60
+ terminalScanPay: !1,
61
+ terminalQrPay: !1
62
+ }
63
+ };
64
+ _.value && (I.value && (I.value === f.enum.TERMINAL && (b.card.terminal = !0), I.value === f.enum.NFC && (b.card.nfc = !0)), U.value && (b.terminal = !0), g.value.includes(f.enum.QRPAY) && (b.eWallet.qrPay = !0), g.value.includes(f.enum.SCANPAY) && (b.eWallet.scanPay = !0), g.value.includes(f.enum.TERMINAL_SCAN_PAY) && (b.eWallet.terminalScanPay = !0), g.value.includes(f.enum.TERMINAL_QR_PAY) && (b.eWallet.terminalQrPay = !0)), h("update:ePaymentTypes", b);
65
+ }, W = (b) => {
66
+ I.value = "", b && (I.value = f.enum.TERMINAL), T();
67
+ }, H = (b) => {
68
+ g.value = [], b && (g.value = [
69
+ f.enum.QRPAY,
70
+ f.enum.SCANPAY
71
+ ]), T();
72
+ }, ee = (b) => {
73
+ h("update:paymentTypes", b), b.includes(me.F_ORDER_PAYMENT_TYPE.enum.ePayment) || (l.value = !1, A.value = !1, W(!1), H(!1));
74
+ };
75
+ return Ee(() => {
76
+ G();
77
+ }), (b, m) => {
78
+ const O = V("FmSwitch"), K = V("FmRadio"), ae = V("FmRadioGroup"), j = V("FmCardSection"), q = V("FmCard"), D = V("FmCheckbox");
79
+ return w(), oe(We, {
80
+ "payment-types": o.paymentTypes,
81
+ "offline-payment-types": o.offlinePaymentTypes,
82
+ "allow-e-payment": u.allowEPayment,
83
+ "allow-credit": u.allowCredit,
84
+ "onUpdate:paymentTypes": ee,
85
+ "onUpdate:offlinePaymentTypes": m[8] || (m[8] = (c) => h("update:offlinePaymentTypes", c || []))
86
+ }, {
87
+ "e-payment-note": R(() => [
88
+ d("div", Ke, v(a(e)("order.legacyEPaymentNote")), 1)
89
+ ]),
90
+ "e-payment-content": R(() => [
91
+ i(q, { variant: "outlined" }, {
92
+ default: R(() => [
93
+ i(j, null, {
94
+ default: R(() => [
95
+ i(O, {
96
+ label: a(e)("order.bankCard"),
97
+ sublabel: a(e)("order.cardPaymentDescription"),
98
+ "label-placement": "right",
99
+ modelValue: l.value,
100
+ "onUpdate:modelValue": [
101
+ m[0] || (m[0] = (c) => l.value = c),
102
+ W
103
+ ]
104
+ }, null, 8, ["label", "sublabel", "modelValue"]),
105
+ m[9] || (m[9] = d("br", null, null, -1)),
106
+ F(d("div", je, [
107
+ i(ae, {
108
+ modelValue: I.value,
109
+ "onUpdate:modelValue": [
110
+ m[1] || (m[1] = (c) => I.value = c),
111
+ Z
112
+ ],
113
+ inline: ""
114
+ }, {
115
+ default: R(() => [
116
+ i(K, {
117
+ label: a(e)("order.terminal"),
118
+ value: a(f).enum.TERMINAL
119
+ }, null, 8, ["label", "value"]),
120
+ i(K, {
121
+ label: a(e)("order.nfc"),
122
+ value: a(f).enum.NFC
123
+ }, null, 8, ["label", "value"])
124
+ ]),
125
+ _: 1
126
+ }, 8, ["modelValue"])
127
+ ], 512), [
128
+ [N, l.value]
129
+ ])
130
+ ]),
131
+ _: 1
132
+ })
133
+ ]),
134
+ _: 1
135
+ }),
136
+ i(q, {
137
+ variant: "outlined",
138
+ class: "mt-2"
139
+ }, {
140
+ default: R(() => [
141
+ i(j, null, {
142
+ default: R(() => [
143
+ i(O, {
144
+ label: a(e)("order.terminal"),
145
+ sublabel: a(e)("order.terminalPaymentDescription"),
146
+ "label-placement": "right",
147
+ modelValue: U.value,
148
+ "onUpdate:modelValue": [
149
+ m[2] || (m[2] = (c) => U.value = c),
150
+ T
151
+ ]
152
+ }, null, 8, ["label", "sublabel", "modelValue"])
153
+ ]),
154
+ _: 1
155
+ })
156
+ ]),
157
+ _: 1
158
+ }),
159
+ i(q, {
160
+ variant: "outlined",
161
+ class: "mt-2"
162
+ }, {
163
+ default: R(() => [
164
+ i(j, null, {
165
+ default: R(() => [
166
+ i(O, {
167
+ label: a(e)("order.eWallet"),
168
+ sublabel: a(e)("order.eWalletDescription"),
169
+ "label-placement": "right",
170
+ modelValue: A.value,
171
+ "onUpdate:modelValue": [
172
+ m[3] || (m[3] = (c) => A.value = c),
173
+ H
174
+ ]
175
+ }, null, 8, ["label", "sublabel", "modelValue"]),
176
+ m[10] || (m[10] = d("br", null, null, -1)),
177
+ F(d("div", qe, [
178
+ d("div", Be, [
179
+ i(D, {
180
+ modelValue: g.value,
181
+ "onUpdate:modelValue": [
182
+ m[4] || (m[4] = (c) => g.value = c),
183
+ T
184
+ ],
185
+ label: a(e)("order.qrPay"),
186
+ value: a(f).enum.QRPAY
187
+ }, null, 8, ["modelValue", "label", "value"]),
188
+ i(D, {
189
+ modelValue: g.value,
190
+ "onUpdate:modelValue": [
191
+ m[5] || (m[5] = (c) => g.value = c),
192
+ T
193
+ ],
194
+ label: a(e)("order.scanPay"),
195
+ value: a(f).enum.SCANPAY
196
+ }, null, 8, ["modelValue", "label", "value"]),
197
+ i(D, {
198
+ modelValue: g.value,
199
+ "onUpdate:modelValue": [
200
+ m[6] || (m[6] = (c) => g.value = c),
201
+ T
202
+ ],
203
+ label: a(e)("order.terminalScanPay"),
204
+ value: a(f).enum.TERMINAL_SCAN_PAY
205
+ }, null, 8, ["modelValue", "label", "value"]),
206
+ i(D, {
207
+ modelValue: g.value,
208
+ "onUpdate:modelValue": [
209
+ m[7] || (m[7] = (c) => g.value = c),
210
+ T
211
+ ],
212
+ label: a(e)("order.terminalQrPay"),
213
+ value: a(f).enum.TERMINAL_QR_PAY
214
+ }, null, 8, ["modelValue", "label", "value"])
215
+ ])
216
+ ], 512), [
217
+ [N, A.value]
218
+ ])
219
+ ]),
220
+ _: 1
221
+ })
222
+ ]),
223
+ _: 1
224
+ })
225
+ ]),
226
+ _: 1
227
+ }, 8, ["payment-types", "offline-payment-types", "allow-e-payment", "allow-credit"]);
228
+ };
229
+ }
230
+ }), ze = {
231
+ "en-US": "English",
232
+ "zh-CN": "中文",
233
+ "th-TH": "ไทย",
234
+ "vi-VN": "Tiếng Việt",
235
+ "id-ID": "Bahasa Indonesia",
236
+ "ko-KR": "한국어",
237
+ "ja-JP": "日本語",
238
+ "ar-SA": "العربية"
239
+ }, Qe = Le.map((o) => ({
240
+ code: o,
241
+ label: ze[o]
242
+ }));
243
+ var Xe = { firebase: {} }, Je = {};
244
+ let Q = null;
245
+ function Ze(o) {
246
+ var u;
247
+ const s = (u = o.name.split(".").pop()) == null ? void 0 : u.toLowerCase();
248
+ return s && /^[a-z0-9]+$/.test(s) ? s : {
249
+ "image/jpeg": "jpg",
250
+ "image/png": "png",
251
+ "image/webp": "webp",
252
+ "image/gif": "gif"
253
+ }[o.type] ?? "bin";
254
+ }
255
+ function ea() {
256
+ var e;
257
+ return (((e = Je.firebase) == null ? void 0 : e.storageBucket) ?? Xe.firebase.storageBucket ?? "image.feedme.cc").replace(/^https?:\/\//, "").replace(/\/+$/, "");
258
+ }
259
+ function aa(o) {
260
+ const s = o.replace(/^\/+/, "");
261
+ return `https://${ea()}/${s}`;
262
+ }
263
+ async function la() {
264
+ const o = be();
265
+ if (!o.currentUser && (await o.authStateReady(), !o.currentUser && (Q || (Q = (async () => {
266
+ const s = await Ie.getCustomToken();
267
+ await ge(o, s);
268
+ })().finally(() => {
269
+ Q = null;
270
+ })), await Q, !o.currentUser)))
271
+ throw new Error("User not authenticated for image upload");
272
+ }
273
+ async function ta() {
274
+ const o = be();
275
+ o.currentUser && await Oe(o);
276
+ const s = await Ie.getCustomToken();
277
+ await ge(o, s);
278
+ }
279
+ async function na(o, s) {
280
+ const e = Ne(), u = pe(e, o);
281
+ try {
282
+ await ce(u, s, {
283
+ contentType: s.type || void 0
284
+ });
285
+ return;
286
+ } catch (_) {
287
+ if ((_ == null ? void 0 : _.code) !== "storage/unauthorized")
288
+ throw _;
289
+ }
290
+ await ta();
291
+ const h = pe(e, o);
292
+ await ce(h, s, {
293
+ contentType: s.type || void 0
294
+ });
295
+ }
296
+ async function oa(o, s) {
297
+ await la();
298
+ const e = o.replace(/^\/+/, "").replace(/\/+$/, ""), u = Ze(s), h = `${Date.now()}_${Math.random().toString(36).slice(2, 10)}.${u}`, _ = `${e}/${h}`;
299
+ return await na(_, s), aa(_);
300
+ }
301
+ const X = 8, ye = 6, _e = 2, Se = 60, ra = {
302
+ landscape: "coverImageLandscape",
303
+ portrait: "coverImagePortrait"
304
+ };
305
+ function Pe(o) {
306
+ if (!Array.isArray(o)) return [];
307
+ const s = /* @__PURE__ */ new Set(), e = [];
308
+ for (const u of o) {
309
+ const h = typeof u == "string" ? u.trim() : "";
310
+ !h || s.has(h) || (s.add(h), e.push(h));
311
+ }
312
+ return e;
313
+ }
314
+ function J(o, s) {
315
+ var e;
316
+ return Pe((e = o.coverCarousel) == null ? void 0 : e[s]);
317
+ }
318
+ function sa(o, s) {
319
+ const e = o[ra[s]], u = typeof e == "string" ? e.trim() : "";
320
+ return u.length > 0 ? u : null;
321
+ }
322
+ function da(o, s) {
323
+ const e = J(o, s);
324
+ if (e.length > 0) return e;
325
+ const u = sa(o, s);
326
+ return u ? [u] : [];
327
+ }
328
+ function ia(o) {
329
+ var e;
330
+ const s = (e = o.coverCarousel) == null ? void 0 : e.intervalMs;
331
+ return typeof s != "number" || !Number.isFinite(s) || s <= 0 ? null : Math.round(s / 1e3);
332
+ }
333
+ function Ce(o, s, e) {
334
+ return o.length === 0 && s.length === 0 ? null : {
335
+ landscape: o.length > 0 ? o : void 0,
336
+ portrait: s.length > 0 ? s : void 0,
337
+ intervalMs: typeof e == "number" && e > 0 ? e : void 0
338
+ };
339
+ }
340
+ function ua(o, s, e) {
341
+ var I;
342
+ const u = Pe(e).slice(0, X), h = s === "landscape" ? "portrait" : "landscape", _ = {
343
+ [s]: u.length > 1 ? u : [],
344
+ [h]: J(o, h)
345
+ };
346
+ return {
347
+ coverImageLandscape: s === "landscape" ? u[0] ?? null : o.coverImageLandscape,
348
+ coverImagePortrait: s === "portrait" ? u[0] ?? null : o.coverImagePortrait,
349
+ coverCarousel: Ce(
350
+ _.landscape,
351
+ _.portrait,
352
+ (I = o.coverCarousel) == null ? void 0 : I.intervalMs
353
+ )
354
+ };
355
+ }
356
+ function ma(o, s) {
357
+ const e = s == null || !Number.isFinite(s) ? null : Math.min(Se, Math.max(_e, Math.round(s)));
358
+ return {
359
+ coverImageLandscape: o.coverImageLandscape,
360
+ coverImagePortrait: o.coverImagePortrait,
361
+ coverCarousel: Ce(
362
+ J(o, "landscape"),
363
+ J(o, "portrait"),
364
+ e == null ? null : e * 1e3
365
+ )
366
+ };
367
+ }
368
+ function pa(o, s, e) {
369
+ if (s === e) return [...o];
370
+ if (s < 0 || e < 0 || s >= o.length || e >= o.length) return [...o];
371
+ const u = [...o], [h] = u.splice(s, 1);
372
+ return u.splice(e, 0, h), u;
373
+ }
374
+ const ca = {
375
+ key: 0,
376
+ class: "flex flex-col gap-32"
377
+ }, ya = {
378
+ key: 0,
379
+ class: "flex flex-col gap-2"
380
+ }, va = { class: "fm-typo-en-title-sm-600" }, fa = { class: "flex flex-col gap-1 w-full md:w-1/2" }, ba = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ga = { class: "flex flex-col gap-2" }, ha = { class: "fm-typo-en-title-sm-600" }, Ia = { class: "flex flex-col gap-5" }, _a = { class: "flex flex-col gap-16" }, Sa = { class: "border p-[1.5rem] fm-corner-radius-lg flex flex-col gap-2 my-5 w-11/12" }, Pa = { class: "fm-typo-en-title-sm-600" }, Ca = { class: "border p-[1.5rem] fm-corner-radius-lg flex flex-col gap-2 my-5 w-11/12" }, xa = { class: "fm-typo-en-title-sm-600" }, wa = { class: "flex flex-row gap-2" }, Va = { class: "border p-[1.5rem] fm-corner-radius-lg flex flex-col gap-2 my-5 w-11/12" }, ka = { class: "fm-typo-en-title-sm-600" }, Aa = { class: "flex flex-col gap-2" }, Ta = { class: "fm-typo-en-title-sm-600" }, Ra = { class: "border p-[1.5rem] fm-corner-radius-lg flex flex-col gap-2 my-5 w-11/12" }, Ea = { class: "fm-typo-en-title-sm-600" }, Ua = { class: "flex flex-col gap-2" }, Fa = { class: "fm-typo-en-title-sm-600" }, Na = { class: "flex flex-col gap-2" }, Oa = { class: "fm-typo-en-title-sm-600" }, La = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ma = { class: "border p-[1.5rem] fm-corner-radius-lg flex flex-col gap-4 my-5 w-11/12" }, Wa = { class: "grid grid-cols-1 md:grid-cols-2 gap-3" }, Da = {
381
+ key: 0,
382
+ class: "fm-typo-en-body-sm-400 text-fm-color-system-error-300"
383
+ }, $a = { class: "flex flex-col gap-2" }, Ya = { class: "fm-typo-en-title-sm-600" }, Ga = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ka = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ja = { class: "fm-typo-en-body-md-600" }, qa = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ba = { class: "flex flex-wrap items-start gap-4" }, Ha = { class: "relative" }, za = ["src", "alt"], Qa = { class: "absolute top-2 left-2 px-2 rounded-full bg-fm-color-typo-primary text-fm-color-neutral-white fm-typo-en-body-sm-400" }, Xa = { class: "flex items-center gap-1" }, Ja = {
384
+ key: 0,
385
+ class: "w-11/12"
386
+ }, Za = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, el = { class: "flex flex-col gap-2" }, al = { class: "fm-typo-en-title-sm-600" }, ll = { class: "w-11/12" }, tl = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, nl = { class: "flex flex-col gap-2" }, ol = { class: "fm-typo-en-title-sm-600" }, rl = { class: "flex flex-col gap-2" }, sl = { key: 1 }, dl = 10 * 1e3 * 1e3, ve = 1e5, vl = /* @__PURE__ */ fe({
387
+ __name: "KioskSettingView",
388
+ props: {
389
+ restaurantId: {},
390
+ form: {}
391
+ },
392
+ emits: ["updateKioskOrderSetting"],
393
+ setup(o, { emit: s }) {
394
+ const { t: e } = he(), u = Ye(), h = x(() => {
395
+ var t;
396
+ return ((t = u.sessionUser.value) == null ? void 0 : t.role.isAdmin) ?? !1;
397
+ }), _ = o, I = Ge(), g = s, l = Y(_.form), U = Qe, A = x(() => l.value.languages != null), G = x(() => l.value.languages ?? []);
398
+ function Z(t) {
399
+ l.value.languages = t ? ["en-US"] : null;
400
+ }
401
+ function T(t, r) {
402
+ const p = l.value.languages ?? [];
403
+ l.value.languages = r ? U.filter((y) => y.code === t || p.includes(y.code)).map((y) => y.code) : p.filter((y) => y !== t);
404
+ }
405
+ const W = (t) => t < 0 ? e("order.nonNegativeRule") : !0, H = (t) => t <= (l.value.dineIn.displayStand.standSlotRange.min ?? 0) ? e("order.greaterThanMinRule") : !0, ee = x(() => [W]), b = x(() => [W]), m = x(() => [W, H]), O = x(() => {
406
+ var y, S, L, M, z, n, k, C;
407
+ const t = l.value, r = (y = t.otaChannel) == null ? void 0 : y.trim();
408
+ if (t.dineIn.enabled && t.dineIn.displayStand.enabled) {
409
+ const { padDigit: P, standSlotRange: $ } = t.dineIn.displayStand;
410
+ if (!(P != null && P >= 0 && $.min != null && $.max != null && $.min <= $.max)) return null;
411
+ }
412
+ if (t.languages != null && t.languages.length === 0 || t.minWeighGrams != null && (!Number.isInteger(t.minWeighGrams) || t.minWeighGrams < 1 || t.minWeighGrams > ve))
413
+ return null;
414
+ const p = t.paymentSetting;
415
+ if ((S = p == null ? void 0 : p.paymentTypes) != null && S.includes(Me.enum.ePayment)) {
416
+ const P = p.ePaymentTypes;
417
+ if (!P) return null;
418
+ const $ = ((L = P.card) == null ? void 0 : L.terminal) || ((M = P.card) == null ? void 0 : M.nfc), ue = ((z = P.eWallet) == null ? void 0 : z.qrPay) || ((n = P.eWallet) == null ? void 0 : n.scanPay) || ((k = P.eWallet) == null ? void 0 : k.terminalScanPay) || ((C = P.eWallet) == null ? void 0 : C.terminalQrPay), Re = P.terminal;
419
+ if (!$ && !ue && !Re) return null;
420
+ }
421
+ return {
422
+ ...t,
423
+ otaChannel: r || void 0,
424
+ dineIn: {
425
+ ...t.dineIn,
426
+ displayStand: {
427
+ ...t.dineIn.displayStand,
428
+ enabled: t.dineIn.enabled && t.dineIn.displayStand.enabled,
429
+ padDigit: t.dineIn.displayStand.padDigit ?? 0,
430
+ standSlotRange: {
431
+ min: t.dineIn.displayStand.standSlotRange.min ?? 0,
432
+ max: t.dineIn.displayStand.standSlotRange.max ?? 10
433
+ },
434
+ prefix: t.dineIn.displayStand.prefix ?? ""
435
+ }
436
+ }
437
+ };
438
+ }), { startAsyncCall: K } = De();
439
+ function ae(t) {
440
+ l.value.paymentSetting.paymentTypes = t;
441
+ }
442
+ function j(t) {
443
+ l.value.paymentSetting.ePaymentTypes = t;
444
+ }
445
+ const q = $e(), D = [
446
+ {
447
+ value: "landscape",
448
+ labelKey: "order.coverImageLandscape",
449
+ hintKey: "order.coverImageLandscapeHint",
450
+ previewClass: "w-[280px] aspect-video",
451
+ dropClass: "w-[280px] aspect-video"
452
+ },
453
+ {
454
+ value: "portrait",
455
+ labelKey: "order.coverImagePortrait",
456
+ hintKey: "order.coverImagePortraitHint",
457
+ previewClass: "w-[160px] aspect-[9/16]",
458
+ dropClass: "w-[160px] aspect-[9/16]"
459
+ }
460
+ ];
461
+ function c(t) {
462
+ return da(l.value, t);
463
+ }
464
+ const xe = x(
465
+ () => c("landscape").length > 1 || c("portrait").length > 1
466
+ );
467
+ function le(t, r) {
468
+ Object.assign(
469
+ l.value,
470
+ ua(l.value, t, r)
471
+ );
472
+ }
473
+ function re(t, r, p) {
474
+ le(t, pa(c(t), r, p));
475
+ }
476
+ function we(t, r) {
477
+ const p = c(t).filter((y, S) => S !== r);
478
+ le(t, p);
479
+ }
480
+ const se = x({
481
+ get: () => l.value.minWeighGrams ?? null,
482
+ set: (t) => {
483
+ l.value.minWeighGrams = typeof t == "number" && Number.isFinite(t) && t >= 1 ? Math.trunc(t) : null;
484
+ }
485
+ }), de = x({
486
+ get: () => ia(l.value),
487
+ set: (t) => {
488
+ Object.assign(
489
+ l.value,
490
+ ma(l.value, t)
491
+ );
492
+ }
493
+ });
494
+ async function Ve(t, r) {
495
+ if (!(c(t).length >= X))
496
+ try {
497
+ const p = await K(async () => {
498
+ const y = `/restaurant/${_.restaurantId}/kiosk/cover-${t}`;
499
+ return await oa(y, r);
500
+ });
501
+ le(t, [...c(t), p]), I.open({
502
+ title: e("order.imageUploadSuccess"),
503
+ type: "success"
504
+ });
505
+ } catch (p) {
506
+ console.error(p), I.open({
507
+ title: e("order.imageUploadFailed"),
508
+ type: "error"
509
+ });
510
+ }
511
+ }
512
+ function ke(t, r) {
513
+ var S, L;
514
+ const p = e(t === "landscape" ? "order.coverImageLandscape" : "order.coverImagePortrait"), y = (L = (S = r[0]) == null ? void 0 : S.reason) == null ? void 0 : L[0];
515
+ I.open({
516
+ title: y ? `${e("order.imageUploadRejected")}: ${p} (${y})` : `${e("order.imageUploadRejected")}: ${p}`,
517
+ type: "error"
518
+ });
519
+ }
520
+ const Ae = x(() => q.getRestaurantEPayment()), ie = x({
521
+ get: () => (l.value.dineIn.displayStand.enabled && l.value.dineIn.displayStand.enablePaxDialog || l.value.dineIn.pickUp.enablePaxDialog) ?? !1,
522
+ set: (t) => {
523
+ l.value.dineIn.displayStand.enablePaxDialog = t, l.value.dineIn.pickUp.enablePaxDialog = t;
524
+ }
525
+ });
526
+ Ue(
527
+ () => [
528
+ l.value.dineIn.enabled,
529
+ l.value.dineIn.pickUp.enabled,
530
+ l.value.dineIn.displayStand.enabled
531
+ ],
532
+ ([t, r, p], y) => {
533
+ const S = (y == null ? void 0 : y[0]) ?? !1;
534
+ t && !r && !p && (l.value.dineIn.pickUp.enabled = !0, S || I.open({
535
+ title: e("order.dineInModeAutoCorrected"),
536
+ type: "info"
537
+ }));
538
+ },
539
+ { immediate: !0 }
540
+ );
541
+ async function Te() {
542
+ if (O.value) {
543
+ const t = O.value;
544
+ K(async () => {
545
+ await g("updateKioskOrderSetting", t);
546
+ });
547
+ } else
548
+ I.open({
549
+ title: e("order.failedToUpdateSetting"),
550
+ type: "error"
551
+ });
552
+ }
553
+ return (t, r) => {
554
+ const p = V("FmTextField"), y = V("FmSwitch"), S = V("FmStepperField"), L = V("FmCheckbox"), M = V("FmButton"), z = V("FmDropField");
555
+ return l.value ? (w(), E("div", ca, [
556
+ h.value ? (w(), E("div", ya, [
557
+ d("span", va, v(a(e)("order.otaChannel")), 1),
558
+ d("div", fa, [
559
+ i(p, {
560
+ modelValue: l.value.otaChannel,
561
+ "onUpdate:modelValue": r[0] || (r[0] = (n) => l.value.otaChannel = n),
562
+ label: a(e)("order.otaChannel"),
563
+ placeholder: a(e)("order.otaChannelHint")
564
+ }, null, 8, ["modelValue", "label", "placeholder"]),
565
+ d("span", ba, v(a(e)("order.otaChannelHint")), 1)
566
+ ])
567
+ ])) : B("", !0),
568
+ d("div", ga, [
569
+ d("span", ha, v(a(e)("order.dineIn")), 1),
570
+ d("div", Ia, [
571
+ i(y, {
572
+ modelValue: l.value.dineIn.enabled,
573
+ "onUpdate:modelValue": r[1] || (r[1] = (n) => l.value.dineIn.enabled = n),
574
+ label: a(e)("order.dineIn"),
575
+ "label-placement": "right"
576
+ }, null, 8, ["modelValue", "label"]),
577
+ F(d("div", _a, [
578
+ d("div", null, [
579
+ i(y, {
580
+ modelValue: l.value.dineIn.pickUp.enabled,
581
+ "onUpdate:modelValue": r[2] || (r[2] = (n) => l.value.dineIn.pickUp.enabled = n),
582
+ label: a(e)("order.pickAtCounter"),
583
+ "label-placement": "right"
584
+ }, null, 8, ["modelValue", "label"]),
585
+ F(d("div", Sa, [
586
+ d("span", Pa, v(a(e)("order.submitOrderInstruction")), 1),
587
+ i(p, {
588
+ modelValue: l.value.dineIn.pickUp.submitOrderInstruction.payAtCounter,
589
+ "onUpdate:modelValue": r[3] || (r[3] = (n) => l.value.dineIn.pickUp.submitOrderInstruction.payAtCounter = n),
590
+ label: a(e)("order.payAtCounter"),
591
+ placeholder: "Collect your transaction slip below and present it to the cashier"
592
+ }, null, 8, ["modelValue", "label"]),
593
+ i(p, {
594
+ modelValue: l.value.dineIn.pickUp.submitOrderInstruction.paid,
595
+ "onUpdate:modelValue": r[4] || (r[4] = (n) => l.value.dineIn.pickUp.submitOrderInstruction.paid = n),
596
+ label: a(e)("order.paid"),
597
+ placeholder: "Please wait as we prepare your food. We'll call your number when it's ready."
598
+ }, null, 8, ["modelValue", "label"])
599
+ ], 512), [
600
+ [N, l.value.dineIn.pickUp.enabled]
601
+ ])
602
+ ]),
603
+ d("div", null, [
604
+ i(y, {
605
+ modelValue: l.value.dineIn.displayStand.enabled,
606
+ "onUpdate:modelValue": r[5] || (r[5] = (n) => l.value.dineIn.displayStand.enabled = n),
607
+ label: a(e)("order.displayStand"),
608
+ "label-placement": "right"
609
+ }, null, 8, ["modelValue", "label"]),
610
+ F(d("div", Ca, [
611
+ d("span", xa, v(a(e)("order.tableServiceSetting")), 1),
612
+ i(p, {
613
+ modelValue: l.value.dineIn.displayStand.prefix,
614
+ "onUpdate:modelValue": r[6] || (r[6] = (n) => l.value.dineIn.displayStand.prefix = n),
615
+ label: a(e)("order.prefix"),
616
+ placeholder: a(e)("order.prefix")
617
+ }, null, 8, ["modelValue", "label", "placeholder"]),
618
+ d("div", wa, [
619
+ i(S, {
620
+ modelValue: l.value.dineIn.displayStand.standSlotRange.min,
621
+ "onUpdate:modelValue": r[7] || (r[7] = (n) => l.value.dineIn.displayStand.standSlotRange.min = n),
622
+ class: "w-1/2",
623
+ label: a(e)("order.start"),
624
+ labelMark: "required",
625
+ rules: b.value,
626
+ placeholder: a(e)("order.enterANumber")
627
+ }, null, 8, ["modelValue", "label", "rules", "placeholder"]),
628
+ i(S, {
629
+ modelValue: l.value.dineIn.displayStand.standSlotRange.max,
630
+ "onUpdate:modelValue": r[8] || (r[8] = (n) => l.value.dineIn.displayStand.standSlotRange.max = n),
631
+ class: "w-1/2",
632
+ label: a(e)("order.end"),
633
+ labelMark: "required",
634
+ rules: m.value,
635
+ placeholder: a(e)("order.enterANumber")
636
+ }, null, 8, ["modelValue", "label", "rules", "placeholder"])
637
+ ]),
638
+ i(S, {
639
+ modelValue: l.value.dineIn.displayStand.padDigit,
640
+ "onUpdate:modelValue": r[9] || (r[9] = (n) => l.value.dineIn.displayStand.padDigit = n),
641
+ label: a(e)("order.padDigit"),
642
+ labelMark: "required",
643
+ rules: ee.value,
644
+ placeholder: a(e)("order.padDigit")
645
+ }, null, 8, ["modelValue", "label", "rules", "placeholder"])
646
+ ], 512), [
647
+ [N, l.value.dineIn.displayStand.enabled]
648
+ ]),
649
+ F(d("div", Va, [
650
+ d("span", ka, v(a(e)("order.submitOrderInstruction")), 1),
651
+ i(p, {
652
+ modelValue: l.value.dineIn.displayStand.submitOrderInstruction.payAtCounter,
653
+ "onUpdate:modelValue": r[10] || (r[10] = (n) => l.value.dineIn.displayStand.submitOrderInstruction.payAtCounter = n),
654
+ label: a(e)("order.payAtCounter"),
655
+ placeholder: "Collect your transaction slip below and present it to the cashier"
656
+ }, null, 8, ["modelValue", "label"]),
657
+ i(p, {
658
+ modelValue: l.value.dineIn.displayStand.submitOrderInstruction.paid,
659
+ "onUpdate:modelValue": r[11] || (r[11] = (n) => l.value.dineIn.displayStand.submitOrderInstruction.paid = n),
660
+ label: a(e)("order.paid"),
661
+ placeholder: "Please collect your receipt and we'll bring your food to your table once it's ready."
662
+ }, null, 8, ["modelValue", "label"])
663
+ ], 512), [
664
+ [N, l.value.dineIn.displayStand.enabled]
665
+ ])
666
+ ])
667
+ ], 512), [
668
+ [N, l.value.dineIn.enabled]
669
+ ])
670
+ ])
671
+ ]),
672
+ d("div", Aa, [
673
+ d("span", Ta, v(a(e)("order.takeawayTitle")), 1),
674
+ i(y, {
675
+ modelValue: l.value.takeaway.enabled,
676
+ "onUpdate:modelValue": r[12] || (r[12] = (n) => l.value.takeaway.enabled = n),
677
+ label: a(e)("order.takeaway"),
678
+ "label-placement": "right",
679
+ class: "mb-5"
680
+ }, null, 8, ["modelValue", "label"]),
681
+ F(d("div", Ra, [
682
+ d("span", Ea, v(a(e)("order.submitOrderInstruction")), 1),
683
+ i(p, {
684
+ modelValue: l.value.takeaway.submitOrderInstruction.payAtCounter,
685
+ "onUpdate:modelValue": r[13] || (r[13] = (n) => l.value.takeaway.submitOrderInstruction.payAtCounter = n),
686
+ label: a(e)("order.payAtCounter"),
687
+ placeholder: "Collect your transaction slip below and present it to the cashier"
688
+ }, null, 8, ["modelValue", "label"]),
689
+ i(p, {
690
+ modelValue: l.value.takeaway.submitOrderInstruction.paid,
691
+ "onUpdate:modelValue": r[14] || (r[14] = (n) => l.value.takeaway.submitOrderInstruction.paid = n),
692
+ label: a(e)("order.paid"),
693
+ placeholder: "Please wait as we prepare your food. We'll call your number when it's ready."
694
+ }, null, 8, ["modelValue", "label"])
695
+ ], 512), [
696
+ [N, l.value.takeaway.enabled]
697
+ ])
698
+ ]),
699
+ d("div", Ua, [
700
+ d("span", Fa, v(a(e)("order.menuItem")), 1),
701
+ i(y, {
702
+ modelValue: l.value.menuItem.showAllOnly,
703
+ "onUpdate:modelValue": r[15] || (r[15] = (n) => l.value.menuItem.showAllOnly = n),
704
+ label: a(e)("order.showNotAvailableMenuItem"),
705
+ "label-placement": "right",
706
+ class: "mb-5"
707
+ }, null, 8, ["modelValue", "label"])
708
+ ]),
709
+ d("div", Na, [
710
+ d("span", Oa, v(a(e)("order.kioskLanguage")), 1),
711
+ d("span", La, v(a(e)("order.kioskLanguageHint")), 1),
712
+ d("div", Ma, [
713
+ i(y, {
714
+ "model-value": A.value,
715
+ label: a(e)("order.kioskLanguageRestrict"),
716
+ sublabel: a(e)("order.kioskLanguageRestrictSublabel"),
717
+ "label-placement": "right",
718
+ "onUpdate:modelValue": Z
719
+ }, null, 8, ["model-value", "label", "sublabel"]),
720
+ F(d("div", Wa, [
721
+ (w(!0), E(te, null, ne(a(U), (n) => (w(), oe(L, {
722
+ key: n.code,
723
+ "model-value": G.value.includes(n.code),
724
+ value: n.code,
725
+ label: n.label,
726
+ "onUpdate:modelValue": (k) => T(n.code, k)
727
+ }, null, 8, ["model-value", "value", "label", "onUpdate:modelValue"]))), 128))
728
+ ], 512), [
729
+ [N, A.value]
730
+ ]),
731
+ A.value && G.value.length === 0 ? (w(), E("span", Da, v(a(e)("order.kioskLanguageAtLeastOne")), 1)) : B("", !0)
732
+ ])
733
+ ]),
734
+ d("div", $a, [
735
+ d("span", Ya, v(a(e)("order.coverImage")), 1),
736
+ d("span", Ga, v(a(e)("order.coverImageFallbackHint")), 1),
737
+ d("span", Ka, v(a(e)("order.coverCarouselHint", { max: a(X) })), 1),
738
+ (w(), E(te, null, ne(D, (n) => d("div", {
739
+ key: n.value,
740
+ class: "border p-[1.5rem] fm-corner-radius-lg flex flex-col gap-4 my-5 w-11/12"
741
+ }, [
742
+ d("span", ja, v(a(e)(n.labelKey)), 1),
743
+ d("span", qa, v(a(e)(n.hintKey)), 1),
744
+ d("div", Ba, [
745
+ (w(!0), E(te, null, ne(c(n.value), (k, C) => (w(), E("div", {
746
+ key: `${n.value}-${C}-${k}`,
747
+ class: "flex flex-col gap-2"
748
+ }, [
749
+ d("div", Ha, [
750
+ d("img", {
751
+ src: k,
752
+ alt: `${a(e)(n.labelKey)} ${C + 1}`,
753
+ class: Fe([
754
+ n.previewClass,
755
+ "object-cover rounded-md border border-fm-color-neutral-gray-200"
756
+ ])
757
+ }, null, 10, za),
758
+ d("span", Qa, v(C + 1), 1)
759
+ ]),
760
+ d("div", Xa, [
761
+ i(M, {
762
+ variant: "tertiary",
763
+ size: "md",
764
+ "prepend-icon": "arrow_back",
765
+ disabled: C === 0,
766
+ "aria-label": a(e)("order.coverCarouselMoveEarlier"),
767
+ onClick: (P) => re(n.value, C, C - 1)
768
+ }, null, 8, ["disabled", "aria-label", "onClick"]),
769
+ i(M, {
770
+ variant: "tertiary",
771
+ size: "md",
772
+ "prepend-icon": "arrow_forward",
773
+ disabled: C === c(n.value).length - 1,
774
+ "aria-label": a(e)("order.coverCarouselMoveLater"),
775
+ onClick: (P) => re(n.value, C, C + 1)
776
+ }, null, 8, ["disabled", "aria-label", "onClick"]),
777
+ i(M, {
778
+ variant: "tertiary",
779
+ size: "md",
780
+ "prepend-icon": "delete",
781
+ "aria-label": a(e)("common.delete"),
782
+ onClick: (P) => we(n.value, C)
783
+ }, null, 8, ["aria-label", "onClick"])
784
+ ])
785
+ ]))), 128)),
786
+ c(n.value).length < a(X) ? (w(), oe(z, {
787
+ key: 0,
788
+ accept: "image/*",
789
+ "max-file-size": dl,
790
+ "content-class": n.dropClass,
791
+ onFileUpload: (k) => Ve(n.value, k),
792
+ onFileRejected: (k) => ke(n.value, k)
793
+ }, null, 8, ["content-class", "onFileUpload", "onFileRejected"])) : B("", !0)
794
+ ])
795
+ ])), 64)),
796
+ xe.value ? (w(), E("div", Ja, [
797
+ i(S, {
798
+ modelValue: de.value,
799
+ "onUpdate:modelValue": r[16] || (r[16] = (n) => de.value = n),
800
+ class: "max-w-[240px]",
801
+ label: a(e)("order.coverCarouselInterval"),
802
+ min: a(_e),
803
+ max: a(Se),
804
+ placeholder: String(a(ye))
805
+ }, null, 8, ["modelValue", "label", "min", "max", "placeholder"]),
806
+ d("span", Za, v(a(e)("order.coverCarouselIntervalHint", { seconds: a(ye) })), 1)
807
+ ])) : B("", !0)
808
+ ]),
809
+ d("div", el, [
810
+ d("span", al, v(a(e)("order.minWeighGrams")), 1),
811
+ d("div", ll, [
812
+ i(S, {
813
+ modelValue: se.value,
814
+ "onUpdate:modelValue": r[17] || (r[17] = (n) => se.value = n),
815
+ class: "max-w-[240px]",
816
+ label: a(e)("order.minWeighGramsLabel"),
817
+ min: 1,
818
+ max: ve,
819
+ placeholder: a(e)("order.minWeighGramsPlaceholder")
820
+ }, null, 8, ["modelValue", "label", "placeholder"]),
821
+ d("span", tl, v(a(e)("order.minWeighGramsHint")), 1)
822
+ ])
823
+ ]),
824
+ d("div", nl, [
825
+ d("span", ol, v(a(e)("order.displayPaxDialogTitle")), 1),
826
+ i(y, {
827
+ modelValue: ie.value,
828
+ "onUpdate:modelValue": r[18] || (r[18] = (n) => ie.value = n),
829
+ label: a(e)("order.displayPaxDialogDescription"),
830
+ "label-placement": "right",
831
+ class: "mb-5"
832
+ }, null, 8, ["modelValue", "label"])
833
+ ]),
834
+ B("", !0),
835
+ d("div", rl, [
836
+ i(He, {
837
+ "payment-types": l.value.paymentSetting.paymentTypes ?? [],
838
+ "allow-credit": !0,
839
+ "allow-e-payment": Ae.value,
840
+ "offline-payment-types": l.value.paymentSetting.offlinePaymentTypes ?? [],
841
+ ePaymentTypes: l.value.paymentSetting.ePaymentTypes ?? {},
842
+ "onUpdate:paymentTypes": ae,
843
+ "onUpdate:offlinePaymentTypes": r[20] || (r[20] = (n) => l.value.paymentSetting.offlinePaymentTypes = n),
844
+ "onUpdate:ePaymentTypes": j
845
+ }, null, 8, ["payment-types", "allow-e-payment", "offline-payment-types", "ePaymentTypes"])
846
+ ]),
847
+ i(M, {
848
+ class: "w-1/4 mb-10",
849
+ variant: "primary",
850
+ label: a(e)("order.updateSetting"),
851
+ disabled: !O.value,
852
+ onClick: Te
853
+ }, null, 8, ["label", "disabled"])
854
+ ])) : (w(), E("div", sl, v(a(e)("order.pleaseSelectRestaurant")), 1));
855
+ };
856
+ }
857
+ });
858
+ export {
859
+ vl as default
860
+ };