// Drone Product Class class Drone { constructor(id, name, category, price, specs, features) { this.id = id; this.name = name; this.category = category; this.price = price; this.specs = specs; this.features = features; } displaySpecs() { return `

Technical Specifications

`; } displayFeatures() { return `

Key Features

`; } } // Drone Collection Class class DroneCollection { constructor() { this.drones = []; } addDrone(drone) { this.drones.push(drone); } getDronesByCategory(category) { return this.drones.filter(drone => drone.category === category); } getDroneById(id) { return this.drones.find(drone => drone.id === id); } } // Contact Form Handler class ContactForm { constructor(formId) { this.form = document.getElementById(formId); this.init(); } init() { if (this.form) { this.form.addEventListener('submit', (e) => { e.preventDefault(); this.handleSubmit(); }); } } handleSubmit() { const formData = new FormData(this.form); const data = Object.fromEntries(formData); // In a real application, you would send this data to a server console.log('Form submitted:', data); // Show success message this.showMessage('Thank you! Our team will contact you shortly.', 'success'); this.form.reset(); } showMessage(message, type) { // Create message element const messageEl = document.createElement('div'); messageEl.className = `fixed top-4 right-4 p-4 rounded-lg shadow-lg z-50 ${ type === 'success' ? 'bg-green-600' : 'bg-red-600' }`; messageEl.textContent = message; // Add to DOM document.body.appendChild(messageEl); // Remove after 3 seconds setTimeout(() => { messageEl.remove(); }, 3000); } } // Initialize when DOM is loaded document.addEventListener('DOMContentLoaded', () => { // Initialize contact form const contactForm = new ContactForm('contactForm'); // Initialize drone collection const droneCollection = new DroneCollection(); // Add sample drones droneCollection.addDrone(new Drone( 1, 'SkyHawk Civilian X1', 'civilian', 899, [ { label: 'Flight Time', value: '30 minutes' }, { label: 'Camera', value: '4K HDR' }, { label: 'Range', value: '5 km' }, { label: 'Weight', value: '500g' } ], [ 'GPS Positioning', 'Headless Mode', 'One-Key Return', 'Gesture Control' ] )); droneCollection.addDrone(new Drone( 2, 'SkyHawk Pro Surveyor', 'commercial', 3499, [ { label: 'Flight Time', value: '45 minutes' }, { label: 'Camera', value: '1-inch 20MP' }, { label: 'Range', value: '15 km' }, { label: 'Accuracy', value: '2 cm' } ], [ 'RTK Positioning', 'Photogrammetry Software', 'Obstacle Avoidance', 'Data Encryption' ] )); droneCollection.addDrone(new Drone( 3, 'AgriHawk Crop Master', 'agricultural', 5999, [ { label: 'Flight Time', value: '60 minutes' }, { label: 'Spray Capacity', value: '16L' }, { label: 'Coverage', value: '20 acres/hour' }, { label: 'Sensors', value: 'Multispectral + RGB' } ], [ 'AI Crop Analysis', 'Variable Rate Application', 'Weather Monitoring', 'Automated Flight Paths' ] )); droneCollection.addDrone(new Drone( 4, 'Tactical Recon X7', 'military', 24999, [ { label: 'Flight Time', value: '90 minutes' }, { label: 'Stealth Mode', value: 'Yes' }, { label: 'Range', value: '50 km' }, { label: 'Payload', value: '5 kg' } ], [ 'Military-Grade Encryption', 'Night Vision Capability', 'Anti-Jamming System', 'Self-Destruct Mechanism' ] )); // Store collection in window object for global access window.droneCollection = droneCollection; // Initialize Feather Icons feather.replace(); });