2020-06-26 10:51:05 +00:00
|
|
|
@extends("app.layout.base")
|
|
|
|
@section("title")
|
2020-07-30 08:11:52 +00:00
|
|
|
Reservationer
|
2020-06-26 10:51:05 +00:00
|
|
|
@endsection
|
|
|
|
|
|
|
|
@section("content")
|
2020-08-20 10:18:30 +00:00
|
|
|
<?php
|
|
|
|
date_default_timezone_set('Europe/Copenhagen');
|
|
|
|
$washingreservations = 0;
|
|
|
|
?>
|
2020-07-30 08:11:52 +00:00
|
|
|
<main style="min-height: calc(100% - 61.34px);">
|
2020-08-06 18:33:46 +00:00
|
|
|
<h2 class="text-center sde-blue mb-0">{{__('msg.dinereservationer')}}</h2>
|
2020-07-30 08:11:52 +00:00
|
|
|
@foreach($reservations as $reservation)
|
2020-08-20 10:18:30 +00:00
|
|
|
@if(date('Y-m-d H:i:s', strtotime('-1 hour')) < $reservation->time)
|
2020-12-01 11:05:18 +00:00
|
|
|
<div id="row_{{ $reservation->id }}" class="reservation" style="margin: 0 32px 1.75rem 32px;">
|
2020-08-20 10:18:30 +00:00
|
|
|
<h3>{{ \App\WashingMachine::query()->find($reservation->machine_id)->name }}</h3>
|
|
|
|
<div class="row align-items-center">
|
2020-08-31 12:04:02 +00:00
|
|
|
<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') }}
|
2020-09-02 11:15:11 +00:00
|
|
|
- {{ \App\Location::query()->where('id', '=', \App\WashingMachine::query()->find($reservation->machine_id)->location_id)->first()->name }}</span>
|
2020-12-01 11:05:18 +00:00
|
|
|
|
|
|
|
@csrf
|
|
|
|
<a class="btn btn-sde-blue ml-auto mb-0" onclick="delete_reservation({{ $reservation->id }})">{{__('msg.fjern')}}</a>
|
2020-08-20 10:18:30 +00:00
|
|
|
</div>
|
2020-06-26 10:51:05 +00:00
|
|
|
</div>
|
2020-08-20 10:18:30 +00:00
|
|
|
<?php
|
|
|
|
$washingreservations++;
|
|
|
|
?>
|
|
|
|
@endif
|
2020-07-30 08:11:52 +00:00
|
|
|
@endforeach
|
2020-08-20 10:18:30 +00:00
|
|
|
@if(count($reservations) < 1 || $washingreservations == 0)
|
2020-08-06 18:33:46 +00:00
|
|
|
<p style="margin: 0 18px;">{{__('msg.duharingenreservationer')}}.</p>
|
2020-08-19 07:54:26 +00:00
|
|
|
@else
|
2020-07-30 08:11:52 +00:00
|
|
|
@endif
|
2020-08-06 18:33:46 +00:00
|
|
|
<a href="{{ route("washing-reservations.create") }}" class="btn btn-sde-blue mt-auto mb-1">{{__('msg.reservervaskemaskine')}}</a>
|
2020-06-26 10:51:05 +00:00
|
|
|
</main>
|
|
|
|
@endsection
|
2020-07-28 12:26:32 +00:00
|
|
|
|
|
|
|
@section("scripts")
|
2020-12-01 11:05:18 +00:00
|
|
|
<script src="{{ asset("/js/jquery-3.2.1.min.js") }}"></script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function delete_reservation(id) {
|
|
|
|
var token = $("input[name='_token']").val();
|
|
|
|
|
|
|
|
Swal.fire({
|
|
|
|
title: 'Er du sikker?',
|
|
|
|
text: "Dette kan ikke blive ændret tilbage!",
|
|
|
|
icon: 'warning',
|
|
|
|
showCancelButton: true,
|
|
|
|
confirmButtonColor: '#3085d6',
|
|
|
|
cancelButtonColor: '#d33',
|
|
|
|
confirmButtonText: 'Slet Reservationen',
|
|
|
|
cancelButtonText: 'Annuller'
|
|
|
|
}).then((result) => {
|
|
|
|
if (result.isConfirmed) {
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "/washing-reservations/"+id,
|
|
|
|
data:{'_token':token, _method: 'DELETE'},
|
|
|
|
success: function () {
|
|
|
|
$('#row_'+id).remove()
|
|
|
|
},
|
|
|
|
error:function (data) {
|
|
|
|
console.log(data);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
</script>
|
2020-07-28 12:26:32 +00:00
|
|
|
@endsection
|