@feedmepos/mf-hrm-portal 1.1.0-dev → 1.1.1-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.
Files changed (96) hide show
  1. package/dist/AuditLogList-D62QRWN-.js +232 -0
  2. package/dist/{EmployeeList-tmUqs5a6.js → EmployeeList-CMUbRS7j.js} +156 -150
  3. package/dist/Main-BbZ-t-pu.js +85 -0
  4. package/dist/{main-DOtgCRZe.js → Main-un3v_g6p.js} +1500 -1532
  5. package/dist/{PageLayout.vue_vue_type_script_setup_true_lang-DuwNwJDM.js → PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js} +2 -2
  6. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CZKBfM_R.js +3119 -0
  7. package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js +38 -0
  8. package/dist/{RoleList-C5xG7LHg.js → RoleList-mlTepnhN.js} +52 -50
  9. package/dist/RolePermissionList-tR-Kmlu7.js +285 -0
  10. package/dist/TeamMemberList-BkRQl6x8.js +948 -0
  11. package/dist/{TimesheetList-CZfo4Dua.js → TimesheetList-i5yaAzhB.js} +21 -21
  12. package/dist/api/audit-log/index.d.ts +10 -0
  13. package/dist/api/index.d.ts +1 -3
  14. package/dist/api/permission-assignment/index.d.ts +10 -0
  15. package/dist/api/permission-set/index.d.ts +8 -0
  16. package/dist/api/team/index.d.ts +2 -1
  17. package/dist/app-4LaGLcWC.js +2305 -0
  18. package/dist/app.js +1 -1
  19. package/dist/components/AppForm.vue.d.ts +3 -2
  20. package/dist/components/CheckboxInput.vue.d.ts +10 -4
  21. package/dist/components/CollapsibleWrapper.vue.d.ts +3 -2
  22. package/dist/components/form/SelectFilter.vue.d.ts +3 -2
  23. package/dist/components/layout/FormColumn.vue.d.ts +6 -3
  24. package/dist/components/layout/FormItem.vue.d.ts +2 -1
  25. package/dist/components/layout/FormSection.vue.d.ts +2 -1
  26. package/dist/components/layout/FullWrapper.vue.d.ts +6 -3
  27. package/dist/components/layout/PageLayout.vue.d.ts +2 -1
  28. package/dist/components/menu/BottomSheetMenu.vue.d.ts +2 -1
  29. package/dist/components/menu/BottomSheetMenuItem.vue.d.ts +6 -3
  30. package/dist/components/table/EmptyDataTemplate/index.vue.d.ts +6 -3
  31. package/dist/composables/useAppStore.d.ts +6 -6
  32. package/dist/composables/useDateRange.d.ts +1 -1
  33. package/dist/composables/useRestaurantMap.d.ts +4 -8
  34. package/dist/composables/useSheet.d.ts +1 -1
  35. package/dist/{employee-BQc7Wgpu.js → employee-BZTntAR0.js} +9 -9
  36. package/dist/helpers/permission-set.d.ts +32 -0
  37. package/dist/helpers/portal-user.d.ts +8 -0
  38. package/dist/helpers/rule.d.ts +4 -3
  39. package/dist/index-BsEM84j5.js +8440 -0
  40. package/dist/{empty-placeholder-ey8LJtN1.js → index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js} +43 -2
  41. package/dist/{lodash-DNzKT_gG.js → lodash-DYaYvsmp.js} +326 -343
  42. package/dist/router/shared.d.ts +3 -1
  43. package/dist/stores/employee.d.ts +4 -4
  44. package/dist/stores/permission-assignment.d.ts +277 -0
  45. package/dist/stores/permission-set.d.ts +250 -0
  46. package/dist/stores/role.d.ts +4 -4
  47. package/dist/stores/team.d.ts +288 -0
  48. package/dist/stores/timesheet.d.ts +19 -19
  49. package/dist/team-eo_yQh1g.js +26 -0
  50. package/dist/{timesheet-B4M1nCIm.js → timesheet-CfPIK52Q.js} +14 -15
  51. package/dist/tsconfig.app.tsbuildinfo +1 -1
  52. package/dist/types/audit-log.d.ts +18 -0
  53. package/dist/types/permission-assignment.d.ts +20 -0
  54. package/dist/types/permission-set.d.ts +20 -0
  55. package/dist/types/permission.d.ts +4 -3
  56. package/dist/types/team.d.ts +13 -3
  57. package/dist/useAppStore-D0F-tWJO.js +180 -0
  58. package/dist/useLoading-DpbOtToC.js +99 -0
  59. package/dist/useRestaurantMap-D5BNPLKh.js +107 -0
  60. package/dist/{useSearch-C25VELOk.js → useSearch-C6gRA62e.js} +8 -8
  61. package/dist/views/hr/employee/{components/EmployeeForm.vue.d.ts → EmployeeForm.vue.d.ts} +10 -7
  62. package/dist/views/hr/locales/index.d.ts +0 -214
  63. package/dist/views/team/components/BasePermission.vue.d.ts +76 -0
  64. package/dist/views/team/components/{TeamMemberConditionPermission.vue.d.ts → ConditionPermission.vue.d.ts} +14 -1
  65. package/dist/views/team/components/InheritPermissionTooltip.vue.d.ts +14 -0
  66. package/dist/views/team/components/PermissionWithTooltip.vue.d.ts +14 -0
  67. package/dist/views/team/components/PortalPermissionEditor.vue.d.ts +68 -28
  68. package/dist/views/team/components/{TeamMemberRolePermission.vue.d.ts → PosRolePermission.vue.d.ts} +14 -1
  69. package/dist/views/team/locales/index.d.ts +176 -4
  70. package/dist/views/team/{components → member}/AddMemberForm.vue.d.ts +1 -0
  71. package/dist/views/team/member/TeamMemberList.vue.d.ts +4 -0
  72. package/dist/views/team/member/TeamMemberMasterUser.vue.d.ts +55 -0
  73. package/dist/views/team/role/RolePermissionForm.vue.d.ts +19 -0
  74. package/dist/views/{hr/grant-user/GrantUserList.vue.d.ts → team/role/RolePermissionList.vue.d.ts} +0 -12
  75. package/package.json +14 -9
  76. package/dist/FormSection.vue_vue_type_script_setup_true_lang-BY9VGOoM.js +0 -71
  77. package/dist/HorizontalSplitter-B9DVYJIM.js +0 -12
  78. package/dist/Main-ebQsujY3.js +0 -600
  79. package/dist/TeamMemberList-09_3YTHe.js +0 -1509
  80. package/dist/api/grant-user/index.d.ts +0 -8
  81. package/dist/app-B4KDGOw1.js +0 -1432
  82. package/dist/index-CSG8t9Dl.js +0 -58
  83. package/dist/role-DGAu9X1X.js +0 -9728
  84. package/dist/rule-CSj0p2P3.js +0 -450
  85. package/dist/stores/grant-user.d.ts +0 -86
  86. package/dist/types/grant-user.d.ts +0 -17
  87. package/dist/useAppStore-CKmMR-gI.js +0 -93
  88. package/dist/useLoading-v4m-6mEy.js +0 -141
  89. package/dist/useRestaurantMap-e9fQJiLC.js +0 -39
  90. package/dist/views/hr/grant-user/components/GrantUserForm.vue.d.ts +0 -14
  91. package/dist/views/team/components/TeamMemberBasePermission.vue.d.ts +0 -36
  92. package/dist/views/team/components/TeamMemberMasterUser.vue.d.ts +0 -718
  93. /package/dist/views/hr/{grant-user/Main.vue.d.ts → Main.vue.d.ts} +0 -0
  94. /package/dist/views/hr/{main.vue.d.ts → audit-log/AuditLogList.vue.d.ts} +0 -0
  95. /package/dist/views/team/{TeamMemberList.vue.d.ts → Main.vue.d.ts} +0 -0
  96. /package/dist/views/team/{components → member}/MemberInfo.vue.d.ts +0 -0
@@ -1,600 +0,0 @@
1
- import { ref as V, defineComponent as Y, computed as S, watch as ue, resolveComponent as U, openBlock as I, createElementBlock as E, Fragment as X, renderSlot as ye, createVNode as n, unref as r, withCtx as x, createElementVNode as l, toDisplayString as k, isRef as ne, createBlock as j, renderList as _e, withModifiers as oe, createTextVNode as le, normalizeClass as Ue, createCommentVNode as be, h } from "vue";
2
- import { useCoreStore as Z, useI18n as ee, RestaurantSelector as J } from "@feedmepos/mf-common";
3
- import { _ as xe } from "./PageLayout.vue_vue_type_script_setup_true_lang-DuwNwJDM.js";
4
- import { g as M, a as we, b as Q, u as te } from "./role-DGAu9X1X.js";
5
- import { defineStore as ke } from "pinia";
6
- import { useSnackbar as de, components as O, useDialog as Ve, useBreakpoints as Se, FmButtonVariant as K } from "@feedmepos/ui-library";
7
- import { u as Fe, S as ce } from "./useSearch-C25VELOk.js";
8
- import { _ as Ie } from "./app-B4KDGOw1.js";
9
- import { H as Ce } from "./HorizontalSplitter-B9DVYJIM.js";
10
- import { u as me, _ as Be } from "./useLoading-v4m-6mEy.js";
11
- import { _ as $e, a as ie } from "./FormSection.vue_vue_type_script_setup_true_lang-BY9VGOoM.js";
12
- const q = {
13
- async getGrantUsers() {
14
- return M(await Q("grant").get("/"));
15
- },
16
- async createGrantUser(p) {
17
- return M(await Q("grant").post("/", p));
18
- },
19
- async revokeGrantUser(p, y) {
20
- return M(
21
- await Q("grant").patch(`/revoke/${p}`, null, {
22
- params: { restaurantId: y }
23
- })
24
- );
25
- },
26
- // TODO: For testing, remove when deploy
27
- async validatePasscode(p, y) {
28
- return M(
29
- await we().post("", {
30
- passcode: p,
31
- restaurantId: y
32
- })
33
- );
34
- }
35
- }, Ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
36
- __proto__: null,
37
- default: q
38
- }, Symbol.toStringTag, { value: "Module" })), Re = ke("grantUser", () => {
39
- const p = V([]), y = V(!1);
40
- async function a() {
41
- y.value = !0;
42
- try {
43
- p.value = (await q.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 _(d) {
53
- try {
54
- const m = await q.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 o = await q.revokeGrantUser(d, m), c = p.value.findIndex((i) => i._id === d);
63
- c !== -1 && (p.value[c] = o);
64
- } catch (o) {
65
- throw console.error("Error revoking grant user:", o), o;
66
- }
67
- }
68
- return {
69
- grantUsers: p,
70
- isLoading: y,
71
- readGrantUsers: a,
72
- createGrantUser: _,
73
- revokeGrantUser: b
74
- };
75
- }), ae = Re, Le = { class: "fm-typo-en-title-md-600" }, Ne = { class: "space-y-40" }, Pe = { class: "flex gap-8 items-center justify-start" }, Ae = /* @__PURE__ */ Y({
76
- __name: "GrantUserForm",
77
- setup(p, { expose: y }) {
78
- const a = ae(), _ = te(), b = Z(), d = de(), m = me(d), { t: o } = ee(), c = V(!1), i = V({
79
- name: "",
80
- restaurantId: "",
81
- roleId: ""
82
- }), w = () => {
83
- i.value = {
84
- name: "",
85
- restaurantId: "",
86
- roleId: ""
87
- }, c.value = !0;
88
- }, B = S(() => o("hr.grantUser.form.title")), F = S(() => o("common.create")), L = S(() => b.restaurants.value.map((u) => ({
89
- label: `${u.profile.code ? u.profile.code + " - " : ""}${u.profile.name}`,
90
- value: u._id
91
- }))), N = S(() => i.value.restaurantId ? _.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
- ue(
97
- () => i.value.restaurantId,
98
- () => {
99
- i.value.roleId = "";
100
- }
101
- );
102
- async function H() {
103
- await m.minor(async () => {
104
- const u = await a.createGrantUser(i.value);
105
- d.open({
106
- message: o("hr.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 = U("FmTextField"), R = U("FmSelect"), A = U("fm-button"), z = U("fm-side-sheet");
118
- return I(), E(X, null, [
119
- ye(u.$slots, "default", { trigger: w }),
120
- n(z, {
121
- id: "grant-user-form",
122
- modelValue: c.value,
123
- "onUpdate:modelValue": g[4] || (g[4] = (v) => c.value = v),
124
- "is-container": r(O).FmForm,
125
- "is-container-props": {
126
- onValidationSuccess: H,
127
- blameFormChildOnValidationFailed: !0
128
- },
129
- "max-width": 560
130
- }, {
131
- "side-sheet-header": x(() => [
132
- l("p", Le, k(B.value), 1)
133
- ]),
134
- "side-sheet-footer": x(() => [
135
- l("div", Pe, [
136
- n(A, {
137
- label: F.value,
138
- size: "lg",
139
- type: "submit",
140
- variant: "primary"
141
- }, null, 8, ["label"]),
142
- n(A, {
143
- label: r(o)("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", Ne, [
152
- n($e, {
153
- title: r(o)("hr.grantUser.form.section")
154
- }, {
155
- default: x(() => [
156
- n(P, {
157
- modelValue: i.value.name,
158
- "onUpdate:modelValue": g[0] || (g[0] = (v) => i.value.name = v),
159
- label: r(o)("hr.grantUser.form.name"),
160
- rules: [(v) => !!v || r(o)("hr.grantUser.form.nameRequired")]
161
- }, null, 8, ["modelValue", "label", "rules"]),
162
- n(ie, {
163
- label: r(o)("hr.grantUser.form.restaurant")
164
- }, {
165
- default: x(() => [
166
- n(R, {
167
- modelValue: i.value.restaurantId,
168
- "onUpdate:modelValue": g[1] || (g[1] = (v) => i.value.restaurantId = v),
169
- items: L.value,
170
- placeholder: r(o)("hr.grantUser.form.selectRestaurant"),
171
- rules: [(v) => !!v || r(o)("hr.grantUser.form.restaurantRequired")]
172
- }, null, 8, ["modelValue", "items", "placeholder", "rules"])
173
- ]),
174
- _: 1
175
- }, 8, ["label"]),
176
- n(ie, {
177
- label: r(o)("hr.grantUser.form.role")
178
- }, {
179
- default: x(() => [
180
- n(R, {
181
- modelValue: i.value.roleId,
182
- "onUpdate:modelValue": g[2] || (g[2] = (v) => i.value.roleId = v),
183
- items: N.value,
184
- placeholder: r(o)("hr.grantUser.form.selectRole"),
185
- disabled: !i.value.restaurantId,
186
- rules: [(v) => !!v || r(o)("hr.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
- }), ze = {
202
- class: "p-16 bg-fm-color-surface-secondary rounded-8 space-y-8"
203
- }, Te = {
204
- class: "flex items-center"
205
- }, De = {
206
- class: "space-y-8"
207
- }, Me = {
208
- class: "xs:hidden flex w-full items-start justify-between"
209
- }, Ke = {
210
- class: "flex items-start gap-8"
211
- }, Ee = {
212
- class: "space-y-4 hidden xs:block"
213
- }, je = {
214
- class: "px-16"
215
- }, Oe = {
216
- class: "px-16 flex items-start gap-8"
217
- }, qe = {
218
- class: "pb-64 hidden xs:block"
219
- }, He = {
220
- class: "space-y-4"
221
- }, We = {
222
- class: "flex items-center gap-8"
223
- }, Je = {
224
- class: "fm-typo-en-body-lg-600"
225
- }, Qe = {
226
- class: "font-mono text-lg font-bold mr-4"
227
- }, Xe = {
228
- class: "text-fm-color-typo-secondary"
229
- }, Ye = {
230
- class: "text-xs"
231
- }, Ze = {
232
- class: "mt-4 space-y-2"
233
- }, et = {
234
- class: "text-xs"
235
- }, tt = {
236
- class: "text-xs"
237
- }, at = {
238
- key: 0,
239
- class: "flex flex-col gap-4"
240
- }, rt = /* @__PURE__ */ Y({
241
- __name: "GrantUserList",
242
- setup(p, {
243
- expose: y
244
- }) {
245
- const {
246
- t: a
247
- } = ee(), _ = V(), b = ae(), {
248
- restaurants: d
249
- } = Z(), {
250
- roles: m
251
- } = te(), o = S(() => b.grantUsers), {
252
- searchKey: c,
253
- filter: i
254
- } = Fe(""), w = S(() => {
255
- var t;
256
- return (t = o.value) == null ? void 0 : t.filter((e) => {
257
- const f = !_.value || _.value.includes(e.restaurantId), G = !$.value || $.value.includes(e.status), D = B.value[e.restaurantId] || "", W = F.value[e.roleId] || "";
258
- return f && G && i([e.passcode, e.name, D, W, e.grantByName]);
259
- });
260
- }), B = S(() => {
261
- const t = {};
262
- return d.value.forEach((e) => {
263
- t[e._id] = e.profile.name;
264
- }), t;
265
- }), F = S(() => {
266
- const t = {};
267
- return m.value.forEach((e) => {
268
- t[e._id] = e.name;
269
- }), t;
270
- }), L = (t) => {
271
- switch (t) {
272
- case "active":
273
- return "bg-fm-color-system-success-100 text-fm-color-typo-success";
274
- case "used":
275
- return "bg-fm-color-typo-tertiary text-fm-color-typo-primary";
276
- case "revoked":
277
- return "bg-fm-color-system-error-100 text-fm-color-typo-error";
278
- default:
279
- return "bg-fm-color-typo-secondary text-fm-color-typo-primary";
280
- }
281
- }, N = (t) => a(`hr.grantUser.status.${t}`), H = [{
282
- accessorKey: "passcode",
283
- size: 120,
284
- maxSize: 120,
285
- minSize: 120,
286
- header: () => a("hr.grantUser.columns.passcode"),
287
- cell(t) {
288
- const e = t.row.original.passcode;
289
- return h("div", {
290
- class: "flex items-center gap-8"
291
- }, [h(O.FmButton, {
292
- variant: K.Tertiary,
293
- textColor: "neutral-gray-400",
294
- icon: "content_copy",
295
- onClick: (f) => {
296
- f.stopPropagation(), se(e);
297
- }
298
- }), h("span", {
299
- class: "font-mono text-lg font-bold"
300
- }, e)]);
301
- }
302
- }, {
303
- accessorKey: "name",
304
- header: () => a("hr.grantUser.columns.name"),
305
- enableSorting: !1
306
- }, {
307
- accessorKey: "restaurantName",
308
- header: () => a("hr.grantUser.columns.restaurant"),
309
- enableSorting: !1,
310
- meta: {
311
- width: "250px"
312
- },
313
- cell(t) {
314
- const e = t.row.original.restaurantId, f = B.value[e] || a("hr.grantUser.restaurant.unknown");
315
- return h("div", [h("div", f), h("div", {
316
- class: "text-fm-color-typo-secondary text-sm"
317
- }, `${e}`)]);
318
- }
319
- }, {
320
- accessorKey: "roleName",
321
- header: () => a("hr.grantUser.columns.role"),
322
- enableSorting: !1,
323
- cell(t) {
324
- const e = t.row.original.roleId, f = F.value[e] || a("hr.grantUser.role.unknown");
325
- return h("div", f);
326
- }
327
- }, {
328
- accessorKey: "status",
329
- header: () => a("hr.grantUser.columns.status"),
330
- enableSorting: !1,
331
- meta: {
332
- maxWidth: "120px"
333
- },
334
- cell(t) {
335
- const e = t.row.original.status;
336
- return h(O.FmChip, {
337
- label: N(e),
338
- class: L(e)
339
- });
340
- }
341
- }, {
342
- accessorKey: "grantByName",
343
- header: () => a("hr.grantUser.columns.grantedBy"),
344
- enableSorting: !1,
345
- cell(t) {
346
- const e = t.row.original.grantById, f = t.row.original.grantByName;
347
- return h("div", [h("div", f), h("div", {
348
- class: "text-fm-color-typo-secondary text-sm"
349
- }, `${e}`)]);
350
- }
351
- }, {
352
- accessorKey: "createdAt",
353
- header: () => a("hr.grantUser.columns.createdAt"),
354
- enableSorting: !1,
355
- cell(t) {
356
- const e = t.row.original.createdAt;
357
- return h("div", new Date(e).toLocaleString());
358
- }
359
- }, {
360
- id: "action",
361
- size: 180,
362
- meta: {
363
- cellClass: "p-16",
364
- headerContentClass: "-mx-16"
365
- },
366
- cell: (t) => {
367
- const e = t.row.original;
368
- return e.status !== "active" ? null : h("div", {
369
- class: "w-full flex justify-end items-center gap-4"
370
- }, [h(O.FmButton, {
371
- label: a("hr.grantUser.actions.revoke"),
372
- variant: K.Secondary,
373
- onClick: (f) => {
374
- f.stopPropagation(), z(e);
375
- }
376
- })]);
377
- }
378
- }], u = de(), g = Ve(), P = me(u), R = V(), {
379
- breakpoints: A
380
- } = Se(), z = (t) => {
381
- g.open({
382
- title: a("hr.grantUser.revoke.title"),
383
- message: a("hr.grantUser.revoke.message", {
384
- name: t.name
385
- }),
386
- minWidth: A.value.lg ? 588 : 0,
387
- primaryActions: {
388
- text: a("hr.grantUser.actions.revoke"),
389
- close: !1,
390
- variant: "destructive"
391
- },
392
- secondaryActions: {
393
- text: a("common.cancel"),
394
- close: !0
395
- }
396
- }).onPrimary(async () => {
397
- P.minor(async () => {
398
- await b.revokeGrantUser(t._id, t.restaurantId);
399
- }, {
400
- successMessage: a("hr.grantUser.revoke.successMessage", {
401
- name: t.name
402
- })
403
- }), g.close();
404
- });
405
- };
406
- function v() {
407
- var t;
408
- (t = R.value) == null || t.trigger();
409
- }
410
- const re = S(() => [{
411
- label: a("hr.grantUser.status.active"),
412
- value: "active"
413
- }, {
414
- label: a("hr.grantUser.status.used"),
415
- value: "used"
416
- }, {
417
- label: a("hr.grantUser.status.revoked"),
418
- value: "revoked"
419
- }]), $ = V();
420
- async function se(t) {
421
- try {
422
- await navigator.clipboard.writeText(t), u.open({
423
- message: a("hr.grantUser.passcode.copied"),
424
- type: "success"
425
- });
426
- } catch (e) {
427
- u.open({
428
- message: String(e),
429
- type: "error"
430
- });
431
- }
432
- }
433
- const C = V(""), T = V("");
434
- async function pe(t, e) {
435
- const {
436
- default: f
437
- } = await Promise.resolve().then(() => Ge);
438
- P.minor(async () => {
439
- (await f.validatePasscode(t, e)).bypass && b.readGrantUsers();
440
- }, {
441
- successMessage: `Passcode ${t} valid!`
442
- });
443
- }
444
- return y({
445
- create: v,
446
- filteredGrantUsers: w
447
- }), (t, e) => {
448
- const f = U("FmTextField"), G = U("FmButton"), D = U("FmSearch"), W = U("FmTable"), ge = U("FmChip"), ve = U("FmListItem"), fe = U("FmList");
449
- return I(), E(X, null, [n(Ae, {
450
- ref_key: "grantUserFormRef",
451
- ref: R,
452
- class: "gap-8"
453
- }, null, 512), l("div", ze, [e[10] || (e[10] = l("p", {
454
- class: "fm-typo-en-body-md-600"
455
- }, "Test Passcode Validation", -1)), l("div", Te, [n(f, {
456
- modelValue: C.value,
457
- "onUpdate:modelValue": e[0] || (e[0] = (s) => C.value = s),
458
- type: "number",
459
- "max-length": 4,
460
- class: "!w-[100px]",
461
- placeholder: "0000",
462
- onInput: e[1] || (e[1] = (s) => C.value = C.value.replace(/[^0-9]/g, ""))
463
- }, null, 8, ["modelValue"]), n(r(J), {
464
- modelValue: T.value,
465
- "onUpdate:modelValue": e[2] || (e[2] = (s) => T.value = s),
466
- "managable-only": !1,
467
- variant: "dark",
468
- class: "!w-[200px] ml-2"
469
- }, null, 8, ["modelValue"]), n(G, {
470
- label: "Validate",
471
- variant: r(K).Primary,
472
- disabled: !C.value || C.value.length !== 4 || !T.value,
473
- onClick: e[3] || (e[3] = (s) => pe(C.value, T.value))
474
- }, null, 8, ["variant", "disabled"])])]), l("div", De, [l("div", Me, [l("div", Ke, [n(r(J), {
475
- modelValue: _.value,
476
- "onUpdate:modelValue": e[4] || (e[4] = (s) => _.value = s),
477
- "managable-only": !1,
478
- multiple: "",
479
- variant: "dark",
480
- class: "!w-auto"
481
- }, null, 8, ["modelValue"]), n(ce, {
482
- modelValue: $.value,
483
- "onUpdate:modelValue": e[5] || (e[5] = (s) => $.value = s),
484
- multiple: "",
485
- variant: "dark",
486
- items: re.value,
487
- "selected-prefix": r(a)("hr.grantUser.filter.selected_status_prefix"),
488
- placeholder: r(a)("hr.grantUser.filter.status_placeholder")
489
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]), n(D, {
490
- modelValue: r(c),
491
- "onUpdate:modelValue": e[6] || (e[6] = (s) => ne(c) ? c.value = s : null),
492
- autofocus: "",
493
- class: "pl-4 w-[320px]",
494
- placeholder: r(a)("hr.grantUser.search.placeholder")
495
- }, null, 8, ["modelValue", "placeholder"])]), l("div", Ee, [l("div", je, [n(D, {
496
- modelValue: r(c),
497
- "onUpdate:modelValue": e[7] || (e[7] = (s) => ne(c) ? c.value = s : null),
498
- autofocus: "",
499
- placeholder: r(a)("hr.grantUser.search.placeholder")
500
- }, null, 8, ["modelValue", "placeholder"])]), n(Ce), l("div", Oe, [n(r(J), {
501
- modelValue: _.value,
502
- "onUpdate:modelValue": e[8] || (e[8] = (s) => _.value = s),
503
- "managable-only": !1,
504
- multiple: "",
505
- variant: "dark",
506
- class: "!w-auto"
507
- }, null, 8, ["modelValue"]), n(ce, {
508
- modelValue: $.value,
509
- "onUpdate:modelValue": e[9] || (e[9] = (s) => $.value = s),
510
- multiple: "",
511
- items: re.value,
512
- variant: "dark",
513
- "selected-prefix": r(a)("hr.grantUser.filter.selected_status_prefix"),
514
- placeholder: r(a)("hr.grantUser.filter.status_placeholder")
515
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]), o.value.length > 0 || r(b).isLoading ? (I(), j(Ie, {
516
- key: 0,
517
- class: "overflow-auto"
518
- }, {
519
- default: x(() => [n(W, {
520
- class: "xs:hidden",
521
- "column-defs": H,
522
- "row-data": w.value,
523
- "page-size": w.value.length,
524
- loading: r(b).isLoading,
525
- virtual: w.value.length > 0,
526
- "pin-header-row": "",
527
- "hide-footer": ""
528
- }, null, 8, ["row-data", "page-size", "loading", "virtual"]), l("div", qe, [n(fe, {
529
- separator: ""
530
- }, {
531
- default: x(() => [(I(!0), E(X, null, _e(w.value, (s) => (I(), j(ve, {
532
- key: s._id,
533
- class: "py-12 px-16 items-center justify-between"
534
- }, {
535
- default: x(() => [l("div", He, [l("div", We, [n(G, {
536
- variant: "tertiary",
537
- "text-color": "neutral-gray-400",
538
- icon: "content_copy",
539
- onClick: oe((he) => se(s.passcode), ["stop"])
540
- }, null, 8, ["onClick"]), l("p", Je, [l("span", Qe, k(s.passcode), 1), le(" - " + k(s.name), 1)])]), l("div", Xe, [l("div", null, [le(k(B.value[s.restaurantId] || r(a)("hr.grantUser.restaurant.unknown")) + " ", 1), l("div", Ye, k(s.restaurantId), 1), l("div", null, k(F.value[s.roleId] || r(a)("hr.grantUser.role.unknown")), 1)]), l("div", Ze, [l("div", et, k(r(a)("hr.grantUser.columns.grantedBy")) + ": " + k(s.grantByName), 1), l("div", tt, k(r(a)("hr.grantUser.columns.createdAt")) + ": " + k(new Date(s.createdAt).toLocaleString()), 1), n(ge, {
541
- label: N(s.status),
542
- class: Ue(L(s.status))
543
- }, null, 8, ["label", "class"])])])]), s.status === "active" ? (I(), E("div", at, [n(G, {
544
- label: r(a)("hr.grantUser.actions.revoke"),
545
- variant: r(K).Secondary,
546
- onClick: oe((he) => z(s), ["stop"])
547
- }, null, 8, ["label", "variant", "onClick"])])) : be("", !0)]),
548
- _: 2
549
- }, 1024))), 128))]),
550
- _: 1
551
- })])]),
552
- _: 1
553
- })) : (I(), j(r(Be), {
554
- key: 1,
555
- title: r(a)("hr.grantUser.noData.title"),
556
- subtitle: r(a)("hr.grantUser.noData.subtitle")
557
- }, null, 8, ["title", "subtitle"]))])], 64);
558
- };
559
- }
560
- }), vt = /* @__PURE__ */ Y({
561
- __name: "Main",
562
- setup(p) {
563
- const { readGrantUsers: y } = ae(), { readRestaurants: a, currentBusiness: _ } = Z(), { readRoles: b } = te(), { t: d } = ee(), m = V();
564
- return ue(
565
- _,
566
- async () => {
567
- var o;
568
- (o = _.value) != null && o._id && await Promise.all([a(), b(), y()]);
569
- },
570
- { immediate: !0 }
571
- ), (o, c) => {
572
- const i = U("FmSpacer"), w = U("FmButton");
573
- return I(), j(xe, {
574
- heading: r(d)("hr.grantUser.title")
575
- }, {
576
- "append-heading": x(() => [
577
- n(i),
578
- n(w, {
579
- "prepend-icon": "add",
580
- label: r(d)("hr.grantUser.actions.create"),
581
- onClick: c[0] || (c[0] = (B) => {
582
- var F;
583
- return (F = m.value) == null ? void 0 : F.create();
584
- })
585
- }, null, 8, ["label"])
586
- ]),
587
- default: x(() => [
588
- n(rt, {
589
- ref_key: "grantUserListRef",
590
- ref: m
591
- }, null, 512)
592
- ]),
593
- _: 1
594
- }, 8, ["heading"]);
595
- };
596
- }
597
- });
598
- export {
599
- vt as default
600
- };