162 lines
6.6 KiB
PHP

@extends('layouts.app')
@push('styles')
<!-- DataTables -->
<link rel="stylesheet" href="{{ asset('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css') }}">
<link rel="stylesheet" href="{{ asset('plugins/datatables-responsive/css/responsive.bootstrap4.min.css') }}">
<link rel="stylesheet" href="{{ asset('plugins/datatables-buttons/css/buttons.bootstrap4.min.css') }}">
@endpush
@section('content-header')
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">Registrasi Pasien</h1>
</div><!-- /.col -->
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="#">Home</a></li>
<li class="breadcrumb-item active">Registrasi Pasien</li>
</ol>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div>
@endsection
@section('main-content')
<div class="card">
<div class="card-header">
<a href="{{ route('patient-registration.create') }}" class="btn btn-info">
<i class="fas fa-plus"></i>
&nbsp;&nbsp;Tambah Registrasi Pasien
</a>
</div>
<div class="card-body">
<table id="tableData" class="table table-bordered table-hover">
<thead>
<tr>
<th>No</th>
<th>Rekam Medis</th>
<th>Nama Lengkap</th>
<th>Jaminan Kesehatan</th>
<th>Dibuat Oleh</th>
<th>Dibuat Pada</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($registrations as $index => $data)
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $data->patient->medical_record_number }}</td>
<td>{{ $data->patient->first_name }} {{ $data->patient->last_name }}</td>
<td>{{ $data->insurance->name }}</td>
<td>{{ $data->user->name }}</td>
<td>{{ $data->created_at }}</td>
<td>
<a href="{{ route('transaction.index', $data->id) }}" class="btn btn-sm btn-info">
<i class="fas fa-money-bill"></i>&nbsp;&nbsp;Transaksi
</a>
<a href="{{ route('patient-registration.edit', $data->id) }}"
class="btn btn-sm btn-warning">
<i class="fas fa-pencil-alt"></i>&nbsp;&nbsp;Edit
</a>
<button type="button" class="btn btn-sm btn-danger delete-btn"
data-url="{{ route('patient-registration.destroy', $data->id) }}">
<i class="fas fa-trash"></i>&nbsp;&nbsp;Hapus
</button>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<!-- /.card-body -->
</div>
<!-- Delete Confirmation Modal -->
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="deleteModalLabel">Konfirmasi Hapus</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Apakah Anda yakin ingin menghapus data ini?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Batal</button>
<form id="deleteForm" action="" method="POST">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger">Hapus</button>
</form>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
@if (session('success'))
<script>
document.addEventListener('DOMContentLoaded', function() {
Toast.fire({
icon: 'success',
title: "{{ session('success') }}",
});
});
</script>
@endif
@if (session('error'))
<script>
document.addEventListener('DOMContentLoaded', function() {
Toast.fire({
icon: 'error',
title: "{{ session('error') }}",
});
});
</script>
@endif
<script src="{{ asset('plugins/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js') }}"></script>
<script src="{{ asset('plugins/datatables-responsive/js/dataTables.responsive.min.js') }}"></script>
<script src="{{ asset('plugins/datatables-responsive/js/responsive.bootstrap4.min.js') }}"></script>
<script>
$(function() {
$("#tableData").DataTable({
"paging": true,
"lengthChange": false,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": true,
});
});
document.addEventListener("DOMContentLoaded", function() {
const deleteButtons = document.querySelectorAll('.delete-btn');
const deleteModal = document.getElementById('deleteModal');
const deleteForm = document.getElementById('deleteForm');
deleteButtons.forEach(button => {
button.addEventListener('click', function() {
const url = this.getAttribute('data-url');
deleteForm.setAttribute('action', url);
$(deleteModal).modal('show'); // Use jQuery to show the modal
});
});
});
</script>
@endpush