add sppd to git repo
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
include('../../koneksi.php');
|
||||
$key=$_POST['key'];
|
||||
|
||||
if ($key=='simpan_jns_user') {
|
||||
$id=$_POST['id'];
|
||||
$nama=$_POST['nama'];
|
||||
|
||||
$cek_jns_user=pg_query("SELECT id FROM sp_jenis_user WHERE id='$id'");
|
||||
$row_jns_user = pg_fetch_row($cek_jns_user);
|
||||
if ($row_jns_user[0] > 0) {
|
||||
$upd_jns_user = pg_query("UPDATE sp_jenis_user SET
|
||||
nama='$nama'
|
||||
WHERE id='$id'");
|
||||
} else {
|
||||
$ins_jns_user = pg_query("INSERT into sp_jenis_user (
|
||||
nama
|
||||
) values(
|
||||
'$nama'
|
||||
)
|
||||
");
|
||||
}
|
||||
} else
|
||||
if ($key=='delete_jns_user') {
|
||||
$id=$_POST['id'];
|
||||
$del_jns_user = pg_query("DELETE FROM sp_jenis_user WHERE id='$id'");
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,77 @@
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-2">
|
||||
<button type="button" id="btn_baru_jns_user" class="btn btn-primary waves-effect waves-light">
|
||||
<i class="fa fa-plus m-r-5"></i> Data baru
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div id="tabel_jns_user"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="modal_jns_user" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header no-border">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="myModalLabel">Jenis User</h4>
|
||||
</div>
|
||||
<div class="modal-body" id="modal_body_jns_user"></div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default waves-effect" data-dismiss="modal" id="keluar_jns_user">Keluar</button>
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light" id="simpan_jns_user">Simpan</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$('#tabel_jns_user').load("app/master/jns_user/tabel.php");
|
||||
|
||||
$('#btn_baru_jns_user').click(function(){
|
||||
var id = 0;
|
||||
$('#modal_jns_user').modal('show');
|
||||
$('#modal_body_jns_user').html("");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "app/master/jns_user/modal.php",
|
||||
data: 'id='+id,
|
||||
success: function(data){
|
||||
$('#modal_body_jns_user').html(data);
|
||||
$('#nama_jns_user').first().focus().selected();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#simpan_jns_user').click(function(){
|
||||
var id = $('#jns_user_id').val();
|
||||
var nama = $('#nama_jns_user').val();
|
||||
var key = 'simpan_jns_user';
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "app/master/jns_user/crud.php",
|
||||
data: 'id='+id
|
||||
+'&nama='+nama
|
||||
+'&key='+key,
|
||||
success: function(data){
|
||||
$('#modal_jns_user').modal('hide');
|
||||
$('body').removeClass('modal-open');
|
||||
$('.modal-backdrop').remove();
|
||||
alert('tersimpan..');
|
||||
$('#tabel_jns_user').load("app/master/jns_user/tabel.php");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#modal_jns_user").on("hidden.bs.modal", function () {
|
||||
$(this).off('hidden.bs.modal');
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
include ('../../koneksi.php');
|
||||
$id=$_POST['id'];
|
||||
$data=pg_query("SELECT * FROM sp_jenis_user WHERE id='$id'");
|
||||
while($row=pg_fetch_array($data)) {
|
||||
$id=$row['id'];
|
||||
$nama=$row['nama'];
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<form role="form">
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1">Jenis User</label>
|
||||
<input type="hidden" value="<?php echo $id; ?>" id="jns_user_id">
|
||||
<input type="text" class="form-control" value="<?php echo $nama; ?>" id="nama_jns_user">
|
||||
</div>
|
||||
</form>
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
include('../../koneksi.php');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">$("#tabel_data_jns_user").DataTable({"stateSave": true,"paging": true,"lengthChange": true,"searching": true,"ordering": false,"info": true,"autoWidth": false});</script>
|
||||
<table id="tabel_data_jns_user" class="table table-striped table-bordered table-condensed tb_master" cellpadding="1" >
|
||||
<thead style="font-weight:bold">
|
||||
<tr>
|
||||
<td align="center" width="40px;" align="center">ID</td>
|
||||
<td align="center">Jenis User</td>
|
||||
<td align="center" width="60px;">Tools</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody style="color:black">
|
||||
<?php
|
||||
$data = pg_query("SELECT * FROM sp_jenis_user ORDER BY id DESC");
|
||||
while($row=pg_fetch_array($data)) {
|
||||
?>
|
||||
<tr>
|
||||
<td class="kiri" align="center"><?php echo $row['id']; ?></td>
|
||||
<td><?php echo $row['nama']; ?></td>
|
||||
<td align="center" class="kana">
|
||||
<button type="button" name="edit_jns_user" style="height:22px;" class="btn btn-teal btn-xs edit_jns_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_jns_user" style="height:22px;"class="btn btn-danger btn-xs delete_jns_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_jns_user").on('click','.edit_jns_user',function(){
|
||||
var id = $(this).attr('id');
|
||||
$('#modal_jns_user').modal('show');
|
||||
$('#modal_body_jns_user').html("");
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "app/master/jns_user/modal.php",
|
||||
data: 'id='+id,
|
||||
success: function(data){
|
||||
$('#modal_body_jns_user').html(data);
|
||||
$('#nama').first().focus().selected();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("#tabel_data_jns_user").on('click','.delete_jns_user',function(){
|
||||
var x = confirm("Anda yakin ingin menghapus ?");
|
||||
if (x) {
|
||||
var key = "delete_jns_user";
|
||||
var id = $(this).attr('id');
|
||||
var rowElement = $(this).parent().parent();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "app/master/jns_user/crud.php",
|
||||
data: 'id='+id
|
||||
+'&key='+key,
|
||||
success: function(data){
|
||||
rowElement.fadeOut(500).remove();
|
||||
}
|
||||
});
|
||||
} else {}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user