<?php $__env->startSection('ogp'); ?>
    <meta property="og:type" content="website">
    <meta property="og:url" content="<?php echo e(request()->url()); ?>">
    <meta property="og:image" content="<?php echo e(asset($product->thumbnail ?? $options->image)); ?>">
    <meta property="og:title" content="<?php echo e($product->post->title); ?>">
    <meta property="og:description" content="<?php echo e($product->post->excerpt); ?>">
<?php $__env->stopSection(); ?>

<?php $__env->startSection('title', $product->post->title); ?>

<?php $__env->startSection('content'); ?>
    <article id="product">
        <div class="breadcrumb">
            <div class="container d-flex align-items-center">
                <a href="<?php echo e(url('/')); ?>">Inicio</a>
                <span><?php echo $__env->yieldContent('title'); ?></span>
            </div>
        </div>
        <section>
            <div class="container">
                <div class="row row-grid">
                    <div class="col-md-6">
                        <div class="row row-grid">
                            <?php $__currentLoopData = $product->images; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $medium): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="col-<?php echo e($loop->first ? 12 : 4); ?>">
                                    <a href="<?php echo e(asset($medium->post->image)); ?>" class="mzoom">
                                        <div class="img-holder img-full">
                                            <img src="<?php echo e(asset($medium->thumbnail)); ?>" alt="" class="cover">
                                        </div>
                                    </a>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="product-info">
                            <h2><?php echo $__env->yieldContent('title'); ?></h2>
                            <h4><?php echo e(num_format($product->price)); ?></h4>
                            <p><?php echo nl2br($product->post->excerpt); ?></p>
                            <?php if($product->active): ?>
                                <?php echo Form::open([
                                    'class' => 'cart-add-form'
                                ]); ?>

                                <?php echo Form::hidden('action', 'add'); ?>

                                <?php echo Form::hidden('product_id', $product->id); ?>

                                <div class="row row-grid align-items-center">
                                    <div class="col-auto">Cantidad:</div>
                                    <div class="col-auto">
                                        <div class="input-number">
                                            <a href="#" class="plus far fa-plus"></a>
                                            <a href="#" class="minus far fa-minus"></a>
                                            <input type="number" name="qty" value="1" min="1" max="<?php echo e($product->stock); ?>">
                                        </div>
                                    </div>
                                    <div class="col-sm col-12">
                                        <button class="btn" type="submit">
                                            <span>Añadir al carrito</span>
                                            <i class="far fa-arrow-right"></i>
                                        </button>
                                    </div>
                                </div>
                                <?php echo Form::close(); ?>

                            <?php else: ?>
                                <p><b>No disponible</b></p>
                            <?php endif; ?>
                            <p>
                                <?php if($product->sku): ?>
                                    <span class="d-block">SKU: <?php echo e($product->sku); ?></span>
                                <?php endif; ?>
                                <?php if($product->post->categories->count()): ?>
                                    <span class="d-block">Categorías: <?php echo e($product->post->categories->implode('title', ', ')); ?></span>
                                <?php endif; ?>
                                <?php if($product->tags): ?>
                                    <span class="d-block">Etiquetas: <?php echo e(implode(', ', $product->tags_array)); ?></span>
                                <?php endif; ?>
                                <?php if($product->sizes): ?>
                                    <span class="d-block">Tamaños: <?php echo e(implode(', ', $product->sizes_array)); ?></span>
                                <?php endif; ?>
                                <?php if($product->colors): ?>
                                    <span class="d-block">Colores: <?php echo e(implode(', ', $product->colors_array)); ?></span>
                                <?php endif; ?>
                                <?php if($product->materials): ?>
                                    <span class="d-block">Materiales: <?php echo e(implode(', ', $product->materials_array)); ?></span>
                                <?php endif; ?>
                            </p>
                        </div>
                    </div>
                    <?php if($product->post->content): ?>
                        <div class="col-12 mt-5 product-content">
                            <div class="row row-grid">
                                <div class="col-auto">
                                    <h3>Descripción</h3>
                                </div>
                                <div class="col-sm col-12">
                                    <div class="content-html">
                                        <?php echo $product->post->content; ?>

                                    </div>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </section>
        <?php if($products->count()): ?>
            <section class="related">
                <div class="container">
                    <h2>Productos relacionados</h2>
                    <div class="row-container">
                        <div class="row row-grid justify-content-center">
                            <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="col-md-3 col-6">
                                    <?php echo $__env->make('partials.card', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                    </div>
                </div>
            </section>
        <?php endif; ?>
    </article>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('scripts'); ?>
    <script>
      $(function() {
        $('body').on('submit', '.cart-add-form', function() {
          var $this = $(this);
          $.post('<?php echo e(route('cart.action')); ?>', $this.serialize(), function(response) {
            $this.find('.btn span').text(response.message);
            $this.addClass('btn-cart-toggle');
            $('.cart-count').text(response.count);
            $('.cart-content').html(response.cart);
          }).fail(function(response) {
            alert(response.responseJSON.message);
          });
          return false;
        });
      });
    </script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('layouts.frontend', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/bgreen/test.bgreen.com.py/resources/views/templates/product.blade.php ENDPATH**/ ?>