Compare commits

..

4 Commits

Author SHA1 Message Date
aslan f482d036e1 any fix
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Failing after 1m38s Details
Tests & Lint & Deploy to Railway / deploy (push) Has been skipped Details
2024-02-28 15:05:54 +03:00
aslan 422a5872c9 add entrance Examination to store Direction 2024-02-28 15:05:41 +03:00
aslan 3cb9ec4a08 add jquery to project 2024-02-28 15:04:10 +03:00
aslan c1dbcc82b3 add quota at Places Resource 2024-02-28 15:03:46 +03:00
32 changed files with 378 additions and 83 deletions

View File

@ -4,9 +4,7 @@ namespace App\Http\Controllers\admin\Catalog\Direction;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\admin\Catalog\Direction\StoreCostRequest; use App\Http\Requests\admin\Catalog\Direction\StoreCostRequest;
use App\Http\Requests\admin\Catalog\Direction\StorePlaceRequest;
use App\Http\Requests\admin\Catalog\Direction\UpdateCostRequest; use App\Http\Requests\admin\Catalog\Direction\UpdateCostRequest;
use App\Http\Requests\admin\Catalog\Direction\UpdatePlaceRequest;
use App\Models\Cost; use App\Models\Cost;
use App\Models\Direction; use App\Models\Direction;
use App\Models\EducationForm; use App\Models\EducationForm;

View File

@ -23,7 +23,7 @@ class EntranceExaminationController extends Controller
public function create(): View public function create(): View
{ {
$directions = Direction::pluck('name', 'id'); $directions = Direction::pluck('full_name', 'id');
$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');
@ -64,7 +64,7 @@ class EntranceExaminationController extends Controller
public function edit(EntranceExamination $entranceExamination): View public function edit(EntranceExamination $entranceExamination): View
{ {
$directions = Direction::pluck('name', 'id'); $directions = Direction::pluck('full_name', 'id');
$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');

View File

@ -6,9 +6,7 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\admin\Catalog\Direction\StoreExaminationTypeRequest; use App\Http\Requests\admin\Catalog\Direction\StoreExaminationTypeRequest;
use App\Http\Requests\admin\Catalog\Direction\UpdateExaminationTypeRequest; use App\Http\Requests\admin\Catalog\Direction\UpdateExaminationTypeRequest;
use App\Models\ExaminationType; use App\Models\ExaminationType;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View; use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
class ExaminationTypeController extends Controller class ExaminationTypeController extends Controller

View File

@ -3,9 +3,7 @@
namespace App\Http\Controllers\admin\Catalog\Direction; namespace App\Http\Controllers\admin\Catalog\Direction;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\admin\Catalog\Direction\StoreCostRequest;
use App\Http\Requests\admin\Catalog\Direction\StorePeriodRequest; use App\Http\Requests\admin\Catalog\Direction\StorePeriodRequest;
use App\Http\Requests\admin\Catalog\Direction\UpdateCostRequest;
use App\Http\Requests\admin\Catalog\Direction\UpdatePeriodRequest; use App\Http\Requests\admin\Catalog\Direction\UpdatePeriodRequest;
use App\Models\Direction; use App\Models\Direction;
use App\Models\EducationForm; use App\Models\EducationForm;

View File

@ -43,6 +43,7 @@ class PlaceController extends Controller
$place->position = $validated['position']; $place->position = $validated['position'];
$place->description = $validated['description']; $place->description = $validated['description'];
$place->amount = $validated['amount']; $place->amount = $validated['amount'];
$place->quota = $validated['quota'];
$place->education_form_id = $validated['education_form_id']; $place->education_form_id = $validated['education_form_id'];
$place->place_type_id = $validated['place_type_id']; $place->place_type_id = $validated['place_type_id'];
$place->direction_id = $validated['direction_id']; $place->direction_id = $validated['direction_id'];
@ -79,6 +80,7 @@ class PlaceController extends Controller
$place->position = $validated['position']; $place->position = $validated['position'];
$place->description = $validated['description']; $place->description = $validated['description'];
$place->amount = $validated['amount']; $place->amount = $validated['amount'];
$place->quota = $validated['quota'];
$place->education_form_id = $validated['education_form_id']; $place->education_form_id = $validated['education_form_id'];
$place->place_type_id = $validated['place_type_id']; $place->place_type_id = $validated['place_type_id'];
$place->direction_id = $validated['direction_id']; $place->direction_id = $validated['direction_id'];

View File

@ -3,9 +3,7 @@
namespace App\Http\Controllers\admin\Catalog\Direction; namespace App\Http\Controllers\admin\Catalog\Direction;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\admin\Catalog\Direction\StoreExaminationTypeRequest;
use App\Http\Requests\admin\Catalog\Direction\StorePlaceTypeRequest; use App\Http\Requests\admin\Catalog\Direction\StorePlaceTypeRequest;
use App\Http\Requests\admin\Catalog\Direction\UpdateExaminationTypeRequest;
use App\Http\Requests\admin\Catalog\Direction\UpdatePlaceTypeRequest; use App\Http\Requests\admin\Catalog\Direction\UpdatePlaceTypeRequest;
use App\Models\PlaceType; use App\Models\PlaceType;
use Illuminate\Contracts\View\View; use Illuminate\Contracts\View\View;

View File

@ -3,9 +3,7 @@
namespace App\Http\Controllers\admin\Catalog\Direction; namespace App\Http\Controllers\admin\Catalog\Direction;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\admin\Catalog\Direction\StoreExaminationTypeRequest;
use App\Http\Requests\admin\Catalog\Direction\StoreSubjectRequest; use App\Http\Requests\admin\Catalog\Direction\StoreSubjectRequest;
use App\Http\Requests\admin\Catalog\Direction\UpdateExaminationTypeRequest;
use App\Http\Requests\admin\Catalog\Direction\UpdateSubjectRequest; use App\Http\Requests\admin\Catalog\Direction\UpdateSubjectRequest;
use App\Models\Subject; use App\Models\Subject;
use Illuminate\Contracts\View\View; use Illuminate\Contracts\View\View;

View File

@ -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'];

View File

@ -16,6 +16,7 @@ class StorePlaceRequest extends FormRequest
'position' => 'required|int|numeric|max:255', 'position' => 'required|int|numeric|max:255',
'description' => 'string', 'description' => 'string',
'amount' => 'required|int|numeric|max:255', 'amount' => 'required|int|numeric|max:255',
'quota' => 'required|int|numeric|max:255',
'education_form_id' => 'required|int|numeric|max:255', 'education_form_id' => 'required|int|numeric|max:255',
'place_type_id' => 'required|int|numeric|max:255', 'place_type_id' => 'required|int|numeric|max:255',
'direction_id' => 'required|int|numeric|max:255', 'direction_id' => 'required|int|numeric|max:255',

View File

@ -16,6 +16,7 @@ class UpdatePlaceRequest extends FormRequest
'position' => 'required|int|numeric|max:255', 'position' => 'required|int|numeric|max:255',
'description' => 'string', 'description' => 'string',
'amount' => 'required|int|numeric|max:255', 'amount' => 'required|int|numeric|max:255',
'quota' => 'required|int|numeric|max:255',
'education_form_id' => 'required|int|numeric|max:255', 'education_form_id' => 'required|int|numeric|max:255',
'place_type_id' => 'required|int|numeric|max:255', 'place_type_id' => 'required|int|numeric|max:255',
'direction_id' => 'required|int|numeric|max:255', 'direction_id' => 'required|int|numeric|max:255',

View File

@ -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',
]; ];
} }
} }

View File

@ -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}",
], ],
]; ];
} }

View File

@ -14,6 +14,7 @@ class Direction extends Model
protected $fillable = [ protected $fillable = [
'id', 'id',
'name', 'name',
'full_name',
'description', 'description',
'position', 'position',
'slug', 'slug',

View File

@ -15,6 +15,7 @@ class Place extends Model
'position', 'position',
'description', 'description',
'amount', 'amount',
'quota',
'education_form_id', 'education_form_id',
'place_type_id', 'place_type_id',
'direction_id', 'direction_id',

View File

@ -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,

View File

@ -12,6 +12,7 @@ class PlaceFactory extends Factory
'position' => 1, 'position' => 1,
'description' => fake()->text(), 'description' => fake()->text(),
'amount' => fake()->randomDigit(), 'amount' => fake()->randomDigit(),
'quota' => fake()->randomDigit(),
'education_form_id' => 1, 'education_form_id' => 1,
'place_type_id' => 1, 'place_type_id' => 1,
'direction_id' => 1, 'direction_id' => 1,

View File

@ -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');

View File

@ -15,6 +15,7 @@ return new class extends Migration
$table->id(); $table->id();
$table->integer('position'); $table->integer('position');
$table->integer('amount'); $table->integer('amount');
$table->integer('quota');
$table->foreignId('education_form_id')->constrained('education_forms'); $table->foreignId('education_form_id')->constrained('education_forms');
$table->foreignId('place_type_id')->constrained('place_types'); $table->foreignId('place_type_id')->constrained('place_types');
$table->foreignId('direction_id')->constrained('directions'); $table->foreignId('direction_id')->constrained('directions');

View File

@ -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',

View File

@ -14,6 +14,7 @@ class PlaceSeeder extends Seeder
[ [
'position' => 1, 'position' => 1,
'amount' => 25, 'amount' => 25,
'quota' => 4,
'education_form_id' => 1, 'education_form_id' => 1,
'place_type_id' => 1, 'place_type_id' => 1,
'direction_id' => 1, 'direction_id' => 1,
@ -22,6 +23,7 @@ class PlaceSeeder extends Seeder
[ [
'position' => 2, 'position' => 2,
'amount' => 30, 'amount' => 30,
'quota' => 8,
'education_form_id' => 2, 'education_form_id' => 2,
'place_type_id' => 2, 'place_type_id' => 2,
'direction_id' => 1, 'direction_id' => 1,

8
package-lock.json generated
View File

@ -6,7 +6,8 @@
"": { "": {
"dependencies": { "dependencies": {
"@rails/ujs": "^7.1.2", "@rails/ujs": "^7.1.2",
"bootstrap-icons": "^1.11.3" "bootstrap-icons": "^1.11.3",
"jquery": "^3.7.1"
}, },
"devDependencies": { "devDependencies": {
"@popperjs/core": "^2.11.6", "@popperjs/core": "^2.11.6",
@ -1421,6 +1422,11 @@
"jiti": "bin/jiti.js" "jiti": "bin/jiti.js"
} }
}, },
"node_modules/jquery": {
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.7.1.tgz",
"integrity": "sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg=="
},
"node_modules/laravel-vite-plugin": { "node_modules/laravel-vite-plugin": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/laravel-vite-plugin/-/laravel-vite-plugin-1.0.1.tgz", "resolved": "https://registry.npmjs.org/laravel-vite-plugin/-/laravel-vite-plugin-1.0.1.tgz",

View File

@ -21,6 +21,7 @@
}, },
"dependencies": { "dependencies": {
"@rails/ujs": "^7.1.2", "@rails/ujs": "^7.1.2",
"bootstrap-icons": "^1.11.3" "bootstrap-icons": "^1.11.3",
"jquery": "^3.7.1"
} }
} }

View File

@ -2,8 +2,9 @@
import Alpine from 'alpinejs'; import Alpine from 'alpinejs';
import ujs from '@rails/ujs'; import ujs from '@rails/ujs';
import jQuery from 'jquery';
window.Alpine = Alpine; window.Alpine = Alpine;
Alpine.start(); Alpine.start();
ujs.start(); ujs.start();
window.$ = jQuery;

View File

@ -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

View File

@ -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>

View File

@ -43,6 +43,18 @@
@endif @endif
</div> </div>
<div class="mt-3">
{{ Form::label('quota', 'Квота') }}
</div>
<div class="mt-1">
{{ Form::text('quota', '', ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('quota') }}
@endif
</div>
<div class="mt-3"> <div class="mt-3">
{{ Form::label('direction_id', 'Направление подготовки') }} {{ Form::label('direction_id', 'Направление подготовки') }}
</div> </div>

View File

@ -43,6 +43,18 @@
@endif @endif
</div> </div>
<div class="mt-3">
{{ Form::label('quota', 'Квота') }}
</div>
<div class="mt-1">
{{ Form::text('quota', $place->amount, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('quota') }}
@endif
</div>
<div class="mt-3"> <div class="mt-3">
{{ Form::label('direction_id', 'Направление подготовки') }} {{ Form::label('direction_id', 'Направление подготовки') }}
</div> </div>

View File

@ -15,6 +15,7 @@
<th scope="col">Тип места</th> <th scope="col">Тип места</th>
<th scope="col">направление</th> <th scope="col">направление</th>
<th scope="col">Кол-во</th> <th scope="col">Кол-во</th>
<th scope="col">Квота</th>
<th scope="col">действия</th> <th scope="col">действия</th>
<th scope="col"></th> <th scope="col"></th>
</tr> </tr>
@ -28,6 +29,7 @@
<td><a href="{{ route('place_types.show', $place->placeType) }}">{{ $place->placeType->name }}</a></td> <td><a href="{{ route('place_types.show', $place->placeType) }}">{{ $place->placeType->name }}</a></td>
<td><a href="{{ route('directions.show', $place->direction) }}">{{ $place->direction->name }}</a></td> <td><a href="{{ route('directions.show', $place->direction) }}">{{ $place->direction->name }}</a></td>
<td>{{ $place->amount }}</td> <td>{{ $place->amount }}</td>
<td>{{ $place->quota }}</td>
<td> <td>
<a href="{{ route("places.show", $place) }}" <a href="{{ route("places.show", $place) }}"
class="btn btn-info">посмотреть</a> class="btn btn-info">посмотреть</a>

View File

@ -14,6 +14,8 @@
<p>{{ $place->direction->name }}</p> <p>{{ $place->direction->name }}</p>
<h2>Кол-во</h2> <h2>Кол-во</h2>
<p>{{ $place->amount }}</p> <p>{{ $place->amount }}</p>
<h2>Квота</h2>
<p>{{ $place->quota }}</p>
</div> </div>
@endauth @endauth
@endsection @endsection

View File

@ -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>

View File

@ -36,6 +36,7 @@ class PlaceTest extends TestCase
'position', 'position',
'description', 'description',
'amount', 'amount',
'quota',
'education_form_id', 'education_form_id',
'place_type_id', 'place_type_id',
'direction_id', 'direction_id',

View File

@ -12,4 +12,9 @@ export default defineConfig({
refresh: true, refresh: true,
}), }),
], ],
resolve: {
alias: {
'$': 'jQuery'
},
},
}); });