@extends('layouts.tenant') @section('title', 'Faturamento') @section('content')

Faturamento

Gerencie sua assinatura e informações de pagamento

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

Plano Atual

@if($subscription)

{{ $subscription->plan->name }}

{{ $subscription->plan->description }}

R$ {{ number_format($subscription->plan->price, 2, ',', '.') }}
/{{ $subscription->plan->billing_cycle === 'monthly' ? 'mês' : 'ano' }}
@php $statusClasses = [ 'active' => 'bg-green-100 text-green-800', 'cancelled' => 'bg-red-100 text-red-800', 'suspended' => 'bg-yellow-100 text-yellow-800', 'expired' => 'bg-gray-100 text-gray-800', ]; $statusLabels = [ 'active' => 'Ativo', 'cancelled' => 'Cancelado', 'suspended' => 'Suspenso', 'expired' => 'Expirado', ]; @endphp {{ $statusLabels[$subscription->status] ?? $subscription->status }} @if($subscription->trial_ends_at && $subscription->trial_ends_at->isFuture()) Período de Teste @endif
Início da Assinatura: {{ $subscription->created_at->format('d/m/Y') }}
@if($subscription->trial_ends_at)
Fim do Período de Teste: {{ $subscription->trial_ends_at->format('d/m/Y') }}
@endif @if($subscription->ends_at)
{{ $subscription->status === 'cancelled' ? 'Cancelamento em:' : 'Próxima Cobrança:' }} {{ $subscription->ends_at->format('d/m/Y') }}
@endif @if($subscription->cancelled_at)
Cancelado em: {{ $subscription->cancelled_at->format('d/m/Y H:i') }}
@endif
@if($subscription->status === 'active') Alterar Plano
@csrf
@elseif($subscription->status === 'cancelled')
@csrf
@endif
@else

Nenhuma Assinatura Ativa

Você não possui uma assinatura ativa no momento.

Escolher Plano
@endif
@if($subscription && $usageData)

Uso do Período Atual

{{ number_format($usageData['documents_processed'] ?? 0) }}
Documentos Processados
@if(isset($subscription->plan->features['max_documents']))
@php $percentage = min(100, (($usageData['documents_processed'] ?? 0) / $subscription->plan->features['max_documents']) * 100); @endphp
{{ $usageData['documents_processed'] ?? 0 }} / {{ number_format($subscription->plan->features['max_documents']) }}
@endif
{{ number_format(($usageData['storage_used'] ?? 0) / 1024 / 1024, 1) }} MB
Armazenamento Usado
@if(isset($subscription->plan->features['max_storage']))
@php $storageGB = ($usageData['storage_used'] ?? 0) / 1024 / 1024 / 1024; $maxStorageGB = $subscription->plan->features['max_storage']; $percentage = min(100, ($storageGB / $maxStorageGB) * 100); @endphp
{{ number_format($storageGB, 1) }} GB / {{ $maxStorageGB }} GB
@endif
{{ number_format($usageData['api_calls'] ?? 0) }}
Chamadas de API
@if(isset($subscription->plan->features['max_api_calls']))
@php $percentage = min(100, (($usageData['api_calls'] ?? 0) / $subscription->plan->features['max_api_calls']) * 100); @endphp
{{ $usageData['api_calls'] ?? 0 }} / {{ number_format($subscription->plan->features['max_api_calls']) }}
@endif
@endif @if($subscription)

Método de Pagamento

@if($paymentMethod)
@if($paymentMethod['type'] === 'card') @else @endif
@if($paymentMethod['type'] === 'card') **** **** **** {{ $paymentMethod['last4'] }} @else {{ $paymentMethod['description'] }} @endif
@if($paymentMethod['type'] === 'card') {{ $paymentMethod['brand'] }} • Expira {{ $paymentMethod['exp_month'] }}/{{ $paymentMethod['exp_year'] }} @else {{ $paymentMethod['type'] }} @endif
@else

Nenhum método de pagamento configurado

@endif
@endif
@if($subscription)

Resumo

Plano: {{ $subscription->plan->name }}
Status: {{ $statusLabels[$subscription->status] ?? $subscription->status }}
Valor Mensal: R$ {{ number_format($subscription->plan->price, 2, ',', '.') }}
@if($subscription->ends_at)
{{ $subscription->status === 'cancelled' ? 'Expira em:' : 'Próxima Cobrança:' }} {{ $subscription->ends_at->format('d/m/Y') }}
@endif
@endif
@if($subscription) @endif @endsection