@php /* | Minimalny stepper (tylko wizualizacja) |--------------------------------------- | Uzycie: | @include('components.training.wizard-stepper-minimal', [ | 'trainingId' => (int)($data->id ?? 0) | ]) */ $trainingId = (int)($trainingId ?? 0); $lockParticipantsManage = (bool) ($lockParticipantsManage ?? false); $participantsLockReason = trim((string) ($participantsLockReason ?? '')); if ($participantsLockReason === '') { $participantsLockReason = 'Dodawanie uczestnikow jest aktualnie zablokowane.'; } $materialsStepUrl = $trainingId > 0 ? url('/szkolenia/admin/trainings/'.$trainingId) : '#'; $testStepUrl = $trainingId > 0 ? url('/szkolenia/admin/tests/create/'.$trainingId) : '#'; // Domyslnie wszystko "niegotowe". $steps = [false, false, false, false, false, false]; if ($trainingId > 0 && \Illuminate\Support\Facades\Schema::hasTable('t051_szkolenia')) { $training = DB::table('t051_szkolenia') ->where('id', $trainingId) ->first(); if (!empty($training)) { $isElearning = (int)($training->forma_szkolenia ?? -1) === 0; $placeNormalized = trim(mb_strtolower((string)($training->miejsce_szkolenia ?? ''), 'UTF-8')); $isInternalPlace = strpos($placeNormalized, 'szkolenie wewn') !== false; $checkElearningInternal = $isElearning && $isInternalPlace; $checkTopicAndGoal = trim((string)($training->temat ?? '')) !== '' && trim((string)($training->cel_szkolenia_opis ?? '')) !== ''; $checkSchedule = !empty($training->data) && !empty($training->godzina_start) && !empty($training->data_do) && !empty($training->godzina_stop); $materialsCount = 0; if (\Illuminate\Support\Facades\Schema::hasTable('t056_szkolenie_materialy')) { $materialsCount = (int) DB::table('t056_szkolenie_materialy') ->where('id_szkolenie', $trainingId) ->count(); } $introExists = \Illuminate\Support\Facades\Schema::hasColumn('t051_szkolenia', 'wprowadzenie_html') && trim((string)($training->wprowadzenie_html ?? '')) !== ''; $checkMaterials = $materialsCount > 0 || $introExists; $checkActiveTest = false; if (\Illuminate\Support\Facades\Schema::hasTable('t057_testy')) { $test = DB::table('t057_testy') ->where('id_szkolenie', $trainingId) ->orderBy('id', 'asc') ->first(); $checkActiveTest = !empty($test) && (int)($test->status_aktywny ?? 0) === 1; if (!empty($test) && !empty($test->id)) { $testStepUrl = url('/szkolenia/admin/tests/'.$test->id.'/edit'); } } $participantsCount = 0; // Krok 6: uznajemy za wykonany, gdy istnieje co najmniej jedno przypisanie // w tabeli relacyjnej t052_szkolenie_osoba. if (\Illuminate\Support\Facades\Schema::hasTable('t052_szkolenie_osoba')) { $participantsCount = (int) DB::table('t052_szkolenie_osoba') ->where('id_szkolenie', $trainingId) ->whereNotNull('id_osoba') ->distinct() ->count('id_osoba'); } $checkParticipants = $participantsCount > 0; $steps = [ $checkElearningInternal, $checkTopicAndGoal, $checkSchedule, $checkMaterials, $checkActiveTest, $checkParticipants, ]; } } // Opisy kroków wyświetlane w tooltipie. $stepTitles = [ 0 => 'Tryb e-Learning + miejsce Szkolenie Wewnętrzne', 1 => 'Temat i cel szkolenia', 2 => 'Harmonogram (daty i godziny)', 3 => 'Materiały szkoleniowe', 4 => 'Aktywny test', 5 => 'Lista uczestnikow', ]; @endphp
@foreach($steps as $index => $isDone) @php $stepNo = $index + 1; $done = (bool)$isDone; $stepTitle = $stepTitles[$index] ?? ('Krok '.$stepNo); @endphp
{{ $stepNo }}
@if(!$loop->last) @endif @endforeach
@if($trainingId > 0) @include('components.training.wizard-stepper-edit-modal', [ 'trainingId' => $trainingId, 'modalId' => 'TrainingStepEditModal_'.$trainingId, 'lockParticipantsManage' => $lockParticipantsManage, 'participantsLockReason' => $participantsLockReason, ]) @endif @once @endonce @once @push('scripts') @endpush @endonce @once @endonce