@extends('layouts.app') @section('title', 'Parents & Guardians') @section('content')
{{-- ============================================================ Page Header ============================================================ --}}

Parents & Guardians

Manage parent and guardian information, contact preferences and linked students.

@can('parents.view') Export CSV @endcan @can('parents.create') New Parent @endcan
{{-- ============================================================ Filters ============================================================ --}}
{{-- Search --}}
{{-- --}}
{{-- Status --}}
{{-- SMS --}}
{{-- Email --}}
{{-- Sort --}}
{{-- Preserve Per Page --}} @if(request('per_page')) @endif {{-- Filter --}} {{-- Reset --}} @if(request()->hasAny([ 'search', 'status', 'sms_enabled', 'email_enabled', 'sort' ])) Reset @endif
{{-- ============================================================ Active Filters ============================================================ --}} @if( filled(request('search')) || request('status') !== null && request('status') !== '' || request('sms_enabled') !== null && request('sms_enabled') !== '' || request('email_enabled') !== null && request('email_enabled') !== '' || request('sort', 'latest') !== 'latest' )
Active filters: @if(filled(request('search'))) {{-- --}} {{ request('search') }} @endif @if(request('status') !== null && request('status') !== '') @if(request('status') === '1') Active @else Inactive @endif @endif @if(request('sms_enabled') !== null && request('sms_enabled') !== '') @if(request('sms_enabled') === '1') SMS Enabled @else SMS Disabled @endif @endif @if(request('email_enabled') !== null && request('email_enabled') !== '') @if(request('email_enabled') === '1') Email Enabled @else Email Disabled @endif @endif @if(request('sort', 'latest') !== 'latest') @switch(request('sort')) @case('oldest') Oldest First @break @case('father_asc') Father A-Z @break @case('father_desc') Father Z-A @break @endswitch @endif
@endif {{-- ============================================================ Bulk Actions ============================================================ --}} {{-- ============================================================ Parents Table ============================================================ --}}
{{-- Table Header --}}

Parent & Guardian List

@if($parents->total() > 0) Showing {{ number_format($parents->firstItem()) }} to {{ number_format($parents->lastItem()) }} of {{ number_format($parents->total()) }} parent records. @else No parent records available. @endif

{{-- Per Page --}}
@foreach(request()->except(['per_page', 'page']) as $key => $value) @if(!is_array($value)) @endif @endforeach
@if($parents->total() > 0)
Page {{ $parents->currentPage() }} of {{ $parents->lastPage() }}
@endif
{{-- Table --}}
{{-- Select --}} @forelse($parents as $parent) @php $displayName = $parent->displayName(); $initials = collect( preg_split( '/\s+/', trim($displayName) ) ) ->filter() ->take(2) ->map( fn ($word) => mb_strtoupper( mb_substr($word, 0, 1) ) ) ->implode(''); @endphp {{-- Checkbox --}} {{-- Parent --}} {{-- Contact --}} {{-- Students --}} {{-- SMS --}} {{-- Email --}} {{-- Status --}} {{-- Actions --}} @empty @endforelse
Parent / Guardian Contact Students SMS Email Status Actions
{{ $initials ?: 'P' }}
@can('parents.view') {{ $displayName }} @else

{{ $displayName }}

@endcan
@if($parent->guardian_name) Guardian @if($parent->guardian_relation) {{ $parent->guardian_relation }} @endif @else Father @endif
{{ $parent->primary_phone }}
@if($parent->email)
{{ $parent->email }}
@else
No email
@endif
{{ number_format($parent->students_count ?? 0) }} @if($parent->sms_enabled) Enabled @else Disabled @endif @if($parent->email_enabled) @if($parent->email) Enabled @else Missing Email @endif @else Disabled @endif @if($parent->is_active) Active @else Inactive @endif
{{-- View --}} @can('parents.view') @endcan {{-- Edit --}} @can('parents.edit') @endcan {{-- Delete --}} @can('parents.delete')
@csrf @method('DELETE')
@endcan
@if( filled(request('search')) || request('status') !== null && request('status') !== '' || request('sms_enabled') !== null && request('sms_enabled') !== '' || request('email_enabled') !== null && request('email_enabled') !== '' )

No matching parents found

No parent or guardian records match the current search or filter criteria.

Clear Filters @else

No parent records found

Create your first parent or guardian record to begin linking students and managing communication preferences.

@can('parents.create') New Parent @endcan @endif
{{-- ======================================================== Pagination ======================================================== --}} @if($parents->hasPages())
{{ $parents->withQueryString()->links() }}
@endif
{{-- ================================================================ Bulk Delete Form ================================================================ --}} @endsection @push('scripts') @endpush