CourseWork/resources/views/students/form.blade.php
2024-05-06 17:47:25 +04:00

49 lines
3.0 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>
<div class="mb-3">
<label for="email" class="form-label">Эл. почта:</label>
<input type="text" id="email" name="email" class="form-control" value="{{ isset($student) ? $student->user->email : old('email') }}" required>
</div>
<div class="mb-3">
<label for="password" class="form-label">Пароль:</label>
<input type="text" id="password" name="password" class="form-control" value="{{ isset($student) ? $student->user->password : old('password') }}" required>
</div>
<button type="submit" class="btn btn-success">Подтвердить</button>
</form>
</div>
</div>
</div>
</div>