360 lines
17 KiB
PHP
360 lines
17 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="id">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Data Pasien | SIM-RS Anak dan Bunda Harapan Kita</title>
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet">
|
|
<style>
|
|
/* Gunakan style yang sama dengan halaman sebelumnya */
|
|
:root {
|
|
--primary-color: #0075c9;
|
|
--secondary-color: #64c4ed;
|
|
--accent-color: #ffaa00;
|
|
--light-color: #f8fcff;
|
|
--dark-color: #124467;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Nunito', sans-serif;
|
|
background: linear-gradient(135deg, rgba(18, 68, 103, 0.95), rgba(0, 117, 201, 0.85)),
|
|
url('https://images.unsplash.com/photo-1576091160550-2173dba999ef?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80');
|
|
background-size: cover;
|
|
background-position: center;
|
|
background-attachment: fixed;
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.data-container {
|
|
flex: 1;
|
|
padding: 40px 20px;
|
|
}
|
|
|
|
.data-card {
|
|
background-color: rgba(255, 255, 255, 0.95);
|
|
border-radius: 20px;
|
|
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
|
|
overflow: hidden;
|
|
position: relative;
|
|
}
|
|
|
|
.data-card::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 8px;
|
|
background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
|
|
}
|
|
|
|
.hospital-logo {
|
|
width: 80px;
|
|
height: 80px;
|
|
object-fit: contain;
|
|
padding: 10px;
|
|
background-color: white;
|
|
border-radius: 50%;
|
|
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.display-title {
|
|
background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
|
|
-webkit-background-clip: text;
|
|
-webkit-text-fill-color: transparent;
|
|
font-weight: 800;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.btn-primary-gradient {
|
|
background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
|
|
border: none;
|
|
color: white;
|
|
font-weight: 600;
|
|
padding: 10px 20px;
|
|
border-radius: 30px;
|
|
box-shadow: 0 4px 10px rgba(0, 117, 201, 0.3);
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.btn-primary-gradient:hover {
|
|
transform: translateY(-3px);
|
|
box-shadow: 0 6px 15px rgba(0, 117, 201, 0.4);
|
|
color: white;
|
|
}
|
|
|
|
.table-custom {
|
|
background-color: white;
|
|
border-radius: 15px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.table-custom thead {
|
|
background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
|
|
color: white;
|
|
}
|
|
|
|
.table-custom th {
|
|
border: none;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.table-custom td {
|
|
vertical-align: middle;
|
|
border-color: #f0f7ff;
|
|
}
|
|
|
|
.action-btn {
|
|
width: 35px;
|
|
height: 35px;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border-radius: 50%;
|
|
margin: 0 3px;
|
|
}
|
|
|
|
.modal-content {
|
|
border-radius: 15px;
|
|
border: none;
|
|
}
|
|
|
|
.modal-header {
|
|
background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
|
|
color: white;
|
|
border-radius: 15px 15px 0 0;
|
|
}
|
|
|
|
.bg-pink {
|
|
background-color: rgb(182, 83, 100) !important;
|
|
}
|
|
|
|
.back-link {
|
|
color: var(--primary-color);
|
|
text-decoration: none;
|
|
font-weight: 600;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
transition: all 0.3s;
|
|
}
|
|
|
|
.back-link:hover {
|
|
color: var(--secondary-color);
|
|
transform: translateX(-3px);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="data-container container py-4">
|
|
<div class="row justify-content-center">
|
|
<div class="col-lg-10 col-xl-12">
|
|
<div class="text-start mb-3">
|
|
<a href="/" class="back-link">
|
|
<i class="fas fa-arrow-left me-2"></i> Kembali ke Beranda
|
|
</a>
|
|
</div>
|
|
|
|
<div class="data-card p-4 p-md-5 my-2">
|
|
<div class="text-center mb-4">
|
|
<img src="{{ asset('assets/images/logo.png') }}" alt="Logo RS" class="hospital-logo">
|
|
<h2 class="h3 display-title">DATA PASIEN</h2>
|
|
<p class="subtitle">Sistem Informasi Manajemen RS Anak dan Bunda Harapan Kita</p>
|
|
</div>
|
|
|
|
<div class="d-flex justify-content-between mb-4">
|
|
<div class="search-box">
|
|
<div class="input-group">
|
|
<span class="input-group-text bg-white"><i class="fas fa-search"></i></span>
|
|
<input type="text" class="form-control" placeholder="Cari pasien...">
|
|
</div>
|
|
</div>
|
|
<button class="btn btn-primary-gradient" data-bs-toggle="modal" data-bs-target="#addPasienModal">
|
|
<i class="fas fa-user-plus me-2"></i>Tambah Pasien
|
|
</button>
|
|
</div>
|
|
|
|
<div class="table-responsive">
|
|
<table class="table table-custom table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th width="5%">No</th>
|
|
<th>Nama Pasien</th>
|
|
<th>Tanggal Lahir</th>
|
|
<th>Jenis Kelamin</th>
|
|
<th>Usia</th>
|
|
<th width="15%">Aksi</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($pasiens as $item)
|
|
<tr>
|
|
<td>{{ $loop->iteration }}</td>
|
|
<td>{{ $item->nama_pasien }}</td>
|
|
<td>{{ date('d/m/Y', strtotime($item->tanggal_lahir)) }}</td>
|
|
<td>
|
|
@if($item->jenis_kelamin == 'L')
|
|
<span class="badge bg-primary">Laki-laki</span>
|
|
@else
|
|
<span class="badge bg-pink">Perempuan</span>
|
|
@endif
|
|
</td>
|
|
<td>{{ \Carbon\Carbon::parse($item->tanggal_lahir)->age }} tahun</td>
|
|
<td>
|
|
<button class="btn btn-sm btn-warning action-btn" data-bs-toggle="modal" data-bs-target="#editPasienModal{{ $item->id_pasien }}">
|
|
<i class="fas fa-edit text-white"></i>
|
|
</button>
|
|
<button class="btn btn-sm btn-danger action-btn" data-bs-toggle="modal" data-bs-target="#deletePasienModal{{ $item->id_pasien }}">
|
|
<i class="fas fa-trash-alt text-white"></i>
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
|
|
<!-- Modal Edit -->
|
|
<div class="modal fade" id="editPasienModal{{ $item->id_pasien }}" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Edit Data Pasien</h5>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<form action="{{ route('pasien.update', $item->id_pasien) }}" method="POST">
|
|
@csrf
|
|
@method('PUT')
|
|
<div class="modal-body">
|
|
<div class="mb-3">
|
|
<label class="form-label">Nama Pasien</label>
|
|
<input type="text" class="form-control" name="nama_pasien" value="{{ $item->nama_pasien }}" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label">Tanggal Lahir</label>
|
|
<input type="date" class="form-control" name="tanggal_lahir" value="{{ $item->tanggal_lahir }}" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label">Jenis Kelamin</label>
|
|
<select class="form-select" name="jenis_kelamin" required>
|
|
<option value="L" {{ $item->jenis_kelamin == 'L' ? 'selected' : '' }}>Laki-laki</option>
|
|
<option value="P" {{ $item->jenis_kelamin == 'P' ? 'selected' : '' }}>Perempuan</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
|
<button type="submit" class="btn btn-primary-gradient">Simpan Perubahan</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Modal Delete -->
|
|
<div class="modal fade" id="deletePasienModal{{ $item->id_pasien }}" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header bg-danger">
|
|
<h5 class="modal-title text-white">Konfirmasi Hapus</h5>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<form action="{{ route('pasien.destroy', $item->id_pasien) }}" method="POST">
|
|
@csrf
|
|
@method('DELETE')
|
|
<div class="modal-body">
|
|
<p>Apakah Anda yakin ingin menghapus data pasien <strong>{{ $item->nama_pasien }}</strong>?</p>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
|
<button type="submit" class="btn btn-danger">Ya, Hapus</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="d-flex justify-content-between align-items-center mt-3">
|
|
<div class="text-muted">
|
|
Menampilkan {{ $pasiens->firstItem() }} - {{ $pasiens->lastItem() }} dari {{ $pasiens->total() }} pasien
|
|
</div>
|
|
<div>
|
|
{{ $pasiens->links() }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Modal Add -->
|
|
<div class="modal fade" id="addPasienModal" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Tambah Pasien Baru</h5>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<form action="{{ route('pasien.store') }}" method="POST">
|
|
@csrf
|
|
<div class="modal-body">
|
|
<div class="mb-3">
|
|
<label class="form-label">Nama Pasien</label>
|
|
<input type="text" class="form-control" name="nama_pasien" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label">Tanggal Lahir</label>
|
|
<input type="date" class="form-control" name="tanggal_lahir" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label">Jenis Kelamin</label>
|
|
<select class="form-select" name="jenis_kelamin" required>
|
|
<option value="" selected disabled>Pilih Jenis Kelamin</option>
|
|
<option value="L">Laki-laki</option>
|
|
<option value="P">Perempuan</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
|
|
<button type="submit" class="btn btn-primary-gradient">Simpan Data</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<footer class="footer text-center py-3">
|
|
<div class="container">
|
|
<p class="mb-0">
|
|
© 2025 RS Anak dan Bunda Harapan Kita |
|
|
<a href="#">Kebijakan Privasi</a> |
|
|
<a href="#">Kontak Kami</a>
|
|
</p>
|
|
</div>
|
|
</footer>
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/js/bootstrap.bundle.min.js"></script>
|
|
<script>
|
|
// Set tanggal maksimal hari ini untuk input tanggal lahir
|
|
document.querySelectorAll('input[type="date"]').forEach(input => {
|
|
input.max = new Date().toISOString().split('T')[0];
|
|
});
|
|
|
|
// Validasi form tambah pasien
|
|
document.getElementById('addPasienModal').addEventListener('shown.bs.modal', function() {
|
|
const form = this.querySelector('form');
|
|
form.addEventListener('submit', function(e) {
|
|
const nama = this.querySelector('[name="nama_pasien"]').value.trim();
|
|
if(nama.length < 3) {
|
|
alert('Nama pasien harus minimal 3 karakter');
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |