reorganization direction resource

This commit is contained in:
aslan 2024-02-29 18:00:50 +03:00
parent ade2422a4b
commit bd8bb7e059
14 changed files with 468 additions and 209 deletions

View File

@ -7,6 +7,7 @@ use App\Http\Requests\admin\Catalog\StoreDirectionRequest;
use App\Http\Requests\admin\Catalog\UpdateDirectionRequest; use App\Http\Requests\admin\Catalog\UpdateDirectionRequest;
use App\Models\Department; use App\Models\Department;
use App\Models\Direction; use App\Models\Direction;
use App\Models\DirectionProfile;
use App\Models\EducationForm; use App\Models\EducationForm;
use App\Models\EducationLevel; use App\Models\EducationLevel;
use App\Models\EntranceExamination; use App\Models\EntranceExamination;
@ -35,12 +36,23 @@ class DirectionController extends Controller
$examination_types = ExaminationType::pluck('name', 'id'); $examination_types = ExaminationType::pluck('name', 'id');
$subjects = Subject::pluck('name', 'id'); $subjects = Subject::pluck('name', 'id');
$subjectTypes = SubjectType::pluck('name', 'id'); $subjectTypes = SubjectType::pluck('name', 'id');
$directionProfiles = DirectionProfile::pluck('name', 'id');
return view('admin.catalog.direction.create', return view('admin.catalog.direction.create',
compact('departments', 'levels', 'forms', 'examination_types', 'subjectTypes', 'subjects')); compact(
'departments',
'levels',
'forms',
'examination_types',
'subjectTypes',
'subjects',
'directionProfiles',
)
);
} }
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'];
@ -52,9 +64,13 @@ class DirectionController extends Controller
$direction->education_level_id = $validated['education_level_id']; $direction->education_level_id = $validated['education_level_id'];
$direction->education_form_id = $validated['education_form_id']; $direction->education_form_id = $validated['education_form_id'];
$direction->department_id = $validated['department_id']; $direction->department_id = $validated['department_id'];
$direction->budget_places = $validated['budget_places'];
$direction->quota = $validated['quota'];
$direction->paid_places = $validated['paid_places'];
$direction->cost_paid_place = $validated['cost_paid_place'];
$direction->period = $validated['period'];
$direction->save(); $direction->save();
if(array_key_exists('entrance-examination', $validated)) {
foreach ($validated['entrance-examination'] as $data) { foreach ($validated['entrance-examination'] as $data) {
$entranceExamination = new EntranceExamination(); $entranceExamination = new EntranceExamination();
$entranceExamination->examination_type_id = $data['examination_type_id']; $entranceExamination->examination_type_id = $data['examination_type_id'];
@ -65,6 +81,10 @@ class DirectionController extends Controller
$entranceExamination->subject_type_id = $data['subject_type_id']; $entranceExamination->subject_type_id = $data['subject_type_id'];
$entranceExamination->save(); $entranceExamination->save();
} }
if (array_key_exists('direction_profiles', $validated)) {
$direction->directionProfiles()->attach($validated['direction_profiles']);
} }
return redirect()->route('directions.index'); return redirect()->route('directions.index');
@ -92,23 +112,6 @@ class DirectionController extends Controller
->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')
->sortBy('position')
->pluck('amount', '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',
compact( compact(
@ -119,9 +122,6 @@ class DirectionController extends Controller
'ege', 'ege',
'spo', 'spo',
'magistracy', 'magistracy',
'budget',
'paid',
'costs',
) )
); );
} }
@ -129,9 +129,24 @@ class DirectionController extends Controller
public function edit(Direction $direction): View|Application|Factory|\Illuminate\Contracts\Foundation\Application public function edit(Direction $direction): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{ {
$levels = EducationLevel::pluck('name', 'id'); $levels = EducationLevel::pluck('name', 'id');
$departments = Department::pluck('name', 'id');
$forms = EducationForm::pluck('name', 'id'); $forms = EducationForm::pluck('name', 'id');
return view('admin.catalog.direction.edit', compact('direction', 'departments', 'levels', 'forms')); $departments = Department::pluck('name', 'id');
$examination_types = ExaminationType::pluck('name', 'id');
$subjects = Subject::pluck('name', 'id');
$subjectTypes = SubjectType::pluck('name', 'id');
$directionProfiles = DirectionProfile::pluck('name', 'id');
return view('admin.catalog.direction.edit',
compact(
'direction',
'departments',
'levels',
'forms',
'examination_types',
'subjectTypes',
'subjects',
'directionProfiles',
)
);
} }
public function update(UpdateDirectionRequest $request, Direction $direction): RedirectResponse public function update(UpdateDirectionRequest $request, Direction $direction): RedirectResponse
@ -157,6 +172,9 @@ class DirectionController extends Controller
if ($direction->entranceExaminations()->exists()) { if ($direction->entranceExaminations()->exists()) {
return back(); return back();
} }
if ($direction->places()->exists()) {
return back();
}
$direction->delete(); $direction->delete();
return redirect()->route('directions.index'); return redirect()->route('directions.index');
} }

View File

@ -17,7 +17,6 @@ class StoreDirectionProfileRequest extends FormRequest
'name' => 'required|string|max:255|unique:direction_profiles,name', 'name' => 'required|string|max:255|unique:direction_profiles,name',
'description' => 'string', 'description' => 'string',
'slug' => 'required|string|max:255|unique:direction_profiles,slug', 'slug' => 'required|string|max:255|unique:direction_profiles,slug',
'direction_id' => 'required|int|numeric|max:255',
'position' => 'required|int|numeric|max:255', 'position' => 'required|int|numeric|max:255',
]; ];
} }

View File

@ -17,7 +17,6 @@ class UpdateDirectionProfileRequest extends FormRequest
'name' => "required|string|max:255|unique:direction_profiles,name,{$this->direction_profile->id}", 'name' => "required|string|max:255|unique:direction_profiles,name,{$this->direction_profile->id}",
'description' => 'string', 'description' => 'string',
'slug' => "required|string|max:255|unique:direction_profiles,slug,{$this->direction_profile->id}", 'slug' => "required|string|max:255|unique:direction_profiles,slug,{$this->direction_profile->id}",
'direction_id' => 'required|int|numeric|max:255',
'position' => 'required|int|numeric|max:255', 'position' => 'required|int|numeric|max:255',
]; ];
} }

View File

@ -27,6 +27,12 @@ class StoreDirectionRequest extends FormRequest
'entrance-examination.*.subject_type_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.*.scores' => 'required|numeric|int|max:1000',
'entrance-examination.*.position' => 'required|numeric|int|max:1000', 'entrance-examination.*.position' => 'required|numeric|int|max:1000',
'budget_places' => 'required|int|numeric|max:255',
'paid_places' => 'required|int|numeric|max:255',
'quota' => 'required|int|numeric|max:255',
'cost_paid_place' => 'required|int|numeric|max:255',
'period' => 'required|string|max:255',
'direction_profiles' => 'nullable|array'
]; ];
} }
} }

View File

@ -5,6 +5,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
class Direction extends Model class Direction extends Model
@ -41,23 +42,10 @@ class Direction extends Model
return $this->hasMany('App\Models\EntranceExamination', 'direction_id'); return $this->hasMany('App\Models\EntranceExamination', 'direction_id');
} }
public function places(): HasMany
{
return $this->hasMany('App\Models\Place', 'direction_id');
}
public function costs(): HasMany
{
return $this->hasMany('App\Models\Cost', 'direction_id');
}
public function directionProfiles(): HasMany public function directionProfiles(): BelongsToMany
{ {
return $this->hasMany('App\Models\DirectionProfile', 'direction_id'); return $this->belongsToMany(DirectionProfile::class);
}
public function periods(): HasMany
{
return $this->hasMany('App\Models\Period', 'direction_id');
} }
} }

View File

@ -20,6 +20,11 @@ class DirectionFactory extends Factory
'department_id' => 1, 'department_id' => 1,
'education_level_id' => 1, 'education_level_id' => 1,
'education_form_id' => 1, 'education_form_id' => 1,
'budget_places' => fake()->randomDigit(),
'quota' => fake()->randomDigit(),
'paid_places' => fake()->randomDigit(),
'cost_paid_place' => fake()->randomDigit(),
'period' => fake()->randomDigit(),
]; ];
} }
} }

View File

@ -19,6 +19,11 @@ return new class extends Migration
$table->foreignId('department_id')->constrained('departments'); $table->foreignId('department_id')->constrained('departments');
$table->foreignId('education_level_id')->constrained('education_levels'); $table->foreignId('education_level_id')->constrained('education_levels');
$table->foreignId('education_form_id')->constrained('education_forms'); $table->foreignId('education_form_id')->constrained('education_forms');
$table->integer('budget_places');
$table->integer('quota');
$table->integer('paid_places');
$table->integer('cost_paid_place');
$table->float('period');
$table->timestamps(); $table->timestamps();
}); });
} }

View File

@ -32,11 +32,7 @@ class DatabaseSeeder extends Seeder
SubjectTypeSeeder::class, SubjectTypeSeeder::class,
DirectionSeeder::class, DirectionSeeder::class,
EntranceExaminationSeeder::class, EntranceExaminationSeeder::class,
PlaceTypeSeeder::class,
PlaceSeeder::class,
CostSeeder::class,
DirectionProfileSeeder::class, DirectionProfileSeeder::class,
PeriodSeeder::class,
]); ]);
$this->call([ $this->call([

View File

@ -21,6 +21,11 @@ class DirectionSeeder extends Seeder
'department_id' => 1, 'department_id' => 1,
'education_level_id' => 1, 'education_level_id' => 1,
'education_form_id' => 1, 'education_form_id' => 1,
'budget_places' => 30,
'quota' => 10,
'paid_places' => 20,
'cost_paid_place' => 20,
'period' => 4.5
], ],
[ [
'name' => 'фармация', 'name' => 'фармация',
@ -32,6 +37,11 @@ class DirectionSeeder extends Seeder
'department_id' => 1, 'department_id' => 1,
'education_level_id' => 2, 'education_level_id' => 2,
'education_form_id' => 2, 'education_form_id' => 2,
'budget_places' => 40,
'quota' => 20,
'paid_places' => 30,
'cost_paid_place' => 30,
'period' => 5,
], ],
[ [
'name' => 'строительство', 'name' => 'строительство',
@ -43,6 +53,11 @@ class DirectionSeeder extends Seeder
'department_id' => 1, 'department_id' => 1,
'education_level_id' => 3, 'education_level_id' => 3,
'education_form_id' => 3, 'education_form_id' => 3,
'budget_places' => 50,
'quota' => 20,
'paid_places' => 30,
'cost_paid_place' => 30,
'period' => 5,
], ],
]); ]);
} }

View File

@ -3,6 +3,47 @@
@auth() @auth()
<h1 class=""> Создать Направление</h1> <h1 class=""> Создать Направление</h1>
{{ Form::open(['url' => route('directions.store'), 'method' => 'POST', 'class' => '']) }} {{ Form::open(['url' => route('directions.store'), 'method' => 'POST', 'class' => '']) }}
<div class="row">
<div class="col">
<div class="mt-3">
{{ Form::label('department_id', 'Кафедра') }}
</div>
<div class="mt-1">
{{ Form::select('department_id', $departments, null, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('department_id') }}
@endif
</div>
</div>
<div class="col">
<div class="mt-3">
{{ Form::label('education_level_id', 'Увовень образования') }}
</div>
<div class="mt-1">
{{ Form::select('education_level_id', $levels, null, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('education_level_id') }}
@endif
</div>
</div>
<div class="col">
<div class="mt-3">
{{ Form::label('education_form_id', 'Форма образования') }}
</div>
<div class="mt-1">
{{ Form::select('education_form_id', $forms, null, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('education_form_id') }}
@endif
</div>
</div>
</div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="mt-3"> <div class="mt-3">
@ -67,48 +108,94 @@
{{ $errors->first('description') }} {{ $errors->first('description') }}
@endif @endif
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="mt-3"> <div class="mt-3">
{{ Form::label('department_id', 'Кафедра') }} {{ Form::label('budget_places', 'Кол-во бюджетных мест') }}
</div> </div>
<div class="mt-1"> <div class="mt-1">
{{ Form::select('department_id', $departments, null, ['class' => 'form-select']) }} {{ Form::number('budget_places', null, ['class' => 'form-select']) }}
</div> </div>
<div> <div>
@if ($errors->any()) @if ($errors->any())
{{ $errors->first('department_id') }} {{ $errors->first('budget_places') }}
@endif @endif
</div> </div>
</div> </div>
<div class="col"> <div class="col">
<div class="mt-3"> <div class="mt-3">
{{ Form::label('education_level_id', 'Увовень образования') }} {{ Form::label('quota', 'Квота') }}
</div> </div>
<div class="mt-1"> <div class="mt-1">
{{ Form::select('education_level_id', $levels, null, ['class' => 'form-select']) }} {{ Form::number('quota', null, ['class' => 'form-select']) }}
</div> </div>
<div> <div>
@if ($errors->any()) @if ($errors->any())
{{ $errors->first('education_level_id') }} {{ $errors->first('quota') }}
@endif @endif
</div> </div>
</div> </div>
<div class="col"> <div class="col">
<div class="mt-3"> <div class="mt-3">
{{ Form::label('education_form_id', 'Форма образования') }} {{ Form::label('paid_places', 'Кол-во мест по договорам') }}
</div> </div>
<div class="mt-1"> <div class="mt-1">
{{ Form::select('education_form_id', $forms, null, ['class' => 'form-select']) }} {{ Form::number('paid_places', null, ['class' => 'form-select']) }}
</div> </div>
<div> <div>
@if ($errors->any()) @if ($errors->any())
{{ $errors->first('education_form_id') }} {{ $errors->first('paid_places') }}
@endif
</div>
</div>
<div class="col">
<div class="mt-3">
{{ Form::label('cost_paid_place', 'Стоимость обучения') }}
</div>
<div class="mt-1">
{{ Form::number('cost_paid_place', null, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('cost_paid_place') }}
@endif
</div>
</div>
<div class="col">
<div class="mt-3">
{{ Form::label('period', 'Период обучения') }}
</div>
<div class="mt-1">
{{ Form::text('period', null, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('period') }}
@endif @endif
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="col">
<div class="mt-3">
{{ Form::label('direction_profile', 'Профиль подготовки') }}
</div>
<div class="mt-1">
{{ Form::select('direction_profiles[]', $directionProfiles, null, ['class' => 'form-control rounded border-gray-300 w-1/3 h-32', 'multiple' => 'multiple']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('direction_profile') }}
@endif
</div>
</div>
</div>
<h4 class="mt-3">Добавить вступительные испытания</h4> <h4 class="mt-3">Добавить вступительные испытания</h4>
@ -188,6 +275,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="mt-3 mb-3"> <div class="mt-3 mb-3">
{{ Form::submit('Создать Направление', ['class' => 'btn btn-primary']) }} {{ Form::submit('Создать Направление', ['class' => 'btn btn-primary']) }}
</div> </div>

View File

@ -1,24 +1,64 @@
@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.update', $direction), 'method' => 'PATCH', 'class' => '']) }} {{ Form::label('department_id', 'Кафедра') }}
</div>
<div class="mt-1">
{{ Form::select('department_id', $departments, $direction->department->id, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('department_id') }}
@endif
</div>
</div>
<div class="col">
<div class="mt-3">
{{ Form::label('education_level_id', 'Увовень образования') }}
</div>
<div class="mt-1">
{{ Form::select('education_level_id', $levels, $direction->educationLevel->id, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('education_level_id') }}
@endif
</div>
</div>
<div class="col">
<div class="mt-3">
{{ Form::label('education_form_id', 'Форма образования') }}
</div>
<div class="mt-1">
{{ Form::select('education_form_id', $forms, $direction->educationForm->id, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('education_form_id') }}
@endif
</div>
</div>
</div>
<div class="row">
<div class="col"> <div class="col">
<div class="mt-3"> <div class="mt-3">
{{ Form::label('position', 'Позиция') }} {{ Form::label('position', 'Позиция') }}
</div> </div>
<div class="mt-1"> <div class="mt-1">
{{ Form::text('position', $direction->position, ['class' => 'form-control']) }} {{ Form::number('position', $direction->position, ['class' => 'form-control']) }}
</div> </div>
<div> <div>
@if ($errors->any()) @if ($errors->any())
{{ $errors->first('position') }} {{ $errors->first('position') }}
@endif @endif
</div> </div>
</div>
<div class="col">
<div class="mt-3"> <div class="mt-3">
{{ Form::label('code', 'Код') }} {{ Form::label('code', 'Код') }}
</div> </div>
@ -30,6 +70,20 @@
{{ $errors->first('code') }} {{ $errors->first('code') }}
@endif @endif
</div> </div>
</div>
<div class="col">
<div class="mt-3">
{{ Form::label('slug', 'URL') }}
</div>
<div class="mt-1">
{{ Form::text('slug', $direction->slug, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('slug') }}
@endif
</div>
</div>
<div class="mt-3"> <div class="mt-3">
{{ Form::label('name', 'Название') }} {{ Form::label('name', 'Название') }}
@ -54,59 +108,181 @@
{{ $errors->first('description') }} {{ $errors->first('description') }}
@endif @endif
</div> </div>
<div class="row">
<div class="col">
<div class="mt-3"> <div class="mt-3">
{{ Form::label('department_id', 'Факультет') }} {{ Form::label('budget_places', 'Кол-во бюджетных мест') }}
</div> </div>
<div class="mt-1"> <div class="mt-1">
{{ Form::select('department_id', $departments, $direction->department->id, ['class' => 'form-select']) }} {{ Form::number('budget_places', $direction->budget_places, ['class' => 'form-select']) }}
</div> </div>
<div> <div>
@if ($errors->any()) @if ($errors->any())
{{ $errors->first('department_id') }} {{ $errors->first('budget_places') }}
@endif @endif
</div> </div>
</div>
<div class="col">
<div class="mt-3">
{{ Form::label('quota', 'Квота') }}
</div>
<div class="mt-1">
{{ Form::number('quota', $direction->quota, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('quota') }}
@endif
</div>
</div>
<div class="col">
<div class="mt-3">
{{ Form::label('paid_places', 'Кол-во мест по договорам') }}
</div>
<div class="mt-1">
{{ Form::number('paid_places', $direction->paid_places, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('paid_places') }}
@endif
</div>
</div>
<div class="col">
<div class="mt-3"> <div class="mt-3">
{{ Form::label('education_level_id', 'Увовень образования') }} {{ Form::label('cost_paid_place', 'Стоимость обучения') }}
</div> </div>
<div class="mt-1"> <div class="mt-1">
{{ Form::select('education_level_id', $levels, $direction->educationLevel->id, ['class' => 'form-select']) }} {{ Form::number('cost_paid_place', $direction->cost_paid_place, ['class' => 'form-select']) }}
</div> </div>
<div> <div>
@if ($errors->any()) @if ($errors->any())
{{ $errors->first('education_level_id') }} {{ $errors->first('cost_paid_place') }}
@endif @endif
</div> </div>
</div>
<div class="col">
<div class="mt-3"> <div class="mt-3">
{{ Form::label('education_form_id', 'Увовень образования') }} {{ Form::label('period', 'Период обучения') }}
</div> </div>
<div class="mt-1"> <div class="mt-1">
{{ Form::select('education_form_id', $forms, $direction->educationForm->id, ['class' => 'form-select']) }} {{ Form::text('period', $direction->period, ['class' => 'form-select']) }}
</div> </div>
<div> <div>
@if ($errors->any()) @if ($errors->any())
{{ $errors->first('education_form_id') }} {{ $errors->first('period') }}
@endif @endif
</div> </div>
</div>
</div>
<div class="row">
<div class="col">
<div class="mt-3"> <div class="mt-3">
{{ Form::label('slug', 'URL') }} {{ Form::label('direction_profile', 'Профиль подготовки') }}
</div> </div>
<div class="mt-1"> <div class="mt-1">
{{ Form::text('slug', $direction->slug, ['class' => 'form-control']) }} {{ Form::select('direction_profiles[]', $directionProfiles, $direction->directionProfiles, ['class' => 'form-control rounded border-gray-300 w-1/3 h-32', 'multiple' => 'multiple']) }}
</div> </div>
<div> <div>
@if ($errors->any()) @if ($errors->any())
{{ $errors->first('slug') }} {{ $errors->first('direction_profile') }}
@endif @endif
</div> </div>
<div class="mt-3">
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
</div> </div>
</div> </div>
<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 class="col">
<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 class="col">
<div class="mt-3">
{{ Form::label('entrance-examination[0][subject_type_id]', 'Тип предмета') }}
</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 class="col">
<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 class="mt-3 mb-3">
{{ Form::submit('Изменить Направление', ['class' => 'btn btn-primary']) }}
</div>
{{ Form::close() }} {{ Form::close() }}
</div> </div>
</div> @include('admin.catalog.direction.script')
@endauth @endauth
@endsection @endsection

View File

@ -65,45 +65,23 @@
<h2> <h2>
Количество бюджетных мест Количество бюджетных мест
</h2> </h2>
@foreach($budget as $education_form_id => $amount) {{ $direction->budget_places }}
@php
$educationForm = (new EducationForm())->find($education_form_id);
@endphp
<p>{{ $educationForm->name }} - {{ $amount }}</p>
@endforeach
<h2> <h2>
Количество мест по договорам об оказании платных обр. услуг Количество мест по договорам об оказании платных обр. услуг
</h2> </h2>
@foreach($paid as $education_form_id => $amount) {{ $direction->paid_places }}
@php
$educationForm = (new EducationForm())->find($education_form_id);
@endphp
<p>{{ $educationForm->name }} - {{ $amount }}</p>
@endforeach
<h2> <h2>
стоимость обучения стоимость обучения
</h2> </h2>
@foreach($costs as $education_form_id => $cost) {{ $direction->cost_paid_place }}
@php
$educationForm = (new EducationForm())->find($education_form_id);
@endphp
<p>{{ $educationForm->name }} - {{ $cost }}</p>
@endforeach
<h2>Профили подготовки</h2> <h2>Профили подготовки</h2>
@foreach($direction->directionProfiles as $profile) @foreach($direction->directionProfiles as $profile)
<p>{{ $profile->name }}</p> <p>{{ $profile->name }}</p>
@endforeach @endforeach
<h2>Профили подготовки</h2> <h2>Период Обучения</h2>
@foreach($direction->periods as $period) {{ $direction->period }}
@php
$educationForm = (new EducationForm())->find($period->education_form_id);
@endphp
<p>{{ $educationForm->name }} - {{ $period->period }}</p>
@endforeach

View File

@ -45,6 +45,7 @@
<ul> <ul>
<li class="list-group-item"><a href="{{ route('documents.index') }}">Документы</a></li> <li class="list-group-item"><a href="{{ route('documents.index') }}">Документы</a></li>
<li class="list-group-item"><a href="{{ route('admissions.index') }}">Экран Приема</a></li> <li class="list-group-item"><a href="{{ route('admissions.index') }}">Экран Приема</a></li>
<li class="list-group-item"><a href="{{ route('directions.index') }}">Направления</a></li>
@can('viewAny', Auth::user()) @can('viewAny', Auth::user())
<li class="list-group-item"></li> <li class="list-group-item"></li>
<li class="list-group-item"><a href="{{ route('users.index') }}">Список администраторов</a></li> <li class="list-group-item"><a href="{{ route('users.index') }}">Список администраторов</a></li>
@ -55,17 +56,13 @@
заведения</a></li> заведения</a></li>
<li class="list-group-item"><a href="{{ route('faculties.index') }}">Факультеты</a></li> <li class="list-group-item"><a href="{{ route('faculties.index') }}">Факультеты</a></li>
<li class="list-group-item"><a href="{{ route('departments.index') }}">Кафедры</a></li> <li class="list-group-item"><a href="{{ route('departments.index') }}">Кафедры</a></li>
<li class="list-group-item"><a href="{{ route('directions.index') }}">Направления</a></li>
<li class="list-group-item"><a href="{{ route('entrance_examinations.index') }}">Вступ. экзамены</a></li> <li class="list-group-item"><a href="{{ route('entrance_examinations.index') }}">Вступ. экзамены</a></li>
<li class="list-group-item"><a href="{{ route('education_levels.index') }}">Уровни образования</a></li> <li class="list-group-item"><a href="{{ route('education_levels.index') }}">Уровни образования</a></li>
<li class="list-group-item"><a href="{{ route('education_forms.index') }}">Формы образования</a></li> <li class="list-group-item"><a href="{{ route('education_forms.index') }}">Формы образования</a></li>
<li class="list-group-item"><a href="{{ route('examination_types.index') }}">Типы Экзаменов</a></li> <li class="list-group-item"><a href="{{ route('examination_types.index') }}">Типы Экзаменов</a></li>
<li class="list-group-item"><a href="{{ route('subjects.index') }}">Предметы</a></li> <li class="list-group-item"><a href="{{ route('subjects.index') }}">Предметы</a></li>
<li class="list-group-item"><a href="{{ route('subject_types.index') }}">Типы Предметов</a></li> <li class="list-group-item"><a href="{{ route('subject_types.index') }}">Типы Предметов</a></li>
<li class="list-group-item"><a href="{{ route('places.index') }}">Кол-во Мест</a></li>
<li class="list-group-item"><a href="{{ route('place_types.index') }}">Типы Мест</a></li>
<li class="list-group-item"><a href="{{ route('costs.index') }}">Стоимость об.</a></li>
<li class="list-group-item"><a href="{{ route('periods.index') }}">Срок. обучения</a></li>
<li class="list-group-item"><a href="{{ route('direction_profiles.index') }}">Профили подготовки</a></li> <li class="list-group-item"><a href="{{ route('direction_profiles.index') }}">Профили подготовки</a></li>
</ul> </ul>
</aside> </aside>

View File

@ -2,15 +2,11 @@
use App\Http\Controllers\admin\AdmissionController; use App\Http\Controllers\admin\AdmissionController;
use App\Http\Controllers\admin\Catalog\DepartmentController; use App\Http\Controllers\admin\Catalog\DepartmentController;
use App\Http\Controllers\admin\Catalog\Direction\CostController;
use App\Http\Controllers\admin\Catalog\Direction\DirectionProfileController; use App\Http\Controllers\admin\Catalog\Direction\DirectionProfileController;
use App\Http\Controllers\admin\Catalog\Direction\EducationFormController; use App\Http\Controllers\admin\Catalog\Direction\EducationFormController;
use App\Http\Controllers\admin\Catalog\Direction\EducationLevelController; use App\Http\Controllers\admin\Catalog\Direction\EducationLevelController;
use App\Http\Controllers\admin\Catalog\Direction\EntranceExaminationController; use App\Http\Controllers\admin\Catalog\Direction\EntranceExaminationController;
use App\Http\Controllers\admin\Catalog\Direction\ExaminationTypeController; use App\Http\Controllers\admin\Catalog\Direction\ExaminationTypeController;
use App\Http\Controllers\admin\Catalog\Direction\PeriodController;
use App\Http\Controllers\admin\Catalog\Direction\PlaceController;
use App\Http\Controllers\admin\Catalog\Direction\PlaceTypeController;
use App\Http\Controllers\admin\Catalog\Direction\SubjectController; use App\Http\Controllers\admin\Catalog\Direction\SubjectController;
use App\Http\Controllers\admin\Catalog\Direction\SubjectTypeController; use App\Http\Controllers\admin\Catalog\Direction\SubjectTypeController;
use App\Http\Controllers\admin\Catalog\DirectionController; use App\Http\Controllers\admin\Catalog\DirectionController;
@ -61,13 +57,6 @@ Route::middleware(['auth', 'verified'])->prefix('admin')->group(function () {
Route::resource('/entrance_examinations', EntranceExaminationController::class); Route::resource('/entrance_examinations', EntranceExaminationController::class);
Route::resource('/place_types', PlaceTypeController::class)
->scoped(['place_type' => 'slug']);
Route::resource('/places', PlaceController::class);
Route::resource('/costs', CostController::class);
Route::resource('/periods', PeriodController::class);
Route::resource('/direction_profiles', DirectionProfileController::class) Route::resource('/direction_profiles', DirectionProfileController::class)
->scoped(['direction_profile' => 'slug']); ->scoped(['direction_profile' => 'slug']);