Ajout de la vue index pour afficher les tâches avec leurs niveaux et états
This commit is contained in:
@@ -13,7 +13,8 @@ class LevelController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
//
|
$level = Level::all();
|
||||||
|
return view('index', compact('level'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ class TaskController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
//
|
$tasks = Task::with('level')->get();
|
||||||
|
return view('index', compact('tasks'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,4 +15,9 @@ class Task extends Model
|
|||||||
'details',
|
'details',
|
||||||
'state',
|
'state',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
function level()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Level::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
47
laravel/resources/views/index.blade.php
Normal file
47
laravel/resources/views/index.blade.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<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"> --}}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="contenu">
|
||||||
|
<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 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> --}}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use App\Http\Controllers\TaskController;
|
||||||
|
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
return view('welcome');
|
return view('welcome');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::resource('tasks', TaskController::class);
|
||||||
|
|||||||
Reference in New Issue
Block a user