@php $_pdfLogo = null; foreach (['png','svg','jpg','jpeg'] as $_ext) { $_path = public_path('logo.'.$_ext); if (file_exists($_path)) { $_mime = $_ext === 'svg' ? 'image/svg+xml' : 'image/'.$_ext; $_pdfLogo = 'data:'.$_mime.';base64,'.base64_encode(file_get_contents($_path)); break; } } @endphp 無障礙掃描報告 - {{ $scan->target_url }} {{-- ══ 封面頁 ══ --}}
@if($_pdfLogo) {{ config('app.company_name') }} @else @endif
@if(!$_pdfLogo)
{{ config('app.company_name') }}
@endif
無障礙合規服務
CONFIDENTIAL
Pa11y
HTML CodeSniffer · WCAG 2.x
Web Accessibility Assessment
無障礙掃描報告
Accessibility Compliance Report · {{ $scan->standard }}

Prepared for  ·  委託單位
{{ $scan->project?->client?->name ?? $scan->project?->name ?? '(未指定委託單位)' }}

Target Website  ·  掃描目標網址
{{ $scan->target_url }}
Project  ·  所屬專案
{{ $scan->project?->name ?? '—' }}
Standard  ·  合規標準
WCAG 2.x {{ $scan->standardLabel() }}
Pages  ·  掃描頁數
{{ $scan->pages_scanned ?? 1 }} 頁
@php $bt = $summary['by_type'] ?? []; $topType = ($bt['error'] ?? 0) > 0 ? 'error' : (($bt['warning'] ?? 0) > 0 ? 'warning' : 'notice'); $topLabel = ['error'=>'發現錯誤', 'warning'=>'發現警告', 'notice'=>'僅有注意'][$topType]; $lhScore = $summary['lh_score'] ?? null; @endphp
Overall Result  ·  整體結果
@if($lhScore !== null) @php $lhColor = $lhScore >= 90 ? '#16a34a' : ($lhScore >= 50 ? '#d97706' : '#dc2626'); @endphp
Lighthouse {{ $lhScore }}/100
@else
{{ $topLabel }}
@endif
總計 {{ $summary['total'] ?? 0 }} 個問題  ·  錯誤 {{ $bt['error'] ?? 0 }}   警告 {{ $bt['warning'] ?? 0 }}   注意 {{ $bt['notice'] ?? 0 }}
掃描日期:{{ $scan->finished_at?->format('Y-m-d') ?? '—' }}
掃描工具:Pa11y + {{ $scan->runnerLabel() }}
引擎:Headless Chrome
掃描深度:{{ $scan->max_pages > 1 ? "多頁(最多 {$scan->max_pages} 頁)" : '單頁' }}
報告產生:{{ now()->format('Y-m-d H:i') }}
{{-- ══ 第 2 頁:掃描總覽 ══ --}}
掃描總覽
項目內容
目標網址{{ $scan->target_url }}
合規標準WCAG 2.x {{ $scan->standardLabel() }}
掃描頁數{{ $scan->pages_scanned ?? 1 }} 頁(上限 {{ $scan->max_pages }})
掃描工具Pa11y + {{ $scan->runnerLabel() }} (runner: {{ $scan->runner ?? 'htmlcs' }})
所屬專案{{ $scan->project?->name ?? '—' }}
掃描時間{{ $scan->started_at?->format('Y-m-d H:i') ?? '—' }}
完成時間{{ $scan->finished_at?->format('Y-m-d H:i') ?? '—' }}
問題總計{{ $summary['total'] ?? 0 }}
{{-- 統計卡 --}}
問題統計
錯誤警告注意總計
{{ $bt['error'] ?? 0 }}
Error
錯誤
{{ $bt['warning'] ?? 0 }}
Warning
警告
{{ $bt['notice'] ?? 0 }}
Notice
注意
{{ $summary['total'] ?? 0 }}
Total
總計
{{-- WCAG 原則分布 --}} @php $byPrinciple = []; foreach ($findings as $f) { $byPrinciple[$f['principle'] ?? '—'][] = $f; } @endphp
WCAG 原則分布
@foreach($byPrinciple as $principle => $items) @endforeach
WCAG 原則 錯誤 警告 注意 合計
{{ $principle }} {{ count(array_filter($items, fn($i)=>$i['type']==='error')) }} {{ count(array_filter($items, fn($i)=>$i['type']==='warning')) }} {{ count(array_filter($items, fn($i)=>$i['type']==='notice')) }} {{ count($items) }}
{{-- 多頁:各頁面摘要 --}} @if($scan->max_pages > 1) @php $byPage = []; foreach ($findings as $f) { $byPage[$f['page_url'] ?? '—'][] = $f; } @endphp
各頁面問題統計
@foreach($byPage as $pageUrl => $pageItems) @endforeach
頁面網址 錯誤 警告 注意 合計
{{ $pageUrl }} {{ count(array_filter($pageItems, fn($i)=>$i['type']==='error')) }} {{ count(array_filter($pageItems, fn($i)=>$i['type']==='warning')) }} {{ count(array_filter($pageItems, fn($i)=>$i['type']==='notice')) }} {{ count($pageItems) }}
@endif
{{-- ══ 第 3 頁起:詳細發現 ══ --}} @if(count($findings))
詳細發現清單
@foreach($byPrinciple as $principle => $items)
{{ $principle }}({{ count($items) }} 項)
@foreach($items as $f)
{{ ['error'=>'錯誤','warning'=>'警告','notice'=>'注意'][$f['type']] ?? $f['type'] }} {{ $f['message'] }}
@if(!empty($f['page_url']) && $scan->max_pages > 1)
來源頁面
{{ $f['page_url'] }}
@endif
規則代碼
{{ $f['code'] }}
準則
{{ $f['guideline'] }}
@if(!empty($f['selector']))
選擇器
{{ $f['selector'] }}
@endif @if(!empty($f['context']))
HTML 片段
{{ $f['context'] }}
@endif @if(!empty($f['remediation']))
修改建議
{{ $f['remediation'] }}
@endif
@endforeach
@endforeach
@endif