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

Baru dra

parent 2e081da6
......@@ -504,15 +504,17 @@ class ApiController extends \Application\Master\GlobalActionController {
}
public function editdataregisterAction(){
if($this->isLoggedIn()){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$tb_dokter ='dokter_to_poli';
$tb_ruang ='ruang';
$tb_register_antrian ='register_antrian';
$tb_register_dokter ='register_dokter';
$tb_antrian ='antrian';
$tb_antrian_pasien ='antrian_pasien';
if ($request->isPost()) {
......@@ -520,14 +522,23 @@ class ApiController extends \Application\Master\GlobalActionController {
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$param = new \Application\Model\Param($storage);
try{
$id_register = $post->id;
$id_register = $post->id;
$antrian_all = $post->iantrial_all;
$waktu_antrian = $post->iwaktu_antrian;
$jam_mulai = $post->ijam_mulai;
$antrian_before = $post->iantrian_before;
$poli = $post->ipoli;
$dokter = $post->idokter;
$ruang = $post->iruang;
$tanggal_before = $post->itanggal_before;
$array = array();
$dataArrayRegister = array (
......@@ -549,20 +560,70 @@ class ApiController extends \Application\Master\GlobalActionController {
$load = $param->loadantrianregister($post->id);
$table_register= 'register_dokter';
$where = 'id_register='.$id_register;
// print_r ($where);die;
$param->updateGlobal($table_register, $dataArrayRegister, $where);
$param->updateGlobal($tb_register_dokter, $dataArrayRegister, $where);
// $table_antrian= 'register_antrian';
// $where1 = 'id_registerantrian='.$id_register;
// // print_r ($where);die;
// $param->updateGlobal($table_antrian, $dataArrayAntrian, $where1);
$where1 = 'id_registerantrian='.$id_register;
// print_r ($where);die;
$param->updateGlobal($tb_register_antrian, $dataArrayAntrian, $where1);
$result->code = 0;
$result->info = 'ok';
$result->data = $load->data;
//untuk load data id register di table antrian register lalu menambahkan pada table pasien
if($antrian_before < $antrian_all){
for ($antrian_before; $antrian_before <= $antrian_all;){
$dataArrayAntrianPasien = array (
'id_register' => $id_register,
'create_date' => $tanggal_before,
'no_antrian' => $antrian_before,
'id_poli' => $poli,
'id_dokter' => $dokter,
'id_ruang' => $ruang,
);
// print_r( $dataArrayAntrianPasien);die;
$dataArrayAntrian = array (
'create_date' =>$tanggal_before,
'no_antrian' => $antrian_before,
);
$param->saveGlobal($dataArrayAntrianPasien, $tb_antrian_pasien);
$param->saveGlobal($dataArrayAntrian, $tb_antrian);
$antrian_before++;
}
}
if($antrian_all < $antrian_before){
for ($antrian_before; $antrian_before > $antrian_all ;){
//a
$where = "id_register=$id_register AND no_antrian=$antrian_before";
$param->deleteGlobal($tb_antrian_pasien, $where);
$antrian_before--;
}
}
//print_r($array);die;
$result->code = 0;
$result->info = 'ok';
}catch (\Exception $exc) {
$result = new Result(0,1,$exc->getMessage() .'-'.$exc->getTraceAsString());
}
......@@ -573,7 +634,6 @@ class ApiController extends \Application\Master\GlobalActionController {
return $this->getOutput($result->toJson());
}
public function deletedataregisterAction(){
$result = new Result();
......@@ -633,8 +693,8 @@ class ApiController extends \Application\Master\GlobalActionController {
$request = $this->getRequest();
$post = $request->getPost();
$table_poli= 'poli';
$tabel = 'user_data_header';
if ($request->isPost()) {
......@@ -645,9 +705,11 @@ class ApiController extends \Application\Master\GlobalActionController {
$fileupload = $_FILES['fileupload']['tmp_name'];
// print_r($fileupload);die;
$nama_poli = $post->inama_poli;
$id_poli = $post->id_poli;
$kode_poli = $post->ikode_poli;
$deskripsi_poli = $post->ideskripsi_poli;
$password = $post->ipassword;
if (!empty($fileupload)){
$ImageName = $_FILES['fileupload']['name'];
$tipes = $_FILES['fileupload']['type'];
......@@ -661,6 +723,8 @@ class ApiController extends \Application\Master\GlobalActionController {
$alamatfile = $uploaddir.$ImageName;
if (move_uploaded_file($_FILES['fileupload']['tmp_name'],$alamatfile)){
// print_r('berhasil');die;
/* jika upload berhasil ke folder sever */
$dataAtt = array(
......@@ -669,14 +733,32 @@ class ApiController extends \Application\Master\GlobalActionController {
'image_poli' => $ImageName,
'deskripsi_poli' => $deskripsi_poli,
'kode_poli' => $kode_poli,
);
$param->saveGlobal($dataAtt, $table_poli);
$seqAfter1 = $param->getLastSeqPostgree($table_poli, 'id_poli');
$dataArray = array (
'username' => $nama_poli,
'password' => md5($password),
'create_dtm' => gmdate("Y-m-d H:i:s", time()+60*60*7),
'role' => 10,
'status' => 10,
'name' => $nama_poli,
'id_poli' => $seqAfter1->data['total'],
);
// print_r( $dataArray);die;
$param->saveGlobal($dataArray, $tabel);
$result->code = 0;
$result->info = 'ok';
$result->data = $dataArrayPoli->data;
}else{
$result->code = 17;
......@@ -716,6 +798,9 @@ class ApiController extends \Application\Master\GlobalActionController {
$fileupload = $_FILES['fileupload']['tmp_name'];
$id_poli = $post->id_poli;
$password = $post->ipassword;
$iduser = $post->iduser;
// print_r($iduser);die;
$nama_poli = $post->inama_poli;
$kode_poli = $post->ikode_poli;
$deskripsi_poli = $post->ideskripsi_poli;
......@@ -734,6 +819,9 @@ class ApiController extends \Application\Master\GlobalActionController {
if (move_uploaded_file($_FILES['fileupload']['tmp_name'],$alamatfile)){
/* jika upload berhasil ke folder sever */
$dataArrayPoli = array(
......@@ -748,7 +836,22 @@ class ApiController extends \Application\Master\GlobalActionController {
$where = 'id_poli='.$id_poli;
$param->updateGlobal($table_poli, $dataArrayPoli, $where);
// $param->updateGlobal($table_poli, $dataArrayPoli, $where);
$dataArray = array (
'username' => $nama_poli,
'password' => md5($password),
'create_dtm' => gmdate("Y-m-d H:i:s", time()+60*60*7),
'role' => 10,
'status' => 10,
'name' => $nama_poli,
);
// print_r( $dataArray);die;
$tabel = 'user_data_header';
$where = 'iduser='.$iduser;
$param->updateGlobal($table, $dataArray, $where);
$result->code = 0;
$result->info = 'ok';
......@@ -762,6 +865,7 @@ class ApiController extends \Application\Master\GlobalActionController {
}else{
$dataArrayPoli = array(
'nama_poli' => $nama_poli,
......@@ -771,8 +875,24 @@ class ApiController extends \Application\Master\GlobalActionController {
$table_poli = 'poli';
$where = 'id_poli='.$id_poli;
$param->updateGlobal($table_poli, $dataArrayPoli, $where);
}
// $param->updateGlobal($table_poli, $dataArrayPoli, $where);
$dataArray = array (
'username' => $nama_poli,
'password' =>md5($password),
'create_dtm' => gmdate("Y-m-d H:i:s", time()+60*60*7),
'role' => 10,
'status' => 10,
'name' => $nama_poli,
);
// print_r( $dataArray);die;
$table = 'user_data_header';
$where = 'iduser='.$iduser;
$param->updateGlobal($table, $dataArray, $where);
}
}catch (\Exception $exc) {
......@@ -795,16 +915,21 @@ class ApiController extends \Application\Master\GlobalActionController {
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$tabel1 = 'antrian_pasien';
$where1 = 'id_poli='.$post->id;
// print_r($where1);die;
$res = $test->deleteGlobal($tabel1, $where1);
$tabel = 'dokter_to_poli';
$where = 'id_poli='.$post->id;
$res = $test->deleteGlobal($tabel, $where);
$tabel = 'ruang';
$where = 'id_poli='.$post->id;
$res = $test->deleteGlobal($tabel, $where);
$tabel = 'poli';
$where = 'id_poli='.$post->id;
$res = $test->deleteGlobal($tabel, $where);
$tabel2 = 'ruang';
$where2 = 'id_poli='.$post->id;
$res = $test->deleteGlobal($tabel2, $where2);
$tabel3 = 'poli';
$where3 = 'id_poli='.$post->id;
$res = $test->deleteGlobal($tabel3, $where3);
if($load->code == 0){
$result->code = $result::CODE_SUCCESS;
......@@ -1066,6 +1191,11 @@ class ApiController extends \Application\Master\GlobalActionController {
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$tabel = 'antrian_pasien';
$where1 = 'id_dokter='.$post->id;
// print_r($where);die;
$res = $test->deleteGlobal($tabel, $where1);
$tabel_dokter_to_poli = 'dokter_to_poli';
$where = 'id_dokter='.$post->id;
......@@ -1220,6 +1350,14 @@ class ApiController extends \Application\Master\GlobalActionController {
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$tabel1 = 'antrian_pasien';
$where1 = 'id_ruang='.$post->id;
// print_r($where);die;
$res = $test->deleteGlobal($tabel1, $where1);
$tabel = 'ruang';
$where = 'id_ruang='.$post->id;
......@@ -1379,12 +1517,16 @@ class ApiController extends \Application\Master\GlobalActionController {
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$test = new \Application\Model\Param($storage);
$tabel = 'pasien';
$tabel = 'antrian_pasien';
$where = 'id_pasien='.$post->id_pasien;
// print_r($where);die;
$res = $test->deleteGlobal($tabel, $where);
$tabel = 'pasien';
$where = 'id_pasien='.$post->id_pasien;
$res = $test->deleteGlobal($tabel, $where);
if($load->code == 0){
$result->code = $result::CODE_SUCCESS;
......@@ -1498,6 +1640,85 @@ class ApiController extends \Application\Master\GlobalActionController {
return $this->getOutput($result->toJson());
}
public function updateconditionseluruhruangAction(){
if($this->isLoggedIn()){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
if ($request->isPost()) {
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$param = new \Application\Model\Param($storage);
try{
$id_ruang = $post->id_ruang;
$id_condition = $post->id_condition;
$datacondition = array (
'id_condition' => 1,
);
$tableruang= 'ruang';
$where = 'id_condition = 2';
$param->updateGlobal($tableruang, $datacondition, $where);
$result->code = 0;
$result->info = 'ok';
}catch (\Exception $exc) {
$result = new Result(0,1,$exc->getMessage() .'-'.$exc->getTraceAsString());
}
}else{
$result = new Result(0,401,'Silahkan masuk untuk melanjutkan');
}
}
return $this->getOutput($result->toJson());
}
public function updateconditionseluruhdokterAction(){
if($this->isLoggedIn()){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
if ($request->isPost()) {
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$param = new \Application\Model\Param($storage);
try{
$id_ruang = $post->id_ruang;
$id_condition = $post->id_condition;
$datacondition = array (
'id_condition' => 1,
);
$tableruang= 'dokter_to_poli';
$where = 'id_condition = 2';
$param->updateGlobal($tableruang, $datacondition, $where);
$result->code = 0;
$result->info = 'ok';
}catch (\Exception $exc) {
$result = new Result(0,1,$exc->getMessage() .'-'.$exc->getTraceAsString());
}
}else{
$result = new Result(0,401,'Silahkan masuk untuk melanjutkan');
}
}
return $this->getOutput($result->toJson());
}
public function loadpasienAction(){
$result = new Result();
......@@ -1726,6 +1947,29 @@ class ApiController extends \Application\Master\GlobalActionController {
$load = $dokter->loadDokter($post->id_poli);
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());
}
public function loadDokterWaktuAction(){
$result = new Result();
$request = $this->getRequest();
$post = $request->getPost();
$storage = \Application\Model\Param\Storage::factory($this->getDb(), $this->getConfig());
$dokter = new \Application\Model\Param($storage);
// print_r($post->id_poli);die;
$load = $dokter->loadDokterWaktu($post->id_poli);
if($load->code == 0){
$result->code = $result::CODE_SUCCESS;
$result->info = $result::INFO_SUCCESS;
......
......@@ -174,6 +174,18 @@ class UserController extends \Application\Master\GlobalActionController
return $this->redirect()->toRoute('login');
}
}
public function registrasiAction(){
$view = new ViewModel();
$uri = $this->getRequest()->getUri();
$baseurl = sprintf('//%s', $uri->getHost());
$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');
$this->headScript->appendFile('/action-js/index-js/registrasi.js');
$this->layout("layout/layoutUmum");
return $view;
}
}
......@@ -158,6 +158,10 @@ class Param extends Mapper {
$data = $this->_storage->loadDokter($id);
return $data;
}
public function loadDokterWaktu($id = null){
$data = $this->_storage->loadDokterWaktu($id);
return $data;
}
public function loadAntrianAdmin($idokter = null){
$data = $this->_storage->loadAntrianAdmin($idokter);
return $data;
......
......@@ -80,7 +80,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$insert = $this->_sql->insert()
->into($table)
->values($atribut);
// echo str_replace('"','',$insert->getSqlString());die;
$result = $this->execute($insert);
return $result;
......@@ -1000,7 +1000,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = " SELECT register_dokter.id_register, dokter_to_poli.nama_dokter, poli.nama_poli, ruang.nama_ruang,register_dokter.antrian_all,register_dokter.waktu_antrian, register_dokter.jam_mulai, register_dokter.create_date
$sql = " SELECT register_dokter.id_register, dokter_to_poli.nama_dokter, poli.nama_poli, ruang.nama_ruang,register_dokter.antrian_all,register_dokter.waktu_antrian, register_dokter.jam_mulai, register_dokter.create_date,poli.id_poli,ruang.id_ruang,dokter_to_poli.id_dokter
FROM register_dokter
INNER JOIN poli
ON register_dokter.id_poli = poli.id_poli
......@@ -1150,12 +1150,14 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result();
try {
$sql = " SELECT * FROM poli";
$sql = " SELECT pl.id_poli,pl.nama_poli, pl.kode_poli,pl.deskripsi_poli,pl.image_poli,uss.password,uss.iduser FROM poli pl
LEFT JOIN user_data_header uss
On pl.nama_poli = uss.username";
if($id){
$sql .= " WHERE id_poli = $id ";
$sql .= " WHERE pl.id_poli = $id ";
}
$sql .= " ORDER BY nama_poli ASC";
$sql .= " ORDER BY pl.nama_poli ASC";
......@@ -1520,6 +1522,49 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$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 loadDokterWaktu($id = null){
$result = new Result();
try {
$sql = " SELECT DISTINCT on (idd.create_date) idd.create_date,dp.id_dokter, dp.nama_dokter,pl.id_poli
FROM antrian_pasien idd
LEFT JOIN dokter_to_poli dp
on idd.id_dokter = dp.id_dokter
LEFT JOIN poli pl
on idd.id_poli = pl.id_poli
WHERE idd.create_date > CURRENT_TIMESTAMP - INTERVAL '24 HOUR' AND pl.id_poli=$id";
$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();
......
......@@ -4,6 +4,8 @@
<div class="card-body ">
<h1 class="h4 text-center text-gray-900 mb-4" style="font-size: 50px;font-weight: bold">Kelola Dokter</h1>
<button type="button" class="btn btn-primary fa fa-plus btn-lg" data-toggle="modal" data-target="#addData" id="tambahmodal"> Tambah</button>
<button type="button" class="btn btn-info fa btn-lg" style="float: right;" id="update"> Update Seluruh Kondisi </button>
<br>
<br>
......@@ -72,9 +74,9 @@
</div>
<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">Tambah</button>
<button button type="button" class="btn btn-danger" onclick="reset()">Reset</button>
<button type="submit" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-default" data-dismiss="modal">Keluar</button>
</div>
</form>
</div>
......@@ -123,7 +125,7 @@
<div class="modal-footer">
<button button type="button" class="btn btn-primary" id="edit">Edit</button>
<button button type="button" class="btn btn-danger" onclick="reset()">Reset</button>
<button type="submit" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-default" data-dismiss="modal">Keluar</button>
</div>
</form>
</div>
......
......@@ -27,6 +27,7 @@
<tr>
<th style="">NO</th>
<th>Nama Poli</th>
<th>Password</th>
<th>Kode Poli</th>
<th>Deskripsi Poli</th>
<th>Gambar Poli</th>
......@@ -56,11 +57,20 @@
<div class="modal-body">
<form id="myForm" >
<!-- <input type="hidden" id="id_poli" class="form-control" /></input> -->
<div class="form-group">
<label>Nama Poli</label>
<input type="input" id="nama_poli" name="nama_poli" class="form-control" placeholder="Nama Poli" required ></input>
<label>Nama Poli (Username)</label>
<input type="input" id="nama_poli" name="nama_poli" class="form-control" placeholder="Nama Poli (Username)" required ></input>
</select>
</div>
<div class="form-group">
<label>Pasword</label>
<input type="password" id="password" name="password" class="form-control" placeholder="Password" required ></input>
</select>
</div>
<input style="margin-left:20px" type="checkbox" onclick="changetype()"> <a>Show Password</a>
<br>
<div class="form-group">
<label>Kode Poli</label>
<input type="input" id="kode_poli" name="kode_poli" class="form-control" placeholder="Kode Poli" required ></input>
......@@ -73,10 +83,12 @@
<label>Gambar Poli</label>
<input type="file" name="gambar_poli" id="gambar_poli" class="form-control-file">
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary" id="tambah">Add</button>
<button type="submit" class="btn btn-primary" id="tambah">Tambah</button>
<button type="button" class="btn btn-danger" onclick="reset()">Reset</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Keluar</button>
</div>
</form>
</div>
......@@ -99,6 +111,7 @@
<form id="myFormEdit" >
<input type="hidden" id="id_poli" class="form-control" /></input>
<input type="input" id="iduser" class="form-control" /></input>
<!-- <input type="input" id="nama_poli2" class="form-control" /></input> -->
<div class="form-group">
......@@ -106,6 +119,13 @@
<input type="input" id="nama_poliEdt" name="nama_poli" class="form-control" placeholder="Nama Poli" required ></input>
</select>
</div>
<div class="form-group">
<label>Pasword</label>
<input type="password" id="passwordedt" name="password" class="form-control" placeholder="Password" required ></input>
</select>
</div>
<input style="margin-left:20px" type="checkbox" onclick="changetypee()"> <a>Show Password</a>
<br>
<div class="form-group">
<label>Kode Poli</label>
<input type="input" id="kode_poliEdt" name="kode_poli" class="form-control" placeholder="Kode Poli" required></input>
......
......@@ -18,6 +18,7 @@
<div class="card-body ">
<h1 class="h4 text-center text-gray-900 mb-4" style="font-size: 50px;font-weight: bold">Kelola Ruangan</h1>
<button type="button" class="btn btn-primary fa fa-plus btn-lg" data-toggle="modal" data-target="#addData" id="tambahmodal"> Tambah</button>
<button type="button" class="btn btn-info fa btn-lg" style="float: right;" id="update"> Update Seluruh Kondisi</button>
<br>
<br>
<table class="table table-bordered" id="dataTable">
......@@ -72,9 +73,9 @@
<input type="input" id="nama_ruang" name="nama_ruang" class="form-control" placeholder="Nama Ruangan" required /></input>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="tambah">Add</button>
<button type="button" class="btn btn-primary" id="tambah">Tamabah</button>
<button type="button" class="btn btn-danger" onclick="reset()">Reset</button>
<button type="submit" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-default" data-dismiss="modal">Keluar</button>
</div>
</form>
</div>
......@@ -113,7 +114,7 @@
<div class="modal-footer">
<button button type="button" class="btn btn-primary" id="edit">Edit</button>
<button button type="button" class="btn btn-danger" onclick="reset()">Reset</button>
<button type="submit" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-default" data-dismiss="modal">Keluar</button>
</div>
</form>
</div>
......
......@@ -90,9 +90,9 @@
</div>
</div>
<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">Tambah</button>
<button button type="button" class="btn btn-danger" onclick="reset()">Reset</button>
<button type="submit" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-default" data-dismiss="modal">Keluar</button>
</div>
</form>
</div>
......@@ -118,6 +118,11 @@
<form id="myForm" >
<input type="hidden" id="id_register" class="form-control" /></input>
<input type="hidden" id="antrian_before" class="form-control" /></input>
<input type="hidden" id="id_dokter" class="form-control" /></input>
<input type="hidden" id="id_poli" class="form-control" /></input>
<input type="hidden" id="id_ruang" class="form-control" /></input>
<input type="text" id="tanggal_before" class="form-control" /></input>
<!-- <input type="text" id="antrian_before" class="form-control" /></input> -->
<div class="form-group">
......@@ -169,7 +174,7 @@
<div class="modal-footer">
<button button type="button" class="btn btn-primary" id="edit">Edit</button>
<button button type="button" class="btn btn-danger" onclick="reset()">Reset</button>
<button type="submit" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-default" data-dismiss="modal">Keluar</button>
</div>
</form>
</div>
......
......@@ -48,7 +48,7 @@ $('#poli').on('change', function () {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loaddokter',
url: baseURL + '/api/loadDokterWaktu',
data: {
id_poli: idpoli
},
......@@ -65,7 +65,7 @@ $('#poli').on('change', function () {
$("select#dokter").removeAttr('disabled');
$("select#dokter").html(optionseg);
} else {
bootbox.alert({ message: 'Data Dokter Kosong', centerVertical: true });
bootbox.alert({ message: 'Data Dokter di poli ini kosong', centerVertical: true });
}
}
});
......@@ -76,7 +76,7 @@ function loadpoli() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadpoli',
url: baseURL + '/api/loadregisterpoli',
success: function (result) {
if (result['code'] == 0) {
......
......@@ -120,7 +120,7 @@ $('#poli').on('change', function () {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loaddokter',
url: baseURL + '/api/loadDokterWaktu',
data: {
id_poli: idpoli
},
......
......@@ -159,7 +159,7 @@ $('#poli').on('change', function () {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loaddokter',
url: baseURL + '/api/loadDokterWaktu',
data: {
id_poli: idpoli
},
......@@ -176,7 +176,7 @@ $('#poli').on('change', function () {
$("select#dokter").removeAttr('disabled');
$("select#dokter").html(optionseg);
} else {
bootbox.alert({ message: 'Data Poli Kosong', centerVertical: true });
bootbox.alert({ message: 'Dokter di poli ini belum ada yg didaftarkan', centerVertical: true });
}
}
});
......@@ -186,7 +186,7 @@ function loadpoli() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadpoli',
url: baseURL + '/api/loadregisterpoli',
success: function (result) {
if (result['code'] == 0) {
......@@ -234,7 +234,7 @@ function validasipasien(id_poli, dokter, id_pasien) {
let nama = result.data[0]['nama'];
swal({
title: "Pasien dengan nama'" + nama + "' telah melakukan pendaftaran di poli dan dokter ini! \n Apakah anda ingin mencetak no antrian lagi ? ",
title: "Pasien dengan nama '" + nama + "' telah melakukan pendaftaran di poli dan dokter ini! \n Apakah anda ingin mencetak no antrian lagi ? ",
type: "warning",
confirmButtonClass: "success",
confirmButtonText: "Yes!",
......
......@@ -497,7 +497,7 @@ function Delete(param) {
let nama_dokter = result.data[0].nama_dokter;
swal({
title: "Apakah yakin mengahapus dokter '" + nama_dokter + "'? ",
type: "error",
type: "warning",
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes!",
showCancelButton: true,
......@@ -574,4 +574,39 @@ function Update(id_dokter, id_condition) {
}
});
}
$('#update').on('click', function () {
setruang()
})
function setruang() {
param = null
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/updateconditionseluruhdokter',
data: {
id: param,
},
success: function (result) {
console.log(result);
// console.log(result)
if (result.code == 0) {
location.reload();
} else {
bootbox.alert({ message: 'Gagal ', centerVertical: true });
}
},
error: function () {
bootbox.alert({ message: 'Data dokter masih terdaftar dalam poli ', centerVertical: true });
}
});
}
\ No newline at end of file
......@@ -277,7 +277,7 @@ function Delete(id_pasien) {
let nama_pasien = result.data[0].nama;
swal({
title: "Apakah yakin mengahapus pasien '" + nama_pasien + "'? ",
type: "error",
type: "warning",
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes!",
showCancelButton: true,
......
......@@ -35,6 +35,7 @@ function Loadpoli() {
cols += '<td class="">' + counter + '</td>';
// cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].id_poli + '</td>';
cols += '<td class="tdCenterText bgtd1 ">' + data[x].nama_poli + '</td>';
cols += '<td class="tdCenterText bgtd1 ">' + data[x].password + '</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>';
......@@ -55,11 +56,12 @@ function Loadpoli() {
paging: true,
columnDefs: [
{ width: 30, targets: 0 },
{ width: 120, targets: 1 },
{ width: 120, targets: 2 },
{ width: 250, targets: 3 },
{ width: 100, targets: 4 },
{ width: 120, targets: 5 },
{ width: 100, targets: 1 },
{ width: 10, targets: 2 },
{ width: 80, targets: 3 },
{ width: 200, targets: 4 },
{ width: 100, targets: 5 },
{ width: 100, targets: 6 },
],
});
......@@ -123,15 +125,19 @@ $('#tambah').on('click', function (e) {
function savedatapoli() {
let nama_poli = $('#nama_poli').val();
let kode_poli = $('#kode_poli').val();
let deskripsi_poli = $('#deskripsi_poli').val();
let password = $('#password').val();
const fileupload = $('#gambar_poli').prop('files')[0];
let formData = new FormData();
formData.append('inama_poli', nama_poli);
formData.append('ipassword', password);
formData.append('ikode_poli', kode_poli);
formData.append('ideskripsi_poli', deskripsi_poli);
formData.append('fileupload', fileupload); // set file ke tipe data binary
console.log(id_poli)
$.ajax({
type: 'POST',
......@@ -154,7 +160,7 @@ function savedatapoli() {
icon: "succes",
button: "ok",
}, function () {
location.reload();
// location.reload();
});
} else {
......@@ -279,6 +285,8 @@ function validasipoli(nama_poli, kode_poli, deskripsi_poli, fileupload) {
$('#edit').on('click', function () {
let id_poli = $('#id_poli').val();
let iduser = $('#iduser').val();
console.log(iduser)
let nama_poli = $('#nama_poliEdt').val();
let kode_poli = $('#kode_poliEdt').val();
let deskripsi_poli = $('#deskripsi_poliEdt').val();
......@@ -326,17 +334,22 @@ $('#edit').on('click', function () {
}
})
function editdatapoli(id_poli) {
let nama_poli = $('#nama_poliEdt').val();
let kode_poli = $('#kode_poliEdt').val();
let deskripsi_poli = $('#deskripsi_poliEdt').val();
let password = $('#passwordedt').val();
let iduser = $('#iduser').val();
const fileupload = $('#gambar_poliedt').prop('files')[0];
let formData = new FormData();
formData.append('id_poli', id_poli);
formData.append('iduser', iduser);
// console.log(fileuploadedt)
formData.append('inama_poli', nama_poli);
formData.append('ikode_poli', kode_poli);
formData.append('ipassword', password);
formData.append('ideskripsi_poli', deskripsi_poli);
formData.append('fileupload', fileupload); // set file ke tipe data binary
......@@ -399,7 +412,7 @@ function loadedit(param) {
id: param,
},
success: function (result) {
// console.log(result);
console.log(result);
// $('.loaddata').empty();
......@@ -409,6 +422,9 @@ function loadedit(param) {
let data = result.data;
$('#id_poli').val(data[0].id_poli);
$('#iduser').val(data[0].iduser);
$('#passwordedt').val(data[0].password);
// console.log(data[0].iduser)
$('#nama_poliEdt').val(data[0].nama_poli);
$('#nama_poli2').val(data[0].nama_poli);
$('#kode_poliEdt').val(data[0].kode_poli);
......@@ -438,7 +454,7 @@ function Delete(param) {
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",
type: "warning",
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes!",
showCancelButton: true,
......@@ -481,3 +497,19 @@ function Delete(param) {
}
function changetype() {
var x = document.getElementById("password");
if (x.type === "password") {
x.type = "text";
} else {
x.type = "password";
}
}
function changetypee() {
var x = document.getElementById("passwordedt");
if (x.type === "password") {
x.type = "text";
} else {
x.type = "password";
}
}
\ No newline at end of file
......@@ -424,7 +424,7 @@ function Delete(param) {
let lantai = result.data[0].lantai;
swal({
title: "Apakah yakin mengahapus ruang '" + nama_ruang + " ' lantai '" + lantai + "'? ",
type: "error",
type: "warning",
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes!",
showCancelButton: true,
......@@ -501,4 +501,38 @@ function Update(id_ruang, id_condition) {
}
});
}
$('#update').on('click', function () {
setruang()
})
function setruang() {
param = null
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/updateconditionseluruhruang',
data: {
id: param,
},
success: function (result) {
console.log(result);
// console.log(result)
if (result.code == 0) {
location.reload();
} else {
bootbox.alert({ message: 'Gagal ', centerVertical: true });
}
},
error: function () {
bootbox.alert({ message: 'Data dokter masih terdaftar dalam poli ', centerVertical: true });
}
});
}
\ No newline at end of file
......@@ -102,7 +102,7 @@ function Delete(param) {
let nama_ruang = result.data[0].nama_ruang;
swal({
title: "Apakah yakin mengahapus Registrasi Dokter dengan Nama Poli '" + nama_poli + "', Nama Dokter '" + nama_dokter + "' dan Nama Ruangan '" + nama_ruang + "' ini ? ",
type: "error",
type: "warning",
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes!",
showCancelButton: true,
......
......@@ -84,7 +84,7 @@ $('#poli').on('change', function () {
$("select#dokter").html(optionseg);
$("select#ruang").html(optionseg);
bootbox.alert({ message: 'Data Dokter Kosong', centerVertical: true });
// bootbox.alert({ message: 'Data Dokter Kosong', centerVertical: true });
}
}
......@@ -115,7 +115,7 @@ $('#poli').on('change', function () {
$("select#ruang").html(optionseg);
} else {
bootbox.alert({ message: 'Data Ruang Kosong', centerVertical: true });
// bootbox.alert({ message: 'Data Ruang Kosong', centerVertical: true });
}
}
......@@ -245,9 +245,18 @@ $('#tambahmodal').on('click', function () {
$('#tambah').on('click', function () {
let ruang = $("#ruang option:selected").attr("value");
let poli = $('#poli option:selected').attr("value");
let dokter = $('#dokter option:selected').attr("value");
SaveDataRegister()
if (validasijadwal(poli, ruang, dokter) == 1) {
bootbox.alert({ message: 'Dokter dipoli sudah ada!', centerVertical: true });
}
if (validasijadwal(poli, ruang, dokter) == 2) {
bootbox.alert({ message: 'Ruangan dipoli sudah ada!', centerVertical: true });
} else {
SaveDataRegister()
}
})
......@@ -261,7 +270,6 @@ function SaveDataRegister(param) {
let waktu_antrian = $('#waktu_antrian').val();
let jam_mulai = $('#jam_mulai').val();
if (ruang == null || ruang == "") {
swal({
title: "",
......@@ -342,7 +350,6 @@ function SaveDataRegister(param) {
ijam_mulai: jam_mulai,
},
......@@ -385,6 +392,59 @@ function SaveDataRegister(param) {
}
function validasijadwal(poli, ruang, dokter) {
var exist = 0;
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadantrianregister',
async: false,
data: {
id: null,
},
success: function (result) {
console.log(result)
var data = result.data;
for (x in data) {
if (poli == data[x]['id_poli']) {
if (dokter == data[x]['id_dokter']) {
exist = 1;
}
}
if (poli == data[x]['id_poli']) {
if (ruang == data[x]['id_ruang']) {
exist = 2;
}
}
if (poli == data[x]['id_poli']) {
if (parseInt(dokter) < 1) {
exist = 3;
}
}
}
},
error: function (xhr) {
//alert(xhr.status+'-'+xhr.statusText);
}
});
return exist;
}
$('#edit').on('click', function () {
......@@ -399,15 +459,17 @@ $('#edit').on('click', function () {
function editregister(id_register) {
let ruang = $("#ruang option:selected").attr("value");
let poli = $('#poli option:selected').attr("value");
let dokter = $('#dokter option:selected').attr("value");
let poli = $('#id_poli').val();
let ruang = $('#id_ruang').val();
let dokter = $('#id_dokter').val();
let antrian_all = $('#antrian_alledt').val();
let waktu_antrian = $('#waktu_antrianedt').val();
let jam_mulai = $('#jam_mulaiedt').val();
console.log(antrian_all)
let antrian_before = $('#antrian_before').val();
let tanggal_before = $('#tanggal_before').val();
console.log(poli)
if (antrian_all == null || antrian_all == "") {
swal({
title: "",
......@@ -462,11 +524,13 @@ function editregister(id_register) {
iwaktu_antrian: waktu_antrian,
ijam_mulai: jam_mulai,
iantrian_before: antrian_before,
itanggal_before: tanggal_before,
},
success: function (response) {
console.log(response);
if (response['code'] == 0) {
success: function (result) {
if (result.code == 0) {
$('#editData').modal('hide');
swal({
title: "",
......@@ -477,10 +541,6 @@ function editregister(id_register) {
function () {
location.reload();
});
} else {
swal({
title: "",
......@@ -518,9 +578,9 @@ function loadedit(id_register) {
id: id_register,
},
success: function (result) {
// console.log(result.code);
// $('.loaddata').empty();
// console.log(result);
console.log(result);
if (result.code == 0) {
......@@ -532,7 +592,8 @@ function loadedit(id_register) {
optrua = `<p class="card-text">` + data[0].nama_ruang + `</p>`
// console.log(data[0].nama_poli);
$('#id_register').val(data[0].id_register);
$('#tanggal_before').val(data[0].create_date);
console.log(data[0].create_date)
$('#poliedt').html(optpol);
$('#dokteredt').html(optdok);
$('#ruangedt').html(optrua);
......@@ -540,6 +601,12 @@ function loadedit(id_register) {
$('#antrian_alledt').val(data[0].antrian_all);
$('#id_dokter').val(data[0].id_dokter);
$('#id_poli').val(data[0].id_poli);
$('#id_ruang').val(data[0].id_ruang);
$('#antrian_before').val(data[0].antrian_all);
$('#jam_mulaiedt').val(data[0].jam_mulai);
$('#waktu_antrianedt').val(data[0].waktu_antrian);
......@@ -575,7 +642,7 @@ function Delete(param) {
let nama_ruang = result.data[0].nama_ruang;
swal({
title: "Apakah yakin mengahapus Registrasi Dokter dengan Nama Poli '" + nama_poli + "', Nama Dokter '" + nama_dokter + "' dan Nama Ruangan '" + nama_ruang + "' ini ? ",
type: "error",
type: "errwarningor",
confirmButtonClass: "btn-danger",
confirmButtonText: "Yes!",
showCancelButton: true,
......@@ -617,4 +684,62 @@ function Delete(param) {
}
});
}
\ No newline at end of file
}
// function differenceday(){
// date = new Date();
// $.ajax({
// type: 'POST',
// dataType: 'json',
// url: baseURL + '/api/loadRegisterRuang',
// data: {
// id_poli: null
// },
// success: function (result) {
// if (result['code'] == 0) {
// var res = result['data'];
// for(x in res){
// date = res[x]['date'];
// date = new Date(date);
// now = new Date();
// if( date.getDate() == now.getDate() ){
// }else if(date.getDate() == now.getDate() && date.getMonth() != now.getMonth()){
// setruang();
// }
// else if(date.getDate() != now.getDate()){
// setruang();
// }
// }
// } else {
// bootbox.alert({ message: 'Data Ruang Kosong', centerVertical: true });
// }
// }
// });
// //
// }
// function setruang(){
// param = null
// $.ajax({
// type: 'POST',
// dataType: 'json',
// url: baseURL + '/api/updateconditionruang',
// data: {
// id: param,
// }
// })
// }
\ No newline at end of file
......@@ -7,14 +7,14 @@ $('#pilih').on('click', function () {
function loaddatadokter() {
let poli =$("#antrian_poli option:selected").attr("value");
console.log(poli);
let poli = $("#antrian_poli option:selected").attr("value");
console.log(poli);
/* save data */
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadpoli',
url: baseURL + '/api/loadregisterpoli',
data: {
id_poli: poli,
},
......@@ -49,11 +49,11 @@ function loadpoli() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadpoli',
url: baseURL + '/api/loadregisterpoli',
success: function (result) {
if (result['code'] == 0) {
console.log (result);
console.log(result);
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>Pilih</option>';
......@@ -64,10 +64,10 @@ function loadpoli() {
let $id = result.data[0].id_poli;
// let $id = result.data['id_poli'];
// console.log($id);
} else {
}
}
});
......
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