Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Mobile menu toggle
+ const mobileMenu = document.querySelector('.mobile-menu');
+ const navLinks = document.querySelector('.nav-links');
+
+ mobileMenu.addEventListener('click', () => {
+ navLinks.classList.toggle('active');
+ });
+
+ // Ticket form submission
+ const ticketForm = document.getElementById('ticket-form');
+ ticketForm?.addEventListener('submit', (e) => {
+ e.preventDefault();
+ const formData = {
+ title: document.getElementById('title').value,
+ description: document.getElementById('description').value,
+ priority: document.getElementById('priority').value,
+ relatedAsset: document.getElementById('related-asset').value
+ };
+ submitTicket(formData);
+ });
+
+ // Mock function to submit ticket
+ async function submitTicket(data) {
+ try {
+ // In a real application, this would be an API call
+ console.log('Submitting ticket:', data);
+ showNotification('Ticket submitted successfully!');
+ ticketForm.reset();
+ } catch (error) {
+ showNotification('Error submitting ticket', 'error');
+ }
+ }
+
+ // Notification system
+ function showNotification(message, type = 'success') {
+ const notification = document.createElement('div');
+ notification.className = `notification ${type}`;
+ notification.textContent = message;
+ document.body.appendChild(notification);
+
+ setTimeout(() => {
+ notification.remove();
+ }, 3000);
+ }
+
+ // Dynamic asset loading for dropdown
+ loadAssets();
+ });
+
+ async function loadAssets() {
+ // Mock asset data - in real application, this would be from an API
+ const assets = [
+ { id: 1, name: 'Laptop Dell XPS 13' },
+ { id: 2, name: 'HP Printer P1102w' },
+ { id: 3, name: 'Cisco Router 2900' }
+ ];
+
+ const assetSelect = document.getElementById('related-asset');
+ assets.forEach(asset => {
+ const option = document.createElement('option');
+ option.value = asset.id;
+ option.textContent = asset.name;
+ assetSelect.appendChild(option);
+ });
+ }