feat: add alert delete
parent
e49e41fcde
commit
43e5a74d59
|
|
@ -100,7 +100,7 @@
|
|||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="/lib/datatables/dataTables.js"></script>
|
||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@
|
|||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="/lib/datatables/dataTables.js"></script>
|
||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@
|
|||
</div>
|
||||
|
||||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
<script src="/lib/datatables/dataTables.js"></script>
|
||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/tom-select@2.2.2/dist/css/tom-select.css" rel="stylesheet">
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
</div>
|
||||
|
||||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
<script src="/lib/datatables/dataTables.js"></script>
|
||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@
|
|||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="/lib/datatables/dataTables.js"></script>
|
||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/tom-select@2.2.2/dist/css/tom-select.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/tom-select@2.2.2/dist/js/tom-select.complete.min.js"></script>
|
||||
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@
|
|||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="/lib/datatables/dataTables.js"></script>
|
||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/tom-select@2.2.2/dist/css/tom-select.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/tom-select@2.2.2/dist/js/tom-select.complete.min.js"></script>
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@
|
|||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="/lib/datatables/dataTables.js"></script>
|
||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
|
|
|||
|
|
@ -213,6 +213,7 @@
|
|||
|
||||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="/lib/datatables/dataTables.js"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||
<script type="text/javascript">
|
||||
var table;
|
||||
|
|
@ -394,6 +395,41 @@
|
|||
modal_edit.showModal();
|
||||
});
|
||||
|
||||
// Button Delete
|
||||
table.on("click", ".btn-delete-edukasi", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
let rowData = table.row($(this).closest('tr')).data();
|
||||
|
||||
Swal.fire({
|
||||
title: 'Apakah Anda yakin?',
|
||||
text: "Data yang dihapus tidak dapat dikembalikan!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#ef4444',
|
||||
cancelButtonColor: '#6b7280',
|
||||
confirmButtonText: 'Ya, Hapus!',
|
||||
cancelButtonText: 'Batal'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: '@Url.Action("Delete", "Faq")',
|
||||
type: 'POST',
|
||||
data: { id: rowData.id },
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
showToast('Edukasi berhasil dihapus!', 'Berhasil! Edukasi telah berhasil dihapus.');
|
||||
table.ajax.reload();
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
showToast('Gagal!', 'Terjadi kesalahan saat menghapus data.');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Button Detail
|
||||
table.on("click", ".btn-detail-edukasi", function (e) {
|
||||
e.preventDefault();
|
||||
|
|
|
|||
|
|
@ -62,12 +62,12 @@
|
|||
<h3 class="text-lg font-bold mb-4">Tambah FAQ</h3>
|
||||
<form id="form_tambah">
|
||||
<div class="space-y-4">
|
||||
<fieldset class="fieldset">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend">Pertanyaan <span class="text-red-500">*</span></legend>
|
||||
<textarea name="Pertanyaan" class="textarea textarea-bordered w-full h-32"
|
||||
placeholder="Masukkan pertanyaan" required></textarea>
|
||||
</fieldset>
|
||||
<fieldset class="fieldset">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend">Jawaban <span class="text-red-500">*</span></legend>
|
||||
<textarea name="Jawaban" class="textarea textarea-bordered w-full h-32"
|
||||
placeholder="Masukkan jawaban" required></textarea>
|
||||
|
|
@ -98,12 +98,12 @@
|
|||
<form id="form_edit">
|
||||
<input type="hidden" id="edit_id" name="Id">
|
||||
<div class="space-y-4">
|
||||
<fieldset class="fieldset">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend">Pertanyaan <span class="text-red-500">*</span></legend>
|
||||
<textarea id="edit_pertanyaan" name="Pertanyaan" class="textarea textarea-bordered w-full h-32"
|
||||
placeholder="Masukkan pertanyaan" required></textarea>
|
||||
</fieldset>
|
||||
<fieldset class="fieldset">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend">Jawaban <span class="text-red-500">*</span></legend>
|
||||
<textarea id="edit_jawaban" name="Jawaban" class="textarea textarea-bordered w-full h-32"
|
||||
placeholder="Masukkan jawaban" required></textarea>
|
||||
|
|
@ -160,6 +160,7 @@
|
|||
|
||||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="/lib/datatables/dataTables.js"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||
<script type="text/javascript">
|
||||
var table;
|
||||
|
|
@ -281,6 +282,40 @@
|
|||
modal_edit.showModal();
|
||||
});
|
||||
|
||||
table.on("click", ".btn-delete-faq", function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
let rowData = table.row($(this).closest('tr')).data();
|
||||
|
||||
Swal.fire({
|
||||
title: 'Apakah Anda yakin?',
|
||||
text: "Data yang dihapus tidak dapat dikembalikan!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#ef4444',
|
||||
cancelButtonColor: '#6b7280',
|
||||
confirmButtonText: 'Ya, Hapus!',
|
||||
cancelButtonText: 'Batal'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: '@Url.Action("Delete", "Faq")',
|
||||
type: 'POST',
|
||||
data: { id: rowData.id },
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
showToast('FAQ berhasil dihapus!', 'Berhasil! FAQ telah berhasil dihapus.');
|
||||
table.ajax.reload();
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
showToast('Gagal!', 'Terjadi kesalahan saat menghapus data.');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Button Detail
|
||||
table.on("click", ".btn-detail-faq", function (e) {
|
||||
e.preventDefault();
|
||||
|
|
@ -296,7 +331,7 @@
|
|||
modal_detail.showModal();
|
||||
});
|
||||
|
||||
// Edit from
|
||||
// Edit from detail
|
||||
$('#btn_edit_from_detail').on('click', function () {
|
||||
let rowData = $(this).data('rowData');
|
||||
|
||||
|
|
@ -308,6 +343,5 @@
|
|||
|
||||
modal_edit.showModal();
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
@ -172,7 +172,7 @@
|
|||
</div>
|
||||
|
||||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
<script src="/lib/datatables/dataTables.js"></script>
|
||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/tom-select@2.2.2/dist/css/tom-select.css" rel="stylesheet">
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@
|
|||
</div>
|
||||
|
||||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@
|
|||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="/lib/datatables/dataTables.js"></script>
|
||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css" rel="stylesheet">
|
||||
|
||||
<script>
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@
|
|||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const form = document.getElementById('createAlatPengumpulForm');
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@
|
|||
</template>
|
||||
|
||||
@section Scripts {
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
|
||||
<script>
|
||||
(() => {
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@
|
|||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const form = document.getElementById('editAlatPengumpulForm');
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="/lib/datatables/dataTables.js"></script>
|
||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@
|
|||
</dialog>
|
||||
|
||||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@
|
|||
</div>
|
||||
|
||||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
</dialog>
|
||||
|
||||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@
|
|||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="/lib/datatables/dataTables.js"></script>
|
||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css" rel="stylesheet">
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
</div>
|
||||
|
||||
<script src="/lib/jquery/jquery-3.7.1.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<script src="/lib/sweetalert2/sweetalert2-11.26.4.js"></script>
|
||||
<script src="/lib/datatables/dataTables.js"></script>
|
||||
<script src="/plugins/datatables/dataTables.tailwindcss.js"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/tom-select@2.2.2/dist/css/tom-select.css" rel="stylesheet">
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue