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]['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;

View File

@ -16,77 +16,73 @@ 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 = '<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>';
foreach ($period_array as $key => $item) {
$period .= "<span style='font-family: Geologica-ExtraLight'>$key</span> - <strong> $item </strong><br>";
foreach ($direction['period'] as $key => $el) {
$period .= '<span style="font-family: Geologica-ExtraLight">' . $key . '</span> - ' . '<strong>' . $el . '</strong><br>' ;
}
$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 .= "<p> {$educationalInstitution_name}</p>";
// foreach ($educationalInstitution as $profile_name => $profile) {
// $profile_out = '<br>';
// foreach ($profile as $key => $value) {
// $profile_out .= "<span style='font-family: Geologica-ExtraLight'>{$key}</span> - <strong> {$value['budget_places']} </strong><br>";
// }
// $tmp = str_replace(' ', '', $profile_name);
// $tmp = str_replace(',', '', $tmp);
//// $print_r = '<pre>' . print_r($direction,1) . '<pre>';
// $profiles .= "
// <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>
// ";
// }
// };
// }
$EGE = '<br>';
foreach ($direction['entrance_examinations']['ЕГЭ']['Обязательные'] as $key => $el) {
$EGE .= '<span style="font-family: Geologica-ExtraLight">' . $key . '</span> - ' . '<strong>' . $el . '</strong><br>' ;
}
//dd($direction);
$po_viboru = '<br>';
if(array_key_exists('Предметы по выбору', $direction['entrance_examinations']['ЕГЭ'])){
foreach ($direction['entrance_examinations']['ЕГЭ']['Предметы по выбору'] as $key => $el) {
$po_viboru .= '<span style="font-family: Geologica-ExtraLight">' . $key . '</span> - ' . '<strong>' . $el . '</strong><br>' ;
}
}
$SPO = '<br>';
if(array_key_exists('СПО', $direction['entrance_examinations'])){
foreach ($direction['entrance_examinations']['СПО']['Обязательные'] as $key => $el) {
$SPO .= '<span style="font-family: Geologica-ExtraLight">' . $key . '</span> - ' . '<strong>' . $el . '</strong><br>' ;
}
}
$mgtu = '';
if(array_key_exists('МГТУ', $direction['budget_places'])){
foreach ($direction['budget_places']['МГТУ'] as $profile_name => $profile) {
$profile_content ='';
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 class=\"accordion-item\">
<h2 class=\"accordion-header\">
<button class=\"accordion-button\" type=\"button\" data-bs-toggle=\"collapse\" data-bs-target=\"#collapseOne\" aria-expanded=\"true\" aria-controls=\"collapseOne\">
$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\">
@ -105,8 +101,8 @@ class DirectonHtmlBuilder
</div>
<div class='col d-flex justify-content-end'>
<div class=\"fs-5 \" style=\"font-family: Geologica-Light\">
<a href='#' role='button'> МГТУ </a> |
<a href='#' role='button' > Филиал МГТУ (пос. Яблоновский)</a>
<a href='#' role='button' class='button-mgtu'> МГТУ </a> |
<a href='#' role='button' class='button-filial' > Филиал МГТУ (пос. Яблоновский)</a>
</div>
</div>
</div>
@ -122,25 +118,57 @@ class DirectonHtmlBuilder
<div class=' col-4 '>
<div class=\"p-3 px-5 border-success fs-5\" style='border-radius: 20px; border: 2px solid;'>
<div > Уровень образования:
<strong>{$direction['educationLevel']} </strong>
<strong>{$direction['education_level']} </strong>
</div>
<div > Форма обучения:
<strong> $educationForms</strong>
<strong> {$education_form} </strong>
</div>
<div > Период обучения (в годах):
{$period}
$period
</div>
</div>
</div>
<div class=' col-7 '>
<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 class='row mt-3'>
<div class=' col-9 '>
<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>

View File

@ -363,20 +363,21 @@
<div class="row d-flex justify-content-md-start justify-content-center">
@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 ">
<!-- 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 "
style="background-color: #ffffff; border-radius: 15px; border: unset;">
<img class=" " style="width: 108px; height: auto "
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>
<!-- 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">
<div class="modal-dialog modal-xl">
<div class="modal-content"> <!--style="border-radius: 30px;"-->
@ -386,13 +387,13 @@
</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="col-11">
<p class="fs-5">Основная информация</p>
<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>
<div class="table-responsive ps-4">
<table class="table w-100 fs-6"
@ -404,62 +405,28 @@
<th> Форма обучения</th>
</tr>
@foreach($faculty->departments as $department)
@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)
@foreach ($faculty['directions'] as $direction)
<tr>
<td>
<a class=" border border-dark rounded-3 p-2 hover1"
type="button" data-bs-toggle="offcanvas"
data-bs-target="#offcanvasScrolling-{{ $el['id'] }}"
data-bs-target="#offcanvasScrolling-{{ $direction['id'] }}"
aria-controls="offcanvasScrolling"
role="button">{{ $el['name'] }}</a>
{{-- @dd($el)--}}
role="button">{{ $direction['name'] }}</a>
@php
$DirectonHtmlBuilder = new DirectonHtmlBuilder($el);
$DirectonHtmlBuilder = new DirectonHtmlBuilder($direction);
echo $DirectonHtmlBuilder->getHTML();
@endphp
</td>
<td> {{ $el['code'] }} </td>
<td> {{ $el['educationLevel'] }} </td>
<td> {{ $direction['code'] }} </td>
<td> {{ $direction['education_level'] }} </td>
@php
$educationForms = '';
foreach ($el['educationForms'] as $key => $educationForm) {
$educationForms .= $key . ', ';
foreach ($direction['education_form'] as $educationForm) {
$educationForms .= $educationForm . ', ';
}
$educationForms = substr($educationForms, 0, -2);
@ -467,7 +434,6 @@
<td> {{$educationForms}} </td>
</tr>
@endforeach
@endforeach
</table>
</div>