Commit f41e1573 authored by Azy Mushofy Anwary's avatar Azy Mushofy Anwary

Baru

parent 05cf2def
This diff is collapsed.
<div class="container-fluid">
<div class="col-xl-12 col-lg-12 col-md-12">
<div class="card o-hidden border-0 shadow-lg my-5">
<div class="card-body ">
<h1 class="h4 text-center text-gray-900 mb-4" style="font-size: 50px;font-weight: bold">Seluruh Data Jadwal Dokter </h1>
<br>
<br>
<table class="table table-bordered" id="dataTable">
<thead>
<tr class="table-infos">
<th style="">NO</th>
<th >Nama Poli</th>
<th >Nama Dokter</th>
<th>Ruangan</th>
<th >Antrian Seluruh</th>
<th>Jam Mulai</th>
<th >Waktu Antrian</th>
<th >Tanggal Antrian</th>
<th >Action</th>
</tr>
</thead>
<tbody id="tableregisterdokter" >
</tbody>
</table>
</div>
</div>
</div>
</div>
function antrianadmin() {
window.location.href = "antrianadmin";
}
LoadDadta();
function LoadDadta() {
/* save data */
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadantrianregisterall',
success: function (result) {
// console.log(result);
$('table.table-bordered > tbody').empty();
// console.log(result);
if (result.code == 0) {
let data = result.data;
let counter = 1;
for (x in data) {
// console.log(data);
var newRow = $("<tr>");
var cols = "";
// console.log(data[x].id_register);
cols += '<tr>'
cols += '<td class="">' + counter + '</td>';
// cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].id_register + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].nama_poli + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].nama_dokter + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].nama_ruang + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].antrian_all + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].jam_mulai + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].waktu_antrian + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].create_date + '</td>';
cols += '<td class="tdCenterText bgtd1 "> <div class="text-center" > <span style="padding: 7px;" class="btn btn-danger btn-xs" onclick="Delete(' + data[x].id_register + ')">Hapus</span></div></td>';
cols += '</tr>'
newRow.append(cols);
$("#tableregisterdokter").append(cols);
counter++;
}
} else {
}
$('#dataTable').DataTable({
"scrollY": '600px',
"scrollX": true,
fixedHeader: true,
scrollCollapse: true,
paging: true,
columnDefs: [
{ width: 20, targets: 0 },
{ width: 100, targets: 1 },
{ width: 100, targets: 2 },
{ width: 50, targets: 3 },
{ width: 50, targets: 4 },
{ width: 50, targets: 5 },
{ width: 50, targets: 6 },
{ width: 50, targets: 7 },
{ width: 100, targets: 8 },
],
});
},
error: function (xhr) {
alert(xhr.status + '-' + xhr.statusText);
}
});
}
function Delete(param) {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadantrianregisterall',
data: {
id: param,
},
success: function (result) {
// console.log(result.data[0].nama_poli);
let id_register = result.data[0].id_register;
let nama_poli = result.data[0].nama_poli;
let nama_dokter = result.data[0].nama_dokter;
let nama_ruang = result.data[0].nama_ruang;
swal({
title: "Apakah yakin mengahapus Registrasi Dokter dengan Nama Poli '" + nama_poli + "', Nama Dokter '" + nama_dokter + "' dan Nama Ruangan '" + nama_ruang + "' ini ? ",
type: "error",
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes!",
showCancelButton: true,
},
function () {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/deletedataregister',
data: {
id: param,
},
success: function (result) {
// console.log(result)
if (result.code == 0) {
swal({
title: "",
text: "Data Berhasil Dihapus!",
icon: "succes",
button: "ok",
}, function () {
location.reload();
});
} else {
bootbox.alert({ message: 'Data Kosong', centerVertical: true });
}
},
error: function (xhr) {
alert(xhr.status + '-' + xhr.statusText);
}
});
},
function () {
// This function will run if the user clicked "cancel"
window.location.href = "<?php echo Yii::$app->request->baseUrl;?>/todo/index/";
}
);
}
});
}
loadantrian(id_poli);
function loadantrian(param) {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + `/api/loadantrian`,
data: {
id_poli: param,
},
success: function (result) {
console.log(result);
// $('.loaddata').empty();
// console.log(result);
if (result['code'] == 0) {
var res = result['data'];
$("#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);
}
});
}
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