menambah halaman penelitian pada dosen, memperbaiki tampilan awal agar menampilkan informasi seputar penelitian
This commit is contained in:
1 parent
218f8ce063
commit
e625acd13a
12 files changed
+2275
-290
No files matched your search
+23
-6
@@ -196,13 +196,30 @@
|
||||
// Format Dates
|
||||
function formatDate(dateString) {
|
||||
if (!dateString) return '-';
|
||||
|
||||
// If it's already in "YYYY-MM-DD HH:mm:ss" format, just format it
|
||||
if (!dateString.includes('T')) {
|
||||
// Replace T with space, then remove the seconds
|
||||
let cleanStr = dateString.replace('T', ' ');
|
||||
return cleanStr.substring(0, 16).replace(/-/g, ' ').replace(':', '.');
|
||||
}
|
||||
|
||||
const date = new Date(dateString);
|
||||
return date.toLocaleString('id-ID', {
|
||||
day: '2-digit', month: 'short', year: 'numeric',
|
||||
hour: '2-digit', minute: '2-digit'
|
||||
});
|
||||
|
||||
// Use UTC getters because the DB stores WIB as "UTC" in the ISO string
|
||||
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Agu', 'Sep', 'Okt', 'Nov', 'Des'];
|
||||
|
||||
const day = String(date.getUTCDate()).padStart(2, '0');
|
||||
const month = months[date.getUTCMonth()];
|
||||
const year = date.getUTCFullYear();
|
||||
const hours = String(date.getUTCHours()).padStart(2, '0');
|
||||
const minutes = String(date.getUTCMinutes()).padStart(2, '0');
|
||||
|
||||
return `${day} ${month} ${year}, ${hours}.${minutes}`;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function logout() {
|
||||
swal({
|
||||
title: "Logout?",
|
||||
@@ -220,7 +237,7 @@
|
||||
|
||||
// --- CHART RENDERING FUNCTION ---
|
||||
function renderChart() {
|
||||
$.get('/api/laporan/stats/daily', function(data) {
|
||||
$.get('/api/laporan/stats/daily', function (data) {
|
||||
const labels = [];
|
||||
const counts = [];
|
||||
|
||||
@@ -234,7 +251,7 @@
|
||||
});
|
||||
|
||||
const ctx = document.getElementById('penelitianChart').getContext('2d');
|
||||
|
||||
|
||||
new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
|
||||
+429
-115
@@ -22,9 +22,36 @@
|
||||
<link rel="stylesheet" href="assets/plugin/datatables/media/css/dataTables.bootstrap.min.css">
|
||||
<link rel="stylesheet" href="assets/plugin/datatables/extensions/Responsive/css/responsive.bootstrap.min.css">
|
||||
<style>
|
||||
body {
|
||||
display: none;
|
||||
body { display: none; }
|
||||
.dataTables_filter { display: none; }
|
||||
|
||||
/* File list styles for the View Modal */
|
||||
.file-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
padding: 8px;
|
||||
background: #f9f9f9;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
gap: 10px;
|
||||
}
|
||||
.file-item a {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
word-break: break-all;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
flex: 1;
|
||||
}
|
||||
.file-item a:hover { color: #007bff; text-decoration: underline; }
|
||||
|
||||
.history-panel { margin-bottom: 15px; border: 1px solid #ddd; border-radius: 4px; }
|
||||
.history-header { background-color: #f5f5f5; padding: 10px 15px; border-bottom: 1px solid #ddd; font-weight: bold; }
|
||||
.history-body { padding: 15px; }
|
||||
#modalHistory .modal-body { max-height: calc(100vh - 210px); overflow-y: auto; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -34,8 +61,7 @@
|
||||
<a href="admin_index.html" class="logo">UHM</a>
|
||||
<button type="button" class="button-close fa fa-times js__menu_close"></button>
|
||||
<div class="user">
|
||||
<a href="#" class="avatar"><img src="assets/images/person.png" alt=""><span
|
||||
class="status online"></span></a>
|
||||
<a href="#" class="avatar"><img src="assets/images/person.png" alt=""><span class="status online"></span></a>
|
||||
<h5 class="name"><a href="#">Admin</a></h5>
|
||||
<h5 class="position">Administrator</h5>
|
||||
</div>
|
||||
@@ -44,30 +70,12 @@
|
||||
<div class="navigation">
|
||||
<h5 class="title">Navigasi</h5>
|
||||
<ul class="menu js__accordion">
|
||||
<li class="current">
|
||||
<a class="waves-effect" href="admin_index.html"><i
|
||||
class="menu-icon fa fa-home"></i><span>Halaman Utama</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="waves-effect" href="admin_list_penelitian.html"><i
|
||||
class="menu-icon fa fa-list"></i><span>List Penelitian</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="waves-effect" href="admin_manage_dosen.html"><i
|
||||
class="menu-icon fa fa-users"></i><span>Managemen Dosen</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="waves-effect" href="admin_manage_mahasiswa.html"><i
|
||||
class="menu-icon fa fa-users"></i><span>Managemen Mahasiswa</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="waves-effect" href="admin_profile.html"><i
|
||||
class="menu-icon fa fa-user"></i><span>Profil</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="waves-effect" href="#" onclick="logout()"><i
|
||||
class="menu-icon fa fa-sign-out"></i><span>Logout</span></a>
|
||||
</li>
|
||||
<li><a class="waves-effect" href="admin_index.html"><i class="menu-icon fa fa-home"></i><span>Halaman Utama</span></a></li>
|
||||
<li class="current"><a class="waves-effect" href="admin_list_penelitian.html"><i class="menu-icon fa fa-list"></i><span>List Penelitian</span></a></li>
|
||||
<li><a class="waves-effect" href="admin_manage_dosen.html"><i class="menu-icon fa fa-users"></i><span>Managemen Dosen</span></a></li>
|
||||
<li><a class="waves-effect" href="admin_manage_mahasiswa.html"><i class="menu-icon fa fa-users"></i><span>Managemen Mahasiswa</span></a></li>
|
||||
<li><a class="waves-effect" href="admin_profile.html"><i class="menu-icon fa fa-user"></i><span>Profil</span></a></li>
|
||||
<li><a class="waves-effect" href="#" onclick="logout()"><i class="menu-icon fa fa-sign-out"></i><span>Logout</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -75,9 +83,8 @@
|
||||
|
||||
<div class="fixed-navbar">
|
||||
<div class="pull-left">
|
||||
<button type="button"
|
||||
class="menu-mobile-button glyphicon glyphicon-menu-hamburger js__menu_mobile"></button>
|
||||
<h1 class="page-title">Halaman Utama Admin</h1>
|
||||
<button type="button" class="menu-mobile-button glyphicon glyphicon-menu-hamburger js__menu_mobile"></button>
|
||||
<h1 class="page-title">Daftar Semua Penelitian</h1>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<div class="ico-item fa fa-arrows-alt js__full_screen"></div>
|
||||
@@ -118,23 +125,20 @@
|
||||
<div class="col-lg-3 col-md-6 col-xs-12">
|
||||
<div class="box-content">
|
||||
<div class="statistics-box with-icon">
|
||||
<i class="ico fa fa-users text-primary"></i>
|
||||
<h2 class="counter text-primary" id="h_jumlah_mahasiswa">...</h2>
|
||||
<p class="text">Jumlah Mahasiswa</p>
|
||||
<i class="ico fa fa-history text-primary"></i>
|
||||
<h2 class="counter text-primary" id="h_update" style="font-size: 20px;">...</h2>
|
||||
<p class="text">Update Terakhir</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row small-spacing">
|
||||
<div class="col-lg-7 col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">Keterangan</h4>
|
||||
<h4 class="box-title">Statistik Penelitian</h4>
|
||||
<div class="card-content">
|
||||
<p style="text-align: justify;">Selamat datang sistem penelitian dosen. Pada sistem ini
|
||||
admin berperan dalam mengelola data dosen dan mahasiswa Universitas Handayani Makassar.
|
||||
Gunakan menu navigasi di kiri untuk berpindah halaman. </p>
|
||||
<canvas id="penelitianChart" style="width: 100%; height: 400px;"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -142,13 +146,64 @@
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">Penelitian Update Terakhir</h4>
|
||||
<div class="card-content" id="lastUpdateContainer">
|
||||
<!-- Data will be injected by JS -->
|
||||
<p class="text-center text-muted">Memuat data...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TABLE SECTION -->
|
||||
<div class="row small-spacing">
|
||||
<div class="col-md-12">
|
||||
<div class="box-content">
|
||||
<header class="panel-heading"
|
||||
style="display: flex; flex-direction: column; gap: 15px; overflow: hidden;">
|
||||
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||
<h4 class="box-title" style="margin: 0;">Daftar Seluruh Penelitian</h4>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<label>Judul Penelitian</label>
|
||||
<input type="text" id="searchJudul" class="form-control" placeholder="Cari judul...">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label>Tahun Dari</label>
|
||||
<select id="searchTahunFrom" class="form-control">
|
||||
<option value="">-- Pilih --</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label>Tahun Sampai</label>
|
||||
<select id="searchTahunTo" class="form-control">
|
||||
<option value="">-- Pilih --</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2" style="display: flex; align-items: flex-end; gap: 5px; margin-top: 24px;">
|
||||
<button class="btn btn-info" onclick="applyCustomFilter()" style="flex: 1;"><i class="fa fa-search"></i> Cari</button>
|
||||
<button class="btn btn-default" onclick="resetCustomFilter()"><i class="fa fa-refresh"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="panel-body" style="overflow-x: auto;">
|
||||
<table id="tablePenelitian" class="table table-striped table-bordered dt-responsive nowrap" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Nama Dosen</th>
|
||||
<th>Judul Penelitian</th>
|
||||
<th>Tahun</th>
|
||||
<th>Status</th>
|
||||
<th>Terakhir Update</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbodyPenelitian"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<ul class="list-inline">
|
||||
@@ -158,6 +213,68 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal View Penelitian -->
|
||||
<div class="modal fade" id="modalPenelitian" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="modalLabel">Lihat Penelitian</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="formPenelitian">
|
||||
<div class="form-group">
|
||||
<label>Nama Dosen</label>
|
||||
<input type="text" class="form-control" id="view_dosen_name" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Judul Penelitian</label>
|
||||
<input type="text" class="form-control" id="view_judul" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Tahun Penelitian</label>
|
||||
<input type="text" class="form-control" id="view_tahun" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Status Penelitian</label>
|
||||
<input type="text" class="form-control" id="view_status" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Keterangan</label>
|
||||
<textarea class="form-control" id="view_keterangan" rows="3" readonly></textarea>
|
||||
</div>
|
||||
<div class="form-group" id="fileListSection" style="display: none;">
|
||||
<label>Daftar File Publikasi:</label>
|
||||
<div id="existingFilesContainer" class="mt-2"></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-info pull-left" id="btnHistory" onclick="viewHistory()"><i class="fa fa-history"></i> Riwayat Laporan</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Tutup</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal History / Laporan -->
|
||||
<div class="modal fade" id="modalHistory" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span>×</span></button>
|
||||
<h4 class="modal-title">Riwayat Perubahan Penelitian</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="historyContainer"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary pull-left" onclick="printLaporan()"><i class="fa fa-print"></i> Cetak Laporan PDF</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Tutup</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src="assets/scripts/jquery.min.js"></script>
|
||||
@@ -169,24 +286,60 @@
|
||||
<script src="assets/plugin/waves/waves.min.js"></script>
|
||||
<script src="assets/plugin/fullscreen/jquery.fullscreen-min.js"></script>
|
||||
|
||||
<!-- Data Tables -->
|
||||
<script src="assets/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
|
||||
<script src="assets/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
|
||||
<script src="assets/plugin/datatables/extensions/Responsive/js/dataTables.responsive.min.js"></script>
|
||||
<script src="assets/plugin/datatables/extensions/Responsive/js/responsive.bootstrap.min.js"></script>
|
||||
|
||||
<script src="assets/plugin/chart/chartjs/Chart.bundle.min.js"></script>
|
||||
|
||||
<script src="assets/scripts/main.min.js"></script>
|
||||
<script src="assets/color-switcher/color-switcher.min.js"></script>
|
||||
|
||||
<script>
|
||||
// Format Dates
|
||||
function formatDate(dateString) {
|
||||
let dataTable;
|
||||
let currentViewId = null;
|
||||
|
||||
// --- DATE FORMATTER (ISO String to "DD Mon YYYY, HH.mm") ---
|
||||
function formatDateOnly(dateString) {
|
||||
if (!dateString) return '-';
|
||||
if (!dateString.includes('T')) {
|
||||
let cleanStr = dateString.replace('T', ' ');
|
||||
return cleanStr.substring(0, 16).replace(/-/g, ' ').replace(':', '.');
|
||||
}
|
||||
const date = new Date(dateString);
|
||||
return date.toLocaleString('id-ID', {
|
||||
day: '2-digit', month: 'short', year: 'numeric',
|
||||
hour: '2-digit', minute: '2-digit'
|
||||
});
|
||||
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Agu', 'Sep', 'Okt', 'Nov', 'Des'];
|
||||
const day = String(date.getUTCDate()).padStart(2, '0');
|
||||
const month = months[date.getUTCMonth()];
|
||||
const year = date.getUTCFullYear();
|
||||
const hours = String(date.getUTCHours()).padStart(2, '0');
|
||||
const minutes = String(date.getUTCMinutes()).padStart(2, '0');
|
||||
return `${day} ${month} ${year}, ${hours}.${minutes}`;
|
||||
}
|
||||
|
||||
// Custom Search Logic
|
||||
$.fn.dataTable.ext.search.push(
|
||||
function (settings, data, dataIndex) {
|
||||
const judul = data[2].toLowerCase(); // Index 2 is Judul now
|
||||
const tahun = parseInt(data[3]); // Index 3 is Tahun now
|
||||
|
||||
const searchJudul = $('#searchJudul').val().toLowerCase();
|
||||
const searchFrom = $('#searchTahunFrom').val();
|
||||
const searchTo = $('#searchTahunTo').val();
|
||||
|
||||
if (searchJudul && !judul.includes(searchJudul)) return false;
|
||||
if (searchFrom && tahun < parseInt(searchFrom)) return false;
|
||||
if (searchTo && tahun > parseInt(searchTo)) return false;
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
function applyCustomFilter() { dataTable.draw(); }
|
||||
function resetCustomFilter() {
|
||||
$('#searchJudul').val('');
|
||||
$('#searchTahunFrom').val('');
|
||||
$('#searchTahunTo').val('');
|
||||
dataTable.draw();
|
||||
}
|
||||
|
||||
function logout() {
|
||||
@@ -204,85 +357,246 @@
|
||||
});
|
||||
}
|
||||
|
||||
// --- CHART RENDERING ---
|
||||
function renderChart() {
|
||||
$.get('/api/laporan/stats/daily', function (data) {
|
||||
const labels = [];
|
||||
const counts = [];
|
||||
|
||||
data.forEach(item => {
|
||||
const dateObj = new Date(item.date);
|
||||
const formattedDate = dateObj.toLocaleDateString('id-ID', { day: '2-digit', month: 'short' });
|
||||
labels.push(formattedDate);
|
||||
counts.push(item.total);
|
||||
});
|
||||
|
||||
const ctx = document.getElementById('penelitianChart').getContext('2d');
|
||||
new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: 'Jumlah Submit/Update Penelitian',
|
||||
data: counts,
|
||||
backgroundColor: 'rgba(54, 162, 235, 0.2)',
|
||||
borderColor: 'rgba(54, 162, 235, 1)',
|
||||
borderWidth: 2,
|
||||
pointBackgroundColor: 'rgba(54, 162, 235, 1)',
|
||||
pointRadius: 4,
|
||||
fill: true,
|
||||
tension: 0.3
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
scales: { y: { beginAtZero: true, ticks: { stepSize: 1 } } },
|
||||
plugins: { legend: { display: true, position: 'top' } }
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
document.body.style.display = 'block';
|
||||
|
||||
// 1. Fetch Penelitian (for stats and last update)
|
||||
$.ajax({
|
||||
url: `/api/penelitian`,
|
||||
method: 'GET',
|
||||
success: function (data) {
|
||||
let total = data.length;
|
||||
let selesai = 0;
|
||||
let latestUpdateItem = null;
|
||||
// 1. Populate "Tahun Dari" and "Tahun Sampai"
|
||||
const fromSelect = document.getElementById('searchTahunFrom');
|
||||
const toSelect = document.getElementById('searchTahunTo');
|
||||
for (let y = 2010; y <= 2026; y++) {
|
||||
fromSelect.appendChild(new Option(y, y));
|
||||
}
|
||||
toSelect.disabled = true;
|
||||
toSelect.innerHTML = '<option value="">-- Pilih Tahun Dari --</option>';
|
||||
|
||||
data.forEach(item => {
|
||||
if (item.status_penelitian === 'Selesai') selesai++;
|
||||
|
||||
// Find the latest updated item
|
||||
if (item.updated_at) {
|
||||
const itemDate = new Date(item.updated_at);
|
||||
if (!latestUpdateItem || itemDate > new Date(latestUpdateItem.updated_at)) {
|
||||
latestUpdateItem = item;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#h_jumlah_penelitian').text(total);
|
||||
$('#h_penelitian_selesai').text(selesai);
|
||||
|
||||
// Populate Last Update Card
|
||||
const container = $('#lastUpdateContainer');
|
||||
container.empty();
|
||||
|
||||
if (latestUpdateItem) {
|
||||
let badge = latestUpdateItem.status_penelitian === 'Berjalan' ? 'label-warning' : 'label-success';
|
||||
|
||||
container.append(`
|
||||
<div style="margin-bottom: 15px;">
|
||||
<h5 style="margin-top: 0; font-weight: bold; color: #333;">${latestUpdateItem.judul_penelitian}</h5>
|
||||
<p class="text-muted" style="margin-bottom: 5px; font-size: 13px;">
|
||||
<i class="fa fa-user"></i> ${latestUpdateItem.dosen_name} <br>
|
||||
<i class="fa fa-calendar"></i> ${formatDate(latestUpdateItem.updated_at)}
|
||||
</p>
|
||||
<span class="label ${badge}" style="font-size: 12px;">${latestUpdateItem.status_penelitian}</span>
|
||||
</div>
|
||||
`);
|
||||
} else {
|
||||
container.append('<p class="text-center text-muted">Belum ada penelitian.</p>');
|
||||
$('#searchTahunFrom').on('change', function () {
|
||||
const selectedFrom = $(this).val();
|
||||
toSelect.innerHTML = '';
|
||||
if (selectedFrom) {
|
||||
toSelect.disabled = false;
|
||||
toSelect.innerHTML = '<option value="">-- Pilih --</option>';
|
||||
for (let y = parseInt(selectedFrom); y <= 2026; y++) {
|
||||
toSelect.appendChild(new Option(y, y));
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
$('#lastUpdateContainer').html('<p class="text-center text-danger">Gagal memuat data penelitian.</p>');
|
||||
} else {
|
||||
toSelect.disabled = true;
|
||||
toSelect.innerHTML = '<option value="">-- Pilih Tahun Dari Dulu --</option>';
|
||||
}
|
||||
applyCustomFilter();
|
||||
});
|
||||
|
||||
// 2. Render Chart & Fetch Last Update
|
||||
renderChart();
|
||||
$.get('/api/penelitian', function (data) {
|
||||
let total = data.length;
|
||||
let selesai = 0;
|
||||
let latestUpdateItem = null;
|
||||
data.forEach(item => {
|
||||
if (item.status_penelitian === 'Selesai') selesai++;
|
||||
if (item.updated_at) {
|
||||
const itemDate = new Date(item.updated_at);
|
||||
if (!latestUpdateItem || itemDate > new Date(latestUpdateItem.updated_at)) {
|
||||
latestUpdateItem = item;
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#h_jumlah_penelitian').text(total);
|
||||
$('#h_penelitian_selesai').text(selesai);
|
||||
$('#h_update').text(latestUpdateItem ? formatDateOnly(latestUpdateItem.updated_at) : '-');
|
||||
|
||||
const container = $('#lastUpdateContainer');
|
||||
container.empty();
|
||||
if (latestUpdateItem) {
|
||||
let badge = latestUpdateItem.status_penelitian === 'Berjalan' ? 'label-warning' : 'label-success';
|
||||
container.append(`
|
||||
<div style="margin-bottom: 15px;">
|
||||
<h5 style="margin-top: 0; font-weight: bold; color: #333;">${latestUpdateItem.judul_penelitian}</h5>
|
||||
<p class="text-muted" style="margin-bottom: 5px; font-size: 13px;">
|
||||
<i class="fa fa-user"></i> ${latestUpdateItem.dosen_name} <br>
|
||||
<i class="fa fa-calendar"></i> ${formatDateOnly(latestUpdateItem.updated_at)}
|
||||
</p>
|
||||
<span class="label ${badge}" style="font-size: 12px;">${latestUpdateItem.status_penelitian}</span>
|
||||
</div>
|
||||
`);
|
||||
} else {
|
||||
container.append('<p class="text-center text-muted">Belum ada penelitian.</p>');
|
||||
}
|
||||
});
|
||||
|
||||
// 2. Fetch Mahasiswa Count
|
||||
$.ajax({
|
||||
url: `/api/mahasiswa`,
|
||||
method: 'GET',
|
||||
success: function (data) {
|
||||
$('#h_jumlah_mahasiswa').text(data.length);
|
||||
},
|
||||
error: function () {
|
||||
$('#h_jumlah_mahasiswa').text('0');
|
||||
}
|
||||
});
|
||||
// 3. Fetch Mahasiswa & Dosen Count
|
||||
$.get('/api/mahasiswa', function (data) { $('#h_jumlah_mahasiswa').text(data.length); });
|
||||
$.get('/api/dosen', function (data) { $('#h_jumlah_dosen').text(data.length); });
|
||||
|
||||
// 3. Fetch Dosen Count
|
||||
$.ajax({
|
||||
url: `/api/dosen`,
|
||||
method: 'GET',
|
||||
success: function (data) {
|
||||
$('#h_jumlah_dosen').text(data.length);
|
||||
},
|
||||
error: function () {
|
||||
$('#h_jumlah_dosen').text('0');
|
||||
}
|
||||
// 4. Initialize DataTable
|
||||
dataTable = $('#tablePenelitian').DataTable({
|
||||
ajax: { url: `/api/penelitian`, dataSrc: '' },
|
||||
columns: [
|
||||
{ data: null, render: (data, type, row, meta) => meta.row + 1 },
|
||||
{ data: 'dosen_name' },
|
||||
{ data: 'judul_penelitian' },
|
||||
{ data: 'tahun_penelitian' },
|
||||
{
|
||||
data: 'status_penelitian',
|
||||
render: function (data) {
|
||||
let badge = data === 'Berjalan' ? 'label-warning' : 'label-success';
|
||||
return `<span class="label ${badge}">${data}</span>`;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'updated_at',
|
||||
render: function (data) { return formatDateOnly(data); }
|
||||
},
|
||||
{
|
||||
data: null,
|
||||
render: function (data, type, row) {
|
||||
// Only show the View (Eye) button
|
||||
return `<button class="btn btn-info btn-xs" title="Lihat" onclick="viewPenelitian(${row.id})"><i class="fa fa-eye"></i> Lihat</button>`;
|
||||
}
|
||||
}
|
||||
],
|
||||
order: [[5, "desc"]]
|
||||
});
|
||||
});
|
||||
|
||||
// --- MODAL FUNCTIONS ---
|
||||
|
||||
function viewPenelitian(id) {
|
||||
currentViewId = id;
|
||||
// Find the data by making an AJAX call (or we can find it in DataTable data)
|
||||
$.get(`/api/penelitian`, function (allData) {
|
||||
const item = allData.find(p => p.id === id);
|
||||
if (item) {
|
||||
$('#view_dosen_name').val(item.dosen_name);
|
||||
$('#view_judul').val(item.judul_penelitian);
|
||||
$('#view_tahun').val(item.tahun_penelitian);
|
||||
$('#view_status').val(item.status_penelitian);
|
||||
$('#view_keterangan').val(item.keterangan || '');
|
||||
|
||||
renderExistingFilesView(item.hasil_publikasi);
|
||||
$('#modalPenelitian').modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function renderExistingFilesView(filesData) {
|
||||
let currentFiles = [];
|
||||
if (Array.isArray(filesData)) currentFiles = filesData;
|
||||
else if (typeof filesData === 'string') {
|
||||
try { currentFiles = JSON.parse(filesData); } catch (e) {}
|
||||
}
|
||||
|
||||
const container = $('#existingFilesContainer');
|
||||
container.empty();
|
||||
|
||||
if (currentFiles.length > 0) {
|
||||
$('#fileListSection').show();
|
||||
currentFiles.forEach((filename) => {
|
||||
let displayName = filename.substring(filename.indexOf('-') + 1);
|
||||
container.append(`
|
||||
<div class="file-item">
|
||||
<a href="/api/uploads/${filename}" target="_blank"><i class="fa fa-file-pdf-o text-danger"></i> ${displayName}</a>
|
||||
</div>
|
||||
`);
|
||||
});
|
||||
} else {
|
||||
$('#fileListSection').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function viewHistory() {
|
||||
if (!currentViewId) return;
|
||||
$('#historyContainer').empty();
|
||||
$('#modalPenelitian').modal('hide');
|
||||
$('#modalHistory').modal('show');
|
||||
|
||||
$.get(`/api/laporan/${currentViewId}`, function (data) {
|
||||
if (data.length === 0) {
|
||||
$('#historyContainer').html('<p class="text-center text-muted">Belum ada riwayat.</p>');
|
||||
return;
|
||||
}
|
||||
|
||||
data.forEach((log, index) => {
|
||||
let filesHtml = '';
|
||||
if (log.hasil_publikasi) {
|
||||
try {
|
||||
const files = typeof log.hasil_publikasi === 'string' ? JSON.parse(log.hasil_publikasi) : log.hasil_publikasi;
|
||||
files.forEach(f => {
|
||||
let displayName = f.substring(f.indexOf('-') + 1);
|
||||
filesHtml += `<div class="file-item" style="margin-top:5px;">
|
||||
<a href="/api/uploads/${f}" target="_blank"><i class="fa fa-file-pdf-o text-danger"></i> ${displayName}</a>
|
||||
</div>`;
|
||||
});
|
||||
} catch (e) { }
|
||||
}
|
||||
|
||||
$('#historyContainer').append(`
|
||||
<div class="history-panel">
|
||||
<div class="history-header">
|
||||
Update #${data.length - index}
|
||||
<span class="pull-right text-muted" style="font-size: 12px; font-weight: normal;">
|
||||
${formatDateOnly(log.created_at)}
|
||||
</span>
|
||||
</div>
|
||||
<div class="history-body">
|
||||
<table class="table table-condensed" style="margin-bottom: 0;">
|
||||
<tr><td width="120"><strong>Status</strong></td><td>: <span class="label ${log.status_penelitian === 'Berjalan' ? 'label-warning' : 'label-success'}">${log.status_penelitian}</span></td></tr>
|
||||
<tr><td><strong>Keterangan</strong></td><td>: ${log.keterangan || '-'}</td></tr>
|
||||
<tr><td><strong>File</strong></td><td>${filesHtml || '-'}</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function printLaporan() {
|
||||
if (currentViewId) {
|
||||
window.open(`laporan.html?id=${currentViewId}`, '_blank');
|
||||
} else {
|
||||
swal("Gagal", "ID Penelitian tidak ditemukan.", "error");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+81
-19
@@ -21,10 +21,8 @@
|
||||
<link rel="stylesheet" href="assets/plugin/datatables/media/css/dataTables.bootstrap.min.css">
|
||||
<link rel="stylesheet" href="assets/plugin/datatables/extensions/Responsive/css/responsive.bootstrap.min.css">
|
||||
<style>
|
||||
/* Hide body until auth passes */
|
||||
body { display: none; }
|
||||
/* Hide default DataTables search */
|
||||
.dataTables_filter { display: none; }
|
||||
/* .dataTables_filter { display: none; } */
|
||||
.detail-img { width: 120px; height: 120px; object-fit: cover; border-radius: 50%; border: 3px solid #eee; }
|
||||
</style>
|
||||
</head>
|
||||
@@ -115,9 +113,17 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Daftar Dosen</h3>
|
||||
<button class="btn btn-primary btn-sm pull-right" data-toggle="modal" data-target="#modalAddDosen">
|
||||
<i class="fa fa-plus"></i> Tambah Dosen
|
||||
</button>
|
||||
<div class="pull-right">
|
||||
<button class="btn btn-success btn-sm" data-toggle="modal" data-target="#modalImportCSV">
|
||||
<i class="fa fa-upload"></i> Import CSV
|
||||
</button>
|
||||
<button class="btn btn-info btn-sm" onclick="exportCSV()">
|
||||
<i class="fa fa-download"></i> Export CSV
|
||||
</button>
|
||||
<button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#modalAddDosen">
|
||||
<i class="fa fa-plus"></i> Tambah Dosen
|
||||
</button>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
@@ -174,6 +180,30 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- MODAL IMPORT CSV -->
|
||||
<div class="modal fade" id="modalImportCSV" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<form id="formImportCSV">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">Import Data Dosen (CSV)</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Pilih file CSV yang memiliki 2 kolom: <b>dosen_id</b> dan <b>dosen_name</b>. Pastikan baris pertama adalah header.</p>
|
||||
<div class="form-group">
|
||||
<input type="file" class="form-control" id="csv_file" accept=".csv" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-success" id="btnImportCSV">Upload & Import</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- MODAL DETAIL DOSEN -->
|
||||
<div class="modal fade" id="modalDetailDosen" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
@@ -221,7 +251,7 @@
|
||||
<script src="assets/color-switcher/color-switcher.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.body.style.display = 'block'; // Show body after auth check
|
||||
document.body.style.display = 'block';
|
||||
|
||||
// FORMAT DATE HELPER
|
||||
function formatDate(dateString) {
|
||||
@@ -238,7 +268,6 @@
|
||||
|
||||
// LOAD STATISTICS
|
||||
function loadStatistics() {
|
||||
// 1. Fetch Penelitian
|
||||
$.get('/api/penelitian', function(data) {
|
||||
let total = data.length;
|
||||
let selesai = 0;
|
||||
@@ -257,14 +286,12 @@
|
||||
$('#h_update').text(latestUpdate ? formatDateShort(latestUpdate) : '-');
|
||||
});
|
||||
|
||||
// 2. Fetch Dosen Count
|
||||
$.get('/api/dosen', function(data) {
|
||||
$('#h_jumlah_dosen').text(data.length);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// LOAD DATATABLE
|
||||
// LOAD DATATABLE
|
||||
let tableDosen;
|
||||
function loadDosen() {
|
||||
if ($.fn.DataTable.isDataTable('#tabelDosen')) {
|
||||
@@ -272,17 +299,13 @@
|
||||
}
|
||||
|
||||
tableDosen = $('#tabelDosen').DataTable({
|
||||
"ajax": {
|
||||
"url": "/api/dosen",
|
||||
"dataSrc": ""
|
||||
},
|
||||
"ajax": { "url": "/api/dosen", "dataSrc": "" },
|
||||
"columns": [
|
||||
{ "data": "dosen_id" },
|
||||
{ "data": "dosen_name" },
|
||||
{
|
||||
"data": "jumlah_penelitian",
|
||||
"render": function(data) {
|
||||
// Display as a badge for better UI
|
||||
return `<span class="label label-primary" style="font-size: 13px;">${data} Penelitian</span>`;
|
||||
}
|
||||
},
|
||||
@@ -306,14 +329,12 @@
|
||||
const dosen = data.dosen;
|
||||
const p = data.latest_penelitian;
|
||||
|
||||
// Image
|
||||
if (dosen.dosen_image) {
|
||||
$('#detail_img').attr('src', `/api/images/dosen/${dosen.dosen_image}`);
|
||||
} else {
|
||||
$('#detail_img').attr('src', 'assets/images/person.png');
|
||||
}
|
||||
|
||||
// Text Info
|
||||
$('#detail_id').text(dosen.dosen_id);
|
||||
$('#detail_name').text(dosen.dosen_name);
|
||||
$('#detail_jumlah').text(dosen.jumlah_penelitian + " Penelitian");
|
||||
@@ -375,7 +396,7 @@
|
||||
$('#formAddDosen')[0].reset();
|
||||
swal("Berhasil!", response.message, "success");
|
||||
loadDosen();
|
||||
loadStatistics(); // Update count
|
||||
loadStatistics();
|
||||
},
|
||||
error: function(xhr) {
|
||||
swal("Gagal!", xhr.responseJSON?.error || 'Terjadi kesalahan sistem.', "error");
|
||||
@@ -386,6 +407,47 @@
|
||||
});
|
||||
});
|
||||
|
||||
// --- NEW: IMPORT CSV ---
|
||||
$('#formImportCSV').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
const btn = $('#btnImportCSV');
|
||||
const fileInput = $('#csv_file')[0];
|
||||
|
||||
if (!fileInput.files.length) return;
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('csv_file', fileInput.files[0]);
|
||||
|
||||
btn.prop('disabled', true).text('Mengimpor...');
|
||||
|
||||
$.ajax({
|
||||
url: '/api/dosen/import-csv',
|
||||
method: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(response) {
|
||||
$('#modalImportCSV').modal('hide');
|
||||
$('#formImportCSV')[0].reset();
|
||||
swal("Berhasil!", response.message, "success");
|
||||
loadDosen();
|
||||
loadStatistics();
|
||||
},
|
||||
error: function(xhr) {
|
||||
swal("Gagal", xhr.responseJSON?.error || "Terjadi kesalahan saat mengimpor", "error");
|
||||
},
|
||||
complete: function() {
|
||||
btn.prop('disabled', false).text('Upload & Import');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// --- NEW: EXPORT CSV ---
|
||||
function exportCSV() {
|
||||
// Redirect to the export endpoint, the browser will automatically download the file
|
||||
window.location.href = '/api/dosen/export-csv';
|
||||
}
|
||||
|
||||
// LOGOUT
|
||||
function logout() {
|
||||
swal({
|
||||
|
||||
@@ -0,0 +1,458 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<title>Aplikasi Penelitian Dosen - Manajemen Mahasiswa</title>
|
||||
|
||||
<script>
|
||||
if (localStorage.getItem('admin_auth') !== 'true') {
|
||||
localStorage.clear();
|
||||
window.location.href = 'index.html';
|
||||
}
|
||||
</script>
|
||||
|
||||
<link rel="stylesheet" href="assets/styles/style.min.css">
|
||||
<link rel="stylesheet" href="assets/plugin/mCustomScrollbar/jquery.mCustomScrollbar.min.css">
|
||||
<link rel="stylesheet" href="assets/plugin/waves/waves.min.css">
|
||||
<link rel="stylesheet" href="assets/plugin/sweet-alert/sweetalert.css">
|
||||
<link rel="stylesheet" href="assets/color-switcher/color-switcher.min.css">
|
||||
<link rel="stylesheet" href="assets/plugin/datatables/media/css/dataTables.bootstrap.min.css">
|
||||
<link rel="stylesheet" href="assets/plugin/datatables/extensions/Responsive/css/responsive.bootstrap.min.css">
|
||||
<style>
|
||||
body { display: none; }
|
||||
/* .dataTables_filter { display: none; } */
|
||||
/* Style for the detail modal image */
|
||||
.detail-img { width: 120px; height: 120px; object-fit: cover; border-radius: 50%; border: 3px solid #eee; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="main-menu">
|
||||
<header class="header">
|
||||
<a href="admin_index.html" class="logo">UHM</a>
|
||||
<button type="button" class="button-close fa fa-times js__menu_close"></button>
|
||||
<div class="user">
|
||||
<a href="#" class="avatar"><img src="assets/images/person.png" alt=""><span class="status online"></span></a>
|
||||
<h5 class="name"><a href="#">Admin</a></h5>
|
||||
<h5 class="position">Administrator</h5>
|
||||
</div>
|
||||
</header>
|
||||
<div class="content">
|
||||
<div class="navigation">
|
||||
<h5 class="title">Navigasi</h5>
|
||||
<ul class="menu js__accordion">
|
||||
<li><a class="waves-effect" href="admin_index.html"><i class="menu-icon fa fa-home"></i><span>Halaman Utama</span></a></li>
|
||||
<li><a class="waves-effect" href="admin_list_penelitian.html"><i class="menu-icon fa fa-list"></i><span>List Penelitian</span></a></li>
|
||||
<li><a class="waves-effect" href="admin_manage_dosen.html"><i class="menu-icon fa fa-users"></i><span>Managemen Dosen</span></a></li>
|
||||
<li class="current"><a class="waves-effect" href="admin_manage_mahasiswa.html"><i class="menu-icon fa fa-users"></i><span>Managemen Mahasiswa</span></a></li>
|
||||
<li><a class="waves-effect" href="admin_profile.html"><i class="menu-icon fa fa-user"></i><span>Profil</span></a></li>
|
||||
<li><a class="waves-effect" href="#" onclick="logout()"><i class="menu-icon fa fa-sign-out"></i><span>Logout</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fixed-navbar">
|
||||
<div class="pull-left">
|
||||
<button type="button" class="menu-mobile-button glyphicon glyphicon-menu-hamburger js__menu_mobile"></button>
|
||||
<h1 class="page-title">Manajemen Mahasiswa</h1>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<div class="ico-item fa fa-arrows-alt js__full_screen"></div>
|
||||
<a href="#" class="ico-item fa fa-sign-out" onclick="logout()"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
|
||||
<!-- STATISTICS -->
|
||||
<div class="row small-spacing">
|
||||
<div class="col-lg-3 col-md-6 col-xs-12">
|
||||
<div class="box-content">
|
||||
<div class="statistics-box with-icon">
|
||||
<i class="ico fa fa-wpforms text-inverse"></i>
|
||||
<h2 class="counter text-inverse" id="h_jumlah_penelitian">...</h2>
|
||||
<p class="text">Jumlah Penelitian</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-6 col-xs-12">
|
||||
<div class="box-content">
|
||||
<div class="statistics-box with-icon">
|
||||
<i class="ico fa fa-check text-success"></i>
|
||||
<h2 class="counter text-success" id="h_penelitian_selesai">...</h2>
|
||||
<p class="text">Penelitian Selesai</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-6 col-xs-12">
|
||||
<div class="box-content">
|
||||
<div class="statistics-box with-icon">
|
||||
<i class="ico fa fa-graduation-cap text-info"></i>
|
||||
<h2 class="counter text-info" id="h_jumlah_mahasiswa">...</h2>
|
||||
<p class="text">Jumlah Mahasiswa</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-6 col-xs-12">
|
||||
<div class="box-content">
|
||||
<div class="statistics-box with-icon">
|
||||
<i class="ico fa fa-clock-o text-primary"></i>
|
||||
<h2 class="counter text-primary" id="h_update" style="font-size: 20px;">...</h2>
|
||||
<p class="text">Update Terakhir</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TABLE -->
|
||||
<div class="row small-spacing">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Daftar Mahasiswa</h3>
|
||||
<div class="pull-right">
|
||||
<button class="btn btn-success btn-sm" data-toggle="modal" data-target="#modalImportCSV">
|
||||
<i class="fa fa-upload"></i> Import CSV
|
||||
</button>
|
||||
<button class="btn btn-info btn-sm" onclick="exportCSV()">
|
||||
<i class="fa fa-download"></i> Export CSV
|
||||
</button>
|
||||
<button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#modalAddMahasiswa">
|
||||
<i class="fa fa-plus"></i> Tambah Mahasiswa
|
||||
</button>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<table id="tabelMahasiswa" class="table table-striped table-bordered dt-responsive nowrap" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID Mahasiswa</th>
|
||||
<th>Nama Mahasiswa</th>
|
||||
<th>Tanggal Daftar</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<ul class="list-inline">
|
||||
<li>2026 © Tugas RPL.</li>
|
||||
</ul>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- MODAL ADD MAHASISWA -->
|
||||
<div class="modal fade" id="modalAddMahasiswa" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<form id="formAddMahasiswa">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">Tambah Mahasiswa Baru</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="id_mahasiswa">ID Mahasiswa</label>
|
||||
<input type="text" class="form-control" id="id_mahasiswa" placeholder="Contoh: 2026001" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="nama_mahasiswa">Nama Mahasiswa</label>
|
||||
<input type="text" class="form-control" id="nama_mahasiswa" placeholder="Masukkan nama lengkap" required>
|
||||
</div>
|
||||
<p class="text-muted"><small>*Password default akan di-set otomatis menjadi <b>1234567</b>.</small></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-primary" id="btnSaveMahasiswa">Simpan</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- MODAL IMPORT CSV -->
|
||||
<div class="modal fade" id="modalImportCSV" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<form id="formImportCSV">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">Import Data Mahasiswa (CSV)</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Pilih file CSV yang memiliki 2 kolom: <b>id_mahasiswa</b> dan <b>nama_mahasiswa</b>. Pastikan baris pertama adalah header.</p>
|
||||
<div class="form-group">
|
||||
<input type="file" class="form-control" id="csv_file" accept=".csv" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Batal</button>
|
||||
<button type="submit" class="btn btn-success" id="btnImportCSV">Upload & Import</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- MODAL DETAIL MAHASISWA -->
|
||||
<div class="modal fade" id="modalDetailMahasiswa" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">Detail Mahasiswa</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="text-center" style="margin-bottom: 20px;">
|
||||
<!-- Default image since tb_mahasiswa doesn't have an image column yet -->
|
||||
<img id="detail_mhs_img" src="assets/images/person.png" alt="Foto Mahasiswa" class="detail-img">
|
||||
</div>
|
||||
<table class="table table-condensed">
|
||||
<tr><th width="150">ID Mahasiswa</th><td>: <span id="detail_mhs_id"></span></td></tr>
|
||||
<tr><th>Nama Mahasiswa</th><td>: <span id="detail_mhs_name"></span></td></tr>
|
||||
<tr><th>Tanggal Daftar</th><td>: <span id="detail_mhs_date"></span></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Tutup</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src="assets/scripts/jquery.min.js"></script>
|
||||
<script src="assets/scripts/modernizr.min.js"></script>
|
||||
<script src="assets/plugin/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="assets/plugin/mCustomScrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
|
||||
<script src="assets/plugin/nprogress/nprogress.js"></script>
|
||||
<script src="assets/plugin/sweet-alert/sweetalert.min.js"></script>
|
||||
<script src="assets/plugin/waves/waves.min.js"></script>
|
||||
<script src="assets/plugin/fullscreen/jquery.fullscreen-min.js"></script>
|
||||
|
||||
<script src="assets/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
|
||||
<script src="assets/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
|
||||
<script src="assets/plugin/datatables/extensions/Responsive/js/dataTables.responsive.min.js"></script>
|
||||
<script src="assets/plugin/datatables/extensions/Responsive/js/responsive.bootstrap.min.js"></script>
|
||||
|
||||
<script src="assets/scripts/main.min.js"></script>
|
||||
<script src="assets/color-switcher/color-switcher.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.body.style.display = 'block';
|
||||
|
||||
// FORMAT DATE HELPER (Reformat ISO String to "DD Mon YYYY")
|
||||
function formatDateShort(dateString) {
|
||||
if (!dateString) return '-';
|
||||
const date = new Date(dateString);
|
||||
return date.toLocaleDateString('id-ID', { day: '2-digit', month: 'short', year: 'numeric' });
|
||||
}
|
||||
|
||||
// LOAD STATISTICS
|
||||
function loadStatistics() {
|
||||
$.get('/api/penelitian', function(data) {
|
||||
let total = data.length;
|
||||
let selesai = 0;
|
||||
let latestUpdate = null;
|
||||
|
||||
data.forEach(item => {
|
||||
if (item.status_penelitian === 'Selesai') selesai++;
|
||||
if (item.updated_at) {
|
||||
const itemDate = new Date(item.updated_at);
|
||||
if (!latestUpdate || itemDate > latestUpdate) latestUpdate = itemDate;
|
||||
}
|
||||
});
|
||||
|
||||
$('#h_jumlah_penelitian').text(total);
|
||||
$('#h_penelitian_selesai').text(selesai);
|
||||
$('#h_update').text(latestUpdate ? formatDateShort(latestUpdate) : '-');
|
||||
});
|
||||
|
||||
$.get('/api/mahasiswa', function(data) {
|
||||
$('#h_jumlah_mahasiswa').text(data.length);
|
||||
});
|
||||
}
|
||||
|
||||
// LOAD DATATABLE
|
||||
let tableMahasiswa;
|
||||
let allMahasiswaData = []; // We store the data here for the Detail modal
|
||||
|
||||
function loadMahasiswa() {
|
||||
if ($.fn.DataTable.isDataTable('#tabelMahasiswa')) {
|
||||
$('#tabelMahasiswa').DataTable().destroy();
|
||||
}
|
||||
|
||||
tableMahasiswa = $('#tabelMahasiswa').DataTable({
|
||||
"ajax": {
|
||||
"url": "/api/mahasiswa",
|
||||
"dataSrc": function(json) {
|
||||
allMahasiswaData = json; // Save data globally
|
||||
return json;
|
||||
}
|
||||
},
|
||||
"columns": [
|
||||
{ "data": "id_mahasiswa" },
|
||||
{ "data": "nama_mahasiswa" },
|
||||
{
|
||||
"data": "created_at",
|
||||
"render": function(data) {
|
||||
return formatDateShort(data);
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": null,
|
||||
"render": function(data, type, row) {
|
||||
return `
|
||||
<button class="btn btn-info btn-xs" title="Detail" onclick="showDetail('${row.id_mahasiswa}')"><i class="fa fa-eye"></i></button>
|
||||
<button class="btn btn-danger btn-xs" title="Reset Password" onclick="resetPassword('${row.id_mahasiswa}', '${row.nama_mahasiswa}')"><i class="fa fa-key"></i></button>
|
||||
`;
|
||||
}
|
||||
}
|
||||
],
|
||||
"order": [[ 0, "asc" ]]
|
||||
});
|
||||
}
|
||||
|
||||
// SHOW DETAIL MODAL
|
||||
function showDetail(mhsId) {
|
||||
// Find the specific student in our saved data
|
||||
const mhs = allMahasiswaData.find(m => m.id_mahasiswa === mhsId);
|
||||
|
||||
if (mhs) {
|
||||
$('#detail_mhs_id').text(mhs.id_mahasiswa);
|
||||
$('#detail_mhs_name').text(mhs.nama_mahasiswa);
|
||||
$('#detail_mhs_date').text(formatDateShort(mhs.created_at));
|
||||
|
||||
// Image logic: Since tb_mahasiswa doesn't have an image column, we default to person.png
|
||||
// If you add a 'mahasiswa_image' column in the future, change this logic.
|
||||
$('#detail_mhs_img').attr('src', 'assets/images/person.png');
|
||||
|
||||
$('#modalDetailMahasiswa').modal('show');
|
||||
}
|
||||
}
|
||||
|
||||
// RESET PASSWORD
|
||||
function resetPassword(mhsId, mhsName) {
|
||||
swal({
|
||||
title: "Reset Password?",
|
||||
text: `Password untuk ${mhsName} akan direset menjadi '1234567'.`,
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Ya, Reset!",
|
||||
closeOnConfirm: false
|
||||
}, function() {
|
||||
$.ajax({
|
||||
url: `/api/mahasiswa/reset-password/${mhsId}`,
|
||||
type: 'PUT',
|
||||
success: function(response) {
|
||||
swal("Berhasil!", response.message, "success");
|
||||
},
|
||||
error: function(xhr) {
|
||||
swal("Gagal", xhr.responseJSON?.error || "Terjadi kesalahan", "error");
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// HANDLE FORM SUBMIT (ADD MAHASISWA)
|
||||
$('#formAddMahasiswa').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
const btn = $('#btnSaveMahasiswa');
|
||||
btn.prop('disabled', true).text('Menyimpan...');
|
||||
|
||||
$.ajax({
|
||||
url: '/api/mahasiswa',
|
||||
method: 'POST',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({ id_mahasiswa: $('#id_mahasiswa').val(), nama_mahasiswa: $('#nama_mahasiswa').val() }),
|
||||
success: function(response) {
|
||||
$('#modalAddMahasiswa').modal('hide');
|
||||
$('#formAddMahasiswa')[0].reset();
|
||||
swal("Berhasil!", response.message, "success");
|
||||
loadMahasiswa();
|
||||
loadStatistics();
|
||||
},
|
||||
error: function(xhr) {
|
||||
swal("Gagal!", xhr.responseJSON?.error || 'Terjadi kesalahan sistem.', "error");
|
||||
},
|
||||
complete: function() {
|
||||
btn.prop('disabled', false).text('Simpan');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// --- IMPORT CSV ---
|
||||
$('#formImportCSV').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
const btn = $('#btnImportCSV');
|
||||
const fileInput = $('#csv_file')[0];
|
||||
if (!fileInput.files.length) return;
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('csv_file', fileInput.files[0]);
|
||||
|
||||
btn.prop('disabled', true).text('Mengimpor...');
|
||||
|
||||
$.ajax({
|
||||
url: '/api/mahasiswa/import-csv',
|
||||
method: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(response) {
|
||||
$('#modalImportCSV').modal('hide');
|
||||
$('#formImportCSV')[0].reset();
|
||||
swal("Berhasil!", response.message, "success");
|
||||
loadMahasiswa();
|
||||
loadStatistics();
|
||||
},
|
||||
error: function(xhr) {
|
||||
swal("Gagal", xhr.responseJSON?.error || "Terjadi kesalahan saat mengimpor", "error");
|
||||
},
|
||||
complete: function() {
|
||||
btn.prop('disabled', false).text('Upload & Import');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// --- EXPORT CSV ---
|
||||
function exportCSV() {
|
||||
window.location.href = '/api/mahasiswa/export-csv';
|
||||
}
|
||||
|
||||
// LOGOUT
|
||||
function logout() {
|
||||
swal({
|
||||
title: "Logout?",
|
||||
text: "Anda akan keluar dari halaman admin.",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Ya, Logout!",
|
||||
closeOnConfirm: true
|
||||
}, function() {
|
||||
localStorage.removeItem('admin_auth');
|
||||
window.location.href = 'index.html';
|
||||
});
|
||||
}
|
||||
|
||||
// INIT
|
||||
$(document).ready(function() {
|
||||
loadStatistics();
|
||||
loadMahasiswa();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
+5
-2
@@ -152,6 +152,9 @@
|
||||
<li><a class="waves-effect" href="dosen_index.html"><i
|
||||
class="menu-icon fa fa-home"></i><span>Halaman
|
||||
Utama</span></a></li>
|
||||
<li><a class="waves-effect" href="dosen_halaman_penelitian.html"><i
|
||||
class="menu-icon fa fa-file-text"></i><span>Halaman
|
||||
Penelitian</span></a></li>
|
||||
<li class="current"><a class="waves-effect" href="dosen.html"><i
|
||||
class="menu-icon fa fa-list"></i><span>Managemen
|
||||
Penelitian</span></a></li>
|
||||
@@ -215,7 +218,7 @@
|
||||
<div class="statistics-box with-icon">
|
||||
<i class="ico fa fa-area-chart text-info"></i>
|
||||
<h2 class="counter text-info" id="h_terakhir_update"
|
||||
style="font-size: 20px; margin-top: 25px;">...</h2>
|
||||
style="font-size: 20px;">...</h2>
|
||||
<p class="text">Terakhir Update</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -624,7 +627,7 @@
|
||||
|
||||
if (latestUpdate) {
|
||||
const options = { day: '2-digit', month: 'short', year: 'numeric' };
|
||||
$('#h_terakhir_update').text(latestUpdate.toLocaleDateString('id-ID', options));
|
||||
$('#h_terakhir_update').text(formatDateOnly(latestUpdate.toISOString()));
|
||||
} else {
|
||||
$('#h_terakhir_update').text('-');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,703 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<title>Aplikasi Penelitian Dosen - Halaman List Penelitian</title>
|
||||
|
||||
<script>
|
||||
(async function checkAuth() {
|
||||
const dosenId = localStorage.getItem('dosen_id');
|
||||
const dosenName = localStorage.getItem('dosen_name');
|
||||
|
||||
if (!dosenId || !dosenName) {
|
||||
localStorage.clear();
|
||||
window.location.href = 'index.html';
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/dosen/verify?dosen_id=${encodeURIComponent(dosenId)}&dosen_name=${encodeURIComponent(dosenName)}`);
|
||||
const data = await response.json();
|
||||
|
||||
if (response.ok && data.valid) {
|
||||
document.body.style.display = 'block';
|
||||
} else {
|
||||
localStorage.clear();
|
||||
window.location.href = 'index.html';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Auth check failed:", error);
|
||||
localStorage.clear();
|
||||
window.location.href = 'index.html';
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<link rel="stylesheet" href="assets/styles/style.min.css">
|
||||
<link rel="stylesheet" href="assets/plugin/mCustomScrollbar/jquery.mCustomScrollbar.min.css">
|
||||
<link rel="stylesheet" href="assets/plugin/waves/waves.min.css">
|
||||
<link rel="stylesheet" href="assets/plugin/sweet-alert/sweetalert.css">
|
||||
<link rel="stylesheet" href="assets/color-switcher/color-switcher.min.css">
|
||||
<link rel="stylesheet" href="assets/plugin/datatables/media/css/dataTables.bootstrap.min.css">
|
||||
<link rel="stylesheet" href="assets/plugin/datatables/extensions/Responsive/css/responsive.bootstrap.min.css">
|
||||
<style>
|
||||
body {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.dataTables_filter {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Fix for the top-left profile image to be a perfect circle */
|
||||
.header .avatar {
|
||||
width: 65px;
|
||||
height: 65px;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
border-radius: 50%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.header .avatar img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
/* This ensures the image fills the circle without stretching */
|
||||
}
|
||||
|
||||
/* File list styles for the View Modal */
|
||||
.file-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 5px;
|
||||
padding: 8px;
|
||||
background: #f9f9f9;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.file-item a {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
word-break: break-all;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.file-item a:hover {
|
||||
color: #007bff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.history-panel {
|
||||
margin-bottom: 15px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.history-header {
|
||||
background-color: #f5f5f5;
|
||||
padding: 10px 15px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.history-body {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
#modalHistory .modal-body {
|
||||
max-height: calc(100vh - 210px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="main-menu">
|
||||
<header class="header">
|
||||
<a href="admin_index.html" class="logo">UHM</a>
|
||||
<button type="button" class="button-close fa fa-times js__menu_close"></button>
|
||||
<div class="user">
|
||||
<a href="#" class="avatar"><img src="assets/images/person.png" id="foto_dosen" alt=""><span
|
||||
class="status online"></span></a>
|
||||
<h5 class="name"><a href="#" id="dosenName">Dosen</a></h5>
|
||||
<h5 class="position">Dosen</h5>
|
||||
</div>
|
||||
</header>
|
||||
<div class="content">
|
||||
<div class="navigation">
|
||||
<h5 class="title">Navigasi</h5>
|
||||
<ul class="menu js__accordion">
|
||||
<li><a class="waves-effect" href="dosen_index.html"><i
|
||||
class="menu-icon fa fa-home"></i><span>Halaman
|
||||
Utama</span></a></li>
|
||||
<li class="current"><a class="waves-effect" href="dosen_halaman_penelitian.html"><i
|
||||
class="menu-icon fa fa-file-text"></i><span>Halaman
|
||||
Penelitian</span></a></li>
|
||||
<li><a class="waves-effect" href="dosen.html"><i class="menu-icon fa fa-list"></i><span>Managemen
|
||||
Penelitian</span></a></li>
|
||||
<li><a class="waves-effect" href="dosen_profil.html"><i
|
||||
class="menu-icon fa fa-user"></i><span>Profil</span></a></li>
|
||||
<li><a class="waves-effect" href="#" onclick="logout()"><i
|
||||
class="menu-icon fa fa-sign-out"></i><span>Logout</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fixed-navbar">
|
||||
<div class="pull-left">
|
||||
<button type="button"
|
||||
class="menu-mobile-button glyphicon glyphicon-menu-hamburger js__menu_mobile"></button>
|
||||
<h1 class="page-title">Daftar Semua Penelitian</h1>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<div class="ico-item fa fa-arrows-alt js__full_screen"></div>
|
||||
<a href="#" class="ico-item fa fa-sign-out" onclick="logout()"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
<div class="row small-spacing">
|
||||
<div class="col-lg-3 col-md-6 col-xs-12">
|
||||
<div class="box-content">
|
||||
<div class="statistics-box with-icon">
|
||||
<i class="ico fa fa-wpforms text-inverse"></i>
|
||||
<h2 class="counter text-inverse" id="h_jumlah_penelitian">...</h2>
|
||||
<p class="text">Jumlah Penelitian</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-6 col-xs-12">
|
||||
<div class="box-content">
|
||||
<div class="statistics-box with-icon">
|
||||
<i class="ico fa fa-check text-success"></i>
|
||||
<h2 class="counter text-success" id="h_penelitian_selesai">...</h2>
|
||||
<p class="text">Penelitian Selesai</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-6 col-xs-12">
|
||||
<div class="box-content">
|
||||
<div class="statistics-box with-icon">
|
||||
<i class="ico fa fa-users text-info"></i>
|
||||
<h2 class="counter text-info" id="h_jumlah_dosen">...</h2>
|
||||
<p class="text">Jumlah Dosen</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-6 col-xs-12">
|
||||
<div class="box-content">
|
||||
<div class="statistics-box with-icon">
|
||||
<i class="ico fa fa-history text-primary"></i>
|
||||
<h2 class="counter text-primary" id="h_update" style="font-size: 20px;">...</h2>
|
||||
<p class="text">Update Terakhir</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row small-spacing">
|
||||
<div class="col-lg-7 col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">Statistik Penelitian</h4>
|
||||
<div class="card-content">
|
||||
<canvas id="penelitianChart" style="width: 100%; height: 400px;"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-5 col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">Penelitian Update Terakhir</h4>
|
||||
<div class="card-content" id="lastUpdateContainer">
|
||||
<p class="text-center text-muted">Memuat data...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TABLE SECTION -->
|
||||
<div class="row small-spacing">
|
||||
<div class="col-md-12">
|
||||
<div class="box-content">
|
||||
<header class="panel-heading"
|
||||
style="display: flex; flex-direction: column; gap: 15px; overflow: hidden;">
|
||||
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||
<h4 class="box-title" style="margin: 0;">Daftar Seluruh Penelitian</h4>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<label>Judul Penelitian</label>
|
||||
<input type="text" id="searchJudul" class="form-control"
|
||||
placeholder="Cari judul...">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label>Tahun Dari</label>
|
||||
<select id="searchTahunFrom" class="form-control">
|
||||
<option value="">-- Pilih --</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label>Tahun Sampai</label>
|
||||
<select id="searchTahunTo" class="form-control">
|
||||
<option value="">-- Pilih --</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2"
|
||||
style="display: flex; align-items: flex-end; gap: 5px; margin-top: 24px;">
|
||||
<button class="btn btn-info" onclick="applyCustomFilter()" style="flex: 1;"><i
|
||||
class="fa fa-search"></i> Cari</button>
|
||||
<button class="btn btn-default" onclick="resetCustomFilter()"><i
|
||||
class="fa fa-refresh"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="panel-body" style="overflow-x: auto;">
|
||||
<table id="tablePenelitian" class="table table-striped table-bordered dt-responsive nowrap"
|
||||
style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>Nama Dosen</th>
|
||||
<th>Judul Penelitian</th>
|
||||
<th>Tahun</th>
|
||||
<th>Status</th>
|
||||
<th>Terakhir Update</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbodyPenelitian"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<ul class="list-inline">
|
||||
<li>2026 © Sistem Penelitian Dosen | Universitas Handayani Makassar.</li>
|
||||
</ul>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal View Penelitian -->
|
||||
<div class="modal fade" id="modalPenelitian" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
||||
aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="modalLabel">Lihat Penelitian</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="formPenelitian">
|
||||
<div class="form-group">
|
||||
<label>Nama Dosen</label>
|
||||
<input type="text" class="form-control" id="view_dosen_name" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Judul Penelitian</label>
|
||||
<input type="text" class="form-control" id="view_judul" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Tahun Penelitian</label>
|
||||
<input type="text" class="form-control" id="view_tahun" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Status Penelitian</label>
|
||||
<input type="text" class="form-control" id="view_status" readonly>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Keterangan</label>
|
||||
<textarea class="form-control" id="view_keterangan" rows="3" readonly></textarea>
|
||||
</div>
|
||||
<div class="form-group" id="fileListSection" style="display: none;">
|
||||
<label>Daftar File Publikasi:</label>
|
||||
<div id="existingFilesContainer" class="mt-2"></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-info pull-left" id="btnHistory" onclick="viewHistory()"><i
|
||||
class="fa fa-history"></i> Riwayat Laporan</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Tutup</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal History / Laporan -->
|
||||
<div class="modal fade" id="modalHistory" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span>×</span></button>
|
||||
<h4 class="modal-title">Riwayat Perubahan Penelitian</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div id="historyContainer"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary pull-left" onclick="printLaporan()"><i
|
||||
class="fa fa-print"></i> Cetak Laporan PDF</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Tutup</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src="assets/scripts/jquery.min.js"></script>
|
||||
<script src="assets/scripts/modernizr.min.js"></script>
|
||||
<script src="assets/plugin/bootstrap/js/bootstrap.min.js"></script>
|
||||
<script src="assets/plugin/mCustomScrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
|
||||
<script src="assets/plugin/nprogress/nprogress.js"></script>
|
||||
<script src="assets/plugin/sweet-alert/sweetalert.min.js"></script>
|
||||
<script src="assets/plugin/waves/waves.min.js"></script>
|
||||
<script src="assets/plugin/fullscreen/jquery.fullscreen-min.js"></script>
|
||||
|
||||
<script src="assets/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
|
||||
<script src="assets/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
|
||||
<script src="assets/plugin/datatables/extensions/Responsive/js/dataTables.responsive.min.js"></script>
|
||||
<script src="assets/plugin/datatables/extensions/Responsive/js/responsive.bootstrap.min.js"></script>
|
||||
|
||||
<script src="assets/plugin/chart/chartjs/Chart.bundle.min.js"></script>
|
||||
|
||||
<script src="assets/scripts/main.min.js"></script>
|
||||
<script src="assets/color-switcher/color-switcher.min.js"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
const dosenName = localStorage.getItem('dosen_name');
|
||||
const dosenId = localStorage.getItem('dosen_id');
|
||||
|
||||
if (dosenName) document.getElementById('dosenName').textContent = dosenName;
|
||||
|
||||
// Fetch current profile image
|
||||
$.get(`/api/dosen`, function (data) {
|
||||
const dosen = data.find(d => d.dosen_id === dosenId);
|
||||
if (dosen && dosen.dosen_image) {
|
||||
const imgUrl = `/api/images/dosen/${dosen.dosen_image}`;
|
||||
$('#profileImagePreview').attr('src', imgUrl);
|
||||
$('#foto_dosen').attr('src', imgUrl);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
let dataTable;
|
||||
let currentViewId = null;
|
||||
|
||||
// --- DATE FORMATTER (ISO String to "DD Mon YYYY, HH.mm") ---
|
||||
function formatDateOnly(dateString) {
|
||||
if (!dateString) return '-';
|
||||
if (!dateString.includes('T')) {
|
||||
let cleanStr = dateString.replace('T', ' ');
|
||||
return cleanStr.substring(0, 16).replace(/-/g, ' ').replace(':', '.');
|
||||
}
|
||||
const date = new Date(dateString);
|
||||
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Agu', 'Sep', 'Okt', 'Nov', 'Des'];
|
||||
const day = String(date.getUTCDate()).padStart(2, '0');
|
||||
const month = months[date.getUTCMonth()];
|
||||
const year = date.getUTCFullYear();
|
||||
const hours = String(date.getUTCHours()).padStart(2, '0');
|
||||
const minutes = String(date.getUTCMinutes()).padStart(2, '0');
|
||||
return `${day} ${month} ${year}, ${hours}.${minutes}`;
|
||||
}
|
||||
|
||||
// Custom Search Logic
|
||||
$.fn.dataTable.ext.search.push(
|
||||
function (settings, data, dataIndex) {
|
||||
const judul = data[2].toLowerCase(); // Index 2 is Judul now
|
||||
const tahun = parseInt(data[3]); // Index 3 is Tahun now
|
||||
|
||||
const searchJudul = $('#searchJudul').val().toLowerCase();
|
||||
const searchFrom = $('#searchTahunFrom').val();
|
||||
const searchTo = $('#searchTahunTo').val();
|
||||
|
||||
if (searchJudul && !judul.includes(searchJudul)) return false;
|
||||
if (searchFrom && tahun < parseInt(searchFrom)) return false;
|
||||
if (searchTo && tahun > parseInt(searchTo)) return false;
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
function applyCustomFilter() { dataTable.draw(); }
|
||||
function resetCustomFilter() {
|
||||
$('#searchJudul').val('');
|
||||
$('#searchTahunFrom').val('');
|
||||
$('#searchTahunTo').val('');
|
||||
dataTable.draw();
|
||||
}
|
||||
|
||||
function logout() {
|
||||
swal({
|
||||
title: "Logout?",
|
||||
text: "Anda akan keluar dari halaman admin.",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Ya, Logout!",
|
||||
closeOnConfirm: true
|
||||
}, function () {
|
||||
localStorage.removeItem('admin_auth');
|
||||
window.location.href = 'index.html';
|
||||
});
|
||||
}
|
||||
|
||||
// --- CHART RENDERING ---
|
||||
function renderChart() {
|
||||
$.get('/api/laporan/stats/daily', function (data) {
|
||||
const labels = [];
|
||||
const counts = [];
|
||||
|
||||
data.forEach(item => {
|
||||
const dateObj = new Date(item.date);
|
||||
const formattedDate = dateObj.toLocaleDateString('id-ID', { day: '2-digit', month: 'short' });
|
||||
labels.push(formattedDate);
|
||||
counts.push(item.total);
|
||||
});
|
||||
|
||||
const ctx = document.getElementById('penelitianChart').getContext('2d');
|
||||
new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: 'Jumlah Submit/Update Penelitian',
|
||||
data: counts,
|
||||
backgroundColor: 'rgba(54, 162, 235, 0.2)',
|
||||
borderColor: 'rgba(54, 162, 235, 1)',
|
||||
borderWidth: 2,
|
||||
pointBackgroundColor: 'rgba(54, 162, 235, 1)',
|
||||
pointRadius: 4,
|
||||
fill: true,
|
||||
tension: 0.3
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
scales: { y: { beginAtZero: true, ticks: { stepSize: 1 } } },
|
||||
plugins: { legend: { display: true, position: 'top' } }
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
document.body.style.display = 'block';
|
||||
|
||||
// 1. Populate "Tahun Dari" and "Tahun Sampai"
|
||||
const fromSelect = document.getElementById('searchTahunFrom');
|
||||
const toSelect = document.getElementById('searchTahunTo');
|
||||
for (let y = 2010; y <= 2026; y++) {
|
||||
fromSelect.appendChild(new Option(y, y));
|
||||
}
|
||||
toSelect.disabled = true;
|
||||
toSelect.innerHTML = '<option value="">-- Pilih Tahun Dari --</option>';
|
||||
|
||||
$('#searchTahunFrom').on('change', function () {
|
||||
const selectedFrom = $(this).val();
|
||||
toSelect.innerHTML = '';
|
||||
if (selectedFrom) {
|
||||
toSelect.disabled = false;
|
||||
toSelect.innerHTML = '<option value="">-- Pilih --</option>';
|
||||
for (let y = parseInt(selectedFrom); y <= 2026; y++) {
|
||||
toSelect.appendChild(new Option(y, y));
|
||||
}
|
||||
} else {
|
||||
toSelect.disabled = true;
|
||||
toSelect.innerHTML = '<option value="">-- Pilih Tahun Dari Dulu --</option>';
|
||||
}
|
||||
applyCustomFilter();
|
||||
});
|
||||
|
||||
// 2. Render Chart & Fetch Last Update
|
||||
renderChart();
|
||||
$.get('/api/penelitian', function (data) {
|
||||
let total = data.length;
|
||||
let selesai = 0;
|
||||
let latestUpdateItem = null;
|
||||
data.forEach(item => {
|
||||
if (item.status_penelitian === 'Selesai') selesai++;
|
||||
if (item.updated_at) {
|
||||
const itemDate = new Date(item.updated_at);
|
||||
if (!latestUpdateItem || itemDate > new Date(latestUpdateItem.updated_at)) {
|
||||
latestUpdateItem = item;
|
||||
}
|
||||
}
|
||||
});
|
||||
$('#h_jumlah_penelitian').text(total);
|
||||
$('#h_penelitian_selesai').text(selesai);
|
||||
$('#h_update').text(latestUpdateItem ? formatDateOnly(latestUpdateItem.updated_at) : '-');
|
||||
|
||||
const container = $('#lastUpdateContainer');
|
||||
container.empty();
|
||||
if (latestUpdateItem) {
|
||||
let badge = latestUpdateItem.status_penelitian === 'Berjalan' ? 'label-warning' : 'label-success';
|
||||
container.append(`
|
||||
<div style="margin-bottom: 15px;">
|
||||
<h5 style="margin-top: 0; font-weight: bold; color: #333;">${latestUpdateItem.judul_penelitian}</h5>
|
||||
<p class="text-muted" style="margin-bottom: 5px; font-size: 13px;">
|
||||
<i class="fa fa-user"></i> ${latestUpdateItem.dosen_name} <br>
|
||||
<i class="fa fa-calendar"></i> ${formatDateOnly(latestUpdateItem.updated_at)}
|
||||
</p>
|
||||
<span class="label ${badge}" style="font-size: 12px;">${latestUpdateItem.status_penelitian}</span>
|
||||
</div>
|
||||
`);
|
||||
} else {
|
||||
container.append('<p class="text-center text-muted">Belum ada penelitian.</p>');
|
||||
}
|
||||
});
|
||||
|
||||
// 3. Fetch Mahasiswa & Dosen Count
|
||||
$.get('/api/mahasiswa', function (data) { $('#h_jumlah_mahasiswa').text(data.length); });
|
||||
$.get('/api/dosen', function (data) { $('#h_jumlah_dosen').text(data.length); });
|
||||
|
||||
// 4. Initialize DataTable
|
||||
dataTable = $('#tablePenelitian').DataTable({
|
||||
ajax: { url: `/api/penelitian`, dataSrc: '' },
|
||||
columns: [
|
||||
{ data: null, render: (data, type, row, meta) => meta.row + 1 },
|
||||
{ data: 'dosen_name' },
|
||||
{ data: 'judul_penelitian' },
|
||||
{ data: 'tahun_penelitian' },
|
||||
{
|
||||
data: 'status_penelitian',
|
||||
render: function (data) {
|
||||
let badge = data === 'Berjalan' ? 'label-warning' : 'label-success';
|
||||
return `<span class="label ${badge}">${data}</span>`;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: 'updated_at',
|
||||
render: function (data) { return formatDateOnly(data); }
|
||||
},
|
||||
{
|
||||
data: null,
|
||||
render: function (data, type, row) {
|
||||
// Only show the View (Eye) button
|
||||
return `<button class="btn btn-info btn-xs" title="Lihat" onclick="viewPenelitian(${row.id})"><i class="fa fa-eye"></i> Lihat</button>`;
|
||||
}
|
||||
}
|
||||
],
|
||||
order: [[5, "desc"]]
|
||||
});
|
||||
});
|
||||
|
||||
// --- MODAL FUNCTIONS ---
|
||||
|
||||
function viewPenelitian(id) {
|
||||
currentViewId = id;
|
||||
// Find the data by making an AJAX call (or we can find it in DataTable data)
|
||||
$.get(`/api/penelitian`, function (allData) {
|
||||
const item = allData.find(p => p.id === id);
|
||||
if (item) {
|
||||
$('#view_dosen_name').val(item.dosen_name);
|
||||
$('#view_judul').val(item.judul_penelitian);
|
||||
$('#view_tahun').val(item.tahun_penelitian);
|
||||
$('#view_status').val(item.status_penelitian);
|
||||
$('#view_keterangan').val(item.keterangan || '');
|
||||
|
||||
renderExistingFilesView(item.hasil_publikasi);
|
||||
$('#modalPenelitian').modal('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function renderExistingFilesView(filesData) {
|
||||
let currentFiles = [];
|
||||
if (Array.isArray(filesData)) currentFiles = filesData;
|
||||
else if (typeof filesData === 'string') {
|
||||
try { currentFiles = JSON.parse(filesData); } catch (e) { }
|
||||
}
|
||||
|
||||
const container = $('#existingFilesContainer');
|
||||
container.empty();
|
||||
|
||||
if (currentFiles.length > 0) {
|
||||
$('#fileListSection').show();
|
||||
currentFiles.forEach((filename) => {
|
||||
let displayName = filename.substring(filename.indexOf('-') + 1);
|
||||
container.append(`
|
||||
<div class="file-item">
|
||||
<a href="/api/uploads/${filename}" target="_blank"><i class="fa fa-file-pdf-o text-danger"></i> ${displayName}</a>
|
||||
</div>
|
||||
`);
|
||||
});
|
||||
} else {
|
||||
$('#fileListSection').hide();
|
||||
}
|
||||
}
|
||||
|
||||
function viewHistory() {
|
||||
if (!currentViewId) return;
|
||||
$('#historyContainer').empty();
|
||||
$('#modalPenelitian').modal('hide');
|
||||
$('#modalHistory').modal('show');
|
||||
|
||||
$.get(`/api/laporan/${currentViewId}`, function (data) {
|
||||
if (data.length === 0) {
|
||||
$('#historyContainer').html('<p class="text-center text-muted">Belum ada riwayat.</p>');
|
||||
return;
|
||||
}
|
||||
|
||||
data.forEach((log, index) => {
|
||||
let filesHtml = '';
|
||||
if (log.hasil_publikasi) {
|
||||
try {
|
||||
const files = typeof log.hasil_publikasi === 'string' ? JSON.parse(log.hasil_publikasi) : log.hasil_publikasi;
|
||||
files.forEach(f => {
|
||||
let displayName = f.substring(f.indexOf('-') + 1);
|
||||
filesHtml += `<div class="file-item" style="margin-top:5px;">
|
||||
<a href="/api/uploads/${f}" target="_blank"><i class="fa fa-file-pdf-o text-danger"></i> ${displayName}</a>
|
||||
</div>`;
|
||||
});
|
||||
} catch (e) { }
|
||||
}
|
||||
|
||||
$('#historyContainer').append(`
|
||||
<div class="history-panel">
|
||||
<div class="history-header">
|
||||
Update #${data.length - index}
|
||||
<span class="pull-right text-muted" style="font-size: 12px; font-weight: normal;">
|
||||
${formatDateOnly(log.created_at)}
|
||||
</span>
|
||||
</div>
|
||||
<div class="history-body">
|
||||
<table class="table table-condensed" style="margin-bottom: 0;">
|
||||
<tr><td width="120"><strong>Status</strong></td><td>: <span class="label ${log.status_penelitian === 'Berjalan' ? 'label-warning' : 'label-success'}">${log.status_penelitian}</span></td></tr>
|
||||
<tr><td><strong>Keterangan</strong></td><td>: ${log.keterangan || '-'}</td></tr>
|
||||
<tr><td><strong>File</strong></td><td>${filesHtml || '-'}</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function printLaporan() {
|
||||
if (currentViewId) {
|
||||
window.open(`laporan.html?id=${currentViewId}`, '_blank');
|
||||
} else {
|
||||
swal("Gagal", "ID Penelitian tidak ditemukan.", "error");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+93
-12
@@ -85,6 +85,9 @@
|
||||
<li class="current"><a class="waves-effect" href="dosen_index.html"><i
|
||||
class="menu-icon fa fa-home"></i><span>Halaman
|
||||
Utama</span></a></li>
|
||||
<li><a class="waves-effect" href="dosen_halaman_penelitian.html"><i
|
||||
class="menu-icon fa fa-file-text"></i><span>Halaman
|
||||
Penelitian</span></a></li>
|
||||
<li><a class="waves-effect" href="dosen.html"><i class="menu-icon fa fa-list"></i><span>Managemen
|
||||
Penelitian</span></a></li>
|
||||
<li><a class="waves-effect" href="dosen_profil.html"><i
|
||||
@@ -145,13 +148,25 @@
|
||||
<div class="statistics-box with-icon">
|
||||
<i class="ico fa fa-area-chart text-info"></i>
|
||||
<h2 class="counter text-info" id="h_terakhir_update"
|
||||
style="font-size: 20px; margin-top: 25px;">...</h2>
|
||||
style="font-size: 20px;">...</h2>
|
||||
<p class="text">Terakhir Update</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- CHART SECTION -->
|
||||
<div class="row small-spacing">
|
||||
<div class="col-lg-12 col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">Statistik Penelitian Anda</h4>
|
||||
<div class="card-content">
|
||||
<canvas id="penelitianChart" style="width: 100%; height: 400px;"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row small-spacing">
|
||||
<div class="col-lg-7 col-xs-12">
|
||||
<div class="box-content card">
|
||||
@@ -193,20 +208,29 @@
|
||||
<script src="assets/plugin/waves/waves.min.js"></script>
|
||||
<script src="assets/plugin/fullscreen/jquery.fullscreen-min.js"></script>
|
||||
|
||||
<script src="assets/plugin/chart/chartjs/Chart.bundle.min.js"></script>
|
||||
|
||||
<script src="assets/block/jquery.blockUI.js"></script>
|
||||
<script src="assets/scripts/main.min.js"></script>
|
||||
<script src="assets/color-switcher/color-switcher.min.js"></script>
|
||||
<script src="assets/block.js"></script>
|
||||
|
||||
<script>
|
||||
// Format Dates
|
||||
function formatDate(dateString) {
|
||||
// --- DATE FORMATTER (ISO String to "DD Mon YYYY, HH.mm") ---
|
||||
function formatDateOnly(dateString) {
|
||||
if (!dateString) return '-';
|
||||
if (!dateString.includes('T')) {
|
||||
let cleanStr = dateString.replace('T', ' ');
|
||||
return cleanStr.substring(0, 16).replace(/-/g, ' ').replace(':', '.');
|
||||
}
|
||||
const date = new Date(dateString);
|
||||
return date.toLocaleString('id-ID', {
|
||||
day: '2-digit', month: 'short', year: 'numeric',
|
||||
hour: '2-digit', minute: '2-digit'
|
||||
});
|
||||
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Agu', 'Sep', 'Okt', 'Nov', 'Des'];
|
||||
const day = String(date.getUTCDate()).padStart(2, '0');
|
||||
const month = months[date.getUTCMonth()];
|
||||
const year = date.getUTCFullYear();
|
||||
const hours = String(date.getUTCHours()).padStart(2, '0');
|
||||
const minutes = String(date.getUTCMinutes()).padStart(2, '0');
|
||||
return `${day} ${month} ${year}, ${hours}.${minutes}`;
|
||||
}
|
||||
|
||||
// Format Short Dates for the Card
|
||||
@@ -231,6 +255,62 @@
|
||||
});
|
||||
}
|
||||
|
||||
// --- CHART RENDERING FUNCTION ---
|
||||
function renderChart(dosenId) {
|
||||
// Fetch stats filtered by dosen_id
|
||||
$.get(`/api/laporan/stats/daily?dosen_id=${dosenId}`, function (data) {
|
||||
const labels = [];
|
||||
const counts = [];
|
||||
|
||||
// Extract dates and counts
|
||||
data.forEach(item => {
|
||||
// Format date from YYYY-MM-DD to DD MMM
|
||||
const dateObj = new Date(item.date);
|
||||
const formattedDate = dateObj.toLocaleDateString('id-ID', { day: '2-digit', month: 'short' });
|
||||
labels.push(formattedDate);
|
||||
counts.push(item.total);
|
||||
});
|
||||
|
||||
const ctx = document.getElementById('penelitianChart').getContext('2d');
|
||||
|
||||
new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: 'Jumlah Submit/Update Penelitian Anda',
|
||||
data: counts,
|
||||
backgroundColor: 'rgba(54, 162, 235, 0.2)',
|
||||
borderColor: 'rgba(54, 162, 235, 1)',
|
||||
borderWidth: 2,
|
||||
pointBackgroundColor: 'rgba(54, 162, 235, 1)',
|
||||
pointRadius: 4,
|
||||
fill: true,
|
||||
tension: 0.3 // Makes the line slightly curved
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
scales: {
|
||||
y: {
|
||||
beginAtZero: true,
|
||||
ticks: {
|
||||
stepSize: 1 // Ensure integers on Y axis
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
display: true,
|
||||
position: 'top'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
const dosenName = localStorage.getItem('dosen_name');
|
||||
const dosenId = localStorage.getItem('dosen_id');
|
||||
@@ -242,13 +322,12 @@
|
||||
const dosen = data.find(d => d.dosen_id === dosenId);
|
||||
if (dosen && dosen.dosen_image) {
|
||||
const imgUrl = `/api/images/dosen/${dosen.dosen_image}`;
|
||||
|
||||
$('#profileImagePreview').attr('src', imgUrl);
|
||||
$('#foto_dosen').attr('src', imgUrl);
|
||||
}
|
||||
});
|
||||
|
||||
// Fetch Data
|
||||
// Fetch Data for Stats and Last Update
|
||||
$.ajax({
|
||||
url: `/api/penelitian/dosen/${dosenId}`,
|
||||
method: 'GET',
|
||||
@@ -278,7 +357,7 @@
|
||||
$('#h_penelitian_berjalan').text(berjalan);
|
||||
|
||||
if (latestUpdateItem) {
|
||||
$('#h_terakhir_update').text(formatDateShort(latestUpdateItem.updated_at));
|
||||
$('#h_terakhir_update').text(formatDateOnly(latestUpdateItem.updated_at));
|
||||
} else {
|
||||
$('#h_terakhir_update').text('-');
|
||||
}
|
||||
@@ -296,13 +375,12 @@
|
||||
<div style="margin-bottom: 15px;">
|
||||
<h5 style="margin-top: 0; font-weight: bold; color: #333; line-height: 1.4;">${latestUpdateItem.judul_penelitian}</h5>
|
||||
|
||||
<!-- NEW: Keterangan Field -->
|
||||
<p style="font-size: 13px; color: #555; text-align: justify; margin-bottom: 10px;">
|
||||
${keteranganText}
|
||||
</p>
|
||||
|
||||
<p class="text-muted" style="margin-bottom: 10px; font-size: 12px;">
|
||||
<i class="fa fa-calendar"></i> Terakhir diubah: ${formatDate(latestUpdateItem.updated_at)}
|
||||
<i class="fa fa-calendar"></i> Terakhir diubah: ${formatDateOnly(latestUpdateItem.updated_at)}
|
||||
</p>
|
||||
|
||||
<span class="label ${badge}" style="font-size: 12px;">${latestUpdateItem.status_penelitian}</span>
|
||||
@@ -322,6 +400,9 @@
|
||||
$('#lastUpdateContainer').html('<p class="text-center text-danger">Gagal memuat data.</p>');
|
||||
}
|
||||
});
|
||||
|
||||
// Render the Chart for this specific Dosen
|
||||
renderChart(dosenId);
|
||||
});
|
||||
|
||||
// Function to print report from this page
|
||||
|
||||
@@ -100,6 +100,9 @@
|
||||
<li><a class="waves-effect" href="dosen_index.html"><i
|
||||
class="menu-icon fa fa-home"></i><span>Halaman
|
||||
Utama</span></a></li>
|
||||
<li><a class="waves-effect" href="dosen_halaman_penelitian.html"><i
|
||||
class="menu-icon fa fa-file-text"></i><span>Halaman
|
||||
Penelitian</span></a></li>
|
||||
<li><a class="waves-effect" href="dosen.html"><i class="menu-icon fa fa-list"></i><span>Managemen
|
||||
Penelitian</span></a></li>
|
||||
<li class="current"><a class="waves-effect" href="dosen_profil.html"><i
|
||||
|
||||
+156
-66
@@ -5,50 +5,27 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="description" content="">
|
||||
<meta name="description" content="Sistem Informasi Penelitian Dosen Universitas Handayani Makassar">
|
||||
<meta name="author" content="">
|
||||
|
||||
<title>Aplikasi Penelitian Dosen - Halaman Utama</title>
|
||||
|
||||
<!-- Main Styles -->
|
||||
<link rel="stylesheet" href="assets/styles/style.min.css">
|
||||
|
||||
<!-- mCustomScrollbar -->
|
||||
<link rel="stylesheet" href="assets/plugin/mCustomScrollbar/jquery.mCustomScrollbar.min.css">
|
||||
|
||||
<!-- Waves Effect -->
|
||||
<link rel="stylesheet" href="assets/plugin/waves/waves.min.css">
|
||||
|
||||
<!-- Sweet Alert -->
|
||||
<link rel="stylesheet" href="assets/plugin/sweet-alert/sweetalert.css">
|
||||
|
||||
<!-- Color Picker -->
|
||||
<link rel="stylesheet" href="assets/color-switcher/color-switcher.min.css">
|
||||
|
||||
<!-- Data Tables -->
|
||||
<link rel="stylesheet" href="assets/plugin/datatables/media/css/dataTables.bootstrap.min.css">
|
||||
<link rel="stylesheet" href="assets/plugin/datatables/extensions/Responsive/css/responsive.bootstrap.min.css">
|
||||
|
||||
|
||||
<style>
|
||||
/* Custom style for file list inside table */
|
||||
.file-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.file-list li {
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.file-list a {
|
||||
color: #007bff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.file-list a:hover {
|
||||
text-decoration: underline;
|
||||
body { display: none; }
|
||||
.header .avatar {
|
||||
width: 65px; height: 65px; display: inline-block;
|
||||
overflow: hidden; border-radius: 50%; vertical-align: middle;
|
||||
}
|
||||
.header .avatar img { width: 100%; height: 100%; object-fit: cover; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -58,54 +35,41 @@
|
||||
<a href="index.html" class="logo">UHM</a>
|
||||
<button type="button" class="button-close fa fa-times js__menu_close"></button>
|
||||
<div class="user">
|
||||
<a href="#" class="avatar"><img src="assets/images/person.png" alt=""><span
|
||||
class="status online"></span></a>
|
||||
<h5 class="name"><a href="profile.html">Belum Login</a></h5>
|
||||
<a href="#" class="avatar"><img src="assets/images/person.png" alt=""></a>
|
||||
<h5 class="name"><a href="#">Belum Login</a></h5>
|
||||
<h5 class="position">-</h5>
|
||||
</div>
|
||||
<!-- /.user -->
|
||||
</header>
|
||||
<!-- /.header -->
|
||||
<div class="content">
|
||||
|
||||
<div class="navigation">
|
||||
<h5 class="title">Navigasi</h5>
|
||||
<!-- /.title -->
|
||||
<ul class="menu js__accordion">
|
||||
<li class="current">
|
||||
<a class="waves-effect" href="index.html"><i class="menu-icon fa fa-home"></i><span>Halaman Utama</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="waves-effect" href="login.html"><i
|
||||
class="menu-icon fa fa-sign-in"></i><span>Login</span></a>
|
||||
<a class="waves-effect" href="login.html"><i class="menu-icon fa fa-sign-in"></i><span>Login</span></a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<!-- /.navigation -->
|
||||
</div>
|
||||
<!-- /.content -->
|
||||
</div>
|
||||
<!-- /.main-menu -->
|
||||
|
||||
<div class="fixed-navbar">
|
||||
<div class="pull-left">
|
||||
<button type="button"
|
||||
class="menu-mobile-button glyphicon glyphicon-menu-hamburger js__menu_mobile"></button>
|
||||
<button type="button" class="menu-mobile-button glyphicon glyphicon-menu-hamburger js__menu_mobile"></button>
|
||||
<h1 class="page-title">Halaman Utama</h1>
|
||||
<!-- /.page-title -->
|
||||
</div>
|
||||
<!-- /.pull-left -->
|
||||
<div class="pull-right">
|
||||
<div class="ico-item fa fa-arrows-alt js__full_screen"></div>
|
||||
|
||||
<a href="login.html" class="ico-item fa fa-sign-in"></a>
|
||||
<a href="login.html" class="ico-item fa fa-sign-in" title="Login"></a>
|
||||
</div>
|
||||
<!-- /.pull-right -->
|
||||
</div>
|
||||
<!-- /.fixed-navbar -->
|
||||
|
||||
|
||||
<div id="wrapper">
|
||||
<div class="main-content">
|
||||
<!-- DASHBOARD STATISTICS -->
|
||||
|
||||
<!-- STATISTICS -->
|
||||
<div class="row small-spacing">
|
||||
<div class="col-lg-3 col-md-6 col-xs-12">
|
||||
<div class="box-content">
|
||||
@@ -145,12 +109,32 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- CHART SECTION -->
|
||||
<div class="row small-spacing">
|
||||
<div class="col-lg-12 col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">Statistik Penelitian</h4>
|
||||
<div class="card-content">
|
||||
<canvas id="penelitianChart" style="width: 100%; height: 400px;"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- INFO AND LAST UPDATE -->
|
||||
<div class="row small-spacing">
|
||||
<div class="col-lg-7 col-xs-12">
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">Keterangan</h4>
|
||||
<div class="card-content">
|
||||
<p style="text-align: justify;">Selamat datang sistem penelitian dosen. Pada sistem ini dosen di Univertas Handayani Makkasar dapat memuat penelitian mereka dan mengelola penelitian mereka. Para mahasiswa Universitas Handayani Makassar juga dapat melihat semua penelitian yang dilakukan oleh dosen. Dosen dan mahasiswa wajib login untuk mengakses sistem ini. Jika tidak memiliki akun, silahkan daftar terlebih dahulu.</p>
|
||||
<p style="text-align: justify;">Selamat datang sistem penelitian dosen. Pada sistem ini
|
||||
dosen di Universitas Handayani Makassar dapat memuat penelitian mereka dan mengelola
|
||||
penelitian mereka. Para mahasiswa Universitas Handayani Makassar juga dapat melihat
|
||||
semua penelitian yang dilakukan oleh dosen. Dosen dan mahasiswa wajib login untuk
|
||||
mengakses sistem ini. Jika tidak memiliki akun, silahkan hubungi admin terlebih dahulu.</p>
|
||||
|
||||
<br>
|
||||
<a href="login.html" class="btn btn-primary"><i class="fa fa-sign-in"></i> Login Sekarang</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -158,7 +142,6 @@
|
||||
<div class="box-content card">
|
||||
<h4 class="box-title">Last Updated</h4>
|
||||
<div class="card-content" id="lastUpdateContainer">
|
||||
<!-- Data will be injected by JS -->
|
||||
<p class="text-center text-muted">Memuat data...</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -171,10 +154,9 @@
|
||||
</ul>
|
||||
</footer>
|
||||
</div>
|
||||
<!-- /.main-content -->
|
||||
</div><!--/#wrapper -->
|
||||
</div>
|
||||
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<!-- Scripts -->
|
||||
<script src="assets/scripts/jquery.min.js"></script>
|
||||
<script src="assets/scripts/modernizr.min.js"></script>
|
||||
<script src="assets/plugin/bootstrap/js/bootstrap.min.js"></script>
|
||||
@@ -183,17 +165,125 @@
|
||||
<script src="assets/plugin/sweet-alert/sweetalert.min.js"></script>
|
||||
<script src="assets/plugin/waves/waves.min.js"></script>
|
||||
<script src="assets/plugin/fullscreen/jquery.fullscreen-min.js"></script>
|
||||
|
||||
<!-- Data Tables -->
|
||||
<script src="assets/plugin/datatables/media/js/jquery.dataTables.min.js"></script>
|
||||
<script src="assets/plugin/datatables/media/js/dataTables.bootstrap.min.js"></script>
|
||||
<script src="assets/plugin/datatables/extensions/Responsive/js/dataTables.responsive.min.js"></script>
|
||||
<script src="assets/plugin/datatables/extensions/Responsive/js/responsive.bootstrap.min.js"></script>
|
||||
|
||||
<script src="assets/plugin/chart/chartjs/Chart.bundle.min.js"></script>
|
||||
<script src="assets/scripts/main.min.js"></script>
|
||||
<script src="assets/color-switcher/color-switcher.min.js"></script>
|
||||
|
||||
<script>
|
||||
// --- DATE FORMATTER (ISO String to "DD Mon YYYY, HH.mm") ---
|
||||
function formatDateOnly(dateString) {
|
||||
if (!dateString) return '-';
|
||||
if (!dateString.includes('T')) {
|
||||
let cleanStr = dateString.replace('T', ' ');
|
||||
return cleanStr.substring(0, 16).replace(/-/g, ' ').replace(':', '.');
|
||||
}
|
||||
const date = new Date(dateString);
|
||||
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Agu', 'Sep', 'Okt', 'Nov', 'Des'];
|
||||
const day = String(date.getUTCDate()).padStart(2, '0');
|
||||
const month = months[date.getUTCMonth()];
|
||||
const year = date.getUTCFullYear();
|
||||
const hours = String(date.getUTCHours()).padStart(2, '0');
|
||||
const minutes = String(date.getUTCMinutes()).padStart(2, '0');
|
||||
return `${day} ${month} ${year}, ${hours}.${minutes}`;
|
||||
}
|
||||
|
||||
// --- CHART RENDERING ---
|
||||
function renderChart() {
|
||||
$.get('/api/laporan/stats/daily', function (data) {
|
||||
const labels = [];
|
||||
const counts = [];
|
||||
|
||||
data.forEach(item => {
|
||||
const dateObj = new Date(item.date);
|
||||
const formattedDate = dateObj.toLocaleDateString('id-ID', { day: '2-digit', month: 'short' });
|
||||
labels.push(formattedDate);
|
||||
counts.push(item.total);
|
||||
});
|
||||
|
||||
const ctx = document.getElementById('penelitianChart').getContext('2d');
|
||||
new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: 'Jumlah Aktivitas Penelitian',
|
||||
data: counts,
|
||||
backgroundColor: 'rgba(54, 162, 235, 0.2)',
|
||||
borderColor: 'rgba(54, 162, 235, 1)',
|
||||
borderWidth: 2,
|
||||
pointBackgroundColor: 'rgba(54, 162, 235, 1)',
|
||||
pointRadius: 4,
|
||||
fill: true,
|
||||
tension: 0.3
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
scales: { y: { beginAtZero: true, ticks: { stepSize: 1 } } }
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
document.body.style.display = 'block';
|
||||
|
||||
// 1. Fetch Penelitian for Stats and Last Update
|
||||
$.get('/api/penelitian', function (data) {
|
||||
let total = data.length;
|
||||
let selesai = 0;
|
||||
let berjalan = 0;
|
||||
let latestUpdateItem = null;
|
||||
|
||||
data.forEach(item => {
|
||||
if (item.status_penelitian === 'Selesai') selesai++;
|
||||
if (item.status_penelitian === 'Berjalan') berjalan++;
|
||||
|
||||
if (item.updated_at) {
|
||||
const itemDate = new Date(item.updated_at);
|
||||
if (!latestUpdateItem || itemDate > new Date(latestUpdateItem.updated_at)) {
|
||||
latestUpdateItem = item;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#h_jumlah_penelitian').text(total);
|
||||
$('#h_penelitian_selesai').text(selesai);
|
||||
$('#h_penelitian_berjalan').text(berjalan);
|
||||
|
||||
const container = $('#lastUpdateContainer');
|
||||
container.empty();
|
||||
|
||||
if (latestUpdateItem) {
|
||||
let badge = latestUpdateItem.status_penelitian === 'Berjalan' ? 'label-warning' : 'label-success';
|
||||
container.append(`
|
||||
<div style="margin-bottom: 15px;">
|
||||
<h5 style="margin-top: 0; font-weight: bold; color: #333;">${latestUpdateItem.judul_penelitian}</h5>
|
||||
<p class="text-muted" style="margin-bottom: 5px; font-size: 13px;">
|
||||
<i class="fa fa-user"></i> ${latestUpdateItem.dosen_name} <br>
|
||||
<i class="fa fa-calendar"></i> ${formatDateOnly(latestUpdateItem.updated_at)}
|
||||
</p>
|
||||
<span class="label ${badge}" style="font-size: 12px;">${latestUpdateItem.status_penelitian}</span>
|
||||
</div>
|
||||
`);
|
||||
} else {
|
||||
container.append('<p class="text-center text-muted">Belum ada penelitian.</p>');
|
||||
}
|
||||
}).fail(function() {
|
||||
$('#lastUpdateContainer').html('<p class="text-center text-danger">Gagal memuat data.</p>');
|
||||
});
|
||||
|
||||
// 2. Fetch Dosen Count
|
||||
$.get('/api/dosen', function (data) {
|
||||
$('#h_jumlah_dosen').text(data.length);
|
||||
}).fail(function() {
|
||||
$('#h_jumlah_dosen').text('0');
|
||||
});
|
||||
|
||||
// 3. Render Chart
|
||||
renderChart();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+130
-43
@@ -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;">← 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>
|
||||
Reference in new issue
Block a user