@extends('layouts.prestataire') @section('title', 'Dashboard Paiements') @section('content')
{{-- En-tĂŞte --}}

đź’° Dashboard Paiements

Gérez tous vos revenus en un seul endroit

{{-- Connexion Stripe --}} @if($stripeConnected) Stripe Connecté @else Connecter Stripe @endif {{-- Export CSV --}} Exporter CSV
{{-- Navigation Finances (dans la page, pas dans la tuile dashboard) --}} {{-- Cartes statistiques --}}
{{-- Solde Stripe --}} @if($stats['available_balance'])
Solde Stripe

{{ number_format($stats['available_balance']['available'], 2) }} €

+ {{ number_format($stats['available_balance']['pending'], 2) }} € en transit

@endif {{-- Total gagné --}}
Total gagné

{{ number_format($stats['total_earned'], 2) }} €

Net après commission

{{-- Ce mois --}}
Ce mois

{{ number_format($stats['this_month'], 2) }} €

@if($stats['evolution'] != 0)

{{ $stats['evolution'] > 0 ? '↑' : '↓' }} {{ abs($stats['evolution']) }}% vs mois dernier

@endif
{{-- En attente --}}
En attente

{{ number_format($stats['pending_amount'], 2) }} €

Paiements en cours

{{-- Aujourd'hui --}}
Aujourd'hui

{{ number_format($stats['today'], 2) }} €

Reçu aujourd'hui

{{-- Transactions --}}
Transactions

{{ $stats['completed_transactions'] }}

Sur {{ $stats['total_transactions'] }} totales

{{-- Répartition par type --}}

Services

{{ number_format($stats['by_type']['booking'], 2) }} €

Équipements

{{ number_format($stats['by_type']['equipment'], 2) }} €

Ventes Flash

{{ number_format($stats['by_type']['urgent_sale'], 2) }} €

Food

{{ number_format($stats['by_type']['food'], 2) }} €

{{-- Filtres --}}
{{-- Type --}}
{{-- Statut --}}
{{-- Période --}}
{{-- Dates personnalisées --}}
{{-- Boutons --}}
{{-- Liste des transactions --}}

Transactions ({{ $payments->total() }} résultats)

@if($payments->count() > 0)
@foreach($payments as $payment) {{-- Type --}} {{-- Référence --}} {{-- Client --}} {{-- Description --}} {{-- Montant avec détail déductions --}} {{-- Statut --}} {{-- Date --}} {{-- Actions --}} @endforeach
Type Référence Client Description Montant Statut Date Actions
@php $typeConfig = [ 'booking' => ['icon' => '📅', 'bg' => 'bg-blue-100', 'text' => 'text-blue-800'], 'equipment' => ['icon' => '🔧', 'bg' => 'bg-purple-100', 'text' => 'text-purple-800'], 'urgent_sale' => ['icon' => '🔥', 'bg' => 'bg-orange-100', 'text' => 'text-orange-800'], 'food' => ['icon' => '🍽️', 'bg' => 'bg-green-100', 'text' => 'text-green-800'], ]; $config = $typeConfig[$payment['type']] ?? ['icon' => '💰', 'bg' => 'bg-gray-100', 'text' => 'text-gray-800']; @endphp {{ $config['icon'] }} {{ $payment['type_label'] }} {{ $payment['reference'] }}
{{ $payment['client_name'] }}
{{ $payment['client_email'] }}
{{ $payment['title'] }}
@if($payment['payment_type'] === 'deposit') ⚡ Acompte @elseif($payment['payment_type'] === 'balance') ✓ Solde @endif @if(($payment['type'] ?? '') === 'equipment' && !empty($payment['rental'])) @php $rentalRow = $payment['rental']; $escrowRow = is_object($payment['escrow'] ?? null) ? (array) $payment['escrow'] : []; $escrowMeta = []; try { $escrowMeta = !empty($escrowRow['metadata'] ?? null) ? (json_decode((string) $escrowRow['metadata'], true) ?: []) : []; } catch (\Throwable $e) { $escrowMeta = []; } $depositAmount = (float) ($rentalRow->equipment->security_deposit ?? $rentalRow->security_deposit ?? ($escrowRow['deposit_amount'] ?? 0)); $depositStatus = strtolower((string) (($rentalRow->deposit_status ?? null) ?: ($escrowMeta['deposit_status'] ?? 'pending'))); @endphp @if($depositAmount > 0)
Caution: {{ $depositStatus === 'returned' ? 'remboursée' : ($depositStatus === 'partial' ? 'partielle' : ($depositStatus === 'retained' ? 'retenue' : 'en attente')) }}
@endif @endif
@php $stripeFeePercent = (float) get_setting('stripe_fee_percent', '1.4'); $stripeFeeFixed = (float) get_setting('stripe_fee_fixed', '0.25'); $securityDeposit = (float) ($payment['security_deposit'] ?? 0); $grossAmount = (float) ($payment['gross_amount'] ?? $payment['amount']); @endphp
+{{ number_format($payment['net_amount'], 2) }} €
@if(($payment['type'] ?? '') === 'equipment' && $securityDeposit > 0) Location: {{ number_format($payment['amount'], 2) }}€
Caution: {{ number_format($securityDeposit, 2) }}€
Débité: {{ number_format($grossAmount, 2) }}€
@else Brut: {{ number_format($payment['amount'], 2) }}€
@endif @if(($payment['platform_commission'] ?? 0) >= 0) -{{ number_format($payment['platform_commission'], 2) }}€
@else +{{ number_format(abs($payment['platform_commission']), 2) }}€ absorbé
@endif -{{ number_format($payment['stripe_fee'] ?? 0, 2) }}€ Stripe
@php $statusConfig = [ 'completed' => ['label' => 'Complété', 'bg' => 'bg-green-100', 'text' => 'text-green-800'], 'pending' => ['label' => 'En attente', 'bg' => 'bg-yellow-100', 'text' => 'text-yellow-800'], 'processing' => ['label' => 'En cours', 'bg' => 'bg-blue-100', 'text' => 'text-blue-800'], 'refunded' => ['label' => 'Remboursé', 'bg' => 'bg-red-100', 'text' => 'text-red-800'], 'cancelled' => ['label' => 'Annulé', 'bg' => 'bg-gray-100', 'text' => 'text-gray-800'], ]; $sConfig = $statusConfig[$payment['status']] ?? ['label' => ucfirst($payment['status']), 'bg' => 'bg-gray-100', 'text' => 'text-gray-800']; @endphp {{ $sConfig['label'] }}
{{ \Carbon\Carbon::parse($payment['date'])->format('d/m/Y') }}
{{ \Carbon\Carbon::parse($payment['date'])->format('H:i') }}
@php // Pour Stripe, garder l'ID complet (py_xxx), sinon extraire le numérique if ($payment['type'] === 'stripe') { $itemId = $payment['id']; } else { $parts = explode('_', $payment['id']); $itemId = end($parts); } @endphp Détails →
{{-- Pagination --}}
{{ $payments->links() }}
@else

Aucune transaction

Aucune transaction ne correspond à vos critères de recherche.

@endif
{{-- Info commission --}} @php $stripeFeePercentInfo = (float) get_setting('stripe_fee_percent', '1.4'); $stripeFeeFixedInfo = (float) get_setting('stripe_fee_fixed', '0.25'); @endphp

Détail des déductions

Sur chaque transaction, les déductions suivantes sont appliquées :

  • 🏢 Commission TaPrestation : variable selon le type de service
  • đź’ł Frais Stripe : {{ number_format($stripeFeeFixedInfo, 2, ',', ' ') }}€ + {{ rtrim(rtrim(number_format($stripeFeePercentInfo, 2, '.', ''), '0'), '.') }}% par transaction
  • đź’¬ Pour les petits montants, TaPrestation peut absorber une partie des frais Stripe

Total des déductions prélevées : {{ number_format($stats['total_commission'], 2) }} €

@endsection