deepsite-project-u83dz / checkout.html
codebyjerry's picture
Initial DeepSite commit
5a4691d verified
Raw History Blame Contribute Delete
15.9 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Checkout | LUMINA</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/lucide@latest"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;700&display=swap" rel="stylesheet">
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: { 500: '#f97316', 600: '#ea580c' },
creative: { 500: '#0ea5e9' }
},
fontFamily: {
sans: ['Inter', 'sans-serif'],
display: ['Space Grotesk', 'sans-serif'],
}
}
}
}
</script>
<style>
.step-active { @apply bg-primary-500 text-white border-primary-500; }
.step-complete { @apply bg-green-500 text-white border-green-500; }
.input-field { @apply w-full px-4 py-3 border border-gray-200 rounded-xl focus:outline-none focus:border-primary-500 focus:ring-2 focus:ring-primary-500/20 transition-all; }
</style>
</head>
<body class="bg-gray-50 text-gray-900 min-h-screen">
<!-- Checkout Header -->
<header class="bg-white border-b border-gray-100 sticky top-0 z-50">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4">
<div class="flex items-center justify-between">
<a href="index.html" class="flex items-center gap-2">
<div class="w-10 h-10 bg-gradient-to-br from-primary-500 to-creative-500 rounded-xl flex items-center justify-center">
<i data-lucide="sparkles" class="w-6 h-6 text-white"></i>
</div>
<span class="font-display text-2xl font-bold">LUMINA</span>
</a>
<div class="hidden sm:flex items-center gap-2 text-sm text-gray-600">
<i data-lucide="lock" class="w-4 h-4"></i>
Secure Checkout
</div>
</div>
</div>
</header>
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<!-- Progress Steps -->
<div class="flex items-center justify-center mb-8">
<div class="flex items-center gap-4 sm:gap-8">
<div class="flex items-center gap-2 sm:gap-3" id="step1Indicator">
<div class="w-8 h-8 sm:w-10 sm:h-10 rounded-full bg-primary-500 text-white flex items-center justify-center font-bold text-sm sm:text-base">1</div>
<span class="font-semibold text-sm sm:text-base hidden sm:inline">Shipping</span>
</div>
<div class="w-12 sm:w-20 h-0.5 bg-gray-200"></div>
<div class="flex items-center gap-2 sm:gap-3" id="step2Indicator">
<div class="w-8 h-8 sm:w-10 sm:h-10 rounded-full bg-gray-200 text-gray-600 flex items-center justify-center font-bold text-sm sm:text-base">2</div>
<span class="text-gray-500 text-sm sm:text-base hidden sm:inline">Payment</span>
</div>
<div class="w-12 sm:w-20 h-0.5 bg-gray-200"></div>
<div class="flex items-center gap-2 sm:gap-3" id="step3Indicator">
<div class="w-8 h-8 sm:w-10 sm:h-10 rounded-full bg-gray-200 text-gray-600 flex items-center justify-center font-bold text-sm sm:text-base">3</div>
<span class="text-gray-500 text-sm sm:text-base hidden sm:inline">Confirm</span>
</div>
</div>
</div>
<div class="grid lg:grid-cols-3 gap-8">
<!-- Main Form -->
<div class="lg:col-span-2">
<!-- Step 1: Shipping -->
<div id="step1" class="bg-white rounded-2xl p-6 sm:p-8 border border-gray-100">
<h2 class="font-display text-2xl font-bold mb-6">Shipping Information</h2>
<form id="shippingForm" class="space-y-4">
<div class="grid sm:grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium mb-2">First Name *</label>
<input type="text" required class="input-field" placeholder="John">
</div>
<div>
<label class="block text-sm font-medium mb-2">Last Name *</label>
<input type="text" required class="input-field" placeholder="Doe">
</div>
</div>
<div>
<label class="block text-sm font-medium mb-2">Email *</label>
<input type="email" required class="input-field" placeholder="john@example.com">
</div>
<div>
<label class="block text-sm font-medium mb-2">Phone *</label>
<input type="tel" required class="input-field" placeholder="+91 98765 43210">
</div>
<div>
<label class="block text-sm font-medium mb-2">Address *</label>
<input type="text" required class="input-field mb-3" placeholder="Street address">
<input type="text" class="input-field" placeholder="Apartment, suite, etc. (optional)">
</div>
<div class="grid sm:grid-cols-3 gap-4">
<div>
<label class="block text-sm font-medium mb-2">City *</label>
<input type="text" required class="input-field" placeholder="Bangalore">
</div>
<div>
<label class="block text-sm font-medium mb-2">State *</label>
<select required class="input-field">
<option value="">Select state</option>
<option value="KA">Karnataka</option>
<option value="MH">Maharashtra</option>
<option value="DL">Delhi</option>
<option value="TN">Tamil Nadu</option>
</select>
</div>
<div>
<label class="block text-sm font-medium mb-2">PIN Code *</label>
<input type="text" required class="input-field" placeholder="560001">
</div>
</div>
</form>
<button onclick="goToStep(2)" class="w-full mt-6 bg-gray-900 hover:bg-primary-500 text-white py-4 rounded-xl font-semibold transition-colors">
Continue to Payment
</button>
</div>
<!-- Step 2: Payment -->
<div id="step2" class="hidden bg-white rounded-2xl p-6 sm:p-8 border border-gray-100">
<h2 class="font-display text-2xl font-bold mb-6">Payment Method</h2>
<div class="space-y-4 mb-6">
<label class="flex items-center gap-4 p-4 border-2 border-primary-500 bg-primary-50 rounded-xl cursor-pointer">
<input type="radio" name="payment" value="card" checked class="w-5 h-5 text-primary-500">
<div class="flex-1">
<div class="font-semibold">Credit/Debit Card</div>
<div class="text-sm text-gray-500">Visa, Mastercard, RuPay</div>
</div>
<div class="flex gap-2">
<div class="w-10 h-6 bg-gray-200 rounded"></div>
<div class="w-10 h-6 bg-gray-200 rounded"></div>
</div>
</label>
<label class="flex items-center gap-4 p-4 border-2 border-gray-200 rounded-xl cursor-pointer hover:border-gray-300">
<input type="radio" name="payment" value="upi" class="w-5 h-5">
<div class="flex-1">
<div class="font-semibold">UPI</div>
<div class="text-sm text-gray-500">Google Pay, PhonePe, Paytm</div>
</div>
</label>
<label class="flex items-center gap-4 p-4 border-2 border-gray-200 rounded-xl cursor-pointer hover:border-gray-300">
<input type="radio" name="payment" value="cod" class="w-5 h-5">
<div class="flex-1">
<div class="font-semibold">Cash on Delivery</div>
<div class="text-sm text-gray-500">Pay when you receive</div>
</div>
</label>
</div>
<div id="cardForm" class="space-y-4">
<div>
<label class="block text-sm font-medium mb-2">Card Number *</label>
<input type="text" placeholder="1234 5678 9012 3456" class="input-field">
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium mb-2">Expiry Date *</label>
<input type="text" placeholder="MM/YY" class="input-field">
</div>
<div>
<label class="block text-sm font-medium mb-2">CVV *</label>
<input type="text" placeholder="123" class="input-field">
</div>
</div>
<div>
<label class="block text-sm font-medium mb-2">Name on Card *</label>
<input type="text" placeholder="JOHN DOE" class="input-field">
</div>
</div>
<div class="flex gap-4 mt-6">
<button onclick="goToStep(1)" class="flex-1 border-2 border-gray-200 text-gray-700 py-4 rounded-xl font-semibold hover:bg-gray-50 transition-colors">
Back
</button>
<button onclick="goToStep(3)" class="flex-1 bg-gray-900 hover:bg-primary-500 text-white py-4 rounded-xl font-semibold transition-colors">
Review Order
</button>
</div>
</div>
<!-- Step 3: Confirmation -->
<div id="step3" class="hidden bg-white rounded-2xl p-6 sm:p-8 border border-gray-100 text-center">
<div class="w-20 h-20 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-6">
<i data-lucide="check" class="w-10 h-10 text-green-600"></i>
</div>
<h2 class="font-display text-2xl font-bold mb-4">Order Confirmed!</h2>
<p class="text-gray-600 mb-8">Thank you for your purchase. We've sent a confirmation email to your inbox.</p>
<div class="bg-gray-50 rounded-xl p-6 mb-8 text-left">
<div class="flex justify-between mb-2">
<span class="text-gray-600">Order Number</span>
<span class="font-bold">#ORD-${Date.now().toString().slice(-6)}</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Estimated Delivery</span>
<span class="font-bold">3-5 Business Days</span>
</div>
</div>
<a href="index.html" class="inline-flex items-center gap-2 bg-primary-500 hover:bg-primary-600 text-white px-8 py-4 rounded-xl font-semibold transition-colors">
Continue Shopping <i data-lucide="arrow-right" class="w-5 h-5"></i>
</a>
</div>
</div>
<!-- Order Summary -->
<div class="lg:sticky lg:top-24 h-fit">
<div class="bg-white rounded-2xl p-6 border border-gray-100">
<h3 class="font-display text-lg font-bold mb-4">Order Summary</h3>
<div id="checkoutItems" class="space-y-3 mb-4 max-h-60 overflow-y-auto">
<!-- Items rendered by JS -->
</div>
<div class="border-t border-gray-200 pt-4 space-y-2 text-sm">
<div class="flex justify-between text-gray-600">
<span>Subtotal</span>
<span id="checkoutSubtotal">₹0</span>
</div>
<div class="flex justify-between text-gray-600">
<span>Shipping</span>
<span id="checkoutShipping">Free</span>
</div>
<div class="flex justify-between text-gray-600">
<span>Tax</span>
<span id="checkoutTax">₹0</span>
</div>
<div class="flex justify-between font-display text-lg font-bold pt-2">
<span>Total</span>
<span id="checkoutTotal">₹0</span>
</div>
</div>
</div>
</div>
</div>
</main>
<script src="script.js"></script>
<script>
let currentStep = 1;
document.addEventListener('DOMContentLoaded', () => {
lucide.createIcons();
renderCheckoutSummary();
const cart = getCart();
if (cart.length === 0) {
window.location.href = 'products.html';
}
});
function goToStep(step) {
if (step === 2 && !document.getElementById('shippingForm').checkValidity()) {
document.getElementById('shippingForm').reportValidity();
return;
}
// Hide all steps
document.getElementById('step1').classList.add('hidden');
document.getElementById('step2').classList.add('hidden');
document.getElementById('step3').classList.add('hidden');
// Show current step
document.getElementById(`step${step}`).classList.remove('hidden');
// Update indicators
updateStepIndicators(step);
currentStep = step;
if (step === 3) {
clearCart();
}
window.scrollTo({ top: 0, behavior: 'smooth' });
}
function updateStepIndicators(active) {
const indicators = [
document.getElementById('step1Indicator'),
document.getElementById('step2Indicator'),
document.getElementById('step3Indicator')
];
indicators.forEach((ind, i) => {
const stepNum = i + 1;
const circle = ind.querySelector('div');
const text = ind.querySelector('span');
if (stepNum < active) {
circle.className = 'w-8 h-8 sm:w-10 sm:h-10 rounded-full bg-green-500 text-white flex items-center justify-center font-bold';
circle.innerHTML = '<i data-lucide="check" class="w-5 h-5"></i>';
} else if (stepNum === active) {
circle.className = 'w-8 h-8 sm:w-10 sm:h-10 rounded-full bg-primary-500 text-white flex items-center justify-center font-bold';
circle.textContent = stepNum;
text.className = 'font-semibold text-sm sm:text-base hidden sm:inline';
} else {
circle.className = 'w-8 h-8 sm:w-10 sm:h-10 rounded-full bg-gray-200 text-gray-600 flex items-center justify-center font-bold';
circle.textContent = stepNum;
text.className = 'text-gray-500 text-sm sm:text-base hidden sm:inline';
}
});
lucide.createIcons();
}
function renderCheckoutSummary() {
const cart = getCart();
const container = document.getElementById('checkoutItems');
container.innerHTML = cart.map(item => {
const product = products.find(p => p.id === item.id);
return `
<div class="flex gap-3">
<img src="${product.image}" class="w-16 h-16 rounded-lg object-cover">
<div class="flex-1 min-w-0">
<p class="font-medium text-sm truncate">${product.name}</p>
<p class="text-xs text-gray-500">Qty: ${item.quantity}</p>
<p class="text-sm font-semibold">₹${(product.price * item.quantity).toLocaleString()}</p>
</div>
</div>
`;
}).join('');
// Calculate totals
const subtotal = cart.reduce((sum, item) => {
const product = products.find(p => p.id === item.id);
return sum + (product.price * item.quantity);
}, 0);
const shipping = subtotal > 2500 ? 0 : 99;
const tax = Math.round(subtotal * 0.18);
const total = subtotal + shipping + tax;
document.getElementById('checkoutSubtotal').textContent = `₹${subtotal.toLocaleString()}`;
document.getElementById('checkoutShipping').textContent = shipping === 0 ? 'Free' : `₹${shipping}`;
document.getElementById('checkoutTax').textContent = `₹${tax.toLocaleString()}`;
document.getElementById('checkoutTotal').textContent = `₹${total.toLocaleString()}`;
}
</script>
</body>
</html>