perbaiki database agar semua tabel +8 utc, perbaiki admin_index dengan menambah line chart submit/update penelitian
This commit is contained in:
1 parent
31eb35c090
commit
218f8ce063
3 files changed
+162
-70
No files matched your search
+47
-38
@@ -71,7 +71,6 @@ const db = mysql.createPool({
|
|||||||
password: process.env.DB_PASSWORD || 'karan456',
|
password: process.env.DB_PASSWORD || 'karan456',
|
||||||
database: process.env.DB_NAME || 'db_penelitian',
|
database: process.env.DB_NAME || 'db_penelitian',
|
||||||
port: process.env.DB_PORT || 3306,
|
port: process.env.DB_PORT || 3306,
|
||||||
timezone: '+08:00',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Initialize Database
|
// Initialize Database
|
||||||
@@ -171,61 +170,56 @@ const initDB = () => {
|
|||||||
|
|
||||||
// Function to create the +8 hour triggers
|
// Function to create the +8 hour triggers
|
||||||
const createTimezoneTriggers = () => {
|
const createTimezoneTriggers = () => {
|
||||||
const triggers = [
|
// Array of queries to run sequentially
|
||||||
|
const queries = [
|
||||||
// tb_dosen
|
// tb_dosen
|
||||||
`DROP TRIGGER IF EXISTS trg_dosen_insert;`,
|
`DROP TRIGGER IF EXISTS trg_dosen_insert;`,
|
||||||
`CREATE TRIGGER trg_dosen_insert BEFORE INSERT ON tb_dosen FOR EACH ROW
|
`CREATE TRIGGER trg_dosen_insert BEFORE INSERT ON tb_dosen FOR EACH ROW BEGIN SET NEW.created_at = DATE_ADD(NOW(), INTERVAL 8 HOUR); SET NEW.updated_at = DATE_ADD(NOW(), INTERVAL 8 HOUR); END;`,
|
||||||
BEGIN
|
|
||||||
SET NEW.created_at = DATE_ADD(NOW(), INTERVAL 8 HOUR);
|
|
||||||
SET NEW.updated_at = DATE_ADD(NOW(), INTERVAL 8 HOUR);
|
|
||||||
END;`,
|
|
||||||
`DROP TRIGGER IF EXISTS trg_dosen_update;`,
|
`DROP TRIGGER IF EXISTS trg_dosen_update;`,
|
||||||
`CREATE TRIGGER trg_dosen_update BEFORE UPDATE ON tb_dosen FOR EACH ROW
|
`CREATE TRIGGER trg_dosen_update BEFORE UPDATE ON tb_dosen FOR EACH ROW BEGIN SET NEW.updated_at = DATE_ADD(NOW(), INTERVAL 8 HOUR); END;`,
|
||||||
BEGIN
|
|
||||||
SET NEW.updated_at = DATE_ADD(NOW(), INTERVAL 8 HOUR);
|
|
||||||
END;`,
|
|
||||||
|
|
||||||
// tb_penelitian
|
// tb_penelitian
|
||||||
`DROP TRIGGER IF EXISTS trg_penelitian_insert;`,
|
`DROP TRIGGER IF EXISTS trg_penelitian_insert;`,
|
||||||
`CREATE TRIGGER trg_penelitian_insert BEFORE INSERT ON tb_penelitian FOR EACH ROW
|
`CREATE TRIGGER trg_penelitian_insert BEFORE INSERT ON tb_penelitian FOR EACH ROW BEGIN SET NEW.created_at = DATE_ADD(NOW(), INTERVAL 8 HOUR); SET NEW.updated_at = DATE_ADD(NOW(), INTERVAL 8 HOUR); END;`,
|
||||||
BEGIN
|
|
||||||
SET NEW.created_at = DATE_ADD(NOW(), INTERVAL 8 HOUR);
|
|
||||||
SET NEW.updated_at = DATE_ADD(NOW(), INTERVAL 8 HOUR);
|
|
||||||
END;`,
|
|
||||||
`DROP TRIGGER IF EXISTS trg_penelitian_update;`,
|
`DROP TRIGGER IF EXISTS trg_penelitian_update;`,
|
||||||
`CREATE TRIGGER trg_penelitian_update BEFORE UPDATE ON tb_penelitian FOR EACH ROW
|
`CREATE TRIGGER trg_penelitian_update BEFORE UPDATE ON tb_penelitian FOR EACH ROW BEGIN SET NEW.updated_at = DATE_ADD(NOW(), INTERVAL 8 HOUR); END;`,
|
||||||
BEGIN
|
|
||||||
SET NEW.updated_at = DATE_ADD(NOW(), INTERVAL 8 HOUR);
|
|
||||||
END;`,
|
|
||||||
|
|
||||||
// tb_laporan
|
// tb_laporan
|
||||||
`DROP TRIGGER IF EXISTS trg_laporan_insert;`,
|
`DROP TRIGGER IF EXISTS trg_laporan_insert;`,
|
||||||
`CREATE TRIGGER trg_laporan_insert BEFORE INSERT ON tb_laporan FOR EACH ROW
|
`CREATE TRIGGER trg_laporan_insert BEFORE INSERT ON tb_laporan FOR EACH ROW BEGIN SET NEW.created_at = DATE_ADD(NOW(), INTERVAL 8 HOUR); END;`,
|
||||||
BEGIN
|
|
||||||
SET NEW.created_at = DATE_ADD(NOW(), INTERVAL 8 HOUR);
|
|
||||||
END;`,
|
|
||||||
|
|
||||||
// tb_mahasiswa
|
// tb_mahasiswa
|
||||||
`DROP TRIGGER IF EXISTS trg_mahasiswa_insert;`,
|
`DROP TRIGGER IF EXISTS trg_mahasiswa_insert;`,
|
||||||
`CREATE TRIGGER trg_mahasiswa_insert BEFORE INSERT ON tb_mahasiswa FOR EACH ROW
|
`CREATE TRIGGER trg_mahasiswa_insert BEFORE INSERT ON tb_mahasiswa FOR EACH ROW BEGIN SET NEW.created_at = DATE_ADD(NOW(), INTERVAL 8 HOUR); SET NEW.updated_at = DATE_ADD(NOW(), INTERVAL 8 HOUR); END;`,
|
||||||
BEGIN
|
|
||||||
SET NEW.created_at = DATE_ADD(NOW(), INTERVAL 8 HOUR);
|
|
||||||
SET NEW.updated_at = DATE_ADD(NOW(), INTERVAL 8 HOUR);
|
|
||||||
END;`,
|
|
||||||
`DROP TRIGGER IF EXISTS trg_mahasiswa_update;`,
|
`DROP TRIGGER IF EXISTS trg_mahasiswa_update;`,
|
||||||
`CREATE TRIGGER trg_mahasiswa_update BEFORE UPDATE ON tb_mahasiswa FOR EACH ROW
|
`CREATE TRIGGER trg_mahasiswa_update BEFORE UPDATE ON tb_mahasiswa FOR EACH ROW BEGIN SET NEW.updated_at = DATE_ADD(NOW(), INTERVAL 8 HOUR); END;`
|
||||||
BEGIN
|
|
||||||
SET NEW.updated_at = DATE_ADD(NOW(), INTERVAL 8 HOUR);
|
|
||||||
END;`
|
|
||||||
];
|
];
|
||||||
|
|
||||||
triggers.forEach(q => {
|
// Execute queries sequentially to prevent race conditions
|
||||||
db.query(q, (err) => {
|
let i = 0;
|
||||||
if (err) console.error("Trigger Error:", err.message);
|
const nextQuery = () => {
|
||||||
});
|
if (i >= queries.length) {
|
||||||
});
|
|
||||||
console.log("Timezone Triggers (+8 Hours) siap.");
|
console.log("Timezone Triggers (+8 Hours) siap.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
db.query(queries[i], (err) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(`Trigger Error [${i}]:`, err.message);
|
||||||
|
// If a drop trigger fails, it means it doesn't exist. We can safely continue.
|
||||||
|
if (!err.message.includes("does not exist")) {
|
||||||
|
// If it's a create trigger error, log it loudly.
|
||||||
|
if(queries[i].toUpperCase().startsWith("CREATE")) {
|
||||||
|
console.error(`Fatal Trigger Error: ${queries[i]}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
nextQuery();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
nextQuery();
|
||||||
};
|
};
|
||||||
|
|
||||||
setTimeout(initDB, 5000);
|
setTimeout(initDB, 5000);
|
||||||
|
|
||||||
app.get('/', (req, res) => {
|
app.get('/', (req, res) => {
|
||||||
@@ -573,6 +567,21 @@ app.get('/laporan/latest/:dosen_id', (req, res) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Get Laporan Statistics (Group by Date)
|
||||||
|
app.get('/laporan/stats/daily', (req, res) => {
|
||||||
|
// We group by DATE(created_at) and count how many entries there are per date
|
||||||
|
const query = `
|
||||||
|
SELECT DATE(created_at) as date, COUNT(*) as total
|
||||||
|
FROM tb_laporan
|
||||||
|
GROUP BY DATE(created_at)
|
||||||
|
ORDER BY DATE(created_at) ASC
|
||||||
|
`;
|
||||||
|
db.query(query, (err, results) => {
|
||||||
|
if (err) return res.status(500).json({ error: err.message });
|
||||||
|
res.json(results);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
app.use('/uploads', express.static(uploadDir));
|
app.use('/uploads', express.static(uploadDir));
|
||||||
|
|
||||||
app.listen(3000, () => console.log('API berjalan di port 3000'));
|
app.listen(3000, () => console.log('API berjalan di port 3000'));
|
||||||
@@ -127,6 +127,17 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
<div class="row small-spacing">
|
<div class="row small-spacing">
|
||||||
<div class="col-lg-7 col-xs-12">
|
<div class="col-lg-7 col-xs-12">
|
||||||
<div class="box-content card">
|
<div class="box-content card">
|
||||||
@@ -175,6 +186,9 @@
|
|||||||
<script src="assets/plugin/datatables/extensions/Responsive/js/dataTables.responsive.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/datatables/extensions/Responsive/js/responsive.bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
<!-- chart.js Chart -->
|
||||||
|
<script src="assets/plugin/chart/chartjs/Chart.bundle.min.js"></script>
|
||||||
|
|
||||||
<script src="assets/scripts/main.min.js"></script>
|
<script src="assets/scripts/main.min.js"></script>
|
||||||
<script src="assets/color-switcher/color-switcher.min.js"></script>
|
<script src="assets/color-switcher/color-switcher.min.js"></script>
|
||||||
|
|
||||||
@@ -204,6 +218,61 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- CHART RENDERING FUNCTION ---
|
||||||
|
function renderChart() {
|
||||||
|
$.get('/api/laporan/stats/daily', 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',
|
||||||
|
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 () {
|
$(document).ready(function () {
|
||||||
document.body.style.display = 'block';
|
document.body.style.display = 'block';
|
||||||
|
|
||||||
@@ -280,6 +349,9 @@
|
|||||||
$('#h_jumlah_dosen').text('0');
|
$('#h_jumlah_dosen').text('0');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 4. Render the Chart
|
||||||
|
renderChart();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
+43
-32
@@ -429,6 +429,31 @@
|
|||||||
let isViewMode = false;
|
let isViewMode = false;
|
||||||
let currentViewId = null;
|
let currentViewId = null;
|
||||||
|
|
||||||
|
// --- DATE FORMATTER (ISO String to "DD Mon YYYY, HH.mm") ---
|
||||||
|
function formatDateOnly(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);
|
||||||
|
|
||||||
|
// 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}`;
|
||||||
|
}
|
||||||
|
|
||||||
// Custom Search Logic
|
// Custom Search Logic
|
||||||
$.fn.dataTable.ext.search.push(
|
$.fn.dataTable.ext.search.push(
|
||||||
function (settings, data, dataIndex) {
|
function (settings, data, dataIndex) {
|
||||||
@@ -471,6 +496,16 @@
|
|||||||
if (dosenName) document.getElementById('dosenName').textContent = dosenName;
|
if (dosenName) document.getElementById('dosenName').textContent = dosenName;
|
||||||
if (dosenId) document.getElementById('dosenId').value = dosenId;
|
if (dosenId) document.getElementById('dosenId').value = dosenId;
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 1. Populate Years for the Form (Tambah/Edit)
|
// 1. Populate Years for the Form (Tambah/Edit)
|
||||||
const yearSelect = document.getElementById('tahun_penelitian');
|
const yearSelect = document.getElementById('tahun_penelitian');
|
||||||
for (let y = 2026; y >= 2010; y--) {
|
for (let y = 2026; y >= 2010; y--) {
|
||||||
@@ -499,16 +534,12 @@
|
|||||||
// 3. Add Event Listener to "Tahun Dari"
|
// 3. Add Event Listener to "Tahun Dari"
|
||||||
$('#searchTahunFrom').on('change', function () {
|
$('#searchTahunFrom').on('change', function () {
|
||||||
const selectedFrom = $(this).val();
|
const selectedFrom = $(this).val();
|
||||||
|
|
||||||
// Reset "Tahun Sampai"
|
|
||||||
toSelect.innerHTML = '';
|
toSelect.innerHTML = '';
|
||||||
|
|
||||||
if (selectedFrom) {
|
if (selectedFrom) {
|
||||||
// Enable "Tahun Sampai" if a start year is selected
|
|
||||||
toSelect.disabled = false;
|
toSelect.disabled = false;
|
||||||
toSelect.innerHTML = '<option value="">-- Pilih --</option>';
|
toSelect.innerHTML = '<option value="">-- Pilih --</option>';
|
||||||
|
|
||||||
// Populate "Tahun Sampai" starting from the selected "Tahun Dari" up to 2026
|
|
||||||
for (let y = parseInt(selectedFrom); y <= 2026; y++) {
|
for (let y = parseInt(selectedFrom); y <= 2026; y++) {
|
||||||
let opt = document.createElement('option');
|
let opt = document.createElement('option');
|
||||||
opt.value = y;
|
opt.value = y;
|
||||||
@@ -516,28 +547,16 @@
|
|||||||
toSelect.appendChild(opt);
|
toSelect.appendChild(opt);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If "Tahun Dari" is cleared, disable "Tahun Sampai" again
|
|
||||||
toSelect.disabled = true;
|
toSelect.disabled = true;
|
||||||
toSelect.innerHTML = '<option value="">-- Pilih Tahun Dari Dulu --</option>';
|
toSelect.innerHTML = '<option value="">-- Pilih Tahun Dari Dulu --</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redraw table to clear any previous filter
|
|
||||||
applyCustomFilter();
|
applyCustomFilter();
|
||||||
});
|
});
|
||||||
|
|
||||||
initDataTable(dosenId);
|
initDataTable(dosenId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function formatDate(dateString) {
|
|
||||||
if (!dateString) return '-';
|
|
||||||
const date = new Date(dateString);
|
|
||||||
return date.toLocaleString('id-ID', {
|
|
||||||
day: '2-digit', month: 'short', year: 'numeric',
|
|
||||||
hour: '2-digit', minute: '2-digit'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function initDataTable(dosenId) {
|
function initDataTable(dosenId) {
|
||||||
dataTable = $('#tablePenelitian').DataTable({
|
dataTable = $('#tablePenelitian').DataTable({
|
||||||
ajax: {
|
ajax: {
|
||||||
@@ -557,7 +576,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
data: 'updated_at',
|
data: 'updated_at',
|
||||||
render: function (data) { return formatDate(data); }
|
render: function (data) {
|
||||||
|
return formatDateOnly(data);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
data: null,
|
data: null,
|
||||||
@@ -571,18 +592,14 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
order: [[4, "desc"]],
|
order: [[4, "desc"]],
|
||||||
// REPLACED initComplete WITH drawCallback
|
|
||||||
drawCallback: function () {
|
drawCallback: function () {
|
||||||
// Get all data from the DataTable instance
|
|
||||||
const data = this.api().rows().data().toArray();
|
const data = this.api().rows().data().toArray();
|
||||||
updateStatistics(data);
|
updateStatistics(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calculate and update the dashboard cards
|
||||||
|
|
||||||
// NEW FUNCTION: Calculate and update the dashboard cards
|
|
||||||
function updateStatistics(data) {
|
function updateStatistics(data) {
|
||||||
let total = data.length;
|
let total = data.length;
|
||||||
let selesai = 0;
|
let selesai = 0;
|
||||||
@@ -593,7 +610,6 @@
|
|||||||
if (item.status_penelitian === 'Selesai') selesai++;
|
if (item.status_penelitian === 'Selesai') selesai++;
|
||||||
if (item.status_penelitian === 'Berjalan') berjalan++;
|
if (item.status_penelitian === 'Berjalan') berjalan++;
|
||||||
|
|
||||||
// Find the most recent updated_at date
|
|
||||||
if (item.updated_at) {
|
if (item.updated_at) {
|
||||||
const itemDate = new Date(item.updated_at);
|
const itemDate = new Date(item.updated_at);
|
||||||
if (!latestUpdate || itemDate > latestUpdate) {
|
if (!latestUpdate || itemDate > latestUpdate) {
|
||||||
@@ -602,13 +618,11 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update the DOM elements
|
|
||||||
$('#h_jumlah_penelitian').text(total);
|
$('#h_jumlah_penelitian').text(total);
|
||||||
$('#h_penelitian_selesai').text(selesai);
|
$('#h_penelitian_selesai').text(selesai);
|
||||||
$('#h_penelitian_berjalan').text(berjalan);
|
$('#h_penelitian_berjalan').text(berjalan);
|
||||||
|
|
||||||
if (latestUpdate) {
|
if (latestUpdate) {
|
||||||
// Format to show just the day, month, and year
|
|
||||||
const options = { day: '2-digit', month: 'short', year: 'numeric' };
|
const options = { day: '2-digit', month: 'short', year: 'numeric' };
|
||||||
$('#h_terakhir_update').text(latestUpdate.toLocaleDateString('id-ID', options));
|
$('#h_terakhir_update').text(latestUpdate.toLocaleDateString('id-ID', options));
|
||||||
} else {
|
} else {
|
||||||
@@ -663,21 +677,19 @@
|
|||||||
$('#keterangan').val(item.keterangan || '');
|
$('#keterangan').val(item.keterangan || '');
|
||||||
renderExistingFiles(item.hasil_publikasi);
|
renderExistingFiles(item.hasil_publikasi);
|
||||||
|
|
||||||
$('#lblCreated').text(formatDate(item.created_at));
|
$('#lblCreated').text(formatDateOnly(item.created_at));
|
||||||
$('#lblUpdated').text(formatDate(item.updated_at));
|
$('#lblUpdated').text(formatDateOnly(item.updated_at));
|
||||||
$('#timestampInfo').show();
|
$('#timestampInfo').show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function editPenelitian(id) {
|
function editPenelitian(id) {
|
||||||
resetModal();
|
resetModal();
|
||||||
$('#modalLabel').text('Update Penelitian');
|
$('#modalLabel').text('Update Penelitian');
|
||||||
$('#penelitianId').val(id);
|
$('#penelitianId').val(id);
|
||||||
$('#modalPenelitian').modal('show');
|
$('#modalPenelitian').modal('show');
|
||||||
|
|
||||||
// Disable Judul and Tahun for Edit mode
|
|
||||||
$('#judul_penelitian').prop('disabled', true);
|
$('#judul_penelitian').prop('disabled', true);
|
||||||
$('#tahun_penelitian').prop('disabled', true);
|
$('#tahun_penelitian').prop('disabled', true);
|
||||||
|
|
||||||
@@ -693,8 +705,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function renderExistingFiles(filesData) {
|
function renderExistingFiles(filesData) {
|
||||||
if (Array.isArray(filesData)) {
|
if (Array.isArray(filesData)) {
|
||||||
currentEditFiles = filesData;
|
currentEditFiles = filesData;
|
||||||
@@ -771,7 +781,7 @@
|
|||||||
<div class="history-header">
|
<div class="history-header">
|
||||||
Update #${data.length - index}
|
Update #${data.length - index}
|
||||||
<span class="pull-right text-muted" style="font-size: 12px; font-weight: normal;">
|
<span class="pull-right text-muted" style="font-size: 12px; font-weight: normal;">
|
||||||
${formatDate(log.created_at)}
|
${formatDateOnly(log.created_at)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="history-body">
|
<div class="history-body">
|
||||||
@@ -931,6 +941,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Reference in new issue
Block a user