@feedmepos/mf-hrm-portal 2.3.2-dev → 2.3.3-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 (47) hide show
  1. package/dist/{ApprovalCodeList-xOyDG5ug.js → ApprovalCodeList-D8ZVkmrF.js} +13 -14
  2. package/dist/{AuditLogList-Dd6HyFhk.js → AuditLogList-Fby1fcGU.js} +3 -3
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-Cixg_icC.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-B1uS6T3r.js} +2 -2
  4. package/dist/{EmployeeList-BG2KPvOB.js → EmployeeList-DY2Y-FtT.js} +16 -17
  5. package/dist/FormSection.vue_vue_type_script_setup_true_lang-BDGewUFD.js +90 -0
  6. package/dist/{GrantUserList-CUkuf3VV.js → GrantUserList-RK38DjjY.js} +14 -15
  7. package/dist/{Main-Cg9SOzcz.js → Main-424HHE7m.js} +5 -5
  8. package/dist/{Main-BSHf8gTE.js → Main-BuJe2QNl.js} +12 -11
  9. package/dist/{Main-BcixH7R5.js → Main-Pv9x678t.js} +11 -11
  10. package/dist/{MyPosProfile-CN8Bj3aV.js → MyPosProfile-Rc2ZTeQR.js} +1 -1
  11. package/dist/{PermissionSetList-I3u2_qHR.js → PermissionSetList-BT1oUm8M.js} +20 -20
  12. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BBoRXQPn.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BRrhFF3y.js} +1008 -1008
  13. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-B5QDOF0L.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-CD3d4RX6.js} +1 -1
  14. package/dist/RoleForm.vue_vue_type_script_setup_true_lang-DS4eMJ6w.js +547 -0
  15. package/dist/RoleList-CrLxn4_K.js +274 -0
  16. package/dist/TeamMemberList-D32ZtSLP.js +2060 -0
  17. package/dist/{TimesheetList-CECFKt7H.js → TimesheetList-ByUp0yfA.js} +7 -7
  18. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-RIyoAmeb.js → TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-9x0jnL2P.js} +3 -3
  19. package/dist/{app-CdrnR_Pw.js → app-BsAwRWj0.js} +208 -188
  20. package/dist/app.js +1 -1
  21. package/dist/{approval-code-Bwvwehz9.js → approval-code-BUuYtJAO.js} +1 -1
  22. package/dist/{dayjs.min-BO8bcI17.js → dayjs.min-C9xnIrg1.js} +1 -1
  23. package/dist/{employee-Dg-J9goA.js → employee-DAwBQ0bc.js} +5 -5
  24. package/dist/{grant-user-whFOaPZI.js → grant-user-D-PdX5g-.js} +1 -1
  25. package/dist/{iteration-ZpERYj3o.js → iteration-Dat4Ismm.js} +1 -1
  26. package/dist/{lodash-7SZBZ8VQ.js → lodash-DjYVoggD.js} +1 -1
  27. package/dist/{member-grant-C46lvrh2.js → member-grant-CQHFGo-k.js} +2 -2
  28. package/dist/{restaurant-CKhT6kgj.js → restaurant-dbllb9m8.js} +1 -1
  29. package/dist/{role-C6hFKOfU.js → role-DN-jiQnS.js} +3 -3
  30. package/dist/{rule-BlMymDXm.js → rule-Bgcb9R7I.js} +19 -19
  31. package/dist/src/helpers/pos-assignment-rows.d.ts +2 -0
  32. package/dist/src/views/hr/locales/index.d.ts +20 -0
  33. package/dist/src/views/hr/role/RoleForm.vue.d.ts +29 -2
  34. package/dist/src/views/team/components/MemberGrantFields.vue.d.ts +2 -6
  35. package/dist/src/views/team/components/PosAssignmentRows.vue.d.ts +0 -2
  36. package/dist/src/views/team/member/AddMemberForm.vue.d.ts +0 -2
  37. package/dist/src/views/team/member/TeamMemberMasterUser.vue.d.ts +0 -2
  38. package/dist/style.css +1 -1
  39. package/dist/tsconfig.app.tsbuildinfo +1 -1
  40. package/dist/{useAppStore-CL6EEDuw.js → useAppStore-BABlZnfR.js} +1 -1
  41. package/dist/{useLoading-BBjBUzGJ.js → useLoading-B47q5dVg.js} +1 -1
  42. package/dist/{useReportPermissions-Bg0fma6m.js → useReportPermissions-D-nbQAm5.js} +5 -5
  43. package/package.json +1 -1
  44. package/dist/FormItem.vue_vue_type_script_setup_true_lang-DPT2FoIc.js +0 -45
  45. package/dist/FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js +0 -49
  46. package/dist/RoleList-ALmAwN0U.js +0 -739
  47. package/dist/TeamMemberList-DZfEnOs1.js +0 -2097
@@ -1,6 +1,6 @@
1
1
  import { computed as B, ref as L } from "vue";
2
2
  import { useCoreStore as G0 } from "@feedmepos/mf-common";
3
- import { g as h, b, T as k0, m as $0, n as B0, q as j0 } from "./app-CdrnR_Pw.js";
3
+ import { g as h, b, T as k0, m as $0, l as B0, n as j0 } from "./app-BsAwRWj0.js";
4
4
  const U0 = {
5
5
  async readProviders() {
6
6
  return h(await b("staff-invites").get("/providers"));
@@ -0,0 +1,547 @@
1
+ import { defineComponent as ze, computed as y, ref as C, watch as T, onMounted as Le, resolveComponent as w, createBlock as E, openBlock as h, unref as o, withCtx as V, createElementVNode as c, createVNode as _, toDisplayString as M, createElementBlock as S, Fragment as z, renderList as ee, createCommentVNode as te, normalizeClass as he } from "vue";
2
+ import { l as W } from "./lodash-DjYVoggD.js";
3
+ import { e as be } from "./iteration-Dat4Ismm.js";
4
+ import { useI18n as Ne } from "@feedmepos/mf-common";
5
+ import { useBreakpoints as qe, useSnackbar as Ke, components as Te } from "@feedmepos/ui-library";
6
+ import { u as We, _ as Ge, a as _e } from "./ConditionBuilderForm.vue_vue_type_script_setup_true_lang-B1uS6T3r.js";
7
+ import { u as Je } from "./useDiscardConfirm-DPhEV6v0.js";
8
+ import { u as He } from "./useLoading-B47q5dVg.js";
9
+ import { u as Qe } from "./useReportPermissions-D-nbQAm5.js";
10
+ import { D as Xe, q as Ye, A as Ze, S as et } from "./app-BsAwRWj0.js";
11
+ import { r as ae, h as tt, e as at, s as st, i as ge, j as lt } from "./rule-Bgcb9R7I.js";
12
+ import { u as rt } from "./restaurant-dbllb9m8.js";
13
+ import { u as ot } from "./role-DN-jiQnS.js";
14
+ function Kt(d) {
15
+ const n = [];
16
+ for (const { restaurantId: m, roleId: a } of d) {
17
+ if (!m) continue;
18
+ const u = n.find((x) => x.roleId === a);
19
+ u ? u.restaurantIds.push(m) : n.push({ restaurantIds: [m], roleId: a });
20
+ }
21
+ return n;
22
+ }
23
+ function Tt(d) {
24
+ return d.flatMap(
25
+ (n) => n.restaurantIds.map((m) => ({ restaurantId: m, roleId: n.roleId }))
26
+ );
27
+ }
28
+ function Wt(d, n) {
29
+ const m = (a) => a.map((u) => `${u.restaurantId}:${u.roleId}`).sort().join("|");
30
+ return m(d) === m(n);
31
+ }
32
+ function se(d) {
33
+ return `${d.profile.code ? `${d.profile.code} - ` : ""}${d.profile.name}`;
34
+ }
35
+ function Gt(d, n) {
36
+ return d.filter((m) => n.restaurantIds.includes(m._id)).map(se).join(", ");
37
+ }
38
+ function Jt(d, n, m) {
39
+ var x;
40
+ const a = ((x = n[m]) == null ? void 0 : x.restaurantIds) ?? [], u = new Set(n.flatMap((v, P) => P === m ? [] : v.restaurantIds));
41
+ return d.filter((v) => v.managable || a.includes(v._id)).map((v) => ({
42
+ label: se(v),
43
+ value: v._id,
44
+ disabled: u.has(v._id)
45
+ }));
46
+ }
47
+ function nt(d, n, m) {
48
+ return n.restaurantIds.length === 0 ? [] : d.filter(
49
+ (a) => n.restaurantIds.every((u) => a.restaurants.some((x) => x.id === u))
50
+ ).map((a) => ({
51
+ label: a.name,
52
+ value: a._id,
53
+ disabled: !m(a) && a._id !== n.roleId
54
+ }));
55
+ }
56
+ function Ht(d, n, m) {
57
+ var u, x;
58
+ const a = nt(d, n, m);
59
+ return ((u = a.find((v) => v.value === n.roleId && !v.disabled)) == null ? void 0 : u.value) ?? ((x = a.find((v) => !v.disabled)) == null ? void 0 : x.value) ?? "";
60
+ }
61
+ function Qt(d, n) {
62
+ const m = new Set(n.flatMap((u) => u.restaurantIds));
63
+ return d.some((u) => u.managable && !m.has(u._id)) && n.every((u) => u.restaurantIds.length > 0 && u.roleId);
64
+ }
65
+ const ut = { class: "flex w-full items-center gap-4" }, it = { class: "min-w-0 flex-1 truncate fm-typo-en-title-md-600" }, dt = { class: "flex flex-col gap-24" }, mt = { class: "flex flex-col gap-16 rounded-[16px] border border-fm-color-neutral-gray-300 p-16" }, ct = { class: "fm-typo-en-title-sm-600" }, ft = { class: "flex flex-col gap-16 rounded-[16px] border border-fm-color-neutral-gray-200 p-16" }, pt = { class: "fm-typo-en-title-sm-600" }, vt = {
66
+ key: 0,
67
+ class: "flex justify-center py-16"
68
+ }, ht = { class: "flex flex-col gap-8" }, bt = { class: "flex flex-col gap-16 rounded-[16px] border border-fm-color-neutral-gray-200 p-16" }, _t = { class: "flex flex-col gap-8" }, gt = { class: "fm-typo-en-title-sm-600" }, yt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xt = { class: "flex flex-col gap-24" }, Rt = { class: "text-[18px] font-semibold leading-[24px] text-fm-color-typo-primary" }, It = { class: "mt-16 space-y-8" }, Ft = { class: "flex items-center" }, kt = { class: "h-[24px] w-[24px] flex items-center justify-center" }, wt = { class: "h-[24px] w-[24px] flex items-center justify-center" }, Vt = {
69
+ key: 0,
70
+ class: "ml-20 mt-8 flex max-w-[320px] flex-row items-start gap-8"
71
+ }, Dt = { class: "mt-8 whitespace-nowrap" }, Ct = { class: "flex gap-8 items-center justify-start" }, St = "condition-form-select-menu", Xt = /* @__PURE__ */ ze({
72
+ __name: "RoleForm",
73
+ props: {
74
+ id: {
75
+ type: String,
76
+ default: void 0
77
+ },
78
+ /** Outlets ticked when creating a role (the member sheet passes the row's outlets). */
79
+ restaurantIds: {
80
+ type: Array,
81
+ default: () => []
82
+ },
83
+ /** Opened over another sheet: a back arrow returns to it. */
84
+ showBack: {
85
+ type: Boolean,
86
+ default: !1
87
+ }
88
+ },
89
+ emits: ["created"],
90
+ setup(d, { expose: n, emit: m }) {
91
+ const { t: a } = Ne(), { breakpoints: u } = qe(), x = y(() => u.value.xs || u.value.sm), v = rt(), P = y(() => v.restaurants.value), le = C(v.restaurants.value.length === 0);
92
+ T(
93
+ () => v.restaurants.value.length,
94
+ (e) => {
95
+ e > 0 && (le.value = !1);
96
+ }
97
+ );
98
+ const B = ot(), ye = Ke(), xe = He(ye), {
99
+ fetchReportPermissions: re,
100
+ allReportPermissions: Re,
101
+ availableReportKeys: oe,
102
+ customReportKeys: Ie,
103
+ isLoaded: Fe
104
+ } = Qe(), L = d, ke = m, R = C(!1), we = () => {
105
+ R.value = !R.value, R.value && fe();
106
+ }, Ve = y(() => L.id ? a("hr.role.form.update") : a("hr.role.form.addTitle")), De = y(() => L.id ? a("common.update") : a("hr.role.form.add")), G = y(() => {
107
+ const e = Xe.filter(
108
+ (l) => l.subject !== be.F_RULE_SUBJECT.enum.report
109
+ ).map((l) => ae(l)), t = Re.value.map((l) => ae(l));
110
+ return [...e, ...t];
111
+ }), b = y(() => B.roles.value.find((e) => e._id == L.id)), N = () => ({
112
+ name: "",
113
+ restaurantIds: [],
114
+ permissions: [],
115
+ maxDiscountPercentage: 100
116
+ }), s = C(N()), J = C([]), q = C([]), ne = C([]), I = C(/* @__PURE__ */ new Map()), U = We(I), H = Ye("report");
117
+ function ue(e) {
118
+ const t = I.value.get(e);
119
+ return !!t && Object.keys(t).length > 0;
120
+ }
121
+ function ie(e, t) {
122
+ const l = U.getDraft({ subject: e, builderKey: t.builderKey });
123
+ return l ? l.formValue : t.fromCondition(
124
+ Ze(I.value.get(e), t)
125
+ );
126
+ }
127
+ function de(e, t, l) {
128
+ U.setDraft({ subject: e, builderKey: t.builderKey }, { formValue: l });
129
+ }
130
+ const Q = C(null);
131
+ function me(e, t) {
132
+ if (U.getDraftsForSubject(e).size === 0) {
133
+ t == null || t();
134
+ return;
135
+ }
136
+ const p = [];
137
+ for (const D of H) {
138
+ const O = U.getDraft({ subject: e, builderKey: D.builderKey });
139
+ O && p.push({ builder: D, form: O.formValue });
140
+ }
141
+ if (p.length === 0) {
142
+ t == null || t();
143
+ return;
144
+ }
145
+ const j = I.value.get(e), F = et(
146
+ j,
147
+ p.map(({ builder: D, form: O }) => ({ builder: D, formValue: O }))
148
+ ), k = new Map(I.value);
149
+ Object.keys(F).length === 0 ? k.delete(e) : k.set(e, F), I.value = k, U.clearDraftsForSubject(e), t == null || t();
150
+ }
151
+ function ce(e) {
152
+ return U.hasDraftsForSubject(e);
153
+ }
154
+ const Ce = y(() => [
155
+ {
156
+ title: a("hr.role.labels.operation"),
157
+ filter: (e) => e.isOrderOperation
158
+ },
159
+ {
160
+ title: a("hr.role.labels.report"),
161
+ filter: (e) => e.isReportPermission
162
+ },
163
+ {
164
+ title: a("hr.role.labels.other"),
165
+ filter: (e) => !e.isOrderOperation && !e.isReportPermission
166
+ }
167
+ ].map((e) => ({
168
+ title: e.title,
169
+ options: G.value.filter(e.filter).map(({ label: t, value: l }) => {
170
+ const p = a(`hr.role.form.permissionLabels.${l}`, t);
171
+ return l.startsWith($) && Ie.value.has(l.slice($.length)) ? {
172
+ label: `${p} ${a("hr.role.form.v8OnlyReportTag")}`,
173
+ value: l
174
+ } : {
175
+ label: p,
176
+ value: l
177
+ };
178
+ })
179
+ }))), g = y(() => {
180
+ var e;
181
+ return tt(((e = b.value) == null ? void 0 : e.permissions) || []);
182
+ }), $ = `${be.F_RULE_SUBJECT.enum.report}:`;
183
+ function X(e) {
184
+ return Fe.value ? e.filter(
185
+ (t) => !t.startsWith($) || oe.value.has(t.slice($.length))
186
+ ) : e;
187
+ }
188
+ function fe() {
189
+ var e;
190
+ if (s.value = N(), I.value = /* @__PURE__ */ new Map(), J.value = [], s.value.name = ((e = b.value) == null ? void 0 : e.name) ?? "", g.value)
191
+ s.value.restaurantIds = P.value.map((t) => t._id), s.value.permissions = G.value.map((t) => t.value);
192
+ else if (b.value) {
193
+ s.value.restaurantIds = b.value.restaurants.map((F) => F.id);
194
+ const t = new Set(G.value.map((F) => F.value)), { values: l, passthrough: p, dropped: j } = st(
195
+ b.value.permissions,
196
+ t
197
+ );
198
+ J.value = p, j.length > 0 && console.warn("Dropping corrupted role permissions (repaired on save):", j), s.value.permissions = X(l), s.value.maxDiscountPercentage = ge(
199
+ b.value.permissions
200
+ );
201
+ for (const F of b.value.permissions) {
202
+ const k = ae(F), D = lt(F);
203
+ D && I.value.set(k.value, D);
204
+ }
205
+ } else
206
+ s.value.restaurantIds = [...L.restaurantIds];
207
+ q.value = [...s.value.permissions], ne.value = [...s.value.restaurantIds];
208
+ }
209
+ Le(async () => {
210
+ await v.readRestaurants(), await re(), R.value || fe();
211
+ }), T(R, async (e) => {
212
+ e && await re();
213
+ }), T(oe, () => {
214
+ if (R.value && b.value && !g.value) {
215
+ s.value.permissions = X(s.value.permissions), q.value = X(q.value);
216
+ const e = new Map(I.value);
217
+ for (const t of e.keys())
218
+ t.startsWith($) && !s.value.permissions.includes(t) && e.delete(t);
219
+ I.value = e;
220
+ }
221
+ });
222
+ const Se = C(""), Pe = y(() => ({
223
+ restaurantIds: s.value.restaurantIds,
224
+ role: {
225
+ name: s.value.name,
226
+ permissions: [
227
+ ...at(
228
+ s.value.permissions,
229
+ s.value.maxDiscountPercentage,
230
+ I.value
231
+ ),
232
+ ...J.value
233
+ ]
234
+ }
235
+ })), Ue = async () => {
236
+ const e = Pe.value;
237
+ await xe.minor(
238
+ async () => {
239
+ if (b.value)
240
+ await B.updateRole(b.value._id, e);
241
+ else {
242
+ const t = new Set(B.roles.value.map((p) => p._id));
243
+ await B.createRole(e);
244
+ const l = B.roles.value.find((p) => !t.has(p._id));
245
+ l && ke("created", l._id);
246
+ }
247
+ },
248
+ {
249
+ successMessage: b.value ? a("hr.role.update.successMessage", { name: e.role.name }) : a("hr.role.add.successMessage", { name: e.role.name })
250
+ }
251
+ ), R.value = !1;
252
+ }, Y = y(
253
+ () => s.value.restaurantIds.filter((e) => P.value.some((t) => t._id === e))
254
+ ), Z = y(() => P.value.length > 0 && P.value.length === Y.value.length), je = y(() => Y.value.length > 0 && !Z.value), Ee = () => {
255
+ const e = s.value.restaurantIds.filter((t) => !Y.value.includes(t));
256
+ Z.value === !0 ? s.value.restaurantIds = e : s.value.restaurantIds = P.value.map((t) => t._id);
257
+ }, pe = (e) => e.map((l) => l.value).every((l) => s.value.permissions.includes(l)), Me = (e) => {
258
+ const t = e.filter(
259
+ (l) => s.value.permissions.includes(l.value)
260
+ ).length;
261
+ return t === 1 ? a("hr.role.form.permissionAllowed") : a("hr.role.form.permissionsAllowed", { count: t });
262
+ }, Oe = (e) => {
263
+ const t = s.value.permissions.filter(
264
+ (l) => !e.map((p) => p.value).includes(l)
265
+ );
266
+ pe(e) === !0 ? s.value.permissions = t : s.value.permissions = [...t, ...e.map((l) => l.value)];
267
+ };
268
+ T(
269
+ () => s.value.restaurantIds,
270
+ (e) => {
271
+ e.length > 0 && (Se.value = "");
272
+ }
273
+ );
274
+ const K = Je(
275
+ () => {
276
+ var e, t;
277
+ return !W.isEqual(s.value.name, ((e = b.value) == null ? void 0 : e.name) || N().name) || !W.isEqual(s.value.restaurantIds, ne.value) || !W.isEqual(s.value.permissions, q.value) || !W.isEqual(
278
+ s.value.maxDiscountPercentage,
279
+ b.value ? ge((t = b.value) == null ? void 0 : t.permissions) : N().maxDiscountPercentage
280
+ );
281
+ },
282
+ () => {
283
+ R.value = !1;
284
+ }
285
+ );
286
+ return n({
287
+ show: R,
288
+ trigger: we
289
+ }), (e, t) => {
290
+ const l = w("FmButton"), p = w("FmIcon"), j = w("FmTextField"), F = w("FmCircularProgress"), k = w("FmCheckbox"), D = w("FmFormGroup"), O = w("FmBottomSheet"), Ae = w("FmPopover"), ve = w("fm-button"), Be = w("fm-side-sheet");
291
+ return h(), E(Be, {
292
+ id: "unit-form",
293
+ modelValue: R.value,
294
+ "onUpdate:modelValue": t[5] || (t[5] = (f) => R.value = f),
295
+ "is-container": o(Te).FmForm,
296
+ "is-container-props": {
297
+ onValidationSuccess: Ue,
298
+ blameFormChildOnValidationFailed: !0
299
+ },
300
+ "max-width": 960,
301
+ "close-button": !1,
302
+ "onOn:clickedAway": o(K)
303
+ }, {
304
+ "side-sheet-header": V(() => [
305
+ c("div", ut, [
306
+ d.showBack ? (h(), E(l, {
307
+ key: 0,
308
+ icon: "arrow_back",
309
+ variant: "tertiary",
310
+ size: "md",
311
+ "text-color": "neutral-gray-500",
312
+ "data-testid": "role-form-back",
313
+ onClick: o(K)
314
+ }, null, 8, ["onClick"])) : te("", !0),
315
+ c("p", it, M(Ve.value), 1),
316
+ _(p, {
317
+ name: "close",
318
+ size: "md",
319
+ class: "cursor-pointer",
320
+ onClick: o(K)
321
+ }, null, 8, ["onClick"])
322
+ ])
323
+ ]),
324
+ "side-sheet-footer": V(() => [
325
+ c("div", Ct, [
326
+ _(ve, {
327
+ label: De.value,
328
+ size: "md",
329
+ type: "submit",
330
+ variant: "primary",
331
+ disabled: g.value
332
+ }, null, 8, ["label", "disabled"]),
333
+ _(ve, {
334
+ label: o(a)("common.cancel"),
335
+ size: "md",
336
+ variant: "tertiary",
337
+ onClick: o(K)
338
+ }, null, 8, ["label", "onClick"])
339
+ ])
340
+ ]),
341
+ default: V(() => [
342
+ c("div", dt, [
343
+ c("section", mt, [
344
+ c("p", ct, M(o(a)("hr.role.form.roleDetail")), 1),
345
+ _(j, {
346
+ modelValue: s.value.name,
347
+ "onUpdate:modelValue": t[0] || (t[0] = (f) => s.value.name = f),
348
+ autofocus: "",
349
+ rules: [(f) => !!f || o(a)("hr.role.form.required")],
350
+ label: o(a)("hr.role.form.name"),
351
+ placeholder: o(a)("hr.role.form.namePlaceholder"),
352
+ disabled: g.value
353
+ }, null, 8, ["modelValue", "rules", "label", "placeholder", "disabled"])
354
+ ]),
355
+ c("section", ft, [
356
+ c("p", pt, M(o(a)("hr.role.form.restaurant")), 1),
357
+ le.value ? (h(), S("div", vt, [
358
+ _(F)
359
+ ])) : (h(), E(D, {
360
+ key: 1,
361
+ modelValue: s.value.restaurantIds,
362
+ "onUpdate:modelValue": t[2] || (t[2] = (f) => s.value.restaurantIds = f),
363
+ rules: [(f) => f.length > 0 || o(a)("hr.role.form.atLeastOneRestaurant")]
364
+ }, {
365
+ default: V(() => [
366
+ c("div", ht, [
367
+ _(k, {
368
+ "model-value": Z.value,
369
+ indeterminate: je.value,
370
+ label: o(a)("hr.role.form.all"),
371
+ value: "1",
372
+ disabled: g.value,
373
+ "onUpdate:modelValue": Ee
374
+ }, null, 8, ["model-value", "indeterminate", "label", "disabled"]),
375
+ (h(!0), S(z, null, ee(P.value, (f) => (h(), E(k, {
376
+ key: f._id,
377
+ modelValue: s.value.restaurantIds,
378
+ "onUpdate:modelValue": t[1] || (t[1] = (r) => s.value.restaurantIds = r),
379
+ label: o(se)(f),
380
+ value: f._id,
381
+ disabled: g.value
382
+ }, null, 8, ["modelValue", "label", "value", "disabled"]))), 128))
383
+ ])
384
+ ]),
385
+ _: 1
386
+ }, 8, ["modelValue", "rules"]))
387
+ ]),
388
+ c("section", bt, [
389
+ c("div", _t, [
390
+ c("p", gt, M(o(a)("hr.role.form.permissions")), 1),
391
+ c("p", yt, M(o(a)("hr.role.form.permissionsSubtitle")), 1)
392
+ ]),
393
+ c("div", xt, [
394
+ (h(!0), S(z, null, ee(Ce.value, (f) => (h(), S("div", {
395
+ key: f.title
396
+ }, [
397
+ _(Ge, {
398
+ layout: "leading",
399
+ "initially-collapsed": "",
400
+ subtitle: Me(f.options)
401
+ }, {
402
+ title: V(() => [
403
+ c("p", Rt, M(f.title), 1)
404
+ ]),
405
+ default: V(() => [
406
+ c("div", It, [
407
+ _(k, {
408
+ "model-value": pe(f.options),
409
+ label: o(a)("hr.role.form.all"),
410
+ value: "1",
411
+ disabled: g.value,
412
+ "onUpdate:modelValue": (r) => Oe(f.options)
413
+ }, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"]),
414
+ t[6] || (t[6] = c("div", { class: "h-px w-full bg-fm-color-neutral-gray-200" }, null, -1)),
415
+ (h(!0), S(z, null, ee(f.options, (r) => (h(), S("div", {
416
+ key: r.value
417
+ }, [
418
+ c("div", Ft, [
419
+ _(k, {
420
+ modelValue: s.value.permissions,
421
+ "onUpdate:modelValue": t[3] || (t[3] = (i) => s.value.permissions = i),
422
+ label: r.label,
423
+ value: r.value,
424
+ disabled: g.value,
425
+ class: "flex-1"
426
+ }, null, 8, ["modelValue", "label", "value", "disabled"]),
427
+ r.value.startsWith("report:") ? (h(), S(z, { key: 0 }, [
428
+ s.value.permissions.includes(r.value) ? (h(), S(z, { key: 0 }, [
429
+ x.value ? (h(), E(O, {
430
+ key: 0,
431
+ "model-value": Q.value === r.value,
432
+ header: r.label,
433
+ "dismiss-away": "",
434
+ "z-index": 100,
435
+ class: "h-5 flex items-center",
436
+ "onUpdate:modelValue": (i) => {
437
+ Q.value = i ? r.value : null, i || o(U).clearDraftsForSubject(r.value);
438
+ }
439
+ }, {
440
+ "bottom-sheet-button": V(() => [
441
+ c("div", kt, [
442
+ _(p, {
443
+ name: "settings",
444
+ size: "sm",
445
+ class: he([
446
+ "cursor-pointer transition-colors",
447
+ ue(r.value) ? "text-fm-color-primary-main" : "text-fm-color-neutral-gray-400 hover:text-fm-color-neutral-gray-600"
448
+ ])
449
+ }, null, 8, ["class"])
450
+ ])
451
+ ]),
452
+ default: V(() => [
453
+ _(_e, {
454
+ builders: o(H),
455
+ "form-value-for": (i) => ie(r.value, i),
456
+ "has-changes": ce(r.value),
457
+ disable: g.value,
458
+ "full-width": !0,
459
+ onUpdateForm: ({ builder: i, form: A }) => de(r.value, i, A),
460
+ onApply: (i) => me(r.value, () => Q.value = null)
461
+ }, null, 8, ["builders", "form-value-for", "has-changes", "disable", "onUpdateForm", "onApply"])
462
+ ]),
463
+ _: 2
464
+ }, 1032, ["model-value", "header", "onUpdate:modelValue"])) : (h(), E(Ae, {
465
+ key: 1,
466
+ disabled: g.value,
467
+ "z-index": 100,
468
+ "exclude-el-from-click-outside": [St],
469
+ class: "h-5 flex items-center",
470
+ onPopoverChanged: (i) => {
471
+ i || o(U).clearDraftsForSubject(r.value);
472
+ }
473
+ }, {
474
+ "popover-button": V(() => [
475
+ c("div", wt, [
476
+ _(p, {
477
+ name: "settings",
478
+ size: "sm",
479
+ class: he([
480
+ "cursor-pointer transition-colors",
481
+ ue(r.value) ? "text-fm-color-primary-main" : "text-fm-color-neutral-gray-400 hover:text-fm-color-neutral-gray-600"
482
+ ])
483
+ }, null, 8, ["class"])
484
+ ])
485
+ ]),
486
+ default: V(({ hide: i }) => [
487
+ _(_e, {
488
+ title: r.label,
489
+ builders: o(H),
490
+ "form-value-for": (A) => ie(r.value, A),
491
+ "has-changes": ce(r.value),
492
+ disable: g.value,
493
+ onUpdateForm: ({ builder: A, form: $e }) => de(r.value, A, $e),
494
+ onApply: (A) => me(r.value, i)
495
+ }, null, 8, ["title", "builders", "form-value-for", "has-changes", "disable", "onUpdateForm", "onApply"])
496
+ ]),
497
+ _: 2
498
+ }, 1032, ["disabled", "exclude-el-from-click-outside", "onPopoverChanged"]))
499
+ ], 64)) : (h(), E(p, {
500
+ key: 1,
501
+ name: "settings",
502
+ size: "sm",
503
+ class: "invisible"
504
+ }))
505
+ ], 64)) : te("", !0)
506
+ ]),
507
+ r.value === "order:discount" && s.value.permissions.includes(r.value) ? (h(), S("div", Vt, [
508
+ c("div", Dt, M(o(a)("hr.role.form.maxDiscountPercentage")), 1),
509
+ _(j, {
510
+ modelValue: s.value.maxDiscountPercentage,
511
+ "onUpdate:modelValue": t[4] || (t[4] = (i) => s.value.maxDiscountPercentage = i),
512
+ rules: [
513
+ (i) => !!i || o(a)("hr.role.form.required"),
514
+ (i) => !isNaN(i) || o(a)("hr.role.form.onlyContainsNumber"),
515
+ (i) => i <= 100 || o(a)("hr.role.form.maxValueIs", { max: 100 }),
516
+ (i) => i >= 0 || o(a)("hr.role.form.minValueIs", { min: 0 })
517
+ ],
518
+ "append-text": "%",
519
+ disabled: g.value
520
+ }, null, 8, ["modelValue", "rules", "disabled"])
521
+ ])) : te("", !0)
522
+ ]))), 128))
523
+ ])
524
+ ]),
525
+ _: 2
526
+ }, 1032, ["subtitle"])
527
+ ]))), 128))
528
+ ])
529
+ ])
530
+ ])
531
+ ]),
532
+ _: 1
533
+ }, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"]);
534
+ };
535
+ }
536
+ });
537
+ export {
538
+ Xt as _,
539
+ Tt as a,
540
+ Jt as b,
541
+ Qt as c,
542
+ nt as d,
543
+ Ht as p,
544
+ Gt as r,
545
+ Wt as s,
546
+ Kt as t
547
+ };