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);
......
This diff is collapsed.
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