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