update
This commit is contained in:
69
resources/js/custom.js
Normal file
69
resources/js/custom.js
Normal file
@ -0,0 +1,69 @@
|
||||
|
||||
$('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();
|
||||
|
||||
$('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,
|
||||
});
|
Reference in New Issue
Block a user