Hide student and entry menus if current user does not have a school. Hint on profile page that they should get a school

This commit is contained in:
Matt Young 2024-06-11 21:02:26 -05:00
parent c6eb511146
commit 6e0d0cb27a
3 changed files with 11 additions and 6 deletions

View File

@ -1,4 +1,4 @@
@props(['active' => false])
@props(['active' => false, 'slot'])
@php($classes = $active ? 'bg-indigo-700' : 'hover:bg-indigo-500 hover:bg-opacity-75')
@php($classes .= ' text-white rounded-md px-3 py-2 text-sm font-medium')
<a {{ $attributes->merge(['class' => $classes]) }}

View File

@ -17,10 +17,12 @@
<div class="ml-10 flex items-baseline space-x-4">
<x-layout.navbar.nav-link href="/dashboard" :active="request()->is('dashboard')">Dashboard
</x-layout.navbar.nav-link>
<x-layout.navbar.nav-link href="/students" :active="request()->is('students')">Students
</x-layout.navbar.nav-link>
<x-layout.navbar.nav-link href="/entries" :active="request()->is('entries')">Entries
</x-layout.navbar.nav-link>
@if(Auth::user()->school_id)
<x-layout.navbar.nav-link href="/students" :active="request()->is('students')">Students
</x-layout.navbar.nav-link>
<x-layout.navbar.nav-link href="/entries" :active="request()->is('entries')">Entries
</x-layout.navbar.nav-link>
@endif
@if(Auth::user()->isJudge() AND Settings::get('judging_enabled'))
<x-layout.navbar.nav-link href="/judging" :active="request()->is('judging')">Judging
</x-layout.navbar.nav-link>

View File

@ -1,4 +1,7 @@
@php use Illuminate\Support\Facades\Auth; @endphp
<x-layout.app>
<x-slot:page_title>Dashboard</x-slot:page_title>
@if(! Auth::user()->school_id)
You aren't currently associated with a school. <a href="/my_school" class="text-blue-600">Click here to choose or create one.</a>
@endif
</x-layout.app>