From 1f207a427db6c4f9eb596d8597140c8e7ad8d062 Mon Sep 17 00:00:00 2001 From: ROMANGOLIENKO Date: Thu, 21 Mar 2024 16:29:10 +0300 Subject: [PATCH] redesign of direction card --- app/Http/Controllers/admin/PageController.php | 1 + app/Services/DirectonHtmlBuilder.php | 114 ++++++++---------- .../new-design/bakalavr-special.blade.php | 66 +++------- 3 files changed, 65 insertions(+), 116 deletions(-) diff --git a/app/Http/Controllers/admin/PageController.php b/app/Http/Controllers/admin/PageController.php index 1e214f1..61afb69 100644 --- a/app/Http/Controllers/admin/PageController.php +++ b/app/Http/Controllers/admin/PageController.php @@ -133,6 +133,7 @@ class PageController extends Controller $carry[$facultyName]['id'] = $facultyId; $carry[$facultyName]['name'] = $facultyName; $carry[$facultyName]['description'] = $facultyDescription; + $carry[$facultyName]['directions'][$directionName]['name'] = $directionName; $carry[$facultyName]['directions'][$directionName]['id'] = $directionId; $carry[$facultyName]['directions'][$directionName]['code'] = $directionCode; $carry[$facultyName]['directions'][$directionName]['education_level'] = $educationLevelName; diff --git a/app/Services/DirectonHtmlBuilder.php b/app/Services/DirectonHtmlBuilder.php index 3575c6f..e14d14a 100644 --- a/app/Services/DirectonHtmlBuilder.php +++ b/app/Services/DirectonHtmlBuilder.php @@ -16,77 +16,43 @@ class DirectonHtmlBuilder public function getHTML() { - - $direction = $this->direction; - - $fon_3 = URL::to('img/front-page/bakalavr-special/fon3_blok.png'); - - $educationForms = ''; - foreach ($direction['educationForms'] as $key => $educationForm) { - $educationForms .= $key . ', '; + $education_form = ''; + foreach ($direction['education_form'] as $el) { + $education_form .= $el . ', '; } - $educationForms = substr($educationForms, 0, -2); + $education_form = substr($education_form, 0, -2); - // phpcs:disable - - $budget_places_array = array(); - foreach ($direction['educationForms'] as $key => $educationForm) { - $budget_places_array[$key] = $educationForm['budget_places']; - } - $budget_places = '
'; - foreach ($budget_places_array as $key => $item) { - $budget_places .= "$key - $item
"; - } - - $period_array = array(); - foreach ($direction['educationForms'] as $key => $period) { - $period_array[$key] = $period['period']; - } $period = '
'; - foreach ($period_array as $key => $item) { - $period .= "$key - $item
"; + foreach ($direction['period'] as $key => $el) { + $period .= '' . $key . ' - ' . '' . $el . '
' ; } - $profiles = ''; - //if (array_key_exists('educationalInstitution',$direction)) echo '+++++'; else echo '----'; - //exit(); -// if (array_key_exists('educationalInstitution', $direction)) { -// foreach ($direction['educationalInstitution'] as $educationalInstitution_name => $educationalInstitution) { -// -// $profiles .= "

{$educationalInstitution_name}

"; -// foreach ($educationalInstitution as $profile_name => $profile) { -// $profile_out = '
'; -// foreach ($profile as $key => $value) { -// $profile_out .= "{$key} - {$value['budget_places']}
"; -// } -// $tmp = str_replace(' ', '', $profile_name); -// $tmp = str_replace(',', '', $tmp); -//// $print_r = '
' . print_r($direction,1) . '
';
-//                    $profiles .= "
-//                                  
-//
-//

-// -//

-//
-//
-// $profile_out -// -// -// -//
-//
-//
-//
-// "; -// } -// }; -// } + + $EGE = '
'; + foreach ($direction['entrance_examinations']['ЕГЭ']['Обязательные'] as $key => $el) { + $EGE .= '' . $key . ' - ' . '' . $el . '
' ; + } + //dd($direction); + $po_viboru = '
'; + if(array_key_exists('Предметы по выбору', $direction['entrance_examinations']['ЕГЭ'])){ + foreach ($direction['entrance_examinations']['ЕГЭ']['Предметы по выбору'] as $key => $el) { + $po_viboru .= '' . $key . ' - ' . '' . $el . '
' ; + } + } + $SPO = '
'; + if(array_key_exists('СПО', $direction['entrance_examinations'])){ + foreach ($direction['entrance_examinations']['СПО']['Обязательные'] as $key => $el) { + $SPO .= '' . $key . ' - ' . '' . $el . '
' ; + } + } + + + + + return "
@@ -122,13 +88,13 @@ class DirectonHtmlBuilder
Уровень образования: - {$direction['educationLevel']} + {$direction['education_level']}
Форма обучения: - $educationForms + {$education_form}
Период обучения (в годах): - {$period} + $period
@@ -141,6 +107,22 @@ class DirectonHtmlBuilder
+ Проходные баллы: +
+
+ ЕГЭ + $EGE +
+
+ Предметы по выбору + $po_viboru +
+
+ СПО + $SPO +
+
+
diff --git a/resources/views/new-design/bakalavr-special.blade.php b/resources/views/new-design/bakalavr-special.blade.php index e198121..9b3fac1 100644 --- a/resources/views/new-design/bakalavr-special.blade.php +++ b/resources/views/new-design/bakalavr-special.blade.php @@ -363,20 +363,21 @@
@php use App\Services\DirectonHtmlBuilder; @endphp - @foreach($faculties as $faculty) + @foreach($groupedDirections as $faculty) +
- -