@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,544 @@
1
+ import { defineComponent as oe, ref as g, computed as P, watch as W, resolveComponent as h, openBlock as m, createBlock as j, unref as r, withCtx as O, createElementBlock as f, createElementVNode as s, toDisplayString as c, createVNode as _, Fragment as E, renderList as q, createCommentVNode as Y, createTextVNode as Z, normalizeClass as ie, h as ce } from "vue";
2
+ import { d as M } from "./dayjs.min-zBHHlxAP.js";
3
+ import { useRoute as me, useRouter as fe } from "vue-router";
4
+ import { useI18n as te } from "@feedmepos/mf-common";
5
+ import { components as pe } from "@feedmepos/ui-library";
6
+ import { u as re } from "./snackbar-DZQ0_reQ.js";
7
+ import { u as ye } from "./useFoodCourtContext-2p5sJMcB.js";
8
+ import { d as ae } from "./index-BeBZTUcq.js";
9
+ import { e as se } from "./food-court-member-piX3gesl.js";
10
+ import { a as ve } from "./index-DLDihONy.js";
11
+ const J = ["PAID", "PENDING_PAYMENT", "CANCELLED"], B = {
12
+ PAID: { variant: "success", labelKey: "order.foodCourt.orders.statusPaid" },
13
+ PENDING_PAYMENT: { variant: "warning", labelKey: "order.foodCourt.orders.statusPendingPayment" },
14
+ CANCELLED: { variant: "neutral", labelKey: "order.foodCourt.orders.statusCancelled" },
15
+ DRAFT: { variant: "neutral", labelKey: "order.foodCourt.orders.statusDraft" }
16
+ };
17
+ function Q(e) {
18
+ var o;
19
+ switch ((o = e == null ? void 0 : e.bill) == null ? void 0 : o.status) {
20
+ case "REFUNDED":
21
+ return { variant: "critical", labelKey: "order.foodCourt.orders.stallRefunded" };
22
+ case "VOIDED":
23
+ return { variant: "critical", labelKey: "order.foodCourt.orders.stallVoided" };
24
+ }
25
+ switch (e == null ? void 0 : e.status) {
26
+ case "ACCEPTED":
27
+ return { variant: "success", labelKey: "order.foodCourt.orders.stallAccepted" };
28
+ case "DECLINED":
29
+ return { variant: "critical", labelKey: "order.foodCourt.orders.stallDeclined" };
30
+ case "NEW":
31
+ return { variant: "warning", labelKey: "order.foodCourt.orders.stallWaiting" };
32
+ default:
33
+ return { variant: "neutral", labelKey: "order.foodCourt.orders.stallUnknown" };
34
+ }
35
+ }
36
+ function _e(e, o = M()) {
37
+ const t = e.startDate ? M(e.startDate) : o, d = e.endDate ? M(e.endDate) : t;
38
+ return {
39
+ from: t.startOf("day").format(),
40
+ to: d.add(1, "day").startOf("day").format()
41
+ };
42
+ }
43
+ function A(e) {
44
+ return e ? ve.Dinero.fromFdoDinero(e).toFormat(!0) : "-";
45
+ }
46
+ function le(e, o = !1) {
47
+ return e ? M(e).format(o ? "DD MMM YYYY, HH:mm:ss" : "DD MMM YYYY, HH:mm") : "-";
48
+ }
49
+ function ne(e, o = []) {
50
+ return o.flatMap((t, d) => {
51
+ const l = `${e}.${d}`;
52
+ return [
53
+ {
54
+ key: l,
55
+ name: t.name,
56
+ quantity: t.quantity,
57
+ amount: t.price && t.price.amount !== 0 ? t.price : null,
58
+ remark: null,
59
+ sub: !0
60
+ },
61
+ ...ne(l, t.subItems)
62
+ ];
63
+ });
64
+ }
65
+ function be(e) {
66
+ return e ? Object.entries(e.items ?? {}).filter(([, o]) => o.status !== "VOIDED").flatMap(([o, t]) => {
67
+ var d;
68
+ return [
69
+ {
70
+ key: o,
71
+ name: ((d = t.product) == null ? void 0 : d.name) ?? "",
72
+ quantity: t.quantity,
73
+ amount: t.nettTotal ?? null,
74
+ remark: t.remark || null,
75
+ sub: !1
76
+ },
77
+ ...ne(o, t.subItems)
78
+ ];
79
+ }) : [];
80
+ }
81
+ function X(e) {
82
+ return !e || e.amount === 0;
83
+ }
84
+ function Ce(e) {
85
+ if (!e) return [];
86
+ const o = [
87
+ {
88
+ key: "subtotal",
89
+ label: "order.foodCourt.orders.subtotal",
90
+ labelIsName: !1,
91
+ amount: e.grossTotal
92
+ }
93
+ ];
94
+ e.adjustedTotal && e.adjustedTotal.amount !== e.grossTotal.amount && o.push({
95
+ key: "discount",
96
+ label: "order.foodCourt.orders.discount",
97
+ labelIsName: !1,
98
+ amount: { ...e.adjustedTotal, amount: e.adjustedTotal.amount - e.grossTotal.amount }
99
+ });
100
+ for (const [t, d] of Object.entries(e.nettTaxes ?? {}))
101
+ d.inclusive || X(d.total) || o.push({ key: `tax.${t}`, label: d.name, labelIsName: !0, amount: d.total });
102
+ return X(e.rounding) || o.push({
103
+ key: "rounding",
104
+ label: "order.foodCourt.orders.rounding",
105
+ labelIsName: !1,
106
+ amount: e.rounding
107
+ }), o;
108
+ }
109
+ function ge(e) {
110
+ const o = new Map((e.pf_orders ?? []).map((t) => [String(t._id), t]));
111
+ return (e.stalls ?? []).map((t) => {
112
+ const d = o.get(String(t.orderId)) ?? null, l = be(d == null ? void 0 : d.bill);
113
+ return {
114
+ key: t.orderId,
115
+ unitNo: t.unitNo || null,
116
+ name: t.displayName || t.restaurantId,
117
+ amount: t.amount,
118
+ order: d,
119
+ items: l,
120
+ itemCount: l.filter((w) => !w.sub).reduce((w, v) => w + v.quantity, 0),
121
+ totals: Ce(d == null ? void 0 : d.bill)
122
+ };
123
+ });
124
+ }
125
+ const he = {
126
+ key: 1,
127
+ class: "flex flex-col gap-3 items-start"
128
+ }, xe = { class: "fm-typo-en-body-md-400" }, ke = {
129
+ key: 2,
130
+ class: "flex flex-col gap-4"
131
+ }, Ie = { class: "flex items-center justify-between gap-2" }, De = { class: "fm-typo-en-title-sm-600" }, Fe = { class: "flex flex-col gap-2" }, we = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ne = { class: "fm-typo-en-body-md-600 break-all" }, Se = { class: "flex items-center justify-between gap-2" }, Te = { class: "flex items-center gap-2 min-w-0" }, Ee = {
132
+ key: 0,
133
+ class: "px-2 py-[2px] rounded bg-fm-color-neutral-gray-100 fm-typo-en-body-sm-400 shrink-0"
134
+ }, Me = { class: "fm-typo-en-body-lg-600 truncate" }, $e = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ve = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, Oe = ["onClick"], Ye = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ae = { class: "flex items-center gap-1 fm-typo-en-body-md-600" }, Pe = {
135
+ key: 0,
136
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary"
137
+ }, Re = {
138
+ key: 1,
139
+ class: "flex flex-col gap-1"
140
+ }, je = { class: "flex flex-col min-w-0" }, Le = {
141
+ key: 0,
142
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary"
143
+ }, Ke = { class: "shrink-0" }, Ue = {
144
+ key: 2,
145
+ class: "flex flex-col gap-1 border-t border-fm-color-neutral-gray-200 pt-3 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
146
+ }, qe = { class: "flex justify-between gap-3 fm-typo-en-body-md-600 text-fm-color-typo-primary" }, Be = { class: "fm-typo-en-title-sm-600" }, He = { class: "fm-typo-en-title-sm-600" }, ze = /* @__PURE__ */ oe({
147
+ __name: "FoodCourtOrderSheet",
148
+ props: {
149
+ modelValue: { type: Boolean },
150
+ foodCourtId: {},
151
+ orderId: {}
152
+ },
153
+ emits: ["update:modelValue"],
154
+ setup(e, { emit: o }) {
155
+ const t = e, d = o, { t: l } = te(), { showError: w } = re(), v = g(null), k = g(!1), I = g(!1), b = g(/* @__PURE__ */ new Set()), N = P(() => v.value ? ge(v.value) : []), S = P(() => {
156
+ var p;
157
+ const y = v.value;
158
+ return y ? [
159
+ {
160
+ label: l("order.foodCourt.orders.date"),
161
+ value: le(((p = y.payment) == null ? void 0 : p.paidAt) ?? null, !0)
162
+ },
163
+ { label: l("order.foodCourt.orders.paidBy"), value: y.paymentMethod || "-" },
164
+ { label: l("order.foodCourt.orders.orderId"), value: y._id }
165
+ ] : [];
166
+ });
167
+ function $(y) {
168
+ const p = new Set(b.value);
169
+ p.has(y) ? p.delete(y) : p.add(y), b.value = p;
170
+ }
171
+ async function D() {
172
+ var V, T;
173
+ const y = t.foodCourtId, p = t.orderId;
174
+ if (I.value = !1, !!p) {
175
+ k.value = !0;
176
+ try {
177
+ const C = await ae.getOrder(y, p);
178
+ if (p !== t.orderId || y !== t.foodCourtId) return;
179
+ v.value = C;
180
+ const x = (T = (V = C.stalls) == null ? void 0 : V[0]) == null ? void 0 : T.orderId;
181
+ b.value = new Set(x ? [x] : []);
182
+ } catch (C) {
183
+ if (p !== t.orderId || y !== t.foodCourtId) return;
184
+ I.value = !0, w(se(C));
185
+ } finally {
186
+ p === t.orderId && y === t.foodCourtId && (k.value = !1);
187
+ }
188
+ }
189
+ }
190
+ return W(
191
+ () => [t.foodCourtId, t.orderId],
192
+ () => {
193
+ v.value = null, D();
194
+ },
195
+ { immediate: !0 }
196
+ ), (y, p) => {
197
+ const V = h("FmCircularProgress"), T = h("FmButton"), C = h("FmChip"), x = h("FmCard"), R = h("FmIcon"), H = h("FmSideSheet");
198
+ return m(), j(H, {
199
+ "model-value": e.modelValue,
200
+ header: r(l)("order.foodCourt.orders.detailTitle"),
201
+ "dismiss-away": "",
202
+ "max-width": 560,
203
+ "onUpdate:modelValue": p[1] || (p[1] = (u) => d("update:modelValue", u))
204
+ }, {
205
+ "side-sheet-footer": O(() => [
206
+ _(T, {
207
+ variant: "secondary",
208
+ label: r(l)("order.foodCourt.orders.close"),
209
+ size: "lg",
210
+ onClick: p[0] || (p[0] = (u) => d("update:modelValue", !1))
211
+ }, null, 8, ["label"])
212
+ ]),
213
+ default: O(() => [
214
+ k.value ? (m(), j(V, {
215
+ key: 0,
216
+ size: "xl"
217
+ })) : I.value ? (m(), f("div", he, [
218
+ s("span", xe, c(r(l)("order.foodCourt.orders.detailLoadFailed")), 1),
219
+ _(T, {
220
+ variant: "secondary",
221
+ label: r(l)("order.foodCourt.retry"),
222
+ onClick: D
223
+ }, null, 8, ["label"])
224
+ ])) : v.value ? (m(), f("div", ke, [
225
+ _(x, {
226
+ variant: "outlined",
227
+ class: "p-4 flex flex-col gap-3"
228
+ }, {
229
+ default: O(() => [
230
+ s("div", Ie, [
231
+ s("span", De, c(v.value.orderNumber ? r(l)("order.foodCourt.orders.orderTitle", { number: `#${v.value.orderNumber}` }) : r(l)("order.foodCourt.orders.noNumber")), 1),
232
+ _(C, {
233
+ variant: r(B)[v.value.status].variant,
234
+ label: r(l)(r(B)[v.value.status].labelKey)
235
+ }, null, 8, ["variant", "label"])
236
+ ]),
237
+ s("div", Fe, [
238
+ (m(!0), f(E, null, q(S.value, (u) => (m(), f("div", {
239
+ key: u.label,
240
+ class: "flex flex-col"
241
+ }, [
242
+ s("span", we, c(u.label), 1),
243
+ s("span", Ne, c(u.value), 1)
244
+ ]))), 128))
245
+ ])
246
+ ]),
247
+ _: 1
248
+ }),
249
+ (m(!0), f(E, null, q(N.value, (u) => (m(), j(x, {
250
+ key: u.key,
251
+ variant: "outlined",
252
+ class: "p-4 flex flex-col gap-3"
253
+ }, {
254
+ default: O(() => {
255
+ var L, K, a, i;
256
+ return [
257
+ s("div", Se, [
258
+ s("div", Te, [
259
+ u.unitNo ? (m(), f("span", Ee, c(u.unitNo), 1)) : Y("", !0),
260
+ s("span", Me, c(u.name), 1)
261
+ ]),
262
+ _(C, {
263
+ variant: r(Q)(u.order).variant,
264
+ label: r(l)(r(Q)(u.order).labelKey)
265
+ }, null, 8, ["variant", "label"])
266
+ ]),
267
+ s("span", $e, [
268
+ Z(c(r(l)("order.foodCourt.orders.billNo")) + " • ", 1),
269
+ s("span", Ve, c(((K = (L = u.order) == null ? void 0 : L.bill) == null ? void 0 : K.seqNumber) || r(l)("order.foodCourt.orders.notBilled")), 1)
270
+ ]),
271
+ s("button", {
272
+ type: "button",
273
+ class: "flex items-center justify-between border-t border-fm-color-neutral-gray-200 pt-3",
274
+ onClick: (n) => $(u.key)
275
+ }, [
276
+ s("span", Ye, c(r(l)("order.foodCourt.orders.itemCount", { count: u.itemCount })), 1),
277
+ s("span", Ae, [
278
+ Z(c(r(A)(u.amount)) + " ", 1),
279
+ _(R, {
280
+ name: b.value.has(u.key) ? "expand_less" : "expand_more",
281
+ size: "md"
282
+ }, null, 8, ["name"])
283
+ ])
284
+ ], 8, Oe),
285
+ b.value.has(u.key) ? (m(), f(E, { key: 0 }, [
286
+ u.items.length ? (m(), f("div", Re, [
287
+ (m(!0), f(E, null, q(u.items, (n) => (m(), f("div", {
288
+ key: n.key,
289
+ class: ie([
290
+ "flex justify-between gap-3",
291
+ n.sub ? "pl-4 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" : "fm-typo-en-body-md-600 pt-1"
292
+ ])
293
+ }, [
294
+ s("div", je, [
295
+ s("span", null, c(n.sub ? `+ ${n.name}` : `${n.quantity}x ${n.name}`), 1),
296
+ n.remark ? (m(), f("span", Le, c(n.remark), 1)) : Y("", !0)
297
+ ]),
298
+ s("span", Ke, c(n.amount ? r(A)(n.amount) : ""), 1)
299
+ ], 2))), 128))
300
+ ])) : (m(), f("div", Pe, c(r(l)("order.foodCourt.orders.noItems")), 1)),
301
+ u.totals.length ? (m(), f("div", Ue, [
302
+ (m(!0), f(E, null, q(u.totals, (n) => (m(), f("div", {
303
+ key: n.key,
304
+ class: "flex justify-between gap-3"
305
+ }, [
306
+ s("span", null, c(n.labelIsName ? n.label : r(l)(n.label)), 1),
307
+ s("span", null, c(r(A)(n.amount)), 1)
308
+ ]))), 128)),
309
+ s("div", qe, [
310
+ s("span", null, c(r(l)("order.foodCourt.orders.stallTotal")), 1),
311
+ s("span", null, c(r(A)(((i = (a = u.order) == null ? void 0 : a.bill) == null ? void 0 : i.nettTotal) ?? u.amount)), 1)
312
+ ])
313
+ ])) : Y("", !0)
314
+ ], 64)) : Y("", !0)
315
+ ];
316
+ }),
317
+ _: 2
318
+ }, 1024))), 128)),
319
+ _(x, {
320
+ variant: "outlined",
321
+ class: "p-4 flex items-center justify-between"
322
+ }, {
323
+ default: O(() => [
324
+ s("span", Be, c(r(l)("order.foodCourt.orders.netTotal")), 1),
325
+ s("span", He, c(r(A)(v.value.total)), 1)
326
+ ]),
327
+ _: 1
328
+ })
329
+ ])) : Y("", !0)
330
+ ]),
331
+ _: 1
332
+ }, 8, ["model-value", "header"]);
333
+ };
334
+ }
335
+ }), We = { class: "py-[1.5rem] flex flex-col gap-1" }, Ge = { class: "px-[1.5rem] fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ze = {
336
+ key: 0,
337
+ class: "px-[1.5rem] fm-typo-en-body-md-400 text-fm-color-typo-secondary"
338
+ }, Je = {
339
+ key: 1,
340
+ class: "px-[1.5rem] flex flex-col gap-4"
341
+ }, Qe = { class: "flex items-center gap-3 flex-wrap" }, Xe = {
342
+ key: 0,
343
+ class: "py-4 flex flex-col gap-3 items-start"
344
+ }, eo = { class: "fm-typo-en-body-md-400" }, oo = {
345
+ key: 1,
346
+ class: "text-center py-8 text-fm-color-typo-tertiary fm-typo-en-body-md-400"
347
+ }, to = { class: "flex items-center justify-between gap-3 flex-wrap pb-6" }, ro = { class: "flex items-center gap-2" }, ao = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, so = { class: "flex items-center gap-2" }, lo = { class: "fm-typo-en-body-md-400" }, ee = "Food Court Order Detail View", no = "Food Court Orders View", Co = /* @__PURE__ */ oe({
348
+ __name: "FoodCourtOrdersView",
349
+ setup(e) {
350
+ const { t: o } = te(), { showError: t } = re(), d = ye(), l = me(), w = fe(), v = M().format("YYYY-MM-DD"), k = g({
351
+ startDate: v,
352
+ endDate: v
353
+ }), I = g([]), b = g(0), N = g(25), S = g([]), $ = g(!1), D = g(!1), y = g(!1), p = P(
354
+ () => J.map((a) => ({
355
+ label: o(B[a].labelKey),
356
+ value: a
357
+ }))
358
+ ), V = [10, 25, 50, 100].map((a) => ({ label: String(a), value: a })), T = P(() => {
359
+ const { startDate: a, endDate: i } = k.value, n = a ? M(a).format("DD MMM YYYY") : "", U = i ? M(i).format("DD MMM YYYY") : n;
360
+ return n === U ? n : `${n} - ${U}`;
361
+ });
362
+ let C = 0;
363
+ async function x() {
364
+ const a = d.value, i = ++C;
365
+ if (y.value = !1, !a) {
366
+ S.value = [], $.value = !1;
367
+ return;
368
+ }
369
+ D.value = !0;
370
+ try {
371
+ const n = await ae.listOrders(a, {
372
+ ..._e(k.value),
373
+ status: I.value.length ? I.value : J,
374
+ page: b.value,
375
+ limit: N.value
376
+ });
377
+ if (i !== C) return;
378
+ S.value = n.items, $.value = n.hasMore;
379
+ } catch (n) {
380
+ if (i !== C) return;
381
+ S.value = [], $.value = !1, y.value = !0, t(se(n));
382
+ } finally {
383
+ i === C && (D.value = !1);
384
+ }
385
+ }
386
+ W(
387
+ [d, k, I, N],
388
+ () => {
389
+ b.value === 0 ? x() : b.value = 0;
390
+ },
391
+ { deep: !0 }
392
+ ), W(b, x), x();
393
+ const R = P(
394
+ () => l.name === ee && typeof l.params.orderId == "string" ? l.params.orderId : null
395
+ );
396
+ function H(a) {
397
+ w.push({ name: ee, params: { orderId: a._id }, query: l.query });
398
+ }
399
+ function u(a) {
400
+ H(a.original);
401
+ }
402
+ function L() {
403
+ R.value && w.push({ name: no, query: l.query });
404
+ }
405
+ const K = P(() => [
406
+ {
407
+ id: "orderNumber",
408
+ header: () => o("order.foodCourt.orders.columnOrderNo"),
409
+ cell: ({ row: a }) => a.original.orderNumber ? `#${a.original.orderNumber}` : "-",
410
+ enableSorting: !1,
411
+ meta: { width: "120px" }
412
+ },
413
+ {
414
+ id: "createdAt",
415
+ header: () => o("order.foodCourt.orders.columnDate"),
416
+ cell: ({ row: a }) => le(a.original.paidAt ?? a.original.createdAt),
417
+ enableSorting: !1
418
+ },
419
+ {
420
+ id: "stalls",
421
+ header: () => o("order.foodCourt.orders.columnStalls"),
422
+ cell: ({ row: a }) => String(a.original.stallCount),
423
+ enableSorting: !1,
424
+ meta: { width: "96px" }
425
+ },
426
+ {
427
+ id: "paymentMethod",
428
+ header: () => o("order.foodCourt.orders.columnPayment"),
429
+ cell: ({ row: a }) => a.original.paymentMethod || "-",
430
+ enableSorting: !1
431
+ },
432
+ {
433
+ id: "total",
434
+ header: () => o("order.foodCourt.orders.columnTotal"),
435
+ cell: ({ row: a }) => A(a.original.total),
436
+ enableSorting: !1
437
+ },
438
+ {
439
+ id: "status",
440
+ header: () => o("order.foodCourt.orders.columnStatus"),
441
+ cell: ({ row: a }) => {
442
+ const i = B[a.original.status];
443
+ return i ? ce(pe.FmChip, { variant: i.variant, label: o(i.labelKey) }) : "-";
444
+ },
445
+ enableSorting: !1
446
+ }
447
+ ]);
448
+ return (a, i) => {
449
+ const n = h("FmPageHead"), U = h("FmChip"), de = h("FmDateRangePicker"), G = h("FmSelect"), z = h("FmButton"), ue = h("FmTable");
450
+ return m(), f(E, null, [
451
+ s("div", We, [
452
+ _(n, {
453
+ title: r(o)("order.foodCourt.orders.title"),
454
+ "line-height": 1.7
455
+ }, null, 8, ["title"]),
456
+ s("span", Ge, c(r(o)("order.foodCourt.orders.subtitle")), 1)
457
+ ]),
458
+ r(d) ? (m(), f("div", Je, [
459
+ s("div", Qe, [
460
+ _(de, {
461
+ modelValue: k.value,
462
+ "onUpdate:modelValue": i[0] || (i[0] = (F) => k.value = F),
463
+ "show-predefined-range": ""
464
+ }, {
465
+ "trigger-button": O(() => [
466
+ _(U, {
467
+ label: T.value,
468
+ icon: "calendar_today"
469
+ }, null, 8, ["label"])
470
+ ]),
471
+ _: 1
472
+ }, 8, ["modelValue"]),
473
+ _(G, {
474
+ modelValue: I.value,
475
+ "onUpdate:modelValue": i[1] || (i[1] = (F) => I.value = F),
476
+ class: "min-w-[240px]",
477
+ multiselect: "",
478
+ items: p.value,
479
+ placeholder: r(o)("order.foodCourt.orders.allStatuses")
480
+ }, null, 8, ["modelValue", "items", "placeholder"])
481
+ ]),
482
+ y.value ? (m(), f("div", Xe, [
483
+ s("span", eo, c(r(o)("order.foodCourt.orders.loadFailed")), 1),
484
+ _(z, {
485
+ variant: "secondary",
486
+ label: r(o)("order.foodCourt.retry"),
487
+ onClick: x
488
+ }, null, 8, ["label"])
489
+ ])) : (m(), f(E, { key: 1 }, [
490
+ D.value || S.value.length ? (m(), j(ue, {
491
+ key: 0,
492
+ "row-data": S.value,
493
+ "column-defs": K.value,
494
+ loading: D.value,
495
+ "hide-footer": !0,
496
+ "page-size": N.value,
497
+ "shrink-at": !1,
498
+ class: "w-full",
499
+ onRowClick: u
500
+ }, null, 8, ["row-data", "column-defs", "loading", "page-size"])) : (m(), f("div", oo, c(r(o)("order.foodCourt.orders.empty")), 1)),
501
+ s("div", to, [
502
+ s("div", ro, [
503
+ s("span", ao, c(r(o)("order.foodCourt.orders.perPage")), 1),
504
+ _(G, {
505
+ modelValue: N.value,
506
+ "onUpdate:modelValue": i[2] || (i[2] = (F) => N.value = F),
507
+ class: "w-[96px]",
508
+ items: r(V)
509
+ }, null, 8, ["modelValue", "items"])
510
+ ]),
511
+ s("div", so, [
512
+ _(z, {
513
+ variant: "tertiary",
514
+ "prepend-icon": "chevron_left",
515
+ label: r(o)("order.foodCourt.orders.previous"),
516
+ disabled: D.value || b.value === 0,
517
+ onClick: i[3] || (i[3] = (F) => b.value -= 1)
518
+ }, null, 8, ["label", "disabled"]),
519
+ s("span", lo, c(r(o)("order.foodCourt.orders.page", { page: b.value + 1 })), 1),
520
+ _(z, {
521
+ variant: "tertiary",
522
+ "append-icon": "chevron_right",
523
+ label: r(o)("order.foodCourt.orders.next"),
524
+ disabled: D.value || !$.value,
525
+ onClick: i[4] || (i[4] = (F) => b.value += 1)
526
+ }, null, 8, ["label", "disabled"])
527
+ ])
528
+ ])
529
+ ], 64))
530
+ ])) : (m(), f("div", Ze, c(r(o)("order.foodCourt.noFoodCourtSelected")), 1)),
531
+ r(d) ? (m(), j(ze, {
532
+ key: 2,
533
+ "model-value": !!R.value,
534
+ "food-court-id": r(d),
535
+ "order-id": R.value,
536
+ "onUpdate:modelValue": i[5] || (i[5] = (F) => !F && L())
537
+ }, null, 8, ["model-value", "food-court-id", "order-id"])) : Y("", !0)
538
+ ], 64);
539
+ };
540
+ }
541
+ });
542
+ export {
543
+ Co as default
544
+ };