bank-sampah/Views/Wilayah/Kota/Index.cshtml

77 lines
2.5 KiB
Plaintext

@{
ViewData["Title"] = "Wilayah Kota";
}
<div class="flex flex-col gap-2 md:flex-row md:justify-between md:gap-0">
<div class="prose">
<span class="text-xl font-semibold text-black">
Wilayah Kota
</span>
</div>
</div>
<div class="h-6"></div>
<div class="card bg-white">
<div class="card-body p-2">
<table class="table-zebra table" id="example">
<!-- head -->
<thead>
<tr>
<th class="w-[5%]">No</th>
<th class="w-[10%]">Kode</th>
<th class="w-[30%]">Nama Kabupaten</th>
<th class="w-[25%]">Provinsi</th>
<th class="w-[15%]">Latitude</th>
<th class="w-[15%]">Longitude</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
<script type="text/javascript">
var table;
$(document).ready(function () {
table = new DataTable('#example', {
ajax: '/Dinas/Kota/Table',
scrollX: true,
autoWidth: false,
initComplete: function () {
$('div.dt-scroll-body thead').css('visibility', 'collapse');
},
columns: [
{ data: null, render: (d, t, r, m) => m.row + 1, orderable: false, searchable: false },
{ data: 'kode' },
{ data: 'kabupaten' },
{ data: 'provinsi' },
{ data: 'latitude' },
{ data: 'longitude' }, ]
});
table.on("click", ".delete", function (e) {
e.preventDefault();
let url = $(this).data("url");
swal.fire({
title: "Apakah anda yakin?",
text: "Data yang dihapus tidak dapat dikembalikan lagi",
icon: "question",
showCancelButton: true,
confirmButtonText: "Ya, Hapus",
cancelButtonText: "Batal",
buttonsStyling: false,
customClass: {
confirmButton: "btn btn-error text-white",
cancelButton: "btn btn-link no-underline text-gray-500",
},
});
});
});
</script>