// Global State let state = { projects: [], clients: [], categories: ['Web Development', 'Mobile Apps', 'AI/ML', 'Game Dev', 'Blockchain', 'IoT', 'DevOps', 'Desktop Apps'], currentFilter: 'all' }; // DOM Elements const recentProjectsTable = document.getElementById('recentProjects'); const projectModal = document.getElementById('projectModal'); let categoryChart = null; let revenueChart = null; // Initialize Charts function initializeCharts() { // Category Distribution Chart const categoryCtx = document.getElementById('categoryChart').getContext('2d'); categoryChart = new Chart(categoryCtx, { type: 'doughnut', data: { labels: state.categories, datasets: [{ data: [15, 8, 6, 4, 3, 2, 2, 2], backgroundColor: [ '#6366f1', '#f59e0b', '#10b981', '#ef4444', '#8b5cf6', '#06b6d4', '#f97316', '#84cc16' ], borderWidth: 2, borderColor: '#0f172a' }] }, options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { position: 'right', labels: { color: '#cbd5e1', padding: 20 } } }, animation: { animateScale: true, animateRotate: true } } }); // Revenue Chart const revenueCtx = document.getElementById('revenueChart').getContext('2d'); revenueChart = new Chart(revenueCtx, { type: 'line', data: { labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'], datasets: [{ label: 'Revenue', data: [4500, 5200, 7800, 9200, 12500, 14800, 16500], borderColor: '#f59e0b', backgroundColor: 'rgba(245, 158, 11, 0.1)', borderWidth: 3, fill: true, tension: 0.4 }] }, options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { labels: { color: '#cbd5e1' } } }, scales: { x: { grid: { color: 'rgba(255, 255, 255, 0.1)' }, ticks: { color: '#cbd5e1' } }, y: { grid: { color: 'rgba(255, 255, 255, 0.1)' }, ticks: { color: '#cbd5e1', callback: function(value) { return '$' + value; } } } } } }); } // Load Recent Projects function loadRecentProjects() { const sampleProjects = [ { id: 1, name: 'E-Commerce Platform', category: 'Web Development', status: 'complete', completion: '100%', client: 'TechCorp Inc.', date: '2024-01-15', amount: '$12,500', paid: true }, { id: 2, name: 'Fitness Mobile App', category: 'Mobile Apps', status: 'in-progress', completion: '75%', client: 'FitLife LLC', date: '2024-02-20', amount: '$8,000', paid: false }, { id: 3, name: 'AI Chat Assistant', category: 'AI/ML', status: 'in-progress', completion: '60%', client: 'Innovate AI', date: '2024-03-10', amount: '$15,000', paid: true }, { id: 4, name: 'Blockchain Wallet', category: 'Blockchain', status: 'pending', completion: '30%', client: 'CryptoWorks', date: '2024-03-25', amount: '$20,000', paid: false }, { id: 5, name: 'Game Engine', category: 'Game Dev', status: 'complete', completion: '100%', client: 'GameDev Studio', date: '2024-01-30', amount: '$25,000', paid: true } ]; recentProjectsTable.innerHTML = ''; sampleProjects.forEach(project => { const row = document.createElement('tr'); row.className = 'border-b border-gray-700 hover:bg-gray-800/50 transition-colors'; row.innerHTML = `
Started: ${project.date}
${project.category}
${project.description}
Start Date
${project.startDate}
Deadline
${project.deadline}
Total Budget
${project.budget}
Amount Paid
${project.paid}
Pending Amount
${project.pending}
Generated on: ${new Date().toLocaleDateString()}
Complete project report including timeline, budget, and progress details.
| Item | Amount |
|---|---|
| Total Budget | $12,500.00 |
| Amount Received | $8,000.00 |
| Pending Amount | $4,500.00 |
| Phase | Status | Completion Date |
|---|---|---|
| Planning | Completed | 2024-01-20 |
| Development | In Progress | 2024-04-15 |
| Testing | Pending | 2024-04-30 |