{{-- Shared filter card for the lock billing + analytics pages. Expects: $filters, $apis, $selectedApis, $properties. Optional: $pageRoute (reset target), $showExports (CSV/Excel buttons). --}} @php $activeFilterCount = 0; if (!empty($filters['from_month'])) $activeFilterCount++; if (!empty($filters['to_month'])) $activeFilterCount++; if (!empty($filters['property_id'])) $activeFilterCount++; if (!empty($filters['property_name'])) $activeFilterCount++; if (!empty($filters['only_billable'])) $activeFilterCount++; if (count($selectedApis) !== count($apis)) $activeFilterCount++; @endphp {{-- ══════════════════ COLLAPSIBLE FILTER ════════════════════════════════ --}}
@if($activeFilterCount > 0) {{ $activeFilterCount }} active @if(!empty($filters['from_month'])) From: {{ $filters['from_month'] }} @endif @if(!empty($filters['to_month'])) To: {{ $filters['to_month'] }} @endif @if(!empty($filters['property_id'])) ID: {{ $filters['property_id'] }} @endif @if(!empty($filters['property_name'])) Name: {{ $filters['property_name'] }} @endif @if(!empty($filters['only_billable'])) Billable > 0 @endif @if(count($selectedApis) !== count($apis)) APIs: {{ implode(', ', $selectedApis) }} @endif @else No active filters — showing all data @endif
clearReset
{{-- Month inputs always use is-filled: the browser renders a date widget regardless of value --}}
{{-- Selects always use is-filled: they always show a selected option --}}
@php // Inactive / superseded / never-billed properties go to a group at the bottom. $settingsForFilter = $propertySettingsMap ?? collect(); $nowMonth = now()->format('Y-m'); $filterInactive = function ($p) use ($settingsForFilter, $nowMonth) { $s = $settingsForFilter[trim((string) $p->PropertyID)] ?? null; return $s && (!empty($s->billing_disabled) || !empty($s->superseded_by) || (!empty($s->inactive_from) && $s->inactive_from <= $nowMonth)); }; [$inactiveProps, $activeProps] = $properties->partition($filterInactive); @endphp
/
@foreach($apis as $api)
@endforeach
@if(!empty($showExports)) Export CSV Export Excel @endif