Commit 10fccefe authored by Azy Mushofy Anwary's avatar Azy Mushofy Anwary

cetakk

parent 823eb81e
...@@ -35,12 +35,12 @@ $('#cetak').on('click', function (e) { ...@@ -35,12 +35,12 @@ $('#cetak').on('click', function (e) {
'</th></tr></tbody></table></body></html>'); '</th></tr></tbody></table></body></html>');
w.window.print(); w.window.print();
w.document.close(); w.document.close();
w.window.onafterprint = function(){ w.window.onafterprint = function () {
setTimeout(function() { setTimeout(function () {
w.close() w.close()
window.location.href = baseURL + "/queue/beranda" window.location.href = baseURL + "/queue/beranda"
}, 3000); }, 3000);
} }
}) })
...@@ -87,9 +87,9 @@ function SaveDataAja(param) { ...@@ -87,9 +87,9 @@ function SaveDataAja(param) {
success: function (response) { success: function (response) {
// alert("success"); // alert("success");
// response[data]; // response[data];
if (response['code'] == 0) { if (response['code'] == 0) {
let $id = response.data.id_pasien; let $id = response.data.id_pasien;
console.log(response.data); console.log(response.data);
// alert($id); // alert($id);
let $encodedId = btoa($id); let $encodedId = btoa($id);
...@@ -273,94 +273,94 @@ function pilihAntrian() { ...@@ -273,94 +273,94 @@ function pilihAntrian() {
// console.log($antrian); // console.log($antrian);
// console.log(response); // console.log(response);
if ($antrian) { if ($antrian) {
var hour=0;; var hour = 0;;
var splithour=[]; var splithour = [];
splithour[0]= $antrian[0]['jam_mulai'].split(':'); splithour[0] = $antrian[0]['jam_mulai'].split(':');
hour += parseInt(splithour[0][0]); hour += parseInt(splithour[0][0]);
minute = parseInt(splithour[0][1]); minute = parseInt(splithour[0][1]);
for (var i = 0; i < $antrian.length; i++) { for (var i = 0; i < $antrian.length; i++) {
if ($antrian[i]['id_pasien'] === null) { if ($antrian[i]['id_pasien'] === null) {
let y = ''; let y = '';
var splittime=[]; var splittime = [];
splittime[i]= $antrian[i]['waktu_antrian'].split(':'); splittime[i] = $antrian[i]['waktu_antrian'].split(':');
if (minute >= 60) { if (minute >= 60) {
hour += Math.floor(minute/60); hour += Math.floor(minute / 60);
minute = minute % 60; minute = minute % 60;
} }
if(minute.toString().length ===1){ if (minute.toString().length === 1) {
y += `<div class="col-lg-1"> y += `<div class="col-lg-1">
<div class="buttons" > <div class="buttons" >
<input type="radio" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" /> <input type="radio" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label> <label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label style="text-align:center` + i + `">` + hour +':'+'0'+minute+ `</label> <label style="text-align:center` + i + `">` + hour + ':' + '0' + minute + `</label>
</div> </div>
</div > `; </div > `;
$('.antrian').append(y); $('.antrian').append(y);
}else{ } else {
y += `<div class="col-lg-1"> y += `<div class="col-lg-1">
<div class="buttons" > <div class="buttons" >
<input type="radio" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" /> <input type="radio" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" />
<label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label> <label for="antrian` + i + `">` + $antrian[i]['no_antrian'] + `</label>
<label style="text-align:center"` + i + `">` + hour +':'+minute+ `</label> <label style="text-align:center"` + i + `">` + hour + ':' + minute + `</label>
</div> </div>
</div > `; </div > `;
$('.antrian').append(y); $('.antrian').append(y);
} }
minute += parseInt(splittime[i][1]); 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 ){ } else if ($antrian[i]['status_code'] == 10 || $antrian[i]['status_code'] == 20 || $antrian[i]['status_code'] == 30 || $antrian[i]['status_code'] == 40) {
var splittime=[]; var splittime = [];
splittime[i]= $antrian[i]['waktu_antrian'].split(':'); splittime[i] = $antrian[i]['waktu_antrian'].split(':');
let y = ''; let y = '';
if (minute >= 60) { if (minute >= 60) {
hour += Math.floor(minute/60); hour += Math.floor(minute / 60);
minute = minute % 60; minute = minute % 60;
} }
if(minute.toString().length ===1){ if (minute.toString().length === 1) {
y += `<div class="col-lg-1"> y += `<div class="col-lg-1">
<div class="buttons" > <div class="buttons" >
<input type="picked" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" /> <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 + `">` + $antrian[i]['no_antrian'] + `</label>
<label for="antrian` + i + `">` + hour +':'+'0'+minute+ `</label> <label for="antrian` + i + `">` + hour + ':' + '0' + minute + `</label>
</div> </div>
</div > `; </div > `;
$('.antrian').append(y); $('.antrian').append(y);
}else{ } else {
y += `<div class="col-lg-1"> y += `<div class="col-lg-1">
<div class="buttons" > <div class="buttons" >
<input type="picked" name="antrian" value="` + $antrian[i]['no_antrian'] + `" id="antrian` + i + `" /> <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 + `">` + $antrian[i]['no_antrian'] + `</label>
<label for="antrian` + i + `">` + hour +':'+minute+ `</label> <label for="antrian` + i + `">` + hour + ':' + minute + `</label>
</div> </div>
</div > `; </div > `;
$('.antrian').append(y); $('.antrian').append(y);
} }
minute += parseInt(splittime[i][1]); minute += parseInt(splittime[i][1]);
} }
else if ( $antrian[i]['status_code']==60){ else if ($antrian[i]['status_code'] == 60) {
let y = ''; let y = '';
y += `<div class="col-lg-1"> y += `<div class="col-lg-1">
<div class="buttons" > <div class="buttons" >
...@@ -370,20 +370,20 @@ function pilihAntrian() { ...@@ -370,20 +370,20 @@ function pilihAntrian() {
</div> </div>
</div > `; </div > `;
$('.antrian').append(y); $('.antrian').append(y);
} else if ( $antrian[i]['status_code']==50){ } else if ($antrian[i]['status_code'] == 50) {
var splittime = [];
splittime[i] = $antrian[i]['waktu_antrian'].split(':');
var splittime=[];
splittime[i]= $antrian[i]['waktu_antrian'].split(':');
if (minute >= 60) { if (minute >= 60) {
hour += Math.floor(minute/60); hour += Math.floor(minute / 60);
minute = minute % 60; minute = minute % 60;
} }
let y = ''; let y = '';
y += `<div class="col-lg-1"> y += `<div class="col-lg-1">
<div class="buttons" > <div class="buttons" >
...@@ -400,7 +400,7 @@ function pilihAntrian() { ...@@ -400,7 +400,7 @@ function pilihAntrian() {
} }
} else { } else {
} }
}, },
error: function (xhr) { error: function (xhr) {
......
...@@ -14,7 +14,12 @@ $('#cetak').on('click', function (e) { ...@@ -14,7 +14,12 @@ $('#cetak').on('click', function (e) {
'</th></tr></tbody></table></body></html>'); '</th></tr></tbody></table></body></html>');
w.window.print(); w.window.print();
w.document.close(); w.document.close();
return false; w.window.onafterprint = function () {
setTimeout(function () {
w.close()
window.location = baseURL + "/queue/beranda"
}, 3000);
}
}) })
\ 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