Compare commits

...

7 Commits

3 changed files with 195 additions and 117 deletions

View File

@ -47,7 +47,137 @@ class PageController extends Controller
'directions.name', 'directions.name',
"educational_institutions.name as educational_institution_name" "educational_institutions.name as educational_institution_name"
]); ]);
return view('new-design.bakalavr-special', compact('faculties', 'subjects', 'directionsWithInstitution'));
$directionsGroups = Direction::with(['department'])
->leftJoin('direction_direction_profile', 'directions.id', '=', 'direction_direction_profile.direction_id')
->leftJoin(
'direction_profiles',
'direction_direction_profile.direction_profile_id',
'=',
'direction_profiles.id'
)
->leftJoin('departments', 'directions.department_id', '=', 'departments.id')
->leftJoin('faculties', 'departments.faculty_id', '=', 'faculties.id')
->leftJoin('education_levels', 'directions.education_level_id', '=', 'education_levels.id')
->leftJoin('education_forms', 'directions.education_form_id', '=', 'education_forms.id')
->leftJoin('entrance_examinations', 'entrance_examinations.direction_id', '=', 'directions.id')
->leftJoin(
'educational_institutions',
'faculties.educational_institution_id',
'=',
'educational_institutions.id'
)
->leftJoin('examination_types', 'entrance_examinations.examination_type_id', '=', 'examination_types.id')
->leftJoin('subject_types', 'entrance_examinations.subject_type_id', '=', 'subject_types.id')
->leftJoin('subjects', 'entrance_examinations.subject_id', '=', 'subjects.id')
->select(
'directions.id as direction_id',
'directions.code as direction_code',
'directions.name as direction_name',
'directions.description as direction_description',
'directions.budget_places as direction_budget_places',
'directions.paid_places as direction_paid_places',
'directions.cost_paid_place as direction_cost_paid_place',
'directions.period as direction_period',
'education_levels.name as education_level_name',
'education_forms.name as education_form_name',
'faculties.id as faculty_id',
'faculties.name as faculty_name',
'faculties.description as faculty_description',
'educational_institutions.id as educational_institution_id',
'educational_institutions.name as educational_institution_name',
'direction_profiles.id as direction_profile_id',
'entrance_examinations.scores as entrance_examination_score',
'examination_types.name as examination_type_name',
'subject_types.name as subject_type_name',
'subjects.name as subject_name',
'direction_profiles.name as direction_profile_name',
)
->get()->toArray();
$branches = [];
$directionsGroupWithOutBranch = array_reduce($directionsGroups, function ($acc, $direction) use (&$branches) {
if ($direction['educational_institution_id'] == 3) {
$branches[] = $direction;
}
$acc[] = $direction;
return $acc;
}, []);
$groupedDirections = collect($directionsGroupWithOutBranch)
->reduce(function ($carry, $item, $key) use ($branches) {
[
'direction_id' => $directionId,
'direction_name' => $directionName,
'direction_code' => $directionCode,
'educational_institution_id' => $educational_institution_id,
'educational_institution_name' => $educationalInstitutionName,
'faculty_id' => $facultyId,
'faculty_name' => $facultyName,
'faculty_description' => $facultyDescription,
'education_level_name' => $educationLevelName,
'education_form_name' => $educationFormName,
'entrance_examination_score' => $entranceExaminationScore,
'examination_type_name' => $examinationTypeName,
'subject_type_name' => $subjectTypeName,
'subject_name' => $subjectName,
'direction_profile_name' => $directionProfileName,
'direction_budget_places' => $directionBudgetPlaces,
'direction_paid_places' => $directionPaidPlaces,
'direction_cost_paid_place' => $directionCostPaidPlace,
'direction_period' => $directionPeriod,
'direction_description' => $directionDescription,
] = $item;
$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;
$carry[$facultyName]['directions'][$directionName]['education_form'][] = $educationFormName;
$carry[$facultyName]['directions'][$directionName]['education_form'] = array_unique(
$carry[$facultyName]['directions'][$directionName]['education_form']
);
$carry[$facultyName]['directions'][$directionName]['entrance_examinations']
[$examinationTypeName][$subjectTypeName][$subjectName] = $entranceExaminationScore;
$carry[$facultyName]['directions'][$directionName]['budget_places']
[$educationalInstitutionName][$directionProfileName][$educationFormName] = $directionBudgetPlaces;
$carry[$facultyName]['directions'][$directionName]
['paid_places'][$educationFormName] = $directionPaidPlaces;
$carry[$facultyName]['directions'][$directionName]
['cost_paid_place'][$educationFormName] = $directionCostPaidPlace;
$carry[$facultyName]['directions'][$directionName]['period'][$educationFormName] = $directionPeriod;
$carry[$facultyName]['directions'][$directionName]['description'] = $directionDescription;
foreach ($branches as $branch) {
[
'direction_name' => $directionNameBranch,
'educational_institution_name' => $educationalInstitutionNameBranch,
'direction_profile_name' => $directionProfileNameBranch,
'education_form_name' => $educationFormNameBranch,
'direction_budget_places' => $directionBudgetPlacesBranch
] = $branch;
if ($directionNameBranch === $directionName) {
$carry[$facultyName]['directions'][$directionName]['budget_places']
[$educationalInstitutionNameBranch][$directionProfileNameBranch]
[$educationFormNameBranch] = $directionBudgetPlacesBranch;
}
}
return $carry;
}, []);
return view('new-design.bakalavr-special', compact(
'faculties',
'subjects',
'directionsWithInstitution',
'groupedDirections'
));
} }

View File

@ -16,77 +16,43 @@ class DirectonHtmlBuilder
public function getHTML() public function getHTML()
{ {
$direction = $this->direction; $direction = $this->direction;
$fon_3 = URL::to('img/front-page/bakalavr-special/fon3_blok.png'); $fon_3 = URL::to('img/front-page/bakalavr-special/fon3_blok.png');
$education_form = '';
$educationForms = ''; foreach ($direction['education_form'] as $el) {
foreach ($direction['educationForms'] as $key => $educationForm) { $education_form .= $el . ', ';
$educationForms .= $key . ', ';
} }
$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 = '<br>';
foreach ($budget_places_array as $key => $item) {
$budget_places .= "<span style='font-family: Geologica-ExtraLight'>$key</span> - <strong> $item </strong><br>";
}
$period_array = array();
foreach ($direction['educationForms'] as $key => $period) {
$period_array[$key] = $period['period'];
}
$period = '<br>'; $period = '<br>';
foreach ($period_array as $key => $item) { foreach ($direction['period'] as $key => $el) {
$period .= "<span style='font-family: Geologica-ExtraLight'>$key</span> - <strong> $item </strong><br>"; $period .= '<span style="font-family: Geologica-ExtraLight">' . $key . '</span> - ' . '<strong>' . $el . '</strong><br>' ;
} }
$profiles = '';
//if (array_key_exists('educationalInstitution',$direction)) echo '+++++'; else echo '----'; $EGE = '<br>';
//exit(); foreach ($direction['entrance_examinations']['ЕГЭ']['Обязательные'] as $key => $el) {
// if (array_key_exists('educationalInstitution', $direction)) { $EGE .= '<span style="font-family: Geologica-ExtraLight">' . $key . '</span> - ' . '<strong>' . $el . '</strong><br>' ;
// foreach ($direction['educationalInstitution'] as $educationalInstitution_name => $educationalInstitution) { }
// //dd($direction);
// $profiles .= "<p> {$educationalInstitution_name}</p>"; $po_viboru = '<br>';
// foreach ($educationalInstitution as $profile_name => $profile) { if(array_key_exists('Предметы по выбору', $direction['entrance_examinations']['ЕГЭ'])){
// $profile_out = '<br>'; foreach ($direction['entrance_examinations']['ЕГЭ']['Предметы по выбору'] as $key => $el) {
// foreach ($profile as $key => $value) { $po_viboru .= '<span style="font-family: Geologica-ExtraLight">' . $key . '</span> - ' . '<strong>' . $el . '</strong><br>' ;
// $profile_out .= "<span style='font-family: Geologica-ExtraLight'>{$key}</span> - <strong> {$value['budget_places']} </strong><br>"; }
// } }
// $tmp = str_replace(' ', '', $profile_name); $SPO = '<br>';
// $tmp = str_replace(',', '', $tmp); if(array_key_exists('СПО', $direction['entrance_examinations'])){
//// $print_r = '<pre>' . print_r($direction,1) . '<pre>'; foreach ($direction['entrance_examinations']['СПО']['Обязательные'] as $key => $el) {
// $profiles .= " $SPO .= '<span style="font-family: Geologica-ExtraLight">' . $key . '</span> - ' . '<strong>' . $el . '</strong><br>' ;
// <div class=\"accordion \" id=\"accordionPanelsStayOpenExample\"> }
// <div class=\"accordion-item\"> }
// <h2 class=\"accordion-header\">
// <button class=\"accordion-button\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"#panelsStayOpen-{$tmp}\" aria-expanded=\"true\" aria-controls=\"panelsStayOpen-{$tmp}\">
// {$profile_name}
// </button>
// </h2>
// <div id=\"panelsStayOpen-{$tmp}\" class=\"accordion-collapse collapse show\">
// <div class=\"accordion-body\">
// $profile_out
//
//
//
// </div>
// </div>
// </div>
// </div>
// ";
// }
// };
// }
return "<div class=\"offcanvas offcanvas-bottom\" data-bs-scroll=\"true\" data-bs-backdrop=\"false\" tabindex=\"-1\" id=\"offcanvasScrolling-{$direction['id'] }\" aria-labelledby=\"offcanvasScrollingLabel-{$direction['id']}\" style=\"height: 100%; font-family: Geologica-Medium; overflow-y: auto ; background-image: url({$fon_3}); color: #004329\"> return "<div class=\"offcanvas offcanvas-bottom\" data-bs-scroll=\"true\" data-bs-backdrop=\"false\" tabindex=\"-1\" id=\"offcanvasScrolling-{$direction['id'] }\" aria-labelledby=\"offcanvasScrollingLabel-{$direction['id']}\" style=\"height: 100%; font-family: Geologica-Medium; overflow-y: auto ; background-image: url({$fon_3}); color: #004329\">
@ -122,13 +88,13 @@ class DirectonHtmlBuilder
<div class=' col-4 '> <div class=' col-4 '>
<div class=\"p-3 px-5 border-success fs-5\" style='border-radius: 20px; border: 2px solid;'> <div class=\"p-3 px-5 border-success fs-5\" style='border-radius: 20px; border: 2px solid;'>
<div > Уровень образования: <div > Уровень образования:
<strong>{$direction['educationLevel']} </strong> <strong>{$direction['education_level']} </strong>
</div> </div>
<div > Форма обучения: <div > Форма обучения:
<strong> $educationForms</strong> <strong> {$education_form} </strong>
</div> </div>
<div > Период обучения (в годах): <div > Период обучения (в годах):
{$period} $period
</div> </div>
</div> </div>
</div> </div>
@ -141,6 +107,22 @@ class DirectonHtmlBuilder
<div class='row mt-3'> <div class='row mt-3'>
<div class=' col-9 '> <div class=' col-9 '>
<div class=\"p-3 px-5 border-success fs-5 h-100\" style='border-radius: 20px; border: 2px solid;'> <div class=\"p-3 px-5 border-success fs-5 h-100\" style='border-radius: 20px; border: 2px solid;'>
<strong> Проходные баллы:</strong>
<div class='row mt-3'>
<div class='col '>
<strong> ЕГЭ </strong>
$EGE
</div>
<div class='col '>
<strong> Предметы по выбору </strong>
$po_viboru
</div>
<div class='col '>
<strong> СПО </strong>
$SPO
</div>
</div>
</div> </div>
</div> </div>

View File

@ -363,20 +363,21 @@
<div class="row d-flex justify-content-md-start justify-content-center"> <div class="row d-flex justify-content-md-start justify-content-center">
@php use App\Services\DirectonHtmlBuilder; @endphp @php use App\Services\DirectonHtmlBuilder; @endphp
@foreach($faculties as $faculty) @foreach($groupedDirections as $faculty)
<div class="mt-xl-5 col-xxl-4 col-md-6 col-10 "> <div class="mt-xl-5 col-xxl-4 col-md-6 col-10 ">
<!-- Button trigger modal --> <!-- Button trigger modal -->
<button type="button" data-bs-toggle="modal" data-bs-target="#exampleModal-{{ $faculty->id }}" <button type="button" data-bs-toggle="modal" data-bs-target="#exampleModal-{{ $faculty['id'] }}"
class=" col-md-11 col-12 shadow-lg p-2 ps-md-3 mt-3 d-flex justify-content-start align-items-center hover1 " class=" col-md-11 col-12 shadow-lg p-2 ps-md-3 mt-3 d-flex justify-content-start align-items-center hover1 "
style="background-color: #ffffff; border-radius: 15px; border: unset;"> style="background-color: #ffffff; border-radius: 15px; border: unset;">
<img class=" " style="width: 108px; height: auto " <img class=" " style="width: 108px; height: auto "
src="{{ URL::to('img/faculties/5.png') }}" alt=""> src="{{ URL::to('img/faculties/5.png') }}" alt="">
<span class="ms-xl-5 ms-2 z-3 gradient-text text-start"> {{ $faculty->name }}</span> <span class="ms-xl-5 ms-2 z-3 gradient-text text-start"> {{ $faculty['name'] }}</span>
</button> </button>
<!-- Modal --> <!-- Modal -->
<div class="modal fade" id="exampleModal-{{ $faculty->id }}" tabindex="-1" <div class="modal fade" id="exampleModal-{{ $faculty['id'] }}" tabindex="-1"
aria-labelledby="exampleModalLabel" aria-hidden="true"> aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl"> <div class="modal-dialog modal-xl">
<div class="modal-content"> <!--style="border-radius: 30px;"--> <div class="modal-content"> <!--style="border-radius: 30px;"-->
@ -386,13 +387,13 @@
</div> </div>
<p class="text-center fs-3"> {{ $faculty->name }} </p> <p class="text-center fs-3"> {{ $faculty['name'] }} </p>
<div class="modal-body d-flex justify-content-center" > <div class="modal-body d-flex justify-content-center" >
<div class="col-11"> <div class="col-11">
<p class="fs-5">Основная информация</p> <p class="fs-5">Основная информация</p>
<p class="fs-6" <p class="fs-6"
style=" font-family: Geologica-ExtraLight; text-align: justify;"> {{ $faculty->description }}</p> style=" font-family: Geologica-ExtraLight; text-align: justify;"> {{ $faculty['description'] }}</p>
<p class="fs-5">Специальности</p> <p class="fs-5">Специальности</p>
<div class="table-responsive ps-4"> <div class="table-responsive ps-4">
<table class="table w-100 fs-6" <table class="table w-100 fs-6"
@ -404,62 +405,28 @@
<th> Форма обучения</th> <th> Форма обучения</th>
</tr> </tr>
@foreach($faculty->departments as $department) @foreach ($faculty['directions'] as $direction)
@php
$napr = array();
foreach ($department->directions as $direction){
$napr[$direction->name]['educationForms'][$direction->educationForm->name]['budget_places'] = $direction->budget_places;
foreach($direction->directionProfiles as $profile) {$napr[$direction->name]['educationalInstitution'][$faculty->educationalInstitution->name][$profile->name][$direction->educationForm->name]['budget_places'] = $direction->budget_places;
}
$napr[$direction->name]['educationForms'][$direction->educationForm->name]['period'] = $direction->period;
$napr[$direction->name]['id'] = $direction->id;
$napr[$direction->name]['code'] = $direction->code;
$napr[$direction->name]['educationLevel'] = $direction->educationLevel->name;
$napr[$direction->name]['name'] = $direction->name;
$napr[$direction->name]['budget_places'] = $direction->budget_places;
$napr[$direction->name]['quota'] = $direction->quota;
$napr[$direction->name]['paid_places'] = $direction->paid_places;
$napr[$direction->name]['cost_paid_place'] = $direction->cost_paid_place;
$napr[$direction->name]['period'] = $direction->period;
$napr[$direction->name]['description'] = $direction->description;
}
@endphp
{{-- @dd($napr)--}}
@foreach($napr as $el)
<tr> <tr>
<td> <td>
<a class=" border border-dark rounded-3 p-2 hover1" <a class=" border border-dark rounded-3 p-2 hover1"
type="button" data-bs-toggle="offcanvas" type="button" data-bs-toggle="offcanvas"
data-bs-target="#offcanvasScrolling-{{ $el['id'] }}" data-bs-target="#offcanvasScrolling-{{ $direction['id'] }}"
aria-controls="offcanvasScrolling" aria-controls="offcanvasScrolling"
role="button">{{ $el['name'] }}</a> role="button">{{ $direction['name'] }}</a>
{{-- @dd($el)--}}
@php @php
$DirectonHtmlBuilder = new DirectonHtmlBuilder($el); $DirectonHtmlBuilder = new DirectonHtmlBuilder($direction);
echo $DirectonHtmlBuilder->getHTML(); echo $DirectonHtmlBuilder->getHTML();
@endphp @endphp
</td> </td>
<td> {{ $el['code'] }} </td> <td> {{ $direction['code'] }} </td>
<td> {{ $el['educationLevel'] }} </td> <td> {{ $direction['education_level'] }} </td>
@php @php
$educationForms = ''; $educationForms = '';
foreach ($el['educationForms'] as $key => $educationForm) { foreach ($direction['education_form'] as $educationForm) {
$educationForms .= $key . ', '; $educationForms .= $educationForm . ', ';
} }
$educationForms = substr($educationForms, 0, -2); $educationForms = substr($educationForms, 0, -2);
@ -467,7 +434,6 @@
<td> {{$educationForms}} </td> <td> {{$educationForms}} </td>
</tr> </tr>
@endforeach @endforeach
@endforeach
</table> </table>
</div> </div>