@feedmepos/mf-hrm-portal 2.0.20-dev.1 → 2.0.20-dev.3

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