farwew's picture
Upload 9 files
a6a4cdd verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sistem Laporan Siswa</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
:root {
--primary-color: #6d28d9; /* Ungu - matching with tambah_siswa.html */
--secondary-color: #7c3aed;
--success-color: #10b981; /* Green */
--background-color: #f3f4f6;
--card-color: #ffffff;
--text-color: #374151;
--border-color: #e5e7eb;
--shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
padding: 20px;
background-color: var(--background-color);
line-height: 1.6;
color: var(--text-color);
}
.container {
max-width: 1100px;
margin: 0 auto;
background-color: var(--card-color);
padding: 30px;
border-radius: 1rem;
box-shadow: var(--shadow);
animation: fadeIn 0.5s ease;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.header {
text-align: center;
margin-bottom: 30px;
padding-bottom: 20px;
border-bottom: 2px solid var(--border-color);
position: relative;
}
.header::after {
content: '';
position: absolute;
bottom: -2px;
left: 50%;
transform: translateX(-50%);
width: 100px;
height: 4px;
background-color: var(--primary-color);
border-radius: 2px;
}
h1 {
color: var(--primary-color);
margin: 0;
font-size: 28px;
font-weight: 700;
letter-spacing: -0.5px;
}
h2 {
color: #555;
font-size: 22px;
margin: 15px 0;
font-weight: 600;
}
h3 {
color: var(--text-color);
margin: 25px 0 15px 0;
font-size: 18px;
font-weight: 600;
position: relative;
padding-left: 15px;
}
h3::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 5px;
height: 20px;
background-color: var(--primary-color);
border-radius: 3px;
}
.action-buttons {
display: flex;
justify-content: center;
gap: 20px;
margin: 25px 0;
}
.action-btn {
padding: 12px 25px;
border-radius: 8px;
color: white;
text-decoration: none;
font-weight: 600;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
}
.action-btn i {
margin-right: 8px;
font-size: 16px;
}
.action-btn:hover {
transform: translateY(-3px);
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.btn-print {
background-color: var(--success-color);
}
.btn-print:hover {
background-color: #0da76f;
}
.btn-add {
background-color: var(--primary-color);
}
.btn-add:hover {
background-color: var(--secondary-color);
}
.table-container {
overflow-x: auto;
border-radius: 8px;
box-shadow: var(--shadow);
}
table {
width: 100%;
border-collapse: collapse;
border-radius: 8px;
overflow: hidden;
}
th, td {
padding: 15px 20px;
text-align: left;
}
th {
background-color: var(--primary-color);
color: white;
font-weight: 600;
text-transform: uppercase;
font-size: 14px;
letter-spacing: 0.5px;
}
tr:nth-child(even) {
background-color: #f9fafb;
}
tr:not(thead tr) {
border-bottom: 1px solid var(--border-color);
}
tr:last-child {
border-bottom: none;
}
tr:hover:not(thead tr) {
background-color: #f3f4f6;
}
td {
transition: all 0.2s ease;
}
.alert {
padding: 15px 20px;
background-color: #ecfdf5;
border-left: 4px solid var(--success-color);
color: #065f46;
border-radius: 8px;
margin-bottom: 20px;
display: flex;
align-items: center;
opacity: 1;
transition: opacity 0.5s ease, transform 0.5s ease;
transform: translateY(0);
box-shadow: 0 2px 5px rgba(0,0,0,0.05);
{% if status != 'success' %}display: none;{% endif %}
}
.alert i {
margin-right: 10px;
font-size: 20px;
color: var(--success-color);
}
.alert.fade-out {
opacity: 0;
transform: translateY(-20px);
}
.empty-state {
text-align: center;
padding: 40px 20px;
color: #6b7280;
}
.empty-state i {
font-size: 48px;
color: #d1d5db;
margin-bottom: 15px;
}
.empty-state p {
font-size: 16px;
margin-bottom: 20px;
}
/* Action icons styling */
.actions {
width: 100px;
text-align: center;
}
.action-icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
border-radius: 50%;
color: white;
margin: 0 3px;
transition: all 0.2s ease;
}
.edit-icon {
background-color: #3b82f6;
}
.edit-icon:hover {
background-color: #2563eb;
transform: translateY(-2px);
}
.delete-icon {
background-color: #ef4444;
}
.delete-icon:hover {
background-color: #dc2626;
transform: translateY(-2px);
}
/* Modal styles */
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1000;
align-items: center;
justify-content: center;
}
.modal-content {
background-color: white;
padding: 2rem;
border-radius: 1rem;
width: 90%;
max-width: 500px;
box-shadow: var(--shadow);
text-align: center;
animation: modalFadeIn 0.3s ease;
}
@keyframes modalFadeIn {
from { opacity: 0; transform: translateY(-50px); }
to { opacity: 1; transform: translateY(0); }
}
.modal h3 {
color: #dc2626;
margin-bottom: 1rem;
padding: 0;
}
.modal h3::before {
display: none;
}
.modal p {
margin-bottom: 1.5rem;
}
.modal-buttons {
display: flex;
justify-content: center;
gap: 1rem;
}
.modal-btn {
padding: 0.75rem 1.5rem;
border-radius: 0.5rem;
font-weight: 600;
cursor: pointer;
}
.btn-confirm {
background-color: #ef4444;
color: white;
}
.btn-cancel {
background-color: #e5e7eb;
color: #4b5563;
}
/* Responsive Design */
@media (max-width: 768px) {
.action-buttons {
flex-direction: column;
gap: 10px;
}
.action-btn {
width: 100%;
}
th, td {
padding: 12px 15px;
}
h1 {
font-size: 24px;
}
h2 {
font-size: 18px;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>SEKOLAH MENENGAH KEJURUAN NEGERI 5 CILEGON</h1>
<h2>Sistem Laporan Siswa</h2>
</div>
<div class="alert">
<i class="fas fa-check-circle"></i>
<span>Data berhasil disimpan!</span>
</div>
<div class="action-buttons">
<a href="{{ url_for('cetak_pdf') }}" class="action-btn btn-print" target="_blank">
<i class="fas fa-file-pdf"></i> Cetak Laporan PDF
</a>
<a href="{{ url_for('tambah_siswa') }}" class="action-btn btn-add">
<i class="fas fa-user-plus"></i> Tambah Data Siswa
</a>
</div>
<h3>Daftar Siswa Kelas IX Jurusan Rekayasa Kecerdasan Artifisial</h3>
<div class="table-container">
{% if mahasiswa and mahasiswa|length > 0 %}
<table>
<thead>
<tr>
<th>NRP/NIM</th>
<th>Nama Lengkap</th>
<th>No HP</th>
<th>Tanggal Lahir</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
{% for student in mahasiswa %}
<tr>
<td>{{ student.NRP if student.NRP is defined else student.nim }}</td>
<td>{{ student.nama_lengkap }}</td>
<td>{{ student.no_hp }}</td>
<td>{{ student.tanggal_lahir.strftime('%d-%m-%Y') if student.tanggal_lahir is not string else student.tanggal_lahir }}</td>
<td class="actions">
<a href="{{ url_for('edit_siswa', id=student.NRP if student.NRP is defined else student.nim) }}" class="action-icon edit-icon" title="Edit">
<i class="fas fa-edit"></i>
</a>
<a href="#" onclick="confirmDelete('{{ student.NRP if student.NRP is defined else student.nim }}')" class="action-icon delete-icon" title="Hapus">
<i class="fas fa-trash-alt"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="empty-state">
<i class="fas fa-user-graduate"></i>
<p>Tidak ada data siswa ditemukan.</p>
</div>
{% endif %}
</div>
</div>
<!-- Modal for delete confirmation -->
<div id="deleteModal" class="modal">
<div class="modal-content">
<h3><i class="fas fa-exclamation-triangle"></i> Konfirmasi Hapus</h3>
<p>Apakah Anda yakin ingin menghapus data siswa ini?</p>
<form id="deleteForm" action="{{ url_for('hapus_siswa') }}" method="POST">
<input type="hidden" id="deleteId" name="id">
<div class="modal-buttons">
<button type="button" class="modal-btn btn-cancel" onclick="closeModal()">Batal</button>
<button type="submit" class="modal-btn btn-confirm">Hapus</button>
</div>
</form>
</div>
</div>
<script>
function confirmDelete(id) {
document.getElementById('deleteId').value = id;
document.getElementById('deleteModal').style.display = 'flex';
}
function closeModal() {
document.getElementById('deleteModal').style.display = 'none';
}
// Close modal when clicking outside of it
window.onclick = function(event) {
const modal = document.getElementById('deleteModal');
if (event.target == modal) {
closeModal();
}
}
// Add this to improve performance
document.addEventListener('DOMContentLoaded', function() {
// Auto-dismiss success alert after 5 seconds
const alert = document.querySelector('.alert');
if (alert && getComputedStyle(alert).display !== 'none') {
setTimeout(function() {
alert.classList.add('fade-out');
setTimeout(function() {
alert.style.display = 'none';
}, 500);
}, 5000);
}
// Preload modal for faster response
setTimeout(function() {
document.getElementById('deleteModal').style.display = 'flex';
document.getElementById('deleteModal').style.display = 'none';
}, 1000);
});
</script>
</body>
</html>