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

80 lines
2.5 KiB
PHP

@extends("app.layout.base")
@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="justify-content: unset;">
@foreach(\App\News::query()->orderBy("created_at", "desc")->get() as $new)
<div class="card">
@if($new->resource_id !== null)
<div class="header" style="background-size: cover; background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');">
<p style="text-shadow: 2px 2px 2px #00078A;"><b>{{ $new->name }}</b></p>
<h3 style="text-shadow: 2px 2px 2px #00078A;">{{ $new->subname }}</h3>
</div>
@else
<div class="header">
<p><b>{{ $new->name }}</b></p>
<h3>{{ $new->subname }}</h3>
</div>
@endif
<div class="container">
{!! $new->content !!}
</div>
</div>
@endforeach
@if(count(\App\News::query()->orderBy("created_at", "desc")->get()) == 0)
<p class="text-center">{{__('msg.ingennyheder')}}</p>
@endif
<div id="snackbar"></div>
</main>
@endsection
@section("scripts")
<script type="text/javascript">
function snackbar(data) {
var x = document.getElementById("snackbar");
x.innerHTML = data;
x.className = "show";
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
}
function ajaxCall(event_id) {
axios.post("{{ route("userevents.createajax") }}",
{
event_id: event_id
}
).then(function (response) {
var data = response.data;
snackbar(data);
}).catch(function (error) {
console.log(error);
});
}
</script>
@endsection