v0.9.13 - Added notifications in events, when an event you're signed up to gets canceled.

This commit is contained in:
frederikpyt
2020-08-14 07:36:42 +02:00
parent bd0d504ab8
commit 9e0f449bd3
8 changed files with 98 additions and 13 deletions
+2 -1
View File
@@ -58,7 +58,8 @@ return[
"af" => "Af",
"programmedby" => "Programmeret af",
"error" => "Fejl",
"404" => "Denne side findes ikke."
"404" => "Denne side findes ikke.",
"canceled" => "Aflyst"
+2 -1
View File
@@ -67,5 +67,6 @@ return[
"af" => "By",
"programmedby" => "Programmed by",
"error" => "Error",
"404" => "This page doesn't exist."
"404" => "This page doesn't exist.",
"canceled" => "Canceled"
];
@@ -34,6 +34,18 @@
<main>
<h1 class="text-center sde-blue mb-0" style="margin-bottom: 2rem">{{ __('msg.aktiviteter') }}</h1>
@if(count(\App\Notification::query()->where("user_id", "=", auth()->user()->id)->get()) > 0)
<div class="card" id="notifications">
<div class="container" style="margin-top: 8px;">
<button style="margin-left: calc(100% - 1rem - 8px); border-radius: 50%; background-color: #00788a; color: white; border: 1px solid grey;" onclick="deleteNotifications(document.getElementById('notifications'))">X</button>
@foreach(\App\Notification::query()->where("user_id", "=", auth()->user()->id)->get() as $notification)
<p>{{ $notification->message }}{{ __("msg.canceled") }}</p>
@endforeach
</div>
</div>
@endif
@if(!$events->isEmpty())
@foreach($events as $event)
<div class="card">
@@ -59,7 +71,7 @@
@if (count(\App\UserEvent::query()->where('event_id', '=', $event->id)->where('user_id', '=', Auth::user()->id)->get()) > 0)
<a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" 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 style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="javascript:void(0);" onclick="ajaxCall({{ $event->id }}, this)" >{{__('msg.tilmeld')}}</a>
<a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="javascript:void(0);" onclick="ajaxCall({{ $event->id }}, this)" >{{__('msg.tilmeld')}}</a>
@endif
<a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="{{route("events.show", ["event" => $event->id ])}}">{{__('msg.læsmere')}}</a>
<a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="{{route("events.accountsignups", ["event" => $event->id ])}}">{{__('msg.sedeltagere')}}</a>
@@ -115,6 +127,21 @@
});
}
}
function deleteNotifications(el) {
el.remove();
}
window.onload = function () {
setMain();
axios({
method: 'delete',
url: '{{route("notifications.delete")}}',
data: {
user_id: {{ auth()->user()->id }}
}
});
};
</script>
@endsection
@@ -67,6 +67,6 @@
@endif
@endforeach
</table>
<button onclick="window.history.back();" style="margin-top: auto; margin-bottom: 8px;" class="btn btn-sde-blue text-white">{{ __('msg.tilbage') }}</button>
<button onclick="document.location = document.referrer;" style="margin-top: auto; margin-bottom: 8px;" class="btn btn-sde-blue text-white">{{ __('msg.tilbage') }}</button>
</main>
@endsection