diff --git a/frontend/e2e/dashboard.spec.ts b/frontend/e2e/dashboard.spec.ts index a19aeb1..3516165 100644 --- a/frontend/e2e/dashboard.spec.ts +++ b/frontend/e2e/dashboard.spec.ts @@ -322,6 +322,71 @@ test.describe('Dashboard', () => { await expect(page.getByRole('heading', { name: 'Configuration', exact: true })).toBeVisible(); await expect(page.getByRole('heading', { name: /activité récente/i })).toBeVisible(); }); + + test('shows section titles grouping action cards', async ({ page }) => { + await goToDashboard(page); + await switchToDemoRole(page, 'Admin'); + + await expect(page.getByRole('heading', { name: 'Personnes', exact: true })).toBeVisible(); + await expect(page.getByRole('heading', { name: 'Organisation', exact: true })).toBeVisible(); + await expect(page.getByRole('heading', { name: 'Année scolaire', exact: true })).toBeVisible(); + await expect(page.getByRole('heading', { name: 'Paramètres', exact: true })).toBeVisible(); + await expect(page.getByRole('heading', { name: 'Imports', exact: true })).toBeVisible(); + }); + + test('groups correct cards within each section', async ({ page }) => { + await goToDashboard(page); + await switchToDemoRole(page, 'Admin'); + + // Personnes: Utilisateurs, Invitations parents, Élèves + const personnes = page.locator('section[aria-labelledby="section-personnes"]'); + await expect(personnes.locator('.action-card')).toHaveCount(3); + await expect(personnes.locator('.action-card[href="/admin/users"]')).toBeVisible(); + await expect(personnes.locator('.action-card[href="/admin/parent-invitations"]')).toBeVisible(); + await expect(personnes.locator('.action-card[href="/admin/students"]')).toBeVisible(); + + // Organisation: Classes, Matières, Affectations, Remplacements, Emploi du temps + const organisation = page.locator('section[aria-labelledby="section-organisation"]'); + await expect(organisation.locator('.action-card')).toHaveCount(5); + await expect(organisation.locator('.action-card[href="/admin/classes"]')).toBeVisible(); + await expect(organisation.locator('.action-card[href="/admin/subjects"]')).toBeVisible(); + await expect(organisation.locator('.action-card[href="/admin/assignments"]')).toBeVisible(); + await expect(organisation.locator('.action-card[href="/admin/replacements"]')).toBeVisible(); + await expect(organisation.locator('.action-card[href="/admin/schedule"]')).toBeVisible(); + + // Année scolaire: Périodes scolaires, Calendrier + const anneeScolaire = page.locator('section[aria-labelledby="section-annee-scolaire"]'); + await expect(anneeScolaire.locator('.action-card')).toHaveCount(2); + await expect(anneeScolaire.locator('.action-card[href="/admin/academic-year/periods"]')).toBeVisible(); + await expect(anneeScolaire.locator('.action-card[href="/admin/calendar"]')).toBeVisible(); + + // Paramètres: Droit à l'image, Pédagogie, Identité visuelle, Règles de devoirs + const parametres = page.locator('section[aria-labelledby="section-parametres"]'); + await expect(parametres.locator('.action-card')).toHaveCount(4); + await expect(parametres.locator('.action-card[href="/admin/image-rights"]')).toBeVisible(); + await expect(parametres.locator('.action-card[href="/admin/pedagogy"]')).toBeVisible(); + await expect(parametres.locator('.action-card[href="/admin/branding"]')).toBeVisible(); + await expect(parametres.locator('.action-card[href="/admin/homework-rules"]')).toBeVisible(); + + // Imports: Importer des élèves, Importer des enseignants + const imports = page.locator('section[aria-labelledby="section-imports"]'); + await expect(imports.locator('.action-card')).toHaveCount(2); + await expect(imports.locator('.action-card[href="/admin/import/students"]')).toBeVisible(); + await expect(imports.locator('.action-card[href="/admin/import/teachers"]')).toBeVisible(); + }); + + test('sections are displayed in the expected order', async ({ page }) => { + await goToDashboard(page); + await switchToDemoRole(page, 'Admin'); + + const sectionTitles = page.locator('.dashboard-section .section-title'); + await expect(sectionTitles).toHaveCount(5); + await expect(sectionTitles.nth(0)).toHaveText('Personnes'); + await expect(sectionTitles.nth(1)).toHaveText('Organisation'); + await expect(sectionTitles.nth(2)).toHaveText('Année scolaire'); + await expect(sectionTitles.nth(3)).toHaveText('Paramètres'); + await expect(sectionTitles.nth(4)).toHaveText('Imports'); + }); }); // ============================================================================ diff --git a/frontend/src/lib/components/organisms/Dashboard/DashboardAdmin.svelte b/frontend/src/lib/components/organisms/Dashboard/DashboardAdmin.svelte index 7151506..f9e0099 100644 --- a/frontend/src/lib/components/organisms/Dashboard/DashboardAdmin.svelte +++ b/frontend/src/lib/components/organisms/Dashboard/DashboardAdmin.svelte @@ -11,6 +11,58 @@ hasRealData?: boolean; establishmentName?: string; } = $props(); + + type ActionCard = { href: string; icon: string; label: string; hint: string }; + type DashboardSectionDef = { id: string; title: string; cards: ActionCard[] }; + + const dashboardSections: DashboardSectionDef[] = [ + { + id: 'personnes', + title: 'Personnes', + cards: [ + { href: '/admin/users', icon: '👥', label: 'Gérer les utilisateurs', hint: 'Inviter et gérer' }, + { href: '/admin/parent-invitations', icon: '✉️', label: 'Invitations parents', hint: "Codes d'invitation" }, + { href: '/admin/students', icon: '🎒', label: 'Gérer les élèves', hint: 'Inscrire et affecter' } + ] + }, + { + id: 'organisation', + title: 'Organisation', + cards: [ + { href: '/admin/classes', icon: '🏫', label: 'Configurer les classes', hint: 'Créer et gérer' }, + { href: '/admin/subjects', icon: '📚', label: 'Gérer les matières', hint: 'Créer et gérer' }, + { href: '/admin/assignments', icon: '📋', label: 'Affectations', hint: 'Enseignants et classes' }, + { href: '/admin/replacements', icon: '🔄', label: 'Remplacements', hint: 'Enseignants absents' }, + { href: '/admin/schedule', icon: '🕐', label: 'Emploi du temps', hint: 'Cours et créneaux' } + ] + }, + { + id: 'annee-scolaire', + title: 'Année scolaire', + cards: [ + { href: '/admin/academic-year/periods', icon: '📅', label: 'Périodes scolaires', hint: 'Trimestres et semestres' }, + { href: '/admin/calendar', icon: '🗓️', label: 'Calendrier scolaire', hint: 'Fériés et vacances' } + ] + }, + { + id: 'parametres', + title: 'Paramètres', + cards: [ + { href: '/admin/image-rights', icon: '📷', label: "Droit à l'image", hint: 'Autorisations élèves' }, + { href: '/admin/pedagogy', icon: '🎓', label: 'Pédagogie', hint: 'Mode de notation' }, + { href: '/admin/branding', icon: '🎨', label: 'Identité visuelle', hint: 'Logo et couleurs' }, + { href: '/admin/homework-rules', icon: '📏', label: 'Règles de devoirs', hint: 'Timing et contraintes' } + ] + }, + { + id: 'imports', + title: 'Imports', + cards: [ + { href: '/admin/import/students', icon: '📤', label: 'Importer des élèves', hint: 'CSV ou XLSX' }, + { href: '/admin/import/teachers', icon: '📤', label: 'Importer des enseignants', hint: 'CSV ou XLSX' } + ] + } + ];