v0.10.17 - Added permission check (create/edit/delete) on all admin sites

This commit is contained in:
Anders
2020-08-31 10:57:26 +02:00
parent 0418805b7c
commit 7b157fcd90
11 changed files with 211 additions and 113 deletions
@@ -19,7 +19,9 @@
<th>Vaskemaskine</th>
<th>Tidspunkt</th>
<th>Bruger</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
@if(auth()->user()->can('washing.machine.reservation.delete'))
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
@endif
</tr>
@foreach($reservations as $reservation)
@if(date('Y-m-d H:i:s', strtotime('-1 hour')) < $reservation->time)
@@ -28,13 +30,15 @@
<td>{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</td>
<td>{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y \k\l\. H:i') }}</td>
<td>{{ ucfirst(\App\User::query()->find($reservation->user_id)->name_first) }} {{ ucfirst(\App\User::query()->find($reservation->user_id)->name_last) }}</td>
<td><form method="post" action="{{ route('washing-reservations.destroy', ['washing_reservation' => $reservation]) }}" class="w-100 nostyle">
@csrf
@method("delete")
@if(auth()->user()->can('washing.machine.reservation.delete'))
<td><form method="post" action="{{ route('washing-reservations.destroy', ['washing_reservation' => $reservation]) }}" class="w-100 nostyle">
@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>
</form>
</td>
<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>
</td>
@endif
</tr>
@endif
@endforeach