@extends('layouts.app') @section('title', $customer->name) @section('content') @php $quoteLabels = ['draft' => 'Em aberto', 'converted' => 'Aprovado', 'cancelled' => 'Cancelado']; $orderLabels = ['draft' => 'Rascunho', 'in_production' => 'Em produção', 'ready' => 'Pronta', 'delivered' => 'Entregue', 'cancelled' => 'Cancelada']; $appointmentLabels = ['appointment' => 'Atendimento', 'return' => 'Retorno', 'contact' => 'Contato', 'delivery' => 'Entrega', 'reminder' => 'Lembrete']; $latestMeasurement = $customer->pupilMeasurements->first(); $nextAppointment = $customer->appointments->where('status', 'scheduled')->sortBy('starts_at')->first(); @endphp

{{ $customer->name }}

{{ $customer->active ? 'Ativo' : 'Inativo' }}
{{ $customer->whatsapp ?: $customer->phone ?: 'Sem telefone' }} @if($customer->email) · {{ $customer->email }} @endif
@if($customer->active) + Orçamento Agendar @endif Editar
Financeiro

{{ $summary['financial_status'] }}

@if($summary['overdue'] > 0) R$ {{ number_format($summary['overdue'], 2, ',', '.') }} em atraso @elseif($summary['outstanding'] > 0) R$ {{ number_format($summary['outstanding'], 2, ',', '.') }} em aberto @else Sem pendências @endif
Última receita
@if($rx = $summary['latest_prescription'])

{{ $rx->issued_at?->format('d/m/Y') ?: 'Sem data' }}

{{ $rx->lens_usage ?: 'Uso não informado' }}
@else

Nenhuma

Cadastre quando precisar.
@endif
Medidas
@if($latestMeasurement)

DP {{ number_format((float) $latestMeasurement->binocular_pd, 2, ',', '.') }} mm

Medida em {{ $latestMeasurement->measured_at?->format('d/m/Y') ?: '—' }}
@else

Não medidas

Sem DNP/DP registrada.
@endif
Próximo compromisso
@if($nextAppointment)

{{ $nextAppointment->starts_at?->format('d/m H:i') ?: 'Sem horário' }}

{{ $nextAppointment->title }}
@else

Nenhum

Sem retorno agendado.
@endif

Dados do cliente

Cadastro desde {{ $customer->created_at?->format('d/m/Y') ?: '—' }}
Editar dados
CPF
{{ $customer->cpf ?: 'Não informado' }}
Nascimento
{{ $customer->birth_date?->format('d/m/Y') ?: 'Não informado' }}
Contato
{{ $customer->whatsapp ?: $customer->phone ?: 'Não informado' }}
Endereço
{{ collect([$customer->street, $customer->number, $customer->complement, $customer->district, $customer->city, $customer->state])->filter()->implode(', ') ?: 'Não informado' }}
@if($customer->responsible_name)
Responsável
{{ $customer->responsible_name }} @if($customer->responsible_relationship) · {{ $customer->responsible_relationship }} @endif
{{ $customer->responsible_phone ?: 'Sem telefone informado' }}
@endif @if($customer->notes)
Observações
{{ $customer->notes }}
@endif
Vendas e atendimento
Orçamentos, OS e próximos compromissos do cliente.
@if($customer->active) Novo orçamento Nova OS direta Novo agendamento @endif
Orçamentos{{ $customer->salesQuotes->count() }}
@forelse($customer->salesQuotes->take(5) as $quote) @empty @endforelse
CódigoTotalStatus
{{ $quote->code }}
{{ $quote->created_at?->format('d/m/Y') ?: '—' }}
R$ {{ number_format((float) $quote->total_amount, 2, ',', '.') }} {{ $quoteLabels[$quote->status] ?? $quote->status }}
Nenhum orçamento.
Vendas / OS{{ $customer->serviceOrders->count() }}
@forelse($customer->serviceOrders->take(5) as $order) @empty @endforelse
OSTotalStatus
{{ $order->code }}
{{ $order->ordered_at?->format('d/m/Y') ?: '—' }}
R$ {{ number_format((float) $order->total_amount, 2, ',', '.') }} {{ $orderLabels[$order->status] ?? $order->status }}
Nenhuma OS.
Agenda
@forelse($customer->appointments->where('status', 'scheduled')->sortBy('starts_at')->take(5) as $appointment) @empty @endforelse
QuandoCompromisso
{{ $appointment->starts_at?->format('d/m H:i') ?: '—' }} {{ $appointment->title }}
{{ $appointmentLabels[$appointment->type] ?? $appointment->type }}
Nenhum compromisso aberto.
Receita e medidas
Abra somente quando precisar consultar ou registrar dados ópticos.
@if($rx = $summary['latest_prescription'])
Receita atual · {{ $rx->issued_at?->format('d/m/Y') ?: 'sem data' }} @if($rx->attachment_path) Abrir anexo @endif
OlhoEsféricoCilíndricoEixoAdiçãoDNP
OD{{ $rx->od_sphere ?? '—' }}{{ $rx->od_cylinder ?? '—' }}{{ $rx->od_axis ?? '—' }}{{ $rx->od_addition ?? '—' }}{{ $rx->od_dnp ?? '—' }}
OE{{ $rx->oe_sphere ?? '—' }}{{ $rx->oe_cylinder ?? '—' }}{{ $rx->oe_axis ?? '—' }}{{ $rx->oe_addition ?? '—' }}{{ $rx->oe_dnp ?? '—' }}
@endif
+ Cadastrar nova receita
@csrf

Olho direito

Olho esquerdo

Complementos

PDF ou imagem, até 10 MB.
Medidas pupilares
@include('customers._pupil_measurements')
Histórico de receitas
@forelse($customer->prescriptions as $prescription) @empty @endforelse
DataProfissionalUsoStatusAnexo
{{ $prescription->issued_at?->format('d/m/Y') ?: '—' }} {{ $prescription->prescriber_name ?: '—' }} {{ $prescription->lens_usage ?: '—' }} @if($prescription->is_current)Atual@elseHistórica@endif @if($prescription->attachment_path)Abrir@else@endif
Nenhuma receita.
Crediário e pagamentos
Limite, parcelas e recebimentos ficam aqui.

Configuração

@csrf @method('PUT')

Nova venda parcelada

@if($summary['credit_account'])
@csrf
Disponível: R$ {{ number_format($summary['available_credit'], 2, ',', '.') }}
@else

Abra o crediário primeiro.

@endif
@if($summary['credit_account'])
@forelse($summary['installment_rows'] as $row) @empty @endforelse
ParcelaOrigemVencimentoValorSaldoStatus
{{ $row['installment']->installment_number }}/{{ $row['installment']->total_installments }} @if($row['installment']->serviceOrder) {{ $row['installment']->serviceOrder->code }} @else Manual @endif {{ $row['installment']->due_date?->format('d/m/Y') ?: '—' }} R$ {{ number_format($row['gross'], 2, ',', '.') }} R$ {{ number_format($row['balance'], 2, ',', '.') }} {{ $row['display_status'] }}
Nenhuma parcela lançada.
Receber pagamento
@csrf
Últimos pagamentosTotal R$ {{ number_format($summary['total_paid'], 2, ',', '.') }}
@forelse($summary['recent_payments'] as $payment) @empty @endforelse
DataFormaValor
{{ $payment->paid_at?->format('d/m/Y H:i') ?: '—' }}{{ $payment->method }}R$ {{ number_format((float) $payment->amount, 2, ',', '.') }}
Nenhum pagamento.
@endif
Histórico completo
Tudo que aconteceu com este cliente, em ordem cronológica.
@forelse($timeline as $item)
{{ $item['title'] }}
{{ optional($item['occurred_at'])->format('d/m/Y H:i') }}
@if($item['description'])
{{ $item['description'] }}
@endif
@empty

Ainda não há eventos.

@endforelse
@if(auth()->user()?->role === 'admin')
Ações administrativas
Use somente quando necessário.
@csrf @method('PATCH')
@csrf @method('DELETE')
@endif @endsection