[ Mini Kiebo ]
Server: Windows NT DESKTOP-5B8S0D4 6.2 build 9200 (Windows 8 Professional Edition) i586
Path:
D:
/
xampp182
/
htdocs
/
simpegx
/
dashboard
/
application
/
[
Home
]
File: MTipePegawai.inc.php
<?php if(isset($_GET["deleteID"])) { $sql = "delete from pgw_jenis where id = ".$_GET["deleteID"]; if (mysqli_query($conn, $sql)) { echo "<script>window.alert('Data Sudah Terhapus');</script>"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } } $wdth = "col-xs-12"; $buton = "Tambah"; $id = 0; if(isset($_GET["editID"])) { $sql = "SELECT * FROM pgw_jenis where id = ".$_GET["editID"]." order by id desc"; $result = mysqli_query($conn, $sql); if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { $id = $row['id']; $jenis = $row['jenis']; $buton = "Koreksi"; } } } if(isset($_POST["Koreksi"])) { $sql = "update pgw_jenis set jenis = '".$_POST["jenis"]."' where id = ".$_POST["id"]; $exec = mysqli_query($conn, $sql); echo "<script>window.alert('Berhasil Diubah');</script>"; } if(isset($_POST["Tambah"])) { $id = Max_ID("pgw_jenis","id",$conn); $sql = "insert into pgw_jenis (jenis,id) values ('".$_POST["jenis"]."','".$id."')"; $exec = mysqli_query($conn, $sql); // echo "<br><br><br><br><br><br>".$sql; } if(isset($_GET["MTipePegawai"])) { if(isset($_GET["Entry"])) $Entry = $_GET["Entry"]; else $Entry = 0; if($Entry == 1) $wdth = "col-xs-6"; else $wdth = "col-xs-12"; }else $Entry = 0; ?> <div id="wrapper"> <div class="main-content"> <div class="row small-spacing"> <?php if($Entry == 1) { ?> <form action="dashboard.php?MTipePegawai" method="POST"> <div class="col-xs-6"> <div class="box-content"> <h4 class="box-title">Tulis Tipe Pegawai</h4> <div class="form-group has-success"> <label for="input-states-1">Keterangan</label> <div class="form-with-icon"> <textarea id="jenis" class="form-control" name="jenis" maxlength="225" rows="2" placeholder="This textarea has a limit of 225 chars."><?=$jenis;?></textarea> <i class="fa fa-pencil item-icon item-icon-right"></i> </div> </div> <input type="hidden" value="<?=$id;?>" id="id" name="id"> <button type="cancel" name="cancel" class="btn btn-primary btn-sm waves-effect waves-light">Cancel</button> <button type="submit" name="<?=$buton;?>" class="btn btn-primary btn-sm waves-effect waves-light"><?=$buton;?></button> </div> </div> </form> <?php } ?> <div class="<?=$wdth;?>"> <div class="box-content"> <h4 class="box-title">Master Tipe Pegawai</h4> <!-- /.box-title --> <table id="example" class="table table-striped table-bordered display" style="width:100%"> <thead> <tr> <th>No</th> <th>Keterangan</th> <th>Edit</th> <th>Hapus</th> </tr> </thead> <tfoot> <tr> <th>No</th> <th>Keterangan</th> <th>Edit</th> <th>Hapus</th> </tr> </tfoot> <tbody> <?php $no = 0; $sql = "SELECT * from pgw_jenis order by id desc"; //echo $sql; $result = mysqli_query($conn, $sql); if(mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { $no = ($no+1); ?> <tr> <td width="5%"><?=$no;?></td> <td width="80%"><?=$row["jenis"];?></td> <td align="center" width="5%"> <a href="#" onclick="edit(<?=$row["id"];?>);"><i class='fa fa-pencil'></i></a> </td> <td align="center" width="5%"> <a href="#" onclick="hapus(<?=$row["id"];?>);"><i class='fa fa-trash'></i></a> </td> </tr> <?php } } ?> </tbody> </table> <hr> <div align="center"> <button type="button" onclick="location.href='dashboard.php?MTipePegawai&Entry=1';" class="btn btn-primary btn-sm waves-effect waves-light"> Entry Baru</button> </div> </div> <!-- /.box-content --> </div> <script> function hapus(id) { let text = "Anda Yakin Akan Menghapus Data Ini?"; if (confirm(text) == true) { location.href='dashboard.php?MTipePegawai&deleteID='+id; } else { } } function edit(id) { let text = "Anda Yakin Akan Mengubah Data Ini?"; if (confirm(text) == true) { location.href='dashboard.php?MTipePegawai&Entry=1&editID='+id; } else { } } </script>