@extends('site.layouts.layout_1')
@section('content_header')
    <div class="content-section">
        <div class="content-wrapper w-container">
            <div class="masterbreadcrumb">
                <div class="container">
                    <div class="breadcrumb">
                        <a href="/">
                            <span class="breadcrumb__inner">
                                <span class="breadcrumb__title">Página inicial</span>
                            </span>
                        </a>
                        <a href="{{ route('site.noticias.index') }}" class="w--current">
                            <span class="breadcrumb__inner">
                                <span class="breadcrumb__title">Notícias</span>
                            </span>
                        </a>
                    </div>
                </div>
            </div>

            <div class="w-col w-col-8">

                <div class="post-content-text">
                    <h3 class="big">Todas as notícias</h3>
                    <div class="rich-text-block w-richtext">
                        <div class="bottom-border title-box"></div>
                        <div class="w-dyn-list">
                            <div class="w-dyn-items">
                                @foreach ($noticias->sortByDesc('id')->take(10) as $noticia)
                                    <div class="w-dyn-item">

                                        <div class="flex-wrapper section">
                                            <div class="inner-page post-preview-image">
                                                <a class="post-image-link w-inline-block" data-ix="full-opacity-on-hover"
                                                    href="noticia/{{ $noticia->slug }}"
                                                    style="background-image:url({{ asset('assets/site/uploads/' . $entidade->id_tce . '/noticias/' . $noticia->foto) }})">
                                                    <div class="overlay" data-ix="no-opacity-on-load"
                                                        style="opacity: 1; transition: opacity 300ms;"></div>
                                                </a>
                                            </div>
                                            <div class="_50-percent-column left-padding">
                                                <a class="tag" href="noticia/{{ $noticia->slug }}"
                                                    style="background-color: #dac64a;">{{ $noticia->id_categoria }}</a>
                                                <a class="bottom-border heading-link-box2 w-inline-block"
                                                    href="noticia/{{ $noticia->slug }}">
                                                    <h5 class="heading-hover2">{{ $noticia->titulo }}</h5>
                                                </a>
                                                <p class="subtitle">{{ $noticia->id_categoria }}</p>
                                                <div>
                                                    <p style="text-transform: lowercase;" class="details-text">
                                                        <i class="fa fa-clock-o" aria-hidden="true"></i>
                                                        {{ \Carbon\Carbon::parse($noticia->data)->locale('pt_BR')->isoFormat('dddd, DD [de] MMMM [de] YYYY') }}
                                                    </p>
                                                </div>
                                            </div>
                                        </div>

                                    </div>
                                @endforeach

                            </div>
                        </div>
                        <!-- Paginação -->
                        <nav class="mt-4">
                            <ul class="pagination justify-content-center">
                                @if ($noticias->onFirstPage())
                                    <li class="page-item disabled">
                                        <span class="page-link">Anterior</span>
                                    </li>
                                @else
                                    <li class="page-item">
                                        <a class="page-link" href="{{ $noticias->previousPageUrl() }}"
                                            aria-label="Previous">
                                            <span aria-hidden="true">&laquo; Anterior</span>
                                        </a>
                                    </li>
                                @endif

                                @foreach ($noticias->links()->elements as $element)
                                    @if (is_string($element))
                                        <li class="page-item disabled"><span class="page-link">{{ $element }}</span>
                                        </li>
                                    @endif

                                    @if (is_array($element))
                                        @foreach ($element as $page => $url)
                                            <li class="page-item {{ $page == $noticias->currentPage() ? 'active' : '' }}">
                                                <a class="page-link" href="{{ $url }}">{{ $page }}</a>
                                            </li>
                                        @endforeach
                                    @endif
                                @endforeach

                                @if ($noticias->hasMorePages())
                                    <li class="page-item">
                                        <a class="page-link" href="{{ $noticias->nextPageUrl() }}" aria-label="Next">
                                            <span aria-hidden="true">Próximo &raquo;</span>
                                        </a>
                                    </li>
                                @else
                                    <li class="page-item disabled">
                                        <span class="page-link">Próximo</span>
                                    </li>
                                @endif
                            </ul>
                        </nav>
                    </div>
                </div>
            </div>
            <div style="padding-right:0px" class="w-col w-col-4">
                @if ($entidade->tipo == '1')
                    <h1 class="heading-1">Tv Prefeitura</h1>
                @else
                    <h1 class="heading-1">Tv Câmara</h1>
                @endif
                @foreach ($videos->take(1) as $video)
                    <div style="padding:10px;" class="w-col w-col-12">
                        <a class="w-lightbox" href="#" data-ix="fade-in-text-on-load-4"
                            style=" cursor:pointer; transition: background-color 0.5s ease 0s, opacity 1200ms cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 500ms cubic-bezier(0.215, 0.61, 0.355, 1); opacity: 1; transform: translateX(0px) translateY(0px);">
                            <img src="https://i1.ytimg.com/vi/{{ $video->video_url }}/hqdefault.jpg" width="100%">
                            <script type="application/json" class="w-json">{ "items": [{
                                "type": "video",
                                "html": "<iframe class=\"embedly-embed\" src=\"https://www.youtube-nocookie.com/embed/{{$video->video_url}}?rel=0&amp;controls=0&amp;showinfo=0\" width=\"854\" height=\"480\" scrolling=\"no\" frameborder=\"0\" allowfullscreen></iframe>",
                                "thumbnailUrl": "",
                                "width": 700,
                                "height": 420
                              }] }
                            </script>
                        </a>
                    </div>
                    <div class="center_vios">{{ $video->video_titulo }}</div>
                    <a href="{{ route('site.videos') }}">
                        <div class="all_moveis">
                            <h4>+ Vídeos</h4>
                        </div>
                    </a>
                @endforeach
                <h1 style="margin-top:30px; float:left; width:100%" class="heading-1">Últimas Notícias</h1>
                @foreach ($noticias->take(5) as $noticia)
                    <a href="/noticia/{{ $noticia->slug }}" class="w-dyn-item"> <span
                            class="heading-link-box w-inline-block">
                            <h2 style="font-size: 17px; color: #00652e; font-weight: 500;" class="heading-hover">
                                {{ $noticia->titulo }}</h2>
                            <h2 class="heading-hover">{{ $noticia->id_categoria }}</h2>
                            <p style="margin-bottom:10px; font-size: 15px; color: #999999; font-weight:300"
                                class="details-text">{{ $noticia->data }} </p>
                        </span>
                    </a>
                @endforeach
            </div>
        </div>
    </div> 
@endsection
