<?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><!-- /.container-fluid -->
        </section>
        <!-- /.content-header -->

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

                <div class="row">
                    <!-- left column -->
                    <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.store')); ?>"
                              enctype="multipart/form-data">
                        <?php echo csrf_field(); ?>
                        <!-- general form elements -->
                            <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" value="" required>
                                                        <?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 $__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">

                                                    <div class="inputField">
                                                        <label for="sponsorImage">Sponsor Image</label><br>

                                                        <input type="file" class="form-control old-first-image"
                                                               name="sponsor_image" id="sponsorImage"
                                                               required>

                                                        <img id="preview_sponsorImage"
                                                             src=""
                                                             alt="Profile Preview"
                                                             style="width: 300px;height: 200px;margin-top: 10px;">
                                                    </div>
                                                    <?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 class="card-footer text-center">
                                    <input type="submit" value="Submit" id="submit_btn" class="btn btn-primary">
                                </div>
                            </div>
                        </form>
                        <!-- /.card -->
                    </div>
                </div>


            </div>
        </section>
    </div>
<?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 userImageInput = document.getElementById('sponsorImage');
        userImageInput.addEventListener('change', function () {
            showImagePreview(this, 'preview_sponsorImage');
        });
        $(document).on('click', '.old-second-image', function () {
            var oldImage = $(this).data('old_second_image');
            console.log(oldImage);
            $('<input>').attr({
                type: 'hidden',
                name: 'old_second_image',
                value: oldImage
            }).appendTo('.add-old-second-image-input');


        });
    </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/create.blade.php ENDPATH**/ ?>