@extends('layouts.admin-modern') @section('title', 'Facture ' . $invoice->invoice_number) @section('content')
{{-- Header --}} {{-- Info boxes --}}

Type

{{ $invoice->type_label }}

Montant TTC

{{ number_format($invoice->total, 2, ',', ' ') }}€

Commission

{{ number_format($invoice->commission_amount, 2, ',', ' ') }}€

Statut

{{ $invoice->status_label }}
{{-- Facture complète --}}
{{-- Header --}}

{{ $invoice->type === 'client' ? 'FACTURE' : 'RELEVÉ' }}

{{ $invoice->invoice_number }}

Émise le {{ optional($invoice->issued_at)->format('d/m/Y à H:i') }}

@if($invoice->paid_at)

Payée le {{ $invoice->paid_at->format('d/m/Y à H:i') }}

@endif
{{-- Parties --}}

{{ $invoice->type === 'client' ? 'Vendeur' : 'Émetteur' }}

{{ $invoice->seller_name }}

@if($invoice->seller_address)

{{ $invoice->seller_address }}

@endif @if($invoice->seller_siret)

SIRET: {{ $invoice->seller_siret }}

@endif @if($invoice->seller_vat_number)

N° TVA: {{ $invoice->seller_vat_number }}

@endif

{{ $invoice->type === 'client' ? 'Client' : 'Bénéficiaire' }}

{{ $invoice->billing_name }}

{{ $invoice->billing_email }}

@if($invoice->billing_phone)

{{ $invoice->billing_phone }}

@endif @if($invoice->billing_address)

{{ $invoice->billing_address }}

@if($invoice->billing_postal_code || $invoice->billing_city)

{{ $invoice->billing_postal_code }} {{ $invoice->billing_city }}

@endif @endif @if($invoice->billing_siret)

SIRET: {{ $invoice->billing_siret }}

@endif
{{-- Prestataire info (admin only) --}} @if($invoice->prestataire)

Prestataire associé

{{ strtoupper(substr(data_get($invoice, 'prestataire.user.name', 'P'), 0, 1)) }}

{{ data_get($invoice, 'prestataire.user.name', 'N/A') }}

{{ data_get($invoice, 'prestataire.user.email', '') }}

Commission

{{ number_format($invoice->commission_amount, 2) }}€ ({{ $invoice->commission_rate }}%)

Net versé

{{ number_format($invoice->net_amount, 2) }}€

@endif {{-- Description --}} @if($invoice->description)

Description

{{ $invoice->description }}

@endif {{-- Lignes --}}
@if($invoice->line_items && is_array($invoice->line_items)) @foreach($invoice->line_items as $item) @endforeach @else @endif
Description Qté Prix unit. Total

{{ $item['description'] ?? 'Article' }}

@if(isset($item['details']))

{{ $item['details'] }}

@endif @if(isset($item['reference']))

Réf: {{ $item['reference'] }}

@endif
{{ $item['quantity'] ?? 1 }}{{ isset($item['unit']) ? ' ' . $item['unit'] : '' }} {{ isset($item['unit_price']) ? number_format($item['unit_price'], 2, ',', ' ') . ' €' : '-' }} {{ number_format($item['total'] ?? 0, 2, ',', ' ') }} €

{{ $invoice->description }}

{{ number_format($invoice->subtotal, 2, ',', ' ') }} €
{{-- Totaux avec détail complet --}} @php $notes = is_string($invoice->notes) ? json_decode($invoice->notes, true) : $invoice->notes; $stripeFee = $notes['stripe_fee'] ?? 0; $totalDeductions = $notes['total_deductions'] ?? ($invoice->commission_amount + $stripeFee); @endphp

Détail financier complet

{{-- Montant brut --}}
💰 Prix de vente {{ number_format($invoice->subtotal, 2, ',', ' ') }} €
@if($invoice->tax_amount > 0)
TVA ({{ number_format($invoice->tax_rate, 1) }}%) {{ number_format($invoice->tax_amount, 2, ',', ' ') }} €
@endif
{{-- Commission plateforme --}}
🏢 Commission TaPrestation ({{ $invoice->commission_rate }}%) -{{ number_format($invoice->commission_amount, 2, ',', ' ') }} €
{{-- Frais Stripe --}} @if($stripeFee > 0)
💳 Frais Stripe (1.4% + 0.25€) -{{ number_format($stripeFee, 2, ',', ' ') }} €
@endif
{{-- Total déductions --}} @if($totalDeductions > 0)
Total déductions -{{ number_format($totalDeductions, 2, ',', ' ') }} €
@endif
{{-- Net versé au prestataire --}}
✅ Net versé au prestataire {{ number_format($invoice->net_amount, 2, ',', ' ') }} €
{{-- Paiement --}} @if($invoice->payment_method || $invoice->payment_reference)

Informations de paiement

@if($invoice->payment_method)
Méthode: {{ ucfirst($invoice->payment_method) }}
@endif @if($invoice->payment_reference)
Référence: {{ $invoice->payment_reference }}
@endif
@endif {{-- Notes --}} @if($invoice->notes)

Notes

{{ $invoice->notes }}

@endif
{{-- Factures liées --}} @if($relatedInvoices->count() > 0)

📎 Factures liées

@endif
@endsection