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

82 lines
3.8 KiB
PHP
Raw Normal View History

2024-06-16 00:41:31 +04:00
@extends('layouts.application')
2024-04-23 14:52:49 +04:00
@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>
2024-05-06 17:47:25 +04:00
<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>
2024-06-24 00:51:05 +04:00
<th>Класс</th>
2024-05-06 17:47:25 +04:00
<th>&nbsp;</th>
</thead>
<tbody>
@foreach ($students as $student)
<tr>
<td class="table-text">
<div>
2024-06-24 00:51:05 +04:00
@can('view', $student)
<a href="{{ route('students.show', $student) }}" class="btn btn-block col-8">{{ $student->fio }}</a>
@else
{{ $student->fio }}
@endcan
2024-05-06 17:47:25 +04:00
</div>
</td>
2024-06-24 00:51:05 +04:00
<td class="table-text">
2024-05-06 17:47:25 +04:00
<div>
2024-06-24 00:51:05 +04:00
{{ $student->grade->name }}
2024-05-06 17:47:25 +04:00
</div>
</td>
2024-06-24 00:51:05 +04:00
@can('update', $student)
<td>
<div>
<a href="{{ route('students.edit', $student) }}" class="btn btn-warning">Редактировать</a>
</div>
</td>
@endcan
@can('delete', $student)
<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>
@endcan
2024-05-06 17:47:25 +04:00
</tr>
@endforeach
</tbody>
</table>
@else
<p>Ученики остутствуют</p>
@endif
2024-04-23 14:52:49 +04:00
</div>
2024-06-24 00:51:05 +04:00
@can('create', \App\Models\Student::class)
<div class="card-footer">
<a href="{{ route('students.create') }}" class="btn btn-success">Добавить</a>
</div>
@endcan
2024-05-06 17:47:25 +04:00
<div class="card-footer">{{ $students->links() }}</div>
</div>
2024-04-23 14:52:49 +04:00
</div>
</div>
@endsection