Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Navigation
+ const menuToggle = document.querySelector('.menu-toggle');
+ const navLinks = document.querySelector('.nav-links');
+ const sections = document.querySelectorAll('section');
+
+ menuToggle.addEventListener('click', () => {
+ navLinks.classList.toggle('active');
+ });
+
+ // Section navigation
+ document.querySelectorAll('.nav-links a').forEach(link => {
+ link.addEventListener('click', (e) => {
+ e.preventDefault();
+ const targetId = link.getAttribute('href').substring(1);
+
+ sections.forEach(section => {
+ section.classList.add('hidden');
+ if (section.id === targetId) {
+ section.classList.remove('hidden');
+ }
+ });
+
+ navLinks.classList.remove('active');
+ });
+ });
+
+ // Modal functionality
+ const modal = document.getElementById('donorModal');
+ const addBtn = document.querySelector('.add-btn');
+ const cancelBtn = document.querySelector('.secondary-btn');
+
+ addBtn.addEventListener('click', () => {
+ modal.style.display = 'block';
+ });
+
+ cancelBtn.addEventListener('click', () => {
+ modal.style.display = 'none';
+ });
+
+ window.addEventListener('click', (e) => {
+ if (e.target === modal) {
+ modal.style.display = 'none';
+ }
+ });
+
+ // Form submission
+ const donorForm = document.getElementById('donorForm');
+ donorForm.addEventListener('submit', (e) => {
+ e.preventDefault();
+ const formData = new FormData(donorForm);
+ // Here you would typically send the data to a server
+ console.log('Form submitted:', Object.fromEntries(formData));
+ modal.style.display = 'none';
+ donorForm.reset();
+ });
+
+ // Sample data population (in real app, this would come from a database)
+ const donorGrid = document.querySelector('.donor-grid');
+ const donationList = document.querySelector('.donation-list');
+ const calendarGrid = document.querySelector('.calendar-grid');
+
+ // Initialize with sample data
+ updateDashboardStats();
+ });
+
+ function updateDashboardStats() {
+ // In a real application, these would be fetched from a server
+ const stats = {
+ totalDonors: 124,
+ monthlyDonations: 12450,
+ upcomingEvents: 3
+ };
+
+ document.querySelectorAll('.stat-number').forEach(stat => {
+ const value = stat.textContent;
+ if (value.includes('$')) {
+ stat.textContent = `$${stats.monthlyDonations.toLocaleString()}`;
+ }
+ });
+ }