<?php $attributes ??= new \Illuminate\View\ComponentAttributeBag;

$__newAttributes = [];
$__propNames = \Illuminate\View\ComponentAttributeBag::extractPropNames((['product']));

foreach ($attributes->all() as $__key => $__value) {
    if (in_array($__key, $__propNames)) {
        $$__key = $$__key ?? $__value;
    } else {
        $__newAttributes[$__key] = $__value;
    }
}

$attributes = new \Illuminate\View\ComponentAttributeBag($__newAttributes);

unset($__propNames);
unset($__newAttributes);

foreach (array_filter((['product']), 'is_string', ARRAY_FILTER_USE_KEY) as $__key => $__value) {
    $$__key = $$__key ?? $__value;
}

$__defined_vars = get_defined_vars();

foreach ($attributes->all() as $__key => $__value) {
    if (array_key_exists($__key, $__defined_vars)) unset($$__key);
}

unset($__defined_vars, $__key, $__value); ?>

<?php
    $primaryImage = $product->images->where('is_primary', true)->first() ?? $product->images->first();
    $imageUrl = $primaryImage ? asset('storage/' . $primaryImage->image_path) : 'https://placehold.co/400x400/f5f5f5/999999?text=' . urlencode($product->name);
    $effectivePrice = $product->sale_price && $product->sale_price > 0 ? $product->sale_price : $product->price;
    $onSale = $product->sale_price && $product->sale_price > 0 && $product->sale_price < $product->price;
    $stockClass = $product->stock_quantity > 0 ? 'instock' : 'outofstock';
    $featuredClass = $product->is_featured ? 'featured' : '';
    $saleClass = $onSale ? 'sale' : '';
?>

<li class="product type-product status-publish <?php echo e($stockClass); ?> <?php echo e($featuredClass); ?> <?php echo e($saleClass); ?> has-post-thumbnail purchasable product-type-simple">
    <div class="product-block">
        <div class="content-product-imagin"></div>
        <div class="product-transition">
            <div class="product-image">
                <img width="400" height="400" src="<?php echo e($imageUrl); ?>" class="attachment-shop_catalog size-shop_catalog" alt="<?php echo e($product->name); ?>" loading="lazy"
                     onerror="this.src='https://placehold.co/400x400/f5f5f5/999999?text=No+Image'">
            </div>
            <div class="group-action">
                <div class="shop-action">
                    <button class="woosq-btn" data-id="<?php echo e($product->id); ?>" onclick="window.location='<?php echo e(url('/products/' . $product->slug)); ?>'">Quick view</button>
                </div>
            </div>
            <a href="<?php echo e(url('/products/' . $product->slug)); ?>" class="woocommerce-LoopProduct-link woocommerce-loop-product__link"></a>
        </div>
        <div class="product-caption">
            <h3 class="woocommerce-loop-product__title">
                <a href="<?php echo e(url('/products/' . $product->slug)); ?>"><?php echo e($product->name); ?></a>
            </h3>
            <?php if($onSale): ?>
                <span class="price">
                    <del aria-hidden="true">
                        <span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">LKR </span><?php echo e(number_format($product->price, 2)); ?></bdi></span>
                    </del>
                    <ins>
                        <span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">LKR </span><?php echo e(number_format($effectivePrice, 2)); ?></bdi></span>
                    </ins>
                </span>
            <?php else: ?>
                <span class="price">
                    <span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol">LKR </span><?php echo e(number_format($effectivePrice, 2)); ?></bdi></span>
                </span>
            <?php endif; ?>
        </div>
        <div class="product-caption-bottom">
            <?php if($product->stock_quantity > 0): ?>
                <form method="POST" action="<?php echo e(url('/cart/add')); ?>" style="display:inline">
                    <?php echo csrf_field(); ?>
                    <input type="hidden" name="product_id" value="<?php echo e($product->id); ?>">
                    <input type="hidden" name="quantity" value="1">
                    <button type="submit" class="button product_type_simple add_to_cart_button" aria-label="Add &ldquo;<?php echo e($product->name); ?>&rdquo; to your cart">Add to cart</button>
                </form>
            <?php else: ?>
                <a href="<?php echo e(url('/products/' . $product->slug)); ?>" class="button product_type_simple" aria-label="Read more about &ldquo;<?php echo e($product->name); ?>&rdquo;">Read more</a>
            <?php endif; ?>
        </div>
    </div>
</li>
<?php /**PATH /var/lib/freelancer/projects/40289218/resources/views/components/product-card.blade.php ENDPATH**/ ?>