Untitled
unknown
plain_text
10 months ago
4.1 kB
16
Indexable
<!DOCTYPE html>
<html>
<head>
<title>Todo List</title>
<meta name="csrf-token" content="{{ csrf_token() }}">
<style>
body {
font-family: Arial, sans-serif;
background: #f3f4f6;
margin: 0;
padding: 40px;
display: flex;
justify-content: center;
}
.container {
background: #fff;
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
width: 500px;
}
h1 {
text-align: center;
color: #333;
margin-bottom: 20px;
}
form {
margin-bottom: 20px;
}
input[type="text"],
textarea {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 8px;
margin-bottom: 10px;
font-size: 14px;
}
button {
background: #2563eb;
color: #fff;
border: none;
padding: 8px 14px;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
}
button:hover {
background: #1d4ed8;
}
ul {
list-style: none;
padding: 0;
}
li {
background: #f9fafb;
padding: 12px;
margin-bottom: 10px;
border-radius: 8px;
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.task-content {
flex-grow: 1;
margin: 0 10px;
}
.task-title {
font-weight: bold;
color: #111;
display: block;
}
.completed {
text-decoration: line-through;
color: #6b7280;
}
.task-desc {
font-size: 13px;
color: #6b7280;
margin-top: 4px;
word-wrap: break-word;
white-space: pre-line;
}
</style>
</head>
<body>
<div class="container">
<h1>Todo List</h1>
{{-- Form thêm task --}}
<form action="{{ route('tasks.store') }}" method="POST">
@csrf
<input type="text" name="title" placeholder="Nhập công việc..." required>
<textarea name="content" placeholder="Mô tả..."></textarea>
<button type="submit">➕ Thêm</button>
</form>
{{-- Danh sách task --}}
<ul>
@foreach ($tasks as $task)
<li>
{{-- Nút check/uncheck --}}
<form action="{{ route('tasks.update', $task->id) }}" method="POST">
@csrf
@method('PUT')
<button type="submit">
{{ $task->completed ? '✅' : '⬜' }}
</button>
</form>
{{-- Nội dung task --}}
<div class="task-content">
<span class="task-title {{ $task->completed ? 'completed' : '' }}">
{{ $task->title }}
</span>
@if ($task->content)
<div class="task-desc">
{{ $task->content }}
</div>
@endif
</div>
{{-- Nút xóa --}}
<form action="{{ route('tasks.destroy', $task->id) }}" method="POST">
@csrf
@method('DELETE')
<button type="submit">❌</button>
</form>
</li>
@endforeach
</ul>
</div>
</body>
</html>
Editor is loading...
Leave a Comment