Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmad luky ramdani committed May 19, 2016
1 parent beeafd8 commit fa8b2fa
Show file tree
Hide file tree
Showing 22 changed files with 186 additions and 43 deletions.
104 changes: 104 additions & 0 deletions admin/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?php
session_start();
if (!isset($_SESSION["loket_client"])) {
$_SESSION["loket_client"] = NULL;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Admin : Queue</title>
<link href="../assert/css/bootstrap.min.css" rel="stylesheet">
<link href="../assert/css/jumbotron-narrow.css" rel="stylesheet">
<script src="../assert/js/jquery.min.js"></script>
</head>

<body>
<div class="container">
<div class="header clearfix">
<nav>
<ul class="nav nav-pills pull-right">
<li role="presentation"><a href="#">ABOUT</a></li>
</ul>
</nav>
<h3 class="text-muted">Admin : Queue Apps</h3>
</div>


<form>
<div class="alert alert-info alert-dismissible peringatan" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<strong>Info !</strong> Jumlah loket berhasil disave
</div>
<label for="exampleInputEmail1">Jumlah Loket</label>
<input type="text" class="form-control loket" placeholder="Jumlah Loket">
</form>

<footer class="footer">
<p>&copy; ITERA <?php echo date("Y");?></p>
</footer>
</div>
</body>

<script type="text/javascript">
$("document").ready(function()
{
$('.peringatan').hide();

// GET JUMLAH LOKET
$.post( "../apps/admin_server.php", function( data ) {
$(".loket").val(data['jumlah_loket']);
},"json");


// NUMBER LOKET
$('form input').data('val', $('form input').val() );
$('form input').change(function() {
//set seassion or save
var data = {"jmlloket": $(".loket").val()};
$.ajax({
type: "POST",
dataType: "json",
url: "../apps/admin_server.php",//request
data: data,
success: function(data) {
if (data["status"])
{
$('.peringatan').show();
}
}
});
});
$('form input').keyup(function() {
if( $('form input').val() != $('form input').data('val') ){
$('form input').data('val', $('form input').val() );
$(this).change();
}
});


// GET NEXT COUNTER
// $(".next_queue").click(function(){
// var loket = $(".loket").val();
// var data = {"loket" : loket};
// $.ajax({
// type: "POST",
// dataType: "json",
// url: "../apps/daemon.php",//request
// data: data,
// success: function(data) {
// $(".jumbotron h1").html(data["next"]);
// }
// });
// return false;
// });

});
</script>
</html>

33 changes: 33 additions & 0 deletions apps/admin_server.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
$data = array();
$db = new SQLite3('../db/antrian.db');

if (isset($_POST) and count($_POST) > 0)
{
$jmlloket = $_POST['jmlloket'];

$results = $db->query('DELETE FROM client_antrian;');

for ($i=1; $i <= $jmlloket ; $i++) {

$results = $db->query('INSERT INTO client_antrian (client) VALUES ('.$i.')');

}

echo json_encode(array("status"=>TRUE));

} else {
$results = $db->query('SELECT count(*) as jumlah_loket FROM client_antrian');

if ( $results->numColumns())
{
while ($row = $results->fetchArray())
{
$data['jumlah_loket'] = $row['jumlah_loket'];
}
} else {
$data['jumlah_loket'] = $row['jumlah_loket'];
}

echo json_encode($data);
}
11 changes: 9 additions & 2 deletions apps/monitoring-daemon.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@

$db = new SQLite3('../db/antrian.db');
$data = array();


// Jumlah Loket
$results = $db->query('SELECT count(*) as jumlah_loket FROM client_antrian');
$loket = $results->fetchArray();
$data['jumlah_loket'] = $loket['jumlah_loket'];

//2 done
//1 wait
//0 execution
Expand All @@ -14,6 +19,7 @@
$c = $wait['c'];
if ($c)
{

}else{

$result = $db->query('SELECT id, counter FROM data_antrian WHERE status=0 ORDER BY waktu ASC LIMIT 1'); // execution
Expand All @@ -26,8 +32,9 @@
$_SESSION["next_server"][$rows['counter']] = $rows['id'];
$_SESSION["counter_server"][$rows['counter']] = $rows['counter'];
$db->query('UPDATE data_antrian SET status= 1 WHERE id='. $rows['id'] .''); // wait
echo json_encode($data);
}

}

echo json_encode($data);
?>
Binary file added audio/new/1.MP3
Binary file not shown.
Binary file added audio/new/2.MP3
Binary file not shown.
Binary file added audio/new/3.MP3
Binary file not shown.
Binary file added audio/new/4.MP3
Binary file not shown.
Binary file added audio/new/5.MP3
Binary file not shown.
Binary file added audio/new/6.MP3
Binary file not shown.
Binary file added audio/new/7.MP3
Binary file not shown.
Binary file added audio/new/8.MP3
Binary file not shown.
Binary file added audio/new/9.MP3
Binary file not shown.
Binary file added audio/new/belas.MP3
Binary file not shown.
Binary file added audio/new/konter.MP3
Binary file not shown.
Binary file added audio/new/loket.MP3
Binary file not shown.
Binary file added audio/new/puluh.MP3
Binary file not shown.
Binary file added audio/new/ratus.MP3
Binary file not shown.
Binary file added audio/new/ribu.MP3
Binary file not shown.
Binary file added audio/new/sebelas.MP3
Binary file not shown.
Binary file added audio/new/sepuluh.MP3
Binary file not shown.
Binary file modified db/antrian.db
Binary file not shown.
81 changes: 40 additions & 41 deletions server/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,42 +20,25 @@
</head>

<body>

<div class="container">

<div class="row loket">
<div class="col-md-3">
<div class="satu jumbotron">
<button class="btn btn-danger" type="button">
LOKET 1
</button>
<h1>0</h1>
</div>
</div>
<div class="col-md-3">
<div class="dua jumbotron">
<button class="btn btn-danger" type="button">
LOKET 2
</button>
<h1>0</h1>
</div>
</div>
</div>

<div class="audio">
<audio id="in" src="../audio/in.wav" ></audio>
<audio id="out" src="../audio/out.wav" ></audio>
<audio id="suarabel" src="../audio/Airport_Bell.mp3" ></audio>
<audio id="suarabelnomorurut" src="../audio/nomor-urut.wav" ></audio>
<audio id="suarabelsuarabelloket" src="../audio/loket.wav" ></audio>
<audio id="belas" src="../audio/belas.wav" ></audio>
<audio id="sebelas" src="../audio/sebelas.wav" ></audio>
<audio id="puluh" src="../audio/puluh.wav" ></audio>
<audio id="sepuluh" src="../audio/sepuluh.wav" ></audio>
<audio id="ratus" src="../audio/ratus.wav" ></audio>
<audio id="seratus" src="../audio/seratus.wav" ></audio>
<audio id="suarabelloket1" src="../audio/1.wav" ></audio>
<audio id="suarabelloket2" src="../audio/2.wav" ></audio>
<audio id="suarabelsuarabelloket" src="../audio/new/di_konter.MP3" ></audio>
<audio id="belas" src="../audio/new/belas.MP3" ></audio>
<audio id="sebelas" src="../audio/new/sepuluh.MP3" ></audio>
<audio id="puluh" src="../audio/new/puluh.MP3" ></audio>
<audio id="sepuluh" src="../audio/new/sepuluh.MP3" ></audio>
<audio id="ratus" src="../audio/new/ratus.MP3" ></audio>
<audio id="seratus" src="../audio/new/seratus.wav" ></audio>
<audio id="suarabelloket1" src="../audio/new/1.MP3" ></audio>
<audio id="suarabelloket2" src="../audio/new/2.MP3" ></audio>
<audio id="loket" src="../audio/loket.wav" ></audio>
</div>

Expand All @@ -67,37 +50,53 @@

<script type="text/javascript">
$("document").ready(function(){

<?php if ($_SESSION['counter_server'][1] == 1) { ?>
$(".satu h1").html(<?php echo $_SESSION['next_server'][1] ?>);
$(".1 h1").html(<?php echo $_SESSION['next_server'][1] ?>);
<?php } ?>

<?php if ($_SESSION['counter_server'][2] == 2) { ?>
$(".dua h1").html(<?php echo $_SESSION['next_server'][2] ?>);
$(".2 h1").html(<?php echo $_SESSION['next_server'][2] ?>);
<?php } ?>


var tmp_loket=0;

setInterval(function() {
$.post("../apps/monitoring-daemon.php", function( data ){
if (data["counter"]==1) {
$(".satu h1").html(data["next"]);
if(tmp_loket!=data['jumlah_loket']){
$(".col-md-3").remove();
tmp_loket=0;
}
if (data["counter"]==2) {
$(".dua h1").html(data["next"]);
if (tmp_loket==0) {
for (var i = 1; i<= data['jumlah_loket']; i++) {
loket = '<div class="col-md-3">'+
'<div class="'+ i +
' jumbotron">'+
'<button class="btn btn-danger" type="button">LOKET '+ i +'</button><h1>0</h1></button>'
'</div>'+
'</div>';
$(".loket").append(loket);
}

tmp_loket = data['jumlah_loket'];
}

for (var i = 1; i <= data['jumlah_loket']; i++) {
if (data["counter"]==i) {
$("."+i+" h1").html(data["next"]);
}
}

if (data["next"]) {
var angka = data["next"];
for (var i = 0 ; i < angka.toString().length; i++) {
$(".audio").append('<audio id="suarabel'+i+'" src="../audio/'+angka.toString().substr(i,1)+'.wav" ></audio>');
};
mulai(data["next"],data["counter"]);
}else{
if (data["counter"]==1) {
$(".satu h1").html(data["next"]);
}
if (data["counter"]==2) {
$(".dua h1").html(data["next"]);
}
<?php for ($i=1; $i <= count($_SESSION["counter_server"]); $i++) { ?>
$(".<?php echo $i;?> h1").html(<?php echo $_SESSION['next_server'][$i] ?>);
<?php } ?>
};

}, "json");
}, 1000);
//change
Expand Down

0 comments on commit fa8b2fa

Please sign in to comment.