├── DB.sql
├── DB_connection.php
├── README.md
├── add-user.php
├── app
├── Model
│ ├── Notification.php
│ ├── Task.php
│ └── User.php
├── add-task.php
├── add-user.php
├── login.php
├── notification-count.php
├── notification-read.php
├── notification.php
├── update-profile.php
├── update-task-employee.php
├── update-task.php
└── update-user.php
├── create_task.php
├── css
└── style.css
├── delete-task.php
├── delete-user.php
├── edit-task-employee.php
├── edit-task.php
├── edit-user.php
├── edit_profile.php
├── img
└── user.png
├── inc
├── header.php
└── nav.php
├── index.php
├── login.php
├── logout.php
├── my_task.php
├── notifications.php
├── profile.php
├── task_management_db.sql
├── tasks.php
└── user.php
/DB.sql:
--------------------------------------------------------------------------------
1 | --- USER
2 | CREATE TABLE users (
3 | id INT AUTO_INCREMENT PRIMARY KEY,
4 | full_name VARCHAR(50) NOT NULL,
5 | username VARCHAR(50) NOT NULL,
6 | password VARCHAR(255) NOT NULL,
7 | role ENUM('admin', 'employee') NOT NULL,
8 | created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
9 | );
10 |
11 | CREATE TABLE tasks (
12 | id INT AUTO_INCREMENT PRIMARY KEY,
13 | title VARCHAR(100) NOT NULL,
14 | description TEXT,
15 | assigned_to INT,
16 | status ENUM('pending', 'in_progress', 'completed') DEFAULT 'pending',
17 | created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
18 | FOREIGN KEY (assigned_to) REFERENCES users(id)
19 | );
20 |
21 | CREATE TABLE notifications (
22 | id INT AUTO_INCREMENT PRIMARY KEY,
23 | message TEXT NOT NULL,
24 | recipient INT NOT NULL,
25 | type VARCHAR(50) NOT NULL,
26 | date DATE NOT NULL,
27 | is_read BOOLEAN DEFAULT FALSE
28 | );
29 |
--------------------------------------------------------------------------------
/DB_connection.php:
--------------------------------------------------------------------------------
1 | setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
11 | }catch(PDOExeption $e){
12 | echo "Connection failed: ". $e->getMessage();
13 | exit;
14 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Task Management System
2 | ### A simple Task Management System built with PHP, MySQL, and XAMPP that allows users (admin and employees) to manage tasks, assign roles, track task progress, and receive notifications.
3 |
4 |
5 | ## Full Tutorial
6 |
7 | [On Youtube](https://www.youtube.com/playlist?list=PL2WFgdVk-usHC-HHC0SkpsmHquwHB0Aiy)
8 |
9 | ## DEMO
10 |
11 | [DEMO](https://youtu.be/Ff3ug0eqrWI)
12 |
13 | ## Features
14 |
15 | + User Role Management: Supports two roles - Admin and Employee.
16 | + Task Management: Create, update, delete, and view tasks.
17 | + Task Categorization: Filter tasks by status, and due date.
18 | + Authentication and Authorization: Secure login system with role-based access control.
19 | + Notifications: Notify users of assigned tasks and important updates.
20 | + Task Filtering: Filter tasks by priority, status, deadline.
21 | + Task Deadlines: Track due dates and overdue tasks.
22 |
23 | ## Requirements
24 |
25 | + XAMPP (PHP, MySQL, Apache)
26 | + PHP 7.4 or higher
27 | + MySQL 5.7 or higher
28 |
29 | ## Login Credentials:
30 |
31 | ### Default Admin User:
32 |
33 | + Username: admin
34 | + Password: 123
35 | ### Default Employee User:
36 |
37 | + Username: john
38 | + Password: 123
39 |
40 | ## Contributing
41 |
42 | If you'd like to contribute, please fork the repository and submit a pull request. Any contributions are welcome.
43 |
44 | ## License
45 |
46 | This project is open-source and available under the MIT License.
--------------------------------------------------------------------------------
/add-user.php:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 | Add User
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
53 |
54 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/app/Model/Notification.php:
--------------------------------------------------------------------------------
1 | prepare($sql);
6 | $stmt->execute([$id]);
7 |
8 | if($stmt->rowCount() > 0){
9 | $notifications = $stmt->fetchAll();
10 | }else $notifications = 0;
11 |
12 | return $notifications;
13 | }
14 |
15 |
16 | function count_notification($conn, $id){
17 | $sql = "SELECT id FROM notifications WHERE recipient=? AND is_read=0";
18 | $stmt = $conn->prepare($sql);
19 | $stmt->execute([$id]);
20 |
21 | return $stmt->rowCount();
22 | }
23 |
24 | function insert_notification($conn, $data){
25 | $sql = "INSERT INTO notifications (message, recipient, type) VALUES(?,?,?)";
26 | $stmt = $conn->prepare($sql);
27 | $stmt->execute($data);
28 | }
29 |
30 | function notification_make_read($conn, $recipient_id, $notification_id){
31 | $sql = "UPDATE notifications SET is_read=1 WHERE id=? AND recipient=?";
32 | $stmt = $conn->prepare($sql);
33 | $stmt->execute([$notification_id, $recipient_id]);
34 | }
--------------------------------------------------------------------------------
/app/Model/Task.php:
--------------------------------------------------------------------------------
1 | prepare($sql);
6 | $stmt->execute($data);
7 | }
8 |
9 | function get_all_tasks($conn){
10 | $sql = "SELECT * FROM tasks ORDER BY id DESC";
11 | $stmt = $conn->prepare($sql);
12 | $stmt->execute([]);
13 |
14 | if($stmt->rowCount() > 0){
15 | $tasks = $stmt->fetchAll();
16 | }else $tasks = 0;
17 |
18 | return $tasks;
19 | }
20 | function get_all_tasks_due_today($conn){
21 | $sql = "SELECT * FROM tasks WHERE due_date = CURDATE() AND status != 'completed' ORDER BY id DESC";
22 | $stmt = $conn->prepare($sql);
23 | $stmt->execute([]);
24 |
25 | if($stmt->rowCount() > 0){
26 | $tasks = $stmt->fetchAll();
27 | }else $tasks = 0;
28 |
29 | return $tasks;
30 | }
31 | function count_tasks_due_today($conn){
32 | $sql = "SELECT id FROM tasks WHERE due_date = CURDATE() AND status != 'completed'";
33 | $stmt = $conn->prepare($sql);
34 | $stmt->execute([]);
35 |
36 | return $stmt->rowCount();
37 | }
38 |
39 | function get_all_tasks_overdue($conn){
40 | $sql = "SELECT * FROM tasks WHERE due_date < CURDATE() AND status != 'completed' ORDER BY id DESC";
41 | $stmt = $conn->prepare($sql);
42 | $stmt->execute([]);
43 |
44 | if($stmt->rowCount() > 0){
45 | $tasks = $stmt->fetchAll();
46 | }else $tasks = 0;
47 |
48 | return $tasks;
49 | }
50 | function count_tasks_overdue($conn){
51 | $sql = "SELECT id FROM tasks WHERE due_date < CURDATE() AND status != 'completed'";
52 | $stmt = $conn->prepare($sql);
53 | $stmt->execute([]);
54 |
55 | return $stmt->rowCount();
56 | }
57 |
58 |
59 | function get_all_tasks_NoDeadline($conn){
60 | $sql = "SELECT * FROM tasks WHERE status != 'completed' AND due_date IS NULL OR due_date = '0000-00-00' ORDER BY id DESC";
61 | $stmt = $conn->prepare($sql);
62 | $stmt->execute([]);
63 |
64 | if($stmt->rowCount() > 0){
65 | $tasks = $stmt->fetchAll();
66 | }else $tasks = 0;
67 |
68 | return $tasks;
69 | }
70 | function count_tasks_NoDeadline($conn){
71 | $sql = "SELECT id FROM tasks WHERE status != 'completed' AND due_date IS NULL OR due_date = '0000-00-00'";
72 | $stmt = $conn->prepare($sql);
73 | $stmt->execute([]);
74 |
75 | return $stmt->rowCount();
76 | }
77 |
78 |
79 |
80 | function delete_task($conn, $data){
81 | $sql = "DELETE FROM tasks WHERE id=? ";
82 | $stmt = $conn->prepare($sql);
83 | $stmt->execute($data);
84 | }
85 |
86 |
87 | function get_task_by_id($conn, $id){
88 | $sql = "SELECT * FROM tasks WHERE id =? ";
89 | $stmt = $conn->prepare($sql);
90 | $stmt->execute([$id]);
91 |
92 | if($stmt->rowCount() > 0){
93 | $task = $stmt->fetch();
94 | }else $task = 0;
95 |
96 | return $task;
97 | }
98 | function count_tasks($conn){
99 | $sql = "SELECT id FROM tasks";
100 | $stmt = $conn->prepare($sql);
101 | $stmt->execute([]);
102 |
103 | return $stmt->rowCount();
104 | }
105 |
106 | function update_task($conn, $data){
107 | $sql = "UPDATE tasks SET title=?, description=?, assigned_to=?, due_date=? WHERE id=?";
108 | $stmt = $conn->prepare($sql);
109 | $stmt->execute($data);
110 | }
111 |
112 | function update_task_status($conn, $data){
113 | $sql = "UPDATE tasks SET status=? WHERE id=?";
114 | $stmt = $conn->prepare($sql);
115 | $stmt->execute($data);
116 | }
117 |
118 |
119 | function get_all_tasks_by_id($conn, $id){
120 | $sql = "SELECT * FROM tasks WHERE assigned_to=?";
121 | $stmt = $conn->prepare($sql);
122 | $stmt->execute([$id]);
123 |
124 | if($stmt->rowCount() > 0){
125 | $tasks = $stmt->fetchAll();
126 | }else $tasks = 0;
127 |
128 | return $tasks;
129 | }
130 |
131 |
132 |
133 | function count_pending_tasks($conn){
134 | $sql = "SELECT id FROM tasks WHERE status = 'pending'";
135 | $stmt = $conn->prepare($sql);
136 | $stmt->execute([]);
137 |
138 | return $stmt->rowCount();
139 | }
140 |
141 | function count_in_progress_tasks($conn){
142 | $sql = "SELECT id FROM tasks WHERE status = 'in_progress'";
143 | $stmt = $conn->prepare($sql);
144 | $stmt->execute([]);
145 |
146 | return $stmt->rowCount();
147 | }
148 |
149 | function count_completed_tasks($conn){
150 | $sql = "SELECT id FROM tasks WHERE status = 'completed'";
151 | $stmt = $conn->prepare($sql);
152 | $stmt->execute([]);
153 |
154 | return $stmt->rowCount();
155 | }
156 |
157 |
158 | function count_my_tasks($conn, $id){
159 | $sql = "SELECT id FROM tasks WHERE assigned_to=?";
160 | $stmt = $conn->prepare($sql);
161 | $stmt->execute([$id]);
162 |
163 | return $stmt->rowCount();
164 | }
165 |
166 | function count_my_tasks_overdue($conn, $id){
167 | $sql = "SELECT id FROM tasks WHERE due_date < CURDATE() AND status != 'completed' AND assigned_to=? AND due_date != '0000-00-00'";
168 | $stmt = $conn->prepare($sql);
169 | $stmt->execute([$id]);
170 |
171 | return $stmt->rowCount();
172 | }
173 |
174 | function count_my_tasks_NoDeadline($conn, $id){
175 | $sql = "SELECT id FROM tasks WHERE assigned_to=? AND status != 'completed' AND due_date IS NULL OR due_date = '0000-00-00'";
176 | $stmt = $conn->prepare($sql);
177 | $stmt->execute([$id]);
178 |
179 | return $stmt->rowCount();
180 | }
181 |
182 | function count_my_pending_tasks($conn, $id){
183 | $sql = "SELECT id FROM tasks WHERE status = 'pending' AND assigned_to=?";
184 | $stmt = $conn->prepare($sql);
185 | $stmt->execute([$id]);
186 |
187 | return $stmt->rowCount();
188 | }
189 |
190 | function count_my_in_progress_tasks($conn, $id){
191 | $sql = "SELECT id FROM tasks WHERE status = 'in_progress' AND assigned_to=?";
192 | $stmt = $conn->prepare($sql);
193 | $stmt->execute([$id]);
194 |
195 | return $stmt->rowCount();
196 | }
197 |
198 | function count_my_completed_tasks($conn, $id){
199 | $sql = "SELECT id FROM tasks WHERE status = 'completed' AND assigned_to=?";
200 | $stmt = $conn->prepare($sql);
201 | $stmt->execute([$id]);
202 |
203 | return $stmt->rowCount();
204 | }
--------------------------------------------------------------------------------
/app/Model/User.php:
--------------------------------------------------------------------------------
1 | prepare($sql);
6 | $stmt->execute(["employee"]);
7 |
8 | if($stmt->rowCount() > 0){
9 | $users = $stmt->fetchAll();
10 | }else $users = 0;
11 |
12 | return $users;
13 | }
14 |
15 |
16 | function insert_user($conn, $data){
17 | $sql = "INSERT INTO users (full_name, username, password, role) VALUES(?,?,?, ?)";
18 | $stmt = $conn->prepare($sql);
19 | $stmt->execute($data);
20 | }
21 |
22 | function update_user($conn, $data){
23 | $sql = "UPDATE users SET full_name=?, username=?, password=?, role=? WHERE id=? AND role=?";
24 | $stmt = $conn->prepare($sql);
25 | $stmt->execute($data);
26 | }
27 |
28 | function delete_user($conn, $data){
29 | $sql = "DELETE FROM users WHERE id=? AND role=?";
30 | $stmt = $conn->prepare($sql);
31 | $stmt->execute($data);
32 | }
33 |
34 |
35 | function get_user_by_id($conn, $id){
36 | $sql = "SELECT * FROM users WHERE id =? ";
37 | $stmt = $conn->prepare($sql);
38 | $stmt->execute([$id]);
39 |
40 | if($stmt->rowCount() > 0){
41 | $user = $stmt->fetch();
42 | }else $user = 0;
43 |
44 | return $user;
45 | }
46 |
47 | function update_profile($conn, $data){
48 | $sql = "UPDATE users SET full_name=?, password=? WHERE id=? ";
49 | $stmt = $conn->prepare($sql);
50 | $stmt->execute($data);
51 | }
52 |
53 | function count_users($conn){
54 | $sql = "SELECT id FROM users WHERE role='employee'";
55 | $stmt = $conn->prepare($sql);
56 | $stmt->execute([]);
57 |
58 | return $stmt->rowCount();
59 | }
--------------------------------------------------------------------------------
/app/add-task.php:
--------------------------------------------------------------------------------
1 | prepare($sql);
28 | $stmt->execute([$user_name]);
29 |
30 | if ($stmt->rowCount() == 1) {
31 | $user = $stmt->fetch();
32 | $usernameDb = $user['username'];
33 | $passwordDb = $user['password'];
34 | $role = $user['role'];
35 | $id = $user['id'];
36 |
37 | if ($user_name === $usernameDb) {
38 | if (password_verify($password, $passwordDb)) {
39 | if ($role == "admin") {
40 | $_SESSION['role'] = $role;
41 | $_SESSION['id'] = $id;
42 | $_SESSION['username'] = $usernameDb;
43 | header("Location: ../index.php");
44 | }else if ($role == 'employee') {
45 | $_SESSION['role'] = $role;
46 | $_SESSION['id'] = $id;
47 | $_SESSION['username'] = $usernameDb;
48 | header("Location: ../index.php");
49 | }else {
50 | $em = "Unknown error occurred ";
51 | header("Location: ../login.php?error=$em");
52 | exit();
53 | }
54 | }else {
55 | $em = "Incorrect username or password ";
56 | header("Location: ../login.php?error=$em");
57 | exit();
58 | }
59 | }else {
60 | $em = "Incorrect username or password ";
61 | header("Location: ../login.php?error=$em");
62 | exit();
63 | }
64 | }
65 |
66 |
67 | }
68 | }else {
69 | $em = "Unknown error occurred";
70 | header("Location: ../login.php?error=$em");
71 | exit();
72 | }
--------------------------------------------------------------------------------
/app/notification-count.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/notification-read.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/notification.php:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 | You have zero notification
13 |
14 |
15 |
16 |
19 |
20 |
21 |
22 | ".$notification['type'].": ";
24 | }else echo $notification['type'].": " ?>
25 | =$notification['message']?>
26 | =$notification['date']?>
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/update-profile.php:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 | Create Task
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Create Task
25 |
64 |
65 |
66 |
67 |
68 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/css/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | padding: 0;
3 | margin: 0;
4 | box-sizing: border-box;
5 | font-family: arial, sans-serif;
6 | }
7 | .header {
8 | display: flex;
9 | justify-content: space-between;
10 | align-items: center;
11 | padding: 15px 30px;
12 | background: #23242b;
13 | color: #fff;
14 | }
15 | .u-name {
16 | font-size: 20px;
17 | padding-left: 17px;
18 | }
19 | .u-name b {
20 | color: #127b8e;
21 | }
22 | .header i {
23 | font-size: 30px;
24 | cursor: pointer;
25 | color: #fff;
26 | }
27 | /*.header i:hover {
28 | color: #127b8e;
29 | }*/
30 | .header .notification {
31 | position: relative;
32 | cursor: pointer;
33 | }
34 | .header .notification span{
35 | position: absolute;
36 | top: 5px;
37 | left: 5px;
38 | background: #C80000;
39 | padding: 1px;
40 | border-radius: 50%;
41 | }
42 | .header .notification:hover i{
43 | color: #127b8e;
44 | }
45 | .notification-bar {
46 | display: none;
47 | width: 90%;
48 | max-width: 300px;
49 | position: absolute;
50 | right: 0;
51 | background: #eee;
52 | padding: 5px;
53 | border: 1px solid #262931;
54 | box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
55 | }
56 | .notification-bar ul li{
57 | list-style: none;
58 | margin-top: 10px;
59 | }
60 | .notification-bar ul li a{
61 | text-decoration: none;
62 | color: #000;
63 | }
64 |
65 | .notification-bar ul li:nth-child(even){
66 | background: #fff;
67 | }
68 | .open-notification {
69 | display: block;
70 | }
71 |
72 |
73 | .user-p {
74 | text-align: center;
75 | padding-left: 10px;
76 | padding-top: 25px;
77 | }
78 | .user-p img {
79 | width: 100px;
80 | border-radius: 50%;
81 | }
82 | .user-p h4 {
83 | color: #ccc;
84 | padding: 5px 0;
85 |
86 | }
87 | .side-bar {
88 | width: 250px;
89 | background: #262931;
90 | min-height: 100vh;
91 | transition: 500ms width;
92 | }
93 | .body {
94 | display: flex;
95 | }
96 |
97 |
98 | .side-bar ul {
99 | margin-top: 20px;
100 | list-style: none;
101 | }
102 | .side-bar ul li {
103 | font-size: 16px;
104 | padding: 15px 0px;
105 | padding-left: 20px;
106 | transition: 500ms background;
107 | white-space: nowrap;
108 | overflow: hidden;
109 | text-overflow: ellipsis;
110 | }
111 | .side-bar ul li:hover {
112 | background: #127b8e;
113 | }
114 |
115 | .side-bar ul li a {
116 | text-decoration: none;
117 | color: #eee;
118 | cursor: pointer;
119 | letter-spacing: 1px;
120 | }
121 | .side-bar .active a {
122 | color: #127b8e !important;
123 | }
124 | .side-bar .active a i {
125 | color: #127b8e !important;
126 | }
127 | .side-bar ul .active:hover {
128 | background: transparent;
129 | }
130 | .side-bar ul li a i {
131 | display: inline-block;
132 | padding-right: 10px;
133 | font-size: 23px;
134 | }
135 | #navbtn {
136 | display: inline-block;
137 | margin-left: 70px;
138 | font-size: 20px;
139 | transition: 500ms color;
140 | }
141 | #checkbox {
142 | display: none;
143 | }
144 | #checkbox:checked ~ .body .side-bar {
145 | width: 60px;
146 | }
147 | #checkbox:checked ~ .body .side-bar .user-p{
148 | visibility: hidden;
149 | }
150 | #checkbox:checked ~ .body .side-bar a span{
151 | display: none;
152 | }
153 |
154 | .login-body {
155 | display: flex;
156 | justify-content: center;
157 | align-items: center;
158 | min-height: 100vh;
159 | }
160 | .login-body form {
161 | max-width:420px;
162 | width: 90%;
163 | }
164 |
165 | .section-1 {
166 | padding: 30px;
167 | }
168 | .section-1 .title {
169 | margin-bottom: 10px;
170 | }
171 | .section-1 .title a{
172 | text-decoration: none;
173 | display: inline-block;
174 | padding-left: 10px;
175 | border: none;
176 | background: #00CF22;
177 | padding: 10px 15px;
178 | color: #fff;
179 | font-size: 16px;
180 | border-radius: 5px;
181 | cursor: pointer;
182 | outline: none;
183 | transition: background 1s;
184 | box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
185 | }
186 |
187 | .section-1 .title-2 {
188 | margin-bottom: 10px;
189 | }
190 | .section-1 .title-2 .btn{
191 | text-decoration: none;
192 | display: inline-block;
193 | padding-left: 10px;
194 | border: none;
195 | background: #00CF22;
196 | padding: 10px 15px;
197 | color: #fff;
198 | font-size: 16px;
199 | border-radius: 5px;
200 | cursor: pointer;
201 | outline: none;
202 | transition: background 1s;
203 | box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
204 | }
205 | .section-1 .title-2 .btn:hover{
206 | opacity: .6;
207 | }
208 | .section-1 .title-2 a{
209 | display: inline-block;
210 | margin-left: 10px;
211 | }
212 |
213 |
214 | .section-1 {
215 | width: 100%;
216 | background: #ffe;
217 | }
218 | .section-1 .title a:hover{
219 | opacity: .6;
220 | }
221 |
222 | .main-table, .main-table tr, .main-table th, .main-table td {
223 | border: 1px solid #aaa;
224 | border-collapse: collapse;
225 | padding: 7px;
226 | }
227 | .main-table {
228 | width: 90%;
229 | margin-top: 30px;
230 | }
231 |
232 |
233 | .delete-btn{
234 | text-decoration: none;
235 | display: inline-block;
236 | padding-left: 10px;
237 | border: none;
238 | background: #E00051;
239 | padding: 10px 15px;
240 | color: #fff;
241 | font-size: 16px;
242 | border-radius: 5px;
243 | cursor: pointer;
244 | outline: none;
245 | transition: background 1s;
246 | box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
247 | }
248 | .delete-btn:hover{
249 | opacity: .6;
250 | }
251 |
252 | .edit-btn{
253 | text-decoration: none;
254 | display: inline-block;
255 | padding-left: 10px;
256 | border: none;
257 | background: #006CE0;
258 | padding: 10px 15px;
259 | color: #fff;
260 | font-size: 16px;
261 | border-radius: 5px;
262 | cursor: pointer;
263 | outline: none;
264 | transition: background 1s;
265 | box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
266 | }
267 | .edit-btn:hover{
268 | opacity: .6;
269 | }
270 | .form-1 {
271 | width: 90%;
272 | max-width: 500px;
273 | }
274 | .input-holder lable {
275 | display: block;
276 | margin-bottom: 5px;
277 | }
278 | .input-1 {
279 | border: 2px solid #ccc;
280 | width: 100%;
281 | padding: 10px;
282 | font-size: 15px;
283 | outline: none;
284 | border-radius: 5px;
285 | display: block;
286 | }
287 |
288 | .input-1:focus{
289 | border-color: #555;
290 | }
291 | .danger {
292 | background: #FF98AA;
293 | color: #B20008;
294 | padding: 10px;
295 | margin-bottom: 10px;
296 | }
297 | .success {
298 | background: #80CE91;
299 | color: #009D22;
300 | padding: 10px;
301 | margin-bottom: 10px;
302 | }
303 | .dashboard {
304 | display: flex;
305 | max-width: 650px;
306 | width: 95%;
307 | justify-content: space-between;
308 | flex-wrap: wrap;
309 | }
310 | .dashboard-item {
311 | text-align: center;
312 | background: #262931;
313 | width: 200px;
314 | padding: 30px 5px;
315 | margin-bottom: 40px;
316 | }
317 | .dashboard-item i{
318 | display: block;
319 | color: #fff;
320 | font-size: 30px;
321 | margin-bottom: 5px;
322 | }
323 | .dashboard-item span{
324 | display: block;
325 | color: #fff;
326 | }
--------------------------------------------------------------------------------
/delete-task.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/delete-user.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/edit-task-employee.php:
--------------------------------------------------------------------------------
1 |
21 |
22 |
23 |
24 | Edit Task
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
71 |
72 |
73 |
74 |
75 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/edit-task.php:
--------------------------------------------------------------------------------
1 |
21 |
22 |
23 |
24 | Edit Task
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
83 |
84 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/edit-user.php:
--------------------------------------------------------------------------------
1 |
20 |
21 |
22 |
23 | Edit User
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
68 |
69 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/edit_profile.php:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 | Edit Profile
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
61 |
62 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/img/user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codingWithElias/Employee-Task-Management-System-using-PHP-and-MySQL/ffc7d8c1d51c12e02ef340ecdc8ec9628130eb9e/img/user.png
--------------------------------------------------------------------------------
/inc/header.php:
--------------------------------------------------------------------------------
1 |
12 |
17 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/inc/nav.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 |
28 |
29 |
30 |
31 | Dashboard
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | =$num_users?> Employee
46 |
47 |
48 |
49 | =$num_task?> All Tasks
50 |
51 |
52 |
53 | =$overdue_task?> Overdue
54 |
55 |
56 |
57 | =$nodeadline_task?> No Deadline
58 |
59 |
60 |
61 | =$todaydue_task?> Due Today
62 |
63 |
64 |
65 | =$overdue_task?> Notifications
66 |
67 |
68 |
69 | =$pending?> Pending
70 |
71 |
72 |
73 | =$in_progress?> In progress
74 |
75 |
76 |
77 | =$completed?> Completed
78 |
79 |
80 |
81 |
82 |
83 |
84 | =$num_my_task?> My Tasks
85 |
86 |
87 |
88 | =$overdue_task?> Overdue
89 |
90 |
91 |
92 | =$nodeadline_task?> No Deadline
93 |
94 |
95 |
96 | =$pending?> Pending
97 |
98 |
99 |
100 | =$in_progress?> In progress
101 |
102 |
103 |
104 | =$completed?> Completed
105 |
106 |
107 |
108 |
109 |
110 |
111 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/login.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Login | Task Management System
7 |
8 |
9 |
10 |
11 |
12 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/logout.php:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 | My Tasks
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | My Tasks
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | # |
35 | Title |
36 | Description |
37 | Status |
38 | Due Date |
39 | Action |
40 |
41 |
42 |
43 | =++$i?> |
44 | =$task['title']?> |
45 | =$task['description']?> |
46 | =$task['status']?> |
47 | =$task['due_date']?> |
48 |
49 |
50 | Edit
51 | |
52 |
53 |
54 |
55 |
56 | Empty
57 |
58 |
59 |
60 |
61 |
62 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/notifications.php:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 | Notifications
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | All Notifications
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | # |
35 | Message |
36 | Type |
37 | Date |
38 |
39 |
40 |
41 | =++$i?> |
42 | =$notification['message']?> |
43 | =$notification['type']?> |
44 | =$notification['date']?> |
45 |
46 |
47 |
48 |
49 | You have zero notification
50 |
51 |
52 |
53 |
54 |
55 |
56 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/profile.php:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 | Profile
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | Full Name |
27 | =$user['full_name']?> |
28 |
29 |
30 | User name |
31 | =$user['username']?> |
32 |
33 |
34 | Joined At |
35 | =$user['created_at']?> |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/task_management_db.sql:
--------------------------------------------------------------------------------
1 | -- phpMyAdmin SQL Dump
2 | -- version 5.2.1
3 | -- https://www.phpmyadmin.net/
4 | --
5 | -- Host: 127.0.0.1
6 | -- Generation Time: Sep 06, 2024 at 10:40 AM
7 | -- Server version: 10.4.32-MariaDB
8 | -- PHP Version: 8.0.30
9 |
10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11 | START TRANSACTION;
12 | SET time_zone = "+00:00";
13 |
14 |
15 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
16 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
17 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
18 | /*!40101 SET NAMES utf8mb4 */;
19 |
20 | --
21 | -- Database: `task_management_db`
22 | --
23 |
24 | -- --------------------------------------------------------
25 |
26 | --
27 | -- Table structure for table `notifications`
28 | --
29 |
30 | CREATE TABLE `notifications` (
31 | `id` int(11) NOT NULL,
32 | `message` text NOT NULL,
33 | `recipient` int(11) NOT NULL,
34 | `type` varchar(50) NOT NULL,
35 | `date` date NOT NULL DEFAULT current_timestamp(),
36 | `is_read` tinyint(1) DEFAULT 0
37 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
38 |
39 | --
40 | -- Dumping data for table `notifications`
41 | --
42 |
43 | INSERT INTO `notifications` (`id`, `message`, `recipient`, `type`, `date`, `is_read`) VALUES
44 | (1, '\'Customer Feedback Survey Analysis\' has been assigned to you. Please review and start working on it.', 7, 'New Task Assigned', '2024-09-05', 1),
45 | (2, '\'test task\' has been assigned to you. Please review and start working on it', 7, 'New Task Assigned', '0000-00-00', 1),
46 | (3, '\'Example task 2\' has been assigned to you. Please review and start working on it', 2, 'New Task Assigned', '2006-09-24', 1),
47 | (4, '\'test\' has been assigned to you. Please review and start working on it', 8, 'New Task Assigned', '2009-06-24', 0),
48 | (5, '\'test task 3\' has been assigned to you. Please review and start working on it', 7, 'New Task Assigned', '2024-09-06', 1),
49 | (6, '\'Prepare monthly sales report\' has been assigned to you. Please review and start working on it', 7, 'New Task Assigned', '2024-09-06', 1),
50 | (7, '\'Update client database\' has been assigned to you. Please review and start working on it', 7, 'New Task Assigned', '2024-09-06', 1),
51 | (8, '\'Fix server downtime issue\' has been assigned to you. Please review and start working on it', 2, 'New Task Assigned', '2024-09-06', 0),
52 | (9, '\'Plan annual marketing strategy\' has been assigned to you. Please review and start working on it', 2, 'New Task Assigned', '2024-09-06', 0),
53 | (10, '\'Onboard new employees\' has been assigned to you. Please review and start working on it', 7, 'New Task Assigned', '2024-09-06', 0),
54 | (11, '\'Design new company website\' has been assigned to you. Please review and start working on it', 2, 'New Task Assigned', '2024-09-06', 0),
55 | (12, '\'Conduct software testing\' has been assigned to you. Please review and start working on it', 7, 'New Task Assigned', '2024-09-06', 0),
56 | (13, '\'Schedule team meeting\' has been assigned to you. Please review and start working on it', 2, 'New Task Assigned', '2024-09-06', 0),
57 | (14, '\'Prepare budget for Q4\' has been assigned to you. Please review and start working on it', 7, 'New Task Assigned', '2024-09-06', 0),
58 | (15, '\'Write blog post on industry trend\' has been assigned to you. Please review and start working on it', 7, 'New Task Assigned', '2024-09-06', 0),
59 | (16, '\'Renew software license\' has been assigned to you. Please review and start working on it', 2, 'New Task Assigned', '2024-09-06', 0);
60 |
61 | -- --------------------------------------------------------
62 |
63 | --
64 | -- Table structure for table `tasks`
65 | --
66 |
67 | CREATE TABLE `tasks` (
68 | `id` int(11) NOT NULL,
69 | `title` varchar(100) NOT NULL,
70 | `description` text DEFAULT NULL,
71 | `assigned_to` int(11) DEFAULT NULL,
72 | `due_date` date DEFAULT NULL,
73 | `status` enum('pending','in_progress','completed') DEFAULT 'pending',
74 | `created_at` timestamp NOT NULL DEFAULT current_timestamp()
75 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
76 |
77 | --
78 | -- Dumping data for table `tasks`
79 | --
80 |
81 | INSERT INTO `tasks` (`id`, `title`, `description`, `assigned_to`, `due_date`, `status`, `created_at`) VALUES
82 | (1, 'Task 1', 'Task Description', 7, NULL, 'completed', '2024-08-29 16:47:37'),
83 | (4, 'Monthly Financial Report Preparation', 'Prepare and review the monthly financial report, including profit and loss statements, balance sheets, and cash flow analysis.', 7, '2024-09-01', 'completed', '2024-08-31 10:50:20'),
84 | (5, 'Customer Feedback Survey Analysis', 'Collect and analyze data from the latest customer feedback survey to identify areas for improvement in customer service.', 7, '2024-09-03', 'in_progress', '2024-08-31 10:50:47'),
85 | (6, 'Website Maintenance and Update', 'Perform regular maintenance on the company website, update content, and ensure all security patches are applied.', 7, '2024-09-03', 'pending', '2024-08-31 10:51:12'),
86 | (7, 'Quarterly Inventory Audit', 'Conduct a thorough audit of inventory levels across all warehouses and update the inventory management system accordingly.', 2, '2024-09-03', 'completed', '2024-08-31 10:51:45'),
87 | (8, 'Employee Training Program Development', 'Develop and implement a new training program focused on enhancing employee skills in project management and teamwork.', 2, '2024-09-01', 'pending', '2024-08-31 10:52:11'),
88 | (17, 'Prepare monthly sales report', 'Compile and analyze sales data for the previous month', 7, '2024-09-06', 'pending', '2024-09-06 08:01:48'),
89 | (18, 'Update client database', 'Ensure all client information is current and complete', 7, '2024-09-07', 'pending', '2024-09-06 08:02:27'),
90 | (19, 'Fix server downtime issue', 'Investigate and resolve the cause of recent server downtimes', 2, '2024-09-07', 'pending', '2024-09-06 08:02:59'),
91 | (20, 'Plan annual marketing strategy', 'Develop a comprehensive marketing strategy for the next year', 2, '2024-09-04', 'pending', '2024-09-06 08:03:21'),
92 | (21, 'Onboard new employees', 'Complete HR onboarding tasks for the new hires', 7, '2024-09-07', 'pending', '2024-09-06 08:03:44'),
93 | (22, 'Design new company website', 'Create wireframes and mockups for the new website design', 2, '2024-09-06', 'pending', '2024-09-06 08:04:20'),
94 | (23, 'Conduct software testing', 'Run tests on the latest software release to identify bugs', 7, '2024-09-07', 'pending', '2024-09-06 08:04:39'),
95 | (24, 'Schedule team meeting', 'Organize a meeting to discuss project updates', 2, '2024-09-07', 'pending', '2024-09-06 08:04:57'),
96 | (25, 'Prepare budget for Q4', 'Create and review the budget for the upcoming quarter', 7, '2024-09-07', 'pending', '2024-09-06 08:05:21'),
97 | (26, 'Write blog post on industry trend', 'Draft and publish a blog post about current industry trend', 7, '2024-09-07', 'pending', '2024-09-06 08:10:50'),
98 | (27, 'Renew software license', 'Ensure all software licenses are renewed and up to date', 2, '2024-09-06', 'pending', '2024-09-06 08:11:28');
99 |
100 | -- --------------------------------------------------------
101 |
102 | --
103 | -- Table structure for table `users`
104 | --
105 |
106 | CREATE TABLE `users` (
107 | `id` int(11) NOT NULL,
108 | `full_name` varchar(50) NOT NULL,
109 | `username` varchar(50) NOT NULL,
110 | `password` varchar(255) NOT NULL,
111 | `role` enum('admin','employee') NOT NULL,
112 | `created_at` timestamp NOT NULL DEFAULT current_timestamp()
113 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
114 |
115 | --
116 | -- Dumping data for table `users`
117 | --
118 |
119 | INSERT INTO `users` (`id`, `full_name`, `username`, `password`, `role`, `created_at`) VALUES
120 | (1, 'Oliver', 'admin', '$2y$10$TnyR1Y43m1EIWpb0MiwE8Ocm6rj0F2KojE3PobVfQDo9HYlAHY/7O', 'admin', '2024-08-28 07:10:04'),
121 | (2, 'Elias A.', 'elias', '$2y$10$8xpI.hVCVd/GKUzcYTxLUO7ICSqlxX5GstSv7WoOYfXuYOO/SZAZ2', 'employee', '2024-08-28 07:10:40'),
122 | (7, 'John', 'john', '$2y$10$CiV/f.jO5vIsSi0Fp1Xe7ubWG9v8uKfC.VfzQr/sjb5/gypWNdlBW', 'employee', '2024-08-29 17:11:21'),
123 | (8, 'Oliver', 'oliver', '$2y$10$E9Xx8UCsFcw44lfXxiq/5OJtloW381YJnu5lkn6q6uzIPdL5yH3PO', 'employee', '2024-08-29 17:11:34');
124 |
125 | --
126 | -- Indexes for dumped tables
127 | --
128 |
129 | --
130 | -- Indexes for table `notifications`
131 | --
132 | ALTER TABLE `notifications`
133 | ADD PRIMARY KEY (`id`);
134 |
135 | --
136 | -- Indexes for table `tasks`
137 | --
138 | ALTER TABLE `tasks`
139 | ADD PRIMARY KEY (`id`),
140 | ADD KEY `assigned_to` (`assigned_to`);
141 |
142 | --
143 | -- Indexes for table `users`
144 | --
145 | ALTER TABLE `users`
146 | ADD PRIMARY KEY (`id`);
147 |
148 | --
149 | -- AUTO_INCREMENT for dumped tables
150 | --
151 |
152 | --
153 | -- AUTO_INCREMENT for table `notifications`
154 | --
155 | ALTER TABLE `notifications`
156 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
157 |
158 | --
159 | -- AUTO_INCREMENT for table `tasks`
160 | --
161 | ALTER TABLE `tasks`
162 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;
163 |
164 | --
165 | -- AUTO_INCREMENT for table `users`
166 | --
167 | ALTER TABLE `users`
168 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
169 |
170 | --
171 | -- Constraints for dumped tables
172 | --
173 |
174 | --
175 | -- Constraints for table `tasks`
176 | --
177 | ALTER TABLE `tasks`
178 | ADD CONSTRAINT `tasks_ibfk_1` FOREIGN KEY (`assigned_to`) REFERENCES `users` (`id`);
179 | COMMIT;
180 |
181 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
182 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
183 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
184 |
--------------------------------------------------------------------------------
/tasks.php:
--------------------------------------------------------------------------------
1 |
32 |
33 |
34 |
35 | All Tasks
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
54 | =$text?> (=$num_task?>)
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | # |
64 | Title |
65 | Description |
66 | Assigned To |
67 | Due Date |
68 | Status |
69 | Action |
70 |
71 |
72 |
73 | =++$i?> |
74 | =$task['title']?> |
75 | =$task['description']?> |
76 |
77 |
82 | |
83 | |
86 | =$task['status']?> |
87 |
88 | Edit
89 | Delete
90 | |
91 |
92 |
93 |
94 |
95 | Empty
96 |
97 |
98 |
99 |
100 |
101 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/user.php:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 | Manage Users
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | # |
34 | Full Name |
35 | Username |
36 | role |
37 | Action |
38 |
39 |
40 |
41 | =++$i?> |
42 | =$user['full_name']?> |
43 | =$user['username']?> |
44 | =$user['role']?> |
45 |
46 | Edit
47 | Delete
48 | |
49 |
50 |
51 |
52 |
53 | Empty
54 |
55 |
56 |
57 |
58 |
59 |
63 |
64 |
65 |
--------------------------------------------------------------------------------