@feedmepos/mf-hrm-portal 2.1.1-dev.2 → 2.1.1-dev.4

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