SUBD_Transport_Company/resources/views/cars/show.blade.php

72 lines
3.4 KiB
PHP
Raw 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">
<div class="card">
<div class="card-header">{{ ('Автомобиль') }}</div>
<div class="card-body">
<div class="mb-3">
<h5><strong>Название: </strong>{{ $car->name ?? "" }}</h5>
</div>
<div class="mb-3">
<h5><strong>Гос. номер: </strong> {{ $car->number ?? ""}} </h5>
</div>
<div class="mb-3">
<h5><strong>ФИО владельца: </strong>{{ $car->user->fio ?? "" }}</h5>
</div>
</div>
<div class="card-footer">
<a href="{{ route('cars.edit', $car) }}" class="btn btn-primary">Редактировать</a>
</div>
</div>
@if($user->role)
<div class="card mt-4">
<div class="card-header">{{__('Автомобиль')}}</div>
<div class="card-body">
@if ($user->car)
<table class="table table-striped">
<thead>
<th>Название</th>
<th>Номер</th>
<th>&nbsp;</th>
</thead>
<tbody>
<tr>
<td class="table-text">
<div>
{{ $user->car->name }}
</div>
</td>
<td>
<div>
{{ $user->car->number }}
</div>
</td>
<td>
<a href="{{ route('cars.edit', $user->car) }}" class="btn btn-warning">Редактировать</a>
</td>
<td>
<form action="{{ route('cars.destroy', $user->car) }}" method="POST" style="display: inline-block;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Удалить</button>
</form>
</td>
</tr>
</tbody>
</table>
@else
<a href="{{ route('cars.create', $user) }}" class="btn btn-success">Добавить</a>
<div class="mt-4">
<label class="form-label"><strong>Автомобиль отсутствует</strong></label>
</div>
@endif
</div>
</div>
@endif
</div>
</div>
@endsection