@feedmepos/mf-hrm-portal 2.0.3-dev → 2.0.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 (130) hide show
  1. package/dist/AuditLogList-DzzjaV-o.js +492 -0
  2. package/dist/{EmployeeList-D5IfP20e.js → EmployeeList-D5QaYblG.js} +6 -6
  3. package/dist/{Main-hADhiwrp.js → Main-C3m7HI9_.js} +5 -5
  4. package/dist/{Main-mvm27j-a.js → Main-T_E5KrHZ.js} +8 -8
  5. package/dist/PermissionSetList-B0r1Zvxn.js +337 -0
  6. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-B6TBX159.js +3360 -0
  7. package/dist/{RoleList-C0gK0AMO.js → RoleList-CAefesZr.js} +6 -6
  8. package/dist/{SelectFilter-NbXrJ4iH.js → SelectFilter-DUj7GBtT.js} +93 -89
  9. package/dist/TeamMemberList-CdvOoijY.js +988 -0
  10. package/dist/{TimesheetList-C3jduNcK.js → TimesheetList-DssVgr5n.js} +6 -6
  11. package/dist/{app-CXscIHdd.js → app-BWf6RVbF.js} +606 -567
  12. package/dist/app.js +2 -2
  13. package/dist/{dayjs.min-Bc0i83P9.js → dayjs.min-lryG40lo.js} +1 -1
  14. package/dist/{employee-Se3Yks-o.js → employee-CxGGtb8O.js} +3 -3
  15. package/dist/{index-D35d9iES.js → index-BU0GrqVB.js} +1 -1
  16. package/dist/{index-DOp84DcN.js → index-Bcq1VM6Y.js} +1989 -1936
  17. package/dist/{lodash-DuiYjdnV.js → lodash-BE8Ewygc.js} +1 -1
  18. package/dist/{api → src/api}/permission-assignment/index.d.ts +3 -0
  19. package/dist/{api → src/api}/report-query/index.d.ts +1 -0
  20. package/dist/{components → src/components}/form/SelectFilter.vue.d.ts +2 -0
  21. package/dist/{helpers → src/helpers}/permission-set.d.ts +25 -3
  22. package/dist/src/helpers/permission-set.test.d.ts +1 -0
  23. package/dist/{types → src/types}/report-query.d.ts +1 -0
  24. package/dist/{team-CT4SDg-h.js → team-DwEBaUCP.js} +1 -1
  25. package/dist/{timesheet-D0SI4Zli.js → timesheet-CTi2CKqU.js} +2 -2
  26. package/dist/tsconfig.app.tsbuildinfo +1 -1
  27. package/dist/{useAppStore-TCd8aSgi.js → useAppStore-D2zBOPcx.js} +1 -1
  28. package/dist/{useLoading-CwO9YfJb.js → useLoading-V1InDRtT.js} +1 -1
  29. package/dist/{useReportPermissions-CmtxmL3h.js → useReportPermissions-Dpxpt8rj.js} +2 -2
  30. package/package.json +3 -3
  31. package/dist/AuditLogList-wzVOem7J.js +0 -474
  32. package/dist/PermissionSetList-DgaTwV_y.js +0 -327
  33. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BzA__vQJ.js +0 -3287
  34. package/dist/TeamMemberList-BVAbjvKZ.js +0 -979
  35. /package/dist/{App.vue.d.ts → src/App.vue.d.ts} +0 -0
  36. /package/dist/{Entry.vue.d.ts → src/Entry.vue.d.ts} +0 -0
  37. /package/dist/{api → src/api}/audit-log/index.d.ts +0 -0
  38. /package/dist/{api → src/api}/employee/index.d.ts +0 -0
  39. /package/dist/{api → src/api}/index.d.ts +0 -0
  40. /package/dist/{api → src/api}/inventory/index.d.ts +0 -0
  41. /package/dist/{api → src/api}/permission-set/index.d.ts +0 -0
  42. /package/dist/{api → src/api}/public-setting/index.d.ts +0 -0
  43. /package/dist/{api → src/api}/role/index.d.ts +0 -0
  44. /package/dist/{api → src/api}/team/index.d.ts +0 -0
  45. /package/dist/{api → src/api}/timesheet/index.d.ts +0 -0
  46. /package/dist/{api → src/api}/user/index.d.ts +0 -0
  47. /package/dist/{app.d.ts → src/app.d.ts} +0 -0
  48. /package/dist/{components → src/components}/AppForm.vue.d.ts +0 -0
  49. /package/dist/{components → src/components}/CheckboxInput.vue.d.ts +0 -0
  50. /package/dist/{components → src/components}/CollapsibleWrapper.vue.d.ts +0 -0
  51. /package/dist/{components → src/components}/Navigator.vue.d.ts +0 -0
  52. /package/dist/{components → src/components}/Splash.vue.d.ts +0 -0
  53. /package/dist/{components → src/components}/button/ResponsiveFabButton.vue.d.ts +0 -0
  54. /package/dist/{components → src/components}/layout/FormColumn.vue.d.ts +0 -0
  55. /package/dist/{components → src/components}/layout/FormItem.vue.d.ts +0 -0
  56. /package/dist/{components → src/components}/layout/FormSection.vue.d.ts +0 -0
  57. /package/dist/{components → src/components}/layout/FullWrapper.vue.d.ts +0 -0
  58. /package/dist/{components → src/components}/layout/HorizontalSplitter.vue.d.ts +0 -0
  59. /package/dist/{components → src/components}/layout/LottieAnimation.vue.d.ts +0 -0
  60. /package/dist/{components → src/components}/layout/PageLayout.vue.d.ts +0 -0
  61. /package/dist/{components → src/components}/loading/AppLoading.vue.d.ts +0 -0
  62. /package/dist/{components → src/components}/loading/PageLoading.vue.d.ts +0 -0
  63. /package/dist/{components → src/components}/loading/index.d.ts +0 -0
  64. /package/dist/{components → src/components}/menu/BottomSheetMenu.vue.d.ts +0 -0
  65. /package/dist/{components → src/components}/menu/BottomSheetMenuItem.vue.d.ts +0 -0
  66. /package/dist/{components → src/components}/menu/ResponsiveContextMenu.vue.d.ts +0 -0
  67. /package/dist/{components → src/components}/table/EmptyDataTemplate/Icon.vue.d.ts +0 -0
  68. /package/dist/{components → src/components}/table/EmptyDataTemplate/index.d.ts +0 -0
  69. /package/dist/{components → src/components}/table/EmptyDataTemplate/index.vue.d.ts +0 -0
  70. /package/dist/{composables → src/composables}/useAppStore.d.ts +0 -0
  71. /package/dist/{composables → src/composables}/useCustomReportPermissions.d.ts +0 -0
  72. /package/dist/{composables → src/composables}/useDateRange.d.ts +0 -0
  73. /package/dist/{composables → src/composables}/useDiscardConfirm.d.ts +0 -0
  74. /package/dist/{composables → src/composables}/useElementPosition.d.ts +0 -0
  75. /package/dist/{composables → src/composables}/useFilterSelector.d.ts +0 -0
  76. /package/dist/{composables → src/composables}/useLoading.d.ts +0 -0
  77. /package/dist/{composables → src/composables}/useMessage.d.ts +0 -0
  78. /package/dist/{composables → src/composables}/useReportPermissions.d.ts +0 -0
  79. /package/dist/{composables → src/composables}/useRestaurantMap.d.ts +0 -0
  80. /package/dist/{composables → src/composables}/useSearch.d.ts +0 -0
  81. /package/dist/{composables → src/composables}/useSheet.d.ts +0 -0
  82. /package/dist/{helpers → src/helpers}/component.d.ts +0 -0
  83. /package/dist/{helpers → src/helpers}/iteration.d.ts +0 -0
  84. /package/dist/{helpers → src/helpers}/object.d.ts +0 -0
  85. /package/dist/{helpers → src/helpers}/portal-user.d.ts +0 -0
  86. /package/dist/{helpers → src/helpers}/rule.d.ts +0 -0
  87. /package/dist/{helpers → src/helpers}/string.d.ts +0 -0
  88. /package/dist/{helpers → src/helpers}/utils.d.ts +0 -0
  89. /package/dist/{main.d.ts → src/main.d.ts} +0 -0
  90. /package/dist/{router → src/router}/index.d.ts +0 -0
  91. /package/dist/{router → src/router}/shared.d.ts +0 -0
  92. /package/dist/{stores → src/stores}/employee.d.ts +0 -0
  93. /package/dist/{stores → src/stores}/permission-assignment.d.ts +0 -0
  94. /package/dist/{stores → src/stores}/permission-set.d.ts +0 -0
  95. /package/dist/{stores → src/stores}/role.d.ts +0 -0
  96. /package/dist/{stores → src/stores}/team.d.ts +0 -0
  97. /package/dist/{stores → src/stores}/timesheet.d.ts +0 -0
  98. /package/dist/{types → src/types}/audit-log.d.ts +0 -0
  99. /package/dist/{types → src/types}/employee.d.ts +0 -0
  100. /package/dist/{types → src/types}/permission-assignment.d.ts +0 -0
  101. /package/dist/{types → src/types}/permission-set.d.ts +0 -0
  102. /package/dist/{types → src/types}/restaurant.d.ts +0 -0
  103. /package/dist/{types → src/types}/role.d.ts +0 -0
  104. /package/dist/{types → src/types}/team.d.ts +0 -0
  105. /package/dist/{types → src/types}/timesheet.d.ts +0 -0
  106. /package/dist/{views → src/views}/audit-log/AuditLogList.vue.d.ts +0 -0
  107. /package/dist/{views → src/views}/audit-log/locales/index.d.ts +0 -0
  108. /package/dist/{views → src/views}/hr/Main.vue.d.ts +0 -0
  109. /package/dist/{views → src/views}/hr/employee/Employee.vue.d.ts +0 -0
  110. /package/dist/{views → src/views}/hr/employee/EmployeeForm.vue.d.ts +0 -0
  111. /package/dist/{views → src/views}/hr/employee/EmployeeList.vue.d.ts +0 -0
  112. /package/dist/{views → src/views}/hr/locales/index.d.ts +0 -0
  113. /package/dist/{views → src/views}/hr/role/RoleForm.vue.d.ts +0 -0
  114. /package/dist/{views → src/views}/hr/role/RoleList.vue.d.ts +0 -0
  115. /package/dist/{views → src/views}/hr/timesheet/TimesheetList.vue.d.ts +0 -0
  116. /package/dist/{views → src/views}/team/Main.vue.d.ts +0 -0
  117. /package/dist/{views → src/views}/team/components/BasePermission.vue.d.ts +0 -0
  118. /package/dist/{views → src/views}/team/components/ConditionPermission.vue.d.ts +0 -0
  119. /package/dist/{views → src/views}/team/components/InheritPermissionTooltip.vue.d.ts +0 -0
  120. /package/dist/{views → src/views}/team/components/PermissionWithTooltip.vue.d.ts +0 -0
  121. /package/dist/{views → src/views}/team/components/PortalPermissionEditor.vue.d.ts +0 -0
  122. /package/dist/{views → src/views}/team/components/PortalUserSearcher.vue.d.ts +0 -0
  123. /package/dist/{views → src/views}/team/components/PosRolePermission.vue.d.ts +0 -0
  124. /package/dist/{views → src/views}/team/locales/index.d.ts +0 -0
  125. /package/dist/{views → src/views}/team/member/AddMemberForm.vue.d.ts +0 -0
  126. /package/dist/{views → src/views}/team/member/MemberInfo.vue.d.ts +0 -0
  127. /package/dist/{views → src/views}/team/member/TeamMemberList.vue.d.ts +0 -0
  128. /package/dist/{views → src/views}/team/member/TeamMemberMasterUser.vue.d.ts +0 -0
  129. /package/dist/{views → src/views}/team/permission-set/PermissionSetForm.vue.d.ts +0 -0
  130. /package/dist/{views → src/views}/team/permission-set/PermissionSetList.vue.d.ts +0 -0
@@ -0,0 +1,988 @@
1
+ import { defineComponent as ae, ref as F, resolveComponent as _, createBlock as I, openBlock as v, withCtx as E, createElementVNode as m, renderSlot as be, createCommentVNode as J, withModifiers as Re, nextTick as $e, createElementBlock as q, normalizeClass as Ie, createTextVNode as Ce, toDisplayString as B, computed as S, Fragment as ue, renderList as ye, createVNode as d, unref as r, watch as Me, isRef as he, createSlots as Le } from "vue";
2
+ import { useI18n as de, useCoreStore as ce, baseClientInstance as ge, RestaurantSelector as Ve } from "@feedmepos/mf-common";
3
+ import { useBreakpoints as Ne, useSnackbar as Be, useDialog as Te, components as Fe } from "@feedmepos/ui-library";
4
+ import { _ as ze, S as xe } from "./SelectFilter-DUj7GBtT.js";
5
+ import { a as Se, f as qe, U as Ke, _ as Ge } from "./app-BWf6RVbF.js";
6
+ import { _ as We } from "./index.vue_vue_type_script_setup_true_lang-Vc5ARO29.js";
7
+ import { u as De } from "./useSearch-B6WK1LBB.js";
8
+ import { u as Je } from "./useLoading-V1InDRtT.js";
9
+ import { g as Ue, l as Oe, u as je, m as Xe, n as Qe, o as pe, q as Ae, p as we, v as Ye, w as Pe, x as Ze, y as He, z as et, A as tt, B as st, t as fe } from "./index-Bcq1VM6Y.js";
10
+ import "./index-BU0GrqVB.js";
11
+ import { u as Ee } from "./useAppStore-D2zBOPcx.js";
12
+ /* empty css */
13
+ import { _ as ot, a as at } from "./PortalPermissionEditor.vue_vue_type_script_setup_true_lang-B6TBX159.js";
14
+ import { u as lt } from "./team-DwEBaUCP.js";
15
+ const nt = /* @__PURE__ */ ae({
16
+ __name: "BottomSheetMenu",
17
+ setup(o) {
18
+ const f = F(!1);
19
+ async function l() {
20
+ await $e(), f.value = !f.value;
21
+ }
22
+ return (s, u) => {
23
+ const D = _("FmButton"), N = _("FmBottomSheet");
24
+ return v(), I(N, {
25
+ modelValue: f.value,
26
+ "onUpdate:modelValue": u[1] || (u[1] = (h) => f.value = h),
27
+ "dismiss-away": "",
28
+ "no-header": "",
29
+ "z-index": 110
30
+ }, {
31
+ "bottom-sheet-button": E(() => [
32
+ s.$slots.button ? J("", !0) : (v(), I(D, {
33
+ key: 0,
34
+ icon: "more_vert",
35
+ variant: "tertiary",
36
+ onClick: Re(l, ["stop"])
37
+ })),
38
+ be(s.$slots, "button")
39
+ ]),
40
+ default: E(() => [
41
+ m("div", {
42
+ onClick: u[0] || (u[0] = (h) => f.value = !1)
43
+ }, [
44
+ be(s.$slots, "default")
45
+ ])
46
+ ]),
47
+ _: 3
48
+ }, 8, ["modelValue"]);
49
+ };
50
+ }
51
+ }), rt = { class: "py-8 px-12 hover:bg-fm-color-neutral-gray-100" }, it = /* @__PURE__ */ ae({
52
+ __name: "BottomSheetMenuItem",
53
+ props: {
54
+ label: {},
55
+ icon: {},
56
+ disabled: { type: Boolean },
57
+ itemClass: {}
58
+ },
59
+ setup(o) {
60
+ const f = o;
61
+ return (l, s) => {
62
+ const u = _("FmIcon");
63
+ return v(), q("div", rt, [
64
+ l.$slots.content ? J("", !0) : (v(), q("div", {
65
+ key: 0,
66
+ class: Ie(["flex items-center", {
67
+ "text-fm-color-typo-disabled": f.disabled,
68
+ "cursor-pointer": !f.disabled,
69
+ "cursor-not-allowed": f.disabled,
70
+ [f.itemClass || ""]: f.itemClass && !f.disabled
71
+ }])
72
+ }, [
73
+ o.icon ? (v(), I(u, {
74
+ key: 0,
75
+ name: o.icon
76
+ }, null, 8, ["name"])) : J("", !0),
77
+ Ce(" " + B(o.label), 1)
78
+ ], 2)),
79
+ be(l.$slots, "content")
80
+ ]);
81
+ };
82
+ }
83
+ }), mt = /* @__PURE__ */ ae({
84
+ __name: "ResponsiveContextMenu",
85
+ props: {
86
+ items: {}
87
+ },
88
+ setup(o) {
89
+ const f = Ne(), l = S(() => f.breakpoints.value.xs);
90
+ return (s, u) => {
91
+ const D = _("FmButton"), N = _("FmMenuItem"), h = _("FmMenu");
92
+ return l.value ? (v(), I(nt, { key: 0 }, {
93
+ default: E(() => [
94
+ (v(!0), q(ue, null, ye(o.items, ({ icon: y, label: p, disabled: U, itemClass: x, onClick: O }) => (v(), I(it, {
95
+ key: p,
96
+ icon: y,
97
+ label: p,
98
+ disabled: U,
99
+ itemClass: x,
100
+ onClick: () => {
101
+ !U && (O == null || O());
102
+ }
103
+ }, null, 8, ["icon", "label", "disabled", "itemClass", "onClick"]))), 128))
104
+ ]),
105
+ _: 1
106
+ })) : (v(), I(h, {
107
+ key: 1,
108
+ "stop-click-propagation": "",
109
+ shift: !0
110
+ }, {
111
+ "menu-button": E(() => [
112
+ d(D, {
113
+ type: "button",
114
+ variant: "tertiary",
115
+ icon: "more_vert",
116
+ "text-color": "neutral-gray-400",
117
+ size: "md"
118
+ })
119
+ ]),
120
+ default: E(() => [
121
+ (v(!0), q(ue, null, ye(o.items, ({ label: y, disabled: p, itemClass: U, onClick: x }) => (v(), I(N, {
122
+ key: y,
123
+ disabled: p,
124
+ label: y,
125
+ onClick: () => {
126
+ !p && (x == null || x());
127
+ }
128
+ }, {
129
+ label: E(() => [
130
+ m("span", {
131
+ class: Ie(p ? "text-fm-color-typo-disabled" : U)
132
+ }, B(y), 3)
133
+ ]),
134
+ _: 2
135
+ }, 1032, ["disabled", "label", "onClick"]))), 128))
136
+ ]),
137
+ _: 1
138
+ }));
139
+ };
140
+ }
141
+ });
142
+ var ie = /* @__PURE__ */ ((o) => (o.Update = "Update", o.Remove = "Remove", o))(ie || {});
143
+ const ut = { class: "w-full flex flex-col gap-16" }, ct = { class: "flex items-center gap-16" }, dt = { class: "space-y-4 min-w-0 flex-1" }, pt = { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400" }, ft = { class: "fm-typo-en-body-lg-600 truncate" }, vt = { class: "w-full flex gap-16 items-center" }, bt = { class: "flex-1 flex flex-col gap-4 min-w-0" }, yt = { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400" }, ht = { class: "fm-typo-en-body-lg-600 truncate" }, _t = { class: "flex-1 flex flex-col gap-4 min-w-0" }, gt = { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400" }, Vt = { class: "fm-typo-en-body-lg-600 truncate" }, Ft = /* @__PURE__ */ ae({
144
+ __name: "MemberInfo",
145
+ props: {
146
+ data: {}
147
+ },
148
+ setup(o) {
149
+ const { t: f } = de();
150
+ return (l, s) => {
151
+ const u = _("FmAvatar");
152
+ return v(), q("div", ut, [
153
+ m("div", ct, [
154
+ d(u, {
155
+ size: "xl",
156
+ initials: o.data.name
157
+ }, null, 8, ["initials"]),
158
+ m("div", dt, [
159
+ m("p", pt, B(r(f)("team.memberForm.memberInfo.memberName")), 1),
160
+ m("p", ft, B(o.data.name || "--"), 1)
161
+ ])
162
+ ]),
163
+ m("div", vt, [
164
+ m("div", bt, [
165
+ m("p", yt, B(r(f)("team.memberForm.memberInfo.mobileNumber")), 1),
166
+ m("p", ht, B(o.data.phoneNumber || "--"), 1)
167
+ ]),
168
+ m("div", _t, [
169
+ m("p", gt, B(r(f)("team.memberForm.memberInfo.emailAddress")), 1),
170
+ m("p", Vt, B(o.data.email || "--"), 1)
171
+ ])
172
+ ])
173
+ ]);
174
+ };
175
+ }
176
+ }), ke = {
177
+ async readPermissionUserByPhoneNo(o) {
178
+ var l;
179
+ const { currentBusiness: f } = ce();
180
+ return Ue(
181
+ await ge("/").get(`/user/b/${(l = f.value) == null ? void 0 : l._id}/phone/${o}`)
182
+ );
183
+ },
184
+ async readPermissionUserByEmail(o) {
185
+ var l;
186
+ const { currentBusiness: f } = ce();
187
+ return Ue(
188
+ await ge("/").get(`/user/b/${(l = f.value) == null ? void 0 : l._id}/email/${o}`)
189
+ );
190
+ }
191
+ }, xt = { class: "flex flex-col gap-24 w-full" }, St = {
192
+ key: 0,
193
+ class: "flex flex-col gap-8"
194
+ }, Ut = { class: "user-info-icon user-info-icon--lg" }, wt = { class: "flex-1 overflow-hidden" }, Pt = { class: "profile-displayName" }, kt = { class: "profile-email" }, Rt = { class: "profile-phone" }, $t = { key: 2 }, It = /* @__PURE__ */ ae({
195
+ __name: "PortalUserSearcher",
196
+ emits: ["invite"],
197
+ setup(o, { emit: f }) {
198
+ const l = f, { t: s } = de(), u = Be(), D = ce(), N = F("phone"), h = F(""), y = F(""), p = F();
199
+ async function U() {
200
+ if (!h.value && !y.value) {
201
+ u.open({
202
+ type: "error",
203
+ title: s("team.memberForm.searchUser.emptyError")
204
+ });
205
+ return;
206
+ }
207
+ const g = N.value === "phone" ? await ke.readPermissionUserByPhoneNo(h.value.replace(/ /g, "")) : await ke.readPermissionUserByEmail(y.value);
208
+ g || u.open({
209
+ type: "error",
210
+ title: s("team.memberForm.searchUser.userNotFound")
211
+ }), p.value = g;
212
+ }
213
+ const x = S(() => {
214
+ var X;
215
+ let g = ((X = p.value) == null ? void 0 : X.displayName) ?? "";
216
+ g || (g = "Feed Me");
217
+ const [k, L] = g.split(" ");
218
+ return L ? `${k[0]}${L[0]}` : k.slice(0, 2);
219
+ }), O = F(!1);
220
+ function ee(g) {
221
+ l("invite", g), O.value = !0;
222
+ }
223
+ function le() {
224
+ O.value = !1;
225
+ }
226
+ return (g, k) => {
227
+ var w, R, T;
228
+ const L = _("FmRadio"), X = _("FmPhoneNumber"), C = _("FmTextField"), a = _("FmRadioGroup"), n = _("FmButton");
229
+ return v(), q("div", xt, [
230
+ O.value ? J("", !0) : (v(), q("div", St, [
231
+ d(a, {
232
+ modelValue: N.value,
233
+ "onUpdate:modelValue": k[2] || (k[2] = ($) => N.value = $)
234
+ }, {
235
+ default: E(() => [
236
+ d(L, {
237
+ value: "phone",
238
+ label: r(s)("team.memberForm.searchUser.phoneNumber")
239
+ }, null, 8, ["label"]),
240
+ N.value === "phone" ? (v(), I(X, {
241
+ key: 0,
242
+ modelValue: h.value,
243
+ "onUpdate:modelValue": k[0] || (k[0] = ($) => h.value = $),
244
+ "extra-country-codes": r(D).enabledCountries.value,
245
+ class: "ml-8"
246
+ }, null, 8, ["modelValue", "extra-country-codes"])) : J("", !0),
247
+ d(L, {
248
+ value: "email",
249
+ label: r(s)("team.memberForm.searchUser.email")
250
+ }, null, 8, ["label"]),
251
+ N.value === "email" ? (v(), I(C, {
252
+ key: 1,
253
+ modelValue: y.value,
254
+ "onUpdate:modelValue": k[1] || (k[1] = ($) => y.value = $),
255
+ placeholder: r(s)("team.memberForm.searchUser.emailPlaceholder"),
256
+ class: "ml-8"
257
+ }, null, 8, ["modelValue", "placeholder"])) : J("", !0)
258
+ ]),
259
+ _: 1
260
+ }, 8, ["modelValue"]),
261
+ d(n, {
262
+ label: r(s)("team.memberForm.searchUser.search"),
263
+ variant: "secondary",
264
+ onClick: U
265
+ }, null, 8, ["label"])
266
+ ])),
267
+ p.value ? (v(), q("div", {
268
+ key: 1,
269
+ class: "profile-menu--profile cursor-pointer hover:bg-fm-color-opacity-sm",
270
+ onClick: k[3] || (k[3] = ($) => ee(p.value))
271
+ }, [
272
+ m("div", Ut, B(x.value), 1),
273
+ m("div", wt, [
274
+ m("p", Pt, B((w = p.value) == null ? void 0 : w.displayName), 1),
275
+ m("p", kt, B((R = p.value) == null ? void 0 : R.email), 1),
276
+ m("p", Rt, B((T = p.value) == null ? void 0 : T.phoneNumber), 1)
277
+ ])
278
+ ])) : J("", !0),
279
+ O.value ? (v(), q("div", $t, [
280
+ d(n, {
281
+ label: r(s)("team.memberForm.searchUser.changeUser"),
282
+ variant: "secondary",
283
+ onClick: le
284
+ }, null, 8, ["label"])
285
+ ])) : J("", !0)
286
+ ]);
287
+ };
288
+ }
289
+ }), Ct = /* @__PURE__ */ ze(It, [["__scopeId", "data-v-c2c7ed35"]]), Mt = { class: "flex flex-col gap-40" }, Nt = { class: "flex items-center" }, Bt = { class: "flex-1 flex flex-col" }, Dt = { class: "fm-typo-en-title-sm-600" }, Ot = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, jt = { class: "flex flex-row gap-16" }, At = { class: "flex flex-col gap-8" }, Et = { class: "fm-typo-en-body-lg-400" }, Lt = { class: "p-16 fm-corner-radius-lg border border-fm-color-neutral-gray-200" }, ve = 4, Tt = /* @__PURE__ */ ae({
290
+ __name: "TeamMemberMasterUser",
291
+ props: {
292
+ modelValue: {
293
+ type: Object,
294
+ default: void 0
295
+ },
296
+ fallbackName: {
297
+ type: String,
298
+ required: !0
299
+ },
300
+ fallbackPasscode: {
301
+ type: String,
302
+ default: void 0
303
+ },
304
+ restaurants: {
305
+ type: Array,
306
+ required: !0
307
+ },
308
+ roles: {
309
+ type: Array,
310
+ required: !0
311
+ }
312
+ },
313
+ emits: ["update:model-value"],
314
+ setup(o, { emit: f }) {
315
+ const l = o, s = f, { t: u } = de(), { searchKey: D, filter: N } = De(""), h = F(!0), y = F([]), p = S(() => {
316
+ const a = {};
317
+ return l.roles.forEach((n) => {
318
+ a[n.value] = n.label;
319
+ }), a;
320
+ }), U = S(() => {
321
+ var n;
322
+ const a = {};
323
+ return (n = l.modelValue) == null || n.roles.forEach((w) => {
324
+ a[w.restaurantId] = w.roleId;
325
+ }), a;
326
+ }), x = S(() => l.restaurants.filter((a) => N([a.profile.name, a.profile.code, ee(a._id)])).map((a) => ({
327
+ label: `${a.profile.code ? a.profile.code + "-" : ""}${a.profile.name}`,
328
+ value: a._id,
329
+ slot: `checkbox-${a._id}-bottom`,
330
+ disable: l.roles.filter((n) => !n.disabled).length === 0,
331
+ roleOptions: l.roles
332
+ }))), O = S(() => {
333
+ const a = l.roles.find((n) => !n.disabled);
334
+ return a ? a.value : null;
335
+ });
336
+ function ee(a) {
337
+ const n = U.value[a] ?? "";
338
+ return p.value[n] || "";
339
+ }
340
+ function le(a) {
341
+ a ? l.modelValue || s("update:model-value", {
342
+ code: "",
343
+ name: l.fallbackName,
344
+ roles: [],
345
+ passcode: l.fallbackPasscode || ""
346
+ }) : s("update:model-value", void 0);
347
+ }
348
+ function g(a, n) {
349
+ if (!l.modelValue || a === "passcode" && l.modelValue.passcode === n)
350
+ return;
351
+ const w = Oe(l.modelValue);
352
+ w[a] = n, s("update:model-value", w);
353
+ }
354
+ function k(a) {
355
+ g(
356
+ "roles",
357
+ a.map((n) => {
358
+ var T, $, se;
359
+ const w = ($ = (T = x.value.find((Q) => Q.value === n)) == null ? void 0 : T.roleOptions.find((Q) => !Q.disabled)) == null ? void 0 : $.value, R = (se = l.modelValue) == null ? void 0 : se.roles.find((Q) => Q.restaurantId === n);
360
+ return {
361
+ restaurantId: n,
362
+ roleId: (R == null ? void 0 : R.roleId) || w
363
+ };
364
+ })
365
+ );
366
+ }
367
+ function L(a, n) {
368
+ g("roles", [
369
+ ...l.modelValue.roles.filter(
370
+ (w) => w.restaurantId !== a
371
+ ),
372
+ {
373
+ restaurantId: a,
374
+ roleId: n
375
+ }
376
+ ]);
377
+ }
378
+ function X() {
379
+ h.value && (h.value = !1, y.value = [], g("passcode", ""));
380
+ }
381
+ Me(
382
+ () => {
383
+ var a;
384
+ return (a = l.modelValue) == null ? void 0 : a.passcode;
385
+ },
386
+ (a) => {
387
+ a && a.length === ve ? (y.value = a.split(""), h.value = !0) : (y.value = [], h.value = !1);
388
+ },
389
+ { immediate: !0 }
390
+ );
391
+ const C = S({
392
+ get: () => {
393
+ var a;
394
+ return ((a = l.modelValue) == null ? void 0 : a.roles) ?? [];
395
+ },
396
+ set: () => {
397
+ }
398
+ });
399
+ return (a, n) => {
400
+ const w = _("FmSwitch"), R = _("FmTextField"), T = _("FmPinField"), $ = _("FmFormGroup"), se = _("FmSearch"), Q = _("FmSelect");
401
+ return v(), q("div", Mt, [
402
+ m("div", Nt, [
403
+ m("div", Bt, [
404
+ m("div", Dt, B(r(u)("team.memberForm.masterUser.title")), 1),
405
+ m("div", Ot, B(r(u)("team.memberForm.masterUser.sublabel")), 1)
406
+ ]),
407
+ m("div", null, [
408
+ d(w, {
409
+ "model-value": !!o.modelValue,
410
+ value: "master-user",
411
+ "onUpdate:modelValue": le
412
+ }, null, 8, ["model-value"])
413
+ ])
414
+ ]),
415
+ o.modelValue ? (v(), q(ue, { key: 0 }, [
416
+ m("div", jt, [
417
+ d(R, {
418
+ "model-value": o.modelValue.code,
419
+ label: r(u)("team.memberForm.masterUser.code"),
420
+ "onUpdate:modelValue": n[0] || (n[0] = (c) => g("code", c))
421
+ }, null, 8, ["model-value", "label"]),
422
+ d(R, {
423
+ "model-value": o.modelValue.name,
424
+ class: "w-full",
425
+ label: r(u)("team.memberForm.masterUser.name"),
426
+ rules: [(c) => !!c || r(u)("team.memberForm.masterUser.nameEmptyError")],
427
+ "onUpdate:modelValue": n[1] || (n[1] = (c) => g("name", c))
428
+ }, null, 8, ["model-value", "label", "rules"])
429
+ ]),
430
+ m("div", At, [
431
+ m("div", Et, B(r(u)("team.memberForm.masterUser.passcode")), 1),
432
+ d($, {
433
+ modelValue: y.value,
434
+ "onUpdate:modelValue": n[4] || (n[4] = (c) => y.value = c),
435
+ rules: [
436
+ (c) => (c == null ? void 0 : c.filter((Y) => !!Y).length) !== ve ? r(u)("team.memberForm.masterUser.passcodeRequired") : !0
437
+ ]
438
+ }, {
439
+ default: E(() => [
440
+ (v(), I(T, {
441
+ key: `pin-field-${h.value}`,
442
+ modelValue: y.value,
443
+ "onUpdate:modelValue": n[2] || (n[2] = (c) => y.value = c),
444
+ length: ve,
445
+ masked: h.value,
446
+ onComplete: n[3] || (n[3] = (c) => g("passcode", c)),
447
+ onFocus: X
448
+ }, null, 8, ["modelValue", "masked"]))
449
+ ]),
450
+ _: 1
451
+ }, 8, ["modelValue", "rules"])
452
+ ]),
453
+ d($, {
454
+ modelValue: C.value,
455
+ "onUpdate:modelValue": n[6] || (n[6] = (c) => C.value = c),
456
+ rules: [
457
+ (c) => !c || c.length === 0 ? r(u)("team.memberForm.masterUser.restaurantRequired") : c.some((Y) => !Y.roleId) ? r(u)("team.memberForm.masterUser.roleRequired") : !0
458
+ ]
459
+ }, {
460
+ default: E(() => [
461
+ m("div", Lt, [
462
+ d(se, {
463
+ modelValue: r(D),
464
+ "onUpdate:modelValue": n[5] || (n[5] = (c) => he(D) ? D.value = c : null),
465
+ placeholder: r(u)("team.memberForm.posRole.placeholder"),
466
+ class: "mb-16"
467
+ }, null, 8, ["modelValue", "placeholder"]),
468
+ d(ot, {
469
+ "model-value": o.modelValue.roles.map((c) => c.restaurantId),
470
+ options: x.value,
471
+ min: 1,
472
+ title: r(u)("team.memberForm.masterUser.role"),
473
+ "onUpdate:modelValue": k
474
+ }, Le({ _: 2 }, [
475
+ ye(x.value, (c) => ({
476
+ name: c.slot,
477
+ fn: E(() => {
478
+ var Y;
479
+ return [
480
+ m("div", null, [
481
+ d(Q, {
482
+ "model-value": ((Y = o.modelValue.roles.find((z) => z.restaurantId === c.value)) == null ? void 0 : Y.roleId) || O.value,
483
+ items: c.roleOptions,
484
+ "onUpdate:modelValue": (z) => L(c.value, z)
485
+ }, null, 8, ["model-value", "items", "onUpdate:modelValue"])
486
+ ])
487
+ ];
488
+ })
489
+ }))
490
+ ]), 1032, ["model-value", "options", "title"])
491
+ ])
492
+ ]),
493
+ _: 1
494
+ }, 8, ["modelValue", "rules"])
495
+ ], 64)) : J("", !0)
496
+ ]);
497
+ };
498
+ }
499
+ }), zt = { class: "flex flex-col gap-32" }, qt = { class: "flex w-full" }, Kt = /* @__PURE__ */ ae({
500
+ __name: "AddMemberForm",
501
+ props: {
502
+ initialValue: {
503
+ type: Object
504
+ },
505
+ roleErrorMessage: {
506
+ type: String,
507
+ default: ""
508
+ }
509
+ },
510
+ setup(o, { expose: f }) {
511
+ var z, te, me;
512
+ const l = o, { t: s } = de(), u = F(), D = je(), N = S(
513
+ () => D.permissionSets.value.map((i) => ({
514
+ label: i.name,
515
+ value: i.id
516
+ }))
517
+ ), h = F(((z = l.initialValue) == null ? void 0 : z.permissionSetIds) || []), y = S(
518
+ () => Xe(h.value, D.permissionSets.value)
519
+ ), p = F((te = l.initialValue) == null ? void 0 : te.posUser), U = F(
520
+ Qe(
521
+ pe(y.value),
522
+ ((me = l.initialValue) == null ? void 0 : me.permissions) || []
523
+ )
524
+ ), { customReportPermissions: x, isLoaded: O } = Ae(), ee = new Set(
525
+ we.filter((i) => i.subject.startsWith(Ye)).map((i) => i.subject)
526
+ ), le = S(() => {
527
+ const i = new Set(ee);
528
+ for (const b of x.value) i.add(b.subject);
529
+ return i;
530
+ }), g = S(() => {
531
+ const i = /* @__PURE__ */ new Set();
532
+ for (const b of we)
533
+ b.category === Se.reports && i.add(b.subject);
534
+ for (const b of x.value)
535
+ b.category === Se.reports && i.add(b.subject);
536
+ return i;
537
+ }), { restaurants: k } = ce(), L = Ee().roles, X = S(() => Pe(U.value)), C = S(() => {
538
+ const i = X.value;
539
+ return L.value.map(
540
+ (b) => ({
541
+ label: b.name,
542
+ value: b._id,
543
+ disabled: !!i && !i.includes(b._id)
544
+ })
545
+ );
546
+ });
547
+ function a(i) {
548
+ u.value = i;
549
+ }
550
+ function n(i) {
551
+ p.value = se(p.value, i);
552
+ }
553
+ function w() {
554
+ const i = pe(y.value), b = O.value ? le.value : ee, K = Ze(U.value, b), G = He(K, g.value), j = et(G);
555
+ return tt(i, j);
556
+ }
557
+ function R() {
558
+ var K, G, j, W, ne, re, oe, e, t, V;
559
+ const i = w(), b = U.value.filter((M) => !M.inverted);
560
+ return {
561
+ email: ((K = u.value) == null ? void 0 : K.email) ?? void 0,
562
+ phoneNumber: ((G = u.value) == null ? void 0 : G.phoneNumber) ?? void 0,
563
+ customPermissions: i,
564
+ // Deprecated: keep for backward compatibility, will be removed in the future
565
+ permissions: b.map((M) => ({
566
+ ...M,
567
+ subject: qe(M.subject)
568
+ })),
569
+ permissionSetIds: h.value,
570
+ name: ((j = u.value) == null ? void 0 : j.displayName) || ((W = l.initialValue) == null ? void 0 : W.name) || "",
571
+ posUser: p.value ? {
572
+ ...p.value,
573
+ name: p.value.name || ((re = (ne = l.initialValue) == null ? void 0 : ne.posUser) == null ? void 0 : re.name) || ((oe = l.initialValue) == null ? void 0 : oe.name) || ((e = u.value) == null ? void 0 : e.displayName) || "",
574
+ code: p.value.code || ((V = (t = l.initialValue) == null ? void 0 : t.posUser) == null ? void 0 : V.code) || "",
575
+ passcode: p.value.passcode,
576
+ roles: p.value.roles.filter((M) => !!M.roleId)
577
+ } : void 0
578
+ };
579
+ }
580
+ const T = F();
581
+ function $() {
582
+ U.value = pe(y.value);
583
+ }
584
+ function se(i, b) {
585
+ if (!i) return;
586
+ const K = Pe(b);
587
+ if (!K) return i;
588
+ const G = Oe(i);
589
+ return G.roles = G.roles.reduce((j, W) => (K.includes(W.roleId) && j.push(W), j), []), G;
590
+ }
591
+ async function Q() {
592
+ await $e(), T.value && T.value.$el.scrollIntoView({ behavior: "smooth", block: "start" });
593
+ }
594
+ const c = F();
595
+ async function Y() {
596
+ return (await c.value.validateInputsWithoutSubmit()).length ? null : R();
597
+ }
598
+ return f({
599
+ readFormData: R,
600
+ validate: Y
601
+ }), (i, b) => {
602
+ const K = _("FmSelect"), G = _("FmForm");
603
+ return v(), I(G, {
604
+ ref_key: "formRef",
605
+ ref: c,
606
+ class: "mx-4"
607
+ }, {
608
+ default: E(() => {
609
+ var j, W, ne, re, oe, e;
610
+ return [
611
+ m("div", zt, [
612
+ m("div", qt, [
613
+ o.initialValue ? (v(), I(Ft, {
614
+ key: 1,
615
+ data: o.initialValue
616
+ }, null, 8, ["data"])) : (v(), I(Ct, {
617
+ key: 0,
618
+ onInvite: b[0] || (b[0] = (t) => a(t))
619
+ }))
620
+ ]),
621
+ u.value || o.initialValue ? (v(), q(ue, { key: 0 }, [
622
+ (j = o.initialValue) != null && j.isOwner ? J("", !0) : (v(), I(K, {
623
+ key: 0,
624
+ modelValue: h.value,
625
+ "onUpdate:modelValue": [
626
+ b[1] || (b[1] = (t) => h.value = t),
627
+ $
628
+ ],
629
+ multiselect: "",
630
+ searchable: "",
631
+ "search-debounce": 300,
632
+ items: N.value,
633
+ label: r(s)("team.memberForm.permissionSet.title"),
634
+ placeholder: r(s)("team.memberForm.permissionSet.selectPlaceholder")
635
+ }, null, 8, ["modelValue", "items", "label", "placeholder"])),
636
+ (W = o.initialValue) != null && W.isOwner ? J("", !0) : (v(), I(at, {
637
+ key: 1,
638
+ modelValue: U.value,
639
+ "onUpdate:modelValue": b[2] || (b[2] = (t) => U.value = t),
640
+ "inherit-permissions": y.value,
641
+ onPermissionChanged: n
642
+ }, null, 8, ["modelValue", "inherit-permissions"])),
643
+ d(Tt, {
644
+ ref_key: "masterUserContentRef",
645
+ ref: T,
646
+ modelValue: p.value,
647
+ "onUpdate:modelValue": [
648
+ b[3] || (b[3] = (t) => p.value = t),
649
+ Q
650
+ ],
651
+ "fallback-name": ((ne = o.initialValue) == null ? void 0 : ne.name) || ((re = u.value) == null ? void 0 : re.displayName) || "",
652
+ "fallback-passcode": (e = (oe = o.initialValue) == null ? void 0 : oe.posUser) == null ? void 0 : e.passcode,
653
+ roles: C.value,
654
+ restaurants: r(k)
655
+ }, null, 8, ["modelValue", "fallback-name", "fallback-passcode", "roles", "restaurants"])
656
+ ], 64)) : J("", !0)
657
+ ])
658
+ ];
659
+ }),
660
+ _: 1
661
+ }, 512);
662
+ };
663
+ }
664
+ }), Gt = {
665
+ class: "space-y-24"
666
+ }, Wt = {
667
+ class: "space-y-8"
668
+ }, Jt = {
669
+ class: "xs:hidden flex w-full items-start justify-between px-16"
670
+ }, Xt = {
671
+ class: "flex items-start gap-8"
672
+ }, Qt = {
673
+ class: "space-y-4 sm:hidden md:hidden lg:hidden px-16"
674
+ }, Yt = {
675
+ class: "flex items-start gap-8"
676
+ }, Zt = {
677
+ class: "flex items-center justify-start gap-8"
678
+ };
679
+ var H = /* @__PURE__ */ function(o) {
680
+ return o[o.ADD = 0] = "ADD", o[o.UPDATE = 1] = "UPDATE", o[o.CLOSED = 2] = "CLOSED", o;
681
+ }(H || {});
682
+ const ps = /* @__PURE__ */ ae({
683
+ __name: "TeamMemberList",
684
+ setup(o, {
685
+ expose: f
686
+ }) {
687
+ const {
688
+ fetchCustomReportPermissions: l
689
+ } = Ae(), {
690
+ t: s
691
+ } = de(), u = ce(), D = Ee(), N = Be(), h = Je(N), y = je(), p = st(), U = lt(), x = F(!0), O = ({
692
+ member: e,
693
+ className: t = ""
694
+ }) => {
695
+ const V = {
696
+ label: s("common.update"),
697
+ onClick: () => L(ie.Update, e)
698
+ }, M = {
699
+ label: s("common.remove"),
700
+ onClick: () => L(ie.Remove, e),
701
+ itemClass: "text-fm-color-typo-error"
702
+ }, Z = e.doc.isOwner ? [V] : [V, M];
703
+ return d(mt, {
704
+ class: t,
705
+ items: Z
706
+ }, null);
707
+ }, ee = (e) => e.doc.isOwner ? s("team.labels.businessOwner") : e.restaurants.join(", "), le = [{
708
+ accessorKey: "name",
709
+ header: () => s("team.table.columns.name"),
710
+ enableSorting: !1
711
+ }, {
712
+ accessorKey: "phoneNumber",
713
+ header: () => s("team.table.columns.phoneNumber"),
714
+ enableSorting: !1
715
+ }, {
716
+ accessorKey: "restaurant",
717
+ header: () => s("team.table.columns.restaurant"),
718
+ enableSorting: !1,
719
+ cell(e) {
720
+ const t = e.row.original;
721
+ return ee(t);
722
+ }
723
+ }, {
724
+ accessorKey: "assignedRoles",
725
+ header: () => s("team.table.columns.assignedRoles"),
726
+ enableSorting: !1,
727
+ cell(e) {
728
+ const t = e.row.original, V = p.getPermissionAssignmentByUserId(t.id), M = (V == null ? void 0 : V.permissionSetIds) || t.doc.permissionSetIds || [];
729
+ return y.permissionSets.value.filter((A) => M.includes(A.id)).map((A) => A.name).join(", ");
730
+ }
731
+ }, {
732
+ accessorKey: "permission",
733
+ header: () => s("team.table.columns.permission"),
734
+ enableSorting: !1,
735
+ cell(e) {
736
+ const t = e.row.original;
737
+ return g(t);
738
+ },
739
+ meta: {
740
+ width: "200px"
741
+ }
742
+ }, {
743
+ id: "action",
744
+ meta: {
745
+ cellClass: "pl-16",
746
+ headerContentClass: "-mx-16"
747
+ },
748
+ cell(e) {
749
+ const t = e.row.original;
750
+ return O({
751
+ member: t,
752
+ className: "flex justify-end w-full"
753
+ });
754
+ },
755
+ enableSorting: !1
756
+ }];
757
+ function g(e) {
758
+ if (e.doc.isOwner)
759
+ return s("team.labels.businessOwner");
760
+ const t = d(Fe.FmTooltip, {
761
+ variant: "plain",
762
+ placement: "top"
763
+ }, {
764
+ default: () => d(Fe.FmIcon, {
765
+ name: "info",
766
+ class: "cursor-pointer text-fm-color-neutral-gray-300"
767
+ }, null),
768
+ content: () => d("div", null, [s("team.labels.permission"), e.permissionLabels.map((V) => d("div", null, [Ce("- "), V]))])
769
+ });
770
+ return d("div", {
771
+ class: "flex flex-row items-center gap-8"
772
+ }, [d("span", null, [s("team.labels.allowed", {
773
+ count: e.permissionLabels.length
774
+ })]), e.permissionLabels.length > 0 && t]);
775
+ }
776
+ function k(e) {
777
+ var Z, A, P, _e;
778
+ const t = p.getPermissionAssignmentByUserId(e.id), V = (t == null ? void 0 : t.customPermissions) || e.permissions || [], M = (t == null ? void 0 : t.permissionSetIds) || [];
779
+ return {
780
+ id: e.id,
781
+ isOwner: e.doc.isOwner,
782
+ name: e.name,
783
+ phoneNumber: e.phoneNumber,
784
+ email: e.email,
785
+ permissions: V,
786
+ permissionSetIds: M,
787
+ posUser: e.doc.posUser ? {
788
+ code: ((Z = e.doc.posUser) == null ? void 0 : Z.code) ?? "",
789
+ name: ((A = e.doc.posUser) == null ? void 0 : A.name) ?? e.name,
790
+ passcode: ((P = e.doc.posUser) == null ? void 0 : P.passcode) ?? "",
791
+ roles: ((_e = e.doc.posUser) == null ? void 0 : _e.roles) ?? []
792
+ } : void 0
793
+ };
794
+ }
795
+ const L = (e, t) => {
796
+ if (e == ie.Update) {
797
+ const V = k(t);
798
+ R.value = V, C.value = H.UPDATE;
799
+ }
800
+ e == ie.Remove && Q(t);
801
+ }, X = Te(), C = F(H.CLOSED), a = S(() => C.value !== H.CLOSED), n = S(() => C.value === H.ADD ? s("common.add") : s("common.update")), w = S(() => C.value === H.ADD ? s("team.actions.addMember") : s("team.actions.updateMember")), R = F();
802
+ function T(e) {
803
+ e || (C.value = H.CLOSED);
804
+ }
805
+ function $() {
806
+ C.value = H.CLOSED;
807
+ }
808
+ const {
809
+ breakpoints: se
810
+ } = Ne(), Q = (e) => {
811
+ X.open({
812
+ title: s("team.actions.removeMember"),
813
+ message: s("team.removeMember.confirmationMessage", {
814
+ memberName: e.name
815
+ }),
816
+ minWidth: se.value.lg ? 588 : 0,
817
+ primaryActions: {
818
+ text: "Remove",
819
+ close: !1,
820
+ variant: "destructive"
821
+ },
822
+ secondaryActions: {
823
+ text: "Cancel",
824
+ close: !0
825
+ }
826
+ }).onPrimary(async () => {
827
+ await h.minor(async () => {
828
+ await fe.deleteTeamMember(e.id), await j({
829
+ force: !0
830
+ });
831
+ }, {
832
+ successMessage: s("team.removeMember.successMessage", {
833
+ memberName: e.name
834
+ })
835
+ }), X.close();
836
+ });
837
+ }, c = () => {
838
+ R.value = null, C.value = H.ADD;
839
+ }, Y = S(() => U.members), z = F(), te = F(), me = S(() => Object.values(Ke).map((e) => ({
840
+ label: e.label,
841
+ value: e.subject
842
+ }))), {
843
+ searchKey: i,
844
+ filter: b
845
+ } = De(""), K = S(() => Y.value.filter((e) => {
846
+ var Z;
847
+ const t = !z.value || e.managableRestaurantIds.some((A) => z.value.includes(A)), V = ((Z = e.permissions) == null ? void 0 : Z.map((A) => A.subject).flat().filter(Boolean)) || [], M = !te.value || V.some((A) => te.value.includes(A));
848
+ return t && M && b([e.name, e.phoneNumber, ee(e)]);
849
+ }));
850
+ async function G() {
851
+ await D.readRoles();
852
+ }
853
+ async function j({
854
+ force: e = !1
855
+ } = {}) {
856
+ x.value = !0;
857
+ try {
858
+ await U.readTeamMembers({
859
+ force: e
860
+ });
861
+ } finally {
862
+ x.value = !1;
863
+ }
864
+ }
865
+ const W = F();
866
+ async function ne() {
867
+ if (!W.value) return;
868
+ const e = await W.value.validate();
869
+ if (!e) return;
870
+ const t = C.value === H.ADD;
871
+ await h.minor(async () => {
872
+ await (t ? fe.createTeamMember(e) : fe.updateTeamMember(R.value.id, e)), $(), await oe(), await j({
873
+ force: !0
874
+ });
875
+ }, {
876
+ successMessage: t ? s("team.addMember.successMessage", {
877
+ memberName: e.name
878
+ }) : s("team.updateMember.successMessage", {
879
+ memberName: e.name
880
+ })
881
+ }), C.value = H.CLOSED;
882
+ }
883
+ async function re() {
884
+ await y.readPermissionSets();
885
+ }
886
+ async function oe() {
887
+ await p.readPermissionAssignments();
888
+ }
889
+ return Me(u.currentBusiness, async () => {
890
+ var e;
891
+ (e = u.currentBusiness.value) != null && e._id && (await Promise.all([re(), oe(), l()]), j(), G());
892
+ }, {
893
+ immediate: !0
894
+ }), f({
895
+ create: c
896
+ }), (e, t) => {
897
+ const V = _("FmSearch"), M = _("FmTable"), Z = _("FmButton"), A = _("FmSideSheet");
898
+ return v(), q(ue, null, [m("div", Gt, [m("div", Wt, [m("div", Jt, [m("div", Xt, [d(r(Ve), {
899
+ modelValue: z.value,
900
+ "onUpdate:modelValue": t[0] || (t[0] = (P) => z.value = P),
901
+ "managable-only": !1,
902
+ multiple: "",
903
+ variant: "dark",
904
+ class: "!w-auto"
905
+ }, null, 8, ["modelValue"]), d(xe, {
906
+ modelValue: te.value,
907
+ "onUpdate:modelValue": t[1] || (t[1] = (P) => te.value = P),
908
+ multiple: "",
909
+ variant: "dark",
910
+ items: me.value,
911
+ "selected-prefix": r(s)("team.filter.selected_permission_prefix"),
912
+ placeholder: r(s)("team.filter.permission_placeholder")
913
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])]), d(V, {
914
+ modelValue: r(i),
915
+ "onUpdate:modelValue": t[2] || (t[2] = (P) => he(i) ? i.value = P : null),
916
+ class: "w-[320px] xs:w-full xs:mt-8",
917
+ autofocus: "",
918
+ placeholder: r(s)("team.search.placeholder")
919
+ }, null, 8, ["modelValue", "placeholder"])]), m("div", Qt, [d(V, {
920
+ modelValue: r(i),
921
+ "onUpdate:modelValue": t[3] || (t[3] = (P) => he(i) ? i.value = P : null),
922
+ class: "w-[320px] xs:w-full xs:mt-8",
923
+ autofocus: "",
924
+ placeholder: r(s)("team.search.placeholder")
925
+ }, null, 8, ["modelValue", "placeholder"]), m("div", Yt, [d(r(Ve), {
926
+ modelValue: z.value,
927
+ "onUpdate:modelValue": t[4] || (t[4] = (P) => z.value = P),
928
+ "managable-only": !1,
929
+ multiple: "",
930
+ variant: "dark",
931
+ class: "!w-auto"
932
+ }, null, 8, ["modelValue"]), d(xe, {
933
+ modelValue: te.value,
934
+ "onUpdate:modelValue": t[5] || (t[5] = (P) => te.value = P),
935
+ multiple: "",
936
+ variant: "dark",
937
+ items: me.value,
938
+ "selected-prefix": r(s)("team.filter.selected_permission_prefix"),
939
+ placeholder: r(s)("team.filter.permission_placeholder")
940
+ }, null, 8, ["modelValue", "items", "selected-prefix", "placeholder"])])]), Y.value.length === 0 && !x.value ? (v(), I(r(We), {
941
+ key: 0,
942
+ title: r(s)("team.emptyState.title"),
943
+ subtitle: r(s)("team.emptyState.description")
944
+ }, null, 8, ["title", "subtitle"])) : (v(), I(Ge, {
945
+ key: 1
946
+ }, {
947
+ default: E(() => [d(M, {
948
+ "column-defs": le,
949
+ "row-data": K.value,
950
+ "page-size": K.value.length,
951
+ loading: x.value,
952
+ "pin-header-row": "",
953
+ "hide-footer": "",
954
+ onRowClick: t[6] || (t[6] = (P) => L(r(ie).Update, P.original))
955
+ }, null, 8, ["row-data", "page-size", "loading"])]),
956
+ _: 1
957
+ }))])]), d(A, {
958
+ header: w.value,
959
+ "model-value": a.value,
960
+ "max-width": 560,
961
+ "dismiss-away": "",
962
+ "onUpdate:modelValue": t[7] || (t[7] = (P) => T(P))
963
+ }, {
964
+ "side-sheet-footer": E(() => [m("div", Zt, [d(Z, {
965
+ label: n.value,
966
+ size: "md",
967
+ variant: "primary",
968
+ onClick: Re(ne, ["prevent"])
969
+ }, null, 8, ["label"]), d(Z, {
970
+ label: r(s)("common.cancel"),
971
+ size: "md",
972
+ variant: "secondary",
973
+ onClick: $
974
+ }, null, 8, ["label"])])]),
975
+ default: E(() => [d(Kt, {
976
+ ref_key: "memberForm",
977
+ ref: W,
978
+ initialValue: R.value,
979
+ class: "gap-8"
980
+ }, null, 8, ["initialValue"])]),
981
+ _: 1
982
+ }, 8, ["header", "model-value"])], 64);
983
+ };
984
+ }
985
+ });
986
+ export {
987
+ ps as default
988
+ };