@feedmepos/mf-hrm-portal 2.0.14 → 2.0.15-dev.2

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 (36) hide show
  1. package/dist/{AuditLogList-n6b4-GzJ.js → AuditLogList-_iGkRjav.js} +4 -4
  2. package/dist/EmployeeList-BsauFDHA.js +736 -0
  3. package/dist/{Main-79eUPL7p.js → Main-CWSLq8gH.js} +4 -4
  4. package/dist/{Main-Cw4gYTr3.js → Main-D0eoxqEG.js} +5 -5
  5. package/dist/{Main-Dn71WvVQ.js → Main-DWBJw_Ta.js} +1298 -1294
  6. package/dist/{PermissionSetList-BNNwLjXj.js → PermissionSetList-CzFf90Bv.js} +20 -20
  7. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BYyT6oya.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CBcnIfck.js} +1039 -1039
  8. package/dist/RoleList-CsdcFHQK.js +528 -0
  9. package/dist/{TeamMemberList-DSHrsX5J.js → TeamMemberList-CI24SCZz.js} +303 -300
  10. package/dist/{TimesheetList-CXPqOjdC.js → TimesheetList-eD8-rA_L.js} +7 -7
  11. package/dist/{app-DPZbZJCq.js → app-DnT6yzx7.js} +4 -4
  12. package/dist/app.js +1 -1
  13. package/dist/{dayjs.min-DW1WmkoA.js → dayjs.min-L-465Ow8.js} +1 -1
  14. package/dist/{employee-Kw8TDet-.js → employee-DGjXlPn1.js} +71 -74
  15. package/dist/{index-CQ9ZArJF.js → index-DOpSY75_.js} +1 -1
  16. package/dist/{iteration-BFQu0b3r.js → iteration-CAxWl04o.js} +2 -2
  17. package/dist/{lodash-Dsav6UyM.js → lodash-VfbpRiGW.js} +1 -1
  18. package/dist/rule-D6eh6FDn.js +991 -0
  19. package/dist/src/helpers/rule.d.ts +1 -1
  20. package/dist/src/stores/employee.d.ts +124 -19
  21. package/dist/src/types/employee.d.ts +3 -0
  22. package/dist/src/views/hr/employee/EmployeeList.vue.d.ts +4 -0
  23. package/dist/style.css +1 -1
  24. package/dist/{timesheet-ZmSkwQIE.js → timesheet-B11NLk-Z.js} +9 -9
  25. package/dist/tsconfig.app.tsbuildinfo +1 -1
  26. package/dist/useAppStore-BaDI6IZu.js +171 -0
  27. package/dist/useDiscardConfirm-BHni0LNu.js +28 -0
  28. package/dist/{useLoading-C0ICgchk.js → useLoading-B2CoUwmJ.js} +1 -1
  29. package/dist/{useReportPermissions-lRru0ii7.js → useReportPermissions-BfjLdcAd.js} +3 -3
  30. package/dist/utils-BZkjJbju.js +17 -0
  31. package/package.json +1 -1
  32. package/dist/EmployeeList-B7cemoN0.js +0 -702
  33. package/dist/RoleList-DY8Za0dd.js +0 -519
  34. package/dist/index-nwRgIeL9.js +0 -998
  35. package/dist/useAppStore-CKbtSJIP.js +0 -168
  36. package/dist/useRestaurantMap-e9fQJiLC.js +0 -39
@@ -0,0 +1,528 @@
1
+ import { computed as h, defineComponent as ge, ref as $, watch as ne, onMounted as be, resolveComponent as b, createBlock as E, openBlock as c, unref as o, withCtx as F, createElementVNode as _, createVNode as p, createElementBlock as k, Fragment as M, createCommentVNode as ce, renderList as se, toDisplayString as A, h as w, createTextVNode as pe, resolveDynamicComponent as ve, withModifiers as Le, nextTick as fe } from "vue";
2
+ import { e as U } from "./iteration-CAxWl04o.js";
3
+ import { useCoreStore as me, useI18n as ye } from "@feedmepos/mf-common";
4
+ import { useSnackbar as Fe, components as te, useDialog as Ue, useBreakpoints as Ee, FmButtonColorThemeVariant as he, FmButtonVariant as Ie } from "@feedmepos/ui-library";
5
+ import { _ as Se } from "./app-DnT6yzx7.js";
6
+ import { _ as Pe } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
7
+ import { e as $e, r as W, h as ue, f as Te, g as _e, a as ee } from "./rule-D6eh6FDn.js";
8
+ import { u as xe } from "./useAppStore-BaDI6IZu.js";
9
+ import { u as Ce } from "./useReportPermissions-BfjLdcAd.js";
10
+ import { l as ae } from "./lodash-VfbpRiGW.js";
11
+ import { _ as ie, a as Be } from "./FormSection.vue_vue_type_script_setup_true_lang-BVb8c4YU.js";
12
+ import { u as De } from "./useDiscardConfirm-BHni0LNu.js";
13
+ import { u as Me } from "./useLoading-B2CoUwmJ.js";
14
+ function Ae() {
15
+ const j = me();
16
+ return h(() => {
17
+ const s = {};
18
+ return j.restaurants.value.forEach((R) => {
19
+ s[R._id] = R;
20
+ }), s;
21
+ });
22
+ }
23
+ const Ne = { class: "fm-typo-en-title-md-600" }, Oe = { class: "space-y-40" }, Je = {
24
+ key: 0,
25
+ class: "flex justify-center py-16"
26
+ }, qe = { class: "space-y-8" }, ze = { class: "space-y-8" }, Ke = {
27
+ key: 0,
28
+ class: "w-50 ml-5 flex flex-row items-start"
29
+ }, We = { class: "m-2" }, je = { class: "flex gap-8 items-center justify-start" }, Ge = /* @__PURE__ */ ge({
30
+ __name: "RoleForm",
31
+ props: {
32
+ id: {
33
+ type: String,
34
+ default: void 0
35
+ }
36
+ },
37
+ setup(j, { expose: G }) {
38
+ const { t: s } = ye(), R = me(), T = $(""), I = h(() => R.restaurants.value.filter(({ profile: e }) => {
39
+ const a = `${e.code ? e.code + "-" : ""}${e.legalName}`;
40
+ return !T.value || a.toLowerCase().includes(T.value.toLowerCase());
41
+ })), N = $(R.restaurants.value.length === 0);
42
+ ne(
43
+ () => R.restaurants.value.length,
44
+ (e) => {
45
+ e > 0 && (N.value = !1);
46
+ }
47
+ );
48
+ const B = xe(), H = Fe(), le = Me(H), { fetchReportPermissions: Q, allReportPermissions: L, availableReportKeys: O } = Ce(), J = j, g = $(!1), X = () => {
49
+ g.value = !g.value, g.value && l();
50
+ }, Y = h(() => J.id ? s("hr.role.form.update") : s("hr.role.form.add")), oe = h(() => J.id ? s("common.update") : s("common.add")), q = h(() => {
51
+ const e = $e.filter(
52
+ (i) => i.subject !== U.F_RULE_SUBJECT.enum.report
53
+ ).map((i) => W(i)), a = L.value.map((i) => W(i));
54
+ return [...e, ...a];
55
+ }), d = h(() => B.roles.value.find((e) => e._id == J.id)), V = () => ({
56
+ name: "",
57
+ restaurantIds: [],
58
+ permissions: [],
59
+ maxDiscountPercentage: 100
60
+ }), t = $(V()), re = h(() => [
61
+ {
62
+ title: s("hr.role.labels.operation"),
63
+ filter: (e) => e.isOrderOperation
64
+ },
65
+ {
66
+ title: s("hr.role.labels.report"),
67
+ filter: (e) => e.isReportPermission
68
+ },
69
+ {
70
+ title: s("hr.role.labels.other"),
71
+ filter: (e) => !e.isOrderOperation && !e.isReportPermission
72
+ }
73
+ ].map((e) => ({
74
+ title: e.title,
75
+ options: q.value.filter(e.filter).map(({ label: a, value: i }) => ({
76
+ label: a,
77
+ value: i
78
+ }))
79
+ }))), x = h(() => {
80
+ var e;
81
+ return ue(((e = d.value) == null ? void 0 : e.permissions) || []);
82
+ });
83
+ function l() {
84
+ var e;
85
+ t.value = V(), t.value.name = ((e = d.value) == null ? void 0 : e.name) ?? "", x.value ? (t.value.restaurantIds = I.value.map((a) => a._id), t.value.permissions = q.value.map((a) => a.value)) : d.value && (t.value.restaurantIds = d.value.restaurants.map((a) => a.id), t.value.permissions = d.value.permissions.map((a) => W(a).value).filter((a) => a.startsWith("report:") ? O.value.has(a.split(":")[1]) : !0), t.value.maxDiscountPercentage = _e(
86
+ d.value.permissions
87
+ ));
88
+ }
89
+ be(async () => {
90
+ await Q(), l();
91
+ }), ne(O, () => {
92
+ g.value && d.value && !x.value && (t.value.permissions = t.value.permissions.filter((e) => e.startsWith("report:") ? O.value.has(e.split(":")[1]) : !0));
93
+ });
94
+ const r = $(""), v = h(() => ({
95
+ restaurantIds: t.value.restaurantIds,
96
+ role: {
97
+ name: t.value.name,
98
+ permissions: Te(t.value.permissions, t.value.maxDiscountPercentage)
99
+ }
100
+ })), u = async () => {
101
+ const e = v.value;
102
+ await le.minor(
103
+ async () => {
104
+ d.value ? await B.updateRole(d.value._id, e) : await B.createRole(e);
105
+ },
106
+ {
107
+ successMessage: d.value ? s("hr.role.update.successMessage", { name: e.role.name }) : s("hr.role.add.successMessage", { name: e.role.name })
108
+ }
109
+ ), g.value = !1;
110
+ }, f = h(
111
+ () => t.value.restaurantIds.filter((e) => I.value.some((a) => a._id === e))
112
+ ), y = h(() => I.value.length > 0 && I.value.length === f.value.length), z = () => {
113
+ const e = t.value.restaurantIds.filter((a) => !f.value.includes(a));
114
+ y.value === !0 ? t.value.restaurantIds = e : t.value.restaurantIds = I.value.map((a) => a._id);
115
+ }, m = (e) => e.map((i) => i.value).every((i) => t.value.permissions.includes(i)), S = (e) => {
116
+ const a = t.value.permissions.filter(
117
+ (i) => !e.map((D) => D.value).includes(i)
118
+ );
119
+ m(e) === !0 ? t.value.permissions = a : t.value.permissions = [...a, ...e.map((i) => i.value)];
120
+ };
121
+ ne(
122
+ () => t.value.restaurantIds,
123
+ (e) => {
124
+ e.length > 0 && (r.value = "");
125
+ }
126
+ );
127
+ const Re = De(
128
+ () => {
129
+ var e, a, i, D;
130
+ return !ae.isEqual(t.value.name, ((e = d.value) == null ? void 0 : e.name) || V().name) || !ae.isEqual(
131
+ t.value.restaurantIds,
132
+ ((a = d.value) == null ? void 0 : a.restaurants.map((K) => K.id)) || V().restaurantIds
133
+ ) || !ae.isEqual(
134
+ t.value.permissions,
135
+ ((i = d.value) == null ? void 0 : i.permissions.map((K) => W(K).value)) || V().permissions
136
+ ) || !ae.isEqual(
137
+ t.value.maxDiscountPercentage,
138
+ d.value ? _e((D = d.value) == null ? void 0 : D.permissions) : V().maxDiscountPercentage
139
+ );
140
+ },
141
+ () => {
142
+ g.value = !1;
143
+ }
144
+ );
145
+ return G({
146
+ show: g,
147
+ trigger: X
148
+ }), (e, a) => {
149
+ const i = b("FmTextField"), D = b("FmCircularProgress"), K = b("FmSearch"), Z = b("FmCheckbox"), Ve = b("FmFormGroup"), we = b("FmCard"), de = b("fm-button"), ke = b("fm-side-sheet");
150
+ return c(), E(ke, {
151
+ id: "unit-form",
152
+ modelValue: g.value,
153
+ "onUpdate:modelValue": a[7] || (a[7] = (n) => g.value = n),
154
+ "is-container": o(te).FmForm,
155
+ "is-container-props": {
156
+ onValidationSuccess: u,
157
+ blameFormChildOnValidationFailed: !0
158
+ },
159
+ "max-width": 560,
160
+ "onOn:clickedAway": o(Re)
161
+ }, {
162
+ "side-sheet-header": F(() => [
163
+ _("p", Ne, A(Y.value), 1)
164
+ ]),
165
+ "side-sheet-footer": F(() => [
166
+ _("div", je, [
167
+ p(de, {
168
+ label: oe.value,
169
+ size: "lg",
170
+ type: "submit",
171
+ variant: "primary",
172
+ disabled: x.value
173
+ }, null, 8, ["label", "disabled"]),
174
+ p(de, {
175
+ label: o(s)("common.cancel"),
176
+ size: "lg",
177
+ variant: "tertiary",
178
+ onClick: a[6] || (a[6] = () => g.value = !1)
179
+ }, null, 8, ["label"])
180
+ ])
181
+ ]),
182
+ default: F(() => [
183
+ _("div", Oe, [
184
+ p(ie, { title: "Role detail" }, {
185
+ default: F(() => [
186
+ p(i, {
187
+ modelValue: t.value.name,
188
+ "onUpdate:modelValue": a[0] || (a[0] = (n) => t.value.name = n),
189
+ autofocus: "",
190
+ rules: [(n) => !!n || o(s)("hr.role.form.required")],
191
+ label: o(s)("hr.role.form.name"),
192
+ disabled: x.value
193
+ }, null, 8, ["modelValue", "rules", "label", "disabled"])
194
+ ]),
195
+ _: 1
196
+ }),
197
+ p(ie, {
198
+ title: o(s)("hr.role.form.restaurant")
199
+ }, {
200
+ default: F(() => [
201
+ N.value ? (c(), k("div", Je, [
202
+ p(D)
203
+ ])) : (c(), k(M, { key: 1 }, [
204
+ p(K, {
205
+ modelValue: T.value,
206
+ "onUpdate:modelValue": a[1] || (a[1] = (n) => T.value = n),
207
+ placeholder: o(s)("hr.restaurant.search.placeholder")
208
+ }, null, 8, ["modelValue", "placeholder"]),
209
+ p(Ve, {
210
+ modelValue: t.value.restaurantIds,
211
+ "onUpdate:modelValue": a[3] || (a[3] = (n) => t.value.restaurantIds = n),
212
+ rules: [(n) => n.length > 0 || o(s)("hr.role.form.atLeastOneRestaurant")]
213
+ }, {
214
+ default: F(() => [
215
+ _("div", qe, [
216
+ T.value ? ce("", !0) : (c(), E(Z, {
217
+ key: 0,
218
+ "model-value": y.value,
219
+ label: "All",
220
+ value: "1",
221
+ disabled: x.value,
222
+ "onUpdate:modelValue": z
223
+ }, null, 8, ["model-value", "disabled"])),
224
+ (c(!0), k(M, null, se(I.value, (n) => (c(), k("div", {
225
+ key: n._id
226
+ }, [
227
+ p(Z, {
228
+ modelValue: t.value.restaurantIds,
229
+ "onUpdate:modelValue": a[2] || (a[2] = (P) => t.value.restaurantIds = P),
230
+ label: `${n.profile.code ? n.profile.code + "-" : ""}${n.profile.name}`,
231
+ value: n._id,
232
+ disabled: x.value
233
+ }, null, 8, ["modelValue", "label", "value", "disabled"])
234
+ ]))), 128))
235
+ ])
236
+ ]),
237
+ _: 1
238
+ }, 8, ["modelValue", "rules"])
239
+ ], 64))
240
+ ]),
241
+ _: 1
242
+ }, 8, ["title"]),
243
+ p(ie, {
244
+ title: o(s)("hr.role.form.permissions")
245
+ }, {
246
+ default: F(() => [
247
+ (c(!0), k(M, null, se(re.value, (n) => (c(), E(we, {
248
+ key: n.title,
249
+ variant: "outlined",
250
+ class: "p-16"
251
+ }, {
252
+ default: F(() => [
253
+ p(Be, {
254
+ label: n.title
255
+ }, {
256
+ default: F(() => [
257
+ _("div", ze, [
258
+ p(Z, {
259
+ "model-value": m(n.options),
260
+ label: "All",
261
+ value: "1",
262
+ disabled: x.value,
263
+ "onUpdate:modelValue": (P) => S(n.options)
264
+ }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]),
265
+ (c(!0), k(M, null, se(n.options, (P) => (c(), k("div", {
266
+ key: P.value
267
+ }, [
268
+ p(Z, {
269
+ modelValue: t.value.permissions,
270
+ "onUpdate:modelValue": a[4] || (a[4] = (C) => t.value.permissions = C),
271
+ label: P.label,
272
+ value: P.value,
273
+ disabled: x.value
274
+ }, null, 8, ["modelValue", "label", "value", "disabled"]),
275
+ P.value === "order:discount" && t.value.permissions.includes(P.value) ? (c(), k("div", Ke, [
276
+ _("div", We, A(o(s)("hr.role.form.maxDiscountPercentage")), 1),
277
+ p(i, {
278
+ modelValue: t.value.maxDiscountPercentage,
279
+ "onUpdate:modelValue": a[5] || (a[5] = (C) => t.value.maxDiscountPercentage = C),
280
+ rules: [
281
+ (C) => !!C || o(s)("hr.role.form.required"),
282
+ (C) => !isNaN(C) || o(s)("hr.role.form.onlyContainsNumber"),
283
+ (C) => C <= 100 || o(s)("hr.role.form.maxValueIs", { max: 100 }),
284
+ (C) => C >= 0 || o(s)("hr.role.form.minValueIs", { min: 0 })
285
+ ],
286
+ "append-text": "%",
287
+ disabled: x.value
288
+ }, null, 8, ["modelValue", "rules", "disabled"])
289
+ ])) : ce("", !0)
290
+ ]))), 128))
291
+ ])
292
+ ]),
293
+ _: 2
294
+ }, 1032, ["label"])
295
+ ]),
296
+ _: 2
297
+ }, 1024))), 128))
298
+ ]),
299
+ _: 1
300
+ }, 8, ["title"])
301
+ ])
302
+ ]),
303
+ _: 1
304
+ }, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"]);
305
+ };
306
+ }
307
+ }), He = {
308
+ class: "space-y-8"
309
+ }, Qe = {
310
+ class: "flex justify-end xs:px-16"
311
+ }, Xe = {
312
+ class: "pb-64 sm:hidden md:hidden lg:hidden"
313
+ }, Ye = {
314
+ class: "space-y-4"
315
+ }, Ze = {
316
+ class: "fm-typo-en-body-lg-600"
317
+ }, ea = {
318
+ class: "text-fm-color-typo-secondary"
319
+ }, aa = {
320
+ class: "flex"
321
+ }, sa = {
322
+ class: "flex"
323
+ }, ha = /* @__PURE__ */ ge({
324
+ __name: "RoleList",
325
+ setup(j, {
326
+ expose: G
327
+ }) {
328
+ const {
329
+ t: s
330
+ } = ye(), {
331
+ allReportPermissions: R
332
+ } = Ce(), T = me(), I = h(() => T.restaurants.value), N = h(() => I.value.map((l) => l._id));
333
+ function B(l, r) {
334
+ const v = r === U.F_RULE_SUBJECT.enum.report ? R.value : void 0, u = ee(l, r, v);
335
+ return ["-", "All"].includes(u) ? () => null : () => w(te.FmTooltip, {
336
+ "z-index": "999",
337
+ placement: "top",
338
+ class: "ml-2"
339
+ }, {
340
+ content: () => w("div", [s("hr.role.tooltip.labels.permission"), ...l.filter((f) => f.subject === r).map((f) => w("div", ["- ", W(f).label]))]),
341
+ default: () => w(te.FmIcon, {
342
+ name: "info",
343
+ color: he.NeutralGray400
344
+ })
345
+ });
346
+ }
347
+ function H(l, r) {
348
+ const v = r === U.F_RULE_SUBJECT.enum.report ? R.value : void 0, u = ee(l, r, v);
349
+ return () => u === "All" ? u : w("div", {
350
+ class: "flex items-center"
351
+ }, [u, B(l, r)()]);
352
+ }
353
+ const le = [{
354
+ accessorKey: "name",
355
+ header: () => s("hr.role.columns.name"),
356
+ enableSorting: !1
357
+ }, {
358
+ accessorKey: "operation",
359
+ header: () => s("hr.role.columns.operation"),
360
+ cell: (l) => w(H(l.row.original.permissions, U.F_RULE_SUBJECT.enum.order)),
361
+ enableSorting: !1
362
+ }, {
363
+ accessorKey: "report",
364
+ header: () => s("hr.role.columns.report"),
365
+ cell: (l) => w(H(l.row.original.permissions, U.F_RULE_SUBJECT.enum.report)),
366
+ enableSorting: !1
367
+ }, {
368
+ accessorKey: "restaurants",
369
+ header: () => s("hr.role.columns.restaurants"),
370
+ cell: (l) => l.row.original.restaurants.map((r, v) => {
371
+ const u = r.code, f = `${u ? u + " - " : ""}${r.name}`;
372
+ return w("div", (v ? `
373
+ ` : "") + f);
374
+ }),
375
+ enableSorting: !1
376
+ }, {
377
+ id: "action",
378
+ size: 52,
379
+ meta: {
380
+ cellClass: "pl-16",
381
+ headerContentClass: "-mx-16"
382
+ },
383
+ cell: (l) => w("div", {
384
+ class: "w-full flex justify-end items-center"
385
+ }, [w(te.FmButton, {
386
+ prependIcon: "delete",
387
+ variant: Ie.Tertiary,
388
+ textColor: he.NeutralGray400,
389
+ disabled: ue(l.row.original.permissions),
390
+ onClick: (r) => {
391
+ r.stopPropagation(), q(l.row.original);
392
+ }
393
+ })])
394
+ }], Q = async (l) => {
395
+ var r;
396
+ t.value = l._id, await fe(), (r = V.value) == null || r.trigger();
397
+ }, L = xe(), O = Ae(), J = h(() => {
398
+ const l = L.roles.value || [];
399
+ return (N.value.length === 0 ? l : l.filter((v) => v.restaurants.some((u) => N.value.includes(u.id)))).map((v) => {
400
+ const u = v.restaurants.map((f) => {
401
+ const y = O.value[f.id];
402
+ return {
403
+ ...f,
404
+ // Prefer live data from restaurantMap so names populate reactively
405
+ // even when restaurants loaded after roles.
406
+ name: (y == null ? void 0 : y.profile.name) || f.name,
407
+ code: y == null ? void 0 : y.profile.code
408
+ };
409
+ });
410
+ return {
411
+ ...v,
412
+ restaurants: u
413
+ };
414
+ });
415
+ }), g = h(() => {
416
+ var r;
417
+ return (r = J.value) == null ? void 0 : r.filter((v) => {
418
+ const u = d.value.toLowerCase(), f = v.name.toLowerCase().includes(u), z = (v.restaurants || []).some((m) => {
419
+ var S;
420
+ return m.name.toLowerCase().includes(u) || ((S = m.code) == null ? void 0 : S.toLowerCase().includes(u));
421
+ });
422
+ return f || z;
423
+ });
424
+ }), X = Ue(), Y = Fe(), {
425
+ breakpoints: oe
426
+ } = Ee(), q = (l) => {
427
+ X.open({
428
+ title: s("hr.role.remove.title"),
429
+ message: s("hr.role.remove.message", {
430
+ name: l.name
431
+ }),
432
+ minWidth: oe.value.lg ? 588 : 0,
433
+ primaryActions: {
434
+ text: s("common.remove"),
435
+ close: !1,
436
+ variant: "destructive"
437
+ },
438
+ secondaryActions: {
439
+ text: s("common.cancel"),
440
+ close: !0
441
+ }
442
+ }).onPrimary(async () => {
443
+ await L.deleteRole(l).then(() => Y.open({
444
+ message: s("hr.role.remove.successMessage", {
445
+ name: l.name
446
+ }),
447
+ type: "success"
448
+ })).catch((r) => Y.open({
449
+ message: r,
450
+ type: "error"
451
+ })), X.close();
452
+ });
453
+ }, d = $(""), V = $(), t = $(void 0);
454
+ async function re() {
455
+ var l;
456
+ t.value = void 0, await fe(), (l = V.value) == null || l.trigger();
457
+ }
458
+ async function x() {
459
+ L.roles.value.length === 0 && await L.readRoles();
460
+ }
461
+ return be(() => {
462
+ x();
463
+ }), G({
464
+ create: re
465
+ }), (l, r) => {
466
+ const v = b("FmSearch"), u = b("FmTable"), f = b("FmButton"), y = b("FmListItem"), z = b("FmList");
467
+ return c(), k(M, null, [(c(), E(Ge, {
468
+ id: t.value,
469
+ key: t.value,
470
+ ref_key: "roleFormRef",
471
+ ref: V
472
+ }, null, 8, ["id"])), _("div", He, [_("div", Qe, [p(v, {
473
+ modelValue: d.value,
474
+ "onUpdate:modelValue": r[0] || (r[0] = (m) => d.value = m),
475
+ class: "w-[320px] xs:w-full",
476
+ autofocus: "",
477
+ placeholder: o(s)("hr.role.search.placeholder") + " / " + o(s)("hr.restaurant.search.placeholder")
478
+ }, null, 8, ["modelValue", "placeholder"])]), o(L).roles.value.length > 0 || o(L).isLoading.value ? (c(), E(Se, {
479
+ key: 0,
480
+ class: "overflow-auto"
481
+ }, {
482
+ default: F(() => [p(u, {
483
+ class: "xs:hidden",
484
+ "column-defs": le,
485
+ "row-data": g.value,
486
+ "page-size": g.value.length,
487
+ loading: o(L).isLoading.value,
488
+ "pin-header-row": "",
489
+ "hide-footer": "",
490
+ "shrink-at": !1,
491
+ onRowClick: r[1] || (r[1] = (m) => Q(m.original))
492
+ }, null, 8, ["row-data", "page-size", "loading"]), _("div", Xe, [p(z, {
493
+ separator: ""
494
+ }, {
495
+ default: F(() => [(c(!0), k(M, null, se(g.value, (m) => (c(), E(y, {
496
+ key: m._id,
497
+ class: "py-12 px-16 items-center justify-between",
498
+ onClick: (S) => Q(m)
499
+ }, {
500
+ default: F(() => [_("div", Ye, [_("p", Ze, A(m.name), 1), _("div", ea, [_("p", null, A(o(s)("hr.role.labels.restaurantList", {
501
+ items: m.restaurants.map((S) => S.name).join(", ")
502
+ })), 1), _("p", aa, [pe(A(o(s)("hr.role.labels.operationList", {
503
+ items: o(ee)(m.permissions, o(U.F_RULE_SUBJECT).enum.order)
504
+ })) + " ", 1), (c(), E(ve(B(m.permissions, o(U.F_RULE_SUBJECT).enum.order))))]), _("p", sa, [pe(A(o(s)("hr.role.labels.reportList", {
505
+ items: o(ee)(m.permissions, o(U.F_RULE_SUBJECT).enum.report, o(R))
506
+ })) + " ", 1), (c(), E(ve(B(m.permissions, o(U.F_RULE_SUBJECT).enum.report))))])])]), p(f, {
507
+ disabled: o(ue)(m.permissions),
508
+ icon: "delete",
509
+ variant: "tertiary",
510
+ "text-color": "neutral-gray-400",
511
+ onClick: Le((S) => q(m), ["stop"])
512
+ }, null, 8, ["disabled", "onClick"])]),
513
+ _: 2
514
+ }, 1032, ["onClick"]))), 128))]),
515
+ _: 1
516
+ })])]),
517
+ _: 1
518
+ })) : (c(), E(o(Pe), {
519
+ key: 1,
520
+ title: o(s)("hr.role.noData.title"),
521
+ subtitle: o(s)("hr.role.noData.subtitle")
522
+ }, null, 8, ["title", "subtitle"]))])], 64);
523
+ };
524
+ }
525
+ });
526
+ export {
527
+ ha as default
528
+ };