@feedmepos/mf-order-setting 0.0.108 → 0.0.109

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 (57) hide show
  1. package/dist/{DisplaySystemView-ChGTO4v2.js → DisplaySystemView-hHA7fMQR.js} +4 -4
  2. package/dist/{FoodCourtInvitationsView-F1LiGOR8.js → FoodCourtInvitationsView-C_x0pvnB.js} +4 -4
  3. package/dist/{FoodCourtOrderSettingsView-D5M5kFAl.js → FoodCourtOrderSettingsView-BMRJe6tf.js} +1 -1
  4. package/dist/FoodCourtOrdersView-DlGJnMOd.js +1433 -0
  5. package/dist/{FoodCourtStallsView-jz1xnZus.js → FoodCourtStallsView-BAzlMqlj.js} +2 -2
  6. package/dist/{FoodCourtStatusView-DC3qHL1L.js → FoodCourtStatusView-CRkk2f66.js} +1 -1
  7. package/dist/{KioskDevicesView-B9w4izOk.js → KioskDevicesView-COuR39YQ.js} +1 -1
  8. package/dist/{KioskDevicesView.vue_vue_type_script_setup_true_lang-XJm-f2JF.js → KioskDevicesView.vue_vue_type_script_setup_true_lang-CAcDjPbk.js} +5 -5
  9. package/dist/{KioskSettingView-Bmfvz0Kz.js → KioskSettingView-DsIzIbYf.js} +3 -3
  10. package/dist/{KioskView-B0WlDEsG.js → KioskView-B1sn-D6k.js} +8 -8
  11. package/dist/{OrderSettingsView-BF89-eSB.js → OrderSettingsView-BvYGRXfI.js} +10 -10
  12. package/dist/{RestaurantSelector.vue_vue_type_script_setup_true_lang-BqPQnAVb.js → RestaurantSelector.vue_vue_type_script_setup_true_lang-COUKtg5k.js} +1 -1
  13. package/dist/{app-B4ew9SMz.js → app-utsChJtE.js} +71 -15
  14. package/dist/app.js +1 -1
  15. package/dist/{dayjs.min-BsZk4QHK.js → dayjs.min-C9WrpSe-.js} +1 -1
  16. package/dist/{featureFlag-CFlCo4uv.js → featureFlag-CHPFyNAw.js} +1 -1
  17. package/dist/frontend/mf-order/src/api/food-court/index.d.ts +29 -2
  18. package/dist/frontend/mf-order/src/app.d.ts +56 -0
  19. package/dist/frontend/mf-order/src/main.d.ts +56 -0
  20. package/dist/frontend/mf-order/src/views/food-court/food-court-order.d.ts +12 -1
  21. package/dist/frontend/mf-order/src/views/food-court/orders/FoodCourtOrderSheet.vue.d.ts +3 -1
  22. package/dist/frontend/mf-order/src/views/food-court/orders/FoodCourtReceiptDialog.vue.d.ts +17 -0
  23. package/dist/frontend/mf-order/src/views/food-court/orders/food-court-receipt.d.ts +20 -0
  24. package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
  25. package/dist/index--4Q-LHMq.js +6854 -0
  26. package/dist/{index-D0vTvoQN.js → index-BaABuG0J.js} +1 -1
  27. package/dist/{index-Z1ZA897U.js → index-CVxg__RB.js} +1 -1
  28. package/dist/index-Ck6Ef5sR.js +5 -0
  29. package/dist/{index-C6c28uBZ.js → index-D349Zd9k.js} +35 -23
  30. package/dist/{index-DLeX1p1o.js → index-DC8V_7zz.js} +2 -2
  31. package/dist/{index-D4_zVJPi.js → index-DVJkdWEG.js} +4 -4
  32. package/dist/index-iSsU83r4.js +46278 -0
  33. package/dist/{order.dto-DrlhCvYK.js → order.dto-D4yp5hGF.js} +47 -43
  34. package/dist/package/entity/alert/suggestion.dto.d.ts +2 -2
  35. package/dist/package/entity/food-court/order-v2.dto.d.ts +5 -5
  36. package/dist/package/entity/kiosk/kiosk.do.d.ts +16 -16
  37. package/dist/package/entity/kiosk/kiosk.dto.d.ts +19 -19
  38. package/dist/package/entity/order/order.do.d.ts +3 -3
  39. package/dist/package/entity/order/order.dto.d.ts +10 -10
  40. package/dist/package/entity/order/order.enum.d.ts +1 -1
  41. package/dist/package/entity/order-platform/deliveroo/deliveroo.menu.dto.d.ts +30 -30
  42. package/dist/{useInternalUser-BaSqwN4K.js → useInternalUser-CeoNePyw.js} +1 -1
  43. package/package.json +4 -1
  44. package/src/api/food-court/index.ts +42 -4
  45. package/src/locales/en-US.json +15 -1
  46. package/src/locales/ja-JP.json +15 -1
  47. package/src/locales/th-TH.json +15 -1
  48. package/src/locales/zh-CN.json +15 -1
  49. package/src/views/food-court/FoodCourtOrdersView.vue +135 -16
  50. package/src/views/food-court/food-court-order.spec.ts +16 -1
  51. package/src/views/food-court/food-court-order.ts +23 -1
  52. package/src/views/food-court/orders/FoodCourtOrderSheet.vue +29 -11
  53. package/src/views/food-court/orders/FoodCourtReceiptDialog.vue +113 -0
  54. package/src/views/food-court/orders/food-court-receipt.spec.ts +43 -0
  55. package/src/views/food-court/orders/food-court-receipt.ts +49 -0
  56. package/vite.config.ts +13 -0
  57. package/dist/FoodCourtOrdersView-BQrESoTH.js +0 -1190
@@ -1,1190 +0,0 @@
1
- import { defineComponent as We, ref as H, computed as ie, watch as Te, resolveComponent as G, openBlock as T, createBlock as ce, unref as h, withCtx as ne, createElementBlock as U, createElementVNode as _, toDisplayString as I, createVNode as j, Fragment as re, renderList as ve, createCommentVNode as le, createTextVNode as Le, normalizeClass as ur, h as fr } from "vue";
2
- import { d as X } from "./dayjs.min-BsZk4QHK.js";
3
- import { useRoute as cr, useRouter as mr } from "vue-router";
4
- import { useI18n as Qe } from "@feedmepos/mf-common";
5
- import { components as vr } from "@feedmepos/ui-library";
6
- import { u as Ze } from "./snackbar-DZQ0_reQ.js";
7
- import { u as pr } from "./useFoodCourtContext-2p5sJMcB.js";
8
- import { d as De } from "./index-C6c28uBZ.js";
9
- import { e as Se } from "./food-court-member-joC8tmsI.js";
10
- import { a as hr } from "./index-Z1ZA897U.js";
11
- import { a as yr } from "./index-D0vTvoQN.js";
12
- const we = ["PAID", "PENDING_PAYMENT", "CANCELLED"], pe = {
13
- PAID: { variant: "success", labelKey: "order.foodCourt.orders.statusPaid" },
14
- PENDING_PAYMENT: { variant: "warning", labelKey: "order.foodCourt.orders.statusPendingPayment" },
15
- CANCELLED: { variant: "neutral", labelKey: "order.foodCourt.orders.statusCancelled" },
16
- DRAFT: { variant: "neutral", labelKey: "order.foodCourt.orders.statusDraft" }
17
- };
18
- function Pe(e) {
19
- var r;
20
- switch ((r = e == null ? void 0 : e.bill) == null ? void 0 : r.status) {
21
- case "REFUNDED":
22
- return { variant: "critical", labelKey: "order.foodCourt.orders.stallRefunded" };
23
- case "VOIDED":
24
- return { variant: "critical", labelKey: "order.foodCourt.orders.stallVoided" };
25
- }
26
- switch (e == null ? void 0 : e.status) {
27
- case "ACCEPTED":
28
- return { variant: "success", labelKey: "order.foodCourt.orders.stallAccepted" };
29
- case "DECLINED":
30
- return { variant: "critical", labelKey: "order.foodCourt.orders.stallDeclined" };
31
- case "NEW":
32
- return { variant: "warning", labelKey: "order.foodCourt.orders.stallWaiting" };
33
- default:
34
- return { variant: "neutral", labelKey: "order.foodCourt.orders.stallUnknown" };
35
- }
36
- }
37
- function Ve(e, r = X()) {
38
- const t = e.startDate ? X(e.startDate) : r, o = e.endDate ? X(e.endDate) : t;
39
- return {
40
- from: t.startOf("day").format(),
41
- to: o.add(1, "day").startOf("day").format()
42
- };
43
- }
44
- function se(e) {
45
- return e ? hr.Dinero.fromFdoDinero(e).toFormat(!0) : "-";
46
- }
47
- function Je(e, r = !1) {
48
- return e ? X(e).format(r ? "DD MMM YYYY, HH:mm:ss" : "DD MMM YYYY, HH:mm") : "-";
49
- }
50
- function er(e, r = []) {
51
- return r.flatMap((t, o) => {
52
- const a = `${e}.${o}`;
53
- return [
54
- {
55
- key: a,
56
- name: t.name,
57
- quantity: t.quantity,
58
- amount: t.price && t.price.amount !== 0 ? t.price : null,
59
- remark: null,
60
- sub: !0
61
- },
62
- ...er(a, t.subItems)
63
- ];
64
- });
65
- }
66
- function gr(e) {
67
- return e ? Object.entries(e.items ?? {}).filter(([, r]) => r.status !== "VOIDED").flatMap(([r, t]) => {
68
- var o;
69
- return [
70
- {
71
- key: r,
72
- name: ((o = t.product) == null ? void 0 : o.name) ?? "",
73
- quantity: t.quantity,
74
- amount: t.nettTotal ?? null,
75
- remark: t.remark || null,
76
- sub: !1
77
- },
78
- ...er(r, t.subItems)
79
- ];
80
- }) : [];
81
- }
82
- function Be(e) {
83
- return !e || e.amount === 0;
84
- }
85
- function xr(e) {
86
- if (!e) return [];
87
- const r = [
88
- {
89
- key: "subtotal",
90
- label: "order.foodCourt.orders.subtotal",
91
- labelIsName: !1,
92
- amount: e.grossTotal
93
- }
94
- ];
95
- e.adjustedTotal && e.adjustedTotal.amount !== e.grossTotal.amount && r.push({
96
- key: "discount",
97
- label: "order.foodCourt.orders.discount",
98
- labelIsName: !1,
99
- amount: { ...e.adjustedTotal, amount: e.adjustedTotal.amount - e.grossTotal.amount }
100
- });
101
- for (const [t, o] of Object.entries(e.nettTaxes ?? {}))
102
- o.inclusive || Be(o.total) || r.push({ key: `tax.${t}`, label: o.name, labelIsName: !0, amount: o.total });
103
- return Be(e.rounding) || r.push({
104
- key: "rounding",
105
- label: "order.foodCourt.orders.rounding",
106
- labelIsName: !1,
107
- amount: e.rounding
108
- }), r;
109
- }
110
- function _r(e) {
111
- const r = new Map((e.pf_orders ?? []).map((t) => [String(t._id), t]));
112
- return (e.stalls ?? []).map((t) => {
113
- const o = r.get(String(t.orderId)) ?? null, a = gr(o == null ? void 0 : o.bill);
114
- return {
115
- key: t.orderId,
116
- unitNo: t.unitNo || null,
117
- name: t.displayName || t.restaurantId,
118
- amount: t.amount,
119
- order: o,
120
- items: a,
121
- itemCount: a.filter((n) => !n.sub).reduce((n, l) => n + l.quantity, 0),
122
- totals: xr(o == null ? void 0 : o.bill)
123
- };
124
- });
125
- }
126
- const Cr = {
127
- key: 1,
128
- class: "flex flex-col gap-3 items-start"
129
- }, wr = { class: "fm-typo-en-body-md-400" }, br = {
130
- key: 2,
131
- class: "flex flex-col gap-4"
132
- }, Ir = { class: "flex items-center justify-between gap-2" }, Tr = { class: "fm-typo-en-title-sm-600" }, Dr = { class: "flex flex-col gap-2" }, Sr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Nr = { class: "fm-typo-en-body-md-600 break-all" }, kr = { class: "flex items-center justify-between gap-2" }, Er = { class: "flex items-center gap-2 min-w-0" }, Fr = {
133
- key: 0,
134
- class: "px-2 py-[2px] rounded bg-fm-color-neutral-gray-100 fm-typo-en-body-sm-400 shrink-0"
135
- }, Ar = { class: "fm-typo-en-body-lg-600 truncate" }, Mr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Or = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, Rr = ["onClick"], Ur = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Yr = { class: "flex items-center gap-1 fm-typo-en-body-md-600" }, $r = {
136
- key: 0,
137
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary"
138
- }, Lr = {
139
- key: 1,
140
- class: "flex flex-col gap-1"
141
- }, Pr = { class: "flex flex-col min-w-0" }, Vr = {
142
- key: 0,
143
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary"
144
- }, Br = { class: "shrink-0" }, jr = {
145
- key: 2,
146
- 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"
147
- }, qr = { class: "flex justify-between gap-3 fm-typo-en-body-md-600 text-fm-color-typo-primary" }, zr = { class: "fm-typo-en-title-sm-600" }, Hr = { class: "fm-typo-en-title-sm-600" }, Kr = /* @__PURE__ */ We({
148
- __name: "FoodCourtOrderSheet",
149
- props: {
150
- modelValue: { type: Boolean },
151
- foodCourtId: {},
152
- orderId: {}
153
- },
154
- emits: ["update:modelValue"],
155
- setup(e, { emit: r }) {
156
- const t = e, o = r, { t: a } = Qe(), { showError: n } = Ze(), l = H(null), d = H(!1), i = H(!1), m = H(/* @__PURE__ */ new Set()), s = ie(() => l.value ? _r(l.value) : []), u = ie(() => {
157
- var c;
158
- const v = l.value;
159
- return v ? [
160
- {
161
- label: a("order.foodCourt.orders.date"),
162
- value: Je(((c = v.payment) == null ? void 0 : c.paidAt) ?? null, !0)
163
- },
164
- { label: a("order.foodCourt.orders.paidBy"), value: v.paymentMethod || "-" },
165
- { label: a("order.foodCourt.orders.orderId"), value: v._id }
166
- ] : [];
167
- });
168
- function C(v) {
169
- const c = new Set(m.value);
170
- c.has(v) ? c.delete(v) : c.add(v), m.value = c;
171
- }
172
- async function w() {
173
- var O, $;
174
- const v = t.foodCourtId, c = t.orderId;
175
- if (i.value = !1, !!c) {
176
- d.value = !0;
177
- try {
178
- const F = await De.getOrder(v, c);
179
- if (c !== t.orderId || v !== t.foodCourtId) return;
180
- l.value = F;
181
- const A = ($ = (O = F.stalls) == null ? void 0 : O[0]) == null ? void 0 : $.orderId;
182
- m.value = new Set(A ? [A] : []);
183
- } catch (F) {
184
- if (c !== t.orderId || v !== t.foodCourtId) return;
185
- i.value = !0, n(Se(F));
186
- } finally {
187
- c === t.orderId && v === t.foodCourtId && (d.value = !1);
188
- }
189
- }
190
- }
191
- return Te(
192
- () => [t.foodCourtId, t.orderId],
193
- () => {
194
- l.value = null, w();
195
- },
196
- { immediate: !0 }
197
- ), (v, c) => {
198
- const O = G("FmCircularProgress"), $ = G("FmButton"), F = G("FmChip"), A = G("FmCard"), k = G("FmIcon"), R = G("FmSideSheet");
199
- return T(), ce(R, {
200
- "model-value": e.modelValue,
201
- header: h(a)("order.foodCourt.orders.detailTitle"),
202
- "dismiss-away": "",
203
- "max-width": 560,
204
- "onUpdate:modelValue": c[1] || (c[1] = (p) => o("update:modelValue", p))
205
- }, {
206
- "side-sheet-footer": ne(() => [
207
- j($, {
208
- variant: "secondary",
209
- label: h(a)("order.foodCourt.orders.close"),
210
- size: "lg",
211
- onClick: c[0] || (c[0] = (p) => o("update:modelValue", !1))
212
- }, null, 8, ["label"])
213
- ]),
214
- default: ne(() => [
215
- d.value ? (T(), ce(O, {
216
- key: 0,
217
- size: "xl"
218
- })) : i.value ? (T(), U("div", Cr, [
219
- _("span", wr, I(h(a)("order.foodCourt.orders.detailLoadFailed")), 1),
220
- j($, {
221
- variant: "secondary",
222
- label: h(a)("order.foodCourt.retry"),
223
- onClick: w
224
- }, null, 8, ["label"])
225
- ])) : l.value ? (T(), U("div", br, [
226
- j(A, {
227
- variant: "outlined",
228
- class: "p-4 flex flex-col gap-3"
229
- }, {
230
- default: ne(() => [
231
- _("div", Ir, [
232
- _("span", Tr, I(l.value.orderNumber ? h(a)("order.foodCourt.orders.orderTitle", { number: `#${l.value.orderNumber}` }) : h(a)("order.foodCourt.orders.noNumber")), 1),
233
- j(F, {
234
- variant: h(pe)[l.value.status].variant,
235
- label: h(a)(h(pe)[l.value.status].labelKey)
236
- }, null, 8, ["variant", "label"])
237
- ]),
238
- _("div", Dr, [
239
- (T(!0), U(re, null, ve(u.value, (p) => (T(), U("div", {
240
- key: p.label,
241
- class: "flex flex-col"
242
- }, [
243
- _("span", Sr, I(p.label), 1),
244
- _("span", Nr, I(p.value), 1)
245
- ]))), 128))
246
- ])
247
- ]),
248
- _: 1
249
- }),
250
- (T(!0), U(re, null, ve(s.value, (p) => (T(), ce(A, {
251
- key: p.key,
252
- variant: "outlined",
253
- class: "p-4 flex flex-col gap-3"
254
- }, {
255
- default: ne(() => {
256
- var D, g, y, L;
257
- return [
258
- _("div", kr, [
259
- _("div", Er, [
260
- p.unitNo ? (T(), U("span", Fr, I(p.unitNo), 1)) : le("", !0),
261
- _("span", Ar, I(p.name), 1)
262
- ]),
263
- j(F, {
264
- variant: h(Pe)(p.order).variant,
265
- label: h(a)(h(Pe)(p.order).labelKey)
266
- }, null, 8, ["variant", "label"])
267
- ]),
268
- _("span", Mr, [
269
- Le(I(h(a)("order.foodCourt.orders.billNo")) + " • ", 1),
270
- _("span", Or, I(((g = (D = p.order) == null ? void 0 : D.bill) == null ? void 0 : g.seqNumber) || h(a)("order.foodCourt.orders.notBilled")), 1)
271
- ]),
272
- _("button", {
273
- type: "button",
274
- class: "flex items-center justify-between border-t border-fm-color-neutral-gray-200 pt-3",
275
- onClick: (b) => C(p.key)
276
- }, [
277
- _("span", Ur, I(h(a)("order.foodCourt.orders.itemCount", { count: p.itemCount })), 1),
278
- _("span", Yr, [
279
- Le(I(h(se)(p.amount)) + " ", 1),
280
- j(k, {
281
- name: m.value.has(p.key) ? "expand_less" : "expand_more",
282
- size: "md"
283
- }, null, 8, ["name"])
284
- ])
285
- ], 8, Rr),
286
- m.value.has(p.key) ? (T(), U(re, { key: 0 }, [
287
- p.items.length ? (T(), U("div", Lr, [
288
- (T(!0), U(re, null, ve(p.items, (b) => (T(), U("div", {
289
- key: b.key,
290
- class: ur([
291
- "flex justify-between gap-3",
292
- b.sub ? "pl-4 fm-typo-en-body-sm-400 text-fm-color-typo-secondary" : "fm-typo-en-body-md-600 pt-1"
293
- ])
294
- }, [
295
- _("div", Pr, [
296
- _("span", null, I(b.sub ? `+ ${b.name}` : `${b.quantity}x ${b.name}`), 1),
297
- b.remark ? (T(), U("span", Vr, I(b.remark), 1)) : le("", !0)
298
- ]),
299
- _("span", Br, I(b.amount ? h(se)(b.amount) : ""), 1)
300
- ], 2))), 128))
301
- ])) : (T(), U("div", $r, I(h(a)("order.foodCourt.orders.noItems")), 1)),
302
- p.totals.length ? (T(), U("div", jr, [
303
- (T(!0), U(re, null, ve(p.totals, (b) => (T(), U("div", {
304
- key: b.key,
305
- class: "flex justify-between gap-3"
306
- }, [
307
- _("span", null, I(b.labelIsName ? b.label : h(a)(b.label)), 1),
308
- _("span", null, I(h(se)(b.amount)), 1)
309
- ]))), 128)),
310
- _("div", qr, [
311
- _("span", null, I(h(a)("order.foodCourt.orders.stallTotal")), 1),
312
- _("span", null, I(h(se)(((L = (y = p.order) == null ? void 0 : y.bill) == null ? void 0 : L.nettTotal) ?? p.amount)), 1)
313
- ])
314
- ])) : le("", !0)
315
- ], 64)) : le("", !0)
316
- ];
317
- }),
318
- _: 2
319
- }, 1024))), 128)),
320
- j(A, {
321
- variant: "outlined",
322
- class: "p-4 flex items-center justify-between"
323
- }, {
324
- default: ne(() => [
325
- _("span", zr, I(h(a)("order.foodCourt.orders.netTotal")), 1),
326
- _("span", Hr, I(h(se)(l.value.total)), 1)
327
- ]),
328
- _: 1
329
- })
330
- ])) : le("", !0)
331
- ]),
332
- _: 1
333
- }, 8, ["model-value", "header"]);
334
- };
335
- }
336
- });
337
- var q = Uint8Array, K = Uint16Array, Ae = Int32Array, Me = new q([
338
- 0,
339
- 0,
340
- 0,
341
- 0,
342
- 0,
343
- 0,
344
- 0,
345
- 0,
346
- 1,
347
- 1,
348
- 1,
349
- 1,
350
- 2,
351
- 2,
352
- 2,
353
- 2,
354
- 3,
355
- 3,
356
- 3,
357
- 3,
358
- 4,
359
- 4,
360
- 4,
361
- 4,
362
- 5,
363
- 5,
364
- 5,
365
- 5,
366
- 0,
367
- /* unused */
368
- 0,
369
- 0,
370
- /* impossible */
371
- 0
372
- ]), Oe = new q([
373
- 0,
374
- 0,
375
- 0,
376
- 0,
377
- 1,
378
- 1,
379
- 2,
380
- 2,
381
- 3,
382
- 3,
383
- 4,
384
- 4,
385
- 5,
386
- 5,
387
- 6,
388
- 6,
389
- 7,
390
- 7,
391
- 8,
392
- 8,
393
- 9,
394
- 9,
395
- 10,
396
- 10,
397
- 11,
398
- 11,
399
- 12,
400
- 12,
401
- 13,
402
- 13,
403
- /* unused */
404
- 0,
405
- 0
406
- ]), je = new q([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), rr = function(e, r) {
407
- for (var t = new K(31), o = 0; o < 31; ++o)
408
- t[o] = r += 1 << e[o - 1];
409
- for (var a = new Ae(t[30]), o = 1; o < 30; ++o)
410
- for (var n = t[o]; n < t[o + 1]; ++n)
411
- a[n] = n - t[o] << 5 | o;
412
- return { b: t, r: a };
413
- }, tr = rr(Me, 2), Gr = tr.b, Ne = tr.r;
414
- Gr[28] = 258, Ne[258] = 28;
415
- var Xr = rr(Oe, 0), qe = Xr.r, ke = new K(32768);
416
- for (var N = 0; N < 32768; ++N) {
417
- var ee = (N & 43690) >> 1 | (N & 21845) << 1;
418
- ee = (ee & 52428) >> 2 | (ee & 13107) << 2, ee = (ee & 61680) >> 4 | (ee & 3855) << 4, ke[N] = ((ee & 65280) >> 8 | (ee & 255) << 8) >> 1;
419
- }
420
- var me = function(e, r, t) {
421
- for (var o = e.length, a = 0, n = new K(r); a < o; ++a)
422
- e[a] && ++n[e[a] - 1];
423
- var l = new K(r);
424
- for (a = 1; a < r; ++a)
425
- l[a] = l[a - 1] + n[a - 1] << 1;
426
- var d;
427
- if (t) {
428
- d = new K(1 << r);
429
- var i = 15 - r;
430
- for (a = 0; a < o; ++a)
431
- if (e[a])
432
- for (var m = a << 4 | e[a], s = r - e[a], u = l[e[a] - 1]++ << s, C = u | (1 << s) - 1; u <= C; ++u)
433
- d[ke[u] >> i] = m;
434
- } else
435
- for (d = new K(o), a = 0; a < o; ++a)
436
- e[a] && (d[a] = ke[l[e[a] - 1]++] >> 15 - e[a]);
437
- return d;
438
- }, te = new q(288);
439
- for (var N = 0; N < 144; ++N)
440
- te[N] = 8;
441
- for (var N = 144; N < 256; ++N)
442
- te[N] = 9;
443
- for (var N = 256; N < 280; ++N)
444
- te[N] = 7;
445
- for (var N = 280; N < 288; ++N)
446
- te[N] = 8;
447
- var he = new q(32);
448
- for (var N = 0; N < 32; ++N)
449
- he[N] = 5;
450
- var Wr = /* @__PURE__ */ me(te, 9, 0), Qr = /* @__PURE__ */ me(he, 5, 0), or = function(e) {
451
- return (e + 7) / 8 | 0;
452
- }, ar = function(e, r, t) {
453
- return (t == null || t > e.length) && (t = e.length), new q(e.subarray(r, t));
454
- }, Zr = [
455
- "unexpected EOF",
456
- "invalid block type",
457
- "invalid length/literal",
458
- "invalid distance",
459
- "stream finished",
460
- "no stream handler",
461
- ,
462
- // determined by compression function
463
- "no callback",
464
- "invalid UTF-8 data",
465
- "extra field too long",
466
- "date not in range 1980-2099",
467
- "filename too long",
468
- "stream finishing",
469
- "invalid zip data"
470
- // determined by unknown compression method
471
- ], ge = function(e, r, t) {
472
- var o = new Error(r || Zr[e]);
473
- if (o.code = e, Error.captureStackTrace && Error.captureStackTrace(o, ge), !t)
474
- throw o;
475
- return o;
476
- }, J = function(e, r, t) {
477
- t <<= r & 7;
478
- var o = r / 8 | 0;
479
- e[o] |= t, e[o + 1] |= t >> 8;
480
- }, ue = function(e, r, t) {
481
- t <<= r & 7;
482
- var o = r / 8 | 0;
483
- e[o] |= t, e[o + 1] |= t >> 8, e[o + 2] |= t >> 16;
484
- }, be = function(e, r) {
485
- for (var t = [], o = 0; o < e.length; ++o)
486
- e[o] && t.push({ s: o, f: e[o] });
487
- var a = t.length, n = t.slice();
488
- if (!a)
489
- return { t: lr, l: 0 };
490
- if (a == 1) {
491
- var l = new q(t[0].s + 1);
492
- return l[t[0].s] = 1, { t: l, l: 1 };
493
- }
494
- t.sort(function(R, p) {
495
- return R.f - p.f;
496
- }), t.push({ s: -1, f: 25001 });
497
- var d = t[0], i = t[1], m = 0, s = 1, u = 2;
498
- for (t[0] = { s: -1, f: d.f + i.f, l: d, r: i }; s != a - 1; )
499
- d = t[t[m].f < t[u].f ? m++ : u++], i = t[m != s && t[m].f < t[u].f ? m++ : u++], t[s++] = { s: -1, f: d.f + i.f, l: d, r: i };
500
- for (var C = n[0].s, o = 1; o < a; ++o)
501
- n[o].s > C && (C = n[o].s);
502
- var w = new K(C + 1), v = Ee(t[s - 1], w, 0);
503
- if (v > r) {
504
- var o = 0, c = 0, O = v - r, $ = 1 << O;
505
- for (n.sort(function(p, D) {
506
- return w[D.s] - w[p.s] || p.f - D.f;
507
- }); o < a; ++o) {
508
- var F = n[o].s;
509
- if (w[F] > r)
510
- c += $ - (1 << v - w[F]), w[F] = r;
511
- else
512
- break;
513
- }
514
- for (c >>= O; c > 0; ) {
515
- var A = n[o].s;
516
- w[A] < r ? c -= 1 << r - w[A]++ - 1 : ++o;
517
- }
518
- for (; o >= 0 && c; --o) {
519
- var k = n[o].s;
520
- w[k] == r && (--w[k], ++c);
521
- }
522
- v = r;
523
- }
524
- return { t: new q(w), l: v };
525
- }, Ee = function(e, r, t) {
526
- return e.s == -1 ? Math.max(Ee(e.l, r, t + 1), Ee(e.r, r, t + 1)) : r[e.s] = t;
527
- }, ze = function(e) {
528
- for (var r = e.length; r && !e[--r]; )
529
- ;
530
- for (var t = new K(++r), o = 0, a = e[0], n = 1, l = function(i) {
531
- t[o++] = i;
532
- }, d = 1; d <= r; ++d)
533
- if (e[d] == a && d != r)
534
- ++n;
535
- else {
536
- if (!a && n > 2) {
537
- for (; n > 138; n -= 138)
538
- l(32754);
539
- n > 2 && (l(n > 10 ? n - 11 << 5 | 28690 : n - 3 << 5 | 12305), n = 0);
540
- } else if (n > 3) {
541
- for (l(a), --n; n > 6; n -= 6)
542
- l(8304);
543
- n > 2 && (l(n - 3 << 5 | 8208), n = 0);
544
- }
545
- for (; n--; )
546
- l(a);
547
- n = 1, a = e[d];
548
- }
549
- return { c: t.subarray(0, o), n: r };
550
- }, fe = function(e, r) {
551
- for (var t = 0, o = 0; o < r.length; ++o)
552
- t += e[o] * r[o];
553
- return t;
554
- }, nr = function(e, r, t) {
555
- var o = t.length, a = or(r + 2);
556
- e[a] = o & 255, e[a + 1] = o >> 8, e[a + 2] = e[a] ^ 255, e[a + 3] = e[a + 1] ^ 255;
557
- for (var n = 0; n < o; ++n)
558
- e[a + n + 4] = t[n];
559
- return (a + 4 + o) * 8;
560
- }, He = function(e, r, t, o, a, n, l, d, i, m, s) {
561
- J(r, s++, t), ++a[256];
562
- for (var u = be(a, 15), C = u.t, w = u.l, v = be(n, 15), c = v.t, O = v.l, $ = ze(C), F = $.c, A = $.n, k = ze(c), R = k.c, p = k.n, D = new K(19), g = 0; g < F.length; ++g)
563
- ++D[F[g] & 31];
564
- for (var g = 0; g < R.length; ++g)
565
- ++D[R[g] & 31];
566
- for (var y = be(D, 7), L = y.t, b = y.l, f = 19; f > 4 && !L[je[f - 1]]; --f)
567
- ;
568
- var x = m + 5 << 3, S = fe(a, te) + fe(n, he) + l, Y = fe(a, C) + fe(n, c) + l + 14 + 3 * f + fe(D, L) + 2 * D[16] + 3 * D[17] + 7 * D[18];
569
- if (i >= 0 && x <= S && x <= Y)
570
- return nr(r, s, e.subarray(i, i + m));
571
- var M, E, V, W;
572
- if (J(r, s, 1 + (Y < S)), s += 2, Y < S) {
573
- M = me(C, w, 0), E = C, V = me(c, O, 0), W = c;
574
- var z = me(L, b, 0);
575
- J(r, s, A - 257), J(r, s + 5, p - 1), J(r, s + 10, f - 4), s += 14;
576
- for (var g = 0; g < f; ++g)
577
- J(r, s + 3 * g, L[je[g]]);
578
- s += 3 * f;
579
- for (var Q = [F, R], de = 0; de < 2; ++de)
580
- for (var oe = Q[de], g = 0; g < oe.length; ++g) {
581
- var Z = oe[g] & 31;
582
- J(r, s, z[Z]), s += L[Z], Z > 15 && (J(r, s, oe[g] >> 5 & 127), s += oe[g] >> 12);
583
- }
584
- } else
585
- M = Wr, E = te, V = Qr, W = he;
586
- for (var g = 0; g < d; ++g) {
587
- var B = o[g];
588
- if (B > 255) {
589
- var Z = B >> 18 & 31;
590
- ue(r, s, M[Z + 257]), s += E[Z + 257], Z > 7 && (J(r, s, B >> 23 & 31), s += Me[Z]);
591
- var ae = B & 31;
592
- ue(r, s, V[ae]), s += W[ae], ae > 3 && (ue(r, s, B >> 5 & 8191), s += Oe[ae]);
593
- } else
594
- ue(r, s, M[B]), s += E[B];
595
- }
596
- return ue(r, s, M[256]), s + E[256];
597
- }, Jr = /* @__PURE__ */ new Ae([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]), lr = /* @__PURE__ */ new q(0), et = function(e, r, t, o, a, n) {
598
- var l = n.z || e.length, d = new q(o + l + 5 * (1 + Math.ceil(l / 7e3)) + a), i = d.subarray(o, d.length - a), m = n.l, s = (n.r || 0) & 7;
599
- if (r) {
600
- s && (i[0] = n.r >> 3);
601
- for (var u = Jr[r - 1], C = u >> 13, w = u & 8191, v = (1 << t) - 1, c = n.p || new K(32768), O = n.h || new K(v + 1), $ = Math.ceil(t / 3), F = 2 * $, A = function(Ce) {
602
- return (e[Ce] ^ e[Ce + 1] << $ ^ e[Ce + 2] << F) & v;
603
- }, k = new Ae(25e3), R = new K(288), p = new K(32), D = 0, g = 0, y = n.i || 0, L = 0, b = n.w || 0, f = 0; y + 2 < l; ++y) {
604
- var x = A(y), S = y & 32767, Y = O[x];
605
- if (c[S] = Y, O[x] = S, b <= y) {
606
- var M = l - y;
607
- if ((D > 7e3 || L > 24576) && (M > 423 || !m)) {
608
- s = He(e, i, 0, k, R, p, g, L, f, y - f, s), L = D = g = 0, f = y;
609
- for (var E = 0; E < 286; ++E)
610
- R[E] = 0;
611
- for (var E = 0; E < 30; ++E)
612
- p[E] = 0;
613
- }
614
- var V = 2, W = 0, z = w, Q = S - Y & 32767;
615
- if (M > 2 && x == A(y - Q))
616
- for (var de = Math.min(C, M) - 1, oe = Math.min(32767, y), Z = Math.min(258, M); Q <= oe && --z && S != Y; ) {
617
- if (e[y + V] == e[y + V - Q]) {
618
- for (var B = 0; B < Z && e[y + B] == e[y + B - Q]; ++B)
619
- ;
620
- if (B > V) {
621
- if (V = B, W = Q, B > de)
622
- break;
623
- for (var ae = Math.min(Q, B - 2), Re = 0, E = 0; E < ae; ++E) {
624
- var xe = y - Q + E & 32767, dr = c[xe], Ue = xe - dr & 32767;
625
- Ue > Re && (Re = Ue, Y = xe);
626
- }
627
- }
628
- }
629
- S = Y, Y = c[S], Q += S - Y & 32767;
630
- }
631
- if (W) {
632
- k[L++] = 268435456 | Ne[V] << 18 | qe[W];
633
- var Ye = Ne[V] & 31, $e = qe[W] & 31;
634
- g += Me[Ye] + Oe[$e], ++R[257 + Ye], ++p[$e], b = y + V, ++D;
635
- } else
636
- k[L++] = e[y], ++R[e[y]];
637
- }
638
- }
639
- for (y = Math.max(y, b); y < l; ++y)
640
- k[L++] = e[y], ++R[e[y]];
641
- s = He(e, i, m, k, R, p, g, L, f, y - f, s), m || (n.r = s & 7 | i[s / 8 | 0] << 3, s -= 7, n.h = O, n.p = c, n.i = y, n.w = b);
642
- } else {
643
- for (var y = n.w || 0; y < l + m; y += 65535) {
644
- var _e = y + 65535;
645
- _e >= l && (i[s / 8 | 0] = m, _e = l), s = nr(i, s + 1, e.subarray(y, _e));
646
- }
647
- n.i = l;
648
- }
649
- return ar(d, 0, o + or(s) + a);
650
- }, rt = /* @__PURE__ */ function() {
651
- for (var e = new Int32Array(256), r = 0; r < 256; ++r) {
652
- for (var t = r, o = 9; --o; )
653
- t = (t & 1 && -306674912) ^ t >>> 1;
654
- e[r] = t;
655
- }
656
- return e;
657
- }(), tt = function() {
658
- var e = -1;
659
- return {
660
- p: function(r) {
661
- for (var t = e, o = 0; o < r.length; ++o)
662
- t = rt[t & 255 ^ r[o]] ^ t >>> 8;
663
- e = t;
664
- },
665
- d: function() {
666
- return ~e;
667
- }
668
- };
669
- }, ot = function(e, r, t, o, a) {
670
- if (!a && (a = { l: 1 }, r.dictionary)) {
671
- var n = r.dictionary.subarray(-32768), l = new q(n.length + e.length);
672
- l.set(n), l.set(e, n.length), e = l, a.w = n.length;
673
- }
674
- return et(e, r.level == null ? 6 : r.level, r.mem == null ? a.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(e.length))) * 1.5) : 20 : 12 + r.mem, t, o, a);
675
- }, sr = function(e, r) {
676
- var t = {};
677
- for (var o in e)
678
- t[o] = e[o];
679
- for (var o in r)
680
- t[o] = r[o];
681
- return t;
682
- }, P = function(e, r, t) {
683
- for (; t; ++r)
684
- e[r] = t, t >>>= 8;
685
- };
686
- function at(e, r) {
687
- return ot(e, r || {}, 0, 0);
688
- }
689
- var ir = function(e, r, t, o) {
690
- for (var a in e) {
691
- var n = e[a], l = r + a, d = o;
692
- Array.isArray(n) && (d = sr(o, n[1]), n = n[0]), ArrayBuffer.isView(n) ? t[l] = [n, d] : (t[l += "/"] = [new q(0), d], ir(n, l, t, o));
693
- }
694
- }, Ke = typeof TextEncoder < "u" && /* @__PURE__ */ new TextEncoder(), nt = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), lt = 0;
695
- try {
696
- nt.decode(lr, { stream: !0 }), lt = 1;
697
- } catch {
698
- }
699
- function ye(e, r) {
700
- var t;
701
- if (Ke)
702
- return Ke.encode(e);
703
- for (var o = e.length, a = new q(e.length + (e.length >> 1)), n = 0, l = function(m) {
704
- a[n++] = m;
705
- }, t = 0; t < o; ++t) {
706
- if (n + 5 > a.length) {
707
- var d = new q(n + 8 + (o - t << 1));
708
- d.set(a), a = d;
709
- }
710
- var i = e.charCodeAt(t);
711
- i < 128 || r ? l(i) : i < 2048 ? (l(192 | i >> 6), l(128 | i & 63)) : i > 55295 && i < 57344 ? (i = 65536 + (i & 1047552) | e.charCodeAt(++t) & 1023, l(240 | i >> 18), l(128 | i >> 12 & 63), l(128 | i >> 6 & 63), l(128 | i & 63)) : (l(224 | i >> 12), l(128 | i >> 6 & 63), l(128 | i & 63));
712
- }
713
- return ar(a, 0, n);
714
- }
715
- var Fe = function(e) {
716
- var r = 0;
717
- if (e)
718
- for (var t in e) {
719
- var o = e[t].length;
720
- o > 65535 && ge(9), r += o + 4;
721
- }
722
- return r;
723
- }, Ge = function(e, r, t, o, a, n, l, d) {
724
- var i = o.length, m = t.extra, s = d && d.length, u = Fe(m);
725
- P(e, r, l != null ? 33639248 : 67324752), r += 4, l != null && (e[r++] = 20, e[r++] = t.os), e[r] = 20, r += 2, e[r++] = t.flag << 1 | (n < 0 && 8), e[r++] = a && 8, e[r++] = t.compression & 255, e[r++] = t.compression >> 8;
726
- var C = new Date(t.mtime == null ? Date.now() : t.mtime), w = C.getFullYear() - 1980;
727
- if ((w < 0 || w > 119) && ge(10), P(e, r, w << 25 | C.getMonth() + 1 << 21 | C.getDate() << 16 | C.getHours() << 11 | C.getMinutes() << 5 | C.getSeconds() >> 1), r += 4, n != -1 && (P(e, r, t.crc), P(e, r + 4, n < 0 ? -n - 2 : n), P(e, r + 8, t.size)), P(e, r + 12, i), P(e, r + 14, u), r += 16, l != null && (P(e, r, s), P(e, r + 6, t.attrs), P(e, r + 10, l), r += 14), e.set(o, r), r += i, u)
728
- for (var v in m) {
729
- var c = m[v], O = c.length;
730
- P(e, r, +v), P(e, r + 2, O), e.set(c, r + 4), r += 4 + O;
731
- }
732
- return s && (e.set(d, r), r += s), r;
733
- }, st = function(e, r, t, o, a) {
734
- P(e, r, 101010256), P(e, r + 8, t), P(e, r + 10, t), P(e, r + 12, o), P(e, r + 16, a);
735
- };
736
- function it(e, r) {
737
- r || (r = {});
738
- var t = {}, o = [];
739
- ir(e, "", t, r);
740
- var a = 0, n = 0;
741
- for (var l in t) {
742
- var d = t[l], i = d[0], m = d[1], s = m.level == 0 ? 0 : 8, u = ye(l), C = u.length, w = m.comment, v = w && ye(w), c = v && v.length, O = Fe(m.extra);
743
- C > 65535 && ge(11);
744
- var $ = s ? at(i, m) : i, F = $.length, A = tt();
745
- A.p(i), o.push(sr(m, {
746
- size: i.length,
747
- crc: A.d(),
748
- c: $,
749
- f: u,
750
- m: v,
751
- u: C != l.length || v && w.length != c,
752
- o: a,
753
- compression: s
754
- })), a += 30 + C + O + F, n += 76 + 2 * (C + O) + (c || 0) + F;
755
- }
756
- for (var k = new q(n + 22), R = a, p = n - a, D = 0; D < o.length; ++D) {
757
- var u = o[D];
758
- Ge(k, u.o, u, u.f, u.u, u.c.length);
759
- var g = 30 + u.f.length + Fe(u.extra);
760
- k.set(u.c, u.o + g), Ge(k, a, u, u.f, u.u, u.c.length, u.o, u.m), a += 16 + g + (u.m ? u.m.length : 0);
761
- }
762
- return st(k, a, o.length, p, R), k;
763
- }
764
- function dt(e) {
765
- return e ? X(e).format("YYYY-MM-DD HH:mm:ss") : null;
766
- }
767
- const Ie = [
768
- {
769
- header: "MAIN_ORDER_ID",
770
- definition: `Unique identifier for every food court order ID
771
- When a customer makes a single order from 3 stalls, there will be 1 main food court order ID.`,
772
- value: (e) => e.mainOrderId
773
- },
774
- {
775
- header: "SUB_ORDER_ID",
776
- definition: `Unique identifier for every order created when the main order gets split and distributed to individual stalls.
777
- If there are 3 stalls, there will be 3 order IDs.`,
778
- value: (e) => e.subOrderId
779
- },
780
- {
781
- header: "SHORT_ORDER_ID",
782
- definition: `Customer-facing order ID for food collection, common across all stalls under the same main food court order ID. This is NOT unique and will be recycled.
783
- Prefix with FC.`,
784
- value: (e) => e.shortOrderId
785
- },
786
- {
787
- header: "INVOICE_NO",
788
- definition: "Invoice No issued by the food court owner for the main food court order",
789
- value: (e) => e.invoiceNo
790
- },
791
- {
792
- header: "SUB_INVOICE_NO",
793
- definition: "Invoice No issued by individual stalls for the sub food court orders",
794
- value: (e) => e.subInvoiceNo
795
- },
796
- {
797
- header: "BILL_ID",
798
- definition: "Bill ID of the stall order, as printed on the stall receipt",
799
- value: (e) => e.billId
800
- },
801
- {
802
- header: "TRANSACTION_ID",
803
- definition: "Payment identifier for the transaction",
804
- value: (e) => e.transactionId
805
- },
806
- {
807
- header: "GATEWAY_ID",
808
- definition: "Identifier of the payment gateway used",
809
- value: (e) => e.gatewayId
810
- },
811
- {
812
- header: "GATEWAY_NAME",
813
- definition: "Name of the payment gateway used",
814
- value: (e) => e.gatewayName
815
- },
816
- {
817
- header: "PAYMENT_METHOD",
818
- definition: "Payment method used by the customer",
819
- value: (e) => e.paymentMethod
820
- },
821
- {
822
- header: "ORDER_CHANNEL",
823
- definition: "For identification of whether customer is ordering via kiosk or table QR",
824
- value: (e) => e.orderChannel
825
- },
826
- {
827
- header: "TRANSACTION_TIMESTAMP",
828
- definition: "Payment completion timestamp",
829
- value: (e) => dt(e.transactionTimestamp)
830
- },
831
- { header: "ORDER_STATUS", definition: "Status of the order", value: (e) => e.orderStatus },
832
- {
833
- header: "PAYMENT_STATUS",
834
- definition: "Payment status of the order",
835
- value: (e) => e.paymentStatus
836
- },
837
- { header: "CURRENCY", definition: "Currency of the transaction", value: (e) => e.currency },
838
- // GROSS_AMOUNT − DISCOUNT_APPLIED + SST + SERVICE_CHARGE + ROUNDING = NETT_SALES_AMOUNT, read left
839
- // to right (Food Court Operations, KDI-4942); the two discount splits follow their total.
840
- {
841
- header: "GROSS_AMOUNT",
842
- definition: "Gross amount for the individual stall order, before discounts",
843
- value: (e) => e.grossAmount
844
- },
845
- {
846
- header: "DISCOUNT_APPLIED",
847
- definition: "Total discount applied for a particular stall order ID (ITEM_DISCOUNT + BILL_DISCOUNT)",
848
- value: (e) => e.discountApplied
849
- },
850
- {
851
- header: "ITEM_DISCOUNT",
852
- definition: "Item-level discount applied for a particular stall order ID",
853
- value: (e) => e.itemDiscount
854
- },
855
- {
856
- header: "BILL_DISCOUNT",
857
- definition: "Bill-level discount applied for a particular stall order ID",
858
- value: (e) => e.billDiscount
859
- },
860
- { header: "SST", definition: "SST for the individual stall order", value: (e) => e.sst },
861
- {
862
- header: "SERVICE_CHARGE",
863
- definition: "Service Charge for the individual stall order",
864
- value: (e) => e.serviceCharge
865
- },
866
- {
867
- header: "ROUNDING",
868
- definition: "Rounding for the individual stall order",
869
- value: (e) => e.rounding
870
- },
871
- {
872
- header: "NETT_SALES_AMOUNT",
873
- definition: "Amount paid by customer for the individual stall order, including all applicable taxes and service charges",
874
- value: (e) => e.nettSalesAmount
875
- },
876
- {
877
- header: "TOTAL_SALES_AMOUNT",
878
- definition: "Grand amount paid by customer for all stalls, including all applicable taxes and service charges",
879
- value: (e) => e.totalSalesAmount
880
- },
881
- { header: "FC_ID", definition: "Unique identifier of the food court", value: (e) => e.fcId },
882
- { header: "FC_NAME", definition: "Name of the food court", value: (e) => e.fcName },
883
- {
884
- header: "RESTAURANT_ID",
885
- definition: "Unique identifier of the restaurant or stall",
886
- value: (e) => e.restaurantId
887
- },
888
- {
889
- header: "RESTAURANT_NAME",
890
- definition: "Name of the restaurant or stall",
891
- value: (e) => e.restaurantName
892
- },
893
- { header: "FEE", definition: "MDR charged for the transaction", value: (e) => e.fee },
894
- {
895
- header: "SETTLEMENT_AMOUNT",
896
- definition: "Amount settled by FeedMe after deducting fees",
897
- value: (e) => e.settlementAmount
898
- },
899
- {
900
- header: "SETTLEMENT_ID",
901
- definition: "Identifier for a batch settlement to the food court owner. Empty if the settlement ID has yet to be generated.",
902
- value: (e) => e.settlementId
903
- }
904
- ];
905
- function ut(e) {
906
- return [
907
- Ie.map((r) => r.header),
908
- Ie.map((r) => r.definition),
909
- ...e.map((r) => Ie.map((t) => t.value(r)))
910
- ];
911
- }
912
- function ft(e, r, t = X()) {
913
- const o = (e ?? "").replace(/[\\/:*?"<>|]/g, "").trim().replace(/\s+/g, "_") || "Food_Court", a = r.startDate ? X(r.startDate) : t, n = r.endDate ? X(r.endDate) : a;
914
- return `${o}_${a.format("YYYYMMDD")}-${n.format("YYYYMMDD")}.xlsx`;
915
- }
916
- function ct(e) {
917
- let r = e + 1, t = "";
918
- for (; r > 0; ) {
919
- const o = (r - 1) % 26;
920
- t = String.fromCharCode(65 + o) + t, r = Math.floor((r - 1) / 26);
921
- }
922
- return t;
923
- }
924
- function mt(e) {
925
- return e.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDFFF]/gu, "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
926
- }
927
- function vt(e) {
928
- return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetData>${e.map((t, o) => {
929
- const a = (l) => `${ct(l)}${o + 1}`, n = t.map((l, d) => l == null || l === "" ? "" : typeof l == "number" && Number.isFinite(l) ? `<c r="${a(d)}"><v>${l}</v></c>` : `<c r="${a(d)}" t="inlineStr"><is><t xml:space="preserve">${mt(String(l))}</t></is></c>`).join("");
930
- return `<row r="${o + 1}">${n}</row>`;
931
- }).join("")}</sheetData></worksheet>`;
932
- }
933
- const pt = {
934
- "[Content_Types].xml": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/></Types>',
935
- "_rels/.rels": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>',
936
- "xl/workbook.xml": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets><sheet name="Orders" sheetId="1" r:id="rId1"/></sheets></workbook>',
937
- "xl/_rels/workbook.xml.rels": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>',
938
- // The one default style. Optional in the spec, but some readers expect the part.
939
- "xl/styles.xml": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><fonts count="1"><font><sz val="11"/><name val="Calibri"/></font></fonts><fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>'
940
- };
941
- function ht(e) {
942
- const r = {};
943
- for (const [t, o] of Object.entries(pt)) r[t] = ye(o);
944
- return r["xl/worksheets/sheet1.xml"] = ye(vt(ut(e))), it(r, { level: 6 });
945
- }
946
- function yt(e, r) {
947
- const t = new Blob([ht(r)], {
948
- type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
949
- }), o = URL.createObjectURL(t), a = document.createElement("a");
950
- a.href = o, a.download = e, document.body.appendChild(a), a.click(), a.remove(), setTimeout(() => URL.revokeObjectURL(o), 3e4);
951
- }
952
- const gt = { class: "py-[1.5rem] flex flex-col gap-1" }, xt = { class: "px-[1.5rem] fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _t = {
953
- key: 0,
954
- class: "px-[1.5rem] fm-typo-en-body-md-400 text-fm-color-typo-secondary"
955
- }, Ct = {
956
- key: 1,
957
- class: "px-[1.5rem] flex flex-col gap-4"
958
- }, wt = { class: "flex items-center gap-3 flex-wrap" }, bt = {
959
- key: 0,
960
- class: "py-4 flex flex-col gap-3 items-start"
961
- }, It = { class: "fm-typo-en-body-md-400" }, Tt = {
962
- key: 1,
963
- class: "text-center py-8 text-fm-color-typo-tertiary fm-typo-en-body-md-400"
964
- }, Dt = { class: "flex items-center justify-between gap-3 flex-wrap pb-6" }, St = { class: "flex items-center gap-2" }, Nt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, kt = { class: "flex items-center gap-2" }, Et = { class: "fm-typo-en-body-md-400" }, Xe = "Food Court Order Detail View", Ft = "Food Court Orders View", jt = /* @__PURE__ */ We({
965
- __name: "FoodCourtOrdersView",
966
- setup(e) {
967
- const { t: r } = Qe(), { showError: t, showWarning: o } = Ze(), a = pr(), n = cr(), l = mr(), d = X().format("YYYY-MM-DD"), i = H({
968
- startDate: d,
969
- endDate: d
970
- }), m = H([]), s = H(0), u = H(25), C = H([]), w = H(!1), v = H(!1), c = H(!1), O = ie(
971
- () => we.map((f) => ({
972
- label: r(pe[f].labelKey),
973
- value: f
974
- }))
975
- ), $ = [10, 25, 50, 100].map((f) => ({ label: String(f), value: f })), F = ie(() => {
976
- const { startDate: f, endDate: x } = i.value, S = f ? X(f).format("DD MMM YYYY") : "", Y = x ? X(x).format("DD MMM YYYY") : S;
977
- return S === Y ? S : `${S} - ${Y}`;
978
- });
979
- let A = 0;
980
- async function k() {
981
- const f = a.value, x = ++A;
982
- if (c.value = !1, !f) {
983
- C.value = [], w.value = !1;
984
- return;
985
- }
986
- v.value = !0;
987
- try {
988
- const S = await De.listOrders(f, {
989
- ...Ve(i.value),
990
- status: m.value.length ? m.value : we,
991
- page: s.value,
992
- limit: u.value
993
- });
994
- if (x !== A) return;
995
- C.value = S.items, w.value = S.hasMore;
996
- } catch (S) {
997
- if (x !== A) return;
998
- C.value = [], w.value = !1, c.value = !0, t(Se(S));
999
- } finally {
1000
- x === A && (v.value = !1);
1001
- }
1002
- }
1003
- const R = H(!1);
1004
- async function p() {
1005
- var Y;
1006
- const f = a.value;
1007
- if (!f || R.value) return;
1008
- R.value = !0;
1009
- const x = { ...i.value }, S = m.value.length ? [...m.value] : we;
1010
- try {
1011
- const M = await De.exportOrders(f, { ...Ve(x), status: S });
1012
- if (!M.rows.length) {
1013
- o(r("order.foodCourt.orders.exportEmpty"));
1014
- return;
1015
- }
1016
- yt(ft(M.courtName, x), M.rows), (Y = M.unreadableStalls) != null && Y.length && o(r("order.foodCourt.orders.exportIncomplete", { count: M.unreadableStalls.length }));
1017
- } catch (M) {
1018
- const E = M instanceof yr ? M.code : void 0;
1019
- t(E === "EXPORT_RANGE_TOO_LONG" ? r("order.foodCourt.orders.exportRangeTooLong", { days: 31 }) : E === "EXPORT_TOO_MANY_ROWS" ? r("order.foodCourt.orders.exportTooManyRows", { rows: "50,000" }) : Se(M));
1020
- } finally {
1021
- R.value = !1;
1022
- }
1023
- }
1024
- Te(
1025
- [a, i, m, u],
1026
- () => {
1027
- s.value === 0 ? k() : s.value = 0;
1028
- },
1029
- { deep: !0 }
1030
- ), Te(s, k), k();
1031
- const D = ie(
1032
- () => n.name === Xe && typeof n.params.orderId == "string" ? n.params.orderId : null
1033
- );
1034
- function g(f) {
1035
- l.push({ name: Xe, params: { orderId: f._id }, query: n.query });
1036
- }
1037
- function y(f) {
1038
- g(f.original);
1039
- }
1040
- function L() {
1041
- D.value && l.push({ name: Ft, query: n.query });
1042
- }
1043
- const b = ie(() => [
1044
- {
1045
- id: "orderNumber",
1046
- header: () => r("order.foodCourt.orders.columnOrderNo"),
1047
- cell: ({ row: f }) => f.original.orderNumber ? `#${f.original.orderNumber}` : "-",
1048
- enableSorting: !1,
1049
- meta: { width: "120px" }
1050
- },
1051
- {
1052
- id: "createdAt",
1053
- header: () => r("order.foodCourt.orders.columnDate"),
1054
- cell: ({ row: f }) => Je(f.original.paidAt ?? f.original.createdAt),
1055
- enableSorting: !1
1056
- },
1057
- {
1058
- id: "stalls",
1059
- header: () => r("order.foodCourt.orders.columnStalls"),
1060
- cell: ({ row: f }) => String(f.original.stallCount),
1061
- enableSorting: !1,
1062
- meta: { width: "96px" }
1063
- },
1064
- {
1065
- id: "paymentMethod",
1066
- header: () => r("order.foodCourt.orders.columnPayment"),
1067
- cell: ({ row: f }) => f.original.paymentMethod || "-",
1068
- enableSorting: !1
1069
- },
1070
- {
1071
- id: "total",
1072
- header: () => r("order.foodCourt.orders.columnTotal"),
1073
- cell: ({ row: f }) => se(f.original.total),
1074
- enableSorting: !1
1075
- },
1076
- {
1077
- id: "status",
1078
- header: () => r("order.foodCourt.orders.columnStatus"),
1079
- cell: ({ row: f }) => {
1080
- const x = pe[f.original.status];
1081
- return x ? fr(vr.FmChip, { variant: x.variant, label: r(x.labelKey) }) : "-";
1082
- },
1083
- enableSorting: !1
1084
- }
1085
- ]);
1086
- return (f, x) => {
1087
- const S = G("FmPageHead"), Y = G("FmChip"), M = G("FmDateRangePicker"), E = G("FmSelect"), V = G("FmButton"), W = G("FmTable");
1088
- return T(), U(re, null, [
1089
- _("div", gt, [
1090
- j(S, {
1091
- title: h(r)("order.foodCourt.orders.title"),
1092
- "line-height": 1.7
1093
- }, null, 8, ["title"]),
1094
- _("span", xt, I(h(r)("order.foodCourt.orders.subtitle")), 1)
1095
- ]),
1096
- h(a) ? (T(), U("div", Ct, [
1097
- _("div", wt, [
1098
- j(M, {
1099
- modelValue: i.value,
1100
- "onUpdate:modelValue": x[0] || (x[0] = (z) => i.value = z),
1101
- "show-predefined-range": ""
1102
- }, {
1103
- "trigger-button": ne(() => [
1104
- j(Y, {
1105
- label: F.value,
1106
- icon: "calendar_today"
1107
- }, null, 8, ["label"])
1108
- ]),
1109
- _: 1
1110
- }, 8, ["modelValue"]),
1111
- j(E, {
1112
- modelValue: m.value,
1113
- "onUpdate:modelValue": x[1] || (x[1] = (z) => m.value = z),
1114
- class: "min-w-[240px]",
1115
- multiselect: "",
1116
- items: O.value,
1117
- placeholder: h(r)("order.foodCourt.orders.allStatuses")
1118
- }, null, 8, ["modelValue", "items", "placeholder"]),
1119
- j(V, {
1120
- class: "ml-auto",
1121
- variant: "secondary",
1122
- "prepend-icon": "download",
1123
- label: h(r)("order.foodCourt.orders.export"),
1124
- loading: R.value,
1125
- onClick: p
1126
- }, null, 8, ["label", "loading"])
1127
- ]),
1128
- c.value ? (T(), U("div", bt, [
1129
- _("span", It, I(h(r)("order.foodCourt.orders.loadFailed")), 1),
1130
- j(V, {
1131
- variant: "secondary",
1132
- label: h(r)("order.foodCourt.retry"),
1133
- onClick: k
1134
- }, null, 8, ["label"])
1135
- ])) : (T(), U(re, { key: 1 }, [
1136
- v.value || C.value.length ? (T(), ce(W, {
1137
- key: 0,
1138
- "row-data": C.value,
1139
- "column-defs": b.value,
1140
- loading: v.value,
1141
- "hide-footer": !0,
1142
- "page-size": u.value,
1143
- "shrink-at": !1,
1144
- class: "w-full",
1145
- onRowClick: y
1146
- }, null, 8, ["row-data", "column-defs", "loading", "page-size"])) : (T(), U("div", Tt, I(h(r)("order.foodCourt.orders.empty")), 1)),
1147
- _("div", Dt, [
1148
- _("div", St, [
1149
- _("span", Nt, I(h(r)("order.foodCourt.orders.perPage")), 1),
1150
- j(E, {
1151
- modelValue: u.value,
1152
- "onUpdate:modelValue": x[2] || (x[2] = (z) => u.value = z),
1153
- class: "w-[96px]",
1154
- items: h($)
1155
- }, null, 8, ["modelValue", "items"])
1156
- ]),
1157
- _("div", kt, [
1158
- j(V, {
1159
- variant: "tertiary",
1160
- "prepend-icon": "chevron_left",
1161
- label: h(r)("order.foodCourt.orders.previous"),
1162
- disabled: v.value || s.value === 0,
1163
- onClick: x[3] || (x[3] = (z) => s.value -= 1)
1164
- }, null, 8, ["label", "disabled"]),
1165
- _("span", Et, I(h(r)("order.foodCourt.orders.page", { page: s.value + 1 })), 1),
1166
- j(V, {
1167
- variant: "tertiary",
1168
- "append-icon": "chevron_right",
1169
- label: h(r)("order.foodCourt.orders.next"),
1170
- disabled: v.value || !w.value,
1171
- onClick: x[4] || (x[4] = (z) => s.value += 1)
1172
- }, null, 8, ["label", "disabled"])
1173
- ])
1174
- ])
1175
- ], 64))
1176
- ])) : (T(), U("div", _t, I(h(r)("order.foodCourt.noFoodCourtSelected")), 1)),
1177
- h(a) ? (T(), ce(Kr, {
1178
- key: 2,
1179
- "model-value": !!D.value,
1180
- "food-court-id": h(a),
1181
- "order-id": D.value,
1182
- "onUpdate:modelValue": x[5] || (x[5] = (z) => !z && L())
1183
- }, null, 8, ["model-value", "food-court-id", "order-id"])) : le("", !0)
1184
- ], 64);
1185
- };
1186
- }
1187
- });
1188
- export {
1189
- jt as default
1190
- };