v1.5.23a - Fix of multiple events

This commit is contained in:
Anders 2021-05-11 12:47:44 +02:00
parent d1b083bae1
commit be09caaf34
5 changed files with 19 additions and 107 deletions

View File

@ -36,7 +36,7 @@ class MultipleEventsController extends Controller
*/
public function index()
{
$multiEvents = MultipleEventsParent::join("multiple_events", "multiple_events.multiple_events_parent_id", '=', 'multiple_events_parent.id')->groupBy('multiple_events_parent_id')->orderBy('multiple_events.date', 'desc')->selectRaw('multiple_events_parent.*, max(date) as date')->get();
$multiEvents = MultipleEventsParent::join("multiple_events", "multiple_events.multiple_events_parent_id", '=', 'multiple_events_parent.id')->groupBy('multiple_events.multiple_events_parent_id', 'multiple_events_parent.id', 'multiple_events_parent.week', 'multiple_events_parent.resource_id', 'multiple_events_parent.created_at', 'multiple_events_parent.updated_at')->selectRaw('multiple_events_parent.*, max(date) as date')->get();
return Response::detect("multiple-events.index", [ "multiEvents" => $multiEvents]);
}
@ -124,6 +124,23 @@ class MultipleEventsController extends Controller
return Response::detect("multiple-events.show", [ "week" => $multiEventParent->week, "multiEvents" => $multiEvents]);
}
/**
* Display signups for event.
*
* @param int $id
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function accountsignups(Request $request)
{
// Find every event you have clicked on. And find all users to that event, and the event name itself.
$events = UserEvent::join('users', 'users.id', '=', 'user_events.user_id')->where('multiple_event_id', $request->multiEvent)->select('user_events.*', 'users.name_first', 'users.name_last', 'users.phone')->get();
if (count($events) == 0)
$events = Event::where('id', $request->event)->get();
return Response::detect("multiple-events.signups", [ "multiEvent" => $events ]);
}
/**
* Show the form for editing the specified resource.-
*
@ -197,18 +214,6 @@ class MultipleEventsController extends Controller
return Response::detect("events.index", [ "events" => $events]);
}
public function accountsignups(Request $request)
{
// Find every event you have clicked on. And find all users to that event, and the event name itself.
$multiEvents = UserEvent::join('users', 'users.id', '=', 'user_events.user_id')->join('multiple_events', 'multiple_events.id', '=', 'user_events.multiple_event_id')->where('multiple_event_id', $request->multiEvent)->get();
if (count($multiEvents) == 0)
$multiEvents = Event::where('id', $request->event)->get();
return Response::detect("multiple-events.signups", [ "multiEvent" => $multiEvents ]);
}
/**
* Remove the specified resource from storage.
*

View File

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RemoveEvent extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
/*
public function up()
{
\Illuminate\Support\Facades\DB::unprepared("CREATE OR REPLACE EVENT `remove_event` ON SCHEDULE EVERY 1 HOUR STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO
DELETE FROM events WHERE HOUR(TIMEDIFF(NOW(), events.date)) >= 24 AND date(events.date) < CURDATE()");
}
*/
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RemoveNews extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
/*
public function up()
{
\Illuminate\Support\Facades\DB::unprepared("CREATE OR REPLACE EVENT `remove_news` ON SCHEDULE EVERY 1 HOUR STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO
DELETE FROM news WHERE news_expiration_date < NOW();");
}
*/
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RemoveReservation extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
/*
public function up()
{
\Illuminate\Support\Facades\DB::unprepared("CREATE OR REPLACE EVENT `remove_reservation` ON SCHEDULE EVERY 1 HOUR STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO
DELETE FROM washing_reservations WHERE time <= DATE_SUB(NOW(), INTERVAL 1 HOUR)");
}
*/
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -63,7 +63,7 @@
<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") onclick="ajaxMultiCall({{ $userevent->id }}, this)" @endif id="f">{{__('msg.tilmeld')}}</a>
@endif
<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>
<a class="sde-blue text-center m-none p-none bold" @if($key == "events") href="{{route("events.accountsignups", ["event" => $userevent->id ])}}" @elseif($key == "multiple") href="{{route("multiple-events.accountsignups", ["multiEvent" => $userevent->id])}}" @endif>{{__('msg.sedeltagere')}}</a>
</div>
</div>
</div>