File: /var/www/vhost/disk-apps/dev-telemedicina.teky.com.co/public/js/users/users.js
//filtro por hospitales
$("#select-center-filtro").change(function() {
valor = $(this).val();
$(location).attr("href", url + "/users/filter/hospital/" + valor);
});
$(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"]
});
});
$("#select-rol").change(function() {
if ($(this).val() == 3 || $(this).val() == 6) {
$("#dating_duration").attr('readonly', false);
$("#specialty_id").attr('disabled', false);
$("#medic_code").attr('readonly', false);
} else {
$("#dating_duration").val(0);
$("#dating_duration").attr('readonly', true);
$("#medic_code").attr('readonly', true);
$("#specialty_id").val(null);
$("#specialty_id").attr('disabled', true);
}
});
/**Activar/Desactivar Usuario usando switch*/
$(".chkUsers").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: "/users/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.users.update_ok'));
} else {
swal("Ok", Lang.get('messages.users.update_error'), "error");
}
}
});
});