@feedmepos/mf-hrm-portal 2.3.2-dev.2 → 2.3.2-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 (99) hide show
  1. package/dist/{ApprovalCodeList-sHnINTik.js → ApprovalCodeList-D3U4nvlF.js} +15 -14
  2. package/dist/{AuditLogList-C9C2emU9.js → AuditLogList-qGCW7tf0.js} +13 -13
  3. package/dist/ConditionBuilderForm.vue_vue_type_script_setup_true_lang-B0VcRYUg.js +438 -0
  4. package/dist/EmployeeList-Bd73xDCX.js +776 -0
  5. package/dist/FormItem.vue_vue_type_script_setup_true_lang-cLEnrtC6.js +45 -0
  6. package/dist/FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js +49 -0
  7. package/dist/{GrantUserList-LWpqhl-5.js → GrantUserList-C71pal0N.js} +16 -15
  8. package/dist/{Main-PBJjfzBg.js → Main-BWJPyEU1.js} +5 -5
  9. package/dist/{Main-BWKb-QIE.js → Main-CCdTWngg.js} +11 -11
  10. package/dist/Main-DGf0bQvy.js +96 -0
  11. package/dist/PasscodePinField.vue_vue_type_script_setup_true_lang-CqG0v0Sz.js +243 -0
  12. package/dist/{PermissionSetList-D2qZVlF4.js → PermissionSetList-BS-oBunI.js} +46 -45
  13. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CkOAT-oX.js +4167 -0
  14. package/dist/PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-DQcgZ0nF.js +35 -0
  15. package/dist/RoleList-B_7UnVNb.js +740 -0
  16. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-Cs0rhCa3.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-BXihM4sl.js} +1 -1
  17. package/dist/{ScheduleGeneralPage-C4J6jYtG.js → ScheduleGeneralPage-DpNvWNGs.js} +2 -2
  18. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-3UqO6uPu.js → ScheduleModal.vue_vue_type_script_setup_true_lang-DIYLOF9N.js} +186 -187
  19. package/dist/{SchedulePage-ICzggri0.js → SchedulePage-QW-cYvu2.js} +13 -13
  20. package/dist/{SchedulePositionPage-BshUCd_C.js → SchedulePositionPage-BtFfVo2N.js} +3 -3
  21. package/dist/{SelectFilter-D9T0nFvG.js → SelectFilter-BXeVKgHN.js} +1 -1
  22. package/dist/TeamMemberList-DoisBYnk.js +1154 -0
  23. package/dist/{TimesheetList-nxhr0EWj.js → TimesheetList-D-bESKe5.js} +9 -9
  24. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-BLqgALLe.js → TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-D0zAVqCa.js} +3 -3
  25. package/dist/{app-n6d4AmtP.js → app-D-MUq9Ab.js} +3429 -6368
  26. package/dist/app.js +3 -3
  27. package/dist/{approval-code-1j1OoXt1.js → approval-code-BXUiojPH.js} +1 -1
  28. package/dist/{dayjs.min-DdNivv4b.js → dayjs.min-BZ1pM-6M.js} +34 -34
  29. package/dist/{employee-BlfleiCU.js → employee-HQEU8fjb.js} +47 -48
  30. package/dist/{grant-user-BmTyexk3.js → grant-user-CBJ3gEgW.js} +1 -1
  31. package/dist/{iteration-y_jodvfN.js → iteration-ogxW2-Tv.js} +1 -1
  32. package/dist/{lodash-B2eWEGH4.js → lodash-Def4gaas.js} +1 -1
  33. package/dist/restaurant-D2mfKHaH.js +1880 -0
  34. package/dist/{role-DfZi7Ssk.js → role-JDoDFVd9.js} +4 -5
  35. package/dist/{rule-ChmhcGgA.js → rule-DPtqlnz-.js} +100 -105
  36. package/dist/src/components/CollapsibleWrapper.vue.d.ts +3 -11
  37. package/dist/src/helpers/string.d.ts +1 -10
  38. package/dist/src/router/shared.d.ts +1 -3
  39. package/dist/src/stores/restaurant.d.ts +7 -7
  40. package/dist/src/stores/team.d.ts +0 -30
  41. package/dist/src/types/team.d.ts +1 -17
  42. package/dist/src/views/hr/locales/index.d.ts +4 -24
  43. package/dist/src/views/hr/role/RoleForm.vue.d.ts +2 -29
  44. package/dist/src/views/scheduling/composables/useScheduleOnboardingAvailability.d.ts +1 -1
  45. package/dist/src/views/scheduling/composables/useScheduleOnboardingWizard.d.ts +1 -1
  46. package/dist/src/views/scheduling/composables/useScheduleShiftDraft.d.ts +1 -1
  47. package/dist/src/views/scheduling/composables/useScheduleShiftPopover.d.ts +1 -1
  48. package/dist/src/views/team/components/BasePermission.vue.d.ts +0 -11
  49. package/dist/src/views/team/components/ConditionPermission.vue.d.ts +0 -11
  50. package/dist/src/views/team/components/PortalPermissionEditor.vue.d.ts +0 -21
  51. package/dist/src/views/team/components/PosRolePermission.vue.d.ts +0 -11
  52. package/dist/src/views/team/locales/index.d.ts +0 -716
  53. package/dist/src/views/team/member/AddMemberForm.vue.d.ts +3 -48
  54. package/dist/src/views/team/{components/MemberStatusBadge.vue.d.ts → member/MemberInfo.vue.d.ts} +2 -2
  55. package/dist/src/views/team/member/TeamMemberList.vue.d.ts +0 -1
  56. package/dist/string-VNuQNweN.js +15 -0
  57. package/dist/style.css +1 -1
  58. package/dist/tsconfig.app.tsbuildinfo +1 -1
  59. package/dist/{useAppStore-BPARQyvJ.js → useAppStore-DZCdxlCd.js} +1 -1
  60. package/dist/{useLoading-iPESFb6R.js → useLoading-Nygx2zn8.js} +1 -1
  61. package/dist/{useReportPermissions-By-BoJZb.js → useReportPermissions-CxV7Dz1B.js} +5 -5
  62. package/package.json +2 -2
  63. package/dist/ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BbsPesWY.js +0 -459
  64. package/dist/EmployeeList-D4oy5hXz.js +0 -896
  65. package/dist/FormSection.vue_vue_type_script_setup_true_lang-Cl053Tg1.js +0 -90
  66. package/dist/Main-CVGiOYpC.js +0 -101
  67. package/dist/MyPosProfile-BQCBFMFw.js +0 -301
  68. package/dist/PasscodePinField.vue_vue_type_script_setup_true_lang-TXPEqa46.js +0 -126
  69. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-ZSREAS1r.js +0 -4243
  70. package/dist/PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-DRGTxOMW.js +0 -1831
  71. package/dist/RoleForm.vue_vue_type_script_setup_true_lang-DFDTw0lj.js +0 -547
  72. package/dist/RoleList-DG0crFzW.js +0 -274
  73. package/dist/TeamMemberList-C970Iqlj.js +0 -2086
  74. package/dist/member-grant-CzZUdO_s.js +0 -55
  75. package/dist/restaurant-Dl6yx37M.js +0 -51
  76. package/dist/src/api/my-pos-profile/index.d.ts +0 -5
  77. package/dist/src/api/sso-provider/index.d.ts +0 -5
  78. package/dist/src/api/staff-invite/index.d.ts +0 -16
  79. package/dist/src/components/form/SegmentedTabs.vue.d.ts +0 -23
  80. package/dist/src/composables/useMenuAccess.d.ts +0 -56
  81. package/dist/src/composables/useSsoProviders.d.ts +0 -19
  82. package/dist/src/composables/useStaffInviteProviders.d.ts +0 -8
  83. package/dist/src/helpers/member-grant.d.ts +0 -36
  84. package/dist/src/helpers/my-pos-profile.d.ts +0 -37
  85. package/dist/src/helpers/pos-assignment-rows.d.ts +0 -28
  86. package/dist/src/helpers/staff-invite.d.ts +0 -54
  87. package/dist/src/router/menu-access-guard.d.ts +0 -17
  88. package/dist/src/types/my-pos-profile.d.ts +0 -25
  89. package/dist/src/types/sso-provider.d.ts +0 -10
  90. package/dist/src/types/staff-invite.d.ts +0 -100
  91. package/dist/src/views/my-pos-profile/MyPosProfile.vue.d.ts +0 -2
  92. package/dist/src/views/my-pos-profile/components/PasscodeChangedDialog.vue.d.ts +0 -4
  93. package/dist/src/views/my-pos-profile/locales/index.d.ts +0 -200
  94. package/dist/src/views/team/components/MemberGrantFields.vue.d.ts +0 -51
  95. package/dist/src/views/team/components/PosAssignmentRows.vue.d.ts +0 -44
  96. package/dist/src/views/team/member/ExistingMemberNotice.vue.d.ts +0 -11
  97. package/dist/src/views/team/member/MemberDetailsCard.vue.d.ts +0 -35
  98. package/dist/src/views/team/member/MemberHeaderCard.vue.d.ts +0 -19
  99. package/dist/string-DZQ1uNjn.js +0 -22
@@ -1,896 +0,0 @@
1
- import { defineComponent as Ve, computed as k, resolveComponent as w, createElementBlock as O, openBlock as b, createElementVNode as m, createVNode as n, toDisplayString as N, Fragment as ke, renderList as Be, createCommentVNode as H, withKeys as Ie, withModifiers as oe, normalizeClass as be, ref as h, watch as re, renderSlot as je, unref as t, withCtx as x, createBlock as D, onUnmounted as Ge, isRef as Re, createTextVNode as he, resolveDynamicComponent as qe, h as pe } from "vue";
2
- import { useI18n as Le, useCoreStore as He } from "@feedmepos/mf-common";
3
- import { useSnackbar as $e, components as Me, useDialog as We, useBreakpoints as Je } from "@feedmepos/ui-library";
4
- import { S as fe } from "./SelectFilter-D9T0nFvG.js";
5
- import { _ as Qe, c as Ye, a as Ze } from "./app-n6d4AmtP.js";
6
- import { _ as Ee, a as Fe, u as Xe, H as ea } from "./FormSection.vue_vue_type_script_setup_true_lang-Cl053Tg1.js";
7
- import { _ as aa } from "./ResponsiveContextMenu.vue_vue_type_script_setup_true_lang-mSJFKo7r.js";
8
- import { _ as la } from "./TableEmptyState.vue_vue_type_script_setup_true_lang-IfAZmWr0.js";
9
- import { c as ta, b as sa, a as oa, p as ra, r as na, s as ia, _ as ua, d as da, e as Ue } from "./PasscodePinField.vue_vue_type_script_setup_true_lang-TXPEqa46.js";
10
- import { u as ca } from "./useDebounce-B8ZPVS5C.js";
11
- import { n as ma } from "./string-DZQ1uNjn.js";
12
- import { u as Pe, E as pa } from "./employee-BlfleiCU.js";
13
- import { u as Ae } from "./restaurant-Dl6yx37M.js";
14
- import { l as fa } from "./lodash-B2eWEGH4.js";
15
- import { u as va } from "./useDiscardConfirm-CzZSPyvh.js";
16
- import { u as De } from "./useLoading-iPESFb6R.js";
17
- import { c as Se } from "./object-Dwyg2LgX.js";
18
- import { u as _e } from "./role-DfZi7Ssk.js";
19
- /* empty css */
20
- const ya = { class: "rounded-lg border border-fm-color-neutral-gray-200 p-16 space-y-16" }, ga = { class: "fm-typo-en-title-sm-600" }, ha = { class: "space-y-16" }, ba = { class: "grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] gap-16" }, _a = { class: "text-sm font-semibold text-fm-color-typo-primary" }, Va = { class: "text-sm font-semibold text-fm-color-typo-primary" }, ka = { class: "flex justify-self-end" }, xa = ["tabindex", "aria-disabled", "aria-label", "onClick", "onKeydown"], wa = /* @__PURE__ */ Ve({
21
- __name: "OutletRoleAssignment",
22
- props: {
23
- modelValue: {},
24
- restaurants: {},
25
- roles: {},
26
- isRoleUsable: {},
27
- isRestaurantLocked: { type: Function, default: () => !1 },
28
- createRow: {},
29
- title: {},
30
- restaurantLabel: {},
31
- roleLabel: {},
32
- addLabel: {},
33
- removeLabel: {}
34
- },
35
- emits: ["update:modelValue"],
36
- setup(R, { emit: Z }) {
37
- const l = R, _ = Z, f = k(() => ({
38
- isRoleUsable: l.isRoleUsable,
39
- isRestaurantLocked: l.isRestaurantLocked
40
- }));
41
- function L(y) {
42
- return sa(l.restaurants, l.modelValue, y);
43
- }
44
- function X(y) {
45
- return oa(l.roles, y.restaurantId, y.roleId, f.value);
46
- }
47
- function V(y) {
48
- return l.isRestaurantLocked(y);
49
- }
50
- function ee(y, U) {
51
- const v = l.modelValue[y], I = ra(l.roles, U, v.roleId, f.value), M = [...l.modelValue];
52
- M[y] = { ...v, restaurantId: U, roleId: I }, _("update:modelValue", M);
53
- }
54
- function u(y, U) {
55
- const v = l.modelValue[y], I = [...l.modelValue];
56
- I[y] = { ...v, roleId: U }, _("update:modelValue", I);
57
- }
58
- function E() {
59
- _("update:modelValue", [...l.modelValue, l.createRow()]);
60
- }
61
- function F(y) {
62
- _(
63
- "update:modelValue",
64
- na(l.modelValue, y, l.createRow, f.value)
65
- );
66
- }
67
- const K = k(() => ta(l.restaurants, l.modelValue));
68
- return (y, U) => {
69
- const v = w("FmSelect"), I = w("FmIcon"), M = w("FmButton");
70
- return b(), O("div", ya, [
71
- m("div", ga, N(R.title), 1),
72
- m("div", ha, [
73
- m("div", ba, [
74
- m("div", _a, N(R.restaurantLabel), 1),
75
- m("div", Va, N(R.roleLabel), 1),
76
- U[0] || (U[0] = m("div", null, null, -1))
77
- ]),
78
- (b(!0), O(ke, null, Be(R.modelValue, (p, s) => (b(), O("div", {
79
- key: `${p.restaurantId || "new"}-${s}`,
80
- class: "grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] items-center gap-16"
81
- }, [
82
- n(v, {
83
- class: "min-w-0",
84
- "model-value": p.restaurantId,
85
- items: L(p.restaurantId),
86
- multiselect: !1,
87
- searchable: "",
88
- "search-debounce": 300,
89
- placeholder: R.restaurantLabel,
90
- disabled: V(p.restaurantId),
91
- "onUpdate:modelValue": (S) => ee(s, S)
92
- }, null, 8, ["model-value", "items", "placeholder", "disabled", "onUpdate:modelValue"]),
93
- n(v, {
94
- class: "min-w-0",
95
- "model-value": p.roleId,
96
- items: X(p),
97
- multiselect: !1,
98
- placeholder: R.roleLabel,
99
- disabled: !p.restaurantId || V(p.restaurantId),
100
- "onUpdate:modelValue": (S) => u(s, S)
101
- }, null, 8, ["model-value", "items", "placeholder", "disabled", "onUpdate:modelValue"]),
102
- m("div", ka, [
103
- R.modelValue.length > 1 ? (b(), O("div", {
104
- key: 0,
105
- role: "button",
106
- tabindex: V(p.restaurantId) ? -1 : 0,
107
- "aria-disabled": V(p.restaurantId),
108
- class: be(["inline-flex h-40 w-40 shrink-0 items-center justify-center rounded-lg text-fm-color-neutral-gray-400 transition-colors hover:bg-fm-color-neutral-gray-100 focus:outline-none focus:ring-2 focus:ring-fm-color-primary disabled:cursor-not-allowed disabled:text-fm-color-neutral-gray-200 disabled:hover:bg-transparent", {
109
- "cursor-pointer": !V(p.restaurantId),
110
- "pointer-events-none": V(p.restaurantId)
111
- }]),
112
- "aria-label": R.removeLabel,
113
- onClick: oe((S) => F(s), ["stop"]),
114
- onKeydown: [
115
- Ie(oe((S) => F(s), ["prevent", "stop"]), ["enter"]),
116
- Ie(oe((S) => F(s), ["prevent", "stop"]), ["space"])
117
- ]
118
- }, [
119
- n(I, {
120
- name: "delete",
121
- size: "md"
122
- })
123
- ], 42, xa)) : H("", !0)
124
- ])
125
- ]))), 128))
126
- ]),
127
- n(M, {
128
- type: "button",
129
- variant: "secondary",
130
- "text-color": "primary",
131
- "border-color": "primary",
132
- "prepend-icon": "add",
133
- label: R.addLabel,
134
- size: "md",
135
- disabled: !K.value,
136
- onClick: oe(E, ["stop"])
137
- }, null, 8, ["label", "disabled"])
138
- ]);
139
- };
140
- }
141
- }), Ia = { class: "flex w-full items-center justify-between" }, Ra = { class: "fm-typo-en-title-md-600" }, Ea = { class: "space-y-40" }, Fa = { class: "flex flex-row gap-16" }, Ua = { class: "space-y-16" }, Sa = { class: "flex gap-8 items-center justify-start" }, Ce = 4, Ca = /* @__PURE__ */ Ve({
142
- __name: "EmployeeForm",
143
- props: {
144
- roleErrorMessage: {
145
- type: String,
146
- default: ""
147
- }
148
- },
149
- emits: ["submitted"],
150
- setup(R, { expose: Z, emit: l }) {
151
- const _ = _e(), f = Ae(), L = Pe(), X = $e(), V = De(X), ee = l, { t: u } = Le(), E = h(!1), F = h(!0);
152
- function K() {
153
- return {
154
- restaurantId: "",
155
- roleId: ""
156
- };
157
- }
158
- function y(d) {
159
- if (!d) return v();
160
- const r = Se(d);
161
- return {
162
- code: r.code ?? "",
163
- isMasterUser: r.isMasterUser ?? !1,
164
- name: r.name ?? "",
165
- passcode: r.passcode ?? "",
166
- restaurants: r.restaurants.length > 0 ? r.restaurants.map(({ restaurantId: C, roleId: P }) => ({
167
- restaurantId: C,
168
- roleId: P
169
- })) : [K()]
170
- };
171
- }
172
- const U = (d) => {
173
- s.value = y(d), p.value = Se(s.value), S.value = d == null ? void 0 : d._id, A.value = [], s.value.passcode ? (A.value = s.value.passcode.split(""), B.value = !0) : B.value = !1, F.value = !d, E.value = !0;
174
- };
175
- function v() {
176
- return {
177
- code: "",
178
- isMasterUser: !1,
179
- name: "",
180
- passcode: "",
181
- restaurants: [K()]
182
- };
183
- }
184
- const I = k(() => F.value ? u("hr.employee.form.add") : u("hr.employee.form.update")), M = k(() => F.value ? u("common.create") : u("common.update")), p = h(v()), s = h(v()), S = h(void 0), T = k(
185
- () => ia(s.value.restaurants)
186
- );
187
- function ne(d) {
188
- var r;
189
- return d ? !((r = f.restaurants.value.find((C) => C._id === d)) != null && r.managable) : !1;
190
- }
191
- function ie(d) {
192
- return d.isUsable;
193
- }
194
- const A = h([]), B = h(!1), W = h(!1), ae = h(!1), ue = k(() => T.value.length > 0);
195
- async function j() {
196
- if (ue.value)
197
- try {
198
- const d = await V.custom(
199
- () => pa.generateEmployeePasscode({
200
- restaurantIds: T.value,
201
- excludePosUserId: S.value
202
- }),
203
- { isLoading: ae }
204
- );
205
- B.value = !1, A.value = d.split(""), s.value.passcode = d;
206
- } catch {
207
- }
208
- }
209
- const J = va(
210
- () => !fa.isEqual(s.value, p.value),
211
- () => {
212
- E.value = !1;
213
- }
214
- );
215
- async function ve() {
216
- const d = {
217
- user: {
218
- name: s.value.name,
219
- passcode: s.value.passcode,
220
- code: s.value.code
221
- },
222
- roles: s.value.restaurants
223
- };
224
- s.value.isMasterUser ? await L.createMasterEmployee(d) : (delete d.user.code, await L.createEmployee(d));
225
- }
226
- async function le() {
227
- var P, z;
228
- const d = p.value, r = S.value, C = {
229
- user: {
230
- name: s.value.name,
231
- passcode: s.value.passcode
232
- },
233
- roles: s.value.restaurants,
234
- previousRoles: (P = d.restaurants) == null ? void 0 : P.map(($) => ({
235
- restaurantId: $.restaurantId,
236
- roleId: $.roleId
237
- }))
238
- };
239
- if (!s.value.isMasterUser)
240
- await L.updateEmployee(r, C);
241
- else {
242
- const $ = {
243
- user: {
244
- name: s.value.name,
245
- passcode: s.value.passcode,
246
- code: s.value.code
247
- },
248
- roles: s.value.restaurants,
249
- previousRoles: (z = d.restaurants) == null ? void 0 : z.map((G) => ({
250
- restaurantId: G.restaurantId,
251
- roleId: G.roleId
252
- }))
253
- };
254
- p.value.isMasterUser ? await L.updateMasterEmployee(r, $) : await L.migrateToMasterUser(r, $);
255
- }
256
- }
257
- async function Q() {
258
- F.value ? await V.minor(
259
- async () => {
260
- await ve();
261
- },
262
- {
263
- successMessage: u("hr.employee.create.successMessage"),
264
- isLoading: W
265
- }
266
- ) : await V.minor(
267
- async () => {
268
- await le();
269
- },
270
- {
271
- successMessage: u("hr.employee.update.successMessage"),
272
- isLoading: W
273
- }
274
- ), ee("submitted"), E.value = !1;
275
- }
276
- return re(
277
- () => E.value,
278
- (d) => {
279
- }
280
- ), Z({
281
- show: E,
282
- trigger: U
283
- }), (d, r) => {
284
- const C = w("FmIcon"), P = w("FmSwitch"), z = w("FmTextField"), $ = w("FmFormGroup"), G = w("fm-button"), de = w("fm-side-sheet");
285
- return b(), O(ke, null, [
286
- je(d.$slots, "default", { trigger: U }),
287
- n(de, {
288
- id: "unit-form",
289
- modelValue: E.value,
290
- "onUpdate:modelValue": r[9] || (r[9] = (o) => E.value = o),
291
- "is-container": t(Me).FmForm,
292
- "is-container-props": {
293
- onValidationSuccess: Q,
294
- blameFormChildOnValidationFailed: !0
295
- },
296
- "max-width": 960,
297
- "close-button": !1,
298
- "onOn:clickedAway": t(J)
299
- }, {
300
- "side-sheet-header": x(() => [
301
- m("div", Ia, [
302
- m("p", Ra, N(I.value), 1),
303
- n(C, {
304
- name: "close",
305
- size: "md",
306
- class: "cursor-pointer",
307
- onClick: t(J)
308
- }, null, 8, ["onClick"])
309
- ])
310
- ]),
311
- "side-sheet-footer": x(() => [
312
- m("div", Sa, [
313
- n(G, {
314
- label: M.value,
315
- size: "lg",
316
- type: "submit",
317
- variant: "primary",
318
- disabled: W.value
319
- }, null, 8, ["label", "disabled"]),
320
- n(G, {
321
- label: t(u)("common.cancel"),
322
- size: "lg",
323
- variant: "tertiary",
324
- disabled: W.value,
325
- onClick: t(J)
326
- }, null, 8, ["label", "disabled", "onClick"])
327
- ])
328
- ]),
329
- default: x(() => [
330
- m("div", Ea, [
331
- n(Ee, {
332
- title: t(u)("hr.employee.form.employeeSetting")
333
- }, {
334
- default: x(() => [
335
- n(Fe, {
336
- label: t(u)("hr.employee.form.masterUserConfig")
337
- }, {
338
- default: x(() => [
339
- n(P, {
340
- modelValue: s.value.isMasterUser,
341
- "onUpdate:modelValue": r[0] || (r[0] = (o) => s.value.isMasterUser = o),
342
- value: "masterUser",
343
- label: t(u)("hr.employee.form.masterUser"),
344
- sublabel: t(u)("hr.employee.form.masterUserSublabel"),
345
- "label-placement": "right"
346
- }, null, 8, ["modelValue", "label", "sublabel"])
347
- ]),
348
- _: 1
349
- }, 8, ["label"]),
350
- m("div", Fa, [
351
- s.value.isMasterUser ? (b(), D(z, {
352
- key: 0,
353
- modelValue: s.value.code,
354
- "onUpdate:modelValue": r[1] || (r[1] = (o) => s.value.code = o),
355
- label: t(u)("hr.employee.form.code")
356
- }, null, 8, ["modelValue", "label"])) : H("", !0),
357
- n(z, {
358
- modelValue: s.value.name,
359
- "onUpdate:modelValue": r[2] || (r[2] = (o) => s.value.name = o),
360
- class: "w-full",
361
- label: t(u)("hr.employee.form.name"),
362
- rules: [(o) => !!o || t(u)("hr.employee.form.required")]
363
- }, null, 8, ["modelValue", "label", "rules"])
364
- ]),
365
- n(Fe, {
366
- label: t(u)("hr.employee.form.passcode")
367
- }, {
368
- default: x(() => [
369
- m("div", Ua, [
370
- n($, {
371
- modelValue: A.value,
372
- "onUpdate:modelValue": r[6] || (r[6] = (o) => A.value = o),
373
- rules: [
374
- (o) => (o == null ? void 0 : o.filter((Y) => !!Y).length) !== Ce ? t(u)("hr.employee.form.passcodeRequired") : !0
375
- ]
376
- }, {
377
- default: x(() => [
378
- n(ua, {
379
- modelValue: A.value,
380
- "onUpdate:modelValue": r[3] || (r[3] = (o) => A.value = o),
381
- masked: B.value,
382
- "onUpdate:masked": r[4] || (r[4] = (o) => B.value = o),
383
- length: Ce,
384
- "toggle-label": t(u)("hr.employee.form.passcodeToggleVisibility"),
385
- onComplete: r[5] || (r[5] = (o) => s.value.passcode = o)
386
- }, null, 8, ["modelValue", "masked", "toggle-label"])
387
- ]),
388
- _: 1
389
- }, 8, ["modelValue", "rules"]),
390
- n(da, {
391
- label: t(u)("hr.employee.form.passcodeGenerate"),
392
- hint: t(u)("hr.employee.form.passcodeSelectOutletFirst"),
393
- loading: ae.value,
394
- disabled: !ue.value,
395
- onClick: j
396
- }, null, 8, ["label", "hint", "loading", "disabled"])
397
- ])
398
- ]),
399
- _: 1
400
- }, 8, ["label"])
401
- ]),
402
- _: 1
403
- }, 8, ["title"]),
404
- n(Ee, null, {
405
- default: x(() => [
406
- n($, {
407
- modelValue: s.value.restaurants,
408
- "onUpdate:modelValue": r[8] || (r[8] = (o) => s.value.restaurants = o),
409
- tag: "div",
410
- rules: [
411
- (o) => o.length > 0 || t(u)("hr.employee.form.atLeastOneRestaurant"),
412
- (o) => o.every((Y) => Y.restaurantId && Y.roleId) || t(u)("hr.employee.form.roleRequired")
413
- ]
414
- }, {
415
- default: x(() => [
416
- n(wa, {
417
- modelValue: s.value.restaurants,
418
- "onUpdate:modelValue": r[7] || (r[7] = (o) => s.value.restaurants = o),
419
- restaurants: t(f).restaurants.value,
420
- roles: t(_).roles.value,
421
- "is-role-usable": ie,
422
- "is-restaurant-locked": ne,
423
- "create-row": K,
424
- title: t(u)("hr.employee.form.assignmentSection"),
425
- "restaurant-label": t(u)("hr.employee.columns.restaurants"),
426
- "role-label": t(u)("hr.employee.form.role"),
427
- "add-label": t(u)("hr.employee.form.addAnother"),
428
- "remove-label": t(u)("common.remove")
429
- }, null, 8, ["modelValue", "restaurants", "roles", "title", "restaurant-label", "role-label", "add-label", "remove-label"])
430
- ]),
431
- _: 1
432
- }, 8, ["modelValue", "rules"])
433
- ]),
434
- _: 1
435
- })
436
- ])
437
- ]),
438
- _: 1
439
- }, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"])
440
- ], 64);
441
- };
442
- }
443
- }), La = {
444
- class: "space-y-8"
445
- }, $a = {
446
- key: 0,
447
- class: "flex w-full items-start justify-between"
448
- }, Ma = {
449
- class: "flex items-start gap-8"
450
- }, Pa = {
451
- class: "flex"
452
- }, Aa = {
453
- key: 1,
454
- class: "space-y-4"
455
- }, Da = {
456
- class: "px-16"
457
- }, Na = {
458
- class: "px-16 flex items-start gap-8"
459
- }, Oa = {
460
- class: "flex h-full flex-col overflow-auto"
461
- }, Ka = {
462
- class: "space-y-4"
463
- }, za = {
464
- class: "fm-typo-en-body-lg-600"
465
- }, Ta = {
466
- key: 0,
467
- class: "mr-4"
468
- }, Ba = {
469
- class: "text-fm-color-typo-secondary"
470
- }, ja = {
471
- class: "line-clamp-2"
472
- }, Ga = {
473
- class: "font-bold"
474
- }, q = 200, qa = /* @__PURE__ */ Ve({
475
- __name: "EmployeeList",
476
- setup(R, {
477
- expose: Z
478
- }) {
479
- const {
480
- t: l
481
- } = Le(), _ = h(), f = Pe(), L = Ae(), X = He(), {
482
- currentBusiness: V,
483
- sessionUser: ee
484
- } = X, u = _e(), E = k(() => L.isLoading.value), F = h(u.roles.value.length === 0);
485
- re(L.restaurants, (e) => {
486
- if (e.length > 0 && f.listEmployees.value.length > 0) {
487
- const a = new Map(e.map((i) => [i._id, i]));
488
- f.listEmployees.value = f.listEmployees.value.map((i) => ({
489
- ...i,
490
- restaurants: i.restaurants.map((g) => {
491
- var te, se;
492
- return {
493
- ...g,
494
- restaurantName: ((te = a.get(g.restaurantId)) == null ? void 0 : te.profile.name) || g.restaurantName,
495
- restaurantCode: ((se = a.get(g.restaurantId)) == null ? void 0 : se.profile.code) ?? void 0
496
- };
497
- })
498
- }));
499
- }
500
- });
501
- const K = k(() => L.restaurants.value.map((e) => ({
502
- label: `${e.profile.code ? `${e.profile.code} - ` : ""}${e.profile.name}`,
503
- value: e._id
504
- }))), y = re(u.roles, (e) => {
505
- if (e.length > 0) {
506
- if (F.value = !1, f.listEmployees.value.length > 0) {
507
- const a = new Map(e.map((i) => [i._id, i.name]));
508
- f.listEmployees.value = f.listEmployees.value.map((i) => ({
509
- ...i,
510
- restaurants: i.restaurants.map((g) => ({
511
- ...g,
512
- roleName: a.get(g.roleId) || g.roleName
513
- }))
514
- }));
515
- }
516
- y();
517
- }
518
- }), U = k(() => f.listEmployees.value), {
519
- searchKey: v
520
- } = Xe(), I = h(""), M = k(() => U.value), p = k(() => f.totalEmployees.value), s = h(1), S = k(() => f.isLoading.value), T = h(!1), ne = k(() => {
521
- var e;
522
- return JSON.stringify({
523
- businessId: ((e = V.value) == null ? void 0 : e._id) ?? "",
524
- search: I.value.trim(),
525
- restaurantIds: [..._.value ?? []].sort(),
526
- roleIds: [...o.value ?? []].sort()
527
- });
528
- }), ie = (e) => {
529
- const a = e.restaurantCode, i = e.restaurantName;
530
- return a ? `${a} - ${i}` : i;
531
- }, A = (e) => e.roleName || "-";
532
- function B(e) {
533
- return [{
534
- label: l("hr.employee.form.update"),
535
- onClick: () => C(e)
536
- }, {
537
- label: l("hr.employee.remove.title"),
538
- onClick: () => z(e),
539
- itemClass: "text-fm-color-typo-error"
540
- }];
541
- }
542
- const W = ({
543
- employee: e,
544
- className: a = ""
545
- }) => n("div", {
546
- class: a,
547
- onClick: (i) => {
548
- i.stopPropagation();
549
- }
550
- }, [n(aa, {
551
- items: B(e)
552
- }, null)]), ae = [{
553
- accessorKey: "code",
554
- size: 100,
555
- header: () => l("hr.employee.columns.code")
556
- }, {
557
- accessorKey: "name",
558
- header: () => l("hr.employee.columns.name"),
559
- enableSorting: !1,
560
- cell(e) {
561
- const a = e.row.original;
562
- return n("div", {
563
- class: "flex items-center gap-8"
564
- }, [n(Me.FmAvatar, {
565
- name: a.name,
566
- initials: ma(a.name),
567
- size: "sm",
568
- class: "shrink-0"
569
- }, null), n("span", {
570
- class: "truncate"
571
- }, [a.name])]);
572
- }
573
- }, {
574
- accessorKey: "restaurants",
575
- align: "center",
576
- header: () => l("hr.employee.columns.restaurants"),
577
- enableSorting: !1,
578
- cell(e) {
579
- return E.value || F.value ? pe(Ue) : e.row.original.restaurants.map((a, i) => {
580
- const g = ie(a);
581
- return pe("div", {
582
- key: a.restaurantId || i
583
- }, (i ? `
584
- ` : "") + g);
585
- });
586
- }
587
- }, {
588
- accessorKey: "assignedRole",
589
- align: "center",
590
- header: () => l("hr.employee.columns.assignedRole"),
591
- enableSorting: !1,
592
- cell(e) {
593
- return E.value || F.value ? pe(Ue, {
594
- width: "120px"
595
- }) : e.row.original.restaurants.map((a, i) => {
596
- const g = A(a);
597
- return pe("div", {
598
- key: a.restaurantId || i
599
- }, (i ? `
600
- ` : "") + g);
601
- });
602
- }
603
- }, {
604
- accessorKey: "since",
605
- header: () => l("hr.employee.columns.since"),
606
- enableSorting: !1
607
- }, {
608
- id: "action",
609
- size: 52,
610
- meta: {
611
- cellClass: "pl-16",
612
- headerContentClass: "-mx-16"
613
- },
614
- cell(e) {
615
- return W({
616
- employee: e.row.original,
617
- className: "flex w-full items-center justify-end"
618
- });
619
- }
620
- }], ue = ({
621
- employee: e
622
- }) => n("div", {
623
- class: "flex flex-col gap-4 grow p-8"
624
- }, [ae.map((a, i) => n("div", {
625
- key: a.id ?? a.accessorKey ?? i,
626
- class: "fm-typo-en-body-md-400 line-clamp-2 w-full"
627
- }, [a.cell ? a.cell({
628
- row: {
629
- original: e
630
- }
631
- }) : e[a.accessorKey]]))]), j = $e(), J = We(), ve = De(j), le = h(!1), Q = h(), d = h();
632
- function r(e) {
633
- const a = e.isRestricted;
634
- return a && j.open({
635
- message: l("hr.employee.cannotUpdateMasterUser", {
636
- name: e.name
637
- }),
638
- type: "error"
639
- }), a;
640
- }
641
- const C = (e) => {
642
- var i;
643
- e && r(e) || (i = d.value) == null || i.trigger(e);
644
- }, {
645
- breakpoints: P
646
- } = Je(), z = (e) => {
647
- r(e) || J.open({
648
- title: l("hr.employee.remove.title"),
649
- message: l("hr.employee.remove.message", {
650
- name: e.name
651
- }),
652
- minWidth: P.value.lg ? 588 : 0,
653
- primaryActions: {
654
- text: l("common.remove"),
655
- close: !1,
656
- variant: "destructive",
657
- isLoading: le
658
- },
659
- secondaryActions: {
660
- text: l("common.cancel"),
661
- close: !0
662
- }
663
- }).onPrimary(async () => {
664
- if (le.value) return;
665
- const i = e.isMasterUser ? f.deleteMasterEmployee : f.deleteEmployee;
666
- await ve.minor(async () => {
667
- await i(e), await ye();
668
- }, {
669
- isLoading: le,
670
- successMessage: l("hr.employee.remove.successMessage", {
671
- name: e.name
672
- })
673
- }).catch(() => {
674
- }), J.close();
675
- });
676
- }, $ = h("");
677
- function G() {
678
- var e;
679
- (e = d.value) == null || e.trigger();
680
- }
681
- const de = k(() => _e().roles.value.map((e) => ({
682
- label: e.name,
683
- value: e._id
684
- }))), o = h();
685
- async function Y() {
686
- try {
687
- await f.syncUsersMeta(), await ye(), j.open({
688
- message: l("hr.employee.sync.successMessage"),
689
- type: "success"
690
- });
691
- } catch (e) {
692
- console.error("Error syncing users:", e), j.open({
693
- message: l("hr.employee.sync.errorMessage"),
694
- type: "error"
695
- });
696
- }
697
- }
698
- async function ce(e = s.value) {
699
- var a, i;
700
- try {
701
- await f.readEmployeesPage({
702
- limit: q,
703
- offset: (e - 1) * q,
704
- search: I.value.trim() || void 0,
705
- restaurantIds: (a = _.value) != null && a.length ? _.value : void 0,
706
- roleIds: (i = o.value) != null && i.length ? o.value : void 0
707
- });
708
- } catch (g) {
709
- console.error("Failed to load employees:", g), j.open({
710
- message: g instanceof Error ? g.message : String(g),
711
- type: "error"
712
- });
713
- }
714
- }
715
- async function ye() {
716
- var a;
717
- if (!((a = V.value) != null && a._id)) return;
718
- await ce(s.value);
719
- const e = Math.max(1, Math.ceil(p.value / q));
720
- s.value > e && (s.value = e, await ce(s.value));
721
- }
722
- async function Ne() {
723
- var e, a;
724
- return await f.readAllEmployeesPage({
725
- search: I.value.trim() || void 0,
726
- restaurantIds: (e = _.value) != null && e.length ? _.value : void 0,
727
- roleIds: (a = o.value) != null && a.length ? o.value : void 0
728
- }, p.value);
729
- }
730
- const Oe = ca(v, () => {
731
- I.value = v.value;
732
- }, 300);
733
- Ge(Oe);
734
- let ge = !1;
735
- async function Ke({
736
- pageIndex: e
737
- }) {
738
- var a;
739
- if ((a = V.value) != null && a._id && !ge && !(e === 0 && s.value === 1 && M.value.length > 0)) {
740
- ge = !0, s.value = e + 1;
741
- try {
742
- await ce(s.value);
743
- } finally {
744
- ge = !1;
745
- }
746
- }
747
- }
748
- re(ne, async () => {
749
- var e;
750
- s.value = 1, T.value = !1, (e = V.value) != null && e._id && (await ce(1), T.value = !0);
751
- }, {
752
- immediate: !0
753
- }), re(() => Q.value && Q.value.restaurants, (e) => {
754
- e && e.length > 0 && ($.value = "");
755
- });
756
- const ze = k(() => p.value > q);
757
- return Z({
758
- create: G,
759
- filteredEmployees: M,
760
- exportEmployees: Ne,
761
- getHasPaginationFooter: () => ze.value
762
- }), (e, a) => {
763
- var xe, we;
764
- const i = w("FmButton"), g = w("FmTooltip"), te = w("FmSearch"), se = w("FmListItem"), Te = w("FmTable");
765
- return b(), O(ke, null, [n(Ca, {
766
- ref_key: "employeeFormRef",
767
- ref: d,
768
- modelValue: Q.value,
769
- "onUpdate:modelValue": a[0] || (a[0] = (c) => Q.value = c),
770
- "role-error-message": $.value,
771
- class: "gap-8",
772
- onSubmitted: ye
773
- }, null, 8, ["modelValue", "role-error-message"]), m("div", La, [t(P).xs ? (b(), O("div", Aa, [m("div", Da, [n(te, {
774
- modelValue: t(v),
775
- "onUpdate:modelValue": a[4] || (a[4] = (c) => Re(v) ? v.value = c : null),
776
- placeholder: t(l)("hr.employee.search.placeholder")
777
- }, null, 8, ["modelValue", "placeholder"])]), n(ea), m("div", Na, [n(fe, {
778
- modelValue: _.value,
779
- "onUpdate:modelValue": a[5] || (a[5] = (c) => _.value = c),
780
- multiple: "",
781
- items: K.value,
782
- variant: "dark",
783
- "selected-prefix": t(l)("hr.role.columns.restaurants"),
784
- placeholder: t(l)("hr.role.columns.restaurants"),
785
- class: "!w-auto"
786
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), n(fe, {
787
- modelValue: o.value,
788
- "onUpdate:modelValue": a[6] || (a[6] = (c) => o.value = c),
789
- multiple: "",
790
- items: de.value,
791
- variant: "dark",
792
- "selected-prefix": t(l)("hr.employee.filter.selected_role_prefix"),
793
- placeholder: t(l)("hr.employee.filter.role_placeholder")
794
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])])) : (b(), O("div", $a, [m("div", Ma, [n(fe, {
795
- modelValue: _.value,
796
- "onUpdate:modelValue": a[1] || (a[1] = (c) => _.value = c),
797
- multiple: "",
798
- items: K.value,
799
- variant: "dark",
800
- "selected-prefix": t(l)("hr.role.columns.restaurants"),
801
- placeholder: t(l)("hr.role.columns.restaurants"),
802
- class: "!w-auto"
803
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"]), n(fe, {
804
- modelValue: o.value,
805
- "onUpdate:modelValue": a[2] || (a[2] = (c) => o.value = c),
806
- multiple: "",
807
- variant: "dark",
808
- items: de.value,
809
- "selected-prefix": t(l)("hr.employee.filter.selected_role_prefix"),
810
- placeholder: t(l)("hr.employee.filter.role_placeholder")
811
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]), m("div", Pa, [(xe = t(ee)) != null && xe.role.isAdmin ? (b(), D(g, {
812
- key: 0,
813
- content: t(l)("hr.employee.sync.tooltip")
814
- }, {
815
- default: x(() => [n(i, {
816
- icon: "refresh",
817
- label: t(l)("hr.employee.sync.tooltip"),
818
- variant: "tertiary",
819
- onClick: Y
820
- }, null, 8, ["label"])]),
821
- _: 1
822
- }, 8, ["content"])) : H("", !0), n(te, {
823
- modelValue: t(v),
824
- "onUpdate:modelValue": a[3] || (a[3] = (c) => Re(v) ? v.value = c : null),
825
- autofocus: "",
826
- class: "pl-4 w-[320px]",
827
- placeholder: t(l)("hr.employee.search.placeholder")
828
- }, null, 8, ["modelValue", "placeholder"])])])), (we = t(V)) != null && we._id ? (b(), D(Qe, {
829
- key: 2
830
- }, {
831
- default: x(() => [m("div", Oa, [!T.value && t(f).isLoading.value ? (b(), D(Ye, {
832
- key: 0
833
- })) : H("", !0), T.value ? (b(), D(la, {
834
- key: 1,
835
- "is-loading": t(f).isLoading.value,
836
- "is-empty": p.value === 0,
837
- title: t(l)("hr.employee.noData.title"),
838
- subtitle: t(l)("hr.employee.noData.subtitle")
839
- }, {
840
- default: x(() => [(b(), D(Te, {
841
- key: ne.value,
842
- class: be(["employee-list-table h-full", {
843
- "employee-list-table--pagination-loading": S.value
844
- }]),
845
- "column-defs": ae,
846
- "row-data": M.value,
847
- "page-size": q,
848
- "page-count": Math.ceil(p.value / q),
849
- "row-count": p.value,
850
- "fetch-fn": Ke,
851
- "hide-footer": p.value <= q,
852
- loading: t(f).isLoading.value,
853
- virtual: !1,
854
- "pin-header-row": "",
855
- onRowClick: a[7] || (a[7] = (c) => C(c.original))
856
- }, {
857
- "list-row": x((c) => [t(P).xs ? (b(), D(se, {
858
- key: 0,
859
- class: be(["py-12 px-16 items-center justify-between", {
860
- "border-t border-fm-color-neutral-gray-100": c.index > 0
861
- }]),
862
- onClick: (me) => C(c.original)
863
- }, {
864
- default: x(() => [m("div", Ka, [m("p", za, [c.original.code ? (b(), O("span", Ta, N(c.original.code) + ".", 1)) : H("", !0), he(N(c.original.name), 1)]), m("div", Ba, [m("p", ja, [m("span", Ga, N(t(l)("hr.employee.columns.restaurants")) + ":", 1), he(" " + N(c.original.restaurants.map((me) => ie(me)).join(", ")), 1)]), m("p", null, [a[8] || (a[8] = m("span", {
865
- class: "font-bold"
866
- }, "Since:", -1)), he(" " + N(c.original.since), 1)])])]), n(i, {
867
- icon: "delete",
868
- variant: "tertiary",
869
- "text-color": "neutral-gray-400",
870
- onClick: oe((me) => z(c.original), ["stop"])
871
- }, null, 8, ["onClick"])]),
872
- _: 2
873
- }, 1032, ["class", "onClick"])) : (b(), D(se, {
874
- key: 1,
875
- style: {
876
- padding: "0"
877
- },
878
- onClick: (me) => C(c.original)
879
- }, {
880
- default: x(() => [(b(), D(qe(ue), {
881
- employee: c.original
882
- }, null, 8, ["employee"]))]),
883
- _: 2
884
- }, 1032, ["onClick"]))]),
885
- _: 1
886
- }, 8, ["class", "row-data", "page-count", "row-count", "hide-footer", "loading"]))]),
887
- _: 1
888
- }, 8, ["is-loading", "is-empty", "title", "subtitle"])) : H("", !0)])]),
889
- _: 1
890
- })) : H("", !0)])], 64);
891
- };
892
- }
893
- }), ml = /* @__PURE__ */ Ze(qa, [["__scopeId", "data-v-5aed0d1c"]]);
894
- export {
895
- ml as default
896
- };