<?php $__env->startSection('title'); ?> Admin-Profile
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
    <style>
        .active {
            background-color: #007BFF !important;
            color: white !important;
        }
    </style>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Main content -->
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-12">

                        <div class="card card-box-shadow mt-5">

                            <div class="card-header">
                                <h3 class="card-title">Admin Profile Update</h3>
                            </div>
                            <!-- /.card-header -->
                            <div class="card-body">
                                <form action="<?php echo e(route('admin.profile.update')); ?>" method="POST"
                                      enctype="multipart/form-data">
                                    <?php echo csrf_field(); ?>

                                    <div class="row">

                                    <input type='hidden' value='<?php echo e(Auth::user()->id); ?>' name='admin_id'>
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <label for="Name">First Name:</label>
                                                <input type="text" class="form-control form__field" name="first_name"
                                                       value="<?php echo e(Auth::user()->first_name); ?>"placeholder="Enter First Name"></div>
                                        </div>

                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <label for="Name">Last Name:</label>
                                                <input type="text" class="form-control form__field" name="last_name"
                                                       value="<?php echo e(Auth::user()->last_name); ?>"placeholder="Enter Last Name"></div>
                                        </div>

                                        <div class="col-md-12">
                                            <div class="form-group">
                                                <label for="Name">Email:</label>
                                                <input type="email" class="form-control" name="email"
                                                       placeholder="Enter Name" id="Name" style="min-height: 50px;padding: 14px;border-radius: 20px;"
                                                       value="<?php echo e(Auth::user()->email); ?>" readonly ></div>
                                        </div>



                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <label for="Name">Address:</label>
                                                <input type="text" class="form-control form__field" name="address"
                                                       value="<?php echo e(Auth::user()->address); ?>"placeholder="Enter Address"></div>
                                        </div>


                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <label for="Name">Phone Number:</label>
                                                <input type="text" class="form-control form__field" name="phone_number"
                                                       value="<?php echo e(Auth::user()->phone_number); ?>"placeholder="Enter Phone Number"oninput="this.value = this.value.replace(/[^0-9]/g, '')"></div>
                                        </div>


                                        <div class="col-md-12">
                                            <div class="form-group">
                                                <label for="userProfileImageInput">Choose Profile:</label>
                                                <input type="file" class="form-control form__field visually-hidden" name="admin_image"
                                                       id="userProfileImageInput"accept="image/*">
                                                <label for="userProfileImageInput" class="file-input-label form__field form-control">
                                                    <i class="fas fa-camera"></i> Choose file
                                                </label>
                                                <small
                                                    class='text-danger'><?php $__errorArgs = ['admin_profile'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> <?php echo e($message); ?> <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?></small>
                                            </div>
                                        </div>

                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <img id="userProfileImagePreview"
                                                     src="<?php echo e((Auth::user()->getFirstMediaUrl('admin_image') ?? '')); ?>"
                                                     alt="Profile Preview"
                                                     style="width: 200px; height: 150px; margin-top: 10px;">
                                            </div>
                                        </div>
                                    </div>


                                    <div class="text-center mb-2">
                                        <button id="submit_btn" class="btn btn-primary custom_btn" type="submit">
                                            <i class="fa-solid fa-cloud-arrow-up"></i> Submit
                                        </button>
                                    </div>

                                </form>

                            </div>
                            <!-- /.card-body -->
                        </div>

                    </div>
                    <!-- /.col -->
                </div>
                <!-- /.row -->
            </div>
            <!-- /.container-fluid -->
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
<?php $__env->stopSection(); ?>

<?php $__env->startSection('script'); ?>
    <script>

        function showImagePreview(input, previewId) {
            const preview = document.getElementById(previewId);

            if (input.files && input.files[0]) {
                const reader = new FileReader();

                reader.onload = function (e) {
                    preview.src = e.target.result;
                    preview.style.display = 'block';
                };

                reader.readAsDataURL(input.files[0]);
            }
        }

        const imageInput = document.getElementById('userProfileImageInput');
        imageInput.addEventListener('change', function () {
            showImagePreview(this, 'userProfileImagePreview');
        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin-layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/vagrant/projects/upsence/resources/views/admin/pages/profile.blade.php ENDPATH**/ ?>