2020-07-29 12:59:35 +00:00
|
|
|
|
@extends("app.layout.base")
|
|
|
|
|
@section("title")
|
|
|
|
|
Aktiviteter
|
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
|
|
@section("content")
|
2020-08-12 13:17:48 +00:00
|
|
|
|
<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>
|
|
|
|
|
|
2020-07-29 12:59:35 +00:00
|
|
|
|
<main>
|
2020-11-26 09:19:12 +00:00
|
|
|
|
<h1 class="text-center sde-blue mb-2rem">{{__('msg.tilmeldteaktiviteter')}}</h1>
|
2020-07-29 12:59:35 +00:00
|
|
|
|
{!! session()->get('eventunsubscribed') !!}
|
|
|
|
|
@if(!$userevents->isEmpty())
|
|
|
|
|
@foreach($userevents as $userevent)
|
|
|
|
|
<form method="post" action="{{ route("userevents.destroy", $userevent) }}">
|
|
|
|
|
@csrf
|
|
|
|
|
@method("delete")
|
2020-08-12 13:17:48 +00:00
|
|
|
|
<div class="card">
|
|
|
|
|
@if($userevent->resource_id !== null)
|
2020-11-26 09:19:12 +00:00
|
|
|
|
<div class="header bs-cover bp-center" style="background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $userevent->resource_id)->first()->filename) }}');">
|
|
|
|
|
<h3 class="event-text-shadow">{{ $userevent->name }}</h3>
|
|
|
|
|
<p class="event-text-shadow text-center mt-0">{{__('msg.af')}}: {{ $userevent->accountable }}</p>
|
|
|
|
|
<p class="event-text-shadow text-center mt-0">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($userevent->date))->format('d/m/Y \k\l\. H:i') }}</p>
|
2020-08-12 13:17:48 +00:00
|
|
|
|
</div>
|
|
|
|
|
@else
|
|
|
|
|
<div class="header">
|
|
|
|
|
<h3>{{ $userevent->name }}</h3>
|
|
|
|
|
<p class="text-center mt-0">{{__('msg.af')}}: {{ $userevent->accountable }}</p>
|
2020-08-14 07:03:15 +00:00
|
|
|
|
<p class="text-center mt-0">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($userevent->date))->format('d/m/Y \k\l\. H:i') }}</p>
|
2020-08-12 13:17:48 +00:00
|
|
|
|
</div>
|
|
|
|
|
@endif
|
|
|
|
|
<div class="container">
|
2020-11-26 09:19:12 +00:00
|
|
|
|
<div class="row justify-content-space">
|
2020-08-13 07:08:34 +00:00
|
|
|
|
@if (count(\App\UserEvent::query()->where('event_id', '=', $userevent->id)->where('user_id', '=', Auth::user()->id)->get()) > 0)
|
2020-11-26 09:19:12 +00:00
|
|
|
|
<a class="sde-blue text-center m-none p-none bold" href="javascript:void(0);" onclick="ajaxCall({{ $userevent->id }}, this)" id="t">{{__('msg.afmeld')}}</a>
|
2020-08-13 07:08:34 +00:00
|
|
|
|
@else {{-- ^ If you're already participating in the event, then show a ´cancel´ button - v Else show a ´participate´ button --}}
|
2020-11-26 09:19:12 +00:00
|
|
|
|
<a class="sde-blue text-center m-none p-none bold" href="javascript:void(0);" onclick="ajaxCall({{ $userevent->id }}, this)" >{{__('msg.tilmeld')}}</a>
|
2020-08-13 07:08:34 +00:00
|
|
|
|
@endif
|
2020-11-26 09:19:12 +00:00
|
|
|
|
<a class="sde-blue text-center m-none p-none bold" href="{{route("events.show", ["event" => $userevent->id ])}}">{{__('msg.læsmere')}}</a>
|
|
|
|
|
<a class="sde-blue text-center m-none p-none bold" href="{{route("events.accountsignups", ["event" => $userevent->id ])}}">{{__('msg.sedeltagere')}}</a>
|
2020-08-12 13:17:48 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-07-29 12:59:35 +00:00
|
|
|
|
</form>
|
|
|
|
|
@endforeach
|
|
|
|
|
@else
|
2020-08-06 18:33:46 +00:00
|
|
|
|
<p class="text-center">{{__('msg.duharikketilmeldtdignogenaktiviteter')}}!</p>
|
2020-07-29 12:59:35 +00:00
|
|
|
|
@endif
|
2020-11-26 09:19:12 +00:00
|
|
|
|
<a onclick="window.history.back()" type="submit" class="mt-auto btn text-center btn-sde-blue">{{__('msg.tilbage')}}</a>
|
2020-08-13 07:08:34 +00:00
|
|
|
|
<div id="snackbar"></div>
|
2020-07-29 12:59:35 +00:00
|
|
|
|
</main>
|
|
|
|
|
@endsection
|
2020-08-13 07:08:34 +00:00
|
|
|
|
@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);
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-13 09:39:10 +00:00
|
|
|
|
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;
|
2020-08-13 07:08:34 +00:00
|
|
|
|
|
2020-08-13 09:39:10 +00:00
|
|
|
|
snackbar(data);
|
2020-08-13 07:08:34 +00:00
|
|
|
|
|
2020-08-13 09:39:10 +00:00
|
|
|
|
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;
|
2020-08-13 07:08:34 +00:00
|
|
|
|
|
2020-08-13 09:39:10 +00:00
|
|
|
|
snackbar(data);
|
2020-08-13 07:08:34 +00:00
|
|
|
|
|
2020-08-13 09:39:10 +00:00
|
|
|
|
el.innerHTML = "{{__("msg.tilmeld")}}";
|
|
|
|
|
}).catch(function (error) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-08-13 07:08:34 +00:00
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
@endsection
|