@extends('template.'.config('settings.template').'.content.master')
@section('content')
    <div class="container">
        <div class="row mb-5">
            <div class="col-12">
                <h1 class="mb-5 mt-5">{{ $list->name }}</h1>

                @isset($list->image)
                    <style>

                        .block {
                            width: 100%;
                            height: 100%;
                            position: relative;
                            overflow: hidden;
                            font-size: 16px;
                        }

                        .img-parallax {
                            width: 100vmax;
                            z-index: -1;
                            position: absolute;
                            top: 0;
                            left: 50%;
                            transform: translate(-50%, 0);
                            pointer-events: none;
                        }
                    </style>

                    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

                    <div class="block rounded mb-5" style="height: 450px;">
                        <img src="{{ $list->image }}" data-speed="-1"   class="img-parallax rounded mb-5" alt="{{config('settings.name')}} Cover" />
                    </div>

                    <script>
                    $('.img-parallax').each(function() {
  var $image = $(this);
  var $imageParent = $(this).parent();

  function parallaxImg () {
    var speed = $image.data('speed');
    var imageY = $imageParent.offset().top;
    var winY = $(this).scrollTop();
    var winH = $(this).height();
    var parentH = $imageParent.innerHeight();
    // The next pixel to show on screen
    var winBottom = winY + winH;

    // If block is shown on screen
    if (winBottom > imageY && winY < imageY + parentH) {
      // Number of pixels shown after block appear
      var imgBottom = ((winBottom - imageY) * speed);
      // Max number of pixels until block disappear
      var imgTop = winH + parentH;
      // Percentage between start showing until disappearing
      var imgPercent = ((imgBottom / imgTop) * 100) + (50 - (speed * 50));
    }

    $image.css({ top: imgPercent + '%', transform: 'translate(-50%, -' + imgPercent + '%)' });
  }

  $(document).on({
    scroll: function () {
      parallaxImg();
    }, ready: function () {
      parallaxImg();
    }
  });
});
                </script>
                @endif

                <p class="fs-5 mb-5">
                    {{ $list->description }}
                </p>
            </div>

            @if(count($contents) > 0)

                @foreach($contents as $content)

                    <div class="col-12 my-3">
                        <div class="card" style="background-color: {{$_secondary_background_color}};">
                            <div class="card-body">
                                <div class="row">
                                    <div class="col-2 ">
                                        <img src="{{$logo}}" title="{{$_legal_name}}" class="border rounded img-fluid shadow-sm" alt="{{$_legal_name}}" style="width: 100px;">
                                        <br>


                                    </div>

                                    <div class="col-12 col-lg-8">
                                        <h3 class="card-title h4 ">
                                            <a class="text-decoration-none" href="{{$content->path}}">
                                                {{$content->title}}
                                            </a>
                                        </h3>

                                        <h6 class="my-2 text-muted">
                                            <svg style="width: 10px; margin-bottom: 6px; fill: #db4739" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0z"></path></svg>
                                            {{$_legal_zip_code}} {{$_legal_city}}
                                        </h6>
                                    </div>
                                    <div class="col-5 d-lg-none mt-2">
                                    <span title="{{$content->created_at}}" >
                                            <svg style="fill: currentColor;width:15px;margin-bottom: 5px;margin-right: 3px;}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M112 0c8.8 0 16 7.2 16 16V64H320V16c0-8.8 7.2-16 16-16s16 7.2 16 16V64h32c35.3 0 64 28.7 64 64v32 32V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V192 160 128C0 92.7 28.7 64 64 64H96V16c0-8.8 7.2-16 16-16zM416 192H32V448c0 17.7 14.3 32 32 32H384c17.7 0 32-14.3 32-32V192zM384 96H64c-17.7 0-32 14.3-32 32v32H416V128c0-17.7-14.3-32-32-32z"/></svg>
                                        {{ $content->updated_at->diffForHumans() }}
                                        </span>
                                    </div>
                                    <div class="col-7 col-lg-2 text-end ">

                                        <span title="{{$content->created_at}}" class="d-none d-lg-block">
                                            <svg style="fill: currentColor;width:15px;margin-bottom: 5px;margin-right: 3px;}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M112 0c8.8 0 16 7.2 16 16V64H320V16c0-8.8 7.2-16 16-16s16 7.2 16 16V64h32c35.3 0 64 28.7 64 64v32 32V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V192 160 128C0 92.7 28.7 64 64 64H96V16c0-8.8 7.2-16 16-16zM416 192H32V448c0 17.7 14.3 32 32 32H384c17.7 0 32-14.3 32-32V192zM384 96H64c-17.7 0-32 14.3-32 32v32H416V128c0-17.7-14.3-32-32-32z"/></svg>
                                        {{ $content->updated_at->diffForHumans() }}
                                        </span>
                                        <a class="btn btn-primary btn-sm mt-2" href="{{$content->path}}" onclick="gtag('event', 'See Job', {'event_category' : 'Home', 'event_label' : ''});">
                                            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"></path>
                                            </svg>
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                @endforeach
            @else

                <div class="col-12 text-center" style="margin-bottom: 30vh; margin-top: 5vh;">
                    <script src="https://unpkg.com/@dotlottie/player-component@latest/dist/dotlottie-player.mjs" type="module"></script>
                    <dotlottie-player src="https://lottie.host/d5a4355a-7074-40b5-804a-28ed21d8b944/6ryk9g1wqN.lottie" background="transparent" speed="1" style="width: 200px; height: 200px; margin: 0 auto;" loop autoplay></dotlottie-player>
                    <i>
                        Derzeit keine offenen Stellen
                    </i>
                </div>

            @endif

        </div>
    </div>
@stop
