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

185 lines
4.9 KiB
PHP

@extends('layouts.admin')
@section('title', 'Data Siswa')
@section('content')
<style>
body {
background: #e5f1ff;
font-family: 'Poppins', sans-serif;
}
.card {
border-radius: 20px;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
background-color: white;
overflow: hidden;
margin-bottom: 30px;
}
.card-header.bg-primary {
background: linear-gradient(to right, #3b82f6, #60a5fa);
border-bottom: none;
padding: 1rem 1.5rem;
}
.card-title {
color: white;
font-size: 20px;
font-weight: 600;
margin: 0;
}
.table th,
.table td {
vertical-align: middle !important;
font-size: 15px;
font-family: 'Poppins', sans-serif;
border: 1px solid #d1d5db;
}
.table thead th {
background-color: #93c5fd;
color: #1e3a8a;
}
.btn {
border-radius: 10px;
padding: 6px 15px;
font-weight: 500;
font-family: 'Poppins', sans-serif;
transition: 0.3s ease;
}
.btn-primary {
background: #3b82f6;
border-color: #3b82f6;
color: white;
}
.btn-primary:hover {
background: #2563eb;
}
.btn-info {
background: #60a5fa;
border-color: #3b82f6;
color: white;
}
.btn-info:hover {
background: #3b82f6;
}
.btn-danger {
background: #ef4444;
border-color: #dc2626;
color: white;
}
.btn-danger:hover {
background: #dc2626;
}
.alert {
font-size: 15px;
border-radius: 10px;
}
.text-muted {
color: #6b7280 !important;
}
.table-responsive {
margin-top: 20px;
}
.text-center.mt-4 {
margin-top: 30px !important;
}
.btn-lg {
padding: 10px 24px;
font-size: 16px;
border-radius: 8px;
}
.text-center p {
font-size: 16px;
}
.btn i {
margin-right: 5px;
}
</style>
<!-- pastikan FontAwesome sudah dimuat -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
<div class="card">
<div class="card-header bg-primary">
<h3 class="card-title"><i class="fas fa-users mr-2"></i>Data Siswa</h3>
</div>
<div class="card-body">
@if(session('success'))
<div class="alert alert-success">{{ session('success') }}</div>
@endif
@if(session('error'))
<div class="alert alert-danger">{{ session('error') }}</div>
@endif
@if(count($siswas) > 0)
<div class="table-responsive">
<table class="table table-bordered text-center">
<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->nama ?? '-' }}</td>
<td>{{ $siswa->umur }}</td>
<td>{{ $siswa->absen }}</td>
<td>
<a href="{{ route('siswa.edit', $siswa->id) }}" class="btn btn-info btn-sm">
<i class="fas fa-edit"></i>Edit
</a>
<form action="{{ route('siswa.destroy', $siswa->id) }}" method="POST" class="d-inline">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Yakin mau hapus?')">
<i class="fas fa-trash-alt"></i>Hapus
</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@else
<div class="text-center text-muted my-4">
<p>Belum ada data siswa, silahkan tambahkan data.</p>
</div>
@endif
<div class="text-center mt-4">
<a href="{{ route('siswa.create') }}" class="btn btn-primary btn-lg font-weight-bold">
<i class="fas fa-plus-circle"></i> Tambah Data Siswa
</a>
</div>
</div>
</div>
@endsection