<?php
  $page_title = 'Editar Programacion';
  require_once('../../includes/load.php');
  // Checkin What level user has permission to view this page
  page_require_level(5);
?>
<?php
  $programa = find_by_id('programa',(int)$_GET['id']);
  if(!$programa){
  $session->msg("d","Error: No se encontró id del programa.");
  redirect('programa.php');
}
?>
<?php include_once('../../layouts/header.php'); ?>
<div class="row">
  <div class="col-md-12">
    <?php echo display_msg($msg); ?>
  </div>
</div>
  <div class="row">
  <div class="col-md-16">
      <div class="panel panel-default">
        <div class="panel-heading">
          <strong>
            <span class="glyphicon glyphicon-info-sign"></span>
            <span>Visualizar Programa</span>
         </strong>
        </div> 
 <!-- FORMULARIO PARA GUARDAR EL PROGRAMA-->
        <form  enctype="multipart/form-data" autocomplete="off" id="form">
          <div class="panel-body">
            <div class="col-md-12">
        		<div class="card-header">
                  <strong>
                     <span>Programa</span>
                  </strong> 
                </div>

                 <div class="card-body">
                 	<div class="form-group">
		                <div class="row">
		                  	<div class="col-md-3">
		                      <label for="galpones" class="control-label">Programa:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                        <span class="form-control" ><?php echo (int)$programa['id'];?></span>                           	                                                                      
		                      </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="campana" class="control-label">Campaña:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <span class="form-control" ><?php echo $programa['Campana'];?></span>                                            
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="granja" class="control-label">Granja:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>   
	                              	<?php
													        $consulta = $db->query("SELECT g.GNombre FROM programa pr INNER JOIN granja g ON g.IdGranja  = {$programa['IdGranja']}");
													        $grnaja = $db->fetch_array($consulta);  									        
											            ?>
																	<span class="form-control" ><?php echo $grnaja['GNombre'];?></span>                                         
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="destino" class="control-label">Destino:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span> 
		                        <span class="form-control" ><?php echo $programa['TipoGranja'];?></span>                                           
		                        </div>               
		                    </div>
		                </div>
		               </div>


		              <div class="form-group">
		                <div class="row">
		                	<div class="col-md-3">
		                      <label for="servicio" class="control-label">Servicio:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
													   <?php
											        $consulta = $db->query("SELECT ts.TSNombre FROM programa pr INNER JOIN tiposervicio ts ON ts.IdTipoServicio = {$programa['IdTipoServicio']}");
											        $servicio = $db->fetch_array($consulta);  									        
									           ?>
															<span class="form-control" ><?php echo $servicio['TSNombre'];?></span>                               
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="responsable" class="control-label">Responsable:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="responsable" name="responsable" class="form-control" value="<?php echo $programa['Responsable'];?>" readonly>                                         
		                        </div>               
		                    </div>		                    
		                    <div class="col-md-3">
		                      <label for="ult_venta" class="control-label">Ultima Venta:</label>
		                      <div class="input-group">   
		                              <span class="form-control" ><?php echo remove_junk($programa['ProFechaUltimaVenta']);?></span>                           
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="ini_limpieza" class="control-label">Inicio de Limpieza:</label>
		                      <div class="input-group">  
		                           <span class="form-control" ><?php echo remove_junk($programa['ProFechaInicioLimpieza']);?></span>                            
		                      </div>               
		                    </div>
		                </div>
		               </div>

		               <div class="form-group">
		                <div class="row">
		                  	<div class="col-md-3">
		                      <label for="ini_recepcion" class="control-label">Inicio de Recepción:</label>
		                      <div class="input-group">   
		                          <span class="form-control" ><?php echo remove_junk($programa['ProFechaInicioRecepcion']);?></span>                            
		                      </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="ter_recepcion" class="control-label">Termino de Recepción:</label>
		                      <div class="input-group">    
		                              <span class="form-control" ><?php echo remove_junk($programa['ProFechaTerminoRecepcion']);?></span>                          
		                      </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="ini_compost" class="control-label">Inicio Compost:</label>
		                      <div class="input-group">  
		                              <span class="form-control" ><?php echo remove_junk($programa['ProFechaInicioCompost']);?></span>                            
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="ter_compost" class="control-label">Termino Compost:</label>
		                      <div class="input-group">    
		                              <span class="form-control" ><?php echo remove_junk($programa['ProFechaTerminoCompost']);?></span>                            
		                      </div>               
		                    </div>
		                </div>
		              </div>


		              <div class="form-group">
		                <div class="row">
		                  	 <div class="col-md-3">
		                      <label for="ter_limpieza" class="control-label">Termino Limpieza::</label>
		                      <div class="input-group">   
		                              <span class="form-control" ><?php echo remove_junk($programa['ProFechaTerminoLimpiezaInicial']);?></span>                           
		                        </div>               
		                    </div>
		                     <div class="col-md-3">
		                      <label for="ini_tumbado" class="control-label">Inicio Tumbado:</label>
		                      <div class="input-group">  
		                              <span class="form-control" ><?php echo remove_junk($programa['ProFechaInicioTumbadoCompost']);?></span>                           
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="ter_tumbado" class="control-label">Termino Tumbado:</label>
		                      <div class="input-group">   
		                              <span class="form-control" ><?php echo remove_junk($programa['ProFechaTerminoTumbadoCompost']);?></span>                            
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="red_dragon" class="control-label">Red Dragon:</label>
		                      <div class="input-group">   
		                              <span class="form-control" ><?php echo remove_junk($programa['ProFechaRedDragon']);?></span>                           
		                        </div>               
		                    </div>
		                </div>
		              </div>
		              <div class="form-group">
		                <div class="row">
		                    <div class="col-md-3">
		                      <label for="ent_granja" class="control-label">Entrega Granja:</label>
		                      <div class="input-group">  
		                              <span class="form-control" ><?php echo remove_junk($programa['ProFechaEntregaGranja']); ?></span>                          
		                        </div>               
		                    </div>  
		                    <div class="col-md-3">
		                      <label for="pollo" class="control-label">Pollo BB:</label>
		                      <div class="input-group">   
		                              <span class="form-control" ><?php echo remove_junk($programa['ProFechaIngresoPollosBB']);?></span>                                           
		                        </div>
		                    </div>
		                </div>
		              </div>
			               <div class="text-center">
	                     		 <a href="listado_programa.php" class="btn btn-primary"><i class="glyphicon glyphicon-th-list"></i>Listado</a>
	                       </div>
          			  </div>
	          	    </div>
	             </div>
	           </div>   
            </div>
          </div>           
        </form>
     </div>
    </div>
  </div>
</div>
</div>

<?php include_once('../../layouts/footer.php'); ?>
<script type="text/javascript" src="js/programa.js"></script>