[permissions] Fixed permission parsing

This commit is contained in:
Ferdinand Thiessen 2021-11-13 14:52:50 +01:00
parent 3db6e0d2d1
commit 9331006db3
2 changed files with 6 additions and 14 deletions

View File

@ -108,7 +108,7 @@ export default defineComponent({
const calendarRealView = computed(() => (calendarDays.value != 7 ? 'day' : 'week')); const calendarRealView = computed(() => (calendarDays.value != 7 ? 'day' : 'week'));
const calendarDays = computed(() => const calendarDays = computed(() =>
// <= 1023 is the breakpoint for sm to md // <= 1023 is the breakpoint for sm to md
calendarView.value == 'day' ? 1 : windowWidth.value <= 1023 ? 3 : 7 calendarView.value == 'day' ? 1 : (windowWidth.value <= 1023 ? 3 : 7)
); );
const events = ref<Agendas>({}); const events = ref<Agendas>({});
const editor = ref<FG.Event | undefined>(undefined); const editor = ref<FG.Event | undefined>(undefined);

View File

@ -38,7 +38,7 @@
<EventTypes /> <EventTypes />
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="jobtypes"> <q-tab-panel name="jobtypes">
<JobTypes v-if="canEditJobTypes" /> <JobTypes />
</q-tab-panel> </q-tab-panel>
</q-tab-panels> </q-tab-panels>
</q-page> </q-page>
@ -58,18 +58,11 @@ export default defineComponent({
name: 'EventManagement', name: 'EventManagement',
components: { EditEvent, EventTypes, JobTypes }, components: { EditEvent, EventTypes, JobTypes },
setup() { setup() {
const canEditJobTypes = computed(() => hasPermission(PERMISSIONS.JOB_TYPE)); const tabs = computed(() => [
interface Tab {
name: string;
label: string;
}
const tabs: Tab[] = [
{ name: 'create', label: 'Veranstaltungen' }, { name: 'create', label: 'Veranstaltungen' },
{ name: 'eventtypes', label: 'Veranstaltungsarten' }, ...(hasPermission(PERMISSIONS.JOB_TYPE) ? [{ name: 'jobtypes', label: 'Dienstarten' }] : []),
{ name: 'jobtypes', label: 'Dienstarten' }, ...(hasPermission(PERMISSIONS.EVENT_TYPE) ? [{ name: 'eventtypes', label: 'Veranstaltungsarten' }] : [])
]; ]);
const drawer = ref<boolean>(false); const drawer = ref<boolean>(false);
@ -85,7 +78,6 @@ export default defineComponent({
const tab = ref<string>('create'); const tab = ref<string>('create');
return { return {
canEditJobTypes,
showDrawer, showDrawer,
tab, tab,
tabs, tabs,