@feedmepos/mf-hrm-portal 2.3.2-dev.2 → 2.3.2-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ApprovalCodeList-sHnINTik.js → ApprovalCodeList-D3U4nvlF.js} +15 -14
- package/dist/{AuditLogList-C9C2emU9.js → AuditLogList-qGCW7tf0.js} +13 -13
- package/dist/ConditionBuilderForm.vue_vue_type_script_setup_true_lang-B0VcRYUg.js +438 -0
- package/dist/EmployeeList-Bd73xDCX.js +776 -0
- package/dist/FormItem.vue_vue_type_script_setup_true_lang-cLEnrtC6.js +45 -0
- package/dist/FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js +49 -0
- package/dist/{GrantUserList-LWpqhl-5.js → GrantUserList-C71pal0N.js} +16 -15
- package/dist/{Main-PBJjfzBg.js → Main-BWJPyEU1.js} +5 -5
- package/dist/{Main-BWKb-QIE.js → Main-CCdTWngg.js} +11 -11
- package/dist/Main-DGf0bQvy.js +96 -0
- package/dist/PasscodePinField.vue_vue_type_script_setup_true_lang-CqG0v0Sz.js +243 -0
- package/dist/{PermissionSetList-D2qZVlF4.js → PermissionSetList-BS-oBunI.js} +46 -45
- package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CkOAT-oX.js +4167 -0
- package/dist/PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-DQcgZ0nF.js +35 -0
- package/dist/RoleList-B_7UnVNb.js +740 -0
- package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-Cs0rhCa3.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-BXihM4sl.js} +1 -1
- package/dist/{ScheduleGeneralPage-C4J6jYtG.js → ScheduleGeneralPage-DpNvWNGs.js} +2 -2
- package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-3UqO6uPu.js → ScheduleModal.vue_vue_type_script_setup_true_lang-DIYLOF9N.js} +186 -187
- package/dist/{SchedulePage-ICzggri0.js → SchedulePage-QW-cYvu2.js} +13 -13
- package/dist/{SchedulePositionPage-BshUCd_C.js → SchedulePositionPage-BtFfVo2N.js} +3 -3
- package/dist/{SelectFilter-D9T0nFvG.js → SelectFilter-BXeVKgHN.js} +1 -1
- package/dist/TeamMemberList-DoisBYnk.js +1154 -0
- package/dist/{TimesheetList-nxhr0EWj.js → TimesheetList-D-bESKe5.js} +9 -9
- package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-BLqgALLe.js → TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-D0zAVqCa.js} +3 -3
- package/dist/{app-n6d4AmtP.js → app-D-MUq9Ab.js} +3429 -6368
- package/dist/app.js +3 -3
- package/dist/{approval-code-1j1OoXt1.js → approval-code-BXUiojPH.js} +1 -1
- package/dist/{dayjs.min-DdNivv4b.js → dayjs.min-BZ1pM-6M.js} +34 -34
- package/dist/{employee-BlfleiCU.js → employee-HQEU8fjb.js} +47 -48
- package/dist/{grant-user-BmTyexk3.js → grant-user-CBJ3gEgW.js} +1 -1
- package/dist/{iteration-y_jodvfN.js → iteration-ogxW2-Tv.js} +1 -1
- package/dist/{lodash-B2eWEGH4.js → lodash-Def4gaas.js} +1 -1
- package/dist/restaurant-D2mfKHaH.js +1880 -0
- package/dist/{role-DfZi7Ssk.js → role-JDoDFVd9.js} +4 -5
- package/dist/{rule-ChmhcGgA.js → rule-DPtqlnz-.js} +100 -105
- package/dist/src/components/CollapsibleWrapper.vue.d.ts +3 -11
- package/dist/src/helpers/string.d.ts +1 -10
- package/dist/src/router/shared.d.ts +1 -3
- package/dist/src/stores/restaurant.d.ts +7 -7
- package/dist/src/stores/team.d.ts +0 -30
- package/dist/src/types/team.d.ts +1 -17
- package/dist/src/views/hr/locales/index.d.ts +4 -24
- package/dist/src/views/hr/role/RoleForm.vue.d.ts +2 -29
- package/dist/src/views/scheduling/composables/useScheduleOnboardingAvailability.d.ts +1 -1
- package/dist/src/views/scheduling/composables/useScheduleOnboardingWizard.d.ts +1 -1
- package/dist/src/views/scheduling/composables/useScheduleShiftDraft.d.ts +1 -1
- package/dist/src/views/scheduling/composables/useScheduleShiftPopover.d.ts +1 -1
- package/dist/src/views/team/components/BasePermission.vue.d.ts +0 -11
- package/dist/src/views/team/components/ConditionPermission.vue.d.ts +0 -11
- package/dist/src/views/team/components/PortalPermissionEditor.vue.d.ts +0 -21
- package/dist/src/views/team/components/PosRolePermission.vue.d.ts +0 -11
- package/dist/src/views/team/locales/index.d.ts +0 -716
- package/dist/src/views/team/member/AddMemberForm.vue.d.ts +3 -48
- package/dist/src/views/team/{components/MemberStatusBadge.vue.d.ts → member/MemberInfo.vue.d.ts} +2 -2
- package/dist/src/views/team/member/TeamMemberList.vue.d.ts +0 -1
- package/dist/string-VNuQNweN.js +15 -0
- package/dist/style.css +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{useAppStore-BPARQyvJ.js → useAppStore-DZCdxlCd.js} +1 -1
- package/dist/{useLoading-iPESFb6R.js → useLoading-Nygx2zn8.js} +1 -1
- package/dist/{useReportPermissions-By-BoJZb.js → useReportPermissions-CxV7Dz1B.js} +5 -5
- package/package.json +2 -2
- package/dist/ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BbsPesWY.js +0 -459
- package/dist/EmployeeList-D4oy5hXz.js +0 -896
- package/dist/FormSection.vue_vue_type_script_setup_true_lang-Cl053Tg1.js +0 -90
- package/dist/Main-CVGiOYpC.js +0 -101
- package/dist/MyPosProfile-BQCBFMFw.js +0 -301
- package/dist/PasscodePinField.vue_vue_type_script_setup_true_lang-TXPEqa46.js +0 -126
- package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-ZSREAS1r.js +0 -4243
- package/dist/PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-DRGTxOMW.js +0 -1831
- package/dist/RoleForm.vue_vue_type_script_setup_true_lang-DFDTw0lj.js +0 -547
- package/dist/RoleList-DG0crFzW.js +0 -274
- package/dist/TeamMemberList-C970Iqlj.js +0 -2086
- package/dist/member-grant-CzZUdO_s.js +0 -55
- package/dist/restaurant-Dl6yx37M.js +0 -51
- package/dist/src/api/my-pos-profile/index.d.ts +0 -5
- package/dist/src/api/sso-provider/index.d.ts +0 -5
- package/dist/src/api/staff-invite/index.d.ts +0 -16
- package/dist/src/components/form/SegmentedTabs.vue.d.ts +0 -23
- package/dist/src/composables/useMenuAccess.d.ts +0 -56
- package/dist/src/composables/useSsoProviders.d.ts +0 -19
- package/dist/src/composables/useStaffInviteProviders.d.ts +0 -8
- package/dist/src/helpers/member-grant.d.ts +0 -36
- package/dist/src/helpers/my-pos-profile.d.ts +0 -37
- package/dist/src/helpers/pos-assignment-rows.d.ts +0 -28
- package/dist/src/helpers/staff-invite.d.ts +0 -54
- package/dist/src/router/menu-access-guard.d.ts +0 -17
- package/dist/src/types/my-pos-profile.d.ts +0 -25
- package/dist/src/types/sso-provider.d.ts +0 -10
- package/dist/src/types/staff-invite.d.ts +0 -100
- package/dist/src/views/my-pos-profile/MyPosProfile.vue.d.ts +0 -2
- package/dist/src/views/my-pos-profile/components/PasscodeChangedDialog.vue.d.ts +0 -4
- package/dist/src/views/my-pos-profile/locales/index.d.ts +0 -200
- package/dist/src/views/team/components/MemberGrantFields.vue.d.ts +0 -51
- package/dist/src/views/team/components/PosAssignmentRows.vue.d.ts +0 -44
- package/dist/src/views/team/member/ExistingMemberNotice.vue.d.ts +0 -11
- package/dist/src/views/team/member/MemberDetailsCard.vue.d.ts +0 -35
- package/dist/src/views/team/member/MemberHeaderCard.vue.d.ts +0 -19
- package/dist/string-DZQ1uNjn.js +0 -22
|
@@ -1,547 +0,0 @@
|
|
|
1
|
-
import { defineComponent as ze, computed as y, ref as C, watch as q, 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-B2eWEGH4.js";
|
|
3
|
-
import { e as be } from "./iteration-y_jodvfN.js";
|
|
4
|
-
import { useI18n as Ne } from "@feedmepos/mf-common";
|
|
5
|
-
import { useBreakpoints as Ke, useSnackbar as Te, components as qe } from "@feedmepos/ui-library";
|
|
6
|
-
import { u as We, _ as Ge, a as _e } from "./ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BbsPesWY.js";
|
|
7
|
-
import { u as Je } from "./useDiscardConfirm-CzZSPyvh.js";
|
|
8
|
-
import { u as He } from "./useLoading-iPESFb6R.js";
|
|
9
|
-
import { u as Qe } from "./useReportPermissions-By-BoJZb.js";
|
|
10
|
-
import { D as Xe, l as Ye, A as Ze, S as et } from "./app-n6d4AmtP.js";
|
|
11
|
-
import { r as ae, h as tt, e as at, s as st, i as ge, j as lt } from "./rule-ChmhcGgA.js";
|
|
12
|
-
import { u as rt } from "./restaurant-Dl6yx37M.js";
|
|
13
|
-
import { u as ot } from "./role-DfZi7Ssk.js";
|
|
14
|
-
function Tt(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 qt(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 } = Ke(), x = y(() => u.value.xs || u.value.sm), v = rt(), P = y(() => v.restaurants.value), le = C(v.restaurants.value.length === 0);
|
|
92
|
-
q(
|
|
93
|
-
() => v.restaurants.value.length,
|
|
94
|
-
(e) => {
|
|
95
|
-
e > 0 && (le.value = !1);
|
|
96
|
-
}
|
|
97
|
-
);
|
|
98
|
-
const B = ot(), ye = Te(), 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([]), K = 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
|
-
K.value = [...s.value.permissions], ne.value = [...s.value.restaurantIds];
|
|
208
|
-
}
|
|
209
|
-
Le(async () => {
|
|
210
|
-
await v.readRestaurants(), await re(), R.value || fe();
|
|
211
|
-
}), q(R, async (e) => {
|
|
212
|
-
e && await re();
|
|
213
|
-
}), q(oe, () => {
|
|
214
|
-
if (R.value && b.value && !g.value) {
|
|
215
|
-
s.value.permissions = X(s.value.permissions), K.value = X(K.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
|
-
q(
|
|
269
|
-
() => s.value.restaurantIds,
|
|
270
|
-
(e) => {
|
|
271
|
-
e.length > 0 && (Se.value = "");
|
|
272
|
-
}
|
|
273
|
-
);
|
|
274
|
-
const T = 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, K.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(qe).FmForm,
|
|
296
|
-
"is-container-props": {
|
|
297
|
-
onValidationSuccess: Ue,
|
|
298
|
-
blameFormChildOnValidationFailed: !0
|
|
299
|
-
},
|
|
300
|
-
"max-width": 960,
|
|
301
|
-
"close-button": !1,
|
|
302
|
-
"onOn:clickedAway": o(T)
|
|
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(T)
|
|
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(T)
|
|
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(T)
|
|
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
|
-
qt 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
|
-
Tt as t
|
|
547
|
-
};
|