feat: navigation

This commit is contained in:
Sallu9007
2025-03-23 15:28:49 +05:30
parent a6a07162b4
commit e27937c29f
2 changed files with 41 additions and 32 deletions

View File

@@ -12,6 +12,28 @@
{{ __("You're logged in!") }} {{ __("You're logged in!") }}
</div> </div>
</div> </div>
{{-- Role-based Buttons --}}
<div class="mt-6 p-6 bg-white shadow-sm sm:rounded-lg">
@php $role = auth()->user()->role->name; @endphp
@if ($role === 'Admin')
<a href="{{ route('admin.responses') }}"
class="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">
Go to Admin Responses
</a>
@elseif ($role === 'Coordinator')
<a href="{{ route('coordinator.responses') }}"
class="px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600">
Go to Coordinator Responses
</a>
@elseif ($role === 'Faculty')
<a href="{{ route('faculty.response-form') }}"
class="px-4 py-2 bg-purple-500 text-white rounded hover:bg-purple-600">
Go to Faculty Response Form
</a>
@endif
</div>
</div> </div>
</div> </div>
</x-app-layout> </x-app-layout>

View File

@@ -16,27 +16,20 @@
{{ __('Dashboard') }} {{ __('Dashboard') }}
</x-nav-link> </x-nav-link>
<!-- <x-nav-link :href="route('admin.responses')" :active="request()->routeIs('admin.responses')"> <!-- Role-specific Links using direct role checks -->
{{ __('View Form Responses') }} @if(auth()->user()->role->name === 'Admin')
</x-nav-link> -->
<!-- Role-specific Links -->
@can('isAdmin')
<x-nav-link :href="route('admin.responses')" :active="request()->routeIs('admin.responses')"> <x-nav-link :href="route('admin.responses')" :active="request()->routeIs('admin.responses')">
{{ __('View Form Responses') }} {{ __('Activities Attended') }}
</x-nav-link> </x-nav-link>
@endcan @elseif(auth()->user()->role->name === 'Coordinator')
@can('isCoordinator')
<x-nav-link :href="route('coordinator.responses')" :active="request()->routeIs('coordinator.responses')"> <x-nav-link :href="route('coordinator.responses')" :active="request()->routeIs('coordinator.responses')">
{{ __('View Form Responses') }} {{ __('Activities Attended') }}
</x-nav-link> </x-nav-link>
@endcan @elseif(auth()->user()->role->name === 'Faculty')
@can('isFaculty')
<x-nav-link :href="route('faculty.responseForm')" :active="request()->routeIs('faculty.responseForm')"> <x-nav-link :href="route('faculty.responseForm')" :active="request()->routeIs('faculty.responseForm')">
{{ __('Respond to a Form') }} {{ __('Activities Attended') }}
</x-nav-link> </x-nav-link>
@endcan @endif
</div> </div>
</div> </div>
@@ -65,8 +58,7 @@
@csrf @csrf
<x-dropdown-link :href="route('logout')" <x-dropdown-link :href="route('logout')"
onclick="event.preventDefault(); onclick="event.preventDefault(); this.closest('form').submit();">
this.closest('form').submit();">
{{ __('Log Out') }} {{ __('Log Out') }}
</x-dropdown-link> </x-dropdown-link>
</form> </form>
@@ -93,24 +85,20 @@
{{ __('Dashboard') }} {{ __('Dashboard') }}
</x-responsive-nav-link> </x-responsive-nav-link>
<!-- Role-specific Links --> <!-- Role-specific Links using direct role checks -->
@can('isAdmin') @if(auth()->user()->role->name === 'Admin')
<x-responsive-nav-link :href="route('admin.responses')" :active="request()->routeIs('admin.responses')"> <x-responsive-nav-link :href="route('admin.responses')" :active="request()->routeIs('admin.responses')">
{{ __('View Form Responses') }} {{ __('Activities Attended') }}
</x-responsive-nav-link> </x-responsive-nav-link>
@endcan @elseif(auth()->user()->role->name === 'Coordinator')
@can('isCoordinator')
<x-responsive-nav-link :href="route('coordinator.responses')" :active="request()->routeIs('coordinator.responses')"> <x-responsive-nav-link :href="route('coordinator.responses')" :active="request()->routeIs('coordinator.responses')">
{{ __('View Form Responses') }} {{ __('Activities Attended') }}
</x-responsive-nav-link> </x-responsive-nav-link>
@endcan @elseif(auth()->user()->role->name === 'Faculty')
@can('isFaculty')
<x-responsive-nav-link :href="route('faculty.responseForm')" :active="request()->routeIs('faculty.responseForm')"> <x-responsive-nav-link :href="route('faculty.responseForm')" :active="request()->routeIs('faculty.responseForm')">
{{ __('Respond to a Form') }} {{ __('Activities Attended') }}
</x-responsive-nav-link> </x-responsive-nav-link>
@endcan @endif
</div> </div>
<!-- Responsive Settings Options --> <!-- Responsive Settings Options -->
@@ -130,8 +118,7 @@
@csrf @csrf
<x-responsive-nav-link :href="route('logout')" <x-responsive-nav-link :href="route('logout')"
onclick="event.preventDefault(); onclick="event.preventDefault(); this.closest('form').submit();">
this.closest('form').submit();">
{{ __('Log Out') }} {{ __('Log Out') }}
</x-responsive-nav-link> </x-responsive-nav-link>
</form> </form>