/
home
/
u820193700
/
domains
/
throtllr.in
/
public_html
/
Upload File
HOME
<?php require_once 'includes/db.php'; require_once 'includes/functions.php'; if (!is_customer_logged_in()) { redirect('login.php'); } $customer_id = $_SESSION['customer_id']; // Fetch User Info $stmt = $pdo->prepare("SELECT * FROM customers WHERE id = ?"); $stmt->execute([$customer_id]); $user = $stmt->fetch(); // Fetch Sell Requests $stmtSell = $pdo->prepare("SELECT * FROM sell_requests WHERE customer_id = ? ORDER BY created_at DESC"); $stmtSell->execute([$customer_id]); $sell_requests = $stmtSell->fetchAll(); // Fetch Inspections $stmtInsp = $pdo->prepare(" SELECT i.*, b.model_name as bike_model, b.reference_id as bike_ref FROM inspection_bookings i LEFT JOIN bikes b ON i.bike_id = b.id WHERE i.customer_id = ? ORDER BY i.created_at DESC "); $stmtInsp->execute([$customer_id]); $inspections = $stmtInsp->fetchAll(); // Fetch Wishlist $stmtWish = $pdo->prepare(" SELECT b.*, w.id as wishlist_id, (SELECT image_url FROM bike_images WHERE bike_id = b.id AND is_main = TRUE LIMIT 1) as main_image FROM wishlist w JOIN bikes b ON w.bike_id = b.id WHERE w.customer_id = ? ORDER BY w.created_at DESC "); $stmtWish->execute([$customer_id]); $wishlist_bikes = $stmtWish->fetchAll(); require_once 'includes/header.php'; ?> <style> /* Dashboard Custom Styling */ .dash-header { background: linear-gradient(135deg, rgba(28,28,28,0.95) 0%, rgba(18,18,18,0.95) 100%), url('https://images.unsplash.com/photo-1558981408-db0ecd8a1ee4?q=80&w=1200&auto=format&fit=crop') center/cover no-repeat; padding: 80px 0 60px 0; border-bottom: 2px solid var(--re-red); margin-top: 56px; /* Offset for fixed navbar */ } .profile-avatar { width: 100px; height: 100px; font-size: 2.5rem; box-shadow: 0 0 20px rgba(220, 53, 69, 0.4); border: 3px solid #fff; } .dash-nav { display: flex; gap: 10px; overflow-x: auto; white-space: nowrap; padding-bottom: 10px; } .dash-nav .nav-link { color: #fff; border: none; border-bottom: 3px solid transparent; padding: 15px 25px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; background: transparent !important; border-radius: 0; } .dash-nav .nav-link:hover { color: var(--re-red) !important; } .dash-nav .nav-link.active { color: var(--re-red) !important; border-bottom: 3px solid var(--re-red); } .activity-card { transition: transform 0.3s ease, box-shadow 0.3s ease; border-left: 4px solid transparent; } .activity-card:hover { transform: translateX(5px); border-left-color: var(--re-red); background: rgba(40,40,40,0.8) !important; } .bike-card { transition: transform 0.3s ease; } .bike-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.5); } /* Custom scrollbar for mobile nav */ .dash-nav::-webkit-scrollbar { height: 4px; } .dash-nav::-webkit-scrollbar-thumb { background-color: var(--re-red); border-radius: 4px; } </style> <div class="dash-header"> <div class="container fade-up"> <div class="row align-items-center"> <div class="col-md-8 d-flex align-items-center"> <div class="bg-re-red text-white rounded-circle d-inline-flex align-items-center justify-content-center me-4 profile-avatar"> <?php echo strtoupper(substr($user['name'], 0, 1)); ?> </div> <div> <h1 class="fw-bold mb-1">Welcome back, <?php echo htmlspecialchars($user['name']); ?></h1> <p class="text-white-50 mb-0 fs-5"> <i class="fas fa-map-marker-alt me-2 text-re-red"></i><?php echo htmlspecialchars($user['city'] ?? 'India'); ?> <span class="mx-2">|</span> <i class="fas fa-phone-alt me-2 text-re-red"></i><?php echo htmlspecialchars($user['phone']); ?> </p> </div> </div> <div class="col-md-4 text-md-end mt-4 mt-md-0"> <a href="logout.php" class="btn btn-outline-light rounded-pill px-4 py-2"><i class="fas fa-sign-out-alt me-2"></i> Logout</a> </div> </div> </div> </div> <section class="py-5"> <div class="container py-2 fade-up"> <ul class="nav nav-pills dash-nav mb-5 border-bottom border-secondary border-opacity-50" id="dashboardTabs" role="tablist"> <li class="nav-item" role="presentation"> <button class="nav-link active" id="sell-tab" data-bs-toggle="pill" data-bs-target="#sell" type="button" role="tab"><i class="fas fa-motorcycle me-2"></i>My Sell Requests</button> </li> <li class="nav-item" role="presentation"> <button class="nav-link" id="inspection-tab" data-bs-toggle="pill" data-bs-target="#inspection" type="button" role="tab"><i class="fas fa-search me-2"></i>My Inspections</button> </li> <li class="nav-item" role="presentation"> <button class="nav-link" id="wishlist-tab" data-bs-toggle="pill" data-bs-target="#wishlist" type="button" role="tab"><i class="fas fa-heart me-2"></i>My Wishlist</button> </li> </ul> <div class="tab-content" id="dashboardTabContent"> <!-- Sell Requests --> <div class="tab-pane fade show active" id="sell" role="tabpanel"> <div class="d-flex justify-content-between align-items-center mb-4"> <h3 class="fw-bold">Sell Requests</h3> <a href="sell-bike.php" class="btn btn-primary rounded-pill"><i class="fas fa-plus me-2"></i>New Request</a> </div> <?php if (count($sell_requests) > 0): ?> <div class="row g-4"> <?php foreach($sell_requests as $req): ?> <div class="col-12"> <div class="glass-card p-4 activity-card d-flex flex-column flex-md-row justify-content-between align-items-md-center"> <div> <h5 class="mb-1 text-white"><?php echo htmlspecialchars($req['model_name']); ?> <span class="text-muted">(<?php echo htmlspecialchars($req['year']); ?>)</span></h5> <p class="text-muted mb-0"><small>Ref: <?php echo htmlspecialchars($req['reference_id']); ?> | Submitted on <?php echo date('M d, Y', strtotime($req['created_at'])); ?></small></p> </div> <div class="text-md-end mt-3 mt-md-0"> <h4 class="text-re-red mb-1">₹ <?php echo number_format($req['expected_price'] ?? 0); ?></h4> <?php $statusClass = 'bg-secondary'; if($req['status'] == 'approved') $statusClass = 'bg-success'; if($req['status'] == 'pending') $statusClass = 'bg-warning text-dark'; if($req['status'] == 'rejected') $statusClass = 'bg-danger'; if($req['status'] == 'reviewing') $statusClass = 'bg-info text-dark'; ?> <span class="badge <?php echo $statusClass; ?> px-3 py-2 rounded-pill fs-7"><?php echo strtoupper($req['status']); ?></span> </div> </div> </div> <?php endforeach; ?> </div> <?php else: ?> <div class="glass-card text-center py-5"> <i class="fas fa-motorcycle fa-3x text-muted mb-3 opacity-50"></i> <h4 class="text-white">No Sell Requests Yet</h4> <p class="text-muted mb-4">Looking to upgrade? Get the best value for your Royal Enfield.</p> <a href="sell-bike.php" class="btn btn-primary">Sell Your Bike</a> </div> <?php endif; ?> </div> <!-- Inspections --> <div class="tab-pane fade" id="inspection" role="tabpanel"> <div class="d-flex justify-content-between align-items-center mb-4"> <h3 class="fw-bold">Inspection Bookings</h3> <a href="buy-bikes.php" class="btn btn-outline-light rounded-pill">Browse Bikes</a> </div> <?php if (count($inspections) > 0): ?> <div class="row g-4"> <?php foreach($inspections as $insp): ?> <div class="col-12"> <div class="glass-card p-4 activity-card d-flex flex-column flex-md-row justify-content-between align-items-md-center"> <div> <?php if($insp['bike_model']): ?> <h5 class="mb-1 text-white">Inspection for <a href="bike-details.php?id=<?php echo $insp['bike_id']; ?>" class="text-re-red text-decoration-none"><?php echo htmlspecialchars($insp['bike_model']); ?></a></h5> <?php else: ?> <h5 class="mb-1 text-white">General Showroom Inspection</h5> <?php endif; ?> <p class="text-muted mb-0"><small> <i class="far fa-calendar-alt me-1"></i> <?php echo date('M d, Y', strtotime($insp['preferred_date'])); ?> | <i class="far fa-clock me-1"></i> <?php echo htmlspecialchars($insp['preferred_time'] ?? 'Any Time'); ?> </small></p> </div> <div class="text-md-end mt-3 mt-md-0"> <?php $statusClass = 'bg-secondary'; if($insp['status'] == 'completed') $statusClass = 'bg-success'; if($insp['status'] == 'pending') $statusClass = 'bg-warning text-dark'; if($insp['status'] == 'assigned') $statusClass = 'bg-info text-dark'; if($insp['status'] == 'cancelled') $statusClass = 'bg-danger'; ?> <span class="badge <?php echo $statusClass; ?> px-3 py-2 rounded-pill fs-7"><?php echo strtoupper($insp['status']); ?></span> </div> </div> </div> <?php endforeach; ?> </div> <?php else: ?> <div class="glass-card text-center py-5"> <i class="fas fa-search fa-3x text-muted mb-3 opacity-50"></i> <h4 class="text-white">No Inspections Booked</h4> <p class="text-muted mb-4">Want to see a bike in person? Book a certified inspection today.</p> <a href="buy-bikes.php" class="btn btn-primary">Find a Bike</a> </div> <?php endif; ?> </div> <!-- Wishlist --> <div class="tab-pane fade" id="wishlist" role="tabpanel"> <div class="mb-4"> <h3 class="fw-bold">My Saved Bikes</h3> </div> <?php if (count($wishlist_bikes) > 0): ?> <div class="row g-4"> <?php foreach($wishlist_bikes as $bike): ?> <div class="col-lg-4 col-md-6"> <div class="glass-card h-100 bike-card"> <div class="position-relative"> <?php $imgSrc = $bike['main_image'] ? $bike['main_image'] : 'https://images.unsplash.com/photo-1558981806-ec527fa84c39?q=80&w=800'; ?> <img src="<?php echo htmlspecialchars($imgSrc); ?>" class="w-100 rounded-top" style="height: 250px; object-fit: cover;" alt="<?php echo htmlspecialchars($bike['model_name']); ?>"> <div class="position-absolute top-0 end-0 bg-re-red text-white px-3 py-1 m-2 fw-bold rounded">₹ <?php echo number_format($bike['price']); ?></div> <button class="btn btn-dark btn-sm rounded-circle position-absolute top-0 start-0 m-2" onclick="removeWishlist(<?php echo $bike['id']; ?>)" title="Remove from wishlist"> <i class="fas fa-times text-white"></i> </button> </div> <div class="p-4"> <h4 class="mb-2"><?php echo htmlspecialchars($bike['model_name']); ?></h4> <div class="d-flex justify-content-between text-muted mb-3 fs-6"> <span><i class="fas fa-calendar-alt me-1"></i> <?php echo htmlspecialchars($bike['year']); ?></span> <span><i class="fas fa-road me-1"></i> <?php echo number_format($bike['km_driven']); ?> KM</span> </div> <p class="text-muted"><i class="fas fa-map-marker-alt me-1 text-re-red"></i> <?php echo htmlspecialchars($bike['location']); ?></p> <a href="bike-details.php?id=<?php echo $bike['id']; ?>" class="btn btn-outline-light w-100 mt-2">View Details</a> </div> </div> </div> <?php endforeach; ?> </div> <?php else: ?> <div class="glass-card text-center py-5"> <i class="far fa-heart fa-3x text-muted mb-3 opacity-50"></i> <h4 class="text-white">Your Wishlist is Empty</h4> <p class="text-muted mb-4">Explore our inventory and save the bikes you love.</p> <a href="buy-bikes.php" class="btn btn-primary">Start Browsing</a> </div> <?php endif; ?> </div> </div> </div> </section> <script> function removeWishlist(bikeId) { if(confirm('Remove this bike from your wishlist?')) { fetch('api/toggle_wishlist.php', { method: 'POST', headers: {'Content-Type': 'application/x-www-form-urlencoded'}, body: 'bike_id=' + bikeId }) .then(res => res.json()) .then(data => { if(data.status === 'removed') { location.reload(); // Simple reload to refresh the list } }); } } </script> <?php require_once 'includes/footer.php'; ?>