55 lines
1.8 KiB
PHP
55 lines
1.8 KiB
PHP
</div><!-- /admin-content -->
|
|
</main><!-- /admin-main -->
|
|
|
|
<!-- Toast Container -->
|
|
<div class="toast-container" id="toastContainer"></div>
|
|
|
|
<script>
|
|
// ── Clock ──
|
|
function updateClock() {
|
|
const now = new Date();
|
|
document.getElementById('clockText').textContent =
|
|
now.toLocaleTimeString('id-ID', { hour:'2-digit', minute:'2-digit', second:'2-digit' });
|
|
}
|
|
updateClock();
|
|
setInterval(updateClock, 1000);
|
|
|
|
// ── Toast utility ──
|
|
window.showToast = function(msg, type = 'success') {
|
|
const t = document.createElement('div');
|
|
t.className = `toast ${type}`;
|
|
const icons = { success: 'check-circle', error: 'exclamation-circle', info: 'info-circle' };
|
|
t.innerHTML = `<i class="fas fa-${icons[type]||'info-circle'}" style="margin-right:8px;"></i>${msg}`;
|
|
document.getElementById('toastContainer').appendChild(t);
|
|
setTimeout(() => { t.style.opacity = '0'; setTimeout(() => t.remove(), 400); }, 3000);
|
|
};
|
|
|
|
// ── Modal helpers ──
|
|
window.openModal = function(id) {
|
|
document.getElementById(id)?.classList.add('active');
|
|
document.body.style.overflow = 'hidden';
|
|
};
|
|
window.closeModal = function(id) {
|
|
document.getElementById(id)?.classList.remove('active');
|
|
document.body.style.overflow = '';
|
|
};
|
|
|
|
// Close modal on overlay click
|
|
document.querySelectorAll('.modal-overlay').forEach(overlay => {
|
|
overlay.addEventListener('click', e => {
|
|
if (e.target === overlay) closeModal(overlay.id);
|
|
});
|
|
});
|
|
|
|
// ── Search filter ──
|
|
window.filterTable = function(inputId, tableId) {
|
|
const q = document.getElementById(inputId)?.value.toLowerCase() || '';
|
|
document.querySelectorAll(`#${tableId} tbody tr`).forEach(row => {
|
|
row.style.display = row.textContent.toLowerCase().includes(q) ? '' : 'none';
|
|
});
|
|
};
|
|
</script>
|
|
<?= $extraScript ?? '' ?>
|
|
</body>
|
|
</html>
|