Mise à jour du contrôleur des niveaux pour retourner tous les niveaux dans la vue des tâches et ajout d'un filtre par priorité dans la vue index.
This commit is contained in:
@@ -2,15 +2,18 @@
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Tasks !</title>
|
||||
<style>
|
||||
.termine { color: green; font-weight: bold; }
|
||||
.encours { color: red; font-weight: bold; }
|
||||
</style>
|
||||
{{-- <link rel="stylesheet" href="https://cdn.datatables.net/2.3.2/css/dataTables.dataTables.min.css"> --}}
|
||||
<title>Tasks !</title>
|
||||
<link rel="stylesheet" href="{{ asset('styles.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
<div id="contenu">
|
||||
<label for="priority-filter">Filtrer par priorité :</label>
|
||||
<select id="priority-filter">
|
||||
<option value="">Toutes</option>
|
||||
@foreach($levels as $level)
|
||||
<option value="{{ $level }}">{{ $level }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<table id="tasks">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -38,10 +41,19 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{-- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/2.3.2/js/dataTables.min.js"></script>
|
||||
<script>
|
||||
new DataTable("#tasks")
|
||||
</script> --}}
|
||||
document.getElementById('priority-filter').addEventListener('change', function() {
|
||||
let filter = this.value;
|
||||
let rows = document.querySelectorAll('#tasks tbody tr');
|
||||
rows.forEach(row => {
|
||||
let priority = row.children[0].textContent;
|
||||
if (!filter || priority === filter) {
|
||||
row.style.display = '';
|
||||
} else {
|
||||
row.style.display = 'none';
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user