v0.9.4 - Added remove function to feedback admin page
Added - You can now see if you're participating an event on event.index and yourevents.blade.php Fixed `Tilbage` buttons
This commit is contained in:
@@ -36,38 +36,85 @@
|
||||
<h1 class="text-center sde-blue mb-0" style="margin-bottom: 2rem">{{ __('msg.aktiviteter') }}</h1>
|
||||
@if(!$events->isEmpty())
|
||||
@foreach($events as $event)
|
||||
<form method="get" action="{{ route("userevents.create") }}" id="form{{$event->id}}">
|
||||
<div class="card">
|
||||
@if($event->resource_id !== null)
|
||||
<div class="header" style="background-size: cover; background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $event->resource_id)->first()->filename) }}');">
|
||||
<h3 style="text-shadow: 2px 2px 2px #00078A;">{{ $event->name }}</h3>
|
||||
<p style="text-shadow: 2px 2px 2px #00078A"; class="text-center mt-0">{{__('msg.af')}}: {{ $event->accountable }}</p>
|
||||
<p style="text-shadow: 2px 2px 2px #00078A"; class="text-center mt-0">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($event->date))->format('d/m/Y \k\l\. H:i') }}</p>
|
||||
<div class="card">
|
||||
@if($event->resource_id !== null)
|
||||
<div class="header" style="background-size: cover; background-image: url('{{ asset(\App\Resource::query()->where("id", "=", $event->resource_id)->first()->filename) }}');">
|
||||
<h3 style="text-shadow: 2px 2px 2px #00078A;">{{ $event->name }}</h3>
|
||||
<p style="text-shadow: 2px 2px 2px #00078A"; class="text-center mt-0">{{__('msg.af')}}: {{ $event->accountable }}</p>
|
||||
<p style="text-shadow: 2px 2px 2px #00078A"; class="text-center mt-0">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($event->date))->format('d/m/Y \k\l\. H:i') }}</p>
|
||||
</div>
|
||||
@else
|
||||
<div class="header">
|
||||
<h3>{{ $event->name }}</h3>
|
||||
<p class="text-center mt-0">Af: {{ $event->accountable }}</p>
|
||||
<p class="text-center mt-0">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($event->date))->format('d/m/Y \k\l\. H:i') }}</p>
|
||||
</div>
|
||||
@else
|
||||
<div class="header">
|
||||
<h3>{{ $event->name }}</h3>
|
||||
<p class="text-center mt-0">Af: {{ $event->accountable }}</p>
|
||||
<p class="text-center mt-0">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($event->date))->format('d/m/Y \k\l\. H:i') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
<div class="container" style="margin-top: 8px;">
|
||||
{!! \App\Helpers::closetags(substr($event->description, 0, 300) )!!}
|
||||
<input type="hidden" name="event_id" value="{{ $event->id }}">
|
||||
{!! session()->get('error#' . $event->id) !!}
|
||||
{!! session()->get('signup#' . $event->id) !!}
|
||||
<div class="row" style="justify-content: space-between; margin-top: 16px;">
|
||||
<a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="javascript:;" onclick="document.getElementById('form{{$event->id}}').submit();" >{{__('msg.tilmeld')}}</a>
|
||||
<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>
|
||||
</div>
|
||||
@endif
|
||||
<div class="container" style="margin-top: 8px;">
|
||||
{!! \App\Helpers::closetags(substr($event->description, 0, 300) )!!}
|
||||
<input type="hidden" name="event_id" value="{{ $event->id }}">
|
||||
{!! session()->get('error#' . $event->id) !!}
|
||||
{!! session()->get('signup#' . $event->id) !!}
|
||||
<div class="row" style="justify-content: space-between; margin-top: 16px;">
|
||||
@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="ajaxCallCancel({{ $event->id }})" >{{__('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 }})" >{{__('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>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@endforeach
|
||||
@else
|
||||
<p class="text-center" style="margin-bottom: auto">{{__('msg.dereringenaktiviteter')}}!</p>
|
||||
@endif
|
||||
<a href="{{ route("userevents.index") }}" style="margin-top: auto" class="mt-2 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) {
|
||||
|
||||
axios.post("{{ route("userevents.createajax") }}",
|
||||
{
|
||||
event_id: event_id
|
||||
}
|
||||
).then(function (response) {
|
||||
var data = response.data;
|
||||
|
||||
snackbar(data);
|
||||
setTimeout(function(){document.location.reload(false)}, 2000);
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
function ajaxCallCancel(event_id) {
|
||||
|
||||
axios.post("{{ route("userevents.createajaxcancel") }}",
|
||||
{
|
||||
event_id: event_id
|
||||
}
|
||||
).then(function (response) {
|
||||
var data = response.data;
|
||||
|
||||
snackbar(data);
|
||||
setTimeout(function(){document.location.reload(false)}, 2000);
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
|
||||
@@ -57,7 +57,11 @@
|
||||
<div class="container">
|
||||
{!! \App\Helpers::closetags(substr($userevent->description, 0, 300) )!!}
|
||||
<div class="row" style="justify-content: space-between;">
|
||||
<a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="javascript:;" onclick="return confirm('Are you sure you want to remove this event?');" >{{__('msg.afmeld')}}</a>
|
||||
@if (count(\App\UserEvent::query()->where('event_id', '=', $userevent->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="ajaxCallCancel({{ $userevent->id }})" id="t">{{__('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({{ $userevent->id }})" >{{__('msg.tilmeld')}}</a>
|
||||
@endif
|
||||
<a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="{{route("events.show", ["event" => $userevent->id ])}}">{{__('msg.læsmere')}}</a>
|
||||
<a style="margin: 0; padding: 0; font-weight: 700;" class="sde-blue text-center" href="{{route("events.accountsignups", ["event" => $userevent->id ])}}">{{__('msg.sedeltagere')}}</a>
|
||||
</div>
|
||||
@@ -68,6 +72,50 @@
|
||||
@else
|
||||
<p class="text-center">{{__('msg.duharikketilmeldtdignogenaktiviteter')}}!</p>
|
||||
@endif
|
||||
<a href="{{ route("events.index") }}" type="submit" style="margin-top: auto" class="mt-2 btn text-center btn-sde-blue">{{__('msg.tilbage')}}</a>
|
||||
<a onclick="window.history.back()" type="submit" style="margin-top: auto" class="mt-2 btn text-center btn-sde-blue">{{__('msg.tilbage')}}</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) {
|
||||
|
||||
axios.post("{{ route("userevents.createajax") }}",
|
||||
{
|
||||
event_id: event_id
|
||||
}
|
||||
).then(function (response) {
|
||||
var data = response.data;
|
||||
|
||||
snackbar(data);
|
||||
setTimeout(function(){document.location.reload(false)}, 2000);
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
function ajaxCallCancel(event_id) {
|
||||
|
||||
axios.post("{{ route("userevents.createajaxcancel") }}",
|
||||
{
|
||||
event_id: event_id
|
||||
}
|
||||
).then(function (response) {
|
||||
var data = response.data;
|
||||
|
||||
snackbar(data);
|
||||
setTimeout(function(){document.location.reload(false)}, 2000);
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user