@feedmepos/mf-hrm-portal 1.1.3-dev → 1.1.3-dev.10

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