@feedmepos/mf-hrm-portal 1.1.6-dev → 2.0.0

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