@extends('component.app')
@section('title', 'Edit Admin')
@section('active4', 'active')
@section('content')

    <div class="content-wrapper">
        <div class="container-xxl flex-grow-1 container-p-y">
            <!-- Invoice List Table -->
            <div class="card">
                <div class="header-menu d-flex justify-content-between align-items-center">
                    <h3 class="card-header">Edit Data Admin</h3>
                    <form action="{{ route('admin.update', $data->id) }}" method="POST" enctype="multipart/form-data">
                        @csrf
                        <button type="submit" class="btn btn-primary me-2" data-bs-toggle="modal"
                            data-bs-target="#staticBackdrop"><i class="bx bx-save bx-sm"></i> Simpan</button>
                </div>
                <div class="card-body">
                    <div class="row">
                        <!-- Kolom Kiri -->
                        <div class="col-md-6">
                            <!-- Laundry -->
                            <div class="mb-3">
                                <label for="laundry_id" class="form-label">Data Laundry</label>
                                <input type="text" class="form-control bg-light"
                                    value="{{ $data->laundry->nama_laundry }} - {{ $data->laundry->email }}" readonly>
                                <input type="text" class="form-control" id="laundry_id" name="laundry_id"
                                    value="{{ $data->laundry_id }}" hidden required>
                                {{-- <select id="laundry_id" name="laundry_id" class="form-select" required>
                                    <option value="{{ $data->laundry_id }}">{{ $data->laundry->nama_laundry }}</option>
                                    <option value="">Pilih Laundry</option>
                                    @foreach ($laundry as $laundry)
                                        <option value="{{ $laundry->id }}">{{ $laundry->nama_laundry }}
                                        </option>
                                    @endforeach
                                </select> --}}
                            </div>
                            <!-- Username -->
                            <div class="mb-3">
                                <label for="username" class="form-label">Username</label>
                                <input type="text" class="form-control" id="username" name="username"
                                    placeholder="Masukkan Username" value="{{ $data->user->username }}" required>
                            </div>

                            <!-- Email -->
                            <div class="mb-3">
                                <label for="email" class="form-label">Email</label>
                                <input type="email" class="form-control" id="email" name="email"
                                    placeholder="Masukkan Email" value="{{ $data->user->email }}" required>
                            </div>

                            <!-- Password -->
                            <div class="mb-3">
                                <label for="password" class="form-label">Password</label>
                                <input type="password" class="form-control" id="password" name="password"
                                    placeholder="Masukkan Password">
                                <span class="text-danger">*Isi jika ingin perbarui password</span>
                            </div>

                            <!-- Phone -->
                            <div class="mb-3">
                                <label for="phone" class="form-label">No. Telp</label>
                                <input type="text" class="form-control" id="phone" name="phone"
                                    placeholder="Masukkan No. Telp" value="{{ $data->user->phone }}" required>
                            </div>
                        </div>

                        <!-- Kolom Kanan -->
                        <div class="col-md-6">
                            <!-- Nama -->
                            <div class="mb-3">
                                <label for="nama" class="form-label">Nama</label>
                                <input type="text" class="form-control" id="nama" name="nama"
                                    placeholder="Masukkan Nama" value="{{ $data->nama }}" required>
                            </div>

                            <!-- Alamat -->
                            <div class="mb-3">
                                <label for="alamat" class="form-label">Alamat</label>
                                <textarea class="form-control" id="alamat" name="alamat" placeholder="Masukkan Alamat" rows="3" required>{{ $data->alamat }}</textarea>
                            </div>

                            <!-- Foto -->
                            <div class="mb-3">
                                <label for="foto" class="form-label">Foto</label>
                                <input type="file" class="form-control" id="foto" name="foto">
                                <span class="text-danger">*Isi jika ingin perbarui foto</span>
                            </div>

                            <div class="mb-3">
                                <img src="{{ asset('storage/img/' . $data->foto) }}"
                                    class="img-preview img-fluid mb-3 col-sm-5" alt="">
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>

@endsection
