@feedmepos/mf-hrm-portal 0.0.1-alpha.1

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 (104) hide show
  1. package/dist/App.vue.d.ts +2 -0
  2. package/dist/EmployeeList-BU6n0y6w.js +604 -0
  3. package/dist/Entry.vue.d.ts +2 -0
  4. package/dist/PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js +37 -0
  5. package/dist/RoleList-kE8O8wyy.js +492 -0
  6. package/dist/TeamMemberList-BBl8auxB.js +1447 -0
  7. package/dist/TimesheetList-QmuwWz31.js +395 -0
  8. package/dist/api/employee/index.d.ts +15 -0
  9. package/dist/api/index.d.ts +3 -0
  10. package/dist/api/inventory/index.d.ts +5 -0
  11. package/dist/api/role/index.d.ts +9 -0
  12. package/dist/api/team/index.d.ts +10 -0
  13. package/dist/api/timesheet/index.d.ts +6 -0
  14. package/dist/api/user/index.d.ts +6 -0
  15. package/dist/app-DWSjl6MP.js +1170 -0
  16. package/dist/app-DXlbstZu.js +2282 -0
  17. package/dist/app.d.ts +3 -0
  18. package/dist/app.js +6 -0
  19. package/dist/components/AppForm.vue.d.ts +45 -0
  20. package/dist/components/CheckboxInput.vue.d.ts +155 -0
  21. package/dist/components/Navigator.vue.d.ts +6 -0
  22. package/dist/components/Splash.vue.d.ts +2 -0
  23. package/dist/composables/message.d.ts +4 -0
  24. package/dist/composables/restaurant.d.ts +329 -0
  25. package/dist/employee-C-ICOGva.js +449 -0
  26. package/dist/favicon.ico +0 -0
  27. package/dist/helpers/component.d.ts +12 -0
  28. package/dist/helpers/iteration.d.ts +10 -0
  29. package/dist/helpers/rule.d.ts +28 -0
  30. package/dist/helpers/utils.d.ts +3 -0
  31. package/dist/index-COaCoGwy.js +57 -0
  32. package/dist/loading-31nfQqf0.js +140 -0
  33. package/dist/lodash-P5mhhlxp.js +3676 -0
  34. package/dist/main-DlJuqlgg.js +15636 -0
  35. package/dist/main.d.ts +1 -0
  36. package/dist/restaurant-D5BNPLKh.js +107 -0
  37. package/dist/router/index.d.ts +2 -0
  38. package/dist/router/shared.d.ts +10 -0
  39. package/dist/rule-DjIknogy.js +8229 -0
  40. package/dist/search-Dh3HG-_h.js +258 -0
  41. package/dist/shared/api/index.d.ts +3 -0
  42. package/dist/shared/api/public.d.ts +5 -0
  43. package/dist/shared/components/button/ResponsiveFabButton.vue.d.ts +3 -0
  44. package/dist/shared/components/form/SelectFilter.vue.d.ts +86 -0
  45. package/dist/shared/components/layout/FormColumn.vue.d.ts +12 -0
  46. package/dist/shared/components/layout/FormItem.vue.d.ts +17 -0
  47. package/dist/shared/components/layout/FormSection.vue.d.ts +18 -0
  48. package/dist/shared/components/layout/FullWrapper.vue.d.ts +9 -0
  49. package/dist/shared/components/layout/HorizontalSplitter.vue.d.ts +2 -0
  50. package/dist/shared/components/layout/LottieAnimation.vue.d.ts +39 -0
  51. package/dist/shared/components/layout/PageLayout.vue.d.ts +20 -0
  52. package/dist/shared/components/loading/AppLoading.vue.d.ts +20 -0
  53. package/dist/shared/components/loading/PageLoading.vue.d.ts +2 -0
  54. package/dist/shared/components/loading/index.d.ts +1 -0
  55. package/dist/shared/components/menu/BottomSheetMenu.vue.d.ts +13 -0
  56. package/dist/shared/components/menu/BottomSheetMenuItem.vue.d.ts +15 -0
  57. package/dist/shared/components/menu/ResponsiveContextMenu.vue.d.ts +13 -0
  58. package/dist/shared/components/table/EmptyDataTemplate/Icon.vue.d.ts +2 -0
  59. package/dist/shared/components/table/EmptyDataTemplate/index.d.ts +1 -0
  60. package/dist/shared/components/table/EmptyDataTemplate/index.vue.d.ts +18 -0
  61. package/dist/shared/composable/dateRange.d.ts +18 -0
  62. package/dist/shared/composable/discardConfirm.d.ts +1 -0
  63. package/dist/shared/composable/elementPosition.d.ts +17 -0
  64. package/dist/shared/composable/filterSelector.d.ts +12 -0
  65. package/dist/shared/composable/loading.d.ts +29 -0
  66. package/dist/shared/composable/search.d.ts +5 -0
  67. package/dist/shared/composable/sheet.d.ts +17 -0
  68. package/dist/shared/helpers/createComponent.d.ts +7 -0
  69. package/dist/shared/helpers/iteration.d.ts +11 -0
  70. package/dist/shared/helpers/object.d.ts +6 -0
  71. package/dist/shared/helpers/string.d.ts +12 -0
  72. package/dist/shared/permission/posPermission.d.ts +6 -0
  73. package/dist/shared/stores/app.d.ts +217 -0
  74. package/dist/stores/employee.d.ts +590 -0
  75. package/dist/stores/role.d.ts +214 -0
  76. package/dist/stores/timesheet.d.ts +253 -0
  77. package/dist/style.css +1 -0
  78. package/dist/timesheet-Jwqi_LdM.js +56 -0
  79. package/dist/tsconfig.app.tsbuildinfo +1 -0
  80. package/dist/types/employee.d.ts +30 -0
  81. package/dist/types/permission.d.ts +2 -0
  82. package/dist/types/restaurant.d.ts +18 -0
  83. package/dist/types/role.d.ts +37 -0
  84. package/dist/types/team.d.ts +49 -0
  85. package/dist/types/timesheet.d.ts +16 -0
  86. package/dist/views/hr/locales/index.d.ts +602 -0
  87. package/dist/views/hr/views/employee/Employee.vue.d.ts +2 -0
  88. package/dist/views/hr/views/employee/EmployeeList.vue.d.ts +38 -0
  89. package/dist/views/hr/views/employee/components/EmployeeForm.vue.d.ts +27 -0
  90. package/dist/views/hr/views/main.vue.d.ts +2 -0
  91. package/dist/views/hr/views/role/RoleForm.vue.d.ts +17 -0
  92. package/dist/views/hr/views/role/RoleList.vue.d.ts +5 -0
  93. package/dist/views/hr/views/timesheet/TimesheetList.vue.d.ts +2 -0
  94. package/dist/views/team/locales/index.d.ts +348 -0
  95. package/dist/views/team/views/team/TeamMemberList.vue.d.ts +2 -0
  96. package/dist/views/team/views/team/components/AddMemberForm.vue.d.ts +37 -0
  97. package/dist/views/team/views/team/components/MemberInfo.vue.d.ts +6 -0
  98. package/dist/views/team/views/team/components/PortalPermissionEditor.vue.d.ts +46 -0
  99. package/dist/views/team/views/team/components/PortalUserSearcher.vue.d.ts +40 -0
  100. package/dist/views/team/views/team/components/TeamMemberBasePermission.vue.d.ts +36 -0
  101. package/dist/views/team/views/team/components/TeamMemberConditionPermission.vue.d.ts +50 -0
  102. package/dist/views/team/views/team/components/TeamMemberMasterUser.vue.d.ts +710 -0
  103. package/dist/views/team/views/team/components/TeamMemberRolePermission.vue.d.ts +46 -0
  104. package/package.json +73 -0
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,604 @@
1
+ import { createElementBlock as O, openBlock as h, 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, h as se, createTextVNode as $e, withModifiers as Oe } 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 "./search-Dh3HG-_h.js";
5
+ import { _ as Pe } from "./app-DWSjl6MP.js";
6
+ import { u as Te, _ as ze } from "./loading-31nfQqf0.js";
7
+ import { u as ke, E as Ae } from "./employee-C-ICOGva.js";
8
+ import { l as je } from "./lodash-P5mhhlxp.js";
9
+ import { u as Ke, _ as de, a as pe, b as Ge } from "./restaurant-D5BNPLKh.js";
10
+ import { u as ne } from "./rule-DjIknogy.js";
11
+ const qe = {};
12
+ function He(S, M) {
13
+ return h(), O("div", null, [...M[0] || (M[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: M }) {
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 I = u.roles.value.filter((w) => w.restaurants.some(($) => $.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: I
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 I, w, $;
95
+ const m = ((w = (I = k.value.find((j) => j.value === e)) == null ? void 0 : I.roleOptions[0]) == null ? void 0 : w.value) || "";
96
+ return {
97
+ restaurantId: e,
98
+ roleId: (($ = s.value.restaurants.find((j) => j.restaurantId === e)) == null ? void 0 : $.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
+ ), M({
170
+ show: f,
171
+ trigger: R
172
+ }), (a, e) => {
173
+ const m = v("FmSwitch"), I = v("FmTextField"), w = v("FmPinField"), $ = 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(), O(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(I, {
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(I, {
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($, {
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($, {
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), O(G, null, ge(k.value, (r, oe) => (h(), O(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: M
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
+ }), M({
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(), O(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
+ variant: "tertiary",
530
+ onClick: ee
531
+ })]),
532
+ _: 1
533
+ }, 8, ["content"])) : Q("", !0), n(V, {
534
+ autofocus: "",
535
+ modelValue: o(f),
536
+ "onUpdate:modelValue": t[3] || (t[3] = (e) => re(f) ? f.value = e : null),
537
+ class: "pl-4 w-[320px]",
538
+ placeholder: o(u)("hr.employee.search.placeholder")
539
+ }, null, 8, ["modelValue", "placeholder"])])]), c("div", sl, [c("div", rl, [n(V, {
540
+ autofocus: "",
541
+ modelValue: o(f),
542
+ "onUpdate:modelValue": t[4] || (t[4] = (e) => re(f) ? f.value = e : null),
543
+ placeholder: o(u)("hr.employee.search.placeholder")
544
+ }, null, 8, ["modelValue", "placeholder"])]), n(Je), c("div", nl, [n(o(me), {
545
+ modelValue: E.value,
546
+ "onUpdate:modelValue": t[5] || (t[5] = (e) => E.value = e),
547
+ "managable-only": !1,
548
+ multiple: "",
549
+ variant: "dark",
550
+ class: "!w-auto"
551
+ }, null, 8, ["modelValue"]), n(ce, {
552
+ modelValue: U.value,
553
+ "onUpdate:modelValue": t[6] || (t[6] = (e) => U.value = e),
554
+ multiple: "",
555
+ items: z.value,
556
+ variant: "dark",
557
+ "selected-prefix": o(u)("hr.employee.filter.selected_role_prefix"),
558
+ placeholder: o(u)("hr.employee.filter.role_placeholder")
559
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]), o(d).employees.value.length > 0 || o(d).isLoading.value ? (h(), B(Pe, {
560
+ key: 0,
561
+ class: "overflow-auto"
562
+ }, {
563
+ default: y(() => [n(le, {
564
+ class: "xs:hidden",
565
+ "column-defs": X,
566
+ "row-data": R.value,
567
+ "page-size": R.value.length,
568
+ loading: o(d).isLoading.value,
569
+ virtual: R.value.length > 0,
570
+ "pin-header-row": "",
571
+ "hide-footer": "",
572
+ onRowClick: t[7] || (t[7] = (e) => k(e.original))
573
+ }, null, 8, ["row-data", "page-size", "loading", "virtual"]), c("div", ul, [n(te, {
574
+ separator: ""
575
+ }, {
576
+ default: y(() => [(h(!0), O(G, null, ge(R.value, (e) => (h(), B(ae, {
577
+ class: "py-12 px-16 items-center justify-between",
578
+ onClick: (m) => k(e),
579
+ key: e._id
580
+ }, {
581
+ default: y(() => [c("div", il, [c("p", ml, [e.code ? (h(), O("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", {
582
+ restaurants: e.restaurants.map((m) => N(m)).join(", ")
583
+ })), 1), c("p", null, " Since: " + K(e.since), 1)])]), n(p, {
584
+ icon: "delete",
585
+ variant: "tertiary",
586
+ "text-color": "neutral-gray-400",
587
+ onClick: Oe((m) => T(e), ["stop"])
588
+ }, null, 8, ["onClick"])]),
589
+ _: 2
590
+ }, 1032, ["onClick"]))), 128))]),
591
+ _: 1
592
+ })])]),
593
+ _: 1
594
+ })) : (h(), B(o(ze), {
595
+ key: 1,
596
+ title: o(u)("hr.employee.noData.title"),
597
+ subtitle: o(u)("hr.employee.noData.subtitle")
598
+ }, null, 8, ["title", "subtitle"]))])], 64);
599
+ };
600
+ }
601
+ });
602
+ export {
603
+ xl as default
604
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,37 @@
1
+ import { defineComponent as l, createElementBlock as a, openBlock as r, normalizeClass as t, createElementVNode as o, renderSlot as s, toDisplayString as d } from "vue";
2
+ const i = {
3
+ class: /* @__PURE__ */ t([
4
+ "flex flex-col",
5
+ "p-24 xs:p-0",
6
+ "bg-fm-color-neutral-white",
7
+ "min-h-[calc(100dvh-56px)]",
8
+ "xs:max-h-[calc(100dvh-56px)]"
9
+ ])
10
+ }, c = {
11
+ class: /* @__PURE__ */ t([
12
+ "flex items-center",
13
+ "mb-24 xs:mb-0 xs:p-16",
14
+ "xs:border-b border-fm-color-neutral-gray-100"
15
+ ])
16
+ }, p = { class: "fm-typo-en-title-md-600 h-[36px] items-center flex" }, f = /* @__PURE__ */ l({
17
+ __name: "PageLayout",
18
+ props: {
19
+ heading: {}
20
+ },
21
+ setup(n) {
22
+ return (e, m) => (r(), a("div", i, [
23
+ o("div", c, [
24
+ s(e.$slots, "prepend-heading"),
25
+ o("div", null, [
26
+ o("h1", p, d(n.heading), 1),
27
+ s(e.$slots, "sub-heading")
28
+ ]),
29
+ s(e.$slots, "append-heading")
30
+ ]),
31
+ s(e.$slots, "default")
32
+ ]));
33
+ }
34
+ });
35
+ export {
36
+ f as _
37
+ };