Merge branch 'master' of https://github.com/sebathefox/skolehjem-webapp into master
This commit is contained in:
commit
f5e3e0c6e0
|
@ -33,7 +33,12 @@ class EventController extends Controller
|
|||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
DB::table('events')->where('date', '<=', date('Y-m-d H:i', strtotime('-1 day')))->delete();
|
||||
DB::table('user_events')
|
||||
->where('event_id')
|
||||
->delete();
|
||||
DB::table('events')
|
||||
->where('events.date', '<=', date('Y-m-d H:i', strtotime('-1 day')))
|
||||
->delete();
|
||||
|
||||
$events = Event::query()->orderBY('date' , 'asc')->paginate($request->input("limit", 20));
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ use App\WashingReservation;
|
|||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\View\View;
|
||||
|
||||
date_default_timezone_set('Europe/Copenhagen');
|
||||
|
||||
class WashingReservationController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
|
@ -37,6 +39,8 @@ class WashingReservationController extends Controller
|
|||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
WashingReservation::query()->where('time', '<', date('Y-m-d H:i:s', strtotime('-1 hour')))->delete();
|
||||
|
||||
$reservations = WashingReservation::query()->orderBY('time' , 'asc')->paginate($request->query("limit", 20));
|
||||
|
||||
return Response::detect("washing-reservations.index", [ "reservations" => $reservations]);
|
||||
|
@ -260,6 +264,8 @@ class WashingReservationController extends Controller
|
|||
|
||||
public function appindex(Request $request)
|
||||
{
|
||||
WashingReservation::query()->where('time', '<', date('Y-m-d H:i:s', strtotime('-1 hour')))->delete();
|
||||
|
||||
$reservations = WashingReservation::query()->where("user_id", "=", auth()->user()->id)->orderBY('time' , 'asc')->paginate($request->query("limit", 20));
|
||||
|
||||
return Response::detect("washing-reservations.index", [ "reservations" => $reservations]);
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
$i = 1;
|
||||
?>
|
||||
<div class="row">
|
||||
@foreach(\App\WashingMachine::query()->where("location_id", "=", $location->id)->get() as $machine)
|
||||
@foreach(\App\WashingReservation::query()->where("machine_id", "=", $machine->id)->where("time", "LIKE", date("Y-m-d"). "%")->orderBy("time", "asc")->get() as $reservation)
|
||||
@foreach(\App\WashingReservation::query()->join('washing_machines', 'washing_machines.id', '=', 'washing_reservations.machine_id')->where("location_id", "=", $location->id)->where("time", "LIKE", date("Y-m-d"). "%")->orderBy("time", "asc")->get() as $reservation)
|
||||
@if (date('Y-m-d H:i:s', strtotime('-1 hour')) < $reservation->time)
|
||||
@if($i % 3 == 1)
|
||||
</div>
|
||||
|
@ -33,9 +32,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<?php $i++; ?>
|
||||
@else
|
||||
{{ \App\WashingReservation::query()->join('washing_machines', 'washing_machines.id', '=', 'washing_reservations.machine_id')->where("location_id", "=", $location->id)->where('time', '<', date('Y-m-d H:i:s'). '%')->delete() }}
|
||||
@endif
|
||||
@endforeach
|
||||
@endforeach
|
||||
@if($i == 1)
|
||||
<b class="w-100 text-center" style="font-size: 2vw; padding-top: 16px;">Der er ingen vaskemaskine reservationer for i dag.</b>
|
||||
@endif
|
||||
|
@ -46,8 +46,8 @@
|
|||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
setInterval(function(){ // There has to be a space between " and # or it will not load correctly
|
||||
$('#mainDiv').load(" #mainDiv").fadeIn();
|
||||
}, (60000*5));
|
||||
$('#mainDiv').load(" #mainDiv");
|
||||
}, (60000*1));
|
||||
});
|
||||
</script>
|
||||
@yield("scripts")
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(!$events->isEmpty())
|
||||
@foreach($events as $event)
|
||||
<div class="card">
|
||||
|
|
Loading…
Reference in New Issue