From bd8bb7e059c6f83249c26c7b8a5a842baf585219 Mon Sep 17 00:00:00 2001 From: aslan Date: Thu, 29 Feb 2024 18:00:50 +0300 Subject: [PATCH] reorganization direction resource --- .../admin/Catalog/DirectionController.php | 86 ++-- .../StoreDirectionProfileRequest.php | 1 - .../UpdateDirectionProfileRequest.php | 1 - .../admin/Catalog/StoreDirectionRequest.php | 6 + app/Models/Direction.php | 18 +- database/factories/DirectionFactory.php | 5 + ...4_02_09_114155_create_directions_table.php | 5 + database/seeders/DatabaseSeeder.php | 4 - database/seeders/DirectionSeeder.php | 15 + .../admin/catalog/direction/create.blade.php | 106 ++++- .../admin/catalog/direction/edit.blade.php | 380 +++++++++++++----- .../admin/catalog/direction/show.blade.php | 32 +- .../views/layouts/admin_layout.blade.php | 7 +- routes/admin.php | 11 - 14 files changed, 468 insertions(+), 209 deletions(-) diff --git a/app/Http/Controllers/admin/Catalog/DirectionController.php b/app/Http/Controllers/admin/Catalog/DirectionController.php index be3584d..f31cfdb 100644 --- a/app/Http/Controllers/admin/Catalog/DirectionController.php +++ b/app/Http/Controllers/admin/Catalog/DirectionController.php @@ -7,6 +7,7 @@ use App\Http\Requests\admin\Catalog\StoreDirectionRequest; use App\Http\Requests\admin\Catalog\UpdateDirectionRequest; use App\Models\Department; use App\Models\Direction; +use App\Models\DirectionProfile; use App\Models\EducationForm; use App\Models\EducationLevel; use App\Models\EntranceExamination; @@ -35,12 +36,23 @@ class DirectionController extends Controller $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.create', - compact('departments', 'levels', 'forms', 'examination_types', 'subjectTypes', 'subjects')); + compact( + 'departments', + 'levels', + 'forms', + 'examination_types', + 'subjectTypes', + 'subjects', + 'directionProfiles', + ) + ); } public function store(StoreDirectionRequest $request): RedirectResponse { + $validated = $request->validated(); $direction = new Direction(); $direction->name = $validated['name']; @@ -52,19 +64,27 @@ class DirectionController extends Controller $direction->education_level_id = $validated['education_level_id']; $direction->education_form_id = $validated['education_form_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(); - 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(); - } + 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(); + } + + + if (array_key_exists('direction_profiles', $validated)) { + $direction->directionProfiles()->attach($validated['direction_profiles']); } return redirect()->route('directions.index'); @@ -92,23 +112,6 @@ class DirectionController extends Controller ->where('examination_type_id', '=', '3') ->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( 'admin.catalog.direction.show', compact( @@ -119,9 +122,6 @@ class DirectionController extends Controller 'ege', 'spo', 'magistracy', - 'budget', - 'paid', - 'costs', ) ); } @@ -129,9 +129,24 @@ class DirectionController extends Controller public function edit(Direction $direction): View|Application|Factory|\Illuminate\Contracts\Foundation\Application { $levels = EducationLevel::pluck('name', 'id'); - $departments = Department::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 @@ -157,6 +172,9 @@ class DirectionController extends Controller if ($direction->entranceExaminations()->exists()) { return back(); } + if ($direction->places()->exists()) { + return back(); + } $direction->delete(); return redirect()->route('directions.index'); } diff --git a/app/Http/Requests/admin/Catalog/Direction/StoreDirectionProfileRequest.php b/app/Http/Requests/admin/Catalog/Direction/StoreDirectionProfileRequest.php index 1b19fe3..22bd567 100644 --- a/app/Http/Requests/admin/Catalog/Direction/StoreDirectionProfileRequest.php +++ b/app/Http/Requests/admin/Catalog/Direction/StoreDirectionProfileRequest.php @@ -17,7 +17,6 @@ class StoreDirectionProfileRequest extends FormRequest 'name' => 'required|string|max:255|unique:direction_profiles,name', 'description' => 'string', 'slug' => 'required|string|max:255|unique:direction_profiles,slug', - 'direction_id' => 'required|int|numeric|max:255', 'position' => 'required|int|numeric|max:255', ]; } diff --git a/app/Http/Requests/admin/Catalog/Direction/UpdateDirectionProfileRequest.php b/app/Http/Requests/admin/Catalog/Direction/UpdateDirectionProfileRequest.php index f9f3dcb..03ea02f 100644 --- a/app/Http/Requests/admin/Catalog/Direction/UpdateDirectionProfileRequest.php +++ b/app/Http/Requests/admin/Catalog/Direction/UpdateDirectionProfileRequest.php @@ -17,7 +17,6 @@ class UpdateDirectionProfileRequest extends FormRequest 'name' => "required|string|max:255|unique:direction_profiles,name,{$this->direction_profile->id}", 'description' => 'string', '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', ]; } diff --git a/app/Http/Requests/admin/Catalog/StoreDirectionRequest.php b/app/Http/Requests/admin/Catalog/StoreDirectionRequest.php index 27d05a4..6989ce5 100644 --- a/app/Http/Requests/admin/Catalog/StoreDirectionRequest.php +++ b/app/Http/Requests/admin/Catalog/StoreDirectionRequest.php @@ -27,6 +27,12 @@ class StoreDirectionRequest extends FormRequest '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', + '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' ]; } } diff --git a/app/Models/Direction.php b/app/Models/Direction.php index 7ece0d1..c0c618a 100644 --- a/app/Models/Direction.php +++ b/app/Models/Direction.php @@ -5,6 +5,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; class Direction extends Model @@ -41,23 +42,10 @@ class Direction extends Model 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'); - } - - public function periods(): HasMany - { - return $this->hasMany('App\Models\Period', 'direction_id'); + return $this->belongsToMany(DirectionProfile::class); } } diff --git a/database/factories/DirectionFactory.php b/database/factories/DirectionFactory.php index 57ad9c5..bca14b0 100644 --- a/database/factories/DirectionFactory.php +++ b/database/factories/DirectionFactory.php @@ -20,6 +20,11 @@ class DirectionFactory extends Factory 'department_id' => 1, 'education_level_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(), ]; } } diff --git a/database/migrations/2024_02_09_114155_create_directions_table.php b/database/migrations/2024_02_09_114155_create_directions_table.php index 6e2cc3c..8fe8385 100644 --- a/database/migrations/2024_02_09_114155_create_directions_table.php +++ b/database/migrations/2024_02_09_114155_create_directions_table.php @@ -19,6 +19,11 @@ return new class extends Migration $table->foreignId('department_id')->constrained('departments'); $table->foreignId('education_level_id')->constrained('education_levels'); $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(); }); } diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 55f581a..d20572b 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -32,11 +32,7 @@ class DatabaseSeeder extends Seeder SubjectTypeSeeder::class, DirectionSeeder::class, EntranceExaminationSeeder::class, - PlaceTypeSeeder::class, - PlaceSeeder::class, - CostSeeder::class, DirectionProfileSeeder::class, - PeriodSeeder::class, ]); $this->call([ diff --git a/database/seeders/DirectionSeeder.php b/database/seeders/DirectionSeeder.php index b2bf20e..903db4b 100644 --- a/database/seeders/DirectionSeeder.php +++ b/database/seeders/DirectionSeeder.php @@ -21,6 +21,11 @@ class DirectionSeeder extends Seeder 'department_id' => 1, 'education_level_id' => 1, 'education_form_id' => 1, + 'budget_places' => 30, + 'quota' => 10, + 'paid_places' => 20, + 'cost_paid_place' => 20, + 'period' => 4.5 ], [ 'name' => 'фармация', @@ -32,6 +37,11 @@ class DirectionSeeder extends Seeder 'department_id' => 1, 'education_level_id' => 2, 'education_form_id' => 2, + 'budget_places' => 40, + 'quota' => 20, + 'paid_places' => 30, + 'cost_paid_place' => 30, + 'period' => 5, ], [ 'name' => 'строительство', @@ -43,6 +53,11 @@ class DirectionSeeder extends Seeder 'department_id' => 1, 'education_level_id' => 3, 'education_form_id' => 3, + 'budget_places' => 50, + 'quota' => 20, + 'paid_places' => 30, + 'cost_paid_place' => 30, + 'period' => 5, ], ]); } diff --git a/resources/views/admin/catalog/direction/create.blade.php b/resources/views/admin/catalog/direction/create.blade.php index cebd615..164e38e 100644 --- a/resources/views/admin/catalog/direction/create.blade.php +++ b/resources/views/admin/catalog/direction/create.blade.php @@ -3,6 +3,47 @@ @auth()

Создать Направление

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

Добавить вступительные испытания

@@ -188,6 +275,7 @@
+
{{ Form::submit('Создать Направление', ['class' => 'btn btn-primary']) }}
diff --git a/resources/views/admin/catalog/direction/edit.blade.php b/resources/views/admin/catalog/direction/edit.blade.php index 9715b23..c81476e 100644 --- a/resources/views/admin/catalog/direction/edit.blade.php +++ b/resources/views/admin/catalog/direction/edit.blade.php @@ -1,112 +1,288 @@ @extends('layouts.admin_layout') @section('content') - @auth() +

Создать Направление

+ {{ Form::open(['url' => route('directions.store'), 'method' => 'POST', 'class' => '']) }}
-

Изменить направление

- {{ Form::open(['url' => route('directions.update', $direction), 'method' => 'PATCH', 'class' => '']) }} -
-
- {{ Form::label('position', 'Позиция') }} -
-
- {{ Form::text('position', $direction->position, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('position') }} - @endif -
- -
- {{ Form::label('code', 'Код') }} -
-
- {{ Form::text('code', $direction->code, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('code') }} - @endif -
- -
- {{ Form::label('name', 'Название') }} -
-
- {{ Form::text('name', $direction->name, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('name') }} - @endif -
- -
- {{ Form::label('description', 'Описание') }} -
-
- {{ Form::text('description', $direction->description, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('description') }} - @endif -
-
- {{ Form::label('department_id', 'Факультет') }} -
-
- {{ Form::select('department_id', $departments, $direction->department->id, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('department_id') }} - @endif -
- -
- {{ Form::label('education_level_id', 'Увовень образования') }} -
-
- {{ Form::select('education_level_id', $levels, $direction->educationLevel->id, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('education_level_id') }} - @endif -
- -
- {{ Form::label('education_form_id', 'Увовень образования') }} -
-
- {{ Form::select('education_form_id', $forms, $direction->educationForm->id, ['class' => 'form-select']) }} -
-
- @if ($errors->any()) - {{ $errors->first('education_form_id') }} - @endif -
- -
- {{ Form::label('slug', 'URL') }} -
-
- {{ Form::text('slug', $direction->slug, ['class' => 'form-control']) }} -
-
- @if ($errors->any()) - {{ $errors->first('slug') }} - @endif -
-
- {{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }} -
+
+ {{ Form::label('department_id', 'Кафедра') }} +
+
+ {{ Form::select('department_id', $departments, $direction->department->id, ['class' => 'form-select']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('department_id') }} + @endif +
+
+
+
+ {{ Form::label('education_level_id', 'Увовень образования') }} +
+
+ {{ Form::select('education_level_id', $levels, $direction->educationLevel->id, ['class' => 'form-select']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('education_level_id') }} + @endif +
+
+
+
+ {{ Form::label('education_form_id', 'Форма образования') }} +
+
+ {{ Form::select('education_form_id', $forms, $direction->educationForm->id, ['class' => 'form-select']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('education_form_id') }} + @endif
- {{ Form::close() }}
+
+
+
+ {{ Form::label('position', 'Позиция') }} +
+
+ {{ Form::number('position', $direction->position, ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('position') }} + @endif +
+
+
+
+ {{ Form::label('code', 'Код') }} +
+
+ {{ Form::text('code', $direction->code, ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('code') }} + @endif +
+
+
+
+ {{ Form::label('slug', 'URL') }} +
+
+ {{ Form::text('slug', $direction->slug, ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('slug') }} + @endif +
+
+ +
+ {{ Form::label('name', 'Название') }} +
+
+ {{ Form::text('name', $direction->name, ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('name') }} + @endif +
+ +
+ {{ Form::label('description', 'Описание') }} +
+
+ {{ Form::text('description', $direction->description, ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('description') }} + @endif +
+ + + +
+
+
+ {{ Form::label('budget_places', 'Кол-во бюджетных мест') }} +
+
+ {{ Form::number('budget_places', $direction->budget_places, ['class' => 'form-select']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('budget_places') }} + @endif +
+
+
+
+ {{ Form::label('quota', 'Квота') }} +
+
+ {{ Form::number('quota', $direction->quota, ['class' => 'form-select']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('quota') }} + @endif +
+
+
+
+ {{ Form::label('paid_places', 'Кол-во мест по договорам') }} +
+
+ {{ Form::number('paid_places', $direction->paid_places, ['class' => 'form-select']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('paid_places') }} + @endif +
+
+ +
+
+ {{ Form::label('cost_paid_place', 'Стоимость обучения') }} +
+
+ {{ Form::number('cost_paid_place', $direction->cost_paid_place, ['class' => 'form-select']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('cost_paid_place') }} + @endif +
+
+ +
+
+ {{ Form::label('period', 'Период обучения') }} +
+
+ {{ Form::text('period', $direction->period, ['class' => 'form-select']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('period') }} + @endif +
+
+
+ +
+
+
+ {{ Form::label('direction_profile', 'Профиль подготовки') }} +
+
+ {{ Form::select('direction_profiles[]', $directionProfiles, $direction->directionProfiles, ['class' => 'form-control rounded border-gray-300 w-1/3 h-32', 'multiple' => 'multiple']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('direction_profile') }} + @endif +
+
+
+ +

Добавить вступительные испытания

+ +
+
+
+
+ {{ Form::label('entrance-examination[0][examination_type_id]', 'Тип экзамена') }} +
+
+ {{ Form::select('entrance-examination[0][examination_type_id]', $examination_types, null, ['class' => 'form-select']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('entrance-examination[0][examination_type_id]') }} + @endif +
+
+
+
+ {{ Form::label('entrance-examination[0][subject_id]', 'Предмет') }} +
+
+ {{ Form::select('entrance-examination[0][subject_id]', $subjects, null, ['class' => 'form-select']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('entrance-examination[0][subject_id]') }} + @endif +
+
+
+
+ {{ Form::label('entrance-examination[0][subject_type_id]', 'Тип предмета') }} +
+
+ {{ Form::select('entrance-examination[0][subject_type_id]', $subjectTypes, null, ['class' => 'form-select']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('entrance-examination[0][subject_type_id]') }} + @endif +
+
+
+
+ {{ Form::label('entrance-examination[0][scores]', 'Кол-во баллов') }} +
+
+ {{ Form::text('entrance-examination[0][scores]', '', ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('entrance-examination[0][scores]') }} + @endif +
+
+
+
+ {{ Form::label('entrance-examination[0][position]', 'Позиция') }} +
+
+ {{ Form::text('entrance-examination[0][position]', '', ['class' => 'form-control']) }} +
+
+ @if ($errors->any()) + {{ $errors->first('entrance-examination[0][position]') }} + @endif +
+
+
+
+ {{ Form::label('btn', 'Действия') }} +
+ +
+
+
+ +
+ {{ Form::submit('Изменить Направление', ['class' => 'btn btn-primary']) }} +
+ {{ Form::close() }} +
+ @include('admin.catalog.direction.script') @endauth @endsection + + diff --git a/resources/views/admin/catalog/direction/show.blade.php b/resources/views/admin/catalog/direction/show.blade.php index 09a7e62..e6ffabb 100644 --- a/resources/views/admin/catalog/direction/show.blade.php +++ b/resources/views/admin/catalog/direction/show.blade.php @@ -65,45 +65,23 @@

Количество бюджетных мест

- @foreach($budget as $education_form_id => $amount) - @php - $educationForm = (new EducationForm())->find($education_form_id); - @endphp -

{{ $educationForm->name }} - {{ $amount }}

- @endforeach - + {{ $direction->budget_places }}

Количество мест по договорам об оказании платных обр. услуг

- @foreach($paid as $education_form_id => $amount) - @php - $educationForm = (new EducationForm())->find($education_form_id); - @endphp -

{{ $educationForm->name }} - {{ $amount }}

- @endforeach - + {{ $direction->paid_places }}

стоимость обучения

- @foreach($costs as $education_form_id => $cost) - @php - $educationForm = (new EducationForm())->find($education_form_id); - @endphp -

{{ $educationForm->name }} - {{ $cost }}

- @endforeach + {{ $direction->cost_paid_place }}

Профили подготовки

@foreach($direction->directionProfiles as $profile)

{{ $profile->name }}

@endforeach -

Профили подготовки

- @foreach($direction->periods as $period) - @php - $educationForm = (new EducationForm())->find($period->education_form_id); - @endphp -

{{ $educationForm->name }} - {{ $period->period }}

- @endforeach +

Период Обучения

+ {{ $direction->period }} diff --git a/resources/views/layouts/admin_layout.blade.php b/resources/views/layouts/admin_layout.blade.php index c2c8492..f8fa2fd 100644 --- a/resources/views/layouts/admin_layout.blade.php +++ b/resources/views/layouts/admin_layout.blade.php @@ -45,6 +45,7 @@ diff --git a/routes/admin.php b/routes/admin.php index ccc9a3d..2bcdb9b 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -2,15 +2,11 @@ use App\Http\Controllers\admin\AdmissionController; 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\EducationFormController; use App\Http\Controllers\admin\Catalog\Direction\EducationLevelController; use App\Http\Controllers\admin\Catalog\Direction\EntranceExaminationController; 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\SubjectTypeController; 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('/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) ->scoped(['direction_profile' => 'slug']);