-
Notifications
You must be signed in to change notification settings - Fork 0
/
survey_report.php
241 lines (96 loc) · 3.26 KB
/
survey_report.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
<?php include 'db_connect.php' ?>
<form action="" method="POST">
<div class="row justify-content-center">
<div class="col-xl-10 col-xl-12 col-md-9">
<div class="card o-hidden border-0 shadow-lg my-5">
<div class="card-body p-0">
<div class="p-5">
<div class="text-center">
<h1 class="h4 text-gray-900 mb-4">Choisir Client :</h1>
</div>
<select name="usc" id="usc" class="custom-select form-control form-control-sm">
<?php
$usc = $conn->query("SELECT id, middlename from users where type = 2 ");
while($row= $usc->fetch_assoc()):
?>
<option value="<?php echo ucwords($row['id']) ?>"><?php echo ucwords($row['middlename']) ?></option>
<?php endwhile;?>
</select>
<br><br><br><br>
<div class="d-flex justify-content-center">
<input type="submit" class="btn btn-outline-primary" name="sub" vlaue="Choose user">
</div>
</form>
<?php
$selected = 0;
if(isset($_POST['sub'])){
if(!empty($_POST['usc'])) {
$selected = $_POST['usc'];
} else {
echo $selected;
}
}
$answers = $conn->query("SELECT distinct(survey_id) from answers as a, users as u ");
?>
<div class="col-lg-12">
<div class="row">
<?php
$survey = $conn->query("SELECT s.id, s.title, s.description, s.start_date, s.end_date FROM survey_set AS s, users as u WHERE FIND_IN_SET(s.title,u.serv) and u.id = '".$selected."' " );
while($row=$survey->fetch_assoc()):
?>
<div class="col-md-3 py-1 px-1 survey-item">
<div class="card card-outline card-primary">
<div class="card-header">
<h3 class="card-title"><?php echo ucwords($row['title']) ?></h3>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse">
</button>
</div>
</div>
<div class="card-body" style="display: block;">
<div class="row">
<hr class="border-primary">
<div class="d-flex justify-content-center w-100 text-center">
<a href="index.php?page=view_survey_report&id=<?php echo $row['id'] ?>&usid=<?php echo $selected ?>" class="btn btn-sm btn-outline-primary"><i class="fa fa-poll"></i> View Report</a>
</div>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
<?php
error_reporting( E_NOTICE);
?>
<script>
function find_survey(){
start_load()
var filter = $('#filter').val()
filter = filter.toLowerCase()
console.log(filter)
$('.survey-item').each(function(){
var txt = $(this).text()
if((txt.toLowerCase()).includes(filter) == true){
$(this).toggle(true)
}else{
$(this).toggle(false)
}
if($('.survey-item:visible').length <= 0){
$('#ns').show()
}else{
$('#ns').hide()
}
})
end_load()
}
$('#search').click(function(){
find_survey()
})
$('#filter').keypress(function(e){
if(e.which == 13){
find_survey()
return false;
}
})
</script>