@extends('layouts.app') @section('content') @php $isOut = $deviceRequest->flow === 'out'; // ★ 判斷攜出 / 攜入 @endphp

設備{{ $isOut ? '攜出' : '攜入' }}申請 #{{ $deviceRequest->id }}

返回清單
{{-- ============ 共用:申請人 / 時間 / 狀態 ============ --}}
{{-- flow 特有欄位 --}} @if ($isOut) {{-- === 攜出資料 === --}} @php $detail = $deviceRequest->out_reason_detail; $labels = [ 'backup_offsite' => '備份媒體異地儲存', 'backup_return' => '異地備份媒體送回', 'new_device' => '新增設備', 'repair' => '設備送修', 'transfer' => '調 / 借 / 還', 'other' => '其他', ]; @endphp @else {{-- === 攜入資料 === --}} {{-- 依設備類別顯示細項 --}} @php $types = explode(',',$deviceRequest->device_type ?? ''); @endphp @if (in_array('nb', $types)) @endif @if (in_array('media', $types)) @endif @if (in_array('other', $types)) @endif @endif {{-- 共同備註、主管、狀態… --}} @if ($deviceRequest->approver) @endif
申請人 {{ $deviceRequest->user->name }}
部門 {{ $deviceRequest->user->department }}
申請日期 {{ $deviceRequest->created_at->format('Y-m-d H:i') }}
計畫攜出日 {{ $deviceRequest->bring_date }}
預計歸還日 {{ $deviceRequest->return_date ?? '—' }}
攜出方式 {{ $deviceRequest->out_way }} @if ($deviceRequest->out_way === 'freight') ({{ $deviceRequest->freight_company }} / {{ $deviceRequest->freight_no }}) @elseif($deviceRequest->out_way === 'other') ({{ $deviceRequest->out_way_other }}) @endif
攜出原因 {{ collect($detail['reasons'] ?? [])->map(fn($r) => $labels[$r] ?? $r)->implode('、') ?: '—' }}
計畫攜入日 {{ $deviceRequest->bring_date }}
預計攜出 {{ $deviceRequest->return_date ?? '—' }}
使用場地 {{ ['meeting_room' => '會議室', 'office' => '辦公室', 'server_room' => '機房', 'other' => '其他'][ $deviceRequest->place ] ?? '—' }} @if ($deviceRequest->place === 'other') ({{ $deviceRequest->place_other_text }}) @endif
筆電型式 {{ $deviceRequest->model ?: '—' }}
筆電廠牌 {{ $deviceRequest->brand ?: '—' }}
病毒碼是否最新 {{ $deviceRequest->av_updated ? '是' : '否' }}
防毒軟體 {{ $deviceRequest->nb_av ?: '—' }}
可攜式儲存媒體 {!! $deviceRequest->item_usb ? '■ 隨身碟' : '□ 隨身碟' !!} {!! $deviceRequest->item_hdd ? '、■ 抽取式硬碟' : '、□ 抽取式硬碟' !!}
其它設備 {{ $deviceRequest->item_other_name ?: '—' }}
備註 {{ $deviceRequest->note ?? '—' }}
主管 {{ optional($deviceRequest->supervisor)->name ?? '—' }}
網路管理員 {{ optional($deviceRequest->approver)->name }}
核准日期 {{ optional($deviceRequest->approved_at)->format('Y-m-d') }}
狀態 @php $color = [ 'approved' => 'success', 'rejected' => 'danger', 'pending_supervisor' => 'warning', 'pending_admin' => 'info', ][$deviceRequest->status] ?? 'secondary'; $label = [ 'pending_supervisor' => '待主管審核', 'pending_admin' => '待管理者審核', 'approved' => '已通過', 'rejected' => '已拒絕', ][$deviceRequest->status] ?? '未知'; @endphp {{ $label }}
{{-- === 攜出完成後的紀錄(僅 flow=out && status=returned) === --}} @if ($isOut && $deviceRequest->status === 'returned')
攜出紀錄
實際攜出日期 {{ $deviceRequest->actual_return_date }}
承辦人 {{ $deviceRequest->handled_by }}
權責主管 {{ $deviceRequest->approved_by }}
@endif {{-- === 流程相關按鈕(示例) === --}} @auth @if (!$isOut && $deviceRequest->status === 'approved') {{-- 攜入單可下載 Docx --}} 下載申請單 @elseif($isOut && Auth::user()->role === 'admin' && $deviceRequest->status === 'approved') {{-- 攜出單 admin 可登記攜出 --}} @endif @endauth
{{-- ===== 攜出登記 Modal(只在攜出流程才需要) ===== --}} @if ($isOut && Auth::user()->role === 'admin') @include('device-requests.partials.out-modal', ['deviceRequest' => $deviceRequest]) @endif @endsection