CourseWork/resources/views/students/form.blade.php
2024-04-23 14:52:49 +04:00

41 lines
2.4 KiB
PHP

<div class="container col-md-6">
<div class="row justify-content-center">
<div class="card mt-4">
<div class="card-body">
<form action="{{ $route }}" method="POST">
@csrf
@method($method)
<div class="mb-3">
<label for="name" class="form-label">Имя:</label>
<input type="text" id="name" name="name" class="form-control" value="{{ isset($student) ? $student->name : old('name') }}" required>
</div>
<div class="mb-3">
<label for="last_name" class="form-label">Фамилия:</label>
<input type="text" id="last_name" name="last_name" class="form-control" value="{{ isset($student) ? $student->last_name : old('last_name') }}" required>
</div>
<div class="mb-3">
<label for="middle_name" class="form-label">Отчество:</label>
<input type="text" id="middle_name" name="middle_name" class="form-control" value="{{ isset($student) ? $student->middle_name : old('middle_name') }}" required>
</div>
<div class="mb-3">
<label for="birthday" class="form-label">Дата рождения:</label>
<input type="date" id="birthday" name="birthday" class="form-control" value="{{ isset($student) ? $student->birthday : old('birthday') }}" required>
</div>
<div class="mb-3">
<label for="grade_id" class="form-label">Класс:</label>
<select id="grade_id" name="grade_id" class="form-select" required>
<option value="">Выберите класс</option>
@foreach($grades as $grade)
<option value="{{ $grade->id }}" {{ isset($student) && $student->grade_id == $grade->id ? 'selected' : '' }}>
{{ $grade->name }}
</option>
@endforeach
</select>
</div>
<button type="submit" class="btn btn-success">Подтвердить</button>
</form>
</div>
</div>
</div>
</div>