120 lines
6.6 KiB
PHP
120 lines
6.6 KiB
PHP
<?php
|
|
include('../koneksi.php');
|
|
$riwayat_kegiatan_id=$_POST['riwayat_kegiatan_id'];
|
|
?>
|
|
|
|
<script type="text/javascript">$("#tabel_data_peserta").DataTable({"stateSave": true,"paging": true,"lengthChange": true,"searching": true,"ordering": false,"info": true,"autoWidth": false});</script>
|
|
<table id="tabel_data_peserta" class="table table-striped table-bordered" cellpadding="1" style="font-size:12px;" >
|
|
<thead>
|
|
<tr>
|
|
<td align="center"><b>Nama Peserta</b></td>
|
|
<td align="center" width="190px;"><b>NIP</b></td>
|
|
<td align="center"><b>Satuan Kerja</b></td>
|
|
<td align="center"><b>Jab Tim</b></td>
|
|
<td align="center" width="90px;"><b>Waktu</b></td>
|
|
<td align="center" width="50px;"><b>Tools</b></td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$data = pg_query("SELECT
|
|
COALESCE(NULL,p.nama,l.nama),
|
|
COALESCE(NULL,p.nipb,l.nipb),
|
|
COALESCE(NULL,s.nama,l.instansi),
|
|
COALESCE(NULL,t.jabtim,l.jabatan),
|
|
t.waktu_mulai,t.waktu_selesai,t.id,t.peserta_luar
|
|
FROM riwayat_peserta t
|
|
LEFT OUTER JOIN data_pegawai p ON (p.id=t.data_pegawai_id)
|
|
LEFT OUTER JOIN satuan_kerja s ON (s.id=p.satuan_kerja)
|
|
LEFT OUTER JOIN data_pegawai_luar l ON (l.id=t.peserta_luar)
|
|
WHERE t.riwayat_kegiatan_id='$riwayat_kegiatan_id' ORDER BY t.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[3]; ?></td>
|
|
<td align="center"><?php echo date('H:i',strtotime($row['waktu_mulai'])).' - '.date('H:i',strtotime($row['waktu_selesai'])); ?></td>
|
|
<td align="center">
|
|
<?php
|
|
if ($row['peserta_luar']==NULL) {
|
|
?>
|
|
<button type="button" name="edit_peserta" style="height:22px;" class="btn btn-teal btn-xs edit_peserta" id="<?php echo $row['id'];?>" data-content="Edit Data" rel="popover" data-placement="top" data-trigger="hover">
|
|
<i class="fa fa fa-pencil"></i>
|
|
</button>
|
|
<?php } else {
|
|
?>
|
|
<button type="button" name="edit_peserta_luar" style="height:22px;" class="btn btn-teal btn-xs edit_peserta_luar" id="<?php echo $row['id'];?>" data-content="Edit Data" rel="popover" data-placement="top" data-trigger="hover">
|
|
<i class="fa fa fa-pencil"></i>
|
|
</button>
|
|
<?php } ?>
|
|
<button type="button" name="delete_peserta" style="height:22px;"class="btn btn-danger btn-xs delete_peserta" id="<?php echo $row['id'];?>" data-content="Hapus" rel="popover" data-placement="top" data-trigger="hover">
|
|
<i class="fa fa-remove"></i>
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$('button[name="edit_peserta"]').popover();
|
|
$('button[name="delete_peserta"]').popover();
|
|
|
|
$("#tabel_data_peserta").on('click','.edit_peserta',function(){
|
|
var id = $(this).attr('id');
|
|
$('#modal_peserta').modal('show');
|
|
$('#modal_body_peserta').html("");
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/peserta/modal.php",
|
|
data: 'id='+id,
|
|
success: function(data){
|
|
$('#modal_body_peserta').html(data);
|
|
$('#peserta_nama').first().focus().selected();
|
|
}
|
|
});
|
|
});
|
|
|
|
$("#tabel_data_peserta").on('click','.edit_peserta_luar',function(){
|
|
var id = $(this).attr('id');
|
|
$('#modal_peserta_luar').modal('show');
|
|
$('#modal_body_peserta_luar').html("");
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/peserta/modal_luar.php",
|
|
data: 'id='+id,
|
|
success: function(data){
|
|
$('#modal_body_peserta_luar').html(data);
|
|
$('#waktu_mulai_m_l').first().focus().selected();
|
|
}
|
|
});
|
|
});
|
|
|
|
$("#tabel_data_peserta").on('click','.delete_peserta',function(){
|
|
var x = confirm("Anda yakin ingin menghapus ?");
|
|
if (x) {
|
|
var key = "delete_peserta";
|
|
var id = $(this).attr('id');
|
|
var rowElement = $(this).parent().parent();
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/peserta/crud.php",
|
|
data: 'id='+id
|
|
+'&key='+key,
|
|
success: function(data){
|
|
rowElement.fadeOut(500).remove();
|
|
}
|
|
});
|
|
} else {}
|
|
});
|
|
|
|
</script>
|
|
|