@extends("app.layout.base")

@section("title")
    Vejledninger
@endsection

@section("content")
    <style>
        div.card {
            margin-top: 1rem;
            margin-bottom: 30px;
            width: auto;
            heigt: auto;
            box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
        }

        div.header {
            background-color: #00788a;
            color: white;
            padding: 8px;
            font-size: 10px;
            text-align: center;
        }

        div.container {
            padding: 8px;
            text-align: justify;
            line-height: 1.5;
        }

        ol {
            padding-right: 8px;
        }
    </style>
    <main style="min-height: calc(100% - 61.34px);">
        <h1 class="text-center sde-blue mt-0" style="margin-bottom: 2rem;">{{__('msg.vejledning')}}</h1>
        @if(!$guides->isEmpty())
            @foreach($guides as $guide)
                <div class="card">
                    @if($guide->resource_id !== null)
                        <div class="header" style="background-size: cover; background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $guide->resource_id)->first()->filename) }}');">
                        <h3 style="text-shadow: 2px 2px 2px #00788A;">{{ $guide->name}}</h3>
                    </div>
                    @else
                        <div class="header">
                            <h3>{{ $guide->name}}</h3>
                        </div>
                    @endif
                    <div class="container">
                        {!! \App\Helpers::closetags(substr($guide->guide_articles, 0, 300)) !!}
                        <div class="row" style="justify-content: center;">
                            <a style="margin: 0; padding: 0; text-align: center; font-weight: 700;" class="sde-blue" href="{{route("guides.show", ["guide" => $guide->id ])}}">{{__('msg.læsmere')}}</a>
                        </div>
                    </div>
                </div>
            @endforeach
        @else
            <p style="margin: 0 18px; margin-bottom: auto; text-align: center">{{__('msg.dereringenvejledninger')}}.</p>
        @endif
        <button onclick="window.history.back()" style="margin-top: auto;" class="btn btn-sde-blue text-white mb-1 mt-1" >{{__('msg.tilbage')}}</button>
    </main>
@endsection