@extends ('Layouts Dashboard-Registr
@extends ('Layouts Dashboard-Registr
dashboard-registrar')
@section('title', 'Students Dashboard')
@section('content')
<!-- Add this style tag to ensure x-cloak works properly -->
<style>
[x-cloak] { display: none !important; }
</style>
<div class="bg-gray-50 min-h-screen p-6">
<!-- Dashboard Header with Search -->
<div class="flex flex-col md:flex-row md:items-center justify-between gap-4 mb-
6">
<div>
<h1 class="text-2xl font-bold text-gray-800">Student Requirements</h1>
<p class="text-sm text-gray-500">Manage and view all requirements of
students</p>
</div>
</div>
<!-- Student List Section -->
<div class="bg-gradient-to-br from-gray-50 to-gray-100 rounded-xl shadow-2xl
overflow-hidden border border-gray-200">
<!-- Filter Header -->
<div class="flex flex-col md:flex-row justify-between items-center px-6 py-5
bg-white border-b border-gray-200">
<h3 class="text-2xl font-bold text-gray-800 mb-4 md:mb-0 flex items-
center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8 mr-3 text-blue-
600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-
width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-
1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0
0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014
0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />
</svg>
Student List
</h3>
<div class="flex flex-wrap gap-3 items-center justify-end">
<!-- Student Status Dropdown -->
<div class="relative inline-block text-left">
<button type="button" id="statusDropdownButton" class="inline-flex justify-
between items-center w-full px-4 py-2.5 bg-white border border-gray-300 rounded-lg
shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none
focus:ring-2 focus:ring-indigo-500">
<div class="flex items-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2 text-gray-
500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-
width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-
1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0
0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014
0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />
</svg>
<span>{{ request('status') ?? 'All Students' }}</span>
<span class="ml-2 bg-purple-100 text-purple-600 text-xs font-medium px-
2 py-0.5 rounded-full">{{ $totalStudents ?? Student::count() }}</span>
</div>
<svg class="ml-2 -mr-1 h-5 w-5" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10
10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
clip-rule="evenodd" />
</svg>
</button>
<div
id="statusDropdown"
class="absolute left-0 mt-2 w-72 bg-white rounded-lg shadow-lg z-20 border
border-gray-100 hidden overflow-y-auto max-h-96"
>
<div class="py-1.5 rounded-lg">
<div class="px-3 py-2 sticky top-0 bg-white border-b border-gray-100">
<input type="text" id="statusSearch" class="w-full px-3 py-1.5
text-sm border border-gray-200 rounded-md focus:border-indigo-300 focus:ring
focus:ring-indigo-200 focus:ring-opacity-50" placeholder="Search status...">
</div>
if (!dropdownButton || !dropdown) {
console.error('Dropdown elements not found');
return;
}
// Toggle dropdown
dropdownButton.addEventListener('click', function(event) {
event.stopPropagation(); // Prevent event bubbling
dropdown.classList.toggle('hidden');
if (!dropdown.classList.contains('hidden')) {
if (searchInput) searchInput.focus();
}
});
// Search functionality
if (searchInput) {
searchInput.addEventListener('input', function() {
const searchTerm = this.value.toLowerCase();
statusItems.forEach(item => {
const text = item.textContent.toLowerCase();
if (text.includes(searchTerm)) {
item.style.display = 'block';
} else {
item.style.display = 'none';
}
});
});
<button
id="programFilterBtn"
class="text-sm px-4 py-2 bg-indigo-50 hover:bg-indigo-100 text-indigo-700
rounded-lg transition flex items-center font-medium"
type="button"
>
@if(request('course'))
{{ collect($programs)->firstWhere('id', request('course'))
['program_name'] ?? 'All Programs' }}
@if(request('major'))
- {{ collect($programs)->firstWhere('id', request('course'))
['major_name'] ?? '' }}
@endif
@else
All Programs
@endif
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 ml-2 transform
group-hover:rotate-180 transition-transform" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M19 9l-7 7-7-7" />
</svg>
</button>
<div
id="programDropdown"
class="absolute right-0 mt-2 w-72 bg-white rounded-lg shadow-lg z-20 border
border-gray-100 hidden overflow-y-auto max-h-96"
>
<div class="py-1.5 rounded-lg">
<div class="px-3 py-2 sticky top-0 bg-white border-b border-gray-100">
<input type="text" id="programSearch" class="w-full px-3 py-1.5
text-sm border border-gray-200 rounded-md focus:border-indigo-300 focus:ring
focus:ring-indigo-200 focus:ring-opacity-50" placeholder="Search program...">
</div>
@forelse($programs as $program)
<a href="{{ url()->current() }}?
{{ http_build_query(array_merge(request()->except('course', 'major', 'page'),
['course' => $program['id']])) }}"
class="program-item block px-4 py-2 text-sm text-gray-700
hover:bg-indigo-50 {{ request('course') == $program['id'] ? 'bg-indigo-50 text-
indigo-700' : '' }} transition rounded-md mx-1">
{{ $program['program_name'] }}
@if($program['major_name'])
- {{ $program['major_name'] }}
@endif
</a>
@empty
<div class="px-4 py-2 text-sm text-gray-500">No programs
found</div>
@endforelse
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const programFilterBtn = document.getElementById('programFilterBtn');
const programDropdown = document.getElementById('programDropdown');
const programSearch = document.getElementById('programSearch');
const programItems = document.querySelectorAll('.program-item');
programItems.forEach(item => {
const programText = item.textContent.toLowerCase();
const matchesSearch = programText.includes(searchTerm);
<div
id="yearLevelDropdown"
class="absolute right-0 mt-2 w-48 bg-white rounded-lg shadow-lg z-20 border
border-gray-100 hidden overflow-y-auto max-h-64"
>
<div class="py-1.5 rounded-lg">
<a href="{{ url()->current() }}?{{ http_build_query(request()-
>except('year_level', 'page')) }}"
class="block px-4 py-2 text-sm text-gray-700 hover:bg-indigo-50 {{ !
request('year_level') ? 'bg-indigo-50 text-indigo-700' : '' }} transition rounded-
md mx-1">
All Year Levels
</a>
@php
$yearLevels = ['1', '2', '3', '4', '5'];
@endphp
@foreach($yearLevels as $yearLevel)
<a href="{{ url()->current() }}?
{{ http_build_query(array_merge(request()->except('year_level', 'page'),
['year_level' => $yearLevel])) }}"
class="year-level-item block px-4 py-2 text-sm text-gray-700
hover:bg-indigo-50 {{ request('year_level') == $yearLevel ? 'bg-indigo-50 text-
indigo-700' : '' }} transition rounded-md mx-1">
{{ $yearLevel }} Year
</a>
@endforeach
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Year Level Filter Toggle
const yearLevelFilterBtn = document.getElementById('yearLevelFilterBtn');
const yearLevelDropdown = document.getElementById('yearLevelDropdown');
<div
id="barangayDropdown"
class="absolute right-0 mt-2 w-64 bg-white rounded-lg shadow-lg z-20 border
border-gray-100 hidden overflow-y-auto max-h-64"
>
<div class="py-1.5 rounded-lg">
<div class="px-3 py-2 sticky top-0 bg-white border-b border-gray-100">
<input type="text" id="barangaySearch" class="w-full px-3 py-1.5
text-sm border border-gray-200 rounded-md focus:border-indigo-300 focus:ring
focus:ring-indigo-200 focus:ring-opacity-50" placeholder="Search barangay...">
</div>
@php
// City of San Fernando city code
$cityCode = '035416';
@forelse($sanFernandoBarangays as $barangay)
<a href="{{ url()->current() }}?
{{ http_build_query(array_merge(request()->except('barangay_code', 'page'),
['barangay_code' => $barangay['brgy_code']])) }}"
class="barangay-item block px-4 py-2 text-sm text-gray-700
hover:bg-indigo-50 {{ request('barangay_code') == $barangay['brgy_code'] ? 'bg-
indigo-50 text-indigo-700' : '' }} transition rounded-md mx-1">
{{ $barangay['brgy_name'] }}
</a>
@empty
<div class="px-4 py-2 text-sm text-gray-500">No barangays
found</div>
@endforelse
</div>
</div>
</div>
<script>
// Add this to your JavaScript file or include it in a script tag
document.addEventListener('DOMContentLoaded', function() {
// Barangay Filter Toggle
const barangayFilterBtn = document.getElementById('barangayFilterBtn');
const barangayDropdown = document.getElementById('barangayDropdown');
const barangaySearch = document.getElementById('barangaySearch');
// Search functionality
if (barangaySearch) {
barangaySearch.addEventListener('input', function() {
const searchValue = this.value.toLowerCase();
const barangayItems = document.querySelectorAll('.barangay-item');
let hasResults = false;
barangayItems.forEach(item => {
const barangayName = item.textContent.trim().toLowerCase();
if (barangayName.includes(searchValue)) {
item.style.display = 'block';
hasResults = true;
} else {
item.style.display = 'none';
}
});