SUBD_Transport_Company/resources/views/deliveries/index.blade.php

73 lines
3.7 KiB
PHP

@extends('layouts.application')
@section('content')
<div class="container col-md-6">
<div class="row justify-content-center">
@can('create', \App\Models\Delivery::class)
<div class="card">
<div class="card-header">{{__('Новая доставка')}}</div>
<div class="card-body">
<a href="{{ route('deliveries.create') }}" class="btn btn-success">Добавить</a>
</div>
</div>
@endcan
@if (count($deliveries))
<div class="card mt-4">
<div class="card-header">{{__('Доставки')}}</div>
<div class="card-body">
<table class="table table-striped">
<thead>
<th>Адрес доставки</th>
<th>Водитель</th>
<th>Статус</th>
<th>&nbsp;</th>
</thead>
<tbody>
@foreach ($deliveries as $delivery)
@can('view', $delivery)
<tr>
<td class="table-text">
<div>
<a href="{{ route('deliveries.show', $delivery) }}" class="btn btn-block col-8">{{ $delivery->address }}</a>
</div>
</td>
<td>
<div>
<p>{{ $delivery->user->fio }}</p>
</div>
</td>
<td>
<div>
<p>{{ $delivery->status->description()}}</p>
</div>
</td>
<td>
@can('update', $delivery)
<div>
<a href="{{ route('deliveries.edit', $delivery) }}" class="btn btn-warning">Редактировать</a>
</div>
@endcan
</td>
<td>
@can('delete', $delivery)
<form action="{{ route('deliveries.destroy', $delivery) }}" method="POST" style="display: inline-block;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Удалить</button>
</form>
@endcan
</td>
</tr>
@endcan
@endforeach
</tbody>
</table>
</div>
<div class="card-footer">{{ $deliveries->links() }}</div>
</div>
@endif
</div>
</div>
@endsection