this is a cart issue when we proceed to checkout resolve this and add payment method like easypaisa , jazzcash and bank accounts of pakistan - Follow Up Deployment
Browse files- index.html +106 -4
index.html
CHANGED
@@ -462,6 +462,18 @@
|
|
462 |
</div>
|
463 |
</section>
|
464 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
<!-- Footer -->
|
466 |
<footer class="bg-gray-900 text-white py-12">
|
467 |
<div class="container mx-auto px-4">
|
@@ -559,8 +571,55 @@
|
|
559 |
</div>
|
560 |
</div>
|
561 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
562 |
<button id="checkout-btn" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded transition duration-300 mb-4">
|
563 |
-
|
564 |
</button>
|
565 |
|
566 |
<a href="#" class="block text-center text-blue-600 hover:text-blue-800 font-medium">
|
@@ -703,13 +762,56 @@
|
|
703 |
}
|
704 |
}
|
705 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
706 |
// Checkout button
|
707 |
const checkoutBtn = document.getElementById('checkout-btn');
|
708 |
checkoutBtn.addEventListener('click', () => {
|
709 |
if (cart.length > 0) {
|
710 |
-
|
711 |
-
|
712 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
713 |
} else {
|
714 |
alert('Your cart is empty. Please add some items before checking out.');
|
715 |
}
|
|
|
462 |
</div>
|
463 |
</section>
|
464 |
|
465 |
+
<style>
|
466 |
+
input[type="radio"] {
|
467 |
+
accent-color: #2563eb;
|
468 |
+
}
|
469 |
+
.payment-method {
|
470 |
+
background-color: #f8fafc;
|
471 |
+
padding: 1rem;
|
472 |
+
border-radius: 0.5rem;
|
473 |
+
border: 1px solid #e2e8f0;
|
474 |
+
}
|
475 |
+
</style>
|
476 |
+
|
477 |
<!-- Footer -->
|
478 |
<footer class="bg-gray-900 text-white py-12">
|
479 |
<div class="container mx-auto px-4">
|
|
|
571 |
</div>
|
572 |
</div>
|
573 |
|
574 |
+
<div class="mb-6">
|
575 |
+
<h4 class="font-bold mb-3">Payment Method</h4>
|
576 |
+
<div class="space-y-3">
|
577 |
+
<div class="flex items-center">
|
578 |
+
<input type="radio" id="easypaisa" name="payment" value="easypaisa" class="mr-2" checked>
|
579 |
+
<label for="easypaisa" class="flex items-center">
|
580 |
+
<img src="https://play-lh.googleusercontent.com/DTXkUuB2V7V8OQYioQpVJkEEEFHZq8n1qtzdH8iXyJ4gXQz9Xz9Xz9Xz9Xz9Xz9Xz9" alt="EasyPaisa" class="h-6 mr-2">
|
581 |
+
EasyPaisa
|
582 |
+
</label>
|
583 |
+
</div>
|
584 |
+
<div class="flex items-center">
|
585 |
+
<input type="radio" id="jazzcash" name="payment" value="jazzcash" class="mr-2">
|
586 |
+
<label for="jazzcash" class="flex items-center">
|
587 |
+
<img src="https://play-lh.googleusercontent.com/9pXJ9z5z9pXJ9z5z9pXJ9z5z9pXJ9z5z9pXJ9z5z9pXJ9z5z9pXJ9z5z9pXJ9z5" alt="JazzCash" class="h-6 mr-2">
|
588 |
+
JazzCash
|
589 |
+
</label>
|
590 |
+
</div>
|
591 |
+
<div class="flex items-center">
|
592 |
+
<input type="radio" id="bank" name="payment" value="bank" class="mr-2">
|
593 |
+
<label for="bank" class="flex items-center">
|
594 |
+
<i class="fas fa-university text-blue-500 mr-2"></i>
|
595 |
+
Bank Transfer
|
596 |
+
</label>
|
597 |
+
</div>
|
598 |
+
</div>
|
599 |
+
</div>
|
600 |
+
|
601 |
+
<div id="payment-details" class="mb-4 hidden">
|
602 |
+
<div id="easypaisa-details" class="payment-method">
|
603 |
+
<p class="text-sm mb-2">Send payment to EasyPaisa account:</p>
|
604 |
+
<p class="font-bold">0323-5186970</p>
|
605 |
+
<p class="text-sm mt-2">After payment, share receipt via WhatsApp at +92 323 5186970</p>
|
606 |
+
</div>
|
607 |
+
<div id="jazzcash-details" class="payment-method hidden">
|
608 |
+
<p class="text-sm mb-2">Send payment to JazzCash account:</p>
|
609 |
+
<p class="font-bold">0323-5186970</p>
|
610 |
+
<p class="text-sm mt-2">After payment, share receipt via WhatsApp at +92 323 5186970</p>
|
611 |
+
</div>
|
612 |
+
<div id="bank-details" class="payment-method hidden">
|
613 |
+
<p class="text-sm mb-2">Bank Account Details:</p>
|
614 |
+
<p class="font-bold">Bank: HBL</p>
|
615 |
+
<p class="font-bold">Account Title: Dialup Watches</p>
|
616 |
+
<p class="font-bold">Account #: 1234567890123</p>
|
617 |
+
<p class="text-sm mt-2">After transfer, share receipt via WhatsApp at +92 323 5186970</p>
|
618 |
+
</div>
|
619 |
+
</div>
|
620 |
+
|
621 |
<button id="checkout-btn" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-3 px-4 rounded transition duration-300 mb-4">
|
622 |
+
Confirm Order
|
623 |
</button>
|
624 |
|
625 |
<a href="#" class="block text-center text-blue-600 hover:text-blue-800 font-medium">
|
|
|
762 |
}
|
763 |
}
|
764 |
|
765 |
+
// Payment method selection
|
766 |
+
const paymentMethods = document.querySelectorAll('input[name="payment"]');
|
767 |
+
const paymentDetails = document.getElementById('payment-details');
|
768 |
+
const paymentMethodDetails = document.querySelectorAll('.payment-method');
|
769 |
+
|
770 |
+
paymentMethods.forEach(method => {
|
771 |
+
method.addEventListener('change', () => {
|
772 |
+
paymentDetails.classList.remove('hidden');
|
773 |
+
paymentMethodDetails.forEach(detail => {
|
774 |
+
detail.classList.add('hidden');
|
775 |
+
});
|
776 |
+
document.getElementById(`${method.value}-details`).classList.remove('hidden');
|
777 |
+
});
|
778 |
+
});
|
779 |
+
|
780 |
// Checkout button
|
781 |
const checkoutBtn = document.getElementById('checkout-btn');
|
782 |
checkoutBtn.addEventListener('click', () => {
|
783 |
if (cart.length > 0) {
|
784 |
+
const selectedPayment = document.querySelector('input[name="payment"]:checked').value;
|
785 |
+
let paymentInfo = '';
|
786 |
+
|
787 |
+
if (selectedPayment === 'easypaisa') {
|
788 |
+
paymentInfo = 'EasyPaisa: 0323-5186970';
|
789 |
+
} else if (selectedPayment === 'jazzcash') {
|
790 |
+
paymentInfo = 'JazzCash: 0323-5186970';
|
791 |
+
} else {
|
792 |
+
paymentInfo = 'Bank: HBL - Account # 1234567890123';
|
793 |
+
}
|
794 |
+
|
795 |
+
// Create order summary
|
796 |
+
let orderSummary = 'Order Summary:\n\n';
|
797 |
+
cart.forEach(item => {
|
798 |
+
orderSummary += `${item.name} x ${item.quantity} = Rs.${item.price * item.quantity}\n`;
|
799 |
+
});
|
800 |
+
|
801 |
+
orderSummary += `\nTotal: Rs.${cart.reduce((sum, item) => sum + (item.price * item.quantity), 0)}\n`;
|
802 |
+
orderSummary += `\nPayment Method: ${selectedPayment}\n${paymentInfo}`;
|
803 |
+
|
804 |
+
// Show confirmation modal
|
805 |
+
const confirmed = confirm(`${orderSummary}\n\nPlease confirm your order. After payment, share receipt via WhatsApp at +92 323 5186970`);
|
806 |
+
|
807 |
+
if (confirmed) {
|
808 |
+
// In a real implementation, you would send this data to your backend
|
809 |
+
alert('Order confirmed! Please complete your payment and share the receipt. We will process your order shortly.');
|
810 |
+
cart = [];
|
811 |
+
updateCart();
|
812 |
+
cartSidebar.classList.add('hidden');
|
813 |
+
overlay.classList.add('hidden');
|
814 |
+
}
|
815 |
} else {
|
816 |
alert('Your cart is empty. Please add some items before checking out.');
|
817 |
}
|