File: /var/www/vhost/disk-apps/demo-telemedicina.teky.com.co/public/js/insurances/insurances.js
$(document).ready(function() {
$("#example2").DataTable({
paging: true,
lengthChange: true,
searching: true,
ordering: true,
info: true,
autoWidth: true,
language: {
url: Lang.get('messages.datatable.url_language')
},
buttons: ["copyHtml5", "excelHtml5", "csvHtml5", "pdfHtml5"]
});
});
/**Activar/Desactivar usando switch*/
$(".chkInsurances").change(function() {
var estado;
var id = $(this).attr("data-id");
if (this.checked) {
estado = 1;
} else {
estado = 0;
}
var info = {
id: id,
estado: estado
};
$.ajax({
url: "/insurances/active",
type: "POST",
contentType: "application/json",
headers: {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
"Content-Type": "application/json"
},
data: JSON.stringify(info),
success: function(r) {
if (r[0]["respuesta"]) {
swal("Ok", Lang.get('messages.insurances.update_ok'));
} else {
swal("Ok", Lang.get('messages.insurances.error_update'), "error");
}
}
});
});