Compare commits

..

2 Commits

Author SHA1 Message Date
aslan 5202545724 Merge pull request 'adding logic to direction view' (#32) from RomanGolienko/Roman_applicant-site:new-design into main
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Failing after 1m38s Details
Tests & Lint & Deploy to Railway / deploy (push) Has been skipped Details
Reviewed-on: http://172.17.254.104/aslan/applicant-site/pulls/32
2024-03-15 16:10:00 +03:00
ROMANGOLIENKO 8e8b16d540 adding logic to direction view
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (pull_request) Failing after 1m45s Details
Tests & Lint & Deploy to Railway / deploy (pull_request) Has been skipped Details
2024-03-15 16:09:19 +03:00
3 changed files with 108 additions and 11 deletions

View File

@ -53,7 +53,7 @@ class CalculatorController extends Controller
<div class=\"\"> <div class=\"\">
<div class=\"display-6 \" style=\"font-family: Geologica-Light\"> {$direction->code} </div> <div class=\"display-6 \" style=\"font-family: Geologica-Light\"> {$direction->code} </div>
<div class=\"display-5 \" > {$direction->name}</div> <div class=\"display-5 \" > {$direction->name} </div>
</div> </div>
<div class=\"mt-4\"> <div class=\"mt-4\">
<p style=\"text-align: justify;\">{$direction->description}</p> <p style=\"text-align: justify;\">{$direction->description}</p>

View File

@ -9,17 +9,87 @@ use PhpParser\Node\Expr\Array_;
class DirectonHtmlBuilder class DirectonHtmlBuilder
{ {
private array $direction; private array $direction;
public function __construct($direction) public function __construct($direction)
{ {
$this->direction = $direction; $this->direction = $direction;
} }
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');
$educationForm = implode(", ", $direction['educationForm']);
$educationForms = '';
foreach ($direction['educationForms'] as $key => $educationForm) {
$educationForms .= $key . ', ';
}
$educationForms = substr($educationForms, 0, -2);
$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>";
}
$profiles = '';
//if (array_key_exists('educationalInstitution',$direction)) echo '+++++'; else echo '----';
//exit();
if (array_key_exists('educationalInstitution',$direction)) {
foreach ($direction['educationalInstitution'] as $educationalInstitution_name => $educationalInstitution) {
$profile_out = '<br>';
$profiles .= "<p> {$educationalInstitution_name}</p>";
foreach ($educationalInstitution as $profile_name => $profile) {
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);
$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>
";
}
};
}
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\">
@ -39,8 +109,13 @@ class DirectonHtmlBuilder
</div> </div>
<div class=\"mt-4\"> <div class=\"mt-4\">
<p style=\"text-align: justify;\">{$direction['description']}</p> <p style=\"text-align: justify;\">{$direction['description']}</p>
<div class='row'> <p class='fs-5'> Бюджетные места: </p> {$profiles} </div>
</div> </div>
</div> </div>
@ -52,12 +127,12 @@ class DirectonHtmlBuilder
</div> </div>
<hr class='d-block d-md-none'><br> <hr class='d-block d-md-none'><br>
<div > Форма обучения: <div > Форма обучения:
<strong> {$educationForm} <strong> $educationForms
</strong> </strong>
</div> </div>
<hr class='d-block d-md-none'><br> <hr class='d-block d-md-none'><br>
<div > Бюджетные места: <div > Бюджетные места:
<strong >{$direction['budget_places']} </strong> {$budget_places}
</div> </div>
<hr class='d-block d-md-none'><br> <hr class='d-block d-md-none'><br>
<div > Квота: <div > Квота:
@ -69,11 +144,11 @@ class DirectonHtmlBuilder
</div> </div>
<hr class='d-block d-md-none'><br> <hr class='d-block d-md-none'><br>
<div > Стоимость платного обучения: <div > Стоимость платного обучения:
<strong >{$direction['cost_paid_place']} </strong>
</div> </div>
<hr class='d-block d-md-none'><br> <hr class='d-block d-md-none'><br>
<div > Период обучения (в годах): <div > Период обучения (в годах):
<strong>{$direction['period']} </span> {$period}
</div> </div>
</div> </div>
</div> </div>

View File

@ -362,7 +362,20 @@
@php @php
$napr = array(); $napr = array();
foreach ($department->directions as $direction){ foreach ($department->directions as $direction){
$napr[$direction->name]['educationForm'][$direction->name . ' ' . $direction->id] = $direction->educationForm->name;
$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]['id'] = $direction->id;
$napr[$direction->name]['code'] = $direction->code; $napr[$direction->name]['code'] = $direction->code;
$napr[$direction->name]['educationLevel'] = $direction->educationLevel->name; $napr[$direction->name]['educationLevel'] = $direction->educationLevel->name;
@ -378,12 +391,13 @@
@endphp @endphp
{{-- @dd($napr)--}}
@foreach($napr as $el) @foreach($napr as $el)
<tr> <tr>
<td> <td>
<a class=" border border-dark rounded-3 p-2 hover1" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasScrolling-{{ $el['id'] }}" aria-controls="offcanvasScrolling" role="button">{{ $el['name'] }}</a> <a class=" border border-dark rounded-3 p-2 hover1" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasScrolling-{{ $el['id'] }}" aria-controls="offcanvasScrolling" role="button">{{ $el['name'] }}</a>
{{-- @dd($el)--}}
@php @php
$DirectonHtmlBuilder = new DirectonHtmlBuilder($el); $DirectonHtmlBuilder = new DirectonHtmlBuilder($el);
echo $DirectonHtmlBuilder->getHTML(); echo $DirectonHtmlBuilder->getHTML();
@ -392,7 +406,15 @@
<td> {{ $el['code'] }} </td> <td> {{ $el['code'] }} </td>
<td> {{ $el['educationLevel'] }} </td> <td> {{ $el['educationLevel'] }} </td>
<td> <?php foreach($el['educationForm'] as $form) { echo $form . '<br>'; } ?> </td> @php
$educationForms = '';
foreach ($el['educationForms'] as $key => $educationForm) {
$educationForms .= $key . ', ';
}
$educationForms = substr($educationForms, 0, -2);
@endphp
<td> {{$educationForms}} </td>
</tr> </tr>
@endforeach @endforeach
@endforeach @endforeach