@extends('layouts.tenant') @section('title', 'Detalhes do Documento') @section('content')

{{ $document->name }}

Detalhes e informações do documento

@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif

Visualização do Documento

@php $extension = strtolower(pathinfo($document->name, PATHINFO_EXTENSION)); $isImage = in_array($extension, ['jpg', 'jpeg', 'png', 'gif']); $isPdf = $extension === 'pdf'; @endphp @if($isImage) {{ $document->name }} @elseif($isPdf)

Documento PDF

Clique no botão abaixo para visualizar o PDF

Abrir PDF
@else

{{ strtoupper($extension) }} Document

Visualização não disponível para este tipo de arquivo

Baixar Arquivo
@endif
@if($document->extracted_text)

Texto Extraído (OCR)

{{ $document->extracted_text }}
@endif @if($document->ai_analysis)

Análise via IA

{!! nl2br(e($document->ai_analysis)) !!}
@endif @if($document->processing_history)

Histórico de Processamento

@foreach(json_decode($document->processing_history, true) ?? [] as $entry)
@if($entry['status'] === 'success') @elseif($entry['status'] === 'error') @else @endif

{{ $entry['action'] ?? 'Ação' }}

{{ $entry['message'] ?? 'Sem mensagem' }}

{{ isset($entry['timestamp']) ? \Carbon\Carbon::parse($entry['timestamp'])->format('d/m/Y H:i') : '' }}
@endforeach
@endif

Informações do Documento

@php $statusClasses = [ 'pending' => 'bg-yellow-100 text-yellow-800', 'processing' => 'bg-blue-100 text-blue-800', 'processed' => 'bg-green-100 text-green-800', 'failed' => 'bg-red-100 text-red-800', ]; $statusLabels = [ 'pending' => 'Pendente', 'processing' => 'Processando', 'processed' => 'Processado', 'failed' => 'Falhou', ]; @endphp {{ $statusLabels[$document->status] ?? $document->status }}
@php $typeLabels = [ 'invoice' => 'Fatura', 'receipt' => 'Recibo', 'contract' => 'Contrato', 'report' => 'Relatório', 'other' => 'Outro' ]; @endphp

{{ $typeLabels[$document->type] ?? $document->type }}

{{ number_format($document->size / 1024, 1) }} KB

{{ $document->mime_type }}

@if($document->priority && $document->priority !== 'normal')
@php $priorityLabels = [ 'high' => 'Alta', 'urgent' => 'Urgente' ]; $priorityClasses = [ 'high' => 'bg-orange-100 text-orange-800', 'urgent' => 'bg-red-100 text-red-800' ]; @endphp {{ $priorityLabels[$document->priority] ?? $document->priority }}
@endif @if($document->client) @endif @if($document->tags)
@foreach(explode(',', $document->tags) as $tag) {{ trim($tag) }} @endforeach
@endif

{{ $document->created_at->format('d/m/Y H:i') }}

@if($document->processed_at)

{{ $document->processed_at->format('d/m/Y H:i') }}

@endif

Ações

Baixar Documento @if(in_array($document->status, ['pending', 'failed'])) @endif @if($document->status === 'processed') @endif
@if($document->description)

Descrição

{{ $document->description }}

@endif @if($document->meta && is_array(json_decode($document->meta, true)))

Metadados

@foreach(json_decode($document->meta, true) as $key => $value)
{{ ucfirst($key) }}: {{ is_array($value) ? json_encode($value) : $value }}
@endforeach
@endif
@endsection