Files
ladill-qr-plus/resources/views/qr/dashboard.blade.php
T
isaaccladandClaude Opus 4.8 296312ab4b
Deploy Ladill QR Plus / deploy (push) Successful in 41s
Wire QR overview create-code links into the two-step add-funds modal
The dashboard 'Create code' / 'Create your first code' links were plain hrefs
to the create page, so a user with insufficient balance only met the top-up
modal after filling the form. Gate them with balanceGate + mount the modal so
they open Add funds directly when the wallet can't cover a QR code.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 06:37:28 +00:00

64 lines
3.5 KiB
PHP

<x-user-layout>
<x-slot name="title">Overview</x-slot>
@php $fmt = fn ($m) => 'GHS '.number_format($m / 100, 2); @endphp
<div class="space-y-6"
x-data="balanceGate({
balance: @js((float) ($balanceMinor / 100)),
price: @js((float) $pricePerQr),
modalId: 'qr',
href: @js(route('user.qr-codes.create')),
})">
<div>
<h1 class="text-xl font-semibold text-slate-900">QR Plus</h1>
<p class="mt-1 text-sm text-slate-500">Dynamic utility QR codes links, WiFi, business pages & more.</p>
</div>
<div class="grid gap-4 sm:grid-cols-3">
<div class="rounded-2xl border border-slate-200 bg-white p-5">
<p class="text-xs font-medium uppercase tracking-wide text-slate-400">Wallet balance</p>
<p class="mt-1.5 text-2xl font-semibold text-slate-900">{{ $fmt($balanceMinor) }}</p>
</div>
<div class="rounded-2xl border border-slate-200 bg-white p-5">
<p class="text-xs font-medium uppercase tracking-wide text-slate-400">Active codes</p>
<p class="mt-1.5 text-2xl font-semibold text-slate-900">{{ $activeCount }}</p>
</div>
<div class="rounded-2xl border border-slate-200 bg-white p-5">
<p class="text-xs font-medium uppercase tracking-wide text-slate-400">Scans (30d)</p>
<p class="mt-1.5 text-2xl font-semibold text-slate-900">{{ number_format($scans30d) }}</p>
</div>
</div>
<div class="rounded-2xl border border-slate-200 bg-white">
<div class="flex items-center justify-between border-b border-slate-100 px-6 py-4">
<h2 class="font-semibold text-slate-900">Recent codes</h2>
<a href="{{ route('user.qr-codes.create') }}" @click="goOrTopup($event)" class="text-sm font-medium text-indigo-600 hover:text-indigo-800">Create code</a>
</div>
@if($recentCodes->isEmpty())
<p class="px-6 py-8 text-sm text-slate-500">No QR codes yet. <a href="{{ route('user.qr-codes.create') }}" @click="goOrTopup($event)" class="font-medium text-indigo-600">Create your first code</a>.</p>
@else
<div class="divide-y divide-slate-100">
@foreach($recentCodes as $code)
<a href="{{ route('user.qr-codes.show', $code) }}" class="flex items-center justify-between px-6 py-4 hover:bg-slate-50">
<div>
<p class="font-medium text-slate-900">{{ $code->label }}</p>
<p class="text-xs text-slate-500">{{ $code->typeLabel() }}</p>
</div>
<span class="text-xs text-slate-500">{{ number_format($code->scans_total) }} scans</span>
</a>
@endforeach
</div>
@endif
</div>
{{-- Two-step add-funds modal (create links open this when balance is too low) --}}
<x-user.service-topup-modal
id="qr"
title="Add funds"
:topup-action="route('user.wallet.topup')"
:price-per-action="(float) $pricePerQr"
action-noun="QR code"
:service-balance="(float) ($balanceMinor / 100)"
service-balance-label="Wallet balance"
:return-url="route('user.qr-codes.create')"
:open-on-load="session('open_topup_modal') === 'qr'" />
</div>
</x-user-layout>