@if ($total === 0)

{{ __('windows.empty') }}

@else {{-- summary --}}

{{ $open > 0 ? trans_choice('windows.open_count', $open, ['count' => $open]) : __('windows.all_closed') }}

{{ trans_choice('windows.sensor_count', $total, ['count' => $total]) }}

@foreach ($groups as $roomName => $sensors)

{{ $roomName }}

{{ $sensors->count() }}
@foreach ($sensors as $sensor) @php $battery = $sensor->device->entities->firstWhere('type', 'battery'); $pct = $battery ? (int) data_get($battery->state, 'state.percent', 0) : null; $pos = data_get($sensor->state, 'state.position') ?? (data_get($sensor->state, 'state.open') === true ? 'open' : 'closed'); $isMotion = $sensor->type === 'motion'; $alert = $isMotion ? (data_get($sensor->state, 'state.on') === true || data_get($sensor->state, 'state.active') === true) : $pos !== 'closed'; @endphp $alert, 'border-line-soft bg-surface hover:border-line' => ! $alert, ])>
$alert, 'bg-inset text-ink-2' => ! $alert])>
{{ $sensor->device->name }}
{{ $sensor->name ?: $sensor->key }}
@if ($isMotion) $alert, 'text-ink-3' => ! $alert])>{{ $alert ? __('devices.motion') : __('devices.no_motion') }} @else $alert, 'text-online' => ! $alert])>{{ __('devices.contact_'.$pos) }} @endif @if (! is_null($pct)) {{ $pct }}% @endif
@endforeach
@endforeach @endif