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 { ...@@ -76,8 +76,9 @@ class ApiController extends \Application\Master\GlobalActionController {
$no_hp = $post->ino_hp; $no_hp = $post->ino_hp;
$ktp = $post->iktp; $ktp = $post->iktp;
$no_antrian = $post->ino_antrian; $no_antrian = $post->ino_antrian;
$norm = $post->inorm;
$dataArrayPasien = array (
$dataArrayPasien = array (
'id_pasien' => $idpasien, 'id_pasien' => $idpasien,
'create_date' => gmdate("Y-m-d H:i:s", time()+60*60*7), 'create_date' => gmdate("Y-m-d H:i:s", time()+60*60*7),
'nama' => $nama, 'nama' => $nama,
...@@ -86,9 +87,9 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -86,9 +87,9 @@ class ApiController extends \Application\Master\GlobalActionController {
'alamat' => $alamat, 'alamat' => $alamat,
'no_hp' => $no_hp, 'no_hp' => $no_hp,
'ktp' => $ktp, 'ktp' => $ktp,
'no_rekam_medis' => $norm
); );
$param->saveGlobal( $dataArrayPasien, $table_pasien); $param->saveGlobal( $dataArrayPasien, $table_pasien);
...@@ -142,14 +143,13 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -142,14 +143,13 @@ class ApiController extends \Application\Master\GlobalActionController {
$ktp = $post->iktp; $ktp = $post->iktp;
$cekpasien = $test->cekpasien($no_rekam_medis); $cekpasien = $test->cekpasien($no_rekam_medis);
$validasi = $test->cekktp($no_rekam_medis, $ktp);
$array = array( $array = array(
'validasiinput' => $validasi->code,
'datapasien'=> $cekpasien->data 'datapasien'=> $cekpasien->data
); );
// print_r($no_rekam_medis) ;die; // print_r( $cekpasien) ;die;
if($cekpasien->code == 0){ if($cekpasien->code == 0){
$result->code = $result::CODE_SUCCESS; $result->code = $result::CODE_SUCCESS;
...@@ -670,15 +670,6 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -670,15 +670,6 @@ class ApiController extends \Application\Master\GlobalActionController {
}else{ }else{
$result->info = 'File tidak boleh kosong'; $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) { }catch (\Exception $exc) {
...@@ -705,29 +696,58 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -705,29 +696,58 @@ class ApiController extends \Application\Master\GlobalActionController {
$param = new \Application\Model\Param($storage); $param = new \Application\Model\Param($storage);
try{ try{
$id_poli = $post->id; $fileupload = $_FILES['fileupload']['tmp_name'];
$id_poli = $post->id_poli;
$nama_poli = $post->inama_poli; $nama_poli = $post->inama_poli;
$kode_poli = $post->ikode_poli; $kode_poli = $post->ikode_poli;
$deskripsi_poli = $post->ideskripsi_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, $alamatfile = $uploaddir.$ImageName;
'kode_poli' =>$kode_poli,
'deskripsi_poli'=>$deskripsi_poli, 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_poli);
$load = $param->loadkelolapoli($post->id); $table_poli = 'poli';
// print_r($load);die; $where = 'id_poli='.$id_poli;
$table_poli= 'poli';
$where = 'id_poli='.$id_poli;
// print_r ($where);die; $param->updateGlobal($table_poli, $dataArrayPoli, $where);
$param->updateGlobal($table_poli, $dataArrayPoli, $where);
$result->code = 0;
$result->code = 0; $result->info = 'ok';
$result->info = 'ok'; $result->data = $load->data;
$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) { }catch (\Exception $exc) {
$result = new Result(0,1,$exc->getMessage() .'-'.$exc->getTraceAsString()); $result = new Result(0,1,$exc->getMessage() .'-'.$exc->getTraceAsString());
...@@ -814,39 +834,73 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -814,39 +834,73 @@ class ApiController extends \Application\Master\GlobalActionController {
try{ try{
$fileupload = $_FILES['fileupload']['tmp_name'];
$nama_dokter = $post->inama_dokter; $nama_dokter = $post->inama_dokter;
$kode_dokter = $post->ikode_dokter; $kode_dokter = $post->ikode_dokter;
$poli = $post->ipoli; $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, $uploaddir = './public/tamplate/img/doctor/'; // directory file
'id_poli' =>$poli,
'id_condition' => 1,
'create_date' => gmdate("Y-m-d H:i:s", time()+60*60*7), $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) { }catch (\Exception $exc) {
...@@ -872,46 +926,80 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -872,46 +926,80 @@ class ApiController extends \Application\Master\GlobalActionController {
$param = new \Application\Model\Param($storage); $param = new \Application\Model\Param($storage);
try{ try{
$id_dokter = $post->id;
$nama_dokter = $post->inama_dokter;
$kode_dokter = $post->ikode_dokter; $fileupload = $_FILES['fileupload']['tmp_name'];
$poli = $post->ipoli; $id_dokter = $post->id_dokter;
$condition = $post->icondition; // print_r($id_dokter);die;
$nama_dokter = $post->inama_dokter;
$kode_dokter = $post->ikode_dokter;
$poli = $post->ipoli;
$condition = $post->icondition;
$DokterPoli = array ( if (!empty($fileupload)){
$ImageName = $_FILES['fileupload']['name'];
'nama_dokter' => $nama_dokter, $tipes = $_FILES['fileupload']['type'];
'kode_dokter' =>$kode_dokter, $size = $_FILES['fileupload']['size'];
'id_poli' =>$poli,
'id_condition' =>$condition,
$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; $Dokter = array (
$table_dokter= 'dokter';
$where = 'id_dokter='.$id_dokter; 'nama_dokter' => $nama_dokter,
// print_r ($where);die; 'kode_dokter' =>$kode_dokter,
$param->updateGlobal($table_dokter, $Dokter, $where); 'image_dokter' => $ImageName,
$result->code = 0; );
$result->info = 'ok';
$result->data = $load->data; $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) { }catch (\Exception $exc) {
$result = new Result(0,1,$exc->getMessage() .'-'.$exc->getTraceAsString()); $result = new Result(0,1,$exc->getMessage() .'-'.$exc->getTraceAsString());
...@@ -1279,8 +1367,9 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -1279,8 +1367,9 @@ class ApiController extends \Application\Master\GlobalActionController {
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig()); $storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage); $test = new \Application\Model\Param($storage);
// print_r($post->id);die; // print_r($post->no_rekam_medis);die;
$load = $test->loadpasien($post->id);
$load = $test->loadpasien($post->id, $post->no_rekam_medis);
if($load->code == 0){ if($load->code == 0){
$result->code = $result::CODE_SUCCESS; $result->code = $result::CODE_SUCCESS;
...@@ -1893,6 +1982,32 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -1893,6 +1982,32 @@ class ApiController extends \Application\Master\GlobalActionController {
$result->info = 'Not Found'; $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()); return $this->getOutput($result->toJson());
} }
} }
\ No newline at end of file
...@@ -61,8 +61,8 @@ class Param extends Mapper { ...@@ -61,8 +61,8 @@ class Param extends Mapper {
$data = $this->_storage->loadUserData($id,$iddok); $data = $this->_storage->loadUserData($id,$iddok);
return $data; return $data;
} }
public function loadpasien($id = null){ public function loadpasien($id = null, $norm = null){
$data = $this->_storage->loadpasien($id); $data = $this->_storage->loadpasien($id, $norm);
return $data; return $data;
} }
public function loaddatapasien($id){ public function loaddatapasien($id){
...@@ -175,6 +175,10 @@ class Param extends Mapper { ...@@ -175,6 +175,10 @@ class Param extends Mapper {
$data = $this->_storage->loadterlayani(); $data = $this->_storage->loadterlayani();
return $data; return $data;
} }
public function loadtotalantrian(){
$data = $this->_storage->loadtotalantrian();
return $data;
}
public function tampilpoli($id = null){ public function tampilpoli($id = null){
$data = $this->_storage-> tampilpoli($id); $data = $this->_storage-> tampilpoli($id);
return $data; return $data;
......
...@@ -361,7 +361,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton { ...@@ -361,7 +361,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
return $result; return $result;
} }
public function loadpasien($id){ public function loadpasien($id = null, $norm = null){
$result = new Result(); $result = new Result();
try { try {
...@@ -370,8 +370,13 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton { ...@@ -370,8 +370,13 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
if($id){ if($id){
$sql .= " WHERE id_pasien = $id "; $sql .= " WHERE id_pasien = $id ";
} }
if($norm){
$sql .= " WHERE no_rekam_medis = '$norm'";
}
$sql .= " ORDER BY no_rekam_medis ASC"; $sql .= " ORDER BY no_rekam_medis ASC";
// print_r($sql);die;
$stmt = $this->_db->query($sql); $stmt = $this->_db->query($sql);
$resdata = $stmt->execute(); $resdata = $stmt->execute();
...@@ -509,6 +514,43 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton { ...@@ -509,6 +514,43 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
} }
return $result; 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(){ public function loadpasiendalamantrian(){
$result = new Result(); $result = new Result();
try { try {
...@@ -663,11 +705,11 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton { ...@@ -663,11 +705,11 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result(); $result = new Result();
try { 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 $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 LEFT JOIN antrian_pasien ap
ON ap.id_pasien = p.id_pasien ON ap.id_pasien = p.id_pasien
WHERE p.no_rekam_medis='$no_rekam_medis' "; WHERE p.no_rekam_medis = '$no_rekam_medis' ";
// print_r($sql);die; // print_r($sql);die;
$stmt = $this->_db->query($sql); $stmt = $this->_db->query($sql);
...@@ -1046,13 +1088,13 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton { ...@@ -1046,13 +1088,13 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result(); $result = new Result();
try { 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 $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 FROM dokter_to_poli
INNER JOIN poli INNER JOIN poli
ON dokter_to_poli.id_poli = poli.id_poli ON dokter_to_poli.id_poli = poli.id_poli
INNER JOIN condition INNER JOIN condition
ON condition.id_condition = dokter_to_poli.id_condition ON condition.id_condition = dokter_to_poli.id_condition
"; ";
if($id){ if($id){
$sql .= " Where dokter_to_poli.id_dokter = $id"; $sql .= " Where dokter_to_poli.id_dokter = $id";
......
...@@ -88,18 +88,7 @@ ...@@ -88,18 +88,7 @@
<!-- Card Header - Dropdown --> <!-- Card Header - Dropdown -->
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between"> <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> <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> </div>
<!-- Card Body --> <!-- Card Body -->
<div class="card-body"> <div class="card-body">
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<th colspan="" class=" thLeftText">Nama Dokter</th> <th colspan="" class=" thLeftText">Nama Dokter</th>
<th colspan="" class=" thLeftText">Kode Dokter</th> <th colspan="" class=" thLeftText">Kode Dokter</th>
<th colspan="" class=" thLeftText">Kondisi Dokter</th> <th colspan="" class=" thLeftText">Kondisi Dokter</th>
<th colspan="" class=" thLeftText">Gambar Dokter</th>
<th colspan="" class=" thLeftText">Action</th> <th colspan="" class=" thLeftText">Action</th>
</tr> </tr>
</thead> </thead>
...@@ -65,11 +66,10 @@ ...@@ -65,11 +66,10 @@
<input type="input" id="kode_dokter" name="kode_dokter" class="form-control" placeholder="Kode Dokter" /></input> <input type="input" id="kode_dokter" name="kode_dokter" class="form-control" placeholder="Kode Dokter" /></input>
</div> </div>
<!-- <div class="form-group"> <div class="form-group " >
<label>Foto Dokter</label> <label>Gambar Dokter</label>
<input type="image" id="image" name="image" class="form-control" required /></input> <input type="file" name="gambar_dokter" id="gambar_dokter" class="form-control-file">
</div> --> </div>
<div class="modal-footer"> <div class="modal-footer">
<button button type="button" class="btn btn-primary" id="tambah">Add</button> <button button type="button" class="btn btn-primary" id="tambah">Add</button>
...@@ -118,10 +118,11 @@ ...@@ -118,10 +118,11 @@
</select> </select>
</div> </div>
<!-- <div class="form-group"> <div class="form-group " >
<label>Foto Dokter</label> <label>Gambar Dokter</label>
<input type="image" id="image" name="image" class="form-control" required /></input> <input type="file" name="gambar_dokteredt" id="gambar_dokteredt" class="form-control-file">
</div> --> </div>
<div class="modal-footer"> <div class="modal-footer">
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<div class="modal-body"> <div class="modal-body">
<form id="myForm" > <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"> <div class="form-group">
<label> No Rekam Medis</label><br> <label> No Rekam Medis</label><br>
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<th>Nama Poli</th> <th>Nama Poli</th>
<th>Kode Poli</th> <th>Kode Poli</th>
<th>Deskripsi Poli</th> <th>Deskripsi Poli</th>
<th>Gambar Poli</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
...@@ -53,7 +54,7 @@ ...@@ -53,7 +54,7 @@
<button type="button" class="close" data-dismiss="modal">&times;</button> <button type="button" class="close" data-dismiss="modal">&times;</button>
</div> </div>
<div class="modal-body"> <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"> <div class="form-group">
<label>Nama Poli</label> <label>Nama Poli</label>
...@@ -117,7 +118,7 @@ ...@@ -117,7 +118,7 @@
<div class="form-group "> <div class="form-group ">
<label>Gambar Poli</label> <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>
<div class="modal-footer"> <div class="modal-footer">
<button button type="button" class="btn btn-primary" id="edit">Edit</button> <button button type="button" class="btn btn-primary" id="edit">Edit</button>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<form id="myForm" > <form id="myForm" >
<div class="form-group"> <div class="form-group">
<label>Jenis Layanan</label> <label>Nama Poli</label>
<select name="nama_poli" id="poli" class="form-control" require> <select name="nama_poli" id="poli" class="form-control" require>
<option disable selected> Pilih </option> <option disable selected> Pilih </option>
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
<input type="input" id="id_register" class="form-control" /></input> <input type="input" id="id_register" class="form-control" /></input>
<div class="form-group"> <div class="form-group">
<label>Jenis Layanan</label> <label>Nama Poli</label>
<div class="card" > <div class="card" >
<div class="card-body" style="padding: 0.5rem;" id="poliedt" > <div class="card-body" style="padding: 0.5rem;" id="poliedt" >
</div> </div>
......
...@@ -5,12 +5,9 @@ ...@@ -5,12 +5,9 @@
<div class="col-lg-5 col-xl-5"> <div class="col-lg-5 col-xl-5">
<div class="banner_text"> <div class="banner_text">
<div class="banner_text_iner"> <div class="banner_text_iner">
<h5>We are here for your care</h5> <h5>Kami di sini untuk perawatan Anda</h5>
<h1>Best Care & <h1>Perawatan Terbaik</h1>
Better Doctor</h1> <p>Dalam kesehatan terdapat kebebasan. Kesehatan adalah hal paling pertama dalam semua kebebasan.
<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>
<a href="<?php echo $this->basePath('queue/cekdatapasien');?>"class="btn_2">Registrai Antrian</a> <a href="<?php echo $this->basePath('queue/cekdatapasien');?>"class="btn_2">Registrai Antrian</a>
</div> </div>
......
...@@ -45,10 +45,10 @@ input::-webkit-inner-spin-button { ...@@ -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> <input type="number" id="no_rekam_medis" placeholder="No Rekam Medis" class="form-control" max="999999999999999" maxlength="8" ></input>
</div> </div>
<div class="form-group"> <!-- <div class="form-group">
<label> <h5>No Induk Kependudukan (NIK)</h5></label><br> <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> <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> <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> <a class="card-text" href="<?php echo $this->basePath('queue/daftarpasien') ?>" style="display:inline">Klik disini !</a>
</form> </form>
......
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
<section class="doctor_part single_page_doctor_part" style="padding:20px;"> <section class="doctor_part single_page_doctor_part" style="padding:20px;">
<div class="container"> <div class="container">
<div class="row justify-content-center"> <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"> <div class="section_tittle text-center">
<h2> Dokter </h2> <h2 > Beberapa dokter di rumah sakit</h2>
<p>Beberapa dokter di rumah sakit ini</p>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<!-- breadcrumb start--> <!-- breadcrumb start-->
<!-- feature_part 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="container">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-xl-8"> <div class="col-xl-8">
......
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
<div class="row justify-content-between"> <div class="row justify-content-between">
<div class="col-xl-2 col-md-4 col-sm-6 single-footer-widget"> <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> <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>
<div class="col-xl-9 col-sm-6 col-md-4 single-footer-widget"> <div class="col-xl-9 col-sm-6 col-md-4 single-footer-widget">
...@@ -142,13 +142,7 @@ ...@@ -142,13 +142,7 @@
<div class="copyright_part"> <div class="copyright_part">
<div class="container"> <div class="container">
<div class="row align-items-center"> <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>
</div> </div>
......
$('#cekdata').on('click', function () { $('#cekdata').on('click', function () {
let no_rekam_medis = $('#no_rekam_medis').val(); 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({ $.ajax({
type: 'POST', type: 'POST',
...@@ -16,7 +30,7 @@ function cekpasien(no_rekam_medis, ktp) { ...@@ -16,7 +30,7 @@ function cekpasien(no_rekam_medis, ktp) {
url: baseURL + '/api/cekpasien', url: baseURL + '/api/cekpasien',
data: { data: {
ino_rekam_medis: no_rekam_medis, ino_rekam_medis: no_rekam_medis,
iktp: ktp,
}, },
success: function (result) { success: function (result) {
// let data = result.data['datapasien'][0]['no_rekam_medis']; // let data = result.data['datapasien'][0]['no_rekam_medis'];
...@@ -26,7 +40,7 @@ function cekpasien(no_rekam_medis, ktp) { ...@@ -26,7 +40,7 @@ function cekpasien(no_rekam_medis, ktp) {
bootbox.alert({ message: "No rekam medis atau NIK tidak sesuai!", centerVertical: true }); 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']); console.log(result.data['datapasien'][0]['no_rekam_medis']);
// alert('berhasil'); // alert('berhasil');
if (result.data['datapasien'][0]['no_rekam_medis'] == null) { if (result.data['datapasien'][0]['no_rekam_medis'] == null) {
...@@ -66,8 +80,8 @@ function cekpasien(no_rekam_medis, ktp) { ...@@ -66,8 +80,8 @@ function cekpasien(no_rekam_medis, ktp) {
bootbox.alert({ message: "Pasien Sedang Telah Terlewat Silahkan Hubungi Petugas", centerVertical: true }); bootbox.alert({ message: "Pasien Sedang Telah Terlewat Silahkan Hubungi Petugas", centerVertical: true });
} }
} else if (result.data['validasiinput'] == 1) { // } else if (result.data['validasiinput'] == 1) {
bootbox.alert({ message: "No Induk Kependudukan tidak sesuai", centerVertical: true }); // bootbox.alert({ message: "No Induk Kependudukan tidak sesuai", centerVertical: true });
} else { } else {
// bootbox.alert({ message: "Pasien Tidak Terdaftar <br> Silahkan Daftar Terlebih Dahulu", centerVertical: true }); // bootbox.alert({ message: "Pasien Tidak Terdaftar <br> Silahkan Daftar Terlebih Dahulu", centerVertical: true });
......
...@@ -64,11 +64,55 @@ $('#tambahdata').on('click', function () { ...@@ -64,11 +64,55 @@ $('#tambahdata').on('click', function () {
bootbox.alert({ message: 'KTP Sudah Digunakan!', centerVertical: true }); bootbox.alert({ message: 'KTP Sudah Digunakan!', centerVertical: true });
} }
else { 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 id_pasien = $('#id_pasien').val();
let nama = $('#nama').val(); let nama = $('#nama').val();
let tempat_lahir = $('#tempat_lahir').val(); let tempat_lahir = $('#tempat_lahir').val();
...@@ -78,9 +122,6 @@ function SaveDataAja() { ...@@ -78,9 +122,6 @@ function SaveDataAja() {
let ktp = $('#ktp').val(); let ktp = $('#ktp').val();
// console.log(no_antrian);
/* save data */
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
dataType: 'json', dataType: 'json',
...@@ -93,6 +134,7 @@ function SaveDataAja() { ...@@ -93,6 +134,7 @@ function SaveDataAja() {
itanggal_lahir: tanggal_lahir, itanggal_lahir: tanggal_lahir,
ialamat: alamat, ialamat: alamat,
ino_hp: no_hp, ino_hp: no_hp,
inorm: no_rekam_medis
}, },
success: function (response) { success: function (response) {
...@@ -137,7 +179,6 @@ function validasipoli(KTP) { ...@@ -137,7 +179,6 @@ function validasipoli(KTP) {
id: null, id: null,
}, },
success: function (result) { success: function (result) {
console.log(result)
var data = result.data; var data = result.data;
......
...@@ -76,7 +76,7 @@ function Loaddokter() { ...@@ -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].nama_dokter + '</td>';
cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].kode_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].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>'; 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); newRow.append(cols);
...@@ -113,7 +113,7 @@ function Loaddokter() { ...@@ -113,7 +113,7 @@ function Loaddokter() {
}); });
} }
function validasidokter(poli, nama_dokter, kode_dokter) { function validasidokter(poli, nama_dokter, kode_dokter, fileupload) {
var exist = 0; var exist = 0;
...@@ -144,12 +144,17 @@ function validasidokter(poli, nama_dokter, kode_dokter) { ...@@ -144,12 +144,17 @@ function validasidokter(poli, nama_dokter, kode_dokter) {
exist = 2; exist = 2;
} }
} }
if (poli == data[x]['id_poli']) {
if (fileupload == data[x]['image_dokter']) {
exist = 3;
}
}
if (poli == data[x]['id_poli']) { if (poli == data[x]['id_poli']) {
if (nama_dokter == data[x]['nama_dokter']) { if (nama_dokter == data[x]['nama_dokter']) {
namacounter += 1; namacounter += 1;
if (namacounter > 1) { if (namacounter > 1) {
exist = 3; exist = 4;
} }
} }
} }
...@@ -157,10 +162,20 @@ function validasidokter(poli, nama_dokter, kode_dokter) { ...@@ -157,10 +162,20 @@ function validasidokter(poli, nama_dokter, kode_dokter) {
if (kode_dokter == data[x]['kode_dokter']) { if (kode_dokter == data[x]['kode_dokter']) {
kodecounter += 1; kodecounter += 1;
if (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) { ...@@ -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 () { $('#tambahmodal').on('click', function () {
loadpoli() loadpoli()
...@@ -182,7 +217,7 @@ $('#tambah').on('click', function () { ...@@ -182,7 +217,7 @@ $('#tambah').on('click', function () {
let nama_dokter = $('#nama_dokter').val(); let nama_dokter = $('#nama_dokter').val();
let kode_dokter = $('#kode_dokter').val(); let kode_dokter = $('#kode_dokter').val();
let poli = $("#poli option:selected").attr("value"); let poli = $("#poli option:selected").attr("value");
console.log(poli) const fileupload = $('#gambar_dokter').prop('files')[0];
if (nama_dokter == null || nama_dokter == "") { if (nama_dokter == null || nama_dokter == "") {
bootbox.alert({ message: 'Nama dokter tidak boleh kosong', centerVertical: true }); bootbox.alert({ message: 'Nama dokter tidak boleh kosong', centerVertical: true });
...@@ -191,39 +226,65 @@ $('#tambah').on('click', function () { ...@@ -191,39 +226,65 @@ $('#tambah').on('click', function () {
else if (kode_dokter == null || kode_dokter == "") { else if (kode_dokter == null || kode_dokter == "") {
bootbox.alert({ message: 'Kode dokter tidak boleh kosong', centerVertical: true }); bootbox.alert({ message: 'Kode dokter tidak boleh kosong', centerVertical: true });
return false; 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 }); 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 }); 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 { } else {
savedokter() savedokter()
} }
console.log(validasidokter(poli, nama_dokter, kode_dokter));
}) })
function savedokter() { function savedokter() {
let nama_dokter = $('#nama_dokter').val(); let nama_dokter = $('#nama_dokter').val();
let kode_dokter = $('#kode_dokter').val(); let kode_dokter = $('#kode_dokter').val();
let poli = $("#poli option:selected").attr("value"); 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({ $.ajax({
type: 'POST', type: 'POST',
dataType: 'json', dataType: 'json',
url: baseURL + '/api/savekeloladokter', url: baseURL + '/api/savekeloladokter',
data: { data: formData,
inama_dokter: nama_dokter, cache: false,
ikode_dokter: kode_dokter, processData: false,
ipoli: poli contentType: false,
},
success: function (response) { success: function (response) {
//console.log(poli) //console.log(poli)
if (response['code'] == 0) { if (response['code'] == 0) {
$('#addData').modal('hide');
swal({ swal({
title: "", title: "",
text: "Data Berhasil Ditambahkan!", text: "Data Berhasil Ditambahkan!",
...@@ -264,6 +325,7 @@ $('#edit').on('click', function () { ...@@ -264,6 +325,7 @@ $('#edit').on('click', function () {
let nama_dokter = $('#nama_dokteredt').val(); let nama_dokter = $('#nama_dokteredt').val();
let kode_dokter = $('#kode_dokteredt').val(); let kode_dokter = $('#kode_dokteredt').val();
let poli = $("#poliedt option:selected").attr("value"); let poli = $("#poliedt option:selected").attr("value");
const fileupload = $('#gambar_dokter').prop('files')[0];
if (nama_dokter == null || nama_dokter == "") { if (nama_dokter == null || nama_dokter == "") {
...@@ -274,12 +336,23 @@ $('#edit').on('click', function () { ...@@ -274,12 +336,23 @@ $('#edit').on('click', function () {
bootbox.alert({ message: 'Kode dokter tidak boleh kosong', centerVertical: true }); bootbox.alert({ message: 'Kode dokter tidak boleh kosong', centerVertical: true });
return false; 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) { else if (validasidokter(poli, nama_dokter, kode_dokter) == 3) {
bootbox.alert({ message: 'Nama dokter harus berbeda!', centerVertical: true }); bootbox.alert({ message: 'Nama dokter harus berbeda!', centerVertical: true });
} }
else if (validasidokter(poli, nama_dokter, kode_dokter) == 4) { else if (validasidokter(poli, nama_dokter, kode_dokter) == 4) {
bootbox.alert({ message: 'Kode dokter harus berbeda!', centerVertical: true }); bootbox.alert({ message: 'Kode dokter harus berbeda!', centerVertical: true });
}
else if (validasigambar() == 2) {
bootbox.alert({ message: 'Harus berupa gambar', centerVertical: true });
} else { } else {
editdatadokter(id_dokter) editdatadokter(id_dokter)
} }
...@@ -292,24 +365,30 @@ function editdatadokter(id_dokter) { ...@@ -292,24 +365,30 @@ function editdatadokter(id_dokter) {
let condition = $("#condition option:selected").attr("value"); let condition = $("#condition option:selected").attr("value");
let nama_dokter = $('#nama_dokteredt').val(); let nama_dokter = $('#nama_dokteredt').val();
let kode_dokter = $('#kode_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({ $.ajax({
type: 'POST', type: 'POST',
dataType: 'json', dataType: 'json',
url: baseURL + '/api/editkeloladokter', url: baseURL + '/api/editkeloladokter',
data: { data: formData,
id: id_dokter, cache: false,
inama_dokter: nama_dokter, processData: false,
ikode_dokter: kode_dokter, contentType: false,
ipoli: poli,
icondition: condition,
},
success: function (response) { success: function (response) {
// console.log(response); // console.log(response);
if (response['code'] == 0) { if (response['code'] == 0) {
$('#Editdata').modal('hide');
swal({ swal({
title: "", title: "",
text: "Data Berhasil DiUbah!", text: "Data Berhasil DiUbah!",
...@@ -371,7 +450,7 @@ function loadedit(id_dokter) { ...@@ -371,7 +450,7 @@ function loadedit(id_dokter) {
async: false, async: false,
success: function (result) { success: function (result) {
// console.log(data); console.log(data);
if (result['code'] == 0) { if (result['code'] == 0) {
...@@ -410,6 +489,7 @@ function loadedit(id_dokter) { ...@@ -410,6 +489,7 @@ function loadedit(id_dokter) {
$('#nama_dokteredt').val(data[0].nama_dokter); $('#nama_dokteredt').val(data[0].nama_dokter);
$('#kode_dokteredt').val(data[0].kode_dokter); $('#kode_dokteredt').val(data[0].kode_dokter);
// $("#gambar_dokteredt").val(data[0].image_dokter);
} else { } else {
bootbox.alert({ message: 'Data Kosong', centerVertical: true }); bootbox.alert({ message: 'Data Kosong', centerVertical: true });
} }
...@@ -470,8 +550,8 @@ function Delete(param) { ...@@ -470,8 +550,8 @@ function Delete(param) {
}); });
} }
}, },
error: function (xhr) { error: function () {
alert(xhr.status + '-' + xhr.statusText); bootbox.alert({ message: 'Data dokter masih terdaftar dalam poli ', centerVertical: true });
} }
}); });
} }
......
...@@ -152,6 +152,7 @@ function editdatapasien(id_pasien) { ...@@ -152,6 +152,7 @@ function editdatapasien(id_pasien) {
}, },
success: function (response) { success: function (response) {
$('#Editdata').modal('hide');
console.log(response); console.log(response);
if (response['code'] == 0) { if (response['code'] == 0) {
swal({ swal({
......
...@@ -20,7 +20,7 @@ function Loadpoli() { ...@@ -20,7 +20,7 @@ function Loadpoli() {
$('table.table-bordered > tbody').empty(); $('table.table-bordered > tbody').empty();
// console.log(result); console.log(result);
if (result.code == 0) { if (result.code == 0) {
...@@ -37,8 +37,10 @@ function Loadpoli() { ...@@ -37,8 +37,10 @@ function Loadpoli() {
cols += '<td class="tdCenterText bgtd1 ">' + data[x].nama_poli + '</td>'; 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].kode_poli + '</td>';
cols += '<td class="tdCenterText bgtd1 ">' + data[x].deskripsi_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 += '<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>' cols += '</tr>'
//newRow.append(cols); //newRow.append(cols);
$("#tablepoli").append(cols); $("#tablepoli").append(cols);
counter++; counter++;
...@@ -54,10 +56,11 @@ function Loadpoli() { ...@@ -54,10 +56,11 @@ function Loadpoli() {
paging: true, paging: true,
columnDefs: [ columnDefs: [
{ width: 30, targets: 0 }, { width: 30, targets: 0 },
{ width: 170, targets: 1 }, { width: 120, targets: 1 },
{ width: 170, targets: 2 }, { width: 120, targets: 2 },
{ width: 290, targets: 3 }, { width: 250, targets: 3 },
{ width: 120, targets: 4 }, { width: 100, targets: 4 },
{ width: 120, targets: 5 },
], ],
}); });
...@@ -70,10 +73,13 @@ function Loadpoli() { ...@@ -70,10 +73,13 @@ function Loadpoli() {
$('#tambah').on('click', function (e) { $('#tambah').on('click', function (e) {
e.preventDefault(); e.preventDefault();
let nama_poli = $('#nama_poli').val(); let nama_poli = $('#nama_poli').val();
let kode_poli = $('#kode_poli').val(); let kode_poli = $('#kode_poli').val();
let deskripsi_poli = $('#deskripsi_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 == "") { if (nama_poli == null || nama_poli == "") {
bootbox.alert({ message: 'Nama poli tidak boleh kosong', centerVertical: true }); bootbox.alert({ message: 'Nama poli tidak boleh kosong', centerVertical: true });
...@@ -87,299 +93,397 @@ $('#tambah').on('click', function (e) { ...@@ -87,299 +93,397 @@ $('#tambah').on('click', function (e) {
bootbox.alert({ message: 'Deskripsi poli tidak boleh kosong', centerVertical: true }); bootbox.alert({ message: 'Deskripsi poli tidak boleh kosong', centerVertical: true });
return false; 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 }); bootbox.alert({ message: 'Nama poli sudah ada!', centerVertical: true });
} }
else if (validasipoli(nama_poli, kode_poli) == 2) { else if (validasipoli(nama_poli, kode_poli, deskripsi_poli, fileupload) == 2) {
bootbox.alert({ message: 'Kode poli sudah ada', centerVertical: true }); 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 { } else {
savedatapoli(); savedatapoli();
} }
})
function savedatapoli() { function savedatapoli() {
let nama_poli = $('#nama_poli').val(); let nama_poli = $('#nama_poli').val();
let kode_poli = $('#kode_poli').val(); let kode_poli = $('#kode_poli').val();
let deskripsi_poli = $('#deskripsi_poli').val(); let deskripsi_poli = $('#deskripsi_poli').val();
const fileupload = $('#gambar_poli').prop('files')[0]; const fileupload = $('#gambar_poli').prop('files')[0];
let formData = new FormData(); let formData = new FormData();
formData.append('inama_poli', nama_poli); formData.append('inama_poli', nama_poli);
formData.append('ikode_poli', kode_poli); formData.append('ikode_poli', kode_poli);
formData.append('ideskripsi_poli', deskripsi_poli); formData.append('ideskripsi_poli', deskripsi_poli);
formData.append('fileupload', fileupload); // set file ke tipe data binary formData.append('fileupload', fileupload); // set file ke tipe data binary
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/savekelolapoli',
data: $.ajax({
// inama_poli: nama_poli, type: 'POST',
// ikode_poli: kode_poli, dataType: 'json',
// ideskripsi_poli: deskripsi_poli, url: baseURL + '/api/savekelolapoli',
formData, data: formData,
cache: false,
processData: false,
contentType: false,
cache: false, success: function (response) {
processData: false,
contentType: false,
success: function (response) {
if (response['code'] == 0) {
$('#addData').modal('hide');
if (response['code'] == 0) { swal({
swal({ title: "",
title: "", text: "Data Berhasil Ditambahkan!",
text: "Data Berhasil Ditambahkan!", icon: "succes",
icon: "succes", button: "ok",
button: "ok", }, function () {
}, function () { location.reload();
location.reload(); });
});
} else { } else {
swal({ swal({
title: "", title: "",
text: "Data Gagal Ditambahkan!", text: "Data Gagal Ditambahkan!",
icon: "succes", icon: "succes",
button: "ok", button: "ok",
}); });
} }
}, },
error: function (xhr) { error: function (xhr) {
if (xhr.status != 200) { if (xhr.status != 200) {
//bootbox.alert(xhr.status + "-" + xhr.statusText + " <br>Silahkan coba kembali :) "); //bootbox.alert(xhr.status + "-" + xhr.statusText + " <br>Silahkan coba kembali :) ");
} else { } else {
alert('gagal error'); 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({ $.ajax({
type: 'POST', type: 'POST',
dataType: 'json', dataType: 'json',
url: baseURL + '/api/loadkelolapoli', url: baseURL + '/api/loadkelolapoli',
async: false, async: false,
data: { data: {
id: null, id: null,
}, },
success: function (result) { 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']) { for (x in data) {
exist = 1; 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 == "") { $('#edit').on('click', function () {
bootbox.alert({ message: 'Nama poli tidak boleh kosong', centerVertical: true }); let id_poli = $('#id_poli').val();
return false; let nama_poli = $('#nama_poliEdt').val();
} let kode_poli = $('#kode_poliEdt').val();
else if (kode_poli == null || kode_poli == "") { let deskripsi_poli = $('#deskripsi_poliEdt').val();
bootbox.alert({ message: 'Kode poli tidak boleh kosong', centerVertical: true }); const fileupload = $('#gambar_poliedt').prop('files')[0];
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)
}
}) if (nama_poli == null || nama_poli == "") {
function editdatapoli(id_poli) { bootbox.alert({ message: 'Nama poli tidak boleh kosong', centerVertical: true });
let nama_poli = $('#nama_poliEdt').val(); return false;
let kode_poli = $('#kode_poliEdt').val(); }
let deskripsi_poli = $('#deskripsi_poliEdt').val(); else if (kode_poli == null || kode_poli == "") {
bootbox.alert({ message: 'Kode poli tidak boleh kosong', centerVertical: true });
return false;
// let image = $('#kode_poli').val(); }
else if (deskripsi_poli == null || deskripsi_poli == "") {
$.ajax({ bootbox.alert({ message: 'Deskripsi poli tidak boleh kosong', centerVertical: true });
type: 'POST', return false;
dataType: 'json', }
url: baseURL + '/api/editkelolapoli', else if (fileupload == null) {
async: false, bootbox.alert({ message: ' Gambar tidak boleh kosong', centerVertical: true });
data: { return false;
id: id_poli, }
inama_poli: nama_poli, else if (kode_poli.toString().length > 5) {
ikode_poli: kode_poli, bootbox.alert({ message: 'Kode Poli tidak boleh lebih dari 5 angka', centerVertical: true });
ideskripsi_poli: deskripsi_poli, 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({ function editdatapoli(id_poli) {
title: "",
text: "Data Gagal Ditambahkan!", let nama_poli = $('#nama_poliEdt').val();
icon: "succes", let kode_poli = $('#kode_poliEdt').val();
button: "ok", 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) {
}, if (response['code'] == 0) {
error: function (xhr) { $('#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: { function loadedit(param) {
id: param,
}, $.ajax({
success: function (result) { type: 'POST',
// console.log(result); dataType: 'json',
// $('.loaddata').empty(); url: baseURL + '/api/loadkelolapoli',
// console.log(result); 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); let data = result.data;
$('#nama_poliEdt').val(data[0].nama_poli); console.log(data);
$('#nama_poli2').val(data[0].nama_poli);
$('#kode_poliEdt').val(data[0].kode_poli);
$('#deskripsi_poliEdt').val(data[0].deskripsi_poli);
} else { $('#id_poli').val(data[0].id_poli);
alert(result.info); $('#nama_poliEdt').val(data[0].nama_poli);
} $('#nama_poli2').val(data[0].nama_poli);
}, $('#kode_poliEdt').val(data[0].kode_poli);
error: function (xhr) { $('#deskripsi_poliEdt').val(data[0].deskripsi_poli);
alert(xhr.status + '-' + xhr.statusText);
} else {
alert(result.info);
} }
}); },
} error: function (xhr) {
alert(xhr.status + '-' + xhr.statusText);
}
});
}
function Delete(param) { function Delete(param) {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
dataType: 'json', dataType: 'json',
url: baseURL + '/api/loadkelolapoli', url: baseURL + '/api/loadkelolapoli',
data: { data: {
id: param, 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) { function () {
// console.log(result.data[0].nama_poli); $.ajax({
let nama_poli = result.data[0].nama_poli; type: 'POST',
swal({ dataType: 'json',
title: "Apakah yakin mengahapus poli '" + nama_poli + "'? \nJika anda menghapus Poli ini \nmaka Dokter Dan Ruangan \ndengan nama poli '" + nama_poli + "' akan terhapus", url: baseURL + '/api/deletekelolapoli',
type: "error", data: {
confirmButtonClass: "btn-danger", id: param,
confirmButtonText: "Yes!", },
showCancelButton: true, success: function (result) {
}, // console.log(result)
function () { if (result.code == 0) {
$.ajax({ swal({
type: 'POST', title: "",
dataType: 'json', text: "Data Berhasil Dihapus!",
url: baseURL + '/api/deletekelolapoli', icon: "succes",
data: { button: "ok",
id: param, }, function () {
}, location.reload();
success: function (result) { });
// console.log(result) } else {
if (result.code == 0) { swal({
swal({ title: "",
title: "", text: "Data Gagal Dihapus!",
text: "Data Berhasil Dihapus!", icon: "succes",
icon: "succes", button: "ok",
button: "ok", });
}, function () {
location.reload();
});
} else {
swal({
title: "",
text: "Data Gagal Dihapus!",
icon: "succes",
button: "ok",
});
}
},
error: function (xhr) {
alert(xhr.status + '-' + xhr.statusText);
} }
}); },
}, error: function (xhr) {
function () { alert(xhr.status + '-' + xhr.statusText);
// This function will run if the user clicked "cancel" }
window.location.href = "<?php echo Yii::$app->request->baseUrl;?>/todo/index/"; });
} },
); 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 () { ...@@ -127,7 +127,6 @@ $('#tambah').on('click', function () {
let nama_ruang = $('#nama_ruang').val(); let nama_ruang = $('#nama_ruang').val();
let lantai = $('#lantai').val(); let lantai = $('#lantai').val();
if (nama_ruang == null || nama_ruang == "") { if (nama_ruang == null || nama_ruang == "") {
bootbox.alert({ message: 'Nama Ruang tidak boleh kosong', centerVertical: true }); bootbox.alert({ message: 'Nama Ruang tidak boleh kosong', centerVertical: true });
return false; return false;
...@@ -136,7 +135,10 @@ $('#tambah').on('click', function () { ...@@ -136,7 +135,10 @@ $('#tambah').on('click', function () {
bootbox.alert({ message: 'Lantai tidak boleh kosong', centerVertical: true }); bootbox.alert({ message: 'Lantai tidak boleh kosong', centerVertical: true });
return false; 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 }); bootbox.alert({ message: 'Nama ruang dan lantai sudah ada!', centerVertical: true });
} }
else { else {
...@@ -170,6 +172,7 @@ function saveruang() { ...@@ -170,6 +172,7 @@ function saveruang() {
if (result['code'] == 0) { if (result['code'] == 0) {
$('#addData').modal('hide');
swal({ swal({
title: "", title: "",
text: "Data Berhasil Ditambahkan!", text: "Data Berhasil Ditambahkan!",
...@@ -201,7 +204,7 @@ function saveruang() { ...@@ -201,7 +204,7 @@ function saveruang() {
}); });
} }
// validasiruang()
function validasiruang(lantai, nama_ruang) { function validasiruang(lantai, nama_ruang) {
var exist = 0; var exist = 0;
...@@ -221,23 +224,30 @@ function validasiruang(lantai, nama_ruang) { ...@@ -221,23 +224,30 @@ function validasiruang(lantai, nama_ruang) {
var ruangcounter = 0 var ruangcounter = 0
for (x in data) { 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 (lantai == data[x]['lantai']) { if (nama_ruang == data[x]['nama_ruang']) {
if (nama_ruang == data[x]['nama_ruang']) { exist = 2;
exist = 1;
}
} }
} }
if (lantai == data[x]['lantai']) { if (lantai == data[x]['lantai']) {
if (nama_ruang == data[x]['nama_ruang']) { if (nama_ruang == data[x]['nama_ruang']) {
ruangcounter += 1; ruangcounter += 1;
if (ruangcounter > 1) { if (ruangcounter > 1) {
exist = 2; exist = 3;
} }
} }
} }
} }
...@@ -267,7 +277,7 @@ $('#edit').on('click', function () { ...@@ -267,7 +277,7 @@ $('#edit').on('click', function () {
else if (lantai == null || lantai == "") { else if (lantai == null || lantai == "") {
bootbox.alert({ message: 'Lantai tidak boleh kosong', centerVertical: true }); bootbox.alert({ message: 'Lantai tidak boleh kosong', centerVertical: true });
return false; 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 }); bootbox.alert({ message: 'Nama ruang dan lantai harus berbeda!', centerVertical: true });
} else { } else {
editdataruang(id_ruang) editdataruang(id_ruang)
...@@ -297,6 +307,8 @@ function editdataruang(id_ruang) { ...@@ -297,6 +307,8 @@ function editdataruang(id_ruang) {
//console.log(respoonse); //console.log(respoonse);
if (response['code'] == 0) { if (response['code'] == 0) {
$('#Editdata').modal('hide');
swal({ swal({
title: "", title: "",
text: "Data Berhasil DiUbah!", text: "Data Berhasil DiUbah!",
...@@ -454,8 +466,8 @@ function Delete(param) { ...@@ -454,8 +466,8 @@ function Delete(param) {
}); });
} }
}, },
error: function (xhr) { error: function () {
alert(xhr.status + '-' + xhr.statusTexDa); bootbox.alert({ message: 'Data ruang masih terdaftar dalam poli ', centerVertical: true });
} }
}); });
}, },
......
...@@ -234,15 +234,16 @@ function LoadDadta(id) { ...@@ -234,15 +234,16 @@ function LoadDadta(id) {
} }
$('#tambah').on('click', function () { $('#tambah').on('click', function () {
SaveDataRegister() SaveDataRegister()
}) })
function SaveDataRegister(param) { function SaveDataRegister(param) {
...@@ -255,7 +256,126 @@ function SaveDataRegister(param) { ...@@ -255,7 +256,126 @@ function SaveDataRegister(param) {
let antrian_akhir = $('#antrian_akhir').val(); let antrian_akhir = $('#antrian_akhir').val();
let waktu_antrian = $('#waktu_antrian').val(); let waktu_antrian = $('#waktu_antrian').val();
let jam_mulai = $('#jam_mulai').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 */ /* save data */
$.ajax({ $.ajax({
...@@ -276,136 +396,19 @@ function SaveDataRegister(param) { ...@@ -276,136 +396,19 @@ function SaveDataRegister(param) {
}, },
success: function (result) { success: function (result) {
if (ruang == null || ruang == "") {
swal({ if (result.code == 0) {
title: "", $('#addData').modal('hide');
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) {
swal({ swal({
title: "<span style='color:#222'>Good Job!</span>", title: "<span style='color:#222'>Good Job!</span>",
confirmButtonColor: "#66BB6A", confirmButtonColor: "#66BB6A",
html: true, html: true,
type: "success" type: "success"
}, function () { }, function () {
location.reload(); location.reload();
}); });
// loadpoli(); // loadpoli();
...@@ -439,12 +442,10 @@ function SaveDataRegister(param) { ...@@ -439,12 +442,10 @@ function SaveDataRegister(param) {
$('#edit').on('click', function () { $('#edit').on('click', function () {
let id_register = $('#id_register').val(); let id_register = $('#id_register').val();
// if (validasieditnama() == true) {
// alert("Nama Poli Harus Berbeda!")
// } else {
editregister(id_register) editregister(id_register)
// }
}) })
...@@ -459,8 +460,129 @@ function editregister(id_register) { ...@@ -459,8 +460,129 @@ function editregister(id_register) {
let waktu_antrian = $('#waktu_antrianedt').val(); let waktu_antrian = $('#waktu_antrianedt').val();
let jam_mulai = $('#jam_mulaiedt').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({ $.ajax({
type: 'POST', type: 'POST',
...@@ -469,7 +591,7 @@ function editregister(id_register) { ...@@ -469,7 +591,7 @@ function editregister(id_register) {
async: false, async: false,
data: { data: {
id: id_register, id: id_register,
ipoli :poli, ipoli: poli,
idokter: dokter, idokter: dokter,
iruang: ruang, iruang: ruang,
iantrial_all: antrian_all, iantrial_all: antrian_all,
...@@ -482,20 +604,18 @@ function editregister(id_register) { ...@@ -482,20 +604,18 @@ function editregister(id_register) {
success: function (response) { success: function (response) {
console.log(response); console.log(response);
if (response['code'] == 0) { if (response['code'] == 0) {
$('#editData').modal('hide');
swal({ swal({
title: "", title: "",
text: "Data Berhasil DiUbah!", text: "Data Berhasil DiUbah!",
icon: "succes", icon: "succes",
button: "ok", button: "ok",
}, },
function () { function () {
location.reload(); location.reload();
}); });
//
//window.onload
//location.reload()
} else { } else {
......
...@@ -39,34 +39,34 @@ input:hover, input:focus { ...@@ -39,34 +39,34 @@ input:hover, input:focus {
/* line 18, ../../01 cl html template/03_jun 2019/182_medico_html/sass/_common.scss */ /* line 18, ../../01 cl html template/03_jun 2019/182_medico_html/sass/_common.scss */
.section_padding { .section_padding {
padding: 140px 0px; padding: 50px 0px;
} }
@media only screen and (min-width: 992px) and (max-width: 1200px) { @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 */ /* line 18, ../../01 cl html template/03_jun 2019/182_medico_html/sass/_common.scss */
.section_padding { .section_padding {
padding: 80px 0px; padding: 40px 0px;
} }
} }
@media only screen and (min-width: 768px) and (max-width: 991px) { @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 */ /* line 18, ../../01 cl html template/03_jun 2019/182_medico_html/sass/_common.scss */
.section_padding { .section_padding {
padding: 70px 0px; padding: 30px 0px;
} }
} }
@media (max-width: 576px) { @media (max-width: 576px) {
/* line 18, ../../01 cl html template/03_jun 2019/182_medico_html/sass/_common.scss */ /* line 18, ../../01 cl html template/03_jun 2019/182_medico_html/sass/_common.scss */
.section_padding { .section_padding {
padding: 70px 0px; padding: 30px 0px;
} }
} }
@media only screen and (min-width: 576px) and (max-width: 767px) { @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 */ /* line 18, ../../01 cl html template/03_jun 2019/182_medico_html/sass/_common.scss */
.section_padding { .section_padding {
padding: 70px 0px; padding: 30px 0px;
} }
} }
......
...@@ -3,75 +3,57 @@ Chart.defaults.global.defaultFontFamily = 'Nunito', '-apple-system,system-ui,Bli ...@@ -3,75 +3,57 @@ Chart.defaults.global.defaultFontFamily = 'Nunito', '-apple-system,system-ui,Bli
Chart.defaults.global.defaultFontColor = '#858796'; Chart.defaults.global.defaultFontColor = '#858796';
// Pie Chart Example // Pie Chart Example
var ctx = document.getElementById("myPieChart"); // var ctx = document.getElementById("myPieChart");
var myPieChart = new Chart(ctx, { // var myPieChart = new Chart(ctx, {
type: 'doughnut', // type: 'doughnut',
data: { // data: {
labels: ["Direct", "Referral", "Social"], // labels: ["Direct", "Referral", "Social"],
datasets: [{ // datasets: [{
data: [55, 30, 15], // data: [55, 30, 15],
backgroundColor: ['#4e73df', '#1cc88a', '#36b9cc'], // backgroundColor: ['#4e73df', '#1cc88a', '#36b9cc'],
hoverBackgroundColor: ['#2e59d9', '#17a673', '#2c9faf'], // hoverBackgroundColor: ['#2e59d9', '#17a673', '#2c9faf'],
hoverBorderColor: "rgba(234, 236, 244, 1)", // hoverBorderColor: "rgba(234, 236, 244, 1)",
}], // }],
}, // },
options: { // options: {
maintainAspectRatio: false, // maintainAspectRatio: false,
tooltips: { // tooltips: {
backgroundColor: "rgb(255,255,255)", // backgroundColor: "rgb(255,255,255)",
bodyFontColor: "#858796", // bodyFontColor: "#858796",
borderColor: '#dddfeb', // borderColor: '#dddfeb',
borderWidth: 1, // borderWidth: 1,
xPadding: 15, // xPadding: 15,
yPadding: 15, // yPadding: 15,
displayColors: false, // displayColors: false,
caretPadding: 10, // caretPadding: 10,
}, // },
legend: { // legend: {
display: false // display: false
}, // },
cutoutPercentage: 80, // cutoutPercentage: 80,
}, // },
}); // });
loadpoli() jumlahantrian()
function loadpoli() { function jumlahantrian() {
var id = document.getElementById("myPieChart");
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
dataType: 'json', 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); success: function (result) {
} else { console.log(result)
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');
}
}
}
});
}
} }
}); });
} }
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