
<?php $__env->startSection('title'); ?>
    <?php echo e(__('Hero Section')); ?>

<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
    <div class="main-content">
        <div class="page-title">
            <div class="container-fluid">
                <div class="row justify-content-center">
                    <div class="col-xl-12">
                        <div class="title-content">
                            <h2 class="title"><?php echo e(__('Hero Section')); ?></h2>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="site-tab-bars">
            <ul class="nav nav-pills" id="pills-tab" role="tablist">
                <?php $__currentLoopData = $languages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $language): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <li class="nav-item" role="presentation">
                        <a href="" class="nav-link  <?php echo e($loop->index == 0 ? 'active' : ''); ?>"
                            id="pills-informations-tab" data-bs-toggle="pill" data-bs-target="#<?php echo e($language->locale); ?>"
                            type="button" role="tab" aria-controls="pills-informations" aria-selected="true"><i
                                data-lucide="languages"></i><?php echo e($language->name); ?></a>
                    </li>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </ul>
        </div>

        <div class="tab-content" id="pills-tabContent">

            <?php $__currentLoopData = $groupData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php
                    $data = new Illuminate\Support\Fluent($value);
                ?>

                <div class="tab-pane fade <?php echo e($loop->index == 0 ? 'show active' : ''); ?>" id="<?php echo e($key); ?>"
                    role="tabpanel" aria-labelledby="pills-informations-tab">
                    <div class="site-card">
                        <div class="site-card-header">
                            <h3 class="title"><?php echo e(__('Contents')); ?></h3>
                        </div>
                        <div class="site-card-body">
                            <form action="<?php echo e(route('admin.page.section.section.update')); ?>" method="post"
                                enctype="multipart/form-data">
                                <?php echo csrf_field(); ?>
                                <input type="hidden" name="section_code" value="hero">
                                <input type="hidden" name="section_locale" value="<?php echo e($key); ?>">
                                <?php if($key == 'en'): ?>
                                    <div class="site-input-groups row">
                                        <label for=""
                                            class="col-sm-3 col-label pt-0"><?php echo e(__('Section Visibility')); ?><i
                                                data-lucide="info" data-bs-toggle="tooltip" title=""
                                                data-bs-original-title="Manage Section Visibility"></i></label>
                                        <div class="col-sm-3">
                                            <div class="site-input-groups">
                                                <div class="switch-field">
                                                    <input type="radio" id="active" name="status"
                                                        <?php if($status): ?> checked <?php endif; ?> value="1" />
                                                    <label for="active"><?php echo e(__('Show')); ?></label>
                                                    <input type="radio" id="deactivate" name="status"
                                                        <?php if(!$status): ?> checked <?php endif; ?> value="0" />
                                                    <label for="deactivate"><?php echo e(__('Hide')); ?></label>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                <?php endif; ?>
                                <div class="site-input-groups row">
                                    <label for="" class="col-sm-3 col-label"><?php echo e(__('Hero Title')); ?></label>
                                    <div class="col-sm-9">
                                        <input type="text" name="hero_title" class="box-input"
                                            value="<?php echo e($data->hero_title); ?>">
                                    </div>
                                </div>
                                <div class="site-input-groups row">
                                    <label for="" class="col-sm-3 col-label"><?php echo e(__('Description')); ?></label>
                                    <div class="col-sm-9">
                                        <input type="text" name="sub_title" class="box-input"
                                            value="<?php echo e($data->sub_title); ?>">
                                    </div>
                                </div>
                                <div class="site-input-groups row">
                                    <label for="" class="col-sm-3 col-label"><?php echo e(__('Hero Button')); ?><i
                                            data-lucide="info" data-bs-toggle="tooltip" title=""
                                            data-bs-original-title="Leave it blank if you don't need this button"></i></label>
                                    <div class="col-sm-9">
                                        <div class="form-row">
                                            <div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12">
                                                <div class="site-input-groups">
                                                    <label for=""
                                                        class="box-input-label"><?php echo e(__('Title')); ?></label>
                                                    <input type="text" name="hero_button_level" class="box-input"
                                                        value="<?php echo e($data->hero_button_level); ?>">
                                                </div>
                                            </div>
                                            <div class="col-xl-6 col-lg-6 col-md-6 col-sm-12 col-12">
                                                <div class="site-input-groups">
                                                    <label for=""
                                                        class="box-input-label"><?php echo e(__('Video URL')); ?></label>
                                                    <div class="site-input-groups">
                                                        <div class="site-input-groups">
                                                            <input type="text" name="hero_button_url"
                                                                class="box-input" value="<?php echo e($data->hero_button_url); ?>">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="site-input-groups row">
                                    <div class="col-xl-3 col-lg-3 col-md-3 col-sm-12 col-label">
                                        <?php echo e(__('Banner Image')); ?></label>
                                    </div>
                                    <div class="col-xl-9 col-lg-9 col-md-9 col-sm-12">
                                        <div class="wrap-custom-file">
                                            <input type="file" name="banner_image" id="banner_image"
                                                accept=".gif, .jpg, .png" />
                                            <label for="banner_image" id="banner_image"
                                                <?php if($data->banner_image): ?> class="file-ok"
                                                   style="background-image: url(<?php echo e(asset($data->banner_image)); ?>)" <?php endif; ?>>
                                                <img class="upload-icon" src="<?php echo e(asset('global/materials/upload.svg')); ?>"
                                                    alt="" />
                                                <span><?php echo e(__('Update Banner')); ?></span>
                                            </label>
                                            <?php $isHidden = $data->banner_image; $img_field = 'banner_image'; ?>
            <div data-des="<?php echo $img_field; ?>" <?php if(!$isHidden) echo 'hidden'; ?> class="close remove-img <?php echo $img_field; ?>"><i data-lucide="x"></i></div>
                                        </div>
                                    </div>
                                </div>

                                <div class="site-input-groups row">
                                    <label for="" class="col-sm-3 col-label"><?php echo e(__('Social Links')); ?><i
                                            data-lucide="info" data-bs-toggle="tooltip" title=""
                                            data-bs-original-title="Leave it blank if you don't need this button"></i></label>
                                    <div class="col-sm-9">
                                        <div class="form-row">
                                            <div class="col-xl-4 col-lg-6 col-md-6 col-sm-12 col-12">
                                                <div class="site-input-groups">
                                                    <label for="" class="box-input-label"><?php echo e(__('Facebook')); ?>

                                                    </label>
                                                    <input type="text" name="fb" class="box-input"
                                                        value="<?php echo e($data->fb); ?>">
                                                </div>
                                            </div>
                                            <div class="col-xl-4 col-lg-6 col-md-6 col-sm-12 col-12">
                                                <div class="site-input-groups">
                                                    <label for=""
                                                        class="box-input-label"><?php echo e(__('Linkedin')); ?></label>
                                                    <input type="text" name="linkedin" class="box-input"
                                                        value="<?php echo e($data->linkedin); ?>">
                                                </div>
                                            </div>
                                            <div class="col-xl-4 col-lg-6 col-md-6 col-sm-12 col-12">
                                                <div class="site-input-groups">
                                                    <label for="" class="box-input-label"><?php echo e(__('Twitter')); ?>

                                                    </label>
                                                    <input type="text" name="x" class="box-input"
                                                        value="<?php echo e($data->x); ?>">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="site-input-groups row">
                                    <label for="" class="col-sm-3 col-label"><?php echo e(__('Bubble Counter')); ?></label>
                                    <div class="col-sm-9">
                                        <input type="text" name="bubble_counter" class="box-input"
                                            value="<?php echo e($data->bubble_counter); ?>">
                                    </div>
                                </div>

                                <div class="site-input-groups row">
                                    <label for="" class="col-sm-3 col-label"><?php echo e(__('Bubble Text')); ?></label>
                                    <div class="col-sm-9">
                                        <input type="text" name="bubble_text" class="box-input"
                                            value="<?php echo e($data->bubble_text); ?>">
                                    </div>
                                </div>

                                <?php
                                    $user_photos = json_decode($data->user_photos, true);
                                ?>

                                <input type="hidden" name="deleted[user_photos]" id="deleted_images" value="">
                                <div class="site-input-groups row" id="galleries-section">
                                    <label for=""
                                        class="col-sm-3 col-label"><?php echo e(__('Bubble User Photos')); ?></label>
                                    <div class="col-sm-9">
                                        <div class="row gallery-group gallery-items">
                                            <?php $__currentLoopData = $user_photos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $photo): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <div class="col-xl-3 gallery-item">
                                                    <div class="wrap-custom-file">
                                                        <input type="file" name="user_photos[]"
                                                            id="galleries<?php echo e($loop->iteration); ?>"
                                                            accept=".gif, .jpg, .png" />
                                                        <label for="galleries<?php echo e($loop->iteration); ?>" class="file-ok"
                                                            style="background-image: url(<?php echo e(asset($photo)); ?>)">
                                                            <img class="upload-icon"
                                                                src="<?php echo e(asset('global/materials/upload.svg')); ?>"
                                                                alt="" />
                                                            <span><?php echo e(__('Upload Photo')); ?></span>
                                                        </label>
                                                        <div class="close" id="remove-btn"
                                                            data-gallery-url="<?php echo e($photo); ?>">
                                                            <i data-lucide="x"></i>
                                                        </div>
                                                    </div>
                                                </div>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </div>
                                        <button type="button" class="site-btn-sm primary-btn mt-3"
                                            id="add-more-galleries">
                                            <i data-lucide="plus-circle"></i>
                                            <?php echo e(__('Add More')); ?>

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

                                <div class="site-input-groups row">
                                    <label for="" class="col-sm-3 col-label"><?php echo e(__('Brand Title')); ?></label>
                                    <div class="col-sm-9">
                                        <input type="text" name="company_title" class="box-input"
                                            value="<?php echo e($data->company_title); ?>">
                                    </div>
                                </div>

                                <div class="row">
                                    <div class="offset-sm-3 col-sm-9">
                                        <button type="submit"
                                            class="site-btn-sm primary-btn w-100"><?php echo e(__('Save Changes')); ?></button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
        <?php
            $brandContents = \App\Models\LandingContent::where('type', 'brands')
                ->where('locale', app()->getLocale())
                ->get();
        ?>
        <div class="site-card">
            <div class="site-card-header">
                <h3 class="title"><?php echo e(__('Brand Images')); ?></h3>
                <div class="card-header-links">
                    <a href="" class="card-header-link" type="button" data-bs-toggle="modal"
                        data-bs-target="#addNew"><?php echo e(__('Add New')); ?></a>
                </div>
            </div>
            <div class="site-card-body">
                <div class="site-table table-responsive">
                    <table class="table">
                        <thead>
                            <tr>
                                <th scope="col"><?php echo e(__('Image')); ?></th>
                                <th scope="col"><?php echo e(__('Action')); ?></th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = $brandContents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $content): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td>
                                        <img class="avatar" src="<?php echo e(asset($content->photo)); ?>" alt="">
                                    </td>
                                    <td>
                                        <button class="round-icon-btn primary-btn editContent" type="button"
                                            data-id="<?php echo e($content->id); ?>">
                                            <i data-lucide="edit-3"></i>
                                        </button>
                                        <button class="round-icon-btn red-btn deleteContent" type="button"
                                            data-id="<?php echo e($content->id); ?>">
                                            <i data-lucide="trash-2"></i>
                                        </button>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <!-- Modal for Add New  -->
    <?php echo $__env->make('backend.page.default.section.include.__add_new_brands_image', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <!-- Modal for Add New End -->

    <!-- Modal for Edit -->
    <?php echo $__env->make('backend.page.default.section.include.__edit_brands_image', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <!-- Modal for Edit  End-->

    <!-- Modal for Delete  -->
    <?php echo $__env->make('backend.page.default.section.include.__delete_hero_image', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <!-- Modal for Delete  End-->
<?php $__env->stopSection(); ?>

<?php $__env->startSection('script'); ?>
    <script>
        document.getElementById('add-more-galleries').addEventListener('click', function() {
            const galleriesSection = document.querySelector('#galleries-section .gallery-group');
            const galleryCount = galleriesSection.querySelectorAll('.gallery-item').length;

            const newGalleryInput = `
                <div class="col-xl-3 gallery-item">
                    <div class="wrap-custom-file">
                            <input type="file" name="user_photos[]" id="galleries${galleryCount + 1}" accept=".gif, .jpg, .png" required />
                            <label for="galleries${galleryCount + 1}">
                                <img class="upload-icon" src="<?php echo e(asset('global/materials/upload.svg')); ?>" alt="" />
                                <span><?php echo e(__('Upload Photo')); ?></span>
                            </label>
                            <div class="close" id="remove-btn">
                                <i data-lucide="x"></i>
                            </div>
                        </div>
                </div>`;

            galleriesSection.insertAdjacentHTML('beforeend', newGalleryInput);
            imagePreview();
            lucide.createIcons();
        });

        $(document).on('click', '#remove-btn', function() {

            // Remove gallery url store in deleted_images hidden innput
            const deletedImages = document.getElementById('deleted_images');
            const galleryUrl = $(this).data('gallery-url');

            if (galleryUrl) {
                let deletedImagesArray = [];
                if (deletedImages.value) {
                    deletedImagesArray = JSON.parse(deletedImages.value);
                }
                deletedImagesArray.push(galleryUrl);
                deletedImages.value = JSON.stringify(deletedImagesArray);
            }

            $(this).closest('.gallery-item').remove();
        });

        $('.editContent').on('click', function(e) {
            "use strict";
            e.preventDefault();
            var id = $(this).data('id');

            var url = '<?php echo e(route('admin.page.content-edit', ':id')); ?>';
            url = url.replace(':id', id);

            $.ajax({
                url: url,
                type: 'GET',
                success: function(response) {
                    // Handle the response HTML
                    $('#target-element').html(response.html);
                    $('#editContent').modal('show');
                    initIconType();
                },
                error: function(xhr) {
                    // Handle any errors that occurred during the request
                    console.log(xhr.responseText);
                }
            });
        });

        $('.deleteContent').on('click', function(e) {
            "use strict";
            e.preventDefault();
            var id = $(this).data('id');
            $('#deleteId').val(id);
            $('#deleteContent').modal('show');
        });

        $('#iconType').on('change', function() {
            const iconType = $(this).val();

            if (iconType == 'class') {
                $('#classField').removeClass('d-none');
                $('#imageField').addClass('d-none');
            } else {
                $('#imageField').removeClass('d-none')
                $('#classField').addClass('d-none');
            }
        });

        function initIconType() {
            const editIconType = $('#editIconTypes').val();

            if (editIconType == 'class') {
                $('#editClassField').removeClass('d-none');
                $('#editImageField').addClass('d-none');
            } else {
                $('#editImageField').removeClass('d-none')
                $('#editClassField').addClass('d-none');
            }
        }
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('backend.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /www/wwwroot/mxawfis.atharvatek.com/resources/views/backend/page/spaceify/section/hero.blade.php ENDPATH**/ ?>