Replace teal-brand→primary, teal-dark→primary-dark, teal-light→primary-light, gray-soft→gray-200, gray-brand→gray-900 across 53 files. Fixes theming not applying — colors now use CSS custom properties from org_config. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
88 lines
4.1 KiB
Svelte
88 lines
4.1 KiB
Svelte
<script lang="ts">
|
|
import { enhance } from '$app/forms';
|
|
let { data, form } = $props();
|
|
const vet = $derived(data.vet);
|
|
let submitting = $state(false);
|
|
let showSuccess = $state(false);
|
|
|
|
function handleEnhance() {
|
|
submitting = true;
|
|
return async ({ update, result }: { update: (opts?: { reset?: boolean }) => Promise<void>; result: { type: string } }) => {
|
|
submitting = false;
|
|
await update({ reset: false });
|
|
if (result.type === 'success') { showSuccess = true; setTimeout(() => showSuccess = false, 3000); }
|
|
};
|
|
}
|
|
|
|
const inputClass = 'w-full px-3 py-2.5 rounded-lg border border-gray-200 bg-white text-gray-900 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary text-sm';
|
|
const labelClass = 'block text-sm font-medium text-gray-700 mb-1';
|
|
</script>
|
|
|
|
<svelte:head><title>{vet.name} — Admin</title></svelte:head>
|
|
|
|
<div>
|
|
<div class="flex items-center gap-4 mb-6">
|
|
<a href="/admin/vets" class="text-gray-400 hover:text-gray-600 transition-colors">
|
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" /></svg>
|
|
</a>
|
|
<div>
|
|
<h1 class="text-2xl font-bold text-gray-900">{vet.name}</h1>
|
|
{#if vet.clinic}<p class="text-sm text-gray-500">{vet.clinic}</p>{/if}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-6 p-4 bg-blue-50 border border-blue-200 rounded-xl text-sm text-blue-700 flex items-center gap-2">
|
|
<svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>
|
|
{data.petCount} pet record{data.petCount !== 1 ? 's' : ''} assigned to this vet
|
|
</div>
|
|
|
|
{#if showSuccess}
|
|
<div class="mb-6 p-4 bg-green-50 border border-green-200 rounded-xl text-sm text-green-700 flex items-center gap-2">
|
|
<svg class="w-4 h-4 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" /></svg>
|
|
Vet updated successfully.
|
|
</div>
|
|
{/if}
|
|
|
|
{#if form?.error}
|
|
<div class="mb-6 p-4 bg-red-50 border border-red-200 rounded-xl text-sm text-red-700">{form.error}</div>
|
|
{/if}
|
|
|
|
<form method="POST" use:enhance={handleEnhance} class="space-y-6">
|
|
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
|
|
<h2 class="text-lg font-semibold text-gray-900 mb-4">Vet Information</h2>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<label for="name" class={labelClass}>Name <span class="text-red-500">*</span></label>
|
|
<input type="text" id="name" name="name" required value={vet.name} class={inputClass} />
|
|
</div>
|
|
<div>
|
|
<label for="clinic" class={labelClass}>Clinic</label>
|
|
<input type="text" id="clinic" name="clinic" value={vet.clinic ?? ''} class={inputClass} />
|
|
</div>
|
|
<div>
|
|
<label for="phone" class={labelClass}>Phone</label>
|
|
<input type="tel" id="phone" name="phone" value={vet.phone ?? ''} class={inputClass} />
|
|
</div>
|
|
<div>
|
|
<label for="email" class={labelClass}>Email</label>
|
|
<input type="email" id="email" name="email" value={vet.email ?? ''} class={inputClass} />
|
|
</div>
|
|
<div class="md:col-span-2">
|
|
<label for="address" class={labelClass}>Address</label>
|
|
<textarea id="address" name="address" rows="2" class="{inputClass} resize-y">{vet.address ?? ''}</textarea>
|
|
</div>
|
|
<div class="md:col-span-2">
|
|
<label for="notes" class={labelClass}>Notes</label>
|
|
<textarea id="notes" name="notes" rows="3" class="{inputClass} resize-y">{vet.notes ?? ''}</textarea>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="flex justify-end gap-3">
|
|
<a href="/admin/vets" class="px-6 py-2.5 text-sm font-medium rounded-lg border border-gray-200 text-gray-900 hover:bg-gray-100 transition-colors">Cancel</a>
|
|
<button type="submit" disabled={submitting} class="px-6 py-2.5 text-sm font-medium rounded-lg bg-primary text-white hover:bg-primary-dark transition-colors disabled:opacity-50 cursor-pointer">
|
|
{submitting ? 'Saving...' : 'Save Changes'}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|