-
Notifications
You must be signed in to change notification settings - Fork 0
/
training.php
141 lines (120 loc) · 6.39 KB
/
training.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
include('header.php');
?>
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- Page Heading -->
<h1 class="h3 mb-4 text-gray-800">TRAINING MANAGEMENT</h1>
<div class="row">
<div class="col-lg-6">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Create New Training</h6>
</div>
<div class="card-body">
<form class="user" autocomplete="off" method="POST" action="functions/system/process/create_training.php">
<div class="form-group">
<input type="text" class="form-control form-control-user" name="title" placeholder="Title.. " required>
</div>
<div class="form-group">
<input type="text" class="form-control form-control-user" name="description" placeholder="Description.. " required>
</div>
<button type="reset" class="btn btn-danger btn-icon-split">
<span class="icon text-white-50">
<i class="fas fa-flag"></i>
</span>
<span class="text">Reset</span>
</button>
<button type="submit" class="btn btn-success btn-icon-split">
<span class="icon text-white-50">
<i class="fas fa-check"></i>
</span>
<span class="text">Submit</span>
</button>
</form>
</div>
</div>
</div>
<!-- lists of users -->
<div class="col-lg-6">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Trainings</h6>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>Title</th>
<th>Description</th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>Title</th>
<th>Description</th>
<th></th>
</tr>
</tfoot>
<tbody>
<?php
$findTrainings = selectAll('training');
foreach ($findTrainings as $training) {
?>
<tr id="<?php echo $training['id'] ?>">
<td><?php echo $training['title'] ?></td>
<td><?php echo $training['description'] ?></td>
<td>
<input type="text" id="itemId" value="<?php echo $training['id'] ?>" hidden>
<a href="#" class="btn btn-info btn-circle">
<i class="fas fa-info-circle"></i>
</a>
<a href="#" class="btn btn-warning btn-circle">
<i class="fas fa-edit"></i>
</a>
<a href="#" class="btn btn-danger btn-circle" onclick="deleteQuestion()">
<i class="fas fa-trash"></i>
</a>
<script>
function deleteQuestion() {
if (confirm("Are you sure you want to delete this question?")) {
$(document).ready(function() {
// alert("Deleted")
$('#itemId').ready(function() {
var itemId = $('#itemId').val();
$.ajax({
url: "functions/system/ajax_functions/delete/delete_training.php",
method: "POST",
data: {
itemId: itemId
},
success: function(data) {
$("#<?php echo $training['id'] ?>").remove();
}
})
});
});
} else {
alert("Not Deleted")
}
}
</script>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
<?php
include('footer.php');
?>