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

    <style>
        .inputField input {
            height: auto;
            padding: 0.75rem 1.25rem;
        }
    </style>

    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <div class="container-fluid">
                <div class="row mb-2">
                    <div class="col-sm-6">
                        <h1>Sponsor Form</h1>
                    </div>
                    <div class="col-sm-6">
                        <ol class="breadcrumb float-sm-right">
                            <li class="breadcrumb-item"><a href="#">Home</a></li>
                            <li class="breadcrumb-item active">Sponsor Form</li>
                        </ol>
                    </div>
                </div>
            </div>
        </section>

        <section class="content">
            <div class="container-fluid">

                <div class="row">
                    <div class="col-md-12">
                        <a href="<?php echo e(route('admin.sponsors.index')); ?>" class="btn btn-primary mb-2 ">Back</a>

                        <form class="category-form" method="post"
                              action="<?php echo e(route('admin.sponsors.update', ['id' => $sponsor->id])); ?>"
                              enctype="multipart/form-data">

                            <?php echo csrf_field(); ?>
                            <div class="card card-primary">
                                <div class="card-body">
                                    <div class="tab-content ">
                                        <div class="tab-pane active" role="tabpanel" id="product">
                                            <h2>Sponsor Section</h2>
                                            <div class="row">

                                                <div class="col-md-6 mt-4">
                                                    <div class="inputField">
                                                        <label for="">Sponsor Link</label>
                                                        <input type="text" name="sponsor_link"
                                                               placeholder="https://www.global-man-cave.com"
                                                               class="form-control" required
                                                               value="<?php echo e($sponsor->sponsor_link ?? ''); ?>">
                                                        <?php $__errorArgs = ['sponsor_link'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                                        <div class="text-danger"><?php echo e($message); ?></div>
                                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                                    </div>
                                                </div>
                                                <div class="col-md-6 mt-4">
                                                    <div class="inputField">
                                                        <label for="">Begin Date</label>
                                                        <input type="date" name="begin_date" class="form-control"
                                                               value="<?php echo e(date('Y-m-d', strtotime($sponsor->begin_date ?? ''))); ?>">

                                                        <?php $__errorArgs = ['begin_date'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                                        <div class="text-danger"><?php echo e($message); ?></div>
                                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                                    </div>
                                                </div>

                                            </div>
                                            <div class="row">

                                                <div class="col-md-6 mt-4 add-old-first-image-input">
                                                    <div class="inputField">
                                                        <label for="sponsorImage">Sponsor Image</label><br>

                                                        <input type="file" class="form-control old-first-image"
                                                               name="sponsor_image" id="sponsorImage"
                                                               data-old_second_image="<?php echo e($sponsor->sponsor_image ?? ''); ?>"
                                                               value="<?php echo e($sponsor->sponsor_image ?? ''); ?>">

                                                        <img id="secondimagePreview"
                                                             src="<?php echo e(isset($sponsor->sponsor_image) ? asset('sponsor/'.$sponsor->sponsor_image) : asset('admin/dist/img/placeholder.png')); ?>"
                                                             alt="Profile Preview"
                                                             style="width: 300px; height: 200px; margin-top: 10px;">
                                                        <?php $__errorArgs = ['sponsor_image'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                                        <div class="text-danger"><?php echo e($message); ?></div>
                                                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                                                    </div>
                                                </div>


                                            </div>


                                        </div>
                                    </div>

                                </div>
                                <div class="card-footer text-center">
                                    <input type="submit" value="Submit" id="submit_btn" class="btn btn-primary">
                                </div>
                            </div>
                        </form>
                    </div>
                </div>

            </div>
        </section>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('script'); ?>
    <script>
        document.getElementById('sponsorImage').addEventListener('change', function (e) {
            var fileInput = e.target;
            var file = fileInput.files[0];

            if (file) {
                var reader = new FileReader();

                reader.onload = function (e) {
                    document.getElementById('secondimagePreview').src = e.target.result;
                };

                reader.readAsDataURL(file);
            }
        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/servicedemoweb/public_html/global-man-cave/resources/views/admin/sponsor/edit.blade.php ENDPATH**/ ?>