fix logic new calculator

This commit is contained in:
aslan 2024-04-03 15:21:10 +03:00
parent 0e65ddaed0
commit 5547d00565
2 changed files with 20 additions and 13 deletions

View File

@ -4,14 +4,11 @@ namespace App\Http\Controllers\Api;
use App\Enums\ExaminationTypeEnum;
use App\Http\Controllers\Controller;
use App\Models\Department;
use App\Models\Direction;
use App\Models\EntranceExamination;
use App\Models\Faculty;
use App\Models\Subject;
use App\Services\DirectonHtmlBuilder;
use App\Services\DirectonHtmlBuilderForCalculator;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\URL;
class CalculatorController extends Controller
{
@ -61,9 +58,19 @@ class CalculatorController extends Controller
$dataToGenerateHTML = $this->getDirectionsToModals($directionIds);
// dd($dataToGenerateHTML);
$generateHtml = function ($acc, $direction) {
$builder = new DirectonHtmlBuilder($direction);
$builder = new DirectonHtmlBuilderForCalculator($direction);
$offCanvasModal = $builder->getHTML();
return "{$acc} $offCanvasModal";
// dd($offCanvasModal);
return "{$acc} <tr class=\"border-bottom border-white my-3\">
<td class='w-25 '>
<a class=\"hover2 \" type=\"button\" data-bs-toggle=\"offcanvas\" data-bs-target=\"#calc-{$direction['id']}\" aria-controls=\"offcanvasScrolling\" role=\"button\">{$direction['name']}</a>
{$offCanvasModal}
</td>
<td class=\"text-end\"> 123</td>
<td class=\"text-end\"> 456 </td>
</tr>";
};
$html = collect($dataToGenerateHTML)->reduce($generateHtml, '');

View File

@ -179,7 +179,7 @@ class DirectonHtmlBuilderForCalculator
}
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=\"calc-{$direction['id'] }\" aria-labelledby=\"Labelcalc-{$direction['id']}\" style=\"height: 100%; font-family: Geologica-Medium; overflow-y: auto ; background-image: url({$fon_3}); color: #004329\">
<div class=\"mx-5 pb-5\">