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