//BUSQUEDA DE TABSIGVIT
var contenedorTABSIGVIT = null;
var panelTABSIGVIT = null, panelTABCATRUT = null;
var GridStoreTABSIGVIT = null, gridEjercicios = null;
var currentStrId = "";

function TABSIGVIT_Constructor(){
	
	strEjercicioForMsg = "";
	//var cuerpo = Ext.getCmp('objdivRegistroDiario');
	//cuerpo.setTitle("Expediente de " + strClienteSeleccionado);
		
	idTab = 'TABSIGVIT';

	var txtBoton = "";

	var sHeight = '80%';
	var sHeightContenedor = 740;
		
	panelTABSIGVIT = new Ext.Panel({
						width:'100%',
						height: 'auto',
						autoScroll:false,
						disabled: false
						
	});
		
	contenedorTABSIGVIT = new Ext.FormPanel({
		labelAlign: 'top',
        labelWidth: 75,
        frame:true,
		bodyStyle:'padding:5px 5px 0',
        width: '100%',
		height:  'auto',
		autoScroll:true,
        items: [ panelTABSIGVIT ]
    });
	
	$("#divSignosVitales").empty();
	
	cargarPanelTABSIGVIT();
	
}
	  
function cargarPanelTABSIGVIT(){
	
	$.post("vistas/tabSignosVitales.php", function(data){
		
		$("#divSignosVitales").html(data);
		
	    getPendientesTomarSigVit();
		
	});
}

//var strIdConsulta = "";
function getPendientesTomarSigVit(){
	console.log("\n\n getPendientesTomarSigVit");
    
    var strUrl = "data/dataConsultas.php?rnd="+ Math.random();
    
    var dataObject = { method: 'getConsultasPendientes'
    		 , intCaso: 1
    		 , intMedico: (objUsuario.id)
    };
    
    $.post(strUrl, dataObject, function(dataNew){
    	//console.log("dataNew: "+ dataNew);
    
    	if(dataNew!=""){

			var data = $.parseJSON(dataNew);
			var arrItems = data.Items;
		 	
		 	var strItems = "";
		 	for(var i=0; i<arrItems.length; i++){
                
                var strIdConsulta = arrItems[i].strIdConsulta , strBg = "#5c84de", strColor = "#ffffff";
                
                var clsItemConsulta = "";
                
                if( (strIdConsultaSel==="" && i==0) || (strIdConsulta === strIdConsultaSel) ){
                    //strBg = "#ffffff";
                    //strColor = "#5c84de";
                    clsItemConsulta = "clsItemConsultaSel";
                }
                
		 		strItems += "<div id='divConsulta_"+ strIdConsulta +"' style='width: 100%; padding: 10px 0px 10px 0px; font-size: 16px; border: none;' class='clsItemConsulta "+ clsItemConsulta +"'>";
			 		strItems += "<a href='javascript: iraExpediente("+ arrItems[i].intCliente +");' >";
			 		
			 		strItems += arrItems[i].strCliente;
			 		
			 		strItems += "      ";
			 		
			 		strItems += arrItems[i].datFecha;
			 		
			 		strItems += "</a>"; //style='color: "+ strColor +";'
		 		strItems += "</div>";

		 	}

		 	$("#divGridMonitorVisitas").html( strItems );
		    

    	}
    });
    
}


