@extends('template.'.config('settings.template').'.content.master')
@section('content')
    <link rel="stylesheet" href="{{ asset('template/css/pages/news.css') }}">
    <span id="database"
        data-new-id="{{$nach->id}}"
        data-new-url="{{route_content($nach)}}"
        data-new-title="{{$nach->title}}"
        data-new-date="{{date('Y-m-d h:i:s', strtotime($nach->created_at))}}"
        data-author-url="{{route('author.get', [$nach->user->slug])}}"
        data-author-name="{{$nach->user->name}}"
        data-author-image="{{$nach->user->gravatar()}}"
    ></span>
    <div class="container">
        <!-- Modal -->







        <div class="row" style="padding-top:60px; padding-bottom: 20px;">




            <div class="col-9 col-md-11 d-flex align-items-center" >

                <h1>{{$nach->title}}</h1>

            </div>


        </div>
        <div class="row">
            <div class="col-6 text-muted">
                <i class="fal fa-calendar"></i> Veröffentlicht: {{date('d.m.Y', strtotime($nach->created_at))}}

            </div>


        </div>
        <div class="row">


                    <div class="col-md-9">


                        @if ($nach->image)
                            <br>
                            <img src="{{ asset('uploads/' . $nach->image) }}" class="img-fluid">
                            <br>
                        @endif

                            <br>




                            <style>
                                h2 {
                                    font-size: 1.4rem;
                                    padding-top:55px;
                                }
                                h5{
                                    font-size: 0.9rem;
                                }
                            </style>


                            <br>
                            <br>
                            {!! isset($nach->additional_fields['1']) ? $nach->additional_fields['1']  : 'keine Angaben' !!}

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

            @if(App::environment('production'))

                <div class="row">


                    @if (\App\Models\Nachrichten::whereJsonContains('additional_fields->14', $nach->additional_fields['14'])->where('approved', 1)->where('id', '!=', $nach->id)->limit(4)->get()->sortByDesc('created_at')->count() > 0)

                        <div class="col-12">
                            <hr>
                            <br>
                            <h2>Ähnliche Jobangebote</h2>
                            <br>
                        </div>

                        @foreach (\App\Models\Nachrichten::whereJsonContains('additional_fields->14', $nach->additional_fields['14'])->where('approved', 1)->where('id', '!=', $nach->id)->limit(3)->get()->sortByDesc('created_at') as $nachLimit)
                            <div class="col-12 col-md-6 col-lg-4" style="padding-bottom: 1rem;">

                                <div class="card h-100" style="background-color: #f8f8f8;">
                                    <div class="card-body">
                                        <div class="row">
                                            <div class="col-3">
                                                <a href="{{ route('author.get', [$nachLimit->user->slug]) }}"
                                                   onclick="gtag('event', 'See Employer', {'event_category' : '{{$nach->title}}', 'event_label' : '{{ $nachLimit->user->name }}'});"

                                                >
                                                    <img src="{{ $nachLimit->user->gravatar() }}" title="" height="70px" class="border rounded">
                                                </a>
                                            </div>

                                            <div class="col-9">

                                                <br>
                                                <a href="{{ route('author.get', [$nachLimit->user->slug]) }}" class="text-muted"
                                                   onclick="gtag('event', 'See Employer', {'event_category' : '{{$nach->title}}', 'event_label' : '{{ $nachLimit->user->name }}'});"

                                                >
                                                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-building" viewBox="0 0 16 16">
                                                        <path fill-rule="evenodd" d="M14.763.075A.5.5 0 0 1 15 .5v15a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5V14h-1v1.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V10a.5.5 0 0 1 .342-.474L6 7.64V4.5a.5.5 0 0 1 .276-.447l8-4a.5.5 0 0 1 .487.022zM6 8.694L1 10.36V15h5V8.694zM7 15h2v-1.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5V15h2V1.309l-7 3.5V15z"/>
                                                        <path d="M2 11h1v1H2v-1zm2 0h1v1H4v-1zm-2 2h1v1H2v-1zm2 0h1v1H4v-1zm4-4h1v1H8V9zm2 0h1v1h-1V9zm-2 2h1v1H8v-1zm2 0h1v1h-1v-1zm2-2h1v1h-1V9zm0 2h1v1h-1v-1zM8 7h1v1H8V7zm2 0h1v1h-1V7zm2 0h1v1h-1V7zM8 5h1v1H8V5zm2 0h1v1h-1V5zm2 0h1v1h-1V5zm0-2h1v1h-1V3z"/>
                                                    </svg>
                                                    {{ $nachLimit->user->name }}
                                                </a>
                                            </div>
                                            <div class="col-12">
                                                <h5 class="card-title" style="margin-top: 20px;">
                                                    <a href="{{ route_content($nachLimit) }}"
                                                       onclick="gtag('event', 'See Job', {'event_category' : '{{$nach->title}}', 'event_label' : '{{ $nachLimit->title }}'});"

                                                    >
                                                        {{ $nachLimit->title }}
                                                    </a>
                                                </h5>

                                            </div>

                                            <div class="col-5">
                                                <br>
                                                <h6 class="card-subtitle mb-2 text-muted">{{date('d.m.Y', strtotime($nachLimit->created_at))}}</h6>

                                            </div>
                                            <div class="col-7 text-end ">
                                                <br>
                                                <a class="btn btn-ci" href="{{ route_content($nachLimit) }}"
                                                   onclick="gtag('event', 'See Job', {'event_category' : '{{$nach->title}}', 'event_label' : '{{ $nachLimit->title }}'});">
                                                    Job ansehen
                                                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-right" viewBox="0 0 16 16">
                                                        <path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"/>
                                                    </svg>
                                                </a>

                                            </div>
                                        </div>

                                    </div>
                                </div>
                            </div>
                        @endforeach
                    @endif

                    <div class="col-sm-12">
                        <br>
                        <br>
                    </div>
                </div>
            @endif
            </div>
    </div>

@stop

@section('scripts')
    <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>

    <script src="{{ asset('template/js/pages/news/methods.js') }}"></script>
    <script src="{{ asset('template/js/pages/news/events.js') }}"></script>
    <script src="{{ asset('template/js/pages/news/script.js') }}"></script>

@stop

