Changed around line 1
+ // Mock data for demonstration
+ const mockInterruptions = [
+ {
+ date: '2023-11-01',
+ machine: 'Mill 01',
+ duration: 45,
+ type: 'Mechanical',
+ description: 'Bearing failure'
+ },
+ {
+ date: '2023-11-02',
+ machine: 'Mill 02',
+ duration: 30,
+ type: 'Electrical',
+ description: 'Power surge'
+ },
+ // Add more mock data as needed
+ ];
+
+ // DOM Elements
+ const menuToggle = document.querySelector('.menu-toggle');
+ const navLinks = document.querySelector('.nav-links');
+ const durationFilter = document.getElementById('duration');
+ const machineFilter = document.getElementById('machine');
+ const applyFiltersBtn = document.getElementById('apply-filters');
+ const tableBody = document.getElementById('interruptions-data');
+
+ // Toggle mobile menu
+ menuToggle.addEventListener('click', () => {
+ navLinks.classList.toggle('active');
+ });
+
+ // Filter and display interruptions
+ function filterAndDisplayInterruptions() {
+ const minDuration = parseInt(durationFilter.value) || 0;
+ const selectedMachine = machineFilter.value;
+
+ const filteredData = mockInterruptions.filter(interruption => {
+ const durationMatch = interruption.duration >= minDuration;
+ const machineMatch = !selectedMachine || interruption.machine.toLowerCase().includes(selectedMachine.toLowerCase());
+ return durationMatch && machineMatch;
+ });
+
+ displayInterruptions(filteredData);
+ }
+
+ // Display interruptions in table
+ function displayInterruptions(interruptions) {
+ tableBody.innerHTML = '';
+
+ interruptions.forEach(interruption => {
+ const row = document.createElement('tr');
+ row.innerHTML = `
+
${interruption.date} | +
${interruption.machine} | +
${interruption.duration} min | +
${interruption.type} | +
${interruption.description} | + `;
+ tableBody.appendChild(row);
+ });
+ }
+
+ // Event listeners
+ applyFiltersBtn.addEventListener('click', filterAndDisplayInterruptions);
+
+ // Initial display
+ displayInterruptions(mockInterruptions);
+
+ // Add smooth scrolling
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
+ anchor.addEventListener('click', function (e) {
+ e.preventDefault();
+ document.querySelector(this.getAttribute('href')).scrollIntoView({
+ behavior: 'smooth'
+ });
+ });
+ });