Files
simrs-jatim/index.php
2024-04-19 14:04:41 +07:00

683 lines
34 KiB
PHP

<?php
require_once 'core/main.php';
if(!isset($_SESSION['SES_REG'])) {
header("location:login.php");
}
if(isset($_REQUEST["link"])){
$link = $_REQUEST["link"];
}else{
header("location:index.php?link=".$_SESSION['first_direction']);
}
// get bootstrap status from link
$get_style = $db->query("SELECT * from m_menu where link = '".$link."'");
$style_form = null;
if($get_style->numRows() > 0)
{
$data_style = $get_style->fetchFirst();
$style_form = $data_style['bootstrap'];
}
else {
$style_form = 1;
}
$page_akses = (array_key_exists('page_akses', $_SESSION) && array_key_exists($link, $_SESSION['page_akses'])) ? $_SESSION['page_akses'][$link] : null;
$js_init = '';
$form_plugin['ui_plugins_css'] = array($select2_css,$datepicker_css,$typeahead_css,$fontawesome_css);
$form_plugin['ui_plugins_js'] = array($bootstrap_js,$jquery_validation_js,$select2_js,$datepicker_js,$datepicker_id_js,$inputmask_js,$typeahead_js);
$list_plugin['ui_plugins_css'] = array($datatable_bootstrap4_css);
$list_plugin['ui_plugins_js'] = array($datatable_js,$datatable_bootstrap4_js);
if($_SESSION['KDDOKTER'] != null)
{
if($_SESSION['disable_warning'] == false)
{
$tmp_dokter = $db->query("SELECT tgl_akhir_sip from m_dokter where kddokter = {$_SESSION['KDDOKTER']}");
if($tmp_dokter->numRows() > 0)
{
$dt_dokter = $tmp_dokter->fetchFirst();
$tgl_akhir = new Datetime($dt_dokter['tgl_akhir_sip']);
$tgl_sekarang = new Datetime(date('Y-m-d'));
$diff = $tgl_akhir->diff($tgl_sekarang);
$_SESSION['disable_warning'] = true;
array_push($form_plugin['ui_plugins_js'], $sweetalert_js);
array_push($list_plugin['ui_plugins_js'], $sweetalert_js);
if($tgl_sekarang < $tgl_akhir) {
$js_init .= 'Swal.fire({
html: "<div class=\"alert alert-info\"><h2>Surat Ijin Praktek akan berakhir <strong>'.$diff->format('%Y tahun %M bulan').' lagi.</strong></h2></div>",
type: "info"});';
}
else {
$js_init .= 'Swal.fire({
html: "<div class=\"alert alert-info\"><h2>Surat Ijin Praktek telah berakhir pada <strong>'.date_to_id_mm($tgl_akhir->format('Y-m-d')).'.</strong></h2></div>",
type: "info"});';
}
}
}
}
if($_SESSION['KDUNIT'] == $_SESSION['kd_unit_lab_pk'] ||
$_SESSION['KDUNIT'] == $_SESSION['kd_unit_lab_mikro'] ||
$_SESSION['KDUNIT'] == $_SESSION['kd_unit_lab_pa'] ||
$_SESSION['KDUNIT'] == $_SESSION['kd_unit_radiologi'] ||
$_SESSION['KDUNIT'] == $_SESSION['kd_unit_lab_darah'] ||
$_SESSION['KDUNIT'] == $_SESSION['kd_unit_farmasi']
)
{
if($_SESSION['disable_warning_penunjang'] == false){
$tmp_rencanapulang = $db->query("SELECT a.nomr,b.nama,rencana_pulang,r.nama as ruang,(select nobill from t_billranap where idxdaftar = a.id_admission limit 1) as nobill from t_admission a join m_pasien b on a.nomr = b.nomr join m_ruang r on a.noruang = r.no where date(rencana_pulang) = '".date('Y-m-d')."' and a.keluarrs is null order by rencana_pulang");
if($tmp_rencanapulang->numRows() > 0)
{
$table = '<h5>Daftar Pasien Rencana Pulang Tgl. '.date('Y-m-d').'</h5><p>Informasi ini ditujukan untuk bagian penunjang, diantaranya Lab Sentral, Lab Mikrobiologi, Lab Patologi Anatomi, Farmasi, dan Radiologi. Bertujuan untuk menginformasikan pasien yang akan KRS, harapannya sebelum pasien KRS tindakan-tindakan yang berkaitan dengan billing pasien sudah terinput ke dalam sistem.</p><p class=\"text-info\">Halaman ini tampil ketika pertama kali login saja</p> <div style=\"overflow:hidden;height:400px\"><table class=\"table table-bordered table-striped table-sm\" id=\"list_rencana_pulang\"><thead> <tr><th>No</th><th>Tgl Rencana Pulang</th><th>No Bill</th><th>No RM</th><th>Nama Pasien</th><th>Ruang</th></tr> </thead><tbody>';
$no = 1;
foreach($tmp_rencanapulang->fetchAll() as $row) {
$table .= '<tr><td>'.$no.'</td><td>'.$row['rencana_pulang'].'</td><td>'.$row['nobill'].'</td><td>'.$row['nomr'].'</td><td>'.$row['nama'].'</td><td>'.$row['ruang'].'</td></tr>';
$no++;
}
$table .= '</tbody></table></div>';
$_SESSION['disable_warning_penunjang'] = true;
if(!in_array($sweetalert_js,$form_plugin['ui_plugins_js'])){
array_push($form_plugin['ui_plugins_js'], $sweetalert_js);
}
if(!in_array($sweetalert_js,$list_plugin['ui_plugins_js'])){
array_push($list_plugin['ui_plugins_js'], $sweetalert_js);
}
$js_init .= '
Swal.fire({
html: "'.$table.'",
width:"80%",
title:"INFORMASI PASIEN RENCANA PULANG",
});
$(document).ready(function(){
$(".swal2-select").select2("destroy");
});';
}
}
if(!in_array($chat_css,$form_plugin['ui_plugins_css'])){
array_push($form_plugin['ui_plugins_css'], $chat_css);
}
if(!in_array($chat_css,$list_plugin['ui_plugins_css'])){
array_push($list_plugin['ui_plugins_css'], $chat_css);
}
$js_init .= '
$(document).ready(function(){
$("body").append($("#chatbox").html());
});
';
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=$rstitle?></title>
<?php
if($style_form == 1 || $style_form == 2) : ?>
<link rel="stylesheet" type="text/css" href="rajal/styledev.css"/>
<link href="dq_sirsdev.css" type="text/css" rel="stylesheet" />
<?php
echo $bootstrap_css;
if($style_form == 1) {
$ui = "\n";
if(!empty($form_plugin['ui_plugins_css']))
{
foreach($form_plugin['ui_plugins_css'] as $css_addin){
$ui .= $css_addin."\n";
}
}
echo $ui;
}
if($style_form == 2) {
$ui = "\n";
if(!empty($list_plugin['ui_plugins_css']))
{
foreach($list_plugin['ui_plugins_css'] as $css_addin){
$ui .= $css_addin."\n";
}
}
echo $ui;
}
echo $jquery_js;
?>
<?php else : ?>
<link rel="stylesheet" type="text/css" href="rajal/style.css"/>
<link href="dq_sirs.css" type="text/css" rel="stylesheet" />
<?php endif; ?>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" type="text/css" href="include/jquery.autocomplete.css" />
<link rel="stylesheet" href="css/autosuggest_inquisitor.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="css/adminlte.css" type="text/css" media="screen" charset="utf-8" />
<?php
echo $navigation_css;
echo $slick_css; ?>
<script language="javascript" type="text/javascript" src="rajal/functions.js"></script>
<script language="javascript" type="text/javascript" src="rajal/xmlhttp.js"></script>
<script type="text/javascript" language="javascript" src="include/ajaxrequest.js"></script>
<?php if(!$style_form == 1 && !$style_form == 2) : ?>
<script type="text/javascript" src="include/js.js"></script>
<script language="javascript" src="include/cal2.js"></script>
<script language="javascript" src="include/cal_conf2.js"></script>
<!-- JQUERY -->
<?php // echo $jquery_js; ?>
<script src="js/jquery-1.7.min.js" language="JavaScript" type="text/javascript"></script>
<script src="js/jquery.validate.js" language="JavaScript" type="text/javascript"></script>
<script type="text/javascript">
jQuery.noConflict();
</script>
<!-- admission pasien
<script type="text/javascript">
jQuery(document).ready(function() {
//pendaftaran
//$("#NAMA").autocomplete("include/scripts/auto_nama.php", { width: 260, selectFirst: true });
jQuery("#nomroperasi").autocomplete("operasi/nomroperasi.php",{width:260});
jQuery("#icdv").autocomplete("vk/autocomplete_vk.php",{width:260});
jQuery("#namaobat1").autocomplete("ranap/auto_icd.php",{width:260});
});
</script>
-->
<!--auto refresh jumlah pasien-->
<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
jQuery('#totalpasienhariini').load('admission/jmlpasien.php').fadeIn("slow");
}, 5000);
</script>
<!--auto refresh jumlah pasien-->
<!--autocomplete-->
<script type='text/javascript' src='include/jquery.autocomplete.pack.js'></script>
<?php endif; ?>
<script type="text/javascript">
function init(){
var stretchers = document.getElementsByClassName('box');
var toggles = document.getElementsByClassName('tab');
var myAccordion = new fx.Accordion(
toggles, stretchers, {opacity: false, height: true, duration: 600}
);
var found = false;
toggles.each(function(h3, i){
var div = Element.find(h3, 'nextSibling');
if (window.location.href.indexOf(h3.title) > 0) {
myAccordion.showThisHideOpen(div);
found = true;
}
});
if (!found) myAccordion.showThisHideOpen(stretchers[0]);
}
function jumpTo (link)
{
var new_url=link;
if ( (new_url != "") && (new_url != null) )
window.location=new_url;
}
</script>
<script type="text/javascript">
function enter_pressed(e){
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return false;
return (keycode == 13);
}
function set_ruang_tindakan() {
elm = $("#set_ruang");
id_ruang = elm.find(":selected").val();
nama_ruang = elm.select2("data")[0].text;
$.post("<?php echo _BASE_.'include/master.php'; ?>",{set_ruang_tindakan:1,ruang:id_ruang,nama_ruang},function(data){
Toast.fire({title:data.message,type:data.type,onClose : function(){
window.location.reload();
}});
},"json");
}
</script>
<script type="text/javascript" src="js/bsn.AutoSuggest_c_2.0.js"></script>
<link rel="stylesheet" href="css/autosuggest_inquisitor.css" type="text/css" media="screen" charset="utf-8" />
</head>
<body>
<div id="header">
<div id="bg_variation">
<div class="row">
<div class="col-sm-9">
<div id="logo">
</div>
</div>
<div class="col-sm-3">
<div class="navbar-collapse">
<ul class="navbar-nav pull-right mr-2">
<li class="nav-item dropdown">
<a class="nav-icon dropdown-toggle d-inline-block d-sm-none" href="#" data-toggle="dropdown">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings align-middle"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>
</a>
<a class="nav-link dropdown-toggle d-none d-sm-inline-block" href="#" data-toggle="dropdown" aria-expanded="false">
<img src="<?php echo _BASE_.'assets/images/people.png'; ?>" class="avatar img-fluid rounded-circle mr-1" style="width:55px" alt="<?php echo (array_key_exists('SES_REG', $_SESSION)) ? $_SESSION['NAMA_PEGAWAI'] : ''; ?>">
<span class="text-white"><?php
if(strlen($_SESSION['NAMA_PEGAWAI']) > 20) {
$nama_pegawai = substr($_SESSION['NAMA_PEGAWAI'],0,18).'...';
}
else {
$nama_pegawai = $_SESSION['NAMA_PEGAWAI'];
}
echo $nama_pegawai; ?></span>
</a>
<div class="dropdown-menu dropdown-menu-right">
<span class="dropdown-item" >Bagian : <?php echo (array_key_exists('SES_REG', $_SESSION)) ? $_SESSION['DEPARTEMEN'] : '';
?>
</span>
<?php
if($_SESSION['ROLES'] == "28")
{
$ss = $db->query("SELECT * FROM m_ruang where st_aktif = 1 and ruang='R.TINDAKAN' order by no ASC");
$arr_set_ruang = array(''=>'Pilih Ruang');
foreach($ss->fetchAll() as $ds){
$arr_set_ruang[$ds['no']] = $ds['nama'];
}
$set_ruang = (array_key_exists('ruang_tindakan',$_SESSION)) ? $_SESSION['ruang_tindakan'] : '';
echo '<div class="dropdown-item">
<form method="POST" action="" id="set_ruang_tindakan">
<div class="form-group row">
<label class="col-sm-12 col-md-12">Set Ruang Tindakan</label>
<div class="col-sm-12 col-md-12">
'.form_dropdown('set_ruang',$arr_set_ruang,$set_ruang,'class="form-control form-control-sm" id="set_ruang" style="width:100%" onchange="set_ruang_tindakan()"').'
</div>
</div>
</form>
</div>';
}
?>
<!-- <a class="dropdown-item" href="<?php echo _BASE_.'index.php?link=list_tindakandpjp'; ?>"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user align-middle mr-1"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg> Status DPJP</a> -->
<?php if($_SESSION['KDDOKTER'] != '') { ?>
<a class="dropdown-item" href="<?php echo _BASE_.'index.php?link=list_tindakandpjp'; ?>"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-pie-chart align-middle mr-1"><path d="M21.21 15.89A10 10 0 1 1 8 2.83"></path><path d="M22 12A10 10 0 0 0 12 2v10z"></path></svg> Analytics</a>
<?php } ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#" id="change_password"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-key"><path d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"></path></svg> Ubah Password</a>
<a class="dropdown-item" href="#" id="author"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-pen-tool"><path d="M12 19l7-7 3 3-7 7-3-3z"></path><path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"></path><path d="M2 2l7.586 7.586"></path><circle cx="11" cy="11" r="2"></circle></svg> Otorisasi</a>
<a class="dropdown-item" href="http://cloud.rssa" id="cloud" target="_blank"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-cloud"><path d="M18 10h-1.26A8 8 0 1 0 9 20h9a5 5 0 0 0 0-10z"></path></svg> Dokumen</a>
<a class="dropdown-item" href="log_out.php"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-power text-danger"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"></path><line x1="12" y1="2" x2="12" y2="12"></line></svg> Keluar</a>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
<?php require_once 'menu.php'; ?>
</div>
<?php require_once 'runtext.php'; ?>
<div id="container_master_bg">
<div id="container">
<?php
// block access to pages that out of this user role menu
$rolemenu = explode(',', $_SESSION['user_rolemenu']);
if(!in_array($link, $rolemenu)) {
require_once 'error404.php';
}
else {
require_once 'navigation.php';
}
?>
</div>
<div align="center" id="footer">
<div class="left">SIMRS versi <?php echo $_SESSION['app_version']; ?> <?=strtoupper($rstitle)?> </div>
<?php
$timestamp = time();
echo "<input id='servertime' type='hidden' value='".$timestamp."' />";
echo "<input id='clockn' type='hidden' />";
?>
</div>
</div>
<?php
$main_js_load = FALSE;
if($style_form == 1 || $style_form == 2) :
if($style_form == 1) {
$ui = "\n";
if(!empty($form_plugin['ui_plugins_js']))
{
foreach($form_plugin['ui_plugins_js'] as $js_addin){
$ui .= $js_addin."\n";
}
}
echo $ui."\n";
if($main_js_load == FALSE)
{
echo $main_js."\n";
$main_js_load = TRUE;
}
echo '<script type="text/javascript">mainform(); '.$js_init.'</script>';
}
if($style_form == 2) {
$ui = "\n";
if(!empty($list_plugin['ui_plugins_js']))
{
foreach($list_plugin['ui_plugins_js'] as $js_addin){
$ui .= $js_addin."\n";
}
}
echo $ui."\n";
if($main_js_load == FALSE)
{
echo $main_js."\n";
$main_js_load = TRUE;
}
echo '<script type="text/javascript"> mainlist(); '.$js_init.' </script>';
}
endif;
?>
<script src="js/jqclock_201.js" language="JavaScript" type="text/javascript"></script>
<!--Notifikasi-->
<script src="js/jquery.captcha.js" language="JavaScript" type="text/javascript"></script>
<?php
echo $sweetalert_js;
echo $slick_js;
if($style_form == 1 || $style_form == 2) : ?>
<script type="text/javascript">
$(function(){
$mt = $("#preview-template").html();
$("body").append($mt);
$("#change_password").click(function(){
const Toast = Swal.mixin({
toast: true,
position: "top-end",
showConfirmButton: false,
timer: 3000
});
$.get("<?php echo _BASE_.'include/master.php'; ?>",{form_password:1},function(form_page){
$("#modal-preview .modal-body").html(form_page);
$("#modal-preview .modal-title").text("Ubah Password");
$("#modal-preview .modal-dialog").css("max-width","55%");
$("#modal-preview .btn-success").hide();
$("#modal-preview").modal('show');
CreateCaptcha();
cek_tombol_simpan = $("#simpan_ubah_password").length;
if(cek_tombol_simpan > 0) {
$("#simpan_ubah_password").remove();
}
$("#modal-preview .modal-footer").append("<button type=\"button\" id=\"simpan_ubah_password\" class=\"btn btn-primary\" ><i class=\"fa fa-save\"></i> Simpan Ubah Password</button>");
});
});
$("#author").click(function(){
const Toast = Swal.mixin({
toast: true,
position: "top-end",
showConfirmButton: false,
timer: 3000
});
$.get("<?php echo _BASE_.'include/master.php'; ?>",{form_author:1},function(form_page){
$("#modal-preview .modal-body").html(form_page);
$("#modal-preview .modal-title").text("Otorisasi");
$("#modal-preview .modal-dialog").css("max-width","55%");
$("#modal-preview .btn-success").hide();
$("#modal-preview").modal('show');
cek_tombol_simpan = $("#simpan_author").length;
if(cek_tombol_simpan > 0) {
$("#simpan_author").remove();
}
$("#modal-preview .modal-footer").append("<button type=\"button\" id=\"simpan_author\" class=\"btn btn-primary\" ><i class=\"fa fa-save\"></i> Simpan Otorisasi</button>");
});
});
});
function printmodal()
{
var divToPrint=document.getElementById('print_body');
if(divToPrint != null){
var newWin=window.open('','Print-Window');
newWin.document.open();
newWin.document.write('<html><body onload="window.print();window.close();">'+divToPrint.innerHTML+'</body></html>');
newWin.document.close();
}
}
</script>
<template id="chatbox">
<div class="chatbox chatbox--tray chatbox--empty" id="chatwrapper">
<div class="chatbox__title">
<h5><a href="#">SIMRS Assistant</a> <span id="chatbox_counter" class="badge badge-light chatbox__counter" style="position: absolute; margin-left: 0.5em; margin-top: .8em;">0</span></h5>
<button class="chatbox__title__tray">
<span></span>
</button>
<button class="chatbox__title__close">
<span>
<svg viewBox="0 0 12 12" width="12px" height="12px">
<line stroke="#FFFFFF" x1="11.75" y1="0.25" x2="0.25" y2="11.75"></line>
<line stroke="#FFFFFF" x1="11.75" y1="11.75" x2="0.25" y2="0.25"></line>
</svg>
</span>
</button>
</div>
<div class="chatbox__body" id="chat">
<div class="card"><div class="card-body">Hai, teman-teman petugas SIMRS<br>Halaman ini akan berisi informasi pasien sistem Rawat Jalan Emergency yang akan KRS, mohon bantuan untuk menindaklanjuti jika terdapat informasi yang muncul. Terima kasih, selamat bekerja.😃🙏</div></div>
</div>
<form class="chatbox__credentials">
<div class="form-group">
<label for="inputName">Name:</label>
<input type="text" class="form-control" id="inputName" required>
</div>
<div class="form-group">
<label for="inputEmail">Email:</label>
<input type="email" class="form-control" id="inputEmail" required>
</div>
<button type="submit" class="btn btn-success btn-block">Enter Chat</button>
</form>
<textarea class="chatbox__message d-none" placeholder="Write something interesting"></textarea>
<script type="text/javascript">
(function($) {
function isHidden(el) {
var style = window.getComputedStyle(el);
return (style.display === 'none')
}
// untuk menghapus pesan
function dismissMsg(elm) {
Swal.fire({
html: "<div class=\"alert alert-info\">Apakah Pesan ini sudah ditindaklanjuti dan akan dihapus?</div>",
showCancelButton: true,
animation: false,
confirmButtonText: "Ya",
cancelButtonText: "Tidak"
}).then((result) => {
if (result.value) {
id_message = $(elm).data("id");
$.post("<?php echo _BASE_.'include/master.php?penunjang_post_message=1'; ?>",{id:id_message,what:"dismiss",petugas:"<?php echo $_SESSION['NIP']; ?>"},function(data){
console.debug(data);
},"json");
}
});
}
function getAssistMsg() {
let roles = '<?php echo $_SESSION['ROLES']; ?>';
$.post("<?php echo _BASE_.'include/master.php?penunjang_get_message=1';?>",{roles,counter:0},function(data){
// console.log(data.messages);
$("#chat").html("<div class=\"card mb-4\"><div class=\"card-body\">Hai, teman-teman petugas SIMRS<br>Halaman ini berisi informasi pasien Rawat Jalan Emergency yang akan KRS, mohon untuk ditindaklanjuti jika terdapat informasi yang muncul. Terima kasih, selamat bekerja.😃🙏</div></div>");
$.each(data.messages,function(k,v){
dismiss_btn = (v.message_type == 'danger') ? "<span class=\"text-right mr-0 ml-1\"><button type=\"button\" id=\"dismiss_msg"+v.id_message+"\" data-id=\""+v.id_message+"\" class=\"btn btn-sm border-light bg-transparent text-white text-sm dismiss\" title=\"Dismiss hanya jika transaksi selesai\">Dismiss</button></span>" : "";
$("#chat").append("<div class=\"card\" id=\"msg"+v.id_message+"\"><div class=\"card-header bg-"+v.message_type+" text-white\"> "+v.message_title+" "+dismiss_btn+"</div><div class=\"card-body\"> <h6 class=\"card-title text-md text-muted\">Ruang "+v.message_from+"</h6> <div class=\"card-text text-md text-dark\">"+v.message_text+"</div> </div> </div>");
if(v.deliver_at == null) {
$.post("<?php echo _BASE_.'include/master.php?penunjang_post_message=1'; ?>",{id:v.id_message,what:"deliver"},function(data){
console.debug(data);
},"json");
}
elm_hidden_check = isHidden(document.getElementById('msg'+v.id_message));
if(v.read_at == null && elm_hidden_check == false) {
$.post("<?php echo _BASE_.'include/master.php?penunjang_post_message=1'; ?>",{id:v.id_message,what:"read"},function(data){
console.debug(data);
},"json");
}
});
$(".dismiss").each(function(){
$(this).on("click",function(){
dismissMsg(this);
});
});
$("#chatbox_counter").text(data.messages.length);
if(data.messages.length > 0) {
$("#chatbox_counter").removeClass("chatbox__counter").addClass("chatbox__counter");
}
else {
$("#chatbox_counter").removeClass("chatbox__counter");
}
},"json");
}
function getCountAssistMsg() {
let roles = '<?php echo $_SESSION['ROLES']; ?>';
$.post("<?php echo _BASE_.'include/master.php?penunjang_get_message=1';?>",{roles,counter:1},function(data){
$("#chatbox_counter").text(data.jumlah);
if(data.jumlah > 0) {
$("#chatbox_counter").removeClass("chatbox__counter").addClass("chatbox__counter");
}
else {
$("#chatbox_counter").removeClass("chatbox__counter");
}
},"json");
}
$(document).ready(function() {
var chatbox = $('#chatwrapper'),
chatboxTitle = $('#chatwrapper .chatbox__title'),
chatboxTitleClose = $('#chatwrapper .chatbox__title__close'),
chatboxCredentials = $('#chatwrapper .chatbox__credentials');
chatboxTitle.on('click', function() {
chatbox.toggleClass('chatbox--tray');
chatboxCredentials.addClass("d-none")
chatbox.removeClass('chatbox--empty');
setInterval(getAssistMsg,2000);
});
chatboxTitleClose.on('click', function(e) {
e.stopPropagation();
chatbox.addClass('chatbox--closed');
});
chatbox.on('transitionend', function() {
if (chatbox.hasClass('chatbox--closed')) chatbox.remove();
});
// chatboxCredentials.on('submit', function(e) {
// e.preventDefault();
// chatbox.removeClass('chatbox--empty');
// });
getCountAssistMsg();
});
})(jQuery);
</script>
</div>
</template>
<template id="preview-template">
<div class="modal fade modal-preview-lg" id="modal-preview" role="dialog" aria-labelledby="modalPreview" aria-hidden="true">
<div class="modal-dialog " style="max-width: 90%">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Preview Hasil</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body" id="print_body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" data-dismiss="modal" onclick="printmodal()">Print</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</template>
<?php endif; ?>
</body>
</html>
<?php
/*
$encrypt = base64_encode(random_bytes(2).$_SESSION['FARMASI_APPPASSWORD'].random_bytes(2));
// Login farmasi
if($_SESSION['farmasi_x_timestamp'] != NULL || $_SESSION['farmasi_x_timestamp'] != '')
{
$sess_time = strtotime($_SESSION['farmasi_x_timestamp']);
$jam_cek = date_create_from_format('Y-m-d H:i:s',$_SESSION['farmasi_x_timestamp']);
date_modify($jam_cek , '+1 months');
$jam_cek_time = strtotime($jam_cek->format('Y-m-d H:i:s'));
$jam_sekarang = strtotime("now");
if($jam_sekarang > $jam_cek_time)
{
// login jika timestamp lebih dari 24 jam
$login = file_get_contents("http://".$_SESSION['FARMASI_WEBADDRESS'].'/api/login?email='.$_SESSION['FARMASI_APPUSER'].'&password='.$encrypt);
$data_login = json_decode($login);
if($data_login->status == 'success')
{
$sql_update = "UPDATE global_var set var_value = '".$data_login->api_key."' where var_name = 'farmasi_x_token';";
$sql_update2 = "UPDATE global_var set var_value = '".$data_login->api_timestamp."' where var_name = 'farmasi_x_timestamp';";
execute($sql_update);
execute($sql_update2);
}
}
}
else {
// login jika belum terset
$opts = array('http'=>array('header' => "User-Agent:MyAgent/1.0\r\n"));
$context = stream_context_create($opts);
$login = file_get_contents("http://".$_SESSION['FARMASI_WEBADDRESS'].'/api/login?email='.$_SESSION['FARMASI_APPUSER'].'&password='.$encrypt,false,$context);
$data_login = json_decode($login);
if($data_login->status == 'success')
{
$sql_update = "UPDATE global_var set var_value = '".$data_login->api_key."' where var_name = 'farmasi_x_token';";
$sql_update2 = "UPDATE global_var set var_value = '".$data_login->api_timestamp."' where var_name = 'farmasi_x_timestamp';";
execute($sql_update);
execute($sql_update2);
}
}*/
$db->close();
?>