<form action="<?php echo e(route('product.filter')); ?>" method="GET" id="form">
    <div class="range">
        <div class="d-grid">
            <div class="d-flex justify-content-between align-items-baseline" id="wrap_min_range_amount">
                <label for="min_range_amount">Min: </label>
                <input class="border px-2 py-1" type="number" name="min_range_amount" id="min_range_amount" value="<?php echo e($request->min_range_amount ?? preg_split('/,/', setting('ALL_PRODUCTS_FILTER_DEFAULT_VALUES') ?? '10,50')[0]); ?>" />
            </div>
            <div class="d-flex justify-content-between align-items-baseline" id="wrap_max_range_amount">
                <label for="max_range_amount">Max: </label>
                <input class="border px-2 py-1" type="number" name="max_range_amount" id="max_range_amount" value="<?php echo e($request->max_range_amount ?? preg_split('/,/', setting('ALL_PRODUCTS_FILTER_DEFAULT_VALUES') ?? '10,50')[1]); ?>" />
            </div>   
        </div>
        <?php $__env->startPush('override_css'); ?>#min_range_amount,#max_range_amount{max-width:70%;}<?php $__env->stopPush(); ?>
        <div id="slider-range"></div>
    </div>


    <?php if(isset($request->mini_category)): ?>
        <?php
            $input_name = 'Mini Category';
            $input = 'mini_category';
            $data = DB::table('mini_categories')
                ->where('slug', $request->mini_category)
                ->first();
            $datan = DB::table('sub_categories')
                ->where('id', $data->category_id)
                ->first();
            $cidn = $datan->category_id;

        ?>
    <?php endif; ?>
    <?php if(isset($request->extra_category)): ?>
        <?php
            $input_name = 'Extra Category';
            $input = 'extra_category';
            $data = DB::table('extra_mini_categories')
                ->where('slug', $request->extra_category)
                ->first();
            $mini = DB::table('mini_categories')
                ->where('id', $data->category_id)
                ->first();
            $datas = DB::table('sub_categories')
                ->where('id', $mini->category_id)
                ->first();
            $cidn = $datas->category_id;

        ?>
    <?php endif; ?>
    <?php if(isset($request->sub_category)): ?>
        <?php
            $input_name = 'Sub Category';
            $input = 'sub_category';
            $data = DB::table('sub_categories')
                ->where('slug', $request->sub_category)
                ->first();
            $cidn = $data->category_id;
            $idn = $data->id;

        ?>
    <?php endif; ?>
    <?php if(isset($request->category)): ?>
        <?php
            $input_name = 'Category';
            $input = 'category';
            $data = DB::table('categories')
                ->where('slug', $request->category)
                ->first();
            $cidn = $data->id;

        ?>
    <?php endif; ?>
    <?php if(isset($request->collection)): ?>
        <?php
            $input_name = 'Collection';
            $input = 'collection';
            $data = DB::table('collections')
                ->where('slug', $request->collection)
                ->first();
        ?>
    <?php endif; ?>

    <?php if($name == 'category'): ?>
        <?php
            $input_name = 'Category';
            $input = 'category';
            $data = DB::table('categories')->where('slug', $value)->first();
            $cidn = $data->id;
        ?>
    <?php endif; ?>
    <?php if($name == 'sub_category'): ?>
        <?php
            $input_name = 'Sub Category';
            $input = 'sub_category';
            $data = DB::table('sub_categories')->where('slug', $value)->first();
            $cidn = $data->category_id;
            $idn = $data->id;
        ?>
    <?php endif; ?>
    <?php if($name == 'mini_category'): ?>
        <?php
            $input_name = 'Mini Category';
            $input = 'mini_category';
            $mini = DB::table('mini_categories')->where('slug', $value)->first();
            $data = DB::table('sub_categories')
                ->where('id', $mini->category_id)
                ->first();
            $cidn = $data->category_id;
        ?>
    <?php endif; ?>
    <?php if($name == 'extra_category'): ?>
        <?php
            $input_name = 'Extra Category';
            $input = 'extra_category';
            $emini = DB::table('extra_mini_categories')->where('slug', $value)->first();
            $mini = DB::table('mini_categories')
                ->where('id', $emini->mini_category_id)
                ->first();
            $data = DB::table('sub_categories')
                ->where('id', $mini->category_id)
                ->first();
            $cidn = $data->category_id;
        ?>
    <?php endif; ?>
    <?php if(isset($cidn)): ?>
        <style>
            .cck2 {
                border-radius: 5px;
                /* cursor: pointer; */
                border: 1px solid black;
                text-align: center;
                padding: 2px 10px !important;
                margin-block: .4rem !important;
                position: relative;
                margin: 0;
                padding: 0;
            }

            .cck2 input {
                opacity: 0;
                position: absolute;
                cursor: pointer;
                text-align: center;
                z-index: 99999;
                width: 100%;
                height: 100%;
            }
            .cck2:hover{
                background: orange;
                border-color: orange;
            }
            .cck2.active {
                background: black;
                color: white;
            }
        </style>

        <?php $__currentLoopData = App\Models\Attribute::where('category_id', $cidn)->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $attribute): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <?php if($attribute->values->count() > 0): ?>
                <div class="left-side mb-3">
                    <p class=""
                        style="border-top: 1px solid gainsboro;margin-bottom: 10px;padding-top: 10px;font-weight: 700;">
                        <?php echo e($attribute->name); ?></p>
                    <?php $__currentLoopData = $attribute->values; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $avalue): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <li style="display:inline-block;">
                            <label
                                class="cck2 <?php if(isset($request->attri)): ?> <?php $__currentLoopData = $request->attri; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $req_brand): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php echo e($avalue->slug == $req_brand ? 'active' : ''); ?>  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endif; ?>"
                                for="<?php echo e($avalue->slug); ?>">
                                <input type="checkbox" id="<?php echo e($avalue->slug); ?>" name="attri[]" class="checked"
                                    value="<?php echo e($avalue->slug); ?>"
                                    <?php if(isset($request->attri)): ?> <?php $__currentLoopData = $request->attri; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $req_brand): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php echo e($avalue->slug == $req_brand ? 'checked' : ''); ?>  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endif; ?>>
                                <?php echo e($avalue->name); ?>

                            </label>
                        </li>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            <?php endif; ?>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    <?php endif; ?>
    <?php if(isset($input_name)): ?>
        <div class="left-side mb-3">
            <p class=""
                style="border-top: 1px solid gainsboro;margin-bottom: 10px;padding-top: 10px;font-weight: 700;">
                <?php echo e($input_name); ?></p>
            <ul>
                <li>
                    <input style="opacity:0" type="checkbox" name="<?php echo e($input); ?>" class="checked" id="dcd"
                        value="<?php echo e($data->slug); ?>" checked>
                    <span class="span">
                        <?php if($input == 'category'): ?>
                            <?php echo e($data->name); ?>

                        <?php endif; ?>
                        <?php if($input == 'sub_category'): ?>
                            <?php ($cs = App\Models\Category::where('id', $cidn)->first()); ?>
                            <a href="<?php echo e(route('category.product', $cs->slug)); ?>"><?php echo e($cs->name); ?></a><i
                                class="icon-down icofont icofont-simple-right"></i><?php echo e($data->name); ?>

                        <?php endif; ?>
                        <?php if($input == 'mini_category'): ?>
                            <?php if(isset($datan)): ?>
                                <?php ($cs = App\Models\Category::where('id', $cidn)->first()); ?>
                                <a href="<?php echo e(route('category.product', $cs->slug)); ?>"><?php echo e($cs->name); ?></a><i
                                    class="icon-down icofont icofont-simple-right"></i> <a
                                    href="<?php echo e(route('subCategory.product', $datan->slug)); ?>"> <?php echo e($datan->name); ?></a><i
                                    class="icon-down icofont icofont-simple-right"></i><?php echo e($data->name); ?>

                            <?php else: ?>
                                <?php ($cs = App\Models\Category::where('id', $cidn)->first()); ?>
                                <a href="<?php echo e(route('category.product', $cs->slug)); ?>"><?php echo e($cs->name); ?></a><i
                                    class="icon-down icofont icofont-simple-right"></i> <a
                                    href="<?php echo e(route('subCategory.product', $data->slug)); ?>"> <?php echo e($data->name); ?></a><i
                                    class="icon-down icofont icofont-simple-right"></i> <?php echo e($mini->name); ?>

                            <?php endif; ?>
                        <?php endif; ?>
                    </span>
                </li>
                <?php if($input == 'category'): ?>
                    <?php $__currentLoopData = App\Models\SubCategory::where('category_id', $cidn)->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <li>
                            <input class="sub_mod" type="radio" id="<?php echo e($cat->slug); ?>" name="sub_category"
                                value="<?php echo e($cat->slug); ?>">
                            <label for="<?php echo e($cat->slug); ?>"><span class="span sub_mod"><?php echo e($cat->name); ?></span></label>

                        </li>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <?php endif; ?>
                <?php if($input == 'sub_category'): ?>
                    <?php $__currentLoopData = App\Models\miniCategory::where('category_id', $idn)->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <li>
                            <input class="sub_mod" type="radio" id="<?php echo e($cat->slug); ?>" name="mini_category"
                                value="<?php echo e($cat->slug); ?>">
                            <label for="<?php echo e($cat->slug); ?>"><span class="span sub_mod"><?php echo e($cat->name); ?></span></label>

                        </li>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <?php endif; ?>
            </ul>
        </div>
    <?php else: ?>
        <ul>
            <?php $__currentLoopData = App\Models\Category::get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <li>
                    <input class="sub_mod" type="radio" id="<?php echo e($cat->slug); ?>" name="category"
                        value="<?php echo e($cat->slug); ?>">
                    <label for="<?php echo e($cat->slug); ?>"><span class="span sub_mod"><?php echo e($cat->name); ?></span></label>

                </li>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </ul>
    <?php endif; ?>
    <!--<input type="hidden" name="amount" value="TK10+-+TK600000">-->
    <div class="left-side">
        <p style="border-top: 1px solid gainsboro;margin-bottom: 10px;padding-top: 10px;font-weight: 700;">Brand</p>
        <ul style="height: 200px;overflow-y: scroll;scrollbar-width: thin;">
            <?php $__currentLoopData = $brands; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $brand): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <li>
                    <input type="checkbox" name="brands[]" class="checked" value="<?php echo e($brand->slug); ?>"
                        <?php if(isset($request->brands)): ?> <?php $__currentLoopData = $request->brands; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $req_brand): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php echo e($brand->slug == $req_brand ? 'checked' : ''); ?>  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> <?php endif; ?>>
                    <span class="span"><?php echo e($brand->name); ?></span>
                </li>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

        </ul>
    </div>
    <style>
        .cc label {
            display: block;

        }
    </style>
    <hr>

    <div class="cc">
        <label>
            <input <?php if(isset($request->sort)): ?> <?php if($request->sort == 'Best Sellers'): ?> checked <?php endif; ?> <?php endif; ?>
                name="sort" type="radio" value="Best Sellers"> Best Sellers
        </label>
        <label>
            <input <?php if(isset($request->sort)): ?> <?php if($request->sort == 'New To Old'): ?> checked <?php endif; ?> <?php endif; ?>
                name="sort" type="radio" value="New To Old"> New Released
        </label>
        <label>
            <input <?php if(isset($request->sort)): ?> <?php if($request->sort == 'High To Low'): ?> checked <?php endif; ?> <?php endif; ?>
                name="sort" type="radio" value="High To Low"> Price- High To Low
        </label>
        <label>
            <input <?php if(isset($request->sort)): ?> <?php if($request->sort == 'Low To High'): ?> checked <?php endif; ?> <?php endif; ?>
                name="sort" type="radio" value="Low To High"> Price- Low To High
        </label>
        <label>
            <input <?php if(isset($request->sort)): ?> <?php if($request->sort == 'dHigh To Low'): ?> checked <?php endif; ?> <?php endif; ?>
                name="sort" type="radio" value="dHigh To Low"> Discount- High To Low
        </label>
        <label>
            <input <?php if(isset($request->sort)): ?> <?php if($request->sort == 'dLow To High'): ?> checked <?php endif; ?> <?php endif; ?>
                name="sort" type="radio" value="dLow To High"> Discount- Low To High
        </label>

    </div>
    <hr>



    <input type="hidden" name="unr" value="<?php echo e($request->unr ?? Request::url()); ?>">

    <div class="left-side action">
        <ul>
            <li><input value="Filter" type="submit"></li>
            <li> <a class="redirect"
                    style="background: #ff5722;color: white;border: none;padding: 8px 25px;display: inline-block;"
                    href="<?php echo e($request->unr ?? Request::url()); ?>">Reset</a> </li>
        </ul>
    </div>
    <style>
        .action ul li {
            display: inline-block;
        }

        .action ul li input {
            display: block;
            background: #2abbe8;
            color: white;
            padding: 8px 25px;
            border-radius: 4px;
            border: none;
            font: 16px;
        }
    </style>
</form>
<?php $__env->startPush('js'); ?>
    <link rel="stylesheet" href="<?php echo e(asset('/')); ?>assets/frontend/css/jquery-ui1.css">
    
    
    <script src="<?php echo e(asset('/')); ?>assets/frontend/js/jquery-ui-v1.14.0.min.js"></script>
    <script>

        $(document).ready(function () {

            function updateSliderValues() {
                var sliderValues = $("#slider-range").slider("values");
                $("#min_range_amount").val(sliderValues[0]);
                $("#max_range_amount").val(sliderValues[1]);
                // console.log(sliderValues[0], sliderValues[1]);
            }

            function updateSliderPosition() {
                var min_range_amount = $("#min_range_amount").val();
                var max_range_amount = $("#max_range_amount").val();
                $("#slider-range").slider("values", [min_range_amount, max_range_amount]);
            }

            $("#slider-range").slider({
                range: true,
                min: 0,
                max: <?php echo setting('ALL_PRODUCTS_MAX_AMOUNT_PRICE_FILTER') ?? 20000; ?>,
                values: [$("#min_range_amount").val(), $("#max_range_amount").val()],
                slide: updateSliderValues
            }).css('margin-top', '.4rem');

            $("#min_range_amount, #max_range_amount").on("input", updateSliderPosition);

            updateSliderValues();
            
        });






        
        // $(document).ready(function () {

        //     $("#slider-range").slider({
                
        //         range: true,
        //         min: 0,
        //         // max: <?php echo setting('ALL_PRODUCTS_MAX_AMOUNT_PRICE_FILTER') ?? 20000; ?>,
        //         max: 20000 ,
        //         // init slide value
        //         // values: [<?php echo setting('ALL_PRODUCTS_FILTER_DEFAULT_VALUES') ?? '10,50'; ?>],
        //         values: [10,50],

        //         slide: function (event, ui) {
        //             $("#amount").val("<?php echo setting('CURRENCY_CODE_MIN') ?? 'TK'; ?>" + ui.values[0] + " - <?php echo setting('CURRENCY_CODE_MIN') ?? 'TK'; ?>" + ui.values[1]);
        //         }
        //     });
        //     // Init value
        //     $("#amount").val(
        //         "<?php echo setting('CURRENCY_CODE_MIN') ?? 'TK'; ?>"
        //         + $("#slider-range").slider("values", 0)
        //         + " - <?php echo setting('CURRENCY_CODE_MIN') ?? 'TK'; ?>"
        //         + $("#slider-range").slider("values", 1)
        //     );
        // });




        // $(document).ready(function () {
        //     $(document).on('change', 'select#sort', function() {
        //         let value = $(this).val();
        //         $('input[name="sort"]').val(value);
        //         $('form#form').submit();
        //     });

        //     $("#slider-range").slider({
        //         range: true,
        //         min: 0,
        //         max: <?php echo setting('ALL_PRODUCTS_MAX_AMOUNT_PRICE_FILTER') ?? 20000; ?>,
        //         values: [<?php echo setting('ALL_PRODUCTS_FILTER_DEFAULT_VALUES') ?? '10,50'; ?>],
        //         slide: function (event, ui) {
        //             $("#amount").val("<?php echo setting('CURRENCY_CODE_MIN') ?? 'TK'; ?>" + ui.values[0] + " -<?php echo setting('CURRENCY_CODE_MIN') ?? 'TK'; ?>" + ui.values[1]);
        //         }
        //     });
        //     $("#amount").val("<?php echo setting('CURRENCY_CODE_MIN') ?? 'TK'; ?>" + $("#slider-range").slider("values", 0) + " -<?php echo setting('CURRENCY_CODE_MIN') ?? 'TK'; ?>" + $("#slider-range").slider("values", 1));
        // });
    </script>
    <script>
        $('.cck').click(function() {
            if ($(this).hasClass('active')) {
                $(this).removeClass('active');
            } else {
                $(this).addClass('active');
            }
        })
        $('.sub_mod').click(function() {
            if ($(this).is(':checked')) {
                $('#dcd').prop('checked', false)
            }
        })
        $('.cck2').click(function() {
            if ($(this).hasClass('active')) {
                $(this).removeClass('active');
            } else {
                $(this).addClass('active');
            }
        })
    </script>
<?php $__env->stopPush(); ?>

<?php if(isset(request()->keyword)): ?>
    <?php echo $__env->make('frontend.partial.index.advertisement.search_sidebar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php else: ?>
    <?php echo $__env->make('frontend.partial.index.advertisement.category_sidebar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<?php endif; ?><?php /**PATH /home/apleusbj/shopping.apleefix.com/resources/views/components/filter-search-component.blade.php ENDPATH**/ ?>