menambah halaman penelitian pada dosen, memperbaiki tampilan awal agar menampilkan informasi seputar penelitian

This commit is contained in:
cowrie committed 2026-11-17 03:14:23 +08:00
1 parent 218f8ce063
commit e625acd13a
12 files changed
+2275 -290

No files matched your search

+130 -43
View File
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Laporan Penelitian Dosen</title>
@@ -11,7 +12,7 @@
color: #000;
background: #fff;
}
/* Header Letterhead */
.header {
text-align: center;
@@ -19,18 +20,43 @@
padding-bottom: 20px;
margin-bottom: 30px;
}
.header h1 { margin: 0; font-size: 24px; text-transform: uppercase; }
.header h2 { margin: 5px 0 0 0; font-size: 18px; font-weight: normal; }
.header p { margin: 5px 0 0 0; font-size: 14px; }
.header h1 {
margin: 0;
font-size: 24px;
text-transform: uppercase;
}
.header h2 {
margin: 5px 0 0 0;
font-size: 18px;
font-weight: normal;
}
.header p {
margin: 5px 0 0 0;
font-size: 14px;
}
/* Info Section */
.info-section {
margin-bottom: 30px;
font-size: 14px;
}
.info-section table { width: 100%; }
.info-section td { padding: 5px 0; vertical-align: top; }
.info-section .label { width: 180px; font-weight: bold; }
.info-section table {
width: 100%;
}
.info-section td {
padding: 5px 0;
vertical-align: top;
}
.info-section .label {
width: 180px;
font-weight: bold;
}
/* History Table */
table.data-table {
@@ -39,22 +65,39 @@
margin-top: 20px;
font-size: 13px;
}
table.data-table th, table.data-table td {
table.data-table th,
table.data-table td {
border: 1px solid #000;
padding: 10px;
text-align: left;
vertical-align: top;
}
table.data-table th {
background-color: #f2f2f2;
text-align: center;
}
/* File Links */
.file-list { list-style: none; padding: 0; margin: 0; }
.file-list li { margin-bottom: 3px; }
.file-list a { color: #000; text-decoration: none; }
.file-list a:hover { text-decoration: underline; }
.file-list {
list-style: none;
padding: 0;
margin: 0;
}
.file-list li {
margin-bottom: 3px;
}
.file-list a {
color: #000;
text-decoration: none;
}
.file-list a:hover {
text-decoration: underline;
}
/* Signature Section */
.signature {
@@ -62,27 +105,66 @@
text-align: right;
font-size: 14px;
}
.signature p { margin: 5px 0; }
.signature-space { height: 80px; }
.signature p {
margin: 5px 0;
}
.signature-space {
height: 80px;
}
/* Print Specific Rules */
.no-print { text-align: right; margin-bottom: 20px; }
.no-print button { padding: 10px 20px; font-size: 16px; cursor: pointer; background-color: #007bff; color: #fff; border: none; border-radius: 4px;}
.no-print button:hover { background-color: #0056b3; }
.no-print a { margin-right: 10px; text-decoration: none; color: #333; font-size: 16px;}
.no-print {
text-align: right;
margin-bottom: 20px;
}
.no-print button {
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
border: none;
border-radius: 4px;
}
.btn-print {
background-color: #007bff;
color: #fff;
margin-left: 10px;
}
.btn-print:hover {
background-color: #0056b3;
}
.btn-close {
background-color: #6c757d;
color: #fff;
}
.btn-close:hover {
background-color: #5a6268;
}
@media print {
.no-print { display: none !important; }
body { margin: 0; }
.no-print {
display: none !important;
}
body {
margin: 0;
}
}
</style>
</head>
<body>
<!-- Buttons (Hidden when printing) -->
<div class="no-print">
<a href="dosen.html" style="float: left; margin-top: 10px;">&larr; Kembali ke Dasbor</a>
<button onclick="window.print()">🖨️ Cetak Laporan</button>
<button class="btn-close" onclick="window.close()">Tutup Halaman</button>
<button class="btn-print" onclick="window.print()">🖨️ Cetak Laporan</button>
</div>
<!-- Letterhead -->
@@ -138,7 +220,9 @@
</tr>
</thead>
<tbody id="printDataBody">
<tr><td colspan="5" style="text-align: center;">Memuat data...</td></tr>
<tr>
<td colspan="5" style="text-align: center;">Memuat data...</td>
</tr>
</tbody>
</table>
@@ -158,24 +242,26 @@
const date = new Date(dateString);
const days = ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu'];
const months = ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'];
let dayName = days[date.getDay()];
let day = String(date.getDate()).padStart(2, '0');
let monthNum = String(date.getMonth() + 1).padStart(2, '0');
let year = date.getFullYear();
let hours = String(date.getHours()).padStart(2, '0');
let minutes = String(date.getMinutes()).padStart(2, '0');
let seconds = String(date.getSeconds()).padStart(2, '0');
// Use getUTCDay() to prevent JS from adding the local timezone offset again
let dayName = days[date.getUTCDay()];
let day = String(date.getUTCDate()).padStart(2, '0');
let monthNum = String(date.getUTCMonth() + 1).padStart(2, '0');
let year = date.getUTCFullYear();
let hours = String(date.getUTCHours()).padStart(2, '0');
let minutes = String(date.getUTCMinutes()).padStart(2, '0');
let seconds = String(date.getUTCSeconds()).padStart(2, '0');
return `${dayName}, ${day}-${monthNum}-${year} | ${hours}:${minutes}:${seconds}`;
}
// Helper to format just the date for the signature
function formatDateOnly(dateString) {
if (!dateString) return '-';
const date = new Date(dateString);
const monthsShort = ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Agu', 'Sep', 'Okt', 'Nov', 'Des'];
return `${date.getDate()} ${monthsShort[date.getMonth()]} ${date.getFullYear()}`;
// Use UTC methods here too
return `${date.getUTCDate()} ${monthsShort[date.getUTCMonth()]} ${date.getUTCFullYear()}`;
}
// Set date for signature
@@ -187,24 +273,23 @@
if (!penelitianId) {
alert("ID Penelitian tidak ditemukan di URL!");
window.location.href = 'dosen.html';
window.close();
}
// Fetch Dosen Info from LocalStorage
document.getElementById('printNamaDosen').innerText = localStorage.getItem('dosen_name') || '-';
document.getElementById('printIdDosen').innerText = localStorage.getItem('dosen_id') || '-';
// Fetch Main Data and History Data
// 1. Fetch main data to get the title, status, and dates
fetch(`/api/penelitian/dosen/${localStorage.getItem('dosen_id')}`)
// 1. Fetch ALL data and find the specific one
fetch(`/api/penelitian`)
.then(res => res.json())
.then(data => {
const item = data.find(p => p.id == penelitianId);
if (item) {
document.getElementById('printNamaDosen').innerText = item.dosen_name;
document.getElementById('printIdDosen').innerText = item.dosen_id;
document.getElementById('printJudul').innerText = item.judul_penelitian;
document.getElementById('printStatus').innerText = item.status_penelitian;
document.getElementById('printTanggalSubmit').innerText = formatDateWIB(item.created_at);
document.getElementById('printTanggalRevisi').innerText = formatDateWIB(item.updated_at);
} else {
alert("Data penelitian tidak ditemukan di database.");
}
})
.catch(err => console.error("Error fetching main data:", err));
@@ -234,7 +319,7 @@
});
filesHtml += '</ul>';
}
} catch(e) {}
} catch (e) { }
}
tbody.innerHTML += `
@@ -253,5 +338,7 @@
document.getElementById('printDataBody').innerHTML = '<tr><td colspan="5" style="text-align: center; color: red;">Gagal memuat data.</td></tr>';
});
</script>
</body>
</html>