diff --git a/app/Http/Controllers/Api/CalculatorController.php b/app/Http/Controllers/Api/CalculatorController.php index 23c8963..ffac451 100644 --- a/app/Http/Controllers/Api/CalculatorController.php +++ b/app/Http/Controllers/Api/CalculatorController.php @@ -4,12 +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\Services\DirectonHtmlBuilder; +use App\Services\DirectonHtmlBuilderForCalculator; use Illuminate\Http\Request; -use Illuminate\Support\Facades\URL; class CalculatorController extends Controller { @@ -34,7 +33,7 @@ class CalculatorController extends Controller return $carry; }, []); - $result = collect($filteredDirectionIds) + $directionIds = collect($filteredDirectionIds) ->filter(function ($subjectTypes) use ($calcultatorSubjects) { $requiredSubjects = $subjectTypes[1]; return array_reduce($requiredSubjects, function ($acc, $requiredSubjects) use ($calcultatorSubjects) { @@ -51,97 +50,157 @@ class CalculatorController extends Controller return $optionalSubjectsInCalculator->count() !== 0; } return true; - })->map(fn($subjectTypes, $directionId) => $directionId); - - $directions = Direction::whereIn('id', $result)->get(); - + }) + ->map(fn($subjectTypes, $directionId) => $directionId); + $directions = Direction::whereIn('id', $directionIds)->get(); +// dd($directionIds); + $dataToGenerateHTML = $this->getDirectionsToModals($directionIds); +// dd($dataToGenerateHTML); $generateHtml = function ($acc, $direction) { - $department = Department::find($direction->department_id); - $faculty = Faculty::find($department->faculty_id); - // phpcs:disable - $fon_3 = URL::to('img/front-page/bakalavr-special/fon3_blok.png'); + $builder = new DirectonHtmlBuilderForCalculator($direction); + $offCanvasModal = $builder->getHTML(); +// dd($offCanvasModal); return "{$acc}
{$direction->description}
-{$direction['description']}
+Бюджет
+ +Коммерция
+