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