{{-- A drawn revenue dashboard on a desktop monitor, with the same figures on a phone. It is decoration made of SVG (so it stays sharp at any size): the figures are made up, the caption says so, and the drawing is hidden from screen readers. The sample numbers live in config('site.home.showcase.revenue'). Usage: --}} @props(['caption' => 'Illustrative dashboard with sample figures']) @php $r = config('site.home.showcase.revenue'); $total = $r['total']; $depts = $r['departments']; // Whole rupees in the Indian style: 542000 -> ₹5,42,000 $inr = function (int|float $n): string { $s = (string) (int) round($n); $last3 = substr($s, -3); $rest = substr($s, 0, -3); return '₹'.($rest === '' ? $last3 : preg_replace('/\B(?=(\d{2})+(?!\d))/', ',', $rest).','.$last3); }; // Growth of the total, worked out from the departments' own growth so the numbers agree with each other. $before = collect($depts)->sum(fn ($d) => $d['amount'] / (1 + $d['growth'] / 100)); $growth = round(($total / $before - 1) * 100, 1); $pct = fn ($d) => round($d['amount'] / $total * 100); $ranked = collect($depts)->sortByDesc('amount')->values(); // A smooth curve through points (Catmull-Rom turned into cubic Beziers). $curve = function (array $p): string { $d = 'M'.round($p[0][0], 1).' '.round($p[0][1], 1); for ($i = 0; $i < count($p) - 1; $i++) { [$p0, $p1, $p2, $p3] = [$p[max($i - 1, 0)], $p[$i], $p[$i + 1], $p[min($i + 2, count($p) - 1)]]; $d .= sprintf(' C%.1f %.1f %.1f %.1f %.1f %.1f', $p1[0] + ($p2[0] - $p0[0]) / 6, $p1[1] + ($p2[1] - $p0[1]) / 6, $p2[0] - ($p3[0] - $p1[0]) / 6, $p2[1] - ($p3[1] - $p1[1]) / 6, $p2[0], $p2[1]); } return $d; }; $plot = fn (array $values, float $x, float $y, float $w, float $h, float $max) => collect($values) ->map(fn ($v, $i) => [$x + $i * $w / (count($values) - 1), $y + $h - $v / $max * $h])->all(); // Monitor: the trend chart (plot box x 176..492, y 204..296; 0..30K). $trend = $plot($r['daily'], 176, 204, 316, 92, 30); $trendLine = $curve($trend); $trendArea = $trendLine.' L'.end($trend)[0].' 296 L'.$trend[0][0].' 296 Z'; $peak = 7; $peakDay = (int) round(1 + $peak * 29 / (count($trend) - 1)); $targetY = 296 - $r['target'] / 30 * 92; // Phone: last 7 days (plot box x 38..222, y 222..268; 0..30K). $week = $plot($r['week'], 38, 222, 184, 46, 30); $weekLine = $curve($week); $weekArea = $weekLine.' L'.end($week)[0].' 268 L'.$week[0][0].' 268 Z'; $nav = [['chart', 'Dashboard'], ['receipt-rupee', 'Revenue'], ['bill', 'Billing'], ['users', 'OPD'], ['bed', 'IPD'], ['pill', 'Pharmacy'], ['lab', 'Laboratory'], ['doc', 'Reports']]; $shades = ['#0284c7', '#38bdf8', '#7dd3fc', '#bae6fd']; @endphp class('mx-auto w-full max-w-[46rem]') }}> {{-- ======================= Monitor ======================= --}} {{-- Stand --}} {{-- Body and screen --}} {{-- Sidebar --}} HMIS @foreach ($nav as $i => [$name, $label]) @php($y = 70 + $i * 38) @php($on = $i === 1) @if ($on) @endif {{ $label }} @endforeach {{-- Top bar --}} Revenue dashboard This month {{-- Key figures --}} @php($cards = [['Total revenue', $total, $growth, 'receipt-rupee', true], ...collect($depts)->map(fn ($d) => [$d['name'], $d['amount'], $d['growth'], $d['icon'], false])->all()]) @foreach ($cards as $i => [$label, $amount, $delta, $iconName, $hero]) @php($x = 120 + $i * 151) {{ $label }} {{ $inr($amount) }} {{ number_format($delta, 1) }}% vs last month @endforeach {{-- Revenue trend --}} Revenue trend Revenue Target @foreach ([0, 10, 20, 30] as $tick) @php($ty = 296 - $tick * 92 / 30) {{ $tick === 0 ? '0' : $tick.'K' }} @endforeach @foreach ([0, 3, 6, 9, 11] as $t) {{ (int) round(1 + $t * 29 / (count($trend) - 1)) }} @endforeach @php([$px, $py] = $trend[$peak]) Day {{ $peakDay }} {{ $inr($r['daily'][$peak] * 1000) }} {{-- By department --}} By department @php($widest = $ranked->max('amount')) @foreach ($ranked as $i => $d) @php($by = 214 + $i * 44) {{ $d['name'] }} {{ $inr($d['amount']) }} {{ $pct($d) }}% @endforeach {{-- Payment modes --}} Payment modes @php($cursor = 136) @foreach ($r['payments'] as $i => [$mode, $share]) @php($cursor += $share * 3.56) @endforeach @foreach ($r['payments'] as $i => [$mode, $share]) {{ $mode }} {{ $share }}% @endforeach {{-- Pending claims --}} Pending claims {{ $inr($r['pending']['amount']) }} {{ $r['pending']['claims'] }} claims awaiting approval {{-- ======================= Phone: the same figures ======================= --}} 9:41 {{-- Header --}} Revenue · this month {{ $inr($total) }} {{ number_format($growth, 1) }}% vs last month {{-- Last 7 days --}} Last 7 days @foreach (['M', 'T', 'W', 'T', 'F', 'S', 'S'] as $i => $day) {{ $day }} @endforeach {{-- Departments --}} @foreach ($depts as $i => $d) @php($ry = 308 + $i * 44) {{ $d['name'] }} +{{ number_format($d['growth'], 1) }}% {{ $inr($d['amount']) }} @endforeach {{-- Tab bar --}} @foreach (['chart', 'receipt-rupee', 'users', 'bell'] as $i => $tab) @endforeach {{ $caption }}