Rechnungs-Seite: Archiv-Filter entfernt, Altsystem-Archiv nur für Bestandskunden
QA-Befund 07.07.: Die Filter-/Suchzeile unter den aktuellen Rechnungen entfällt; das Rechnungsarchiv (Altsystem) erscheint nur noch, wenn der User dort tatsächlich importierte Rechnungen hat — Neukunden sehen es nicht mehr. Seitenbeschreibung passt sich entsprechend an. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
80e04e26e0
commit
c4ccc751e9
2 changed files with 38 additions and 65 deletions
|
|
@ -12,22 +12,8 @@ new #[Layout('components.layouts.app'), Title('Rechnungen')] class extends Compo
|
||||||
{
|
{
|
||||||
use WithPagination;
|
use WithPagination;
|
||||||
|
|
||||||
public string $search = '';
|
|
||||||
|
|
||||||
public string $statusFilter = 'all';
|
|
||||||
|
|
||||||
public ?string $notification = null;
|
public ?string $notification = null;
|
||||||
|
|
||||||
public function updatedSearch(): void
|
|
||||||
{
|
|
||||||
$this->resetPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function updatedStatusFilter(): void
|
|
||||||
{
|
|
||||||
$this->resetPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function with(): array
|
public function with(): array
|
||||||
{
|
{
|
||||||
$baseQuery = LegacyInvoice::query()
|
$baseQuery = LegacyInvoice::query()
|
||||||
|
|
@ -36,11 +22,9 @@ new #[Layout('components.layouts.app'), Title('Rechnungen')] class extends Compo
|
||||||
// Neue Rechnungen (STR = Stripe-Spiegelung, MAN = Bestandskreis).
|
// Neue Rechnungen (STR = Stripe-Spiegelung, MAN = Bestandskreis).
|
||||||
$currentQuery = Invoice::query()->where('user_id', auth()->id());
|
$currentQuery = Invoice::query()->where('user_id', auth()->id());
|
||||||
|
|
||||||
|
// Das Altsystem-Archiv erscheint nur, wenn der User dort überhaupt
|
||||||
|
// Rechnungen hat (QA-Befund 07.07.) — Neukunden sehen es nie.
|
||||||
$invoices = (clone $baseQuery)
|
$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')
|
->latest('invoice_date')
|
||||||
->paginate(100);
|
->paginate(100);
|
||||||
|
|
||||||
|
|
@ -51,13 +35,6 @@ new #[Layout('components.layouts.app'), Title('Rechnungen')] class extends Compo
|
||||||
->limit(100)
|
->limit(100)
|
||||||
->get(),
|
->get(),
|
||||||
'invoices' => $invoices,
|
'invoices' => $invoices,
|
||||||
'statusOptions' => (clone $baseQuery)
|
|
||||||
->whereNotNull('status')
|
|
||||||
->distinct()
|
|
||||||
->orderBy('status')
|
|
||||||
->pluck('status')
|
|
||||||
->filter()
|
|
||||||
->values(),
|
|
||||||
'stats' => [
|
'stats' => [
|
||||||
'count' => (clone $baseQuery)->count() + (clone $currentQuery)->count(),
|
'count' => (clone $baseQuery)->count() + (clone $currentQuery)->count(),
|
||||||
'total_cents' => (int) (clone $baseQuery)->sum('total_cents') + (int) (clone $currentQuery)->sum('total_cents'),
|
'total_cents' => (int) (clone $baseQuery)->sum('total_cents') + (int) (clone $currentQuery)->sum('total_cents'),
|
||||||
|
|
@ -82,7 +59,9 @@ new #[Layout('components.layouts.app'), Title('Rechnungen')] class extends Compo
|
||||||
{{ __('Rechnungen') }}
|
{{ __('Rechnungen') }}
|
||||||
</h1>
|
</h1>
|
||||||
<p class="text-[13px] leading-[1.55] mt-2 m-0 max-w-[640px] text-[color:var(--color-ink-2)]">
|
<p class="text-[13px] leading-[1.55] mt-2 m-0 max-w-[640px] text-[color:var(--color-ink-2)]">
|
||||||
{{ __('Aktuelle Rechnungen Ihrer Buchungen sowie das Archiv aus dem Altsystem.') }}
|
{{ $invoices->total() > 0
|
||||||
|
? __('Aktuelle Rechnungen Ihrer Buchungen sowie das Archiv aus dem Altsystem.')
|
||||||
|
: __('Aktuelle Rechnungen Ihrer Buchungen.') }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -208,23 +187,9 @@ new #[Layout('components.layouts.app'), Title('Rechnungen')] class extends Compo
|
||||||
</flux:table>
|
</flux:table>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
{{-- ============== FILTER-PANEL ============== --}}
|
{{-- ============== RECHNUNGSARCHIV (ALTSYSTEM) ==============
|
||||||
<article class="panel">
|
Nur für Bestandskunden mit importierten Alt-Rechnungen. --}}
|
||||||
<div class="panel-head">
|
@if ($invoices->total() > 0)
|
||||||
<span class="section-eyebrow">{{ __('Filter & Suche (Archiv)') }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="p-5 flex flex-col gap-3 sm:flex-row">
|
|
||||||
<flux:input wire:model.live.debounce.300ms="search" placeholder="{{ __('Rechnungsnummer suchen…') }}" icon="magnifying-glass" class="flex-1" />
|
|
||||||
<flux:select wire:model.live="statusFilter" class="sm:w-48">
|
|
||||||
<option value="all">{{ __('Alle Status') }}</option>
|
|
||||||
@foreach ($statusOptions as $status)
|
|
||||||
<option value="{{ $status }}">{{ $status }}</option>
|
|
||||||
@endforeach
|
|
||||||
</flux:select>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
{{-- ============== TABELLE ============== --}}
|
|
||||||
<article class="panel overflow-hidden">
|
<article class="panel overflow-hidden">
|
||||||
<div class="panel-head">
|
<div class="panel-head">
|
||||||
<span class="section-eyebrow">{{ __('Rechnungsarchiv (Altsystem)') }}</span>
|
<span class="section-eyebrow">{{ __('Rechnungsarchiv (Altsystem)') }}</span>
|
||||||
|
|
@ -243,7 +208,7 @@ new #[Layout('components.layouts.app'), Title('Rechnungen')] class extends Compo
|
||||||
<flux:table.column>{{ __('PDF') }}</flux:table.column>
|
<flux:table.column>{{ __('PDF') }}</flux:table.column>
|
||||||
</flux:table.columns>
|
</flux:table.columns>
|
||||||
|
|
||||||
@forelse ($invoices as $invoice)
|
@foreach ($invoices as $invoice)
|
||||||
<flux:table.row wire:key="legacy-invoice-{{ $invoice->id }}">
|
<flux:table.row wire:key="legacy-invoice-{{ $invoice->id }}">
|
||||||
<flux:table.cell>
|
<flux:table.cell>
|
||||||
<span class="text-[13px] font-semibold text-[color:var(--color-ink)]">
|
<span class="text-[13px] font-semibold text-[color:var(--color-ink)]">
|
||||||
|
|
@ -287,28 +252,9 @@ new #[Layout('components.layouts.app'), Title('Rechnungen')] class extends Compo
|
||||||
</flux:button>
|
</flux:button>
|
||||||
</flux:table.cell>
|
</flux:table.cell>
|
||||||
</flux:table.row>
|
</flux:table.row>
|
||||||
@empty
|
@endforeach
|
||||||
<flux:table.row>
|
|
||||||
<flux:table.cell colspan="7">
|
|
||||||
<div class="flex flex-col items-center justify-center px-4 py-10 text-center">
|
|
||||||
<div class="w-14 h-14 rounded-[6px] flex items-center justify-center mb-3
|
|
||||||
bg-[color:var(--color-hub-soft)] border border-[color:var(--color-hub-soft-2)] text-[color:var(--color-hub)]">
|
|
||||||
<flux:icon.document-text class="size-6" />
|
|
||||||
</div>
|
|
||||||
<div class="text-[14px] font-semibold text-[color:var(--color-ink)] mb-1">
|
|
||||||
{{ __('Keine Rechnungen gefunden') }}
|
|
||||||
</div>
|
|
||||||
<p class="text-[12px] text-[color:var(--color-ink-3)] max-w-md m-0">
|
|
||||||
{{ __('Sobald Rechnungen aus dem Archiv oder aus neuen Buchungen vorhanden sind, erscheinen sie hier.') }}
|
|
||||||
</p>
|
|
||||||
<flux:button class="mt-4" size="sm" variant="filled" icon="user" href="{{ route('me.profile') }}#rechnungsadresse" wire:navigate>
|
|
||||||
{{ __('Rechnungsadresse prüfen') }}
|
|
||||||
</flux:button>
|
|
||||||
</div>
|
|
||||||
</flux:table.cell>
|
|
||||||
</flux:table.row>
|
|
||||||
@endforelse
|
|
||||||
</flux:table>
|
</flux:table>
|
||||||
<x-portal.table-pagination :paginator="$invoices" />
|
<x-portal.table-pagination :paginator="$invoices" />
|
||||||
</article>
|
</article>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,33 @@ test('customer sees only own legacy invoices', function () {
|
||||||
->assertSee('99,00 €');
|
->assertSee('99,00 €');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('the legacy invoice archive is hidden for customers without archived invoices', function () {
|
||||||
|
/** @var TestCase $this */
|
||||||
|
$customer = User::factory()->create(['is_active' => true]);
|
||||||
|
|
||||||
|
// Archiv eines anderen Users darf die Anzeige nicht auslösen.
|
||||||
|
LegacyInvoice::query()->create([
|
||||||
|
'legacy_portal' => 'presseecho',
|
||||||
|
'legacy_id' => 1003,
|
||||||
|
'user_id' => User::factory()->create(['is_active' => true])->id,
|
||||||
|
'legacy_user_id' => 503,
|
||||||
|
'number' => 'RE-FREMD-001',
|
||||||
|
'amount_cents' => 9900,
|
||||||
|
'total_cents' => 9900,
|
||||||
|
'status' => 'paid',
|
||||||
|
'invoice_date' => now()->subMonth(),
|
||||||
|
'paid_at' => now()->subMonth(),
|
||||||
|
'imported_at' => now(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->actingAs($customer);
|
||||||
|
|
||||||
|
LivewireVolt::test('customer.invoices')
|
||||||
|
->assertSee('Aktuelle Rechnungen')
|
||||||
|
->assertDontSee('Rechnungsarchiv (Altsystem)')
|
||||||
|
->assertDontSee('Filter & Suche');
|
||||||
|
});
|
||||||
|
|
||||||
test('current STR and MAN invoices are listed with a stripe link where available', function () {
|
test('current STR and MAN invoices are listed with a stripe link where available', function () {
|
||||||
/** @var TestCase $this */
|
/** @var TestCase $this */
|
||||||
$customer = User::factory()->create(['is_active' => true]);
|
$customer = User::factory()->create(['is_active' => true]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue