@extends('layouts.user_type.auth') @php $hmHour = (int) now()->format('G'); $hmGreeting = $hmHour < 12 ? 'Good morning' : ($hmHour < 17 ? 'Good afternoon' : 'Good evening'); $hmFirst = \Illuminate\Support\Str::of(auth()->user()->name)->trim()->explode(' ')->first(); $hmCronErrors = (int) ($cron_errors_24h ?? 0); $hmTrend = fn ($p) => \Illuminate\Support\Str::contains($p ?? '', '-') ? 'z-badge--danger' : 'z-badge--success'; $hmTrendIcon = fn ($p) => \Illuminate\Support\Str::contains($p ?? '', '-') ? 'ri-arrow-right-down-line' : 'ri-arrow-right-up-line'; $hmInitials = fn ($n) => strtoupper(collect(preg_split('/\s+/', trim($n ?: '?')))->filter()->take(2)->map(fn ($p) => mb_substr($p, 0, 1))->implode('')); $hmTone = fn ($n) => 'c' . ((array_sum(array_map('ord', str_split($n ?: ''))) % 6) + 1); // presentation only: shares and averages worked out from the numbers the controller already sends $hmIsAdmin = in_array(auth()->user()->user_type, ['admin', 'super_admin'], true); $hmTotal = max(0, (int) ($total_company ?? 0)); $hmActive = max(0, (int) ($subscribed_company ?? 0)); $hmExpired = max(0, (int) ($expired_company ?? 0)); $hmPct = fn ($n) => $hmTotal > 0 ? min(100, (int) round($n / $hmTotal * 100)) : 0; $hmCoverage = $hmPct($hmActive); $hmRing = 2 * M_PI * 52; // ring circumference (r = 52) $hmNum = fn ($v) => (float) str_replace(',', '', (string) ($v ?? 0)); $hmMeter = function ($today, $week) use ($hmNum) { // today vs the 7-day daily average $avg = $hmNum($week) / 7; $t = $hmNum($today); $max = max($t, $avg, 1); return ['avg' => rtrim(rtrim(number_format($avg, 1), '0'), '.'), 'today' => (int) round($t / $max * 100), 'mark' => (int) round($avg / $max * 100)]; }; $hmFollowUps = method_exists($subscriptions, 'total') ? (int) $subscriptions->total() : 0; @endphp {{-- the hero below carries the greeting, so the standard page header is hidden --}} @section('pageHead', '') @section('home')
{{ $hmTotal }} {{ \Illuminate\Support\Str::plural('company', $hmTotal) }} on the platform, {{ $hmActive }} on an active plan{!! $hmExpired > 0 ? ', ' . $hmExpired . ' expired' : '' !!}. @if ($hmFollowUps > 0) {{ $hmFollowUps }} {{ \Illuminate\Support\Str::plural('renewal', $hmFollowUps) }} to follow up. @else No renewals need attention right now. @endif
| Company | Package | Expiry date | Time left |
|---|---|---|---|
|
{{ $hmInitials($subscription['company_name']) }}
{{ $subscription['company_name'] }}
{{ $isExpired ? 'Expired' : 'Expiring soon' }}
|
{{ $subscription['package_name'] }} | {{ \Carbon\Carbon::parse($subscription['expires_at'])->format('d M, Y') }} | {{ $isExpired ? abs($days).' days overdue' : ($days == 0 ? 'Expires today' : $days.' days left') }} |
|
All caught up
No upcoming expirations in this billing cycle.
|
|||