79 lines
3.5 KiB
JavaScript
79 lines
3.5 KiB
JavaScript
$('#zero-config').DataTable({
|
|
"dom": "<'dt--top-section'<'row'<'col-12 col-sm-6 d-flex justify-content-sm-start justify-content-center'l><'col-12 col-sm-6 d-flex justify-content-sm-end justify-content-center mt-sm-0 mt-3'f>>>" +
|
|
"<'table-responsive'tr>" +
|
|
"<'dt--bottom-section d-sm-flex justify-content-sm-between text-center'<'dt--pages-count mb-sm-0 mb-3'i><'dt--pagination'p>>",
|
|
"oLanguage": {
|
|
"oPaginate": { "sPrevious": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>', "sNext": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>' },
|
|
"sInfo": "Showing page _PAGE_ of _PAGES_",
|
|
"sSearch": '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>',
|
|
"sSearchPlaceholder": "Search...",
|
|
"sLengthMenu": "Results : _MENU_",
|
|
},
|
|
"stripeClasses": [],
|
|
"lengthMenu": [7, 10, 20, 50],
|
|
"pageLength": 10
|
|
});
|
|
|
|
|
|
$(document).ready(function() {
|
|
$(' <button><a class="extra-btn width-max-content" data-toggle="modal" data-target="#add_location_modal" href="">Add</a></button>')
|
|
.insertBefore("#zero-config_filter label");
|
|
});
|
|
|
|
$(".location_table").on("change", ".active_location", function () {
|
|
let base_url = url_path;
|
|
var status = $(this).prop("checked") == true ? 1 : 0;
|
|
var location_id = $(this).data("id");
|
|
$.ajax({
|
|
type: "GET",
|
|
dataType: "json",
|
|
url: base_url + '/change_location_status',
|
|
data: {
|
|
status: status,
|
|
location_id: location_id,
|
|
},
|
|
success: function (data) {
|
|
if (status == 1) {
|
|
toastr.options = {
|
|
"timeOut": 500
|
|
}
|
|
toastr.success("Status Activate successfully. !!");
|
|
} else {
|
|
toastr.error("Status Deactivate successfully. !!");
|
|
}
|
|
},
|
|
});
|
|
});
|
|
|
|
$(document).on("click", ".delete_location", function () {
|
|
var delete_id = $(this).data('id');
|
|
$('#delete_location_id').val(delete_id);
|
|
});
|
|
|
|
$(document).on("click", ".delete_location_button", function (e) {
|
|
e.preventDefault();
|
|
let base_url = url_path;
|
|
var delete_id = $('#delete_location_id').val();
|
|
$.ajaxSetup({
|
|
headers: {
|
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
|
},
|
|
});
|
|
$.ajax({
|
|
type: "DELETE",
|
|
url: base_url + "/delete_location/" + delete_id,
|
|
success: function (response) {
|
|
if (response.status == 200) {
|
|
toastr.success('Location Deleted Successfully');
|
|
setTimeout(function () {
|
|
window.location.href = base_url + "/manage_location";
|
|
}, 1000);
|
|
} else {
|
|
toastr.error("Something went wrong");
|
|
}
|
|
},
|
|
});
|
|
});
|
|
|
|
|