<?php
  $page_title = 'Editar Responsable';
  require_once('../../includes/load.php');
  // Checkin What level user has permission to view this page
  page_require_level(4);
?>
<?php
  $responsable = find_by_id('responsableactivo',(int)$_GET['id']);
  if(!$responsable){
  $session->msg("d","Error: No se encontró id del responsable.");
  redirect('../lista_responsable/listado_responsable.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-edit"></span>
            <span> Editar</span>
         </strong>
        </div> 
 <!-- FORMULARIO PARA GUARDAR EL PROGRAMA-->
        <form  enctype="multipart/form-data" autocomplete="off" id="form" onSubmit="Edit()">
          <div class="panel-body">
            <div class="col-md-12">
        		<div class="card-header">
                  <strong>
                     <span> Responsable</span>
                  </strong> 
                </div>
                 <div class="card-body">
                 	<div class="form-group">
		              <div class="row">
		                    <div class="col-md-3">
		                      <label for="responsable" class="control-label">IdResponsable:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input class="form-control" id="responsable" name="responsable" value="<?php echo (int)$responsable['id'];?>" readonly>                                            
		                      </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="dni" class="control-label">DNI:</label>
		                      <div class="input-group">   
		                              <input class="form-control" id="dni" name="dni" value="<?php echo $responsable['DNIResponsableActivo'];?>" >                             
		                        </div>               
		                    </div>
                        <div class="col-md-3">
		                      <label for="categoria" class="control-label">Categoria:</label>
		                      <div class="input-group">   
		                              <select id="categoria" name="categoria" class="form-control">
		                                <?php   
																		  $consulta = $db->query("SELECT * FROM categoriaoperador");
																		  $idCat =$responsable['IdCategoriaOperador'];
																	        while ($Categoria = $db->fetch_array($consulta)) {
																	        $def='';
																	        if($Categoria['IdCategoriaOperador']==$idCat){
																	            $def='selected';
																	        }
																	    ?>
																			    <option value="<?php echo $Categoria['IdCategoriaOperador']?>" <?php echo $def?> ><?php echo $Categoria['NombreCategoriaOperador'] ?></option>
																			    <?php
																        }
																    ?>   
		                              </select>                             
		                        </div>               
		                    </div>
                        <div class="col-md-3">
		                      <label for="telefono" class="control-label">Telefono:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="telefono" name="telefono" class="form-control" value="<?php echo remove_junk($responsable['TelefonoResponsableActivo']); ?>">	                                                                        
		                        </div>               
		                    </div>	                	  
		                </div>
		               </div>

		               <div class="form-group">
		                <div class="row">
		                	<div class="col-md-3">
		                      <label for="nombre" class="control-label">Nombres:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input class="form-control" id="nombre" name="nombre" value="<?php echo remove_junk($responsable['NombreResponsableActivo']); ?>">                                             
		                      </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="direccion" class="control-label">Direccion:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="direccion" name="direccion" class="form-control" value="<?php echo remove_junk($responsable['DireccionResponsableActivo']); ?>">	                                                                        
		                        </div>               
		                    </div>
                        <div class="col-md-3">
		                      <label for="licencia" class="control-label">Lincencia:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="licencia" name="licencia" class="form-control" value="<?php echo remove_junk($responsable['NumeroLicenciaResponsableActivo']); ?>">	                                                                        
		                        </div>               
		                    </div>
                         <div class="col-md-3">
		                      <label for="estado" class="control-label">Estado:</label>
		                      <div class="input-group">   
	                              <select id="estado" name="estado" class="form-control">
	                              	<option value="Activo" <?php if ($responsable['EstadoMantenimientoInterno']=='Activo'){echo 'selected';} ?>>Activo</option>
					                				<option value="Inactivo" <?php if ($responsable['EstadoMantenimientoInterno']=='Inactivo'){echo 'selected';} ?>>Inactivo</option>
	                              </select>                             
		                        </div>               
		                    </div>  	
		                </div>
		              </div>
		              <div class="form-group">
		                <div class="row">
		                	<div class="col-md-3">
		                      <label for="apellido" class="control-label">Apellidos:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input class="form-control" id="apellido" name="apellido" value="<?php echo remove_junk($responsable['ApellidoResponsableActivo']); ?>">                                            
		                      </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="costo" class="control-label">Costo:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="costo" name="costo" class="form-control" placeholder="Costo x Hora" value="<?php echo remove_junk($responsable['CostoResponsableActivo']); ?>">                                      
		                        </div>               
		                    </div>
		                	  
		                    <div class="col-md-3">
		                      <label for="precio" class="control-label">Area:</label>
		                      <div class="input-group">    
		                              <select id="area" name="area" class="form-control">
		                                <?php   
																		  $consulta = $db->query("SELECT * FROM areagerenciaoperaciones");
																		  $idCat =$responsable['IdAreaGerenciaOperaciones'];
																	        while ($Categoria = $db->fetch_array($consulta)) {
																	        $def='';
																	        if($Categoria['IdAreaGerenciaOperaciones']==$idCat){
																	            $def='selected';
																	        }
																	    ?>
																			    <option value="<?php echo $Categoria['IdAreaGerenciaOperaciones']?>" <?php echo $def?> ><?php echo $Categoria['NombreAreaGerenciaOperaciones'] ?></option>
																			    <?php
																        }
																    ?>   
		                              </select>                           
		                        </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_responsable.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/edit_responsable.js"></script>


