Commit 7251ee06 authored by Azy Mushofy Anwary's avatar Azy Mushofy Anwary

condisi

parent b6beb3c7
......@@ -76,8 +76,9 @@ class ApiController extends \Application\Master\GlobalActionController {
$no_hp = $post->ino_hp;
$ktp = $post->iktp;
$no_antrian = $post->ino_antrian;
$dataArrayPasien = array (
$norm = $post->inorm;
$dataArrayPasien = array (
'id_pasien' => $idpasien,
'create_date' => gmdate("Y-m-d H:i:s", time()+60*60*7),
'nama' => $nama,
......@@ -86,9 +87,9 @@ class ApiController extends \Application\Master\GlobalActionController {
'alamat' => $alamat,
'no_hp' => $no_hp,
'ktp' => $ktp,
'no_rekam_medis' => $norm
);
$param->saveGlobal( $dataArrayPasien, $table_pasien);
......@@ -142,14 +143,13 @@ class ApiController extends \Application\Master\GlobalActionController {
$ktp = $post->iktp;
$cekpasien = $test->cekpasien($no_rekam_medis);
$validasi = $test->cekktp($no_rekam_medis, $ktp);
$array = array(
'validasiinput' => $validasi->code,
'datapasien'=> $cekpasien->data
);
// print_r($no_rekam_medis) ;die;
// print_r( $cekpasien) ;die;
if($cekpasien->code == 0){
$result->code = $result::CODE_SUCCESS;
......@@ -670,15 +670,6 @@ class ApiController extends \Application\Master\GlobalActionController {
}else{
$result->info = 'File tidak boleh kosong';
}
// print_r($dataArrayPoli);die;
// $param->saveGlobal($dataArrayPoli, $table_poli);
// $result->code = 0;
// $result->info = 'ok';
// $result->data = $dataArrayPoli;
}catch (\Exception $exc) {
......@@ -705,29 +696,58 @@ class ApiController extends \Application\Master\GlobalActionController {
$param = new \Application\Model\Param($storage);
try{
$id_poli = $post->id;
$fileupload = $_FILES['fileupload']['tmp_name'];
$id_poli = $post->id_poli;
$nama_poli = $post->inama_poli;
$kode_poli = $post->ikode_poli;
$deskripsi_poli = $post->ideskripsi_poli;
$dataArrayPoli = array (
if (!empty($fileupload)){
$ImageName = $_FILES['fileupload']['name'];
$tipes = $_FILES['fileupload']['type'];
$size = $_FILES['fileupload']['size'];
$uploaddir = './public/tamplate/img/poli/'; // directory file
'nama_poli' => $nama_poli,
'kode_poli' =>$kode_poli,
'deskripsi_poli'=>$deskripsi_poli,
$alamatfile = $uploaddir.$ImageName;
if (move_uploaded_file($_FILES['fileupload']['tmp_name'],$alamatfile)){
/* jika upload berhasil ke folder sever */
$dataArrayPoli = array(
'nama_poli' => $nama_poli,
'image_poli' => $ImageName,
'deskripsi_poli' => $deskripsi_poli,
'kode_poli' => $kode_poli,
);
);
$load = $param->loadkelolapoli($post->id);
// print_r($load);die;
$table_poli= 'poli';
$where = 'id_poli='.$id_poli;
// print_r ($where);die;
$param->updateGlobal($table_poli, $dataArrayPoli, $where);
$result->code = 0;
$result->info = 'ok';
$result->data = $load->data;
$load = $param->loadkelolapoli($post->id_poli);
$table_poli = 'poli';
$where = 'id_poli='.$id_poli;
$param->updateGlobal($table_poli, $dataArrayPoli, $where);
$result->code = 0;
$result->info = 'ok';
$result->data = $load->data;
}else{
$result->code = 17;
$result->info = 'FAILED UPLOAD FILE to SERVER';
}
}else{
$result->info = 'File tidak boleh kosong';
}
}catch (\Exception $exc) {
$result = new Result(0,1,$exc->getMessage() .'-'.$exc->getTraceAsString());
......@@ -814,39 +834,73 @@ class ApiController extends \Application\Master\GlobalActionController {
try{
$fileupload = $_FILES['fileupload']['tmp_name'];
$nama_dokter = $post->inama_dokter;
$kode_dokter = $post->ikode_dokter;
$poli = $post->ipoli;
//print_r($poli);die;
$DokterPoli = array (
if (!empty($fileupload)){
$ImageName = $_FILES['fileupload']['name'];
$tipes = $_FILES['fileupload']['type'];
$size = $_FILES['fileupload']['size'];
'nama_dokter' => $nama_dokter,
'kode_dokter' =>$kode_dokter,
'id_poli' =>$poli,
'id_condition' => 1,
'create_date' => gmdate("Y-m-d H:i:s", time()+60*60*7),
);
$uploaddir = './public/tamplate/img/doctor/'; // directory file
$alamatfile = $uploaddir.$ImageName;
if (move_uploaded_file($_FILES['fileupload']['tmp_name'],$alamatfile)){
$Dokter = array (
// print_r('berhasil');die;
/* jika upload berhasil ke folder sever */
$DokterPoli = array (
'nama_dokter' => $nama_dokter,
'kode_dokter' =>$kode_dokter,
'id_poli' =>$poli,
'image_dokter' => $ImageName,
'id_condition' => 1,
'create_date' => gmdate("Y-m-d H:i:s", time()+60*60*7),
'nama_dokter' => $nama_dokter,
'kode_dokter' =>$kode_dokter,
);
);
$Dokter = array (
'nama_dokter' => $nama_dokter,
'kode_dokter' =>$kode_dokter,
'image_dokter' => $ImageName,
);
$param->saveGlobal($Dokter, $table_dokter);
$param->saveGlobal($DokterPoli, $table_dokter_to_poli);
$result->code = 0;
$result->info = 'ok';
$result->data = $DokterPoli->data;
}else{
$result->code = 17;
$result->info = 'FAILED UPLOAD FILE to SERVER';
}
}else{
$result->info = 'File tidak boleh kosong';
}
//print_r($poli);die;
// print_r($dataArraydokter);die;
$param->saveGlobal($Dokter, $table_dokter);
$param->saveGlobal($DokterPoli, $table_dokter_to_poli);
$result->code = 0;
$result->info = 'ok';
$result->data = $DokterPoli->data;
}catch (\Exception $exc) {
......@@ -872,46 +926,80 @@ class ApiController extends \Application\Master\GlobalActionController {
$param = new \Application\Model\Param($storage);
try{
$id_dokter = $post->id;
$nama_dokter = $post->inama_dokter;
$kode_dokter = $post->ikode_dokter;
$poli = $post->ipoli;
$condition = $post->icondition;
$fileupload = $_FILES['fileupload']['tmp_name'];
$id_dokter = $post->id_dokter;
// print_r($id_dokter);die;
$nama_dokter = $post->inama_dokter;
$kode_dokter = $post->ikode_dokter;
$poli = $post->ipoli;
$condition = $post->icondition;
$DokterPoli = array (
'nama_dokter' => $nama_dokter,
'kode_dokter' =>$kode_dokter,
'id_poli' =>$poli,
'id_condition' =>$condition,
if (!empty($fileupload)){
$ImageName = $_FILES['fileupload']['name'];
$tipes = $_FILES['fileupload']['type'];
$size = $_FILES['fileupload']['size'];
$uploaddir = './public/tamplate/img/doctor/'; // directory file
);
$alamatfile = $uploaddir.$ImageName;
if (move_uploaded_file($_FILES['fileupload']['tmp_name'],$alamatfile)){
$Dokter = array (
// print_r('berhasil');die;
/* jika upload berhasil ke folder sever */
$DokterPoli = array (
'nama_dokter' => $nama_dokter,
'kode_dokter' =>$kode_dokter,
'id_poli' =>$poli,
'id_condition' =>$condition,
'image_dokter' => $ImageName,
'nama_dokter' => $nama_dokter,
'kode_dokter' =>$kode_dokter,
);
$load = $param->loadkeloladokter($post->id);
// print_r($dataArraydokter);die;
$table_dokter_to_poli= 'dokter_to_poli';
$where = 'id_dokter='.$id_dokter;
// print_r ($where);die;
$param->updateGlobal($table_dokter_to_poli, $DokterPoli, $where);
);
// print_r($dataArraydokter);die;
$table_dokter= 'dokter';
$where = 'id_dokter='.$id_dokter;
// print_r ($where);die;
$param->updateGlobal($table_dokter, $Dokter, $where);
$result->code = 0;
$result->info = 'ok';
$result->data = $load->data;
$Dokter = array (
'nama_dokter' => $nama_dokter,
'kode_dokter' =>$kode_dokter,
'image_dokter' => $ImageName,
);
$load = $param->loadkeloladokter($post->id);
$table_dokter_to_poli= 'dokter_to_poli';
$where = 'id_dokter='.$id_dokter;
$param->updateGlobal($table_dokter_to_poli, $DokterPoli, $where);
$table_dokter= 'dokter';
$where = 'id_dokter='.$id_dokter;
$param->updateGlobal($table_dokter, $Dokter, $where);
$result->code = 0;
$result->info = 'ok';
$result->data = $load->data;
}else{
$result->code = 17;
$result->info = 'FAILED UPLOAD FILE to SERVER';
}
}else{
$result->info = 'File tidak boleh kosong';
}
}catch (\Exception $exc) {
$result = new Result(0,1,$exc->getMessage() .'-'.$exc->getTraceAsString());
......@@ -1279,8 +1367,9 @@ class ApiController extends \Application\Master\GlobalActionController {
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
// print_r($post->id);die;
$load = $test->loadpasien($post->id);
// print_r($post->no_rekam_medis);die;
$load = $test->loadpasien($post->id, $post->no_rekam_medis);
if($load->code == 0){
$result->code = $result::CODE_SUCCESS;
......@@ -1893,6 +1982,32 @@ class ApiController extends \Application\Master\GlobalActionController {
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
}
public function loadtotalantrianAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$load = $test->loadtotalantrian();
// print_r($load);die;
if($load->code == 0){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
$result->data = $load->data;
}else{
$result->code = 1;
$result->info = 'Not Found';
}
return $this->getOutput($result->toJson());
}
}
\ No newline at end of file
......@@ -61,8 +61,8 @@ class Param extends Mapper {
$data = $this->_storage->loadUserData($id,$iddok);
return $data;
}
public function loadpasien($id = null){
$data = $this->_storage->loadpasien($id);
public function loadpasien($id = null, $norm = null){
$data = $this->_storage->loadpasien($id, $norm);
return $data;
}
public function loaddatapasien($id){
......@@ -175,6 +175,10 @@ class Param extends Mapper {
$data = $this->_storage->loadterlayani();
return $data;
}
public function loadtotalantrian(){
$data = $this->_storage->loadtotalantrian();
return $data;
}
public function tampilpoli($id = null){
$data = $this->_storage-> tampilpoli($id);
return $data;
......
......@@ -361,7 +361,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
return $result;
}
public function loadpasien($id){
public function loadpasien($id = null, $norm = null){
$result = new Result();
try {
......@@ -370,8 +370,13 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
if($id){
$sql .= " WHERE id_pasien = $id ";
}
if($norm){
$sql .= " WHERE no_rekam_medis = '$norm'";
}
$sql .= " ORDER BY no_rekam_medis ASC";
// print_r($sql);die;
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
......@@ -509,6 +514,43 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
}
return $result;
}
public function loadtotalantrian(){
$result = new Result();
try {
$sql = " SELECT count(id_dokter) FROM antrian_pasien ";
// print_r($sql);die;
$stmt = $this->_db->query($sql);
$resdata = $stmt->execute();
$listdata = array();
foreach($resdata as $val){
// print_r($val);die;
array_push($listdata, $val);
}
if ($listdata) {
$result->code = 0;
$result->info = 'OK';
$result->data = $listdata;
}else{
$result->code = 1;
$result->info = 'nok';
}
}catch (\Zend\Db\Adapter\Exception\RuntimeException $ex) {
$result->code = 3;
$result->info = 'ERROR : ' . $ex->getMessage();
}catch (\Exception $ex) {
$result->code = 4;
$result->info = 'ERROR : ' . $ex->getMessage();
}
return $result;
}
public function loadpasiendalamantrian(){
$result = new Result();
try {
......@@ -663,11 +705,11 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = " SELECT p.id_pasien, ap.no_rekam_medis, ap.status_code,ap.no_antrian ,ap.no_antrian, ap.id_antrian,ap.nama FROM pasien p
LEFT JOIN antrian_pasien ap
ON ap.id_pasien = p.id_pasien
WHERE p.no_rekam_medis='$no_rekam_medis' ";
$sql = " SELECT p.id_pasien, ap.no_rekam_medis, ap.status_code,ap.no_antrian ,ap.no_antrian, ap.id_antrian, ap.nama FROM pasien p
LEFT JOIN antrian_pasien ap
ON ap.id_pasien = p.id_pasien
WHERE p.no_rekam_medis = '$no_rekam_medis' ";
// print_r($sql);die;
$stmt = $this->_db->query($sql);
......@@ -1046,13 +1088,13 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = " SELECT dokter_to_poli.id_dokter, dokter_to_poli.nama_dokter, dokter_to_poli.kode_dokter , poli.id_poli, poli.nama_poli, condition.condition,condition.id_condition
FROM dokter_to_poli
INNER JOIN poli
ON dokter_to_poli.id_poli = poli.id_poli
INNER JOIN condition
ON condition.id_condition = dokter_to_poli.id_condition
";
$sql = " SELECT dokter_to_poli.id_dokter, dokter_to_poli.nama_dokter, dokter_to_poli.kode_dokter , poli.id_poli, poli.nama_poli,dokter_to_poli.image_dokter, condition.condition,condition.id_condition
FROM dokter_to_poli
INNER JOIN poli
ON dokter_to_poli.id_poli = poli.id_poli
INNER JOIN condition
ON condition.id_condition = dokter_to_poli.id_condition
";
if($id){
$sql .= " Where dokter_to_poli.id_dokter = $id";
......
......@@ -88,18 +88,7 @@
<!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Revenue Sources</h6>
<div class="dropdown no-arrow">
<a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-ellipsis-v fa-sm fa-fw text-gray-400"></i>
</a>
<div class="dropdown-menu dropdown-menu-right shadow animated--fade-in" aria-labelledby="dropdownMenuLink">
<div class="dropdown-header">Dropdown Header:</div>
<a class="dropdown-item" id="poli"></a>
<select name="poli" id="poli" class="form-control" >
<option disable selected> Pilih </option>
</select>
</div>
</div>
</div>
<!-- Card Body -->
<div class="card-body">
......
......@@ -20,6 +20,7 @@
<th colspan="" class=" thLeftText">Nama Dokter</th>
<th colspan="" class=" thLeftText">Kode Dokter</th>
<th colspan="" class=" thLeftText">Kondisi Dokter</th>
<th colspan="" class=" thLeftText">Gambar Dokter</th>
<th colspan="" class=" thLeftText">Action</th>
</tr>
</thead>
......@@ -65,11 +66,10 @@
<input type="input" id="kode_dokter" name="kode_dokter" class="form-control" placeholder="Kode Dokter" /></input>
</div>
<!-- <div class="form-group">
<label>Foto Dokter</label>
<input type="image" id="image" name="image" class="form-control" required /></input>
</div> -->
<div class="form-group " >
<label>Gambar Dokter</label>
<input type="file" name="gambar_dokter" id="gambar_dokter" class="form-control-file">
</div>
<div class="modal-footer">
<button button type="button" class="btn btn-primary" id="tambah">Add</button>
......@@ -118,10 +118,11 @@
</select>
</div>
<!-- <div class="form-group">
<label>Foto Dokter</label>
<input type="image" id="image" name="image" class="form-control" required /></input>
</div> -->
<div class="form-group " >
<label>Gambar Dokter</label>
<input type="file" name="gambar_dokteredt" id="gambar_dokteredt" class="form-control-file">
</div>
<div class="modal-footer">
......
......@@ -41,7 +41,7 @@
<div class="modal-body">
<form id="myForm" >
<input type="text" id="id_pasien" class="form-control" /></input>
<input type="hidden" id="id_pasien" class="form-control" /></input>
<div class="form-group">
<label> No Rekam Medis</label><br>
......
......@@ -29,6 +29,7 @@
<th>Nama Poli</th>
<th>Kode Poli</th>
<th>Deskripsi Poli</th>
<th>Gambar Poli</th>
<th>Action</th>
</tr>
</thead>
......@@ -53,7 +54,7 @@
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body">
<form id="myForm" method="POST" action="<?php $this->basePath('/api/savekelolapoli') ?>" enctype="multipart/form-data">
<form id="myForm" >
<div class="form-group">
<label>Nama Poli</label>
......@@ -117,7 +118,7 @@
<div class="form-group ">
<label>Gambar Poli</label>
<input type="file" name="image_poli" id="image_poliedt" class="form-control-file"></input>
<input type="file" name="gambar_poliedt" id="gambar_poliedt" class="form-control-file"></input>
</div>
<div class="modal-footer">
<button button type="button" class="btn btn-primary" id="edit">Edit</button>
......
......@@ -50,7 +50,7 @@
<form id="myForm" >
<div class="form-group">
<label>Jenis Layanan</label>
<label>Nama Poli</label>
<select name="nama_poli" id="poli" class="form-control" require>
<option disable selected> Pilih </option>
......@@ -134,7 +134,7 @@
<input type="input" id="id_register" class="form-control" /></input>
<div class="form-group">
<label>Jenis Layanan</label>
<label>Nama Poli</label>
<div class="card" >
<div class="card-body" style="padding: 0.5rem;" id="poliedt" >
</div>
......
......@@ -5,12 +5,9 @@
<div class="col-lg-5 col-xl-5">
<div class="banner_text">
<div class="banner_text_iner">
<h5>We are here for your care</h5>
<h1>Best Care &
Better Doctor</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing
elit sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Quis ipsum suspendisse ultrices gravida.Risus cmodo viverra </p>
<h5>Kami di sini untuk perawatan Anda</h5>
<h1>Perawatan Terbaik</h1>
<p>Dalam kesehatan terdapat kebebasan. Kesehatan adalah hal paling pertama dalam semua kebebasan.
<a href="<?php echo $this->basePath('queue/cekdatapasien');?>"class="btn_2">Registrai Antrian</a>
</div>
......
......@@ -45,10 +45,10 @@ input::-webkit-inner-spin-button {
<input type="number" id="no_rekam_medis" placeholder="No Rekam Medis" class="form-control" max="999999999999999" maxlength="8" ></input>
</div>
<div class="form-group">
<!-- <div class="form-group">
<label> <h5>No Induk Kependudukan (NIK)</h5></label><br>
<input type="number" id="ktp" placeholder="No Induk Kependudukan (NIK)" class="form-control"max="9999999999999999" maxlength="16" ></input>
</div>
</div> -->
<p class="card-text" style="display:inline">Jika belum mempunyai no rekam medis, </p>
<a class="card-text" href="<?php echo $this->basePath('queue/daftarpasien') ?>" style="display:inline">Klik disini !</a>
</form>
......
......@@ -23,10 +23,10 @@
<section class="doctor_part single_page_doctor_part" style="padding:20px;">
<div class="container">
<div class="row justify-content-center">
<div class="col-xl-8">
<div class="col-xl-8" style=" height: 75px; ">
<div class="section_tittle text-center">
<h2> Dokter </h2>
<p>Beberapa dokter di rumah sakit ini</p>
<h2 > Beberapa dokter di rumah sakit</h2>
</div>
</div>
</div>
......
......@@ -20,7 +20,7 @@
<!-- breadcrumb start-->
<!-- feature_part start-->
<section class="doctor_part single_page_doctor_part" style="padding:0px;">
<section class="doctor_part single_page_doctor_part" style="padding:0px;" >
<div class="container">
<div class="row justify-content-center">
<div class="col-xl-8">
......
......@@ -114,7 +114,7 @@
<div class="row justify-content-between">
<div class="col-xl-2 col-md-4 col-sm-6 single-footer-widget">
<a href="#" class="footer_logo"> <img src="<?php $this->basePath('queue/beranda') ?>/tamplate/img/logo.png" alt="#"> </a>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor </p>
<p>Hidup sehat adalah hidup sejahtera dan bahagia yang berawal dari diri kita sendiri</p>
</div>
<div class="col-xl-9 col-sm-6 col-md-4 single-footer-widget">
......@@ -142,13 +142,7 @@
<div class="copyright_part">
<div class="container">
<div class="row align-items-center">
<p class="footer-text m-0 col-lg-8 col-md-12">
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
Copyright &copy;
is made with <i class="ti-heart" aria-hidden="true"></i> by <a href="https://colorlib.com"
target="_blank">Colorlib</a>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
</div>
</div>
......
$('#cekdata').on('click', function () {
let no_rekam_medis = $('#no_rekam_medis').val();
let ktp = $('#ktp').val();
cekpasien(no_rekam_medis, ktp);
if (no_rekam_medis == null || no_rekam_medis == "") {
bootbox.alert({ message: 'No Rekam Medis tidak boleh kosong', centerVertical: true });
return false;
} else if (no_rekam_medis.toString().length > 8) {
bootbox.alert({ message: 'No Rekam Medis tidak boleh lebih dari 8 angka', centerVertical: true });
return false;
} else if (no_rekam_medis.toString().length < 8) {
bootbox.alert({ message: 'No Rekam Medis tidak boleh kurang dari 8 angka', centerVertical: true });
return false;
}
else {
cekpasien(no_rekam_medis);
}
})
function cekpasien(no_rekam_medis, ktp) {
function cekpasien(no_rekam_medis) {
$.ajax({
type: 'POST',
......@@ -16,7 +30,7 @@ function cekpasien(no_rekam_medis, ktp) {
url: baseURL + '/api/cekpasien',
data: {
ino_rekam_medis: no_rekam_medis,
iktp: ktp,
},
success: function (result) {
// let data = result.data['datapasien'][0]['no_rekam_medis'];
......@@ -26,7 +40,7 @@ function cekpasien(no_rekam_medis, ktp) {
bootbox.alert({ message: "No rekam medis atau NIK tidak sesuai!", centerVertical: true });
}
else if (result.data['validasiinput'] == 0) {
else if (result.code == 0) {
console.log(result.data['datapasien'][0]['no_rekam_medis']);
// alert('berhasil');
if (result.data['datapasien'][0]['no_rekam_medis'] == null) {
......@@ -66,8 +80,8 @@ function cekpasien(no_rekam_medis, ktp) {
bootbox.alert({ message: "Pasien Sedang Telah Terlewat Silahkan Hubungi Petugas", centerVertical: true });
}
} else if (result.data['validasiinput'] == 1) {
bootbox.alert({ message: "No Induk Kependudukan tidak sesuai", centerVertical: true });
// } else if (result.data['validasiinput'] == 1) {
// bootbox.alert({ message: "No Induk Kependudukan tidak sesuai", centerVertical: true });
} else {
// bootbox.alert({ message: "Pasien Tidak Terdaftar <br> Silahkan Daftar Terlebih Dahulu", centerVertical: true });
......
......@@ -64,11 +64,55 @@ $('#tambahdata').on('click', function () {
bootbox.alert({ message: 'KTP Sudah Digunakan!', centerVertical: true });
}
else {
SaveDataAja();
validasinorekammedis();
}
})
function SaveDataAja() {
function makeid(length) {
let result = '';
let characters =
'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
let charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
function makeidnumber(length) {
let result = '';
let characters =
'1234567890';
let charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
function validasinorekammedis() {
let norekamedis = makeid(2) + makeidnumber(6);
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadpasien',
data: {
no_rekam_medis: norekamedis
},
success: function (result) {
if (result.info == 'Not Found') {
SaveDataAja(norekamedis);
} else {
validasinorekammedis();
}
}
});
}
function SaveDataAja(norekamedis) {
let no_rekam_medis = norekamedis;
let id_pasien = $('#id_pasien').val();
let nama = $('#nama').val();
let tempat_lahir = $('#tempat_lahir').val();
......@@ -78,9 +122,6 @@ function SaveDataAja() {
let ktp = $('#ktp').val();
// console.log(no_antrian);
/* save data */
$.ajax({
type: 'POST',
dataType: 'json',
......@@ -93,6 +134,7 @@ function SaveDataAja() {
itanggal_lahir: tanggal_lahir,
ialamat: alamat,
ino_hp: no_hp,
inorm: no_rekam_medis
},
success: function (response) {
......@@ -137,7 +179,6 @@ function validasipoli(KTP) {
id: null,
},
success: function (result) {
console.log(result)
var data = result.data;
......
......@@ -76,7 +76,7 @@ function Loaddokter() {
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].nama_dokter + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].kode_dokter + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].condition + '</td>';
// cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].image + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].image_dokter + '</td>';
cols += '<td class="tdCenterText bgtd1 "> <div class="text-center" ><span style="padding: 7px;" class="btn btn-success btn-xs" data-toggle="modal" data-target="#Editdata" onClick="loadedit(' + data[x].id_dokter + ')">Edit</span> <span style="padding: 7px;"class="btn btn-danger btn-xs" onclick="Delete(' + data[x].id_dokter + ')">Delete</span></div></td>';
newRow.append(cols);
......@@ -113,7 +113,7 @@ function Loaddokter() {
});
}
function validasidokter(poli, nama_dokter, kode_dokter) {
function validasidokter(poli, nama_dokter, kode_dokter, fileupload) {
var exist = 0;
......@@ -144,12 +144,17 @@ function validasidokter(poli, nama_dokter, kode_dokter) {
exist = 2;
}
}
if (poli == data[x]['id_poli']) {
if (fileupload == data[x]['image_dokter']) {
exist = 3;
}
}
if (poli == data[x]['id_poli']) {
if (nama_dokter == data[x]['nama_dokter']) {
namacounter += 1;
if (namacounter > 1) {
exist = 3;
exist = 4;
}
}
}
......@@ -157,10 +162,20 @@ function validasidokter(poli, nama_dokter, kode_dokter) {
if (kode_dokter == data[x]['kode_dokter']) {
kodecounter += 1;
if (kodecounter > 1) {
exist = 4;
exist = 5;
}
}
}
if (poli == data[x]['id_poli']) {
if (fileupload == data[x]['image_dokter']) {
kodecounter += 1;
if (kodecounter > 1) {
exist = 6;
}
}
}
}
......@@ -174,6 +189,26 @@ function validasidokter(poli, nama_dokter, kode_dokter) {
}
function validasigambar() {
var exist = 0;
let inputString = $('#gambar_dokter').val();
let inputStringedt = $('#gambar_dokteredt').val();
var imageReg = /[\/.](gif|jpg|jpeg|tiff|png)$/i;
if (!imageReg.test(inputString)) {
// bootbox.alert({ message: 'Harus berupa gambar', centerVertical: true });
exist = 1;
}
if (!imageReg.test(inputStringedt)) {
// bootbox.alert({ message: 'Harus berupa gambar', centerVertical: true });
exist = 2;
}
return exist;
}
$('#tambahmodal').on('click', function () {
loadpoli()
......@@ -182,7 +217,7 @@ $('#tambah').on('click', function () {
let nama_dokter = $('#nama_dokter').val();
let kode_dokter = $('#kode_dokter').val();
let poli = $("#poli option:selected").attr("value");
console.log(poli)
const fileupload = $('#gambar_dokter').prop('files')[0];
if (nama_dokter == null || nama_dokter == "") {
bootbox.alert({ message: 'Nama dokter tidak boleh kosong', centerVertical: true });
......@@ -191,39 +226,65 @@ $('#tambah').on('click', function () {
else if (kode_dokter == null || kode_dokter == "") {
bootbox.alert({ message: 'Kode dokter tidak boleh kosong', centerVertical: true });
return false;
} else if (poli == null) {
bootbox.alert({ message: 'Poli tidak boleh kosong', centerVertical: true });
return false;
}
else if (fileupload == null) {
bootbox.alert({ message: 'Gambar dokter tidak boleh kosong', centerVertical: true });
return false;
}
else if (poli == null) {
bootbox.alert({ message: 'Kode dokter tidak boleh kosong', centerVertical: true });
return false;
}
else if (validasidokter(poli, nama_dokter, kode_dokter) == 1) {
else if (validasidokter(poli, nama_dokter, kode_dokter, fileupload) == 1) {
bootbox.alert({ message: 'Nama dokter sudah ada!', centerVertical: true });
}
else if (validasidokter(poli, nama_dokter, kode_dokter) == 2) {
else if (validasidokter(poli, nama_dokter, kode_dokter, fileupload) == 2) {
bootbox.alert({ message: 'Kode dokter sudah ada!', centerVertical: true });
}
else if (validasidokter(poli, nama_dokter, kode_dokter, fileupload) == 3) {
bootbox.alert({ message: 'Gambar dokter sudah ada!', centerVertical: true });
}
else if (validasigambar() == 1) {
bootbox.alert({ message: 'Harus berupa gambar', centerVertical: true });
} else {
savedokter()
}
console.log(validasidokter(poli, nama_dokter, kode_dokter));
})
function savedokter() {
let nama_dokter = $('#nama_dokter').val();
let kode_dokter = $('#kode_dokter').val();
let poli = $("#poli option:selected").attr("value");
const fileupload = $('#gambar_dokter').prop('files')[0];
let formData = new FormData();
formData.append('inama_dokter', nama_dokter);
formData.append('ikode_dokter', kode_dokter);
formData.append('ipoli', poli);
formData.append('fileupload', fileupload); // set file ke tipe data binary
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/savekeloladokter',
data: {
inama_dokter: nama_dokter,
ikode_dokter: kode_dokter,
ipoli: poli
},
data: formData,
cache: false,
processData: false,
contentType: false,
success: function (response) {
//console.log(poli)
if (response['code'] == 0) {
$('#addData').modal('hide');
swal({
title: "",
text: "Data Berhasil Ditambahkan!",
......@@ -264,6 +325,7 @@ $('#edit').on('click', function () {
let nama_dokter = $('#nama_dokteredt').val();
let kode_dokter = $('#kode_dokteredt').val();
let poli = $("#poliedt option:selected").attr("value");
const fileupload = $('#gambar_dokter').prop('files')[0];
if (nama_dokter == null || nama_dokter == "") {
......@@ -274,12 +336,23 @@ $('#edit').on('click', function () {
bootbox.alert({ message: 'Kode dokter tidak boleh kosong', centerVertical: true });
return false;
}
else if (poli == null) {
bootbox.alert({ message: 'Poli tidak boleh kosong', centerVertical: true });
return false;
}
else if (fileupload == null) {
bootbox.alert({ message: 'Gambar dokter tidak boleh kosong', centerVertical: true });
return false;
}
else if (validasidokter(poli, nama_dokter, kode_dokter) == 3) {
bootbox.alert({ message: 'Nama dokter harus berbeda!', centerVertical: true });
}
else if (validasidokter(poli, nama_dokter, kode_dokter) == 4) {
bootbox.alert({ message: 'Kode dokter harus berbeda!', centerVertical: true });
}
else if (validasigambar() == 2) {
bootbox.alert({ message: 'Harus berupa gambar', centerVertical: true });
} else {
editdatadokter(id_dokter)
}
......@@ -292,24 +365,30 @@ function editdatadokter(id_dokter) {
let condition = $("#condition option:selected").attr("value");
let nama_dokter = $('#nama_dokteredt').val();
let kode_dokter = $('#kode_dokteredt').val();
// let image = $('#kode_poli').val();
const fileupload = $('#gambar_dokteredt').prop('files')[0];
let formData = new FormData();
formData.append('id_dokter', id_dokter);
formData.append('inama_dokter', nama_dokter);
formData.append('ikode_dokter', kode_dokter);
formData.append('ipoli', poli);
formData.append('icondition', condition);
formData.append('fileupload', fileupload); // set file ke tipe data binary
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/editkeloladokter',
data: {
id: id_dokter,
inama_dokter: nama_dokter,
ikode_dokter: kode_dokter,
ipoli: poli,
icondition: condition,
},
data: formData,
cache: false,
processData: false,
contentType: false,
success: function (response) {
// console.log(response);
if (response['code'] == 0) {
$('#Editdata').modal('hide');
swal({
title: "",
text: "Data Berhasil DiUbah!",
......@@ -371,7 +450,7 @@ function loadedit(id_dokter) {
async: false,
success: function (result) {
// console.log(data);
console.log(data);
if (result['code'] == 0) {
......@@ -410,6 +489,7 @@ function loadedit(id_dokter) {
$('#nama_dokteredt').val(data[0].nama_dokter);
$('#kode_dokteredt').val(data[0].kode_dokter);
// $("#gambar_dokteredt").val(data[0].image_dokter);
} else {
bootbox.alert({ message: 'Data Kosong', centerVertical: true });
}
......@@ -470,8 +550,8 @@ function Delete(param) {
});
}
},
error: function (xhr) {
alert(xhr.status + '-' + xhr.statusText);
error: function () {
bootbox.alert({ message: 'Data dokter masih terdaftar dalam poli ', centerVertical: true });
}
});
}
......
......@@ -152,6 +152,7 @@ function editdatapasien(id_pasien) {
},
success: function (response) {
$('#Editdata').modal('hide');
console.log(response);
if (response['code'] == 0) {
swal({
......
......@@ -20,7 +20,7 @@ function Loadpoli() {
$('table.table-bordered > tbody').empty();
// console.log(result);
console.log(result);
if (result.code == 0) {
......@@ -37,8 +37,10 @@ function Loadpoli() {
cols += '<td class="tdCenterText bgtd1 ">' + data[x].nama_poli + '</td>';
cols += '<td class="tdCenterText bgtd1 ">' + data[x].kode_poli + '</td>';
cols += '<td class="tdCenterText bgtd1 ">' + data[x].deskripsi_poli + '</td>';
cols += '<td class="tdCenterText bgtd1 ">' + data[x].image_poli + '</td>';
cols += '<td class="tdCenterText bgtd1 "> <div class="text-center" ><span style="padding: 7px;" class="btn btn-success btn-xs" data-toggle="modal" data-target="#editData" onClick="loadedit(' + data[x].id_poli + ')">Edit</span> <span style="padding: 7px;"class="btn btn-danger btn-xs" onclick="Delete(' + data[x].id_poli + ')">Delete</span></div></td>';
cols += '</tr>'
//newRow.append(cols);
$("#tablepoli").append(cols);
counter++;
......@@ -54,10 +56,11 @@ function Loadpoli() {
paging: true,
columnDefs: [
{ width: 30, targets: 0 },
{ width: 170, targets: 1 },
{ width: 170, targets: 2 },
{ width: 290, targets: 3 },
{ width: 120, targets: 4 },
{ width: 120, targets: 1 },
{ width: 120, targets: 2 },
{ width: 250, targets: 3 },
{ width: 100, targets: 4 },
{ width: 120, targets: 5 },
],
});
......@@ -70,10 +73,13 @@ function Loadpoli() {
$('#tambah').on('click', function (e) {
e.preventDefault();
let nama_poli = $('#nama_poli').val();
let kode_poli = $('#kode_poli').val();
let deskripsi_poli = $('#deskripsi_poli').val();
const fileupload = $('#gambar_poli').prop('files')[0];
// console.log(fileupload.name)
if (nama_poli == null || nama_poli == "") {
bootbox.alert({ message: 'Nama poli tidak boleh kosong', centerVertical: true });
......@@ -87,299 +93,397 @@ $('#tambah').on('click', function (e) {
bootbox.alert({ message: 'Deskripsi poli tidak boleh kosong', centerVertical: true });
return false;
}
else if (validasipoli(nama_poli, kode_poli) == 1) {
else if (fileupload == null || fileupload == "") {
bootbox.alert({ message: ' Gambar tidak boleh kosong', centerVertical: true });
return false;
}
else if (kode_poli.toString().length > 5) {
bootbox.alert({ message: 'Kode Poli tidak boleh lebih dari 5 angka', centerVertical: true });
return false;
}
else if (validasipoli(nama_poli, kode_poli, deskripsi_poli, fileupload) == 1) {
bootbox.alert({ message: 'Nama poli sudah ada!', centerVertical: true });
}
else if (validasipoli(nama_poli, kode_poli) == 2) {
bootbox.alert({ message: 'Kode poli sudah ada', centerVertical: true });
else if (validasipoli(nama_poli, kode_poli, deskripsi_poli, fileupload) == 2) {
bootbox.alert({ message: 'Kode poli sudah ada!', centerVertical: true });
}
else if (validasipoli(nama_poli, kode_poli, deskripsi_poli, fileupload) == 3) {
bootbox.alert({ message: 'Deskripsi Poli sudah ada!', centerVertical: true });
}
else if (validasipoli(nama_poli, kode_poli, deskripsi_poli, fileupload.name) == 4) {
bootbox.alert({ message: 'Gambar Poli sudah ada!', centerVertical: true });
}
else if (validasigambar() == 1) {
bootbox.alert({ message: 'Harus berupa gambar', centerVertical: true });
} else {
savedatapoli();
}
})
function savedatapoli() {
let nama_poli = $('#nama_poli').val();
let kode_poli = $('#kode_poli').val();
let deskripsi_poli = $('#deskripsi_poli').val();
const fileupload = $('#gambar_poli').prop('files')[0];
let formData = new FormData();
formData.append('inama_poli', nama_poli);
formData.append('ikode_poli', kode_poli);
formData.append('ideskripsi_poli', deskripsi_poli);
formData.append('fileupload', fileupload); // set file ke tipe data binary
function savedatapoli() {
let nama_poli = $('#nama_poli').val();
let kode_poli = $('#kode_poli').val();
let deskripsi_poli = $('#deskripsi_poli').val();
const fileupload = $('#gambar_poli').prop('files')[0];
let formData = new FormData();
formData.append('inama_poli', nama_poli);
formData.append('ikode_poli', kode_poli);
formData.append('ideskripsi_poli', deskripsi_poli);
formData.append('fileupload', fileupload); // set file ke tipe data binary
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/savekelolapoli',
data:
// inama_poli: nama_poli,
// ikode_poli: kode_poli,
// ideskripsi_poli: deskripsi_poli,
formData,
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/savekelolapoli',
data: formData,
cache: false,
processData: false,
contentType: false,
cache: false,
processData: false,
contentType: false,
success: function (response) {
success: function (response) {
if (response['code'] == 0) {
$('#addData').modal('hide');
if (response['code'] == 0) {
swal({
title: "",
text: "Data Berhasil Ditambahkan!",
icon: "succes",
button: "ok",
}, function () {
location.reload();
});
swal({
title: "",
text: "Data Berhasil Ditambahkan!",
icon: "succes",
button: "ok",
}, function () {
location.reload();
});
} else {
swal({
title: "",
text: "Data Gagal Ditambahkan!",
icon: "succes",
button: "ok",
});
}
},
error: function (xhr) {
} else {
swal({
title: "",
text: "Data Gagal Ditambahkan!",
icon: "succes",
button: "ok",
});
}
},
error: function (xhr) {
if (xhr.status != 200) {
//bootbox.alert(xhr.status + "-" + xhr.statusText + " <br>Silahkan coba kembali :) ");
} else {
alert('gagal error');
}
if (xhr.status != 200) {
//bootbox.alert(xhr.status + "-" + xhr.statusText + " <br>Silahkan coba kembali :) ");
} else {
alert('gagal error');
}
}
});
});
}
function validasigambar() {
var exist = 0;
let inputString = $('#gambar_poli').val();
let inputStringedt = $('#gambar_poliedt').val();
var imageReg = /[\/.](gif|jpg|jpeg|tiff|png)$/i;
if (!imageReg.test(inputString)) {
// bootbox.alert({ message: 'Harus berupa gambar', centerVertical: true });
exist = 1;
}
if (!imageReg.test(inputStringedt)) {
// bootbox.alert({ message: 'Harus berupa gambar', centerVertical: true });
exist = 2;
}
return exist;
}
function validasipoli(nama_poli, kode_poli) {
function validasipoli(nama_poli, kode_poli, deskripsi_poli, fileupload) {
var exist = 0;
var exist = 0;
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadkelolapoli',
async: false,
data: {
id: null,
},
success: function (result) {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadkelolapoli',
async: false,
data: {
id: null,
},
success: function (result) {
var data = result.data;
var data = result.data;
console.log(data)
var counter = 0;
for (x in data) {
if (nama_poli == data[x]['nama_poli']) {
exist = 1;
for (x in data) {
if (nama_poli == data[x]['nama_poli']) {
exist = 1;
}
if (kode_poli == data[x]['kode_poli']) {
exist = 2;
}
if (deskripsi_poli == data[x]['deskripsi_poli']) {
exist = 3;
}
if (fileupload == data[x]['image_poli']) {
exist = 4;
}
if (nama_poli == data[x]['nama_poli']) {
counter += 1;
if (counter > 1) {
exist = 5;
}
}
if (kode_poli == data[x]['kode_poli']) {
counter += 1;
if (counter > 1) {
exist = 6;
}
if (kode_poli == data[x]['kode_poli']) {
exist = 2;
}
if (deskripsi_poli == data[x]['deskripsi_poli']) {
counter += 1;
if (counter > 1) {
exist = 7;
}
}
if (fileupload == data[x]['image_poli']) {
counter += 1;
if (counter > 1) {
exist = 8;
}
}
}
},
error: function (xhr) {
//alert(xhr.status+'-'+xhr.statusText);
}
});
return exist;
},
}
error: function (xhr) {
//alert(xhr.status+'-'+xhr.statusText);
}
});
return exist;
}
$('#edit').on('click', function () {
let id_poli = $('#id_poli').val();
let nama_poli = $('#nama_poliEdt').val();
let kode_poli = $('#kode_poliEdt').val();
let deskripsi_poli = $('#deskripsi_poliEdt').val();
if (nama_poli == null || nama_poli == "") {
bootbox.alert({ message: 'Nama poli tidak boleh kosong', centerVertical: true });
return false;
}
else if (kode_poli == null || kode_poli == "") {
bootbox.alert({ message: 'Kode poli tidak boleh kosong', centerVertical: true });
return false;
}
else if (deskripsi_poli == null || deskripsi_poli == "") {
bootbox.alert({ message: 'Deskripsi poli tidak boleh kosong', centerVertical: true });
return false;
}
else if (validasipoli(nama_poli, kode_poli) == 1) {
bootbox.alert({ message: 'Nama poli harus berbeda!', centerVertical: true });
}
else if (validasipoli(nama_poli, kode_poli) == 2) {
bootbox.alert({ message: 'Kode poli harus berbeda!', centerVertical: true });
} else {
editdatapoli(id_poli)
}
$('#edit').on('click', function () {
let id_poli = $('#id_poli').val();
let nama_poli = $('#nama_poliEdt').val();
let kode_poli = $('#kode_poliEdt').val();
let deskripsi_poli = $('#deskripsi_poliEdt').val();
const fileupload = $('#gambar_poliedt').prop('files')[0];
})
function editdatapoli(id_poli) {
let nama_poli = $('#nama_poliEdt').val();
let kode_poli = $('#kode_poliEdt').val();
let deskripsi_poli = $('#deskripsi_poliEdt').val();
// let image = $('#kode_poli').val();
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/editkelolapoli',
async: false,
data: {
id: id_poli,
inama_poli: nama_poli,
ikode_poli: kode_poli,
ideskripsi_poli: deskripsi_poli,
},
if (nama_poli == null || nama_poli == "") {
bootbox.alert({ message: 'Nama poli tidak boleh kosong', centerVertical: true });
return false;
}
else if (kode_poli == null || kode_poli == "") {
bootbox.alert({ message: 'Kode poli tidak boleh kosong', centerVertical: true });
return false;
}
else if (deskripsi_poli == null || deskripsi_poli == "") {
bootbox.alert({ message: 'Deskripsi poli tidak boleh kosong', centerVertical: true });
return false;
}
else if (fileupload == null) {
bootbox.alert({ message: ' Gambar tidak boleh kosong', centerVertical: true });
return false;
}
else if (kode_poli.toString().length > 5) {
bootbox.alert({ message: 'Kode Poli tidak boleh lebih dari 5 angka', centerVertical: true });
return false;
}
else if (validasipoli(nama_poli, kode_poli, deskripsi_poli, fileupload) == 5) {
bootbox.alert({ message: 'Nama poli harus berbeda!', centerVertical: true });
}
else if (validasipoli(nama_poli, kode_poli, deskripsi_poli, fileupload) == 6) {
bootbox.alert({ message: 'Kode poli harus berbeda!', centerVertical: true });
}
else if (validasipoli(nama_poli, kode_poli, deskripsi_poli, fileupload) == 7) {
bootbox.alert({ message: 'Deskripsi Poli harus berbeda!', centerVertical: true });
}
else if (validasipoli(nama_poli, kode_poli, deskripsi_poli, fileupload.name) == 8) {
bootbox.alert({ message: 'Gambar Poli harus berbeda!', centerVertical: true });
}
else if (validasigambar() == 2) {
bootbox.alert({ message: 'Harus berupa gambar', centerVertical: true });
} else {
editdatapoli(id_poli)
success: function (response) {
//console.log(respoonse);
if (response['code'] == 0) {
swal({
title: "",
text: "Data Berhasil DiUbah!",
icon: "succes",
button: "ok",
}, function () {
location.reload();
});
}
} else {
swal({
title: "",
text: "Data Gagal Ditambahkan!",
icon: "succes",
button: "ok",
});
})
function editdatapoli(id_poli) {
let nama_poli = $('#nama_poliEdt').val();
let kode_poli = $('#kode_poliEdt').val();
let deskripsi_poli = $('#deskripsi_poliEdt').val();
const fileupload = $('#gambar_poliedt').prop('files')[0];
let formData = new FormData();
formData.append('id_poli', id_poli);
// console.log(fileuploadedt)
formData.append('inama_poli', nama_poli);
formData.append('ikode_poli', kode_poli);
formData.append('ideskripsi_poli', deskripsi_poli);
formData.append('fileupload', fileupload); // set file ke tipe data binary
}
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/editkelolapoli',
async: false,
data: formData,
cache: false,
processData: false,
contentType: false,
success: function (response) {
},
error: function (xhr) {
if (response['code'] == 0) {
$('#editData').modal('hide');
swal({
title: "",
text: "Data Berhasil DiUbah!",
icon: "succes",
button: "ok",
}, function () {
location.reload();
});
} else {
swal({
title: "",
text: "Data Gagal Ditambahkan!",
icon: "succes",
button: "ok",
});
if (xhr.status != 200) {
//bootbox.alert(xhr.status + "-" + xhr.statusText + " <br>Silahkan coba kembali :) ");
} else {
alert('gagal error');
}
}
});
}
},
error: function (xhr) {
if (xhr.status != 200) {
//bootbox.alert(xhr.status + "-" + xhr.statusText + " <br>Silahkan coba kembali :) ");
} else {
alert('gagal error');
}
}
function loadedit(param) {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadkelolapoli',
data: {
id: param,
},
success: function (result) {
// console.log(result);
// $('.loaddata').empty();
// console.log(result);
});
}
function loadedit(param) {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadkelolapoli',
data: {
id: param,
},
success: function (result) {
// console.log(result);
// $('.loaddata').empty();
if (result.code == 0) {
let data = result.data;
if (result.code == 0) {
$('#id_poli').val(data[0].id_poli);
$('#nama_poliEdt').val(data[0].nama_poli);
$('#nama_poli2').val(data[0].nama_poli);
$('#kode_poliEdt').val(data[0].kode_poli);
$('#deskripsi_poliEdt').val(data[0].deskripsi_poli);
let data = result.data;
console.log(data);
} else {
alert(result.info);
}
},
error: function (xhr) {
alert(xhr.status + '-' + xhr.statusText);
$('#id_poli').val(data[0].id_poli);
$('#nama_poliEdt').val(data[0].nama_poli);
$('#nama_poli2').val(data[0].nama_poli);
$('#kode_poliEdt').val(data[0].kode_poli);
$('#deskripsi_poliEdt').val(data[0].deskripsi_poli);
} else {
alert(result.info);
}
});
}
},
error: function (xhr) {
alert(xhr.status + '-' + xhr.statusText);
}
});
}
function Delete(param) {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadkelolapoli',
data: {
id: param,
function Delete(param) {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadkelolapoli',
data: {
id: param,
},
success: function (result) {
// console.log(result.data[0].nama_poli);
let nama_poli = result.data[0].nama_poli;
swal({
title: "Apakah yakin mengahapus poli '" + nama_poli + "'? \nJika anda menghapus Poli ini \nmaka Dokter Dan Ruangan \ndengan nama poli '" + nama_poli + "' akan terhapus",
type: "error",
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes!",
showCancelButton: true,
},
success: function (result) {
// console.log(result.data[0].nama_poli);
let nama_poli = result.data[0].nama_poli;
swal({
title: "Apakah yakin mengahapus poli '" + nama_poli + "'? \nJika anda menghapus Poli ini \nmaka Dokter Dan Ruangan \ndengan nama poli '" + nama_poli + "' akan terhapus",
type: "error",
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes!",
showCancelButton: true,
},
function () {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/deletekelolapoli',
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 {
swal({
title: "",
text: "Data Gagal Dihapus!",
icon: "succes",
button: "ok",
});
}
},
error: function (xhr) {
alert(xhr.status + '-' + xhr.statusText);
function () {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/deletekelolapoli',
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 {
swal({
title: "",
text: "Data Gagal Dihapus!",
icon: "succes",
button: "ok",
});
}
});
},
function () {
// This function will run if the user clicked "cancel"
window.location.href = "<?php echo Yii::$app->request->baseUrl;?>/todo/index/";
}
);
},
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/";
}
);
}
});
}
});
}
}
......@@ -127,7 +127,6 @@ $('#tambah').on('click', function () {
let nama_ruang = $('#nama_ruang').val();
let lantai = $('#lantai').val();
if (nama_ruang == null || nama_ruang == "") {
bootbox.alert({ message: 'Nama Ruang tidak boleh kosong', centerVertical: true });
return false;
......@@ -136,7 +135,10 @@ $('#tambah').on('click', function () {
bootbox.alert({ message: 'Lantai tidak boleh kosong', centerVertical: true });
return false;
}
else if (validasiruang(lantai, nama_ruang) == 1) {
else if (validasiruang(lantai, nama_ruang) == 3) {
bootbox.alert({ message: 'Nama ruang dan lantai sudah ada!', centerVertical: true });
}
else if (validasiruang(lantai, nama_ruang) == 2) {
bootbox.alert({ message: 'Nama ruang dan lantai sudah ada!', centerVertical: true });
}
else {
......@@ -170,6 +172,7 @@ function saveruang() {
if (result['code'] == 0) {
$('#addData').modal('hide');
swal({
title: "",
text: "Data Berhasil Ditambahkan!",
......@@ -201,7 +204,7 @@ function saveruang() {
});
}
// validasiruang()
function validasiruang(lantai, nama_ruang) {
var exist = 0;
......@@ -221,23 +224,30 @@ function validasiruang(lantai, nama_ruang) {
var ruangcounter = 0
for (x in data) {
// if (lantai == data[x]['lantai']) {
// if (nama_ruang == data[x]['nama_ruang']) {
// }
// }
if (lantai == data[x]['lantai']) {
if (lantai == data[x]['lantai']) {
if (nama_ruang == data[x]['nama_ruang']) {
exist = 1;
}
if (nama_ruang == data[x]['nama_ruang']) {
exist = 2;
}
}
if (lantai == data[x]['lantai']) {
if (nama_ruang == data[x]['nama_ruang']) {
ruangcounter += 1;
if (ruangcounter > 1) {
exist = 2;
exist = 3;
}
}
}
}
......@@ -267,7 +277,7 @@ $('#edit').on('click', function () {
else if (lantai == null || lantai == "") {
bootbox.alert({ message: 'Lantai tidak boleh kosong', centerVertical: true });
return false;
} else if (validasiruang(lantai, nama_ruang) == 2) {
} else if (validasiruang(lantai, nama_ruang) == 3) {
bootbox.alert({ message: 'Nama ruang dan lantai harus berbeda!', centerVertical: true });
} else {
editdataruang(id_ruang)
......@@ -297,6 +307,8 @@ function editdataruang(id_ruang) {
//console.log(respoonse);
if (response['code'] == 0) {
$('#Editdata').modal('hide');
swal({
title: "",
text: "Data Berhasil DiUbah!",
......@@ -454,8 +466,8 @@ function Delete(param) {
});
}
},
error: function (xhr) {
alert(xhr.status + '-' + xhr.statusTexDa);
error: function () {
bootbox.alert({ message: 'Data ruang masih terdaftar dalam poli ', centerVertical: true });
}
});
},
......
......@@ -234,15 +234,16 @@ function LoadDadta(id) {
}
$('#tambah').on('click', function () {
SaveDataRegister()
})
function SaveDataRegister(param) {
......@@ -255,7 +256,126 @@ function SaveDataRegister(param) {
let antrian_akhir = $('#antrian_akhir').val();
let waktu_antrian = $('#waktu_antrian').val();
let jam_mulai = $('#jam_mulai').val();
if (ruang == null || ruang == "") {
swal({
title: "",
text: "Field ruang is empty!",
icon: "error",
button: "ok",
});
return false;
} else if (antrian_all == null || antrian_all == "") {
swal({
title: "",
text: "Field antrian seluruh is empty!",
icon: "error",
button: "ok",
});
return false;
} else if (antrian_awal == null || antrian_awal == "") {
swal({
title: "",
text: "Field antrian awal is empty!",
icon: "error",
button: "ok",
});
return false;
} else if (antrian_akhir == null || antrian_akhir == "") {
swal({
title: "",
text: "Field antrian akhir is empty!",
icon: "error",
button: "ok",
});
return false;
} else if (waktu_antrian == null || waktu_antrian == "") {
swal({
title: "",
text: "Field waktu antrian is empty!",
icon: "error",
button: "ok",
});
return false;
}
else if (poli == null || poli == "") {
swal({
title: "",
text: "Field poli is empty!",
icon: "error",
button: "ok",
});
return false;
}
else if (dokter == null || dokter == "") {
swal({
title: "",
text: "Field dokter is empty!",
icon: "error",
button: "ok",
});
return false;
} else if (parseInt(antrian_akhir) < parseInt(antrian_awal)) {
if (parseInt(antrian_akhir) < parseInt(antrian_awal)) {
swal({
title: "",
text: "antrian awal tidak boleh lebih besar dari antrian akhir!",
icon: "error",
button: "ok",
});
return false;
} else if (parseInt(antrian_akhir) > parseInt(antrian_all)) {
swal({
title: "",
text: "antrian akhir tidak boleh lebih besar dari antrian seluruh!",
icon: "error",
button: "ok",
});
return false;
}
} else if (parseInt(antrian_akhir) > parseInt(antrian_all)) {
swal({
title: "",
text: "antrian akhir tidak boleh lebih besar dari antrian all!",
icon: "error",
button: "ok",
});
return false;
} else if (parseInt(antrian_awal) == parseInt(antrian_akhir)) {
swal({
title: "",
text: "antrian akhir tidak boleh sama dengan antrian awal!",
icon: "error",
button: "ok",
});
return false;
}
else if (parseInt(antrian_all) > 30) {
swal({
title: "",
text: "antrian seluruh tidak boleh lebih dari 30!",
icon: "error",
button: "ok",
});
return false;
} else if (parseInt(waktu_antrian) > 10) {
swal({
title: "",
text: "waktu antrian per orang tidak lebih dari 10 menit",
icon: "error",
button: "ok",
});
return false;
}
else if (parseInt(antrian_awal) < 5) {
swal({
title: "",
text: "antrian mobile dimulai dari 5! ",
icon: "error",
button: "ok",
});
return false;
}
/* save data */
$.ajax({
......@@ -276,136 +396,19 @@ function SaveDataRegister(param) {
},
success: function (result) {
if (ruang == null || ruang == "") {
swal({
title: "",
text: "Field ruang is empty!",
icon: "error",
button: "ok",
});
return false;
} else if (antrian_all == null || antrian_all == "") {
swal({
title: "",
text: "Field antrian seluruh is empty!",
icon: "error",
button: "ok",
});
return false;
} else if (antrian_awal == null || antrian_awal == "") {
swal({
title: "",
text: "Field antrian awal is empty!",
icon: "error",
button: "ok",
});
return false;
} else if (antrian_akhir == null || antrian_akhir == "") {
swal({
title: "",
text: "Field antrian akhir is empty!",
icon: "error",
button: "ok",
});
return false;
} else if (waktu_antrian == null || waktu_antrian == "") {
swal({
title: "",
text: "Field waktu antrian is empty!",
icon: "error",
button: "ok",
});
return false;
}
else if (poli == null || poli == "") {
swal({
title: "",
text: "Field poli is empty!",
icon: "error",
button: "ok",
});
return false;
}
else if (dokter == null || dokter == "") {
swal({
title: "",
text: "Field dokter is empty!",
icon: "error",
button: "ok",
});
return false;
} else if (parseInt(antrian_akhir) < parseInt(antrian_awal)) {
if (parseInt(antrian_akhir) < parseInt(antrian_awal)) {
swal({
title: "",
text: "antrian awal tidak boleh lebih besar dari antrian akhir!",
icon: "error",
button: "ok",
});
return false;
} else if (parseInt(antrian_akhir) > parseInt(antrian_all)) {
swal({
title: "",
text: "antrian akhir tidak boleh lebih besar dari antrian seluruh!",
icon: "error",
button: "ok",
});
return false;
}
} else if (parseInt(antrian_akhir) > parseInt(antrian_all)) {
swal({
title: "",
text: "antrian akhir tidak boleh lebih besar dari antrian all!",
icon: "error",
button: "ok",
});
return false;
} else if (parseInt(antrian_awal) == parseInt(antrian_akhir)) {
swal({
title: "",
text: "antrian akhir tidak boleh sama dengan antrian awal!",
icon: "error",
button: "ok",
});
return false;
}
else if (parseInt(antrian_all) > 30) {
swal({
title: "",
text: "antrian seluruh tidak boleh lebih dari 30!",
icon: "error",
button: "ok",
});
return false;
} else if (parseInt(waktu_antrian) > 10) {
swal({
title: "",
text: "waktu antrian per orang tidak lebih dari 10 menit",
icon: "error",
button: "ok",
});
return false;
}
else if (parseInt(antrian_awal) < 5) {
swal({
title: "",
text: "antrian mobile dimulai dari 5! ",
icon: "error",
button: "ok",
});
return false;
}
else if (result.code == 0) {
if (result.code == 0) {
$('#addData').modal('hide');
swal({
title: "<span style='color:#222'>Good Job!</span>",
confirmButtonColor: "#66BB6A",
html: true,
type: "success"
}, function () {
location.reload();
});
// loadpoli();
......@@ -439,12 +442,10 @@ function SaveDataRegister(param) {
$('#edit').on('click', function () {
let id_register = $('#id_register').val();
// if (validasieditnama() == true) {
// alert("Nama Poli Harus Berbeda!")
// } else {
editregister(id_register)
// }
})
......@@ -459,8 +460,129 @@ function editregister(id_register) {
let waktu_antrian = $('#waktu_antrianedt').val();
let jam_mulai = $('#jam_mulaiedt').val();
// if (ruang == null || ruang == "") {
// swal({
// title: "",
// text: "Field ruang is empty!",
// icon: "error",
// button: "ok",
// });
// return false;
// }
if (antrian_all == null || antrian_all == "") {
swal({
title: "",
text: "Field antrian seluruh is empty!",
icon: "error",
button: "ok",
});
return false;
} else if (antrian_awal == null || antrian_awal == "") {
swal({
title: "",
text: "Field antrian awal is empty!",
icon: "error",
button: "ok",
});
return false;
} else if (antrian_akhir == null || antrian_akhir == "") {
swal({
title: "",
text: "Field antrian akhir is empty!",
icon: "error",
button: "ok",
});
return false;
} else if (waktu_antrian == null || waktu_antrian == "") {
swal({
title: "",
text: "Field waktu antrian is empty!",
icon: "error",
button: "ok",
});
return false;
}
// else if (poli == null || poli == "") {
// swal({
// title: "",
// text: "Field poli is empty!",
// icon: "error",
// button: "ok",
// });
// return false;
// }
// else if (dokter == null || dokter == "") {
// swal({
// title: "",
// text: "Field dokter is empty!",
// icon: "error",
// button: "ok",
// });
// return false;
// }
else if (parseInt(antrian_akhir) < parseInt(antrian_awal)) {
if (parseInt(antrian_akhir) < parseInt(antrian_awal)) {
swal({
title: "",
text: "antrian awal tidak boleh lebih besar dari antrian akhir!",
icon: "error",
button: "ok",
});
return false;
} else if (parseInt(antrian_akhir) > parseInt(antrian_all)) {
swal({
title: "",
text: "antrian akhir tidak boleh lebih besar dari antrian seluruh!",
icon: "error",
button: "ok",
});
return false;
}
} else if (parseInt(antrian_akhir) > parseInt(antrian_all)) {
swal({
title: "",
text: "antrian akhir tidak boleh lebih besar dari antrian all!",
icon: "error",
button: "ok",
});
return false;
} else if (parseInt(antrian_awal) == parseInt(antrian_akhir)) {
swal({
title: "",
text: "antrian akhir tidak boleh sama dengan antrian awal!",
icon: "error",
button: "ok",
});
return false;
}
else if (parseInt(antrian_all) > 30) {
swal({
title: "",
text: "antrian seluruh tidak boleh lebih dari 30!",
icon: "error",
button: "ok",
});
return false;
} else if (parseInt(waktu_antrian) > 10) {
swal({
title: "",
text: "waktu antrian per orang tidak lebih dari 10 menit",
icon: "error",
button: "ok",
});
return false;
}
else if (parseInt(antrian_awal) < 5) {
swal({
title: "",
text: "antrian mobile dimulai dari 5! ",
icon: "error",
button: "ok",
});
return false;
}
// let image = $('#kode_poli').val();
$.ajax({
type: 'POST',
......@@ -469,7 +591,7 @@ function editregister(id_register) {
async: false,
data: {
id: id_register,
ipoli :poli,
ipoli: poli,
idokter: dokter,
iruang: ruang,
iantrial_all: antrian_all,
......@@ -482,20 +604,18 @@ function editregister(id_register) {
success: function (response) {
console.log(response);
if (response['code'] == 0) {
$('#editData').modal('hide');
swal({
title: "",
text: "Data Berhasil DiUbah!",
icon: "succes",
button: "ok",
},
function () {
location.reload();
});
},
function () {
location.reload();
});
//
//window.onload
//location.reload()
} else {
......
......@@ -39,34 +39,34 @@ input:hover, input:focus {
/* line 18, ../../01 cl html template/03_jun 2019/182_medico_html/sass/_common.scss */
.section_padding {
padding: 140px 0px;
padding: 50px 0px;
}
@media only screen and (min-width: 992px) and (max-width: 1200px) {
/* line 18, ../../01 cl html template/03_jun 2019/182_medico_html/sass/_common.scss */
.section_padding {
padding: 80px 0px;
padding: 40px 0px;
}
}
@media only screen and (min-width: 768px) and (max-width: 991px) {
/* line 18, ../../01 cl html template/03_jun 2019/182_medico_html/sass/_common.scss */
.section_padding {
padding: 70px 0px;
padding: 30px 0px;
}
}
@media (max-width: 576px) {
/* line 18, ../../01 cl html template/03_jun 2019/182_medico_html/sass/_common.scss */
.section_padding {
padding: 70px 0px;
padding: 30px 0px;
}
}
@media only screen and (min-width: 576px) and (max-width: 767px) {
/* line 18, ../../01 cl html template/03_jun 2019/182_medico_html/sass/_common.scss */
.section_padding {
padding: 70px 0px;
padding: 30px 0px;
}
}
......
......@@ -3,75 +3,57 @@ Chart.defaults.global.defaultFontFamily = 'Nunito', '-apple-system,system-ui,Bli
Chart.defaults.global.defaultFontColor = '#858796';
// Pie Chart Example
var ctx = document.getElementById("myPieChart");
var myPieChart = new Chart(ctx, {
type: 'doughnut',
data: {
labels: ["Direct", "Referral", "Social"],
datasets: [{
data: [55, 30, 15],
backgroundColor: ['#4e73df', '#1cc88a', '#36b9cc'],
hoverBackgroundColor: ['#2e59d9', '#17a673', '#2c9faf'],
hoverBorderColor: "rgba(234, 236, 244, 1)",
}],
},
options: {
maintainAspectRatio: false,
tooltips: {
backgroundColor: "rgb(255,255,255)",
bodyFontColor: "#858796",
borderColor: '#dddfeb',
borderWidth: 1,
xPadding: 15,
yPadding: 15,
displayColors: false,
caretPadding: 10,
},
legend: {
display: false
},
cutoutPercentage: 80,
},
});
loadpoli()
function loadpoli() {
// var ctx = document.getElementById("myPieChart");
// var myPieChart = new Chart(ctx, {
// type: 'doughnut',
// data: {
// labels: ["Direct", "Referral", "Social"],
// datasets: [{
// data: [55, 30, 15],
// backgroundColor: ['#4e73df', '#1cc88a', '#36b9cc'],
// hoverBackgroundColor: ['#2e59d9', '#17a673', '#2c9faf'],
// hoverBorderColor: "rgba(234, 236, 244, 1)",
// }],
// },
// options: {
// maintainAspectRatio: false,
// tooltips: {
// backgroundColor: "rgb(255,255,255)",
// bodyFontColor: "#858796",
// borderColor: '#dddfeb',
// borderWidth: 1,
// xPadding: 15,
// yPadding: 15,
// displayColors: false,
// caretPadding: 10,
// },
// legend: {
// display: false
// },
// cutoutPercentage: 80,
// },
// });
jumlahantrian()
function jumlahantrian() {
var id = document.getElementById("myPieChart");
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadRegisterpoli',
url: baseURL + '/api/loadtotalantrian',
success: function (result) {
if (result['code'] == 0) {
//console.log (result);
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>Pilih</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id_poli + '">' + res[i].nama_poli + '</option>';
}
$("select#poli").html(optionseg);
} else {
bootbox.dialog({
message: "<span class='bigger-110'>" + result['info'] + "</span>",
buttons:
{
"OK":
{
"label": "<i class='icon-ok'></i> OK ",
"className": "btn-sm btn-danger",
"callback": function () {
notifyCancel('ERROR: ' + result['info'] + '. Bila ada kesulitan dimohon untuk menghubungi Admin terkait');
}
}
}
});
}
success: function (result) {
console.log(result)
}
});
}
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