File: /var/www/agenda.bradford/resources/views/layout_landing.blade copy.php
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ isset($title) ? $title . ' |' : '' }} {{ env('APP_NAME') }}</title>
<link rel="icon" href="{{ asset(URL_LOGO_FAVICON) }}" sizes="32x32" />
<link rel="icon" href="{{ asset(URL_LOGO_FAVICON) }}" sizes="192x192" />
<link rel="apple-touch-icon" href="{{ asset(URL_LOGO_FAVICON) }}" />
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-image: url('{{ ASSET_BACKGROUND }}');
background-repeat: repeat;
height: 100vh;
background-attachment: fixed;
}
h1 {
color: #172952;
margin-bottom: 25px;
font-size: 24px;
font-weight: 600;
text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.34);
}
p {
color: #006A4D;
font-size: 17px;
font-weight: 400;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.39);
}
header {
color: white;
padding: 20px 0;
}
.header-content {
display: flex;
align-items: center;
justify-content: space-around;
flex-wrap: wrap;
}
.logo {
max-width: 420px;
margin-right: 20px;
margin-bottom: 10px;
}
.header-text {
text-align: center;
}
.header-text h1 {
margin: 0;
font-size: 22px;
}
.header-text p {
margin: 5px 0;
}
.container {
max-width: 1200px;
margin: 20px auto;
padding: 0 20px;
}
.search-box {
margin-bottom: 20px;
text-align: left;
}
.search-box input {
padding: 10px;
width: 100%;
max-width: 200px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 20px;
border: 2px solid #172952;
}
table {
width: 100%;
border-collapse: collapse;
background-color: transparent;
}
th,
td {
padding: 6px;
text-align: left;
border: 1px solid #172952;
cursor: pointer;
text-wrap: nowrap;
font-size: 13px;
}
th {
background-color: #172952;
color: white;
position: sticky;
top: 0;
z-index: 2;
}
th.sortable:after {
content: '\25B2';
/* Default Up arrow */
position: absolute;
right: 8px;
font-size: 12px;
display: inline;
color: #fff;
}
th.sortable.asc:after {
content: '\25B2';
/* Up arrow */
}
th.sortable.desc:after {
content: '\25BC';
/* Down arrow */
}
tbody {
overflow-y: auto;
display: block;
height: 400px;
}
tbody tr {
display: table;
width: 100%;
table-layout: fixed;
}
@media (max-width: 768px) {
table {
font-size: 14px;
}
th,
td {
padding: 3px;
font-size: 12px;
}
.search-box input {
font-size: 14px;
}
h1 {
font-size: 20px;
}
th.sortable:after {
position: absolute;
right: 2px;
font-size: 12px;
display: inline;
color: #fff;
}
}
@media (max-width: 480px) {
.container {
padding: 0 10px;
}
table {
font-size: 12px;
}
th,
td {
padding: 3px;
font-size: 10px;
}
.search-box input {
font-size: 12px;
}
.logo {
width: 380px;
}
h1 {
font-size: 18px;
}
}
.text-center {
text-align: center !important;
}
</style>
</head>
<body>
<header>
<div class="header-content">
<img src="{{ asset(URL_LOGO) }}" alt="logo" class="logo">
<div class="header-text">
<h1>Bradford School’s Directory</h1>
<p>Main Phone: 229123140</p>
</div>
</div>
</header>
<div class="container">
<div class="search-box">
<input type="text" id="search" placeholder="Search">
</div>
<table id="directory">
<thead>
<tr>
<th class="sortable text-center" onclick="sortTable(0, this)">Nombre </th>
<th class="sortable text-center" onclick="sortTable(1, this)">Cargo</th>
<th class="sortable text-center" onclick="sortTable(2, this)">Correo</th>
<th class="sortable text-center" onclick="sortTable(3, this)">Anexo </th>
</tr>
</thead>
<tbody>
@foreach ($school_directory as $employee)
<tr>
<td>{{ $employee->name }}</td>
<td>{{ $employee->position }}</td>
<td>{{ Str::lower($employee->email) }}</td>
<td class="text-center">{{ $employee->extension }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<script>
document.getElementById('search').addEventListener('input', function() {
const searchValue = this.value.toLowerCase();
const rows = document.querySelectorAll('#directory tbody tr');
rows.forEach(row => {
const cells = row.querySelectorAll('td');
const rowText = Array.from(cells).map(cell => cell.textContent.toLowerCase()).join(' ');
if (rowText.includes(searchValue)) {
row.style.display = '';
} else {
row.style.display = 'none';
}
});
});
function sortTable(columnIndex, header) {
const table = document.getElementById("directory");
const rows = Array.from(table.rows).slice(1);
const isAscending = header.classList.contains("asc");
rows.sort((a, b) => {
const cellA = a.cells[columnIndex].textContent.trim().toLowerCase();
const cellB = b.cells[columnIndex].textContent.trim().toLowerCase();
if (cellA < cellB) return isAscending ? 1 : -1;
if (cellA > cellB) return isAscending ? -1 : 1;
return 0;
});
rows.forEach(row => table.tBodies[0].appendChild(row));
document.querySelectorAll("th.sortable").forEach(th => th.classList.remove("asc", "desc"));
header.classList.toggle("asc", !isAscending);
header.classList.toggle("desc", isAscending);
}
</script>
</body>
</html>