@extends('contentNavbarLayout') @section('title', 'Paired Bulk Upload - Documents with CSV Files') @section('page-style') @endsection @section('content')
{{-- Loading Screen Overlay --}}

Paired Bulk Upload - Documents with CSV Files

{{-- Instructions Card --}} {{-- Flash Messages --}} @if(session('success')) @endif @if ($errors->any()) @endif {{-- Template Download Section --}}
Download Templates
Choose the type of records you want to upload
{{-- Active Upload Progress Status - REMOVED FOR FOLDER-BASED SYSTEM --}} {{-- Users no longer upload via web interface --}} {{-- Active/In-Progress Uploads - REMOVED FOR FOLDER-BASED SYSTEM --}} {{-- Processing happens automatically in background via scheduled command --}} {{-- Upload History --}} @hasPermission('document.pairedbulkupload.view_history')
Paired Upload History
@if($uploadHistory->total() == 0)

No paired upload history available

@else
@foreach($uploadHistory as $index => $upload) @endforeach
Timestamp Record Type Total Files Queue Status Upload Status Actions
{{ \Carbon\Carbon::parse($upload->created_at)->format('Y-m-d H:i:s') }} {{ ucfirst($upload->record_type_name) }} {{ $upload->total_files }} @if(isset($upload->status)) @if($upload->status === 'pending') ⏳ Pending @elseif($upload->status === 'processing') 🔄 Processing ({{ round($upload->progress_percentage ?? 0) }}%) @elseif($upload->status === 'completed') ✓ Completed @elseif($upload->status === 'failed') ✗ Failed @endif @else ✓ Completed @endif @if(isset($upload->successful)) {{ $upload->successful }} Success @if($upload->failed > 0) {{ $upload->failed }} Failed @endif @else Processing... @endif @if(isset($upload->files_detail) || isset($upload->result)) @else - @endif
@php // Handle both queue uploads (result field) and history uploads (files_detail field) $details = null; if (isset($upload->result)) { $details = is_string($upload->result) ? json_decode($upload->result, true) : $upload->result; } elseif (isset($upload->files_detail)) { $details = is_string($upload->files_detail) ? json_decode($upload->files_detail, true) : $upload->files_detail; } // Extract file details $files = []; if (is_array($details)) { $files = $details['files'] ?? $details; } @endphp @if(!empty($files) && is_array($files))
Paired File Details:
@foreach($files as $file) @endforeach
Document File CSV File Doc Size CSV Size Status
{{ $file['name'] ?? 'N/A' }} @if(isset($file['csv_file'])) {{ $file['csv_file'] }} @elseif(isset($file['xlsx_file'])) {{ $file['xlsx_file'] }} @else N/A @endif {{ isset($file['size']) && is_numeric($file['size']) ? number_format($file['size'] / 1024, 2) . ' KB' : 'N/A' }} @php $csvSize = $file['csv_size'] ?? $file['xlsx_size'] ?? null; @endphp {{ isset($csvSize) && is_numeric($csvSize) ? number_format($csvSize / 1024, 2) . ' KB' : 'N/A' }} @if(($file['status'] ?? '') == 'success') Success @else Failed @if(isset($file['error']))
{{ $file['error'] }} @endif @endif
@else

@if(isset($upload->status) && in_array($upload->status, ['pending', 'processing'])) Upload is still processing. Details will be available when complete. @elseif(isset($upload->message)) {{ $upload->message }} @else No details available for this upload. @endif

@endif
{{-- Pagination Links --}} @if($uploadHistory->hasPages())
Showing {{ $uploadHistory->firstItem() }} to {{ $uploadHistory->lastItem() }} of {{ $uploadHistory->total() }} entries
{{ $uploadHistory->links() }}
@endif @endif
@endhasPermission
@endsection @section('page-script') @endsection