@extends('components.layouts.app') @section('title', $page->getTranslation('meta_title', app()->getLocale()) ?: $page->getTranslation('title', app()->getLocale())) @push('meta') @if ($page->getTranslation('meta_description', app()->getLocale())) @endif @if ($page->getTranslation('meta_keywords', app()->getLocale())) @endif @endpush @section('content') @if (isset($sliders) && $sliders->count() > 0)
@foreach ($sliders as $slider) @if ($slider->images && is_array($slider->images)) @foreach ($slider->images as $image)
{{ $slider->getTranslation('title', app()->getLocale()) }} @if ($slider->getTranslation('title', app()->getLocale()))

{{ $slider->getTranslation('title', app()->getLocale()) }}

@if ($slider->getTranslation('description', app()->getLocale()))

{{ $slider->getTranslation('description', app()->getLocale()) }}

@endif
@endif
@endforeach @endif @endforeach
@endif

{{ $page->getTranslation('title', app()->getLocale()) }}

@if (isset($latestNews) && $latestNews->count() > 0)

{{ __('NEWS') }}

@foreach ($latestNews as $item)
{{ $item->getTranslation('title', app()->getLocale()) }}
{{ $item->published_at->format('M d, Y') }} @if ($item->categories && $item->categories->count() > 0)
@foreach ($item->categories as $category) {{ $category->getTranslation('name', app()->getLocale()) }} @endforeach
@endif

{{ $item->getTranslation('title', app()->getLocale()) }}

@if ($item->getTranslation('excerpt', app()->getLocale()))

{{ Str::limit($item->getTranslation('excerpt', app()->getLocale()), 100) }}

@endif {{ __('Read More') }} →
@endforeach
@endif @if (isset($departmentDocuments))

{{ __('DOCUMENTS') }}

@if (isset($departmentCategories) && $departmentCategories->count() > 0)
@foreach ($departmentCategories as $category) @endforeach
@endif @if ($departmentDocuments->count() > 0) {{-- Group documents by category --}} @php $documentsByCategory = $departmentDocuments->groupBy(function ($doc) { return $doc->category ? $doc->category->id : 'uncategorized'; }); $categoryMap = isset($departmentCategories) ? $departmentCategories->keyBy('id') : collect(); @endphp @foreach ($documentsByCategory as $categoryId => $categoryDocuments) @php $category = $categoryId !== 'uncategorized' ? $categoryMap->get($categoryId) : null; @endphp
@if ($category)

{{ $category->getTranslation('name', app()->getLocale()) }} ({{ $categoryDocuments->count() }} {{ __('document(s)') }})

@if ($category->getTranslation('description', app()->getLocale()))

{{ $category->getTranslation('description', app()->getLocale()) }}

@endif @else

{{ __('Uncategorized') }} ({{ $categoryDocuments->count() }} {{ __('document(s)') }})

@endif
@foreach ($categoryDocuments as $document)

{{ $document->getTranslation('title', app()->getLocale()) }}

@if ($document->document_type) {{ strtoupper($document->document_type) }} @endif
@if ($document->getTranslation('description', app()->getLocale()))

{{ Str::limit($document->getTranslation('description', app()->getLocale()), 150) }}

@endif {{-- Preview for images --}} @if ($document->document_type === 'image' && $document->file_path)
{{ $document->getTranslation('title', app()->getLocale()) }}
@endif {{-- Preview for videos --}} @if ($document->document_type === 'video' && $document->file_path)
@endif
@if ($document->document_type === 'file') {{ __('Downloads') }}: {{ $document->download_count }} @endif {{ __('Added') }}: {{ $document->created_at->format('M d, Y') }} @if ($document->category) {{ $document->category->getTranslation('name', app()->getLocale()) }} @endif
@endforeach
@endforeach @else

{{ __('No documents found.') }}

@endif
{{-- Add JavaScript for category filtering --}} @endif
@endsection