@extends('layouts.pmar.theme')
@section('title', env('APP_NAME') . " :: $noticia->title")

@section('content')
    <section>
        <div class="container">
            <div class="row">
                <hr />
                <div class="col-12">
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item mt-2 px-3" style="font-size: 1.2em;">
                                <a href="{{ route('paginas.noticias') }}" class="text-secondary"><i
                                        class="fa-solid fa-chevron-left"></i> Notícias</a>
                            </li>
                        </ol>
                    </nav>
                </div>

            </div>

            @php
                $pathSystem = $_SERVER['DOCUMENT_ROOT'] . "/";
                $angraDefault = asset("/pmar/assets/img/angra-default.png");
            @endphp

            <div class="row d-flex justify-content-between p-3">
                <div class="col-lg-9 col-md-12 col-sm-12">
                    <h1 class="mt-3 ">{{ html_entity_decode($noticia->title) }}</h1>
                    <h2 class="news-summary-interna">{{ html_entity_decode($noticia->summary) }}</h2>
                    <div class="row">
                        <div class="col-12">

                            <div class="row d-flex justify-content-xl-between justify-content-lg-between align-items-center">
                                <div class="col-12 col-sm-12 col-md-12 col-lg-6 col-xl-6 col-xxl-6 mx-auto">
                                    <div class="my-auto">
                                        <?php
                                        setlocale(LC_TIME, 'pt_BR');
                                        ?>
                                        <span class="news-date">
                                            {{ app(App\Http\Controllers\Controller::class)->formatDateToPortuguese($noticia->created_at) }}
                                        </span>
                                    </div>
                                </div>
                                <div class="col-12 col-sm-12 col-md-12 col-lg-6 col-xl-6 col-xxl-6 mx-auto">
                                    <div class="mt-5 social-icons text-start text-sm-start text-md-start text-lg-end text-xl-end text-xxl-end mt-3 mb-2" data-title="{{ html_entity_decode($noticia->title) }}"
                                        data-url="{{ url()->current() }}" data-image="{{ file_exists( $pathSystem . $noticia->featuredPhoto ) ? asset($noticia->featuredPhoto) : asset($angraDefault)  }}">
                                        <a href="#" data-platform="twitter" class="me-1" style="font-size: 0.95rem;"
                                            target="_blank">
                                            <i class="fa-brands fa-x-twitter text-secondary"></i>
                                        </a>
                                        <a href="#" data-platform="facebook" class="me-1" style="font-size: 0.95rem;"
                                            target="_blank">
                                            <i class="fa-brands fa-facebook text-secondary"></i>
                                        </a>
                                        <a href="#" data-platform="linkedin" class="me-1" style="font-size: 0.95rem;"
                                            target="_blank">
                                            <i class="fa-brands fa-linkedin text-secondary"></i>
                                        </a>
                                        <a href="#" data-platform="whatsapp" class="me-1" style="font-size: 0.95rem;"
                                            target="_blank">
                                            <i class="fa-brands fa-whatsapp text-secondary"></i>
                                        </a>
                                        <a href="#" data-platform="telegram" class="me-1" style="font-size: 0.95rem;"
                                            target="_blank">
                                            <i class="fa-brands fa-telegram text-secondary"></i>
                                        </a>
                                    </div>
                                </div>
                            </div>

                            <div>
                                <img src="{{ file_exists( $pathSystem . $noticia->internalPhoto ) ? asset($noticia->internalPhoto) : asset($angraDefault) }}" class="img-fluid w-100"
                                    style="height: auto;" />
                            </div>
                            <div>
                                <div class="desc my-3" style="font-size: 1.25em; color: #2C2C2C;">
                                    {!! \App\Helpers\HtmlSanitizer::sanitize($noticia->description) !!}
                                </div>
                                <div class="desc">
                                    {!! $noticia->movie !!}
                                </div>
<!--                                <div class="flickr">
                                    {{ $noticia->flickr }}
                                </div>-->
                                <div class="code">
                                    {!! $noticia->code !!}
                                </div>
                            </div>


                        </div>
                    </div>
                </div>

                <!-- INÍCIO - NOTÍCIAS RECENTES DA SECRETARIA E BANNERS -->
                <div class="col-lg-3 col-md-12 col-sm-12">
                    <div class="row d-flex flex-column align-items-center">
                        <div class="col">
                            <div class="card-slug">
                                <h2 class="slug-title">Leia Mais</h2>
                                @for ($i = 0; $i < count($noticias); $i++)
                                    <div class="my-4">
                                        <!-- <span class="news-label">{{ $noticia->title }}</span> -->
                                        <h5 class="slug-summary mt-3">
                                            <a
                                                href="{{ route('paginas.slug', [date('d-m-Y', strtotime($noticias[$i]->created_at)), $noticias[$i]->slug]) }}">
                                                {{ Str::limit(html_entity_decode($noticias[$i]->summary), 50) }}
                                            </a>
                                        </h5>
                                    </div>
                                    <hr>
                                @endfor

                                <a href="{{ route('paginas.noticias') }}"
                                    class="mt-5 px-4 py-2 btn border-1 bg-blue-gradient text-white text-start text-center rounded-5">Ver
                                    Mais
                                </a>
                            </div>
                        </div>
                        <div class="col d-flex flex-column align-items-center mt-5">
                            <div class="mb-5">
                                @include('paginas.parts.sidebanner1')
                            </div>
                            <div>
                                @include('paginas.parts.sidebanner2')
                            </div>
                        </div>
                    </div>
                </div>
                <!-- FIM - NOTÍCIAS RECENTES DA SECRETARIA E BANNERS -->
            </div>
        </div>
        </div>
    </section>

@endsection
