[add] Enabling covered rol for aux

This commit is contained in:
Jose Pabl Domingo Aramburo Sanchez 2018-08-14 00:16:06 -06:00
parent 6ce90bd318
commit e9f80a9989

View File

@ -49,6 +49,7 @@ $(document).ready(function(){
$(this).data("id", datum.code);
loadEmployeeDataForWorkDays(datum.code);
validateEmployeeCanDoOtherRoles(datum.code);
$('#hidenEmployeeCodeForWorkDaysCode').val(datum.code); // For future reference
});
});
@ -120,6 +121,45 @@ function loadEmployeeDataForWorkDays(code){
error:function(x,e) {
let responseText = $.parseJSON(x["responseText"]);
if (x.status==0) {
$('#modalErrorInternetConnection').modal('show');
} else if(x.status==404) {
$('#modalError404').modal('show');
} else if(x.status==500) {
$('#modalServerResponseError').modal('show');
document.getElementById('modalResponseError').innerHTML = responseText['message'];
} else if(e=='parsererror') {
$('#modalErrorParsererror').modal('show');
} else if(e=='timeout'){
$('#modalErrorTimeout').modal('show');
} else {
$('#modalErrorOther').modal('show');
}
},
});
}
/**
* Based on the employee code determines their type to decide if
* they should be able to cover for other roles or not
*
* @param code string
*/
function validateEmployeeCanDoOtherRoles(code){
let baseUrl = getbaseUrl();
$.ajax({
url: baseUrl + '/api/employee/type/' + code,
type: 'GET',
dataType: 'json',
success:function(data){
if(data == 3){
$("#workDaysEmployeePerformedRol").prop('disabled', false);
}
},
error:function(x,e) {
let responseText = $.parseJSON(x["responseText"]);
if (x.status==0) {
$('#modalErrorInternetConnection').modal('show');
} else if(x.status==404) {