90 lines
4.8 KiB
PHP
90 lines
4.8 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 table-condensed tb_master" cellpadding="1">
|
|
<thead style="font-weight:bold">
|
|
<tr>
|
|
<td align="center" width="300px;" align="center">Satuan Kerja</td>
|
|
<td align="center" style="display:none">Nama</td>
|
|
<td align="center" width="120px;">Username</td>
|
|
<td align="center" width="120px;">Password</td>
|
|
<td align="center" width="80px;">Jenis</td>
|
|
<td align="center" width="50px;">Aktif</td>
|
|
<td align="center" width="50px;">Tools</td>
|
|
</tr>
|
|
</thead>
|
|
<tbody style="color:black">
|
|
<?php
|
|
$data = pg_query("SELECT s.nama,p.nama,u.nama,u.password,j.nama,u.aktif,u.id
|
|
FROM sp_user u
|
|
INNER JOIN satuan_kerja s ON (s.id=u.satuan_kerja_id)
|
|
INNER JOIN sp_jenis_user j ON (j.id=u.sp_jenis_user_id)
|
|
LEFT OUTER JOIN data_pegawai p ON (p.id=u.data_pegawai_id)
|
|
ORDER BY u.id DESC");
|
|
while($row=pg_fetch_array($data)) {
|
|
?>
|
|
<tr>
|
|
<td class="kiri"><?php echo $row[0]; ?></td>
|
|
<td style="display:none"><?php echo $row[1]; ?></td>
|
|
<td><?php echo $row[2]; ?></td>
|
|
<td><?php echo $row[3]; ?></td>
|
|
<td align="center"><?php echo $row[4]; ?></td>
|
|
<td align="center"><?php if ($row[5]=='t') {echo 'ON';} else {echo 'OFF';} ?></td>
|
|
<td align="center" class="kanan">
|
|
<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" rel="popover" data-placement="top" 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">
|
|
|
|
$('button[name="edit_user"]').popover();
|
|
$("#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>
|
|
|