diff --git a/app/Http/Controllers/admin/PageController.php b/app/Http/Controllers/admin/PageController.php index e2c0279..e5c21fd 100644 --- a/app/Http/Controllers/admin/PageController.php +++ b/app/Http/Controllers/admin/PageController.php @@ -7,6 +7,7 @@ use App\Http\Controllers\Controller; use App\Models\Admission; use App\Models\Direction; use App\Models\Faculty; +use App\Models\Subject; use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Illuminate\Foundation\Application; @@ -22,13 +23,14 @@ class PageController extends Controller public function directions() { - $directions = DB::table('faculties') - ->join('departments', 'faculties.id', '=', 'departments.faculty_id') - ->join('directions', 'departments.id', '=', 'directions.department_id') - ->select('faculties.name as faculties.name', 'directions.name', 'directions.id') - ->groupBy('faculties.name') - ->get(); +// $directions = DB::table('faculties') +// ->join('departments', 'faculties.id', '=', 'departments.faculty_id') +// ->join('directions', 'departments.id', '=', 'directions.department_id') +// ->select('faculties.name as faculties.name', 'directions.name', 'directions.id') +// ->groupBy('faculties.name') +// ->get(); $faculties = Faculty::all(); + $subjects = Subject::pluck('name', 'id'); // $infBez = $faculties->find(FacultyEnum::InfBez->value); // $query = `select faculties.name, directions.name, directions.id //FROM faculties @@ -43,9 +45,10 @@ class PageController extends Controller // } // // } - return view('new-design.bakalavr-special', compact('faculties')); + return view('new-design.bakalavr-special', compact('faculties', 'subjects')); } + public function calculator($request) { return response()->json($request); diff --git a/public/json.php b/public/json.php index 5219b9f..cfc14cd 100644 --- a/public/json.php +++ b/public/json.php @@ -7,18 +7,7 @@ if(isset($_POST['ajx'])) { } if($_POST['ajx']=='get_napr') { if(isset($_POST['format'])&&$_POST['format']=='html'){ - $out['html'] = ' - - Технологический факультет 1 - Строительство - 4 года - - - Технологический факультет 2 - Строительство - 4 года - - '; + $out['html'] = $_POST['predmets']; } ; diff --git a/resources/views/new-design/bakalavr-special.blade.php b/resources/views/new-design/bakalavr-special.blade.php index 5c51048..46bc066 100644 --- a/resources/views/new-design/bakalavr-special.blade.php +++ b/resources/views/new-design/bakalavr-special.blade.php @@ -572,49 +572,16 @@
Выберите предметы ЕГЭ
- + @foreach($subjects as $id => $name) + + + @endforeach - - - - - - - - -
@@ -630,7 +597,7 @@ console.log(selected); $(".calcul_rez").html('обрабатываем'); - $.ajax({ url: "json.php", dataType: 'json', cache:false,type: "POST",data: 'ajx=get_napr&format=html&predmets='+predmets, + $.ajax({ url: "json.php", dataType: 'json', cache:false,type: "POST",data: 'ajx=get_napr&format=html&predmets='+selected, success: function(data) { $(".calcul_rez").html(data.html); }}); @@ -644,26 +611,7 @@
- - - - - - - - - - - - - - - - - - - - + Выберите предметы
Технологический факультет Строительство 4 года
Технологический факультет Строительство 4 года
Технологический факультет Строительство 4 года
Технологический факультет Строительство 4 года