Commit f59f81df authored by Indra Raja's avatar Indra Raja

Merge branch 'Version2' into 'Version3'

Baru dra

See merge request !12
parents 1f6a780f eb069d8b
...@@ -693,8 +693,8 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -693,8 +693,8 @@ class ApiController extends \Application\Master\GlobalActionController {
$request = $this->getRequest(); $request = $this->getRequest();
$post = $request->getPost(); $post = $request->getPost();
$table_poli= 'poli'; $table_poli= 'poli';
$tabel = 'user_data_header';
if ($request->isPost()) { if ($request->isPost()) {
...@@ -705,9 +705,11 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -705,9 +705,11 @@ class ApiController extends \Application\Master\GlobalActionController {
$fileupload = $_FILES['fileupload']['tmp_name']; $fileupload = $_FILES['fileupload']['tmp_name'];
// print_r($fileupload);die; // print_r($fileupload);die;
$nama_poli = $post->inama_poli; $nama_poli = $post->inama_poli;
$id_poli = $post->id_poli;
$kode_poli = $post->ikode_poli; $kode_poli = $post->ikode_poli;
$deskripsi_poli = $post->ideskripsi_poli; $deskripsi_poli = $post->ideskripsi_poli;
$password = $post->ipassword;
if (!empty($fileupload)){ if (!empty($fileupload)){
$ImageName = $_FILES['fileupload']['name']; $ImageName = $_FILES['fileupload']['name'];
$tipes = $_FILES['fileupload']['type']; $tipes = $_FILES['fileupload']['type'];
...@@ -721,6 +723,8 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -721,6 +723,8 @@ class ApiController extends \Application\Master\GlobalActionController {
$alamatfile = $uploaddir.$ImageName; $alamatfile = $uploaddir.$ImageName;
if (move_uploaded_file($_FILES['fileupload']['tmp_name'],$alamatfile)){ if (move_uploaded_file($_FILES['fileupload']['tmp_name'],$alamatfile)){
// print_r('berhasil');die; // print_r('berhasil');die;
/* jika upload berhasil ke folder sever */ /* jika upload berhasil ke folder sever */
$dataAtt = array( $dataAtt = array(
...@@ -729,14 +733,32 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -729,14 +733,32 @@ class ApiController extends \Application\Master\GlobalActionController {
'image_poli' => $ImageName, 'image_poli' => $ImageName,
'deskripsi_poli' => $deskripsi_poli, 'deskripsi_poli' => $deskripsi_poli,
'kode_poli' => $kode_poli, 'kode_poli' => $kode_poli,
); );
$param->saveGlobal($dataAtt, $table_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->code = 0;
$result->info = 'ok'; $result->info = 'ok';
$result->data = $dataArrayPoli->data; $result->data = $dataArrayPoli->data;
}else{ }else{
$result->code = 17; $result->code = 17;
...@@ -776,6 +798,9 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -776,6 +798,9 @@ class ApiController extends \Application\Master\GlobalActionController {
$fileupload = $_FILES['fileupload']['tmp_name']; $fileupload = $_FILES['fileupload']['tmp_name'];
$id_poli = $post->id_poli; $id_poli = $post->id_poli;
$password = $post->ipassword;
$iduser = $post->iduser;
// print_r($iduser);die;
$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;
...@@ -794,6 +819,9 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -794,6 +819,9 @@ class ApiController extends \Application\Master\GlobalActionController {
if (move_uploaded_file($_FILES['fileupload']['tmp_name'],$alamatfile)){ if (move_uploaded_file($_FILES['fileupload']['tmp_name'],$alamatfile)){
/* jika upload berhasil ke folder sever */ /* jika upload berhasil ke folder sever */
$dataArrayPoli = array( $dataArrayPoli = array(
...@@ -808,7 +836,22 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -808,7 +836,22 @@ class ApiController extends \Application\Master\GlobalActionController {
$where = 'id_poli='.$id_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;
$tabel = 'user_data_header';
$where = 'iduser='.$iduser;
$param->updateGlobal($table, $dataArray, $where);
$result->code = 0; $result->code = 0;
$result->info = 'ok'; $result->info = 'ok';
...@@ -822,6 +865,7 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -822,6 +865,7 @@ class ApiController extends \Application\Master\GlobalActionController {
}else{ }else{
$dataArrayPoli = array( $dataArrayPoli = array(
'nama_poli' => $nama_poli, 'nama_poli' => $nama_poli,
...@@ -831,8 +875,24 @@ class ApiController extends \Application\Master\GlobalActionController { ...@@ -831,8 +875,24 @@ class ApiController extends \Application\Master\GlobalActionController {
$table_poli = 'poli'; $table_poli = 'poli';
$where = 'id_poli='.$id_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) { }catch (\Exception $exc) {
......
...@@ -183,6 +183,18 @@ class UserController extends \Application\Master\GlobalActionController ...@@ -183,6 +183,18 @@ class UserController extends \Application\Master\GlobalActionController
return $this->redirect()->toRoute('login'); 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;
}
} }
...@@ -80,7 +80,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton { ...@@ -80,7 +80,7 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$insert = $this->_sql->insert() $insert = $this->_sql->insert()
->into($table) ->into($table)
->values($atribut); ->values($atribut);
// echo str_replace('"','',$insert->getSqlString());die;
$result = $this->execute($insert); $result = $this->execute($insert);
return $result; return $result;
...@@ -1148,12 +1148,14 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton { ...@@ -1148,12 +1148,14 @@ class Mysql extends \Khansia\Db\Storage implements Skeleton {
$result = new Result(); $result = new Result();
try { 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){ 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";
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<tr> <tr>
<th style="">NO</th> <th style="">NO</th>
<th>Nama Poli</th> <th>Nama Poli</th>
<th>Password</th>
<th>Kode Poli</th> <th>Kode Poli</th>
<th>Deskripsi Poli</th> <th>Deskripsi Poli</th>
<th>Gambar Poli</th> <th>Gambar Poli</th>
...@@ -56,11 +57,20 @@ ...@@ -56,11 +57,20 @@
<div class="modal-body"> <div class="modal-body">
<form id="myForm" > <form id="myForm" >
<!-- <input type="hidden" id="id_poli" class="form-control" /></input> -->
<div class="form-group"> <div class="form-group">
<label>Nama Poli</label> <label>Nama Poli (Username)</label>
<input type="input" id="nama_poli" name="nama_poli" class="form-control" placeholder="Nama Poli" required ></input> <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> </select>
</div> </div>
<input style="margin-left:20px" type="checkbox" onclick="changetype()"> <a>Show Password</a>
<br>
<div class="form-group"> <div class="form-group">
<label>Kode Poli</label> <label>Kode Poli</label>
<input type="input" id="kode_poli" name="kode_poli" class="form-control" placeholder="Kode Poli" required ></input> <input type="input" id="kode_poli" name="kode_poli" class="form-control" placeholder="Kode Poli" required ></input>
...@@ -73,6 +83,8 @@ ...@@ -73,6 +83,8 @@
<label>Gambar Poli</label> <label>Gambar Poli</label>
<input type="file" name="gambar_poli" id="gambar_poli" class="form-control-file"> <input type="file" name="gambar_poli" id="gambar_poli" class="form-control-file">
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="submit" class="btn btn-primary" id="tambah">Tambah</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-danger" onclick="reset()">Reset</button>
...@@ -99,6 +111,7 @@ ...@@ -99,6 +111,7 @@
<form id="myFormEdit" > <form id="myFormEdit" >
<input type="hidden" id="id_poli" class="form-control" /></input> <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> --> <!-- <input type="input" id="nama_poli2" class="form-control" /></input> -->
<div class="form-group"> <div class="form-group">
...@@ -106,6 +119,13 @@ ...@@ -106,6 +119,13 @@
<input type="input" id="nama_poliEdt" name="nama_poli" class="form-control" placeholder="Nama Poli" required ></input> <input type="input" id="nama_poliEdt" name="nama_poli" class="form-control" placeholder="Nama Poli" required ></input>
</select> </select>
</div> </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"> <div class="form-group">
<label>Kode Poli</label> <label>Kode Poli</label>
<input type="input" id="kode_poliEdt" name="kode_poli" class="form-control" placeholder="Kode Poli" required></input> <input type="input" id="kode_poliEdt" name="kode_poli" class="form-control" placeholder="Kode Poli" required></input>
......
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
<input type="hidden" id="id_dokter" 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_poli" class="form-control" /></input>
<input type="hidden" id="id_ruang" class="form-control" /></input> <input type="hidden" id="id_ruang" class="form-control" /></input>
<input type="hidden" id="tanggal_before" class="form-control" /></input> <input type="text" id="tanggal_before" class="form-control" /></input>
<!-- <input type="text" id="antrian_before" class="form-control" /></input> --> <!-- <input type="text" id="antrian_before" class="form-control" /></input> -->
<div class="form-group"> <div class="form-group">
......
...@@ -64,6 +64,32 @@ function loaddokter() { ...@@ -64,6 +64,32 @@ function loaddokter() {
} }
} }
}); });
});
function loadpoli() {
$.ajax({
type: 'POST',
dataType: 'json',
url: baseURL + '/api/loadregisterpoli',
success: function (result) {
if (result['code'] == 0) {
//console.log (result);
var res = result['data'];
optionseg = '';
optionseg += '<option value="Pilih" disabled selected>Pilih</option>';
for (var i = 0; i < res.length; i++) {
optionseg += '<option value="' + res[i].id_poli + '">' + res[i].nama_poli + '</option>';
}
$("select#poli").html(optionseg);
} else {
bootbox.alert({ message: 'Data Poli Kosong', centerVertical: true });
}
}
});
} }
function loadantrian() { function loadantrian() {
......
...@@ -35,6 +35,7 @@ function Loadpoli() { ...@@ -35,6 +35,7 @@ function Loadpoli() {
cols += '<td class="">' + counter + '</td>'; cols += '<td class="">' + counter + '</td>';
// cols += '<td class="tdCenterText bgtd1 tdBorder-left">' + data[x].id_poli + '</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].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].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 ">' + data[x].image_poli + '</td>';
...@@ -55,11 +56,12 @@ function Loadpoli() { ...@@ -55,11 +56,12 @@ function Loadpoli() {
paging: true, paging: true,
columnDefs: [ columnDefs: [
{ width: 30, targets: 0 }, { width: 30, targets: 0 },
{ width: 120, targets: 1 }, { width: 100, targets: 1 },
{ width: 120, targets: 2 }, { width: 10, targets: 2 },
{ width: 250, targets: 3 }, { width: 80, targets: 3 },
{ width: 100, targets: 4 }, { width: 200, targets: 4 },
{ width: 120, targets: 5 }, { width: 100, targets: 5 },
{ width: 100, targets: 6 },
], ],
}); });
...@@ -123,15 +125,19 @@ $('#tambah').on('click', function (e) { ...@@ -123,15 +125,19 @@ $('#tambah').on('click', function (e) {
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();
let password = $('#password').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('ipassword', password);
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
console.log(id_poli)
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
...@@ -154,7 +160,7 @@ function savedatapoli() { ...@@ -154,7 +160,7 @@ function savedatapoli() {
icon: "succes", icon: "succes",
button: "ok", button: "ok",
}, function () { }, function () {
location.reload(); // location.reload();
}); });
} else { } else {
...@@ -279,6 +285,8 @@ function validasipoli(nama_poli, kode_poli, deskripsi_poli, fileupload) { ...@@ -279,6 +285,8 @@ function validasipoli(nama_poli, kode_poli, deskripsi_poli, fileupload) {
$('#edit').on('click', function () { $('#edit').on('click', function () {
let id_poli = $('#id_poli').val(); let id_poli = $('#id_poli').val();
let iduser = $('#iduser').val();
console.log(iduser)
let nama_poli = $('#nama_poliEdt').val(); let nama_poli = $('#nama_poliEdt').val();
let kode_poli = $('#kode_poliEdt').val(); let kode_poli = $('#kode_poliEdt').val();
let deskripsi_poli = $('#deskripsi_poliEdt').val(); let deskripsi_poli = $('#deskripsi_poliEdt').val();
...@@ -326,17 +334,22 @@ $('#edit').on('click', function () { ...@@ -326,17 +334,22 @@ $('#edit').on('click', function () {
} }
}) })
function editdatapoli(id_poli) { function editdatapoli(id_poli) {
let nama_poli = $('#nama_poliEdt').val(); let nama_poli = $('#nama_poliEdt').val();
let kode_poli = $('#kode_poliEdt').val(); let kode_poli = $('#kode_poliEdt').val();
let deskripsi_poli = $('#deskripsi_poliEdt').val(); let deskripsi_poli = $('#deskripsi_poliEdt').val();
let password = $('#passwordedt').val();
let iduser = $('#iduser').val();
const fileupload = $('#gambar_poliedt').prop('files')[0]; const fileupload = $('#gambar_poliedt').prop('files')[0];
let formData = new FormData(); let formData = new FormData();
formData.append('id_poli', id_poli); formData.append('id_poli', id_poli);
formData.append('iduser', iduser);
// console.log(fileuploadedt) // console.log(fileuploadedt)
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('ipassword', password);
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
...@@ -399,7 +412,7 @@ function loadedit(param) { ...@@ -399,7 +412,7 @@ function loadedit(param) {
id: param, id: param,
}, },
success: function (result) { success: function (result) {
// console.log(result); console.log(result);
// $('.loaddata').empty(); // $('.loaddata').empty();
...@@ -409,6 +422,9 @@ function loadedit(param) { ...@@ -409,6 +422,9 @@ function loadedit(param) {
let data = result.data; let data = result.data;
$('#id_poli').val(data[0].id_poli); $('#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_poliEdt').val(data[0].nama_poli);
$('#nama_poli2').val(data[0].nama_poli); $('#nama_poli2').val(data[0].nama_poli);
$('#kode_poliEdt').val(data[0].kode_poli); $('#kode_poliEdt').val(data[0].kode_poli);
...@@ -481,3 +497,19 @@ function Delete(param) { ...@@ -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
...@@ -423,6 +423,12 @@ function validasijadwal(poli, ruang, dokter) { ...@@ -423,6 +423,12 @@ function validasijadwal(poli, ruang, dokter) {
} }
} }
if (poli == data[x]['id_poli']) {
if (parseInt(dokter) < 1) {
exist = 3;
}
}
......
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