@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
@@ -2,12 +2,12 @@ import { ref as K, defineComponent as he, computed as V, watch as be, resolveCom
2
2
  import { useRoute as es, useRouter as ts } from "vue-router";
3
3
  import { useI18n as Pe, useCoreStore as at, RestaurantSelector as os } from "@feedmepos/mf-common";
4
4
  import { u as Ka } from "./snackbar-DZQ0_reQ.js";
5
- import { D as Ja } from "./order.dto-CyHtvyly.js";
5
+ import { D as Ja } from "./order.dto-JM_fmWnQ.js";
6
6
  import { defineStore as as } from "pinia";
7
- import { g as nt, a as Za, d as ns, c as so } from "./index-CmdP_QXF.js";
7
+ import { g as nt, a as Za, d as ns, c as so } from "./index-601eG3_R.js";
8
8
  import { useDialogChild as ss, useDialog as Ya } from "@feedmepos/ui-library";
9
- import { _ as We, u as ls, e as rs } from "./featureFlag-GHmH1G2d.js";
10
- import { A as is, v as Xa, u as ds } from "./app-y20uA-tu.js";
9
+ import { _ as We, u as ls, e as rs } from "./featureFlag-BTY_R78k.js";
10
+ import { A as is, v as Xa, u as ds } from "./app-CeEFBB-w.js";
11
11
  function Qa(e) {
12
12
  return JSON.parse(JSON.stringify(e));
13
13
  }
@@ -0,0 +1,383 @@
1
+ import { defineComponent as K, resolveComponent as C, openBlock as u, createBlock as P, withCtx as D, createVNode as y, unref as r, createCommentVNode as S, ref as b, computed as F, watch as Y, createElementVNode as d, toDisplayString as p, createElementBlock as m, Fragment as N, withKeys as G, h as R, isRef as O } from "vue";
2
+ import { d as W } from "./dayjs.min-zBHHlxAP.js";
3
+ import { useI18n as H, useCoreStore as Q } from "@feedmepos/mf-common";
4
+ import { useDialog as X, components as Z } from "@feedmepos/ui-library";
5
+ import { u as ee } from "./snackbar-DZQ0_reQ.js";
6
+ import { u as te } from "./search-BAPEUu1R.js";
7
+ import { g as $, b as q } from "./index-601eG3_R.js";
8
+ import { f as oe } from "./index-BeBZTUcq.js";
9
+ import { i as ae, n as V, k as ne, l as re, e as E, M as se, m as le } from "./food-court-member-piX3gesl.js";
10
+ const U = () => q("/foodcourt-v2/join-codes"), J = {
11
+ /** One item per court that has a row for this restaurant. */
12
+ async listMemberships(v) {
13
+ return $(
14
+ await q(`/restaurants/${v}/foodcourt-memberships`).get("")
15
+ );
16
+ },
17
+ /** Leave a food court this restaurant has joined; rejoining needs a new join code. */
18
+ async leaveFoodCourt(v, t) {
19
+ return $(
20
+ await oe(v).post("/members/leave", { memberId: t })
21
+ );
22
+ },
23
+ /** Which court a code belongs to. A wrong code counts as a failed attempt. */
24
+ async previewJoinCode(v) {
25
+ return $(
26
+ await U().post("/preview", { code: v })
27
+ );
28
+ },
29
+ /** Ask to join the code's court as `restaurantId`; the owner then approves or declines. */
30
+ async redeemJoinCode(v, t) {
31
+ return $(
32
+ await U().post("/redeem", { code: v, restaurantId: t })
33
+ );
34
+ }
35
+ }, ie = /* @__PURE__ */ K({
36
+ __name: "MembershipRowActions",
37
+ props: {
38
+ status: {}
39
+ },
40
+ emits: ["leave"],
41
+ setup(v, { emit: t }) {
42
+ const l = t, { t: f } = H();
43
+ return (h, i) => {
44
+ const s = C("FmButton"), _ = C("FmMenuItem"), c = C("FmMenu");
45
+ return v.status === "JOINED" ? (u(), P(c, {
46
+ key: 0,
47
+ "stop-click-propagation": ""
48
+ }, {
49
+ "menu-button": D(() => [
50
+ y(s, {
51
+ variant: "tertiary",
52
+ icon: "more_vert"
53
+ })
54
+ ]),
55
+ default: D(() => [
56
+ y(_, {
57
+ label: r(f)("order.foodCourt.invitations.leave"),
58
+ onClick: i[0] || (i[0] = (B) => l("leave"))
59
+ }, null, 8, ["label"])
60
+ ]),
61
+ _: 1
62
+ })) : S("", !0);
63
+ };
64
+ }
65
+ }), ue = { class: "flex flex-col gap-1" }, de = { class: "fm-typo-en-title-sm-600" }, ce = {
66
+ key: 0,
67
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
68
+ }, me = { class: "flex flex-col gap-1 p-3 rounded-lg bg-fm-color-neutral-gray-100 min-w-0" }, ve = { class: "fm-typo-en-body-lg-600 break-words" }, fe = {
69
+ key: 0,
70
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary break-words"
71
+ }, pe = {
72
+ key: 1,
73
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
74
+ }, ye = {
75
+ key: 0,
76
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-error"
77
+ }, _e = { class: "flex gap-4 flex-wrap" }, Ce = { class: "flex items-start gap-3" }, he = { class: "flex flex-col gap-1 min-w-0" }, be = { class: "fm-typo-en-body-lg-600" }, ge = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary break-words" }, xe = /* @__PURE__ */ K({
78
+ __name: "JoinFoodCourtCard",
79
+ props: {
80
+ restaurantId: {},
81
+ restaurantName: {}
82
+ },
83
+ setup(v) {
84
+ const t = v, { t: l } = H(), f = b("enter"), h = b(""), i = b(!1), s = b(null), _ = b(null), c = b(""), B = F(() => t.restaurantName || t.restaurantId), g = F(() => {
85
+ var o;
86
+ return ae((o = _.value) == null ? void 0 : o.address);
87
+ }), x = F(() => {
88
+ var e;
89
+ const o = (e = _.value) == null ? void 0 : e.stall, n = [
90
+ o != null && o.unitNo ? l("order.foodCourt.invitations.stallBadge", { number: o.unitNo }) : null,
91
+ (o == null ? void 0 : o.displayName) || null
92
+ ].filter(Boolean);
93
+ return n.length ? l("order.foodCourt.invitations.joinAsStall", { stall: n.join(" · ") }) : null;
94
+ });
95
+ function k(o) {
96
+ const n = re(o);
97
+ return n ? l(n) : E(o);
98
+ }
99
+ function w() {
100
+ f.value = "enter", h.value = "", s.value = null, _.value = null;
101
+ }
102
+ Y(
103
+ () => t.restaurantId,
104
+ () => w()
105
+ );
106
+ async function A() {
107
+ if (i.value) return;
108
+ if (!ne(h.value)) {
109
+ s.value = l("order.foodCourt.joinErrors.malformed");
110
+ return;
111
+ }
112
+ const o = t.restaurantId;
113
+ i.value = !0, s.value = null;
114
+ try {
115
+ const n = await J.previewJoinCode(V(h.value));
116
+ if (o !== t.restaurantId) return;
117
+ _.value = n, f.value = "preview";
118
+ } catch (n) {
119
+ if (o !== t.restaurantId) return;
120
+ s.value = k(n);
121
+ } finally {
122
+ i.value = !1;
123
+ }
124
+ }
125
+ async function M() {
126
+ const o = _.value;
127
+ if (!o || i.value) return;
128
+ const n = t.restaurantId;
129
+ i.value = !0, s.value = null;
130
+ try {
131
+ const e = await J.redeemJoinCode(
132
+ V(h.value),
133
+ n
134
+ );
135
+ if (n !== t.restaurantId) return;
136
+ c.value = e.name || o.name, f.value = "sent";
137
+ } catch (e) {
138
+ if (n !== t.restaurantId) return;
139
+ s.value = k(e);
140
+ } finally {
141
+ i.value = !1;
142
+ }
143
+ }
144
+ return (o, n) => {
145
+ const e = C("FmTextField"), a = C("FmButton"), j = C("FmIcon"), T = C("FmCard");
146
+ return u(), P(T, {
147
+ variant: "outlined",
148
+ class: "p-4 flex flex-col gap-4 max-w-[560px]"
149
+ }, {
150
+ default: D(() => [
151
+ d("div", ue, [
152
+ d("span", de, p(r(l)("order.foodCourt.invitations.joinTitle")), 1),
153
+ f.value === "enter" ? (u(), m("span", ce, p(r(l)("order.foodCourt.invitations.joinIntro")), 1)) : S("", !0)
154
+ ]),
155
+ f.value === "enter" ? (u(), m(N, { key: 0 }, [
156
+ y(e, {
157
+ modelValue: h.value,
158
+ "onUpdate:modelValue": [
159
+ n[0] || (n[0] = (I) => h.value = I),
160
+ n[1] || (n[1] = (I) => s.value = null)
161
+ ],
162
+ label: r(l)("order.foodCourt.invitations.joinCode"),
163
+ placeholder: "ABCDE-FGHJK",
164
+ "max-length": 24,
165
+ formatter: (I) => I.toUpperCase(),
166
+ "helper-text": s.value ?? "",
167
+ "helper-state": s.value ? "error" : "none",
168
+ invalid: !!s.value,
169
+ disabled: i.value,
170
+ onKeydown: G(A, ["enter"])
171
+ }, null, 8, ["modelValue", "label", "formatter", "helper-text", "helper-state", "invalid", "disabled"]),
172
+ d("div", null, [
173
+ y(a, {
174
+ variant: "primary",
175
+ label: r(l)("order.foodCourt.invitations.preview"),
176
+ disabled: i.value || !r(V)(h.value),
177
+ onClick: A
178
+ }, null, 8, ["label", "disabled"])
179
+ ])
180
+ ], 64)) : f.value === "preview" && _.value ? (u(), m(N, { key: 1 }, [
181
+ d("div", me, [
182
+ d("span", ve, p(_.value.name), 1),
183
+ g.value ? (u(), m("span", fe, p(g.value), 1)) : S("", !0),
184
+ x.value ? (u(), m("span", pe, p(x.value), 1)) : S("", !0)
185
+ ]),
186
+ s.value ? (u(), m("span", ye, p(s.value), 1)) : S("", !0),
187
+ d("div", _e, [
188
+ y(a, {
189
+ variant: "primary",
190
+ label: r(l)("order.foodCourt.invitations.requestToJoin", { restaurant: B.value }),
191
+ disabled: i.value,
192
+ onClick: M
193
+ }, null, 8, ["label", "disabled"]),
194
+ y(a, {
195
+ variant: "secondary",
196
+ label: r(l)("order.foodCourt.invitations.useAnotherCode"),
197
+ disabled: i.value,
198
+ onClick: w
199
+ }, null, 8, ["label", "disabled"])
200
+ ])
201
+ ], 64)) : f.value === "sent" ? (u(), m(N, { key: 2 }, [
202
+ d("div", Ce, [
203
+ y(j, {
204
+ name: "check_circle",
205
+ size: "lg",
206
+ color: "system-success-300"
207
+ }),
208
+ d("div", he, [
209
+ d("span", be, p(r(l)("order.foodCourt.invitations.requestSent")), 1),
210
+ d("span", ge, p(r(l)("order.foodCourt.invitations.requestSentDetail", { court: c.value })), 1)
211
+ ])
212
+ ]),
213
+ d("div", null, [
214
+ y(a, {
215
+ variant: "secondary",
216
+ label: r(l)("order.foodCourt.invitations.joinAnother"),
217
+ onClick: w
218
+ }, null, 8, ["label"])
219
+ ])
220
+ ], 64)) : S("", !0)
221
+ ]),
222
+ _: 1
223
+ });
224
+ };
225
+ }
226
+ }), we = { class: "py-[1.5rem]" }, Fe = {
227
+ key: 0,
228
+ class: "px-[1.5rem] fm-typo-en-body-md-400 text-fm-color-typo-secondary"
229
+ }, ke = {
230
+ key: 1,
231
+ class: "px-[1.5rem] flex flex-col gap-6"
232
+ }, Ie = { class: "flex flex-col gap-4" }, Se = { class: "fm-typo-en-title-sm-600" }, Ae = {
233
+ key: 0,
234
+ class: "flex flex-col gap-3 items-start"
235
+ }, Me = { class: "fm-typo-en-body-md-400" }, je = {
236
+ key: 1,
237
+ class: "text-center py-8 text-fm-color-typo-tertiary fm-typo-en-body-md-400"
238
+ }, Pe = /* @__PURE__ */ K({
239
+ __name: "FoodCourtInvitationsView",
240
+ setup(v) {
241
+ const { t } = H(), { showSuccess: l, showError: f } = ee(), h = X(), { currentRestaurant: i } = Q(), { searchKey: s, filter: _ } = te(), c = F(() => {
242
+ var e;
243
+ return ((e = i.value) == null ? void 0 : e._id) ?? null;
244
+ }), B = F(() => {
245
+ var e, a;
246
+ return ((a = (e = i.value) == null ? void 0 : e.profile) == null ? void 0 : a.name) ?? null;
247
+ }), g = b([]), x = b(!1), k = b(!1), w = (e) => e.courtName || t("order.foodCourt.invitations.unnamedCourt"), A = F(
248
+ () => g.value.filter((e) => _([w(e), e.courtAddress ?? ""]))
249
+ );
250
+ async function M() {
251
+ const e = c.value;
252
+ if (k.value = !1, !e) {
253
+ g.value = [];
254
+ return;
255
+ }
256
+ x.value = !0;
257
+ try {
258
+ const a = le(await J.listMemberships(e));
259
+ e === c.value && (g.value = a);
260
+ } catch (a) {
261
+ if (e !== c.value) return;
262
+ k.value = !0, f(E(a));
263
+ } finally {
264
+ e === c.value && (x.value = !1);
265
+ }
266
+ }
267
+ Y(
268
+ c,
269
+ () => {
270
+ g.value = [], M();
271
+ },
272
+ { immediate: !0 }
273
+ );
274
+ function o(e) {
275
+ const a = c.value;
276
+ a && h.open({
277
+ title: t("order.foodCourt.invitations.leaveTitle"),
278
+ message: t("order.foodCourt.invitations.leaveMessage", { court: w(e) }),
279
+ primaryActions: {
280
+ text: t("order.foodCourt.invitations.leaveConfirm"),
281
+ variant: "destructive",
282
+ close: !0
283
+ },
284
+ secondaryActions: { text: t("order.cancel"), variant: "tertiary", close: !0 }
285
+ }).onPrimary(async () => {
286
+ if (a === c.value) {
287
+ try {
288
+ await J.leaveFoodCourt(e.foodCourtId, e.memberId), l(t("order.foodCourt.invitations.left"));
289
+ } catch (j) {
290
+ f(E(j));
291
+ }
292
+ await M();
293
+ }
294
+ });
295
+ }
296
+ const n = F(() => [
297
+ {
298
+ id: "courtName",
299
+ header: () => t("order.foodCourt.invitations.columnFoodCourt"),
300
+ cell: ({ row: e }) => w(e.original),
301
+ enableSorting: !1
302
+ },
303
+ {
304
+ id: "courtAddress",
305
+ header: () => t("order.foodCourt.invitations.columnLocation"),
306
+ cell: ({ row: e }) => e.original.courtAddress || "-",
307
+ enableSorting: !1
308
+ },
309
+ {
310
+ id: "joinedAt",
311
+ header: () => t("order.foodCourt.invitations.columnJoined"),
312
+ cell: ({ row: e }) => e.original.joinedAt ? W(e.original.joinedAt).format("DD MMM YYYY") : "-",
313
+ enableSorting: !1
314
+ },
315
+ {
316
+ id: "status",
317
+ header: () => t("order.foodCourt.invitations.columnStatus"),
318
+ cell: ({ row: e }) => {
319
+ const a = se[e.original.status];
320
+ return a ? R(Z.FmChip, { variant: a.variant, label: t(a.labelKey) }) : "-";
321
+ },
322
+ enableSorting: !1
323
+ },
324
+ {
325
+ id: "actions",
326
+ header: () => "",
327
+ cell: ({ row: e }) => R(ie, {
328
+ status: e.original.status,
329
+ onLeave: () => o(e.original)
330
+ }),
331
+ enableSorting: !1,
332
+ meta: { width: "64px" }
333
+ }
334
+ ]);
335
+ return (e, a) => {
336
+ const j = C("FmPageHead"), T = C("FmButton"), I = C("FmSearch"), z = C("FmTable");
337
+ return u(), m(N, null, [
338
+ d("div", we, [
339
+ y(j, {
340
+ title: r(t)("order.foodCourt.invitations.title"),
341
+ "line-height": 1.7
342
+ }, null, 8, ["title"])
343
+ ]),
344
+ c.value ? (u(), m("div", ke, [
345
+ y(xe, {
346
+ "restaurant-id": c.value,
347
+ "restaurant-name": B.value
348
+ }, null, 8, ["restaurant-id", "restaurant-name"]),
349
+ d("div", Ie, [
350
+ d("span", Se, p(r(t)("order.foodCourt.invitations.listTitle")), 1),
351
+ k.value ? (u(), m("div", Ae, [
352
+ d("span", Me, p(r(t)("order.foodCourt.invitations.loadFailed")), 1),
353
+ y(T, {
354
+ variant: "secondary",
355
+ label: r(t)("order.foodCourt.retry"),
356
+ onClick: M
357
+ }, null, 8, ["label"])
358
+ ])) : (u(), m(N, { key: 1 }, [
359
+ y(I, {
360
+ modelValue: r(s),
361
+ "onUpdate:modelValue": a[0] || (a[0] = (L) => O(s) ? s.value = L : null),
362
+ class: "max-w-[400px]",
363
+ placeholder: r(t)("order.foodCourt.invitations.searchPlaceholder")
364
+ }, null, 8, ["modelValue", "placeholder"]),
365
+ x.value || A.value.length ? (u(), P(z, {
366
+ key: 0,
367
+ "row-data": A.value,
368
+ "column-defs": n.value,
369
+ loading: x.value,
370
+ "hide-footer": !0,
371
+ "page-size": 1e3,
372
+ class: "w-full"
373
+ }, null, 8, ["row-data", "column-defs", "loading"])) : (u(), m("div", je, p(g.value.length ? r(t)("order.foodCourt.invitations.noMatch") : r(t)("order.foodCourt.invitations.empty")), 1))
374
+ ], 64))
375
+ ])
376
+ ])) : (u(), m("div", Fe, p(r(t)("order.foodCourt.invitations.noRestaurant")), 1))
377
+ ], 64);
378
+ };
379
+ }
380
+ });
381
+ export {
382
+ Pe as default
383
+ };
@@ -0,0 +1,294 @@
1
+ import { defineComponent as E, ref as x, onMounted as z, resolveComponent as d, unref as o, openBlock as i, createElementBlock as f, createElementVNode as l, toDisplayString as c, createVNode as u, createBlock as k, createCommentVNode as $, computed as b, withCtx as q, Fragment as M } from "vue";
2
+ import "@feedmepos/ui-library";
3
+ import { useI18n as D } from "@feedmepos/mf-common";
4
+ import { u as ee } from "./useFoodCourtContext-2p5sJMcB.js";
5
+ import { u as L } from "./index-Cmb4sEqq.js";
6
+ import { u as G } from "./snackbar-DZQ0_reQ.js";
7
+ import { F as N } from "./index-BeBZTUcq.js";
8
+ const oe = { key: 0 }, te = { class: "p-[1.5rem] flex flex-col gap-5 m-5 w-2/3" }, re = { class: "flex-grow fm-typo-en-title-sm-600" }, le = { class: "flex-grow fm-typo-en-title-sm-600 mt-4" }, ne = { class: "flex flex-col gap-2 fm-typo-en-body-md-400" }, ae = { class: "text-fm-color-typo-secondary" }, se = { class: "text-fm-color-typo-secondary" }, de = { class: "fm-corner-radius-lg flex flex-col gap-5 m-5" }, ue = {
9
+ key: 2,
10
+ class: "p-[1.5rem] m-5 flex flex-col gap-3 items-start"
11
+ }, ie = { class: "fm-typo-en-body-md-400" }, ce = /* @__PURE__ */ E({
12
+ __name: "FoodCourtDineInSetting",
13
+ props: {
14
+ foodCourtId: {}
15
+ },
16
+ setup(r) {
17
+ const n = r, { t: e } = D(), { showSuccess: v } = G(), { startAsyncCallWithErr: _, isLoading: y } = L(), a = x(), t = x(!1);
18
+ async function m() {
19
+ t.value = !1;
20
+ try {
21
+ a.value = await _(
22
+ () => N.getDineIn(n.foodCourtId)
23
+ );
24
+ } catch {
25
+ t.value = !0;
26
+ }
27
+ }
28
+ z(m);
29
+ async function h() {
30
+ if (!a.value) return;
31
+ const g = { qrOrderingEnabled: a.value.qrOrderingEnabled };
32
+ a.value = await _(
33
+ () => N.updateDineIn(n.foodCourtId, g)
34
+ ), v(e("order.foodCourt.saved"));
35
+ }
36
+ return (g, C) => {
37
+ const w = d("FmSwitch"), S = d("FmButton"), R = d("FmCircularProgress");
38
+ return !o(y) && a.value ? (i(), f("div", oe, [
39
+ l("div", te, [
40
+ l("div", re, c(o(e)("order.generalSetting")), 1),
41
+ u(w, {
42
+ modelValue: a.value.qrOrderingEnabled,
43
+ "onUpdate:modelValue": C[0] || (C[0] = (I) => a.value.qrOrderingEnabled = I),
44
+ value: "qrOrderingEnabled",
45
+ label: o(e)("order.foodCourt.qrOrdering"),
46
+ sublabel: o(e)("order.foodCourt.qrOrderingSublabel"),
47
+ "label-placement": "right"
48
+ }, null, 8, ["modelValue", "label", "sublabel"]),
49
+ l("div", le, c(o(e)("order.acceptedPayment")), 1),
50
+ l("div", ne, [
51
+ l("span", null, c(o(e)("order.foodCourt.acceptedPaymentOnline")), 1),
52
+ l("span", ae, c(o(e)("order.foodCourt.acceptedPaymentNotAccepted")), 1),
53
+ l("span", se, c(o(e)("order.foodCourt.acceptedPaymentSource")), 1)
54
+ ])
55
+ ]),
56
+ l("div", de, [
57
+ u(S, {
58
+ variant: "primary",
59
+ label: o(e)("order.saveSetting"),
60
+ class: "mr-auto",
61
+ onClick: h
62
+ }, null, 8, ["label"])
63
+ ])
64
+ ])) : o(y) ? (i(), k(R, {
65
+ key: 1,
66
+ size: "xxl"
67
+ })) : t.value ? (i(), f("div", ue, [
68
+ l("span", ie, c(o(e)("order.foodCourt.loadFailed")), 1),
69
+ u(S, {
70
+ variant: "secondary",
71
+ label: o(e)("order.foodCourt.retry"),
72
+ onClick: m
73
+ }, null, 8, ["label"])
74
+ ])) : $("", !0);
75
+ };
76
+ }
77
+ }), H = "FC-", A = 3, O = { min: 2, max: 6 };
78
+ function T(r) {
79
+ return typeof r == "number" && Number.isInteger(r) && r >= O.min && r <= O.max;
80
+ }
81
+ function me(r) {
82
+ const n = (e) => `${H}${String(e).padStart(r, "0")}`;
83
+ return { start: n(1), end: n(Math.pow(10, r) - 1) };
84
+ }
85
+ function V(r) {
86
+ return Math.pow(10, r) - 1;
87
+ }
88
+ function pe(r, n) {
89
+ return typeof r == "number" && Number.isInteger(r) && r >= 0 && r <= V(n);
90
+ }
91
+ function fe(r, n) {
92
+ const e = r + 1 > V(n) ? 1 : r + 1;
93
+ return `${H}${String(e).padStart(n, "0")}`;
94
+ }
95
+ const ve = { key: 0 }, _e = { class: "p-[1.5rem] flex flex-col gap-5 m-5 mr-8 w-full max-w-4xl" }, ge = { class: "flex-grow fm-typo-en-title-sm-600" }, be = { class: "mr-9 grid grid-cols-1 md:grid-cols-2 gap-5" }, ye = { class: "min-w-0" }, Ce = { class: "bg-gray-50 p-3 rounded-lg border" }, Fe = { class: "flex items-center gap-2" }, xe = { class: "mr-9 grid grid-cols-1 md:grid-cols-2 gap-5" }, he = { class: "min-w-0" }, we = { class: "mt-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Se = { class: "mt-1 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Ie = { class: "fm-corner-radius-lg flex flex-col gap-5 m-5" }, ke = {
96
+ key: 2,
97
+ class: "p-[1.5rem] m-5 flex flex-col gap-3 items-start"
98
+ }, $e = { class: "fm-typo-en-body-md-400" }, Ne = /* @__PURE__ */ E({
99
+ __name: "FoodCourtGeneralSetting",
100
+ props: {
101
+ foodCourtId: {}
102
+ },
103
+ setup(r) {
104
+ const n = r, { t: e } = D(), { showSuccess: v, showError: _ } = G(), { startAsyncCallWithErr: y, isLoading: a } = L(), t = x(), m = b(
105
+ () => {
106
+ var s;
107
+ return T((s = t.value) == null ? void 0 : s.digit) ? t.value.digit : A;
108
+ }
109
+ ), h = b(() => me(m.value)), g = x(null), C = b(() => {
110
+ var s;
111
+ return (((s = t.value) == null ? void 0 : s.current) ?? null) !== g.value;
112
+ }), w = b(() => {
113
+ var s;
114
+ return pe((s = t.value) == null ? void 0 : s.current, m.value);
115
+ }), S = b(
116
+ () => e("order.foodCourt.currentNumberRule", { max: V(m.value) })
117
+ ), R = b(
118
+ () => fe(w.value ? t.value.current : g.value ?? 0, m.value)
119
+ ), I = x(!1);
120
+ async function P() {
121
+ I.value = !1;
122
+ try {
123
+ t.value = await y(
124
+ () => N.getOrderNumber(n.foodCourtId)
125
+ ), g.value = t.value.current ?? null;
126
+ } catch {
127
+ I.value = !0;
128
+ }
129
+ }
130
+ z(P);
131
+ function W(s) {
132
+ t.value && (t.value.resetTime = s ? "00:00" : null);
133
+ }
134
+ async function X() {
135
+ if (!t.value) return;
136
+ if (!T(t.value.digit)) {
137
+ _(e("order.foodCourt.numberOfDigitsRule"));
138
+ return;
139
+ }
140
+ if (C.value && !w.value) {
141
+ _(S.value);
142
+ return;
143
+ }
144
+ const s = {
145
+ digit: t.value.digit,
146
+ resetTime: t.value.resetTime ?? null,
147
+ ...C.value ? { current: t.value.current } : {}
148
+ };
149
+ t.value = await y(
150
+ () => N.updateOrderNumber(n.foodCourtId, s)
151
+ ), g.value = t.value.current ?? null, v(e("order.foodCourt.saved"));
152
+ }
153
+ return (s, F) => {
154
+ const j = d("FmSwitch"), J = d("FmIcon"), K = d("FmTooltip"), Q = d("FmTimePicker"), B = d("FmStepperField"), Y = d("FmCard"), U = d("FmButton"), Z = d("FmCircularProgress");
155
+ return !o(a) && t.value ? (i(), f("div", ve, [
156
+ l("div", _e, [
157
+ l("div", ge, c(o(e)("order.orderNumberSettings")), 1),
158
+ l("div", be, [
159
+ l("div", ye, [
160
+ l("div", Ce, [
161
+ l("div", Fe, [
162
+ u(j, {
163
+ "model-value": !!t.value.resetTime,
164
+ label: o(e)("order.autoResetOrderNumber"),
165
+ "onUpdate:modelValue": W,
166
+ "label-placement": "right"
167
+ }, null, 8, ["model-value", "label"]),
168
+ u(K, {
169
+ content: o(e)("order.foodCourt.autoResetTooltip"),
170
+ zIndex: 1e3
171
+ }, {
172
+ default: q(() => [
173
+ u(J, {
174
+ name: "info",
175
+ size: "sm",
176
+ class: "cursor-help text-fm-color-neutral-gray-400"
177
+ })
178
+ ]),
179
+ _: 1
180
+ }, 8, ["content"])
181
+ ]),
182
+ t.value.resetTime ? (i(), k(Q, {
183
+ key: 0,
184
+ "model-value": t.value.resetTime,
185
+ "onUpdate:modelValue": F[0] || (F[0] = (p) => p && (t.value.resetTime = p)),
186
+ class: "mt-3"
187
+ }, null, 8, ["model-value"])) : $("", !0)
188
+ ])
189
+ ])
190
+ ]),
191
+ l("div", xe, [
192
+ l("div", he, [
193
+ u(Y, {
194
+ variant: "outlined",
195
+ class: "p-3"
196
+ }, {
197
+ default: q(() => [
198
+ u(B, {
199
+ "model-value": t.value.digit,
200
+ label: o(e)("order.foodCourt.numberOfDigits"),
201
+ "onUpdate:modelValue": F[1] || (F[1] = (p) => t.value.digit = p),
202
+ "show-steppers": !1,
203
+ placeholder: String(o(A)),
204
+ rules: [() => {
205
+ var p;
206
+ return o(T)((p = t.value) == null ? void 0 : p.digit) || o(e)("order.foodCourt.numberOfDigitsRule");
207
+ }],
208
+ min: o(O).min,
209
+ max: o(O).max
210
+ }, null, 8, ["model-value", "label", "placeholder", "rules", "min", "max"]),
211
+ u(B, {
212
+ "model-value": t.value.current ?? null,
213
+ label: o(e)("order.currentNumber"),
214
+ "onUpdate:modelValue": F[2] || (F[2] = (p) => t.value.current = p),
215
+ "show-steppers": !1,
216
+ placeholder: "0",
217
+ rules: [() => !C.value || w.value || S.value],
218
+ min: 0,
219
+ class: "mt-3"
220
+ }, null, 8, ["model-value", "label", "rules"]),
221
+ l("div", we, c(o(e)("order.foodCourt.numberPreview", h.value)), 1),
222
+ l("div", Se, c(o(e)("order.foodCourt.nextNumber", { number: R.value })), 1)
223
+ ]),
224
+ _: 1
225
+ })
226
+ ])
227
+ ])
228
+ ]),
229
+ l("div", Ie, [
230
+ u(U, {
231
+ variant: "primary",
232
+ label: o(e)("order.saveSetting"),
233
+ class: "mr-auto",
234
+ onClick: X
235
+ }, null, 8, ["label"])
236
+ ])
237
+ ])) : o(a) ? (i(), k(Z, {
238
+ key: 1,
239
+ size: "xxl"
240
+ })) : I.value ? (i(), f("div", ke, [
241
+ l("span", $e, c(o(e)("order.foodCourt.loadFailed")), 1),
242
+ u(U, {
243
+ variant: "secondary",
244
+ label: o(e)("order.foodCourt.retry"),
245
+ onClick: P
246
+ }, null, 8, ["label"])
247
+ ])) : $("", !0);
248
+ };
249
+ }
250
+ }), Oe = { class: "py-[1.5rem]" }, Re = {
251
+ key: 0,
252
+ class: "flex px-[1.5rem] items-center"
253
+ }, Te = {
254
+ key: 1,
255
+ class: "px-[1.5rem] fm-typo-en-body-md-400 text-fm-color-typo-secondary"
256
+ }, Me = /* @__PURE__ */ E({
257
+ __name: "FoodCourtOrderSettingsView",
258
+ setup(r) {
259
+ const { t: n } = D(), e = ee(), v = x("dinein"), _ = b(() => [
260
+ { label: n("order.dineIn"), value: "dinein" },
261
+ { label: n("order.general"), value: "general" }
262
+ ]);
263
+ return (y, a) => {
264
+ const t = d("FmPageHead"), m = d("FmTabs");
265
+ return i(), f(M, null, [
266
+ l("div", Oe, [
267
+ u(t, {
268
+ title: o(n)("order.orderSetting"),
269
+ "line-height": 1.7
270
+ }, null, 8, ["title"]),
271
+ o(e) ? (i(), f("div", Re, [
272
+ u(m, {
273
+ "model-value": v.value,
274
+ "onUpdate:modelValue": a[0] || (a[0] = (h) => v.value = h),
275
+ items: _.value
276
+ }, null, 8, ["model-value", "items"])
277
+ ])) : $("", !0)
278
+ ]),
279
+ o(e) ? (i(), f(M, { key: 0 }, [
280
+ v.value === "dinein" ? (i(), k(ce, {
281
+ key: `dinein-${o(e)}`,
282
+ "food-court-id": o(e)
283
+ }, null, 8, ["food-court-id"])) : (i(), k(Ne, {
284
+ key: `general-${o(e)}`,
285
+ "food-court-id": o(e)
286
+ }, null, 8, ["food-court-id"]))
287
+ ], 64)) : (i(), f("div", Te, c(o(n)("order.foodCourt.noFoodCourt")), 1))
288
+ ], 64);
289
+ };
290
+ }
291
+ });
292
+ export {
293
+ Me as default
294
+ };