Commit 823eb81e authored by Azy Mushofy Anwary's avatar Azy Mushofy Anwary

Merge branch 'master' of http://git.khansia.co.id/antrian/frontend into master

# Conflicts:
#	public/action-js/antrian-js/action-antrian.js
parents 9ca9842f 212282c3
......@@ -192,7 +192,6 @@ class QueueController extends \Application\Master\GlobalActionController
$view->setVariable('kode_dokter', $result['kode_dokter']);
// print_r($result);die;
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendScript(' var no_rekam_medis_cetak = "' . $result['no_rekam_medis'] . '"');
$this->headScript->appendScript(' var nama_pasien_cetak = "' . $result['nama'] . '"');
......
......@@ -1135,7 +1135,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = "SELECT antrian_pasien.no_antrian, antrian_pasien.nama, dokter_to_poli.kode_dokter , dokter_to_poli.nama_dokter, dokter_to_poli.id_dokter,poli.kode_poli, poli.nama_poli , counter_status.status_name
$sql = "SELECT antrian_pasien.no_antrian, antrian_pasien.nama, dokter_to_poli.kode_dokter , dokter_to_poli.nama_dokter, dokter_to_poli.id_dokter,poli.kode_poli, poli.nama_poli , counter_status.status_name, ruang.nama_ruang
FROM antrian_pasien
INNER JOIN poli
ON poli.id_poli = antrian_pasien.id_poli
......@@ -1143,6 +1143,8 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
ON dokter_to_poli.id_dokter = antrian_pasien.id_dokter
INNER JOIN counter_status
ON counter_status.status_code = antrian_pasien.status_code
INNER JOIN ruang
on ruang.id_ruang = antrian_pasien.id_ruang
" ;
if ($id){
......@@ -1232,12 +1234,14 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = "SELECT antrian_pasien.no_antrian, antrian_pasien.id_dokter, dokter_to_poli.kode_dokter, counter_status.status_name,counter_status.status_code
$sql = "SELECT antrian_pasien.no_antrian, antrian_pasien.id_dokter, dokter_to_poli.kode_dokter, counter_status.status_name,counter_status.status_code, ruang.nama_ruang
FROM antrian_pasien
INNER JOIN counter_status
ON counter_status.status_code = antrian_pasien.status_code
INNER JOIN dokter_to_poli
ON dokter_to_poli.id_dokter = antrian_pasien.id_dokter
INNER JOIN ruang
ON ruang.id_ruang = antrian_pasien.id_ruang
" ;
if ($id){
$sql .= "WHERE antrian_pasien.id_pasien IS NOT NULL AND dokter_to_poli.id_dokter = $id AND antrian_pasien.status_code=10 or dokter_to_poli.id_dokter = $id and antrian_pasien.status_code=30 or dokter_to_poli.id_dokter = $id and antrian_pasien.status_code=40 ORDER BY no_antrian ASC";
......
......@@ -15,7 +15,7 @@
<!-- <button type="button" id="pilihno" class="btn btn-primary" > Daftar Antrian</button> -->
</form>
</div>
<div><span style="visibility:hidden" id="nama_ruang"></span></div>
<div class="row col-lg-12">
<div class="col-lg-6 ">
......@@ -24,10 +24,12 @@
<h6 class="panel-title"><i class="icon-cog3 position-left"></i> Nomor Antrian</h6>
</div>
<div class="text-center content-group">
<div><input type="hidden" value="nomer antrian" id="text-to-speech" placeholder="Enter text to speak..."/></div>
<h1 class="error-title" style=" font-weight: bold;font-size:250px;font-family: Times New Roman, Times, serif;color: #808080"><span id="no_antrian"></span></h1>
<h5></h5>
</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>
</div>
......@@ -104,3 +106,4 @@
</div>
</div>
</div>
<section class="warn"></section>
<select name="voice" id="voices" disabled>
</select><br><br>
<textarea disabled></textarea>
<button id="submit" onclick="speaker.speak();" disabled>Text to Speech</button>
\ No newline at end of file
......@@ -8,7 +8,47 @@ const STATUS_MISSED = 60;
/* JS comes here */
/* JS comes here */
function textToAudio() {
// let msg1 = "nomor antrian";
let no_antrian = document.getElementById("no_antrian").innerHTML;
let voice = "nomor antrian " + no_antrian;
console.log(voice)
let speech = new SpeechSynthesisUtterance();
speech.lang = "id";
speech.text = voice;
speech.volume = 1;
speech.rate = 0.70;
speech.pitch = 1;
window.speechSynthesis.speak(speech);
}
function textToAudioRuang() {
// let msg1 = "nomor antrian";
let ruang = document.getElementById("nama_ruang").innerHTML;
var res = ruang.replace(".", " ");
document.getElementById("nama_ruang").innerHTML = res;
let voice = "silahkan masuk ke " + res;
console.log(voice)
let speech = new SpeechSynthesisUtterance();
speech.lang = "id";
speech.text = voice;
speech.volume = 1;
speech.rate = 0.70;
speech.pitch = 1;
window.speechSynthesis.speak(speech);
}
loadpoli();
$('#poli').on('change', function () {
......@@ -112,19 +152,19 @@ function loadantrian() {
if (result.code == 0) {
let data = result.data;
// console.log(data);
console.log(data);
let counter = 1;
for (var i = 0; i < data.length; i++) {
for (x in data) {
var newRow = $("<tr>");
var cols = "";
// onClick="openmyprofile('+reg[x].userid+',\''+reg[x].named+'\')">
cols = '<td class="">' + counter + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[i].no_antrian + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[i].nama + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[i].nama_dokter + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[i].nama_poli + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[i].status_name + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].no_antrian + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].nama + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].nama_dokter + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].nama_poli + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].status_name + '</td>';
newRow.append(cols);
$("#antrianadmin").append(newRow);
......@@ -173,13 +213,15 @@ function tampilangka() {
if (result.data) {
var res = result['data'][0];
var valTemp = res['kode_dokter'] + '' + res['no_antrian'];
var Ruang = res['nama_ruang'];
noantrian = res['no_antrian'];
iddok = res['id_dokter'];
if (res['status_code'] == 30) {
$('#no_antrian').empty();
$('#no_antrian').html(valTemp);
$('#nama_ruang').empty();
$('#nama_ruang').html(Ruang);
$('#btnNext').prop('disabled', true);
$('#btnCall').prop('disabled', false);
$('#btnServed').prop('disabled', false);
......@@ -188,6 +230,8 @@ function tampilangka() {
} else if (res['status_code'] == 40) {
$('#no_antrian').empty();
$('#no_antrian').html(valTemp);
$('#nama_ruang').empty();
$('#nama_ruang').html(Ruang);
$('#btnNext').prop('disabled', true);
$('#btnCall').prop('disabled', true);
$('#btnServed').prop('disabled', true);
......@@ -196,6 +240,8 @@ function tampilangka() {
} else if (res['status_code'] == 10) {
$('#no_antrian').empty();
$('#no_antrian').html(valTemp);
$('#nama_ruang').empty();
$('#nama_ruang').html(Ruang);
$('#btnNext').prop('disabled', true);
$('#btnCall').prop('disabled', false);
$('#btnServed').prop('disabled', true);
......@@ -204,6 +250,8 @@ function tampilangka() {
} else if (res['status_code'] == 10) {
$('#no_antrian').empty();
$('#no_antrian').html(valTemp);
$('#nama_ruang').empty();
$('#nama_ruang').html(Ruang);
$('#btnNext').prop('disabled', false);
$('#btnCall').prop('disabled', true);
$('#btnServed').prop('disabled', false);
......@@ -297,13 +345,29 @@ function actionqueue(antrianno, status) {
} else if (status == 30) {
// SOound call
// swal({
// title: "Call!",
// text: "Sedang Melakukan Panggilan",
// type: "success",
// showConfirmButton: false,
// timer: 5000
// });
var flush = new Audio('../../data/tone/a1.mp3');
setTimeout(function() {
flush.play(); }, )
flush.onended = function() {
textToAudio()
setTimeout(function() {
textToAudioRuang() }, 3000)
};
swal({
title: "Call!",
text: "Sedang Melakukan Panggilan",
type: "success",
showConfirmButton: false,
timer: 14000
});
$('#btnNext').prop('disabled', true);
$('#btnCall').prop('disabled', false);
......
$(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 = "";
})
});
const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
var recognition = new SpeechRecognition();
recognition.onresult = function(event) {
if (event.results.length > 0) {
query.value = event.results[0][0].transcript;
query.form.submit();
}
}
var Speaker = function () {
var synth
var utterance
var voices
this.init = function () {
// CHECK FOR SPEECHSYNTHESIS API
if (!(window.speechSynthesis)) {
warn("Your browser is not capable of speech synthesis.")
return
}
// INITIALIZE SPEECH SYNTHESIS API ELEMENTS
synth = window.speechSynthesis
voices = synth.getVoices()
utterance = new SpeechSynthesisUtterance("Hello World!");
// CHECK FOR AVAILABLE VOICES
if (voices.length <= 0) {
warn("No voices are provided by either your browser or system.")
return
}
// ADD VOICE INDICES
voices.forEach(function (voice, a) {
voice.voice_index = a
})
// POPULATE VOICES LIST AND ENABLE INPUT ELEMENTS
populateVoicesList();
$(".warn").css("display", "none");
$("button#submit").removeAttr("disabled");
$("textarea").removeAttr("disabled");
$("select#voices").removeAttr("disabled");
// SET AN ENGLISH VOICE AS DEFAULT
var englishes = voices.filter(function (voice) { return voice.default && voice.lang.substr(0, 2) == "en" })
if (englishes.length > 0) {
$("#voices option[value=\"" + englishes[0].voice_index + "\"]").prop("selected", true)
}
clearInterval(timer)
}
function addVoices(languageName, filterBy) {
// Filter voices by filterBy function
var filteredVoices = voices.filter(filterBy)
// Add group only if there is at least one voice
if (filteredVoices.length > 0) {
// Add optgroup
$("#voices").append('<optgroup label="' + languageName + '">')
// Add option for each voice
filteredVoices.forEach(function (el, idx, arr) {
$("#voices").append('<option value="' + el.voice_index + '">' + el.name + ' (' + el.lang + ')' + '</option>')
})
// End optgroup
$("#voices").append('</optgroup>')
}
}
function warn(str) {
$(".warn").css("display", "block");
// $(".reason").append(str);
$("button#submit").attr("disabled");
$("textarea").attr("disabled");
$("select#voices").attr("disabled");
}
function getSelectedVoice() {
return voices[$("#voices option:selected").val()]
}
this.speak = function () {
// Cancel current voice if it's currently talking so new text can be read immediately
synth.cancel();
// CREATE NEW UTTERANCE AND SPEAK IF VOICE IS AVAILABLE
utterance = new SpeechSynthesisUtterance($("textarea").val());
var selectedVoice = getSelectedVoice()
if (selectedVoice) {
utterance.voice = selectedVoice
}
synth.speak(utterance);
}
}
var speaker = new Speaker()
var timer
$(document).ready(function () {
$(".warn").css("display", "none");
timer = setInterval(function () {
speaker.init();
}, 3);
});
\ No newline at end of file
......@@ -21,10 +21,6 @@ function loadantrianumum() {
}
// result.data[0]['no_antrian']+result.data[0]['kode_dokter'];
$("#box").append(hasil);
} else {
......
......@@ -5,8 +5,6 @@ $('#pilih').on('click', function () {
window.location.href = ("tampilanantrian");
});
function loadpoli() {
$.ajax({
type: 'POST',
......
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