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