{{-- Expects: $buildings (with floors), $buildingLevels [buildingId => level], $floorLevels [floorId => level] --}}

Access

View only lets the user see meters and readings. View & add readings also lets them record new readings. A building setting covers all its floors; a floor setting can raise access for just that floor.

@forelse ($buildings as $building)
{{ $building->name }}
@foreach ($building->floors as $floor) @php $f = old('floor.'.$floor->id, $floorLevels[$floor->id] ?? ''); @endphp
{{ $floor->name }}
@endforeach @if ($building->floors->isEmpty())

No floors yet.

@endif
@empty

No buildings yet. Add one first.

@endforelse