126 lines
3.8 KiB
JavaScript
126 lines
3.8 KiB
JavaScript
|
|
function verificaParte(){
|
|||
|
|
var denominacionProyecto=document.getElementById('denominacionProyecto').value;
|
|||
|
|
var nombreCliente=document.getElementById('nombreCliente').value;
|
|||
|
|
var textoAlert="";
|
|||
|
|
if(denominacionProyecto==""){
|
|||
|
|
textoAlert="Debe rellenar la denominaci<63>n del proyecto";
|
|||
|
|
document.getElementById('denominacionProyecto').style.backgroundColor="red";
|
|||
|
|
}
|
|||
|
|
if(nombreCliente==""){
|
|||
|
|
if(textoAlert=="")
|
|||
|
|
textoAlert="Debe rellenar el nombre del cliente";
|
|||
|
|
else
|
|||
|
|
textoAlert+=" y el nombre del cliente";
|
|||
|
|
document.getElementById('nombreCliente').style.backgroundColor="red";
|
|||
|
|
}
|
|||
|
|
if(textoAlert!=""){
|
|||
|
|
alert(textoAlert);
|
|||
|
|
return false;
|
|||
|
|
} else {
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
function submitformPermiso(action){
|
|||
|
|
// Miramos permiso a permiso para pedir el motivo
|
|||
|
|
recargaPermiso();
|
|||
|
|
var formulario=document.getElementById('vacaciones');
|
|||
|
|
var observaciones=document.getElementById('obsCambioEst');
|
|||
|
|
|
|||
|
|
var inputs=formulario.getElementsByTagName("input");
|
|||
|
|
var campobr=document.createElement("br");
|
|||
|
|
var checks=inputs.length;
|
|||
|
|
var todasObs=document.createElement("div");
|
|||
|
|
todasObs.id="todosObs";
|
|||
|
|
var letraPrimera="";
|
|||
|
|
if(action=="pedir")
|
|||
|
|
letraPrimera="d";
|
|||
|
|
else
|
|||
|
|
letraPrimera="a";
|
|||
|
|
for(i=0;i<checks;i++){
|
|||
|
|
if(inputs[i].type=="checkbox"){
|
|||
|
|
if(inputs[i].checked){
|
|||
|
|
//d2008-11-17
|
|||
|
|
if(inputs[i].name.substring(0,1)==letraPrimera){
|
|||
|
|
var dia = inputs[i].name.substring(inputs[i].name.lastIndexOf("-")+1,inputs[i].name.length);
|
|||
|
|
var mes = inputs[i].name.substring(inputs[i].name.indexOf("-")+1,inputs[i].name.lastIndexOf("-"));
|
|||
|
|
var anio = inputs[i].name.substring(1,inputs[i].name.indexOf("-"));
|
|||
|
|
var campoObs=document.createElement("input");
|
|||
|
|
campoObs.name="o"+anio+"-"+mes+"-"+dia;
|
|||
|
|
campoObs.id="o"+anio+"-"+mes+"-"+dia;
|
|||
|
|
|
|||
|
|
var campotxtinfoObs=document.createElement("div");
|
|||
|
|
campotxtinfoObs.id="txt"+anio+"-"+mes+"-"+dia;
|
|||
|
|
campotxtinfoObs.innerHTML="Observaci<63>n del permiso para el d<>a :"+dia+"/"+mes+"/"+anio;
|
|||
|
|
todasObs.appendChild(campotxtinfoObs);
|
|||
|
|
todasObs.appendChild(campoObs);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
var botonSolicitar = document.createElement("input");
|
|||
|
|
botonSolicitar.type="button";
|
|||
|
|
botonSolicitar.name="Solicitar Observacion";
|
|||
|
|
botonSolicitar.value="Solicitar";
|
|||
|
|
botonSolicitar.id="butonSolicitar";
|
|||
|
|
botonSolicitar.onclick=function(){
|
|||
|
|
submitform(action);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
var botonCancel = document.createElement("input");
|
|||
|
|
botonCancel.type="button";
|
|||
|
|
botonCancel.name="Cancelar";
|
|||
|
|
botonCancel.value="Cancelar";
|
|||
|
|
botonCancel.id="butonCancelar";
|
|||
|
|
botonCancel.onclick=function(){
|
|||
|
|
recargaPermiso();
|
|||
|
|
}
|
|||
|
|
todasObs.appendChild(campobr);
|
|||
|
|
todasObs.appendChild(botonSolicitar);
|
|||
|
|
todasObs.appendChild(botonCancel);
|
|||
|
|
|
|||
|
|
|
|||
|
|
observaciones.appendChild(todasObs);
|
|||
|
|
if(todasObs.getElementsByTagName("input").length == 2){
|
|||
|
|
recargaPermiso();
|
|||
|
|
alert("Escoja los dias");
|
|||
|
|
} else {
|
|||
|
|
observaciones.style.visibility="visible";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//submitform(action);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function recargaPermiso(){
|
|||
|
|
eliminaCapa("todosObs");
|
|||
|
|
document.getElementById('obsCambioEst').style.visibility="hidden";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function compruebaAusencia(){
|
|||
|
|
// Miramos parte a parte para comprobar si hay alguna A de ausencia
|
|||
|
|
// , si la hay comprobamos que el campo observaciones est<73> vacio.
|
|||
|
|
// Miramos permiso a permiso para pedir el motivo
|
|||
|
|
var formulario=document.getElementById('parteActividad');
|
|||
|
|
var inputs=formulario.getElementsByTagName("input");
|
|||
|
|
var checks=inputs.length;
|
|||
|
|
|
|||
|
|
var campoObservaciones=document.getElementById('observacionParte');
|
|||
|
|
if(campoObservaciones.value==""){
|
|||
|
|
var ausencia=false;
|
|||
|
|
for(i=0;i<checks;i++){
|
|||
|
|
if(inputs[i].type=="text"){
|
|||
|
|
if((inputs[i].value=="A") || (inputs[i].value=="a")){
|
|||
|
|
ausencia=true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if(ausencia){
|
|||
|
|
alert("Debe especificar el motivo de la ausencia en el campo obervaciones");
|
|||
|
|
return false;
|
|||
|
|
} else {
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} else{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|