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

105 lines
5.8 KiB
PHP
Raw Permalink Normal View History

2024-01-16 15:14:13 +04:00
@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>
2024-01-16 15:14:13 +04:00
</div>
@endcan
2024-01-30 11:21:30 +04:00
<div class="card mt-4">
<div class="card-header">{{__('Поиск доставки')}}</div>
<div class="card-body">
<form action="{{ route('deliveries.index') }}" method="GET">
<div class="mb-3">
<label for="address" class="form-label">Адрес доставки:</label>
<input type="text" id="address" name="address" class="form-control" value="{{ request('address') ?? '' }}">
</div>
<div>
<button type="submit" class="btn btn-primary">Фильтр</button>
</div>
</form>
</div>
</div>
2024-01-16 15:14:13 +04:00
@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>
2024-01-30 11:21:30 +04:00
<td>
@can('startDelivery', $delivery)
<form action="{{ route('deliveries.start', $delivery) }}" method="POST" style="display: inline-block;">
@csrf
@method('PUT')
<button type="submit" class="btn btn-primary">Отправить</button>
</form>
@endcan
</td>
<td>
@can('endDelivery', $delivery)
<form action="{{ route('deliveries.end', $delivery) }}" method="POST" style="display: inline-block;">
@csrf
@method('PUT')
<button type="submit" class="btn btn-primary">Завершить</button>
</form>
@endcan
</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
2024-01-16 15:14:13 +04:00
@endforeach
</tbody>
</table>
</div>
<div class="card-footer">{{ $deliveries->links() }}</div>
</div>
@endif
</div>
</div>
@endsection