@extends('layouts.app') @section('content')
@php $formatIsk = fn($amount) => number_format((float) $amount, 0, ',', '.') . ' ISK'; $latestMonthTotal = $billing['month_groups'][0]['month_total'] ?? 0; $averageMonthTotal = count($billing['month_groups']) > 0 ? (int) round($billing['grand_total'] / count($billing['month_groups'])) : 0; $activeFilterCount = 0; $monthsTracked = $stats->count(); $latestUniqueLocks = (int) ($stats->last()['count'] ?? 0); $totalNewLocksInRange = (int) $stats->sum('new_locks'); $totalNewPropertiesInRange = (int) $stats->sum('new_properties'); $netGrowthRate = $latestUniqueLocks > 0 && $totalNewLocksInRange > 0 ? round(($totalNewLocksInRange / max($latestUniqueLocks, 1)) * 100, 1) : 0; $billableMonths = count($billing['month_groups']); $propertyGrowthRows = $stats ->flatMap(fn($row) => collect($row['properties'] ?? [])->map(fn($property) => [ 'month' => $row['month'], 'name' => $property['name'], 'locks' => $property['locks'], ])) ->values(); $propertyCoverageRate = $monthsTracked > 0 ? round(($propertyGrowthRows->count() / max($monthsTracked, 1)), 1) : 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 {{-- ══════════════════ COMPACT HEADER ════════════════════════════════════ --}}
Lock analytics
Lock growth, property onboarding and revenue trends. Filters apply to the exports too.
receipt_longBack to billing table_viewExcel downloadCSV
@include('superadmin.lock-statistics.partials.filters', ['pageRoute' => 'locks-by-month.analytics', 'showExports' => true]) {{-- 8 KPI cards --}}

Grand total billed

{{ $formatIsk($billing['grand_total']) }}

Latest month total

{{ $formatIsk($latestMonthTotal) }}

Average monthly total

{{ $formatIsk($averageMonthTotal) }}

Active filter groups

{{ $activeFilterCount }}

Latest unique locks

{{ $latestUniqueLocks }}

New locks in range

{{ $totalNewLocksInRange }}

New properties in range

{{ $totalNewPropertiesInRange }}

Months tracked

{{ $monthsTracked }}
{{-- 3 insight cards --}}
Growth Health

How fast the selected period expanded.

{{ $netGrowthRate }}%

Net lock velocity

New locks in range vs. latest unique lock base.

Property Activity

Average additions per tracked month.

{{ $propertyCoverageRate }}

Properties / month

Monthly onboarding consistency in current filters.

Billing Signal

Snapshot of active invoice periods.

{{ $billableMonths }}

Billable months
Grand: {{ $formatIsk($billing['grand_total']) }} Avg: {{ $formatIsk($averageMonthTotal) }}

Verify billing continuity across the selected range.

{{-- Lock growth chart + table --}}
Monthly Lock Growth

Unique locks and property additions per month.

@forelse($stats as $statRow) @empty @endforelse
Month Unique Locks New Locks New Properties
{{ $statRow['month'] }} {{ $statRow['count'] }} {{ $statRow['new_locks'] }} {{ $statRow['new_properties'] }}
No rows for selected filters.
{{-- Property growth chart + table --}}
Monthly Property Growth

Property additions per month.

@forelse($propertyGrowthRows as $propertyRow) @empty @endforelse
Month Property Added Locks Added
{{ $propertyRow['month'] }} {{ strip_tags((string) $propertyRow['name']) }} {{ $propertyRow['locks'] }}
No new properties in the selected range.
@endsection @push('css') @endpush @push('js') @endpush