-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_task.php
92 lines (86 loc) · 2.69 KB
/
create_task.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
session_start();
if (isset($_SESSION['role']) && isset($_SESSION['id']) && $_SESSION['role'] == "admin") {
include "DB_connection.php";
include "app/Model/User.php";
include "app/Model/Category.php";
$users = get_all_users($conn);
$categories = get_all_categories($conn);
?>
<!DOCTYPE html>
<html>
<head>
<title>Create Task</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<input type="checkbox" id="checkbox">
<?php include "inc/header.php" ?>
<div class="body">
<?php include "inc/nav.php" ?>
<section class="section-1">
<h4 class="title">Create Task </h4>
<form class="form-1"
method="POST"
action="app/add-task.php">
<?php if (isset($_GET['error'])) {?>
<div class="danger" role="alert">
<?php echo stripcslashes($_GET['error']); ?>
</div>
<?php } ?>
<?php if (isset($_GET['success'])) {?>
<div class="success" role="alert">
<?php echo stripcslashes($_GET['success']); ?>
</div>
<?php } ?>
<div class="input-holder">
<lable>Title</lable>
<input type="text" name="title" class="input-1" placeholder="Title"><br>
</div>
<div class="input-holder">
<lable>Description</lable>
<textarea type="text" name="description" class="input-1" placeholder="Description"></textarea><br>
</div>
<div class="input-holder">
<lable>Due Date</lable>
<input type="date" name="due_date" class="input-1" placeholder="Due Date"><br>
</div>
<div class="input-holder">
<lable>Assigned to</lable>
<select name="assigned_to" class="input-1">
<option value="0">Select employee</option>
<?php if ($users !=0) {
foreach ($users as $user) {
?>
<option value="<?=$user['id']?>"><?=$user['full_name']?></option>
<?php } } ?>
</select><br>
</div>
<div class="input-holder">
<lable>Category</lable>
<select name="category_id" class="input-1">
<option value="0">Select category</option>
<?php if ($categories !=0) {
foreach ($categories as $category) {
?>
<option value="<?=$category['id']?>"><?=htmlspecialchars($category['name'])?></option>
<?php } } ?>
</select><br>
</div>
<button class="edit-btn">Create Task</button>
</form>
</section>
</div>
<script type="text/javascript">
var active = document.querySelector("#navList li:nth-child(3)");
active.classList.add("active");
</script>
</body>
</html>
<?php }else{
$em = "First login";
header("Location: login.php?error=$em");
exit();
}
?>