๐Ÿงช Lab Chemical Locator

/* Basic CSS for the layout (See the next section for more details) */
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f4f7f9;
}
.container {
max-width: 1000px;
margin: 0 auto;
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
#search-container {
margin-bottom: 20px;
display: flex;
gap: 10px;
}
#search-input {
padding: 10px;
flex-grow: 1;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
}
#search-button {
padding: 10px 15px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
#search-button:hover {
background-color: #0056b3;
}
#results-table {
width: 100%;
border-collapse: collapse;
margin-top: 15px;
}
#results-table th, #results-table td {
border: 1px solid #ddd;
padding: 10px;
text-align: left;
}
#results-table th {
background-color: #e9ecef;
color: #333;
}
.location-highlight {
font-weight: bold;
color: #d9534f; /* Red color for safety/prominence */
}

๐Ÿงช Lab Chemical Inventory & Locator


Search

Chemical Results

Searching for *…*

Chemical Name CAS Number Quantity (g/mL) Storage Unit Location Hazards
Sodium Chloride 7647-14-5 450 g Storage Cabinet C Room 201, Shelf B-3 None (Low Risk)
Sulfuric Acid (Conc.) 7664-93-9 50 mL Acid Storage Cabinet Room 205, Hood Storage Corrosive
Methanol 67-56-1 900 mL Flammable Cabinet A Room 201, Shelf A-1 Flammable, Toxic

function filterTable() {
// **NOTE:** This is a basic client-side filter function.
// For a real application, you would send the search term to your
// Backend/Database and update the table with the results.

let input, filter, table, tr, td, i, txtValue;
input = document.getElementById(“search-input”);
filter = input.value.toUpperCase();
table = document.getElementById(“results-table”);
tr = table.getElementsByTagName(“tr”);

document.getElementById(“search-status”).textContent = `Searching for *${input.value}*…`;

// Loop through all table rows, and hide those who don’t match the search query
for (i = 1; i < tr.length; i++) { // Start at 1 to skip the header row
let match = false;
// Check Chemical Name (Index 0) and CAS Number (Index 1)
for (let j = 0; j -1) {
match = true;
break;
}
}
}

if (match) {
tr[i].style.display = “”;
} else {
tr[i].style.display = “none”;
}
}
}