@if(auth()->user()->isMieter()) {{-- Mieter-Dashboard --}}

Willkommen, {{ auth()->user()->name }}!

Hier siehst du deine persönliche Übersicht.

@php $myTenant = \App\Models\Tenant::where('email', auth()->user()->email)->first(); @endphp @if($myTenant)
@if($myTenant->unit)
Deine Einheit: {{ $myTenant->unit->property->name }} - {{ $myTenant->unit->name }}
@endif @php $myContracts = \App\Models\Contract::where('tenant_id', $myTenant->id)->with('unit.property')->get(); @endphp @if($myContracts->isNotEmpty())
Deine Verträge: @foreach($myContracts as $c)
{{ $c->unit->property->name }}: {{ number_format($c->rent_amount, 2) }} € ({{ $c->status }})
@endforeach
@endif @php $myPayments = \App\Models\Payment::whereHas('contract', fn($q) => $q->where('tenant_id', $myTenant->id))->latest()->take(5)->get(); @endphp @if($myPayments->isNotEmpty())
Letzte Zahlungen: @foreach($myPayments as $p)
{{ $p->due_date->format('d.m.Y') }}: {{ number_format($p->amount, 2) }} € ({{ $p->status }})
@endforeach
@endif
@else

Keine Mieterdaten gefunden. Bitte kontaktiere deinen Vermieter.

@endif
@else

{{ __('Dashboard') }}

{{-- Statistik-Boxen --}}
@php $propertyCount = \App\Models\Property::where('user_id', auth()->id())->count(); $unitCount = \App\Models\Unit::whereHas('property', fn($q) => $q->where('user_id', auth()->id()))->count(); $tenantCount = \App\Models\Tenant::where('user_id', auth()->id())->count(); $totalRent = \App\Models\Contract::whereHas('tenant', fn($q) => $q->where('user_id', auth()->id()))->where('status', 'aktiv')->sum('rent_amount'); $offeneSumme = \App\Models\Payment::where('user_id', auth()->id())->whereIn('status', ['offen', 'überfällig'])->sum('amount'); @endphp

Immobilien

{{ $propertyCount }}

Einheiten

{{ $unitCount }}

Mieter

{{ $tenantCount }}

Offene Zahlungen

{{ number_format($offeneSumme, 0, ',', '.') }} €

{{-- Immobilien-Tabelle --}}

Deine Immobilien

@php $properties = \App\Models\Property::where('user_id', auth()->id())->latest()->get(); @endphp @if($properties->isEmpty())

Noch keine Immobilien.

@else
@foreach($properties as $property) @endforeach
Name Typ Adresse Einheiten Baujahr
{{ $property->name }} {{ ucfirst($property->type) }} {{ $property->street }} {{ $property->house_number }}, {{ $property->postal_code }} {{ $property->city }} {{ $property->units->count() }} {{ $property->construction_year ?? '-' }}
@endif
{{-- Charts Reihe 1 --}}

Einheiten-Status

Immobilien-Typen

{{-- Charts Reihe 2 --}}

Zahlungsübersicht

Mieteinnahmen (6 Monate)

@endif