132 lines
4.9 KiB
PHP
132 lines
4.9 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 Transaksi</h1>
|
|
</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 Tindakan</th>
|
|
<th>Jumlah Tindakan</th>
|
|
<th>Pelaksana</th>
|
|
<th>Total Tarif</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_transaksi.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_transaksi.index') }}",
|
|
columns: [
|
|
{
|
|
data: 'DT_RowIndex',
|
|
name: 'DT_RowIndex'
|
|
},
|
|
{
|
|
data: 'nama_tindakan',
|
|
name: 'nama_tindakan',
|
|
},
|
|
{
|
|
data: 'jumlah_tindakan',
|
|
name: 'jumlah_tindakan',
|
|
},
|
|
{
|
|
data: 'id_pegawai',
|
|
name: 'id_pegawai',
|
|
},
|
|
{
|
|
data: 'total_tarif',
|
|
name: 'total_tarif',
|
|
},
|
|
{
|
|
data: 'action',
|
|
name: 'action',
|
|
orderable: false,
|
|
searchable: false
|
|
},
|
|
]
|
|
});
|
|
});
|
|
</script>
|
|
@endpush
|
|
</x-app-layout> |