188 lines
11 KiB
PHP
188 lines
11 KiB
PHP
<?php
|
||
include("../koneksi.php");
|
||
$thn_skrg=date('Y');
|
||
?>
|
||
|
||
<script type="text/javascript">$("#tabel_data_persiapan").DataTable({"stateSave": true,"paging": true,"lengthChange": true,"searching": true,"ordering": false,"info": true,"autoWidth": false});</script>
|
||
|
||
|
||
<input type="hidden" id="jenis" value="<?php echo $jenis_user; ?>">
|
||
<table id="tabel_data_persiapan" class="table table-striped table-condensed" cellpadding="1" >
|
||
<thead>
|
||
<tr>
|
||
<td width="160"><b>Jenis</b></td>
|
||
<td><b>Nama Kegiatan</b></td>
|
||
<td width="100"><b>Tanggal</b></td>
|
||
<td><b>Pukul</b></td>
|
||
<td><b>Tempat</b></td>
|
||
<td width="110"><b>Penyelenggara</b></td>
|
||
<td><b>Status</b></td>
|
||
<td><b>Peserta</b></td>
|
||
<td><b>Mentor</b></td>
|
||
<td width="130"><center><b>Tools</b></center></td>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php
|
||
/*
|
||
$data=pg_query("SELECT p.nama_pelatihan,(SELECT j.nama FROM jenis_pelatihan j WHERE j.id=p.jenis_pelatihan_id),
|
||
p.penyelenggara,p.status,p.id,p.jatuh_tempo_reg,
|
||
CASE WHEN
|
||
((SELECT DISTINCT status FROM riwayat_peserta WHERE riwayat_kegiatan_id=p.id AND status='Pending') IS NULL)
|
||
AND (p.no_und IS NOT NULL) AND (p.pdf_spt IS NOT NULL)
|
||
THEN 'Ready'
|
||
ELSE 'Pending'
|
||
END,
|
||
CASE WHEN
|
||
(SELECT COUNT(DISTINCT status_mentor) FROM riwayat_peserta WHERE riwayat_kegiatan_id=p.id AND status_mentor='Ready')=1
|
||
THEN 'Ready'
|
||
ELSE 'Pending'
|
||
END,
|
||
p.tanggal_mulai,p.tanggal_selesai,p.waktu_mulai,p.waktu_selesai,p.tempat
|
||
FROM riwayat_kegiatan p WHERE p.thn='$thn_skrg' AND p.status='Open' ORDER BY p.jatuh_tempo_reg ASC
|
||
");
|
||
*/
|
||
$data=pg_query("SELECT p.nama_pelatihan,(SELECT j.nama FROM jenis_pelatihan j WHERE j.id=p.jenis_pelatihan_id),
|
||
p.penyelenggara,p.status,p.id,p.jatuh_tempo_reg,
|
||
CASE WHEN
|
||
((SELECT DISTINCT status FROM riwayat_peserta WHERE riwayat_kegiatan_id=p.id AND status='Pending') IS NULL)
|
||
THEN 'Ready'
|
||
ELSE 'Pending'
|
||
END,
|
||
CASE WHEN
|
||
(SELECT COUNT(DISTINCT status_mentor) FROM riwayat_peserta WHERE riwayat_kegiatan_id=p.id AND status_mentor='Ready')=1
|
||
THEN 'Ready'
|
||
ELSE 'Pending'
|
||
END,
|
||
p.tanggal_mulai,p.tanggal_selesai,p.waktu_mulai,p.waktu_selesai,p.tempat
|
||
FROM riwayat_kegiatan p WHERE p.thn='$thn_skrg' AND p.status='Open' ORDER BY p.jatuh_tempo_reg ASC
|
||
");
|
||
while($r=pg_fetch_array($data)) {
|
||
|
||
?>
|
||
<tr>
|
||
<td class="kiri"><b><?php echo $r[0]; ?></b></td>
|
||
<td><b><?php echo $r[1]; ?></b></td>
|
||
|
||
<td><b><?php echo date('d-m-Y',strtotime($r['tanggal_mulai'])).' s/d '.date('d-m-Y',strtotime($r['tanggal_selesai'])); ?></b></td>
|
||
<td><b> <?php
|
||
if (date('H:i',strtotime($r['waktu_selesai']))=='00:00') {
|
||
echo date('H:i',strtotime($r['waktu_mulai'])).' s/d Selesai';
|
||
} else {
|
||
echo date('H:i',strtotime($r['waktu_mulai'])).' s/d '.date('H:i',strtotime($r['waktu_selesai']));
|
||
}
|
||
?></b></td>
|
||
<td><b><?php echo $r['tempat']; ?></b></td>
|
||
|
||
<td><b><?php echo $r[2]; ?></b></td>
|
||
<td><b><?php echo $r[3]; ?></b></td>
|
||
<td><b><?php echo $r[6]; ?></b></td>
|
||
<td><b><?php echo $r[7]; ?></b></td>
|
||
<td class="kanan">
|
||
<button type="button" name="peserta" style="height:22px;"class="btn btn-danger btn-xs peserta" id="<?php echo $r['id'];?>" data-content="Peserta" rel="popover" data-placement="top" data-trigger="hover"
|
||
><i style="margin-top:3px" class="fa fa-user"></i>
|
||
</button>
|
||
<button type="button" name="panitia" style="height:22px;"class="btn btn-primary btn-xs panitia" id="<?php echo $r['id'];?>" data-content="Panitia" rel="popover" data-placement="top" data-trigger="hover"
|
||
><i style="margin-top:3px" class="fa fa-user"></i>
|
||
</button>
|
||
<button type="button" name="mentor" style="height:22px;"class="btn btn-inverse btn-xs mentor" id="<?php echo $r['id'];?>" data-content="Mentor" rel="popover" data-placement="top" data-trigger="hover"
|
||
><i style="margin-top:3px" class="fa fa-user"></i>
|
||
</button>
|
||
<button type="button" name="materi" style="height:22px;"class="btn btn-brown btn-xs materi" id="<?php echo $r['id'];?>" data-content="Materi" rel="popover" data-placement="top" data-trigger="hover"
|
||
><i style="margin-top:3px" class="fa fa-star"></i>
|
||
</button>
|
||
<button type="button" name="ready" style="height:22px;"class="btn btn-purple btn-xs ready" id="<?php echo $r['id'];?>" data-content="Ready" rel="popover" data-placement="top" data-trigger="hover"
|
||
><i style="margin-top:3px" class="fa fa-check"></i>
|
||
</button>
|
||
</td>
|
||
</tr>
|
||
<?php
|
||
}
|
||
?>
|
||
</tbody>
|
||
</table>
|
||
|
||
|
||
|
||
<div id="modal_pdetail" 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">Detail Kegiatan</h4>
|
||
</div>
|
||
<div class="modal-body" id="modal_body_pdetail"></div>
|
||
<div class="modal-footer no-border">
|
||
<button type="button" class="btn btn-default waves-effect" data-dismiss="modal" id="keluar_pdetail">Keluar</button>
|
||
<button type="button" class="btn btn-primary waves-effect waves-light" id="simpan_pdetail">Simpan</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
<script type="text/javascript">
|
||
|
||
$('button[name="peserta"]').popover();
|
||
$('button[name="ready"]').popover();
|
||
$('button[name="materi"]').popover();
|
||
$('button[name="mentor"]').popover();
|
||
$('button[name="panitia"]').popover();
|
||
|
||
$("#tabel_data_persiapan").on('click','.peserta',function(){
|
||
var id = $(this).attr('id');
|
||
$.post('app/cekpeserta/peserta/main.php',{riwayat_kegiatan_id : id},function(html){$("#main_tag").html(html);
|
||
$('#add_mentor').hide();$('#peserta_ready').hide();$('#peserta_batal').hide();$('#back_2').hide();$('#back_1').show();
|
||
});
|
||
});
|
||
|
||
$("#tabel_data_persiapan").on('click','.panitia',function(){
|
||
var id = $(this).attr('id');
|
||
$.post('app/persiapan/panitia/main.php',{riwayat_kegiatan_id : id},function(html){$("#main_tag").html(html);
|
||
$('#add_mentor').show();$('#peserta_ready').hide();$('#peserta_batal').hide();$('#back_2').hide();$('#back_1').show();
|
||
});
|
||
});
|
||
|
||
$("#tabel_data_persiapan").on('click','.mentor',function(){
|
||
var id = $(this).attr('id');
|
||
$.post('app/persiapan/mentor/main.php',{riwayat_kegiatan_id : id},function(html){$("#main_tag").html(html);
|
||
$('#add_mentor').show();$('#peserta_ready').hide();$('#peserta_batal').hide();$('#back_2').hide();$('#back_1').show();
|
||
});
|
||
});
|
||
|
||
$("#tabel_data_persiapan").on('click','.materi',function(){
|
||
var id = $(this).attr('id');
|
||
$.post('app/persiapan/materi/main.php',{riwayat_kegiatan_id : id},function(html){$("#main_tag").html(html);
|
||
$('#add_mentor').hide();$('#peserta_ready').hide();$('#peserta_batal').hide();$('#back_2').hide();$('#back_1').show();
|
||
});
|
||
});
|
||
|
||
$("#tabel_data_persiapan").on('click','.ready',function(){
|
||
var currentRow=$(this).closest("tr");
|
||
var pes = currentRow.find("td:eq(7)").text();
|
||
var men = currentRow.find("td:eq(8)").text();
|
||
|
||
if (pes=='Pending') {alert('Status peserta belum ready semua.. atau SPT belum upload.. atau Undangan belum dibuat');} else {}
|
||
if (men=='Pending') {alert('Mentor belum ditentukan.. atau status mentor belum ready');} else {}
|
||
|
||
if ((pes=='Pending') || (men=='Pending')) {} else {
|
||
var id = $(this).attr('id');
|
||
var key="simpan_pdetail";
|
||
$.ajax({
|
||
type: "POST",
|
||
url: "app/persiapan/crud.php",
|
||
data: 'id='+id
|
||
+'&key='+key,
|
||
success: function(data){
|
||
alert('SPT dan Undangan terkirim ke kordik. Acara ready..');
|
||
$('#pel_kehadiran').trigger('click');
|
||
}
|
||
});
|
||
}
|
||
});
|
||
|
||
|
||
|
||
|
||
</script>
|