File: /var/www/ivs.kaunokolegija.lt/laravel/resources/views/admin/students/edit.blade.php
@extends('layouts.admin')
@section('content')
<div class="card">
<div class="card-header">
{{ trans('global.edit') }}
</div>
<div class="card-body">
<form method="POST" action="{{ route("admin.students.update", [$student->id]) }}" enctype="multipart/form-data">
@method('PUT')
@csrf
<div class="form-group">
<label class="required" for="name">{{ trans('cruds.student.fields.name') }}</label>
<input class="form-control {{ $errors->has('name') ? 'is-invalid' : '' }}" type="text" name="name" id="name" value="{{ old('name', $student->name) }}" required>
@if($errors->has('name'))
<span class="text-danger">{{ $errors->first('name') }}</span>
@endif
<span class="help-block">{{ trans('cruds.student.fields.name_helper') }}</span>
</div>
<div class="form-group">
<label class="required" for="email">{{ trans('cruds.student.fields.email') }}</label>
<input class="form-control {{ $errors->has('email') ? 'is-invalid' : '' }}" type="email" name="email" id="email" value="{{ old('email', $student->email) }}" required>
@if($errors->has('email'))
<span class="text-danger">{{ $errors->first('email') }}</span>
@endif
<span class="help-block">{{ trans('cruds.student.fields.email_helper') }}</span>
</div>
<div class="form-group">
<label for="phone">{{ trans('cruds.student.fields.phone') }}</label>
<input class="form-control {{ $errors->has('phone') ? 'is-invalid' : '' }}" type="text" name="phone" id="phone" value="{{ old('phone', $student->phone) }}">
@if($errors->has('phone'))
<span class="text-danger">{{ $errors->first('phone') }}</span>
@endif
<span class="help-block">{{ trans('cruds.student.fields.phone_helper') }}</span>
</div>
<div class="form-group">
<div class="form-check {{ $errors->has('ismain') ? 'is-invalid' : '' }}">
<input type="hidden" name="ismain" value="0">
<input class="form-check-input" type="checkbox" name="ismain" id="ismain" value="1" {{ $student->ismain || old('ismain', 0) === 1 ? 'checked' : '' }}>
<label class="form-check-label" for="ismain">{{ trans('cruds.student.fields.ismain') }}</label>
</div>
@if($errors->has('ismain'))
<span class="text-danger">{{ $errors->first('ismain') }}</span>
@endif
<span class="help-block">{{ trans('cruds.student.fields.ismain_helper') }}</span>
</div>
<div class="form-group">
<div class="form-check {{ $errors->has('interested_in_research') ? 'is-invalid' : '' }}">
<input type="hidden" name="interested_in_research" value="0">
<input class="form-check-input" type="checkbox" name="interested_in_research" id="interested_in_research" value="1" {{ $student->interested_in_research || old('interested_in_research', 0) === 1 ? 'checked' : '' }}>
<label class="form-check-label" for="interested_in_research">{{ trans('cruds.student.fields.interested_in_research') }}</label>
</div>
@if($errors->has('interested_in_research'))
<span class="text-danger">{{ $errors->first('interested_in_research') }}</span>
@endif
<span class="help-block">{{ trans('cruds.student.fields.interested_in_research_helper') }}</span>
</div>
<div class="form-group">
<label for="areas_of_interests">{{ trans('cruds.student.fields.areas_of_interest') }}</label>
<div style="padding-bottom: 4px">
<span class="btn btn-info btn-xs select-all" style="border-radius: 0">{{ trans('global.select_all') }}</span>
<span class="btn btn-info btn-xs deselect-all" style="border-radius: 0">{{ trans('global.deselect_all') }}</span>
</div>
<select class="form-control select2 {{ $errors->has('areas_of_interests') ? 'is-invalid' : '' }}" name="areas_of_interests[]" id="areas_of_interests" multiple>
@foreach($areas_of_interests as $id => $areas_of_interest)
<option value="{{ $id }}" {{ (in_array($id, old('areas_of_interests', [])) || $student->areas_of_interests->contains($id)) ? 'selected' : '' }}>{{ $areas_of_interest }}</option>
@endforeach
</select>
@if($errors->has('areas_of_interests'))
<span class="text-danger">{{ $errors->first('areas_of_interests') }}</span>
@endif
<span class="help-block">{{ trans('cruds.student.fields.areas_of_interest_helper') }}</span>
</div>
<div class="form-group">
<button class="btn btn-success" type="submit">
{{ trans('global.save') }}
</button>
</div>
</form>
</div>
</div>
@endsection