Commit 2483887e authored by Azy Mushofy Anwary's avatar Azy Mushofy Anwary

haha

parent 45eb06fd
......@@ -225,6 +225,7 @@ function validasipasien(id_poli, dokter, id_pasien) {
for (x in data) {
if (id_pasien == data[x]['id_pasien']) {
if (id_poli == data[x]['id_poli']) {
if (dokter == data[x]['id_dokter']) {
......@@ -233,8 +234,11 @@ function validasipasien(id_poli, dokter, id_pasien) {
let nama = result.data[0]['nama'];
// $("#pilihantrian").modal("toggle");
$('#pilihantrian').hide();
swal({
title: "Pasien dengan nama'" + nama + "' telah melakukan pendaftaran di poli dan dokter ini! \n Apakah anda ingin mencetak no antrian lagi ? ",
title: "Pasien dengan nama '" + nama + "' telah melakukan pendaftaran di poli dan dokter ini! \n Apakah anda ingin mencetak no antrian lagi ? ",
type: "warning",
confirmButtonClass: "success",
confirmButtonText: "Yes!",
......@@ -263,9 +267,12 @@ $('#pilihno').on('click', function (e) {
var id_pasien = $('#id_pasien').val();
var id_poli = $('#poli option:selected').attr("value");
var dokter = $('#dokter option:selected').attr("value");
pilihAntrian(id_poli)
if (validasipasien(id_poli, dokter, id_pasien) == 1) {
} else {
pilihAntrian(id_poli)
}
// console.log(id_poli)
});
......@@ -291,160 +298,157 @@ function pilihAntrian(id_poli) {
var $antrian = (response.data);
if (validasipasien(id_poli, dokter, id_pasien) == 1) {
// console.log(validasipasien(id_poli, dokter, id_pasien))
} else {
if ($antrian) {
var hour = 0;
if ($antrian) {
var hour = 0;
var splithour = [];
splithour[0] = $antrian[0]['jam_mulai'].split(':');
var splithour = [];
splithour[0] = $antrian[0]['jam_mulai'].split(':');
hour += parseInt(splithour[0][0]);
minute = parseInt(splithour[0][1]);
hour += parseInt(splithour[0][0]);
minute = parseInt(splithour[0][1]);
$('.antrian').empty();
$('.antrian').empty();
for (var i = 0; i < $antrian.length; i++) {
var A = Date.now();
if ($antrian[i]['id_pasien'] === null) {//jika masih kosong
let y = ' ';
for (var i = 0; i < $antrian.length; i++) {
var A = Date.now();
if ($antrian[i]['id_pasien'] === null) {//jika masih kosong
let y = ' ';
var splittime = [];
splittime[i] = $antrian[i]['waktu_antrian'].split(':');
var splittime = [];
splittime[i] = $antrian[i]['waktu_antrian'].split(':');
if (minute >= 60) {
hour += Math.floor(minute / 60);
minute = minute % 60;
}
if (hour >= 24) {
hour = 0;
}
if (minute >= 60) {
hour += Math.floor(minute / 60);
minute = minute % 60;
}
if (hour >= 24) {
hour = 0;
}
if (minute.toString().length === 1) {
y += `<div class="col-lg-1">
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="display: block;text-align: center; line-height: 150%;"` + i + `">` + hour + ':' + '0' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
} else {
y += `<div class="col-lg-1">
$('.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="display: block;text-align: center; line-height: 150%;"` + i + `">` + hour + ':' + minute + `</label>
</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) {//jika antrian sudah terisi
var splittime = [];
splittime[i] = $antrian[i]['waktu_antrian'].split(':');
let y = '';
} else if ($antrian[i]['status_code'] == 10 || $antrian[i]['status_code'] == 20 || $antrian[i]['status_code'] == 30 || $antrian[i]['status_code'] == 40) {//jika antrian sudah terisi
var splittime = [];
splittime[i] = $antrian[i]['waktu_antrian'].split(':');
let y = '';
if (minute >= 60) {
if (minute >= 60) {
hour += Math.floor(minute / 60);
minute = minute % 60;
hour += Math.floor(minute / 60);
minute = minute % 60;
}
}
if (hour >= 24) {
hour = 0;
}
if (hour >= 24) {
hour = 0;
}
if (minute.toString().length === 1) {
y += `<div class="col-lg-1">
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 style="display: block;text-align: center; line-height: 150%;" for="antrian` + i + `">` + hour + ':' + '0' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
} else {
y += `<div class="col-lg-1">
$('.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 style="display: block;text-align: center; line-height: 150%;" for="antrian` + i + `">` + hour + ':' + minute + `</label>
</div>
</div > `;
$('.antrian').append(y);
}
minute += parseInt(splittime[i][1]);
$('.antrian').append(y);
}
else if ($antrian[i]['status_code'] == 60) {
let y = '';
y += `<div class="col-lg-1">
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) {
$('.antrian').append(y);
} 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) {
hour += Math.floor(minute / 60);
minute = minute % 60;
if (minute >= 60) {
hour += Math.floor(minute / 60);
minute = minute % 60;
}
if (hour >= 24) {
hour = 0;
}
}
if (hour >= 24) {
hour = 0;
}
let y = '';
y += `<div class="col-lg-1">
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]);
}
$('.antrian').append(y);
minute += parseInt(splittime[i][1]);
}
} else {
}
} else {
}
},
error: function (xhr) {
......
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