@feedmepos/mf-hrm-portal 2.0.17-dev.4 → 2.0.17-dev.5

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