Show payments and paid bills on billing dashboards.
Deploy Ladill Care / deploy (push) Successful in 1m21s
Deploy Ladill Care / deploy (push) Successful in 1m21s
Cashiers and other bills.view roles get today's collections breakdown and a recent paid-invoice list under the existing metric cards. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -276,4 +276,85 @@
|
||||
@endforelse
|
||||
</section>
|
||||
@endif
|
||||
|
||||
@if (! empty($showBillingPanel) && $paymentStats)
|
||||
@php
|
||||
$money = fn (int $minor) => $currency.' '.number_format($minor / 100, 2);
|
||||
@endphp
|
||||
<section class="mt-6">
|
||||
<div class="flex flex-wrap items-end justify-between gap-3">
|
||||
<div>
|
||||
<h2 class="text-sm font-semibold text-slate-900">Payments today</h2>
|
||||
<p class="mt-0.5 text-xs text-slate-500">Collections at your branch</p>
|
||||
</div>
|
||||
<a href="{{ route('care.bills.index') }}" class="text-sm font-medium text-indigo-600 hover:text-indigo-800">Open billing</a>
|
||||
</div>
|
||||
<div class="mt-3 grid grid-cols-2 gap-4 lg:grid-cols-4">
|
||||
<div class="rounded-2xl border border-slate-200 bg-white p-5">
|
||||
<p class="text-xs font-medium uppercase tracking-wide text-slate-500">Collected</p>
|
||||
<p class="mt-3 text-2xl font-semibold text-emerald-700">{{ $money($paymentStats['collected_minor']) }}</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-500">Payments</p>
|
||||
<p class="mt-3 text-2xl font-semibold text-slate-900">{{ number_format($paymentStats['payment_count']) }}</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-500">Cash</p>
|
||||
<p class="mt-3 text-2xl font-semibold text-slate-900">{{ $money($paymentStats['cash_minor']) }}</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-500">Other methods</p>
|
||||
<p class="mt-3 text-2xl font-semibold text-slate-900">{{ $money($paymentStats['other_minor']) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="mt-6 rounded-2xl border border-slate-200 bg-white">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3 border-b border-slate-100 px-5 py-4">
|
||||
<div>
|
||||
<h2 class="text-sm font-semibold text-slate-900">Recently paid bills</h2>
|
||||
<p class="mt-0.5 text-xs text-slate-500">Latest settled invoices</p>
|
||||
</div>
|
||||
<a href="{{ route('care.bills.index', ['status' => \App\Models\Bill::STATUS_PAID]) }}" class="text-sm font-medium text-indigo-600 hover:text-indigo-800">View paid</a>
|
||||
</div>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-full text-sm">
|
||||
<thead class="bg-slate-50 text-left text-xs uppercase text-slate-500">
|
||||
<tr>
|
||||
<th class="px-5 py-3">Invoice</th>
|
||||
<th class="px-5 py-3">Patient</th>
|
||||
<th class="px-5 py-3">Total</th>
|
||||
<th class="px-5 py-3">Paid at</th>
|
||||
<th class="px-5 py-3 text-right"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-50">
|
||||
@forelse ($recentPaidBills as $bill)
|
||||
@php
|
||||
$billUrl = route('care.bills.show', $bill);
|
||||
$paidAt = $bill->last_paid_at
|
||||
? \Illuminate\Support\Carbon::parse($bill->last_paid_at)->format('d M Y, H:i')
|
||||
: '—';
|
||||
@endphp
|
||||
<tr class="hover:bg-slate-50">
|
||||
<td class="px-5 py-3 font-mono text-xs">
|
||||
<a href="{{ $billUrl }}" class="font-medium text-sky-600 hover:text-sky-700">{{ $bill->invoice_number }}</a>
|
||||
</td>
|
||||
<td class="px-5 py-3">{{ $bill->patient?->fullName() ?? 'Patient' }}</td>
|
||||
<td class="px-5 py-3 tabular-nums">{{ $money((int) $bill->total_minor) }}</td>
|
||||
<td class="px-5 py-3 text-slate-500">{{ $paidAt }}</td>
|
||||
<td class="px-5 py-3 text-right">
|
||||
<a href="{{ $billUrl }}" class="text-sm font-medium text-indigo-600 hover:text-indigo-800">View</a>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="5" class="px-5 py-8 text-center text-sm text-slate-500">No paid bills yet.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
@endif
|
||||
</x-app-layout>
|
||||
|
||||
Reference in New Issue
Block a user