@feedmepos/mf-hrm-portal 2.0.11-dev → 2.0.11-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 (44) hide show
  1. package/dist/AuditLogList-E_BtUYs7.js +915 -0
  2. package/dist/EmployeeList-D758_PXx.js +621 -0
  3. package/dist/{Main-6td6JhCb.js → Main-Bqx0FFmH.js} +1054 -1055
  4. package/dist/{Main-BhNhmkn8.js → Main-DjCFRKkP.js} +4 -4
  5. package/dist/{Main-Bu-UNnSQ.js → Main-eVW0teSe.js} +6 -6
  6. package/dist/{PermissionSetList-IG15Aj5D.js → PermissionSetList-DL5AL3mB.js} +128 -124
  7. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CDA9oDkd.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CMcQnqyK.js} +693 -693
  8. package/dist/RoleList-DuXjqXwQ.js +499 -0
  9. package/dist/TeamMemberList-BHpOC5vA.js +989 -0
  10. package/dist/{TimesheetList-D_JT5iyS.js → TimesheetList-Bz9ZMpHA.js} +74 -74
  11. package/dist/{app-h2mRYtCE.js → app-BhCUAF8K.js} +705 -712
  12. package/dist/app.js +1 -1
  13. package/dist/{dayjs.min-QbzmY4D1.js → dayjs.min-Cxe5QOx7.js} +1 -1
  14. package/dist/employee--8czm9KP.js +145 -0
  15. package/dist/{index-CBgvOHm7.js → index-CyJwEUuG.js} +1 -1
  16. package/dist/{index-BLm_-G4e.js → index-GgFsP7rK.js} +85 -108
  17. package/dist/{iteration-J_5O7DIo.js → iteration-BljyZld9.js} +1 -1
  18. package/dist/{lodash-btS1GWf0.js → lodash-D2-GJ54o.js} +1 -1
  19. package/dist/src/api/employee/index.d.ts +3 -4
  20. package/dist/src/api/team/index.d.ts +1 -3
  21. package/dist/src/stores/employee.d.ts +6 -515
  22. package/dist/src/stores/team.d.ts +0 -6
  23. package/dist/src/types/employee.d.ts +1 -35
  24. package/dist/src/types/team.d.ts +2 -18
  25. package/dist/src/views/hr/employee/EmployeeForm.vue.d.ts +2 -6
  26. package/dist/src/views/hr/employee/EmployeeList.vue.d.ts +0 -3
  27. package/dist/src/views/team/member/AddMemberForm.vue.d.ts +0 -9
  28. package/dist/src/views/team/member/TeamMemberMasterUser.vue.d.ts +5 -5
  29. package/dist/style.css +1 -1
  30. package/dist/team-C7-0IiCm.js +33 -0
  31. package/dist/{timesheet-B4Vja79b.js → timesheet-C_WtQDqh.js} +3 -3
  32. package/dist/tsconfig.app.tsbuildinfo +1 -1
  33. package/dist/{useAppStore-CEidzV7L.js → useAppStore-B7R116Aw.js} +1 -1
  34. package/dist/{useLoading-fH82N_CS.js → useLoading-CwSP2H00.js} +1 -1
  35. package/dist/{useReportPermissions-BZS4zPhT.js → useReportPermissions-DVOIk2oR.js} +3 -3
  36. package/package.json +2 -2
  37. package/dist/AuditLogList-C7QcWwHq.js +0 -941
  38. package/dist/EmployeeList-CQzS4gXV.js +0 -690
  39. package/dist/RoleList-Cziztrpo.js +0 -519
  40. package/dist/TeamMemberList-DwxhZcrA.js +0 -1081
  41. package/dist/employee-CY4sYUu8.js +0 -232
  42. package/dist/src/components/table/TablePagination.vue.d.ts +0 -14
  43. package/dist/src/composables/useDebounce.d.ts +0 -9
  44. package/dist/useDebounce-Cnv3r01W.js +0 -83
@@ -0,0 +1,621 @@
1
+ import { toRaw as Me, defineComponent as _e, ref as g, computed as w, watch as be, resolveComponent as p, createElementBlock as B, openBlock as _, Fragment as K, renderSlot as Ie, createVNode as u, unref as o, withCtx as h, createElementVNode as d, createBlock as N, createCommentVNode as W, isRef as ne, renderList as Ve, toDisplayString as j, onMounted as $e, h as re, createTextVNode as Oe, withModifiers as Le } from "vue";
2
+ import { useCoreStore as Fe, useI18n as we, RestaurantSelector as ce } from "@feedmepos/mf-common";
3
+ import { useSnackbar as xe, components as Ue, useDialog as Ne, useBreakpoints as Be, FmButtonVariant as De } from "@feedmepos/ui-library";
4
+ import { S as pe } from "./SelectFilter-DUj7GBtT.js";
5
+ import { _ as Pe } from "./app-BhCUAF8K.js";
6
+ import { H as Te } from "./HorizontalSplitter-o860F4xM.js";
7
+ import { _ as ze } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
8
+ import { u as ke } from "./useSearch-B6WK1LBB.js";
9
+ import { u as Se, E as Ae } from "./employee--8czm9KP.js";
10
+ import { l as je } from "./lodash-D2-GJ54o.js";
11
+ import { _ as ve, a as fe } from "./FormSection.vue_vue_type_script_setup_true_lang-BVb8c4YU.js";
12
+ import { u as Ke, a as Ge } from "./useRestaurantMap-e9fQJiLC.js";
13
+ import { u as qe } from "./useLoading-CwSP2H00.js";
14
+ import { u as ue } from "./useAppStore-B7R116Aw.js";
15
+ function ye(I) {
16
+ return JSON.parse(JSON.stringify(I));
17
+ }
18
+ function he(I) {
19
+ if (typeof structuredClone > "u")
20
+ return ye(I);
21
+ try {
22
+ return structuredClone(Me(I));
23
+ } catch {
24
+ return ye(I);
25
+ }
26
+ }
27
+ const He = { class: "fm-typo-en-title-md-600" }, Je = { class: "space-y-40" }, We = { class: "flex flex-row gap-16" }, Qe = { class: "space-y-16" }, Xe = { class: "flex gap-8 items-center justify-start" }, ge = 4, Ye = /* @__PURE__ */ _e({
28
+ __name: "EmployeeForm",
29
+ props: {
30
+ roleErrorMessage: {
31
+ type: String,
32
+ default: ""
33
+ }
34
+ },
35
+ setup(I, { expose: Q }) {
36
+ const i = ue(), S = Fe(), c = Se(), G = xe(), q = qe(G), { t: m } = we(), v = g(!1), $ = g(!0), E = (l) => {
37
+ s.value = l ? he(l) : D(), x.value = he(s.value), a.value = [], b.value = s.value.restaurants.map((e) => e.restaurantId), s.value.passcode && (a.value = s.value.passcode.split(""), t.value = !0), $.value = !l, v.value = !0;
38
+ };
39
+ function D() {
40
+ return {
41
+ code: "",
42
+ isMasterUser: !1,
43
+ name: "",
44
+ passcode: "",
45
+ restaurants: []
46
+ };
47
+ }
48
+ const P = w(() => $.value ? m("hr.employee.form.add") : m("hr.employee.form.update")), X = w(() => $.value ? m("common.create") : m("common.update")), x = g(D()), s = g(D()), { searchKey: R, filter: T } = ke(), Y = w(() => {
49
+ const l = {};
50
+ return i.roles.value.forEach((e) => {
51
+ l[e._id] = e.name;
52
+ }), l;
53
+ });
54
+ function H(l) {
55
+ const e = z(l) ?? "";
56
+ return Y.value[e] || "";
57
+ }
58
+ const C = w(() => S.restaurants.value.filter(({ _id: e, profile: n, managable: M }) => M ? T([n.code, n.name, H(e)]) : b.value.includes(e)).map(({ _id: e, profile: n, managable: M }) => {
59
+ const L = i.roles.value.filter((V) => V.restaurants.some((F) => F.id == e)).map((V) => ({
60
+ label: V.name,
61
+ value: V._id,
62
+ disabled: !V.isUsable
63
+ }));
64
+ return {
65
+ value: e,
66
+ label: `${n.code ? n.code + "-" : ""}${n.name}`,
67
+ roleOptions: L,
68
+ disabled: !M
69
+ };
70
+ })), Z = w(() => {
71
+ const l = {};
72
+ return s.value.restaurants.forEach((e) => {
73
+ l[e.restaurantId] = e.roleId;
74
+ }), l;
75
+ }), z = (l) => Z.value[l] ?? null, J = (l, e) => {
76
+ s.value.restaurants = [
77
+ ...s.value.restaurants.filter((n) => n.restaurantId !== l),
78
+ {
79
+ restaurantId: l,
80
+ roleId: e
81
+ }
82
+ ];
83
+ }, b = g(s.value.restaurants.map((l) => l.restaurantId)), O = w(
84
+ () => b.value.filter(
85
+ (l) => C.value.some((e) => e.value === l && !e.disabled)
86
+ )
87
+ ), k = w(() => {
88
+ const l = C.value.filter((e) => !e.disabled).length;
89
+ return l > 0 && l === O.value.length;
90
+ }), ee = () => {
91
+ const l = b.value.filter((e) => !O.value.includes(e));
92
+ if (k.value === !0)
93
+ A(l);
94
+ else {
95
+ const e = C.value.filter((n) => !n.disabled).map((n) => n.value);
96
+ A([...e, ...l]);
97
+ }
98
+ }, A = (l) => {
99
+ b.value = l, s.value.restaurants = l.map((e) => {
100
+ var L, V;
101
+ const n = C.value.find((F) => F.value === e);
102
+ if (n != null && n.disabled)
103
+ return s.value.restaurants.find((F) => F.restaurantId === e) ?? {
104
+ restaurantId: e,
105
+ roleId: ""
106
+ };
107
+ const M = ((L = n == null ? void 0 : n.roleOptions.find((F) => !F.disabled)) == null ? void 0 : L.value) || "";
108
+ return {
109
+ restaurantId: e,
110
+ roleId: ((V = s.value.restaurants.find((F) => F.restaurantId === e)) == null ? void 0 : V.roleId) || M
111
+ };
112
+ });
113
+ }, a = g([]), t = g(!1);
114
+ function f() {
115
+ t.value && (t.value = !1, a.value = []);
116
+ }
117
+ async function U() {
118
+ const l = await Ae.generateEmployeePasscode();
119
+ t.value = !1, a.value = l.split("");
120
+ }
121
+ const y = Ke(
122
+ () => !je.isEqual(s.value, x.value),
123
+ () => {
124
+ v.value = !1;
125
+ }
126
+ );
127
+ async function le() {
128
+ const l = {
129
+ user: {
130
+ name: s.value.name,
131
+ passcode: s.value.passcode,
132
+ code: s.value.code
133
+ },
134
+ roles: s.value.restaurants
135
+ };
136
+ s.value.isMasterUser ? await c.createMasterEmployee(l) : (delete l.user.code, await c.createEmployee(l));
137
+ }
138
+ async function ae() {
139
+ const l = x.value, e = {
140
+ user: {
141
+ name: s.value.name,
142
+ passcode: s.value.passcode
143
+ },
144
+ roles: s.value.restaurants
145
+ };
146
+ if (!s.value.isMasterUser)
147
+ await c.updateEmployee(l._id, e);
148
+ else {
149
+ const n = {
150
+ user: {
151
+ name: s.value.name,
152
+ passcode: s.value.passcode,
153
+ code: s.value.code
154
+ },
155
+ roles: s.value.restaurants
156
+ };
157
+ x.value.isMasterUser ? await c.updateMasterEmployee(l._id, n) : await c.migrateToMasterUser(l._id, n);
158
+ }
159
+ }
160
+ async function te() {
161
+ $.value ? await q.minor(
162
+ async () => {
163
+ await le();
164
+ },
165
+ {
166
+ successMessage: m("hr.employee.create.successMessage")
167
+ }
168
+ ) : await q.minor(
169
+ async () => {
170
+ await ae();
171
+ },
172
+ {
173
+ successMessage: m("hr.employee.update.successMessage")
174
+ }
175
+ ), v.value = !1;
176
+ }
177
+ return be(
178
+ () => v.value,
179
+ (l) => {
180
+ }
181
+ ), Q({
182
+ show: v,
183
+ trigger: E
184
+ }), (l, e) => {
185
+ const n = p("FmSwitch"), M = p("FmTextField"), L = p("FmPinField"), V = p("FmFormGroup"), F = p("FmButton"), Ee = p("FmSearch"), ie = p("FmCheckbox"), Re = p("FmSelect"), me = p("fm-button"), Ce = p("fm-side-sheet");
186
+ return _(), B(K, null, [
187
+ Ie(l.$slots, "default", { trigger: E }),
188
+ u(Ce, {
189
+ id: "unit-form",
190
+ modelValue: v.value,
191
+ "onUpdate:modelValue": e[9] || (e[9] = (r) => v.value = r),
192
+ "is-container": o(Ue).FmForm,
193
+ "is-container-props": {
194
+ onValidationSuccess: te,
195
+ blameFormChildOnValidationFailed: !0
196
+ },
197
+ "max-width": 560,
198
+ "onOn:clickedAway": o(y)
199
+ }, {
200
+ "side-sheet-header": h(() => [
201
+ d("p", He, j(P.value), 1)
202
+ ]),
203
+ "side-sheet-footer": h(() => [
204
+ d("div", Xe, [
205
+ u(me, {
206
+ label: X.value,
207
+ size: "lg",
208
+ type: "submit",
209
+ variant: "primary"
210
+ }, null, 8, ["label"]),
211
+ u(me, {
212
+ label: o(m)("common.cancel"),
213
+ size: "lg",
214
+ variant: "tertiary",
215
+ onClick: e[8] || (e[8] = () => v.value = !1)
216
+ }, null, 8, ["label"])
217
+ ])
218
+ ]),
219
+ default: h(() => [
220
+ d("div", Je, [
221
+ u(ve, {
222
+ title: o(m)("hr.employee.form.employeeSetting")
223
+ }, {
224
+ default: h(() => [
225
+ u(fe, {
226
+ label: o(m)("hr.employee.form.masterUserConfig")
227
+ }, {
228
+ default: h(() => [
229
+ u(n, {
230
+ modelValue: s.value.isMasterUser,
231
+ "onUpdate:modelValue": e[0] || (e[0] = (r) => s.value.isMasterUser = r),
232
+ value: "masterUser",
233
+ label: o(m)("hr.employee.form.masterUser"),
234
+ sublabel: o(m)("hr.employee.form.masterUserSublabel"),
235
+ "label-placement": "right"
236
+ }, null, 8, ["modelValue", "label", "sublabel"])
237
+ ]),
238
+ _: 1
239
+ }, 8, ["label"]),
240
+ d("div", We, [
241
+ s.value.isMasterUser ? (_(), N(M, {
242
+ key: 0,
243
+ modelValue: s.value.code,
244
+ "onUpdate:modelValue": e[1] || (e[1] = (r) => s.value.code = r),
245
+ label: o(m)("hr.employee.form.code")
246
+ }, null, 8, ["modelValue", "label"])) : W("", !0),
247
+ u(M, {
248
+ modelValue: s.value.name,
249
+ "onUpdate:modelValue": e[2] || (e[2] = (r) => s.value.name = r),
250
+ class: "w-full",
251
+ label: o(m)("hr.employee.form.name"),
252
+ rules: [(r) => !!r || o(m)("hr.employee.form.required")]
253
+ }, null, 8, ["modelValue", "label", "rules"])
254
+ ]),
255
+ u(fe, {
256
+ label: o(m)("hr.employee.form.passcode")
257
+ }, {
258
+ default: h(() => [
259
+ d("div", Qe, [
260
+ u(V, {
261
+ modelValue: a.value,
262
+ "onUpdate:modelValue": e[5] || (e[5] = (r) => a.value = r),
263
+ rules: [
264
+ (r) => (r == null ? void 0 : r.filter((oe) => !!oe).length) !== ge ? o(m)("hr.employee.form.passcodeRequired") : !0
265
+ ]
266
+ }, {
267
+ default: h(() => [
268
+ u(L, {
269
+ modelValue: a.value,
270
+ "onUpdate:modelValue": e[3] || (e[3] = (r) => a.value = r),
271
+ length: ge,
272
+ masked: t.value,
273
+ onComplete: e[4] || (e[4] = (r) => s.value.passcode = r),
274
+ onFocus: f
275
+ }, null, 8, ["modelValue", "masked"])
276
+ ]),
277
+ _: 1
278
+ }, 8, ["modelValue", "rules"]),
279
+ u(F, {
280
+ variant: "secondary",
281
+ "text-color": "primary",
282
+ "border-color": "primary",
283
+ label: o(m)("hr.employee.form.passcodeGenerate"),
284
+ size: "md",
285
+ onClick: U
286
+ }, null, 8, ["label"])
287
+ ])
288
+ ]),
289
+ _: 1
290
+ }, 8, ["label"])
291
+ ]),
292
+ _: 1
293
+ }, 8, ["title"]),
294
+ u(ve, {
295
+ title: o(m)("hr.employee.form.role")
296
+ }, {
297
+ default: h(() => [
298
+ u(Ee, {
299
+ modelValue: o(R),
300
+ "onUpdate:modelValue": e[6] || (e[6] = (r) => ne(R) ? R.value = r : null),
301
+ placeholder: o(m)("hr.restaurant.search.placeholder")
302
+ }, null, 8, ["modelValue", "placeholder"]),
303
+ u(V, {
304
+ modelValue: b.value,
305
+ "onUpdate:modelValue": e[7] || (e[7] = (r) => b.value = r),
306
+ rules: [(r) => r.length > 0 || o(m)("hr.employee.form.atLeastOneRestaurant")]
307
+ }, {
308
+ default: h(() => [
309
+ u(ie, {
310
+ "model-value": k.value,
311
+ label: o(m)("hr.employee.form.all"),
312
+ value: "1",
313
+ indeterminate: O.value.length > 0,
314
+ "onUpdate:modelValue": ee
315
+ }, null, 8, ["model-value", "label", "indeterminate"]),
316
+ (_(!0), B(K, null, Ve(C.value, (r, oe) => {
317
+ var de;
318
+ return _(), B(K, { key: oe }, [
319
+ u(ie, {
320
+ "model-value": b.value,
321
+ label: r.label,
322
+ value: r.value,
323
+ disabled: r.disabled,
324
+ "onUpdate:modelValue": A
325
+ }, null, 8, ["model-value", "label", "value", "disabled"]),
326
+ b.value.includes(r.value) ? (_(), N(Re, {
327
+ key: 0,
328
+ class: "ml-32 mr-8",
329
+ items: r.roleOptions,
330
+ "model-value": z(r.value),
331
+ multiselect: !1,
332
+ placeholder: ((de = r.roleOptions.find((se) => !se.disabled) ?? r.roleOptions[0]) == null ? void 0 : de.label) ?? "",
333
+ disabled: r.disabled,
334
+ "onUpdate:modelValue": (se) => J(r.value, se)
335
+ }, null, 8, ["items", "model-value", "placeholder", "disabled", "onUpdate:modelValue"])) : W("", !0)
336
+ ], 64);
337
+ }), 128))
338
+ ]),
339
+ _: 1
340
+ }, 8, ["modelValue", "rules"])
341
+ ]),
342
+ _: 1
343
+ }, 8, ["title"])
344
+ ])
345
+ ]),
346
+ _: 1
347
+ }, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"])
348
+ ], 64);
349
+ };
350
+ }
351
+ }), Ze = {
352
+ class: "space-y-8"
353
+ }, el = {
354
+ class: "xs:hidden flex w-full items-start justify-between"
355
+ }, ll = {
356
+ class: "flex items-start gap-8"
357
+ }, al = {
358
+ class: "flex"
359
+ }, tl = {
360
+ class: "space-y-4 sm:hidden md:hidden lg:hidden"
361
+ }, ol = {
362
+ class: "px-16"
363
+ }, sl = {
364
+ class: "px-16 flex items-start gap-8"
365
+ }, rl = {
366
+ class: "pb-64 sm:hidden md:hidden lg:hidden"
367
+ }, nl = {
368
+ class: "space-y-4"
369
+ }, ul = {
370
+ class: "fm-typo-en-body-lg-600"
371
+ }, il = {
372
+ key: 0,
373
+ class: "mr-4"
374
+ }, ml = {
375
+ class: "text-fm-color-typo-secondary"
376
+ }, Ul = /* @__PURE__ */ _e({
377
+ __name: "EmployeeList",
378
+ setup(I, {
379
+ expose: Q
380
+ }) {
381
+ const {
382
+ t: i
383
+ } = we(), S = g(), c = Se(), G = ue(), {
384
+ sessionUser: q
385
+ } = Fe(), m = w(() => c.employees.value), {
386
+ searchKey: v,
387
+ filter: $
388
+ } = ke(""), E = w(() => {
389
+ var a;
390
+ return (a = m.value) == null ? void 0 : a.filter((t) => {
391
+ const f = !S.value || t.restaurants.some((y) => S.value.includes(y.restaurantId)), U = !k.value || t.restaurants.some((y) => y.roleId && k.value.includes(y.roleId));
392
+ return f && U && $([t.code, t.name, `${t.restaurants.map((y) => P(y)).join(" ")}`]);
393
+ });
394
+ }), D = Ge(), P = (a) => {
395
+ const t = D.value[a.restaurantId], f = t == null ? void 0 : t.profile.code;
396
+ let y = a.restaurantName || (t == null ? void 0 : t.profile.name) || "";
397
+ return a.roleName && (y = `${f ? f + " - " : ""}${y} (${a.roleName})`), y;
398
+ }, X = [{
399
+ accessorKey: "code",
400
+ size: 100,
401
+ header: () => i("hr.employee.columns.code")
402
+ }, {
403
+ accessorKey: "name",
404
+ header: () => i("hr.employee.columns.name"),
405
+ enableSorting: !1
406
+ }, {
407
+ accessorKey: "restaurants",
408
+ align: "center",
409
+ header: () => i("hr.employee.columns.restaurants"),
410
+ enableSorting: !1,
411
+ cell(a) {
412
+ return a.row.original.restaurants.map((t, f) => {
413
+ const U = P(t);
414
+ return re("div", (f ? `
415
+ ` : "") + U);
416
+ });
417
+ }
418
+ }, {
419
+ accessorKey: "since",
420
+ header: () => i("hr.employee.columns.since"),
421
+ enableSorting: !1
422
+ }, {
423
+ id: "action",
424
+ size: 52,
425
+ meta: {
426
+ cellClass: "pl-16",
427
+ headerContentClass: "-mx-16"
428
+ },
429
+ cell: (a) => re("div", {
430
+ class: "w-full flex justify-end items-center"
431
+ }, [re(Ue.FmButton, {
432
+ prependIcon: "delete",
433
+ variant: De.Tertiary,
434
+ textColor: "neutral-gray-400",
435
+ onClick: (t) => {
436
+ t.stopPropagation(), z(a.row.original);
437
+ }
438
+ })])
439
+ }], x = xe(), s = Ne(), R = g(), T = g(), Y = w(() => c.restrictEmployeeIds.value);
440
+ function H(a) {
441
+ const t = Y.value.includes(a._id);
442
+ return t && x.open({
443
+ message: i("hr.employee.cannotUpdateMasterUser", {
444
+ name: a.name
445
+ }),
446
+ type: "error"
447
+ }), t;
448
+ }
449
+ const C = (a) => {
450
+ var f;
451
+ a && H(a) || (f = T.value) == null || f.trigger(a);
452
+ }, {
453
+ breakpoints: Z
454
+ } = Be(), z = (a) => {
455
+ H(a) || s.open({
456
+ title: i("hr.employee.remove.title"),
457
+ message: i("hr.employee.remove.message", {
458
+ name: a.name
459
+ }),
460
+ minWidth: Z.value.lg ? 588 : 0,
461
+ primaryActions: {
462
+ text: i("common.remove"),
463
+ close: !1,
464
+ variant: "destructive"
465
+ },
466
+ secondaryActions: {
467
+ text: i("common.cancel"),
468
+ close: !0
469
+ }
470
+ }).onPrimary(async () => {
471
+ await (a.isMasterUser ? c.deleteMasterEmployee : c.deleteEmployee)(a).then(() => x.open({
472
+ message: i("hr.employee.remove.successMessage", {
473
+ name: a.name
474
+ }),
475
+ type: "success"
476
+ })).catch((U) => x.open({
477
+ message: U,
478
+ type: "error"
479
+ })), s.close();
480
+ });
481
+ }, J = g("");
482
+ be(() => R.value && R.value.restaurants, (a) => {
483
+ a && a.length > 0 && (J.value = "");
484
+ });
485
+ function b() {
486
+ var a;
487
+ (a = T.value) == null || a.trigger();
488
+ }
489
+ const O = w(() => ue().roles.value.map((a) => ({
490
+ label: a.name,
491
+ value: a._id
492
+ }))), k = g();
493
+ async function ee() {
494
+ try {
495
+ await c.syncUsersMeta(), await c.readEmployees(), x.open({
496
+ message: i("hr.employee.sync.successMessage"),
497
+ type: "success"
498
+ });
499
+ } catch (a) {
500
+ console.error("Error syncing users:", a), x.open({
501
+ message: i("hr.employee.sync.errorMessage"),
502
+ type: "error"
503
+ });
504
+ }
505
+ }
506
+ async function A() {
507
+ G.roles.value.length === 0 && await G.readRoles(), c.employees.value.length === 0 && await c.readEmployees();
508
+ }
509
+ return $e(() => {
510
+ A();
511
+ }), Q({
512
+ create: b,
513
+ filteredEmployees: E
514
+ }), (a, t) => {
515
+ var l;
516
+ const f = p("FmButton"), U = p("FmTooltip"), y = p("FmSearch"), le = p("FmTable"), ae = p("FmListItem"), te = p("FmList");
517
+ return _(), B(K, null, [u(Ye, {
518
+ ref_key: "employeeFormRef",
519
+ ref: T,
520
+ modelValue: R.value,
521
+ "onUpdate:modelValue": t[0] || (t[0] = (e) => R.value = e),
522
+ "role-error-message": J.value,
523
+ class: "gap-8"
524
+ }, null, 8, ["modelValue", "role-error-message"]), d("div", Ze, [d("div", el, [d("div", ll, [u(o(ce), {
525
+ modelValue: S.value,
526
+ "onUpdate:modelValue": t[1] || (t[1] = (e) => S.value = e),
527
+ "managable-only": !1,
528
+ multiple: "",
529
+ variant: "dark",
530
+ class: "!w-auto"
531
+ }, null, 8, ["modelValue"]), u(pe, {
532
+ modelValue: k.value,
533
+ "onUpdate:modelValue": t[2] || (t[2] = (e) => k.value = e),
534
+ multiple: "",
535
+ variant: "dark",
536
+ items: O.value,
537
+ "selected-prefix": o(i)("hr.employee.filter.selected_role_prefix"),
538
+ placeholder: o(i)("hr.employee.filter.role_placeholder")
539
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]), d("div", al, [(l = o(q)) != null && l.role.isAdmin ? (_(), N(U, {
540
+ key: 0,
541
+ content: o(i)("hr.employee.sync.tooltip")
542
+ }, {
543
+ default: h(() => [u(f, {
544
+ icon: "refresh",
545
+ label: o(i)("hr.employee.sync.tooltip"),
546
+ variant: "tertiary",
547
+ onClick: ee
548
+ }, null, 8, ["label"])]),
549
+ _: 1
550
+ }, 8, ["content"])) : W("", !0), u(y, {
551
+ modelValue: o(v),
552
+ "onUpdate:modelValue": t[3] || (t[3] = (e) => ne(v) ? v.value = e : null),
553
+ autofocus: "",
554
+ class: "pl-4 w-[320px]",
555
+ placeholder: o(i)("hr.employee.search.placeholder")
556
+ }, null, 8, ["modelValue", "placeholder"])])]), d("div", tl, [d("div", ol, [u(y, {
557
+ modelValue: o(v),
558
+ "onUpdate:modelValue": t[4] || (t[4] = (e) => ne(v) ? v.value = e : null),
559
+ autofocus: "",
560
+ placeholder: o(i)("hr.employee.search.placeholder")
561
+ }, null, 8, ["modelValue", "placeholder"])]), u(Te), d("div", sl, [u(o(ce), {
562
+ modelValue: S.value,
563
+ "onUpdate:modelValue": t[5] || (t[5] = (e) => S.value = e),
564
+ "managable-only": !1,
565
+ multiple: "",
566
+ variant: "dark",
567
+ class: "!w-auto"
568
+ }, null, 8, ["modelValue"]), u(pe, {
569
+ modelValue: k.value,
570
+ "onUpdate:modelValue": t[6] || (t[6] = (e) => k.value = e),
571
+ multiple: "",
572
+ items: O.value,
573
+ variant: "dark",
574
+ "selected-prefix": o(i)("hr.employee.filter.selected_role_prefix"),
575
+ placeholder: o(i)("hr.employee.filter.role_placeholder")
576
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]), o(c).employees.value.length > 0 || o(c).isLoading.value ? (_(), N(Pe, {
577
+ key: 0,
578
+ class: "overflow-auto"
579
+ }, {
580
+ default: h(() => [u(le, {
581
+ class: "xs:hidden",
582
+ "column-defs": X,
583
+ "row-data": E.value,
584
+ "page-size": E.value.length,
585
+ loading: o(c).isLoading.value,
586
+ virtual: E.value.length > 0,
587
+ "pin-header-row": "",
588
+ "hide-footer": "",
589
+ onRowClick: t[7] || (t[7] = (e) => C(e.original))
590
+ }, null, 8, ["row-data", "page-size", "loading", "virtual"]), d("div", rl, [u(te, {
591
+ separator: ""
592
+ }, {
593
+ default: h(() => [(_(!0), B(K, null, Ve(E.value, (e) => (_(), N(ae, {
594
+ key: e._id,
595
+ class: "py-12 px-16 items-center justify-between",
596
+ onClick: (n) => C(e)
597
+ }, {
598
+ default: h(() => [d("div", nl, [d("p", ul, [e.code ? (_(), B("span", il, j(e.code) + ".", 1)) : W("", !0), Oe(j(e.name), 1)]), d("div", ml, [d("p", null, j(o(i)("hr.employee.restaurants", {
599
+ restaurants: e.restaurants.map((n) => P(n)).join(", ")
600
+ })), 1), d("p", null, " Since: " + j(e.since), 1)])]), u(f, {
601
+ icon: "delete",
602
+ variant: "tertiary",
603
+ "text-color": "neutral-gray-400",
604
+ onClick: Le((n) => z(e), ["stop"])
605
+ }, null, 8, ["onClick"])]),
606
+ _: 2
607
+ }, 1032, ["onClick"]))), 128))]),
608
+ _: 1
609
+ })])]),
610
+ _: 1
611
+ })) : (_(), N(o(ze), {
612
+ key: 1,
613
+ title: o(i)("hr.employee.noData.title"),
614
+ subtitle: o(i)("hr.employee.noData.subtitle")
615
+ }, null, 8, ["title", "subtitle"]))])], 64);
616
+ };
617
+ }
618
+ });
619
+ export {
620
+ Ul as default
621
+ };