Files
tugas1_rpl/web/index.html
T

233 lines
7.3 KiB
HTML

<!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">
<meta name="description" content="">
<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;
}
</style>
</head>
<body>
<div class="main-menu">
<header class="header">
<a href="index.html" class="logo">Tugas RPL</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">Tamu</a></h5>
<h5 class="position">Tamu</h5>
</div>
<!-- /.user -->
</header>
<!-- /.header -->
<div class="content">
<div class="navigation">
<h5 class="title">Navigasi</h5>
<!-- /.title -->
<ul class="menu js__accordion">
<li>
<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>
<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>
</div>
<!-- /.pull-right -->
</div>
<!-- /.fixed-navbar -->
<div id="wrapper">
<div class="main-content">
<!-- ================= NEW CONTENT START ================= -->
<div class="row small-spacing">
<div class="col-md-12">
<div class="box-content">
<header class="panel-heading"
style="display: flex; justify-content: space-between; align-items: center;">
<h4 class="box-title" style="margin: 0;">Daftar Penelitian Dosen</h4>
</header>
<div class="panel-body" style="overflow-x: auto;">
<!-- DataTables will automatically add a search box here -->
<table id="tabelPenelitian" class="table table-striped table-bordered dt-responsive nowrap"
width="100%">
<thead>
<tr>
<th>No</th>
<th>Nama Dosen</th>
<th>Judul Penelitian</th>
<th>Tahun</th>
<th>Status</th>
<th>Hasil Publikasi (PDF)</th>
</tr>
</thead>
<tbody>
<!-- Data will be populated via AJAX -->
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- ================= NEW CONTENT END ================= -->
<footer class="footer">
<ul class="list-inline">
<li>2026 © Tugas RPL.</li>
</ul>
</footer>
</div>
<!-- /.main-content -->
</div><!--/#wrapper -->
<!-- Placed at the end of the document so the pages load faster -->
<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>
<!-- 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/scripts/main.min.js"></script>
<script src="assets/color-switcher/color-switcher.min.js"></script>
<!-- ================= CUSTOM SCRIPT FOR INDEX ================= -->
<script>
$(document).ready(function () {
var table = $('#tabelPenelitian').DataTable({
"ajax": {
"url": "/api/penelitian", // Fetch data from backend
"dataSrc": ""
},
"columns": [
{
// Give it a class so we can easily find it later
"data": null,
"className": "row-number",
"render": function (data, type, row, meta) {
// Initial render (will be updated by the event listener below)
return meta.row + meta.settings._iDisplayStart + 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": "hasil_publikasi",
"render": function (data, type, row) {
if (data) {
try {
const files = typeof data === 'string' ? JSON.parse(data) : data;
if (Array.isArray(files) && files.length > 0) {
let html = '<ul class="file-list">';
files.forEach(f => {
html += `<li><a href="/api/uploads/${f}" target="_blank"><i class="fa fa-file-pdf-o text-danger"></i> ${f}</a></li>`;
});
html += '</ul>';
return html;
}
} catch (e) {
console.error("Failed to parse JSON", e);
}
}
return '<span class="text-muted">-</span>';
}
}
],
"order": [[3, "asc"]] // Sort by Year (ascending) by default
});
// THIS IS THE FIX: Update the "No" column every time the table is drawn (sorted, searched, paged)
table.on('order.dt search.dt draw.dt', function () {
table.column(0, { search: 'applied', order: 'applied' }).nodes().each(function (cell, i) {
cell.innerHTML = i + 1;
});
}).draw();
});
</script>
</body>
</html>