@feedmepos/mf-hrm-portal 0.0.1-alpha.1 → 0.0.1
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/package.json +1 -1
- package/dist/App.vue.d.ts +0 -2
- package/dist/EmployeeList-BU6n0y6w.js +0 -604
- package/dist/Entry.vue.d.ts +0 -2
- package/dist/PageLayout.vue_vue_type_script_setup_true_lang-HKK4cbW8.js +0 -37
- package/dist/RoleList-kE8O8wyy.js +0 -492
- package/dist/TeamMemberList-BBl8auxB.js +0 -1447
- package/dist/TimesheetList-QmuwWz31.js +0 -395
- package/dist/api/employee/index.d.ts +0 -15
- package/dist/api/index.d.ts +0 -3
- package/dist/api/inventory/index.d.ts +0 -5
- package/dist/api/role/index.d.ts +0 -9
- package/dist/api/team/index.d.ts +0 -10
- package/dist/api/timesheet/index.d.ts +0 -6
- package/dist/api/user/index.d.ts +0 -6
- package/dist/app-DWSjl6MP.js +0 -1170
- package/dist/app-DXlbstZu.js +0 -2282
- package/dist/app.d.ts +0 -3
- package/dist/app.js +0 -6
- package/dist/components/AppForm.vue.d.ts +0 -45
- package/dist/components/CheckboxInput.vue.d.ts +0 -155
- package/dist/components/Navigator.vue.d.ts +0 -6
- package/dist/components/Splash.vue.d.ts +0 -2
- package/dist/composables/message.d.ts +0 -4
- package/dist/composables/restaurant.d.ts +0 -329
- package/dist/employee-C-ICOGva.js +0 -449
- package/dist/favicon.ico +0 -0
- package/dist/helpers/component.d.ts +0 -12
- package/dist/helpers/iteration.d.ts +0 -10
- package/dist/helpers/rule.d.ts +0 -28
- package/dist/helpers/utils.d.ts +0 -3
- package/dist/index-COaCoGwy.js +0 -57
- package/dist/loading-31nfQqf0.js +0 -140
- package/dist/lodash-P5mhhlxp.js +0 -3676
- package/dist/main-DlJuqlgg.js +0 -15636
- package/dist/main.d.ts +0 -1
- package/dist/restaurant-D5BNPLKh.js +0 -107
- package/dist/router/index.d.ts +0 -2
- package/dist/router/shared.d.ts +0 -10
- package/dist/rule-DjIknogy.js +0 -8229
- package/dist/search-Dh3HG-_h.js +0 -258
- package/dist/shared/api/index.d.ts +0 -3
- package/dist/shared/api/public.d.ts +0 -5
- package/dist/shared/components/button/ResponsiveFabButton.vue.d.ts +0 -3
- package/dist/shared/components/form/SelectFilter.vue.d.ts +0 -86
- package/dist/shared/components/layout/FormColumn.vue.d.ts +0 -12
- package/dist/shared/components/layout/FormItem.vue.d.ts +0 -17
- package/dist/shared/components/layout/FormSection.vue.d.ts +0 -18
- package/dist/shared/components/layout/FullWrapper.vue.d.ts +0 -9
- package/dist/shared/components/layout/HorizontalSplitter.vue.d.ts +0 -2
- package/dist/shared/components/layout/LottieAnimation.vue.d.ts +0 -39
- package/dist/shared/components/layout/PageLayout.vue.d.ts +0 -20
- package/dist/shared/components/loading/AppLoading.vue.d.ts +0 -20
- package/dist/shared/components/loading/PageLoading.vue.d.ts +0 -2
- package/dist/shared/components/loading/index.d.ts +0 -1
- package/dist/shared/components/menu/BottomSheetMenu.vue.d.ts +0 -13
- package/dist/shared/components/menu/BottomSheetMenuItem.vue.d.ts +0 -15
- package/dist/shared/components/menu/ResponsiveContextMenu.vue.d.ts +0 -13
- package/dist/shared/components/table/EmptyDataTemplate/Icon.vue.d.ts +0 -2
- package/dist/shared/components/table/EmptyDataTemplate/index.d.ts +0 -1
- package/dist/shared/components/table/EmptyDataTemplate/index.vue.d.ts +0 -18
- package/dist/shared/composable/dateRange.d.ts +0 -18
- package/dist/shared/composable/discardConfirm.d.ts +0 -1
- package/dist/shared/composable/elementPosition.d.ts +0 -17
- package/dist/shared/composable/filterSelector.d.ts +0 -12
- package/dist/shared/composable/loading.d.ts +0 -29
- package/dist/shared/composable/search.d.ts +0 -5
- package/dist/shared/composable/sheet.d.ts +0 -17
- package/dist/shared/helpers/createComponent.d.ts +0 -7
- package/dist/shared/helpers/iteration.d.ts +0 -11
- package/dist/shared/helpers/object.d.ts +0 -6
- package/dist/shared/helpers/string.d.ts +0 -12
- package/dist/shared/permission/posPermission.d.ts +0 -6
- package/dist/shared/stores/app.d.ts +0 -217
- package/dist/stores/employee.d.ts +0 -590
- package/dist/stores/role.d.ts +0 -214
- package/dist/stores/timesheet.d.ts +0 -253
- package/dist/style.css +0 -1
- package/dist/timesheet-Jwqi_LdM.js +0 -56
- package/dist/tsconfig.app.tsbuildinfo +0 -1
- package/dist/types/employee.d.ts +0 -30
- package/dist/types/permission.d.ts +0 -2
- package/dist/types/restaurant.d.ts +0 -18
- package/dist/types/role.d.ts +0 -37
- package/dist/types/team.d.ts +0 -49
- package/dist/types/timesheet.d.ts +0 -16
- package/dist/views/hr/locales/index.d.ts +0 -602
- package/dist/views/hr/views/employee/Employee.vue.d.ts +0 -2
- package/dist/views/hr/views/employee/EmployeeList.vue.d.ts +0 -38
- package/dist/views/hr/views/employee/components/EmployeeForm.vue.d.ts +0 -27
- package/dist/views/hr/views/main.vue.d.ts +0 -2
- package/dist/views/hr/views/role/RoleForm.vue.d.ts +0 -17
- package/dist/views/hr/views/role/RoleList.vue.d.ts +0 -5
- package/dist/views/hr/views/timesheet/TimesheetList.vue.d.ts +0 -2
- package/dist/views/team/locales/index.d.ts +0 -348
- package/dist/views/team/views/team/TeamMemberList.vue.d.ts +0 -2
- package/dist/views/team/views/team/components/AddMemberForm.vue.d.ts +0 -37
- package/dist/views/team/views/team/components/MemberInfo.vue.d.ts +0 -6
- package/dist/views/team/views/team/components/PortalPermissionEditor.vue.d.ts +0 -46
- package/dist/views/team/views/team/components/PortalUserSearcher.vue.d.ts +0 -40
- package/dist/views/team/views/team/components/TeamMemberBasePermission.vue.d.ts +0 -36
- package/dist/views/team/views/team/components/TeamMemberConditionPermission.vue.d.ts +0 -50
- package/dist/views/team/views/team/components/TeamMemberMasterUser.vue.d.ts +0 -710
- package/dist/views/team/views/team/components/TeamMemberRolePermission.vue.d.ts +0 -46
|
@@ -1,492 +0,0 @@
|
|
|
1
|
-
import { defineComponent as ce, ref as T, computed as _, onMounted as pe, watch as xe, resolveComponent as y, createBlock as C, openBlock as p, unref as t, withCtx as b, createElementVNode as f, createVNode as c, createCommentVNode as re, createElementBlock as L, Fragment as j, renderList as G, toDisplayString as D, h as F, createTextVNode as ne, resolveDynamicComponent as ie, withModifiers as Fe, nextTick as ue } from "vue";
|
|
2
|
-
import { u as ve, f as Ce, e as E, r as K, h as le, j as Re, k as de, l as J } from "./rule-DjIknogy.js";
|
|
3
|
-
import { useI18n as fe, useCoreStore as _e } from "@feedmepos/mf-common";
|
|
4
|
-
import { useSnackbar as he, components as W, useDialog as Ve, useBreakpoints as we, FmButtonColorThemeVariant as me, FmButtonVariant as ke } from "@feedmepos/ui-library";
|
|
5
|
-
import { _ as Ie } from "./app-DWSjl6MP.js";
|
|
6
|
-
import { u as Le, _ as Ue } from "./loading-31nfQqf0.js";
|
|
7
|
-
import { u as Se, _ as se, a as $e, b as Ee } from "./restaurant-D5BNPLKh.js";
|
|
8
|
-
import { l as z } from "./lodash-P5mhhlxp.js";
|
|
9
|
-
const Te = { class: "fm-typo-en-title-md-600" }, Pe = { class: "space-y-40" }, Be = { class: "space-y-8" }, De = { class: "space-y-8" }, Me = {
|
|
10
|
-
key: 0,
|
|
11
|
-
class: "w-50 ml-5 flex flex-row items-start"
|
|
12
|
-
}, Ae = { class: "m-2" }, Ne = { class: "flex gap-8 items-center justify-start" }, Oe = /* @__PURE__ */ ce({
|
|
13
|
-
__name: "RoleForm",
|
|
14
|
-
props: {
|
|
15
|
-
id: {
|
|
16
|
-
type: String,
|
|
17
|
-
default: void 0
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
setup(te, { expose: H }) {
|
|
21
|
-
const { t: s } = fe(), Q = _e(), U = T(""), R = _(() => Q.restaurants.value.filter(({ profile: e }) => {
|
|
22
|
-
const a = `${e.code ? e.code + "-" : ""}${e.legalName}`;
|
|
23
|
-
return !U.value || a.toLowerCase().includes(U.value.toLowerCase());
|
|
24
|
-
})), S = ve(), q = he(), X = Le(q), P = te, d = T(!1), Y = () => {
|
|
25
|
-
d.value = !d.value, d.value && $();
|
|
26
|
-
}, Z = _(() => P.id ? s("hr.role.form.update") : s("hr.role.form.add")), M = _(() => P.id ? s("common.update") : s("common.add")), A = _(() => Ce.filter((e) => !(e.subject === E.F_RULE_SUBJECT.enum.report && !e.conditions)).map((e) => K(e))), m = _(() => S.roles.value.find((e) => e._id == P.id)), V = () => ({
|
|
27
|
-
name: "",
|
|
28
|
-
restaurantIds: [],
|
|
29
|
-
permissions: [],
|
|
30
|
-
maxDiscountPercentage: 100
|
|
31
|
-
}), l = T(V()), N = _(() => [
|
|
32
|
-
{
|
|
33
|
-
title: s("hr.role.labels.operation"),
|
|
34
|
-
filter: (e) => e.isOrderOperation
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
title: s("hr.role.labels.report"),
|
|
38
|
-
filter: (e) => e.isReportPermission
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
title: s("hr.role.labels.other"),
|
|
42
|
-
filter: (e) => !e.isOrderOperation && !e.isReportPermission
|
|
43
|
-
}
|
|
44
|
-
].map((e) => ({
|
|
45
|
-
title: e.title,
|
|
46
|
-
options: A.value.filter(e.filter).map(({ label: a, value: v }) => ({
|
|
47
|
-
label: a,
|
|
48
|
-
value: v
|
|
49
|
-
}))
|
|
50
|
-
}))), h = _(() => {
|
|
51
|
-
var e;
|
|
52
|
-
return le(((e = m.value) == null ? void 0 : e.permissions) || []);
|
|
53
|
-
});
|
|
54
|
-
function $() {
|
|
55
|
-
var e;
|
|
56
|
-
l.value = V(), l.value.name = ((e = m.value) == null ? void 0 : e.name) ?? "", h.value ? (l.value.restaurantIds = R.value.map((a) => a._id), l.value.permissions = A.value.map((a) => a.value)) : m.value && (l.value.restaurantIds = m.value.restaurants.map((a) => a.id), l.value.permissions = m.value.permissions.map(
|
|
57
|
-
(a) => K(a).value
|
|
58
|
-
), l.value.maxDiscountPercentage = de(
|
|
59
|
-
m.value.permissions
|
|
60
|
-
));
|
|
61
|
-
}
|
|
62
|
-
pe(() => {
|
|
63
|
-
$();
|
|
64
|
-
});
|
|
65
|
-
const ee = T(""), ae = _(() => ({
|
|
66
|
-
restaurantIds: l.value.restaurantIds,
|
|
67
|
-
role: {
|
|
68
|
-
name: l.value.name,
|
|
69
|
-
permissions: Re(l.value.permissions, l.value.maxDiscountPercentage)
|
|
70
|
-
}
|
|
71
|
-
})), o = () => {
|
|
72
|
-
const e = ae.value;
|
|
73
|
-
X.minor(
|
|
74
|
-
async () => {
|
|
75
|
-
m.value ? await S.updateRole(m.value._id, e) : await S.createRole(e);
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
successMessage: m.value ? s("hr.role.add.successMessage", { name: e.role.name }) : s("hr.role.update.successMessage", { name: e.role.name })
|
|
79
|
-
}
|
|
80
|
-
), d.value = !1;
|
|
81
|
-
}, r = _(
|
|
82
|
-
() => l.value.restaurantIds.filter((e) => R.value.some((a) => a._id === e))
|
|
83
|
-
), i = _(() => R.value.length > 0 && R.value.length === r.value.length), u = () => {
|
|
84
|
-
const e = l.value.restaurantIds.filter((a) => !r.value.includes(a));
|
|
85
|
-
i.value === !0 ? l.value.restaurantIds = e : l.value.restaurantIds = R.value.map((a) => a._id);
|
|
86
|
-
}, g = (e) => e.map((v) => v.value).every((v) => l.value.permissions.includes(v)), w = (e) => {
|
|
87
|
-
const a = l.value.permissions.filter(
|
|
88
|
-
(v) => !e.map((B) => B.value).includes(v)
|
|
89
|
-
);
|
|
90
|
-
g(e) === !0 ? l.value.permissions = a : l.value.permissions = [...a, ...e.map((v) => v.value)];
|
|
91
|
-
};
|
|
92
|
-
xe(
|
|
93
|
-
() => l.value.restaurantIds,
|
|
94
|
-
(e) => {
|
|
95
|
-
e.length > 0 && (ee.value = "");
|
|
96
|
-
}
|
|
97
|
-
);
|
|
98
|
-
const O = Se(
|
|
99
|
-
() => {
|
|
100
|
-
var e, a, v, B;
|
|
101
|
-
return !z.isEqual(l.value.name, ((e = m.value) == null ? void 0 : e.name) || V().name) || !z.isEqual(
|
|
102
|
-
l.value.restaurantIds,
|
|
103
|
-
((a = m.value) == null ? void 0 : a.restaurants.map((k) => k.id)) || V().restaurantIds
|
|
104
|
-
) || !z.isEqual(
|
|
105
|
-
l.value.permissions,
|
|
106
|
-
((v = m.value) == null ? void 0 : v.permissions.map((k) => K(k).value)) || V().permissions
|
|
107
|
-
) || !z.isEqual(
|
|
108
|
-
l.value.maxDiscountPercentage,
|
|
109
|
-
m.value ? de((B = m.value) == null ? void 0 : B.permissions) : V().maxDiscountPercentage
|
|
110
|
-
);
|
|
111
|
-
},
|
|
112
|
-
() => {
|
|
113
|
-
d.value = !1;
|
|
114
|
-
}
|
|
115
|
-
);
|
|
116
|
-
return H({
|
|
117
|
-
show: d,
|
|
118
|
-
trigger: Y
|
|
119
|
-
}), (e, a) => {
|
|
120
|
-
const v = y("FmTextField"), B = y("FmSearch"), k = y("FmCheckbox"), ge = y("FmFormGroup"), be = y("FmCard"), oe = y("fm-button"), ye = y("fm-side-sheet");
|
|
121
|
-
return p(), C(ye, {
|
|
122
|
-
id: "unit-form",
|
|
123
|
-
modelValue: d.value,
|
|
124
|
-
"onUpdate:modelValue": a[7] || (a[7] = (n) => d.value = n),
|
|
125
|
-
"is-container": t(W).FmForm,
|
|
126
|
-
"is-container-props": {
|
|
127
|
-
onValidationSuccess: o,
|
|
128
|
-
blameFormChildOnValidationFailed: !0
|
|
129
|
-
},
|
|
130
|
-
"max-width": 560,
|
|
131
|
-
"onOn:clickedAway": t(O)
|
|
132
|
-
}, {
|
|
133
|
-
"side-sheet-header": b(() => [
|
|
134
|
-
f("p", Te, D(Z.value), 1)
|
|
135
|
-
]),
|
|
136
|
-
"side-sheet-footer": b(() => [
|
|
137
|
-
f("div", Ne, [
|
|
138
|
-
c(oe, {
|
|
139
|
-
label: M.value,
|
|
140
|
-
size: "lg",
|
|
141
|
-
type: "submit",
|
|
142
|
-
variant: "primary",
|
|
143
|
-
disabled: h.value
|
|
144
|
-
}, null, 8, ["label", "disabled"]),
|
|
145
|
-
c(oe, {
|
|
146
|
-
label: t(s)("common.cancel"),
|
|
147
|
-
size: "lg",
|
|
148
|
-
variant: "tertiary",
|
|
149
|
-
onClick: a[6] || (a[6] = () => d.value = !1)
|
|
150
|
-
}, null, 8, ["label"])
|
|
151
|
-
])
|
|
152
|
-
]),
|
|
153
|
-
default: b(() => [
|
|
154
|
-
f("div", Pe, [
|
|
155
|
-
c(se, { title: "Role detail" }, {
|
|
156
|
-
default: b(() => [
|
|
157
|
-
c(v, {
|
|
158
|
-
autofocus: "",
|
|
159
|
-
modelValue: l.value.name,
|
|
160
|
-
"onUpdate:modelValue": a[0] || (a[0] = (n) => l.value.name = n),
|
|
161
|
-
rules: [(n) => !!n || t(s)("hr.role.form.required")],
|
|
162
|
-
label: t(s)("hr.role.form.name"),
|
|
163
|
-
disabled: h.value
|
|
164
|
-
}, null, 8, ["modelValue", "rules", "label", "disabled"])
|
|
165
|
-
]),
|
|
166
|
-
_: 1
|
|
167
|
-
}),
|
|
168
|
-
c(se, {
|
|
169
|
-
title: t(s)("hr.role.form.restaurant")
|
|
170
|
-
}, {
|
|
171
|
-
default: b(() => [
|
|
172
|
-
c(B, {
|
|
173
|
-
modelValue: U.value,
|
|
174
|
-
"onUpdate:modelValue": a[1] || (a[1] = (n) => U.value = n),
|
|
175
|
-
placeholder: t(s)("hr.restaurant.search.placeholder")
|
|
176
|
-
}, null, 8, ["modelValue", "placeholder"]),
|
|
177
|
-
c(ge, {
|
|
178
|
-
modelValue: l.value.restaurantIds,
|
|
179
|
-
"onUpdate:modelValue": a[3] || (a[3] = (n) => l.value.restaurantIds = n),
|
|
180
|
-
rules: [(n) => n.length > 0 || t(s)("hr.role.form.atLeastOneRestaurant")]
|
|
181
|
-
}, {
|
|
182
|
-
default: b(() => [
|
|
183
|
-
f("div", Be, [
|
|
184
|
-
U.value ? re("", !0) : (p(), C(k, {
|
|
185
|
-
key: 0,
|
|
186
|
-
"model-value": i.value,
|
|
187
|
-
label: "All",
|
|
188
|
-
value: "1",
|
|
189
|
-
disabled: h.value,
|
|
190
|
-
"onUpdate:modelValue": u
|
|
191
|
-
}, null, 8, ["model-value", "disabled"])),
|
|
192
|
-
(p(!0), L(j, null, G(R.value, (n) => (p(), L("div", {
|
|
193
|
-
key: n._id
|
|
194
|
-
}, [
|
|
195
|
-
c(k, {
|
|
196
|
-
modelValue: l.value.restaurantIds,
|
|
197
|
-
"onUpdate:modelValue": a[2] || (a[2] = (I) => l.value.restaurantIds = I),
|
|
198
|
-
label: `${n.profile.code ? n.profile.code + "-" : ""}${n.profile.name}`,
|
|
199
|
-
value: n._id,
|
|
200
|
-
disabled: h.value
|
|
201
|
-
}, null, 8, ["modelValue", "label", "value", "disabled"])
|
|
202
|
-
]))), 128))
|
|
203
|
-
])
|
|
204
|
-
]),
|
|
205
|
-
_: 1
|
|
206
|
-
}, 8, ["modelValue", "rules"])
|
|
207
|
-
]),
|
|
208
|
-
_: 1
|
|
209
|
-
}, 8, ["title"]),
|
|
210
|
-
c(se, {
|
|
211
|
-
title: t(s)("hr.role.form.permissions")
|
|
212
|
-
}, {
|
|
213
|
-
default: b(() => [
|
|
214
|
-
(p(!0), L(j, null, G(N.value, (n) => (p(), C(be, {
|
|
215
|
-
key: n.title,
|
|
216
|
-
variant: "outlined",
|
|
217
|
-
class: "p-16"
|
|
218
|
-
}, {
|
|
219
|
-
default: b(() => [
|
|
220
|
-
c($e, {
|
|
221
|
-
label: n.title
|
|
222
|
-
}, {
|
|
223
|
-
default: b(() => [
|
|
224
|
-
f("div", De, [
|
|
225
|
-
c(k, {
|
|
226
|
-
"model-value": g(n.options),
|
|
227
|
-
label: "All",
|
|
228
|
-
value: "1",
|
|
229
|
-
disabled: h.value,
|
|
230
|
-
"onUpdate:modelValue": (I) => w(n.options)
|
|
231
|
-
}, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]),
|
|
232
|
-
(p(!0), L(j, null, G(n.options, (I) => (p(), L("div", {
|
|
233
|
-
key: I.value
|
|
234
|
-
}, [
|
|
235
|
-
c(k, {
|
|
236
|
-
modelValue: l.value.permissions,
|
|
237
|
-
"onUpdate:modelValue": a[4] || (a[4] = (x) => l.value.permissions = x),
|
|
238
|
-
label: I.label,
|
|
239
|
-
value: I.value,
|
|
240
|
-
disabled: h.value
|
|
241
|
-
}, null, 8, ["modelValue", "label", "value", "disabled"]),
|
|
242
|
-
I.value === "order:discount" && l.value.permissions.includes(I.value) ? (p(), L("div", Me, [
|
|
243
|
-
f("div", Ae, D(t(s)("hr.role.form.maxDiscountPercentage")), 1),
|
|
244
|
-
c(v, {
|
|
245
|
-
modelValue: l.value.maxDiscountPercentage,
|
|
246
|
-
"onUpdate:modelValue": a[5] || (a[5] = (x) => l.value.maxDiscountPercentage = x),
|
|
247
|
-
rules: [
|
|
248
|
-
(x) => !!x || t(s)("hr.role.form.required"),
|
|
249
|
-
(x) => !isNaN(x) || t(s)("hr.role.form.onlyContainsNumber"),
|
|
250
|
-
(x) => x <= 100 || t(s)("hr.role.form.maxValueIs", { max: 100 }),
|
|
251
|
-
(x) => x >= 0 || t(s)("hr.role.form.minValueIs", { min: 0 })
|
|
252
|
-
],
|
|
253
|
-
"append-text": "%",
|
|
254
|
-
disabled: h.value
|
|
255
|
-
}, null, 8, ["modelValue", "rules", "disabled"])
|
|
256
|
-
])) : re("", !0)
|
|
257
|
-
]))), 128))
|
|
258
|
-
])
|
|
259
|
-
]),
|
|
260
|
-
_: 2
|
|
261
|
-
}, 1032, ["label"])
|
|
262
|
-
]),
|
|
263
|
-
_: 2
|
|
264
|
-
}, 1024))), 128))
|
|
265
|
-
]),
|
|
266
|
-
_: 1
|
|
267
|
-
}, 8, ["title"])
|
|
268
|
-
])
|
|
269
|
-
]),
|
|
270
|
-
_: 1
|
|
271
|
-
}, 8, ["modelValue", "is-container", "is-container-props", "onOn:clickedAway"]);
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
}), je = {
|
|
275
|
-
class: "space-y-8"
|
|
276
|
-
}, qe = {
|
|
277
|
-
class: "flex justify-end xs:px-16"
|
|
278
|
-
}, Je = {
|
|
279
|
-
class: "pb-64 hidden xs:block"
|
|
280
|
-
}, ze = {
|
|
281
|
-
class: "space-y-4"
|
|
282
|
-
}, Ge = {
|
|
283
|
-
class: "fm-typo-en-body-lg-600"
|
|
284
|
-
}, Ke = {
|
|
285
|
-
class: "text-fm-color-typo-secondary"
|
|
286
|
-
}, We = {
|
|
287
|
-
class: "flex"
|
|
288
|
-
}, He = {
|
|
289
|
-
class: "flex"
|
|
290
|
-
}, ta = /* @__PURE__ */ ce({
|
|
291
|
-
__name: "RoleList",
|
|
292
|
-
setup(te, {
|
|
293
|
-
expose: H
|
|
294
|
-
}) {
|
|
295
|
-
const {
|
|
296
|
-
t: s
|
|
297
|
-
} = fe(), Q = _e(), U = _(() => Q.restaurants.value), R = _(() => U.value.map((o) => o._id));
|
|
298
|
-
function S(o, r) {
|
|
299
|
-
const i = J(o, r);
|
|
300
|
-
return ["-", "All"].includes(i) ? () => null : () => F(W.FmTooltip, {
|
|
301
|
-
"z-index": "999",
|
|
302
|
-
placement: "top",
|
|
303
|
-
class: "ml-2"
|
|
304
|
-
}, {
|
|
305
|
-
content: () => F("div", {
|
|
306
|
-
innerHTML: `
|
|
307
|
-
${s("hr.role.tooltip.labels.permission")}
|
|
308
|
-
${o.filter((u) => u.subject === r).map((u) => `<div>- ${K(u).label}</div>`).join("")}
|
|
309
|
-
`
|
|
310
|
-
}),
|
|
311
|
-
default: () => F(W.FmIcon, {
|
|
312
|
-
name: "info",
|
|
313
|
-
color: me.NeutralGray400
|
|
314
|
-
})
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
function q(o, r) {
|
|
318
|
-
const i = J(o, r);
|
|
319
|
-
return () => i === "All" ? i : F("div", {
|
|
320
|
-
class: "flex items-center"
|
|
321
|
-
}, [i, S(o, r)()]);
|
|
322
|
-
}
|
|
323
|
-
const X = [{
|
|
324
|
-
accessorKey: "name",
|
|
325
|
-
header: () => s("hr.role.columns.name"),
|
|
326
|
-
enableSorting: !1
|
|
327
|
-
}, {
|
|
328
|
-
accessorKey: "operation",
|
|
329
|
-
header: () => s("hr.role.columns.operation"),
|
|
330
|
-
cell: (o) => F(q(o.row.original.permissions, E.F_RULE_SUBJECT.enum.order)),
|
|
331
|
-
enableSorting: !1
|
|
332
|
-
}, {
|
|
333
|
-
accessorKey: "report",
|
|
334
|
-
header: () => s("hr.role.columns.report"),
|
|
335
|
-
cell: (o) => F(q(o.row.original.permissions, E.F_RULE_SUBJECT.enum.report)),
|
|
336
|
-
enableSorting: !1
|
|
337
|
-
}, {
|
|
338
|
-
accessorKey: "restaurants",
|
|
339
|
-
header: () => s("hr.role.columns.restaurants"),
|
|
340
|
-
cell: (o) => o.row.original.restaurants.map((r, i) => {
|
|
341
|
-
const u = r.code, g = `${u ? u + " - " : ""}${r.name}`;
|
|
342
|
-
return F("div", (i ? `
|
|
343
|
-
` : "") + g);
|
|
344
|
-
}),
|
|
345
|
-
enableSorting: !1
|
|
346
|
-
}, {
|
|
347
|
-
id: "action",
|
|
348
|
-
size: 52,
|
|
349
|
-
meta: {
|
|
350
|
-
cellClass: "pl-16",
|
|
351
|
-
headerContentClass: "-mx-16"
|
|
352
|
-
},
|
|
353
|
-
cell: (o) => F("div", {
|
|
354
|
-
class: "w-full flex justify-end items-center"
|
|
355
|
-
}, [F(W.FmButton, {
|
|
356
|
-
prependIcon: "delete",
|
|
357
|
-
variant: ke.Tertiary,
|
|
358
|
-
textColor: me.NeutralGray400,
|
|
359
|
-
disabled: le(o.row.original.permissions),
|
|
360
|
-
onClick: (r) => {
|
|
361
|
-
r.stopPropagation(), l(o.row.original);
|
|
362
|
-
}
|
|
363
|
-
})])
|
|
364
|
-
}], P = async (o) => {
|
|
365
|
-
var r;
|
|
366
|
-
$.value = o._id, await ue(), (r = h.value) == null || r.trigger();
|
|
367
|
-
}, d = ve(), Y = Ee(), Z = _(() => (d.roles.value || []).filter((i) => i.restaurants.some((u) => R.value.includes(u.id))).map((i) => {
|
|
368
|
-
const u = i.restaurants.map((g) => {
|
|
369
|
-
const w = Y.value[g.id];
|
|
370
|
-
return {
|
|
371
|
-
...g,
|
|
372
|
-
code: w == null ? void 0 : w.profile.code
|
|
373
|
-
};
|
|
374
|
-
});
|
|
375
|
-
return {
|
|
376
|
-
...i,
|
|
377
|
-
restaurants: u
|
|
378
|
-
};
|
|
379
|
-
})), M = _(() => {
|
|
380
|
-
var r;
|
|
381
|
-
return (r = Z.value) == null ? void 0 : r.filter((i) => {
|
|
382
|
-
const u = N.value.toLowerCase(), g = i.name.toLowerCase().includes(u), O = (i.restaurants || []).some((e) => {
|
|
383
|
-
var a;
|
|
384
|
-
return e.name.toLowerCase().includes(u) || ((a = e.code) == null ? void 0 : a.toLowerCase().includes(u));
|
|
385
|
-
});
|
|
386
|
-
return g || O;
|
|
387
|
-
});
|
|
388
|
-
}), A = Ve(), m = he(), {
|
|
389
|
-
breakpoints: V
|
|
390
|
-
} = we(), l = (o) => {
|
|
391
|
-
A.open({
|
|
392
|
-
title: s("hr.role.remove.title"),
|
|
393
|
-
message: s("hr.role.remove.message", {
|
|
394
|
-
name: o.name
|
|
395
|
-
}),
|
|
396
|
-
minWidth: V.value.lg ? 588 : 0,
|
|
397
|
-
primaryActions: {
|
|
398
|
-
text: s("common.remove"),
|
|
399
|
-
close: !1,
|
|
400
|
-
variant: "destructive"
|
|
401
|
-
},
|
|
402
|
-
secondaryActions: {
|
|
403
|
-
text: s("common.cancel"),
|
|
404
|
-
close: !0
|
|
405
|
-
}
|
|
406
|
-
}).onPrimary(async () => {
|
|
407
|
-
await d.deleteRole(o).then(() => m.open({
|
|
408
|
-
message: s("hr.role.remove.successMessage", {
|
|
409
|
-
name: o.name
|
|
410
|
-
}),
|
|
411
|
-
type: "success"
|
|
412
|
-
})).catch((r) => m.open({
|
|
413
|
-
message: r,
|
|
414
|
-
type: "error"
|
|
415
|
-
})), A.close();
|
|
416
|
-
});
|
|
417
|
-
}, N = T(""), h = T(), $ = T(void 0);
|
|
418
|
-
async function ee() {
|
|
419
|
-
var o;
|
|
420
|
-
$.value = void 0, await ue(), (o = h.value) == null || o.trigger();
|
|
421
|
-
}
|
|
422
|
-
async function ae() {
|
|
423
|
-
d.roles.value.length === 0 && await d.readRoles();
|
|
424
|
-
}
|
|
425
|
-
return pe(() => {
|
|
426
|
-
ae();
|
|
427
|
-
}), H({
|
|
428
|
-
create: ee
|
|
429
|
-
}), (o, r) => {
|
|
430
|
-
const i = y("FmSearch"), u = y("FmTable"), g = y("FmButton"), w = y("FmListItem"), O = y("FmList");
|
|
431
|
-
return p(), L(j, null, [(p(), C(Oe, {
|
|
432
|
-
key: $.value,
|
|
433
|
-
ref_key: "roleFormRef",
|
|
434
|
-
ref: h,
|
|
435
|
-
id: $.value
|
|
436
|
-
}, null, 8, ["id"])), f("div", je, [f("div", qe, [c(i, {
|
|
437
|
-
class: "w-[320px] xs:w-full",
|
|
438
|
-
autofocus: "",
|
|
439
|
-
modelValue: N.value,
|
|
440
|
-
"onUpdate:modelValue": r[0] || (r[0] = (e) => N.value = e),
|
|
441
|
-
placeholder: t(s)("hr.role.search.placeholder") + " / " + t(s)("hr.restaurant.search.placeholder")
|
|
442
|
-
}, null, 8, ["modelValue", "placeholder"])]), t(d).roles.value.length > 0 || t(d).isLoading.value ? (p(), C(Ie, {
|
|
443
|
-
key: 0,
|
|
444
|
-
class: "overflow-auto"
|
|
445
|
-
}, {
|
|
446
|
-
default: b(() => [c(u, {
|
|
447
|
-
class: "xs:hidden",
|
|
448
|
-
"column-defs": X,
|
|
449
|
-
"row-data": M.value,
|
|
450
|
-
"page-size": M.value.length,
|
|
451
|
-
loading: t(d).isLoading.value,
|
|
452
|
-
"pin-header-row": "",
|
|
453
|
-
"hide-footer": "",
|
|
454
|
-
"shrink-at": !1,
|
|
455
|
-
onRowClick: r[1] || (r[1] = (e) => P(e.original))
|
|
456
|
-
}, null, 8, ["row-data", "page-size", "loading"]), f("div", Je, [c(O, {
|
|
457
|
-
separator: ""
|
|
458
|
-
}, {
|
|
459
|
-
default: b(() => [(p(!0), L(j, null, G(M.value, (e) => (p(), C(w, {
|
|
460
|
-
key: e._id,
|
|
461
|
-
class: "py-12 px-16 items-center justify-between",
|
|
462
|
-
onClick: (a) => P(e)
|
|
463
|
-
}, {
|
|
464
|
-
default: b(() => [f("div", ze, [f("p", Ge, D(e.name), 1), f("div", Ke, [f("p", null, D(t(s)("hr.role.labels.restaurantList", {
|
|
465
|
-
items: e.restaurants.map((a) => a.name).join(", ")
|
|
466
|
-
})), 1), f("p", We, [ne(D(t(s)("hr.role.labels.operationList", {
|
|
467
|
-
items: t(J)(e.permissions, t(E.F_RULE_SUBJECT).enum.order)
|
|
468
|
-
})) + " ", 1), (p(), C(ie(S(e.permissions, t(E.F_RULE_SUBJECT).enum.order))))]), f("p", He, [ne(D(t(s)("hr.role.labels.reportList", {
|
|
469
|
-
items: t(J)(e.permissions, t(E.F_RULE_SUBJECT).enum.report)
|
|
470
|
-
})) + " ", 1), (p(), C(ie(S(e.permissions, t(E.F_RULE_SUBJECT).enum.report))))])])]), c(g, {
|
|
471
|
-
disabled: t(le)(e.permissions),
|
|
472
|
-
icon: "delete",
|
|
473
|
-
variant: "tertiary",
|
|
474
|
-
"text-color": "neutral-gray-400",
|
|
475
|
-
onClick: Fe((a) => l(e), ["stop"])
|
|
476
|
-
}, null, 8, ["disabled", "onClick"])]),
|
|
477
|
-
_: 2
|
|
478
|
-
}, 1032, ["onClick"]))), 128))]),
|
|
479
|
-
_: 1
|
|
480
|
-
})])]),
|
|
481
|
-
_: 1
|
|
482
|
-
})) : (p(), C(t(Ue), {
|
|
483
|
-
key: 1,
|
|
484
|
-
title: t(s)("hr.role.noData.title"),
|
|
485
|
-
subtitle: t(s)("hr.role.noData.subtitle")
|
|
486
|
-
}, null, 8, ["title", "subtitle"]))])], 64);
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
});
|
|
490
|
-
export {
|
|
491
|
-
ta as default
|
|
492
|
-
};
|