Files
PiAPS_University_Web/University.Web/resources/views/students/index.blade.php

88 lines
6.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@extends('layouts.app')
@section('links')
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<link href="/resources/css/app.css" rel="stylesheet">
@endsection
@section('content')
<div class="container mx-auto px-4 py-8">
<div class="flex justify-between items-center mb-8">
<h1 class="text-2xl font-bold">Список студентов</h1>
<div class="flex flex-wrap gap-2 justify-end">
<a href="{{ url('/dashboard') }}" class="bg-gray-500 hover:bg-gray-600 text-white px-4 py-2 rounded">
Перейти в панель
</a>
<a href="{{ route('students.create') }}" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded">
Добавить студента
</a>
</div>
</div>
<div class="bg-white rounded-lg shadow overflow-hidden">
<div class="table-responsive">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ФИО</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Группа</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Телефон</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Пол</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Дата рождения</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Гражданство</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Зачетная книжка</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"></th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@foreach($students as $student)
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap cursor-pointer" onclick="window.location='{{ route('students.edit', $student['id']) }}'">
<div class="text-sm font-medium text-gray-900">
{{ $student['surname'] }} {{ $student['name'] }} {{ $student['patronymic'] ?? '' }}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap cursor-pointer" onclick="window.location='{{ route('students.edit', $student['id']) }}'">
<div class="text-sm text-gray-500">
{{ $groupsList[$student['student_profile']['group_id']] ?? 'Не указана' }}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap cursor-pointer" onclick="window.location='{{ route('students.edit', $student['id']) }}'">
<div class="text-sm text-gray-500">{{ $student['email'] }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap cursor-pointer" onclick="window.location='{{ route('students.edit', $student['id']) }}'">
<div class="text-sm text-gray-500">{{ $student['telephone'] }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap cursor-pointer" onclick="window.location='{{ route('students.edit', $student['id']) }}'">
<div class="text-sm text-gray-500">{{ $student['gender'] }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap cursor-pointer" onclick="window.location='{{ route('students.edit', $student['id']) }}'">
<div class="text-sm text-gray-500">{{ \Carbon\Carbon::parse($student['birth_date'])->format('d.m.Y') }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap cursor-pointer" onclick="window.location='{{ route('students.edit', $student['id']) }}'">
<div class="text-sm text-gray-500">{{ $student['citizenship'] }}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap cursor-pointer" onclick="window.location='{{ route('students.edit', $student['id']) }}'">
<div class="text-sm text-gray-500">
{{ $student['student_profile']['matriculation_number'] ?? 'Не указан' }}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium flex justify-center items-center">
<form action="{{ route('students.destroy', $student['id']) }}" method="POST" class="inline">
@csrf
@method('DELETE')
<button type="submit" class="text-red-500 hover:text-red-700" onclick="return confirm('Вы уверены?')">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
</svg>
</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endsection