{{-- Hausmeister-Dashboard --}} @php $hmUnits = \App\Models\Unit::where('hausmeister_id', auth()->id())->with('property')->get(); $hmPropertyIds = $hmUnits->pluck('property_id')->unique(); $hmTickets = \App\Models\Ticket::whereIn('unit_id', $hmUnits->pluck('id'))->latest()->take(10)->get(); $hmMaintenances = \App\Models\Maintenance::whereIn('property_id', $hmPropertyIds)->orWhereIn('unit_id', $hmUnits->pluck('id'))->orderBy('next_maintenance')->take(5)->get(); $hmKeys = \App\Models\Key::whereIn('unit_id', $hmUnits->pluck('id'))->get(); $hmMeters = \App\Models\Meter::whereIn('unit_id', $hmUnits->pluck('id'))->with('latestReading')->get(); @endphp
Du bist für {{ $hmUnits->count() }} Einheiten zuständig.
Einheiten
{{ $hmUnits->count() }}
Offene Tickets
{{ $hmTickets->whereIn('status', ['offen','in_bearbeitung'])->count() }}
Wartungen fällig
{{ $hmMaintenances->where('next_maintenance', '<=', now()->addMonth())->count() }}
Schlüssel
{{ $hmKeys->count() }}
Keine Tickets.
@else| Titel | Priorität | Status | Einheit |
|---|---|---|---|
| {{ $t->title }} | {{ $t->priority }} | {{ $t->status_label }} | {{ $t->unit?->name ?? '-' }} |
Keine Wartungen.
@else @foreach($hmMaintenances as $m){{ $m->title }}
📅 {{ $m->next_maintenance->format('d.m.Y') }} | {{ $m->property->name ?? '' }}
Keine Schlüssel.
@else @foreach($hmKeys as $k)| Zähler | Einheit | Letzter Stand | Datum |
|---|---|---|---|
| {{ $m->name ?? $m->type_label }} | {{ $m->unit->property->name }} - {{ $m->unit->name }} | {{ $m->latestReading ? number_format($m->latestReading->value, 2).' '.$m->unit_label : '-' }} | {{ $m->latestReading?->reading_date?->format('d.m.Y') ?? '-' }} |