Calcul en cours...
@if(!$isReadOnly)
@if($clientId && $availableAppointments->count() > 0) @if(count($selectedAppointments) === $availableAppointments->count()) @else @endif @endif
@if($loading)
Chargement en cours...
@endif @if($clientId) @forelse($availableAppointments as $index => $apt) @empty

Aucun rendez-vous disponible

@endforelse @else

Sélectionnez un client pour voir ses rendez-vous

@endif
@endif @if(count($lines) > 0)
@foreach($lines as $line) @endforeach
Service
et durée
HT (TND) TVA (TND) TTC (TND)
{{ $line['service'] }} @php $appointment = $availableAppointments->firstWhere('id', $line['appointment_id'] ?? null); @endphp
{{ $line['date'] }}
@if($appointment) @php $duration = $appointment->start_time->diffInMinutes($appointment->end_time); $hours = floor($duration / 60); $minutes = $duration % 60; $durationText = $hours > 0 ? $hours . 'h' . ($minutes > 0 ? str_pad($minutes, 2, '0', STR_PAD_LEFT) : '') : $minutes . 'min'; @endphp
{{ $appointment->start_time->format('H:i') }} - {{ $appointment->end_time->format('H:i') }} ({{ $durationText }})
@endif
{{ number_format($line['ht'], 3) }} @if($line['vat_rate'] > 0) {{ number_format($line['vat'], 3) }}
{{ number_format($line['vat_rate'], 0) }}%
@else - @endif
{{ number_format($line['ttc'], 3) }}
Total {{ number_format($totalHT, 3) }} {{ number_format($totalVAT, 3) }} {{ number_format($totalTTC, 3) }}
@if(!$isReadOnly)
@php $taxesBeforeVat = $availableTaxes->where('is_before_vat', true)->where('is_withholding_tax', false); $taxesAfterVat = $availableTaxes->where('is_before_vat', false)->where('is_withholding_tax', false); $withholdingTaxes = $availableTaxes->where('is_withholding_tax', true); @endphp @if($taxesBeforeVat->count() > 0)
Calculé sur montant HT
@foreach($taxesBeforeVat as $tax) @endforeach @endif @if($taxesAfterVat->count() > 0)
Calculé sur total TTC
@foreach($taxesAfterVat as $tax) @endforeach @endif @if($withholdingTaxes->count() > 0)
Retenue à la source
@php $selectedWithholding = collect($otherTaxes)->first(fn($t) => $t['is_withholding'] ?? false); @endphp @if($selectedWithholding)
{{ $selectedWithholding['label'] }}: {{ $selectedWithholding['sign'] }}{{ number_format($selectedWithholding['amount'], 3) }} TND
@endif
@endif
@endif
Total HT {{ number_format($totalHT, 3) }} TND
@foreach($otherTaxes as $tax) @if($tax['is_before_vat'])
{{ $tax['label'] }} {{ $tax['sign'] }}{{ number_format($tax['amount'], 3) }} TND
@endif @endforeach
TVA {{ number_format($totalVAT, 3) }} TND
Total TTC {{ number_format($totalTTC, 3) }} TND
@foreach($otherTaxes as $tax) @if(!$tax['is_before_vat'] && $tax['is_withholding'])
{{ $tax['label'] }} {{ $tax['sign'] }}{{ number_format($tax['amount'], 3) }} TND
@endif @endforeach @foreach($otherTaxes as $tax) @if(!$tax['is_before_vat'] && !$tax['is_withholding'])
{{ $tax['label'] }} {{ $tax['sign'] }}{{ number_format($tax['amount'], 3) }} TND
@endif @endforeach
NET À PAYER {{ number_format($netToPay, 3) }} TND
@foreach($selectedTaxes as $taxId) @endforeach @endif