@extends('admin.layouts.app')

@section('content')
<div class="max-w-md mx-auto bg-white rounded-xl shadow p-6">

    <h1 class="text-2xl font-black mb-6 text-center">Edit Admin</h1>

    <form action="{{ route('admin.admins.update', $admin->id) }}" method="POST" class="space-y-4">
        @csrf
        @method('PUT')

        <div>
            <label class="block font-bold mb-1">Nama</label>
            <input type="text" name="name"
                   value="{{ $admin->name }}"
                   class="w-full border rounded px-3 py-2"
                   required>
        </div>

        <div>
            <label class="block font-bold mb-1">Email</label>
            <input type="email" name="email"
                   value="{{ $admin->email }}"
                   class="w-full border rounded px-3 py-2"
                   required>
        </div>

        <div>
            <label class="block font-bold mb-1">Password (opsional)</label>
            <input type="password" name="password"
                   class="w-full border rounded px-3 py-2"
                   placeholder="Kosongkan jika tidak diubah">
        </div>

        <div class="flex gap-3 pt-4">
            <a href="{{ route('admin.admins.index') }}"
               class="w-1/2 text-center bg-gray-400 text-white py-2 rounded font-bold hover:bg-gray-500">
                Cancel
            </a>

            <button type="submit"
                    class="w-1/2 bg-blue-600 text-white py-2 rounded font-bold hover:bg-blue-700">
                Update
            </button>
        </div>
    </form>

</div>
@endsection
