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
+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
|
||||
|
||||
Reference in new issue
Block a user