forked from pragunbhutani/skadool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
111 lines (77 loc) · 2.28 KB
/
index.php
File metadata and controls
111 lines (77 loc) · 2.28 KB
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
<?php
require_once 'includes.php';
?>
<!DOCTYPE html>
<html>
<head>
<title>Skadool</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<style>
.table tr {
transition: all 0.4s ease-in-out;
-webkit-transition: all 0.4s ease-in-out;
-moz-transition: all 0.4s ease-in-out;
}
</style>
</head>
<body>
<div class="container">
<div class="page-header">
<h1>Skadool <small>Flexible scheduling powered by plivo.</small></h1>
</div>
<?php
echo '<h3>List of Visits</h3>';
$result = mysql_query('SELECT visitID, contactName, contactNumber, status FROM visits');
if(mysql_num_rows($result)) {
echo '<table cellpadding="10" cellspacing="10" class="table table-hover">';
echo '<tr><th>Visit ID</th><th>Contact Name</th><th>Contact Number</th><th>Status</th></tr>';
while($row = mysql_fetch_row($result)) {
echo '<tr data-visitid="' . $row[0] . '">';
foreach($row as $cell) {
echo '<td>' . $cell . '</td>';
}
echo '</tr>';
}
echo '</table><br />';
?>
<div class="span4 offset4">
<form name="input" action="sendTexts.php" method="get">
<div class="input-append">
<input class="span3" id="appendedInputButton" type="text" name="countTexts" placeholder="Number of clients to text" />
<button class="btn btn-primary" type="submit">Go!</button>
</div>
</form>
</div>
<?php
}
else {
echo '<p class="lead">No visits in record.</p>';
}
?>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
var serverTime = <?php echo time(); ?>;
function getUpdates() {
console.log(window.serverTime);
$.ajax({
url: 'ajaxUpdates.php?serverTime=' + window.serverTime,
success: function(data) {
data = JSON.parse(data);
for (entry in data.body.updatedData) {
var $tr = $("tr[data-visitid=" + data.body.updatedData[entry].visitID + "]");
$("td:nth-child(4)", $tr).html(data.body.updatedData[entry].status);
$tr.css('background', 'rgb(101, 190, 101)')
window.setTimeout(function($tr) {
$tr.css({background: ''});
}, 3000, $tr);
}
window.serverTime = data.body.serverTime;
},
});
}
window.setInterval(getUpdates, 5000);
</script>
</div>
</body>
</html>