'use client' import { useState } from 'react' import { useRouter } from 'next/navigation' import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/card' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import Link from 'next/link' import { ArrowLeft } from 'lucide-react' export default function NewClientPage() { const router = useRouter() const [loading, setLoading] = useState(false) const [error, setError] = useState('') const [form, setForm] = useState({ name: '', semaphoreKey: '', senderName: 'NFC-HUB', }) async function handleSubmit(e: React.FormEvent) { e.preventDefault() setLoading(true) setError('') const res = await fetch('/api/clients', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(form), }) if (res.ok) { router.push('/dashboard/clients') } else { const data = await res.json() setError(data.error || 'Failed to create client') setLoading(false) } } return (

Add Client

Register a new school or organization

Client Details Each client gets a unique API key for their on-premise NFC attendance app.
{error && (
{error}
)}
setForm(f => ({ ...f, name: e.target.value }))} placeholder="e.g. San Jose Elementary School" required />
setForm(f => ({ ...f, semaphoreKey: e.target.value }))} placeholder="Your Semaphore API key" />

You can add this later in client settings.

setForm(f => ({ ...f, senderName: e.target.value }))} placeholder="NFC-HUB" maxLength={11} />

Max 11 characters. Must be registered with Semaphore.

) }