@php /* ── Precompute chart data ── */ $tenders = $data['tenders']; /* Status distribution */ $statusColors = [ 'draft' => '#94a3b8', 'identified' => '#60a5fa', 'qualification' => '#38bdf8', 'preparation' => '#fb923c', 'submitted' => '#34d399', 'evaluation' => '#a78bfa', 'clarification' => '#fbbf24', 'negotiation' => '#4ade80', 'won' => '#16a34a', 'lost' => '#ef4444', 'cancelled' => '#c084fc', 'completed' => '#059669', ]; $statusLabels = [ 'draft'=>'Draft','identified'=>'Identified','qualification'=>'Qualification', 'preparation'=>'Preparation','submitted'=>'Submitted','evaluation'=>'Evaluation', 'clarification'=>'Clarification','negotiation'=>'Negotiation', 'won'=>'Won','lost'=>'Lost','cancelled'=>'Cancelled','completed'=>'Completed', ]; $statusDist = []; foreach ($tenders as $t) { $k = $t->status?->value ?? 'unknown'; $statusDist[$k] = ($statusDist[$k] ?? 0) + 1; } arsort($statusDist); $totalForPct = array_sum($statusDist) ?: 1; /* Priority distribution */ $priorityColors = ['low'=>'#94a3b8','medium'=>'#fbbf24','high'=>'#fb923c','urgent'=>'#ef4444']; $priorityDist = []; foreach ($tenders as $t) { $k = $t->priority?->value ?? 'unknown'; $priorityDist[$k] = ($priorityDist[$k] ?? 0) + 1; } arsort($priorityDist); $totalPri = array_sum($priorityDist) ?: 1; /* Bar chart max */ $barMax = max(array_values($statusDist) ?: [1]); /* SVG donut helper */ function donutSlices(array $dist, array $colors, int $cx, int $cy, int $r, int $innerR): string { $total = array_sum($dist) ?: 1; $angle = -90; $svg = ''; foreach ($dist as $key => $val) { $pct = $val / $total; $sweep = 360 * $pct; if ($sweep >= 359.9) $sweep = 359.9; $r1 = deg2rad($angle); $r2 = deg2rad($angle + $sweep); $x1 = $cx + $r * cos($r1); $y1 = $cy + $r * sin($r1); $x2 = $cx + $r * cos($r2); $y2 = $cy + $r * sin($r2); $xi1 = $cx + $innerR * cos($r1); $yi1 = $cy + $innerR * sin($r1); $xi2 = $cx + $innerR * cos($r2); $yi2 = $cy + $innerR * sin($r2); $large = $sweep > 180 ? 1 : 0; $color = $colors[$key] ?? '#cbd5e1'; $svg .= ""; $angle += $sweep; } return $svg; } @endphp {{-- ── HEADER ── --}}
Raya Tender
Laporan Tender
PT. Raya Konstruksi Internasional · Dicetak: {{ now()->format('d F Y, H:i') }} @if(!empty($filters['start_date'])) · Periode: {{ $filters['start_date'] }} s/d {{ $filters['end_date'] ?? now()->format('Y-m-d') }} @endif @if(!empty($filters['status'])) · Status: {{ strtoupper($filters['status']) }} @endif
{{-- ── TABLE ── --}}
Daftar Tender
@forelse($data['tenders'] as $t) @php $sk = 's-' . ($t->status?->value ?? 'default'); $pk = 'p-' . ($t->priority?->value ?? 'low'); @endphp @empty @endforelse
Kode Nama Tender Klien Kategori PIC Status Prioritas Deadline
{{ $t->code }} {{ $t->title }} {{ $t->client?->name ?? '—' }} {{ $t->category?->name ?? '—' }} {{ $t->pic?->name ?? '—' }} {{ $t->status?->label() }} {{ $t->priority?->label() }} {{ $t->submission_deadline?->format('d/m/Y') ?? '—' }}
Tidak ada data tender

{{-- ── STATS ── --}}
{{ $data['total'] }}
Total
{{ $data['active'] }}
Aktif
{{ $data['won'] }}
Menang
{{ $data['lost'] }}
Kalah
{{ $data['win_rate'] }}%
Win Rate
{{-- ── CHARTS ── --}}
{{-- Bar chart: Status Distribution --}}
Distribusi Status Tender
@foreach($statusDist as $key => $cnt) @php $pct = $barMax > 0 ? round(($cnt / $barMax) * 100) : 0; $color = $statusColors[$key] ?? '#94a3b8'; @endphp
{{ $statusLabels[$key] ?? ucfirst($key) }}
{{ $cnt }}
@endforeach
{{-- Donut: Priority Distribution --}}
Distribusi Prioritas
@php $svgSize = 110; $cx = 55; $cy = 55; $r = 46; $innerR = 28; $donutSvg = donutSlices($priorityDist, $priorityColors, $cx, $cy, $r, $innerR); @endphp
{!! $donutSvg !!} {{ $totalPri }} tender
@foreach($priorityDist as $key => $cnt) @php $color = $priorityColors[$key] ?? '#cbd5e1'; @endphp
{{ ucfirst($key) }}
{{ $cnt }} ({{ round($cnt/$totalPri*100) }}%)
@endforeach
{{-- ── FOOTER ── --}}