@extends('admin.layouts.admin') @section('title', __('Affilix::affiliation.admin.edit_affiliate') . ' #' . $affiliate->id) @section('content')
{{-- Header --}}
{{ strtoupper(substr($affiliate->customer->firstname ?? $affiliate->customer->name ?? '?', 0, 1)) }}

{{ $affiliate->customer->firstname ?? '' }} {{ $affiliate->customer->lastname ?? ($affiliate->customer->name ?? '—') }}

{{ $affiliate->customer->email ?? '' }} · {{ __('Affilié') }} #{{ $affiliate->id }}

@if($affiliate->status === 'active') {{ __('Affilix::affiliation.active') }} @elseif($affiliate->status === 'inactive') {{ __('Affilix::affiliation.inactive') }} @else {{ __('Affilix::affiliation.suspended') }} @endif
@if($errors->any())
@endif
{{-- Sidebar --}}
{{-- Stats --}}

{{ __('Statistiques') }}

{{ __('Code') }} {{ $affiliate->referral_code }}
{{ __('Clics uniques') }} {{ number_format($affiliate->unique_clicks) }}
{{ __('Parrainages') }}
{{ $affiliate->total_referrals }} @if($affiliate->successful_referrals > 0) {{ $affiliate->successful_referrals }} {{ __('conv.') }} @endif
{{ __('Gains') }}
{{ number_format($affiliate->total_earnings, 2) }} {{ setting('currency_symbol', '€') }} {{ number_format($affiliate->pending_earnings, 2) }} · {{ number_format($affiliate->paid_earnings, 2) }}
{{ __('Membre depuis') }} {{ $affiliate->created_at->format('d/m/Y') }}
{{-- Accès rapides --}}
{{-- Formulaire --}}

{{ __('Modifier') }}

@csrf @method('PUT') @php $wasSubmitted = request()->old() ? true : false; @endphp
{{-- Commission type + taux --}}

{{ __('Commission') }} *

{{ __('Pourcentage sur la vente ou montant fixe par commande.') }}

@php $commType = old('commission_type', $affiliate->commission_type ?? 'percent'); @endphp
{{ $commType === 'fixed' ? setting('currency_symbol', '€') : '%' }}
{{-- Commission premier achat --}} @php $foOverride = $wasSubmitted ? (old('fo_override') === '1') : ($affiliate->first_order_commission_rate !== null); $foType2 = old('first_order_commission_type', $affiliate->first_order_commission_type ?? 'percent'); $foRate2 = old('first_order_commission_rate', $affiliate->first_order_commission_rate ?? '0'); @endphp

{{ __('Commission — Premier achat') }}

{{ __('Taux spécifique au premier achat du filleul.') }}

{{ $foType2 === 'fixed' ? setting('currency_symbol', '€') : '%' }}
{{-- Rémunération au clic --}} @php $hasOverride = $wasSubmitted ? (old('click_override') === '1') : ($affiliate->click_remuneration_enabled !== null); $clickEnabled = $wasSubmitted ? (old('click_remuneration_enabled') === '1') : ($affiliate->click_remuneration_enabled === true); $clickRate = old('click_remuneration_rate', $affiliate->click_remuneration_rate ?? \App\Addons\Affiliation\Models\AffiliationSetting::get('click_remuneration_rate', '0.00')); $globalEnabled = \App\Addons\Affiliation\Models\AffiliationSetting::get('click_remuneration_enabled', '0') === '1'; $globalRate = \App\Addons\Affiliation\Models\AffiliationSetting::get('click_remuneration_rate', '0.00'); @endphp

{{ __('Rémunération au clic') }}

{{ __('Personnaliser la rémunération par clic unique pour cet affilié.') }}

{{ __('Global :') }} @if($globalEnabled) {{ __('Activé') }} · {{ $globalRate }} {{ setting('currency_symbol', '€') }}/clic @else {{ __('Désactivé') }} @endif

{{-- Activé/désactivé --}}
{{ __('Activé pour cet affilié') }}

{{ __('Écrase le paramètre global.') }}

{{-- Montant --}}
{{ __('Montant par clic unique') }}

{{ __('Laisser vide ou 0 pour utiliser le montant global.') }}

{{ setting('currency_symbol', '€') }}
{{-- Statut --}}

{{ __('Affilix::affiliation.status') }} *

{{ __('Passer à "Actif" enregistre automatiquement la date d\'approbation.') }}

@php $currentStatus = old('status', $affiliate->status); $cardBase = 'status-card flex flex-col items-center gap-1.5 p-4 rounded-xl border-2 transition-all cursor-pointer'; $cardOff = 'border-gray-200 dark:border-gray-600 text-gray-400 dark:text-gray-500 hover:border-gray-300 dark:hover:border-gray-500'; $cardOn = [ 'active' => 'border-green-500 bg-green-50 text-green-600 dark:bg-green-900/20 dark:text-green-400', 'inactive' => 'border-yellow-500 bg-yellow-50 text-yellow-600 dark:bg-yellow-900/20 dark:text-yellow-400', 'suspended' => 'border-red-500 bg-red-50 text-red-600 dark:bg-red-900/20 dark:text-red-400', ]; $cardIcon = [ 'active' => 'bi-check-circle-fill', 'inactive' => 'bi-pause-circle-fill', 'suspended' => 'bi-x-circle-fill', ]; $cardLabel = [ 'active' => __('Affilix::affiliation.active'), 'inactive' => __('Affilix::affiliation.inactive'), 'suspended' => __('Affilix::affiliation.suspended'), ]; $cardDesc = [ 'active' => __('Peut parrainer et générer des commissions'), 'inactive' => __('Inscrit mais pas encore validé'), 'suspended' => __('Accès suspendu, aucune commission'), ]; @endphp
@foreach(['active', 'inactive', 'suspended'] as $st) @endforeach
{{-- Notes internes --}}

{{ __('Notes internes') }}

{{ __('Visible uniquement par les administrateurs.') }}

{{ __('Annuler') }}
@endsection