Ekapp/skolehjem/resources/views/app/guides/index.blade.php

111 lines
4.5 KiB
PHP
Raw Normal View History

@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;
}
input, select {
/* margin-bottom: 0;*/
}
.select2-container--default .select2-results>.select2-results__options {
max-height: 120px !important;
}
</style>
<script src="{{ asset("/js/jquery-3.2.1.min.js") }}"></script>
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/js/select2.min.js"></script>
<script>
// In your Javascript (external .js resource or <script> tag)
$(document).ready(function() {
$('.js-example-basic-single').select2();
});
</script>
2020-08-11 07:13:48 +00:00
<main style="min-height: calc(100% - 61.34px);">
2020-08-11 11:16:54 +00:00
<h1 class="text-center sde-blue mt-0" style="margin-bottom: 2rem;">{{__('msg.vejledning')}}</h1>
@if(!$guides->isEmpty())
@if (count(\App\GuidesCategory::query()->get()) > 1)
<h4 class="mt-0 mb-0">{{ __("msg.kategorier") }}</h4>
<select id="categorySelect" class="js-example-basic-single" name="state" style="margin-bottom: 2rem !important;">
<option value="All" selected>{{ __("msg.allekategorier") }}</option>
@foreach (\App\GuidesCategory::query()->get() as $Category)
<option value="{{ $Category->id }}">{{ $Category->guidesCategoryName }}</option>
@endforeach
</select>
@endif
<div id="main">
@foreach($guides as $guide)
<div class="card">
@if($guide->resource_id !== null)
<div class="header" style="background-size: cover; background-position: center; 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">
@php $tags = [ '<p>', '<b>', '<em>', '<a>', '<u>', '<s>', '<sub>', '<ul>', '<li>', '<sup>', '<div>', '<blockquote>', '<ol>', '<strong>', '<br>', '<h1>', '<h2>', '<h3>', '<h4>', '<h5>', '<h6>', '<h7>', '<span>'] @endphp
{!! \App\Helpers::closetags(substr(strip_tags($guide->guide_articles, $tags), 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
</div>
@else
2020-08-11 07:55:01 +00:00
<p style="margin: 0 18px; margin-bottom: auto; text-align: center">{{__('msg.dereringenvejledninger')}}.</p>
2020-08-05 05:51:30 +00:00
@endif
2020-08-11 07:13:48 +00:00
<button onclick="window.history.back()" style="margin-top: auto;" class="btn btn-sde-blue text-white mb-1 mt-1" >{{__('msg.tilbage')}}</button>
</main>
<script>
$('#categorySelect').on('change', function () {
$value = $(this).val();
$.ajax({
type: 'get',
url: '{{ route("guides.showCategory") }}',
data: { 'category':$value },
success:function (data) {
$('#main').html(data);
},
error:function (data) {
console.log(data);
}
});
})
</script>
@endsection