<?php
  $page_title = 'Agregar Programacion';
  require_once('../../includes/load.php');
  // Checkin What level user has permission to view this page
  page_require_level(5);
?>
<?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-plus"></span>
            <span>Aperturar Programa</span>
         </strong>
        </div> 
 <!-- FORMULARIO PARA GUARDAR EL PROGRAMA-->
        <form  enctype="multipart/form-data" autocomplete="off" id="form" onSubmit="validar()">
          <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-2">
		                      <label for="area" class="control-label">Area:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <select id="area" name="area" class="form-control">
		                                <?php   
																		  $consulta = $db->query("SELECT * FROM `areagerenciaoperaciones`");
																		    while ($row = $db->fetch_assoc($consulta)) {   
																		      $id = $row['IdAreaGerenciaOperaciones']; 
																		      $CodigoGO = $row['CodigoGO'];    
																		      echo "<option value='$id'>$CodigoGO</option>";
																		    }
																		?>
		                              </select> 
		                                                                        
		                        </div>               
		                    </div>
		                    <div class="col-md-2">
		                      <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>  
		                              <select id="destino" name="destino" class="form-control">
		                                <option>Mercado</option>
		                                <option>Camal</option>
		                              </select>                                            
		                        </div>               
		                    </div>
		                    <div class="col-md-2">
		                      <label for="ult_venta" class="control-label">Ultima Venta:</label>
		                      <div class="input-group">   
		                              <input type="date" id="ult_venta" name="ult_venta" class="form-control" required>                           
		                        </div>               
		                    </div>
		                    <div class="col-md-2">
		                      <label for="ter_recepcion" class="control-label">Termino de Recepción:</label>
		                      <div class="input-group">   
		                              <input type="date" id="ter_recepcion" name="ter_recepcion" class="form-control">                           
		                        </div>               
		                    </div>
		                    <div class="col-md-2">
		                      <label for="ter_limpieza" class="control-label">Termino Limpieza:</label>
		                      <div class="input-group">   
		                              <input type="date" id="ter_limpieza" name="ter_limpieza" class="form-control">                           
		                        </div>               
		                    </div>
		                    <div class="col-md-2">
		                      <label for="red_dragon" class="control-label">Red Dragon:</label>
		                      <div class="input-group">   
		                              <input type="date" id="red_dragon" name="red_dragon" class="form-control">                           
		                        </div>               
		                    </div>
		                </div>
		               </div>

		               <div class="form-group">
		                <div class="row">
		                  	<div class="col-md-2">
		                      <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>  
		                              <select id="campana" name="campana" class="form-control">
		                                <option>1</option>
		                                <option>2</option>
		                                <option>3</option>
		                                <option>4</option>
		                                <option>5</option>
		                                <option>6</option>
		                                <option>7</option>
		                              </select> 
		                                                                        
		                        </div>               
		                    </div>
		                    <div class="col-md-2">
		                      <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>  
		                              <select id="servicio" name="servicio" class="form-control">
		                                <?php   
																		  $consulta = $db->query("SELECT * FROM `tiposervicio`");
																		    while ($row = $db->fetch_assoc($consulta)) {   
																		      $id = $row['IdTipoServicio']; 
																		      $TSNombre = $row['TSNombre'];    
																		      echo "<option value='$id'>$TSNombre</option>";
																		    }
																		?>
		                              </select>                                            
		                        </div>               
		                    </div>
		                    <div class="col-md-2">
		                      <label for="ini_limpieza" class="control-label">Inicio de Limpieza:</label>
		                      <div class="input-group">  
		                              <input type="date" id="ini_limpieza" name="ini_limpieza" class="form-control" required>                            
		                        </div>               
		                    </div>
		                    <div class="col-md-2">
		                      <label for="ini_compost" class="control-label">Inicio Compost:</label>
		                      <div class="input-group">  
		                              <input type="date" id="ini_compost" name="ini_compost" class="form-control">                            
		                        </div>               
		                    </div>
		                    <div class="col-md-2">
		                      <label for="ini_tumbado" class="control-label">Inicio Tumbado:</label>
		                      <div class="input-group">  
		                              <input type="date" id="ini_tumbado" name="ini_tumbado" class="form-control">                            
		                        </div>               
		                    </div>
		                    <div class="col-md-2">
		                      <label for="ent_granja" class="control-label">Entrega Granja:</label>
		                      <div class="input-group">  
		                              <input type="date" id="ent_granja" name="ent_granja" class="form-control">                            
		                        </div>               
		                    </div>
		                </div>
		              </div>


		              <div class="form-group">
		                <div class="row">
		                  	<div class="col-md-2">
		                      <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>  
		                              <select id="granja" name="granja" class="form-control">
		                                <?php   
																		  $consulta = $db->query("SELECT * FROM `granja`");
																		    while ($row = $db->fetch_assoc($consulta)) {   
																		      $id = $row['IdGranja']; 
																		      $GNombre = $row['GNombre'];    
																		      echo "<option value='$id'>$GNombre</option>";
																		    }
																		?>
		                              </select> 
		                                                                        
		                        </div>               
		                    </div>
		                    <div class="col-md-2">
		                      <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 $user['name'];?>" readonly>                                         
		                        </div>               
		                    </div>
		                    <div class="col-md-2">
		                      <label for="ini_recepcion" class="control-label">Inicio de Recepción:</label>
		                      <div class="input-group">   
		                              <input type="date" id="ini_recepcion" name="ini_recepcion" class="form-control">                             
		                        </div>               
		                    </div>
		                    <div class="col-md-2">
		                      <label for="ter_compost" class="control-label">Termino Compost:</label>
		                      <div class="input-group">   
		                              <input type="date" id="ter_compost" name="ter_compost" class="form-control">                             
		                        </div>               
		                    </div>
		                    <div class="col-md-2">
		                      <label for="ter_tumbado" class="control-label">Termino Tumbado:</label>
		                      <div class="input-group">   
		                              <input type="date" id="ter_tumbado" name="ter_tumbado" class="form-control">                             
		                        </div>               
		                    </div>
		                    <div class="col-md-2">
		                      <label for="pollo" class="control-label">Pollo BB:</label>
		                      <div class="input-group">   
		                              <input type="date" id="pollo" name="pollo" class="form-control">                                            
		                        </div>
		                    </div>
		                </div>
		              </div>
              
		              <div class="form-group">
		                <div class="row">
		                  	<div class="col-md-2">
		                      <label for="galpones" class="control-label">Galpones:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <select id="galpones" name="galpones" class="form-control">
		                                <option>0</option>
		                                <option>1</option>
		                                <option>2</option>
		                                <option>3</option>
		                                <option>4</option>
		                                <option>5</option>
		                                <option>6</option>
		                                <option>7</option>
		                                <option>8</option>
		                                <option>9</option>
		                                <option>10</option>
		                                <option>11</option>
		                                <option>12</option>
		                                <option>13</option>
		                                <option>14</option>
		                                <option>15</option>
		                                <option>16</option>
		                                <option>17</option>
		                                <option>18</option>
		                              </select>
		                              <input type="text" name="anio" id="anio" value="<?php echo date("Y")?>" hidden> 
		                                                                        
		                      </div>               
		                    </div>
		                </div>
		               </div>
			               <div class="text-center">
	                     		 <button type="submit" class="btn btn-success"><i class="glyphicon glyphicon-floppy-disk"></i>Guardar</button>
	                     		  <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>


