90 lines
4.9 KiB
PHP
90 lines
4.9 KiB
PHP
<?php
|
|
include('../../koneksi.php');
|
|
?>
|
|
|
|
<script type="text/javascript">$("#tabel_data_user").DataTable({"stateSave": true,"paging": true,"lengthChange": true,"searching": true,"ordering": false,"info": true,"autoWidth": false});</script>
|
|
<table id="tabel_data_user" class="table table-striped table-bordered" cellpadding="1" style="font-size:12px;">
|
|
<thead>
|
|
<tr>
|
|
<td align="center"><b>Nama</b></td>
|
|
<td align="center"><b>NIP</b></td>
|
|
<td align="center"><b>Satuan Kerja</b></td>
|
|
<td align="center"><b>Username</b></td>
|
|
<td align="center"><b>Password</b></td>
|
|
<td align="center"><b>Jenis User</b></td>
|
|
<td align="center"><b>Aktif</b></td>
|
|
<td align="center" width="80px;"><b>Tools</b></td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$data = pg_query("SELECT p.nama,p.nipb,s.nama,u.password,j.jenis,u.id,u.aktif,u.nama
|
|
FROM data_pegawai p
|
|
INNER JOIN data_user u ON (p.id=u.data_pegawai_id)
|
|
INNER JOIN satuan_kerja s ON (p.satuan_kerja=s.id)
|
|
INNER JOIN jenis_user j ON (j.id=u.jenis_user)
|
|
ORDER BY u.id DESC");
|
|
while($row=pg_fetch_array($data)) {
|
|
?>
|
|
<tr>
|
|
<td><?php echo $row[0]; ?></td>
|
|
<td><?php echo $row[1]; ?></td>
|
|
<td><?php echo $row[2]; ?></td>
|
|
<td><?php echo $row[7]; ?></td>
|
|
<td><?php echo $row[3]; ?></td>
|
|
<td><?php echo $row[4]; ?></td>
|
|
<td><?php if ($row[6]=='t') {echo 'ON';} else {echo 'OFF';} ?></td>
|
|
<td align="center">
|
|
<button type="button" name="edit_user" style="height:22px;" class="btn btn-teal btn-xs edit_user" id="<?php echo $row['id'];?>" data-content="Edit Data" rel="popover" data-placement="bottom" data-trigger="hover">
|
|
<i class="fa fa fa-pencil"></i>
|
|
</button>
|
|
<!-- <button type="button" name="delete_user" style="height:22px;"class="btn btn-danger btn-xs delete_user" id="<?php echo $row['id'];?>" data-content="Hapus" rel="popover" data-placement="bottom" data-trigger="hover">
|
|
<i class="fa fa-remove"></i>
|
|
</button> -->
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
$("#tabel_data_user").on('click','.edit_user',function(){
|
|
var id = $(this).attr('id');
|
|
$('#modal_user').modal('show');
|
|
$('#modal_body_user').html("");
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/master/user/modal.php",
|
|
data: 'id='+id,
|
|
success: function(data){
|
|
$('#modal_body_user').html(data);
|
|
$('#nama').first().focus().selected();
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
$("#tabel_data_user").on('click','.delete_user',function(){
|
|
var x = confirm("Anda yakin ingin menghapus ?");
|
|
if (x) {
|
|
var key = "delete_user";
|
|
var id = $(this).attr('id');
|
|
var rowElement = $(this).parent().parent();
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/master/user/crud.php",
|
|
data: 'id='+id
|
|
+'&key='+key,
|
|
success: function(data){
|
|
rowElement.fadeOut(500).remove();
|
|
}
|
|
});
|
|
} else {}
|
|
});
|
|
</script>
|
|
|