@extends('layouts.app')

@section('content')
<!-- Background seluruh halaman -->
<div style="background-color: #e0e0e0; width: 100%; min-height: 100vh; border-radius: 15px; padding: 1rem;">

    <!-- Header -->
    <div style="background-color: #000; color: #fff; padding: 0.1rem; border-radius: 0.5rem;">
        <h1 class="m-0">Edit Akun Admin</h1>
    </div>

    <!-- Form Edit Admin -->
    <div class="container mt-4">
        <div class="card p-4 border border-secondary" style="border-radius: 15px; background-color: #fff;">
            <form action="{{ route('admin.update', $admin->id) }}" method="POST">
                @csrf
                @method('PUT')

                <!-- Input Nama -->
                <div class="mb-3">
                    <label for="name" class="form-label">Nama</label>
                    <input type="text" name="name" class="form-control" id="name" value="{{ old('name', $admin->name) }}" required>
                </div>

                <!-- Input Email -->
                <div class="mb-3">
                    <label for="email" class="form-label">Email</label>
                    <input type="email" name="email" class="form-control" id="email" value="{{ old('email', $admin->email) }}" required>
                </div>

                <!-- Dropdown Tipe Pengguna -->
                <div class="mb-3">
                    <label for="tipe_pengguna" class="form-label">Tipe Pengguna</label>
                    <select name="tipe_pengguna" id="tipe_pengguna" class="form-control" required>
                        <option value="admin" {{ old('tipe_pengguna', $admin->tipe_pengguna) == 'admin' ? 'selected' : '' }}>Admin</option>
                        <option value="user" {{ old('tipe_pengguna', $admin->tipe_pengguna) == 'user' ? 'selected' : '' }}>Pengguna</option>
                    </select>
                </div>

                <!-- Tombol Kembali dan Update -->
                <div class="d-flex justify-content-between">
                    <a href="{{ route('admin.index') }}" class="btn btn-secondary">Kembali</a>
                    <button class="btn btn-success">Update</button>
                </div>
            </form>
        </div>
    </div>
</div>
@endsection
