72 lines
1.7 KiB
JavaScript
Raw Normal View History

2024-06-23 17:02:56 +05:45
$('body').on('click', '.remove-item', function (e) {
e.preventDefault();
let url = $(this).data('link');
let id = $(this).data('id');
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: url,
type: 'DELETE',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
data: {
id: id
},
success: function (response) {
location.reload();
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
}
});
2024-06-13 21:02:05 +05:45
}
});
2024-06-23 17:02:56 +05:45
});
//initialize ckeditor
document.querySelectorAll('.ckeditor-classic').forEach(editor => {
ClassicEditor
.create(editor)
.catch(error => {
console.error(error);
});
});
// //initialize select2
// $('.dropify').dropify();
// //initialize select2
// $('.select2').select2();
// $('body').on('keyup', '.numeric', function () {
// this.value = this.value.replace(/[^0-9\.]/g, '');
// });
// $(".flatpickr-date").flatpickr({
// enableTime: false,
// dateFormat: "Y-m-d",
// altInput: true,
// altFormat: "Y-m-d",
// defaultDate: "",
// });
// $(".flatpickr-time").flatpickr({
// enableTime: true,
// noCalendar: false,
// dateFormat: "H:i",
// time_24hr: false,
// });