This commit is contained in:
frederikpyt 2020-09-02 15:11:07 +02:00
commit ebd80a31b8
6 changed files with 21 additions and 17 deletions

View File

@ -132,6 +132,7 @@ class WashingReservationController extends Controller
public function destroy($id)
{
$machineReservation = WashingReservation::find($id);
dd($id);
$machineReservation->delete();
$reservations = WashingReservation::query()->paginate( 20);
@ -265,7 +266,7 @@ class WashingReservationController extends Controller
{
WashingReservation::query()->where('time', '<', date('Y-m-d H:i:s', strtotime('-1 hour')))->delete();
$reservations = WashingReservation::query()->join('washing_machines', 'washing_machines.id', '=', 'washing_reservations.machine_id')->join('locations', 'locations.id', '=', 'washing_machines.location_id')->where("user_id", "=", auth()->user()->id)->orderBY('time' , 'asc')->paginate($request->query("limit", 20));
$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]);
}

View File

@ -32,7 +32,7 @@
@csrf
<label for="name">Navn:</label>
<label hidden id="error" for="errormesseages">Rolle navnet findes allerede</label>
<input type="text" name="name" id="name" placeholder="Admin" required>
<input type="text" name="name" id="name" pattern="[A-Za-z]+" title="Der må ikke være tal i rollenavnet" placeholder="Admin" required>
<label for="name">Beskrivelse:</label>
<input type="text" name="description" id="description" placeholder="Admin rollen bruges til administratorene" required>
@ -70,14 +70,14 @@
<tr>
<td>Aktiviteter</td>
<td><p>Empty</p></td>
<td>//TEST<input id="EventCAccount" type="checkbox" name="value[]" value="userevent.create"></td>
<td><input id="EventCAccount" type="checkbox" name="value[]" value="userevent.create"></td>
<td><input id="EventRAccount" onclick="if ($('#EventR').prop('checked') == false) $('#EventR').prop('checked', true); else $('#EventR').prop('checked', false);" type="checkbox" name="value[]" value="event.show"></td>
<td>//TEST<input id="EventDAccount" type="checkbox" name="value[]" value="userevent.delete"></td>
<td><input id="EventDAccount" type="checkbox" name="value[]" value="userevent.delete"></td>
</tr>
<tr>
<td>Reservationer</td>
<td>Empty</td>
<td><input id="ReservationCAccount" onclick="if ($('#ReservationC').prop('checked') == false) $('#ReservationC').prop('checked', true); else $('#ReservationC').prop('checked', false);" type="checkbox" name="value[]" value="washing.machine.reservation.create"></td>
<td><input id="ReservationCAccount" type="checkbox" name="value[]" value="washing.machine.reservation.create"></td>
<td><input id="ReservationRAccount" onclick="if ($('#ReservationR').prop('checked') == false) $('#ReservationR').prop('checked', true); else $('#ReservationR').prop('checked', false);" type="checkbox" name="value[]" value="washing.machine.reservation.show"></td>
<td><input id="ReservationDAccount" onclick="if ($('#ReservationD').prop('checked') == false) $('#ReservationD').prop('checked', true); else $('#ReservationD').prop('checked', false);" type="checkbox" name="value[]" value="washing.machine.reservation.delete"></td>
</tr>
@ -98,7 +98,7 @@
<tr>
<td>Feedback</td>
<td>Empty</td>
<td><input id="FeedbackCAccount" onclick="if ($('#FeedbackC').prop('checked') == false) $('#FeedbackC').prop('checked', true); else $('#FeedbackC').prop('checked', false);" type="checkbox" name="value[]" value="feedback.create"></td>
<td><input id="FeedbackCAccount" type="checkbox" name="value[]" value="feedback.create"></td>
<td></td>
<td></td>
</tr>
@ -122,7 +122,8 @@
<tr>
<td>Admin Panel</td>
<td><p>Adgang til admin panelet</p></td>
<td colspan="5"><input type="checkbox" name="value[]" value="admin.panel.show"></td>
<td></td>
<td colspan="4"><input type="checkbox" name="value[]" value="admin.panel.show"></td>
</tr>
<tr><!--Bruger Start-->
<td>Brugere</td>
@ -218,7 +219,7 @@
<td>Feedback</td>
<td><p>Empty</p></td>
<td></td>
<td><input id="FeedbackR" onclick="if ($('#FeedbackRAccount').prop('checked') == false) $('#FeedbackRAccount').prop('checked', true); else $('#FeedbackRAccount').prop('checked', false);" type="checkbox" name="value[]" value="feedback.show"></td>
<td><input id="FeedbackR" type="checkbox" name="value[]" value="feedback.show"></td>
<td></td>
<td><input id="FeedbackD" type="checkbox" name="value[]" value="feedback.delete"></td>
<td><input id="Feedback" type="checkbox" onclick="FullControl(this)"></td>

View File

@ -33,7 +33,7 @@
@method("put")
<label for="name">Navn:</label>
<label hidden id="error" for="errormesseages">Rolle navnet findes allerede</label>
<input type="text" name="name" id="name" placeholder="Admin" value="{{ $role->name }}" required>
<input type="text" name="name" id="name" pattern="[A-Za-z]+" title="Der må ikke være tal i rollenavnet" placeholder="Admin" value="{{ $role->name }}" required>
<label for="name">Beskrivelse:</label>
<input type="text" name="description" id="description" placeholder="Admin rollen bruges til administratorene" value="{{ $role->description }}" required>
@ -70,14 +70,14 @@
<tr>
<td>Aktiviteter</td>
<td><p>Empty</p></td>
<td>//TEST<input id="EventRAccount" type="checkbox" name="value[]" value="userevent.create" @if ($role->hasPermissionTo("userevent.create")) checked @endif></td>
<td><input id="EventRAccount" type="checkbox" name="value[]" value="userevent.create" @if ($role->hasPermissionTo("userevent.create")) checked @endif></td>
<td><input id="EventRAccount" onclick="if ($('#EventR').prop('checked') == false) $('#EventR').prop('checked', true); else $('#EventR').prop('checked', false);" type="checkbox" name="value[]" value="event.show" @if ($role->hasPermissionTo("event.show")) checked @endif></td>
<td>//TEST<input id="EventRAccount" type="checkbox" name="value[]" value="userevent.delete" @if ($role->hasPermissionTo("userevent.delete")) checked @endif></td>
<td><input id="EventRAccount" type="checkbox" name="value[]" value="userevent.delete" @if ($role->hasPermissionTo("userevent.delete")) checked @endif></td>
</tr>
<tr>
<td>Reservationer</td>
<td>Empty</td>
<td><input id="ReservationCAccount" onclick="if ($('#ReservationC').prop('checked') == false) $('#ReservationC').prop('checked', true); else $('#ReservationC').prop('checked', false);" type="checkbox" name="value[]" value="washing.machine.reservation.create" @if ($role->hasPermissionTo("washing.machine.reservation.create")) checked @endif></td>
<td><input id="ReservationCAccount" type="checkbox" name="value[]" value="washing.machine.reservation.create" @if ($role->hasPermissionTo("washing.machine.reservation.create")) checked @endif></td>
<td><input id="ReservationRAccount" onclick="if ($('#ReservationR').prop('checked') == false) $('#ReservationR').prop('checked', true); else $('#ReservationR').prop('checked', false);" type="checkbox" name="value[]" value="washing.machine.reservation.show" @if ($role->hasPermissionTo("washing.machine.reservation.show")) checked @endif></td>
<td><input id="ReservationDAccount" onclick="if ($('#ReservationD').prop('checked') == false) $('#ReservationD').prop('checked', true); else $('#ReservationD').prop('checked', false);" type="checkbox" name="value[]" value="washing.machine.reservation.delete" @if ($role->hasPermissionTo("washing.machine.reservation.delete")) checked @endif></td>
</tr>
@ -98,7 +98,7 @@
<tr>
<td>Feedback</td>
<td>Empty</td>
<td><input id="FeedbackCAccount" onclick="if ($('#FeedbackC').prop('checked') == false) $('#FeedbackC').prop('checked', true); else $('#FeedbackC').prop('checked', false);" type="checkbox" name="value[]" value="feedback.create" @if ($role->hasPermissionTo("feedback.create")) checked @endif></td>
<td><input id="FeedbackCAccount" type="checkbox" name="value[]" value="feedback.create" @if ($role->hasPermissionTo("feedback.create")) checked @endif></td>
<td></td>
<td></td>
</tr>
@ -122,7 +122,8 @@
<tr>
<td>Admin Panel</td>
<td><p>Adgang til admin panelet</p></td>
<td colspan="5"><input type="checkbox" name="value[]" value="admin.panel.show" @if ($role->hasPermissionTo("admin.panel.show")) checked @endif></td>
<td></td>
<td colspan="4"><input type="checkbox" name="value[]" value="admin.panel.show" @if ($role->hasPermissionTo("admin.panel.show")) checked @endif></td>
</tr>
<tr>
<td>Brugere</td>

View File

@ -20,7 +20,7 @@
<label for="email">Email:</label>
<label hidden id="erroremail">Der findes allerede en bruger med denne email!</label>
<input type="email" name="email" id="email" placeholder="x@y.z" required>
<label for="password1">Adgangskode:</label>
<label for="password1">Adgangskode:</label> <!--Tilføj dette til passwords: pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" title="Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters"-->
<label hidden id="errornotsamepass" for="errormesseages">Der stod ikke det samme i `Adgangskode` & `Bekræft Adgangskode`!</label>
<div class="input-group text-left">
<input type="password" class="form-control" name="password" id="password1" placeholder="******" required>

View File

@ -39,8 +39,9 @@
/*Alert box*/
.alert {
opacity: 0.8;
padding: 20px;
background-color: #f44336;
background-color: #00788A;
color: white;
border-radius: 10px;
}

View File

@ -16,7 +16,7 @@
<h3>{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</h3>
<div class="row align-items-center">
<span style="font-size: 4vw; white-space: pre-line;"><b>{{__('msg.tid')}}:</b> {{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($reservation->time))->format('d/m/Y \k\l\. H:i') }}
- {{ $reservation->name }}</span>
- {{ \App\Location::query()->where('id', '=', \App\WashingMachine::query()->find($reservation->machine_id)->location_id)->first()->name }}</span>
<form class="ml-auto" method="post" action="{{ route("washing-reservations.destroy", [ "washing_reservation" => $reservation ]) }}">
@csrf
@method("delete")