@php($dealer = $dealer ?? null)
<div class="grid grid-cols-2 gap-4">
    <div>
        <label class="block text-sm font-medium mb-1">Yetkili Ad Soyad</label>
        <input type="text" name="name" value="{{ old('name', $dealer?->user?->name) }}" required class="w-full border rounded px-3 py-2">
    </div>
    <div>
        <label class="block text-sm font-medium mb-1">E-posta</label>
        <input type="email" name="email" value="{{ old('email', $dealer?->user?->email) }}" required class="w-full border rounded px-3 py-2">
    </div>
    <div>
        <label class="block text-sm font-medium mb-1">Şifre {{ $dealer ? '(değiştirmek için doldurun)' : '' }}</label>
        <input type="password" name="password" class="w-full border rounded px-3 py-2" {{ $dealer ? '' : 'required' }}>
    </div>
    <div>
        <label class="block text-sm font-medium mb-1">Bayi Kodu</label>
        <input type="text" name="code" value="{{ old('code', $dealer?->code) }}" required class="w-full border rounded px-3 py-2">
    </div>
    <div class="col-span-2">
        <label class="block text-sm font-medium mb-1">Ticari Unvan</label>
        <input type="text" name="company_name" value="{{ old('company_name', $dealer?->company_name) }}" required class="w-full border rounded px-3 py-2">
    </div>
    <div>
        <label class="block text-sm font-medium mb-1">Telefon</label>
        <input type="text" name="phone" value="{{ old('phone', $dealer?->phone) }}" required class="w-full border rounded px-3 py-2">
    </div>
    <div>
        <label class="block text-sm font-medium mb-1">Bayi Tipi</label>
        <select name="type" class="w-full border rounded px-3 py-2">
            <option value="sales" @selected(old('type', $dealer?->type?->value)==='sales')>Satış Bayisi</option>
            <option value="content" @selected(old('type', $dealer?->type?->value)==='content')>İçerik Bayisi</option>
            <option value="sales_content" @selected(old('type', $dealer?->type?->value)==='sales_content')>Satış + İçerik</option>
        </select>
    </div>
    <div>
        <label class="block text-sm font-medium mb-1">İl</label>
        <input type="text" name="il" value="{{ old('il', $dealer?->il) }}" required class="w-full border rounded px-3 py-2">
    </div>
    <div>
        <label class="block text-sm font-medium mb-1">İlçe</label>
        <input type="text" name="ilce" value="{{ old('ilce', $dealer?->ilce) }}" required class="w-full border rounded px-3 py-2">
    </div>
    <div>
        <label class="block text-sm font-medium mb-1">Durum</label>
        <select name="status" class="w-full border rounded px-3 py-2">
            <option value="active" @selected(old('status', $dealer?->status ?? 'active')==='active')>Aktif</option>
            <option value="passive" @selected(old('status', $dealer?->status)==='passive')>Pasif</option>
        </select>
    </div>
    <div class="col-span-2">
        <label class="block text-sm font-medium mb-1">Notlar</label>
        <textarea name="notes" class="w-full border rounded px-3 py-2">{{ old('notes', $dealer?->notes) }}</textarea>
    </div>
</div>
