Changed around line 1
+ // Sample data (would be replaced by actual API calls)
+ const interruptionsData = [
+ {
+ startTime: '2023-07-20 08:15',
+ endTime: '2023-07-20 08:45',
+ duration: 30,
+ machine: 'Mill A',
+ reason: 'Maintenance'
+ },
+ {
+ startTime: '2023-07-20 10:00',
+ endTime: '2023-07-20 10:10',
+ duration: 10,
+ machine: 'Mill B',
+ reason: 'Material Jam'
+ },
+ // Add more sample data
+ ];
+
+ const machines = ['Mill A', 'Mill B', 'Mill C']; // Sample machines
+
+ // Populate machine filter
+ const machineFilter = document.getElementById('machine-filter');
+ machines.forEach(machine => {
+ const option = document.createElement('option');
+ option.value = machine;
+ option.textContent = machine;
+ machineFilter.appendChild(option);
+ });
+
+ // Function to render table
+ function renderTable(data) {
+ const tableBody = document.getElementById('interruptions-table');
+ tableBody.innerHTML = '';
+
+ data.forEach(interruption => {
+ const row = document.createElement('tr');
+
+ const startTimeCell = document.createElement('td');
+ startTimeCell.textContent = interruption.startTime;
+
+ const endTimeCell = document.createElement('td');
+ endTimeCell.textContent = interruption.endTime;
+
+ const durationCell = document.createElement('td');
+ durationCell.textContent = `${interruption.duration} minutes`;
+
+ const machineCell = document.createElement('td');
+ machineCell.textContent = interruption.machine;
+
+ const reasonCell = document.createElement('td');
+ reasonCell.textContent = interruption.reason;
+
+ row.append(startTimeCell, endTimeCell, durationCell, machineCell, reasonCell);
+ tableBody.appendChild(row);
+ });
+ }
+
+ // Initial render
+ renderTable(interruptionsData);
+
+ // Filter functionality
+ document.getElementById('apply-filters').addEventListener('click', () => {
+ const minLength = parseInt(document.getElementById('length-filter').value) || 0;
+ const selectedMachine = document.getElementById('machine-filter').value;
+
+ const filteredData = interruptionsData.filter(interruption => {
+ return interruption.duration >= minLength &&
+ (selectedMachine === '' || interruption.machine === selectedMachine);
+ });
+
+ renderTable(filteredData);
+ });