2020-06-26 06:56:18 +00:00
|
|
|
|
@extends("app.layout.base")
|
|
|
|
|
@section("title")
|
|
|
|
|
Aktiviteter
|
|
|
|
|
@endsection
|
|
|
|
|
|
|
|
|
|
@section("content")
|
2020-08-10 11:26:48 +00:00
|
|
|
|
<style>
|
2020-08-26 08:49:11 +00:00
|
|
|
|
iframe, .ql-video {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
2020-08-10 11:26:48 +00:00
|
|
|
|
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);
|
2020-11-26 10:26:28 +00:00
|
|
|
|
border-radius: 10px;
|
2020-08-10 11:26:48 +00:00
|
|
|
|
}
|
|
|
|
|
div.container {
|
|
|
|
|
padding: 8px;
|
|
|
|
|
text-align: justify;
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
}
|
2020-11-26 10:26:28 +00:00
|
|
|
|
.header > img {
|
|
|
|
|
border-radius: 10px 10px 0px 0px
|
2020-08-10 11:26:48 +00:00
|
|
|
|
}
|
2020-08-31 12:28:15 +00:00
|
|
|
|
/*Alert box*/
|
|
|
|
|
.alert {
|
2020-09-02 10:32:30 +00:00
|
|
|
|
opacity: 0.8;
|
2020-08-31 12:28:15 +00:00
|
|
|
|
padding: 20px;
|
2020-09-02 10:32:30 +00:00
|
|
|
|
background-color: #00788A;
|
2020-08-31 12:28:15 +00:00
|
|
|
|
color: white;
|
|
|
|
|
border-radius: 10px;
|
2020-10-15 09:14:29 +00:00
|
|
|
|
background: linear-gradient(to right, red, purple);
|
2020-08-31 12:28:15 +00:00
|
|
|
|
}
|
|
|
|
|
.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;
|
|
|
|
|
}
|
2020-08-10 11:26:48 +00:00
|
|
|
|
</style>
|
|
|
|
|
|
2020-06-26 06:56:18 +00:00
|
|
|
|
<main>
|
2020-11-26 09:19:12 +00:00
|
|
|
|
<h1 class="text-center sde-blue mb-2rem">{{ __('msg.aktiviteter') }}</h1>
|
2020-10-14 07:07:13 +00:00
|
|
|
|
<!--Alert box, display when a event is delete: start-->
|
2020-08-14 05:36:42 +00:00
|
|
|
|
@if(count(\App\Notification::query()->where("user_id", "=", auth()->user()->id)->get()) > 0)
|
2020-08-31 12:28:15 +00:00
|
|
|
|
<div class="alertBoxBackground" id="notifications">
|
|
|
|
|
<div class="alert">
|
|
|
|
|
<span class="closebtn" onclick="deleteNotifications(document.getElementById('notifications'))">×</span>
|
2020-10-15 09:14:29 +00:00
|
|
|
|
<strong>{{__('msg.aktivitetaflyst')}}</strong>
|
2020-08-14 05:36:42 +00:00
|
|
|
|
@foreach(\App\Notification::query()->where("user_id", "=", auth()->user()->id)->get() as $notification)
|
|
|
|
|
<p>{{ $notification->message }}{{ __("msg.canceled") }}</p>
|
|
|
|
|
@endforeach
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@endif
|
2020-10-14 07:07:13 +00:00
|
|
|
|
<!--Alert box, display when a event is delete: end -->
|
|
|
|
|
|
|
|
|
|
<!--If there is a images to the event do this: Start-->
|
2020-07-01 09:44:14 +00:00
|
|
|
|
@if(!$events->isEmpty())
|
|
|
|
|
@foreach($events as $event)
|
2020-08-13 07:08:34 +00:00
|
|
|
|
<div class="card">
|
|
|
|
|
@if($event->resource_id !== null)
|
|
|
|
|
<div class="header">
|
2020-11-26 10:26:28 +00:00
|
|
|
|
<img class="w-100" src="{{ asset(\App\Resource::query()->where("id", "=", $event->resource_id)->first()->filename) }}">
|
2020-08-10 11:26:48 +00:00
|
|
|
|
</div>
|
2020-08-13 07:08:34 +00:00
|
|
|
|
@endif
|
2020-11-26 09:19:12 +00:00
|
|
|
|
<div class="container" class="mt-1">
|
2020-11-26 10:26:28 +00:00
|
|
|
|
<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->name }}</h4>
|
|
|
|
|
<p class="mt-0">{{__('msg.af')}}: {{ $event->accountable }}</p>
|
2020-11-26 09:19:12 +00:00
|
|
|
|
<div class="row justify-content-space mt-1">
|
2020-08-13 07:08:34 +00:00
|
|
|
|
@if (count(\App\UserEvent::query()->where('event_id', '=', $event->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({{ $event->id }}, this)" >{{__('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({{ $event->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" => $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>
|
2020-08-10 11:26:48 +00:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2020-08-13 07:08:34 +00:00
|
|
|
|
</div>
|
2020-07-01 09:44:14 +00:00
|
|
|
|
@endforeach
|
|
|
|
|
@else
|
2020-11-26 09:19:12 +00:00
|
|
|
|
<p class="text-center mb-auto">{{__('msg.dereringenaktiviteter')}}!</p>
|
2020-07-01 09:44:14 +00:00
|
|
|
|
@endif
|
2020-11-26 09:19:12 +00:00
|
|
|
|
<a href="{{ route("userevents.index") }}" class="mt-auto btn text-center btn-sde-blue" id="tilmeld">{{__('msg.setilmeldteaktiviteter')}}</a>
|
2020-08-13 07:08:34 +00:00
|
|
|
|
<div id="snackbar"></div>
|
2020-06-26 06:56:18 +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
|
|
|
|
}
|
2020-08-14 05:36:42 +00:00
|
|
|
|
|
|
|
|
|
function deleteNotifications(el) {
|
|
|
|
|
el.remove();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.onload = function () {
|
|
|
|
|
setMain();
|
|
|
|
|
axios({
|
|
|
|
|
method: 'delete',
|
|
|
|
|
url: '{{route("notifications.delete")}}',
|
|
|
|
|
data: {
|
|
|
|
|
user_id: {{ auth()->user()->id }}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
2020-08-13 07:08:34 +00:00
|
|
|
|
</script>
|
|
|
|
|
@endsection
|
|
|
|
|
|