forked from aslan/applicant-site
prodV1 #2
|
@ -9,7 +9,6 @@ use App\Models\EntranceExamination;
|
||||||
use App\Models\Faculty;
|
use App\Models\Faculty;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
|
||||||
class CalculatorController extends Controller
|
class CalculatorController extends Controller
|
||||||
{
|
{
|
||||||
public function findDirectionFromSubjects(Request $request)
|
public function findDirectionFromSubjects(Request $request)
|
||||||
|
@ -24,8 +23,7 @@ class CalculatorController extends Controller
|
||||||
->map(function ($direction) {
|
->map(function ($direction) {
|
||||||
return $direction->map(fn($item) => $item['subject_id']);
|
return $direction->map(fn($item) => $item['subject_id']);
|
||||||
})
|
})
|
||||||
->filter(fn($direction) => count($direction) <= $countUserSubjects)
|
->filter(fn($direction) => count($direction) <= $countUserSubjects)->keys();
|
||||||
->keys();
|
|
||||||
|
|
||||||
$directions = Direction::whereIn('id', $filteredDirectionIds)->get();
|
$directions = Direction::whereIn('id', $filteredDirectionIds)->get();
|
||||||
|
|
||||||
|
@ -33,7 +31,7 @@ class CalculatorController extends Controller
|
||||||
$generateHtml = function ($acc, $direction) {
|
$generateHtml = function ($acc, $direction) {
|
||||||
$department = Department::find($direction->department_id);
|
$department = Department::find($direction->department_id);
|
||||||
$faculty = Faculty::find($department->faculty_id);
|
$faculty = Faculty::find($department->faculty_id);
|
||||||
|
// phpcs:disable
|
||||||
return "{$acc} <tr class=\"\">
|
return "{$acc} <tr class=\"\">
|
||||||
<td id=\"faculty\"> {$faculty->name} </td>
|
<td id=\"faculty\"> {$faculty->name} </td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -93,7 +91,7 @@ class CalculatorController extends Controller
|
||||||
<td class=\"text-end\"> {$direction->period} </td>
|
<td class=\"text-end\"> {$direction->period} </td>
|
||||||
</tr>";
|
</tr>";
|
||||||
};
|
};
|
||||||
|
// phpcs:enable
|
||||||
$html = $directions->reduce($generateHtml, '');
|
$html = $directions->reduce($generateHtml, '');
|
||||||
|
|
||||||
return response()->json(['html' => $html]);
|
return response()->json(['html' => $html]);
|
||||||
|
|
|
@ -13,6 +13,8 @@ class DirectonHtmlBuilder
|
||||||
}
|
}
|
||||||
public function getHTML()
|
public function getHTML()
|
||||||
{
|
{
|
||||||
|
// phpcs:disable
|
||||||
|
|
||||||
$direction = $this->direction;
|
$direction = $this->direction;
|
||||||
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 ;\">
|
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 ;\">
|
||||||
<div class=\"mx-5\">
|
<div class=\"mx-5\">
|
||||||
|
@ -65,4 +67,5 @@ class DirectonHtmlBuilder
|
||||||
|
|
||||||
</div> ";
|
</div> ";
|
||||||
}
|
}
|
||||||
|
// phpcs:enable
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue