@feedmepos/mf-hrm-portal 2.1.1-dev → 2.1.1-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-BH5sgVMU.js +638 -0
- package/dist/AuditLogList-Q4L5Te8O.js +1145 -0
- package/dist/CollapsibleWrapper.vue_vue_type_script_setup_true_lang-BLJlmPVa.js +58 -0
- package/dist/EmployeeList-GtKmJZbf.js +899 -0
- package/dist/GrantUserList-CnLjOi5_.js +468 -0
- package/dist/Main-Cn7Dawg4.js +120 -0
- package/dist/{Main-mTxcltDY.js → Main-DLlpEU3j.js} +11 -9
- package/dist/{Main-BLRr_ORG.js → Main-cskEZ3k_.js} +1033 -1035
- package/dist/PermissionSetList-C2fK2pTz.js +357 -0
- package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-CMh0DL1_.js +3458 -0
- package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_79737e32_lang-Czo3FLbc.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_a439fdd8_lang-BJp9hEfv.js} +1 -2
- package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-Cn-3MRBO.js +38 -0
- package/dist/RoleList-CcuT1ERb.js +567 -0
- package/dist/TeamMemberList-Dfs2iNdC.js +1131 -0
- package/dist/{TimesheetList-D21j4zLV.js → TimesheetList-B1H_6zfP.js} +136 -141
- package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_2c7a177a_lang-CRmmIfTk.js → TimesheetList.vue_vue_type_style_index_0_scoped_91afda4e_lang-DeTpbaRk.js} +14 -13
- package/dist/{app-CX-St7pv.js → app-DX-PG6wx.js} +2725 -5281
- package/dist/app.js +1 -1
- package/dist/approval-code-Q4666xp5.js +58 -0
- package/dist/{dayjs.min-MDoe5X-P.js → dayjs.min-BJrHE7oz.js} +1 -1
- package/dist/{employee-B2cdx2t4.js → employee-BJcqtqLM.js} +27 -26
- package/dist/grant-user-CQZaTzVt.js +67 -0
- package/dist/{TableEmptyState.vue_vue_type_script_setup_true_lang-Ci_MVqGK.js → index.vue_vue_type_script_setup_true_lang-BVVwfd7B.js} +19 -50
- package/dist/iteration-Cfaqt-0s.js +7682 -0
- package/dist/{lodash-DZAGPZLQ.js → lodash-ClKqCmlZ.js} +1 -1
- package/dist/restaurant-YOVMuuFY.js +1876 -0
- package/dist/role-CR_-nBDY.js +82 -0
- package/dist/rule-BB-3S-2R.js +996 -0
- package/dist/src/api/approval-code/index.d.ts +7 -0
- package/dist/src/api/audit-log/index.d.ts +0 -6
- package/dist/src/components/CheckboxInput.vue.d.ts +1 -1
- package/dist/src/components/button/ResponsiveFabButton.vue.d.ts +1 -7
- package/dist/src/components/table/TableEmptyState.vue.d.ts +15 -7
- package/dist/src/composables/useBasePermission.d.ts +1 -2
- package/dist/src/helpers/permission-set.d.ts +4 -8
- package/dist/src/helpers/rule.d.ts +1 -2
- package/dist/src/router/shared.d.ts +3 -1
- package/dist/src/stores/approval-code.d.ts +140 -0
- package/dist/src/stores/permission-set.d.ts +3 -12
- package/dist/src/types/approval-code.d.ts +99 -0
- package/dist/src/types/audit-log.d.ts +1 -1
- package/dist/src/views/approval-code/ApprovalCodeList.vue.d.ts +26 -0
- package/dist/src/views/approval-code/components/ApprovalCodeForm.vue.d.ts +17 -0
- package/dist/src/views/approval-code/locales/index.d.ts +320 -0
- package/dist/src/views/audit-log/locales/index.d.ts +0 -296
- package/dist/src/views/hr/employee/EmployeeList.vue.d.ts +0 -1
- package/dist/src/views/pos-access/locales/index.d.ts +48 -0
- package/dist/src/views/team/components/BasePermission.vue.d.ts +0 -13
- package/dist/src/views/team/locales/index.d.ts +0 -72
- package/dist/style.css +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/useAppStore-DNTlIeMv.js +93 -0
- package/dist/useDebounce-CWb5QR9G.js +28 -0
- package/dist/{useLoading-qgSjOzRD.js → useLoading-BH02lYns.js} +1 -1
- package/dist/{useReportPermissions-CIhkjN3B.js → useReportPermissions-ybHA26cJ.js} +3 -3
- package/package.json +2 -2
- package/dist/AuditLogList-Cvp-5_0y.js +0 -1608
- package/dist/ConditionFormHost.vue_vue_type_script_setup_true_lang-Cb8-YaiH.js +0 -387
- package/dist/EmployeeList-DgrD3Hjm.js +0 -884
- package/dist/Main-G3am-0Xi.js +0 -577
- package/dist/PermissionSetList-OzyfE-Yg.js +0 -392
- package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Ca2NnAAF.js +0 -4121
- package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-QrqYEy8i.js +0 -42
- package/dist/RoleList-DOZ5RJ6A.js +0 -684
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-B4PxNMwq.js +0 -16
- package/dist/TeamMemberList-CAqLUyQK.js +0 -1186
- package/dist/iteration-B38iapI_.js +0 -9556
- package/dist/rule-DftQBR76.js +0 -1057
- package/dist/src/composables/useConditionDraft.d.ts +0 -40
- package/dist/src/composables/useCoverConditionOverride.d.ts +0 -61
- package/dist/src/helpers/business-timezone.d.ts +0 -22
- package/dist/src/helpers/filter.d.ts +0 -15
- package/dist/src/helpers/permission-reconcile.d.ts +0 -15
- package/dist/src/helpers/permission-reconcile.test.d.ts +0 -1
- package/dist/src/views/audit-log/event-line.d.ts +0 -13
- package/dist/src/views/audit-log/snapshot-diff.d.ts +0 -11
- package/dist/src/views/team/condition-builders/ConditionFormHost.vue.d.ts +0 -22
- package/dist/src/views/team/condition-builders/ConditionFormRenderer.vue.d.ts +0 -23
- package/dist/src/views/team/condition-builders/component-map.d.ts +0 -4
- package/dist/src/views/team/condition-builders/condition-form-dedupe.d.ts +0 -23
- package/dist/useAppStore-BBsP5C3E.js +0 -169
- package/dist/useDebounce-B8ZPVS5C.js +0 -15
- /package/dist/src/views/{grant → pos-access}/Main.vue.d.ts +0 -0
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
import { computed as _, defineComponent as ge, ref as $, watch as se, onMounted as be, resolveComponent as y, createBlock as P, openBlock as p, unref as o, withCtx as b, createElementVNode as d, createVNode as n, createElementBlock as k, Fragment as N, createCommentVNode as de, renderList as le, toDisplayString as A, h as S, createTextVNode as pe, resolveDynamicComponent as ve, withModifiers as Ie, nextTick as fe } from "vue";
|
|
2
|
+
import { e as L } from "./iteration-Cfaqt-0s.js";
|
|
3
|
+
import { useI18n as ye } from "@feedmepos/mf-common";
|
|
4
|
+
import { useSnackbar as xe, components as ue, useDialog as Ee, useBreakpoints as Ue, FmButtonColorThemeVariant as Se } from "@feedmepos/ui-library";
|
|
5
|
+
import { _ as Pe } from "./app-DX-PG6wx.js";
|
|
6
|
+
import { u as $e, _ as he } from "./useDiscardConfirm-DPhEV6v0.js";
|
|
7
|
+
import { _ as Te } from "./index.vue_vue_type_script_setup_true_lang-BVVwfd7B.js";
|
|
8
|
+
import { e as De, r as K, h as Ce, f as Me, g as _e, a as ae } from "./rule-BB-3S-2R.js";
|
|
9
|
+
import { u as me } from "./restaurant-YOVMuuFY.js";
|
|
10
|
+
import { u as Fe } from "./role-CR_-nBDY.js";
|
|
11
|
+
import { u as Re } from "./useReportPermissions-ybHA26cJ.js";
|
|
12
|
+
import { l as te } from "./lodash-ClKqCmlZ.js";
|
|
13
|
+
import { _ as Be } from "./CollapsibleWrapper.vue_vue_type_script_setup_true_lang-BLJlmPVa.js";
|
|
14
|
+
import { _ as ie } from "./FormSection.vue_vue_type_script_setup_true_lang-DknXTYiK.js";
|
|
15
|
+
import { u as Ne } from "./useLoading-BH02lYns.js";
|
|
16
|
+
function Ae() {
|
|
17
|
+
const W = me();
|
|
18
|
+
return _(() => {
|
|
19
|
+
const s = {};
|
|
20
|
+
return W.restaurants.value.forEach((C) => {
|
|
21
|
+
s[C._id] = C;
|
|
22
|
+
}), s;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
const Oe = { class: "flex w-full items-center justify-between" }, Je = { class: "fm-typo-en-title-md-600" }, qe = { class: "space-y-40" }, ze = {
|
|
26
|
+
key: 0,
|
|
27
|
+
class: "flex justify-center py-16"
|
|
28
|
+
}, je = { class: "space-y-8" }, Ke = { class: "fm-typo-en-title-sm-600" }, We = { class: "mt-16 space-y-8" }, Ge = {
|
|
29
|
+
key: 0,
|
|
30
|
+
class: "ml-20 mt-8 flex max-w-[320px] flex-row items-start gap-8"
|
|
31
|
+
}, He = { class: "mt-8 whitespace-nowrap" }, Qe = { class: "flex gap-8 items-center justify-start" }, Xe = /* @__PURE__ */ ge({
|
|
32
|
+
__name: "RoleForm",
|
|
33
|
+
props: {
|
|
34
|
+
id: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: void 0
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
setup(W, { expose: G }) {
|
|
40
|
+
const { t: s } = ye(), C = me(), T = $(""), I = _(() => C.restaurants.value.filter(({ profile: e }) => {
|
|
41
|
+
const a = `${e.code ? e.code + "-" : ""}${e.legalName}`;
|
|
42
|
+
return !T.value || a.toLowerCase().includes(T.value.toLowerCase());
|
|
43
|
+
})), J = $(C.restaurants.value.length === 0);
|
|
44
|
+
se(
|
|
45
|
+
() => C.restaurants.value.length,
|
|
46
|
+
(e) => {
|
|
47
|
+
e > 0 && (J.value = !1);
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
const D = Fe(), H = xe(), Q = Ne(H), { fetchReportPermissions: X, allReportPermissions: oe, availableReportKeys: M } = Re(), F = W, R = $(!1), re = () => {
|
|
51
|
+
R.value = !R.value, R.value && Z();
|
|
52
|
+
}, q = _(() => F.id ? s("hr.role.form.update") : s("hr.role.form.add")), Y = _(() => F.id ? s("common.update") : s("common.add")), O = _(() => {
|
|
53
|
+
const e = De.filter(
|
|
54
|
+
(u) => u.subject !== L.F_RULE_SUBJECT.enum.report
|
|
55
|
+
).map((u) => K(u)), a = oe.value.map((u) => K(u));
|
|
56
|
+
return [...e, ...a];
|
|
57
|
+
}), v = _(() => D.roles.value.find((e) => e._id == F.id)), E = () => ({
|
|
58
|
+
name: "",
|
|
59
|
+
restaurantIds: [],
|
|
60
|
+
permissions: [],
|
|
61
|
+
maxDiscountPercentage: 100
|
|
62
|
+
}), l = $(E()), z = _(() => [
|
|
63
|
+
{
|
|
64
|
+
title: s("hr.role.labels.operation"),
|
|
65
|
+
filter: (e) => e.isOrderOperation
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
title: s("hr.role.labels.report"),
|
|
69
|
+
filter: (e) => e.isReportPermission
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
title: s("hr.role.labels.other"),
|
|
73
|
+
filter: (e) => !e.isOrderOperation && !e.isReportPermission
|
|
74
|
+
}
|
|
75
|
+
].map((e) => ({
|
|
76
|
+
title: e.title,
|
|
77
|
+
options: O.value.filter(e.filter).map(({ label: a, value: u }) => ({
|
|
78
|
+
label: s(`hr.role.form.permissionLabels.${u}`, a),
|
|
79
|
+
value: u
|
|
80
|
+
}))
|
|
81
|
+
}))), g = _(() => {
|
|
82
|
+
var e;
|
|
83
|
+
return Ce(((e = v.value) == null ? void 0 : e.permissions) || []);
|
|
84
|
+
});
|
|
85
|
+
function Z() {
|
|
86
|
+
var e;
|
|
87
|
+
l.value = E(), l.value.name = ((e = v.value) == null ? void 0 : e.name) ?? "", g.value ? (l.value.restaurantIds = I.value.map((a) => a._id), l.value.permissions = O.value.map((a) => a.value)) : v.value && (l.value.restaurantIds = v.value.restaurants.map((a) => a.id), l.value.permissions = v.value.permissions.map((a) => K(a).value).filter((a) => a.startsWith("report:") ? M.value.has(a.split(":")[1]) : !0), l.value.maxDiscountPercentage = _e(
|
|
88
|
+
v.value.permissions
|
|
89
|
+
));
|
|
90
|
+
}
|
|
91
|
+
be(async () => {
|
|
92
|
+
await C.readRestaurants(), await X(), Z();
|
|
93
|
+
}), se(R, async (e) => {
|
|
94
|
+
e && await X();
|
|
95
|
+
}), se(M, () => {
|
|
96
|
+
R.value && v.value && !g.value && (l.value.permissions = l.value.permissions.filter((e) => e.startsWith("report:") ? M.value.has(e.split(":")[1]) : !0));
|
|
97
|
+
});
|
|
98
|
+
const ne = $(""), t = _(() => ({
|
|
99
|
+
restaurantIds: l.value.restaurantIds,
|
|
100
|
+
role: {
|
|
101
|
+
name: l.value.name,
|
|
102
|
+
permissions: Me(l.value.permissions, l.value.maxDiscountPercentage)
|
|
103
|
+
}
|
|
104
|
+
})), r = async () => {
|
|
105
|
+
const e = t.value;
|
|
106
|
+
await Q.minor(
|
|
107
|
+
async () => {
|
|
108
|
+
v.value ? await D.updateRole(v.value._id, e) : await D.createRole(e);
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
successMessage: v.value ? s("hr.role.update.successMessage", { name: e.role.name }) : s("hr.role.add.successMessage", { name: e.role.name })
|
|
112
|
+
}
|
|
113
|
+
), R.value = !1;
|
|
114
|
+
}, c = _(
|
|
115
|
+
() => l.value.restaurantIds.filter((e) => I.value.some((a) => a._id === e))
|
|
116
|
+
), i = _(() => I.value.length > 0 && I.value.length === c.value.length), h = () => {
|
|
117
|
+
const e = l.value.restaurantIds.filter((a) => !c.value.includes(a));
|
|
118
|
+
i.value === !0 ? l.value.restaurantIds = e : l.value.restaurantIds = I.value.map((a) => a._id);
|
|
119
|
+
}, x = (e) => e.map((u) => u.value).every((u) => l.value.permissions.includes(u)), f = (e) => {
|
|
120
|
+
const a = l.value.permissions.filter(
|
|
121
|
+
(u) => !e.map((B) => B.value).includes(u)
|
|
122
|
+
);
|
|
123
|
+
x(e) === !0 ? l.value.permissions = a : l.value.permissions = [...a, ...e.map((u) => u.value)];
|
|
124
|
+
};
|
|
125
|
+
se(
|
|
126
|
+
() => l.value.restaurantIds,
|
|
127
|
+
(e) => {
|
|
128
|
+
e.length > 0 && (ne.value = "");
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
const V = $e(
|
|
132
|
+
() => {
|
|
133
|
+
var e, a, u, B;
|
|
134
|
+
return !te.isEqual(l.value.name, ((e = v.value) == null ? void 0 : e.name) || E().name) || !te.isEqual(
|
|
135
|
+
l.value.restaurantIds,
|
|
136
|
+
((a = v.value) == null ? void 0 : a.restaurants.map((j) => j.id)) || E().restaurantIds
|
|
137
|
+
) || !te.isEqual(
|
|
138
|
+
l.value.permissions,
|
|
139
|
+
((u = v.value) == null ? void 0 : u.permissions.map((j) => K(j).value)) || E().permissions
|
|
140
|
+
) || !te.isEqual(
|
|
141
|
+
l.value.maxDiscountPercentage,
|
|
142
|
+
v.value ? _e((B = v.value) == null ? void 0 : B.permissions) : E().maxDiscountPercentage
|
|
143
|
+
);
|
|
144
|
+
},
|
|
145
|
+
() => {
|
|
146
|
+
R.value = !1;
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
return G({
|
|
150
|
+
show: R,
|
|
151
|
+
trigger: re
|
|
152
|
+
}), (e, a) => {
|
|
153
|
+
const u = y("FmIcon"), B = y("FmTextField"), j = y("FmCircularProgress"), we = y("FmSearch"), ee = y("FmCheckbox"), ke = y("FmFormGroup"), Ve = y("FmCard"), ce = y("fm-button"), Le = y("fm-side-sheet");
|
|
154
|
+
return p(), P(Le, {
|
|
155
|
+
id: "unit-form",
|
|
156
|
+
"model-value": R.value,
|
|
157
|
+
"is-container": o(ue).FmForm,
|
|
158
|
+
"is-container-props": {
|
|
159
|
+
onValidationSuccess: r,
|
|
160
|
+
blameFormChildOnValidationFailed: !0
|
|
161
|
+
},
|
|
162
|
+
"max-width": 960,
|
|
163
|
+
"close-button": !1,
|
|
164
|
+
"onOn:clickedAway": o(V)
|
|
165
|
+
}, {
|
|
166
|
+
"side-sheet-header": b(() => [
|
|
167
|
+
d("div", Oe, [
|
|
168
|
+
d("p", Je, A(q.value), 1),
|
|
169
|
+
n(u, {
|
|
170
|
+
name: "close",
|
|
171
|
+
size: "md",
|
|
172
|
+
class: "cursor-pointer",
|
|
173
|
+
onClick: o(V)
|
|
174
|
+
}, null, 8, ["onClick"])
|
|
175
|
+
])
|
|
176
|
+
]),
|
|
177
|
+
"side-sheet-footer": b(() => [
|
|
178
|
+
d("div", Qe, [
|
|
179
|
+
n(ce, {
|
|
180
|
+
label: Y.value,
|
|
181
|
+
size: "lg",
|
|
182
|
+
type: "submit",
|
|
183
|
+
variant: "primary",
|
|
184
|
+
disabled: g.value
|
|
185
|
+
}, null, 8, ["label", "disabled"]),
|
|
186
|
+
n(ce, {
|
|
187
|
+
label: o(s)("common.cancel"),
|
|
188
|
+
size: "lg",
|
|
189
|
+
variant: "tertiary",
|
|
190
|
+
onClick: o(V)
|
|
191
|
+
}, null, 8, ["label", "onClick"])
|
|
192
|
+
])
|
|
193
|
+
]),
|
|
194
|
+
default: b(() => [
|
|
195
|
+
d("div", qe, [
|
|
196
|
+
n(ie, {
|
|
197
|
+
title: o(s)("hr.role.form.roleDetail")
|
|
198
|
+
}, {
|
|
199
|
+
default: b(() => [
|
|
200
|
+
n(B, {
|
|
201
|
+
modelValue: l.value.name,
|
|
202
|
+
"onUpdate:modelValue": a[0] || (a[0] = (m) => l.value.name = m),
|
|
203
|
+
autofocus: "",
|
|
204
|
+
rules: [(m) => !!m || o(s)("hr.role.form.required")],
|
|
205
|
+
label: o(s)("hr.role.form.name"),
|
|
206
|
+
disabled: g.value
|
|
207
|
+
}, null, 8, ["modelValue", "rules", "label", "disabled"])
|
|
208
|
+
]),
|
|
209
|
+
_: 1
|
|
210
|
+
}, 8, ["title"]),
|
|
211
|
+
n(ie, {
|
|
212
|
+
title: o(s)("hr.role.form.restaurant")
|
|
213
|
+
}, {
|
|
214
|
+
default: b(() => [
|
|
215
|
+
J.value ? (p(), k("div", ze, [
|
|
216
|
+
n(j)
|
|
217
|
+
])) : (p(), k(N, { key: 1 }, [
|
|
218
|
+
n(we, {
|
|
219
|
+
modelValue: T.value,
|
|
220
|
+
"onUpdate:modelValue": a[1] || (a[1] = (m) => T.value = m),
|
|
221
|
+
placeholder: o(s)("hr.restaurant.search.placeholder")
|
|
222
|
+
}, null, 8, ["modelValue", "placeholder"]),
|
|
223
|
+
n(ke, {
|
|
224
|
+
modelValue: l.value.restaurantIds,
|
|
225
|
+
"onUpdate:modelValue": a[3] || (a[3] = (m) => l.value.restaurantIds = m),
|
|
226
|
+
rules: [(m) => m.length > 0 || o(s)("hr.role.form.atLeastOneRestaurant")]
|
|
227
|
+
}, {
|
|
228
|
+
default: b(() => [
|
|
229
|
+
d("div", je, [
|
|
230
|
+
T.value ? de("", !0) : (p(), k(N, { key: 0 }, [
|
|
231
|
+
n(ee, {
|
|
232
|
+
"model-value": i.value,
|
|
233
|
+
label: o(s)("hr.role.form.all"),
|
|
234
|
+
value: "1",
|
|
235
|
+
disabled: g.value,
|
|
236
|
+
"onUpdate:modelValue": h
|
|
237
|
+
}, null, 8, ["model-value", "label", "disabled"]),
|
|
238
|
+
a[6] || (a[6] = d("div", { class: "h-px w-full bg-fm-color-neutral-gray-200" }, null, -1))
|
|
239
|
+
], 64)),
|
|
240
|
+
(p(!0), k(N, null, le(I.value, (m) => (p(), k("div", {
|
|
241
|
+
key: m._id
|
|
242
|
+
}, [
|
|
243
|
+
n(ee, {
|
|
244
|
+
modelValue: l.value.restaurantIds,
|
|
245
|
+
"onUpdate:modelValue": a[2] || (a[2] = (U) => l.value.restaurantIds = U),
|
|
246
|
+
label: `${m.profile.code ? m.profile.code + "-" : ""}${m.profile.name}`,
|
|
247
|
+
value: m._id,
|
|
248
|
+
disabled: g.value
|
|
249
|
+
}, null, 8, ["modelValue", "label", "value", "disabled"])
|
|
250
|
+
]))), 128))
|
|
251
|
+
])
|
|
252
|
+
]),
|
|
253
|
+
_: 1
|
|
254
|
+
}, 8, ["modelValue", "rules"])
|
|
255
|
+
], 64))
|
|
256
|
+
]),
|
|
257
|
+
_: 1
|
|
258
|
+
}, 8, ["title"]),
|
|
259
|
+
n(ie, {
|
|
260
|
+
title: o(s)("hr.role.form.permissions")
|
|
261
|
+
}, {
|
|
262
|
+
default: b(() => [
|
|
263
|
+
(p(!0), k(N, null, le(z.value, (m) => (p(), P(Ve, {
|
|
264
|
+
key: m.title,
|
|
265
|
+
variant: "outlined",
|
|
266
|
+
class: "p-16"
|
|
267
|
+
}, {
|
|
268
|
+
default: b(() => [
|
|
269
|
+
n(Be, null, {
|
|
270
|
+
title: b(() => [
|
|
271
|
+
d("p", Ke, A(m.title), 1)
|
|
272
|
+
]),
|
|
273
|
+
default: b(() => [
|
|
274
|
+
d("div", We, [
|
|
275
|
+
n(ee, {
|
|
276
|
+
"model-value": x(m.options),
|
|
277
|
+
label: o(s)("hr.role.form.all"),
|
|
278
|
+
value: "1",
|
|
279
|
+
disabled: g.value,
|
|
280
|
+
"onUpdate:modelValue": (U) => f(m.options)
|
|
281
|
+
}, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"]),
|
|
282
|
+
a[7] || (a[7] = d("div", { class: "h-px w-full bg-fm-color-neutral-gray-200" }, null, -1)),
|
|
283
|
+
(p(!0), k(N, null, le(m.options, (U) => (p(), k("div", {
|
|
284
|
+
key: U.value
|
|
285
|
+
}, [
|
|
286
|
+
n(ee, {
|
|
287
|
+
modelValue: l.value.permissions,
|
|
288
|
+
"onUpdate:modelValue": a[4] || (a[4] = (w) => l.value.permissions = w),
|
|
289
|
+
label: U.label,
|
|
290
|
+
value: U.value,
|
|
291
|
+
disabled: g.value
|
|
292
|
+
}, null, 8, ["modelValue", "label", "value", "disabled"]),
|
|
293
|
+
U.value === "order:discount" && l.value.permissions.includes(U.value) ? (p(), k("div", Ge, [
|
|
294
|
+
d("div", He, A(o(s)("hr.role.form.maxDiscountPercentage")), 1),
|
|
295
|
+
n(B, {
|
|
296
|
+
modelValue: l.value.maxDiscountPercentage,
|
|
297
|
+
"onUpdate:modelValue": a[5] || (a[5] = (w) => l.value.maxDiscountPercentage = w),
|
|
298
|
+
rules: [
|
|
299
|
+
(w) => !!w || o(s)("hr.role.form.required"),
|
|
300
|
+
(w) => !isNaN(w) || o(s)("hr.role.form.onlyContainsNumber"),
|
|
301
|
+
(w) => w <= 100 || o(s)("hr.role.form.maxValueIs", { max: 100 }),
|
|
302
|
+
(w) => w >= 0 || o(s)("hr.role.form.minValueIs", { min: 0 })
|
|
303
|
+
],
|
|
304
|
+
"append-text": "%",
|
|
305
|
+
disabled: g.value
|
|
306
|
+
}, null, 8, ["modelValue", "rules", "disabled"])
|
|
307
|
+
])) : de("", !0)
|
|
308
|
+
]))), 128))
|
|
309
|
+
])
|
|
310
|
+
]),
|
|
311
|
+
_: 2
|
|
312
|
+
}, 1024)
|
|
313
|
+
]),
|
|
314
|
+
_: 2
|
|
315
|
+
}, 1024))), 128))
|
|
316
|
+
]),
|
|
317
|
+
_: 1
|
|
318
|
+
}, 8, ["title"])
|
|
319
|
+
])
|
|
320
|
+
]),
|
|
321
|
+
_: 1
|
|
322
|
+
}, 8, ["model-value", "is-container", "is-container-props", "onOn:clickedAway"]);
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
}), Ye = {
|
|
326
|
+
class: "space-y-8"
|
|
327
|
+
}, Ze = {
|
|
328
|
+
class: "flex justify-end xs:px-16"
|
|
329
|
+
}, es = {
|
|
330
|
+
class: "pb-64 sm:hidden md:hidden lg:hidden"
|
|
331
|
+
}, ss = {
|
|
332
|
+
class: "space-y-4"
|
|
333
|
+
}, as = {
|
|
334
|
+
class: "fm-typo-en-body-lg-600"
|
|
335
|
+
}, ts = {
|
|
336
|
+
class: "text-fm-color-typo-secondary"
|
|
337
|
+
}, ls = {
|
|
338
|
+
class: "flex"
|
|
339
|
+
}, os = {
|
|
340
|
+
class: "flex"
|
|
341
|
+
}, xs = /* @__PURE__ */ ge({
|
|
342
|
+
__name: "RoleList",
|
|
343
|
+
setup(W, {
|
|
344
|
+
expose: G
|
|
345
|
+
}) {
|
|
346
|
+
const {
|
|
347
|
+
t: s
|
|
348
|
+
} = ye(), {
|
|
349
|
+
allReportPermissions: C
|
|
350
|
+
} = Re(), T = me(), I = _(() => T.restaurants.value), J = _(() => I.value.map((t) => t._id));
|
|
351
|
+
function D(t, r) {
|
|
352
|
+
const c = r === L.F_RULE_SUBJECT.enum.report ? C.value : void 0, i = ae(t, r, c);
|
|
353
|
+
return ["-", "All"].includes(i) ? () => null : () => S(ue.FmTooltip, {
|
|
354
|
+
"z-index": "999",
|
|
355
|
+
placement: "top",
|
|
356
|
+
class: "ml-2"
|
|
357
|
+
}, {
|
|
358
|
+
content: () => S("div", [s("hr.role.tooltip.labels.permission"), ...t.filter((h) => h.subject === r).map((h) => S("div", ["- ", K(h).label]))]),
|
|
359
|
+
default: () => S(ue.FmIcon, {
|
|
360
|
+
name: "info",
|
|
361
|
+
color: Se.NeutralGray400
|
|
362
|
+
})
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
function H(t, r) {
|
|
366
|
+
const c = r === L.F_RULE_SUBJECT.enum.report ? C.value : void 0, i = ae(t, r, c);
|
|
367
|
+
return () => i === "All" ? i : S("div", {
|
|
368
|
+
class: "flex items-center"
|
|
369
|
+
}, [i, D(t, r)()]);
|
|
370
|
+
}
|
|
371
|
+
function Q(t) {
|
|
372
|
+
return [{
|
|
373
|
+
label: s("hr.role.form.update"),
|
|
374
|
+
onClick: () => M(t)
|
|
375
|
+
}, {
|
|
376
|
+
label: s("hr.role.remove.title"),
|
|
377
|
+
onClick: () => E(t),
|
|
378
|
+
itemClass: "text-fm-color-typo-error",
|
|
379
|
+
disabled: Ce(t.permissions)
|
|
380
|
+
}];
|
|
381
|
+
}
|
|
382
|
+
const X = ({
|
|
383
|
+
role: t,
|
|
384
|
+
className: r = ""
|
|
385
|
+
}) => n("div", {
|
|
386
|
+
class: r,
|
|
387
|
+
onClick: (c) => {
|
|
388
|
+
c.stopPropagation();
|
|
389
|
+
}
|
|
390
|
+
}, [n(he, {
|
|
391
|
+
items: Q(t)
|
|
392
|
+
}, null)]), oe = [{
|
|
393
|
+
accessorKey: "name",
|
|
394
|
+
header: () => s("hr.role.columns.name"),
|
|
395
|
+
enableSorting: !1
|
|
396
|
+
}, {
|
|
397
|
+
accessorKey: "operation",
|
|
398
|
+
header: () => s("hr.role.columns.operation"),
|
|
399
|
+
cell: (t) => S(H(t.row.original.permissions, L.F_RULE_SUBJECT.enum.order)),
|
|
400
|
+
enableSorting: !1
|
|
401
|
+
}, {
|
|
402
|
+
accessorKey: "report",
|
|
403
|
+
header: () => s("hr.role.columns.report"),
|
|
404
|
+
cell: (t) => S(H(t.row.original.permissions, L.F_RULE_SUBJECT.enum.report)),
|
|
405
|
+
enableSorting: !1
|
|
406
|
+
}, {
|
|
407
|
+
accessorKey: "restaurants",
|
|
408
|
+
header: () => s("hr.role.columns.restaurants"),
|
|
409
|
+
cell: (t) => t.row.original.restaurants.map((r, c) => {
|
|
410
|
+
const i = r.code, h = `${i ? i + " - " : ""}${r.name}`;
|
|
411
|
+
return S("div", (c ? `
|
|
412
|
+
` : "") + h);
|
|
413
|
+
}),
|
|
414
|
+
enableSorting: !1
|
|
415
|
+
}, {
|
|
416
|
+
id: "action",
|
|
417
|
+
size: 52,
|
|
418
|
+
meta: {
|
|
419
|
+
cellClass: "pl-16",
|
|
420
|
+
headerContentClass: "-mx-16"
|
|
421
|
+
},
|
|
422
|
+
cell: (t) => X({
|
|
423
|
+
role: t.row.original,
|
|
424
|
+
className: "flex w-full items-center justify-end"
|
|
425
|
+
})
|
|
426
|
+
}], M = async (t) => {
|
|
427
|
+
var r;
|
|
428
|
+
g.value = t._id, await fe(), (r = z.value) == null || r.trigger();
|
|
429
|
+
}, F = Fe(), R = Ae(), re = _(() => {
|
|
430
|
+
const t = F.roles.value || [];
|
|
431
|
+
return (J.value.length === 0 ? t : t.filter((c) => c.restaurants.some((i) => J.value.includes(i.id)))).map((c) => {
|
|
432
|
+
const i = c.restaurants.map((h) => {
|
|
433
|
+
const x = R.value[h.id];
|
|
434
|
+
return {
|
|
435
|
+
...h,
|
|
436
|
+
// Prefer live data from restaurantMap so names populate reactively
|
|
437
|
+
// even when restaurants loaded after roles.
|
|
438
|
+
name: (x == null ? void 0 : x.profile.name) || h.name,
|
|
439
|
+
code: x == null ? void 0 : x.profile.code
|
|
440
|
+
};
|
|
441
|
+
});
|
|
442
|
+
return {
|
|
443
|
+
...c,
|
|
444
|
+
restaurants: i
|
|
445
|
+
};
|
|
446
|
+
});
|
|
447
|
+
}), q = _(() => {
|
|
448
|
+
var r;
|
|
449
|
+
return (r = re.value) == null ? void 0 : r.filter((c) => {
|
|
450
|
+
const i = l.value.toLowerCase(), h = c.name.toLowerCase().includes(i), f = (c.restaurants || []).some((V) => {
|
|
451
|
+
var e;
|
|
452
|
+
return V.name.toLowerCase().includes(i) || ((e = V.code) == null ? void 0 : e.toLowerCase().includes(i));
|
|
453
|
+
});
|
|
454
|
+
return h || f;
|
|
455
|
+
});
|
|
456
|
+
}), Y = Ee(), O = xe(), {
|
|
457
|
+
breakpoints: v
|
|
458
|
+
} = Ue(), E = (t) => {
|
|
459
|
+
Y.open({
|
|
460
|
+
title: s("hr.role.remove.title"),
|
|
461
|
+
message: s("hr.role.remove.message", {
|
|
462
|
+
name: t.name
|
|
463
|
+
}),
|
|
464
|
+
minWidth: v.value.lg ? 588 : 0,
|
|
465
|
+
primaryActions: {
|
|
466
|
+
text: s("common.remove"),
|
|
467
|
+
close: !1,
|
|
468
|
+
variant: "destructive"
|
|
469
|
+
},
|
|
470
|
+
secondaryActions: {
|
|
471
|
+
text: s("common.cancel"),
|
|
472
|
+
close: !0
|
|
473
|
+
}
|
|
474
|
+
}).onPrimary(async () => {
|
|
475
|
+
await F.deleteRole(t).then(() => O.open({
|
|
476
|
+
message: s("hr.role.remove.successMessage", {
|
|
477
|
+
name: t.name
|
|
478
|
+
}),
|
|
479
|
+
type: "success"
|
|
480
|
+
})).catch((r) => O.open({
|
|
481
|
+
message: r,
|
|
482
|
+
type: "error"
|
|
483
|
+
})), Y.close();
|
|
484
|
+
});
|
|
485
|
+
}, l = $(""), z = $(), g = $(void 0);
|
|
486
|
+
async function Z() {
|
|
487
|
+
var t;
|
|
488
|
+
g.value = void 0, await fe(), (t = z.value) == null || t.trigger();
|
|
489
|
+
}
|
|
490
|
+
async function ne() {
|
|
491
|
+
if (F.roles.value.length === 0)
|
|
492
|
+
try {
|
|
493
|
+
await F.readRoles();
|
|
494
|
+
} catch (t) {
|
|
495
|
+
console.error("Failed to load roles:", t), O.open({
|
|
496
|
+
message: t instanceof Error ? t.message : String(t),
|
|
497
|
+
type: "error"
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return be(() => {
|
|
502
|
+
ne();
|
|
503
|
+
}), G({
|
|
504
|
+
create: Z
|
|
505
|
+
}), (t, r) => {
|
|
506
|
+
const c = y("FmSearch"), i = y("FmTable"), h = y("FmListItem"), x = y("FmList");
|
|
507
|
+
return p(), k(N, null, [(p(), P(Xe, {
|
|
508
|
+
id: g.value,
|
|
509
|
+
key: g.value,
|
|
510
|
+
ref_key: "roleFormRef",
|
|
511
|
+
ref: z
|
|
512
|
+
}, null, 8, ["id"])), d("div", Ye, [d("div", Ze, [n(c, {
|
|
513
|
+
modelValue: l.value,
|
|
514
|
+
"onUpdate:modelValue": r[0] || (r[0] = (f) => l.value = f),
|
|
515
|
+
class: "w-[320px] xs:w-full",
|
|
516
|
+
autofocus: "",
|
|
517
|
+
placeholder: o(s)("hr.role.search.placeholder") + " / " + o(s)("hr.restaurant.search.placeholder")
|
|
518
|
+
}, null, 8, ["modelValue", "placeholder"])]), o(F).roles.value.length > 0 || o(F).isLoading.value ? (p(), P(Pe, {
|
|
519
|
+
key: 0,
|
|
520
|
+
class: "overflow-auto"
|
|
521
|
+
}, {
|
|
522
|
+
default: b(() => [n(i, {
|
|
523
|
+
class: "xs:hidden",
|
|
524
|
+
"column-defs": oe,
|
|
525
|
+
"row-data": q.value,
|
|
526
|
+
"page-size": q.value.length,
|
|
527
|
+
loading: o(F).isLoading.value,
|
|
528
|
+
"pin-header-row": "",
|
|
529
|
+
"hide-footer": "",
|
|
530
|
+
"shrink-at": !1,
|
|
531
|
+
onRowClick: r[1] || (r[1] = (f) => M(f.original))
|
|
532
|
+
}, null, 8, ["row-data", "page-size", "loading"]), d("div", es, [n(x, {
|
|
533
|
+
separator: ""
|
|
534
|
+
}, {
|
|
535
|
+
default: b(() => [(p(!0), k(N, null, le(q.value, (f) => (p(), P(h, {
|
|
536
|
+
key: f._id,
|
|
537
|
+
class: "py-12 px-16 items-center justify-between",
|
|
538
|
+
onClick: (V) => M(f)
|
|
539
|
+
}, {
|
|
540
|
+
default: b(() => [d("div", ss, [d("p", as, A(f.name), 1), d("div", ts, [d("p", null, A(o(s)("hr.role.labels.restaurantList", {
|
|
541
|
+
items: f.restaurants.map((V) => V.name).join(", ")
|
|
542
|
+
})), 1), d("p", ls, [pe(A(o(s)("hr.role.labels.operationList", {
|
|
543
|
+
items: o(ae)(f.permissions, o(L.F_RULE_SUBJECT).enum.order)
|
|
544
|
+
})) + " ", 1), (p(), P(ve(D(f.permissions, o(L.F_RULE_SUBJECT).enum.order))))]), d("p", os, [pe(A(o(s)("hr.role.labels.reportList", {
|
|
545
|
+
items: o(ae)(f.permissions, o(L.F_RULE_SUBJECT).enum.report, o(C))
|
|
546
|
+
})) + " ", 1), (p(), P(ve(D(f.permissions, o(L.F_RULE_SUBJECT).enum.report))))])])]), d("div", {
|
|
547
|
+
onClick: r[2] || (r[2] = Ie(() => {
|
|
548
|
+
}, ["stop"]))
|
|
549
|
+
}, [n(he, {
|
|
550
|
+
items: Q(f)
|
|
551
|
+
}, null, 8, ["items"])])]),
|
|
552
|
+
_: 2
|
|
553
|
+
}, 1032, ["onClick"]))), 128))]),
|
|
554
|
+
_: 1
|
|
555
|
+
})])]),
|
|
556
|
+
_: 1
|
|
557
|
+
})) : (p(), P(o(Te), {
|
|
558
|
+
key: 1,
|
|
559
|
+
title: o(s)("hr.role.noData.title"),
|
|
560
|
+
subtitle: o(s)("hr.role.noData.subtitle")
|
|
561
|
+
}, null, 8, ["title", "subtitle"]))])], 64);
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
export {
|
|
566
|
+
xs as default
|
|
567
|
+
};
|