Changed around line 1
+ // Sample inventory data
+ const inventory = [
+ { id: 1, name: "Laptop", quantity: 15 },
+ { id: 2, name: "Monitor", quantity: 20 },
+ { id: 3, name: "Keyboard", quantity: 30 }
+ ];
+
+ // Sample records data
+ const records = [
+ { id: 1, issue: "Printer not working", status: "resolved" },
+ { id: 2, issue: "Network connectivity", status: "pending" }
+ ];
+
+ // Sample tickets data
+ let tickets = [];
+
+ // Display inventory
+ function displayInventory(items) {
+ const inventoryList = document.getElementById('inventory-list');
+ inventoryList.innerHTML = items.map(item => `
+
+
${item.name}
+
Quantity: ${item.quantity}
+
+ `).join('');
+ }
+
+ // Display records
+ function displayRecords(filter = 'all') {
+ const recordsList = document.getElementById('records-list');
+ const filteredRecords = filter === 'all' ? records : records.filter(r => r.status === filter);
+ recordsList.innerHTML = filteredRecords.map(record => `
+
+
${record.issue}
+
Status: ${record.status}
+
+ `).join('');
+ }
+
+ // Display tickets
+ function displayTickets() {
+ const ticketsList = document.getElementById('tickets-list');
+ ticketsList.innerHTML = tickets.map(ticket => `
+ `).join('');
+ }
+
+ // Search inventory
+ function searchInventory() {
+ const searchTerm = document.getElementById('search').value.toLowerCase();
+ const filteredInventory = inventory.filter(item =>
+ item.name.toLowerCase().includes(searchTerm)
+ );
+ displayInventory(filteredInventory);
+ }
+
+ // Handle ticket submission
+ document.getElementById('ticket-form').addEventListener('submit', function(e) {
+ e.preventDefault();
+ const issue = document.getElementById('issue').value;
+ tickets.push(issue);
+ displayTickets();
+ this.reset();
+ });
+
+ // Handle record filtering
+ document.getElementById('filter').addEventListener('change', function() {
+ displayRecords(this.value);
+ });
+
+ // Initial display
+ displayInventory(inventory);
+ displayRecords();