v1.5.15 Added multiple events, not done
This commit is contained in:
@@ -0,0 +1,161 @@
|
||||
@extends("app.layout.base")
|
||||
@section("title")
|
||||
Ugenlige aktiviteter
|
||||
@endsection
|
||||
|
||||
@section("content")
|
||||
<style>
|
||||
iframe, .ql-video {
|
||||
width: 100%;
|
||||
}
|
||||
div.card {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 30px;
|
||||
width: auto;
|
||||
heigt: auto;
|
||||
|
||||
}
|
||||
div.container {
|
||||
padding: 8px;
|
||||
text-align: justify;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.header > img {
|
||||
border-radius: 2px 2px 2px 2px
|
||||
}
|
||||
/*Alert box*/
|
||||
.alert {
|
||||
opacity: 0.8;
|
||||
padding: 20px;
|
||||
background-color: #00788A;
|
||||
color: white;
|
||||
border-radius: 10px;
|
||||
background: linear-gradient(to right, red, purple);
|
||||
}
|
||||
.closebtn {
|
||||
margin-left: 15px;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
float: right;
|
||||
font-size: 22px;
|
||||
line-height: 20px;
|
||||
cursor: pointer;
|
||||
transition: 0.3s;
|
||||
}
|
||||
.closebtn:hover {
|
||||
color: black;
|
||||
}
|
||||
alertBoxBackground {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 30px;
|
||||
width: auto;
|
||||
heigt: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<main>
|
||||
<h1 class="text-center sde-blue mb-2rem">{{ __('msg.ugentligaktiviteter') }}</h1>
|
||||
<!--Alert box, display when a event is delete: start-->
|
||||
@if(count(\App\Notification::query()->where("user_id", "=", auth()->user()->id)->get()) > 0)
|
||||
<div class="alertBoxBackground" id="notifications">
|
||||
<div class="alert">
|
||||
<span class="closebtn" onclick="deleteNotifications(document.getElementById('notifications'))">×</span>
|
||||
<strong>{{__('msg.aktivitetaflyst')}}</strong>
|
||||
@foreach(\App\Notification::query()->where("user_id", "=", auth()->user()->id)->get() as $notification)
|
||||
<p>{{ $notification->message }}{{ __("msg.canceled") }}</p>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<!--Alert box, display when a event is delete: end -->
|
||||
|
||||
<!--If there is a images to the event do this: Start-->
|
||||
@if(!$multiEvents->isEmpty())
|
||||
@foreach($multiEvents as $event)
|
||||
<div class="card">
|
||||
@if($event->resource_id !== null)
|
||||
<div class="header">
|
||||
<img class="w-100" src="{{ asset(\App\Resource::query()->where("id", "=", $event->resource_id)->first()->filename) }}">
|
||||
</div>
|
||||
@endif
|
||||
<div class="container" class="mt-1">
|
||||
<p class="m-none">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($event->date))->format('d/m/Y \k\l\. H:i') }}</p>
|
||||
<h4 class="m-none">{{ $event->week }}</h4>
|
||||
<div class="row justify-content-space mt-1">
|
||||
@if (count(\App\UserEvent::query()->where('event_id', '=', $event->id)->where('user_id', '=', Auth::user()->id)->get()) > 0)
|
||||
<a class="sde-blue text-center m-none p-none bold" href="javascript:void(0);" onclick="ajaxCall({{ $event->id }}, this)" >{{__('msg.afmeld')}}</a>
|
||||
@else {{-- ^ If you're already participating in the event, then show a ´cancel´ button - v Else show a ´participate´ button --}}
|
||||
<a class="sde-blue text-center m-none p-none bold" href="javascript:void(0);" onclick="ajaxCall({{ $event->id }}, this)" >{{__('msg.tilmeld')}}</a>
|
||||
@endif
|
||||
<a class="sde-blue text-center m-none p-none bold" href="{{route("events.show", ["event" => $event->id ])}}">{{__('msg.læsmere')}}</a>
|
||||
<a class="sde-blue text-center m-none p-none bold" href="{{route("events.accountsignups", ["event" => $event->id ])}}">{{__('msg.sedeltagere')}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@else
|
||||
<p class="text-center mb-auto">{{__('msg.dereringenaktiviteter')}}!</p>
|
||||
@endif
|
||||
<a href="{{ route("userevents.index") }}" class="mt-auto btn text-center btn-sde-blue" id="tilmeld">{{__('msg.setilmeldteaktiviteter')}}</a>
|
||||
<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, el) {
|
||||
if(el.innerHTML === "{{__("msg.tilmeld")}}") {
|
||||
axios.post("{{ route("userevents.createajax") }}",
|
||||
{
|
||||
event_id: event_id
|
||||
}
|
||||
).then(function (response) {
|
||||
var data = response.data;
|
||||
|
||||
snackbar(data);
|
||||
|
||||
el.innerHTML = "{{__("msg.afmeld")}}";
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
} else if(el.innerHTML === "{{__("msg.afmeld")}}"){
|
||||
axios.post("{{ route("userevents.createajaxcancel") }}",
|
||||
{
|
||||
event_id: event_id
|
||||
}
|
||||
).then(function (response) {
|
||||
var data = response.data;
|
||||
|
||||
snackbar(data);
|
||||
|
||||
el.innerHTML = "{{__("msg.tilmeld")}}";
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function deleteNotifications(el) {
|
||||
el.remove();
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
setMain();
|
||||
axios({
|
||||
method: 'delete',
|
||||
url: '{{route("notifications.delete")}}',
|
||||
data: {
|
||||
user_id: {{ auth()->user()->id }}
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
<div class="title">{{ $new->subname }}
|
||||
<span class="createdat">{{__('msg.opret')}}{{ date('Y-m-d H:i:s', strtotime($new->created_at))}}</span>
|
||||
</div>
|
||||
@if($new->resource_id !== null)
|
||||
@if($new->resource_id !== null)<!--No resource_id-->
|
||||
<div class="header" style="background-size: cover; background-position: center; background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');"></div>
|
||||
<div class="information">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime(\App\Event::query()->where('id', '=', $new->arrangement_id)->first()->date))->format('d/m/Y \k\l\. H:i') }} <span class="dot"></span> {{\App\Event::query()->where('id', '=', $new->arrangement_id)->first()->accountable}} </div>
|
||||
<div class="container">
|
||||
@@ -181,7 +181,7 @@
|
||||
<a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="{{route("events.accountsignups", ["event" => $new->arrangement_id ])}}">{{__('msg.sedeltagere')}}</a>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
@else <!--Has resource_id-->
|
||||
<div class="container">
|
||||
{!! \App\Helpers::closetags(substr($new->content, 0, 300) ) !!}
|
||||
<div class="information2">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime(\App\Event::query()->where('id', '=', $new->arrangement_id)->first()->date))->format('d/m/Y \k\l\. H:i') }} <span class="dot"></span> {{\App\Event::query()->where('id', '=', $new->arrangement_id)->first()->accountable}} </div>
|
||||
@@ -197,7 +197,7 @@
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@else<!--Code that prints guides-->
|
||||
@elseif($new->type == 'Guide')<!--Code that prints guides-->
|
||||
<div class="card">
|
||||
<div class="img"><a href="{{ route('guides.index') }}"><img src="{{URL::asset('/images/icons/Vejledninger.svg')}}" alt="Vejledninger:"></a></div>
|
||||
<div class="title">{{ $new->subname }}
|
||||
@@ -207,7 +207,6 @@
|
||||
<div class="header bs-cover bp-center" style="background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');"></div>
|
||||
<div class="information">{{__('msg.kategori')}} <span class="dot"></span> {{\App\GuidesCategory::query()->where('id', '=', \App\Guide::query()->where('id','=', $new->arrangement_id)->first()->guide_category_id)->first()->guidesCategoryName}}</div>
|
||||
@endif
|
||||
|
||||
<div class="container" style="margin-top: 8px;">
|
||||
@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($new->content, $tags), 0, 300)) !!}
|
||||
@@ -218,8 +217,29 @@
|
||||
@endif {{-- Else if it's a menu or news, then don't show a button at bottom --}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!---->
|
||||
@elseif($new->type == 'MultipleEvent')
|
||||
<div class="card">
|
||||
<div class="img"><a href="{{ route('guides.index') }}"><img src="{{URL::asset('/images/icons/Aktiviteter.svg')}}" alt="Vejledninger:"></a></div>
|
||||
<div class="title">Ugenlig aktiviteter for uge {{ $new->subname }}
|
||||
<span class="createdat">{{__('msg.opret')}}{{ date('Y-m-d H:i:s', strtotime($new->created_at))}}</span>
|
||||
</div>
|
||||
@if($new->resource_id !== null)
|
||||
<div class="header bs-cover bp-center" style="background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $new->resource_id)->first()->filename) }}');"></div>
|
||||
<div class="information">{{__('msg.kategori')}} <span class="dot"></span> {{\App\GuidesCategory::query()->where('id', '=', \App\Guide::query()->where('id','=', $new->arrangement_id)->first()->guide_category_id)->first()->guidesCategoryName}}</div>
|
||||
@endif
|
||||
<div class="container" style="margin-top: 8px;">
|
||||
@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($new->content, $tags), 0, 300)) !!}
|
||||
<div class="row" style="justify-content: center; padding-top: 12px; border-top: 1px solid rgba(0, 0, 0, .2);">
|
||||
<a style="font-weight: 700;" href="{{route("guides.show", ["guide" => $new->arrangement_id])}}" class="sde-blue">{{__('msg.læsmere')}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
|
||||
@endforeach
|
||||
@if(count(\App\News::query()->orderBy("created_at", "desc")->get()) == 0)
|
||||
<p class="text-center">{{__('msg.ingennyheder')}}</p>
|
||||
|
||||
Reference in New Issue
Block a user