<?php 

    $fecha_actual = date("d/m/Y",time());

	use App\Libraries\ejLib;
	$var = ejLib::getInstance();
	$soapclient = $var->getWs();
	$wsClave = $var->get_wsClave();
?>

<link rel="stylesheet" href="css/smoothness.datepick.css">
<link rel="stylesheet" href="css/jquery.datepick.css">
<script src="js/jquery.datepick.js"></script>
<script src="js/jquery.datepick-es.js"></script>
<style type="text/css">

	td {border: 1px #DDD solid; padding: 5px; cursor: pointer;}
	.selected {
    background-color: #efefef;
    
    }


</style>	

<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal">&times;</button>
    <h4 class="modal-title text-center">Vacunas a programar</h4>
  
</div>
<div class="modal-body" id="mdlVacunacion" name="mdlVacunacion">
    <div class="row">
         
        <input type="hidden" name="h_id_cita" id="h_id_cita" value="{{$id_cita}}">
         
    	<input type="hidden" name="h_fAct" id="h_fAct" value="{{$fecha_actual}}">
    	<input type="hidden" name="h_cve_pac" id="h_cve_pac" value="{{$result->respuesta[0]->clave_pac}}">
		<div class="col-sm-6">
        	<div class="input-group input-group-sm">
                <span class="input-group-addon" id="sizing-addon3" style="background: #eee; font-weight: bold;">Seleccionar Vacuna: </span>
                 {!! $var->getView('Catalogos\VistasController@vCat_VacunasPaciente','clave_pac= '.$result->respuesta[0]->clave_pac); !!}
	       </div>
		</div>

        <div class="col-sm-6" id="cntOtrasVacunas" name="cntOtrasVacunas">
            <div class="input-group input-group-sm">
                <span class="input-group-addon" id="sizing-addon3" style="background: #eee; font-weight: bold;">Especifique: </span>
                <input type="text" id="txtOtraVacuna" name="txtOtraVacuna" class="form-control" placeholder="[a-z 1-9]" title="Proporciona el nombre de la otra vacuna aplicada" value="" width="100%" height="100%">
            </div>
        </div>
    	

 
        <div class="col-sm-12">
            <div class="table-responsive-md">
                <table class="table" id="tblModalVacunasPaciente" name="tblModalVacunasPaciente">
                    <thead>
                    <tr>
                        <th>Vacuna</th>
                        <th>Enfermedades que previene</th>
                        <th>Dosis</th>                        
                        <th>Fecha</th>
                                          
                    </tr>
                    </thead>
                        
                        @foreach($result->respuesta as $vacunasAgregadasPaciente)
                            <tr class="vacunasAsignadas" 
                                data-vacuna="{{$vacunasAgregadasPaciente->vacuna}}" 
                                data-id_vacuna="{{$vacunasAgregadasPaciente->id_vacuna}}" 
                                data-fecha="{{$vacunasAgregadasPaciente->fecha}}" 
                                data-clave_pac="{{$vacunasAgregadasPaciente->clave_pac}}" >

                                <td>{{utf8_decode($vacunasAgregadasPaciente->vacuna)}}</td>
                                <td>{{utf8_decode($vacunasAgregadasPaciente->enfer_prev)}}</td>
                                <td>{{utf8_decode($vacunasAgregadasPaciente->dosis)}}</td>
                                @if($vacunasAgregadasPaciente->editable ==0)
                                    <td>{{$vacunasAgregadasPaciente->fecha}}</td>
                                @else     
                                <td data-id_vacuna="{{$vacunasAgregadasPaciente->id_vacuna}}"><input type="text" name="inpFechaVac" id="inpFechaVac" value="{{$vacunasAgregadasPaciente->fecha}}" /></td>  
                                @endif                           
                          
                            </tr>
                        @endforeach
                        
                       

                    </table>
                </div>
            </div>
    </div>
    <div class="modal-footer">
    	 <div id="testVac" name="testVac" style="width: 100% !important; margin-top: 20px; margin-left: 20px; margin-right: 20px;"></div>
        <p class="text-center">
            <button type="button" class="btn btn-danger" data-dismiss="modal"><span class="fa fa-window-close-o" aria-hidden="true"></span> Cerrar</button>
            <button type="button" class="btn btn-primary" id="cmdRegistrarVac" name="cmdRegistrarVac"><span class="fa fa-plus-square" aria-hidden="true"></span> Agregar</button>   
            <button type="button" class="btn btn-danger"  id="cmdQuitarVac" name="cmdQuitarVac"><span class="fa fa-times" aria-hidden="true"></span> Quitar</button>
            <button type="button" class="btn btn-success" id="cmdActualizarVac" name="cmdActualizarVac" ><span class="fa fa-refresh" aria-hidden="true" ></span> Actualizar</button> 
        </p>
    </div>
</div>

<script type="text/javascript">
    $(document).ready(function(){   
        $('#cmdActualizarVac').prop('disabled', true);
        $('#cntOtrasVacunas').addClass('hidden');
        function highlight(e) {
		    if (selected[0]) selected[0].className = '';
		    e.target.parentNode.className = 'selected';
		}

		var table = document.getElementById('tblModalVacunasPaciente'),
		    selected = table.getElementsByClassName('selected');
		table.onclick = highlight;
      
     });

    $(document).on('focus', '#inpFechaVac', function () {  
         $('#cmdActualizarVac').prop('disabled', false);
    });
  

 
   

     
  

	
</script>

