Files
ladill-care/resources/views/care/patients/index.blade.php
T
isaaccladandCursor 0b6cad75a6
Deploy Ladill Care / deploy (push) Successful in 37s
Add hero sections to Patients, Appointments, Queue, and admin index pages.
Introduce shared x-care.page-hero with summary stats so key list views
match the Ladill app hero pattern used across Frontdesk and Link.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-05 22:57:54 +00:00

78 lines
4.1 KiB
PHP

@php
$canManagePatients = app(\App\Services\Care\CarePermissions::class)->can(
auth()->user() ? app(\App\Services\Care\OrganizationResolver::class)->memberFor(auth()->user(), $organization) : null,
'patients.manage'
);
@endphp
<x-app-layout title="Patients">
<div class="space-y-6">
<x-care.page-hero
badge="Records · Search · Registration"
title="Patients"
description="Search and manage patient records, demographics, and visit history across your branches."
:stats="[
['value' => number_format($heroStats['total']), 'label' => 'Patients'],
['value' => number_format($heroStats['new_this_month']), 'label' => 'New this month'],
['value' => number_format($heroStats['with_visits']), 'label' => 'With visits'],
]">
@if ($canManagePatients)
<x-slot name="actions">
<a href="{{ route('care.patients.create') }}" class="btn-primary">Register patient</a>
</x-slot>
@endif
</x-care.page-hero>
<form method="GET" class="flex flex-wrap gap-3 rounded-2xl border border-slate-200 bg-white p-4">
<input type="search" name="q" value="{{ request('q') }}" placeholder="Name, phone, patient ID, national ID…"
class="min-w-[200px] flex-1 rounded-lg border-slate-300 text-sm">
<input type="date" name="date_of_birth" value="{{ request('date_of_birth') }}"
class="rounded-lg border-slate-300 text-sm" title="Date of birth">
<button type="submit" class="btn-primary">Search</button>
@if (request()->hasAny(['q', 'date_of_birth', 'phone', 'national_id', 'patient_number']))
<a href="{{ route('care.patients.index') }}" class="rounded-lg border border-slate-200 px-4 py-2 text-sm text-slate-600">Clear</a>
@endif
</form>
<div class="overflow-hidden rounded-2xl border border-slate-200 bg-white">
<table class="min-w-full text-sm">
<thead class="bg-slate-50 text-left text-xs uppercase text-slate-500">
<tr>
<th class="px-4 py-3">Patient</th>
<th class="px-4 py-3">Patient ID</th>
<th class="px-4 py-3">Phone</th>
<th class="px-4 py-3">DOB</th>
<th class="px-4 py-3">Branch</th>
<th class="px-4 py-3"></th>
</tr>
</thead>
<tbody class="divide-y divide-slate-50">
@forelse ($patients as $patient)
<tr>
<td class="px-4 py-3">
<p class="font-medium text-slate-900">{{ $patient->fullName() }}</p>
@if ($patient->national_id)
<p class="text-xs text-slate-500">NID: {{ $patient->national_id }}</p>
@endif
</td>
<td class="px-4 py-3 font-mono text-xs">{{ $patient->patient_number }}</td>
<td class="px-4 py-3">{{ $patient->phone ?? '—' }}</td>
<td class="px-4 py-3">{{ $patient->date_of_birth?->format('Y-m-d') ?? '—' }}</td>
<td class="px-4 py-3">{{ $patient->branch?->name ?? '—' }}</td>
<td class="px-4 py-3 text-right">
<a href="{{ route('care.patients.show', $patient) }}" class="text-sky-600 hover:text-sky-700">View</a>
</td>
</tr>
@empty
<tr>
<td colspan="6" class="px-4 py-8 text-center text-slate-500">No patients found.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div>{{ $patients->links() }}</div>
</div>
</x-app-layout>