@feedmepos/mf-order-setting 0.0.102 → 0.0.103

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 (139) hide show
  1. package/dist/{DisplaySystemView-jnt6letY.js → DisplaySystemView-BBiZqcWq.js} +1497 -1468
  2. package/dist/{FoodCourtInvitationsView-DoynqFWB.js → FoodCourtInvitationsView-DwOkVs9m.js} +4 -4
  3. package/dist/{FoodCourtOrderSettingsView-DYZLhTHy.js → FoodCourtOrderSettingsView-C9Ag5Bsg.js} +1 -1
  4. package/dist/FoodCourtOrdersView-y4EwK3sn.js +1173 -0
  5. package/dist/{FoodCourtStallsView-CRMTt5BB.js → FoodCourtStallsView-Bi8H-yR7.js} +2 -2
  6. package/dist/{FoodCourtStatusView-C-b-eI-8.js → FoodCourtStatusView-jugAzTKg.js} +1 -1
  7. package/dist/KioskDevicesView-CYiew4X5.js +4 -0
  8. package/dist/KioskDevicesView.vue_vue_type_script_setup_true_lang-BCvbeo7R.js +1497 -0
  9. package/dist/KioskSettingView-AKBiij9a.js +1124 -0
  10. package/dist/KioskView-zKB6mC8I.js +765 -0
  11. package/dist/{OrderSettingsView-BBCnekaj.js → OrderSettingsView-CoV_yX3m.js} +22064 -21635
  12. package/dist/{RestaurantSelector.vue_vue_type_script_setup_true_lang-DjoTyV6m.js → RestaurantSelector.vue_vue_type_script_setup_true_lang-KSMU_jGl.js} +1 -1
  13. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  14. package/dist/{app-Dvk30CIa.js → app-CmuI6uSl.js} +3589 -2902
  15. package/dist/app.js +1 -1
  16. package/dist/{dayjs.min-DUFHhM7O.js → dayjs.min-B3MssMma.js} +1 -1
  17. package/dist/{featureFlag-BvcirzHS.js → featureFlag-CWvkPOBY.js} +123 -130
  18. package/dist/frontend/mf-order/src/api/food-court/index.d.ts +51 -0
  19. package/dist/frontend/mf-order/src/api/kiosk/index.d.ts +4 -0
  20. package/dist/frontend/mf-order/src/api/payment/index.d.ts +8 -0
  21. package/dist/frontend/mf-order/src/api/queue/index.d.ts +13 -0
  22. package/dist/frontend/mf-order/src/api/restaurant-setting/index.d.ts +9 -1
  23. package/dist/frontend/mf-order/src/app.d.ts +687 -0
  24. package/dist/frontend/mf-order/src/main.d.ts +687 -0
  25. package/dist/frontend/mf-order/src/modules/display-system/interface.d.ts +5 -0
  26. package/dist/frontend/mf-order/src/modules/kiosk/interface.d.ts +4 -0
  27. package/dist/frontend/mf-order/src/modules/kiosk/license.d.ts +92 -0
  28. package/dist/frontend/mf-order/src/modules/kiosk/outletLoad.d.ts +15 -0
  29. package/dist/frontend/mf-order/src/modules/kiosk/settingsSections.d.ts +24 -0
  30. package/dist/frontend/mf-order/src/modules/kiosk/useKioskSettings.d.ts +29 -0
  31. package/dist/frontend/mf-order/src/modules/payment/paymentDevice.d.ts +58 -0
  32. package/dist/frontend/mf-order/src/stores/kiosk/index.d.ts +67 -1
  33. package/dist/frontend/mf-order/src/stores/order-setting/index.d.ts +19 -10
  34. package/dist/frontend/mf-order/src/stores/payment/index.d.ts +59 -1
  35. package/dist/frontend/mf-order/src/views/food-court/food-court-export.d.ts +38 -0
  36. package/dist/frontend/mf-order/src/views/kiosk/devices/KioskDeviceCard.vue.d.ts +3 -0
  37. package/dist/frontend/mf-order/src/views/kiosk/devices/KioskDevicesView.vue.d.ts +7 -0
  38. package/dist/frontend/mf-order/src/views/kiosk/devices/KioskLicenseSummary.vue.d.ts +7 -0
  39. package/dist/frontend/mf-order/src/views/kiosk/devices/KioskLicensesView.vue.d.ts +6 -0
  40. package/dist/frontend/mf-order/src/views/kiosk/devices/KioskOtpDialog.vue.d.ts +3 -0
  41. package/dist/frontend/mf-order/src/views/kiosk/devices/KioskPaymentDeviceCard.vue.d.ts +17 -0
  42. package/dist/frontend/mf-order/src/views/kiosk/settings/KioskSettingView.vue.d.ts +5 -2
  43. package/dist/frontend/mf-order/src/views/order-settings/pickup/PickUpSettingDialogContent.vue.d.ts +0 -9
  44. package/dist/frontend/mf-order/src/views/order-settings/pos-status/PosOrderingStatus.vue.d.ts +17 -0
  45. package/dist/frontend/mf-order/src/views/order-settings/pos-status/pos-status.d.ts +44 -0
  46. package/dist/frontend/mf-order/src/views/order-settings/queue/called-message.d.ts +1 -0
  47. package/dist/frontend/mf-order/src/views/order-settings/queue/phone-join-mode.d.ts +25 -0
  48. package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
  49. package/dist/{index-C4n5H7t3.js → index-BQa8AudZ.js} +3 -3
  50. package/dist/index-CMOvrim4.js +147 -0
  51. package/dist/{index-CW4VlFWz.js → index-D5qh2_4b.js} +1 -1
  52. package/dist/{index-C5n6lil6.js → index-Dup6kWLX.js} +6 -6
  53. package/dist/{index-CGxCWKHB.js → index-wuFIsXHT.js} +188 -179
  54. package/dist/{order.dto-Cb_gh3iB.js → order.dto-BD9raQG5.js} +2782 -2735
  55. package/dist/package/entity/display/blocks.d.ts +12 -2
  56. package/dist/package/entity/marketing/marketing.dto.d.ts +18 -18
  57. package/dist/package/entity/order-platform/external/reconciliation/external-reconciliation.do.d.ts +24 -24
  58. package/dist/package/entity/order-platform/menu.dto.d.ts +20 -20
  59. package/dist/package/entity/order-setting/order-setting.do.d.ts +10 -0
  60. package/dist/package/entity/order-setting/order-setting.dto.d.ts +26 -0
  61. package/dist/package/entity/order-setting/queue/queue.do.d.ts +23 -0
  62. package/dist/package/entity/order-setting/queue/queue.dto.d.ts +14 -0
  63. package/dist/package/entity/queue/queue.do.d.ts +153 -0
  64. package/dist/package/entity/queue/queue.dto.d.ts +221 -2
  65. package/dist/package/entity/queue/queue.enum.d.ts +5 -0
  66. package/dist/package/entity/restaurant/restaurant.dto.d.ts +20 -0
  67. package/dist/style.css +1 -1
  68. package/dist/{index-ILnighyU.js → useInternalUser-CHtaur9A.js} +93 -81
  69. package/package.json +2 -1
  70. package/src/api/food-court/index.ts +63 -0
  71. package/src/api/kiosk/index.ts +8 -0
  72. package/src/api/payment/index.ts +18 -1
  73. package/src/api/queue/index.ts +39 -0
  74. package/src/api/restaurant-setting/index.ts +14 -0
  75. package/src/locales/en-US.json +197 -26
  76. package/src/locales/ja-JP.json +193 -23
  77. package/src/locales/th-TH.json +193 -21
  78. package/src/locales/zh-CN.json +197 -23
  79. package/src/modules/display-system/interface.spec.ts +26 -1
  80. package/src/modules/display-system/interface.ts +20 -0
  81. package/src/modules/kiosk/interface.ts +4 -0
  82. package/src/modules/kiosk/license.spec.ts +167 -0
  83. package/src/modules/kiosk/license.ts +175 -0
  84. package/src/modules/kiosk/outletLoad.spec.ts +25 -0
  85. package/src/modules/kiosk/outletLoad.ts +19 -0
  86. package/src/modules/kiosk/settingsSections.spec.ts +85 -0
  87. package/src/modules/kiosk/settingsSections.ts +82 -0
  88. package/src/modules/kiosk/useKioskSettings.spec.ts +157 -0
  89. package/src/modules/kiosk/useKioskSettings.ts +61 -0
  90. package/src/modules/payment/paymentDevice.spec.ts +175 -0
  91. package/src/modules/payment/paymentDevice.ts +156 -0
  92. package/src/stores/kiosk/index.ts +16 -1
  93. package/src/stores/kiosk/mapper.ts +2 -0
  94. package/src/stores/order-setting/index.spec.ts +83 -0
  95. package/src/stores/order-setting/index.ts +49 -27
  96. package/src/stores/payment/index.spec.ts +86 -0
  97. package/src/stores/payment/index.ts +48 -2
  98. package/src/views/display-system/DisplayInspector.vue +17 -8
  99. package/src/views/display-system/DisplayTemplateEditor.vue +3 -1
  100. package/src/views/food-court/FoodCourtOrdersView.vue +46 -1
  101. package/src/views/food-court/food-court-export.spec.ts +151 -0
  102. package/src/views/food-court/food-court-export.ts +283 -0
  103. package/src/views/kiosk/KioskStatePanel.vue +2 -2
  104. package/src/views/kiosk/KioskView.vue +219 -82
  105. package/src/views/kiosk/devices/KioskDeviceCard.vue +148 -23
  106. package/src/views/kiosk/devices/KioskDevicesView.vue +48 -10
  107. package/src/views/kiosk/devices/KioskLicenseSummary.vue +79 -0
  108. package/src/views/kiosk/devices/KioskLicensesView.vue +152 -0
  109. package/src/views/kiosk/devices/KioskOtpDialog.vue +41 -1
  110. package/src/views/kiosk/devices/KioskPaymentDeviceCard.spec.ts +97 -0
  111. package/src/views/kiosk/devices/KioskPaymentDeviceCard.vue +221 -0
  112. package/src/views/kiosk/settings/KioskPaymentTypeSection.vue +1 -1
  113. package/src/views/kiosk/settings/KioskSettingView.vue +702 -419
  114. package/src/views/order-settings/delivery/DeliverySetting.vue +4 -0
  115. package/src/views/order-settings/dine-in/DineInSetting.vue +4 -0
  116. package/src/views/order-settings/pickup/PickUpSetting.vue +4 -4
  117. package/src/views/order-settings/pickup/PickUpSettingDialogContent.vue +0 -23
  118. package/src/views/order-settings/pos-status/PosOrderingStatus.spec.ts +207 -0
  119. package/src/views/order-settings/pos-status/PosOrderingStatus.vue +209 -0
  120. package/src/views/order-settings/pos-status/pos-status.spec.ts +103 -0
  121. package/src/views/order-settings/pos-status/pos-status.ts +86 -0
  122. package/src/views/order-settings/queue/QueueSetting.source.spec.ts +43 -0
  123. package/src/views/order-settings/queue/QueueSetting.vue +289 -15
  124. package/src/views/order-settings/queue/called-message.spec.ts +29 -1
  125. package/src/views/order-settings/queue/called-message.ts +18 -0
  126. package/src/views/order-settings/queue/phone-join-mode.spec.ts +90 -0
  127. package/src/views/order-settings/queue/phone-join-mode.ts +49 -0
  128. package/dist/FoodCourtOrdersView-CAPOycT3.js +0 -544
  129. package/dist/KioskDevicesView-B0U9JxRl.js +0 -4
  130. package/dist/KioskDevicesView.vue_vue_type_script_setup_true_lang-V3ai4FVI.js +0 -937
  131. package/dist/KioskSettingView-rdom_aS8.js +0 -880
  132. package/dist/KioskView-DOON9zR6.js +0 -516
  133. package/dist/frontend/mf-order/src/views/kiosk/settings/KioskDisplayStandSection.vue.d.ts +0 -10
  134. package/dist/frontend/mf-order/src/views/kiosk/settings/KioskInstructionSection.vue.d.ts +0 -15
  135. package/dist/frontend/mf-order/src/views/kiosk/settings/KioskPickAtCounterSection.vue.d.ts +0 -10
  136. package/dist/index-CaHG3M7C.js +0 -135
  137. package/src/views/kiosk/settings/KioskDisplayStandSection.vue +0 -189
  138. package/src/views/kiosk/settings/KioskInstructionSection.vue +0 -40
  139. package/src/views/kiosk/settings/KioskPickAtCounterSection.vue +0 -68
@@ -0,0 +1,49 @@
1
+ import type { FdoOrderQueueSettings } from '@entity'
2
+
3
+ /**
4
+ * "Phone join" on the Queue page (ITS-002803): where a customer may join the queue from their
5
+ * own phone. One setting on the page, two stored flags:
6
+ *
7
+ * - Anywhere: `disableRemoteQueue: false, requireEntranceCode: false`
8
+ * - Only with entrance QR: `disableRemoteQueue: false, requireEntranceCode: true`
9
+ * - Off (counter only): `disableRemoteQueue: true`, `requireEntranceCode` left as stored
10
+ *
11
+ * Off wins on the server whatever `requireEntranceCode` says, so leaving it alone keeps the
12
+ * merchant's choice for when they switch phone joins back on. Queues created at the POS are
13
+ * never affected by any of the three.
14
+ */
15
+ export const PHONE_JOIN_MODES = ['anywhere', 'entrance', 'off'] as const
16
+ export type PhoneJoinMode = (typeof PHONE_JOIN_MODES)[number]
17
+
18
+ type PhoneJoinFields = Pick<FdoOrderQueueSettings, 'disableRemoteQueue' | 'requireEntranceCode'>
19
+
20
+ export function phoneJoinModeOf(settings: PhoneJoinFields): PhoneJoinMode {
21
+ if (settings.disableRemoteQueue === true) return 'off'
22
+ return settings.requireEntranceCode === true ? 'entrance' : 'anywhere'
23
+ }
24
+
25
+ /** `settings` set to `mode`, as a new object. */
26
+ export function withPhoneJoinMode<T extends PhoneJoinFields>(settings: T, mode: PhoneJoinMode): T {
27
+ switch (mode) {
28
+ case 'anywhere':
29
+ return { ...settings, disableRemoteQueue: false, requireEntranceCode: false }
30
+ case 'entrance':
31
+ return { ...settings, disableRemoteQueue: false, requireEntranceCode: true }
32
+ case 'off':
33
+ return { ...settings, disableRemoteQueue: true }
34
+ }
35
+ }
36
+
37
+ /** queue-backend's own default for an absent or unreadable reset time. */
38
+ export const DEFAULT_ENTRANCE_CODE_RESET_TIME = '04:00'
39
+
40
+ const HH_MM = /^([01]\d|2[0-3]):[0-5]\d$/
41
+
42
+ export function isEntranceCodeResetTimeValid(value: unknown): value is string {
43
+ return typeof value === 'string' && HH_MM.test(value)
44
+ }
45
+
46
+ /** The reset time queue-backend will use: the stored one, or its default when absent or invalid. */
47
+ export function effectiveEntranceCodeResetTime(value: string | null | undefined): string {
48
+ return isEntranceCodeResetTimeValid(value) ? value : DEFAULT_ENTRANCE_CODE_RESET_TIME
49
+ }
@@ -1,544 +0,0 @@
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-DUFHhM7O.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-CaHG3M7C.js";
9
- import { e as se } from "./food-court-member-joC8tmsI.js";
10
- import { a as ve } from "./index-CW4VlFWz.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
- };
@@ -1,4 +0,0 @@
1
- import { _ as f } from "./KioskDevicesView.vue_vue_type_script_setup_true_lang-V3ai4FVI.js";
2
- export {
3
- f as default
4
- };