@props([ 'payment' => null, 'clients' => [], 'appointments' => [], 'taxes' => [], 'prefilledAmount' => null, 'prefilledClientId' => null, 'prefilledAppointmentId' => null, 'isReadonly' => false ]) @php $isEdit = !is_null($payment); $action = $isEdit ? route('provider.payments.update', $payment->uuid) : route('provider.payments.store'); $method = $isEdit ? 'PUT' : 'POST'; $title = $isEdit ? 'Modifier la facture' : 'Informations de paiement'; $submitText = $isEdit ? 'Mettre à jour la facture' : 'Créer la facture'; @endphp

{{ $title }}

@if($isEdit) @endif
@if($isReadonly)

⚠️ Facture finalisée : seule la note est modifiable.

@endif
@csrf @if($isEdit) @method('PUT') @endif
@error('payment_date')

{{ $message }}

@enderror
@error('due_date')

{{ $message }}

@enderror
@if($clients->isEmpty())

Aucun client n'a de rendez-vous terminés non facturés.

@else @endif @error('client_id')

{{ $message }}

@enderror
@php $invoiceClientId = old('client_id', $isEdit ? $payment->client_id : ($prefilledClientId ?? null)); $invoiceAppointments = old('appointment_ids', $isEdit ? $payment->appointments->pluck('id')->toArray() : ($prefilledAppointmentId ? [$prefilledAppointmentId] : [])); @endphp @livewire('provider.invoice.invoice-lines', ['clientId' => $invoiceClientId, 'selectedAppointments' => $invoiceAppointments, 'invoice' => $isEdit ? $payment : null], key('invoice-lines'))
Annuler {{ $submitText }}