static-variables / jweb /ac1 /src /pages /whatsapp-channel.php
fellybikush's picture
Upload 99 files
0dff816 verified
raw
history blame
30 kB
<?php
// Start session and check if user is logged in
session_start();
if (!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] !== true) {
header('Location: ../../index.php');
exit;
}
// Include database configuration
include_once '../../db.php';
// Initialize database connection
$database = new Database();
$db = $database->getConnection();
// Get user data from session
$username = $_SESSION['username'];
$email = $_SESSION['email'];
$tier = $_SESSION['tier'];
$package = $_SESSION['package'];
$balance = $_SESSION['balance'];
$total_deposits = $_SESSION['total_deposits'];
$total_withdrawals = $_SESSION['total_withdrawals'];
$rewards = $_SESSION['rewards'];
$earnings = $total_deposits - $total_withdrawals;
// Fetch WhatsApp channels from database
$channels_query = "SELECT * FROM whatsapp_channels WHERE is_active = 1 ORDER BY channel_type";
$channels_stmt = $db->prepare($channels_query);
$channels_stmt->execute();
$channels = $channels_stmt->fetchAll(PDO::FETCH_ASSOC);
// Fetch FAQs from database
$faqs_query = "SELECT * FROM faqs WHERE is_active = 1 ORDER BY category, id";
$faqs_stmt = $db->prepare($faqs_query);
$faqs_stmt->execute();
$faqs = $faqs_stmt->fetchAll(PDO::FETCH_ASSOC);
// Handle support ticket submission
if ($_POST && isset($_POST['submit_ticket'])) {
$issue_type = $_POST['issue_type'];
$subject = $_POST['subject'];
$description = $_POST['description'];
$ticket_number = 'TKT' . date('Ymd') . rand(1000, 9999);
$ticket_query = "INSERT INTO support_tickets (user_id, ticket_number, issue_type, subject, description)
VALUES (:user_id, :ticket_number, :issue_type, :subject, :description)";
$ticket_stmt = $db->prepare($ticket_query);
$ticket_stmt->bindParam(':user_id', $_SESSION['user_id']);
$ticket_stmt->bindParam(':ticket_number', $ticket_number);
$ticket_stmt->bindParam(':issue_type', $issue_type);
$ticket_stmt->bindParam(':subject', $subject);
$ticket_stmt->bindParam(':description', $description);
if ($ticket_stmt->execute()) {
$ticket_success = "Support ticket submitted successfully! Ticket ID: " . $ticket_number;
} else {
$ticket_error = "Error submitting support ticket. Please try again.";
}
}
// Check user's active tickets
$active_tickets_query = "SELECT COUNT(*) as active_count FROM support_tickets WHERE user_id = :user_id AND status IN ('open', 'in_progress')";
$active_tickets_stmt = $db->prepare($active_tickets_query);
$active_tickets_stmt->bindParam(':user_id', $_SESSION['user_id']);
$active_tickets_stmt->execute();
$active_tickets = $active_tickets_stmt->fetch(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Japanese Motors β€” Dashboard</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700;800&display=swap" rel="stylesheet">
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<style>
:root {
--bg: #7b848d;
--card: #7a2f3b;
--card-2: #6f2630;
--accent: #efdf2d;
--muted: rgba(255,255,255,0.6);
--glass: rgba(255,255,255,0.04);
--promo-gradient: linear-gradient(180deg,#a13df0 0%, #ff2a79 50%, #d70b1a 100%);
font-family: 'Poppins', system-ui, Arial;
--spacing-unit: 1rem;
--accent-primary: #7c3aed;
--accent-secondary: #a855f7;
--shadow-hover: 0 6px 18px rgba(0, 0, 0, 0.1);
--premium-gold: #d97706;
}
body {
background: var(--bg);
font-family: 'Poppins', sans-serif;
transition: all 0.3s ease;
min-height: 100vh;
}
.sidebar {
width: 250px;
height: 100vh;
background: #0d1321;
color: #fff;
position: fixed;
top: 0;
left: -250px;
transition: all 0.3s ease;
z-index: 1000;
overflow-y: auto;
}
.sidebar.active {
left: 0;
}
#content {
margin-left: 0;
transition: all 0.3s ease;
}
.sidebar.active ~ #content {
margin-left: 250px;
}
header {
background: #222;
color: white;
padding: 15px 20px;
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
z-index: 900;
transition: all 0.3s ease;
}
.sidebar.active ~ #content header {
margin-left: 250px;
}
.menu-toggle {
background: transparent;
border: none;
color: white;
font-size: 1.5rem;
cursor: pointer;
}
.logo-section {
padding: 15px;
border-bottom: 1px solid #1c2230;
display: flex;
align-items: center;
gap: 10px;
}
.brand {
font-size: 1.2rem;
font-weight: 700;
color: #ff9800;
}
.subtitle {
font-size: 0.75rem;
color: #aaa;
}
.menu {
list-style: none;
padding: 0;
margin: 0;
}
.menu li a {
display: flex;
align-items: center;
padding: 12px 20px;
color: white;
text-decoration: none;
transition: background 0.3s;
}
.menu li a:hover {
background: #1c2230;
}
.menu li a i {
margin-right: 12px;
}
.user-footer {
padding: 15px;
background: #222;
display: flex;
align-items: center;
gap: 10px;
position: sticky;
bottom: 0;
}
.avatar {
width: 35px;
height: 35px;
background: #444;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
color: white;
}
.banner {
max-width: 450px;
margin: 0 auto calc(var(--spacing-unit) * 2);
background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
border-radius: 12px;
padding: calc(var(--spacing-unit) * 1.5);
text-align: center;
box-shadow: var(--shadow-hover);
animation: fadeIn 0.5s ease;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
0% { opacity: 1; }
50% { opacity: 0.3; }
100% { opacity: 1; }
}
.banner .title {
font-size: 1.25rem;
margin-bottom: calc(var(--spacing-unit) * 1);
color: #ffffff;
font-weight: 700;
animation: blink 1.5s infinite;
}
.banner p {
font-size: 0.95rem;
line-height: 1.6;
margin-bottom: calc(var(--spacing-unit) * 1);
color: var(--premium-gold);
animation: blink 1.5s infinite;
}
.banner .footer {
font-size: 0.75rem;
color: rgba(255, 255, 255, 0.9);
font-style: italic;
animation: blink 1.5s infinite;
}
.card {
background: var(--card);
border-radius: 12px;
padding: 26px;
color: white;
box-shadow: 0 6px 0 rgba(0,0,0,0.08) inset;
flex: 1;
}
.balance {
background: rgba(255,255,255,0.03);
padding: 14px;
border-radius: 10px;
margin: 18px 0;
display: flex;
align-items: center;
justify-content: space-between;
}
.form-group {
margin: 12px 0;
}
label {
display: block;
margin-bottom: 8px;
color: rgba(255,255,255,0.85);
}
input, select, textarea {
width: 100%;
padding: 14px;
border-radius: 10px;
border: 1px solid rgba(255,255,255,0.05);
background: transparent;
color: white;
}
.btn {
display: inline-block;
padding: 14px 24px;
border-radius: 10px;
background: var(--accent);
color: #111;
font-weight: 700;
border: none;
cursor: pointer;
width: 100%;
}
.btn-outline {
background: transparent;
border: 2px solid var(--accent);
color: var(--accent);
}
.dashboard-card {
background: rgba(0,0,0,0.2);
border-radius: 12px;
padding: 20px;
margin-bottom: 20px;
}
.stat-card {
background: rgba(0,0,0,0.15);
border-radius: 10px;
padding: 16px;
margin-bottom: 16px;
}
.channel-card {
background: rgba(0,0,0,0.2);
border-radius: 12px;
padding: 20px;
margin-bottom: 20px;
transition: transform 0.3s ease;
}
.channel-card:hover {
transform: translateY(-5px);
}
.whatsapp-btn {
background: #25D366;
color: white;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 12px 20px;
border-radius: 10px;
font-weight: 600;
text-decoration: none;
margin-top: 15px;
}
.support-ticket {
background: rgba(0,0,0,0.15);
border-radius: 10px;
padding: 16px;
margin-bottom: 16px;
border-left: 4px solid var(--accent);
}
.faq-item {
background: rgba(0,0,0,0.15);
border-radius: 10px;
padding: 16px;
margin-bottom: 16px;
cursor: pointer;
}
.faq-answer {
display: none;
padding-top: 12px;
color: var(--muted);
}
.active-page {
background: #1c2230;
border-right: 4px solid var(--accent);
}
@media (max-width: 768px) {
.cards {
flex-direction: column;
}
.promo {
width: 92%;
}
.grid-cols-2 {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<!-- Sidebar -->
<aside class="sidebar" id="sidebar">
<div class="logo-section">
<i data-feather="zap" class="text-yellow-400"></i>
<div>
<h2 class="brand">JMOTORS</h2>
<p class="subtitle">Marketing Platform</p>
</div>
</div>
<ul class="menu">
<li><a href="index.php"><i data-feather="home"></i> Dashboard</a></li>
<li><a href="meta-uploads.php"><i data-feather="upload"></i> Meta Uploads</a></li>
<li><a href="transactions.php"><i data-feather="repeat"></i> Transactions</a></li>
<li><a href="transfer.php"><i data-feather="send"></i> Transfer</a></li>
<li><a href="daily-product.php"><i data-feather="shopping-bag"></i> Daily Product</a></li>
<li><a href="withdraw.php"><i data-feather="dollar-sign"></i> Withdraw</a></li>
<li><a href="packages.php"><i data-feather="package"></i> Packages</a></li>
<li><a href="loan.php"><i data-feather="credit-card"></i> Loan</a></li>
<li><a href="recharge.php"><i data-feather="battery-charging"></i> Recharge</a></li>
<li><a href="agent-approval.php" class="active-page"><i data-feather="user-check"></i> Agent Approval</a></li>
<li><a href="access-token.php"><i data-feather="key"></i> Access Token</a></li>
<li><a href="agent-claim.php"><i data-feather="tag"></i> Agent Claim</a></li>
<li><a href="team.php"><i data-feather="users"></i> Team</a></li>
</ul>
<ul class="menu bottom">
<li><a href="profile.php"><i data-feather="user"></i> Profile</a></li>
<li><a href="settings.php"><i data-feather="settings"></i> Settings</a></li>
<li><a href="whatsapp-channel.php"><i data-feather="message-square"></i> Whatsapp Channel</a></li>
<li><a href="customer-care.php"><i data-feather="headphones"></i> Customer Care</a></li>
</ul>
<div class="user-footer">
<div class="avatar"><?php echo substr($username, 0, 2); ?></div>
<div>
<h4><?php echo $username; ?></h4>
<p><?php echo $tier; ?> - Marketer</p>
</div>
</div>
</aside>
<!-- Main Content -->
<div id="content">
<header class="bg-gray-800 text-white p-4">
<div class="flex items-center">
<button class="menu-toggle" id="menu-toggle">
<i data-feather="menu"></i>
</button>
<div class="ml-4 font-bold text-xl">Jmotors</div>
</div>
<nav class="flex items-center space-x-6">
<a href="transfer.php" class="hover:text-yellow-300">Transfer</a>
<a href="loan.php" class="hover:text-yellow-300">Loans</a>
<a href="dailyproduct.php" class="hover:text-yellow-300">New Product</a>
<div class="w-9 h-9 rounded-full bg-gradient-to-r from-yellow-300 to-orange-400 flex items-center justify-center font-bold"><?php echo substr($username, 0, 2); ?></div>
</nav>
</header>
<!-- WhatsApp Channel Page -->
<main class="p-4" id="whatsapp-page">
<div class="banner">
<div class="title">πŸ“± Join Our WhatsApp Community</div>
<p>Get exclusive updates, daily tips, and direct support through our official WhatsApp channels</p>
<div class="footer">πŸ’¬ Real-time notifications &nbsp; β€’ &nbsp; Exclusive content &nbsp; β€’ &nbsp; Instant support</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mt-6">
<?php foreach ($channels as $channel): ?>
<div class="channel-card">
<h3 class="text-lg font-bold mb-4 flex items-center gap-2">
<i data-feather="<?php echo $channel['icon_class']; ?>" class="<?php echo $channel['color_class']; ?>"></i>
<?php echo $channel['channel_name']; ?>
</h3>
<p><?php echo $channel['description']; ?></p>
<ul class="mt-4 space-y-2">
<?php if ($channel['channel_type'] == 'group'): ?>
<li class="flex items-center"><i data-feather="check-circle" class="text-green-400 mr-2"></i> Daily marketing tips</li>
<li class="flex items-center"><i data-feather="check-circle" class="text-green-400 mr-2"></i> Announcements & updates</li>
<li class="flex items-center"><i data-feather="check-circle" class="text-green-400 mr-2"></i> Peer support network</li>
<?php elseif ($channel['channel_type'] == 'channel'): ?>
<li class="flex items-center"><i data-feather="check-circle" class="text-blue-400 mr-2"></i> Official announcements</li>
<li class="flex items-center"><i data-feather="check-circle" class="text-blue-400 mr-2"></i> Product updates</li>
<li class="flex items-center"><i data-feather="check-circle" class="text-blue-400 mr-2"></i> No-chat broadcast only</li>
<?php elseif ($channel['channel_type'] == 'tips'): ?>
<li class="flex items-center"><i data-feather="check-circle" class="text-yellow-400 mr-2"></i> Daily marketing strategies</li>
<li class="flex items-center"><i data-feather="check-circle" class="text-yellow-400 mr-2"></i> Performance optimization</li>
<li class="flex items-center"><i data-feather="check-circle" class="text-yellow-400 mr-2"></i> Expert insights</li>
<?php else: ?>
<li class="flex items-center"><i data-feather="check-circle" class="text-red-400 mr-2"></i> Exclusive opportunities</li>
<li class="flex items-center"><i data-feather="check-circle" class="text-red-400 mr-2"></i> Bonus programs</li>
<li class="flex items-center"><i data-feather="check-circle" class="text-red-400 mr-2"></i> Elite marketer network</li>
<?php endif; ?>
</ul>
<a href="<?php echo $channel['whatsapp_link']; ?>" class="whatsapp-btn" target="_blank">
<i data-feather="<?php echo $channel['channel_type'] == 'channel' ? 'radio' : 'message-circle'; ?>"></i>
<?php echo $channel['channel_type'] == 'channel' ? 'Follow Channel' : 'Join Group'; ?>
</a>
</div>
<?php endforeach; ?>
</div>
<div class="dashboard-card mt-8">
<h3 class="text-lg font-bold mb-4 flex items-center gap-2">
<i data-feather="info" class="text-purple-400"></i> WhatsApp Channel Guidelines
</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="stat-card">
<h4 class="font-bold mb-2">Do's</h4>
<ul class="space-y-2">
<li class="flex items-start"><i data-feather="check" class="text-green-400 mr-2 mt-1"></i> Be respectful to all members</li>
<li class="flex items-start"><i data-feather="check" class="text-green-400 mr-2 mt-1"></i> Share relevant content only</li>
<li class="flex items-start"><i data-feather="check" class="text-green-400 mr-2 mt-1"></i> Use appropriate language</li>
<li class="flex items-start"><i data-feather="check" class="text-green-400 mr-2 mt-1"></i> Follow admin instructions</li>
</ul>
</div>
<div class="stat-card">
<h4 class="font-bold mb-2">Don'ts</h4>
<ul class="space-y-2">
<li class="flex items-start"><i data-feather="x" class="text-red-400 mr-2 mt-1"></i> No spamming or flooding</li>
<li class="flex items-start"><i data-feather="x" class="text-red-400 mr-2 mt-1"></i> No inappropriate content</li>
<li class="flex items-start"><i data-feather="x" class="text-red-400 mr-2 mt-1"></i> No external promotions</li>
<li class="flex items-start"><i data-feather="x" class="text-red-400 mr-2 mt-1"></i> No harassment of any kind</li>
</ul>
</div>
</div>
</div>
</main>
<!-- Customer Care Page (initially hidden) -->
<main class="p-4 hidden" id="customer-care-page">
<div class="promo">
<h2 class="text-xl font-bold mb-2">πŸ›ŽοΈ Customer Care Support</h2>
<div class="inner">
<p>We're here to help you with any issues or questions about your Jmotors account</p>
</div>
<div class="text-sm opacity-95 mt-2">⏰ 24/7 support &nbsp; β€’ &nbsp; Quick response &nbsp; β€’ &nbsp; Expert help</div>
</div>
<?php if (isset($ticket_success)): ?>
<div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative mb-4">
<?php echo $ticket_success; ?>
</div>
<?php endif; ?>
<?php if (isset($ticket_error)): ?>
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4">
<?php echo $ticket_error; ?>
</div>
<?php endif; ?>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mt-6">
<div class="dashboard-card md:col-span-2">
<h3 class="text-lg font-bold mb-4 flex items-center gap-2">
<i data-feather="help-circle" class="text-blue-400"></i> Submit a Support Request
</h3>
<form id="support-form" method="POST">
<input type="hidden" name="submit_ticket" value="1">
<div class="form-group">
<label for="issue-type">Issue Type</label>
<select id="issue-type" name="issue_type" required>
<option value="">Select issue type</option>
<option value="technical">Technical Issue</option>
<option value="account">Account Problem</option>
<option value="payment">Payment Issue</option>
<option value="product">Product Related</option>
<option value="other">Other</option>
</select>
</div>
<div class="form-group">
<label for="subject">Subject</label>
<input type="text" id="subject" name="subject" placeholder="Brief description of your issue" required>
</div>
<div class="form-group">
<label for="description">Description</label>
<textarea id="description" name="description" rows="5" placeholder="Please describe your issue in detail..." required></textarea>
</div>
<div class="form-group">
<label for="attachments">Attachments (Optional)</label>
<input type="file" id="attachments" name="attachments">
</div>
<button type="submit" class="btn">Submit Request</button>
</form>
</div>
<div class="dashboard-card">
<h3 class="text-lg font-bold mb-4 flex items-center gap-2">
<i data-feather="phone" class="text-green-400"></i> Contact Options
</h3>
<div class="stat-card">
<h4 class="font-bold mb-2">Direct WhatsApp Support</h4>
<p class="text-sm mb-3">Chat directly with our support team</p>
<a href="https://wa.me/254756709823" class="whatsapp-btn" target="_blank">
<i data-feather="message-circle"></i> Message Support
</a>
</div>
<div class="stat-card">
<h4 class="font-bold mb-2">Email Support</h4>
<p class="text-sm mb-2">support@jmotors.com</p>
<p class="text-xs text-gray-400">Response within 2 hours</p>
</div>
<div class="stat-card">
<h4 class="font-bold mb-2">Phone Support</h4>
<p class="text-sm mb-2">+254 756 709 823</p>
<p class="text-xs text-gray-400">Available 24/7 for urgent issues</p>
</div>
</div>
</div>
<div class="dashboard-card mt-8">
<h3 class="text-lg font-bold mb-4 flex items-center gap-2">
<i data-feather="book-open" class="text-purple-400"></i> Frequently Asked Questions
</h3>
<?php foreach ($faqs as $faq): ?>
<div class="faq-item">
<div class="flex justify-between items-center">
<h4 class="font-bold"><?php echo $faq['question']; ?></h4>
<i data-feather="chevron-down" class="faq-toggle"></i>
</div>
<div class="faq-answer">
<p><?php echo $faq['answer']; ?></p>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mt-8">
<div class="dashboard-card">
<h3 class="text-lg font-bold mb-4 flex items-center gap-2">
<i data-feather="clock" class="text-yellow-400"></i> Support Hours
</h3>
<div class="space-y-3">
<div class="flex justify-between">
<span>WhatsApp Support:</span>
<span class="font-bold">24/7</span>
</div>
<div class="flex justify-between">
<span>Email Support:</span>
<span class="font-bold">Mon-Sun, 6am-11pm</span>
</div>
<div class="flex justify-between">
<span>Phone Support:</span>
<span class="font-bold">24/7 for urgent issues</span>
</div>
<div class="flex justify-between">
<span>Average Response Time:</span>
<span class="font-bold">Under 30 minutes</span>
</div>
</div>
</div>
<div class="dashboard-card">
<h3 class="text-lg font-bold mb-4 flex items-center gap-2">
<i data-feather="file-text" class="text-red-400"></i> Support Tickets
</h3>
<div class="text-center py-4">
<i data-feather="inbox" class="mx-auto text-gray-400 text-4xl"></i>
<p class="mt-2 text-gray-400">Active Tickets: <?php echo $active_tickets['active_count']; ?></p>
</div>
<button class="btn btn-outline">View Ticket History</button>
</div>
</div>
</main>
</div>
<script>
feather.replace();
document.addEventListener('DOMContentLoaded', function() {
const toggleBtn = document.getElementById('menu-toggle');
const sidebar = document.getElementById('sidebar');
const content = document.getElementById('content');
toggleBtn.addEventListener('click', function() {
sidebar.classList.toggle('active');
content.classList.toggle('active');
});
// FAQ toggle functionality
const faqItems = document.querySelectorAll('.faq-item');
faqItems.forEach(item => {
item.addEventListener('click', function() {
const answer = this.querySelector('.faq-answer');
const icon = this.querySelector('.faq-toggle');
if (answer.style.display === 'block') {
answer.style.display = 'none';
icon.setAttribute('data-feather', 'chevron-down');
} else {
answer.style.display = 'block';
icon.setAttribute('data-feather', 'chevron-up');
}
feather.replace();
});
});
// Page navigation simulation
const urlParams = new URLSearchParams(window.location.search);
const page = urlParams.get('page');
if (page === 'customer-care') {
document.getElementById('whatsapp-page').classList.add('hidden');
document.getElementById('customer-care-page').classList.remove('hidden');
document.title = "Japanese Motors β€” Customer Care";
} else {
document.getElementById('whatsapp-page').classList.remove('hidden');
document.getElementById('customer-care-page').classList.add('hidden');
document.title = "Japanese Motors β€” WhatsApp Channel";
}
});
</script>
</body>
</html>