CourseWork/resources/views/students/index.blade.php

67 lines
3.2 KiB
PHP
Raw Normal View History

2024-04-23 14:52:49 +04:00
@extends('layouts.app')
@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">
<a href="{{ route('students.create') }}" class="btn btn-success">Добавить</a>
</div>
</div>
<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>
@if (count($students))
<div class="card mt-4">
<div class="card-header">{{__('Ученики')}}</div>
<div class="card-body">
<table class="table table-striped">
<thead>
2024-05-03 12:42:37 +04:00
<th>ФИО</th>
2024-04-23 14:52:49 +04:00
<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->last_name }} {{ $student->name }} {{ $student->middle_name }}</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>
</div>
<div class="card-footer">{{ $students->links() }}</div>
</div>
@endif
</div>
</div>
@endsection