Lager-v3/resources/views/reservations/validations.blade.php

101 lines
5.4 KiB
PHP

@extends('Layouts.master')
@section('content')
<div class="main-container pb-4">
<div class="head-section mb-2">
@include('Partials.Pages.Search.search_bar')
</div>
@include('Partials.Pages.reservation_selector')
<table class="table table-striped">
<thead>
<th>@lang('user')</th>
<th>@lang('room')</th>
<th>@lang('deadline')</th>
<th>@lang('date_start')</th>
<th>@lang('date_end')</th>
<th>@lang('action')</th>
</thead>
<tbody>
@foreach($data as $loan)
<tr>
<td class="col-2 align-middle">
<a href="{{route('users.show',['user' => $loan->user_id])}}" class="btn btn-success">
{{$loan->user->username}}
</a>
</td>
<td class="col-2 align-middle">
<a href="{{route('rooms.show',['room' => $loan->room_id])}}" class="btn btn-success">
{{$loan->room->building->name}}.{{$loan->room->name}}
</a>
</td>
<td class="col align-middle">
@if(!empty($loan->date_deadline))
{{date('d.m.Y H:i:s',strtotime($loan->date_deadline))}}
@endif
</td>
<td class="col align-middle">
{{date('d.m.Y',strtotime($loan->date_start))}}
</td>
<td class="col align-middle">
@if(!empty($loan->date_end))
{{date('d.m.Y',strtotime($loan->date_end))}}
@else
@lang('permanent')
@endif
</td>
<td>
@can('reservations_validate')
@if(NOW() < $loan->date_deadline)
<a href="{{route('reservations.validate.page',['reservation' => $loan->id])}}" class="btn btn-outline-success">
@lang('validate') @lang('reservation')
</a>
@endif
@endcan
@can('reservations_cancel')
@if(NOW() > $loan->date_deadline)
<div class="col-1">
<button data-toggle="modal" data-target="#deleteModal_{{$loan->id}}" class="btn btn-danger">@lang('delete')</button>
</div>
<div class="product-edit-buttons">
<!-- Modal -->
<div class="modal" tabindex="-1" role="dialog" id="deleteModal_{{$loan->id}}">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="alert alert-danger" style="display:none"></div>
<div class="modal-header">
<h5 class="modal-title">@lang('cancel') @lang('reservation')</h5>
<button type="button" class="btn btn-secondary close fold" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
{{date('d.m.Y',strtotime($loan->date_start))}} @lang('to') {{$loan->user->username}} @lang('in') {{$loan->room->building->name}} - {{$loan->room->name}}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">@lang('cancel')</button>
<form method="post" action="{{route(Request::segment(1).'.validate.cancel', ['reservation' => $loan])}}" id="deleteForm" class="form-inline">
@method('delete')
@csrf
<button class="btn btn-danger" id="ajaxSubmit">@lang('cancel') @lang('reservation')</button>
</form>
</div>
</div>
</div>
</div>
</div>
@endif
@endcan
</td>
</tr>
@endforeach
</tbody>
</table>
@include('Partials.Pages.display')
</div>
@endsection
@section('scripting')
@endsection