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