@feedmepos/mf-order-setting 0.0.95 → 0.0.96

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 (88) hide show
  1. package/dist/{DisplaySystemView-rCw3DE0u.js → DisplaySystemView-BH8SkCOF.js} +4 -4
  2. package/dist/FoodCourtInvitationsView-3cA0Z-5m.js +383 -0
  3. package/dist/FoodCourtOrderSettingsView-DysrLZJD.js +294 -0
  4. package/dist/FoodCourtOrdersView-CbZqHIXO.js +544 -0
  5. package/dist/FoodCourtStallsView-CTZzPUQ6.js +635 -0
  6. package/dist/FoodCourtStatusView-C71y7ghx.js +113 -0
  7. package/dist/{KioskDevicesView-B4dgvMq_.js → KioskDevicesView-BJpbuSzp.js} +1 -1
  8. package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-B-Oi8ZLq.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-CQFpwn28.js} +7 -6
  9. package/dist/{KioskSettingView-DXx6wQQQ.js → KioskSettingView-CJxhMf7N.js} +3 -3
  10. package/dist/{KioskView-BmSHCl13.js → KioskView-BZsdRID1.js} +6 -6
  11. package/dist/{OrderSettingsView-9NOSAxLf.js → OrderSettingsView-gnyXaJjf.js} +10631 -10601
  12. package/dist/{app-y20uA-tu.js → app-CeEFBB-w.js} +4484 -3672
  13. package/dist/app.js +1 -1
  14. package/dist/dayjs.min-zBHHlxAP.js +285 -0
  15. package/dist/{featureFlag-GHmH1G2d.js → featureFlag-BTY_R78k.js} +1 -1
  16. package/dist/food-court-member-piX3gesl.js +212 -0
  17. package/dist/frontend/mf-order/src/api/food-court/index.d.ts +269 -0
  18. package/dist/frontend/mf-order/src/api/food-court/invitation.d.ts +55 -0
  19. package/dist/frontend/mf-order/src/app.d.ts +676 -0
  20. package/dist/frontend/mf-order/src/main.d.ts +676 -0
  21. package/dist/frontend/mf-order/src/stores/business/index.d.ts +3 -3
  22. package/dist/frontend/mf-order/src/stores/order-setting/index.d.ts +6 -0
  23. package/dist/frontend/mf-order/src/utils/constants/route.d.ts +4 -0
  24. package/dist/frontend/mf-order/src/views/food-court/FoodCourtInvitationsView.vue.d.ts +2 -0
  25. package/dist/frontend/mf-order/src/views/food-court/FoodCourtOrdersView.vue.d.ts +2 -0
  26. package/dist/frontend/mf-order/src/views/food-court/FoodCourtStallsView.vue.d.ts +2 -0
  27. package/dist/frontend/mf-order/src/views/food-court/FoodCourtStatusView.vue.d.ts +2 -0
  28. package/dist/frontend/mf-order/src/views/food-court/food-court-member.d.ts +150 -0
  29. package/dist/frontend/mf-order/src/views/food-court/food-court-order.d.ts +66 -0
  30. package/dist/frontend/mf-order/src/views/food-court/invitations/JoinFoodCourtCard.vue.d.ts +13 -0
  31. package/dist/frontend/mf-order/src/views/food-court/invitations/MembershipRowActions.vue.d.ts +11 -0
  32. package/dist/frontend/mf-order/src/views/food-court/orders/FoodCourtOrderSheet.vue.d.ts +16 -0
  33. package/dist/frontend/mf-order/src/views/food-court/stalls/EditStallSheet.vue.d.ts +15 -0
  34. package/dist/frontend/mf-order/src/views/food-court/stalls/GenerateJoinCodeSheet.vue.d.ts +21 -0
  35. package/dist/frontend/mf-order/src/views/food-court/stalls/StallAssignmentFields.vue.d.ts +16 -0
  36. package/dist/frontend/mf-order/src/views/food-court/stalls/StallRowActions.vue.d.ts +11 -0
  37. package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
  38. package/dist/{index-CmdP_QXF.js → index-601eG3_R.js} +1 -1
  39. package/dist/index-BeBZTUcq.js +122 -0
  40. package/dist/index-BtudnkMi.js +1065 -0
  41. package/dist/{index-BlG6mIU4.js → index-CGiWgTn1.js} +38 -37
  42. package/dist/{index-wMygvJpP.js → index-D5nv3ncu.js} +2 -2
  43. package/dist/index-DLDihONy.js +25142 -0
  44. package/dist/order.dto-JM_fmWnQ.js +14842 -0
  45. package/dist/package/entity/food-court/food-court.do.d.ts +1 -1
  46. package/dist/package/entity/food-court/food-court.dto.d.ts +7 -7
  47. package/dist/package/entity/food-court/order-v2.dto.d.ts +4 -4
  48. package/dist/package/entity/order-platform/order-platform.dto.d.ts +190 -92
  49. package/dist/package/entity/order-setting/order-setting.do.d.ts +10 -0
  50. package/dist/package/entity/order-setting/order-setting.dto.d.ts +20 -0
  51. package/dist/package/entity/order-setting/queue/queue.do.d.ts +22 -0
  52. package/dist/package/entity/order-setting/queue/queue.dto.d.ts +7 -0
  53. package/dist/package/entity/queue/queue.do.d.ts +1 -0
  54. package/dist/package/entity/queue/queue.dto.d.ts +8 -8
  55. package/dist/package/entity/restaurant/restaurant.dto.d.ts +20 -0
  56. package/dist/search-BAPEUu1R.js +15 -0
  57. package/dist/useFoodCourtContext-2p5sJMcB.js +16 -0
  58. package/package.json +3 -3
  59. package/src/api/food-court/index.ts +357 -0
  60. package/src/api/food-court/invitation.ts +81 -0
  61. package/src/locales/en-US.json +171 -2
  62. package/src/locales/ja-JP.json +171 -2
  63. package/src/locales/th-TH.json +171 -2
  64. package/src/locales/zh-CN.json +171 -2
  65. package/src/router/routes.ts +44 -0
  66. package/src/utils/constants/route.ts +8 -0
  67. package/src/views/food-court/FoodCourtInvitationsView.vue +187 -0
  68. package/src/views/food-court/FoodCourtOrdersView.vue +263 -0
  69. package/src/views/food-court/FoodCourtStallsView.vue +369 -0
  70. package/src/views/food-court/FoodCourtStatusView.vue +111 -0
  71. package/src/views/food-court/food-court-member.spec.ts +339 -0
  72. package/src/views/food-court/food-court-member.ts +397 -0
  73. package/src/views/food-court/food-court-order.spec.ts +137 -0
  74. package/src/views/food-court/food-court-order.ts +206 -0
  75. package/src/views/food-court/invitations/JoinFoodCourtCard.vue +201 -0
  76. package/src/views/food-court/invitations/MembershipRowActions.vue +19 -0
  77. package/src/views/food-court/orders/FoodCourtOrderSheet.vue +226 -0
  78. package/src/views/food-court/stalls/EditStallSheet.vue +91 -0
  79. package/src/views/food-court/stalls/GenerateJoinCodeSheet.vue +281 -0
  80. package/src/views/food-court/stalls/StallAssignmentFields.vue +36 -0
  81. package/src/views/food-court/stalls/StallRowActions.vue +31 -0
  82. package/src/views/order-settings/OrderSettingsView.vue +2 -4
  83. package/src/views/order-settings/dine-in/DineInSetting.vue +1 -4
  84. package/src/views/order-settings/queue/QueueSetting.vue +27 -0
  85. package/src/views/order-settings/reservation/ReservationSetting.vue +8 -0
  86. package/dist/FoodCourtOrderSettingsView-DUQXCKzB.js +0 -323
  87. package/dist/index-CUI1lL9F.js +0 -1347
  88. package/dist/order.dto-CyHtvyly.js +0 -38829
@@ -0,0 +1,635 @@
1
+ import { defineComponent as P, computed as $, resolveComponent as I, openBlock as u, createBlock as D, withCtx as O, createElementBlock as g, Fragment as K, renderList as le, unref as o, createVNode as f, createCommentVNode as H, ref as S, watch as Z, createElementVNode as b, toDisplayString as F, nextTick as ne, h as Y, isRef as re } from "vue";
2
+ import { d as ae } from "./dayjs.min-zBHHlxAP.js";
3
+ import { useI18n as z } from "@feedmepos/mf-common";
4
+ import { useDialog as de, components as ie } from "@feedmepos/ui-library";
5
+ import { u as ee } from "./snackbar-DZQ0_reQ.js";
6
+ import { u as ue } from "./useFoodCourtContext-2p5sJMcB.js";
7
+ import { u as ce } from "./search-BAPEUu1R.js";
8
+ import { a as U, b as L } from "./index-BeBZTUcq.js";
9
+ import { S as me, a as fe, b as oe, J as q, c as te, f as pe, j as ve, d as Ce, e as X, s as ye, g as W, h as be, t as ge, r as xe } from "./food-court-member-piX3gesl.js";
10
+ const _e = /* @__PURE__ */ P({
11
+ __name: "StallRowActions",
12
+ props: {
13
+ listStatus: {}
14
+ },
15
+ emits: ["action"],
16
+ setup(x, { emit: d }) {
17
+ const h = x, p = d, { t: l } = z(), i = $(() => me[h.listStatus] ?? []);
18
+ return (T, _) => {
19
+ const v = I("FmButton"), C = I("FmMenuItem"), k = I("FmMenu");
20
+ return i.value.length ? (u(), D(k, {
21
+ key: 0,
22
+ "stop-click-propagation": ""
23
+ }, {
24
+ "menu-button": O(() => [
25
+ f(v, {
26
+ variant: "tertiary",
27
+ icon: "more_vert"
28
+ })
29
+ ]),
30
+ default: O(() => [
31
+ (u(!0), g(K, null, le(i.value, (c) => (u(), D(C, {
32
+ key: c,
33
+ label: o(l)(o(fe)[c]),
34
+ onClick: (a) => p("action", c)
35
+ }, null, 8, ["label", "onClick"]))), 128))
36
+ ]),
37
+ _: 1
38
+ })) : H("", !0);
39
+ };
40
+ }
41
+ }), he = { class: "flex flex-col gap-5" }, se = /* @__PURE__ */ P({
42
+ __name: "StallAssignmentFields",
43
+ props: {
44
+ unitNo: {},
45
+ displayName: {}
46
+ },
47
+ emits: ["update:unitNo", "update:displayName"],
48
+ setup(x, { emit: d }) {
49
+ const h = d, { t: p } = z();
50
+ return (l, i) => {
51
+ const T = I("FmTextField");
52
+ return u(), g("div", he, [
53
+ f(T, {
54
+ "model-value": x.unitNo,
55
+ label: o(p)("order.foodCourt.stalls.stallNumber"),
56
+ "label-mark": "optional",
57
+ "max-length": o(oe),
58
+ "onUpdate:modelValue": i[0] || (i[0] = (_) => h("update:unitNo", _))
59
+ }, null, 8, ["model-value", "label", "max-length"]),
60
+ f(T, {
61
+ "model-value": x.displayName,
62
+ label: o(p)("order.foodCourt.stalls.displayName"),
63
+ "label-mark": "optional",
64
+ "helper-text": o(p)("order.foodCourt.stalls.displayNameHint"),
65
+ "max-length": o(oe),
66
+ "onUpdate:modelValue": i[1] || (i[1] = (_) => h("update:displayName", _))
67
+ }, null, 8, ["model-value", "label", "helper-text", "max-length"])
68
+ ]);
69
+ };
70
+ }
71
+ }), Se = {
72
+ key: 0,
73
+ class: "flex flex-col gap-5"
74
+ }, Ne = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ke = {
75
+ key: 1,
76
+ class: "flex flex-col gap-4"
77
+ }, Fe = { class: "flex flex-col items-center gap-3 p-6 rounded-lg bg-fm-color-neutral-gray-100" }, Ie = {
78
+ class: "font-mono text-[2rem] leading-tight font-semibold tracking-[0.12em] select-all break-all text-center",
79
+ "data-testid": "food-court-join-code"
80
+ }, Te = { class: "fm-typo-en-body-md-600" }, Ve = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, we = {
81
+ key: 0,
82
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
83
+ }, Ae = {
84
+ key: 2,
85
+ class: "flex flex-col gap-4"
86
+ }, Me = { class: "flex flex-col px-4 rounded-lg bg-fm-color-neutral-gray-100" }, $e = {
87
+ class: "font-mono text-[1.25rem] leading-tight font-semibold tracking-[0.12em] select-all",
88
+ "data-testid": "food-court-join-code"
89
+ }, je = { class: "fm-typo-en-body-md-600" }, Be = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ee = {
90
+ key: 0,
91
+ class: "flex gap-8 items-center justify-start"
92
+ }, Je = {
93
+ key: 1,
94
+ class: "flex gap-8 items-center justify-start"
95
+ }, Le = /* @__PURE__ */ P({
96
+ __name: "GenerateJoinCodeSheet",
97
+ props: {
98
+ modelValue: { type: Boolean },
99
+ foodCourtId: {}
100
+ },
101
+ emits: ["update:modelValue", "created"],
102
+ setup(x, { emit: d }) {
103
+ const h = x, p = d, { t: l } = z(), { showSuccess: i, showError: T } = ee(), _ = S(""), v = S(""), C = S(q.min), k = $(() => te(C.value)), c = S(!1), a = S(null);
104
+ let A = 0;
105
+ const j = $(() => a.value ? a.value.length > 1 ? l("order.foodCourt.stalls.codesTitle") : l("order.foodCourt.stalls.codeTitle") : l("order.foodCourt.stalls.generateTitle")), N = $(
106
+ () => (a.value ?? []).map((s) => ({ id: s.joinCode._id, code: pe(s.code) }))
107
+ ), B = $(
108
+ () => ve((a.value ?? []).map((s) => s.code))
109
+ ), G = $(() => {
110
+ var n;
111
+ const s = (n = a.value) == null ? void 0 : n[0];
112
+ return s ? ae(s.joinCode.expiresAt).format("DD MMM YYYY, h:mm A") : "";
113
+ }), M = $(() => {
114
+ var V, e;
115
+ const s = (e = (V = a.value) == null ? void 0 : V[0]) == null ? void 0 : e.joinCode.stall, n = [
116
+ s != null && s.unitNo ? l("order.foodCourt.invitations.stallBadge", { number: s.unitNo }) : null,
117
+ (s == null ? void 0 : s.displayName) || null
118
+ ].filter(Boolean);
119
+ return n.length ? l("order.foodCourt.stalls.codeForStall", { stall: n.join(" · ") }) : null;
120
+ });
121
+ Z(
122
+ () => h.modelValue,
123
+ (s) => {
124
+ A++, a.value = null, s && (_.value = "", v.value = "", C.value = q.min);
125
+ }
126
+ );
127
+ async function E(s) {
128
+ if (C.value = s, s === null) return;
129
+ const n = te(s);
130
+ n !== s && (await ne(), C.value = n);
131
+ }
132
+ async function Q() {
133
+ if (c.value) return;
134
+ const s = h.foodCourtId, n = A, V = k.value;
135
+ c.value = !0;
136
+ try {
137
+ const e = V > 1 ? (await U.createJoinCodes(s, V)).codes : [
138
+ await U.createJoinCode(
139
+ s,
140
+ Ce(_.value, v.value)
141
+ )
142
+ ];
143
+ if (n !== A || s !== h.foodCourtId) return;
144
+ a.value = e;
145
+ } catch (e) {
146
+ T(X(e));
147
+ } finally {
148
+ c.value = !1, p("created");
149
+ }
150
+ }
151
+ async function R(s, n) {
152
+ const V = l(n);
153
+ try {
154
+ await navigator.clipboard.writeText(s), i(l("order.copiedToClipboard", { label: V }));
155
+ } catch {
156
+ T(l("order.copyToClipboardFailed", { label: V }));
157
+ }
158
+ }
159
+ return (s, n) => {
160
+ const V = I("FmStepperField"), e = I("FmButton"), t = I("FmSideSheet");
161
+ return u(), D(t, {
162
+ "model-value": x.modelValue,
163
+ header: j.value,
164
+ "dismiss-away": !a.value,
165
+ "max-width": 480,
166
+ "onUpdate:modelValue": n[6] || (n[6] = (r) => p("update:modelValue", r))
167
+ }, {
168
+ "side-sheet-footer": O(() => [
169
+ a.value ? (u(), g("div", Je, [
170
+ f(e, {
171
+ variant: "primary",
172
+ label: o(l)("order.foodCourt.stalls.codeDone"),
173
+ size: "lg",
174
+ onClick: n[5] || (n[5] = (r) => p("update:modelValue", !1))
175
+ }, null, 8, ["label"])
176
+ ])) : (u(), g("div", Ee, [
177
+ f(e, {
178
+ variant: "primary",
179
+ label: k.value > 1 ? o(l)("order.foodCourt.stalls.generateCodes", { count: k.value }) : o(l)("order.foodCourt.stalls.generateCode"),
180
+ size: "lg",
181
+ disabled: c.value,
182
+ onClick: Q
183
+ }, null, 8, ["label", "disabled"]),
184
+ f(e, {
185
+ variant: "secondary",
186
+ label: o(l)("order.cancel"),
187
+ size: "lg",
188
+ onClick: n[4] || (n[4] = (r) => p("update:modelValue", !1))
189
+ }, null, 8, ["label"])
190
+ ]))
191
+ ]),
192
+ default: O(() => [
193
+ a.value ? N.value.length === 1 ? (u(), g("div", ke, [
194
+ b("div", Fe, [
195
+ b("span", Ie, F(N.value[0].code), 1),
196
+ f(e, {
197
+ variant: "secondary",
198
+ "prepend-icon": "content_copy",
199
+ label: o(l)("order.copy"),
200
+ onClick: n[2] || (n[2] = (r) => R(N.value[0].code, "order.foodCourt.stalls.joinCode"))
201
+ }, null, 8, ["label"])
202
+ ]),
203
+ b("span", Te, F(o(l)("order.foodCourt.stalls.codeExpires", { date: G.value })), 1),
204
+ b("span", Ve, F(o(l)("order.foodCourt.stalls.codeShareHint")), 1),
205
+ M.value ? (u(), g("span", we, F(M.value), 1)) : H("", !0)
206
+ ])) : (u(), g("div", Ae, [
207
+ b("ul", Me, [
208
+ (u(!0), g(K, null, le(N.value, (r) => (u(), g("li", {
209
+ key: r.id,
210
+ class: "flex items-center justify-between gap-3 py-2 border-b border-fm-color-neutral-gray-200 last:border-b-0"
211
+ }, [
212
+ b("span", $e, F(r.code), 1),
213
+ f(e, {
214
+ variant: "tertiary",
215
+ "prepend-icon": "content_copy",
216
+ label: o(l)("order.copy"),
217
+ onClick: (y) => R(r.code, "order.foodCourt.stalls.joinCode")
218
+ }, null, 8, ["label", "onClick"])
219
+ ]))), 128))
220
+ ]),
221
+ b("div", null, [
222
+ f(e, {
223
+ variant: "secondary",
224
+ "prepend-icon": "content_copy",
225
+ label: o(l)("order.foodCourt.stalls.copyAll"),
226
+ "data-testid": "food-court-join-codes-copy-all",
227
+ onClick: n[3] || (n[3] = (r) => R(B.value, "order.foodCourt.stalls.joinCodes"))
228
+ }, null, 8, ["label"])
229
+ ]),
230
+ b("span", je, F(o(l)("order.foodCourt.stalls.codeExpires", { date: G.value })), 1),
231
+ b("span", Be, F(o(l)("order.foodCourt.stalls.codesShareHint")), 1)
232
+ ])) : (u(), g("div", Se, [
233
+ b("span", Ne, F(k.value > 1 ? o(l)("order.foodCourt.stalls.generateIntroMany") : o(l)("order.foodCourt.stalls.generateIntro")), 1),
234
+ f(V, {
235
+ "model-value": C.value,
236
+ label: o(l)("order.foodCourt.stalls.codeCount"),
237
+ "helper-text": o(l)("order.foodCourt.stalls.codeCountHint"),
238
+ placeholder: String(o(q).min),
239
+ min: o(q).min,
240
+ max: o(q).max,
241
+ "max-fraction-digits": 0,
242
+ "use-grouping": !1,
243
+ "data-testid": "food-court-join-code-count",
244
+ "onUpdate:modelValue": E
245
+ }, null, 8, ["model-value", "label", "helper-text", "placeholder", "min", "max"]),
246
+ k.value === 1 ? (u(), D(se, {
247
+ key: 0,
248
+ "unit-no": _.value,
249
+ "onUpdate:unitNo": n[0] || (n[0] = (r) => _.value = r),
250
+ "display-name": v.value,
251
+ "onUpdate:displayName": n[1] || (n[1] = (r) => v.value = r)
252
+ }, null, 8, ["unit-no", "display-name"])) : H("", !0)
253
+ ]))
254
+ ]),
255
+ _: 1
256
+ }, 8, ["model-value", "header", "dismiss-away"]);
257
+ };
258
+ }
259
+ }), Ue = {
260
+ key: 0,
261
+ class: "flex flex-col gap-5"
262
+ }, De = { class: "flex flex-col" }, Oe = { class: "fm-typo-en-body-lg-600" }, Re = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, Ye = { class: "flex gap-8 items-center justify-start" }, qe = /* @__PURE__ */ P({
263
+ __name: "EditStallSheet",
264
+ props: {
265
+ modelValue: { type: Boolean },
266
+ foodCourtId: {},
267
+ member: {}
268
+ },
269
+ emits: ["update:modelValue", "saved"],
270
+ setup(x, { emit: d }) {
271
+ const h = x, p = d, { t: l } = z(), { showSuccess: i, showError: T } = ee(), _ = S(""), v = S(""), C = S(!1);
272
+ Z(
273
+ () => [h.modelValue, h.member],
274
+ ([c, a]) => {
275
+ !c || !a || (_.value = a.unitNo ?? "", v.value = a.displayName ?? a.restaurantName ?? "");
276
+ },
277
+ { immediate: !0 }
278
+ );
279
+ async function k() {
280
+ const c = h.member;
281
+ if (!(!c || C.value)) {
282
+ C.value = !0;
283
+ try {
284
+ await L.updateMember(h.foodCourtId, {
285
+ memberId: c.memberId,
286
+ stall: ye(_.value, v.value, c.restaurantName)
287
+ }), i(l("order.foodCourt.stalls.updated")), p("saved"), p("update:modelValue", !1);
288
+ } catch (a) {
289
+ T(X(a));
290
+ } finally {
291
+ C.value = !1;
292
+ }
293
+ }
294
+ }
295
+ return (c, a) => {
296
+ const A = I("FmButton"), j = I("FmSideSheet");
297
+ return u(), D(j, {
298
+ "model-value": x.modelValue,
299
+ header: o(l)("order.foodCourt.stalls.editTitle"),
300
+ "dismiss-away": "",
301
+ "max-width": 480,
302
+ "onUpdate:modelValue": a[3] || (a[3] = (N) => p("update:modelValue", N))
303
+ }, {
304
+ "side-sheet-footer": O(() => [
305
+ b("div", Ye, [
306
+ f(A, {
307
+ variant: "primary",
308
+ label: o(l)("order.save"),
309
+ size: "lg",
310
+ disabled: C.value || !x.member,
311
+ onClick: k
312
+ }, null, 8, ["label", "disabled"]),
313
+ f(A, {
314
+ variant: "secondary",
315
+ label: o(l)("order.cancel"),
316
+ size: "lg",
317
+ onClick: a[2] || (a[2] = (N) => p("update:modelValue", !1))
318
+ }, null, 8, ["label"])
319
+ ])
320
+ ]),
321
+ default: O(() => [
322
+ x.member ? (u(), g("div", Ue, [
323
+ b("div", De, [
324
+ b("span", Oe, F(x.member.restaurantName || x.member.restaurantId), 1),
325
+ b("span", Re, F(x.member.restaurantId), 1)
326
+ ]),
327
+ f(se, {
328
+ "unit-no": _.value,
329
+ "onUpdate:unitNo": a[0] || (a[0] = (N) => _.value = N),
330
+ "display-name": v.value,
331
+ "onUpdate:displayName": a[1] || (a[1] = (N) => v.value = N)
332
+ }, null, 8, ["unit-no", "display-name"])
333
+ ])) : H("", !0)
334
+ ]),
335
+ _: 1
336
+ }, 8, ["model-value", "header"]);
337
+ };
338
+ }
339
+ }), He = { class: "py-[1.5rem]" }, Pe = {
340
+ key: 0,
341
+ class: "px-[1.5rem] fm-typo-en-body-md-400 text-fm-color-typo-secondary"
342
+ }, ze = {
343
+ key: 1,
344
+ class: "p-[1.5rem] m-5 flex flex-col gap-3 items-start"
345
+ }, Ge = { class: "fm-typo-en-body-md-400" }, Ke = {
346
+ key: 2,
347
+ class: "px-[1.5rem] flex flex-col gap-4"
348
+ }, Xe = { class: "flex items-center justify-between gap-3 flex-wrap" }, Qe = {
349
+ key: 1,
350
+ class: "text-center py-8 text-fm-color-typo-tertiary fm-typo-en-body-md-400"
351
+ }, ro = /* @__PURE__ */ P({
352
+ __name: "FoodCourtStallsView",
353
+ setup(x) {
354
+ const { t: d } = z(), { showSuccess: h, showError: p } = ee(), l = de(), i = ue(), { searchKey: T, filter: _ } = ce(), v = S([]), C = S(!1), k = S(!1), c = S(!1), a = S(!1), A = S(null), j = S(!1), N = $(
355
+ () => v.value.filter(
356
+ (e) => _([
357
+ e.unitNo ?? "",
358
+ W(e),
359
+ e.restaurantName ?? "",
360
+ e.restaurantId ?? "",
361
+ e.kind === "joinCode" ? e.businessName ?? "" : ""
362
+ ])
363
+ )
364
+ );
365
+ async function B() {
366
+ const e = i.value;
367
+ if (k.value = !1, !e) {
368
+ v.value = [];
369
+ return;
370
+ }
371
+ C.value = !0;
372
+ try {
373
+ const [t, r] = await Promise.all([
374
+ L.listMembers(e),
375
+ U.listJoinCodes(e)
376
+ ]);
377
+ e === i.value && (v.value = ge(t, r));
378
+ } catch (t) {
379
+ if (e !== i.value) return;
380
+ k.value = !0, p(X(t));
381
+ } finally {
382
+ e === i.value && (C.value = !1);
383
+ }
384
+ }
385
+ function G() {
386
+ c.value = !1, a.value = !1, A.value = null, j.value && (j.value = !1, l.close());
387
+ }
388
+ Z(
389
+ i,
390
+ () => {
391
+ G(), v.value = [], B();
392
+ },
393
+ { immediate: !0 }
394
+ );
395
+ async function M(e, t, r) {
396
+ if (e === i.value) {
397
+ try {
398
+ await t(e), h(d(r));
399
+ } catch (y) {
400
+ p(X(y));
401
+ }
402
+ e === i.value && await B();
403
+ }
404
+ }
405
+ function E(e, t, r) {
406
+ const y = i.value;
407
+ if (!y) return;
408
+ j.value = !0;
409
+ const m = () => {
410
+ j.value = !1;
411
+ };
412
+ l.open({
413
+ title: d(t.title),
414
+ message: d(t.message, { stall: W(e) }),
415
+ primaryActions: { text: d(t.confirm), variant: "destructive", close: !0 },
416
+ secondaryActions: { text: d("order.cancel"), variant: "tertiary", close: !0 }
417
+ }).onPrimary(() => (m(), r(y))).onSecondary(m).onClose(m);
418
+ }
419
+ function Q(e, t) {
420
+ const r = i.value;
421
+ if (!r) return;
422
+ const { memberId: y } = e;
423
+ switch (t) {
424
+ case "edit":
425
+ A.value = e, a.value = !0;
426
+ return;
427
+ case "deactivate":
428
+ E(
429
+ e,
430
+ {
431
+ title: "order.foodCourt.stalls.deactivateTitle",
432
+ message: "order.foodCourt.stalls.deactivateMessage",
433
+ confirm: "order.foodCourt.stalls.actionDeactivate"
434
+ },
435
+ (m) => M(
436
+ m,
437
+ (w) => L.updateMember(w, { memberId: y, visible: !1 }),
438
+ "order.foodCourt.stalls.deactivated"
439
+ )
440
+ );
441
+ return;
442
+ case "activate":
443
+ M(
444
+ r,
445
+ (m) => L.updateMember(m, { memberId: y, visible: !0 }),
446
+ "order.foodCourt.stalls.activated"
447
+ );
448
+ return;
449
+ case "remove":
450
+ E(
451
+ e,
452
+ {
453
+ title: "order.foodCourt.stalls.removeTitle",
454
+ message: "order.foodCourt.stalls.removeMessage",
455
+ confirm: "order.foodCourt.stalls.actionRemove"
456
+ },
457
+ (m) => M(
458
+ m,
459
+ (w) => L.removeMember(w, y),
460
+ "order.foodCourt.stalls.removed"
461
+ )
462
+ );
463
+ return;
464
+ case "cancelInvite":
465
+ E(
466
+ e,
467
+ {
468
+ title: "order.foodCourt.stalls.cancelInviteTitle",
469
+ message: "order.foodCourt.stalls.cancelInviteMessage",
470
+ confirm: "order.foodCourt.stalls.actionCancelInvite"
471
+ },
472
+ (m) => M(
473
+ m,
474
+ (w) => L.revokeInvite(w, y),
475
+ "order.foodCourt.stalls.inviteCancelled"
476
+ )
477
+ );
478
+ return;
479
+ }
480
+ }
481
+ function R(e, t) {
482
+ const r = i.value;
483
+ if (!r) return;
484
+ const { joinCodeId: y } = e;
485
+ switch (t) {
486
+ case "approve":
487
+ M(
488
+ r,
489
+ (m) => U.approveJoinRequest(m, y),
490
+ "order.foodCourt.stalls.requestApproved"
491
+ );
492
+ return;
493
+ case "decline":
494
+ E(
495
+ e,
496
+ {
497
+ title: "order.foodCourt.stalls.declineRequestTitle",
498
+ message: "order.foodCourt.stalls.declineRequestMessage",
499
+ confirm: "order.foodCourt.stalls.actionDecline"
500
+ },
501
+ (m) => M(
502
+ m,
503
+ (w) => U.declineJoinRequest(w, y),
504
+ "order.foodCourt.stalls.requestDeclined"
505
+ )
506
+ );
507
+ return;
508
+ case "cancelCode":
509
+ E(
510
+ e,
511
+ {
512
+ title: "order.foodCourt.stalls.cancelCodeTitle",
513
+ message: "order.foodCourt.stalls.cancelCodeMessage",
514
+ confirm: "order.foodCourt.stalls.actionCancelCode"
515
+ },
516
+ (m) => M(
517
+ m,
518
+ (w) => U.cancelJoinCode(w, y),
519
+ "order.foodCourt.stalls.codeCancelled"
520
+ )
521
+ );
522
+ return;
523
+ }
524
+ }
525
+ function s(e, t) {
526
+ e.kind === "member" ? Q(e, t) : R(e, t);
527
+ }
528
+ function n(e) {
529
+ const t = W(e) || d("order.foodCourt.stalls.codeNoStall");
530
+ if (e.kind === "member") return t;
531
+ const r = e.status === "PENDING" ? d("order.foodCourt.stalls.requestedBy", { outlet: xe(e) }) : d("order.foodCourt.stalls.codeExpires", {
532
+ date: ae(e.expiresAt).format("DD MMM YYYY, h:mm A")
533
+ });
534
+ return Y("div", { class: "flex flex-col min-w-0" }, [
535
+ Y("span", t),
536
+ Y("span", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, r)
537
+ ]);
538
+ }
539
+ const V = $(() => [
540
+ {
541
+ id: "unitNo",
542
+ header: () => d("order.foodCourt.stalls.columnNo"),
543
+ cell: ({ row: e }) => e.original.unitNo || "-",
544
+ enableSorting: !1,
545
+ meta: { width: "96px" }
546
+ },
547
+ {
548
+ id: "stall",
549
+ header: () => d("order.foodCourt.stalls.columnStall"),
550
+ cell: ({ row: e }) => n(e.original),
551
+ enableSorting: !1
552
+ },
553
+ {
554
+ id: "status",
555
+ header: () => d("order.foodCourt.stalls.columnStatus"),
556
+ cell: ({ row: e }) => {
557
+ const t = be[e.original.listStatus];
558
+ return t ? Y(ie.FmChip, { variant: t.variant, label: d(t.labelKey) }) : "-";
559
+ },
560
+ enableSorting: !1
561
+ },
562
+ {
563
+ id: "actions",
564
+ header: () => "",
565
+ cell: ({ row: e }) => Y(_e, {
566
+ listStatus: e.original.listStatus,
567
+ onAction: (t) => s(e.original, t)
568
+ }),
569
+ enableSorting: !1,
570
+ meta: { width: "64px" }
571
+ }
572
+ ]);
573
+ return (e, t) => {
574
+ const r = I("FmPageHead"), y = I("FmButton"), m = I("FmSearch"), w = I("FmTable");
575
+ return u(), g(K, null, [
576
+ b("div", He, [
577
+ f(r, {
578
+ title: o(d)("order.foodCourt.stalls.title"),
579
+ "line-height": 1.7
580
+ }, null, 8, ["title"])
581
+ ]),
582
+ o(i) ? k.value ? (u(), g("div", ze, [
583
+ b("span", Ge, F(o(d)("order.foodCourt.stalls.loadFailed")), 1),
584
+ f(y, {
585
+ variant: "secondary",
586
+ label: o(d)("order.foodCourt.retry"),
587
+ onClick: B
588
+ }, null, 8, ["label"])
589
+ ])) : (u(), g("div", Ke, [
590
+ b("div", Xe, [
591
+ f(m, {
592
+ modelValue: o(T),
593
+ "onUpdate:modelValue": t[0] || (t[0] = (J) => re(T) ? T.value = J : null),
594
+ class: "flex-1 min-w-[200px] max-w-[400px]",
595
+ placeholder: o(d)("order.foodCourt.stalls.searchPlaceholder")
596
+ }, null, 8, ["modelValue", "placeholder"]),
597
+ f(y, {
598
+ variant: "primary",
599
+ "prepend-icon": "add",
600
+ label: o(d)("order.foodCourt.stalls.generateJoinCode"),
601
+ onClick: t[1] || (t[1] = (J) => c.value = !0)
602
+ }, null, 8, ["label"])
603
+ ]),
604
+ C.value || N.value.length ? (u(), D(w, {
605
+ key: 0,
606
+ "row-data": N.value,
607
+ "column-defs": V.value,
608
+ loading: C.value,
609
+ "hide-footer": !0,
610
+ "page-size": 1e3,
611
+ class: "w-full"
612
+ }, null, 8, ["row-data", "column-defs", "loading"])) : (u(), g("div", Qe, F(v.value.length ? o(d)("order.foodCourt.stalls.noMatch") : o(d)("order.foodCourt.stalls.empty")), 1))
613
+ ])) : (u(), g("div", Pe, F(o(d)("order.foodCourt.noFoodCourtSelected")), 1)),
614
+ o(i) ? (u(), g(K, { key: 3 }, [
615
+ f(Le, {
616
+ modelValue: c.value,
617
+ "onUpdate:modelValue": t[2] || (t[2] = (J) => c.value = J),
618
+ "food-court-id": o(i),
619
+ onCreated: B
620
+ }, null, 8, ["modelValue", "food-court-id"]),
621
+ f(qe, {
622
+ modelValue: a.value,
623
+ "onUpdate:modelValue": t[3] || (t[3] = (J) => a.value = J),
624
+ "food-court-id": o(i),
625
+ member: A.value,
626
+ onSaved: B
627
+ }, null, 8, ["modelValue", "food-court-id", "member"])
628
+ ], 64)) : H("", !0)
629
+ ], 64);
630
+ };
631
+ }
632
+ });
633
+ export {
634
+ ro as default
635
+ };