68 lines
1.6 KiB
JavaScript
68 lines
1.6 KiB
JavaScript
|
|
$('body').on('click', '.remove-item-btn', 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);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
//initialize ckeditor
|
|
document.querySelectorAll('.ckeditor-classic').forEach(editor => {
|
|
ClassicEditor
|
|
.create(editor)
|
|
.catch(error => {
|
|
console.error(error);
|
|
});
|
|
|
|
});
|
|
|
|
//initialize select2
|
|
$('.dropify').dropify();
|
|
|
|
//initialize select2
|
|
$('.select2').select2();
|
|
|
|
|
|
|
|
$(".flatpickr-date").flatpickr({
|
|
enableTime: false,
|
|
dateFormat: "Y-m-d",
|
|
minDate: "today",
|
|
altInput: true,
|
|
altFormat: "Y-m-d",
|
|
// defaultDate: "today",
|
|
});
|
|
|
|
$(".flatpickr-time").flatpickr({
|
|
enableTime: true,
|
|
noCalendar: false,
|
|
dateFormat: "H:i",
|
|
time_24hr: false,
|
|
}); |