v1.5.19b bad back and frontend work
This commit is contained in:
parent
125ea424e3
commit
574534fe2a
|
@ -23,7 +23,9 @@ class UserEventController extends Controller
|
||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$userevents = UserEvent::join('events', 'events.id', '=', 'user_events.event_id')->orderBY('date' , 'asc')->where('user_id', auth()->user()->id)->get();
|
$userevents = [];
|
||||||
|
$userevents['events'] = UserEvent::join('events', 'events.id', '=', 'user_events.event_id')->get();
|
||||||
|
$userevents['multiple'] = UserEvent::join('multiple_events', 'multiple_events.id', '=', 'user_events.multiple_event_id')->get();
|
||||||
|
|
||||||
return Response::detect("events.yourevents", [ "userevents" => $userevents ]);
|
return Response::detect("events.yourevents", [ "userevents" => $userevents ]);
|
||||||
}
|
}
|
||||||
|
@ -154,7 +156,7 @@ class UserEventController extends Controller
|
||||||
|
|
||||||
// Check the UserEvent table if there is a row that has the user_id AND the event_id
|
// Check the UserEvent table if there is a row that has the user_id AND the event_id
|
||||||
$getTableInfo = UserEvent::where('user_id', auth()->user()->id)
|
$getTableInfo = UserEvent::where('user_id', auth()->user()->id)
|
||||||
->where('multiple_event_id', $request->multiple_events_id)->get();
|
->where('multiple_event_id', $request->multiple_event_id)->get();
|
||||||
|
|
||||||
// If the row has both, then go back and show an error - Cause you're not allowed to be on the same event twice.
|
// If the row has both, then go back and show an error - Cause you're not allowed to be on the same event twice.
|
||||||
if (count($getTableInfo) > 0) {
|
if (count($getTableInfo) > 0) {
|
||||||
|
|
|
@ -35,8 +35,10 @@
|
||||||
<main>
|
<main>
|
||||||
<h1 class="text-center sde-blue mb-2rem">{{__('msg.tilmeldteaktiviteter')}}</h1>
|
<h1 class="text-center sde-blue mb-2rem">{{__('msg.tilmeldteaktiviteter')}}</h1>
|
||||||
{!! session()->get('eventunsubscribed') !!}
|
{!! session()->get('eventunsubscribed') !!}
|
||||||
@if(!$userevents->isEmpty())
|
@if(!$userevents['events']->isEmpty() || !$userevents['multiple']->isEmpty())
|
||||||
@foreach($userevents as $userevent)
|
@foreach($userevents as $key => $allevents)
|
||||||
|
@foreach($allevents as $userevent)
|
||||||
|
{{ $key }}
|
||||||
<form method="post" action="{{ route("userevents.destroy", $userevent) }}">
|
<form method="post" action="{{ route("userevents.destroy", $userevent) }}">
|
||||||
@csrf
|
@csrf
|
||||||
@method("delete")
|
@method("delete")
|
||||||
|
@ -57,7 +59,7 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row justify-content-space">
|
<div class="row justify-content-space">
|
||||||
@if (count(\App\UserEvent::query()->where('event_id', '=', $userevent->id)->where('user_id', '=', Auth::user()->id)->get()) > 0)
|
@if (count(\App\UserEvent::query()->where('event_id', '=', $userevent->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({{ $userevent->id }}, this)" id="t">{{__('msg.afmeld')}}</a>
|
<a class="sde-blue text-center m-none p-none bold" href="javascript:void(0);" @if($key == "events") onclick="ajaxCall({{ $userevent->id }}, this)" @elseif($key == "multiple") @endif 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 --}}
|
@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({{ $userevent->id }}, this)" >{{__('msg.tilmeld')}}</a>
|
<a class="sde-blue text-center m-none p-none bold" href="javascript:void(0);" onclick="ajaxCall({{ $userevent->id }}, this)" >{{__('msg.tilmeld')}}</a>
|
||||||
@endif
|
@endif
|
||||||
|
@ -68,6 +70,7 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
@endforeach
|
||||||
@else
|
@else
|
||||||
<p class="text-center">{{__('msg.duharikketilmeldtdignogenaktiviteter')}}!</p>
|
<p class="text-center">{{__('msg.duharikketilmeldtdignogenaktiviteter')}}!</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
Loading…
Reference in New Issue