|
|
@@ -1,6 +1,6 @@
|
|
|
import { ItemMenu, ItemsMenu, Menu } from '~/types/interfaces'
|
|
|
import BaseMenu from '~/composables/layout/Menus/baseMenu'
|
|
|
-import {useProfileAccessStore} from "~/store/profile/access";
|
|
|
+import {useAccessProfileStore} from "~/store/profile/access";
|
|
|
import {useAbility} from "@casl/vue";
|
|
|
|
|
|
/**
|
|
|
@@ -10,92 +10,83 @@ import {useAbility} from "@casl/vue";
|
|
|
*/
|
|
|
class AccountMenu extends BaseMenu implements Menu {
|
|
|
|
|
|
- /**
|
|
|
- * @constructor
|
|
|
- * Initialisation des services issues du context
|
|
|
- */
|
|
|
- constructor () {
|
|
|
- const {$config} = useNuxtApp()
|
|
|
- super($config)
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Construit le menu Header Configuration ou null si aucune page accessible
|
|
|
* @return {ItemMenu | null}
|
|
|
*/
|
|
|
getHeaderMenu (): ItemMenu | null {
|
|
|
- const profileAccessStore = useProfileAccessStore();
|
|
|
+ const accessProfileStore = useAccessProfileStore();
|
|
|
const {can} = useAbility()
|
|
|
|
|
|
const children: ItemsMenu = []
|
|
|
|
|
|
if (can('display', 'my_schedule_page')) {
|
|
|
- children.push(this.constructMenu('my_schedule_page', undefined, '/my_calendar', true))
|
|
|
+ children.push(this.constructMenuItem('my_schedule_page', undefined, '/my_calendar', true))
|
|
|
}
|
|
|
|
|
|
if (can('display', 'attendance_bookings_page')) {
|
|
|
- children.push(this.constructMenu('attendance_bookings_menu', undefined, '/own_attendance', true))
|
|
|
+ children.push(this.constructMenuItem('attendance_bookings_menu', undefined, '/own_attendance', true))
|
|
|
}
|
|
|
|
|
|
if (can('display', 'my_attendance_page')) {
|
|
|
- children.push(this.constructMenu('my_attendance', undefined, '/my_attendances/list/', true))
|
|
|
+ children.push(this.constructMenuItem('my_attendance', undefined, '/my_attendances/list/', true))
|
|
|
}
|
|
|
|
|
|
if (can('display', 'my_invitation_page')) {
|
|
|
- children.push(this.constructMenu('my_invitation', undefined, '/my_invitations/list/', true))
|
|
|
+ children.push(this.constructMenuItem('my_invitation', undefined, '/my_invitations/list/', true))
|
|
|
}
|
|
|
|
|
|
if (can('display', 'my_students_page')) {
|
|
|
- children.push(this.constructMenu('my_students', undefined, '/my_students/list/', true))
|
|
|
+ children.push(this.constructMenuItem('my_students', undefined, '/my_students/list/', true))
|
|
|
}
|
|
|
|
|
|
if (can('display', 'my_students_education_students_page')) {
|
|
|
- children.push(this.constructMenu('my_students_education_students', undefined, '/my_students_education_students/list/', true))
|
|
|
+ children.push(this.constructMenuItem('my_students_education_students', undefined, '/my_students_education_students/list/', true))
|
|
|
}
|
|
|
|
|
|
if (can('display', 'criteria_notations_page') || can('display', 'criteria_notations_page_from_account_menu')) {
|
|
|
- children.push(this.constructMenu('criteria_notations', undefined, '/criteria_notations/list/', true))
|
|
|
+ children.push(this.constructMenuItem('criteria_notations', undefined, '/criteria_notations/list/', true))
|
|
|
}
|
|
|
|
|
|
if (can('display', 'my_education_students_page')) {
|
|
|
- children.push(this.constructMenu('my_education_students', undefined, `/main/my_profile/${profileAccessStore.id}/dashboard/my_education_students/list/`, true))
|
|
|
+ children.push(this.constructMenuItem('my_education_students', undefined, `/main/my_profile/${accessProfileStore.id}/dashboard/my_education_students/list/`, true))
|
|
|
}
|
|
|
|
|
|
if (can('display', 'send_an_email_page')) {
|
|
|
- children.push(this.constructMenu('send_an_email', undefined, `/list/create/emails`, true))
|
|
|
+ children.push(this.constructMenuItem('send_an_email', undefined, `/list/create/emails`, true))
|
|
|
}
|
|
|
|
|
|
if (can('display', 'my_documents_page')) {
|
|
|
- children.push(this.constructMenu('my_documents', undefined, `/main/my_profile/${profileAccessStore.id}/dashboard/show/my_access_file`, true))
|
|
|
+ children.push(this.constructMenuItem('my_documents', undefined, `/main/my_profile/${accessProfileStore.id}/dashboard/show/my_access_file`, true))
|
|
|
}
|
|
|
|
|
|
if (can('display', 'my_profile_page')) {
|
|
|
- children.push(this.constructMenu('my_profile', undefined, `/main/my_profile/${profileAccessStore.id}/dashboard`, true))
|
|
|
+ children.push(this.constructMenuItem('my_profile', undefined, `/main/my_profile/${accessProfileStore.id}/dashboard`, true))
|
|
|
}
|
|
|
|
|
|
if (can('display', 'adherent_list_page')) {
|
|
|
- children.push(this.constructMenu('adherent_list', undefined, `/adherent_contacts/list/`, true))
|
|
|
+ children.push(this.constructMenuItem('adherent_list', undefined, `/adherent_contacts/list/`, true))
|
|
|
}
|
|
|
|
|
|
if (can('display', 'subscription_page')) {
|
|
|
- children.push(this.constructMenu('my_subscription', undefined, `/subscription`))
|
|
|
+ children.push(this.constructMenuItem('my_subscription', undefined, `/subscription`))
|
|
|
}
|
|
|
|
|
|
if (can('display', 'my_bills_page')) {
|
|
|
- children.push(this.constructMenu('my_bills', undefined, `/main/my_profile/${profileAccessStore.id}/dashboard/show/my_bills`, true))
|
|
|
+ children.push(this.constructMenuItem('my_bills', undefined, `/main/my_profile/${accessProfileStore.id}/dashboard/show/my_bills`, true))
|
|
|
}
|
|
|
|
|
|
if (can('display', 'cmf_licence_person_page')) {
|
|
|
- children.push(this.constructMenu('print_my_licence', undefined, `/licence_cmf/user`, true))
|
|
|
+ children.push(this.constructMenuItem('print_my_licence', undefined, `/licence_cmf/user`, true))
|
|
|
}
|
|
|
|
|
|
- const accountMenu = this.constructMenu('my_account', {
|
|
|
- avatarId: profileAccessStore.avatarId,
|
|
|
- avatarByDefault: profileAccessStore.gender == 'MISTER' ? 'men-1.png' : 'women-1.png'
|
|
|
+ const accountMenu = this.constructMenuItem('my_account', {
|
|
|
+ avatarId: accessProfileStore.avatarId,
|
|
|
+ avatarByDefault: accessProfileStore.gender == 'MISTER' ? 'men-1.png' : 'women-1.png'
|
|
|
}, undefined, undefined, children, false)
|
|
|
|
|
|
const actions: ItemsMenu = [];
|
|
|
- actions.push(this.constructMenu('logout', undefined, `/logout`, true))
|
|
|
+ actions.push(this.constructMenuItem('logout', undefined, `/logout`, true))
|
|
|
|
|
|
accountMenu.actions = actions
|
|
|
|