Merge pull request 'redesign of direction card' (#35) from RomanGolienko/Roman_applicant-site:prodV1 into main

Reviewed-on: http://gitea.mkgtu.ru/aslan/applicant-site/pulls/35
This commit is contained in:
aslan 2024-03-27 09:21:32 +03:00
commit 4ff59c8d11
3 changed files with 114 additions and 119 deletions

View File

@ -133,6 +133,7 @@ class PageController extends Controller
$carry[$facultyName]['id'] = $facultyId; $carry[$facultyName]['id'] = $facultyId;
$carry[$facultyName]['name'] = $facultyName; $carry[$facultyName]['name'] = $facultyName;
$carry[$facultyName]['description'] = $facultyDescription; $carry[$facultyName]['description'] = $facultyDescription;
$carry[$facultyName]['directions'][$directionName]['name'] = $directionName;
$carry[$facultyName]['directions'][$directionName]['id'] = $directionId; $carry[$facultyName]['directions'][$directionName]['id'] = $directionId;
$carry[$facultyName]['directions'][$directionName]['code'] = $directionCode; $carry[$facultyName]['directions'][$directionName]['code'] = $directionCode;
$carry[$facultyName]['directions'][$directionName]['education_level'] = $educationLevelName; $carry[$facultyName]['directions'][$directionName]['education_level'] = $educationLevelName;

View File

@ -16,77 +16,73 @@ 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} $mgtu = '';
// </button> if(array_key_exists('МГТУ', $direction['budget_places'])){
// </h2>
// <div id=\"panelsStayOpen-{$tmp}\" class=\"accordion-collapse collapse show\"> foreach ($direction['budget_places']['МГТУ'] as $profile_name => $profile) {
// <div class=\"accordion-body\"> $profile_content ='';
// $profile_out foreach($profile as $forms => $budget_places){
// $profile_content .= "<strong> {$forms} </strong> - " . "<span style='font-family: Geologica-ExtraLight'> {$budget_places} </span><br>";
// }
// $mgtu .= "<div class=\"accordion\" id=\"accordionExample\">
// </div> <div class=\"accordion-item\">
// </div> <h2 class=\"accordion-header\">
// </div> <button class=\"accordion-button\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"#collapseOne\" aria-expanded=\"true\" aria-controls=\"collapseOne\">
// </div> $profile_name
// "; </button>
// } </h2>
// }; <div id=\"collapseOne\" class=\"accordion-collapse collapse show\" data-bs-parent=\"#accordionExample\">
// } <div class=\"accordion-body\">
$profile_content
</div>
</div>
</div>
</div>" ;
}
}
$filial = '222';
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\">
@ -105,8 +101,8 @@ class DirectonHtmlBuilder
</div> </div>
<div class='col d-flex justify-content-end'> <div class='col d-flex justify-content-end'>
<div class=\"fs-5 \" style=\"font-family: Geologica-Light\"> <div class=\"fs-5 \" style=\"font-family: Geologica-Light\">
<a href='#' role='button'> МГТУ </a> | <a href='#' role='button' class='button-mgtu'> МГТУ </a> |
<a href='#' role='button' > Филиал МГТУ (пос. Яблоновский)</a> <a href='#' role='button' class='button-filial' > Филиал МГТУ (пос. Яблоновский)</a>
</div> </div>
</div> </div>
</div> </div>
@ -122,25 +118,57 @@ 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>
<div class=' col-7 '> <div class=' col-7 '>
<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;'>
Места для обучения: <script>
$(\".button-mgtu\").click(function () {
$(\".content_budget\").html('{$mgtu}');
});
$(\".button-filial\").click(function () {
$(\".content_budget\").html('{$filial}');
});
</script>
<style>
</style>
<strong>Места для обучения:</strong><br>
<div class='content_budget'>
</div>
</div> </div>
</div> </div>
</div> </div>
<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,69 +405,34 @@
<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);
@endphp @endphp
<td> {{$educationForms}} </td> <td> {{$educationForms}} </td>
</tr> </tr>
@endforeach
@endforeach @endforeach
</table> </table>
</div> </div>