Files
tp-luka/laravel/resources/views/index.blade.php
Luka COUTANT 705ca9c575 lil fix
2025-06-10 15:04:47 +02:00

59 lines
1.9 KiB
PHP

<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<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>
<th>Priority</th>
<th>Titre</th>
<th>Detail</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@foreach ($tasks as $task)
<tr>
<td>{{ $task->level->name }}</td>
<td>{{ $task->title }}</td>
<td>{{ $task->details }}</td>
<td>
@if($task->state)
<span class="termine">Terminé</span>
@else
<span class="encours">En cours</span>
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<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>