<?php $__env->startSection('maincontent'); ?>
<?php $__env->startSection('title'); ?>
    <?php echo e(env('APP_NAME')); ?>-<?php echo e($childCategorysingle->childcategoryName); ?>

<?php $__env->stopSection(); ?>

<input type="hidden" name="childcategory" id="childcategory" value="<?php echo e($childCategorysingle->slug); ?>">

<!-- /.breadcrumb -->
<div class="body-content outer-top-xs">
    <div class="breadcrumb pt-2">
        <div class="container">
            <div class="row">
                <div class="col-12">
                    <div class="breadcrumb-inner p-0">
                        <ul class="list-inline list-unstyled mb-0">
                            <li><a href="#" style="text-transform: capitalize !important;color: #888;padding-right: 12px;font-size: 12px;">Home   > ChildCategory > <span
                                        class="active"></span><?php echo e($childCategorysingle->childcategoryName); ?></span>
                                </a></li>
                        </ul>
                    </div>
                </div>
                <!-- /.breadcrumb-inner -->
            </div>
        </div>
        <!-- /.container -->
    </div>
 
    <div class="container-fluid">
        <div class='row'> 
            <!-- /.sidebar -->
            <div class='col-md-12'>
                <div class="container-fluid" >
                    
                    <div class="row pt-2 pb-2" >
                     <?php $__empty_1 = true; $__currentLoopData = $childCategoryproducts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $categoryproduct): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <?php
                            $firstcatepro=App\Models\Product::with([
                                'sizes' => function ($query) {
                                    $query->select('id','product_id','Discount','RegularPrice','SalePrice')->take(1);
                                }
                                ])->where('id',json_decode($categoryproduct->RelatedProductIds)[0]->productID)->select('id','ProductName')->first();
                    
                            $review = App\Models\Review::where('product_id', $firstcatepro->id)->avg(
                                                            'rating',
                                                        );
                        ?>
                        <?php if(isset($firstcatepro)): ?>
                         <div class="mb-2 px-1 col-6 col-md-4 col-lg-2">
                             <div class="product-micro-row">
                                 <div class="product_item_inner">
                                    <div class="product-image">
                                        <a href="<?php echo e(url('view-product/' . $categoryproduct->ProductSlug)); ?>">
                                            <img src="<?php echo e(asset($categoryproduct->ProductImage)); ?>">
                                        </a>
                                    </div>
                                    <!-- /.product-image -->
                                    <div class="product-text" style="padding-bottom: 4px !important;background: white;">
                                        <div class="pro_name">
                                         <a href="<?php echo e(url('view-product/' . $categoryproduct->ProductSlug)); ?>" id="f_pro_name"><?php echo e($categoryproduct->ProductName); ?></a>
                                         
                                        <div class="d-flex my-2" style="justify-content:center">
                                            <div class="star" style="padding-top: 5px;" display="none!important;">
                                                <span style="font-weight: bold;color:black;font-size:10px">(<?php echo e(App\Models\Review::where('product_id', $categoryproduct->id)->get()->count()); ?>)</span>
                                                    <span class="fas fa-star" id="checked"></span>
                                                    <span class="fas fa-star" id="checked"></span>
                                                    <span class="fas fa-star" id="checked"></span>
                                                    <span class="fas fa-star" id="checked"></span>
                                                    <span class="fas fa-star" id="checked"></span>
                                                 
                                            </div>
                                        </div>
                                        <div class="price-box">
                                            <del class="old-product-price strong-400" style="color:red">৳
                                                <?php echo e(round($firstcatepro->sizes[0]->RegularPrice)); ?></del>
                                            <span
                                                class="product-price strong-600" style="color:black">৳ <?php echo e(round($firstcatepro->sizes[0]->SalePrice)); ?></span>
                                        </div>
                                        
                                      </div>
                                    </div>
                                    <div class="pro_btn">
                                      <form name="form" action="<?php echo e(url('add-to-cart')); ?>" method="POST" enctype="multipart/form-data" style="width: 100%;float: left;text-align: center;">
                                            <?php echo method_field('POST'); ?>
                                            <?php echo csrf_field(); ?>
                                            <input type="text" name="color" id="product_colorold" hidden>
                                            <input type="text" name="size" id="product_sizeold" hidden>
                                            <input type="text" name="product_id" value="<?php echo e($firstcatepro->id); ?>" hidden>
                                            <input type="text" name="qty" value="1" id="qtyor" hidden>
                                            Salman
                                            <button class="btn  btn-sm mb-0 btn-block"  id="purcheseBtn">অর্ডার করুন</button>
                                        </form>
                                    </div>
                             </div>
                            </div>
                        </div>
                      <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <?php endif; ?>
                    </div>
                </div>
                <!-- /.category-product -->
            </div>
            <!-- /.col -->
        </div>

        <!-- ============================================== BRANDS CAROUSEL : END ============================================== -->
    </div>
    <!-- /.container -->

</div>




<input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>" />

<script>
    var token = $("input[name='_token']").val();

   

    function shownow() {
        $('#processing').modal('show');
        var pricerange = $('.price-slider').val();
        var subcategorynow = $('#subcategoryslug').val();
        $.ajax({
            type: 'GET',
            url: '<?php echo e(url('get/products/by-subcategory')); ?>',
            data: {
                _token: token,
                subcategory: subcategorynow,
                price_range: pricerange
            },

            success: function(response) {
                $('#processing').modal('hide');
                $('#viewCategoryProduct').empty().append(response);
            },
            error: function(error) {
                console.log('error');
            }
        });
    }

    function viewsubcategoryproduct(subcategoryslug) {
        $('#processing').modal('show');
        var pricerange = $('.price-slider').val();

        $.ajax({
            type: 'GET',
            url: '<?php echo e(url('get/products/by-subcategory')); ?>',
            data: {
                _token: token,
                subcategory: subcategoryslug,
                price_range: pricerange
            },

            success: function(response) {
                $('#processing').modal('hide');
                $('#viewCategoryProduct').empty().append(response);
            },
            error: function(error) {
                console.log('error');
            }
        });
    }

    function viewcategoryproduct(categoryslug) {
        $('#processing').modal('show');

        $.ajax({
            type: 'GET',
            url: '<?php echo e(url('get/products/by-category')); ?>',
            data: {
                _token: token,
                category: categoryslug,
            },

            success: function(response) {
                $('#processing').modal('hide');
                $('#viewCategoryProduct').empty().append(response);
            },
            error: function(error) {
                console.log('error');
            }
        });
    }

    function addtocart(product_id) {
        $('#processing').css({
            'display': 'flex',
            'justify-content': 'center',
            'align-items': 'center'
        })
        $('#processing').modal('show');
        $.ajax({
            type: 'POST',
            url: '<?php echo e(url('add-to-cart')); ?>',
            data: {
                _token: token,
                product_id: product_id,
                qty: '1',
            },

            success: function(data) {
                updatecart();
                $.ajax({
                    type: 'GET',
                    url: '<?php echo e(url('get-cart-content')); ?>',

                    success: function(response) {
                        $('#cartViewModal .modal-body').empty().append(
                            response);
                    },
                    error: function(error) {
                        console.log('error');
                    }
                });
                $('#processing').modal('hide');
                $('#cartViewModal').modal('show');
            },
            error: function(error) {
                console.log('error');
            }
        });
    }

    function buynow(product_id) {
        $('#processing').css({
            'display': 'flex',
            'justify-content': 'center',
            'align-items': 'center'
        })
        $('#processing').modal('show');
        $.ajax({
            type: 'POST',
            url: '<?php echo e(url('add-to-cart')); ?>',
            data: {
                _token: token,
                product_id: product_id,
                qty: '1',
            },

            success: function(data) {
                updatecart();
                if (data == 'success') {
                    window.location.href = 'https://danpite.xyz/checkout';
                    $('#processing').modal('hide');
                }
            },
            error: function(error) {
                console.log('error');
            }
        });
    }


    function removeFromCartItem(rowId) {

        $.ajax({
            type: 'POST',
            url: '<?php echo e(url('remove-cart')); ?>',
            data: {
                _token: token,
                rowId: rowId,
            },

            success: function(response) {

                updatecart();
                swal({
                    position: 'top-end',
                    icon: 'success',
                    title: 'Product remove from your Cart',
                    showConfirmButton: false,
                    timer: 1500
                });
                if (response == 'empty') {
                    $('#loadingreload').css({
                        'display': 'flex',
                        'justify-content': 'center',
                        'align-items': 'center'
                    })
                    $('#loadingreload').modal('show');
                    $('#cartViewModal').modal('hide');
                    location.reload();
                } else {
                    $('#cartViewModal .modal-body').empty().append(
                        response);
                    $('#cartViewModal').modal('show');
                }


            },
            error: function(error) {
                console.log('error');
            }
        });
    }



    function upQuantity() {
        var qty = $('#proQuantity').val();
        if (qty >= 10) {

        } else {
            var b = parseInt(qty);
            var cq = b + 1;
            $('#proQuantity').val(cq);
            $('#qty').val(cq);
            $('#qtyor').val(cq);
        }
    }

    function downQuantity() {
        var qty = $('#proQuantity').val();
        if (qty <= 1) {

        } else {
            var b = parseInt(qty);
            var cq = b - 1;
            $('#proQuantity').val(cq);
            $('#qty').val(cq);
            $('#qtyor').val(cq);
        }


    }
</script>

<style>
    @media  only screen and (max-width: 768px) {
        #cateoryProSidebar {
            padding-right: 0;
        }

        #cateoryPro {
            padding-left: 0;
        }
    }

    #cateoryProSidebar {
        padding-left: 0;
    }

    #cateoryPro {
        padding-right: 0px;
    }

    .sidebar-widget .sidebar-widget-body .accordion .accordion-group .accordion-heading .accordion-toggle.collapsed:after {
        color: #636363;
        content: "\f067";
        font-family: fontawesome;
        font-weight: normal;
    }

    .sidebar .sidebar-module-container .sidebar-widget .sidebar-widget-body .accordion .accordion-group .accordion-heading .accordion-toggle:after {
        content: "\f068";
        float: right;
        font-family: fontawesome;
    }

    .widget-title {
        font-size: 16px;
        text-align: center;
        border-bottom: 1px solid #e9e9e9;
        padding-bottom: 10px;
        margin: 0;
    }

    .list {
        list-style: none;
    }

    #liaside {
        color: #858585;
        font-weight: bold;
    }

    .breadcrumb {
        padding: 5px 0;
        border-bottom: 1px solid #e9e9e9;
        background-color: #fafafa;
    }
</style>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('webview.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/falconen/multivendor.falconenterprisebd.com/resources/views/webview/content/product/childbcategory.blade.php ENDPATH**/ ?>