CourseWork/resources/views/students/index.blade.php
2024-06-16 00:41:31 +04:00

66 lines
3.0 KiB
PHP

@extends('layouts.application')
@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('students.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($students))
<table class="table table-striped">
<thead>
<th>ФИО</th>
<th>&nbsp;</th>
</thead>
<tbody>
@foreach ($students as $student)
<tr>
<td class="table-text">
<div>
<a href="{{ route('students.show', $student) }}" class="btn btn-block col-8">{{ $student->fio }}</a>
</div>
</td>
<td>
<div>
<a href="{{ route('students.edit', $student) }}" class="btn btn-warning">Редактировать</a>
</div>
</td>
<td>
<form action="{{ route('students.destroy', $student) }}" 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('students.create') }}" class="btn btn-success">Добавить</a>
</div>
<div class="card-footer">{{ $students->links() }}</div>
</div>
</div>
</div>
@endsection