Build-IT_AI / admin.html
Urbanzulu's picture
make sure the user interface is complete and functional all the way around
e59728f verified
raw
history blame
30.1 kB
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Panel | CodeForge-AI</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body class="bg-gray-900 text-white">
<!-- Navigation -->
<nav class="bg-gray-800 border-b border-purple-500/20 sticky top-0 z-50">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between items-center h-16">
<div class="flex items-center space-x-4">
<div class="flex items-center space-x-2">
<div class="w-8 h-8 bg-purple-500 rounded-lg flex items-center justify-center">
<i data-feather="shield" class="w-4 h-4"></i>
</div>
<span class="text-xl font-bold text-white">CodeForge-AI Admin</span>
</div>
<div class="hidden md:flex space-x-6">
<a href="index.html" class="text-gray-300 hover:text-white transition-colors">Home</a>
<a href="dashboard.html" class="text-gray-300 hover:text-white transition-colors">Dashboard</a>
<a href="installation.html" class="text-gray-300 hover:text-white transition-colors">Installation</a>
</div>
</div>
<div class="flex items-center space-x-4">
<div class="text-sm text-gray-300">
Welcome, <span class="text-purple-400 font-semibold">Supreme Admin</span>
</div>
<div class="w-8 h-8 bg-purple-500 rounded-full flex items-center justify-center">
<i data-feather="user" class="w-4 h-4"></i>
</div>
</div>
</div>
</div>
</nav>
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<!-- Admin Stats -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<div class="flex items-center justify-between">
<div>
<p class="text-gray-400 text-sm">Total Users</p>
<p class="text-2xl font-bold text-white">1,247</p>
</div>
<div class="w-12 h-12 bg-purple-500/20 rounded-xl flex items-center justify-center">
<i data-feather="users" class="w-6 h-6 text-purple-400"></i>
</div>
</div>
</div>
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<div class="flex items-center justify-between">
<div>
<p class="text-gray-400 text-sm">Active Workspaces</p>
<p class="text-2xl font-bold text-white">892</p>
</div>
<div class="w-12 h-12 bg-purple-500/20 rounded-xl flex items-center justify-center">
<i data-feather="cpu" class="w-6 h-6 text-purple-400"></i>
</div>
</div>
</div>
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<div class="flex items-center justify-between">
<div>
<p class="text-gray-400 text-sm">System Health</p>
<p class="text-2xl font-bold text-green-400">99.9%</p>
</div>
<div class="w-12 h-12 bg-purple-500/20 rounded-xl flex items-center justify-center">
<i data-feather="activity" class="w-6 h-6 text-purple-400"></i>
</div>
</div>
</div>
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<div class="flex items-center justify-between">
<div>
<p class="text-gray-400 text-sm">Total Revenue</p>
<p class="text-2xl font-bold text-white">$42.8K</p>
</div>
<div class="w-12 h-12 bg-purple-500/20 rounded-xl flex items-center justify-center">
<i data-feather="dollar-sign" class="w-6 h-6 text-purple-400"></i>
</div>
</div>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<!-- System Overview -->
<div class="lg:col-span-2">
<!-- User Management -->
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20 mb-8">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold text-white">User Management</h2>
<button class="bg-purple-500 hover:bg-purple-600 px-4 py-2 rounded-lg text-white text-sm font-medium transition-colors">
<i data-feather="plus" class="w-4 h-4 inline mr-2"></i>
Add User
</button>
</div>
<div class="overflow-x-auto">
<table class="w-full">
<thead>
<tr class="border-b border-gray-700">
<th class="text-left py-3 text-gray-400 font-semibold">User</th>
<th class="text-left py-3 text-gray-400 font-semibold">Plan</th>
<th class="text-left py-3 text-gray-400 font-semibold">Status</th>
<th class="text-left py-3 text-gray-400 font-semibold">Joined</th>
<th class="text-left py-3 text-gray-400 font-semibold">Actions</th>
</tr>
</thead>
<tbody>
<tr class="border-b border-gray-700/50">
<td class="py-3">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 bg-blue-500 rounded-full flex items-center justify-center">
<i data-feather="user" class="w-4 h-4"></i>
</div>
<div>
<p class="font-semibold text-white">John Developer</p>
<p class="text-gray-400 text-sm">john@example.com</p>
</div>
</div>
</td>
<td class="py-3">
<span class="bg-green-500/20 text-green-400 text-xs px-2 py-1 rounded-full">Pro</span>
</td>
<td class="py-3">
<span class="text-green-400 text-sm">Active</span>
</td>
<td class="py-3 text-gray-300 text-sm">2024-01-15</td>
<td class="py-3">
<div class="flex space-x-2">
<button class="text-blue-400 hover:text-blue-300 transition-colors">
<i data-feather="edit" class="w-4 h-4"></i>
</button>
<button class="text-red-400 hover:text-red-300 transition-colors">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
</div>
</td>
</tr>
<tr class="border-b border-gray-700/50">
<td class="py-3">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 bg-green-500 rounded-full flex items-center justify-center">
<i data-feather="user" class="w-4 h-4"></i>
</div>
<div>
<p class="font-semibold text-white">Sarah Coder</p>
<p class="text-gray-400 text-sm">sarah@example.com</p>
</div>
</div>
</td>
<td class="py-3">
<span class="bg-yellow-500/20 text-yellow-400 text-xs px-2 py-1 rounded-full">Starter</span>
</td>
<td class="py-3">
<span class="text-green-400 text-sm">Active</span>
</td>
<td class="py-3 text-gray-300 text-sm">2024-02-03</td>
<td class="py-3">
<div class="flex space-x-2">
<button class="text-blue-400 hover:text-blue-300 transition-colors">
<i data-feather="edit" class="w-4 h-4"></i>
</button>
<button class="text-red-400 hover:text-red-300 transition-colors">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
</div>
</td>
</tr>
<tr>
<td class="py-3">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 bg-purple-500 rounded-full flex items-center justify-center">
<i data-feather="user" class="w-4 h-4"></i>
</div>
<div>
<p class="font-semibold text-white">Mike Engineer</p>
<p class="text-gray-400 text-sm">mike@example.com</p>
</div>
</div>
</td>
<td class="py-3">
<span class="bg-gray-500/20 text-gray-400 text-xs px-2 py-1 rounded-full">Free</span>
</td>
<td class="py-3">
<span class="text-red-400 text-sm">Inactive</span>
</td>
<td class="py-3 text-gray-300 text-sm">2024-03-10</td>
<td class="py-3">
<div class="flex space-x-2">
<button class="text-blue-400 hover:text-blue-300 transition-colors">
<i data-feather="edit" class="w-4 h-4"></i>
</button>
<button class="text-red-400 hover:text-red-300 transition-colors">
<i data-feather="trash-2" class="w-4 h-4"></i>
</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- System Metrics -->
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<h2 class="text-xl font-bold text-white mb-6">System Performance</h2>
<div class="h-64">
<canvas id="systemChart"></canvas>
</div>
</div>
</div>
<!-- Admin Actions -->
<div class="space-y-8">
<!-- Supreme Admin Controls -->
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<div class="flex items-center space-x-3 mb-4">
<div class="w-10 h-10 bg-purple-500 rounded-xl flex items-center justify-center">
<i data-feather="star" class="w-5 h-5"></i>
</div>
<div>
<h2 class="text-xl font-bold text-white">Supreme Admin</h2>
<p class="text-gray-400 text-sm">Unlimited Access</p>
</div>
</div>
<div class="space-y-4 mb-6">
<div class="bg-purple-500/10 border border-purple-500/30 rounded-xl p-4">
<div class="flex items-center justify-between mb-2">
<span class="text-purple-400 font-semibold">AI Usage</span>
<span class="text-white font-bold">Unlimited</span>
</div>
<div class="w-full bg-gray-700 rounded-full h-2">
<div class="bg-purple-500 h-2 rounded-full" style="width: 15%"></div>
</div>
</div>
<div class="bg-purple-500/10 border border-purple-500/30 rounded-xl p-4">
<div class="flex items-center justify-between mb-2">
<span class="text-purple-400 font-semibold">Workspace Limit</span>
<span class="text-white font-bold">Unlimited</span>
</div>
<div class="w-full bg-gray-700 rounded-full h-2">
<div class="bg-purple-500 h-2 rounded-full" style="width: 8%"></div>
</div>
</div>
<div class="bg-purple-500/10 border border-purple-500/30 rounded-xl p-4">
<div class="flex items-center justify-between mb-2">
<span class="text-purple-400 font-semibold">Deployments</span>
<span class="text-white font-bold">Unlimited</span>
</div>
<div class="w-full bg-gray-700 rounded-full h-2">
<div class="bg-purple-500 h-2 rounded-full" style="width: 12%"></div>
</div>
</div>
</div>
<div class="space-y-3">
<button class="w-full bg-purple-500 hover:bg-purple-600 text-white py-3 rounded-xl font-semibold transition-colors flex items-center justify-center">
<i data-feather="settings" class="w-5 h-5 mr-2"></i>
System Settings
</button>
<button class="w-full bg-red-500 hover:bg-red-600 text-white py-3 rounded-xl font-semibold transition-colors flex items-center justify-center">
<i data-feather="alert-triangle" class="w-5 h-5 mr-2"></i>
Emergency Shutdown
</button>
</div>
</div>
<!-- Recent System Logs -->
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<h2 class="text-xl font-bold text-white mb-4">System Logs</h2>
<div class="space-y-4">
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-green-500/20 rounded-full flex items-center justify-center">
<i data-feather="check-circle" class="w-4 h-4 text-green-400"></i>
</div>
<div>
<p class="text-white text-sm">System backup completed successfully</p>
<p class="text-gray-400 text-xs">2 minutes ago</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-blue-500/20 rounded-full flex items-center justify-center">
<i data-feather="user-plus" class="w-4 h-4 text-blue-400"></i>
</div>
<div>
<p class="text-white text-sm">New user registered: alex@example.com</p>
<p class="text-gray-400 text-xs">15 minutes ago</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-yellow-500/20 rounded-full flex items-center justify-center">
<i data-feather="alert-triangle" class="w-4 h-4 text-yellow-400"></i>
</div>
<div>
<p class="text-white text-sm">High CPU usage detected on node-3</p>
<p class="text-gray-400 text-xs">1 hour ago</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-purple-500/20 rounded-full flex items-center justify-center">
<i data-feather="zap" class="w-4 h-4 text-purple-400"></i>
</div>
<div>
<p class="text-white text-sm">AI model training completed</p>
<p class="text-gray-400 text-xs">3 hours ago</p>
</div>
</div>
</div>
</div>
<!-- Quick Stats -->
<div class="bg-gray-800 rounded-2xl p-6 border border-purple-500/20">
<h2 class="text-xl font-bold text-white mb-4">Quick Stats</h2>
<div class="space-y-4">
<div class="flex justify-between items-center">
<span class="text-gray-400">Active Sessions</span>
<span class="text-white font-semibold">347</span>
</div>
<div class="flex justify-between items-center">
<span class="text-gray-400">API Requests</span>
<span class="text-white font-semibold">12.4K</span>
</div>
<div class="flex justify-between items-center">
<span class="text-gray-400">Storage Used</span>
<span class="text-white font-semibold">1.2TB</span>
</div>
<div class="flex justify-between items-center">
<span class="text-gray-400">Error Rate</span>
<span class="text-green-400 font-semibold">0.02%</span>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
// Check if user is logged in as admin
function checkAdminAuth() {
const adminUsername = localStorage.getItem('adminUsername');
const adminPassword = localStorage.getItem('adminPassword');
if (adminUsername !== 'urbanzulu19' || adminPassword !== 'Urbanzulu25') {
window.location.href = 'admin-login.html';
return false;
}
return true;
}
// Initialize Feather Icons
feather.replace();
// Check authentication on page load
if (!checkAdminAuth()) {
// Redirect to login page
window.location.href = 'admin-login.html';
}
// Initialize System Chart
const systemCtx = document.getElementById('systemChart').getContext('2d');
new Chart(systemCtx, {
type: 'line',
data: {
labels: ['00:00', '04:00', '08:00', '12:00', '16:00', '20:00', '24:00'],
datasets: [{
label: 'CPU Usage (%)',
data: [45, 38, 52, 48, 65, 72, 58],
borderColor: '#ef4444',
backgroundColor: 'rgba(239, 68, 68, 0.1)',
tension: 0.4,
fill: true
}, {
label: 'Memory Usage (GB)',
data: [12, 15, 18, 14, 22, 25, 20],
borderColor: '#8b5cf6',
backgroundColor: 'rgba(139, 92, 246, 0.1)',
tension: 0.4,
fill: true
}, {
label: 'Network (MB/s)',
data: [120, 145, 180, 165, 210, 195, 175],
borderColor: '#06b6d4',
backgroundColor: 'rgba(6, 182, 212, 0.1)',
tension: 0.4,
fill: true
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
labels: {
color: '#9ca3af'
}
}
},
scales: {
x: {
grid: {
color: '#374151'
},
ticks: {
color: '#9ca3af'
}
},
y: {
grid: {
color: '#374151'
},
ticks: {
color: '#9ca3af'
}
}
}
}
});
// Add User Modal
const addUserModal = document.createElement('div');
addUserModal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden';
addUserModal.innerHTML = `
<div class="bg-gray-800 rounded-2xl p-6 w-full max-w-md border border-purple-500/20">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold text-white">Add New User</h3>
<button onclick="closeAddUserModal()" class="text-gray-400 hover:text-white">
<i data-feather="x" class="w-5 h-5"></i>
</button>
</div>
<form id="addUserForm" class="space-y-4">
<div>
<label class="block text-gray-300 text-sm mb-2">Name</label>
<input type="text" id="userName" class="w-full bg-gray-700 border border-gray-600 rounded-lg px-4 py-2 text-white focus:outline-none focus:border-purple-500" required>
</div>
<div>
<label class="block text-gray-300 text-sm mb-2">Email</label>
<input type="email" id="userEmail" class="w-full bg-gray-700 border border-gray-600 rounded-lg px-4 py-2 text-white focus:outline-none focus:border-purple-500" required>
</div>
<div>
<label class="block text-gray-300 text-sm mb-2">Plan</label>
<select id="userPlan" class="w-full bg-gray-700 border border-gray-600 rounded-lg px-4 py-2 text-white focus:outline-none focus:border-purple-500">
<option value="free">Free</option>
<option value="starter">Starter</option>
<option value="pro">Pro</option>
</select>
</div>
<div class="flex justify-end space-x-3 pt-4">
<button type="button" onclick="closeAddUserModal()" class="px-4 py-2 text-gray-300 hover:text-white transition-colors">Cancel</button>
<button type="submit" class="bg-purple-500 hover:bg-purple-600 px-4 py-2 rounded-lg text-white font-medium transition-colors">Add User</button>
</div>
</form>
</div>
`;
document.body.appendChild(addUserModal);
function openAddUserModal() {
addUserModal.classList.remove('hidden');
}
function closeAddUserModal() {
addUserModal.classList.add('hidden');
}
// Handle add user form submission
document.getElementById('addUserForm').addEventListener('submit', function(e) {
e.preventDefault();
const name = document.getElementById('userName').value;
const email = document.getElementById('userEmail').value;
const plan = document.getElementById('userPlan').value;
// In a real app, you would send this to your backend
console.log('Adding user:', { name, email, plan });
// Show success message
alert(`User ${name} added successfully!`);
closeAddUserModal();
// Reset form
document.getElementById('addUserForm').reset();
});
// Logout functionality
document.addEventListener('DOMContentLoaded', function() {
// Add logout button to navigation
const userDiv = document.querySelector('.flex.items-center.space-x-4');
if (userDiv) {
const logoutBtn = document.createElement('button');
logoutBtn.className = 'text-gray-300 hover:text-white transition-colors';
logoutBtn.innerHTML = '<i data-feather="log-out" class="w-5 h-5"></i>';
logoutBtn.title = 'Logout';
logoutBtn.onclick = function() {
localStorage.removeItem('adminUsername');
localStorage.removeItem('adminPassword');
window.location.href = 'admin-login.html';
};
userDiv.appendChild(logoutBtn);
feather.replace();
}
// Add click handler for Add User button
const addUserBtn = document.querySelector('button.bg-purple-500');
if (addUserBtn) {
addUserBtn.onclick = openAddUserModal;
}
// Add edit and delete functionality to user table
const userTable = document.querySelector('table');
if (userTable) {
userTable.addEventListener('click', function(e) {
const target = e.target.closest('button');
if (!target) return;
const row = target.closest('tr');
const userName = row.querySelector('.font-semibold').textContent;
if (target.querySelector('i[data-feather="edit"]')) {
alert(`Edit user: ${userName}`);
} else if (target.querySelector('i[data-feather="trash-2"]')) {
if (confirm(`Are you sure you want to delete ${userName}?`)) {
row.remove();
alert(`User ${userName} deleted successfully!`);
}
}
});
}
// Add functionality to admin action buttons
const systemSettingsBtn = document.querySelector('button:contains("System Settings")');
const emergencyShutdownBtn = document.querySelector('button:contains("Emergency Shutdown")');
if (systemSettingsBtn) {
systemSettingsBtn.onclick = function() {
alert('System settings modal would open here');
};
}
if (emergencyShutdownBtn) {
emergencyShutdownBtn.onclick = function() {
if (confirm('Are you sure you want to perform emergency shutdown? This will affect all users.')) {
alert('Emergency shutdown initiated!');
}
};
}
});
</script>
</body>
</html>