@feedmepos/mf-hrm-portal 2.0.12 → 2.0.13

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 (25) hide show
  1. package/dist/{AuditLogList-Bd00VQx_.js → AuditLogList-BRLWRnMw.js} +4 -4
  2. package/dist/{EmployeeList-CK7KmG5w.js → EmployeeList-CaZN66DH.js} +171 -168
  3. package/dist/{Main-BlREdQ9j.js → Main-CFRwFhOp.js} +9 -9
  4. package/dist/{Main-B_8kCVUX.js → Main-DDJqYruE.js} +4 -4
  5. package/dist/{Main-DkBOgy7G.js → Main-DX6DtLSq.js} +5 -5
  6. package/dist/{PermissionSetList-DfDMzjya.js → PermissionSetList-CfKgOGUa.js} +5 -5
  7. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Akov0s-D.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CANjzJpE.js} +855 -855
  8. package/dist/{RoleList-BxXhMLc4.js → RoleList-DVW9rJKE.js} +7 -7
  9. package/dist/{TeamMemberList--YzyKgRn.js → TeamMemberList-CZDwbZVL.js} +322 -319
  10. package/dist/{TimesheetList-K8CKfOu5.js → TimesheetList-DMuID6CQ.js} +7 -7
  11. package/dist/{app-CDx8kP2V.js → app-jGOQVOD0.js} +4 -4
  12. package/dist/app.js +1 -1
  13. package/dist/{dayjs.min-SNComb-n.js → dayjs.min-D2KkLYBN.js} +1 -1
  14. package/dist/{employee-CGtCzQdZ.js → employee-Bh77woAn.js} +4 -4
  15. package/dist/{index-qJ7dWPV1.js → index-BpdsYZQZ.js} +2 -2
  16. package/dist/{index-Ctx7lXyr.js → index-DNRSCsVp.js} +1 -1
  17. package/dist/{iteration-Df2doI7u.js → iteration-iewRosUH.js} +1 -1
  18. package/dist/{lodash--VoFIg3j.js → lodash-BuzCumRN.js} +1 -1
  19. package/dist/style.css +1 -1
  20. package/dist/{timesheet-C8L7eQVO.js → timesheet-D-fS5DjW.js} +3 -3
  21. package/dist/tsconfig.app.tsbuildinfo +1 -1
  22. package/dist/{useAppStore-FR1TO4HT.js → useAppStore-RlI38pvN.js} +1 -1
  23. package/dist/{useLoading-CKrnW2DY.js → useLoading-CJnGoe22.js} +1 -1
  24. package/dist/{useReportPermissions-BeiN0ZNJ.js → useReportPermissions-CwzEzTF1.js} +3 -3
  25. package/package.json +1 -1
@@ -1,18 +1,18 @@
1
- import { toRaw as Oe, defineComponent as Se, ref as p, computed as _, watch as ye, resolveComponent as f, createElementBlock as A, openBlock as F, Fragment as Y, renderSlot as Ne, createVNode as n, unref as t, withCtx as V, createElementVNode as c, createBlock as O, createCommentVNode as T, isRef as he, renderList as Ue, toDisplayString as Q, onUnmounted as Be, withDirectives as Te, h as fe, normalizeClass as Ae, vShow as ze, createTextVNode as Ke, withModifiers as Ge } from "vue";
1
+ import { toRaw as De, defineComponent as Se, ref as p, computed as _, watch as ye, resolveComponent as f, createElementBlock as A, openBlock as w, Fragment as Y, renderSlot as Ne, createVNode as n, unref as t, withCtx as F, createElementVNode as c, createBlock as D, createCommentVNode as N, isRef as he, renderList as Ue, toDisplayString as Q, onUnmounted as Be, h as fe, normalizeClass as Te, createTextVNode as Ae, withModifiers as ze } from "vue";
2
2
  import { useCoreStore as ke, useI18n as Ie, RestaurantSelector as _e } from "@feedmepos/mf-common";
3
- import { useSnackbar as Ce, components as Me, useDialog as je, useBreakpoints as qe, FmButtonVariant as He } from "@feedmepos/ui-library";
4
- import { S as be, _ as Je } from "./SelectFilter-DUj7GBtT.js";
5
- import { _ as We } from "./app-CDx8kP2V.js";
6
- import { H as Qe } from "./HorizontalSplitter-o860F4xM.js";
7
- import { _ as Ye } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
3
+ import { useSnackbar as Ce, components as Me, useDialog as Ke, useBreakpoints as Ge, FmButtonVariant as je } from "@feedmepos/ui-library";
4
+ import { S as be, _ as qe } from "./SelectFilter-DUj7GBtT.js";
5
+ import { _ as He } from "./app-jGOQVOD0.js";
6
+ import { H as Je } from "./HorizontalSplitter-o860F4xM.js";
7
+ import { _ as We } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
8
8
  import { u as Re } from "./useSearch-B6WK1LBB.js";
9
- import { u as Ze } from "./useDebounce-B8ZPVS5C.js";
10
- import { u as Le, E as Xe } from "./employee-CGtCzQdZ.js";
11
- import { l as el } from "./lodash--VoFIg3j.js";
9
+ import { u as Qe } from "./useDebounce-B8ZPVS5C.js";
10
+ import { u as Le, E as Ye } from "./employee-Bh77woAn.js";
11
+ import { l as Ze } from "./lodash-BuzCumRN.js";
12
12
  import { _ as Ve, a as Fe } from "./FormSection.vue_vue_type_script_setup_true_lang-BVb8c4YU.js";
13
- import { u as ll, a as al } from "./useRestaurantMap-e9fQJiLC.js";
14
- import { u as Pe } from "./useLoading-CKrnW2DY.js";
15
- import { u as $e } from "./useAppStore-FR1TO4HT.js";
13
+ import { u as Xe, a as el } from "./useRestaurantMap-e9fQJiLC.js";
14
+ import { u as Pe } from "./useLoading-CJnGoe22.js";
15
+ import { u as $e } from "./useAppStore-RlI38pvN.js";
16
16
  /* empty css */
17
17
  function we(P) {
18
18
  return JSON.parse(JSON.stringify(P));
@@ -21,12 +21,12 @@ function xe(P) {
21
21
  if (typeof structuredClone > "u")
22
22
  return we(P);
23
23
  try {
24
- return structuredClone(Oe(P));
24
+ return structuredClone(De(P));
25
25
  } catch {
26
26
  return we(P);
27
27
  }
28
28
  }
29
- const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, ol = { class: "flex flex-row gap-16" }, rl = { class: "space-y-16" }, nl = { class: "flex gap-8 items-center justify-start" }, Ee = 4, ul = /* @__PURE__ */ Se({
29
+ const ll = { class: "fm-typo-en-title-md-600" }, al = { class: "space-y-40" }, tl = { class: "flex flex-row gap-16" }, sl = { class: "space-y-16" }, ol = { class: "flex gap-8 items-center justify-start" }, Ee = 4, rl = /* @__PURE__ */ Se({
30
30
  __name: "EmployeeForm",
31
31
  props: {
32
32
  roleErrorMessage: {
@@ -36,8 +36,8 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
36
36
  },
37
37
  emits: ["submitted"],
38
38
  setup(P, { expose: oe, emit: d }) {
39
- const w = $e(), h = ke(), I = Le(), re = Ce(), Z = Pe(re), C = d, { t: u } = Ie(), x = p(!1), E = p(!0), U = (e) => {
40
- s.value = e ? xe(e) : z(), $.value = xe(s.value), k.value = [], S.value = s.value.restaurants.map((l) => l.restaurantId), s.value.passcode && (k.value = s.value.passcode.split(""), y.value = !0), E.value = !e, x.value = !0;
39
+ const x = $e(), h = ke(), k = Le(), re = Ce(), Z = Pe(re), C = d, { t: u } = Ie(), b = p(!1), E = p(!0), S = (e) => {
40
+ s.value = e ? xe(e) : z(), $.value = xe(s.value), I.value = [], U.value = s.value.restaurants.map((l) => l.restaurantId), s.value.passcode && (I.value = s.value.passcode.split(""), y.value = !0), E.value = !e, b.value = !0;
41
41
  };
42
42
  function z() {
43
43
  return {
@@ -48,9 +48,9 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
48
48
  restaurants: []
49
49
  };
50
50
  }
51
- const X = _(() => E.value ? u("hr.employee.form.add") : u("hr.employee.form.update")), ne = _(() => E.value ? u("common.create") : u("common.update")), $ = p(z()), s = p(z()), { searchKey: R, filter: ee } = Re(), ue = _(() => {
51
+ const X = _(() => E.value ? u("hr.employee.form.add") : u("hr.employee.form.update")), ne = _(() => E.value ? u("common.create") : u("common.update")), $ = p(z()), s = p(z()), { searchKey: L, filter: ee } = Re(), ue = _(() => {
52
52
  const e = {};
53
- return w.roles.value.forEach((l) => {
53
+ return x.roles.value.forEach((l) => {
54
54
  e[l._id] = l.name;
55
55
  }), e;
56
56
  });
@@ -58,8 +58,8 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
58
58
  const l = le(e) ?? "";
59
59
  return ue.value[l] || "";
60
60
  }
61
- const M = _(() => h.restaurants.value.filter(({ _id: l, profile: r, managable: m }) => m ? ee([r.code, r.name, K(l)]) : S.value.includes(l)).map(({ _id: l, profile: r, managable: m }) => {
62
- const g = w.roles.value.filter((v) => v.restaurants.some((b) => b.id == l)).map((v) => ({
61
+ const M = _(() => h.restaurants.value.filter(({ _id: l, profile: r, managable: m }) => m ? ee([r.code, r.name, K(l)]) : U.value.includes(l)).map(({ _id: l, profile: r, managable: m }) => {
62
+ const g = x.roles.value.filter((v) => v.restaurants.some((V) => V.id == l)).map((v) => ({
63
63
  label: v.name,
64
64
  value: v._id,
65
65
  disabled: !v.isUsable
@@ -83,15 +83,15 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
83
83
  roleId: l
84
84
  }
85
85
  ];
86
- }, S = p(s.value.restaurants.map((e) => e.restaurantId)), j = _(
87
- () => S.value.filter(
86
+ }, U = p(s.value.restaurants.map((e) => e.restaurantId)), j = _(
87
+ () => U.value.filter(
88
88
  (e) => M.value.some((l) => l.value === e && !l.disabled)
89
89
  )
90
90
  ), q = _(() => {
91
91
  const e = M.value.filter((l) => !l.disabled).length;
92
92
  return e > 0 && e === j.value.length;
93
93
  }), te = () => {
94
- const e = S.value.filter((l) => !j.value.includes(l));
94
+ const e = U.value.filter((l) => !j.value.includes(l));
95
95
  if (q.value === !0)
96
96
  H(e);
97
97
  else {
@@ -99,38 +99,38 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
99
99
  H([...l, ...e]);
100
100
  }
101
101
  }, H = (e) => {
102
- S.value = e, s.value.restaurants = e.map((l) => {
102
+ U.value = e, s.value.restaurants = e.map((l) => {
103
103
  var g, v;
104
- const r = M.value.find((b) => b.value === l);
104
+ const r = M.value.find((V) => V.value === l);
105
105
  if (r != null && r.disabled)
106
- return s.value.restaurants.find((b) => b.restaurantId === l) ?? {
106
+ return s.value.restaurants.find((V) => V.restaurantId === l) ?? {
107
107
  restaurantId: l,
108
108
  roleId: ""
109
109
  };
110
- const m = ((g = r == null ? void 0 : r.roleOptions.find((b) => !b.disabled)) == null ? void 0 : g.value) || "";
110
+ const m = ((g = r == null ? void 0 : r.roleOptions.find((V) => !V.disabled)) == null ? void 0 : g.value) || "";
111
111
  return {
112
112
  restaurantId: l,
113
- roleId: ((v = s.value.restaurants.find((b) => b.restaurantId === l)) == null ? void 0 : v.roleId) || m
113
+ roleId: ((v = s.value.restaurants.find((V) => V.restaurantId === l)) == null ? void 0 : v.roleId) || m
114
114
  };
115
115
  });
116
- }, k = p([]), y = p(!1);
116
+ }, I = p([]), y = p(!1);
117
117
  function ie() {
118
- y.value && (y.value = !1, k.value = []);
118
+ y.value && (y.value = !1, I.value = []);
119
119
  }
120
- const L = p(!1), D = p(!1);
120
+ const R = p(!1), O = p(!1);
121
121
  async function de() {
122
- D.value = !0;
122
+ O.value = !0;
123
123
  try {
124
- const e = await Xe.generateEmployeePasscode();
125
- y.value = !1, k.value = e.split("");
124
+ const e = await Ye.generateEmployeePasscode();
125
+ y.value = !1, I.value = e.split("");
126
126
  } finally {
127
- D.value = !1;
127
+ O.value = !1;
128
128
  }
129
129
  }
130
- const ce = ll(
131
- () => !el.isEqual(s.value, $.value),
130
+ const ce = Xe(
131
+ () => !Ze.isEqual(s.value, $.value),
132
132
  () => {
133
- x.value = !1;
133
+ b.value = !1;
134
134
  }
135
135
  );
136
136
  async function J() {
@@ -142,7 +142,7 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
142
142
  },
143
143
  roles: s.value.restaurants
144
144
  };
145
- s.value.isMasterUser ? await I.createMasterEmployee(e) : (delete e.user.code, await I.createEmployee(e));
145
+ s.value.isMasterUser ? await k.createMasterEmployee(e) : (delete e.user.code, await k.createEmployee(e));
146
146
  }
147
147
  async function me() {
148
148
  var r, m;
@@ -158,7 +158,7 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
158
158
  }))
159
159
  };
160
160
  if (!s.value.isMasterUser)
161
- await I.updateEmployee(e._id, l);
161
+ await k.updateEmployee(e._id, l);
162
162
  else {
163
163
  const g = {
164
164
  user: {
@@ -172,7 +172,7 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
172
172
  roleId: v.roleId
173
173
  }))
174
174
  };
175
- $.value.isMasterUser ? await I.updateMasterEmployee(e._id, g) : await I.migrateToMasterUser(e._id, g);
175
+ $.value.isMasterUser ? await k.updateMasterEmployee(e._id, g) : await k.migrateToMasterUser(e._id, g);
176
176
  }
177
177
  }
178
178
  async function a() {
@@ -182,7 +182,7 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
182
182
  },
183
183
  {
184
184
  successMessage: u("hr.employee.create.successMessage"),
185
- isLoading: L
185
+ isLoading: R
186
186
  }
187
187
  ) : await Z.minor(
188
188
  async () => {
@@ -190,25 +190,25 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
190
190
  },
191
191
  {
192
192
  successMessage: u("hr.employee.update.successMessage"),
193
- isLoading: L
193
+ isLoading: R
194
194
  }
195
- ), C("submitted"), x.value = !1;
195
+ ), C("submitted"), b.value = !1;
196
196
  }
197
197
  return ye(
198
- () => x.value,
198
+ () => b.value,
199
199
  (e) => {
200
200
  }
201
201
  ), oe({
202
- show: x,
203
- trigger: U
202
+ show: b,
203
+ trigger: S
204
204
  }), (e, l) => {
205
- const r = f("FmSwitch"), m = f("FmTextField"), g = f("FmPinField"), v = f("FmFormGroup"), b = f("FmButton"), se = f("FmSearch"), W = f("FmCheckbox"), i = f("FmSelect"), N = f("fm-button"), De = f("fm-side-sheet");
206
- return F(), A(Y, null, [
207
- Ne(e.$slots, "default", { trigger: U }),
208
- n(De, {
205
+ const r = f("FmSwitch"), m = f("FmTextField"), g = f("FmPinField"), v = f("FmFormGroup"), V = f("FmButton"), se = f("FmSearch"), W = f("FmCheckbox"), i = f("FmSelect"), B = f("fm-button"), Oe = f("fm-side-sheet");
206
+ return w(), A(Y, null, [
207
+ Ne(e.$slots, "default", { trigger: S }),
208
+ n(Oe, {
209
209
  id: "unit-form",
210
- modelValue: x.value,
211
- "onUpdate:modelValue": l[9] || (l[9] = (o) => x.value = o),
210
+ modelValue: b.value,
211
+ "onUpdate:modelValue": l[9] || (l[9] = (o) => b.value = o),
212
212
  "is-container": t(Me).FmForm,
213
213
  "is-container-props": {
214
214
  onValidationSuccess: a,
@@ -217,37 +217,37 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
217
217
  "max-width": 560,
218
218
  "onOn:clickedAway": t(ce)
219
219
  }, {
220
- "side-sheet-header": V(() => [
221
- c("p", tl, Q(X.value), 1)
220
+ "side-sheet-header": F(() => [
221
+ c("p", ll, Q(X.value), 1)
222
222
  ]),
223
- "side-sheet-footer": V(() => [
224
- c("div", nl, [
225
- n(N, {
223
+ "side-sheet-footer": F(() => [
224
+ c("div", ol, [
225
+ n(B, {
226
226
  label: ne.value,
227
227
  size: "lg",
228
228
  type: "submit",
229
229
  variant: "primary",
230
- disabled: L.value
230
+ disabled: R.value
231
231
  }, null, 8, ["label", "disabled"]),
232
- n(N, {
232
+ n(B, {
233
233
  label: t(u)("common.cancel"),
234
234
  size: "lg",
235
235
  variant: "tertiary",
236
- disabled: L.value,
237
- onClick: l[8] || (l[8] = () => x.value = !1)
236
+ disabled: R.value,
237
+ onClick: l[8] || (l[8] = () => b.value = !1)
238
238
  }, null, 8, ["label", "disabled"])
239
239
  ])
240
240
  ]),
241
- default: V(() => [
242
- c("div", sl, [
241
+ default: F(() => [
242
+ c("div", al, [
243
243
  n(Ve, {
244
244
  title: t(u)("hr.employee.form.employeeSetting")
245
245
  }, {
246
- default: V(() => [
246
+ default: F(() => [
247
247
  n(Fe, {
248
248
  label: t(u)("hr.employee.form.masterUserConfig")
249
249
  }, {
250
- default: V(() => [
250
+ default: F(() => [
251
251
  n(r, {
252
252
  modelValue: s.value.isMasterUser,
253
253
  "onUpdate:modelValue": l[0] || (l[0] = (o) => s.value.isMasterUser = o),
@@ -259,13 +259,13 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
259
259
  ]),
260
260
  _: 1
261
261
  }, 8, ["label"]),
262
- c("div", ol, [
263
- s.value.isMasterUser ? (F(), O(m, {
262
+ c("div", tl, [
263
+ s.value.isMasterUser ? (w(), D(m, {
264
264
  key: 0,
265
265
  modelValue: s.value.code,
266
266
  "onUpdate:modelValue": l[1] || (l[1] = (o) => s.value.code = o),
267
267
  label: t(u)("hr.employee.form.code")
268
- }, null, 8, ["modelValue", "label"])) : T("", !0),
268
+ }, null, 8, ["modelValue", "label"])) : N("", !0),
269
269
  n(m, {
270
270
  modelValue: s.value.name,
271
271
  "onUpdate:modelValue": l[2] || (l[2] = (o) => s.value.name = o),
@@ -277,19 +277,19 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
277
277
  n(Fe, {
278
278
  label: t(u)("hr.employee.form.passcode")
279
279
  }, {
280
- default: V(() => [
281
- c("div", rl, [
280
+ default: F(() => [
281
+ c("div", sl, [
282
282
  n(v, {
283
- modelValue: k.value,
284
- "onUpdate:modelValue": l[5] || (l[5] = (o) => k.value = o),
283
+ modelValue: I.value,
284
+ "onUpdate:modelValue": l[5] || (l[5] = (o) => I.value = o),
285
285
  rules: [
286
286
  (o) => (o == null ? void 0 : o.filter((pe) => !!pe).length) !== Ee ? t(u)("hr.employee.form.passcodeRequired") : !0
287
287
  ]
288
288
  }, {
289
- default: V(() => [
289
+ default: F(() => [
290
290
  n(g, {
291
- modelValue: k.value,
292
- "onUpdate:modelValue": l[3] || (l[3] = (o) => k.value = o),
291
+ modelValue: I.value,
292
+ "onUpdate:modelValue": l[3] || (l[3] = (o) => I.value = o),
293
293
  length: Ee,
294
294
  masked: y.value,
295
295
  onComplete: l[4] || (l[4] = (o) => s.value.passcode = o),
@@ -298,13 +298,13 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
298
298
  ]),
299
299
  _: 1
300
300
  }, 8, ["modelValue", "rules"]),
301
- n(b, {
301
+ n(V, {
302
302
  variant: "secondary",
303
303
  "text-color": "primary",
304
304
  "border-color": "primary",
305
305
  label: t(u)("hr.employee.form.passcodeGenerate"),
306
306
  size: "md",
307
- loading: D.value,
307
+ loading: O.value,
308
308
  onClick: de
309
309
  }, null, 8, ["label", "loading"])
310
310
  ])
@@ -317,18 +317,18 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
317
317
  n(Ve, {
318
318
  title: t(u)("hr.employee.form.role")
319
319
  }, {
320
- default: V(() => [
320
+ default: F(() => [
321
321
  n(se, {
322
- modelValue: t(R),
323
- "onUpdate:modelValue": l[6] || (l[6] = (o) => he(R) ? R.value = o : null),
322
+ modelValue: t(L),
323
+ "onUpdate:modelValue": l[6] || (l[6] = (o) => he(L) ? L.value = o : null),
324
324
  placeholder: t(u)("hr.restaurant.search.placeholder")
325
325
  }, null, 8, ["modelValue", "placeholder"]),
326
326
  n(v, {
327
- modelValue: S.value,
328
- "onUpdate:modelValue": l[7] || (l[7] = (o) => S.value = o),
327
+ modelValue: U.value,
328
+ "onUpdate:modelValue": l[7] || (l[7] = (o) => U.value = o),
329
329
  rules: [(o) => o.length > 0 || t(u)("hr.employee.form.atLeastOneRestaurant")]
330
330
  }, {
331
- default: V(() => [
331
+ default: F(() => [
332
332
  n(W, {
333
333
  "model-value": q.value,
334
334
  label: t(u)("hr.employee.form.all"),
@@ -336,17 +336,17 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
336
336
  indeterminate: j.value.length > 0,
337
337
  "onUpdate:modelValue": te
338
338
  }, null, 8, ["model-value", "label", "indeterminate"]),
339
- (F(!0), A(Y, null, Ue(M.value, (o, pe) => {
339
+ (w(!0), A(Y, null, Ue(M.value, (o, pe) => {
340
340
  var ge;
341
- return F(), A(Y, { key: pe }, [
341
+ return w(), A(Y, { key: pe }, [
342
342
  n(W, {
343
- "model-value": S.value,
343
+ "model-value": U.value,
344
344
  label: o.label,
345
345
  value: o.value,
346
346
  disabled: o.disabled,
347
347
  "onUpdate:modelValue": H
348
348
  }, null, 8, ["model-value", "label", "value", "disabled"]),
349
- S.value.includes(o.value) ? (F(), O(i, {
349
+ U.value.includes(o.value) ? (w(), D(i, {
350
350
  key: 0,
351
351
  class: "ml-32 mr-8",
352
352
  items: o.roleOptions,
@@ -355,7 +355,7 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
355
355
  placeholder: ((ge = o.roleOptions.find((ve) => !ve.disabled) ?? o.roleOptions[0]) == null ? void 0 : ge.label) ?? "",
356
356
  disabled: o.disabled,
357
357
  "onUpdate:modelValue": (ve) => ae(o.value, ve)
358
- }, null, 8, ["items", "model-value", "placeholder", "disabled", "onUpdate:modelValue"])) : T("", !0)
358
+ }, null, 8, ["items", "model-value", "placeholder", "disabled", "onUpdate:modelValue"])) : N("", !0)
359
359
  ], 64);
360
360
  }), 128))
361
361
  ]),
@@ -371,54 +371,54 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
371
371
  ], 64);
372
372
  };
373
373
  }
374
- }), il = {
374
+ }), nl = {
375
375
  class: "space-y-8"
376
- }, dl = {
376
+ }, ul = {
377
377
  class: "xs:hidden flex w-full items-start justify-between"
378
- }, cl = {
378
+ }, il = {
379
379
  class: "flex items-start gap-8"
380
- }, ml = {
380
+ }, dl = {
381
381
  class: "flex"
382
- }, pl = {
382
+ }, cl = {
383
383
  class: "space-y-4 sm:hidden md:hidden lg:hidden"
384
- }, vl = {
384
+ }, ml = {
385
385
  class: "px-16"
386
- }, fl = {
386
+ }, pl = {
387
387
  class: "px-16 flex items-start gap-8"
388
- }, yl = {
388
+ }, vl = {
389
389
  class: "flex h-full flex-col overflow-auto"
390
- }, hl = {
390
+ }, fl = {
391
391
  class: "pb-64 sm:hidden md:hidden lg:hidden"
392
- }, gl = {
392
+ }, yl = {
393
393
  class: "space-y-4"
394
- }, _l = {
394
+ }, hl = {
395
395
  class: "fm-typo-en-body-lg-600"
396
- }, bl = {
396
+ }, gl = {
397
397
  key: 0,
398
398
  class: "mr-4"
399
- }, Vl = {
399
+ }, _l = {
400
400
  class: "text-fm-color-typo-secondary"
401
- }, B = 200, Fl = /* @__PURE__ */ Se({
401
+ }, T = 200, bl = /* @__PURE__ */ Se({
402
402
  __name: "EmployeeList",
403
403
  setup(P, {
404
404
  expose: oe
405
405
  }) {
406
406
  const {
407
407
  t: d
408
- } = Ie(), w = p(), h = Le(), {
409
- currentBusiness: I,
408
+ } = Ie(), x = p(), h = Le(), {
409
+ currentBusiness: k,
410
410
  sessionUser: re
411
411
  } = ke(), Z = _(() => h.listEmployees.value), {
412
412
  searchKey: C
413
- } = Re(""), u = p(""), x = _(() => Z.value), E = _(() => h.totalEmployees.value), U = p(1), z = _(() => h.isLoading.value), X = _(() => {
413
+ } = Re(""), u = p(""), b = _(() => Z.value), E = _(() => h.totalEmployees.value), S = p(1), z = _(() => h.isLoading.value), X = _(() => {
414
414
  var a;
415
415
  return JSON.stringify({
416
- businessId: ((a = I.value) == null ? void 0 : a._id) ?? "",
416
+ businessId: ((a = k.value) == null ? void 0 : a._id) ?? "",
417
417
  search: u.value.trim(),
418
- restaurantIds: [...w.value ?? []].sort(),
418
+ restaurantIds: [...x.value ?? []].sort(),
419
419
  roleIds: [...y.value ?? []].sort()
420
420
  });
421
- }), ne = al(), $ = (a) => {
421
+ }), ne = el(), $ = (a) => {
422
422
  const e = ne.value[a.restaurantId], l = e == null ? void 0 : e.profile.code;
423
423
  let m = a.restaurantName || (e == null ? void 0 : e.profile.name) || "";
424
424
  return a.roleName && (m = `${l ? l + " - " : ""}${m} (${a.roleName})`), m;
@@ -457,28 +457,28 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
457
457
  class: "w-full flex justify-end items-center"
458
458
  }, [fe(Me.FmButton, {
459
459
  prependIcon: "delete",
460
- variant: He.Tertiary,
460
+ variant: je.Tertiary,
461
461
  textColor: "neutral-gray-400",
462
462
  onClick: (e) => {
463
463
  e.stopPropagation(), q(a.row.original);
464
464
  }
465
465
  })])
466
- }], R = Ce(), ee = je(), ue = Pe(R), K = p(!1), M = p(), G = p(), le = _(() => h.restrictEmployeeIds.value);
466
+ }], L = Ce(), ee = Ke(), ue = Pe(L), K = p(!1), M = p(), G = p(), le = _(() => h.restrictEmployeeIds.value);
467
467
  function ae(a) {
468
468
  const e = le.value.includes(a._id);
469
- return e && R.open({
469
+ return e && L.open({
470
470
  message: d("hr.employee.cannotUpdateMasterUser", {
471
471
  name: a.name
472
472
  }),
473
473
  type: "error"
474
474
  }), e;
475
475
  }
476
- const S = (a) => {
476
+ const U = (a) => {
477
477
  var l;
478
478
  a && ae(a) || (l = G.value) == null || l.trigger(a);
479
479
  }, {
480
480
  breakpoints: j
481
- } = qe(), q = (a) => {
481
+ } = Ge(), q = (a) => {
482
482
  ae(a) || ee.open({
483
483
  title: d("hr.employee.remove.title"),
484
484
  message: d("hr.employee.remove.message", {
@@ -499,7 +499,7 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
499
499
  if (K.value) return;
500
500
  const l = a.isMasterUser ? h.deleteMasterEmployee : h.deleteEmployee;
501
501
  await ue.minor(async () => {
502
- await l(a), await D();
502
+ await l(a), await O();
503
503
  }, {
504
504
  isLoading: K,
505
505
  successMessage: d("hr.employee.remove.successMessage", {
@@ -513,49 +513,49 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
513
513
  var a;
514
514
  (a = G.value) == null || a.trigger();
515
515
  }
516
- const k = _(() => $e().roles.value.map((a) => ({
516
+ const I = _(() => $e().roles.value.map((a) => ({
517
517
  label: a.name,
518
518
  value: a._id
519
519
  }))), y = p();
520
520
  async function ie() {
521
521
  try {
522
- await h.syncUsersMeta(), await D(), R.open({
522
+ await h.syncUsersMeta(), await O(), L.open({
523
523
  message: d("hr.employee.sync.successMessage"),
524
524
  type: "success"
525
525
  });
526
526
  } catch (a) {
527
- console.error("Error syncing users:", a), R.open({
527
+ console.error("Error syncing users:", a), L.open({
528
528
  message: d("hr.employee.sync.errorMessage"),
529
529
  type: "error"
530
530
  });
531
531
  }
532
532
  }
533
- async function L(a = U.value) {
533
+ async function R(a = S.value) {
534
534
  var e, l;
535
535
  await h.readEmployeesPage({
536
- limit: B,
537
- offset: (a - 1) * B,
536
+ limit: T,
537
+ offset: (a - 1) * T,
538
538
  search: u.value.trim() || void 0,
539
- restaurantIds: (e = w.value) != null && e.length ? w.value : void 0,
539
+ restaurantIds: (e = x.value) != null && e.length ? x.value : void 0,
540
540
  roleIds: (l = y.value) != null && l.length ? y.value : void 0
541
541
  });
542
542
  }
543
- async function D() {
543
+ async function O() {
544
544
  var e;
545
- if (!((e = I.value) != null && e._id)) return;
546
- await L(U.value);
547
- const a = Math.max(1, Math.ceil(E.value / B));
548
- U.value > a && (U.value = a, await L(U.value));
545
+ if (!((e = k.value) != null && e._id)) return;
546
+ await R(S.value);
547
+ const a = Math.max(1, Math.ceil(E.value / T));
548
+ S.value > a && (S.value = a, await R(S.value));
549
549
  }
550
550
  async function de() {
551
551
  var a, e;
552
552
  return await h.readAllEmployeesPage({
553
553
  search: u.value.trim() || void 0,
554
- restaurantIds: (a = w.value) != null && a.length ? w.value : void 0,
554
+ restaurantIds: (a = x.value) != null && a.length ? x.value : void 0,
555
555
  roleIds: (e = y.value) != null && e.length ? y.value : void 0
556
556
  }, E.value);
557
557
  }
558
- const ce = Ze(C, () => {
558
+ const ce = Qe(C, () => {
559
559
  u.value = C.value;
560
560
  }, 300);
561
561
  Be(ce);
@@ -564,37 +564,40 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
564
564
  pageIndex: a
565
565
  }) {
566
566
  var e;
567
- if ((e = I.value) != null && e._id && !J) {
568
- J = !0, U.value = a + 1;
567
+ if ((e = k.value) != null && e._id && !J && !(a === 0 && S.value === 1 && b.value.length > 0)) {
568
+ J = !0, S.value = a + 1;
569
569
  try {
570
- await L(U.value);
570
+ await R(S.value);
571
571
  } finally {
572
572
  J = !1;
573
573
  }
574
574
  }
575
575
  }
576
- return ye(X, () => {
577
- U.value = 1;
576
+ return ye(X, async () => {
577
+ var a;
578
+ S.value = 1, (a = k.value) != null && a._id && await R(1);
579
+ }, {
580
+ immediate: !0
578
581
  }), ye(() => M.value && M.value.restaurants, (a) => {
579
582
  a && a.length > 0 && (te.value = "");
580
583
  }), oe({
581
584
  create: H,
582
- filteredEmployees: x,
585
+ filteredEmployees: b,
583
586
  exportEmployees: de
584
587
  }), (a, e) => {
585
588
  var se, W;
586
- const l = f("FmButton"), r = f("FmTooltip"), m = f("FmSearch"), g = f("FmTable"), v = f("FmListItem"), b = f("FmList");
587
- return F(), A(Y, null, [n(ul, {
589
+ const l = f("FmButton"), r = f("FmTooltip"), m = f("FmSearch"), g = f("FmTable"), v = f("FmListItem"), V = f("FmList");
590
+ return w(), A(Y, null, [n(rl, {
588
591
  ref_key: "employeeFormRef",
589
592
  ref: G,
590
593
  modelValue: M.value,
591
594
  "onUpdate:modelValue": e[0] || (e[0] = (i) => M.value = i),
592
595
  "role-error-message": te.value,
593
596
  class: "gap-8",
594
- onSubmitted: D
595
- }, null, 8, ["modelValue", "role-error-message"]), c("div", il, [c("div", dl, [c("div", cl, [n(t(_e), {
596
- modelValue: w.value,
597
- "onUpdate:modelValue": e[1] || (e[1] = (i) => w.value = i),
597
+ onSubmitted: O
598
+ }, null, 8, ["modelValue", "role-error-message"]), c("div", nl, [c("div", ul, [c("div", il, [n(t(_e), {
599
+ modelValue: x.value,
600
+ "onUpdate:modelValue": e[1] || (e[1] = (i) => x.value = i),
598
601
  "managable-only": !1,
599
602
  multiple: "",
600
603
  variant: "dark",
@@ -604,34 +607,34 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
604
607
  "onUpdate:modelValue": e[2] || (e[2] = (i) => y.value = i),
605
608
  multiple: "",
606
609
  variant: "dark",
607
- items: k.value,
610
+ items: I.value,
608
611
  "selected-prefix": t(d)("hr.employee.filter.selected_role_prefix"),
609
612
  placeholder: t(d)("hr.employee.filter.role_placeholder")
610
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]), c("div", ml, [(se = t(re)) != null && se.role.isAdmin ? (F(), O(r, {
613
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]), c("div", dl, [(se = t(re)) != null && se.role.isAdmin ? (w(), D(r, {
611
614
  key: 0,
612
615
  content: t(d)("hr.employee.sync.tooltip")
613
616
  }, {
614
- default: V(() => [n(l, {
617
+ default: F(() => [n(l, {
615
618
  icon: "refresh",
616
619
  label: t(d)("hr.employee.sync.tooltip"),
617
620
  variant: "tertiary",
618
621
  onClick: ie
619
622
  }, null, 8, ["label"])]),
620
623
  _: 1
621
- }, 8, ["content"])) : T("", !0), n(m, {
624
+ }, 8, ["content"])) : N("", !0), n(m, {
622
625
  modelValue: t(C),
623
626
  "onUpdate:modelValue": e[3] || (e[3] = (i) => he(C) ? C.value = i : null),
624
627
  autofocus: "",
625
628
  class: "pl-4 w-[320px]",
626
629
  placeholder: t(d)("hr.employee.search.placeholder")
627
- }, null, 8, ["modelValue", "placeholder"])])]), c("div", pl, [c("div", vl, [n(m, {
630
+ }, null, 8, ["modelValue", "placeholder"])])]), c("div", cl, [c("div", ml, [n(m, {
628
631
  modelValue: t(C),
629
632
  "onUpdate:modelValue": e[4] || (e[4] = (i) => he(C) ? C.value = i : null),
630
633
  autofocus: "",
631
634
  placeholder: t(d)("hr.employee.search.placeholder")
632
- }, null, 8, ["modelValue", "placeholder"])]), n(Qe), c("div", fl, [n(t(_e), {
633
- modelValue: w.value,
634
- "onUpdate:modelValue": e[5] || (e[5] = (i) => w.value = i),
635
+ }, null, 8, ["modelValue", "placeholder"])]), n(Je), c("div", pl, [n(t(_e), {
636
+ modelValue: x.value,
637
+ "onUpdate:modelValue": e[5] || (e[5] = (i) => x.value = i),
635
638
  "managable-only": !1,
636
639
  multiple: "",
637
640
  variant: "dark",
@@ -640,58 +643,58 @@ const tl = { class: "fm-typo-en-title-md-600" }, sl = { class: "space-y-40" }, o
640
643
  modelValue: y.value,
641
644
  "onUpdate:modelValue": e[6] || (e[6] = (i) => y.value = i),
642
645
  multiple: "",
643
- items: k.value,
646
+ items: I.value,
644
647
  variant: "dark",
645
648
  "selected-prefix": t(d)("hr.employee.filter.selected_role_prefix"),
646
649
  placeholder: t(d)("hr.employee.filter.role_placeholder")
647
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]), (W = t(I)) != null && W._id ? (F(), O(We, {
650
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]), (W = t(k)) != null && W._id ? (w(), D(He, {
648
651
  key: 0
649
652
  }, {
650
- default: V(() => [c("div", yl, [E.value === 0 && !t(h).isLoading.value ? (F(), O(t(Ye), {
653
+ default: F(() => [c("div", vl, [E.value === 0 && !t(h).isLoading.value ? (w(), D(t(We), {
651
654
  key: 0,
652
655
  title: t(d)("hr.employee.noData.title"),
653
656
  subtitle: t(d)("hr.employee.noData.subtitle")
654
- }, null, 8, ["title", "subtitle"])) : T("", !0), Te((F(), O(g, {
657
+ }, null, 8, ["title", "subtitle"])) : N("", !0), E.value > 0 || t(h).isLoading.value ? (w(), D(g, {
655
658
  key: X.value,
656
- class: Ae(["xs:hidden employee-list-table min-h-0 flex-1", {
659
+ class: Te(["xs:hidden employee-list-table min-h-0 flex-1", {
657
660
  "employee-list-table--pagination-loading": z.value
658
661
  }]),
659
662
  "column-defs": s,
660
- "row-data": x.value,
661
- "page-size": B,
662
- "page-count": Math.ceil(E.value / B),
663
+ "row-data": b.value,
664
+ "page-size": T,
665
+ "page-count": Math.ceil(E.value / T),
663
666
  "row-count": E.value,
664
667
  "fetch-fn": me,
665
- "hide-footer": E.value <= B,
668
+ "hide-footer": E.value <= T,
666
669
  loading: t(h).isLoading.value,
667
670
  virtual: !1,
668
671
  "pin-header-row": "",
669
- onRowClick: e[7] || (e[7] = (i) => S(i.original))
670
- }, null, 8, ["class", "row-data", "page-count", "row-count", "hide-footer", "loading"])), [[ze, E.value > 0 || t(h).isLoading.value]]), c("div", hl, [n(b, {
672
+ onRowClick: e[7] || (e[7] = (i) => U(i.original))
673
+ }, null, 8, ["class", "row-data", "page-count", "row-count", "hide-footer", "loading"])) : N("", !0), c("div", fl, [n(V, {
671
674
  separator: ""
672
675
  }, {
673
- default: V(() => [(F(!0), A(Y, null, Ue(x.value, (i) => (F(), O(v, {
676
+ default: F(() => [(w(!0), A(Y, null, Ue(b.value, (i) => (w(), D(v, {
674
677
  key: i._id,
675
678
  class: "py-12 px-16 items-center justify-between",
676
- onClick: (N) => S(i)
679
+ onClick: (B) => U(i)
677
680
  }, {
678
- default: V(() => [c("div", gl, [c("p", _l, [i.code ? (F(), A("span", bl, Q(i.code) + ".", 1)) : T("", !0), Ke(Q(i.name), 1)]), c("div", Vl, [c("p", null, Q(t(d)("hr.employee.restaurants", {
679
- restaurants: i.restaurants.map((N) => $(N)).join(", ")
681
+ default: F(() => [c("div", yl, [c("p", hl, [i.code ? (w(), A("span", gl, Q(i.code) + ".", 1)) : N("", !0), Ae(Q(i.name), 1)]), c("div", _l, [c("p", null, Q(t(d)("hr.employee.restaurants", {
682
+ restaurants: i.restaurants.map((B) => $(B)).join(", ")
680
683
  })), 1), c("p", null, " Since: " + Q(i.since), 1)])]), n(l, {
681
684
  icon: "delete",
682
685
  variant: "tertiary",
683
686
  "text-color": "neutral-gray-400",
684
- onClick: Ge((N) => q(i), ["stop"])
687
+ onClick: ze((B) => q(i), ["stop"])
685
688
  }, null, 8, ["onClick"])]),
686
689
  _: 2
687
690
  }, 1032, ["onClick"]))), 128))]),
688
691
  _: 1
689
692
  })])])]),
690
693
  _: 1
691
- })) : T("", !0)])], 64);
694
+ })) : N("", !0)])], 64);
692
695
  };
693
696
  }
694
- }), Bl = /* @__PURE__ */ Je(Fl, [["__scopeId", "data-v-20a87df1"]]);
697
+ }), Dl = /* @__PURE__ */ qe(bl, [["__scopeId", "data-v-0db27cb8"]]);
695
698
  export {
696
- Bl as default
699
+ Dl as default
697
700
  };