Files
ladill-care/resources/views/care/consultations/show.blade.php
T
isaaccladandCursor 6c9c742ed8
Deploy Ladill Care / deploy (push) Failing after 13s
Initial Ladill Care release.
Healthcare management app: patients, appointments, consultations, lab,
pharmacy inventory, billing, and reports at care.ladill.com.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 11:36:22 +00:00

233 lines
16 KiB
PHP

<x-app-layout :title="'Consultation · '.$consultation->patient->fullName()">
<div class="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
<div>
<p class="text-xs font-medium uppercase tracking-wide {{ $isCompleted ? 'text-emerald-600' : 'text-amber-600' }}">
{{ $isCompleted ? 'Completed' : 'In progress' }}
</p>
<h1 class="text-2xl font-semibold text-slate-900">{{ $consultation->patient->fullName() }}</h1>
<p class="mt-1 text-sm text-slate-500">
{{ $consultation->patient->patient_number }}
@if ($consultation->practitioner) · {{ $consultation->practitioner->name }} @endif
</p>
</div>
@if ($canManage && ! $isCompleted)
<form method="POST" action="{{ route('care.consultations.complete', $consultation) }}" onsubmit="return confirm('Complete this consultation?')">
@csrf
<button type="submit" class="btn-primary">Complete consultation</button>
</form>
@endif
@if ($canPrescribe)
<a href="{{ route('care.prescriptions.create', $consultation) }}" class="rounded-lg border border-slate-200 bg-white px-4 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50">Prescribe</a>
@endif
@if ($canGenerateBill && $isCompleted && $consultation->visit)
<form method="POST" action="{{ route('care.bills.generate', $consultation->visit) }}">
@csrf
<button type="submit" class="rounded-lg bg-slate-800 px-4 py-2 text-sm font-medium text-white hover:bg-slate-900">Generate bill</button>
</form>
@endif
</div>
@if ($canRequestInvestigations && $investigationTypes->isNotEmpty())
<section class="mt-6 rounded-2xl border border-slate-200 bg-white p-6">
<h2 class="text-sm font-semibold uppercase tracking-wide text-slate-500">Request investigations</h2>
<form method="POST" action="{{ route('care.lab.requests.store', $consultation) }}" class="mt-4 space-y-4">
@csrf
<div class="grid gap-2 sm:grid-cols-2 lg:grid-cols-3">
@foreach ($investigationTypes as $type)
<label class="flex items-center gap-2 rounded-lg border border-slate-100 bg-slate-50 px-3 py-2 text-sm">
<input type="checkbox" name="investigation_type_ids[]" value="{{ $type->id }}" class="rounded border-slate-300">
<span>{{ $type->name }} <span class="text-slate-400">({{ config('care.investigation_categories')[$type->category] ?? $type->category }})</span></span>
</label>
@endforeach
</div>
<div class="grid gap-4 sm:grid-cols-2">
<input type="text" name="clinical_notes" placeholder="Clinical notes for lab" class="rounded-lg border-slate-300 text-sm">
<select name="priority" class="rounded-lg border-slate-300 text-sm">
<option value="routine">Routine</option>
<option value="urgent">Urgent</option>
</select>
</div>
<button type="submit" class="btn-primary">Submit requests</button>
</form>
@if ($consultation->investigationRequests->isNotEmpty())
<div class="mt-4 border-t border-slate-100 pt-4 text-sm">
<p class="font-medium text-slate-700">Requested tests</p>
@foreach ($consultation->investigationRequests as $req)
<p class="mt-1">
<a href="{{ route('care.lab.requests.show', $req) }}" class="text-sky-600">{{ $req->investigationType->name }}</a>
· {{ config('care.investigation_statuses')[$req->status] ?? $req->status }}
</p>
@endforeach
</div>
@endif
</section>
@endif
@if ($consultation->prescriptions->isNotEmpty())
<section class="mt-6 rounded-2xl border border-slate-200 bg-white p-6">
<h2 class="text-sm font-semibold uppercase tracking-wide text-slate-500">Prescriptions</h2>
<ul class="mt-4 space-y-2 text-sm">
@foreach ($consultation->prescriptions as $rx)
<li>
<a href="{{ route('care.prescriptions.show', $rx) }}" class="text-sky-600 hover:text-sky-700">
{{ $rx->created_at->format('d M Y H:i') }}
</a>
· {{ config('care.prescription_statuses')[$rx->status] ?? $rx->status }}
· {{ $rx->items->pluck('name')->join(', ') }}
</li>
@endforeach
</ul>
</section>
@endif
@if (! $isCompleted && ($canManage || $canVitals))
<form method="POST" action="{{ route('care.consultations.update', $consultation) }}" enctype="multipart/form-data" class="mt-6 space-y-6">
@csrf @method('PUT')
@if ($canVitals)
<section class="rounded-2xl border border-slate-200 bg-white p-6">
<h2 class="text-sm font-semibold uppercase tracking-wide text-slate-500">Vital signs</h2>
@php $latestVitals = $consultation->vitalSigns->last(); @endphp
<div class="mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
<div>
<label class="block text-xs text-slate-500">BP systolic</label>
<input type="number" name="vitals[bp_systolic]" value="{{ old('vitals.bp_systolic', $latestVitals?->bp_systolic) }}" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
</div>
<div>
<label class="block text-xs text-slate-500">BP diastolic</label>
<input type="number" name="vitals[bp_diastolic]" value="{{ old('vitals.bp_diastolic', $latestVitals?->bp_diastolic) }}" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
</div>
<div>
<label class="block text-xs text-slate-500">Pulse</label>
<input type="number" name="vitals[pulse]" value="{{ old('vitals.pulse', $latestVitals?->pulse) }}" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
</div>
<div>
<label class="block text-xs text-slate-500">Temperature (°C)</label>
<input type="number" step="0.1" name="vitals[temperature]" value="{{ old('vitals.temperature', $latestVitals?->temperature) }}" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
</div>
<div>
<label class="block text-xs text-slate-500">Weight (kg)</label>
<input type="number" step="0.01" name="vitals[weight_kg]" value="{{ old('vitals.weight_kg', $latestVitals?->weight_kg) }}" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
</div>
<div>
<label class="block text-xs text-slate-500">Height (cm)</label>
<input type="number" step="0.1" name="vitals[height_cm]" value="{{ old('vitals.height_cm', $latestVitals?->height_cm) }}" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
</div>
<div>
<label class="block text-xs text-slate-500">SpO₂ (%)</label>
<input type="number" name="vitals[spo2]" value="{{ old('vitals.spo2', $latestVitals?->spo2) }}" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
</div>
<div>
<label class="block text-xs text-slate-500">Resp. rate</label>
<input type="number" name="vitals[respiratory_rate]" value="{{ old('vitals.respiratory_rate', $latestVitals?->respiratory_rate) }}" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
</div>
</div>
</section>
@endif
@if ($canManage)
<section class="rounded-2xl border border-slate-200 bg-white p-6">
<h2 class="text-sm font-semibold uppercase tracking-wide text-slate-500">Clinical notes</h2>
<div class="mt-4 space-y-4">
<div>
<label class="block text-sm font-medium text-slate-700">Symptoms</label>
<textarea name="symptoms" rows="3" class="mt-1 w-full rounded-lg border-slate-300 text-sm">{{ old('symptoms', $consultation->symptoms) }}</textarea>
</div>
<div>
<label class="block text-sm font-medium text-slate-700">Clinical notes</label>
<textarea name="clinical_notes" rows="5" class="mt-1 w-full rounded-lg border-slate-300 text-sm">{{ old('clinical_notes', $consultation->clinical_notes) }}</textarea>
</div>
<div>
<label class="block text-sm font-medium text-slate-700">Practitioner</label>
<select name="practitioner_id" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
<option value=""></option>
@foreach ($practitioners as $practitioner)
<option value="{{ $practitioner->id }}" @selected(old('practitioner_id', $consultation->practitioner_id) == $practitioner->id)>{{ $practitioner->name }}</option>
@endforeach
</select>
</div>
</div>
</section>
<section class="rounded-2xl border border-slate-200 bg-white p-6" x-data="{ diagnoses: {{ json_encode(old('diagnoses', $consultation->diagnoses->map(fn ($d) => ['code' => $d->code, 'description' => $d->description, 'is_primary' => $d->is_primary, 'notes' => $d->notes])->values()->all() ?: [['code' => '', 'description' => '', 'is_primary' => true, 'notes' => '']])) }} }">
<div class="flex items-center justify-between">
<h2 class="text-sm font-semibold uppercase tracking-wide text-slate-500">Diagnoses</h2>
<button type="button" @click="diagnoses.push({code:'',description:'',is_primary:false,notes:''})" class="text-sm text-sky-600 hover:text-sky-700">Add diagnosis</button>
</div>
<template x-for="(dx, index) in diagnoses" :key="index">
<div class="mt-4 grid gap-3 rounded-xl border border-slate-100 bg-slate-50 p-4 sm:grid-cols-2">
<div>
<label class="block text-xs text-slate-500">ICD code</label>
<input type="text" :name="'diagnoses['+index+'][code]'" x-model="dx.code" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
</div>
<div>
<label class="block text-xs text-slate-500">Description</label>
<input type="text" :name="'diagnoses['+index+'][description]'" x-model="dx.description" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
</div>
<div class="sm:col-span-2">
<label class="inline-flex items-center gap-2 text-sm">
<input type="checkbox" :name="'diagnoses['+index+'][is_primary]'" value="1" x-model="dx.is_primary" class="rounded border-slate-300">
Primary diagnosis
</label>
</div>
</div>
</template>
</section>
<section class="rounded-2xl border border-slate-200 bg-white p-6">
<h2 class="text-sm font-semibold uppercase tracking-wide text-slate-500">Documents</h2>
<input type="file" name="documents[]" multiple accept=".pdf,.jpg,.jpeg,.png,.webp" class="mt-4 block w-full text-sm text-slate-500">
</section>
@endif
<div class="flex gap-3">
<button type="submit" class="btn-primary">Save</button>
<a href="{{ route('care.queue.index') }}" class="rounded-lg border border-slate-200 px-4 py-2 text-sm text-slate-600">Back to queue</a>
</div>
</form>
@else
<div class="mt-6 space-y-6">
@if ($consultation->vitalSigns->isNotEmpty())
<section class="rounded-2xl border border-slate-200 bg-white p-6">
<h2 class="text-sm font-semibold uppercase tracking-wide text-slate-500">Vital signs</h2>
@foreach ($consultation->vitalSigns as $vitals)
<dl class="mt-4 grid gap-3 text-sm sm:grid-cols-4">
<div><dt class="text-slate-500">BP</dt><dd class="font-medium">{{ $vitals->bp_systolic }}/{{ $vitals->bp_diastolic }}</dd></div>
<div><dt class="text-slate-500">Pulse</dt><dd class="font-medium">{{ $vitals->pulse ?? '—' }}</dd></div>
<div><dt class="text-slate-500">Temp</dt><dd class="font-medium">{{ $vitals->temperature ?? '—' }}°C</dd></div>
<div><dt class="text-slate-500">SpO₂</dt><dd class="font-medium">{{ $vitals->spo2 ? $vitals->spo2.'%' : '—' }}</dd></div>
</dl>
@endforeach
</section>
@endif
@if ($consultation->symptoms || $consultation->clinical_notes)
<section class="rounded-2xl border border-slate-200 bg-white p-6">
<h2 class="text-sm font-semibold uppercase tracking-wide text-slate-500">Clinical notes</h2>
@if ($consultation->symptoms)
<p class="mt-4 text-sm"><span class="font-medium text-slate-700">Symptoms:</span> {{ $consultation->symptoms }}</p>
@endif
@if ($consultation->clinical_notes)
<p class="mt-2 whitespace-pre-wrap text-sm text-slate-600">{{ $consultation->clinical_notes }}</p>
@endif
</section>
@endif
@if ($consultation->diagnoses->isNotEmpty())
<section class="rounded-2xl border border-slate-200 bg-white p-6">
<h2 class="text-sm font-semibold uppercase tracking-wide text-slate-500">Diagnoses</h2>
<ul class="mt-4 space-y-2 text-sm">
@foreach ($consultation->diagnoses as $diagnosis)
<li>
<span class="font-medium">{{ $diagnosis->description }}</span>
@if ($diagnosis->code) <span class="text-slate-400">({{ $diagnosis->code }})</span> @endif
@if ($diagnosis->is_primary) <span class="text-sky-600">primary</span> @endif
</li>
@endforeach
</ul>
</section>
@endif
</div>
@endif
</x-app-layout>