{{-- brafa Systems — Smart Lock overview. Livewire backing: App\Http\Livewire\Dashboard\Automotive. Bindings preserved: wire:click goToLockDetails/unlockLock, wire:submit.prevent saveAccessTokenToUser, wire:model username/password, $message/$error, $showLoginForm, $locks, $numberOfLocks, $isUnlocking, $refreshComponent, and the reloadPage / showToast / messageShown JS events. --}} @if (Auth::check() && Auth::user()->role_id == 1) @php $lockCollection = collect($locks); $onlineCount = $lockCollection->where('hasGateway', 1)->count(); $offlineCount = $lockCollection->count() - $onlineCount; $lowBattery = $lockCollection->filter(fn ($l) => (int) ($l['electricQuantity'] ?? 0) < 25)->count(); $brafaLockModel = fn ($lockName, $featureValue = null) => \App\Support\LockModel::for($lockName, $featureValue) ?? ['img' => null, 'label' => (string) $lockName ?: 'N/A']; @endphp
{{-- Hero --}}
Smart locks
{{ $numberOfLocks }}
total locks
Online {{ $onlineCount }}
Offline {{ $offlineCount }}
Low battery {{ $lowBattery }}
@if ($message)
{{ $message }}
@endif @if ($error)
{{ $error }}
@endif

Lock list

@if ($showLoginForm)
@else
@forelse ($locks as $lock) @php $battery = (int) ($lock['electricQuantity'] ?? 0); $batClass = $battery > 69 ? 'battery-chip--high' : ($battery > 35 ? 'battery-chip--mid' : 'battery-chip--low'); $model = $brafaLockModel($lock['lockName'] ?? '', $lock['featureValue'] ?? null); @endphp @empty @endforelse
Lock alias Model Battery Connection Action
{{ $lock['lockAlias'] ?? 'N/A' }} @if ($model['img']) @endif {{ $model['label'] }} battery_std{{ $battery }}% @if ($lock['hasGateway'] == 1) Online @else Offline @endif
No locks found.
@endif
@endif
{{ $refreshComponent }}
@push('js') @endpush