-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforms.php
74 lines (74 loc) · 2.73 KB
/
forms.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
<h3>Form Created By You</h3>
<hr class="border-primary">
<div class="col-md-12">
<table id="forms-tbl" class="table table-stripped">
<thead>
<tr>
<th>#</th>
<th>DateTime</th>
<th>Code</th>
<th>Title</th>
<th>URL</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
$forms = $db->conn->query("SELECT * FROM `form_list` WHERE `form_list`.`created_by`='$uid' order by date(date_created) desc");
while($row = $forms->fetch_assoc()):
?>
<tr>
<td class="text-center"><?php echo $i++ ?></td>
<td><?php echo date("M d,Y h:i A",strtotime($row['date_created'])) ?></td>
<td><?php echo $row['form_code'] ?></td>
<td><?php echo $row['title'] ?></td>
<td><a
href="./form.php?code=<?php echo $row['form_code'] ?>">form.php?code=<?php echo $row['form_code'] ?></a>
</td>
<td class='text-center'>
<a href="./index.php?p=view_form&code=<?php echo $row['form_code'] ?>"
class="btn btn-default border">View</a>
<a href="./index.php?p=view_responses&code=<?php echo $row['form_code'] ?>"
class="btn btn-default border">Responses</a>
<a href="javascript:void(0)" class="btn btn-default border rem_form"
data-id='<?php echo $row['form_code'] ?>'><span class="fa fa-trash text-danger"></span></a>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
<script>
$(function() {
$('#forms-tbl').dataTable();
$('.rem_form').click(function() {
start_loader();
var _conf = confirm("Are you sure to delete this data?")
if (_conf == true) {
$.ajax({
url: 'classes/Forms.php?a=delete_form',
method: 'POST',
data: {
form_code: $(this).attr('data-id')
},
dataType: 'json',
error: err => {
console.log(err)
alert("an error occured")
},
success: function(resp) {
if (resp.status == 'success') {
alert("Data successfully deleted");
location.reload()
} else {
console.log(resp)
alert("an error occured")
}
}
})
}
end_loader()
})
})
</script>