{{-- ── 標題 ── --}}

{{ $handover->applicant->name }} {{ $handover->type === 'resignation' ? '離職' : '調職' }}交接報告

申請人:{{ $handover->applicant->name }}
類型:{{ $handover->type === 'resignation' ? '離職' : '調職' }}
預計日期:{{ $handover->expected_date?->format('Y-m-d') ?? '—' }}
狀態: @php $sl = $handover->statusLabel(); @endphp {{ $sl['label'] }}
申請時間:{{ $handover->created_at->format('Y-m-d') }}
{{-- ── 審核流程 ── --}}

審核流程

@foreach($handover->approvals->sortBy('stage_order') as $ap)
{{ $ap->stageLabel() }}
{{ $ap->approver?->name ?? '未指定' }}
@if($ap->status === 'approved')
✓ {{ $ap->decided_at?->format('m/d') }}
@elseif($ap->status === 'rejected')
✗ {{ $ap->decided_at?->format('m/d') }}
@else
@endif
@endforeach
@if($handover->approvals->where('status','!=','pending')->isNotEmpty()) @foreach($handover->approvals->where('status','!=','pending')->sortBy('stage_order') as $ap) @endforeach
關卡審核人結果意見時間
{{ $ap->stageLabel() }} {{ $ap->approver?->name ?? '—' }} {{ $ap->status === 'approved' ? '核准' : '退回' }} {{ $ap->comment ?? '—' }} {{ $ap->decided_at?->format('Y-m-d H:i') ?? '—' }}
@endif {{-- ── 各專案交接明細 ── --}} @if($handover->projects->isNotEmpty())

各專案交接明細

@foreach($handover->projects as $hp) @php $projResps = $projectResponsesByProject[$hp->id] ?? collect(); $respsByDept = $projResps->groupBy(fn($r) => $r->template->department); $depts = ['business'=>'專案業務組','rd'=>'軟體開發組','systems'=>'系統資安組','admin'=>'人事']; @endphp
{{ $hp->project->client?->name ? $hp->project->client->name . ' / ' : '' }}{{ $hp->project->name }} 交接給:{{ $hp->receiver?->name ?? '未指定' }} @if($hp->receiver_confirmed_at) ✓ {{ $hp->receiverConfirmer?->name }} 已確認({{ $hp->receiver_confirmed_at->format('Y-m-d') }}) @else (尚未確認) @endif
@if($hp->notes)
備註:{{ $hp->notes }}
@endif @foreach($depts as $deptKey => $deptLabel) @php $dRs = $respsByDept[$deptKey] ?? collect(); @endphp @if($dRs->isNotEmpty()) @foreach($dRs as $r) @php $isYesno = $r->template->item_type === 'yesno'; $answer = $isYesno ? ($r->status !== 'pending' ? ($r->yesno_value ? '是' : '否') : '—') : ($r->content ?? '—'); @endphp
{{ $r->template->title }}
{{ $answer }}
@if($r->status === 'confirmed') 已確認 @elseif($r->status === 'filled') 已填寫 @else 未填寫 @endif
@endforeach @endif @endforeach
@endforeach @endif {{-- ── 全域交接項目 ── --}} @foreach(['systems'=>'系統資安組','admin'=>'人事'] as $deptKey => $deptLabel) @php $deptResps = $globalResponsesByDept[$deptKey] ?? collect(); @endphp @if($deptResps->isNotEmpty())

{{ $deptLabel }}交接項目

@foreach($deptResps as $r) @php $isYesno = $r->template->item_type === 'yesno'; $answer = $isYesno ? ($r->status !== 'pending' ? ($r->yesno_value ? '是' : '否') : '—') : ($r->content ?? '—'); @endphp @endforeach
項目填寫內容狀態確認人
{{ $r->template->title }} {{ $answer }} @if($r->status==='confirmed')已確認 @elseif($r->status==='filled')已填寫 @else未填寫@endif {{ $r->confirmer?->name ?? '—' }}
@endif @endforeach {{-- ── 資產歸還 ── --}} @if($handover->assets->isNotEmpty())

資產歸還

@foreach($handover->assets as $ha) @php $deptLabels = \App\Models\Asset::CONFIRM_DEPTS; @endphp @endforeach
資產名稱序號負責組狀態確認人確認時間
{{ $ha->asset->asset_name }} {{ $ha->asset->asset_sn ?? '—' }} {{ $deptLabels[$ha->confirm_dept] ?? $ha->confirm_dept }} @if($ha->returned)已歸還 @else未歸還@endif {{ $ha->confirmer?->name ?? '—' }} {{ $ha->confirmed_at?->format('Y-m-d H:i') ?? '—' }}
@endif {{-- ── 排除的專案 ── --}} @if($handover->excluded_projects && count($handover->excluded_projects) > 0)
申請人排除的專案(不納入本次交接): {{ collect($handover->excluded_projects)->map(fn($p) => ($p['client'] ? $p['client'].' / ' : '').$p['name'])->join('、') }}
@endif @if($handover->notes)
備註:{{ $handover->notes }}
@endif