@feedmepos/mf-hrm-portal 2.0.8-dev → 2.0.8-dev.1

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 (44) hide show
  1. package/dist/{AuditLogList-Dp5B1jR-.js → AuditLogList-YGP3G14A.js} +24 -23
  2. package/dist/{EmployeeList-O6XTYBcz.js → EmployeeList-DuRlCrqN.js} +164 -169
  3. package/dist/FormSection.vue_vue_type_script_setup_true_lang-BVb8c4YU.js +71 -0
  4. package/dist/HorizontalSplitter-o860F4xM.js +12 -0
  5. package/dist/{Main-XEb1ECXG.js → Main-BfDH3uAt.js} +11 -10
  6. package/dist/{Main--bRTC1IR.js → Main-D4ueBOl0.js} +8 -7
  7. package/dist/Main-QpKV1hdj.js +560 -0
  8. package/dist/PermissionSetList-DfAZmUkI.js +338 -0
  9. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DokyDyxJ.js +3432 -0
  10. package/dist/{RoleList-BeB1etH6.js → RoleList-D4mup6LW.js} +26 -24
  11. package/dist/TeamMemberList-D9rTKS5N.js +989 -0
  12. package/dist/{TimesheetList-DNzuykEu.js → TimesheetList-CBudjg1y.js} +11 -10
  13. package/dist/{app-BovCLczm.js → app-BO9lM0sJ.js} +1333 -1060
  14. package/dist/app.js +2 -2
  15. package/dist/{dayjs.min-dxVeOXk_.js → dayjs.min-lY-LRZuh.js} +1 -1
  16. package/dist/{employee-DGiDGhcK.js → employee-DXp_u8jd.js} +21 -20
  17. package/dist/{index-CQ26ps7Z.js → index-BigKo-lS.js} +1 -1
  18. package/dist/index-DAuOIotV.js +968 -0
  19. package/dist/{index-C0yiZ_7g.js → iteration-DgaP-HFg.js} +3444 -4352
  20. package/dist/{lodash-CBlFHm6b.js → lodash-Mhrrz947.js} +1 -1
  21. package/dist/src/api/grant-user/index.d.ts +8 -0
  22. package/dist/src/api/index.d.ts +3 -1
  23. package/dist/src/helpers/permission-set.d.ts +26 -4
  24. package/dist/src/helpers/permission-set.test.d.ts +1 -0
  25. package/dist/src/router/shared.d.ts +2 -1
  26. package/dist/src/stores/grant-user.d.ts +86 -0
  27. package/dist/src/types/grant-user.d.ts +27 -0
  28. package/dist/src/views/grant/GrantUserList.vue.d.ts +17 -0
  29. package/dist/src/views/grant/Main.vue.d.ts +2 -0
  30. package/dist/src/views/grant/components/GrantUserForm.vue.d.ts +17 -0
  31. package/dist/src/views/grant/locales/index.d.ts +232 -0
  32. package/dist/src/views/team/components/BasePermission.vue.d.ts +2 -2
  33. package/dist/{team-BqxJ-gNb.js → team-oeTIbsa-.js} +1 -1
  34. package/dist/{timesheet-BVR_FxsT.js → timesheet-B4XO3Kjx.js} +10 -9
  35. package/dist/tsconfig.app.tsbuildinfo +1 -1
  36. package/dist/{useAppStore-gvdZApLV.js → useAppStore-Cu5QCTlx.js} +1 -1
  37. package/dist/{useLoading-CCzb5k4G.js → useLoading-DKnxkHGF.js} +1 -1
  38. package/dist/{useReportPermissions-9TaHhs9I.js → useReportPermissions-B_w5FiAK.js} +12 -11
  39. package/dist/useRestaurantMap-e9fQJiLC.js +39 -0
  40. package/package.json +2 -2
  41. package/dist/PermissionSetList-DAwnZ-Gu.js +0 -327
  42. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Bx7A0p-f.js +0 -3333
  43. package/dist/TeamMemberList-BKCsNEuQ.js +0 -979
  44. package/dist/useRestaurantMap-D5BNPLKh.js +0 -107
@@ -0,0 +1,560 @@
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 n, unref as s, withCtx as x, createElementVNode as l, toDisplayString as k, 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-Cu5QCTlx.js";
5
+ import { defineStore as Ue } from "pinia";
6
+ import { g as z, a as he, b as O } from "./iteration-DgaP-HFg.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-BO9lM0sJ.js";
10
+ import { H as ke } from "./HorizontalSplitter-o860F4xM.js";
11
+ import { _ as Ve } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
12
+ import { u as Fe } from "./useSearch-B6WK1LBB.js";
13
+ import { u as ue } from "./useLoading-DKnxkHGF.js";
14
+ import { _ as Ie, a as le } from "./FormSection.vue_vue_type_script_setup_true_lang-BVb8c4YU.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 b(d, m) {
61
+ try {
62
+ const r = await H.revokeGrantUser(d, m), c = p.value.findIndex((i) => i._id === d);
63
+ c !== -1 && (p.value[c] = r);
64
+ } catch (r) {
65
+ throw console.error("Error revoking grant user:", r), r;
66
+ }
67
+ }
68
+ return {
69
+ grantUsers: p,
70
+ isLoading: y,
71
+ readGrantUsers: a,
72
+ createGrantUser: U,
73
+ revokeGrantUser: b
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(), b = Q(), d = ie(), m = ue(d), { t: r } = X(), c = S(!1), i = S({
79
+ name: "",
80
+ restaurantId: "",
81
+ roleId: ""
82
+ }), w = () => {
83
+ i.value = {
84
+ name: "",
85
+ restaurantId: "",
86
+ roleId: ""
87
+ }, c.value = !0;
88
+ }, C = F(() => r("grantUser.form.title")), V = F(() => r("common.create")), G = F(() => b.restaurants.value.map((u) => ({
89
+ label: `${u.profile.code ? u.profile.code + " - " : ""}${u.profile.name}`,
90
+ value: u._id
91
+ }))), R = F(() => i.value.restaurantId ? U.roles.value.filter((u) => u.restaurants.some((g) => g.id === i.value.restaurantId)).map((u) => ({
92
+ label: u.name,
93
+ value: u._id,
94
+ disabled: !u.isUsable
95
+ })) : []);
96
+ ce(
97
+ () => i.value.restaurantId,
98
+ () => {
99
+ i.value.roleId = "";
100
+ }
101
+ );
102
+ async function M() {
103
+ await m.minor(async () => {
104
+ const u = await a.createGrantUser(i.value);
105
+ d.open({
106
+ message: r("grantUser.create.successMessage", {
107
+ passcode: u.passcode
108
+ }),
109
+ type: "success"
110
+ });
111
+ }), c.value = !1;
112
+ }
113
+ return y({
114
+ show: c,
115
+ trigger: w
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: w }),
120
+ n(N, {
121
+ id: "grant-user-form",
122
+ modelValue: c.value,
123
+ "onUpdate:modelValue": g[4] || (g[4] = (f) => c.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": x(() => [
132
+ l("p", Ce, k(C.value), 1)
133
+ ]),
134
+ "side-sheet-footer": x(() => [
135
+ l("div", $e, [
136
+ n(L, {
137
+ label: V.value,
138
+ size: "lg",
139
+ type: "submit",
140
+ variant: "primary"
141
+ }, null, 8, ["label"]),
142
+ n(L, {
143
+ label: s(r)("common.cancel"),
144
+ size: "lg",
145
+ variant: "tertiary",
146
+ onClick: g[3] || (g[3] = () => c.value = !1)
147
+ }, null, 8, ["label"])
148
+ ])
149
+ ]),
150
+ default: x(() => [
151
+ l("div", Be, [
152
+ n(Ie, {
153
+ title: s(r)("grantUser.form.section")
154
+ }, {
155
+ default: x(() => [
156
+ n(P, {
157
+ modelValue: i.value.name,
158
+ "onUpdate:modelValue": g[0] || (g[0] = (f) => i.value.name = f),
159
+ label: s(r)("grantUser.form.name"),
160
+ rules: [(f) => !!f || s(r)("grantUser.form.nameRequired")]
161
+ }, null, 8, ["modelValue", "label", "rules"]),
162
+ n(le, {
163
+ label: s(r)("grantUser.form.restaurant")
164
+ }, {
165
+ default: x(() => [
166
+ n($, {
167
+ modelValue: i.value.restaurantId,
168
+ "onUpdate:modelValue": g[1] || (g[1] = (f) => i.value.restaurantId = f),
169
+ items: G.value,
170
+ placeholder: s(r)("grantUser.form.selectRestaurant"),
171
+ rules: [(f) => !!f || s(r)("grantUser.form.restaurantRequired")]
172
+ }, null, 8, ["modelValue", "items", "placeholder", "rules"])
173
+ ]),
174
+ _: 1
175
+ }, 8, ["label"]),
176
+ n(le, {
177
+ label: s(r)("grantUser.form.role")
178
+ }, {
179
+ default: x(() => [
180
+ n($, {
181
+ modelValue: i.value.roleId,
182
+ "onUpdate:modelValue": g[2] || (g[2] = (f) => i.value.roleId = f),
183
+ items: R.value,
184
+ placeholder: s(r)("grantUser.form.selectRole"),
185
+ disabled: !i.value.restaurantId,
186
+ rules: [(f) => !!f || s(r)("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(), b = Z(), {
244
+ restaurants: d
245
+ } = Q(), {
246
+ roles: m
247
+ } = Y(), r = F(() => b.grantUsers), {
248
+ searchKey: c,
249
+ filter: i
250
+ } = Fe(""), w = F(() => {
251
+ var t;
252
+ return (t = r.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 = C.value[e.restaurantId] || "", j = V.value[e.roleId] || "";
254
+ return v && T && i([e.passcode, e.name, A, j, e.grantByName]);
255
+ });
256
+ }), C = F(() => {
257
+ const t = {};
258
+ return d.value.forEach((e) => {
259
+ t[e._id] = e.profile.name;
260
+ }), t;
261
+ }), V = 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) => C.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 = C.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) => V.value[t.roleId],
317
+ header: () => a("grantUser.columns.role"),
318
+ cell(t) {
319
+ const e = t.row.original.roleId, v = V.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 b.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: w
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, [n(Ge, {
431
+ ref_key: "grantUserFormRef",
432
+ ref: $,
433
+ class: "gap-8"
434
+ }, null, 512), l("div", Re, [l("div", Le, [l("div", Ne, [n(s(oe), {
435
+ modelValue: U.value,
436
+ "onUpdate:modelValue": e[0] || (e[0] = (o) => U.value = o),
437
+ "managable-only": !1,
438
+ multiple: "",
439
+ variant: "dark",
440
+ class: "!w-auto"
441
+ }, null, 8, ["modelValue"]), n(ne, {
442
+ modelValue: B.value,
443
+ "onUpdate:modelValue": e[1] || (e[1] = (o) => B.value = o),
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"])]), n(v, {
450
+ modelValue: s(c),
451
+ "onUpdate:modelValue": e[2] || (e[2] = (o) => ae(c) ? c.value = o : 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, [n(v, {
456
+ modelValue: s(c),
457
+ "onUpdate:modelValue": e[3] || (e[3] = (o) => ae(c) ? c.value = o : null),
458
+ autofocus: "",
459
+ placeholder: s(a)("grantUser.search.placeholder")
460
+ }, null, 8, ["modelValue", "placeholder"])]), n(ke), l("div", De, [n(s(oe), {
461
+ modelValue: U.value,
462
+ "onUpdate:modelValue": e[4] || (e[4] = (o) => U.value = o),
463
+ "managable-only": !1,
464
+ multiple: "",
465
+ variant: "dark",
466
+ class: "!w-auto"
467
+ }, null, 8, ["modelValue"]), n(ne, {
468
+ modelValue: B.value,
469
+ "onUpdate:modelValue": e[5] || (e[5] = (o) => B.value = o),
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"])])]), r.value.length > 0 || s(b).isLoading ? (I(), K(we, {
476
+ key: 0,
477
+ class: "overflow-auto"
478
+ }, {
479
+ default: x(() => [n(T, {
480
+ class: "xs:hidden",
481
+ "column-defs": M,
482
+ "row-data": w.value,
483
+ "page-size": w.value.length,
484
+ loading: s(b).isLoading,
485
+ virtual: w.value.length > 0,
486
+ "pin-header-row": "",
487
+ "hide-footer": ""
488
+ }, null, 8, ["row-data", "page-size", "loading", "virtual"]), l("div", Ke, [n(me, {
489
+ separator: ""
490
+ }, {
491
+ default: x(() => [(I(!0), D(W, null, fe(w.value, (o) => (I(), K(de, {
492
+ key: o._id,
493
+ class: "py-12 px-16 items-center justify-between"
494
+ }, {
495
+ default: x(() => [l("div", Ee, [l("div", Me, [n(A, {
496
+ variant: "tertiary",
497
+ "text-color": "neutral-gray-400",
498
+ icon: "content_copy",
499
+ onClick: se((pe) => te(o.passcode), ["stop"])
500
+ }, null, 8, ["onClick"]), l("p", Pe, [l("span", Te, k(o.passcode), 1), re(" - " + k(o.name), 1)])]), l("div", je, [l("div", null, [re(k(C.value[o.restaurantId] || "-") + " ", 1), l("div", Oe, k(o.restaurantId), 1), l("div", null, k(V.value[o.roleId] || "-"), 1)]), l("div", qe, [l("div", He, k(s(a)("grantUser.columns.grantedBy")) + ": " + k(o.grantByName), 1), l("div", We, k(s(a)("grantUser.columns.createdAt")) + ": " + k(new Date(o.createdAt).toLocaleString()), 1), n(j, {
501
+ label: R(o.status),
502
+ class: _e(G(o.status))
503
+ }, null, 8, ["label", "class"])])])]), o.status === "active" ? (I(), D("div", Je, [n(A, {
504
+ label: s(a)("grantUser.actions.revoke"),
505
+ variant: s(q).Secondary,
506
+ onClick: se((pe) => N(o), ["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(), { readRestaurants: a, currentBusiness: U } = Q(), { readRoles: b } = Y(), { t: d } = X(), m = S();
524
+ return ce(
525
+ U,
526
+ async () => {
527
+ var r;
528
+ (r = U.value) != null && r._id && await Promise.all([a(), b(), y()]);
529
+ },
530
+ { immediate: !0 }
531
+ ), (r, c) => {
532
+ const i = h("FmSpacer"), w = h("FmButton");
533
+ return I(), K(ye, {
534
+ heading: s(d)("grantUser.title")
535
+ }, {
536
+ "append-heading": x(() => [
537
+ n(i),
538
+ n(w, {
539
+ "prepend-icon": "add",
540
+ label: s(d)("grantUser.actions.create"),
541
+ onClick: c[0] || (c[0] = (C) => {
542
+ var V;
543
+ return (V = m.value) == null ? void 0 : V.create();
544
+ })
545
+ }, null, 8, ["label"])
546
+ ]),
547
+ default: x(() => [
548
+ n(Qe, {
549
+ ref_key: "grantUserListRef",
550
+ ref: m
551
+ }, null, 512)
552
+ ]),
553
+ _: 1
554
+ }, 8, ["heading"]);
555
+ };
556
+ }
557
+ });
558
+ export {
559
+ dt as default
560
+ };