{{-- brafa Systems — Properties list. Mirror of prototype/admin/views-properties.jsx. Livewire backing is App\Http\Livewire\SetApiKey. Every wire:* directive and property reference below is preserved verbatim — markup only changed. Properties referenced (from $this on SetApiKey): $properties (paginated, with PropertyID/PropertyName/API/dkplus_customer_id) $search, $perPage, $sortField, $sortDirection $selected_api, $apiKey, $arrivals_key $tbf_key1, $tbf_key2, $url_number $totalPropertyName, $authorizationHeaders, $totalURL $dkplus_customer_id, $dkplus_customer_name Methods referenced: sortBy(...), showPropertyDetails(...), updateApiKeys() Livewire events emitted by the component (handled in JS below): closeUpdateApiKeysModal, showSweetAlert --}} @php use Illuminate\Support\Str; use Illuminate\Support\Facades\Auth; $isSuperAdmin = Auth::check() && Auth::user()->role_id == 1; $total = $properties->total(); /* Deterministic colour for the logo tile, derived from PropertyID so a given property keeps the same colour across renders. */ $brafaTilePalette = [ '#1A1A1A', '#3A3A3A', '#5A5A5A', '#2D4A33', '#3A4D6C', '#4D3A6C', '#6C3A53', '#1E8A3E', '#8C5F1B', ]; $brafaTypeFor = function ($api) { $api = strtolower((string) $api); return match ($api) { 'golfbokanir' => ['label' => 'Golf', 'variant' => 'pill--type-golf'], 'beds24', 'godo' => ['label' => 'Hotel', 'variant' => 'pill--type-hotel'], 'bookingfactory', 'total', 'fritimi', 'guesty' => ['label' => 'Hotel', 'variant' => 'pill--type-hotel'], default => ['label' => $api ?: '—', 'variant' => 'pill--type-hotel'], }; }; @endphp
@if (session()->has('error'))
{{ session('error') }}
@endif {{-- ============================================================ Summary strip — Total Properties is real; the other three do not yet have backend wiring on the SetApiKey component, so they render as "—". Replace as data lands. ============================================================ --}}
Total properties {{ $total }}
In-house guests
Arrivals today
Avg occupancy
{{-- ============================================================ List card ============================================================ --}}
{{-- Toolbar --------------------------------------------------- --}}
@if ($isSuperAdmin) @endif
{{-- Table ----------------------------------------------------- --}}
@forelse ($properties as $Property) @php $type = $brafaTypeFor($Property->API); $initials = collect(explode(' ', trim((string) $Property->PropertyName))) ->filter() ->take(2) ->map(fn ($p) => strtoupper(mb_substr($p, 0, 1))) ->implode(''); $tileBg = $brafaTilePalette[crc32((string) $Property->PropertyID) % count($brafaTilePalette)]; $logoSrc = \Illuminate\Support\Facades\Storage::url('public/assets/img/' . Str::slug($Property->PropertyName) . '.png'); @endphp @empty @endforelse
Logo ID @if ($sortField === 'PropertyID') @endif Property name @if ($sortField === 'PropertyName') @endif Type API @if ($sortField === 'API') @endif dkPlus customer Occupancy
{{ $Property->PropertyID }}
{{ $Property->PropertyName }}
{{ $type['label'] }} {{ $Property->API ?: '—' }} {{ $Property->dkplus_customer_id ?: '—' }} {{-- Occupancy data is not yet on the model; render the sunken bar at 0% as a structural placeholder. --}}
No properties match your search.
{{-- Footer ---------------------------------------------------- --}}
{{-- ============================================================ "New property" modal — kept as the existing Bootstrap 4 modal (data-toggle / data-dismiss) so the bundled JS that opens/closes it keeps working. Markup-only restyle inside. ============================================================ --}} @if ($isSuperAdmin) @endif
@push('js') @endpush