@extends('admin.template')

@section('content')
    <div class="content-wrapper">
        <div class="row">
            <div class="col-md-12 grid-margin stretch-card">
                <div class="card">
                    <div class="card-body">
                        <h4 class="card-title">Profil Admin</h4>

                        @if (session('success'))
                            <div class="alert alert-success">
                                {{ session('success') }}
                            </div>
                        @endif

                        <form action="{{ route('admin.profil.update') }}" method="POST">
                            @csrf

                            <div class="form-group">
                                <label>Nama</label>
                                <input type="text" name="name" class="form-control" value="{{ $admin->name }}"
                                    required>
                            </div>

                            <div class="form-group">
                                <label>Username</label>
                                <input type="text" name="username" class="form-control" value="{{ $admin->username }}"
                                    required>
                            </div>

                            <div class="form-group">
                                <label>Role</label>
                                <input type="text" class="form-control" value="{{ $admin->role }}" disabled>
                            </div>

                            <hr>

                            <div class="form-group">
                                <label>Password Baru (opsional)</label>
                                <input type="password" name="password" class="form-control"
                                    placeholder="Kosongkan jika tidak diganti">
                            </div>

                            <div class="form-group">
                                <label>Konfirmasi Password</label>
                                <input type="password" name="password_confirmation" class="form-control">
                            </div>

                            <button type="submit" class="btn btn-primary">
                                Simpan
                            </button>
                            <a href="{{ url()->previous() }}" class="btn btn-light ml-2">
                                Batal
                            </a>
                        </form>

                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
