resetPage();
}
public function updatedStatusFilter(): void
{
$this->resetPage();
}
public function with(): array
{
$baseQuery = LegacyInvoice::query()
->where('user_id', auth()->id());
$invoices = (clone $baseQuery)
->when(filled($this->search), function ($query): void {
$query->where('number', 'like', '%'.$this->search.'%');
})
->when($this->statusFilter !== 'all', fn ($query) => $query->where('status', $this->statusFilter))
->latest('invoice_date')
->paginate(100);
return [
'invoices' => $invoices,
'statusOptions' => (clone $baseQuery)
->whereNotNull('status')
->distinct()
->orderBy('status')
->pluck('status')
->filter()
->values(),
'stats' => [
'count' => (clone $baseQuery)->count(),
'total_cents' => (int) (clone $baseQuery)->sum('total_cents'),
'paid_count' => (clone $baseQuery)->whereNotNull('paid_at')->count(),
'downloadable_count' => (clone $baseQuery)->count(),
],
];
}
}; ?>
{{ __('Rechnungen') }}
{{ __('Ihr Rechnungsarchiv im User Backend. PDFs werden bei Bedarf aus den Archivdaten erzeugt.') }}
{{ __('Archivdaten') }}
{{ __('Hinweis zu Rechnungen') }}
{{ __('Aktuell sehen Sie hier die aus dem Legacy-System übernommenen Rechnungen. Neue Abrechnungen werden später in dieselbe Finanznavigation integriert.') }}
{{ __('Rechnungsadresse im Profil pflegen') }}
@if($notification)
{{ $notification }}
@endif
{{ __('Rechnungen') }}
{{ $stats['count'] }}
{{ __('Archivsumme') }}
{{ number_format($stats['total_cents'] / 100, 2, ',', '.') }} €
{{ __('Bezahlt') }}
{{ $stats['paid_count'] }}
{{ __('PDF-Download') }}
{{ $stats['downloadable_count'] }}
{{ __('Alle Status') }}
@foreach($statusOptions as $status)
{{ $status }}
@endforeach
{{ __('Rechnungsnr.') }}
{{ __('Portal') }}
{{ __('Betrag') }}
{{ __('Status') }}
{{ __('Rechnungsdatum') }}
{{ __('Bezahlt am') }}
{{ __('PDF') }}
@forelse($invoices as $invoice)
{{ $invoice->number ?? ('#'.$invoice->legacy_id) }}
{{ $invoice->legacy_portal?->label() }}
{{ number_format($invoice->total_cents / 100, 2, ',', '.') }} €
{{ $invoice->status ?? ($invoice->paid_at ? __('Bezahlt') : __('Offen')) }}
{{ $invoice->invoice_date?->format('d.m.Y') ?? '–' }}
{{ $invoice->paid_at?->format('d.m.Y') ?? '–' }}
{{ __('Öffnen') }}
@empty
{{ __('Keine Rechnungen gefunden') }}
{{ __('Sobald Rechnungen aus dem Archiv oder aus neuen Buchungen vorhanden sind, erscheinen sie hier.') }}
{{ __('Rechnungsadresse prüfen') }}
@endforelse
{{ $invoices->links() }}