forked from aslan/applicant-site
add entrance Examination to store Direction
This commit is contained in:
parent
3cb9ec4a08
commit
422a5872c9
|
@ -9,7 +9,11 @@ use App\Models\Department;
|
||||||
use App\Models\Direction;
|
use App\Models\Direction;
|
||||||
use App\Models\EducationForm;
|
use App\Models\EducationForm;
|
||||||
use App\Models\EducationLevel;
|
use App\Models\EducationLevel;
|
||||||
|
use App\Models\EntranceExamination;
|
||||||
|
use App\Models\ExaminationType;
|
||||||
use App\Models\Faculty;
|
use App\Models\Faculty;
|
||||||
|
use App\Models\Subject;
|
||||||
|
use App\Models\SubjectType;
|
||||||
use Illuminate\Contracts\View\Factory;
|
use Illuminate\Contracts\View\Factory;
|
||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
|
@ -28,15 +32,19 @@ class DirectionController extends Controller
|
||||||
$levels = EducationLevel::pluck('name', 'id');
|
$levels = EducationLevel::pluck('name', 'id');
|
||||||
$forms = EducationForm::pluck('name', 'id');
|
$forms = EducationForm::pluck('name', 'id');
|
||||||
$departments = Department::pluck('name', 'id');
|
$departments = Department::pluck('name', 'id');
|
||||||
return view('admin.catalog.direction.create', compact('departments', 'levels', 'forms'));
|
$examination_types = ExaminationType::pluck('name', 'id');
|
||||||
|
$subjects = Subject::pluck('name', 'id');
|
||||||
|
$subjectTypes = SubjectType::pluck('name', 'id');
|
||||||
|
return view('admin.catalog.direction.create',
|
||||||
|
compact('departments', 'levels', 'forms', 'examination_types', 'subjectTypes', 'subjects'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function store(StoreDirectionRequest $request): RedirectResponse
|
public function store(StoreDirectionRequest $request): RedirectResponse
|
||||||
{
|
{
|
||||||
$validated = $request->validated();
|
$validated = $request->validated();
|
||||||
|
|
||||||
$direction = new Direction();
|
$direction = new Direction();
|
||||||
$direction->name = $validated['name'];
|
$direction->name = $validated['name'];
|
||||||
|
$direction->full_name = "{$validated['code']} {$validated['name']}";
|
||||||
$direction->description = $validated['description'];
|
$direction->description = $validated['description'];
|
||||||
$direction->position = $validated['position'];
|
$direction->position = $validated['position'];
|
||||||
$direction->slug = $validated['slug'];
|
$direction->slug = $validated['slug'];
|
||||||
|
@ -46,6 +54,19 @@ class DirectionController extends Controller
|
||||||
$direction->department_id = $validated['department_id'];
|
$direction->department_id = $validated['department_id'];
|
||||||
$direction->save();
|
$direction->save();
|
||||||
|
|
||||||
|
if(array_key_exists('entrance-examination', $validated)) {
|
||||||
|
foreach ($validated['entrance-examination'] as $data) {
|
||||||
|
$entranceExamination = new EntranceExamination();
|
||||||
|
$entranceExamination->examination_type_id = $data['examination_type_id'];
|
||||||
|
$entranceExamination->direction_id = $direction->id;
|
||||||
|
$entranceExamination->subject_id = $data['subject_id'];
|
||||||
|
$entranceExamination->scores = $data['scores'];
|
||||||
|
$entranceExamination->position = $data['position'];
|
||||||
|
$entranceExamination->subject_type_id = $data['subject_type_id'];
|
||||||
|
$entranceExamination->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return redirect()->route('directions.index');
|
return redirect()->route('directions.index');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,17 +76,38 @@ class DirectionController extends Controller
|
||||||
$faculty = Faculty::find($department->faculty->id);
|
$faculty = Faculty::find($department->faculty->id);
|
||||||
$educationalInstitution = $faculty->educationalInstitution;
|
$educationalInstitution = $faculty->educationalInstitution;
|
||||||
|
|
||||||
$ege = $direction->entranceExaminations->where('examination_type_id', '=', '1')->pluck('scores', 'subject_id');
|
$ege = $direction
|
||||||
$spo = $direction->entranceExaminations->where('examination_type_id', '=', '2')->pluck('scores', 'subject_id');
|
->entranceExaminations
|
||||||
|
->where('examination_type_id', '=', '1')
|
||||||
|
->sortBy('position')
|
||||||
|
->pluck('scores', 'subject_id');
|
||||||
|
|
||||||
|
$spo = $direction
|
||||||
|
->entranceExaminations->where('examination_type_id', '=', '2')
|
||||||
|
->sortBy('position')
|
||||||
|
->pluck('scores', 'subject_id');
|
||||||
|
|
||||||
$magistracy = $direction
|
$magistracy = $direction
|
||||||
->entranceExaminations
|
->entranceExaminations
|
||||||
->where('examination_type_id', '=', '3')
|
->where('examination_type_id', '=', '3')
|
||||||
->pluck('scores', 'subject_id');
|
->pluck('scores', 'subject_id');
|
||||||
|
|
||||||
$budget = $direction->places->where('place_type_id', '=', '1')->pluck('amount', 'education_form_id');
|
$budget = $direction
|
||||||
$paid = $direction->places->where('place_type_id', '=', '2')->pluck('amount', 'education_form_id');
|
->places
|
||||||
|
->where('place_type_id', '=', '1')
|
||||||
|
->sortBy('position')
|
||||||
|
->pluck('amount', 'education_form_id');
|
||||||
|
|
||||||
$costs = $direction->costs->pluck('cost', 'education_form_id');
|
$paid = $direction
|
||||||
|
->places
|
||||||
|
->where('place_type_id', '=', '2')
|
||||||
|
->sortBy('position')
|
||||||
|
->pluck('amount', 'education_form_id');
|
||||||
|
|
||||||
|
$costs = $direction
|
||||||
|
->costs
|
||||||
|
->sortBy('position')
|
||||||
|
->pluck('cost', 'education_form_id');
|
||||||
|
|
||||||
return view(
|
return view(
|
||||||
'admin.catalog.direction.show',
|
'admin.catalog.direction.show',
|
||||||
|
@ -96,8 +138,8 @@ class DirectionController extends Controller
|
||||||
{
|
{
|
||||||
$validated = $request->validated();
|
$validated = $request->validated();
|
||||||
|
|
||||||
$direction = new Direction();
|
|
||||||
$direction->name = $validated['name'];
|
$direction->name = $validated['name'];
|
||||||
|
$direction->full_name = "{$validated['code']} {$validated['name']}";
|
||||||
$direction->description = $validated['description'];
|
$direction->description = $validated['description'];
|
||||||
$direction->position = $validated['position'];
|
$direction->position = $validated['position'];
|
||||||
$direction->slug = $validated['slug'];
|
$direction->slug = $validated['slug'];
|
||||||
|
|
|
@ -15,13 +15,18 @@ class StoreDirectionRequest extends FormRequest
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'position' => 'required|int|numeric|max:255',
|
'position' => 'required|int|numeric|max:255',
|
||||||
'name' => 'required|string|max:255|unique:directions,name',
|
'name' => 'required|string|max:255',
|
||||||
'description' => 'string',
|
'description' => 'string',
|
||||||
'slug' => 'required|string|max:255|unique:directions,slug',
|
'slug' => 'required|string|max:255|unique:directions,slug',
|
||||||
'code' => 'required|string|max:255',
|
'code' => 'required|string|max:255|unique:directions,code',
|
||||||
'education_level_id' => 'required|int|numeric|max:1000',
|
'education_level_id' => 'required|int|numeric|max:1000',
|
||||||
'education_form_id' => 'required|int|numeric|max:1000',
|
'education_form_id' => 'required|int|numeric|max:1000',
|
||||||
'department_id' => 'required|numeric|int|max:1000'
|
'department_id' => 'required|numeric|int|max:1000',
|
||||||
|
'entrance-examination.*.examination_type_id' => 'required|numeric|int|max:1000',
|
||||||
|
'entrance-examination.*.subject_id' => 'required|numeric|int|max:1000',
|
||||||
|
'entrance-examination.*.subject_type_id' => 'required|numeric|int|max:1000',
|
||||||
|
'entrance-examination.*.scores' => 'required|numeric|int|max:1000',
|
||||||
|
'entrance-examination.*.position' => 'required|numeric|int|max:1000',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,14 +24,14 @@ class UpdateDirectionRequest extends FormRequest
|
||||||
'max:255',
|
'max:255',
|
||||||
"unique:directions,slug,{$this->direction->id}",
|
"unique:directions,slug,{$this->direction->id}",
|
||||||
],
|
],
|
||||||
'code' => 'required|string|max:255',
|
'name' => 'required|string|max:255',
|
||||||
'education_level_id' => 'required|int|numeric|max:1000',
|
'education_level_id' => 'required|int|numeric|max:1000',
|
||||||
'education_form_id' => 'required|int|numeric|max:1000',
|
'education_form_id' => 'required|int|numeric|max:1000',
|
||||||
'name' => [
|
'code' => [
|
||||||
'required',
|
'required',
|
||||||
'string',
|
'string',
|
||||||
'max:255',
|
'max:255',
|
||||||
"unique:directions,name,{$this->direction->id}",
|
"unique:directions,code,{$this->direction->id}",
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ class Direction extends Model
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'id',
|
'id',
|
||||||
'name',
|
'name',
|
||||||
|
'full_name',
|
||||||
'description',
|
'description',
|
||||||
'position',
|
'position',
|
||||||
'slug',
|
'slug',
|
||||||
|
|
|
@ -8,11 +8,14 @@ class DirectionFactory extends Factory
|
||||||
{
|
{
|
||||||
public function definition(): array
|
public function definition(): array
|
||||||
{
|
{
|
||||||
|
$name = fake()->name();
|
||||||
|
$code = fake()->text(10);
|
||||||
return [
|
return [
|
||||||
'name' => fake()->name(),
|
'name' => $name,
|
||||||
|
'full_name' => "{$code} {$name}",
|
||||||
'description' => fake()->text(),
|
'description' => fake()->text(),
|
||||||
'slug' => fake()->slug(),
|
'slug' => fake()->slug(),
|
||||||
'code' => fake()->text(50),
|
'code' => $code,
|
||||||
'position' => fake()->randomDigit(),
|
'position' => fake()->randomDigit(),
|
||||||
'department_id' => 1,
|
'department_id' => 1,
|
||||||
'education_level_id' => 1,
|
'education_level_id' => 1,
|
||||||
|
|
|
@ -11,6 +11,7 @@ return new class extends Migration
|
||||||
Schema::create('directions', function (Blueprint $table) {
|
Schema::create('directions', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
|
$table->string('full_name');
|
||||||
$table->text('description')->nullable();
|
$table->text('description')->nullable();
|
||||||
$table->string('code');
|
$table->string('code');
|
||||||
$table->integer('position');
|
$table->integer('position');
|
||||||
|
|
|
@ -13,6 +13,7 @@ class DirectionSeeder extends Seeder
|
||||||
DB::table('directions')->insert([
|
DB::table('directions')->insert([
|
||||||
[
|
[
|
||||||
'name' => 'Юриспруденция',
|
'name' => 'Юриспруденция',
|
||||||
|
'full_name' => '40.03.01 Юриспруденция',
|
||||||
'description' => 'Юриспруденция',
|
'description' => 'Юриспруденция',
|
||||||
'slug' => 'jurisprudence',
|
'slug' => 'jurisprudence',
|
||||||
'code' => '40.03.01',
|
'code' => '40.03.01',
|
||||||
|
@ -23,6 +24,7 @@ class DirectionSeeder extends Seeder
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'фармация',
|
'name' => 'фармация',
|
||||||
|
'full_name' => '33.05.01 фармация',
|
||||||
'description' => 'фармация',
|
'description' => 'фармация',
|
||||||
'slug' => 'pharmacy',
|
'slug' => 'pharmacy',
|
||||||
'code' => '33.05.01',
|
'code' => '33.05.01',
|
||||||
|
@ -33,6 +35,7 @@ class DirectionSeeder extends Seeder
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'строительство',
|
'name' => 'строительство',
|
||||||
|
'full_name' => '08.04.01 строительство',
|
||||||
'description' => 'строительство',
|
'description' => 'строительство',
|
||||||
'slug' => 'construction',
|
'slug' => 'construction',
|
||||||
'code' => '08.04.01',
|
'code' => '08.04.01',
|
||||||
|
|
|
@ -1,46 +1,74 @@
|
||||||
@extends('layouts.admin_layout')
|
@extends('layouts.admin_layout')
|
||||||
@section('content')
|
@section('content')
|
||||||
@auth()
|
@auth()
|
||||||
|
<h1 class=""> Создать Направление</h1>
|
||||||
|
{{ Form::open(['url' => route('directions.store'), 'method' => 'POST', 'class' => '']) }}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<h1 class=""> Создать Направление</h1>
|
<div class="mt-3">
|
||||||
{{ Form::open(['url' => route('directions.store'), 'method' => 'POST', 'class' => '']) }}
|
{{ Form::label('position', 'Позиция') }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::number('position', '', ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('position') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('code', 'Код') }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::text('code', '', ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('code') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('slug', 'URL') }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::text('slug', '', ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('slug') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('name', 'Название') }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::text('name', '', ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('name') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('description', 'Описание') }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::text('description', '', ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('description') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="mt-3">
|
|
||||||
{{ Form::label('position', 'Позиция') }}
|
|
||||||
</div>
|
|
||||||
<div class="mt-1">
|
|
||||||
{{ Form::text('position', '', ['class' => 'form-control']) }}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
@if ($errors->any())
|
|
||||||
{{ $errors->first('position') }}
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-3">
|
|
||||||
{{ Form::label('code', 'Название') }}
|
|
||||||
</div>
|
|
||||||
<div class="mt-1">
|
|
||||||
{{ Form::text('code', '', ['class' => 'form-control']) }}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
@if ($errors->any())
|
|
||||||
{{ $errors->first('code') }}
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-3">
|
|
||||||
{{ Form::label('description', 'Описание') }}
|
|
||||||
</div>
|
|
||||||
<div class="mt-1">
|
|
||||||
{{ Form::text('description', '', ['class' => 'form-control']) }}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
@if ($errors->any())
|
|
||||||
{{ $errors->first('description') }}
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
{{ Form::label('department_id', 'Кафедра') }}
|
{{ Form::label('department_id', 'Кафедра') }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -52,7 +80,8 @@
|
||||||
{{ $errors->first('department_id') }}
|
{{ $errors->first('department_id') }}
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
{{ Form::label('education_level_id', 'Увовень образования') }}
|
{{ Form::label('education_level_id', 'Увовень образования') }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -64,9 +93,10 @@
|
||||||
{{ $errors->first('education_level_id') }}
|
{{ $errors->first('education_level_id') }}
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
{{ Form::label('education_form_id', 'Увовень образования') }}
|
{{ Form::label('education_form_id', 'Форма образования') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-1">
|
<div class="mt-1">
|
||||||
{{ Form::select('education_form_id', $forms, null, ['class' => 'form-select']) }}
|
{{ Form::select('education_form_id', $forms, null, ['class' => 'form-select']) }}
|
||||||
|
@ -76,24 +106,95 @@
|
||||||
{{ $errors->first('education_form_id') }}
|
{{ $errors->first('education_form_id') }}
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt-3">
|
|
||||||
{{ Form::label('slug', 'URL') }}
|
<h4 class="mt-3">Добавить вступительные испытания</h4>
|
||||||
|
|
||||||
|
<div class="text-center align-items-center entrance-examination" id="entrance-examination"
|
||||||
|
name="entrance-examination">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('entrance-examination[0][examination_type_id]', 'Тип экзамена') }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::select('entrance-examination[0][examination_type_id]', $examination_types, null, ['class' => 'form-select']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('entrance-examination[0][examination_type_id]') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-1">
|
<div class="col">
|
||||||
{{ Form::text('slug', '', ['class' => 'form-control']) }}
|
<div class="mt-3">
|
||||||
|
{{ Form::label('entrance-examination[0][subject_id]', 'Предмет') }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1 col">
|
||||||
|
{{ Form::select('entrance-examination[0][subject_id]', $subjects, null, ['class' => 'form-select']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('entrance-examination[0][subject_id]') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="col">
|
||||||
@if ($errors->any())
|
<div class="mt-3">
|
||||||
{{ $errors->first('slug') }}
|
{{ Form::label('entrance-examination[0][subject_type_id]', 'Тип предмета') }}
|
||||||
@endif
|
</div>
|
||||||
|
<div class="mt-1 col">
|
||||||
|
{{ Form::select('entrance-examination[0][subject_type_id]', $subjectTypes, null, ['class' => 'form-select']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('entrance-examination[0][subject_type_id]') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-3">
|
<div class="col">
|
||||||
{{ Form::submit('Создать', ['class' => 'btn btn-primary']) }}
|
<div class="mt-3">
|
||||||
|
{{ Form::label('entrance-examination[0][scores]', 'Кол-во баллов') }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1 col">
|
||||||
|
{{ Form::text('entrance-examination[0][scores]', '', ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('entrance-examination[0][scores]') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('entrance-examination[0][position]', 'Позиция') }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1 col">
|
||||||
|
{{ Form::text('entrance-examination[0][position]', '', ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('entrance-examination[0][position]') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col align-items-end">
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('btn', 'Действия') }}
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-success col" name="add" id="add">Добавить</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{ Form::close() }}
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mt-3 mb-3">
|
||||||
|
{{ Form::submit('Создать Направление', ['class' => 'btn btn-primary']) }}
|
||||||
|
</div>
|
||||||
|
{{ Form::close() }}
|
||||||
</div>
|
</div>
|
||||||
|
@include('admin.catalog.direction.script')
|
||||||
@endauth
|
@endauth
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<h1 class="">Изменить направление</h1>
|
<h1 class="">Изменить направление</h1>
|
||||||
{{ Form::open(['url' => route('departments.update', $direction), 'method' => 'PATCH', 'class' => '']) }}
|
{{ Form::open(['url' => route('directions.update', $direction), 'method' => 'PATCH', 'class' => '']) }}
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
{{ Form::label('position', 'Позиция') }}
|
{{ Form::label('position', 'Позиция') }}
|
||||||
|
@ -19,6 +19,18 @@
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
{{ Form::label('code', 'Код') }}
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
{{ Form::text('code', $direction->code, ['class' => 'form-control']) }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if ($errors->any())
|
||||||
|
{{ $errors->first('code') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
{{ Form::label('name', 'Название') }}
|
{{ Form::label('name', 'Название') }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
<script type="module">
|
||||||
|
let i = 0;
|
||||||
|
$('#add').click(function () {
|
||||||
|
++i;
|
||||||
|
$('#entrance-examination').append(
|
||||||
|
`<div class="row field">
|
||||||
|
<div class="col">
|
||||||
|
<div class="mt-3">
|
||||||
|
<label for="entrance-examination[${i}][examination_type_id]">Тип экзамена</label>
|
||||||
|
</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
<select class="form-select" id="entrance-examination[${i}][examination_type_id]"
|
||||||
|
name="entrance-examination[${i}][examination_type_id]">
|
||||||
|
@foreach($examination_types as $value => $type)
|
||||||
|
<option value="{{ $value }}">{{ $type }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<div class="mt-3">
|
||||||
|
<label for="entrance-examination[${i}][subject_id]">Предмет</label>
|
||||||
|
</div>
|
||||||
|
<div class="mt-1 col">
|
||||||
|
<select class="form-select" id="entrance-examination[${i}][subject_id]"
|
||||||
|
name="entrance-examination[${i}][subject_id]">
|
||||||
|
@foreach($subjects as $value => $subject)
|
||||||
|
<option value="{{ $value }}">{{ $subject }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<div class="mt-3">
|
||||||
|
<label for="entrance-examination[${i}][subject_type_id]">Тип предмета</label>
|
||||||
|
</div>
|
||||||
|
<div class="mt-1 col">
|
||||||
|
<select class="form-select" id="entrance-examination[${i}][subject_type_id]"
|
||||||
|
name="entrance-examination[${i}][subject_type_id]">
|
||||||
|
@foreach($subjectTypes as $value => $subjectType)
|
||||||
|
<option value="{{ $value }}">{{ $subjectType }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<div class="mt-3">
|
||||||
|
<label for="entrance-examination[${i}][scores]">Кол-во баллов</label>
|
||||||
|
</div>
|
||||||
|
<div class="mt-1 col">
|
||||||
|
<input class="form-control" name="entrance-examination[${i}][scores]" type="text" value=""
|
||||||
|
id="entrance-examination[${i}][scores]">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<div class="mt-3">
|
||||||
|
<label for="entrance-examination[${i}][position]">Позиция</label>
|
||||||
|
</div>
|
||||||
|
<div class="mt-1 col">
|
||||||
|
<input class="form-control" name="entrance-examination[${i}][position]" type="text" value=""
|
||||||
|
id="entrance-examination[${i}][position]">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col align-items-end">
|
||||||
|
<div class="mt-3">
|
||||||
|
<label for="btn">Действия</label>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-danger col remove-examination-row">Удалить</button>
|
||||||
|
</div>
|
||||||
|
</div>`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
$(document).on('click', '.remove-examination-row', function () {
|
||||||
|
$(this).parents('.field').remove();
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Reference in New Issue