@feedmepos/mf-hrm-portal 2.0.17-dev.5 → 2.0.18-dev
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/{AuditLogList-Dl3Nmf00.js → AuditLogList-CaoW9uYd.js} +5 -5
- package/dist/EmployeeList-DcMvF9U5.js +839 -0
- package/dist/Main-CleutFvF.js +567 -0
- package/dist/{Main-CQ3KwxDY.js → Main-CvW6Vu8N.js} +2055 -2055
- package/dist/{Main-w0XUUaBp.js → Main-D7k57uq5.js} +32 -32
- package/dist/{PermissionSetList-B8qNOWH6.js → PermissionSetList-CM7kbWkO.js} +6 -6
- package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-C9VUjAu_.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Ces9YwYB.js} +525 -525
- package/dist/{RoleList-DMFJsUZv.js → RoleList-DR3eVJ9f.js} +102 -102
- package/dist/TeamMemberList-CZZv4Pu5.js +1038 -0
- package/dist/{TimesheetList-Bwp9_xHe.js → TimesheetList-WqqoKPbg.js} +132 -126
- package/dist/{app-COJbSNM4.js → app-R5EioPr4.js} +4 -4
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-CcBi6N-K.js → dayjs.min-CN15Ft3o.js} +1 -1
- package/dist/employee-DwQlWLkL.js +204 -0
- package/dist/{iteration-JOKbtlLf.js → iteration-UBGGRoxQ.js} +9258 -9213
- package/dist/{lodash-D5xlVzib.js → lodash-CC6qHVUo.js} +1 -1
- package/dist/{rule-3sXHiW0y.js → rule-B519XbW6.js} +273 -273
- package/dist/src/api/restaurant/index.d.ts +5 -0
- package/dist/src/composables/useRestaurantMap.d.ts +2 -329
- package/dist/src/stores/restaurant.d.ts +181 -0
- package/dist/src/stores/role.d.ts +7 -7
- package/dist/src/types/restaurant.d.ts +11 -0
- package/dist/style.css +1 -1
- package/dist/{team-CyNektSD.js → team-BGLhgx5P.js} +1 -1
- package/dist/{timesheet-DkD3AysG.js → timesheet-BylrXRfd.js} +2 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/useAppStore-Akl8AoVN.js +171 -0
- package/dist/{useLoading-4TNmhm5N.js → useLoading-rbrVwWuj.js} +1 -1
- package/dist/{useReportPermissions-CWMFFb8E.js → useReportPermissions-BOEZU86S.js} +3 -3
- package/package.json +1 -1
- package/dist/EmployeeList-DBd_rVW2.js +0 -831
- package/dist/Main-pTgqNncY.js +0 -560
- package/dist/TeamMemberList-BLRTfKLz.js +0 -1031
- package/dist/employee-xiV0LfnL.js +0 -204
- package/dist/useAppStore-CvmsaYSG.js +0 -171
package/dist/Main-pTgqNncY.js
DELETED
|
@@ -1,560 +0,0 @@
|
|
|
1
|
-
import { ref as S, defineComponent as J, computed as F, watch as ce, resolveComponent as h, createElementBlock as D, openBlock as I, Fragment as W, renderSlot as ge, createVNode as o, unref as s, withCtx as b, createElementVNode as l, toDisplayString as w, createBlock as K, isRef as ae, renderList as fe, createCommentVNode as ve, withModifiers as se, createTextVNode as re, normalizeClass as _e, h as _ } from "vue";
|
|
2
|
-
import { useCoreStore as Q, useI18n as X, RestaurantSelector as oe } from "@feedmepos/mf-common";
|
|
3
|
-
import { _ as ye } from "./PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js";
|
|
4
|
-
import { u as Y } from "./useAppStore-CvmsaYSG.js";
|
|
5
|
-
import { defineStore as Ue } from "pinia";
|
|
6
|
-
import { g as z, a as he, b as O } from "./iteration-JOKbtlLf.js";
|
|
7
|
-
import { useSnackbar as ie, components as E, useDialog as xe, useBreakpoints as be, FmButtonVariant as q } from "@feedmepos/ui-library";
|
|
8
|
-
import { S as ne } from "./SelectFilter-DUj7GBtT.js";
|
|
9
|
-
import { _ as we } from "./app-COJbSNM4.js";
|
|
10
|
-
import { _ as le, H as ke } from "./FormItem.vue_vue_type_script_setup_true_lang-CoorkndT.js";
|
|
11
|
-
import { _ as Ve } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
|
|
12
|
-
import { u as Fe } from "./useSearch-BAPEUu1R.js";
|
|
13
|
-
import { u as ue } from "./useLoading-4TNmhm5N.js";
|
|
14
|
-
import { _ as Ie } from "./FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js";
|
|
15
|
-
const H = {
|
|
16
|
-
async getGrantUsers() {
|
|
17
|
-
return z(await O("grant").get(""));
|
|
18
|
-
},
|
|
19
|
-
async createGrantUser(p) {
|
|
20
|
-
return z(await O("grant").post("", p));
|
|
21
|
-
},
|
|
22
|
-
async revokeGrantUser(p, y) {
|
|
23
|
-
return z(
|
|
24
|
-
await O("grant").patch(`/revoke/${p}`, null, {
|
|
25
|
-
params: { restaurantId: y }
|
|
26
|
-
})
|
|
27
|
-
);
|
|
28
|
-
},
|
|
29
|
-
// Test grant validation
|
|
30
|
-
async validatePasscode(p, y) {
|
|
31
|
-
return z(
|
|
32
|
-
await he().post("", {
|
|
33
|
-
passcode: p,
|
|
34
|
-
restaurantId: y
|
|
35
|
-
})
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
}, Se = Ue("grantUser", () => {
|
|
39
|
-
const p = S([]), y = S(!1);
|
|
40
|
-
async function a() {
|
|
41
|
-
y.value = !0;
|
|
42
|
-
try {
|
|
43
|
-
p.value = (await H.getGrantUsers()).sort(
|
|
44
|
-
(d, m) => d.createdAt < m.createdAt ? 1 : -1
|
|
45
|
-
);
|
|
46
|
-
} catch (d) {
|
|
47
|
-
throw console.error("Error reading grant users:", d), d;
|
|
48
|
-
} finally {
|
|
49
|
-
y.value = !1;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async function U(d) {
|
|
53
|
-
try {
|
|
54
|
-
const m = await H.createGrantUser(d);
|
|
55
|
-
return p.value = [m, ...p.value], m;
|
|
56
|
-
} catch (m) {
|
|
57
|
-
throw console.error("Error creating grant user:", m), m;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
async function x(d, m) {
|
|
61
|
-
try {
|
|
62
|
-
const n = await H.revokeGrantUser(d, m), i = p.value.findIndex((c) => c._id === d);
|
|
63
|
-
i !== -1 && (p.value[i] = n);
|
|
64
|
-
} catch (n) {
|
|
65
|
-
throw console.error("Error revoking grant user:", n), n;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
grantUsers: p,
|
|
70
|
-
isLoading: y,
|
|
71
|
-
readGrantUsers: a,
|
|
72
|
-
createGrantUser: U,
|
|
73
|
-
revokeGrantUser: x
|
|
74
|
-
};
|
|
75
|
-
}), Z = Se, Ce = { class: "fm-typo-en-title-md-600" }, Be = { class: "space-y-40" }, $e = { class: "flex gap-8 items-center justify-start" }, Ge = /* @__PURE__ */ J({
|
|
76
|
-
__name: "GrantUserForm",
|
|
77
|
-
setup(p, { expose: y }) {
|
|
78
|
-
const a = Z(), U = Y(), x = Q(), d = ie(), m = ue(d), { t: n } = X(), i = S(!1), c = S({
|
|
79
|
-
name: "",
|
|
80
|
-
restaurantId: "",
|
|
81
|
-
roleId: ""
|
|
82
|
-
}), k = () => {
|
|
83
|
-
c.value = {
|
|
84
|
-
name: "",
|
|
85
|
-
restaurantId: "",
|
|
86
|
-
roleId: ""
|
|
87
|
-
}, i.value = !0;
|
|
88
|
-
}, V = F(() => n("grantUser.form.title")), C = F(() => n("common.create")), G = F(() => x.restaurants.value.map((u) => ({
|
|
89
|
-
label: `${u.profile.code ? u.profile.code + " - " : ""}${u.profile.name}`,
|
|
90
|
-
value: u._id
|
|
91
|
-
}))), R = F(() => c.value.restaurantId ? U.roles.value.filter((u) => u.restaurants.some((g) => g.id === c.value.restaurantId)).map((u) => ({
|
|
92
|
-
label: u.name,
|
|
93
|
-
value: u._id,
|
|
94
|
-
disabled: !u.isUsable
|
|
95
|
-
})) : []);
|
|
96
|
-
ce(
|
|
97
|
-
() => c.value.restaurantId,
|
|
98
|
-
() => {
|
|
99
|
-
c.value.roleId = "";
|
|
100
|
-
}
|
|
101
|
-
);
|
|
102
|
-
async function M() {
|
|
103
|
-
await m.minor(async () => {
|
|
104
|
-
const u = await a.createGrantUser(c.value);
|
|
105
|
-
d.open({
|
|
106
|
-
message: n("grantUser.create.successMessage", {
|
|
107
|
-
passcode: u.passcode
|
|
108
|
-
}),
|
|
109
|
-
type: "success"
|
|
110
|
-
});
|
|
111
|
-
}), i.value = !1;
|
|
112
|
-
}
|
|
113
|
-
return y({
|
|
114
|
-
show: i,
|
|
115
|
-
trigger: k
|
|
116
|
-
}), (u, g) => {
|
|
117
|
-
const P = h("FmTextField"), $ = h("FmSelect"), L = h("fm-button"), N = h("fm-side-sheet");
|
|
118
|
-
return I(), D(W, null, [
|
|
119
|
-
ge(u.$slots, "default", { trigger: k }),
|
|
120
|
-
o(N, {
|
|
121
|
-
id: "grant-user-form",
|
|
122
|
-
modelValue: i.value,
|
|
123
|
-
"onUpdate:modelValue": g[4] || (g[4] = (f) => i.value = f),
|
|
124
|
-
"is-container": s(E).FmForm,
|
|
125
|
-
"is-container-props": {
|
|
126
|
-
onValidationSuccess: M,
|
|
127
|
-
blameFormChildOnValidationFailed: !0
|
|
128
|
-
},
|
|
129
|
-
"max-width": 560
|
|
130
|
-
}, {
|
|
131
|
-
"side-sheet-header": b(() => [
|
|
132
|
-
l("p", Ce, w(V.value), 1)
|
|
133
|
-
]),
|
|
134
|
-
"side-sheet-footer": b(() => [
|
|
135
|
-
l("div", $e, [
|
|
136
|
-
o(L, {
|
|
137
|
-
label: C.value,
|
|
138
|
-
size: "lg",
|
|
139
|
-
type: "submit",
|
|
140
|
-
variant: "primary"
|
|
141
|
-
}, null, 8, ["label"]),
|
|
142
|
-
o(L, {
|
|
143
|
-
label: s(n)("common.cancel"),
|
|
144
|
-
size: "lg",
|
|
145
|
-
variant: "tertiary",
|
|
146
|
-
onClick: g[3] || (g[3] = () => i.value = !1)
|
|
147
|
-
}, null, 8, ["label"])
|
|
148
|
-
])
|
|
149
|
-
]),
|
|
150
|
-
default: b(() => [
|
|
151
|
-
l("div", Be, [
|
|
152
|
-
o(Ie, {
|
|
153
|
-
title: s(n)("grantUser.form.section")
|
|
154
|
-
}, {
|
|
155
|
-
default: b(() => [
|
|
156
|
-
o(P, {
|
|
157
|
-
modelValue: c.value.name,
|
|
158
|
-
"onUpdate:modelValue": g[0] || (g[0] = (f) => c.value.name = f),
|
|
159
|
-
label: s(n)("grantUser.form.name"),
|
|
160
|
-
rules: [(f) => !!f || s(n)("grantUser.form.nameRequired")]
|
|
161
|
-
}, null, 8, ["modelValue", "label", "rules"]),
|
|
162
|
-
o(le, {
|
|
163
|
-
label: s(n)("grantUser.form.restaurant")
|
|
164
|
-
}, {
|
|
165
|
-
default: b(() => [
|
|
166
|
-
o($, {
|
|
167
|
-
modelValue: c.value.restaurantId,
|
|
168
|
-
"onUpdate:modelValue": g[1] || (g[1] = (f) => c.value.restaurantId = f),
|
|
169
|
-
items: G.value,
|
|
170
|
-
placeholder: s(n)("grantUser.form.selectRestaurant"),
|
|
171
|
-
rules: [(f) => !!f || s(n)("grantUser.form.restaurantRequired")]
|
|
172
|
-
}, null, 8, ["modelValue", "items", "placeholder", "rules"])
|
|
173
|
-
]),
|
|
174
|
-
_: 1
|
|
175
|
-
}, 8, ["label"]),
|
|
176
|
-
o(le, {
|
|
177
|
-
label: s(n)("grantUser.form.role")
|
|
178
|
-
}, {
|
|
179
|
-
default: b(() => [
|
|
180
|
-
o($, {
|
|
181
|
-
modelValue: c.value.roleId,
|
|
182
|
-
"onUpdate:modelValue": g[2] || (g[2] = (f) => c.value.roleId = f),
|
|
183
|
-
items: R.value,
|
|
184
|
-
placeholder: s(n)("grantUser.form.selectRole"),
|
|
185
|
-
disabled: !c.value.restaurantId,
|
|
186
|
-
rules: [(f) => !!f || s(n)("grantUser.form.roleRequired")]
|
|
187
|
-
}, null, 8, ["modelValue", "items", "placeholder", "disabled", "rules"])
|
|
188
|
-
]),
|
|
189
|
-
_: 1
|
|
190
|
-
}, 8, ["label"])
|
|
191
|
-
]),
|
|
192
|
-
_: 1
|
|
193
|
-
}, 8, ["title"])
|
|
194
|
-
])
|
|
195
|
-
]),
|
|
196
|
-
_: 1
|
|
197
|
-
}, 8, ["modelValue", "is-container", "is-container-props"])
|
|
198
|
-
], 64);
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
}), Re = {
|
|
202
|
-
class: "space-y-8"
|
|
203
|
-
}, Le = {
|
|
204
|
-
class: "xs:hidden flex w-full items-start justify-between"
|
|
205
|
-
}, Ne = {
|
|
206
|
-
class: "flex items-start gap-8"
|
|
207
|
-
}, Ae = {
|
|
208
|
-
class: "space-y-4 hidden xs:block"
|
|
209
|
-
}, ze = {
|
|
210
|
-
class: "px-16"
|
|
211
|
-
}, De = {
|
|
212
|
-
class: "px-16 flex items-start gap-8"
|
|
213
|
-
}, Ke = {
|
|
214
|
-
class: "pb-64 hidden xs:block"
|
|
215
|
-
}, Ee = {
|
|
216
|
-
class: "space-y-4"
|
|
217
|
-
}, Me = {
|
|
218
|
-
class: "flex items-center gap-8"
|
|
219
|
-
}, Pe = {
|
|
220
|
-
class: "fm-typo-en-body-lg-600"
|
|
221
|
-
}, Te = {
|
|
222
|
-
class: "font-mono text-lg font-bold mr-4"
|
|
223
|
-
}, je = {
|
|
224
|
-
class: "text-fm-color-typo-secondary"
|
|
225
|
-
}, Oe = {
|
|
226
|
-
class: "text-xs"
|
|
227
|
-
}, qe = {
|
|
228
|
-
class: "mt-4 space-y-2"
|
|
229
|
-
}, He = {
|
|
230
|
-
class: "text-xs"
|
|
231
|
-
}, We = {
|
|
232
|
-
class: "text-xs"
|
|
233
|
-
}, Je = {
|
|
234
|
-
key: 0,
|
|
235
|
-
class: "flex flex-col gap-4"
|
|
236
|
-
}, Qe = /* @__PURE__ */ J({
|
|
237
|
-
__name: "GrantUserList",
|
|
238
|
-
setup(p, {
|
|
239
|
-
expose: y
|
|
240
|
-
}) {
|
|
241
|
-
const {
|
|
242
|
-
t: a
|
|
243
|
-
} = X(), U = S(), x = Z(), {
|
|
244
|
-
restaurants: d
|
|
245
|
-
} = Q(), {
|
|
246
|
-
roles: m
|
|
247
|
-
} = Y(), n = F(() => x.grantUsers), {
|
|
248
|
-
searchKey: i,
|
|
249
|
-
filter: c
|
|
250
|
-
} = Fe(), k = F(() => {
|
|
251
|
-
var t;
|
|
252
|
-
return (t = n.value) == null ? void 0 : t.filter((e) => {
|
|
253
|
-
const v = !U.value || U.value.includes(e.restaurantId), T = !B.value || B.value.includes(e.status), A = V.value[e.restaurantId] || "", j = C.value[e.roleId] || "";
|
|
254
|
-
return v && T && c([e.passcode, e.name, A, j, e.grantByName]);
|
|
255
|
-
});
|
|
256
|
-
}), V = F(() => {
|
|
257
|
-
const t = {};
|
|
258
|
-
return d.value.forEach((e) => {
|
|
259
|
-
t[e._id] = e.profile.name;
|
|
260
|
-
}), t;
|
|
261
|
-
}), C = F(() => {
|
|
262
|
-
const t = {};
|
|
263
|
-
return m.value.forEach((e) => {
|
|
264
|
-
t[e._id] = e.name;
|
|
265
|
-
}), t;
|
|
266
|
-
}), G = (t) => {
|
|
267
|
-
switch (t) {
|
|
268
|
-
case "active":
|
|
269
|
-
return "bg-fm-color-system-success-100 text-fm-color-typo-success";
|
|
270
|
-
case "used":
|
|
271
|
-
return "bg-fm-color-typo-tertiary text-fm-color-typo-primary";
|
|
272
|
-
case "revoked":
|
|
273
|
-
return "bg-fm-color-system-error-100 text-fm-color-typo-error";
|
|
274
|
-
default:
|
|
275
|
-
return "bg-fm-color-typo-secondary text-fm-color-typo-primary";
|
|
276
|
-
}
|
|
277
|
-
}, R = (t) => a(`grantUser.status.${t}`), M = [{
|
|
278
|
-
accessorKey: "passcode",
|
|
279
|
-
size: 120,
|
|
280
|
-
maxSize: 120,
|
|
281
|
-
minSize: 120,
|
|
282
|
-
header: () => a("grantUser.columns.passcode"),
|
|
283
|
-
cell(t) {
|
|
284
|
-
const e = t.row.original.passcode;
|
|
285
|
-
return _("div", {
|
|
286
|
-
class: "flex items-center gap-8"
|
|
287
|
-
}, [_(E.FmButton, {
|
|
288
|
-
variant: q.Tertiary,
|
|
289
|
-
textColor: "neutral-gray-400",
|
|
290
|
-
icon: "content_copy",
|
|
291
|
-
onClick: (v) => {
|
|
292
|
-
v.stopPropagation(), te(e);
|
|
293
|
-
}
|
|
294
|
-
}), _("span", {
|
|
295
|
-
class: "font-mono text-lg font-bold"
|
|
296
|
-
}, e)]);
|
|
297
|
-
}
|
|
298
|
-
}, {
|
|
299
|
-
accessorKey: "name",
|
|
300
|
-
header: () => a("grantUser.columns.name")
|
|
301
|
-
}, {
|
|
302
|
-
accessorKey: "restaurantName",
|
|
303
|
-
accessorFn: (t) => V.value[t.restaurantId],
|
|
304
|
-
header: () => a("grantUser.columns.restaurant"),
|
|
305
|
-
meta: {
|
|
306
|
-
width: "250px"
|
|
307
|
-
},
|
|
308
|
-
cell(t) {
|
|
309
|
-
const e = t.row.original.restaurantId, v = V.value[e] || "-";
|
|
310
|
-
return _("div", [_("div", v), _("div", {
|
|
311
|
-
class: "text-fm-color-typo-secondary text-sm"
|
|
312
|
-
}, `${e}`)]);
|
|
313
|
-
}
|
|
314
|
-
}, {
|
|
315
|
-
accessorKey: "roleName",
|
|
316
|
-
accessorFn: (t) => C.value[t.roleId],
|
|
317
|
-
header: () => a("grantUser.columns.role"),
|
|
318
|
-
cell(t) {
|
|
319
|
-
const e = t.row.original.roleId, v = C.value[e] || "-";
|
|
320
|
-
return _("div", v);
|
|
321
|
-
}
|
|
322
|
-
}, {
|
|
323
|
-
accessorKey: "status",
|
|
324
|
-
header: () => a("grantUser.columns.status"),
|
|
325
|
-
meta: {
|
|
326
|
-
maxWidth: "120px"
|
|
327
|
-
},
|
|
328
|
-
cell(t) {
|
|
329
|
-
const e = t.row.original.status;
|
|
330
|
-
return _(E.FmChip, {
|
|
331
|
-
label: R(e),
|
|
332
|
-
class: G(e)
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
}, {
|
|
336
|
-
accessorKey: "grantByName",
|
|
337
|
-
header: () => a("grantUser.columns.grantedBy"),
|
|
338
|
-
cell(t) {
|
|
339
|
-
const e = t.row.original.grantById, v = t.row.original.grantByName;
|
|
340
|
-
return _("div", [_("div", v), _("div", {
|
|
341
|
-
class: "text-fm-color-typo-secondary text-sm"
|
|
342
|
-
}, `${e}`)]);
|
|
343
|
-
}
|
|
344
|
-
}, {
|
|
345
|
-
accessorKey: "createdAt",
|
|
346
|
-
header: () => a("grantUser.columns.createdAt"),
|
|
347
|
-
cell(t) {
|
|
348
|
-
const e = t.row.original.createdAt;
|
|
349
|
-
return _("div", new Date(e).toLocaleString());
|
|
350
|
-
}
|
|
351
|
-
}, {
|
|
352
|
-
id: "action",
|
|
353
|
-
size: 180,
|
|
354
|
-
meta: {
|
|
355
|
-
cellClass: "p-16",
|
|
356
|
-
headerContentClass: "-mx-16"
|
|
357
|
-
},
|
|
358
|
-
cell: (t) => {
|
|
359
|
-
const e = t.row.original;
|
|
360
|
-
return e.status !== "active" ? null : _("div", {
|
|
361
|
-
class: "w-full flex justify-end items-center gap-4"
|
|
362
|
-
}, [_(E.FmButton, {
|
|
363
|
-
label: a("grantUser.actions.revoke"),
|
|
364
|
-
variant: q.Secondary,
|
|
365
|
-
onClick: (v) => {
|
|
366
|
-
v.stopPropagation(), N(e);
|
|
367
|
-
}
|
|
368
|
-
})]);
|
|
369
|
-
}
|
|
370
|
-
}], u = ie(), g = xe(), P = ue(u), $ = S(), {
|
|
371
|
-
breakpoints: L
|
|
372
|
-
} = be(), N = (t) => {
|
|
373
|
-
g.open({
|
|
374
|
-
title: a("grantUser.revoke.title"),
|
|
375
|
-
message: a("grantUser.revoke.message", {
|
|
376
|
-
name: t.name
|
|
377
|
-
}),
|
|
378
|
-
minWidth: L.value.lg ? 588 : 0,
|
|
379
|
-
primaryActions: {
|
|
380
|
-
text: a("grantUser.actions.revoke"),
|
|
381
|
-
close: !1,
|
|
382
|
-
variant: "destructive"
|
|
383
|
-
},
|
|
384
|
-
secondaryActions: {
|
|
385
|
-
text: a("common.cancel"),
|
|
386
|
-
close: !0
|
|
387
|
-
}
|
|
388
|
-
}).onPrimary(async () => {
|
|
389
|
-
P.minor(async () => {
|
|
390
|
-
await x.revokeGrantUser(t._id, t.restaurantId);
|
|
391
|
-
}, {
|
|
392
|
-
successMessage: a("grantUser.revoke.successMessage", {
|
|
393
|
-
name: t.name
|
|
394
|
-
})
|
|
395
|
-
}), g.close();
|
|
396
|
-
});
|
|
397
|
-
};
|
|
398
|
-
function f() {
|
|
399
|
-
var t;
|
|
400
|
-
(t = $.value) == null || t.trigger();
|
|
401
|
-
}
|
|
402
|
-
const ee = F(() => [{
|
|
403
|
-
label: a("grantUser.status.active"),
|
|
404
|
-
value: "active"
|
|
405
|
-
}, {
|
|
406
|
-
label: a("grantUser.status.used"),
|
|
407
|
-
value: "used"
|
|
408
|
-
}, {
|
|
409
|
-
label: a("grantUser.status.revoked"),
|
|
410
|
-
value: "revoked"
|
|
411
|
-
}]), B = S();
|
|
412
|
-
async function te(t) {
|
|
413
|
-
try {
|
|
414
|
-
await navigator.clipboard.writeText(t), u.open({
|
|
415
|
-
message: a("grantUser.passcode.copied"),
|
|
416
|
-
type: "success"
|
|
417
|
-
});
|
|
418
|
-
} catch (e) {
|
|
419
|
-
u.open({
|
|
420
|
-
message: String(e),
|
|
421
|
-
type: "error"
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
return y({
|
|
426
|
-
create: f,
|
|
427
|
-
filteredGrantUsers: k
|
|
428
|
-
}), (t, e) => {
|
|
429
|
-
const v = h("FmSearch"), T = h("FmTable"), A = h("FmButton"), j = h("FmChip"), de = h("FmListItem"), me = h("FmList");
|
|
430
|
-
return I(), D(W, null, [o(Ge, {
|
|
431
|
-
ref_key: "grantUserFormRef",
|
|
432
|
-
ref: $,
|
|
433
|
-
class: "gap-8"
|
|
434
|
-
}, null, 512), l("div", Re, [l("div", Le, [l("div", Ne, [o(s(oe), {
|
|
435
|
-
modelValue: U.value,
|
|
436
|
-
"onUpdate:modelValue": e[0] || (e[0] = (r) => U.value = r),
|
|
437
|
-
"managable-only": !1,
|
|
438
|
-
multiple: "",
|
|
439
|
-
variant: "dark",
|
|
440
|
-
class: "!w-auto"
|
|
441
|
-
}, null, 8, ["modelValue"]), o(ne, {
|
|
442
|
-
modelValue: B.value,
|
|
443
|
-
"onUpdate:modelValue": e[1] || (e[1] = (r) => B.value = r),
|
|
444
|
-
multiple: "",
|
|
445
|
-
variant: "dark",
|
|
446
|
-
items: ee.value,
|
|
447
|
-
"selected-prefix": s(a)("grantUser.filter.selected_status_prefix"),
|
|
448
|
-
placeholder: s(a)("grantUser.filter.status_placeholder")
|
|
449
|
-
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]), o(v, {
|
|
450
|
-
modelValue: s(i),
|
|
451
|
-
"onUpdate:modelValue": e[2] || (e[2] = (r) => ae(i) ? i.value = r : null),
|
|
452
|
-
autofocus: "",
|
|
453
|
-
class: "pl-4 w-[320px]",
|
|
454
|
-
placeholder: s(a)("grantUser.search.placeholder")
|
|
455
|
-
}, null, 8, ["modelValue", "placeholder"])]), l("div", Ae, [l("div", ze, [o(v, {
|
|
456
|
-
modelValue: s(i),
|
|
457
|
-
"onUpdate:modelValue": e[3] || (e[3] = (r) => ae(i) ? i.value = r : null),
|
|
458
|
-
autofocus: "",
|
|
459
|
-
placeholder: s(a)("grantUser.search.placeholder")
|
|
460
|
-
}, null, 8, ["modelValue", "placeholder"])]), o(ke), l("div", De, [o(s(oe), {
|
|
461
|
-
modelValue: U.value,
|
|
462
|
-
"onUpdate:modelValue": e[4] || (e[4] = (r) => U.value = r),
|
|
463
|
-
"managable-only": !1,
|
|
464
|
-
multiple: "",
|
|
465
|
-
variant: "dark",
|
|
466
|
-
class: "!w-auto"
|
|
467
|
-
}, null, 8, ["modelValue"]), o(ne, {
|
|
468
|
-
modelValue: B.value,
|
|
469
|
-
"onUpdate:modelValue": e[5] || (e[5] = (r) => B.value = r),
|
|
470
|
-
multiple: "",
|
|
471
|
-
items: ee.value,
|
|
472
|
-
variant: "dark",
|
|
473
|
-
"selected-prefix": s(a)("grantUser.filter.selected_status_prefix"),
|
|
474
|
-
placeholder: s(a)("grantUser.filter.status_placeholder")
|
|
475
|
-
}, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]), n.value.length > 0 || s(x).isLoading ? (I(), K(we, {
|
|
476
|
-
key: 0,
|
|
477
|
-
class: "overflow-auto"
|
|
478
|
-
}, {
|
|
479
|
-
default: b(() => [o(T, {
|
|
480
|
-
class: "xs:hidden",
|
|
481
|
-
"column-defs": M,
|
|
482
|
-
"row-data": k.value,
|
|
483
|
-
"page-size": k.value.length,
|
|
484
|
-
loading: s(x).isLoading,
|
|
485
|
-
virtual: k.value.length > 0,
|
|
486
|
-
"pin-header-row": "",
|
|
487
|
-
"hide-footer": ""
|
|
488
|
-
}, null, 8, ["row-data", "page-size", "loading", "virtual"]), l("div", Ke, [o(me, {
|
|
489
|
-
separator: ""
|
|
490
|
-
}, {
|
|
491
|
-
default: b(() => [(I(!0), D(W, null, fe(k.value, (r) => (I(), K(de, {
|
|
492
|
-
key: r._id,
|
|
493
|
-
class: "py-12 px-16 items-center justify-between"
|
|
494
|
-
}, {
|
|
495
|
-
default: b(() => [l("div", Ee, [l("div", Me, [o(A, {
|
|
496
|
-
variant: "tertiary",
|
|
497
|
-
"text-color": "neutral-gray-400",
|
|
498
|
-
icon: "content_copy",
|
|
499
|
-
onClick: se((pe) => te(r.passcode), ["stop"])
|
|
500
|
-
}, null, 8, ["onClick"]), l("p", Pe, [l("span", Te, w(r.passcode), 1), re(" - " + w(r.name), 1)])]), l("div", je, [l("div", null, [re(w(V.value[r.restaurantId] || "-") + " ", 1), l("div", Oe, w(r.restaurantId), 1), l("div", null, w(C.value[r.roleId] || "-"), 1)]), l("div", qe, [l("div", He, w(s(a)("grantUser.columns.grantedBy")) + ": " + w(r.grantByName), 1), l("div", We, w(s(a)("grantUser.columns.createdAt")) + ": " + w(new Date(r.createdAt).toLocaleString()), 1), o(j, {
|
|
501
|
-
label: R(r.status),
|
|
502
|
-
class: _e(G(r.status))
|
|
503
|
-
}, null, 8, ["label", "class"])])])]), r.status === "active" ? (I(), D("div", Je, [o(A, {
|
|
504
|
-
label: s(a)("grantUser.actions.revoke"),
|
|
505
|
-
variant: s(q).Secondary,
|
|
506
|
-
onClick: se((pe) => N(r), ["stop"])
|
|
507
|
-
}, null, 8, ["label", "variant", "onClick"])])) : ve("", !0)]),
|
|
508
|
-
_: 2
|
|
509
|
-
}, 1024))), 128))]),
|
|
510
|
-
_: 1
|
|
511
|
-
})])]),
|
|
512
|
-
_: 1
|
|
513
|
-
})) : (I(), K(s(Ve), {
|
|
514
|
-
key: 1,
|
|
515
|
-
title: s(a)("grantUser.noData.title"),
|
|
516
|
-
subtitle: s(a)("grantUser.noData.subtitle")
|
|
517
|
-
}, null, 8, ["title", "subtitle"]))])], 64);
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
|
-
}), dt = /* @__PURE__ */ J({
|
|
521
|
-
__name: "Main",
|
|
522
|
-
setup(p) {
|
|
523
|
-
const { readGrantUsers: y } = Z(), { currentBusiness: a } = Q(), { readRoles: U } = Y(), { t: x } = X(), d = S();
|
|
524
|
-
return ce(
|
|
525
|
-
a,
|
|
526
|
-
async () => {
|
|
527
|
-
var m;
|
|
528
|
-
(m = a.value) != null && m._id && await Promise.all([U(), y()]);
|
|
529
|
-
},
|
|
530
|
-
{ immediate: !0 }
|
|
531
|
-
), (m, n) => {
|
|
532
|
-
const i = h("FmSpacer"), c = h("FmButton");
|
|
533
|
-
return I(), K(ye, {
|
|
534
|
-
heading: s(x)("grantUser.title")
|
|
535
|
-
}, {
|
|
536
|
-
"append-heading": b(() => [
|
|
537
|
-
o(i),
|
|
538
|
-
o(c, {
|
|
539
|
-
"prepend-icon": "add",
|
|
540
|
-
label: s(x)("grantUser.actions.create"),
|
|
541
|
-
onClick: n[0] || (n[0] = (k) => {
|
|
542
|
-
var V;
|
|
543
|
-
return (V = d.value) == null ? void 0 : V.create();
|
|
544
|
-
})
|
|
545
|
-
}, null, 8, ["label"])
|
|
546
|
-
]),
|
|
547
|
-
default: b(() => [
|
|
548
|
-
o(Qe, {
|
|
549
|
-
ref_key: "grantUserListRef",
|
|
550
|
-
ref: d
|
|
551
|
-
}, null, 512)
|
|
552
|
-
]),
|
|
553
|
-
_: 1
|
|
554
|
-
}, 8, ["heading"]);
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
export {
|
|
559
|
-
dt as default
|
|
560
|
-
};
|