CourseWork/resources/views/subjects/index.blade.php
2024-05-07 12:14:18 +04:00

65 lines
3.0 KiB
PHP

@extends('layouts.app')
@section('content')
<div class="container col-md-6">
<div class="row justify-content-center">
<div class="card mt-4">
<div class="card-header">{{__('Поиск предмета')}}</div>
<div class="card-body">
<form action="{{ route('subjects.index') }}" method="GET">
<div class="mb-3">
<label for="name" class="form-label">Название:</label>
<input type="text" id="name" name="name" class="form-control" value="{{ request('name') ?? '' }}">
</div>
<div>
<button type="submit" class="btn btn-primary">Фильтр</button>
</div>
</form>
</div>
</div>
<div class="card mt-4">
<div class="card-header">{{__('Предметы')}}</div>
<div class="card-body">
@if (count($subjects))
<table class="table table-striped">
<thead>
<th>Название</th>
<th>&nbsp;</th>
</thead>
<tbody>
@foreach ($subjects as $subject)
<tr>
<td class="table-text">
<div>
<a href="{{ route('subjects.show', $subject) }}" class="btn btn-block col-8">{{ $subject->name }}</a>
</div>
</td>
<td>
<div>
<a href="{{ route('subjects.edit', $subject) }}" class="btn btn-warning">Редактировать</a>
</div>
</td>
<td>
<form action="{{ route('subjects.destroy', $subject) }}" method="POST" style="display: inline-block;">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Удалить</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
@else
<p>Предметы отсутствуют</p>
@endif
</div>
<div class="card-footer">
<a href="{{ route('subjects.create') }}" class="btn btn-success">Добавить</a>
</div>
<div class="card-footer">{{ $subjects->links() }}</div>
</div>
</div>
</div>
@endsection