v0.10.10f - You can no longer see your own reservations if they're an hour past due (Samt with admin)

This commit is contained in:
Anders 2020-08-20 12:18:30 +02:00
parent 4f9cf41656
commit a145c88e2c
2 changed files with 38 additions and 24 deletions

View File

@ -10,6 +10,9 @@
@endsection @endsection
@section("content") @section("content")
<?php
date_default_timezone_set('Europe/Copenhagen');
?>
<table class="tbl mt-0"> <table class="tbl mt-0">
<tr> <tr>
<th>Lokation</th> <th>Lokation</th>
@ -19,19 +22,21 @@
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
</tr> </tr>
@foreach($reservations as $reservation) @foreach($reservations as $reservation)
<tr> @if(date('Y-m-d H:i:s', strtotime('-1 hour')) < $reservation->time)
<td>{{ \App\Location::query()->find(\App\WashingMachine::query()->find($reservation->machine_id)->location_id)->name }}</td> <tr>
<td>{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</td> <td>{{ \App\Location::query()->find(\App\WashingMachine::query()->find($reservation->machine_id)->location_id)->name }}</td>
<td>{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y \k\l\. H:i') }}</td> <td>{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</td>
<td>{{ ucfirst(\App\User::query()->find($reservation->user_id)->name_first) }} {{ ucfirst(\App\User::query()->find($reservation->user_id)->name_last) }}</td> <td>{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y \k\l\. H:i') }}</td>
<td><form method="post" action="{{ route('washing-reservations.destroy', ['washing_reservation' => $reservation]) }}" class="w-100 nostyle"> <td>{{ ucfirst(\App\User::query()->find($reservation->user_id)->name_first) }} {{ ucfirst(\App\User::query()->find($reservation->user_id)->name_last) }}</td>
@csrf <td><form method="post" action="{{ route('washing-reservations.destroy', ['washing_reservation' => $reservation]) }}" class="w-100 nostyle">
@method("delete") @csrf
@method("delete")
<button class="w-100 nostyle" onclick="return confirm('Are you sure you want to delete?');" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button> <button class="w-100 nostyle" onclick="return confirm('Are you sure you want to delete?');" type="submit"><img class="w-100 cursor-pointer" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></button>
</form> </form>
</td> </td>
</tr> </tr>
@endif
@endforeach @endforeach
</table> </table>

View File

@ -4,23 +4,32 @@
@endsection @endsection
@section("content") @section("content")
<?php
date_default_timezone_set('Europe/Copenhagen');
$washingreservations = 0;
?>
<main style="min-height: calc(100% - 61.34px);"> <main style="min-height: calc(100% - 61.34px);">
<h2 class="text-center sde-blue mb-0">{{__('msg.dinereservationer')}}</h2> <h2 class="text-center sde-blue mb-0">{{__('msg.dinereservationer')}}</h2>
@foreach($reservations as $reservation) @foreach($reservations as $reservation)
<div class="reservation" style="margin: 0 32px 1.75rem 32px;"> @if(date('Y-m-d H:i:s', strtotime('-1 hour')) < $reservation->time)
<h3>{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</h3> <div class="reservation" style="margin: 0 32px 1.75rem 32px;">
<div class="row align-items-center"> <h3>{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</h3>
<span style="font-size: 4vw"><b>{{__('msg.tid')}}:</b> {{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y \k\l\. H:i') }}</span> <div class="row align-items-center">
<form class="ml-auto" method="post" action="{{ route("washing-reservations.destroy", [ "washing_reservation" => $reservation ]) }}"> <span style="font-size: 4vw"><b>{{__('msg.tid')}}:</b> {{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y \k\l\. H:i') }}</span>
@csrf <form class="ml-auto" method="post" action="{{ route("washing-reservations.destroy", [ "washing_reservation" => $reservation ]) }}">
@method("delete") @csrf
<input type="hidden" name="id" value="{{ $reservation->id }}"> @method("delete")
<button class="btn btn-sde-blue mb-0" type="submit" onclick="return confirm('Are you sure you want to remove this reservation?');">{{__('msg.fjern')}}</button> <input type="hidden" name="id" value="{{ $reservation->id }}">
</form> <button class="btn btn-sde-blue mb-0" type="submit" onclick="return confirm('Are you sure you want to remove this reservation?');">{{__('msg.fjern')}}</button>
</form>
</div>
</div> </div>
</div> <?php
$washingreservations++;
?>
@endif
@endforeach @endforeach
@if(count($reservations) < 1) @if(count($reservations) < 1 || $washingreservations == 0)
<p style="margin: 0 18px;">{{__('msg.duharingenreservationer')}}.</p> <p style="margin: 0 18px;">{{__('msg.duharingenreservationer')}}.</p>
@else @else
{{ $reservations->links() }} {{ $reservations->links() }}