forked from aslan/applicant-site
Compare commits
1 Commits
b372f14c37
...
50be5bfd70
Author | SHA1 | Date |
---|---|---|
ROMANGOLIENKO | 50be5bfd70 |
|
@ -31,14 +31,7 @@ class FacultyController extends Controller
|
||||||
{
|
{
|
||||||
$validated = $request->validated();
|
$validated = $request->validated();
|
||||||
|
|
||||||
if ($validated['slug'] === null) {
|
$slug = $validated['slug'] === null ? Str::slug($validated['name']) : $validated['slug'];
|
||||||
$transliterationSlug = Str::slug($validated['name']);
|
|
||||||
$randomNumber = random_int(100, 999);
|
|
||||||
$slug = "{$transliterationSlug}-{$randomNumber}";
|
|
||||||
} else {
|
|
||||||
$slug = $validated['slug'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$faculty = new Faculty();
|
$faculty = new Faculty();
|
||||||
$faculty->name = $validated['name'];
|
$faculty->name = $validated['name'];
|
||||||
$faculty->description = $validated['description'];
|
$faculty->description = $validated['description'];
|
||||||
|
|
|
@ -7,7 +7,6 @@ use App\Http\Controllers\Controller;
|
||||||
use App\Models\Admission;
|
use App\Models\Admission;
|
||||||
use App\Models\Direction;
|
use App\Models\Direction;
|
||||||
use App\Models\Faculty;
|
use App\Models\Faculty;
|
||||||
use App\Models\Subject;
|
|
||||||
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;
|
||||||
|
@ -30,7 +29,6 @@ class PageController extends Controller
|
||||||
// ->groupBy('faculties.name')
|
// ->groupBy('faculties.name')
|
||||||
// ->get();
|
// ->get();
|
||||||
$faculties = Faculty::all();
|
$faculties = Faculty::all();
|
||||||
$subjects = Subject::pluck('name', 'id');
|
|
||||||
// $infBez = $faculties->find(FacultyEnum::InfBez->value);
|
// $infBez = $faculties->find(FacultyEnum::InfBez->value);
|
||||||
// $query = `select faculties.name, directions.name, directions.id
|
// $query = `select faculties.name, directions.name, directions.id
|
||||||
//FROM faculties
|
//FROM faculties
|
||||||
|
@ -45,12 +43,6 @@ class PageController extends Controller
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
return view('new-design.bakalavr-special', compact('faculties', 'subjects'));
|
return view('new-design.bakalavr-special', compact('faculties'));
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function calculator($request)
|
|
||||||
{
|
|
||||||
return response()->json($request);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ class StoreDirectionRequest extends FormRequest
|
||||||
'paid_places' => 'required|int|numeric|max:255',
|
'paid_places' => 'required|int|numeric|max:255',
|
||||||
'quota' => 'required|int|numeric|max:255',
|
'quota' => 'required|int|numeric|max:255',
|
||||||
'cost_paid_place' => 'required|int|numeric|max:255',
|
'cost_paid_place' => 'required|int|numeric|max:255',
|
||||||
'period' => 'required|numeric|max:255',
|
'period' => 'required|string|max:255',
|
||||||
'direction_profiles' => 'nullable|array'
|
'direction_profiles' => 'nullable|array'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Http\Requests\admin\Catalog;
|
namespace App\Http\Requests\admin\Catalog;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Validation\ValidationRule;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class UpdateDirectionRequest extends FormRequest
|
class UpdateDirectionRequest extends FormRequest
|
||||||
|
@ -31,7 +32,7 @@ class UpdateDirectionRequest extends FormRequest
|
||||||
'paid_places' => 'required|int|numeric|max:255',
|
'paid_places' => 'required|int|numeric|max:255',
|
||||||
'quota' => 'required|int|numeric|max:255',
|
'quota' => 'required|int|numeric|max:255',
|
||||||
'cost_paid_place' => 'required|int|numeric|max:255',
|
'cost_paid_place' => 'required|int|numeric|max:255',
|
||||||
'period' => 'required|numeric|max:255',
|
'period' => 'required|string|max:255',
|
||||||
'direction_profiles' => 'nullable|array',
|
'direction_profiles' => 'nullable|array',
|
||||||
'delete.*' => 'nullable|array'
|
'delete.*' => 'nullable|array'
|
||||||
];
|
];
|
||||||
|
|
|
@ -10,10 +10,10 @@ return new class extends Migration
|
||||||
{
|
{
|
||||||
Schema::create('faculties', function (Blueprint $table) {
|
Schema::create('faculties', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name')->unique();
|
$table->string('name');
|
||||||
$table->text('description')->nullable();
|
$table->text('description')->nullable();
|
||||||
$table->integer('position');
|
$table->integer('position');
|
||||||
$table->string('slug')->unique();
|
$table->string('slug');
|
||||||
$table->foreignId('educational_institution_id')->constrained('educational_institutions');
|
$table->foreignId('educational_institution_id')->constrained('educational_institutions');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'faculty' => [
|
'position' => '2',
|
||||||
'position' => 'Поле "Позиция" нужно для упарядочивания отображения на сайте',
|
|
||||||
'name' => 'Поле "Название" должно быть уникальным для отображения на сайте',
|
|
||||||
'description' => 'Поле "Описание" может быть пустым для отображения на сайте',
|
|
||||||
'educational_institution_id' => 'Поле "Учебное заведение" указывает на привязку к учебному заведению',
|
|
||||||
'URL' => 'Поле "Учебное заведение" указывает на привязку к учебному заведению'
|
|
||||||
]
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'faculty' => [
|
'position' => '1',
|
||||||
'position' => 'Поле "Позиция" нужно для упарядочивания отображения на сайте',
|
|
||||||
'name' => 'Поле "Название" должно быть уникальным для отображения на сайте',
|
|
||||||
'description' => 'Поле "Описание" может быть пустым для отображения на сайте',
|
|
||||||
'educational_institution_id' => 'Поле "Учебное заведение" указывает на привязку к учебному заведению',
|
|
||||||
'URL' => 'Поле "Учебное заведение" указывает на привязку к учебному заведению'
|
|
||||||
]
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -7,7 +7,18 @@ if(isset($_POST['ajx'])) {
|
||||||
}
|
}
|
||||||
if($_POST['ajx']=='get_napr') {
|
if($_POST['ajx']=='get_napr') {
|
||||||
if(isset($_POST['format'])&&$_POST['format']=='html'){
|
if(isset($_POST['format'])&&$_POST['format']=='html'){
|
||||||
$out['html'] = $_POST['predmets'];
|
$out['html'] = '
|
||||||
|
<tr class="border-bottom border-white">
|
||||||
|
<td> Технологический факультет 1</td>
|
||||||
|
<td> Строительство </td>
|
||||||
|
<td class="text-end"> 4 года</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="border-bottom border-white">
|
||||||
|
<td> Технологический факультет 2</td>
|
||||||
|
<td> Строительство </td>
|
||||||
|
<td class="text-end"> 4 года</td>
|
||||||
|
</tr>
|
||||||
|
';
|
||||||
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
|
@ -5,17 +5,14 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<h1 class=""> Создать факультет</h1>
|
<h1 class=""> Создать факультет</h1>
|
||||||
{{ Form::open(['url' => route('faculties.store'), 'method' => 'POST', 'class' => 'needs-validation', 'novalidate']) }}
|
{{ Form::open(['url' => route('faculties.store'), 'method' => 'POST', 'class' => '']) }}
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
{{ Form::label('position', 'Позиция', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.position')]) }}
|
{{ Form::label('position', 'Позиция', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.position')]) }}
|
||||||
<span class="text-danger">*</span>
|
<span class="text-danger">*</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-1">
|
<div class="mt-1">
|
||||||
{{ Form::number('position', PositionHelper::faculty(), ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.position'), 'required']) }}
|
{{ Form::number('position', PositionHelper::faculty(), ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.position')]) }}
|
||||||
<div class="invalid-feedback">
|
|
||||||
Поле "Позиция" обязательно!
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="text-danger">
|
<div class="text-danger">
|
||||||
@if ($errors->any())
|
@if ($errors->any())
|
||||||
|
@ -24,14 +21,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
{{ Form::label('name', 'Название', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.name')]) }}
|
{{ Form::label('name', 'Название') }}
|
||||||
<span class="text-danger">*</span>
|
<span class="text-danger">*</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-1">
|
<div class="mt-1">
|
||||||
{{ Form::text('name', '', ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.name'), 'required']) }}
|
{{ Form::text('name', '', ['class' => 'form-control']) }}
|
||||||
<div class="invalid-feedback">
|
|
||||||
Поле "Название" обязательно!
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="text-danger">
|
<div class="text-danger">
|
||||||
@if ($errors->any())
|
@if ($errors->any())
|
||||||
|
@ -40,10 +34,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
{{ Form::label('description', 'Описание', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.description')]) }}
|
{{ Form::label('description', 'Описание') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-1">
|
<div class="mt-1">
|
||||||
{{ Form::text('description', '', ['class' => 'form-control', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.description')]) }}
|
{{ Form::text('description', '', ['class' => 'form-control']) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-danger">
|
<div class="text-danger">
|
||||||
@if ($errors->any())
|
@if ($errors->any())
|
||||||
|
@ -51,11 +45,11 @@
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
{{ Form::label('educational_institution_id', 'Учебное заведение', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.educational_institution_id')]) }}
|
{{ Form::label('educational_institution_id', 'Учебное заведение') }}
|
||||||
<span class="text-danger">*</span>
|
<span class="text-danger">*</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-1">
|
<div class="mt-1">
|
||||||
{{ Form::select('educational_institution_id', $educationalInstitutions, null, ['class' => 'form-select', 'data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.educational_institution_id')]) }}
|
{{ Form::select('educational_institution_id', $educationalInstitutions, null, ['class' => 'form-select']) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-danger">
|
<div class="text-danger">
|
||||||
@if ($errors->any())
|
@if ($errors->any())
|
||||||
|
@ -63,10 +57,10 @@
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-3">
|
<div class="mt-3">
|
||||||
{{ Form::label('slug', 'URL', ['data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.slug')]) }}
|
{{ Form::label('slug', 'URL') }}
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-1">
|
<div class="mt-1">
|
||||||
{{ Form::text('slug', '', ['class' => 'form-control','data-bs-toggle' => "tooltip", 'data-bs-title' => __('tooltips.faculty.slug')]) }}
|
{{ Form::text('slug', '', ['class' => 'form-control']) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="text-danger">
|
<div class="text-danger">
|
||||||
@if ($errors->any())
|
@if ($errors->any())
|
||||||
|
@ -81,22 +75,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endauth
|
@endauth
|
||||||
<script>
|
|
||||||
(function () {
|
|
||||||
'use strict'
|
|
||||||
var forms = document.querySelectorAll('.needs-validation')
|
|
||||||
|
|
||||||
Array.prototype.slice.call(forms)
|
|
||||||
.forEach(function (form) {
|
|
||||||
form.addEventListener('submit', function (event) {
|
|
||||||
if (!form.checkValidity()) {
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
|
|
||||||
form.classList.add('was-validated')
|
|
||||||
}, false)
|
|
||||||
})
|
|
||||||
})()
|
|
||||||
</script>
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
@ -572,16 +572,49 @@
|
||||||
|
|
||||||
<div class="text-white display-6" > Выберите предметы ЕГЭ</div>
|
<div class="text-white display-6" > Выберите предметы ЕГЭ</div>
|
||||||
<form class="text-white mt-4 fs-4 calcul" style=" font-family: Geologica-ExtraLight">
|
<form class="text-white mt-4 fs-4 calcul" style=" font-family: Geologica-ExtraLight">
|
||||||
@foreach($subjects as $id => $name)
|
<label class="checkbox1"> Русский язык
|
||||||
|
<input type="checkbox" checked="checked" value="5">
|
||||||
<label class="checkbox1"> {{$name }}
|
<span class="checkmark"></span>
|
||||||
<input type="checkbox" @if($id == '2' || $id == '3') checked="checked" @endif value="{{ $id }}">
|
</label>
|
||||||
<span class="checkmark"></span>
|
|
||||||
</label>
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
|
<label class="checkbox1">Математика
|
||||||
|
<input type="checkbox" name="subject[]" value="10">
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="checkbox1">Физика
|
||||||
|
<input type="checkbox">
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="checkbox1">Химия
|
||||||
|
<input type="checkbox">
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
</label>
|
||||||
|
<label class="checkbox1">Биология
|
||||||
|
<input type="checkbox">
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
</label>
|
||||||
|
<label class="checkbox1">Иностранный язык
|
||||||
|
<input type="checkbox">
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
</label>
|
||||||
|
<label class="checkbox1">История
|
||||||
|
<input type="checkbox">
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
</label>
|
||||||
|
<label class="checkbox1">Обществознание
|
||||||
|
<input type="checkbox">
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
</label>
|
||||||
|
<label class="checkbox1">Литература
|
||||||
|
<input type="checkbox">
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
</label>
|
||||||
|
<label class="checkbox1">Информатика / ИКТ
|
||||||
|
<input type="checkbox">
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
</label>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
<div class="row d-md-block d-flex ms-md-3 justify-content-center">
|
<div class="row d-md-block d-flex ms-md-3 justify-content-center">
|
||||||
|
@ -597,7 +630,7 @@
|
||||||
console.log(selected);
|
console.log(selected);
|
||||||
|
|
||||||
$(".calcul_rez").html('<tr><td>обрабатываем</td></tr>');
|
$(".calcul_rez").html('<tr><td>обрабатываем</td></tr>');
|
||||||
$.ajax({ url: "json.php", dataType: 'json', cache:false,type: "POST",data: 'ajx=get_napr&format=html&predmets='+selected,
|
$.ajax({ url: "json.php", dataType: 'json', cache:false,type: "POST",data: 'ajx=get_napr&format=html&predmets='+predmets,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$(".calcul_rez").html(data.html);
|
$(".calcul_rez").html(data.html);
|
||||||
}});
|
}});
|
||||||
|
@ -611,7 +644,26 @@
|
||||||
|
|
||||||
<div class="d-md-flex d-none border border-white py-5 justify-content-center" style="border-radius: 50px;">
|
<div class="d-md-flex d-none border border-white py-5 justify-content-center" style="border-radius: 50px;">
|
||||||
<table class="table1 text-white mx-0 p-2 calcul_rez" style="width: 90%; font-family: Geologica-ExtraLight;">
|
<table class="table1 text-white mx-0 p-2 calcul_rez" style="width: 90%; font-family: Geologica-ExtraLight;">
|
||||||
Выберите предметы
|
<tr class="border-bottom border-white">
|
||||||
|
<td> Технологический факультет </td>
|
||||||
|
<td> Строительство </td>
|
||||||
|
<td class="text-end"> 4 года</td>
|
||||||
|
</tr>
|
||||||
|
<tr class=" border-bottom border-white">
|
||||||
|
<td> Технологический факультет </td>
|
||||||
|
<td> Строительство </td>
|
||||||
|
<td class="text-end"> 4 года</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="border-bottom border-white">
|
||||||
|
<td> Технологический факультет </td>
|
||||||
|
<td> Строительство </td>
|
||||||
|
<td class="text-end"> 4 года</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="border-bottom border-white">
|
||||||
|
<td> Технологический факультет </td>
|
||||||
|
<td> Строительство </td>
|
||||||
|
<td class="text-end"> 4 года</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Http\Controllers\admin\PageController;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
@ -18,5 +17,3 @@ use Illuminate\Support\Facades\Route;
|
||||||
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
|
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
|
||||||
return $request->user();
|
return $request->user();
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::post('/calc', [PageController::class, 'calculator'])->name('calculator');
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ class DirectionTest extends TestCase
|
||||||
->withSession(['banned' => false])
|
->withSession(['banned' => false])
|
||||||
->patch(route('directions.update', $this->direction), $this->data);
|
->patch(route('directions.update', $this->direction), $this->data);
|
||||||
|
|
||||||
// $response->assertRedirect(route('directions.index'));
|
$response->assertRedirect(route('directions.index'));
|
||||||
|
|
||||||
$this->assertDatabaseHas('directions', $this->data);
|
$this->assertDatabaseHas('directions', $this->data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue