@feedmepos/mf-hrm-portal 2.0.17-dev.5 → 2.0.17

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