@extends('frontend.layout')
@section('content')
@php
$commissioner = getContent('commissioner');
$principal = getContent('principal');
$about = getContent('about');
$course = getContent('course-link');
$latestVideo = \App\Models\Video::latest('id')->first();
// Quick-link buttons come from Static Content (admin: Static Content, type "home-buttons"):
// title = button label, route = page path (e.g. dr-pages/nirf/nirf) or a full http(s) URL,
// content = button colour class, priority = order. "priority" is a text column, so sort numerically.
$homeButtons = getContents('home-buttons')->sortBy(fn($b) => (int) $b->priority)->values();
$buttonColors = ['btn-primary', 'btn-secondary', 'btn-success', 'btn-danger', 'btn-warning', 'btn-info', 'btn-light', 'btn-dark'];
@endphp
{{-- LEFT: COMMISSIONER + QUICK LINKS --}}
{{ strtoupper($commissioner->title ?? 'Commissioner') }}
@if($commissioner && $commissioner->image)
 }})
@else
 }})
@endif
@if($commissioner)
{!! $commissioner->content !!}
@else
Content not available.
@endif
@foreach ($homeButtons as $button)
@php
$isExternal = (bool) preg_match('#^https?://#i', (string) $button->route);
$colour = trim(strip_tags((string) $button->content));
$colour = in_array($colour, $buttonColors, true) ? $colour : 'btn-success';
@endphp
@endforeach
{{-- CENTRE: SLIDER + ABOUT --}}
@foreach($slides as $index => $slide)
@endforeach
@foreach($slides as $index => $slide)
@endforeach
@if($about)
{!! $about->content !!}
@else
Content not available.
@endif
{{-- RIGHT: PRINCIPAL + NEWS --}}
{{ strtoupper($principal->title ?? 'Principal') }}
@if($principal && $principal->image)
 }})
@else
 }})
@endif
@if($principal)
{!! $principal->content !!}
@else
Content not available.
@endif
News and
Updates
{{-- UPCOMING EVENTS --}}
Upcoming Events
@if($events->count())
@else
No upcoming events.
@endif
{{-- ANNOUNCEMENTS --}}
Announcements
@if($announcements->count())
@else
No announcements.
@endif
{{-- VIDEOS --}}
Videos
@if($latestVideo)
{!! convertYoutube($latestVideo->video) !!}
{{ $latestVideo->title }}
@endif
{{-- GALLERY --}}
@endsection