380 lines
16 KiB
PHP
380 lines
16 KiB
PHP
<?php
|
|
include("../koneksi.php");
|
|
$satuan_kerja_id = $_POST['satker'];
|
|
$jenis_user = $_POST['jenis'];
|
|
$sess_nama = $_POST['sess_nama'];
|
|
|
|
$bln2 = $_POST['bln2'];
|
|
$thn2 = $_POST['thn2'];
|
|
|
|
?>
|
|
<style type="text/css">
|
|
/*
|
|
.buttons-excel {
|
|
float: right;
|
|
margin-left: 10px;
|
|
text-transform: uppercase;
|
|
text-align: center;
|
|
vertical-align: top;
|
|
color: white;
|
|
background-color: green;
|
|
}
|
|
*/
|
|
</style>
|
|
<script type="text/javascript">
|
|
$('button[name="terima_inbox"]').popover();
|
|
$('button[name="proses_tl"]').popover();
|
|
$("#tabel_data_inbox").DataTable({
|
|
"paging": true,
|
|
"lengthChange": true,
|
|
"searching": true,
|
|
"ordering": false,
|
|
"info": true,
|
|
"autoWidth": false
|
|
/*
|
|
,
|
|
dom: 'Blfstpi',
|
|
buttons: [{
|
|
extend: 'excel',
|
|
exportOptions: {columns: [ 0,1,2 ':visible' ]}
|
|
}]
|
|
*/
|
|
});
|
|
//$('.buttons-excel').detach().prependTo('#tabel_data_inbox');
|
|
</script>
|
|
|
|
|
|
<input type="hidden" id="jenis" value="<?php echo $jenis_user; ?>">
|
|
<input type="hidden" id="sess_nama" value="<?php echo $sess_nama; ?>">
|
|
<input type="hidden" id="satuan_kerja_id" value="<?php echo $satuan_kerja_id; ?>">
|
|
|
|
<input type="hidden" id="disp_bln" value="<?php echo $bln2; ?>">
|
|
<input type="hidden" id="disp_thn" value="<?php echo $thn2; ?>">
|
|
|
|
<table id="tabel_data_inbox" class="table table-striped table-condensed table-bordered" cellpadding="1">
|
|
<thead>
|
|
<tr>
|
|
<td width="220px;">Dari</td>
|
|
<td width="120px;">No Register</td>
|
|
<td>Perihal</td>
|
|
<td width="90px;">Tgl Kirim</td>
|
|
<!--<td width="60px;" style="display:none">Status</td>-->
|
|
<td width="90px;">Diterima</td>
|
|
<td width="90px;">Status Surat</td>
|
|
<td style="display:none" width="40px;">Tools</td>
|
|
<td width="50px;" align="center">View</td>
|
|
<td style="display:none"></td>
|
|
<td style="display:none"></td>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
|
|
/*
|
|
* TERBARU :: 10/12/2021
|
|
|
|
$data=pg_query("SELECT r.lama,s.perihal,s.satuan_kerja_id,s.id,j.nama,r.proses_tu
|
|
FROM surat s
|
|
INNER JOIN data_user u ON (u.satuan_kerja_id=s.satuan_kerja_id)
|
|
INNER JOIN jabatan_pegawai j ON (j.id=u.jabatan_pegawai_id)
|
|
INNER JOIN kirim r ON (s.id=r.surat_id)
|
|
WHERE r.satuan_kerja_tujuan='$satuan_kerja_id'
|
|
AND s.jenis_surat_id='3' AND s.jenis_disposisi_id='3' AND r.lama IS NOT NULL
|
|
ORDER BY r.lama DESC
|
|
");
|
|
*/
|
|
|
|
/*
|
|
* OPTIMIZER 10/12/2021
|
|
*/
|
|
$data = pg_query_params(
|
|
$koneksi,
|
|
"SELECT r.lama,s.perihal,s.satuan_kerja_id,s.id,j.nama,r.proses_tu,s.no_register,
|
|
COUNT(kg.*) AS count_kg,COUNT(kh.*) AS count_kh,s.no_surat,r.id AS kirimid,r.tgl_diterima,r.isi,s.stts_kendali
|
|
FROM surat s
|
|
INNER JOIN data_user u ON u.satuan_kerja_id = s.satuan_kerja_id
|
|
INNER JOIN jabatan_pegawai j ON j.id = u.jabatan_pegawai_id
|
|
INNER JOIN kirim r ON s.id = r.surat_id
|
|
LEFT JOIN scan kg ON s.id = kg.surat_id AND LOWER(kg.file) LIKE '%jpg'
|
|
LEFT JOIN scan kh ON s.id = kh.surat_id AND LOWER(kh.file) NOT LIKE '%jpg'
|
|
WHERE r.satuan_kerja_tujuan = $1
|
|
AND s.satuan_kerja_id <> r.satuan_kerja_tujuan AND s.pengesahan = 1
|
|
AND r.lama IS NOT NULL AND r.dis_baca IS NULL
|
|
AND COALESCE(s.tahun, '') <> 'batal'
|
|
" . ($thn2 ? "AND EXTRACT(YEAR FROM r.lama) = $2" : "") . "
|
|
" . ($bln2 && $bln2 != '0' ? "AND EXTRACT(MONTH FROM r.lama) = $3" : "") . "
|
|
GROUP BY
|
|
r.lama, s.perihal, s.satuan_kerja_id, s.id, j.nama, r.proses_tu, r.id, s.no_surat, r.tgl_diterima, r.isi,s.stts_kendali
|
|
ORDER BY
|
|
r.lama DESC;
|
|
",
|
|
array($satuan_kerja_id, $thn2, $bln2)
|
|
);
|
|
|
|
|
|
while ($r = pg_fetch_assoc($data)) {
|
|
$dsa = $r['id'];
|
|
$tj = $r['count_kg'];
|
|
$tk = $r['count_kh'];
|
|
$isi = $r['isi'];
|
|
$surat_id = $r['id'];
|
|
?>
|
|
<tr style="color: <?= $r['proses_tu'] == 'B' ? '#7E7474' : 'black'; ?>">
|
|
<td class="kiri" style="font-family: InterSB"><?= htmlspecialchars($r['nama']); ?></td>
|
|
<td>
|
|
<?= htmlspecialchars($r['no_register']); ?>
|
|
<input type="hidden" name="surat_id" id="surat_id" value="<?= htmlspecialchars($surat_id); ?>">
|
|
</td>
|
|
<td><?= htmlspecialchars($r['perihal']); ?></td>
|
|
<!--<td><?= date('d-m-Y H:i', strtotime($r['tgl_surat_keluar'])); ?></td>-->
|
|
<td align="center"><?= $r['lama'] ? date('d-m-Y H:i', strtotime($r['lama'])) : ''; ?></td>
|
|
<!--<td style="display:none"><?= $r['proses_tu'] == 'B' ? "TERIMA" : ""; ?></td>-->
|
|
<td align="center"><?= $r['tgl_diterima'] ? date('d-m-Y H:i', strtotime($r['tgl_diterima'])) : ''; ?></td>
|
|
<td align="center">
|
|
<center>
|
|
<?php
|
|
$statusText = [
|
|
0 => '<span style="color:#0069D3;font-weight: 600;">Pengajuan</span>',
|
|
1 => '<span style="color:#44A2FF;font-weight: 600;">Verifikasi TU</span>',
|
|
3 => '<span style="color:#44A2FF;font-weight: 600;">Verifikasi Kabag Umum</span>',
|
|
5 => '<span style="color:#44A2FF;font-weight: 600;">Verifikasi Wadir Pelay. Medik dan Keperawatan</span>',
|
|
7 => '<span style="color:#44A2FF;font-weight: 600;">Verifikasi Wadir Pend. dan Pengemb. Mutu Pelayanan</span>',
|
|
9 => '<span style="color:#44A2FF;font-weight: 600;">Verifikasi Wadir Pelayanan Penunjang</span>',
|
|
11 => '<span style="color:#44A2FF;font-weight: 600;">Verifikasi Wadir Umum dan Keuangan</span>',
|
|
13 => '<span style="color:#00D814;font-weight: 600;">Selesai</span>',
|
|
99 => '<span style="color: red; font-weight: bold;">Ditolak</span>'
|
|
];
|
|
echo $statusText[$r['stts_kendali']] ?? '';
|
|
?>
|
|
</center>
|
|
</td>
|
|
<td align="center" style="display:none">
|
|
<button type="button" name="terima_inbox" style="height:22px;" class="btn btn-danger btn-xs terima_inbox" id="<?= htmlspecialchars($r['id']); ?>" data-content="Terima Surat" rel="popover" data-placement="top" data-trigger="hover">
|
|
<i class="fa fa-check"></i>
|
|
</button>
|
|
</td>
|
|
<td align="center" class="kanan">
|
|
<button type="button" name="file_inbox" style="height:22px; display:none" class="btn btn-default btn-xs file_inbox" id="<?= htmlspecialchars($r['id']); ?>" data-content="File" rel="popover" data-placement="top" data-trigger="hover">
|
|
<i class="fa fa-file-picture-o m-r-5"></i>Surat
|
|
<span class="sq<?= htmlspecialchars($r[3]); ?>" idne="jpg<?= htmlspecialchars($r[3]); ?>"> (<?= htmlspecialchars($tj); ?>)</span>
|
|
</button>
|
|
<button type="button" name="lampiran_inbox" style="height:22px; display:none" class="btn btn-default btn-xs lampiran_inbox" id="<?= htmlspecialchars($r['id']); ?>" data-content="File" rel="popover" data-placement="top" data-trigger="hover">
|
|
<i class="fa fa-file m-r-5"></i>Lampiran
|
|
<span class="sr<?= htmlspecialchars($r[3]); ?>" idne="file<?= htmlspecialchars($r[3]); ?>"> (<?= htmlspecialchars($tk); ?>)</span>
|
|
</button>
|
|
<!-- Button Untuk Tindak Lanjut -->
|
|
<button type="button" name="proses_tl" style="height:22px;" class="<?= $isi == 'SM' ? 'btn btn-default' : 'btn btn-teal'; ?> btn-xs proses_tl" id="<?= htmlspecialchars($r['id']); ?>" data-content="Input Tindak Lanjut" rel="popover" data-placement="top" data-trigger="hover">
|
|
<?php
|
|
$jko = pg_query($koneksi, "SELECT COUNT(*) FROM komen WHERE surat_id=$surat_id");
|
|
$rjko = pg_fetch_array($jko);
|
|
$tjko = $rjko[0];
|
|
?>
|
|
<?= $tjko == 0 ? '<i class="fa fa-ellipsis-h"></i>' : '<span style="font-family: Arial; font-weight: bold;">' . htmlspecialchars($tjko) . '</span>'; ?>
|
|
</button>
|
|
</td>
|
|
<td style="display:none"><?= htmlspecialchars($r['kirimid']); ?></td>
|
|
<td style="display:none"><?= htmlspecialchars($r['tgl_diterima']); ?></td>
|
|
</tr>
|
|
|
|
<?php
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
$("#tabel_data_inbox").on('click', '.proses_tl', function() {
|
|
var currentRow = $(this).closest("tr");
|
|
var perihal = currentRow.find("td:eq(2)").text();
|
|
var id = $(this).attr('id');
|
|
var surat_id = $(this).closest('tr').find('input[name="surat_id"]').val();
|
|
var cek_satker = $('#satuan_kerja_id').val();
|
|
var kirimid = currentRow.find("td:eq(8)").text();
|
|
|
|
$('#modal_body_tl').html("");
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/tindaklanjut/main.php",
|
|
data: {
|
|
id: id,
|
|
surat_id: surat_id,
|
|
perihal: perihal,
|
|
cek_satker: cek_satker,
|
|
kirimid: kirimid,
|
|
link: 's_pengesahan',
|
|
key: "pembaca"
|
|
},
|
|
success: function(data) {
|
|
$('#modal_tl').modal('show');
|
|
$('#modal_body_tl').html(data);
|
|
$('#kdSurat').select2({
|
|
dropdownParent: $("#modal_body_tl"),
|
|
width: '900px',
|
|
// matcher: matchCustom
|
|
minimumResultsForSearch: 20
|
|
});
|
|
}
|
|
});
|
|
var tgl_diterima = currentRow.find("td:eq(9)").text();
|
|
if (!tgl_diterima) {
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/inbox_pengesahan/crud.php",
|
|
data: {
|
|
id: id,
|
|
satker: cek_satker,
|
|
key: 'approve_keluar'
|
|
},
|
|
success: function(data) {
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/inbox_pengesahan/crud.php",
|
|
data: {
|
|
id: id,
|
|
satker: cek_satker,
|
|
key: "upd_sm_baca"
|
|
},
|
|
success: function(data) {
|
|
updateTabelInbox();
|
|
updateNotifikasiInbox(cek_satker);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
function updateTabelInbox() {
|
|
var sat = $('#sat').val();
|
|
var thn2 = $('#thn').val();
|
|
var bln2 = $('#bln').val();
|
|
var satker = $('#satuan_kerja_id').val();
|
|
|
|
var loadParams = {
|
|
satker: (sat === '172') ? sat : sess_satker,
|
|
jenis: sess_jenis,
|
|
sess_nama: sess_nama,
|
|
thn2: thn2,
|
|
bln2: bln2
|
|
};
|
|
|
|
$('#tabel_inbox').load("app/inbox_pengesahan/tabel.php", loadParams);
|
|
}
|
|
|
|
function updateNotifikasiInbox(satker) {
|
|
var url = (satker === '172') ? 'app/notif/inbox_notifbu.php' : 'app/notif/inbox_notif.php';
|
|
$.ajax({
|
|
type: "POST",
|
|
url: url,
|
|
data: {
|
|
satker: satker
|
|
},
|
|
success: function(data) {
|
|
if (data == 0) {
|
|
$('#not_inbox').hide();
|
|
} else {
|
|
$('#not_inbox').show();
|
|
$('#not_inbox').html(data);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
$("#tabel_data_inbox").on('click', '.file_inbox', function() {
|
|
var id = $(this).attr('id');
|
|
$('#modal_inbox').modal('show');
|
|
$('#modal_body_inbox').html("");
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/inbox_pengesahan/modal.php",
|
|
data: 'id=' + id,
|
|
success: function(data) {
|
|
$('#modal_body_inbox').html(data);
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
$("#tabel_data_inbox").on('click', '.lampiran_inbox', function() {
|
|
var id = $(this).attr('id');
|
|
$('#modal_file_inbox').modal('show');
|
|
$('#modal_body_file_inbox').html("");
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/inbox_pengesahan/modal_file.php",
|
|
data: 'id=' + id,
|
|
success: function(data) {
|
|
$('#modal_body_file_inbox').html(data);
|
|
}
|
|
});
|
|
});
|
|
|
|
/*
|
|
$("#tabel_data_inbox").on('click','.terima_inbox',function(){
|
|
var currentRow=$(this).closest("tr");
|
|
var tgl_diterima = currentRow.find("td:eq(8)").text();
|
|
if (!tgl_diterima) {
|
|
var id = $(this).attr('id');
|
|
var satker = $('#satuan_kerja_id').val();
|
|
var key = 'approve_keluar';
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/inbox/crud.php",
|
|
data: 'id='+id
|
|
+'&satker='+satker
|
|
+'&key='+key,
|
|
success: function(data){
|
|
var key = 'upd_sm_baca';
|
|
var satker = $('#satuan_kerja_id').val();
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "app/inbox/crud.php",
|
|
data: 'id='+id
|
|
+'&satker='+satker
|
|
+'&key='+key,
|
|
success: function(data){
|
|
var sat = $('#sat').val();
|
|
var thn2 = $('#thn').val();
|
|
var bln2 = $('#bln').val();
|
|
if (sat=='172') {
|
|
$('#tabel_inbox').load("app/inbox/tabel.php",{satker:sat,jenis:sess_jenis,sess_nama:sess_nama,thn2:thn2,bln2:bln2});
|
|
} else {
|
|
$('#tabel_inbox').load("app/inbox/tabel.php",{satker:sess_satker,jenis:sess_jenis,sess_nama:sess_nama,thn2:thn2,bln2:bln2});
|
|
}
|
|
var satcer=$('#satuan_kerja_id').val();
|
|
if (satcer=='172') {
|
|
$.ajax({
|
|
type: "POST",
|
|
url:'app/notif/inbox_notifbu.php',
|
|
data: 'satker='+satker,
|
|
success: function(data){
|
|
if (data==0) {$('#not_inbox').hide();} else {
|
|
$('#not_inbox').show();
|
|
$('#not_inbox').html(data);
|
|
}
|
|
}
|
|
});
|
|
} else {
|
|
$.ajax({
|
|
type: "POST",
|
|
url:'app/notif/inbox_notif.php',
|
|
data: 'satker='+satker,
|
|
success: function(data){
|
|
if (data==0) {$('#not_inbox').hide();} else {
|
|
$('#not_inbox').show();
|
|
$('#not_inbox').html(data);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
} else {}
|
|
});
|
|
*/
|
|
</script>
|