syifa-laravel/resources/views/siswa/index.blade.php

137 lines
3.8 KiB
PHP

<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Data Siswa</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
body {
background: linear-gradient(135deg, #74ebd5, #ACB6E5);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
color: #333;
}
.container {
width: 90%;
max-width: 900px;
background: #ffffff;
padding: 40px;
border-radius: 20px;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}
h1 {
text-align: center;
margin-bottom: 30px;
color: #2c3e50;
}
.button, .button-edit {
display: inline-block;
padding: 12px 25px;
margin-top: 20px;
color: #ffffff;
background: #3498db;
text-decoration: none;
border-radius: 50px;
font-weight: 600;
transition: background 0.3s ease;
}
.button:hover, .button-edit:hover {
background: #2980b9;
}
.alert {
padding: 15px;
background-color: #d1f2eb;
color: #117864;
margin-bottom: 20px;
border-left: 6px solid #1abc9c;
border-radius: 8px;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
overflow: hidden;
border-radius: 15px;
}
thead {
background-color: #3498db;
color: white;
}
th, td {
padding: 15px;
text-align: center;
font-size: 16px;
border-bottom: 1px solid #e1e1e1;
}
tbody tr:nth-child(even) {
background-color: #f4f9fd;
}
tbody tr:hover {
background-color: #eaf6ff;
}
p {
text-align: center;
margin-top: 20px;
font-size: 18px;
color: #555;
}
</style>
</head>
<body>
<div class="container">
<h1>Data Siswa</h1>
@if(session('success'))
<div class="alert">{{ session('success') }}</div>
@endif
@if(session('error'))
<div class="alert" style="background: #ffe6e6; color: #c0392b;">{{ session('error') }}</div>
@endif
@if(count($siswas) > 0)
<table>
<thead>
<tr>
<th>No</th>
<th>Nama</th>
<th>Kelas</th>
<th>Umur</th>
<th>Absen</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach($siswas as $siswa)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $siswa->nama }}</td>
<td>{{ $siswa->kelas }}</td>
<td>{{ $siswa->umur }}</td>
<td>{{ $siswa->absen }}</td>
<td>
<a href="{{ route('siswa.edit', $siswa->id) }}" class="button-edit">Edit</a>
<form action="{{ route('siswa.destroy', $siswa->id) }}" method="POST" style="display:inline;">
@csrf
@method('DELETE')
<button type="submit" class="button-edit" style="background:#e74c3c; margin-top:0; margin-left:10px;">Hapus</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
@else
<p>Belum ada data siswa, silahkan tambahkan data.</p>
@endif
<a href="{{ route('siswa.create') }}" class="button">+ Tambah Data Siswa</a>
</div>
</body>
</html>