

<?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 w-100">
        </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'); ?>">

            

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

            

            
        </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 = '9779849264312';

    const isMobile = /Android|iPhone|iPad|iPod|Opera Mini|IEMobile|WPDesktop/i.test(navigator.userAgent);

    let whatsappUrl;
    if (isMobile) {
        // Mobile: open in WhatsApp app
        whatsappUrl = `whatsapp://send?phone=${phoneNumber}&text=${encodedMessage}`;
    } else {
        // Desktop: force open in WhatsApp Web (message preserved)
        whatsappUrl = `https://web.whatsapp.com/send?phone=${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 C:\Users\HP\Desktop\shresthi\app (2)\app\resources\views/users/pages/product-details.blade.php ENDPATH**/ ?>