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