<div class="mx-auto max-w-7xl"><div class="grid gap-6 xl:grid-cols-[1fr_360px]"><section><div class="mb-5"><h2 class="font-display text-2xl font-extrabold">Services & Pricing</h2><p class="mt-2 text-sm text-slate-500">Control the patient service catalogue and default price points.</p></div><div class="overflow-hidden rounded-2xl border border-slate-100 bg-white shadow-card"><div class="overflow-x-auto"><table class="data-table w-full min-w-[720px]"><thead><tr class="border-b border-slate-100 bg-slate-50"><th class="px-5 py-3 text-left">Service</th><th class="px-5 py-3 text-left">Price</th><th class="px-5 py-3 text-left">Duration</th><th class="px-5 py-3 text-left">Status</th><th class="px-5 py-3 text-right">Action</th></tr></thead><tbody><?php foreach($rows as $r): ?><tr class="border-b border-slate-50"><td class="px-5 py-4"><div class="font-semibold"><?= esc($r['name']) ?></div><div class="mt-1 text-[11px] text-slate-400"><?= esc($r['slug']) ?></div></td><td class="px-5 py-4"><?= money($r['base_price']) ?></td><td class="px-5 py-4"><?= (int)$r['duration_minutes'] ?> min</td><td class="px-5 py-4"><span class="text-xs font-semibold <?= $r['is_active']?'text-emerald-600':'text-slate-400' ?>"><?= $r['is_active']?'Active':'Hidden' ?></span></td><td class="px-5 py-4 text-right"><form action="/admin/services/<?= $r['id'] ?>/toggle" method="post"><?= csrf_field() ?><button class="rounded-lg border border-slate-200 px-3 py-2 text-xs font-bold"><?= $r['is_active']?'Hide':'Enable' ?></button></form></td></tr><?php endforeach; ?></tbody></table></div></div></section><aside class="rounded-2xl border border-slate-100 bg-white p-5 shadow-card xl:sticky xl:top-28 xl:self-start"><h3 class="font-display text-lg font-extrabold">Add service</h3><?php if($errors=session()->getFlashdata('errors')): ?><div class="mt-4 rounded-xl bg-rose-50 p-3 text-xs text-rose-700"><?php foreach($errors as $e): ?><div><?= esc($e) ?></div><?php endforeach; ?></div><?php endif; ?><form action="/admin/services" method="post" class="mt-5 space-y-3"><?= csrf_field() ?><input name="name" required class="w-full rounded-xl border border-slate-200 px-3 py-2.5 text-sm" placeholder="Service name"><input name="slug" required pattern="[a-z0-9-]+" class="w-full rounded-xl border border-slate-200 px-3 py-2.5 text-sm" placeholder="service-slug"><textarea name="description" class="min-h-20 w-full rounded-xl border border-slate-200 px-3 py-2.5 text-sm" placeholder="Description"></textarea><div class="grid grid-cols-2 gap-2"><input name="base_price" type="number" min="0" step="0.01" required class="rounded-xl border border-slate-200 px-3 py-2.5 text-sm" placeholder="KES price"><input name="duration_minutes" type="number" min="1" required value="45" class="rounded-xl border border-slate-200 px-3 py-2.5 text-sm" placeholder="Minutes"></div><input name="sort_order" type="number" value="10" class="w-full rounded-xl border border-slate-200 px-3 py-2.5 text-sm" placeholder="Sort order"><button class="w-full rounded-xl bg-teal-600 px-4 py-3 text-sm font-extrabold text-white">Save service</button></form></aside></div></div>
