
function time_load() {
setInterval(function(){
    var date = new Date();
    var day = ("0" + (date.getDate())).slice(-2);
    var mon = ("0" + (date.getMonth() + 1)).slice(-2);
    var year = date.getFullYear();
    var hours = ("0" + (date.getHours())).slice(-2);
    var minute = ("0" + (date.getMinutes())).slice(-2);
    var seconds = ("0" + (date.getSeconds())).slice(-2);
    var ruang = document.getElementById('ruangan').innerHTML;
    var fulltime = day + '-' + mon + '-' + year + " Jam " + hours + ":" + minute + ":" + seconds + "";
    document.getElementById('fulltime').innerHTML = ruang + "    Update    Tanggal   " + fulltime;
}, 1000);
}

function load_modal() {
    $.ajax({
        type: "GET",
        url: "modal.php",
        method: "post",
        success: function(data) {
            $('#mymodal').html(data);
        }
    })
}

function load_modal_manajer() {
    $.ajax({
        type: "GET",
        url: "modalmanajer.php",
        method: "post",
        success: function(data) {
            $('#mymodal').html(data);
        }
    })
}


function load_tabel(){
    var table;
    $(document).ready(function() {
        table = $('.datatable').DataTable({
            "processing": false,

            "ordering": true, // Set true agar bisa di sorting
            "order": [
                [0, 'asc']
            ], // Default sortingnya berdasarkan kolom / field ke 0 (paling pertama)
            "ajax": {
                "url": "datapasien.php", // URL file untuk proses select datanya
                "type": "GET"
            },
            "deferRender": true,
            "aLengthMenu": [
                [10, 25, 50, 100],
                [10, 25, 50, 100]
            ], // Combobox Limit
            "columns": [{
                    data: 'no'
                },
                {
                    data: 'triage'
                },
                {
                    data: 'nama'
                },
                {
                    data: 'register'
                },
                {
                    data: 'smf'
                },
                {
                    data: 'pengkajian'
                },
                {
                    data: 'rencana'
                },
                {
                    data: 'keluar'
                },
                {
                    data: 'waktu_tunggu'
                },
            ]
        });
    });
    setInterval(function() {
        table.ajax.reload(null, false);
    }, 10000);
}

function load_tabel_manajer(){
    var table;
    $(document).ready(function() {
        table = $('.datatable').DataTable({

            "processing": false,

            "ordering": true, // Set true agar bisa di sorting
            "order": [
                [0, 'asc']
            ], // Default sortingnya berdasarkan kolom / field ke 0 (paling pertama)
            "ajax": {
                "url": "datamanajer.php", // URL file untuk proses select datanya
                "type": "GET"
            },
            "deferRender": true,
            "aLengthMenu": [
                [10, 25, 50, 100],
                [10, 25, 50, 100]
            ], // Combobox Limit
            "columns": [{
                    data: 'no'
                },
                {
                    data: 'triage'
                },
                {
                    data: 'nama'
                },
                {
                    data: 'register'
                },
                {
                    data: 'smf'
                },
                {
                    data: 'pengkajian'
                },
                {
                    data: 'rencana'
                },
                {
                    data: 'keluar'
                },
                {
                    data: 'waktu_tunggu'
                },
            ]
        });
    });
    setInterval(function() {
        table.ajax.reload(null, false);
    }, 10000);
}

function warning() {
        alert("maaf anda bukan admin ruangan");
    }

    