File: /var/www/html/sarvodayahospital/resources/views/pages/news.blade.php
@extends('layouts.main')
@section('content')
<section class="py-4 py-md-3 banner-c">
<div class="container">
<div class="row align-items-center">
<div class="col-md-6">
<h1 class="text-white f-sm-30 f-30 fw-500 mb-0">
News
</h1>
</div>
<div class="col-md-6 text-end"></div>
</div>
</div>
</section>
<section class="breadcrumb pt-4 custom_breadcrumb d-sm-block d-none">
<div class="container">
<div class="row align-items-center">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item">
<a href="{{ route('home') }}" role="button" tabindex="0"><i class="fa fa-home"></i> Home</a>
</li>
<li class="breadcrumb-item">News</li>
</ol>
</div>
</div>
</section>
<section class="news-master-section pb-3">
<div class="container">
<div class="row mt-4">
<div class="col-lg-12 left_Sec_content">
<div class="d-sm-flex justify-content-between align-items-center">
<h2 class="mb-0 pt-0 d-none d-sm-block">Latest News</h2>
<form method="GET" action="{{ route('news') }}">
<div id="filterme">
{{-- <select class="form-select clr5c speciality select-input-news ms-0 me-2" id="sortby"
name="sortby" onchange="this.form.submit()">
<option VALUE="">Sort</option>
<option value="A-Z" @if(request('sortby')=='A-Z') selected @endif>A-Z</option>
<option value="Z-A" @if(request('sortby')=='Z-A') selected @endif>Z-A</option>
<option value="Latest" @if(request('sortby')=='Latest') selected @endif>Latest News</option>
</select> --}}
<select class="form-select clr5c speciality select-input-news" id="month"
name="month" onchange="this.form.submit()">
<option value="">Month</option>
@for($i = 1; $i <= 12; $i++)
@php $month = date('F', strtotime('2020-'.$i.'-01')); @endphp
<option value="{{ $i }}" {{ (request('month') == $i) ? "selected" : '' }}>
{{ $month }}
</option>
@endfor
</select>
<select class="form-select clr5c speciality select-input-news mx-0" id="year"
name="year" onchange="this.form.submit()">
<option value="">Year</option>
@foreach ($years as $year)
@if ($year->publicationYear > 0)
<option value="{{ $year->publicationYear }}" @if($year->publicationYear == request('year')) selected @endif>{{ $year->publicationYear }}</option>
@endif
@endforeach
</select>
<input type="hidden" name="page" value="{{ $news->currentPage() }}">
</div>
<h2 class="mb-0 pt-0 d-sm-none mt-3">Latest News</h2>
</form>
</div>
@if(request()->has('year') && !is_null(request('year')) || request()->has('month') && !is_null(request('month')))
<div class="clear-text-wrapper mb-4">
{{-- @if(request()->has('sortby') && !is_null(request('sortby')))
<a href="{{ route('news', ['sortby' => '', 'year' => request('year')]) }}" class="rounded-pill align-items-center bgBlueLight clrBlueDark my-2 d-inline-flex justify-content-center f-16 no-underline px-3 py-1 clear-text me-3">
<span class="me-1">{{ request('sortby') }}</span>
<i class="fa-solid fa-xmark"></i>
</a>
@endif --}}
@if(request()->has('month') && !is_null(request('month')))
<a href="{{ route('news', ['month' => '', 'year' => request('year')]) }}" class="rounded-pill align-items-center bgBlueLight clrBlueDark my-2 d-inline-flex justify-content-center f-16 no-underline px-3 py-1 clear-text me-3">
<span class="me-1">Month: {{ date('F', mktime(0, 0, 0, request('month'), 10)) }}</span>
<i class="fa-solid fa-xmark"></i>
</a>
@endif
@if(request()->has('year') && !is_null(request('year')))
<a href="{{ route('news', ['month' => request('month'), 'year' => '']) }}" class="rounded-pill align-items-center bgBlueLight clrBlueDark my-2 d-inline-flex justify-content-center f-16 no-underline px-3 py-1 clear-text me-3">
<span class="me-1">Year: {{ request('year') }}</span>
<i class="fa-solid fa-xmark"></i>
</a>
@endif
</div>
@endif
<div class="row pt-2 mt-sm-4 mt-3">
@foreach ($news as $newCollection)
@if (
$newCollection->newsTypeCollection &&
in_array($newCollection->newsTypeCollection->Slug, ['newspaper', 'video-url', 'online-blog']))
<div class="col-lg-3 col-md-4 col-sm-6 mb-4">
@if ($newCollection->newsTypeCollection->Slug == 'newspaper')
<a class="clr5c no-underline"
href="{{ $newCollection->media->banner_url ?? '' }}"
data-caption="{{$newCollection->Title}}" data-fancybox="news">
@elseif($newCollection->newsTypeCollection->Slug == 'video-url')
<a class="clr5c no-underline"
href="{{ $newCollection->VideoLink }}" data-fancybox="news"
data-caption="{{$newCollection->Title}}" >
@elseif($newCollection->newsTypeCollection->Slug == 'online-blog')
<a class="clr5c no-underline"
href="{{ $newCollection->URL }}" data-fancybox="news"
data-caption="{{$newCollection->Title}}" >
@endif
<div class="border sp-card border-1 rounded-3 h-100 mb-0">
<div class="px-2 py-2 d-flex flex-column h-100">
<h4 class="text-md-start fw-500 f-16 f-sm-16 mb-3 mt-1 new-b">
{{ \Illuminate\Support\Str::limit($newCollection->Title, 70, '...') }}
</h4>
<div class="d-flex justify-content-between align-items-center mt-auto">
@if ($newCollection->newsTypeCollection->NewsType === 'Newspaper' && !is_null($newCollection->newsLogo))
<img src="{{ $newCollection->newsLogo->url }}" class="img-fluid"
alt="">
@else
<span class="f-14">{{ $newCollection->PublicationName }}</span>
@endif
<h4 class="text-md-start f-14 f-sm-14 mb-0 text-center clrBlueDark">
Read More
</h4>
</div>
</div>
</div>
</a>
</div>
@endif
@endforeach
</div>
<!-- Pagination -->
<div class="row pt-2">
<div class="col-md-6">
{{ $news->links() }}
</div>
</div>
</div>
</div>
</div>
</section>
@stop
@section('javascript')
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.umd.js"></script>
<script>
Fancybox.bind('[data-fancybox="news"]', {
hideScrollbar: false,
Dots: false,
});
</script>
@endsection
@section('css')
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/dist/fancybox/fancybox.css"/>
<style>
#filterme{display: flex!important;}
.select-input-news {margin:5px;}
.fancybox__container{z-index: 9999;}
</style>
@endsection