<?php $__env->startSection('additional-css'); ?>
    <!-- [Page specific CSS] start -->
    <link rel="stylesheet" href="<?php echo e(asset('assets/admin/css/plugins/datepicker-bs5.min.css')); ?>">
<?php $__env->stopSection(); ?>
<?php $__env->startSection('main-content'); ?>
    <?php echo $__env->make('backend.our-project.our-project.partials.add', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
    <?php echo $__env->make('backend.our-project.our-project.partials.view', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
    <div class="pc-container">
        <div class="pc-content">
            <!-- [ breadcrumb ] start -->
            <div class="page-header">
                <div class="page-block">
                    <div class="row align-items-center">
                        <div class="col-md-12">
                            <ul class="breadcrumb">
                                <li class="breadcrumb-item"><a href="<?php echo e(route('admin.dashboard')); ?>">Home</a></li>
                                <li class="breadcrumb-item" aria-current="page"><?php echo e(@$title); ?></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12">
                    <div class="card">
                        <div class="card-header">
                            <div class="d-flex justify-content-between">
                                <h2 class="mb-0"><?php echo e(@$title); ?></h2>
                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('create.successStory')): ?>
                                    <div class="text-end">
                                        <a href="#" class="btn btn-primary d-inline-flex align-item-center"
                                           data-bs-toggle="modal" data-bs-target="#addModal">
                                            <i class="ti ti-plus f-18"></i> Add <?php echo e($title); ?>

                                        </a>
                                    </div>
                                <?php endif; ?>
                            </div>
                        </div>
                        <div class="card-body">
                             <div class="dt-responsive table-responsive position-relative">
                                <table id="master-table" class="display table table-hover "
                                       style="width: 100%">
                                    <thead>
                                    <tr style="">
                                        <th>S.N</th>
                                        <th>Banner Image</th>
                                        <th>Title</th>
                                        <th>Location</th>
                                        <th>Short Description</th>
                                        <th>Image</th>
                                        <th>Status</th>
                                        <th>Created Date</th>
                                        <th>Actions</th>
                                    </tr>
                                    </thead>
                                    <tbody id="tablecontents">
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('additional-js'); ?>
    <script>
        CKEDITOR.replace('short_description');
        CKEDITOR.replace('short_description1');
        CKEDITOR.replace('project_overview');
        CKEDITOR.replace('project_overview1');
    </script>
    <script src="<?php echo e(asset('vendor/laravel-filemanager/js/stand-alone-button.js')); ?>"></script>
    <script>
        var route_prefix = "<?php echo e(url('/laravel-filemanager')); ?>";
        $('.lfm').filemanager('image', {prefix: route_prefix});
    </script>
    <script>
        // Maintain separate counters per modal
        let highlightIndex = {
            'highlight-wrapper-add': 1,
            'highlight-wrapper-edit': 0 // will be set dynamically on edit
        };

        // Add row dynamically
        $(document).on('click', '.add-highlight-btn', function () {
            const wrapperId = $(this).data('target').replace('#', '');
            const index = highlightIndex[wrapperId]++;
            const row = `
        <div class="highlight-row row mb-2" data-index="${index}">
            <div class="col-sm-5">
                <div class="form-group">
                    <label class="form-label">Title </label>
                    <input type="text" name="highlights[${index}][title]" class="form-control form-control-sm required" placeholder="Title">
                    <div class="invalid-feedback" id="highlights_${index}_title_err"></div>
                </div>
            </div>
            <div class="col-sm-5">
                <div class="form-group">
                    <label class="form-label">Value </label>
                    <input type="text" name="highlights[${index}][value]" class="form-control form-control-sm required" placeholder="Value">
                    <div class="invalid-feedback" id="highlights_${index}_value_err"></div>
                </div>
            </div>
            <div class="col-sm-2 d-flex align-items-end">
                <button type="button" class="btn btn-sm btn-danger remove-highlight-btn" style="margin-bottom: 16px;">
                    <i class="fa fa-trash"></i>
                </button>
            </div>
        </div>`;
            $('#' + wrapperId).append(row);
        });

        // Remove row (must keep at least 1)
        $(document).on('click', '.remove-highlight-btn', function () {
            const wrapper = $(this).closest('.card-body').find('[id^="highlight-wrapper"]');
            if (wrapper.find('.highlight-row').length > 1) {
                $(this).closest('.highlight-row').remove();
            } else {
                alert('At least one highlight is required.');
            }
        });
    </script>
    <script src="<?php echo e(asset('assets/admin/js/plugins/sweetalert2.all.min.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/admin/custom/js/backend/our-project/our-project.js')); ?>"></script>
<?php $__env->stopSection(); ?>


<?php echo $__env->make('layout.admin.master-layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/gge/resources/views/backend/our-project/our-project/index.blade.php ENDPATH**/ ?>