Compare commits

...

4 Commits

Author SHA1 Message Date
aslan 44fdacb9e4 Merge branch 'main' of gitea.mkgtu.ru:aslan/applicant-site
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Failing after 2m31s Details
Tests & Lint & Deploy to Railway / deploy (push) Has been skipped Details
2024-02-29 18:01:43 +03:00
aslan 9d7f531ac8 reorganization DirectionProfile and Direction to many to many 2024-02-29 18:01:23 +03:00
aslan bd8bb7e059 reorganization direction resource 2024-02-29 18:00:50 +03:00
aslan ade2422a4b reorganization resource Cost, Places, Placetype, Period 2024-02-29 17:58:02 +03:00
70 changed files with 474 additions and 2583 deletions

View File

@ -1,88 +0,0 @@
<?php
namespace App\Http\Controllers\admin\Catalog\Direction;
use App\Http\Controllers\Controller;
use App\Http\Requests\admin\Catalog\Direction\StoreCostRequest;
use App\Http\Requests\admin\Catalog\Direction\UpdateCostRequest;
use App\Models\Cost;
use App\Models\Direction;
use App\Models\EducationForm;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
class CostController extends Controller
{
public function index(): View
{
$costs = Cost::all();
return view('admin.catalog.direction.cost.index', compact('costs'));
}
public function create(): View
{
$directions = Direction::pluck('name', 'id');
$educationForms = EducationForm::pluck('name', 'id');
return view(
'admin.catalog.direction.cost.create',
compact(
'directions',
'educationForms',
)
);
}
public function store(StoreCostRequest $request): RedirectResponse
{
$validated = $request->validated();
$cost = new Cost();
$cost->position = $validated['position'];
$cost->description = $validated['description'];
$cost->cost = $validated['cost'];
$cost->education_form_id = $validated['education_form_id'];
$cost->direction_id = $validated['direction_id'];
$cost->save();
return redirect()->route('costs.index');
}
public function show(Cost $cost): View
{
return view('admin.catalog.direction.cost.show', compact('cost'));
}
public function edit(Cost $cost): View
{
$directions = Direction::pluck('name', 'id');
$educationForms = EducationForm::pluck('name', 'id');
return view(
'admin.catalog.direction.cost.edit',
compact(
'cost',
'directions',
'educationForms',
)
);
}
public function update(UpdateCostRequest $request, Cost $cost): RedirectResponse
{
$validated = $request->validated();
$cost->position = $validated['position'];
$cost->description = $validated['description'];
$cost->cost = $validated['cost'];
$cost->education_form_id = $validated['education_form_id'];
$cost->direction_id = $validated['direction_id'];
$cost->save();
return redirect()->route('costs.index');
}
public function destroy(Cost $cost): RedirectResponse
{
$cost->delete();
return redirect()->route('costs.index');
}
}

View File

@ -1,88 +0,0 @@
<?php
namespace App\Http\Controllers\admin\Catalog\Direction;
use App\Http\Controllers\Controller;
use App\Http\Requests\admin\Catalog\Direction\StorePeriodRequest;
use App\Http\Requests\admin\Catalog\Direction\UpdatePeriodRequest;
use App\Models\Direction;
use App\Models\EducationForm;
use App\Models\Period;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
class PeriodController extends Controller
{
public function index(): View
{
$periods = Period::all();
return view('admin.catalog.direction.period.index', compact('periods'));
}
public function create(): View
{
$directions = Direction::pluck('name', 'id');
$educationForms = EducationForm::pluck('name', 'id');
return view(
'admin.catalog.direction.period.create',
compact(
'directions',
'educationForms',
)
);
}
public function store(StorePeriodRequest $request): RedirectResponse
{
$validated = $request->validated();
$period = new Period();
$period->position = $validated['position'];
$period->description = $validated['description'];
$period->period = $validated['period'];
$period->education_form_id = $validated['education_form_id'];
$period->direction_id = $validated['direction_id'];
$period->save();
return redirect()->route('periods.index');
}
public function show(Period $period): View
{
return view('admin.catalog.direction.period.show', compact('period'));
}
public function edit(Period $period): View
{
$directions = Direction::pluck('name', 'id');
$educationForms = EducationForm::pluck('name', 'id');
return view(
'admin.catalog.direction.period.edit',
compact(
'period',
'directions',
'educationForms',
)
);
}
public function update(UpdatePeriodRequest $request, Period $period): RedirectResponse
{
$validated = $request->validated();
$period->position = $validated['position'];
$period->description = $validated['description'];
$period->period = $validated['period'];
$period->education_form_id = $validated['education_form_id'];
$period->direction_id = $validated['direction_id'];
$period->save();
return redirect()->route('periods.index');
}
public function destroy(Period $period): RedirectResponse
{
$period->delete();
return redirect()->route('periods.index');
}
}

View File

@ -1,97 +0,0 @@
<?php
namespace App\Http\Controllers\admin\Catalog\Direction;
use App\Http\Controllers\Controller;
use App\Http\Requests\admin\Catalog\Direction\StorePlaceRequest;
use App\Http\Requests\admin\Catalog\Direction\UpdatePlaceRequest;
use App\Models\Direction;
use App\Models\EducationForm;
use App\Models\Place;
use App\Models\PlaceType;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
class PlaceController extends Controller
{
public function index(): View
{
$places = Place::all();
return view('admin.catalog.direction.place.index', compact('places'));
}
public function create(): View
{
$directions = Direction::pluck('name', 'id');
$placeTypes = PlaceType::pluck('name', 'id');
$educationForms = EducationForm::pluck('name', 'id');
return view(
'admin.catalog.direction.place.create',
compact(
'directions',
'placeTypes',
'educationForms',
)
);
}
public function store(StorePlaceRequest $request): RedirectResponse
{
$validated = $request->validated();
$place = new Place();
$place->position = $validated['position'];
$place->description = $validated['description'];
$place->amount = $validated['amount'];
$place->quota = $validated['quota'];
$place->education_form_id = $validated['education_form_id'];
$place->place_type_id = $validated['place_type_id'];
$place->direction_id = $validated['direction_id'];
$place->save();
return redirect()->route('places.index');
}
public function show(Place $place): View
{
return view('admin.catalog.direction.place.show', compact('place'));
}
public function edit(Place $place): View
{
$directions = Direction::pluck('name', 'id');
$placeTypes = PlaceType::pluck('name', 'id');
$educationForms = EducationForm::pluck('name', 'id');
return view(
'admin.catalog.direction.place.edit',
compact(
'place',
'directions',
'placeTypes',
'educationForms',
)
);
}
public function update(UpdatePlaceRequest $request, Place $place): RedirectResponse
{
$validated = $request->validated();
$place->position = $validated['position'];
$place->description = $validated['description'];
$place->amount = $validated['amount'];
$place->quota = $validated['quota'];
$place->education_form_id = $validated['education_form_id'];
$place->place_type_id = $validated['place_type_id'];
$place->direction_id = $validated['direction_id'];
$place->save();
return redirect()->route('places.index');
}
public function destroy(Place $place): RedirectResponse
{
$place->delete();
return redirect()->route('places.index');
}
}

View File

@ -1,70 +0,0 @@
<?php
namespace App\Http\Controllers\admin\Catalog\Direction;
use App\Http\Controllers\Controller;
use App\Http\Requests\admin\Catalog\Direction\StorePlaceTypeRequest;
use App\Http\Requests\admin\Catalog\Direction\UpdatePlaceTypeRequest;
use App\Models\PlaceType;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
class PlaceTypeController extends Controller
{
public function index(): View
{
$placeTypes = PlaceType::all();
return view('admin.catalog.direction.place_type.index', compact('placeTypes'));
}
public function create(): View
{
return view('admin.catalog.direction.place_type.create');
}
public function store(StorePlaceTypeRequest $request): RedirectResponse
{
$validated = $request->validated();
$type = new PlaceType();
$type->name = $validated['name'];
$type->description = $validated['description'];
$type->slug = $validated['slug'];
$type->position = $validated['position'];
$type->save();
return redirect()->route('place_types.index');
}
public function show(PlaceType $placeType): View
{
return view('admin.catalog.direction.place_type.show', compact('placeType'));
}
public function edit(PlaceType $placeType): View
{
return view('admin.catalog.direction.place_type.edit', compact('placeType'));
}
public function update(UpdatePlaceTypeRequest $request, PlaceType $placeType): RedirectResponse
{
$validated = $request->validated();
$placeType->name = $validated['name'];
$placeType->description = $validated['description'];
$placeType->slug = $validated['slug'];
$placeType->position = $validated['position'];
$placeType->save();
return redirect()->route('place_types.index');
}
public function destroy(PlaceType $placeType): RedirectResponse
{
if ($placeType->places()->exists()) {
return back();
}
$placeType->delete();
return redirect()->route('place_types.index');
}
}

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,19 +64,27 @@ 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']; $entranceExamination->direction_id = $direction->id;
$entranceExamination->direction_id = $direction->id; $entranceExamination->subject_id = $data['subject_id'];
$entranceExamination->subject_id = $data['subject_id']; $entranceExamination->scores = $data['scores'];
$entranceExamination->scores = $data['scores']; $entranceExamination->position = $data['position'];
$entranceExamination->position = $data['position']; $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

@ -1,24 +0,0 @@
<?php
namespace App\Http\Requests\admin\Catalog\Direction;
use Illuminate\Foundation\Http\FormRequest;
class StoreCostRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required|int|numeric|max:255',
'description' => 'string',
'cost' => 'required|int|numeric|max:1000000',
'education_form_id' => 'required|int|numeric|max:255',
'direction_id' => 'required|int|numeric|max:255',
];
}
}

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

@ -1,24 +0,0 @@
<?php
namespace App\Http\Requests\admin\Catalog\Direction;
use Illuminate\Foundation\Http\FormRequest;
class StorePeriodRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required|int|numeric|max:255',
'description' => 'string',
'period' => 'required|int|numeric|max:10',
'education_form_id' => 'required|int|numeric|max:255',
'direction_id' => 'required|int|numeric|max:255',
];
}
}

View File

@ -1,25 +0,0 @@
<?php
namespace App\Http\Requests\admin\Catalog\Direction;
use Illuminate\Foundation\Http\FormRequest;
class StorePlaceRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required|int|numeric|max:255',
'description' => 'string',
'amount' => 'required|int|numeric|max:255',
'quota' => 'required|int|numeric|max:255',
'education_form_id' => 'required|int|numeric|max:255',
'place_type_id' => 'required|int|numeric|max:255',
'direction_id' => 'required|int|numeric|max:255',
];
}
}

View File

@ -1,23 +0,0 @@
<?php
namespace App\Http\Requests\admin\Catalog\Direction;
use Illuminate\Foundation\Http\FormRequest;
class StorePlaceTypeRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required|int|numeric|max:255',
'name' => 'required|string|max:255|unique:place_types,name',
'description' => 'string',
'slug' => 'required|string|max:255|unique:place_types,slug',
];
}
}

View File

@ -1,24 +0,0 @@
<?php
namespace App\Http\Requests\admin\Catalog\Direction;
use Illuminate\Foundation\Http\FormRequest;
class UpdateCostRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required|int|numeric|max:255',
'description' => 'string',
'cost' => 'required|int|numeric|max:1000000',
'education_form_id' => 'required|int|numeric|max:255',
'direction_id' => '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

@ -1,24 +0,0 @@
<?php
namespace App\Http\Requests\admin\Catalog\Direction;
use Illuminate\Foundation\Http\FormRequest;
class UpdatePeriodRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required|int|numeric|max:255',
'description' => 'string',
'period' => 'required|int|numeric|max:10',
'education_form_id' => 'required|int|numeric|max:255',
'direction_id' => 'required|int|numeric|max:255',
];
}
}

View File

@ -1,25 +0,0 @@
<?php
namespace App\Http\Requests\admin\Catalog\Direction;
use Illuminate\Foundation\Http\FormRequest;
class UpdatePlaceRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required|int|numeric|max:255',
'description' => 'string',
'amount' => 'required|int|numeric|max:255',
'quota' => 'required|int|numeric|max:255',
'education_form_id' => 'required|int|numeric|max:255',
'place_type_id' => 'required|int|numeric|max:255',
'direction_id' => 'required|int|numeric|max:255',
];
}
}

View File

@ -1,32 +0,0 @@
<?php
namespace App\Http\Requests\admin\Catalog\Direction;
use Illuminate\Foundation\Http\FormRequest;
class UpdatePlaceTypeRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'position' => 'required|int|numeric|max:255',
'description' => 'string',
'slug' => [
'string',
'required',
'max:255',
"unique:place_types,slug,{$this->place_type->id}",
],
'name' => [
'required',
'string',
'max:255',
"unique:place_types,name,{$this->place_type->id}",
],
];
}
}

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

@ -1,32 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Cost extends Model
{
use HasFactory;
protected $fillable = [
'id',
'position',
'description',
'cost',
'education_form_id',
'place_type_id',
'direction_id',
];
public function direction(): BelongsTo
{
return $this->belongsTo(Direction::class);
}
public function educationForm(): BelongsTo
{
return $this->belongsTo(EducationForm::class);
}
}

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

@ -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;
class DirectionProfile extends Model class DirectionProfile extends Model
{ {
@ -16,11 +17,10 @@ class DirectionProfile extends Model
'description', 'description',
'slug', 'slug',
'position', 'position',
'direction_id'
]; ];
public function direction(): BelongsTo public function direction(): BelongsToMany
{ {
return $this->belongsTo(Direction::class); return $this->belongsToMany(Direction::class);
} }
} }

View File

@ -1,32 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Period extends Model
{
use HasFactory;
protected $fillable = [
'id',
'position',
'description',
'period',
'education_form_id',
'place_type_id',
'direction_id',
];
public function direction(): BelongsTo
{
return $this->belongsTo(Direction::class);
}
public function educationForm(): BelongsTo
{
return $this->belongsTo(EducationForm::class);
}
}

View File

@ -1,38 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Place extends Model
{
use HasFactory;
protected $fillable = [
'id',
'position',
'description',
'amount',
'quota',
'education_form_id',
'place_type_id',
'direction_id',
];
public function direction(): BelongsTo
{
return $this->belongsTo(Direction::class);
}
public function placeType(): BelongsTo
{
return $this->belongsTo(PlaceType::class);
}
public function educationForm(): BelongsTo
{
return $this->belongsTo(EducationForm::class);
}
}

View File

@ -1,25 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class PlaceType extends Model
{
use HasFactory;
protected $fillable = [
'id',
'name',
'description',
'slug',
'position',
];
public function places(): HasMany
{
return $this->hasMany('App\Models\Place', 'place_type_id');
}
}

View File

@ -1,19 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class CostFactory extends Factory
{
public function definition(): array
{
return [
'position' => 1,
'description' => fake()->text(),
'cost' => fake()->randomDigit(),
'education_form_id' => 1,
'direction_id' => 1,
];
}
}

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

@ -13,7 +13,6 @@ class DirectionProfileFactory extends Factory
'description' => fake()->text(), 'description' => fake()->text(),
'slug' => fake()->slug(), 'slug' => fake()->slug(),
'position' => 1, 'position' => 1,
'direction_id' => 1,
]; ];
} }
} }

View File

@ -1,19 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class PeriodFactory extends Factory
{
public function definition(): array
{
return [
'position' => 1,
'description' => fake()->text(),
'period' => fake()->randomDigit(),
'education_form_id' => 1,
'direction_id' => 1,
];
}
}

View File

@ -1,21 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class PlaceFactory extends Factory
{
public function definition(): array
{
return [
'position' => 1,
'description' => fake()->text(),
'amount' => fake()->randomDigit(),
'quota' => fake()->randomDigit(),
'education_form_id' => 1,
'place_type_id' => 1,
'direction_id' => 1,
];
}
}

View File

@ -1,18 +0,0 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class PlaceTypeFactory extends Factory
{
public function definition(): array
{
return [
'name' => fake()->name(),
'description' => fake()->text(),
'slug' => fake()->slug(),
'position' => '1',
];
}
}

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

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('place_types', function (Blueprint $table) {
$table->id();
$table->integer('position');
$table->string('name');
$table->text('description')->nullable();
$table->string('slug');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('place_types');
}
};

View File

@ -1,34 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('places', function (Blueprint $table) {
$table->id();
$table->integer('position');
$table->integer('amount');
$table->integer('quota');
$table->foreignId('education_form_id')->constrained('education_forms');
$table->foreignId('place_type_id')->constrained('place_types');
$table->foreignId('direction_id')->constrained('directions');
$table->text('description')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('places');
}
};

View File

@ -17,7 +17,6 @@ return new class extends Migration
$table->text('description')->nullable(); $table->text('description')->nullable();
$table->string('slug'); $table->string('slug');
$table->string('position'); $table->string('position');
$table->foreignId('direction_id')->constrained('directions');
$table->timestamps(); $table->timestamps();
}); });
} }

View File

@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('periods', function (Blueprint $table) {
$table->id();
$table->integer('position');
$table->float('period');
$table->foreignId('education_form_id')->constrained('education_forms');
$table->foreignId('direction_id')->constrained('directions');
$table->text('description')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('periods');
}
};

View File

@ -11,13 +11,10 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('costs', function (Blueprint $table) { Schema::create('direction_direction_profile', function (Blueprint $table) {
$table->id(); $table->id();
$table->integer('position');
$table->integer('cost');
$table->foreignId('education_form_id')->constrained('education_forms');
$table->foreignId('direction_id')->constrained('directions'); $table->foreignId('direction_id')->constrained('directions');
$table->text('description')->nullable(); $table->foreignId('direction_profile_id')->constrained('direction_profiles');
$table->timestamps(); $table->timestamps();
}); });
} }
@ -27,6 +24,6 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::dropIfExists('costs'); Schema::dropIfExists('direction_direction_profile');
} }
}; };

View File

@ -1,30 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class CostSeeder extends Seeder
{
public function run(): void
{
DB::table('costs')->insert([
[
'position' => 1,
'cost' => 103000,
'education_form_id' => 1,
'direction_id' => 1,
'description' => 'стоимость обучения 103 000 руб',
],
[
'position' => 2,
'cost' => 42000,
'education_form_id' => 2,
'direction_id' => 1,
'description' => 'стоимость обучения 42 000 руб',
],
]);
}
}

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

@ -16,21 +16,18 @@ class DirectionProfileSeeder extends Seeder
'description' => 'Государственно-правовой профиль', 'description' => 'Государственно-правовой профиль',
'slug' => 'the-state-legal', 'slug' => 'the-state-legal',
'position' => 1, 'position' => 1,
'direction_id' => 1,
], ],
[ [
'name' => 'Условно-правовой', 'name' => 'Условно-правовой',
'description' => 'Условно-правовой профиль', 'description' => 'Условно-правовой профиль',
'slug' => 'probationary-profile', 'slug' => 'probationary-profile',
'position' => 2, 'position' => 2,
'direction_id' => 1,
], ],
[ [
'name' => 'Цифровой Юрист', 'name' => 'Цифровой Юрист',
'description' => 'Цифровой Юрист профиль', 'description' => 'Цифровой Юрист профиль',
'slug' => 'digital-lawyer', 'slug' => 'digital-lawyer',
'position' => 3, 'position' => 3,
'direction_id' => 1,
], ],
]); ]);
} }

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

@ -1,30 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class PeriodSeeder extends Seeder
{
public function run(): void
{
DB::table('periods')->insert([
[
'position' => 1,
'period' => 4.5,
'education_form_id' => 1,
'direction_id' => 1,
'description' => 'срок обучения 4.5 года',
],
[
'position' => 1,
'period' => 5,
'education_form_id' => 2,
'direction_id' => 1,
'description' => 'срок обучения 5 года',
],
]);
}
}

View File

@ -1,34 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class PlaceSeeder extends Seeder
{
public function run(): void
{
DB::table('places')->insert([
[
'position' => 1,
'amount' => 25,
'quota' => 4,
'education_form_id' => 1,
'place_type_id' => 1,
'direction_id' => 1,
'description' => 'очная бюджетная форма 25 мест юриспруденция',
],
[
'position' => 2,
'amount' => 30,
'quota' => 8,
'education_form_id' => 2,
'place_type_id' => 2,
'direction_id' => 1,
'description' => 'заочная платная форма 30 мест юриспруденция',
],
]);
}
}

View File

@ -1,31 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class PlaceTypeSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
DB::table('place_types')->insert([
[
'name' => 'бюджетная',
'description' => 'бюджетная',
'slug' => 'budget',
'position' => '1',
],
[
'name' => 'платная',
'description' => 'платная',
'slug' => 'paid',
'position' => '2',
],
]);
}
}

View File

@ -1,79 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
@auth()
<div class="row">
<div class="col">
<h1 class=""> Создать стоимость</h1>
{{ Form::open(['url' => route('costs.store'), 'method' => 'POST', 'class' => '']) }}
<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('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">
{{ Form::label('cost', 'стоимость') }}
</div>
<div class="mt-1">
{{ Form::text('cost', '', ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('cost') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('direction_id', 'Направление подготовки') }}
</div>
<div class="mt-1">
{{ Form::select('direction_id', $directions, null, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('direction_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('education_form_id', 'Форма обучения') }}
</div>
<div class="mt-1">
{{ Form::select('education_form_id', $educationForms, null, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('education_form_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::submit('Создать', ['class' => 'btn btn-primary']) }}
</div>
</div>
{{ Form::close() }}
</div>
</div>
@endauth
@endsection

View File

@ -1,79 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
@auth()
<div class="row">
<div class="col">
<h1 class="">Изменить Стоимость</h1>
{{ Form::open(['url' => route('costs.update', $cost), 'method' => 'PATCH', 'class' => '']) }}
<div class="col">
<div class="mt-3">
{{ Form::label('position', 'Позиция') }}
</div>
<div class="mt-1">
{{ Form::text('position', $cost->position, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('position') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('description', 'Описание') }}
</div>
<div class="mt-1">
{{ Form::text('description', $cost->description, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('description') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('cost', 'Количество мест') }}
</div>
<div class="mt-1">
{{ Form::text('cost', $cost->cost, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('cost') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('direction_id', 'Направление подготовки') }}
</div>
<div class="mt-1">
{{ Form::select('direction_id', $directions, $cost->direction->id, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('direction_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('education_form_id', 'Форма обучения') }}
</div>
<div class="mt-1">
{{ Form::select('education_form_id', $educationForms, $cost->educationForm->id, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('education_form_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
</div>
</div>
{{ Form::close() }}
</div>
</div>
@endauth
@endsection

View File

@ -1,45 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
<div class="container">
<h2>Стоимость</h2>
<br>
<a href="{{ route('costs.create') }}" class="btn btn-primary">Создать Стоимость</a>
<br>
<br>
<table class="table">
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
<tr>
<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>
</thead>
<tbody>
@foreach($costs as $cost)
<tr class="">
<td>{{ $cost->position }}</td>
<td>{{ Str::words($cost->description, 10, '...') }}</td>
<td><a href="{{ route('education_forms.show', $cost->educationForm) }}">{{ $cost->educationForm->name }}</a></td>
<td><a href="{{ route('directions.show', $cost->direction) }}">{{ $cost->direction->name }}</a></td>
<td>{{ $cost->cost }}</td>
<td>
<a href="{{ route("costs.show", $cost) }}"
class="btn btn-info">посмотреть</a>
<a href="{{ route("costs.edit", $cost) }}"
class="btn btn-secondary">редактировать</a>
<a rel="nofollow" data-method="delete" data-confirm="Вы действительно хотите удалить?"
href="{{ route('costs.destroy', $cost) }}"
class="btn btn-danger">удалить</a>
</td>
</tr>
@endforeach
</tbody>
</table>
<br>
<br>
</div>
@endsection

View File

@ -1,17 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
@auth()
<div class="container mt-4">
<h2>позиция</h2>
<p>{{ $cost->position }}</p>
<h2>описание</h2>
<p>{{ $cost->description }}</p>
<h2>Форма обучения</h2>
<p>{{ $cost->educationForm->name }}</p>
<h2>Направление</h2>
<p>{{ $cost->direction->name }}</p>
<h2>Стоимость</h2>
<p>{{ $cost->cost }}</p>
</div>
@endauth
@endsection

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

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

View File

@ -18,18 +18,6 @@
@endif @endif
</div> </div>
<div class="mt-3">
{{ Form::label('direction_id', 'Направление подготовки') }}
</div>
<div class="mt-1">
{{ Form::select('direction_id', $directions, $directionProfile->direction->id, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('direction_id') }}
@endif
</div>
<div class="mt-3"> <div class="mt-3">
{{ Form::label('description', 'Описание') }} {{ Form::label('description', 'Описание') }}
</div> </div>

View File

@ -10,7 +10,6 @@
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left"> <thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
<tr> <tr>
<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">URL</th> <th scope="col">URL</th>
@ -22,7 +21,6 @@
@foreach($directionProfiles as $directionProfile) @foreach($directionProfiles as $directionProfile)
<tr class=""> <tr class="">
<td><a href="{{ route('direction_profiles.show', $directionProfile) }}">{{ $directionProfile->name }}</a></td> <td><a href="{{ route('direction_profiles.show', $directionProfile) }}">{{ $directionProfile->name }}</a></td>
<td><a href="{{ route('directions.show', $directionProfile->direction) }}">{{ $directionProfile->direction->name }}</a></td>
<td>{{ Str::words($directionProfile->description, 10, '...') }}</td> <td>{{ Str::words($directionProfile->description, 10, '...') }}</td>
<td>{{ $directionProfile->position }}</td> <td>{{ $directionProfile->position }}</td>
<td>{{ $directionProfile->slug }}</td> <td>{{ $directionProfile->slug }}</td>

View File

@ -4,8 +4,6 @@
<div class="container mt-4"> <div class="container mt-4">
<h2>Название</h2> <h2>Название</h2>
<p>{{ $directionProfile->name }}</p> <p>{{ $directionProfile->name }}</p>
<h2>Направление подготовки</h2>
<p><a href="{{ route('directions.show', $directionProfile->direction) }}">{{ $directionProfile->direction->name }}</a></p>
<h2>Описание</h2> <h2>Описание</h2>
<p>{{ $directionProfile->description }}</p> <p>{{ $directionProfile->description }}</p>
<h2>Позиция</h2> <h2>Позиция</h2>

View File

@ -1,112 +1,288 @@
@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 class="col"> </div>
<div class="mt-3"> <div class="mt-1">
{{ Form::label('position', 'Позиция') }} {{ Form::select('department_id', $departments, $direction->department->id, ['class' => 'form-select']) }}
</div> </div>
<div class="mt-1"> <div>
{{ Form::text('position', $direction->position, ['class' => 'form-control']) }} @if ($errors->any())
</div> {{ $errors->first('department_id') }}
<div> @endif
@if ($errors->any()) </div>
{{ $errors->first('position') }} </div>
@endif <div class="col">
</div> <div class="mt-3">
{{ Form::label('education_level_id', 'Увовень образования') }}
<div class="mt-3"> </div>
{{ Form::label('code', 'Код') }} <div class="mt-1">
</div> {{ Form::select('education_level_id', $levels, $direction->educationLevel->id, ['class' => 'form-select']) }}
<div class="mt-1"> </div>
{{ Form::text('code', $direction->code, ['class' => 'form-control']) }} <div>
</div> @if ($errors->any())
<div> {{ $errors->first('education_level_id') }}
@if ($errors->any()) @endif
{{ $errors->first('code') }} </div>
@endif </div>
</div> <div class="col">
<div class="mt-3">
<div class="mt-3"> {{ Form::label('education_form_id', 'Форма образования') }}
{{ Form::label('name', 'Название') }} </div>
</div> <div class="mt-1">
<div class="mt-1"> {{ Form::select('education_form_id', $forms, $direction->educationForm->id, ['class' => 'form-select']) }}
{{ Form::text('name', $direction->name, ['class' => 'form-control']) }} </div>
</div> <div>
<div> @if ($errors->any())
@if ($errors->any()) {{ $errors->first('education_form_id') }}
{{ $errors->first('name') }} @endif
@endif
</div>
<div class="mt-3">
{{ Form::label('description', 'Описание') }}
</div>
<div class="mt-1">
{{ Form::text('description', $direction->description, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('description') }}
@endif
</div>
<div class="mt-3">
{{ 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 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 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 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 class="mt-3">
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
</div>
</div> </div>
{{ Form::close() }}
</div> </div>
</div> </div>
<div class="row">
<div class="col">
<div class="mt-3">
{{ Form::label('position', 'Позиция') }}
</div>
<div class="mt-1">
{{ Form::number('position', $direction->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', $direction->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', $direction->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', $direction->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', $direction->description, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('description') }}
@endif
</div>
<div class="row">
<div class="col">
<div class="mt-3">
{{ Form::label('budget_places', 'Кол-во бюджетных мест') }}
</div>
<div class="mt-1">
{{ Form::number('budget_places', $direction->budget_places, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('budget_places') }}
@endif
</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">
{{ Form::label('cost_paid_place', 'Стоимость обучения') }}
</div>
<div class="mt-1">
{{ Form::number('cost_paid_place', $direction->cost_paid_place, ['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', $direction->period, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('period') }}
@endif
</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, $direction->directionProfiles, ['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>
<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() }}
</div>
@include('admin.catalog.direction.script')
@endauth @endauth
@endsection @endsection

View File

@ -1,79 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
@auth()
<div class="row">
<div class="col">
<h1 class="">Создать срок обучения</h1>
{{ Form::open(['url' => route('periods.store'), 'method' => 'POST', 'class' => '']) }}
<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('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">
{{ Form::label('period', 'Срок обучения') }}
</div>
<div class="mt-1">
{{ Form::text('period', '', ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('period') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('direction_id', 'Направление подготовки') }}
</div>
<div class="mt-1">
{{ Form::select('direction_id', $directions, null, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('direction_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('education_form_id', 'Форма обучения') }}
</div>
<div class="mt-1">
{{ Form::select('education_form_id', $educationForms, null, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('education_form_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::submit('Создать', ['class' => 'btn btn-primary']) }}
</div>
</div>
{{ Form::close() }}
</div>
</div>
@endauth
@endsection

View File

@ -1,79 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
@auth()
<div class="row">
<div class="col">
<h1 class="">Изменить Стоимость</h1>
{{ Form::open(['url' => route('periods.update', $period), 'method' => 'PATCH', 'class' => '']) }}
<div class="col">
<div class="mt-3">
{{ Form::label('position', 'Позиция') }}
</div>
<div class="mt-1">
{{ Form::text('position', $period->position, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('position') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('description', 'Описание') }}
</div>
<div class="mt-1">
{{ Form::text('description', $period->description, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('description') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('period', 'Срок обучения') }}
</div>
<div class="mt-1">
{{ Form::text('period', $period->period, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('period') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('direction_id', 'Направление подготовки') }}
</div>
<div class="mt-1">
{{ Form::select('direction_id', $directions, $period->direction->id, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('direction_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('education_form_id', 'Форма обучения') }}
</div>
<div class="mt-1">
{{ Form::select('education_form_id', $educationForms, $period->educationForm->id, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('education_form_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
</div>
</div>
{{ Form::close() }}
</div>
</div>
@endauth
@endsection

View File

@ -1,45 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
<div class="container">
<h2>Срок обучения</h2>
<br>
<a href="{{ route('periods.create') }}" class="btn btn-primary">Создать срок обучения</a>
<br>
<br>
<table class="table">
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
<tr>
<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>
</thead>
<tbody>
@foreach($periods as $period)
<tr class="">
<td>{{ $period->position }}</td>
<td>{{ Str::words($period->description, 10, '...') }}</td>
<td><a href="{{ route('education_forms.show', $period->educationForm) }}">{{ $period->educationForm->name }}</a></td>
<td><a href="{{ route('directions.show', $period->direction) }}">{{ $period->direction->name }}</a></td>
<td>{{ $period->period }}</td>
<td>
<a href="{{ route("periods.show", $period) }}"
class="btn btn-info">посмотреть</a>
<a href="{{ route("periods.edit", $period) }}"
class="btn btn-secondary">редактировать</a>
<a rel="nofollow" data-method="delete" data-confirm="Вы действительно хотите удалить?"
href="{{ route('periods.destroy', $period) }}"
class="btn btn-danger">удалить</a>
</td>
</tr>
@endforeach
</tbody>
</table>
<br>
<br>
</div>
@endsection

View File

@ -1,17 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
@auth()
<div class="container mt-4">
<h2>позиция</h2>
<p>{{ $period->position }}</p>
<h2>описание</h2>
<p>{{ $period->description }}</p>
<h2>Форма обучения</h2>
<p>{{ $period->educationForm->name }}</p>
<h2>Направление</h2>
<p>{{ $period->direction->name }}</p>
<h2>Срок обучения</h2>
<p>{{ $period->period }}</p>
</div>
@endauth
@endsection

View File

@ -1,103 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
@auth()
<div class="row">
<div class="col">
<h1 class=""> Создать места</h1>
{{ Form::open(['url' => route('places.store'), 'method' => 'POST', 'class' => '']) }}
<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('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">
{{ Form::label('amount', 'Количество мест') }}
</div>
<div class="mt-1">
{{ Form::text('amount', '', ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('amount') }}
@endif
</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">
{{ Form::label('direction_id', 'Направление подготовки') }}
</div>
<div class="mt-1">
{{ Form::select('direction_id', $directions, null, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('direction_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('place_type_id', 'Тип места') }}
</div>
<div class="mt-1">
{{ Form::select('place_type_id', $placeTypes, null, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('place_type_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('education_form_id', 'Форма обучения') }}
</div>
<div class="mt-1">
{{ Form::select('education_form_id', $educationForms, null, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('education_form_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::submit('Создать', ['class' => 'btn btn-primary']) }}
</div>
</div>
{{ Form::close() }}
</div>
</div>
@endauth
@endsection

View File

@ -1,103 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
@auth()
<div class="row">
<div class="col">
<h1 class="">Изменить место</h1>
{{ Form::open(['url' => route('places.update', $place), 'method' => 'PATCH', 'class' => '']) }}
<div class="col">
<div class="mt-3">
{{ Form::label('position', 'Позиция') }}
</div>
<div class="mt-1">
{{ Form::text('position', $place->position, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('position') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('description', 'Описание') }}
</div>
<div class="mt-1">
{{ Form::text('description', $place->description, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('description') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('amount', 'Количество мест') }}
</div>
<div class="mt-1">
{{ Form::text('amount', $place->amount, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('amount') }}
@endif
</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">
{{ Form::label('direction_id', 'Направление подготовки') }}
</div>
<div class="mt-1">
{{ Form::select('direction_id', $directions, $place->direction->id, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('direction_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('place_type_id', 'Тип места') }}
</div>
<div class="mt-1">
{{ Form::select('place_type_id', $placeTypes, $place->placeType->id, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('place_type_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('education_form_id', 'Форма обучения') }}
</div>
<div class="mt-1">
{{ Form::select('education_form_id', $educationForms, $place->educationForm->id, ['class' => 'form-select']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('education_form_id') }}
@endif
</div>
<div class="mt-3">
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
</div>
</div>
{{ Form::close() }}
</div>
</div>
@endauth
@endsection

View File

@ -1,49 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
<div class="container">
<h2>Места</h2>
<br>
<a href="{{ route('places.create') }}" class="btn btn-primary">Создать место</a>
<br>
<br>
<table class="table">
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
<tr>
<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>
</thead>
<tbody>
@foreach($places as $place)
<tr class="">
<td>{{ $place->position }}</td>
<td>{{ Str::words($place->description, 10, '...') }}</td>
<td><a href="{{ route('education_forms.show', $place->educationForm) }}">{{ $place->educationForm->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>{{ $place->amount }}</td>
<td>{{ $place->quota }}</td>
<td>
<a href="{{ route("places.show", $place) }}"
class="btn btn-info">посмотреть</a>
<a href="{{ route("places.edit", $place) }}"
class="btn btn-secondary">редактировать</a>
<a rel="nofollow" data-method="delete" data-confirm="Вы действительно хотите удалить?"
href="{{ route('places.destroy', $place) }}"
class="btn btn-danger">удалить</a>
</td>
</tr>
@endforeach
</tbody>
</table>
<br>
<br>
</div>
@endsection

View File

@ -1,21 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
@auth()
<div class="container mt-4">
<h2>позиция</h2>
<p>{{ $place->position }}</p>
<h2>описание</h2>
<p>{{ $place->description }}</p>
<h2>Форма обучения</h2>
<p>{{ $place->educationForm->name }}</p>
<h2>Тип Места</h2>
<p>{{ $place->placeType->name }}</p>
<h2>Направление</h2>
<p>{{ $place->direction->name }}</p>
<h2>Кол-во</h2>
<p>{{ $place->amount }}</p>
<h2>Квота</h2>
<p>{{ $place->quota }}</p>
</div>
@endauth
@endsection

View File

@ -1,65 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
@auth()
<div class="row">
<div class="col">
<h1 class=""> Создать тип Места</h1>
{{ Form::open(['url' => route('place_types.store'), 'method' => 'POST', 'class' => '']) }}
<div class="col">
<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="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 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::submit('Создать', ['class' => 'btn btn-primary']) }}
</div>
</div>
{{ Form::close() }}
</div>
</div>
@endauth
@endsection

View File

@ -1,66 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
@auth()
<div class="row">
<div class="col">
<h1 class="">Изменить тип экзамена</h1>
{{ Form::open(['url' => route('place_types.update', $placeType), 'method' => 'PATCH', 'class' => '']) }}
<div class="col">
<div class="mt-3">
{{ Form::label('name', 'Название') }}
</div>
<div class="mt-1">
{{ Form::text('name', $placeType->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', $placeType->description, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('description') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('slug', 'URL') }}
</div>
<div class="mt-1">
{{ Form::text('slug', $placeType->slug, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('slug') }}
@endif
</div>
<div class="mt-3">
{{ Form::label('position', 'Позиция') }}
</div>
<div class="mt-1">
{{ Form::text('position', $placeType->position, ['class' => 'form-control']) }}
</div>
<div>
@if ($errors->any())
{{ $errors->first('position') }}
@endif
</div>
<div class="mt-3">
{{ Form::submit('Изменить', ['class' => 'btn btn-primary']) }}
</div>
</div>
{{ Form::close() }}
</div>
</div>
@endauth
@endsection

View File

@ -1,41 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
<div class="container">
<h2>Тип Места</h2>
<br>
<a href="{{ route('place_types.create') }}" class="btn btn-primary">Создать тип экзамена</a>
<br>
<br>
<table class="table">
<thead class="border-b-2 border-solid border-black text-left" style="text-align: left">
<tr>
<th scope="col">Позиция</th>
<th scope="col">Название</th>
<th scope="col">Описание</th>
<th scope="col">URL</th>
<th scope="col">действия</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@foreach($placeTypes as $placeType)
<tr class="">
<td>{{ $placeType->position }}</td>
<td><a href="{{ route('place_types.show', $placeType) }}">{{ $placeType->name }}</a></td>
<td>{{ Str::words($placeType->description, 10, '...') }}</td>
<td>{{ $placeType->slug }}</td>
<td>
<a href="{{ route("place_types.edit", $placeType) }}"
class="btn btn-secondary">редактировать</a>
<a rel="nofollow" data-method="delete" data-confirm="Вы действительно хотите удалить?"
href="{{ route('place_types.destroy', $placeType) }}"
class="btn btn-danger">удалить</a>
</td>
</tr>
@endforeach
</tbody>
</table>
<br>
<br>
</div>
@endsection

View File

@ -1,19 +0,0 @@
@extends('layouts.admin_layout')
@section('content')
@auth()
<div class="container mt-4">
<h2>Название</h2>
<p>{{ $placeType->name }}</p>
<h2>Описание</h2>
<p>{{ $placeType->description }}</p>
<h2>URL</h2>
<p>{{ $placeType->slug }}</p>
<h2>Позиция</h2>
<p>{{ $placeType->position }}</p>
<h2>Места</h2>
@foreach($placeType->places as $place)
<p><a href="{{ route('places.show', $place) }}">{{ $place->name }}</a></p>
@endforeach
</div>
@endauth
@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']);

View File

@ -1,117 +0,0 @@
<?php
namespace Tests\Feature\admin\catalog\direction;
use App\Models\Cost;
use App\Models\Department;
use App\Models\Direction;
use App\Models\EducationalInstitution;
use App\Models\EducationForm;
use App\Models\EducationLevel;
use App\Models\Faculty;
use App\Models\Place;
use App\Models\PlaceType;
use App\Models\User;
use Tests\TestCase;
class CostTest extends TestCase
{
private User $user;
private Cost $cost;
private array $data;
protected function setUp(): void
{
parent::setUp();
EducationalInstitution::factory()->create();
Faculty::factory()->create();
Department::factory()->create();
EducationLevel::factory()->create();
EducationForm::factory()->create();
Direction::factory()->create();
$this->cost = Cost::factory()->create();
$this->data = Cost::factory()->make()->only([
'position',
'description',
'cost',
'education_form_id',
'direction_id',
]);
$this->user = User::factory()->create([
'name' => 'admin',
'email' => 'test@example.com',
'password' => 123456
]);
}
public function testIndexCostsPage(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('costs.index'));
$response->assertOk();
}
public function testCreateCostPage(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('costs.create'));
$response->assertOk();
}
public function testStoreCost(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->post(route('costs.store', $this->data));
$response->assertRedirect(route('costs.index'));
$this->assertDatabaseHas('costs', $this->data);
}
public function testShowCost(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('costs.show', $this->cost));
$response->assertOk();
}
public function testEditCostPage(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('costs.edit', $this->cost));
$response->assertOk();
}
public function testUpdateCost(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->patch(route('costs.update', $this->cost), $this->data);
$response->assertRedirect(route('costs.index'));
$this->assertDatabaseHas('costs', $this->data);
}
public function testDestroyCost(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->delete(route('costs.destroy', $this->cost));
$response->assertRedirect(route('costs.index'));
$this->assertDatabaseMissing('costs', $this->cost->toArray());
}
}

View File

@ -1,116 +0,0 @@
<?php
namespace Tests\Feature\admin\catalog\direction;
use App\Models\Cost;
use App\Models\Department;
use App\Models\Direction;
use App\Models\EducationalInstitution;
use App\Models\EducationForm;
use App\Models\EducationLevel;
use App\Models\Faculty;
use App\Models\Period;
use App\Models\User;
use Tests\TestCase;
class PeriodTest extends TestCase
{
private User $user;
private Period $period;
private array $data;
protected function setUp(): void
{
parent::setUp();
EducationalInstitution::factory()->create();
Faculty::factory()->create();
Department::factory()->create();
EducationLevel::factory()->create();
EducationForm::factory()->create();
Direction::factory()->create();
$this->period = Period::factory()->create();
$this->data = Period::factory()->make()->only([
'position',
'description',
'period',
'education_form_id',
'direction_id',
]);
$this->user = User::factory()->create([
'name' => 'admin',
'email' => 'test@example.com',
'password' => 123456
]);
}
public function testIndexPeriodsPage(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('periods.index'));
$response->assertOk();
}
public function testCreatePeriodPage(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('periods.create'));
$response->assertOk();
}
public function testStorePeriod(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->post(route('periods.store', $this->data));
$response->assertRedirect(route('periods.index'));
$this->assertDatabaseHas('periods', $this->data);
}
public function testShowPeriod(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('periods.show', $this->period));
$response->assertOk();
}
public function testEditPeriodPage(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('periods.edit', $this->period));
$response->assertOk();
}
public function testUpdatePeriod(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->patch(route('periods.update', $this->period), $this->data);
$response->assertRedirect(route('periods.index'));
$this->assertDatabaseHas('periods', $this->data);
}
public function testDestroyPeriod(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->delete(route('periods.destroy', $this->period));
$response->assertRedirect(route('periods.index'));
$this->assertDatabaseMissing('periods', $this->period->toArray());
}
}

View File

@ -1,120 +0,0 @@
<?php
namespace Tests\Feature\admin\catalog\direction;
use App\Models\Department;
use App\Models\Direction;
use App\Models\EducationalInstitution;
use App\Models\EducationForm;
use App\Models\EducationLevel;
use App\Models\EntranceExamination;
use App\Models\Faculty;
use App\Models\Place;
use App\Models\PlaceType;
use App\Models\User;
use Tests\TestCase;
class PlaceTest extends TestCase
{
private User $user;
private Place $place;
private array $data;
protected function setUp(): void
{
parent::setUp();
PlaceType::factory()->create();
EducationalInstitution::factory()->create();
Faculty::factory()->create();
Department::factory()->create();
EducationLevel::factory()->create();
EducationForm::factory()->create();
Direction::factory()->create();
$this->place = Place::factory()->create();
$this->data = Place::factory()->make()->only([
'position',
'description',
'amount',
'quota',
'education_form_id',
'place_type_id',
'direction_id',
]);
$this->user = User::factory()->create([
'name' => 'admin',
'email' => 'test@example.com',
'password' => 123456
]);
}
public function testIndexPlacesPage(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('places.index'));
$response->assertOk();
}
public function testCreatePlacePage(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('places.create'));
$response->assertOk();
}
public function testStorePlace(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->post(route('places.store', $this->data));
$response->assertRedirect(route('places.index'));
$this->assertDatabaseHas('places', $this->data);
}
public function testShowPlacePage(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('places.show', $this->place));
$response->assertOk();
}
public function testEditPlacePage(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('places.edit', $this->place));
$response->assertOk();
}
public function testUpdatePlace(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->patch(route('places.update', $this->place), $this->data);
$response->assertRedirect(route('places.index'));
$this->assertDatabaseHas('places', $this->data);
}
public function testDestroyPlace(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->delete(route('places.destroy', $this->place));
$response->assertRedirect(route('places.index'));
$this->assertDatabaseMissing('places', $this->place->toArray());
}
}

View File

@ -1,102 +0,0 @@
<?php
namespace Tests\Feature\admin\catalog\direction;
use App\Models\ExaminationType;
use App\Models\PlaceType;
use App\Models\User;
use Tests\TestCase;
class PlaceTypeTest extends TestCase
{
private User $user;
private PlaceType $type;
private array $data;
protected function setUp(): void
{
parent::setUp();
$this->type = PlaceType::factory()->create();
$this->data = PlaceType::factory()->make()->only([
'name',
'description',
'position',
'slug',
]);
$this->user = User::factory()->create([
'name' => 'admin',
'email' => 'test@example.com',
'password' => 123456
]);
}
public function testIndexPlaceTypesPage(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('place_types.index'));
$response->assertOk();
}
public function testCreatePlaceTypePage(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('place_types.create'));
$response->assertOk();
}
public function testStorePlaceType(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->post(route('place_types.store', $this->data));
$response->assertRedirect(route('place_types.index'));
$this->assertDatabaseHas('place_types', $this->data);
}
public function testShowPlaceTypePage(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('place_types.show', $this->type));
$response->assertOk();
}
public function testEditPlaceTypePage(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->get(route('place_types.edit', $this->type));
$response->assertOk();
}
public function testUpdatePlaceType(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->patch(route('place_types.update', $this->type), $this->data);
$response->assertRedirect(route('place_types.index'));
$this->assertDatabaseHas('place_types', $this->data);
}
public function testDestroyPlaceType(): void
{
$response = $this->actingAs($this->user)
->withSession(['banned' => false])
->delete(route('place_types.destroy', $this->type));
$response->assertRedirect(route('place_types.index'));
$this->assertDatabaseMissing('place_types', $this->type->toArray());
}
}