2025-04-27 23:36:33 +07:00

89 lines
4.1 KiB
PHP

@extends('layouts.admin')
@section('title', 'Manajemen Tindakan Medis')
@section('content')
<div class="container mx-auto p-8">
<div class="card mb-4">
<div class="card-header">
<div class="d-flex justify-content-between align-items-center">
<h4><i class="fas fa-stethoscope me-1"></i> Daftar Tindakan Medis</h4>
<a href="{{ route('admin.tindakan.create') }}" class="btn btn-primary btn-sm">
<i class="fas fa-plus"></i> Tambah Tindakan
</a>
</div>
</div>
<div class="card-body">
@if (session('success'))
<div class="alert alert-success alert-dismissible fade show" role="alert">
{{ session('success') }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
@endif
<div class="table-responsive">
<table class="table table-bordered table-hover" id="dataTable">
<thead class="table-light">
<tr>
<th>No</th>
<th>Nama Tindakan</th>
<th>Tarif</th>
<th>Tanggal Dibuat</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@foreach ($tindakan as $item)
<tr>
<td>{{ $loop->iteration }}</td>
<td>{{ $item->nama_tindakan }}</td>
<td>Rp {{ number_format($item->tarif_tindakan, 0, ',', '.') }}</td>
<td>{{ $item->created_at->format('d/m/Y') }}</td>
<td>
<div class="d-flex gap-2">
<a href="{{ route('admin.tindakan.edit', $item->id) }}"
class="btn btn-warning btn-sm">
<i class="fas fa-edit"></i>
</a>
<form action="{{ route('admin.tindakan.destroy', $item->id) }}" method="POST">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger btn-sm"
onclick="return confirm('Apakah Anda yakin ingin menghapus tindakan ini?')">
<i class="fas fa-trash"></i>
</button>
</form>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@push('styles')
<link href="https://cdn.datatables.net/1.11.5/css/dataTables.bootstrap5.min.css" rel="stylesheet">
@endpush
@push('scripts')
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.11.5/js/dataTables.bootstrap5.min.js"></script>
<script>
$(document).ready(function() {
$('#dataTable').DataTable({
language: {
url: '//cdn.datatables.net/plug-ins/1.11.5/i18n/id.json'
},
columnDefs: [{
type: 'currency',
targets: 2
} // Mengurutkan kolom tarif sebagai currency
]
});
});
</script>
@endpush
@endsection