

<?php $__env->startSection('content'); ?>
<div class="inner-banner bg-body-tertiary">

    <div class="container">
        <div class="inner-banner__content text-center text-white">
            <h1> <?php echo e($product->title); ?> </h1>
            
        </div>
    </div>
</div>
<div class="container my-5 product-details">
    <div class="row g-lg-5 g-3">
        <!-- Product Image -->
        <div class="col-md-5">
            <img src="<?php echo e(asset($product->image)); ?>" alt="<?php echo e($product->title); ?>" class="img-fluid rounded">
        </div>

        <!-- Product Info -->
        <div class="col-md-7" id="productDetails" 
            data-name="<?php echo e($product->title); ?>"
            data-brand="<?php echo e($product->brand); ?>"
            data-condition="<?php echo e($product->condition); ?>"
            data-ref="<?php echo e($product->ref ?? 'N/A'); ?>"
            data-price="<?php echo e($product->price); ?>"
            data-color="<?php echo e($product->color ?? 'N/A'); ?>">

            <div class="text-secondary-color fw-semibold mb-2">
                ★★★★☆ 
                <a href="#" class="text-decoration-none text-secondary-color ms-2">
                    <?php echo e($product->reviews_count ?? 2); ?> Review(s)
                </a>
            </div>

            <h2 class="fw-bold mb-3"><?php echo e($product->title); ?></h2>

            <p><?php echo e($product->description); ?></p>

            <ul class="list-unstyled mb-3">
                <li><strong>Brand:</strong> <?php echo e($product->brand); ?></li>
                <li><strong>Condition:</strong> <?php echo e($product->condition); ?></li>
            </ul>

            <div class="mb-2 fw-semibold">
                Hurry up! only <span class="fw-bold text-secondary-color"><?php echo e($product->stock); ?></span> items left in stock!
            </div>

            <div class="progress mb-4" style="height: 6px;">
                <div class="progress-bar bg-theme-color" style="width: <?php echo e(min(100, ($product->stock / 150) * 100)); ?>%"></div>
            </div>

            <h4 class="text-secondary-color mb-2">RS : <?php echo e(number_format($product->price, 2)); ?></h4>
            <div class="text-muted mb-3">Est. Delivery Time: 2–3 Days</div>

            <div class="d-flex align-items-center gap-2 mb-4">
                <button class="btn-buy-now" id="buyNowBtn">Buy Now</button>
            </div>
        </div>
    </div>
</div>
<script>
    document.getElementById('buyNowBtn').addEventListener('click', function () {
        const details = document.getElementById('productDetails');

        const name = details.dataset.name;
        const brand = details.dataset.brand;
        const condition = details.dataset.condition;
        const ref = details.dataset.ref;
        const price = details.dataset.price;
        const color = details.dataset.color;

        const message = `I'm interested in buying the ${name}.\n\n` +
            `★ Brand: ${brand}\n` +
            `★ Condition: ${condition}\n` +
            `★ Reference: ${ref}\n` +
            `★ Price: RS ${price}\n` +
            `★ Color: ${color}\n\n` +
            `Is this still available?`;

        const encodedMessage = encodeURIComponent(message);
        const phoneNumber = '9779851043706'; // Your WhatsApp number
        const whatsappUrl = `https://wa.me/${phoneNumber}?text=${encodedMessage}`;

        window.open(whatsappUrl, '_blank');
    });
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('users.user-dashboard', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home2/pataneye/public_html/resources/views/users/pages/product-details.blade.php ENDPATH**/ ?>