@feedmepos/mf-hrm-portal 2.1.0-dev.3 → 2.1.1-dev

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