mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Added table filter to Locations, Moved table filter js to site.js
This commit is contained in:
@@ -70,35 +70,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Table filter -->
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const filters = document.querySelectorAll('.column-filter');
|
||||
const table = document.querySelector('table');
|
||||
const tbody = table.querySelector('tbody');
|
||||
|
||||
filters.forEach(filter => {
|
||||
filter.addEventListener('input', () => {
|
||||
const rows = tbody.querySelectorAll('tr');
|
||||
const filterValues = Array.from(filters).map(f => f.value.toLowerCase().trim());
|
||||
|
||||
rows.forEach(row => {
|
||||
const cells = row.querySelectorAll('td');
|
||||
let visible = true;
|
||||
|
||||
filterValues.forEach((val, i) => {
|
||||
if (val && !cells[i].textContent.toLowerCase().includes(val)) {
|
||||
visible = false;
|
||||
}
|
||||
});
|
||||
|
||||
row.style.display = visible ? '' : 'none';
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Asset Delete Confirmation Modal -->
|
||||
<div class="modal fade" id="deleteModal" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
|
||||
@@ -27,6 +27,13 @@
|
||||
<th>@T["Seat"]</th>
|
||||
<th>@T["Action"]</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><input type="text" class="form-control form-control-sm column-filter" placeholder="@T["Location ID"]" data-column="0" /></th>
|
||||
<th><input type="text" class="form-control form-control-sm column-filter" placeholder="@T["Location Name"]" data-column="1" /></th>
|
||||
<th><input type="text" class="form-control form-control-sm column-filter" placeholder="@T["Room Number"]" data-column="2" /></th>
|
||||
<th><input type="text" class="form-control form-control-sm column-filter" placeholder="@T["Seat"]" data-column="3" /></th>
|
||||
<th class="text-center">-</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@{
|
||||
|
||||
Reference in New Issue
Block a user