Commit 259c5dc2 authored by Indra Raja's avatar Indra Raja

penambahan fitur tampilan antrian umum

parent 95e7301f
......@@ -220,6 +220,9 @@ class ApiController extends \Application\Master\GlobalActionController {
return $this->getOutput($result->toJson());
}
public function TampilanUmumAction(){
}
public function saveregisterAction(){
$result = new Result();
......@@ -799,9 +802,8 @@ class ApiController extends \Application\Master\GlobalActionController {
// print_r($dataArraydokter);die;
$param->saveGlobal($DokterPoli, $table_dokter_to_poli);
$param->saveGlobal($Dokter, $table_dokter);
$param->saveGlobal($DokterPoli, $table_dokter_to_poli);
$result->code = 0;
......@@ -1195,31 +1197,26 @@ class ApiController extends \Application\Master\GlobalActionController {
return $this->getOutput($result->toJson());
}
public function loadAntrianAction(){
public function loadantrianAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$antrian = new \Application\Model\Param($storage);
$load = $antrian->loadAntrian();
//$name = $this->isFieldMandatory(@$data['name'], 'name');
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
// print_r($load);die;
$load = $test->loadAntrian($post->id);
if($load->code == 0){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $load->data;
}
else{
}else{
$result->code = 1;
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
......@@ -1258,7 +1255,7 @@ class ApiController extends \Application\Master\GlobalActionController {
$poli = new \Application\Model\Param($storage);
$load = $poli->loadPoli();
$load = $poli->loadPoli($post->$id_poli);
......
......@@ -158,8 +158,10 @@ class QueueController extends \Application\Master\GlobalActionController
//print_r($uri);die;
$baseurl = sprintf('//%s', $uri->getHost());
$getpath = explode("/",$uri->getPath());
// print_($getpath);die;
$decodeid = base64_decode($getpath[3]);
// $a = $getpath[3];
$decodeiddok = base64_decode($getpath[4]);
// $decodeidpol = base64_decode($getpath[5]);
......
......@@ -48,25 +48,16 @@ class UmumController extends \Application\Master\GlobalActionController
/* get url */
$uri = $this->getRequest()->getUri();
$baseurl = sprintf('//%s', $uri->getHost());
$getpath = explode("/",$uri->getPath());
// echo "<pre>";
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendFile('/action-js/antrian-js/action-umum.js');
$this->layout("layout/layoutUmum");
return $view;
}
public function tampilanantrianAction()
{
$view = new ViewModel();
$result = new Result();
$uri = $this->getRequest()->getUri();
$baseurl = sprintf('//%s', $uri->getHost());
$decodeid = base64_decode($getpath[3]);
// print_r($decodeid);
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendFile('/action-js/antrian-js/action-umum.js');
$this->headScript->appendScript(' var id = "' . $decodeid . '"');
$this->headScript->appendFile('/action-js/antrian-js/action-umumtampilan.js');
$this->layout("layout/layoutUmum");
return $view;
......
......@@ -114,8 +114,8 @@ class Param extends Mapper {
$data = $this->_storage->loadkelolaantrian($id);
return $data;
}
public function loadPoli($id = null){
$data = $this->_storage->loadPoli($id);
public function loadPoli($id_poli = null){
$data = $this->_storage->loadPoli($id_poli);
return $data;
}
public function loadPilihAntrian($iddok = null){
......
......@@ -965,8 +965,16 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$sql = " SELECT poli.id_poli, poli.nama_poli
FROM antrian_pasien
INNER JOIN poli
ON antrian_pasien.id_poli = poli.id_poli
GROUP BY poli.id_poli";
ON antrian_pasien.id_poli = poli.id_poli ";
if($id){
$sql .=" WHERE poli.id_poli=$id";
}
$sql .= " GROUP BY poli.id_poli";
......@@ -1186,17 +1194,29 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
return $result;
}
public function loadAntrian($id = null){
public function loadAntrian($id){
$result = new Result();
try {
$sql="
SELECT DISTINCT on (idd.id_dokter) idd.id_dokter,idd.no_antrian,dok.nama_dokter,pol.nama_poli,dok.kode_dokter,rur.nama_ruang ,idd.status_code,idd.id_poli
FROM antrian_pasien idd
$sql = " SELECT DISTINCT on (idd.id_dokter) idd.id_dokter,idd.no_antrian,dok.nama_dokter,pol.nama_poli,dok.kode_dokter,rur.nama_ruang FROM antrian_pasien idd
LEFT JOIN dokter_to_poli dok on idd.id_dokter = dok.id_dokter
LEFT JOIN poli pol on idd.id_poli = pol.id_poli
LEFT JOIN ruang rur on idd.id_ruang = rur.id_ruang
LEFT JOIN dokter_to_poli dok
on idd.id_dokter = dok.id_dokter
LEFT JOIN poli pol
on idd.id_poli = pol.id_poli
LEFT JOIN ruang rur
on idd.id_ruang = rur.id_ruang
LEFT JOIN counter_status cs
on cs.status_code = idd.status_code
WHERE idd.id_pasien is not null
and
(cs.status_code=30 or cs.status_code =40) and
idd.id_poli=$id
WHERE idd.id_pasien is not null and status_code=20 or status_code=30 or status_code =40";
";
$stmt = $this->_db->query($sql);
......
<!-- <script type="text/javascript">
// 1 detik = 1000
window.setTimeout("waktu()",1000);
function waktu() {
var tanggal = new Date();
setTimeout("waktu()",1000);
document.getElementById("tanggalku").innerHTML
= tanggal.getHours()+":"+tanggal.getMinutes()+":"+tanggal.getSeconds();
}
</script> -->
<!-- Page header -->
<div class="row">
<div class="page-header" style="border-bottom: 0px solid #ddd0;">
<!-- Header content -->
<div class="page-header-content">
<div class="page-title">
<h4 style="font-size:25px;"><span class="text-semibold">Rumah Sakit - Mohon Antri Dengan Tertib</span></h4>
<h4 style="color: #fff;font-size:25px;"><span class="text-semibold">Rumah Sakit - Mohon Antri Dengan Tertib</span></h4>
</div>
<div class="heading-elements">
<div class="heading-btn-group">
<div style="color: #fff9ff;font-size: 50px;font-weight: 600;margin-top:-20px;">
<span id="tanggalku"></span>
</div>
<div style="color: #fff9ff;font-size: 17px;font-weight: 600;margin-top:-20px;">
<div style="color: #fff;font-size: 17px;font-weight: 600;margin-top:-20px;">
<?php echo $this->today; ?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="justify-content-center">
<div class="col-sm-200" >
<div class="card mb-3 alert alert-info alert-styled-left alert-arrow-left alert-component col-sm-100" style="border-color: #e94c72;background: #faebd73b;width: 1300px;margin-left: 100px;">
<div class="text-center content-group">
<div><input type="hidden" value="nomer antrian" id="text-to-speech" placeholder="Enter text to speak..."/></div>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: #fff"><span > Nomer</span></p>
<h1 class="error-title" style=" font-weight: bold;font-size:100px;font-family: Times New Roman, Times, serif;color: #fff"><span id="no_antrian"></span></h1>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: #fff"><span > Please Proceed To</span></p>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: #fff"><span id="ruang"></span></p>
<!-- <div><input type="hidden" value="no_antrian" id="no_antrian" /></div>
<div><input type="hidden" value="nama_ruang" id="nama_ruang" /><span style="visibility:hidden" id="nama_ruang"></span></div> -->
</div>
</div>
<div id="listdata" class="card-deck" style="padding-left: 100px;padding-right: 100px;width: 2000px;">
</div>
<div class="card">
<h5 class="card-header">Featured</h5>
<div class="card-body">
<h5 class="card-title">Special title treatment</h5>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
<!-- <div id="box" class="wrap">
<!--
<div class="col-md-7 mt-25">
<div class="card mb-3">
<div class="text-center content-group">
<div><input type="hidden" value="nomer antrian" id="text-to-speech" placeholder="Enter text to speak..."/></div>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: grey"><span > Number</span></p>
<h1 class="error-title" style=" font-weight: bold;font-size:215px;font-family: Times New Roman, Times, serif;color: red"><span id="no_antrian"></span></h1>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: grey"><span > Please Proceed To</span></p>
<p class="error-title" style=" font-weight: ;font-size:50px;font-family: Times New Roman, Times, serif;color: red"><span > Ruang 1.1</span></p>
<div><input type="hidden" value="no_antrian" id="no_antrian" /></div>
<div><input type="hidden" value="nama_ruang" id="nama_ruang" /><span style="visibility:hidden" id="nama_ruang"></span></div> -->
<!-- </div>
</div>
</div> -->
<!-- /navigation -->
\ No newline at end of file
<script type="text/javascript">
// 1 detik = 1000
window.setTimeout("waktu()",1000);
function waktu() {
var tanggal = new Date();
setTimeout("waktu()",1000);
document.getElementById("tanggalku").innerHTML
= tanggal.getHours()+":"+tanggal.getMinutes()+":"+tanggal.getSeconds();
}
</script>
<!-- Page header -->
<div class="page-header" style="border-bottom: 0px solid #ddd0;">
<!-- Header content -->
<div class="page-header-content">
<div class="page-title">
<div style=" text-align: center;color: #808080;font-family: Times New Roman, Times, serif;font-size: 50px;font-weight: 600;margin-top:-20px;">
<span id="tanggalku"></span>
</div>
<div style="text-align: center;color: #808080;font-family: Times New Roman, Times, serif;font-size: 17px;font-weight: 600;margin-top:-20px;">
<?php echo $this->today; ?>
</div>
</div>
</div>
<!-- /header content -->
</div>
<!-- /page header -->
<div id="box" class="wrap">
\ No newline at end of file
......@@ -30,18 +30,14 @@
width: 100wh;
height: 90vh;
color: #fff;
background-color: #4d5dfb;
background: linear-gradient(to right, #f05053 80%, #e1eec3);
background: linear-gradient(-45deg, #EE7752, #E73C7E, #23A6D5, #23D5AB);
background-size: 400% 400%;
-webkit-animation: Gradient 15s ease infinite;
-moz-animation: Gradient 15s ease infinite;
animation: Gradient 15s ease infinite;
overflow: hidden;
}
@-webkit-keyframes Gradient {
0% {
background-position: 0% 50%
......
$(document).ready(function () {
$("#tanggal_lahir").change(function () {
//console.log("berubah nih!");
var x = new Date($("#tanggal_lahir").val());
var Cnow = new Date();
if (Cnow.getFullYear() < x.getFullYear()) {
bootbox.alert({
title: "<span min-height='100px'></span>",
message: "Tanggal Lahir tidak Boleh Melebihi Tanggal Hari ini!",
callback: function () {
console.log('This was logged in the callback!');
},
centerVertical: true
})
//$("#tanggal_lahir").val('');
}
});
});
$('#cetak').on('click', function (e) {
//alert("kepanggil");
e.preventDefault();
var w = window.open('', '', 'width=300,height=400');
w.document.write('<html><body><table border="" >' +
'<tr><th><h1>SELAMAT DATANG</h1><h2> Di Rumah Sakit</h2></th></tr></thead>' +
'<tbody><tr>' +
'<th><h2>ANTRIAN</h2>' +
'<h1>' + kode_dokter_cetak + + no_antrian_cetak + '</h1>' +
'<h3>Nama Pasien : ' + nama_pasien_cetak + '</h3>' +
'<h3>Poli : ' + kode_poli_cetak + '</h3>' +
'<h3>Nama Dokter : ' + nama_dokter_cetak + '</h3>' +
'</th></tr></tbody></table></body></html>');
w.window.print();
w.document.close();
w.window.onafterprint = function () {
setTimeout(function () {
w.close()
window.location.href = baseURL + "/queue/beranda"
}, 3000);
}
})
$('#tambah').on('click', function () {
SaveDataAja();
})
function SaveDataAja(param) {
let nama = $('#nama').val();
let tempat_lahir = $('#tempat_lahir').val();
let tanggal_lahir = $('#tanggal_lahir').val();
let alamat = $('#alamat').val();
let no_hp = $('#no_hp').val();
let poli = $("#poli option:selected").attr("value");
let dokter = $('#dokter option:selected').attr("value");
let ktp = $('#ktp').val();
let no_antrian = $("input[name=antrian]:checked").val();
// console.log(no_antrian);
/* save data */
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/savedata',
data: {
iktp: ktp,
//id_pasien: param,
inama: nama,
itempat_lahir: tempat_lahir,
itanggal_lahir: tanggal_lahir,
ialamat: alamat,
ino_hp: no_hp,
ipoli: poli,
idokter: dokter,
ino_antrian: no_antrian,
},
success: function (response) {
// alert("success");
// response[data];
if (response['code'] == 0) {
let $id = response.data.id_pasien;
console.log(response.data);
// alert($id);
let $encodedId = btoa($id);
console.log($encodedId);
window.location.href = ("cetakantrian/" + $encodedId);
} else {
bootbox.alert({ message: ' gagal', centerVertical: true });
}
},
error: function (xhr) {
if (xhr.status != 200) {
//bootbox.alert(xhr.status + "-" + xhr.statusText + " <br>Silahkan coba kembali :) ");
} else {
alert('dadas');
}
}
});
}
loadpoli();
$('#poli').on('change', function () {
var idpoli = $('#poli').val();
console.log(idpoli);
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loaddokter',
data: {
id_poli: idpoli
},
success: function (result) {
if (result['code'] == 0) {
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>Pilih</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id_dokter + '">' + res[i].nama_dokter + '</option>';
}
$("select#dokter").removeAttr('disabled');
$("select#dokter").html(optionseg);
} else {
bootbox.dialog({
message: "<span class='bigger-110'>" + result['info'] + "</span>",
buttons:
{
"OK":
{
"label": "<i class='icon-ok'></i> OK ",
"className": "btn-sm btn-danger",
"callback": function () {
notifyCancel('ERROR: ' + result['info'] + '. Bila ada kesulitan dimohon untuk menghubungi Admin terkait');
}
}
}
});
}
}
});
});
function loadpoli() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadpoli',
success: function (result) {
if (result['code'] == 0) {
//console.log (result);
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>Pilih</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id_poli + '">' + res[i].nama_poli + '</option>';
}
$("select#poli").html(optionseg);
} else {
bootbox.dialog({
message: "<span class='bigger-110'>" + result['info'] + "</span>",
buttons:
{
"OK":
{
"label": "<i class='icon-ok'></i> OK ",
"className": "btn-sm btn-danger",
"callback": function () {
notifyCancel('ERROR: ' + result['info'] + '. Bila ada kesulitan dimohon untuk menghubungi Admin terkait');
}
}
}
});
}
}
});
}
$('#pilihno').on('click', function () {
// let nama = $('#nama').val();
// let tempat_lahir = $('#tempat_lahir').val();
// let tanggal_lahir = $('#tanggal_lahir').val();
// let alamat = $('#alamat').val();
// let no_hp = $('#no_hp').val();
// let poli = $("#poli option:selected").attr("value");
// let dokter = $('#dokter option:selected').attr("value");
// let ktp = $('#ktp').val();
// // let $kode_poli = $("#poli option:selected").attr("code");
// let $no_antrian = $('#no_antrian').val();
// // console.log(nama);
// if (ktp == null || ktp == "") {
// bootbox.alert({ message: 'Ktp tidak boleh kosong', centerVertical: true });
// return false;
// }
// else if (nama == null || nama == "") {
// bootbox.alert({ message: 'Nama tidak boleh kosong', centerVertical: true });
// return false;
// } else if (tempat_lahir == null || tempat_lahir == "") {
// bootbox.alert({ message: 'Tempat lahir tidak boleh kosong', centerVertical: true });
// return false;
// } else if (tanggal_lahir == null || tanggal_lahir == "") {
// bootbox.alert({ message: 'Tanggal lahir tidak boleh kosong', centerVertical: true });
// return false;
// } else if (alamat == null || alamat == "") {
// bootbox.alert({ message: 'Alamat tidak boleh kosong', centerVertical: true });
// return false;
// } else if (no_hp == null || no_hp == "") {
// bootbox.alert({ message: 'No hp tidak boleh kosong', centerVertical: true });
// return false;
// }
// else if (poli == null || poli == "") {
// bootbox.alert({ message: 'Poli tidak boleh kosong', centerVertical: true });
// return false;
// }
// else if (dokter == null || dokter == "") {
// bootbox.alert({ message: 'Dokter tidak boleh kosong', centerVertical: true });
// return false;
// } else if (ktp.toString().length > 16) {
// bootbox.alert({ message: 'KTP tidak boleh lebih dari 16 angka', centerVertical: true });
// return false;
// } else if (ktp.toString().length < 16) {
// bootbox.alert({ message: 'KTP tidak boleh kurang dari 16 angka', centerVertical: true });
// return false;
// } else if (no_hp.toString().length > 13) {
// bootbox.alert({ message: 'No HP tidak boleh lebih dari 13 angka', centerVertical: true });
// return false;
// } else {
pilihAntrian()
// }
});
function pilihAntrian() {
var $dokter = $('#dokter option:selected').attr("value");
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadPilihAntrian',
data: {
iddok: $dokter,
},
success: function (response) {
console.log(response.data);
var $antrian = (response.data);
$('.antrian').empty();
// console.log($antrian);
// console.log(response);
if ($antrian) {
var hour = 0;;
var splithour = [];
splithour[0] = $antrian[0]['jam_mulai'].split(':');
hour += parseInt(splithour[0][0]);
minute = parseInt(splithour[0][1]);
for (var i = 0; i < $antrian.length; i++) {
if ($antrian[i]['id_pasien'] === null) {
let y = '';
var splittime = [];
splittime[i] = $antrian[i]['waktu_antrian'].split(':');
if (minute >= 60) {
hour += Math.floor(minute / 60);
minute = minute % 60;
}
if (minute.toString().length === 1) {
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="radio" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label style="text-align:center` + i + `">` + hour + ':' + '0' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
} else {
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="radio" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label style="text-align:center"` + i + `">` + hour + ':' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
}
minute += parseInt(splittime[i][1]);
} else if ($antrian[i]['status_code'] == 10 || $antrian[i]['status_code'] == 20 || $antrian[i]['status_code'] == 30 || $antrian[i]['status_code'] == 40) {
var splittime = [];
splittime[i] = $antrian[i]['waktu_antrian'].split(':');
let y = '';
if (minute >= 60) {
hour += Math.floor(minute / 60);
minute = minute % 60;
}
if (minute.toString().length === 1) {
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="picked" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label for="antrian` + i + `">` + hour + ':' + '0' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
} else {
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="picked" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label for="antrian` + i + `">` + hour + ':' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
}
minute += parseInt(splittime[i][1]);
}
else if ($antrian[i]['status_code'] == 60) {
let y = '';
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="done" name="antrian" value="` + $antrian[i] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
</div>
</div > `;
$('.antrian').append(y);
} else if ($antrian[i]['status_code'] == 50) {
var splittime = [];
splittime[i] = $antrian[i]['waktu_antrian'].split(':');
if (minute >= 60) {
hour += Math.floor(minute / 60);
minute = minute % 60;
}
let y = '';
y += `<div class="col-lg-1">
<div class="buttons" >
<input type="done" name="antrian" value="` + $antrian[i] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
</div>
</div > `;
$('.antrian').append(y);
minute += parseInt(splittime[i][1]);
}
}
} else {
}
},
error: function (xhr) {
if (xhr.status != 200) {
//bootbox.alert(xhr.status + "-" + xhr.statusText + " <br>Silahkan coba kembali :) ");
} else {
alert('Cannot load queue');
}
}
});
}
$(document).ready(function () {
$('#close').on('click', function () {
document.getElementById("seat").innerHTML = "";
})
});
// alert(id);
//alert(id);
loaddatapasien(id)
function loaddatapasien(param) {
......@@ -39,11 +39,6 @@ function loaddatapasien(param) {
});
}
$('#tambah').on('click', function () {
savedataaja();
})
......@@ -89,6 +84,7 @@ function savedataaja() {
console.log(response);
let $id = response.data[0].id_antrian;
console.log($id);
let $encodedId = btoa($id);
......
......@@ -16,7 +16,7 @@ $(document).ready(function () {
separator: ':',
duration: true,
minimum: '06:00',
maximum: '18:00',
maximum: '24:00',
durationNegative: true
});
});
......@@ -37,7 +37,7 @@ $(document).ready(function () {
separator: ':',
duration: true,
minimum: '00:00',
maximum: '23:00',
maximum: '24:00',
durationNegative: true
});
});
......@@ -47,8 +47,8 @@ $(document).ready(function () {
required: true,
separator: ':',
duration: true,
minimum: '00:10',
maximum: '00:20',
minimum: '00:01',
maximum: '00:59',
durationNegative: true
});
});
......@@ -138,10 +138,23 @@ function loadpoli() {
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id_poli + '">' + res[i].nama_poli + '</option>';
}
$("select#poli").html(optionseg);
} else {
bootbox.alert({ message: 'Data Poli Kosong', centerVertical: true });
bootbox.dialog({
message: "<span class='bigger-110'>" + result['info'] + "</span>",
buttons:
{
"OK":
{
"label": "<i class='icon-ok'></i> OK ",
"className": "btn-sm btn-danger",
"callback": function () {
notifyCancel('ERROR: ' + result['info'] + '. Bila ada kesulitan dimohon untuk menghubungi Admin terkait');
}
}
}
});
}
}
});
......
loadantrianumum();
function loadantrianumum() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadantrian',
success: function (result) {
// console.log(result);
// console.log(result.data);
$('loadantrian').empty();
if (result.code == 0) {
var res = result['data'];
let hasil = '';
for (var i = 0; i < res.length; i++) {
hasil += "<div class='box one" + i + "'> <div class='date'> <h4 >" + res[i]['nama_poli'] + "</h4> <h4 >" + res[i]['nama_ruang'] + "</h4></div> <div class='poster p" + i + "'> <h4 >" + res[i]['kode_dokter'] + "" + res[i]['no_antrian'] + "</h4> </div> </div>"
}
$("#box").append(hasil);
} else {
alert(result.info);
}
},
error: function (xhr) {
console.log('ERROR AJAX:' + xhr.status + '-' + xhr.statusText);
}
});
}
// alert(id);
setInterval(function()
{
loadantrian(id)
}, 3000);
loadantrian(id);
function loadantrian(param) {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadantrian',
data: {
id: param,
},
success: function (result) {
console.log(result);
// $('.loaddata').empty();
// console.log(result);
if (result['code'] == 0) {
var res = result['data'];
console.log(res);
$("#listdata").empty();
$('#no_antrian').empty();
let hasil = '';
for (var i = 0; i < res.length; i++) {
$('#no_antrian').empty();
$('#no_antrian').append("-");
if(res[i]['status_code']==30){
valTemp= res[i]['kode_dokter'] + res[i]['no_antrian'];
$('#no_antrian').empty();
$('#no_antrian').append(valTemp);
ruang= res[i]['nama_ruang'];
$('#ruang').empty();
$('#ruang').append(ruang);
}else{
$('#no_antrian').append("-");
}
hasil =
`
<div class="card col-sm-2" style="border-color: #e94c72;background: #faebd73b; width: 20rem;">
<div class="alert alert-info alert-styled-left alert-arrow-left alert-component" style="background: #faebd73b;">
<div><input type="hidden" value="nomer antrian" id="text-to-speech" placeholder="Enter text to speak..."/></div>
<h1 class="error-title" style=" font-weight:;font-size:53px;font-family: Times New Roman, Times, serif;color: #fff"><span > `+res[i]['kode_dokter']+`-`+res[i]['no_antrian']+` </span></h1>
</div>
<div><input type="hidden" value="no_antrian" id="no_antrian" /></div>
<div><input type="hidden" value="nama_ruang" id="nama_ruang" /><span style="visibility:hidden" id="nama_ruang"></span></div>
</div>
`
$("#listdata").append(hasil);
}
} else {
$('#no_antrian').empty();
$('#no_antrian').append("-");
}
},
error: function (xhr) {
alert(xhr.status + '-' + xhr.statusText);
}
});
}
loadpoli();
$('#pilih').on('click', function () {
// let poli = $("#poli option:selected").attr("value");
window.location.href = ("tampilanantrian");
loaddatadokter()
});
function loaddatadokter() {
let poli =$("#antrian_poli option:selected").attr("value");
console.log(poli);
/* save data */
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadpoli',
data: {
id_poli: poli,
},
success: function (response) {
if (response['code'] == 0) {
console.log(response);
let $id = poli;
console.log($id)
let $encodedId = btoa($id);
window.location.href = ("/umum/umumtampilan/" + $encodedId);
} else {
bootbox.alert({ message: ' gagal', centerVertical: true });
}
}, error: function (xhr) {
if (xhr.status != 200) {
//bootbox.alert(xhr.status + "-" + xhr.statusText + " <br>Silahkan coba kembali :) ");
} else {
alert('data tidak ada');
}
}
});
}
function loadpoli() {
$.ajax({
type: 'POST',
dataType: 'json',
......@@ -13,7 +53,7 @@ function loadpoli() {
success: function (result) {
if (result['code'] == 0) {
//console.log (result);
console.log (result);
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>Pilih</option>';
......@@ -21,22 +61,60 @@ function loadpoli() {
optionseg += '<option value="' + res[i].id_poli + '">' + res[i].nama_poli + '</option>';
}
$("select#antrian_poli").html(optionseg);
let $id = result.data[0].id_poli;
// let $id = result.data['id_poli'];
// console.log($id);
} else {
bootbox.dialog({
message: "<span class='bigger-110'>" + result['info'] + "</span>",
buttons:
{
"OK":
{
"label": "<i class='icon-ok'></i> OK ",
"className": "btn-sm btn-danger",
"callback": function () {
notifyCancel('ERROR: ' + result['info'] + '. Bila ada kesulitan dimohon untuk menghubungi Admin terkait');
}
}
}
});
}
}
});
}
// function loadantriandata() {
// $.ajax({
// type: 'POST',
// dataType: 'json',
// url: baseURL + '/api/loadpoli',
// success: function (result) {
// if (result['code'] == 0) {
// console.log (result);
// var res = result['data'];
// optionseg = '';
// optionseg += '<option value="Pilih" disabled selected>Pilih</option>';
// for (var i = 0; i < res.length; i++) {
// optionseg += '<option value="' + res[i].id_poli + '">' + res[i].nama_poli + '</option>';
// }
// $("select#antrian_poli").html(optionseg);
// let $id = result.data[0].id_poli;
// // let $id = result.data['id_poli'];
// console.log($id);
// let $encodedId = btoa($id);
// window.location = (baseURL + "/umum/umumtampilan/"+$encodedId);
// } else {
// bootbox.dialog({
// message: "<span class='bigger-110'>" + result['info'] + "</span>",
// buttons:
// {
// "OK":
// {
// "label": "<i class='icon-ok'></i> OK ",
// "className": "btn-sm btn-danger",
// "callback": function () {
// notifyCancel('ERROR: ' + result['info'] + '. Bila ada kesulitan dimohon untuk menghubungi Admin terkait');
// }
// }
// }
// });
// }
// }
// });
// }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment