@feedmepos/mf-hrm-portal 2.0.15-dev → 2.0.15-dev.2

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 (36) hide show
  1. package/dist/{AuditLogList-DBIsI4YF.js → AuditLogList-_iGkRjav.js} +4 -4
  2. package/dist/EmployeeList-BsauFDHA.js +736 -0
  3. package/dist/{Main-BAZAQTWi.js → Main-CWSLq8gH.js} +4 -4
  4. package/dist/{Main-D7yzD5SW.js → Main-D0eoxqEG.js} +5 -5
  5. package/dist/{Main-B3YiMuFq.js → Main-DWBJw_Ta.js} +1298 -1294
  6. package/dist/{PermissionSetList-DBT9LtfT.js → PermissionSetList-CzFf90Bv.js} +30 -30
  7. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BfqnjeTK.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CBcnIfck.js} +725 -725
  8. package/dist/RoleList-CsdcFHQK.js +528 -0
  9. package/dist/{TeamMemberList-BCv5Vixx.js → TeamMemberList-CI24SCZz.js} +327 -324
  10. package/dist/{TimesheetList-DpMBgVtY.js → TimesheetList-eD8-rA_L.js} +7 -7
  11. package/dist/{app-pvHHFjbx.js → app-DnT6yzx7.js} +242 -283
  12. package/dist/app.js +2 -2
  13. package/dist/{dayjs.min-BK_bM9xY.js → dayjs.min-L-465Ow8.js} +1 -1
  14. package/dist/{employee-DhkixwiI.js → employee-DGjXlPn1.js} +71 -74
  15. package/dist/{index-DK4fVbTF.js → index-DOpSY75_.js} +1 -1
  16. package/dist/{iteration-Bk3cnP07.js → iteration-CAxWl04o.js} +1 -1
  17. package/dist/{lodash-TrOlqj07.js → lodash-VfbpRiGW.js} +1 -1
  18. package/dist/rule-D6eh6FDn.js +991 -0
  19. package/dist/src/helpers/rule.d.ts +1 -1
  20. package/dist/src/stores/employee.d.ts +124 -19
  21. package/dist/src/types/employee.d.ts +3 -0
  22. package/dist/src/views/hr/employee/EmployeeList.vue.d.ts +4 -0
  23. package/dist/style.css +1 -1
  24. package/dist/{timesheet-DSQeCVfL.js → timesheet-B11NLk-Z.js} +9 -9
  25. package/dist/tsconfig.app.tsbuildinfo +1 -1
  26. package/dist/useAppStore-BaDI6IZu.js +171 -0
  27. package/dist/useDiscardConfirm-BHni0LNu.js +28 -0
  28. package/dist/{useLoading-fEAOlgoV.js → useLoading-B2CoUwmJ.js} +1 -1
  29. package/dist/{useReportPermissions-CkOk_2tl.js → useReportPermissions-BfjLdcAd.js} +3 -3
  30. package/dist/utils-BZkjJbju.js +17 -0
  31. package/package.json +1 -1
  32. package/dist/EmployeeList-BOSxLZbY.js +0 -702
  33. package/dist/RoleList-DeE5tN-5.js +0 -519
  34. package/dist/index-Bckj5jnu.js +0 -998
  35. package/dist/useAppStore-DwfwjZpc.js +0 -168
  36. package/dist/useRestaurantMap-e9fQJiLC.js +0 -39
@@ -1,46 +1,46 @@
1
- import { defineComponent as me, ref as f, resolveComponent as F, createBlock as k, openBlock as v, withCtx as j, createElementVNode as c, renderSlot as ke, createCommentVNode as O, withModifiers as Ee, nextTick as Ae, createElementBlock as E, normalizeClass as Te, createTextVNode as qe, toDisplayString as B, computed as I, Fragment as he, renderList as Re, createVNode as p, unref as m, watch as ye, isRef as ss, createSlots as ts, onUnmounted as as } from "vue";
1
+ import { defineComponent as me, ref as v, resolveComponent as x, createBlock as k, openBlock as f, withCtx as j, createElementVNode as c, renderSlot as ke, createCommentVNode as O, withModifiers as Ee, nextTick as Ae, createElementBlock as E, normalizeClass as Te, createTextVNode as Ke, toDisplayString as B, computed as I, Fragment as he, renderList as Re, createVNode as p, unref as m, watch as ye, isRef as ss, createSlots as ts, onUnmounted as as } from "vue";
2
2
  import { u as ls } from "./useDebounce-B8ZPVS5C.js";
3
3
  import { useI18n as ge, useCoreStore as _e, baseClientInstance as Ie, RestaurantSelector as Me } from "@feedmepos/mf-common";
4
- import { useBreakpoints as Ke, useSnackbar as ze, useDialog as os, components as Ce } from "@feedmepos/ui-library";
4
+ import { useBreakpoints as qe, useSnackbar as ze, useDialog as os, components as Ce } from "@feedmepos/ui-library";
5
5
  import { _ as Ge, S as De } from "./SelectFilter-DUj7GBtT.js";
6
- import { d as Ne, b as ns, C as rs, _ as is, a as us } from "./app-pvHHFjbx.js";
6
+ import { p as Ne, f as ns, k as rs, _ as is, a as us } from "./app-DnT6yzx7.js";
7
7
  import { _ as ms } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
8
- import { u as cs } from "./useLoading-fEAOlgoV.js";
9
- import { g as Be, d as We } from "./iteration-Bk3cnP07.js";
10
- import { u as Je, c as ds, d as we, m as fe, j as Xe, p as Oe, k as ps, l as Le, n as vs, o as fs, s as bs, q as ys, v as hs, t as be } from "./index-Bckj5jnu.js";
11
- import "./index-DK4fVbTF.js";
12
- import { u as Ze } from "./useAppStore-DwfwjZpc.js";
8
+ import { u as cs } from "./useLoading-B2CoUwmJ.js";
9
+ import { g as Be, d as We } from "./iteration-CAxWl04o.js";
10
+ import { u as Je, c as ds, b as we, m as ve, d as Xe, p as Oe, i as ps, j as Le, k as fs, l as vs, s as bs, n as ys, o as hs, t as be } from "./rule-D6eh6FDn.js";
11
+ import "./index-DOpSY75_.js";
12
+ import { u as Ze } from "./useAppStore-BaDI6IZu.js";
13
13
  /* empty css */
14
- import { _ as _s, a as gs } from "./PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BfqnjeTK.js";
14
+ import { _ as _s, a as gs } from "./PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CBcnIfck.js";
15
15
  import { u as xs } from "./useSearch-B6WK1LBB.js";
16
16
  const Fs = /* @__PURE__ */ me({
17
17
  __name: "BottomSheetMenu",
18
18
  setup(a) {
19
- const y = f(!1);
20
- async function r() {
19
+ const y = v(!1);
20
+ async function n() {
21
21
  await Ae(), y.value = !y.value;
22
22
  }
23
- return (t, n) => {
24
- const L = F("FmButton"), M = F("FmBottomSheet");
25
- return v(), k(M, {
23
+ return (t, r) => {
24
+ const L = x("FmButton"), C = x("FmBottomSheet");
25
+ return f(), k(C, {
26
26
  modelValue: y.value,
27
- "onUpdate:modelValue": n[1] || (n[1] = (g) => y.value = g),
27
+ "onUpdate:modelValue": r[1] || (r[1] = (g) => y.value = g),
28
28
  "dismiss-away": "",
29
29
  "no-header": "",
30
30
  "z-index": 110
31
31
  }, {
32
32
  "bottom-sheet-button": j(() => [
33
- t.$slots.button ? O("", !0) : (v(), k(L, {
33
+ t.$slots.button ? O("", !0) : (f(), k(L, {
34
34
  key: 0,
35
35
  icon: "more_vert",
36
36
  variant: "tertiary",
37
- onClick: Ee(r, ["stop"])
37
+ onClick: Ee(n, ["stop"])
38
38
  })),
39
39
  ke(t.$slots, "button")
40
40
  ]),
41
41
  default: j(() => [
42
42
  c("div", {
43
- onClick: n[0] || (n[0] = (g) => y.value = !1)
43
+ onClick: r[0] || (r[0] = (g) => y.value = !1)
44
44
  }, [
45
45
  ke(t.$slots, "default")
46
46
  ])
@@ -59,10 +59,10 @@ const Fs = /* @__PURE__ */ me({
59
59
  },
60
60
  setup(a) {
61
61
  const y = a;
62
- return (r, t) => {
63
- const n = F("FmIcon");
64
- return v(), E("div", Us, [
65
- r.$slots.content ? O("", !0) : (v(), E("div", {
62
+ return (n, t) => {
63
+ const r = x("FmIcon");
64
+ return f(), E("div", Us, [
65
+ n.$slots.content ? O("", !0) : (f(), E("div", {
66
66
  key: 0,
67
67
  class: Te(["flex items-center", {
68
68
  "text-fm-color-typo-disabled": y.disabled,
@@ -71,13 +71,13 @@ const Fs = /* @__PURE__ */ me({
71
71
  [y.itemClass || ""]: y.itemClass && !y.disabled
72
72
  }])
73
73
  }, [
74
- a.icon ? (v(), k(n, {
74
+ a.icon ? (f(), k(r, {
75
75
  key: 0,
76
76
  name: a.icon
77
77
  }, null, 8, ["name"])) : O("", !0),
78
- qe(" " + B(a.label), 1)
78
+ Ke(" " + B(a.label), 1)
79
79
  ], 2)),
80
- ke(r.$slots, "content")
80
+ ke(n.$slots, "content")
81
81
  ]);
82
82
  };
83
83
  }
@@ -87,24 +87,24 @@ const Fs = /* @__PURE__ */ me({
87
87
  items: {}
88
88
  },
89
89
  setup(a) {
90
- const y = Ke(), r = I(() => y.breakpoints.value.xs);
91
- return (t, n) => {
92
- const L = F("FmButton"), M = F("FmMenuItem"), g = F("FmMenu");
93
- return r.value ? (v(), k(Fs, { key: 0 }, {
90
+ const y = qe(), n = I(() => y.breakpoints.value.xs);
91
+ return (t, r) => {
92
+ const L = x("FmButton"), C = x("FmMenuItem"), g = x("FmMenu");
93
+ return n.value ? (f(), k(Fs, { key: 0 }, {
94
94
  default: j(() => [
95
- (v(!0), E(he, null, Re(a.items, ({ icon: _, label: u, disabled: V, itemClass: U, onClick: S }) => (v(), k(Ss, {
95
+ (f(!0), E(he, null, Re(a.items, ({ icon: _, label: u, disabled: P, itemClass: S, onClick: U }) => (f(), k(Ss, {
96
96
  key: u,
97
97
  icon: _,
98
98
  label: u,
99
- disabled: V,
100
- itemClass: U,
99
+ disabled: P,
100
+ itemClass: S,
101
101
  onClick: () => {
102
- !V && (S == null || S());
102
+ !P && (U == null || U());
103
103
  }
104
104
  }, null, 8, ["icon", "label", "disabled", "itemClass", "onClick"]))), 128))
105
105
  ]),
106
106
  _: 1
107
- })) : (v(), k(g, {
107
+ })) : (f(), k(g, {
108
108
  key: 1,
109
109
  "stop-click-propagation": "",
110
110
  shift: !0
@@ -119,17 +119,17 @@ const Fs = /* @__PURE__ */ me({
119
119
  })
120
120
  ]),
121
121
  default: j(() => [
122
- (v(!0), E(he, null, Re(a.items, ({ label: _, disabled: u, itemClass: V, onClick: U }) => (v(), k(M, {
122
+ (f(!0), E(he, null, Re(a.items, ({ label: _, disabled: u, itemClass: P, onClick: S }) => (f(), k(C, {
123
123
  key: _,
124
124
  disabled: u,
125
125
  label: _,
126
126
  onClick: () => {
127
- !u && (U == null || U());
127
+ !u && (S == null || S());
128
128
  }
129
129
  }, {
130
130
  label: j(() => [
131
131
  c("span", {
132
- class: Te(u ? "text-fm-color-typo-disabled" : V)
132
+ class: Te(u ? "text-fm-color-typo-disabled" : P)
133
133
  }, B(_), 3)
134
134
  ]),
135
135
  _: 2
@@ -148,11 +148,11 @@ const ws = { class: "w-full flex flex-col gap-16" }, Ps = { class: "flex items-c
148
148
  },
149
149
  setup(a) {
150
150
  const { t: y } = ge();
151
- return (r, t) => {
152
- const n = F("FmAvatar");
153
- return v(), E("div", ws, [
151
+ return (n, t) => {
152
+ const r = x("FmAvatar");
153
+ return f(), E("div", ws, [
154
154
  c("div", Ps, [
155
- p(n, {
155
+ p(r, {
156
156
  size: "xl",
157
157
  initials: a.data.name
158
158
  }, null, 8, ["initials"]),
@@ -176,83 +176,83 @@ const ws = { class: "w-full flex flex-col gap-16" }, Ps = { class: "flex items-c
176
176
  }
177
177
  }), je = {
178
178
  async readPermissionUserByPhoneNo(a) {
179
- var r;
179
+ var n;
180
180
  const { currentBusiness: y } = _e();
181
181
  return Be(
182
- await Ie("/").get(`/user/b/${(r = y.value) == null ? void 0 : r._id}/phone/${a}`)
182
+ await Ie("/").get(`/user/b/${(n = y.value) == null ? void 0 : n._id}/phone/${a}`)
183
183
  );
184
184
  },
185
185
  async readPermissionUserByEmail(a) {
186
- var r;
186
+ var n;
187
187
  const { currentBusiness: y } = _e();
188
188
  return Be(
189
- await Ie("/").get(`/user/b/${(r = y.value) == null ? void 0 : r._id}/email/${a}`)
189
+ await Ie("/").get(`/user/b/${(n = y.value) == null ? void 0 : n._id}/email/${a}`)
190
190
  );
191
191
  }
192
192
  }, js = { class: "flex flex-col gap-24 w-full" }, Es = {
193
193
  key: 0,
194
194
  class: "flex flex-col gap-8"
195
- }, As = { class: "user-info-icon user-info-icon--lg" }, Ts = { class: "flex-1 overflow-hidden" }, qs = { class: "profile-displayName" }, Ks = { class: "profile-email" }, zs = { class: "profile-phone" }, Gs = { key: 2 }, Ws = /* @__PURE__ */ me({
195
+ }, As = { class: "user-info-icon user-info-icon--lg" }, Ts = { class: "flex-1 overflow-hidden" }, Ks = { class: "profile-displayName" }, qs = { class: "profile-email" }, zs = { class: "profile-phone" }, Gs = { key: 2 }, Ws = /* @__PURE__ */ me({
196
196
  __name: "PortalUserSearcher",
197
197
  emits: ["invite"],
198
198
  setup(a, { emit: y }) {
199
- const r = y, { t } = ge(), n = ze(), L = _e(), M = f("phone"), g = f(""), _ = f(""), u = f();
200
- async function V() {
199
+ const n = y, { t } = ge(), r = ze(), L = _e(), C = v("phone"), g = v(""), _ = v(""), u = v();
200
+ async function P() {
201
201
  if (!g.value && !_.value) {
202
- n.open({
202
+ r.open({
203
203
  type: "error",
204
204
  title: t("team.memberForm.searchUser.emptyError")
205
205
  });
206
206
  return;
207
207
  }
208
- const h = M.value === "phone" ? await je.readPermissionUserByPhoneNo(g.value.replace(/ /g, "")) : await je.readPermissionUserByEmail(_.value);
209
- h || n.open({
208
+ const h = C.value === "phone" ? await je.readPermissionUserByPhoneNo(g.value.replace(/ /g, "")) : await je.readPermissionUserByEmail(_.value);
209
+ h || r.open({
210
210
  type: "error",
211
211
  title: t("team.memberForm.searchUser.userNotFound")
212
212
  }), u.value = h;
213
213
  }
214
- const U = I(() => {
214
+ const S = I(() => {
215
215
  var se;
216
216
  let h = ((se = u.value) == null ? void 0 : se.displayName) ?? "";
217
217
  h || (h = "Feed Me");
218
- const [w, A] = h.split(" ");
219
- return A ? `${w[0]}${A[0]}` : w.slice(0, 2);
220
- }), S = f(!1);
221
- function ee(h) {
222
- r("invite", h), S.value = !0;
218
+ const [V, T] = h.split(" ");
219
+ return T ? `${V[0]}${T[0]}` : V.slice(0, 2);
220
+ }), U = v(!1);
221
+ function A(h) {
222
+ n("invite", h), U.value = !0;
223
223
  }
224
- function W() {
225
- S.value = !1;
224
+ function J() {
225
+ U.value = !1;
226
226
  }
227
- return (h, w) => {
228
- var R, T, Z;
229
- const A = F("FmRadio"), se = F("FmPhoneNumber"), oe = F("FmTextField"), o = F("FmRadioGroup"), i = F("FmButton");
230
- return v(), E("div", js, [
231
- S.value ? O("", !0) : (v(), E("div", Es, [
227
+ return (h, V) => {
228
+ var R, K, Q;
229
+ const T = x("FmRadio"), se = x("FmPhoneNumber"), ne = x("FmTextField"), o = x("FmRadioGroup"), i = x("FmButton");
230
+ return f(), E("div", js, [
231
+ U.value ? O("", !0) : (f(), E("div", Es, [
232
232
  p(o, {
233
- modelValue: M.value,
234
- "onUpdate:modelValue": w[2] || (w[2] = (P) => M.value = P)
233
+ modelValue: C.value,
234
+ "onUpdate:modelValue": V[2] || (V[2] = (w) => C.value = w)
235
235
  }, {
236
236
  default: j(() => [
237
- p(A, {
237
+ p(T, {
238
238
  value: "phone",
239
239
  label: m(t)("team.memberForm.searchUser.phoneNumber")
240
240
  }, null, 8, ["label"]),
241
- M.value === "phone" ? (v(), k(se, {
241
+ C.value === "phone" ? (f(), k(se, {
242
242
  key: 0,
243
243
  modelValue: g.value,
244
- "onUpdate:modelValue": w[0] || (w[0] = (P) => g.value = P),
244
+ "onUpdate:modelValue": V[0] || (V[0] = (w) => g.value = w),
245
245
  "extra-country-codes": m(L).enabledCountries.value,
246
246
  class: "ml-8"
247
247
  }, null, 8, ["modelValue", "extra-country-codes"])) : O("", !0),
248
- p(A, {
248
+ p(T, {
249
249
  value: "email",
250
250
  label: m(t)("team.memberForm.searchUser.email")
251
251
  }, null, 8, ["label"]),
252
- M.value === "email" ? (v(), k(oe, {
252
+ C.value === "email" ? (f(), k(ne, {
253
253
  key: 1,
254
254
  modelValue: _.value,
255
- "onUpdate:modelValue": w[1] || (w[1] = (P) => _.value = P),
255
+ "onUpdate:modelValue": V[1] || (V[1] = (w) => _.value = w),
256
256
  placeholder: m(t)("team.memberForm.searchUser.emailPlaceholder"),
257
257
  class: "ml-8"
258
258
  }, null, 8, ["modelValue", "placeholder"])) : O("", !0)
@@ -262,26 +262,26 @@ const ws = { class: "w-full flex flex-col gap-16" }, Ps = { class: "flex items-c
262
262
  p(i, {
263
263
  label: m(t)("team.memberForm.searchUser.search"),
264
264
  variant: "secondary",
265
- onClick: V
265
+ onClick: P
266
266
  }, null, 8, ["label"])
267
267
  ])),
268
- u.value ? (v(), E("div", {
268
+ u.value ? (f(), E("div", {
269
269
  key: 1,
270
270
  class: "profile-menu--profile cursor-pointer hover:bg-fm-color-opacity-sm",
271
- onClick: w[3] || (w[3] = (P) => ee(u.value))
271
+ onClick: V[3] || (V[3] = (w) => A(u.value))
272
272
  }, [
273
- c("div", As, B(U.value), 1),
273
+ c("div", As, B(S.value), 1),
274
274
  c("div", Ts, [
275
- c("p", qs, B((R = u.value) == null ? void 0 : R.displayName), 1),
276
- c("p", Ks, B((T = u.value) == null ? void 0 : T.email), 1),
277
- c("p", zs, B((Z = u.value) == null ? void 0 : Z.phoneNumber), 1)
275
+ c("p", Ks, B((R = u.value) == null ? void 0 : R.displayName), 1),
276
+ c("p", qs, B((K = u.value) == null ? void 0 : K.email), 1),
277
+ c("p", zs, B((Q = u.value) == null ? void 0 : Q.phoneNumber), 1)
278
278
  ])
279
279
  ])) : O("", !0),
280
- S.value ? (v(), E("div", Gs, [
280
+ U.value ? (f(), E("div", Gs, [
281
281
  p(i, {
282
282
  label: m(t)("team.memberForm.searchUser.changeUser"),
283
283
  variant: "secondary",
284
- onClick: W
284
+ onClick: J
285
285
  }, null, 8, ["label"])
286
286
  ])) : O("", !0)
287
287
  ]);
@@ -313,61 +313,61 @@ const ws = { class: "w-full flex flex-col gap-16" }, Ps = { class: "flex items-c
313
313
  },
314
314
  emits: ["update:model-value"],
315
315
  setup(a, { emit: y }) {
316
- const r = a, t = y, { t: n } = ge(), { searchKey: L, filter: M } = xs(""), g = f(!0), _ = f([]), u = I(() => {
316
+ const n = a, t = y, { t: r } = ge(), { searchKey: L, filter: C } = xs(""), g = v(!0), _ = v([]), u = I(() => {
317
317
  const o = {};
318
- return r.roles.forEach((i) => {
318
+ return n.roles.forEach((i) => {
319
319
  o[i.value] = i.label;
320
320
  }), o;
321
- }), V = I(() => {
321
+ }), P = I(() => {
322
322
  var i;
323
323
  const o = {};
324
- return (i = r.modelValue) == null || i.roles.forEach((R) => {
324
+ return (i = n.modelValue) == null || i.roles.forEach((R) => {
325
325
  o[R.restaurantId] = R.roleId;
326
326
  }), o;
327
- }), U = I(() => r.restaurants.filter((o) => M([o.profile.name, o.profile.code, ee(o._id)])).map((o) => ({
327
+ }), S = I(() => n.restaurants.filter((o) => C([o.profile.name, o.profile.code, A(o._id)])).map((o) => ({
328
328
  label: `${o.profile.code ? o.profile.code + "-" : ""}${o.profile.name}`,
329
329
  value: o._id,
330
330
  slot: `checkbox-${o._id}-bottom`,
331
- disable: r.roles.filter((i) => !i.disabled).length === 0,
332
- roleOptions: r.roles
333
- }))), S = I(() => {
334
- const o = r.roles.find((i) => !i.disabled);
331
+ disable: n.roles.filter((i) => !i.disabled).length === 0,
332
+ roleOptions: n.roles
333
+ }))), U = I(() => {
334
+ const o = n.roles.find((i) => !i.disabled);
335
335
  return o ? o.value : null;
336
336
  });
337
- function ee(o) {
338
- const i = V.value[o] ?? "";
337
+ function A(o) {
338
+ const i = P.value[o] ?? "";
339
339
  return u.value[i] || "";
340
340
  }
341
- function W(o) {
342
- o ? r.modelValue || t("update:model-value", {
341
+ function J(o) {
342
+ o ? n.modelValue || t("update:model-value", {
343
343
  code: "",
344
- name: r.fallbackName,
344
+ name: n.fallbackName,
345
345
  roles: [],
346
- passcode: r.fallbackPasscode || ""
346
+ passcode: n.fallbackPasscode || ""
347
347
  }) : t("update:model-value", null);
348
348
  }
349
349
  function h(o, i) {
350
- if (!r.modelValue || o === "passcode" && r.modelValue.passcode === i)
350
+ if (!n.modelValue || o === "passcode" && n.modelValue.passcode === i)
351
351
  return;
352
- const R = We(r.modelValue);
352
+ const R = We(n.modelValue);
353
353
  R[o] = i, t("update:model-value", R);
354
354
  }
355
- function w(o) {
355
+ function V(o) {
356
356
  h(
357
357
  "roles",
358
358
  o.map((i) => {
359
- var Z, P, D;
360
- const R = (P = (Z = U.value.find((q) => q.value === i)) == null ? void 0 : Z.roleOptions.find((q) => !q.disabled)) == null ? void 0 : P.value, T = (D = r.modelValue) == null ? void 0 : D.roles.find((q) => q.restaurantId === i);
359
+ var Q, w, D;
360
+ const R = (w = (Q = S.value.find((q) => q.value === i)) == null ? void 0 : Q.roleOptions.find((q) => !q.disabled)) == null ? void 0 : w.value, K = (D = n.modelValue) == null ? void 0 : D.roles.find((q) => q.restaurantId === i);
361
361
  return {
362
362
  restaurantId: i,
363
- roleId: (T == null ? void 0 : T.roleId) || R
363
+ roleId: (K == null ? void 0 : K.roleId) || R
364
364
  };
365
365
  })
366
366
  );
367
367
  }
368
- function A(o, i) {
368
+ function T(o, i) {
369
369
  h("roles", [
370
- ...r.modelValue.roles.filter(
370
+ ...n.modelValue.roles.filter(
371
371
  (R) => R.restaurantId !== o
372
372
  ),
373
373
  {
@@ -382,63 +382,63 @@ const ws = { class: "w-full flex flex-col gap-16" }, Ps = { class: "flex items-c
382
382
  ye(
383
383
  () => {
384
384
  var o;
385
- return (o = r.modelValue) == null ? void 0 : o.passcode;
385
+ return (o = n.modelValue) == null ? void 0 : o.passcode;
386
386
  },
387
387
  (o) => {
388
388
  o && o.length === Pe ? (_.value = o.split(""), g.value = !0) : (_.value = [], g.value = !1);
389
389
  },
390
390
  { immediate: !0 }
391
391
  );
392
- const oe = I({
392
+ const ne = I({
393
393
  get: () => {
394
394
  var o;
395
- return ((o = r.modelValue) == null ? void 0 : o.roles) ?? [];
395
+ return ((o = n.modelValue) == null ? void 0 : o.roles) ?? [];
396
396
  },
397
397
  set: () => {
398
398
  }
399
399
  });
400
400
  return (o, i) => {
401
- const R = F("FmSwitch"), T = F("FmTextField"), Z = F("FmPinField"), P = F("FmFormGroup"), D = F("FmSearch"), q = F("FmSelect");
402
- return v(), E("div", Xs, [
401
+ const R = x("FmSwitch"), K = x("FmTextField"), Q = x("FmPinField"), w = x("FmFormGroup"), D = x("FmSearch"), q = x("FmSelect");
402
+ return f(), E("div", Xs, [
403
403
  c("div", Zs, [
404
404
  c("div", Qs, [
405
- c("div", Ys, B(m(n)("team.memberForm.masterUser.title")), 1),
406
- c("div", Hs, B(m(n)("team.memberForm.masterUser.sublabel")), 1)
405
+ c("div", Ys, B(m(r)("team.memberForm.masterUser.title")), 1),
406
+ c("div", Hs, B(m(r)("team.memberForm.masterUser.sublabel")), 1)
407
407
  ]),
408
408
  c("div", null, [
409
409
  p(R, {
410
410
  "model-value": !!a.modelValue,
411
411
  value: "master-user",
412
- "onUpdate:modelValue": W
412
+ "onUpdate:modelValue": J
413
413
  }, null, 8, ["model-value"])
414
414
  ])
415
415
  ]),
416
- a.modelValue ? (v(), E(he, { key: 0 }, [
416
+ a.modelValue ? (f(), E(he, { key: 0 }, [
417
417
  c("div", et, [
418
- p(T, {
418
+ p(K, {
419
419
  "model-value": a.modelValue.code,
420
- label: m(n)("team.memberForm.masterUser.code"),
420
+ label: m(r)("team.memberForm.masterUser.code"),
421
421
  "onUpdate:modelValue": i[0] || (i[0] = (d) => h("code", d))
422
422
  }, null, 8, ["model-value", "label"]),
423
- p(T, {
423
+ p(K, {
424
424
  "model-value": a.modelValue.name,
425
425
  class: "w-full",
426
- label: m(n)("team.memberForm.masterUser.name"),
427
- rules: [(d) => !!d || m(n)("team.memberForm.masterUser.nameEmptyError")],
426
+ label: m(r)("team.memberForm.masterUser.name"),
427
+ rules: [(d) => !!d || m(r)("team.memberForm.masterUser.nameEmptyError")],
428
428
  "onUpdate:modelValue": i[1] || (i[1] = (d) => h("name", d))
429
429
  }, null, 8, ["model-value", "label", "rules"])
430
430
  ]),
431
431
  c("div", st, [
432
- c("div", tt, B(m(n)("team.memberForm.masterUser.passcode")), 1),
433
- p(P, {
432
+ c("div", tt, B(m(r)("team.memberForm.masterUser.passcode")), 1),
433
+ p(w, {
434
434
  modelValue: _.value,
435
435
  "onUpdate:modelValue": i[4] || (i[4] = (d) => _.value = d),
436
436
  rules: [
437
- (d) => (d == null ? void 0 : d.filter((J) => !!J).length) !== Pe ? m(n)("team.memberForm.masterUser.passcodeRequired") : !0
437
+ (d) => (d == null ? void 0 : d.filter((X) => !!X).length) !== Pe ? m(r)("team.memberForm.masterUser.passcodeRequired") : !0
438
438
  ]
439
439
  }, {
440
440
  default: j(() => [
441
- (v(), k(Z, {
441
+ (f(), k(Q, {
442
442
  key: `pin-field-${g.value}`,
443
443
  modelValue: _.value,
444
444
  "onUpdate:modelValue": i[2] || (i[2] = (d) => _.value = d),
@@ -451,11 +451,11 @@ const ws = { class: "w-full flex flex-col gap-16" }, Ps = { class: "flex items-c
451
451
  _: 1
452
452
  }, 8, ["modelValue", "rules"])
453
453
  ]),
454
- p(P, {
455
- modelValue: oe.value,
456
- "onUpdate:modelValue": i[6] || (i[6] = (d) => oe.value = d),
454
+ p(w, {
455
+ modelValue: ne.value,
456
+ "onUpdate:modelValue": i[6] || (i[6] = (d) => ne.value = d),
457
457
  rules: [
458
- (d) => !d || d.length === 0 ? m(n)("team.memberForm.masterUser.restaurantRequired") : d.some((J) => !J.roleId) ? m(n)("team.memberForm.masterUser.roleRequired") : !0
458
+ (d) => !d || d.length === 0 ? m(r)("team.memberForm.masterUser.restaurantRequired") : d.some((X) => !X.roleId) ? m(r)("team.memberForm.masterUser.roleRequired") : !0
459
459
  ]
460
460
  }, {
461
461
  default: j(() => [
@@ -463,26 +463,26 @@ const ws = { class: "w-full flex flex-col gap-16" }, Ps = { class: "flex items-c
463
463
  p(D, {
464
464
  modelValue: m(L),
465
465
  "onUpdate:modelValue": i[5] || (i[5] = (d) => ss(L) ? L.value = d : null),
466
- placeholder: m(n)("team.memberForm.posRole.placeholder"),
466
+ placeholder: m(r)("team.memberForm.posRole.placeholder"),
467
467
  class: "mb-16"
468
468
  }, null, 8, ["modelValue", "placeholder"]),
469
469
  p(_s, {
470
470
  "model-value": a.modelValue.roles.map((d) => d.restaurantId),
471
- options: U.value,
471
+ options: S.value,
472
472
  min: 1,
473
- title: m(n)("team.memberForm.masterUser.role"),
474
- "onUpdate:modelValue": w
473
+ title: m(r)("team.memberForm.masterUser.role"),
474
+ "onUpdate:modelValue": V
475
475
  }, ts({ _: 2 }, [
476
- Re(U.value, (d) => ({
476
+ Re(S.value, (d) => ({
477
477
  name: d.slot,
478
478
  fn: j(() => {
479
- var J;
479
+ var X;
480
480
  return [
481
481
  c("div", null, [
482
482
  p(q, {
483
- "model-value": ((J = a.modelValue.roles.find((te) => te.restaurantId === d.value)) == null ? void 0 : J.roleId) || S.value,
483
+ "model-value": ((X = a.modelValue.roles.find((te) => te.restaurantId === d.value)) == null ? void 0 : X.roleId) || U.value,
484
484
  items: d.roleOptions,
485
- "onUpdate:modelValue": (te) => A(d.value, te)
485
+ "onUpdate:modelValue": (te) => T(d.value, te)
486
486
  }, null, 8, ["model-value", "items", "onUpdate:modelValue"])
487
487
  ])
488
488
  ];
@@ -517,34 +517,34 @@ const ws = { class: "w-full flex flex-col gap-16" }, Ps = { class: "flex items-c
517
517
  },
518
518
  setup(a, { expose: y }) {
519
519
  var xe, Fe, Ue;
520
- const r = a, { t } = ge(), n = f(), L = Je(), M = I(
520
+ const n = a, { t } = ge(), r = v(), L = Je(), C = I(
521
521
  () => L.permissionSets.value.map((l) => ({
522
522
  label: l.name,
523
523
  value: l.id
524
524
  }))
525
- ), g = f(((xe = r.initialValue) == null ? void 0 : xe.permissionSetIds) || []), _ = I(
525
+ ), g = v(((xe = n.initialValue) == null ? void 0 : xe.permissionSetIds) || []), _ = I(
526
526
  () => ds(g.value, L.permissionSets.value)
527
- ), u = f((Fe = r.initialValue) == null ? void 0 : Fe.posUser), V = f(!1), U = f(!1), S = f(
527
+ ), u = v((Fe = n.initialValue) == null ? void 0 : Fe.posUser), P = v(!1), S = v(!1), U = v(
528
528
  we(
529
- fe(_.value),
530
- ((Ue = r.initialValue) == null ? void 0 : Ue.permissions) || []
529
+ ve(_.value),
530
+ ((Ue = n.initialValue) == null ? void 0 : Ue.permissions) || []
531
531
  )
532
- ), { customReportPermissions: ee, isLoaded: W } = Xe(), h = new Set(
532
+ ), { customReportPermissions: A, isLoaded: J } = Xe(), h = new Set(
533
533
  Oe.filter((l) => l.subject.startsWith(ps)).map((l) => l.subject)
534
- ), w = I(() => {
534
+ ), V = I(() => {
535
535
  const l = new Set(h);
536
- for (const b of ee.value) l.add(b.subject);
536
+ for (const b of A.value) l.add(b.subject);
537
537
  return l;
538
- }), A = I(() => {
538
+ }), T = I(() => {
539
539
  const l = /* @__PURE__ */ new Set();
540
540
  for (const b of Oe)
541
541
  b.category === Ne.reports && l.add(b.subject);
542
- for (const b of ee.value)
542
+ for (const b of A.value)
543
543
  b.category === Ne.reports && l.add(b.subject);
544
544
  return l;
545
- }), { restaurants: se } = _e(), oe = Ze().roles, o = I(() => Le(S.value)), i = I(() => {
545
+ }), { restaurants: se } = _e(), ne = Ze().roles, o = I(() => Le(U.value)), i = I(() => {
546
546
  const l = o.value;
547
- return oe.value.map(
547
+ return ne.value.map(
548
548
  (b) => ({
549
549
  label: b.name,
550
550
  value: b._id,
@@ -553,104 +553,104 @@ const ws = { class: "w-full flex flex-col gap-16" }, Ps = { class: "flex items-c
553
553
  );
554
554
  });
555
555
  function R(l) {
556
- n.value = l;
556
+ r.value = l;
557
557
  }
558
- function T(l) {
559
- U.value = !0;
558
+ function K(l) {
559
+ S.value = !0;
560
560
  const b = d(u.value, l);
561
- b !== u.value && (V.value = !0), u.value = b;
561
+ b !== u.value && (P.value = !0), u.value = b;
562
562
  }
563
- function Z() {
564
- const l = fe(_.value), b = W.value ? w.value : h, K = vs(S.value, b), X = fs(K, A.value), Y = bs(X);
565
- return ys(l, Y);
563
+ function Q() {
564
+ const l = ve(_.value), b = J.value ? V.value : h, z = fs(U.value, b), Z = vs(z, T.value), H = bs(Z);
565
+ return ys(l, H);
566
566
  }
567
- function P() {
568
- var K, X, Y, ae, z, G, ne, re, ce, N;
569
- const l = Z(), b = S.value.filter((le) => !le.inverted);
567
+ function w() {
568
+ var z, Z, H, ae, G, W, re, ie, ce, N;
569
+ const l = Q(), b = U.value.filter((oe) => !oe.inverted);
570
570
  return {
571
- email: ((K = n.value) == null ? void 0 : K.email) ?? void 0,
572
- phoneNumber: ((X = n.value) == null ? void 0 : X.phoneNumber) ?? void 0,
571
+ email: ((z = r.value) == null ? void 0 : z.email) ?? void 0,
572
+ phoneNumber: ((Z = r.value) == null ? void 0 : Z.phoneNumber) ?? void 0,
573
573
  customPermissions: l,
574
574
  // Deprecated: keep for backward compatibility, will be removed in the future
575
- permissions: b.map((le) => ({
576
- ...le,
577
- subject: ns(le.subject)
575
+ permissions: b.map((oe) => ({
576
+ ...oe,
577
+ subject: ns(oe.subject)
578
578
  })),
579
579
  permissionSetIds: g.value,
580
- name: ((Y = n.value) == null ? void 0 : Y.displayName) || ((ae = r.initialValue) == null ? void 0 : ae.name) || "",
581
- posUser: !r.initialValue || V.value ? u.value != null ? {
580
+ name: ((H = r.value) == null ? void 0 : H.displayName) || ((ae = n.initialValue) == null ? void 0 : ae.name) || "",
581
+ posUser: !n.initialValue || P.value ? u.value != null ? {
582
582
  ...u.value,
583
- name: u.value.name || ((G = (z = r.initialValue) == null ? void 0 : z.posUser) == null ? void 0 : G.name) || ((ne = r.initialValue) == null ? void 0 : ne.name) || ((re = n.value) == null ? void 0 : re.displayName) || "",
584
- code: u.value.code || ((N = (ce = r.initialValue) == null ? void 0 : ce.posUser) == null ? void 0 : N.code) || "",
583
+ name: u.value.name || ((W = (G = n.initialValue) == null ? void 0 : G.posUser) == null ? void 0 : W.name) || ((re = n.initialValue) == null ? void 0 : re.name) || ((ie = r.value) == null ? void 0 : ie.displayName) || "",
584
+ code: u.value.code || ((N = (ce = n.initialValue) == null ? void 0 : ce.posUser) == null ? void 0 : N.code) || "",
585
585
  passcode: u.value.passcode,
586
- roles: u.value.roles.filter((le) => !!le.roleId)
586
+ roles: u.value.roles.filter((oe) => !!oe.roleId)
587
587
  } : u.value : void 0
588
588
  // update mode, POS not touched → signal no change to backend
589
589
  };
590
590
  }
591
- const D = f();
591
+ const D = v();
592
592
  ye(
593
- () => r.initialValue,
593
+ () => n.initialValue,
594
594
  (l) => {
595
595
  if (!l) {
596
- g.value = [], u.value = void 0, V.value = !1, U.value = !1, S.value = we(fe([]), []);
596
+ g.value = [], u.value = void 0, P.value = !1, S.value = !1, U.value = we(ve([]), []);
597
597
  return;
598
598
  }
599
- if (U.value) {
600
- !V.value && l.posUser !== void 0 && (u.value = l.posUser);
599
+ if (S.value) {
600
+ !P.value && l.posUser !== void 0 && (u.value = l.posUser);
601
601
  return;
602
602
  }
603
- g.value = l.permissionSetIds || [], (!V.value || l.posUser !== void 0) && (u.value = l.posUser), S.value = we(
604
- fe(_.value),
603
+ g.value = l.permissionSetIds || [], (!P.value || l.posUser !== void 0) && (u.value = l.posUser), U.value = we(
604
+ ve(_.value),
605
605
  l.permissions || []
606
- ), V.value = !1;
606
+ ), P.value = !1;
607
607
  },
608
608
  { immediate: !0 }
609
609
  );
610
610
  function q() {
611
- S.value = fe(_.value), U.value = !0;
612
- const l = d(u.value, S.value);
613
- l !== u.value && (V.value = !0), u.value = l;
611
+ U.value = ve(_.value), S.value = !0;
612
+ const l = d(u.value, U.value);
613
+ l !== u.value && (P.value = !0), u.value = l;
614
614
  }
615
615
  function d(l, b) {
616
616
  if (!l) return l;
617
- const K = Le(b);
618
- if (!K) return l;
619
- const X = We(l);
620
- return X.roles = X.roles.reduce((Y, ae) => (K.includes(ae.roleId) && Y.push(ae), Y), []), X;
617
+ const z = Le(b);
618
+ if (!z) return l;
619
+ const Z = We(l);
620
+ return Z.roles = Z.roles.reduce((H, ae) => (z.includes(ae.roleId) && H.push(ae), H), []), Z;
621
621
  }
622
- async function J() {
622
+ async function X() {
623
623
  await Ae(), D.value && D.value.$el.scrollIntoView({ behavior: "smooth", block: "start" });
624
624
  }
625
- const te = f();
626
- async function Q() {
627
- return (await te.value.validateInputsWithoutSubmit()).length ? null : P();
625
+ const te = v();
626
+ async function Y() {
627
+ return (await te.value.validateInputsWithoutSubmit()).length ? null : w();
628
628
  }
629
629
  return y({
630
- readFormData: P,
631
- validate: Q
630
+ readFormData: w,
631
+ validate: Y
632
632
  }), (l, b) => {
633
- const K = F("FmSelect"), X = F("FmCircularProgress"), Y = F("FmForm");
634
- return v(), k(Y, {
633
+ const z = x("FmSelect"), Z = x("FmCircularProgress"), H = x("FmForm");
634
+ return f(), k(H, {
635
635
  ref_key: "formRef",
636
636
  ref: te,
637
637
  class: "mx-4"
638
638
  }, {
639
639
  default: j(() => {
640
- var ae, z, G, ne, re, ce;
640
+ var ae, G, W, re, ie, ce;
641
641
  return [
642
642
  c("div", ot, [
643
643
  c("div", nt, [
644
- a.initialValue ? (v(), k(Ls, {
644
+ a.initialValue ? (f(), k(Ls, {
645
645
  key: 1,
646
646
  data: a.initialValue
647
- }, null, 8, ["data"])) : (v(), k(Js, {
647
+ }, null, 8, ["data"])) : (f(), k(Js, {
648
648
  key: 0,
649
649
  onInvite: b[0] || (b[0] = (N) => R(N))
650
650
  }))
651
651
  ]),
652
- n.value || a.initialValue ? (v(), E(he, { key: 0 }, [
653
- (ae = a.initialValue) != null && ae.isOwner ? O("", !0) : (v(), k(K, {
652
+ r.value || a.initialValue ? (f(), E(he, { key: 0 }, [
653
+ (ae = a.initialValue) != null && ae.isOwner ? O("", !0) : (f(), k(z, {
654
654
  key: 0,
655
655
  modelValue: g.value,
656
656
  "onUpdate:modelValue": [
@@ -660,30 +660,30 @@ const ws = { class: "w-full flex flex-col gap-16" }, Ps = { class: "flex items-c
660
660
  multiselect: "",
661
661
  searchable: "",
662
662
  "search-debounce": 300,
663
- items: M.value,
663
+ items: C.value,
664
664
  label: m(t)("team.memberForm.permissionSet.title"),
665
665
  placeholder: m(t)("team.memberForm.permissionSet.selectPlaceholder")
666
666
  }, null, 8, ["modelValue", "items", "label", "placeholder"])),
667
- (z = a.initialValue) != null && z.isOwner ? O("", !0) : (v(), k(gs, {
667
+ (G = a.initialValue) != null && G.isOwner ? O("", !0) : (f(), k(gs, {
668
668
  key: 1,
669
- modelValue: S.value,
670
- "onUpdate:modelValue": b[2] || (b[2] = (N) => S.value = N),
669
+ modelValue: U.value,
670
+ "onUpdate:modelValue": b[2] || (b[2] = (N) => U.value = N),
671
671
  "inherit-permissions": _.value,
672
- onPermissionChanged: T
672
+ onPermissionChanged: K
673
673
  }, null, 8, ["modelValue", "inherit-permissions"])),
674
- a.isLoadingMasterUser ? (v(), E("div", rt, [
675
- p(X)
676
- ])) : (v(), k(lt, {
674
+ a.isLoadingMasterUser ? (f(), E("div", rt, [
675
+ p(Z)
676
+ ])) : (f(), k(lt, {
677
677
  key: 3,
678
678
  ref_key: "masterUserContentRef",
679
679
  ref: D,
680
680
  "model-value": u.value,
681
- "fallback-name": ((G = a.initialValue) == null ? void 0 : G.name) || ((ne = n.value) == null ? void 0 : ne.displayName) || "",
682
- "fallback-passcode": (ce = (re = a.initialValue) == null ? void 0 : re.posUser) == null ? void 0 : ce.passcode,
681
+ "fallback-name": ((W = a.initialValue) == null ? void 0 : W.name) || ((re = r.value) == null ? void 0 : re.displayName) || "",
682
+ "fallback-passcode": (ce = (ie = a.initialValue) == null ? void 0 : ie.posUser) == null ? void 0 : ce.passcode,
683
683
  roles: i.value,
684
684
  restaurants: m(se),
685
685
  "onUpdate:modelValue": b[3] || (b[3] = (N) => {
686
- u.value = N, V.value = !0, U.value = !0, J();
686
+ u.value = N, P.value = !0, S.value = !0, X();
687
687
  })
688
688
  }, null, 8, ["model-value", "fallback-name", "fallback-passcode", "roles", "restaurants"]))
689
689
  ], 64)) : O("", !0)
@@ -704,47 +704,50 @@ const ws = { class: "w-full flex flex-col gap-16" }, Ps = { class: "flex items-c
704
704
  class: "flex items-start gap-8"
705
705
  }, pt = {
706
706
  class: "space-y-4 sm:hidden md:hidden lg:hidden px-16"
707
- }, vt = {
708
- class: "flex items-start gap-8"
709
707
  }, ft = {
708
+ class: "flex items-start gap-8"
709
+ }, vt = {
710
710
  class: "flex h-full flex-col"
711
711
  }, bt = {
712
712
  class: "flex items-center justify-start gap-8"
713
713
  }, de = 100;
714
- var H = /* @__PURE__ */ function(a) {
714
+ var ee = /* @__PURE__ */ function(a) {
715
715
  return a[a.ADD = 0] = "ADD", a[a.UPDATE = 1] = "UPDATE", a[a.CLOSED = 2] = "CLOSED", a;
716
- }(H || {});
716
+ }(ee || {});
717
717
  const yt = /* @__PURE__ */ me({
718
718
  __name: "TeamMemberList",
719
719
  setup(a, {
720
720
  expose: y
721
721
  }) {
722
722
  const {
723
- fetchCustomReportPermissions: r
723
+ fetchCustomReportPermissions: n
724
724
  } = Xe(), {
725
725
  t
726
- } = ge(), n = _e(), L = Ze(), M = ze(), g = cs(M), _ = Je(), u = hs(), V = f(!0), U = f(!1), S = f(n.restaurants.value.length === 0), ee = f([]), W = f(0), h = f(1), w = f(""), A = f(""), se = ye(n.restaurants, (e) => {
727
- e.length > 0 && (S.value = !1, se());
728
- }), oe = ({
726
+ } = ge(), r = _e(), L = Ze(), C = ze(), g = cs(C), _ = Je(), u = hs(), P = v(!0), S = v(!1), U = v(r.restaurants.value.length === 0), A = v([]), J = v(0), h = v(1), V = v(""), T = v(""), se = ye(r.restaurants, (e) => {
727
+ e.length > 0 && (U.value = !1, A.value.length > 0 && (A.value = A.value.map((s) => ({
728
+ ...s,
729
+ restaurants: s.doc.isOwner ? s.restaurants : s.managableRestaurantIds.map((F) => {
730
+ var M;
731
+ return ((M = e.find((le) => le._id === F)) == null ? void 0 : M.profile.name) ?? "";
732
+ }).filter(Boolean).sort()
733
+ }))), se());
734
+ }), ne = ({
729
735
  member: e,
730
736
  className: s = ""
731
737
  }) => {
732
- const x = {
738
+ const F = {
733
739
  label: t("common.update"),
734
740
  onClick: () => q(pe.Update, e)
735
- }, C = {
741
+ }, M = {
736
742
  label: t("common.remove"),
737
743
  onClick: () => q(pe.Remove, e),
738
744
  itemClass: "text-fm-color-typo-error"
739
- }, ie = e.doc.isOwner ? [x] : [x, C];
745
+ }, le = e.doc.isOwner ? [F] : [F, M];
740
746
  return p(Vs, {
741
747
  class: s,
742
- items: ie
748
+ items: le
743
749
  }, null);
744
- }, o = (e) => e.doc.isOwner ? t("team.labels.businessOwner") : e.managableRestaurantIds.map((s) => {
745
- var x;
746
- return ((x = n.restaurants.value.find((C) => C._id === s)) == null ? void 0 : x.profile.name) ?? "";
747
- }).filter(Boolean).sort().join(", "), i = [{
750
+ }, o = (e) => e.doc.isOwner ? t("team.labels.businessOwner") : e.restaurants.join(", "), i = [{
748
751
  accessorKey: "name",
749
752
  header: () => t("team.table.columns.name"),
750
753
  enableSorting: !1
@@ -758,7 +761,7 @@ const yt = /* @__PURE__ */ me({
758
761
  enableSorting: !1,
759
762
  cell(e) {
760
763
  const s = e.row.original;
761
- return S.value && !s.doc.isOwner ? p("div", {
764
+ return U.value && !s.doc.isOwner ? p("div", {
762
765
  class: "h-16 w-[120px] animate-pulse rounded bg-fm-color-neutral-gray-200"
763
766
  }, null) : o(s);
764
767
  }
@@ -767,8 +770,8 @@ const yt = /* @__PURE__ */ me({
767
770
  header: () => t("team.table.columns.assignedRoles"),
768
771
  enableSorting: !1,
769
772
  cell(e) {
770
- const s = e.row.original, x = u.getPermissionAssignmentByUserId(s.id), C = (x == null ? void 0 : x.permissionSetIds) || s.doc.permissionSetIds || [];
771
- return _.permissionSets.value.filter((ue) => C.includes(ue.id)).map((ue) => ue.name).join(", ");
773
+ const s = e.row.original, F = u.getPermissionAssignmentByUserId(s.id), M = (F == null ? void 0 : F.permissionSetIds) || s.doc.permissionSetIds || [];
774
+ return _.permissionSets.value.filter((ue) => M.includes(ue.id)).map((ue) => ue.name).join(", ");
772
775
  }
773
776
  }, {
774
777
  accessorKey: "permission",
@@ -789,7 +792,7 @@ const yt = /* @__PURE__ */ me({
789
792
  },
790
793
  cell(e) {
791
794
  const s = e.row.original;
792
- return oe({
795
+ return ne({
793
796
  member: s,
794
797
  className: "flex justify-end w-full"
795
798
  });
@@ -807,7 +810,7 @@ const yt = /* @__PURE__ */ me({
807
810
  name: "info",
808
811
  class: "cursor-pointer text-fm-color-neutral-gray-300"
809
812
  }, null),
810
- content: () => p("div", null, [t("team.labels.permission"), e.permissionLabels.map((x) => p("div", null, [qe("- "), x]))])
813
+ content: () => p("div", null, [t("team.labels.permission"), e.permissionLabels.map((F) => p("div", null, [Ke("- "), F]))])
811
814
  });
812
815
  return p("div", {
813
816
  class: "flex flex-row items-center gap-8"
@@ -815,75 +818,75 @@ const yt = /* @__PURE__ */ me({
815
818
  count: e.permissionLabels.length
816
819
  })]), e.permissionLabels.length > 0 && s]);
817
820
  }
818
- function T(e) {
819
- var ie, ue, ve, $;
820
- const s = u.getPermissionAssignmentByUserId(e.id), x = (s == null ? void 0 : s.customPermissions) || e.permissions || [], C = (s == null ? void 0 : s.permissionSetIds) || [];
821
+ function K(e) {
822
+ var le, ue, fe, $;
823
+ const s = u.getPermissionAssignmentByUserId(e.id), F = (s == null ? void 0 : s.customPermissions) || e.permissions || [], M = (s == null ? void 0 : s.permissionSetIds) || [];
821
824
  return {
822
825
  id: e.id,
823
826
  isOwner: e.doc.isOwner,
824
827
  name: e.name,
825
828
  phoneNumber: e.phoneNumber,
826
829
  email: e.email,
827
- permissions: x,
828
- permissionSetIds: C,
830
+ permissions: F,
831
+ permissionSetIds: M,
829
832
  posUser: e.doc.posUser ? {
830
- code: ((ie = e.doc.posUser) == null ? void 0 : ie.code) ?? "",
833
+ code: ((le = e.doc.posUser) == null ? void 0 : le.code) ?? "",
831
834
  name: ((ue = e.doc.posUser) == null ? void 0 : ue.name) ?? e.name,
832
- passcode: ((ve = e.doc.posUser) == null ? void 0 : ve.passcode) ?? "",
835
+ passcode: ((fe = e.doc.posUser) == null ? void 0 : fe.passcode) ?? "",
833
836
  roles: (($ = e.doc.posUser) == null ? void 0 : $.roles) ?? []
834
837
  } : void 0
835
838
  };
836
839
  }
837
- function Z(e) {
838
- const s = u.getPermissionAssignmentByUserId(e.id), x = (s == null ? void 0 : s.customPermissions) || e.permissions || [], C = (s == null ? void 0 : s.permissionSetIds) || [];
840
+ function Q(e) {
841
+ const s = u.getPermissionAssignmentByUserId(e.id), F = (s == null ? void 0 : s.customPermissions) || e.permissions || [], M = (s == null ? void 0 : s.permissionSetIds) || [];
839
842
  return {
840
843
  id: e.id,
841
844
  isOwner: e.doc.isOwner,
842
845
  name: e.name,
843
846
  phoneNumber: e.phoneNumber,
844
847
  email: e.email,
845
- permissions: x,
846
- permissionSetIds: C,
848
+ permissions: F,
849
+ permissionSetIds: M,
847
850
  posUser: void 0
848
851
  };
849
852
  }
850
- const P = f(!1);
853
+ const w = v(!1);
851
854
  let D = 0;
852
855
  const q = async (e, s) => {
853
856
  if (e == pe.Update) {
854
- const x = ++D;
855
- l.value = Z(s), Q.value = H.UPDATE, P.value = s.doc.hasPosUser === !0;
857
+ const F = ++D;
858
+ l.value = Q(s), Y.value = ee.UPDATE, w.value = s.doc.hasPosUser === !0;
856
859
  try {
857
- const C = await be.readTeamMember(s.id);
858
- if (x !== D) return;
859
- l.value = T(C);
860
+ const M = await be.readTeamMember(s.id);
861
+ if (F !== D) return;
862
+ l.value = K(M);
860
863
  } catch {
861
- if (x !== D) return;
862
- M.open({
864
+ if (F !== D) return;
865
+ C.open({
863
866
  message: t("common.error"),
864
867
  type: "error"
865
- }), K();
868
+ }), z();
866
869
  } finally {
867
- x === D && (P.value = !1);
870
+ F === D && (w.value = !1);
868
871
  }
869
872
  }
870
- e == pe.Remove && Y(s);
871
- }, d = os(), J = f(!1), te = f(!1), Q = f(H.CLOSED), xe = I(() => Q.value !== H.CLOSED), Fe = I(() => Q.value === H.ADD ? t("common.add") : t("common.update")), Ue = I(() => Q.value === H.ADD ? t("team.actions.addMember") : t("team.actions.updateMember")), l = f();
873
+ e == pe.Remove && H(s);
874
+ }, d = os(), X = v(!1), te = v(!1), Y = v(ee.CLOSED), xe = I(() => Y.value !== ee.CLOSED), Fe = I(() => Y.value === ee.ADD ? t("common.add") : t("common.update")), Ue = I(() => Y.value === ee.ADD ? t("team.actions.addMember") : t("team.actions.updateMember")), l = v();
872
875
  function b(e) {
873
- e || (D++, P.value = !1, Q.value = H.CLOSED);
876
+ e || (D++, w.value = !1, Y.value = ee.CLOSED);
874
877
  }
875
- function K() {
876
- D++, P.value = !1, Q.value = H.CLOSED;
878
+ function z() {
879
+ D++, w.value = !1, Y.value = ee.CLOSED;
877
880
  }
878
881
  const {
879
- breakpoints: X
880
- } = Ke(), Y = (e) => {
882
+ breakpoints: Z
883
+ } = qe(), H = (e) => {
881
884
  d.open({
882
885
  title: t("team.actions.removeMember"),
883
886
  message: t("team.removeMember.confirmationMessage", {
884
887
  memberName: e.name
885
888
  }),
886
- minWidth: X.value.lg ? 588 : 0,
889
+ minWidth: Z.value.lg ? 588 : 0,
887
890
  primaryActions: {
888
891
  text: "Remove",
889
892
  close: !1,
@@ -896,7 +899,7 @@ const yt = /* @__PURE__ */ me({
896
899
  }
897
900
  }).onPrimary(async () => {
898
901
  te.value || (await g.minor(async () => {
899
- await be.deleteTeamMember(e.id), await le();
902
+ await be.deleteTeamMember(e.id), await oe();
900
903
  }, {
901
904
  isLoading: te,
902
905
  successMessage: t("team.removeMember.successMessage", {
@@ -906,16 +909,16 @@ const yt = /* @__PURE__ */ me({
906
909
  }), d.close());
907
910
  });
908
911
  }, ae = () => {
909
- l.value = null, Q.value = H.ADD;
910
- }, z = f(), G = f(), ne = I(() => {
912
+ l.value = null, Y.value = ee.ADD;
913
+ }, G = v(), W = v(), re = I(() => {
911
914
  var e;
912
915
  return JSON.stringify({
913
- businessId: ((e = n.currentBusiness.value) == null ? void 0 : e._id) ?? "",
914
- search: A.value.trim(),
915
- restaurantIds: [...z.value ?? []].sort(),
916
- permissionSubjects: [...G.value ?? []].sort()
916
+ businessId: ((e = r.currentBusiness.value) == null ? void 0 : e._id) ?? "",
917
+ search: T.value.trim(),
918
+ restaurantIds: [...G.value ?? []].sort(),
919
+ permissionSubjects: [...W.value ?? []].sort()
917
920
  });
918
- }), re = I(() => Object.values(rs).map((e) => ({
921
+ }), ie = I(() => Object.values(rs).map((e) => ({
919
922
  label: e.label,
920
923
  value: e.subject
921
924
  })));
@@ -923,44 +926,44 @@ const yt = /* @__PURE__ */ me({
923
926
  await L.readRoles();
924
927
  }
925
928
  async function N(e = h.value) {
926
- var s, x;
927
- V.value = !0;
929
+ var s, F;
930
+ P.value = !0;
928
931
  try {
929
- const C = await be.readTeamMembersPage({
932
+ const M = await be.readTeamMembersPage({
930
933
  limit: de,
931
934
  offset: (e - 1) * de,
932
- search: A.value.trim() || void 0,
933
- restaurantIds: (s = z.value) != null && s.length ? z.value : void 0,
934
- permissionSubjects: (x = G.value) != null && x.length ? G.value : void 0
935
+ search: T.value.trim() || void 0,
936
+ restaurantIds: (s = G.value) != null && s.length ? G.value : void 0,
937
+ permissionSubjects: (F = W.value) != null && F.length ? W.value : void 0
935
938
  });
936
- ee.value = C.items, W.value = C.total;
939
+ A.value = M.items, J.value = M.total;
937
940
  } finally {
938
- V.value = !1;
941
+ P.value = !1;
939
942
  }
940
943
  }
941
- async function le() {
944
+ async function oe() {
942
945
  var s;
943
- if (!((s = n.currentBusiness.value) != null && s._id)) return;
946
+ if (!((s = r.currentBusiness.value) != null && s._id)) return;
944
947
  await N(h.value);
945
- const e = Math.max(1, Math.ceil(W.value / de));
948
+ const e = Math.max(1, Math.ceil(J.value / de));
946
949
  h.value > e && (h.value = e, await N(h.value));
947
950
  }
948
- const Se = f();
951
+ const Se = v();
949
952
  async function Qe() {
950
953
  if (!Se.value) return;
951
954
  const e = await Se.value.validate();
952
955
  if (!e) return;
953
- const s = Q.value === H.ADD;
956
+ const s = Y.value === ee.ADD;
954
957
  await g.minor(async () => {
955
- await (s ? be.createTeamMember(e) : be.updateTeamMember(l.value.id, e)), K(), await $e(), await le();
958
+ await (s ? be.createTeamMember(e) : be.updateTeamMember(l.value.id, e)), z(), await $e(), await oe();
956
959
  }, {
957
- isLoading: J,
960
+ isLoading: X,
958
961
  successMessage: s ? t("team.addMember.successMessage", {
959
962
  memberName: e.name
960
963
  }) : t("team.updateMember.successMessage", {
961
964
  memberName: e.name
962
965
  })
963
- }), Q.value = H.CLOSED;
966
+ }), Y.value = ee.CLOSED;
964
967
  }
965
968
  async function Ye() {
966
969
  await _.readPermissionSets();
@@ -973,7 +976,7 @@ const yt = /* @__PURE__ */ me({
973
976
  pageIndex: e
974
977
  }) {
975
978
  var s;
976
- if ((s = n.currentBusiness.value) != null && s._id && !Ve && !(e === 0 && h.value === 1 && ee.value.length > 0)) {
979
+ if ((s = r.currentBusiness.value) != null && s._id && !Ve && !(e === 0 && h.value === 1 && A.value.length > 0)) {
977
980
  Ve = !0, h.value = e + 1;
978
981
  try {
979
982
  await N(h.value);
@@ -982,86 +985,86 @@ const yt = /* @__PURE__ */ me({
982
985
  }
983
986
  }
984
987
  }
985
- const es = ls(w, () => {
986
- A.value = w.value;
988
+ const es = ls(V, () => {
989
+ T.value = V.value;
987
990
  });
988
- return as(es), ye(ne, async () => {
991
+ return as(es), ye(re, async () => {
989
992
  var e;
990
- h.value = 1, U.value = !1, (e = n.currentBusiness.value) != null && e._id && (await N(1), U.value = !0);
993
+ h.value = 1, S.value = !1, (e = r.currentBusiness.value) != null && e._id && (await N(1), S.value = !0);
991
994
  }, {
992
995
  immediate: !0
993
- }), ye(n.currentBusiness, async () => {
996
+ }), ye(r.currentBusiness, async () => {
994
997
  var e;
995
- (e = n.currentBusiness.value) != null && e._id && (await Promise.all([Ye(), $e(), r(), n.restaurants.value.length === 0 ? n.readRestaurants() : Promise.resolve()]), ce());
998
+ (e = r.currentBusiness.value) != null && e._id && (await Promise.all([Ye(), $e(), n(), r.restaurants.value.length === 0 ? r.readRestaurants() : Promise.resolve()]), ce());
996
999
  }, {
997
1000
  immediate: !0
998
1001
  }), y({
999
1002
  create: ae
1000
1003
  }), (e, s) => {
1001
- var ve;
1002
- const x = F("FmSearch"), C = F("FmTable"), ie = F("FmButton"), ue = F("FmSideSheet");
1003
- return v(), E(he, null, [c("div", ut, [c("div", mt, [c("div", ct, [c("div", dt, [p(m(Me), {
1004
- modelValue: z.value,
1005
- "onUpdate:modelValue": s[0] || (s[0] = ($) => z.value = $),
1004
+ var fe;
1005
+ const F = x("FmSearch"), M = x("FmTable"), le = x("FmButton"), ue = x("FmSideSheet");
1006
+ return f(), E(he, null, [c("div", ut, [c("div", mt, [c("div", ct, [c("div", dt, [p(m(Me), {
1007
+ modelValue: G.value,
1008
+ "onUpdate:modelValue": s[0] || (s[0] = ($) => G.value = $),
1006
1009
  "managable-only": !1,
1007
1010
  multiple: "",
1008
1011
  variant: "dark",
1009
1012
  class: "!w-auto"
1010
1013
  }, null, 8, ["modelValue"]), p(De, {
1011
- modelValue: G.value,
1012
- "onUpdate:modelValue": s[1] || (s[1] = ($) => G.value = $),
1014
+ modelValue: W.value,
1015
+ "onUpdate:modelValue": s[1] || (s[1] = ($) => W.value = $),
1013
1016
  multiple: "",
1014
1017
  variant: "dark",
1015
- items: re.value,
1018
+ items: ie.value,
1016
1019
  "selected-prefix": m(t)("team.filter.selected_permission_prefix"),
1017
1020
  placeholder: m(t)("team.filter.permission_placeholder")
1018
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]), p(x, {
1019
- modelValue: w.value,
1020
- "onUpdate:modelValue": s[2] || (s[2] = ($) => w.value = $),
1021
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]), p(F, {
1022
+ modelValue: V.value,
1023
+ "onUpdate:modelValue": s[2] || (s[2] = ($) => V.value = $),
1021
1024
  class: "w-[320px] xs:w-full xs:mt-8",
1022
1025
  autofocus: "",
1023
1026
  placeholder: m(t)("team.search.placeholder")
1024
- }, null, 8, ["modelValue", "placeholder"])]), c("div", pt, [p(x, {
1025
- modelValue: w.value,
1026
- "onUpdate:modelValue": s[3] || (s[3] = ($) => w.value = $),
1027
+ }, null, 8, ["modelValue", "placeholder"])]), c("div", pt, [p(F, {
1028
+ modelValue: V.value,
1029
+ "onUpdate:modelValue": s[3] || (s[3] = ($) => V.value = $),
1027
1030
  class: "w-[320px] xs:w-full xs:mt-8",
1028
1031
  autofocus: "",
1029
1032
  placeholder: m(t)("team.search.placeholder")
1030
- }, null, 8, ["modelValue", "placeholder"]), c("div", vt, [p(m(Me), {
1031
- modelValue: z.value,
1032
- "onUpdate:modelValue": s[4] || (s[4] = ($) => z.value = $),
1033
+ }, null, 8, ["modelValue", "placeholder"]), c("div", ft, [p(m(Me), {
1034
+ modelValue: G.value,
1035
+ "onUpdate:modelValue": s[4] || (s[4] = ($) => G.value = $),
1033
1036
  "managable-only": !1,
1034
1037
  multiple: "",
1035
1038
  variant: "dark",
1036
1039
  class: "!w-auto"
1037
1040
  }, null, 8, ["modelValue"]), p(De, {
1038
- modelValue: G.value,
1039
- "onUpdate:modelValue": s[5] || (s[5] = ($) => G.value = $),
1041
+ modelValue: W.value,
1042
+ "onUpdate:modelValue": s[5] || (s[5] = ($) => W.value = $),
1040
1043
  multiple: "",
1041
1044
  variant: "dark",
1042
- items: re.value,
1045
+ items: ie.value,
1043
1046
  "selected-prefix": m(t)("team.filter.selected_permission_prefix"),
1044
1047
  placeholder: m(t)("team.filter.permission_placeholder")
1045
- }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]), (ve = m(n).currentBusiness.value) != null && ve._id ? (v(), k(is, {
1048
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]), (fe = m(r).currentBusiness.value) != null && fe._id ? (f(), k(is, {
1046
1049
  key: 0
1047
1050
  }, {
1048
- default: j(() => [c("div", ft, [!U.value && V.value ? (v(), k(us, {
1049
- key: 0
1050
- })) : !U.value || W.value === 0 ? (v(), k(m(ms), {
1051
+ default: j(() => [c("div", vt, [S.value ? J.value === 0 ? (f(), k(m(ms), {
1051
1052
  key: 1,
1052
1053
  title: m(t)("team.emptyState.title"),
1053
1054
  subtitle: m(t)("team.emptyState.description")
1054
- }, null, 8, ["title", "subtitle"])) : O("", !0), U.value ? (v(), k(C, {
1055
- key: ne.value,
1055
+ }, null, 8, ["title", "subtitle"])) : O("", !0) : (f(), k(us, {
1056
+ key: 0
1057
+ })), S.value ? (f(), k(M, {
1058
+ key: re.value,
1056
1059
  "column-defs": i,
1057
- "row-data": ee.value,
1060
+ "row-data": A.value,
1058
1061
  "page-size": de,
1059
- "page-count": Math.ceil(W.value / de),
1060
- "row-count": W.value,
1062
+ "page-count": Math.ceil(J.value / de),
1063
+ "row-count": J.value,
1061
1064
  "fetch-fn": He,
1062
- "hide-footer": W.value <= de,
1065
+ "hide-footer": J.value <= de,
1063
1066
  virtual: !1,
1064
- loading: V.value,
1067
+ loading: P.value,
1065
1068
  class: "team-member-list-table min-h-0 flex-1",
1066
1069
  "pin-header-row": "",
1067
1070
  onRowClick: s[6] || (s[6] = ($) => q(m(pe).Update, $.original))
@@ -1075,30 +1078,30 @@ const yt = /* @__PURE__ */ me({
1075
1078
  class: "absolute",
1076
1079
  "onUpdate:modelValue": s[7] || (s[7] = ($) => b($))
1077
1080
  }, {
1078
- "side-sheet-footer": j(() => [c("div", bt, [p(ie, {
1081
+ "side-sheet-footer": j(() => [c("div", bt, [p(le, {
1079
1082
  label: Fe.value,
1080
1083
  size: "md",
1081
1084
  variant: "primary",
1082
- disabled: J.value || P.value,
1085
+ disabled: X.value || w.value,
1083
1086
  onClick: Ee(Qe, ["prevent"])
1084
- }, null, 8, ["label", "disabled"]), p(ie, {
1087
+ }, null, 8, ["label", "disabled"]), p(le, {
1085
1088
  label: m(t)("common.cancel"),
1086
1089
  size: "md",
1087
1090
  variant: "secondary",
1088
- disabled: J.value,
1089
- onClick: K
1091
+ disabled: X.value,
1092
+ onClick: z
1090
1093
  }, null, 8, ["label", "disabled"])])]),
1091
1094
  default: j(() => [p(it, {
1092
1095
  ref_key: "memberForm",
1093
1096
  ref: Se,
1094
1097
  initialValue: l.value,
1095
- "is-loading-master-user": P.value
1098
+ "is-loading-master-user": w.value
1096
1099
  }, null, 8, ["initialValue", "is-loading-master-user"])]),
1097
1100
  _: 1
1098
1101
  }, 8, ["header", "model-value"])], 64);
1099
1102
  };
1100
1103
  }
1101
- }), Ct = /* @__PURE__ */ Ge(yt, [["__scopeId", "data-v-3716cb64"]]);
1104
+ }), Ct = /* @__PURE__ */ Ge(yt, [["__scopeId", "data-v-d77998ca"]]);
1102
1105
  export {
1103
1106
  Ct as default
1104
1107
  };