{{-- 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 = function ($lockName) { $name = (string) $lockName; return match (true) { \Illuminate\Support\Str::startsWith($name, 'H31') => ['img' => 'H31', 'label' => 'brafa Hotel FP'], \Illuminate\Support\Str::startsWith($name, 'LL9246') => ['img' => 'H31', 'label' => 'brafa Hotel'], \Illuminate\Support\Str::startsWith($name, 'LL476') => ['img' => 'H31', 'label' => 'brafa Hotel'], \Illuminate\Support\Str::startsWith($name, 'M302') => ['img' => 'M302', 'label' => 'brafa ASSA'], \Illuminate\Support\Str::startsWith($name, 'S31') => ['img' => 'S31', 'label' => 'brafa Slim'], \Illuminate\Support\Str::startsWith($name, 'K3') => ['img' => 'K3', 'label' => 'brafa Keypad K3'], \Illuminate\Support\Str::startsWith($name, 'K2') => ['img' => 'K3', 'label' => 'brafa Keypad K2'], \Illuminate\Support\Str::startsWith($name, 'N30') => ['img' => 'N30', 'label' => 'brafa Cylinder'], \Illuminate\Support\Str::startsWith($name, 'LL80') => ['img' => 'LL80', 'label' => 'brafa FaceID'], default => ['img' => null, 'label' => $name ?: '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'] ?? ''); @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