{{ __('Detail Progres Unit') }}

{{ __('Progres Pembangunan untuk Unit ') }}{{ $unit->nama_unit }}

{{ __('Kembali') }} @can('create unit progress') @endcan
@if (session('success')) @endif @if ($errors->any()) @endif @php function findProgressForStage($stageId, $unitProgresses) { return $unitProgresses->firstWhere('stage_id', $stageId); } function renderStageTree($stages, $unitProgresses, $unit) { echo '
    '; foreach ($stages as $stage) { $progress = findProgressForStage($stage->id, $unitProgresses); $percentage = $progress ? $progress->progress_percentage : 0; $hasChildren = $stage->children->isNotEmpty(); $cumulativePercentage = 0; if ($hasChildren) { $totalPercentage = 0; $totalChildren = $stage->children->count(); foreach($stage->children as $child) { $childProgress = findProgressForStage($child->id, $unitProgresses); if ($childProgress) { $totalPercentage += $childProgress->progress_percentage; } } if ($totalChildren > 0) { $cumulativePercentage = round($totalPercentage / $totalChildren, 2); } } @endphp
  • @if ($hasChildren) @else @endif {{ $stage->name }} @if ($hasChildren) (Progres Akumulatif) @endif
    {{ $hasChildren ? $cumulativePercentage : $percentage }}% @if ($hasChildren)
    @else
    @endif

    {{ $stage->description }}

    @if (!$hasChildren && $progress)
    @csrf @method('DELETE')
    @endif
  • @php if ($hasChildren) { echo ''; } } echo '
'; } @endphp @if ($stages->isEmpty())

{{ __('Belum ada tahapan yang tersedia untuk unit ini.') }}

@else @php renderStageTree($stages->whereNull('parent_id'), $unitProgresses, $unit); @endphp @endif