2025-04-27 23:46:16 +07:00

149 lines
5.7 KiB
PHP

<x-app-layout>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 bg-white border-b border-gray-200">
<div class="flex justify-between mb-4">
<h1 class="text-xl font-bold">Data Registrasi</h1>
<a href="{{ route('admin.tr_registrasi.create') }}" class="bg-blue-500 text-white px-4 py-2 rounded-md">Tambah Data Registrasi</a>
</div>
<hr class="opacity-10 mb-4"></hr>
<table id="rowTable" class="rowTable table-bordered table-striped w-full">
<thead>
<tr>
<th>#</th>
<th>Nama Pasien</th>
<th>Asuransi</th>
<th>No. Asuransi</th>
<th>R. Pelayanan</th>
<th>Pelaksana</th>
<th>Tanggal</th>
<th>Status</th>
<th>Aksi</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
@push('js-internal')
<script>
function deleteData(id) {
Swal.fire({
title: 'Apakah anda yakin?',
text: "Anda tidak dapat mengembalikan data yang telah dihapus!",
icon: 'warning',
showCancelButton: true,
confirmButtonText: 'Ya, hapus!',
cancelButtonText: 'Batal'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: "{{ route('admin.tr_registrasi.destroy', ':id') }}".replace(':id', id),
type: 'DELETE',
data: {
'_token': "{{ csrf_token() }}"
},
success: function() {
Swal.fire({
icon: 'success',
title: 'Berhasil',
text: 'Data berhasil dihapus',
showConfirmButton: false,
timer: 1500
}).then(() => {
$('.rowTable').DataTable().ajax.reload();
});
},
error: function() {
Swal.fire({
icon: 'error',
title: 'Gagal',
text: 'Data gagal dihapus',
showConfirmButton: false,
timer: 1500
});
}
});
}
});
}
@if (Session::has('success'))
Swal.fire({
icon: 'success',
title: 'Berhasil',
text: '{{ Session::get('success') }}',
showConfirmButton: false,
timer: 1500
}).then(() => {
$('.rowTable').DataTable().ajax.reload();
});
@endif
@if (Session::has('error'))
Swal.fire({
icon: 'error',
title: 'Gagal',
text: '{{ Session::get('error') }}',
showConfirmButton: false,
timer: 1500
});
@endif
$(document).ready(function() {
$('.rowTable').DataTable({
processing: true,
serverSide: true,
responsive: true,
autoWidth: false,
ajax: "{{ route('admin.tr_registrasi.data') }}",
columns: [
{
data: 'DT_RowIndex',
name: 'DT_RowIndex'
},
{
data: 'mr_pasien',
name: 'mr_pasien',
},
{
data: 'id_asuransi',
name: 'id_asuransi',
},
{
data: 'no_asuransi',
name: 'no_asuransi',
},
{
data: 'id_ruang_pelayanan',
name: 'id_ruang_pelayanan',
},
{
data: 'id_pegawai',
name: 'id_pegawai',
},
{
data: 'tanggal_registrasi',
name: 'tanggal_registrasi',
},
{
data: 'status',
name: 'status',
},
{
data: 'action',
name: 'action',
orderable: false,
searchable: false
},
]
});
});
</script>
@endpush
</x-app-layout>