{{-- Processor Drawing Documents tab — included in jobs/show.blade.php Accessible by: processor (upload/manage), factory_employee (view/download only) Also visible to office_admin and project_manager in the full tab view. --}} @php $authUser = auth()->user(); $authRole = $authUser->role?->name ?? ''; $canUpload = !in_array($authRole, ['factory_employee']); $isFactoryEmpl = $authRole === 'factory_employee'; @endphp

Processor Drawing Documents {{ $processorDocuments->count() }}

@if($isFactoryEmpl) Drawing documents provided by the processor team. @else Upload and manage processor drawing documents for this job. @endif

{{-- Upload form (hidden for factory_employee) --}} @if($canUpload)

Upload Drawing Document

@csrf

Drag & drop drawing files here or click to browse

PDF, Word, Excel, Images, ZIP — max 20 MB each

@endif {{-- Document list --}} @if($processorDocuments->isEmpty())

No processor drawing documents uploaded yet.

@if($canUpload)

Use the upload form above to add the first drawing.

@endif
@else
@foreach($processorDocuments as $doc)
@php $mime = $doc->file_type ?? ''; $icon = 'fa-file'; $iconColor = 'text-indigo-400'; if (str_contains($mime, 'pdf')) { $icon = 'fa-file-pdf'; $iconColor = 'text-red-400'; } elseif (str_contains($mime, 'word') || str_ends_with($doc->file_path, '.doc') || str_ends_with($doc->file_path, '.docx')) { $icon = 'fa-file-word'; $iconColor = 'text-blue-400'; } elseif (str_contains($mime, 'excel') || str_contains($mime, 'spreadsheet') || in_array(pathinfo($doc->file_path, PATHINFO_EXTENSION), ['xls','xlsx','csv'])) { $icon = 'fa-file-excel'; $iconColor = 'text-green-400'; } elseif (str_contains($mime, 'image')) { $icon = 'fa-file-image'; $iconColor = 'text-purple-400'; } elseif (str_contains($mime, 'zip') || str_contains($mime, 'compressed')) { $icon = 'fa-file-archive'; $iconColor = 'text-yellow-400'; } @endphp

{{ $doc->name }}

{{ $doc->formatted_size }} • {{ $doc->created_at->format('d M Y, g:i a') }} @if($doc->uploader) • {{ $doc->uploader->name }} @endif

Download @if($canUpload && !$isFactoryEmpl) @if(in_array($authRole, ['office_admin','project_manager']) || $doc->uploaded_by === $authUser->id)
@csrf @method('DELETE')
@endif @endif
@endforeach
@endif
@push('scripts') @endpush