<?php
  $page_title = 'EDITAR VEHICULO';
  require_once('../../includes/load.php');
  // Checkin What level user has permission to view this page
  page_require_level(4);
?>
<?php
  $vehiculo = find_by_id('vehiculo',(int)$_GET['id']);
  if(!$vehiculo){
  $session->msg("d","Error: No se encontró id del vehiculo.");
  redirect('listado_vehiculo.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">
 <!-- FORMULARIO PARA GUARDAR EL PROGRAMA-->
        <form  enctype="multipart/form-data" autocomplete="off" id="form" onSubmit="Edit()">
         <div class="container pt-1 mt-1 animated fadeIn" >
					    <div class="row pt-4">
					      <div class="col-12 mb-3">
					        <p class="h1 text-center text-primary font-weight-bold"> Registrar Vehiculos <i class="fas fa-user-alt"></i></p>
					      </div>
					    </div> 
					    <div class="row"> 
					      <div class="col-12">
					        <p class="h3 text-primary">Datos Generales <i class="fas fa-user-circle"></i></p>
					      </div>
					      <div class="col-12 col-lg-6"> 
					        <p class="text-primary mb-1">MARCA DEL VEHICULO</p>
					        <div class="input-group mb-3"> 
					          <div class="input-group-prepend">
					            <span class="input-group-text"><i class="fas fa-car-side"></i></span>
					          </div>
					          <input  type="hidden" id="id" name="id" class="form-control is-requerido" required value="<?php echo $vehiculo['id']?>">
					          <input maxlength="20"  placeholder="Nombre" type="text" id="marca" name="marca" class="form-control is-requerido" required value="<?php echo $vehiculo['NOMB_VEHIC']?>">
					             
					        </div>
					      </div>        
					    </div> 
					    <div class="row">
					      <div class="col-12 col-lg-6">
					        <p class="text-primary mb-1">MODELO DEL VEHICULO</p>
					        <div class="input-group mb-3">
					          <div class="input-group-prepend">
					            <span class="input-group-text"><i class="fas fa-car-side"></i></span>
					          </div>
					          <input maxlength="100"  placeholder="Modelo" type="text" id="modelo" name="modelo" class="form-control is-requerido" required value="<?php echo $vehiculo['MODELO_VEHIC']?>">
					        </div>
					      </div>
					      
					      
					      <div class="col-12 col-lg-6">
					        <p class="text-primary mb-1">PLACA</p>
					        <div class="input-group mb-3">
					          <div class="input-group-prepend">
					            <span class="input-group-text"><i class="fas fa-id-card"></i></span>
					          </div>
					          <input  maxlength="6" type="text" id="placa" name="placa" class="form-control is-requerido" placeholder="Numero de Placa" required value="<?php echo $vehiculo['PLACA']?>">
					        </div>
					      </div>

					      <div class="col-12 col-lg-6">
					        <p class="text-primary mb-1">AÑO</p>
					        <div class="input-group mb-3">
					          <div class="input-group-prepend">
					            <span class="input-group-text"><i class="fas fa-id-card"></i></span>
					          </div>
					          <input  maxlength="6" type="text" id="anio" name="anio" class="form-control is-requerido" placeholder="Año del vehiculo" required value="<?php echo $vehiculo['anio']?>">
					        </div>
					      </div>

					      <div class="col-12 col-lg-6">
					        <p class="text-primary mb-1">NUMERO DE MOTOR</p>
					        <div class="input-group mb-3">
					          <div class="input-group-prepend">
					            <span class="input-group-text"><i class="fas fa-id-card"></i></span>
					          </div>
					          <input  maxlength="6" type="text" id="motor" name="motor" class="form-control is-requerido" placeholder="Numero de motor" required value="<?php echo $vehiculo['num_motor']?>">
					        </div>
					      </div>

					      <div class="col-12 col-lg-6">
					        <p class="text-primary mb-1">PARAMETRO DE MANTENIMIENTO PREVENTIVO / KM</p>
					        <div class="input-group mb-3">
					          <div class="input-group-prepend">
					            <span class="input-group-text"><i class="fas fa-id-card"></i></span>
					          </div>
					          <input  maxlength="6" type="text" id="parametro" name="parametro" class="form-control is-requerido" placeholder="Parametro de mtto preventivo / km" required value="<?php echo $vehiculo['mtto_prevkm']?>">
					        </div>
					      </div>

					      <div class="col-12 col-lg-6">
					        <p class="text-primary mb-1">UTILIZACION MES PROPIA / KM</p>
					        <div class="input-group mb-3">
					          <div class="input-group-prepend">
					            <span class="input-group-text"><i class="fas fa-id-card"></i></span>
					          </div>
					          <input  maxlength="6" type="text" id="utilizacion" name="utilizacion" class="form-control is-requerido" placeholder="Utilizacion mes propia / km" required value="<?php echo $vehiculo['mes_propiokm']?>"> 
					        </div>
					      </div>

					      <div class="col-12 col-lg-6">
					        <p class="text-primary mb-1">RENDIMIENTO DE COMBUSTIBLE / KM</p>
					        <div class="input-group mb-3">
					          <div class="input-group-prepend">
					            <span class="input-group-text"><i class="fas fa-id-card"></i></span>
					          </div>
					          <input  maxlength="6" type="text" id="rendimiento" name="rendimiento" class="form-control is-requerido" placeholder="Rendimiento de combustible" required value="<?php echo $vehiculo['rend_combkm']?>">
					        </div>
					      </div>


					      <div class="col-12 col-lg-6">
					        <p class="text-primary mb-1">CODIGO DE ACTIVO</p>
					        <div class="input-group mb-3">
					          <div class="input-group-prepend">
					            <span class="input-group-text"><i class="fas fa-file-code"></i></span>
					          </div>
					          <input  maxlength="7" type="text" id="codigo" name="codigo" class="form-control is-requerido" placeholder="Codigo" required value="<?php echo $vehiculo['COD_ACTIVO']?>">
					        </div>
					      </div>
					      
					      <div class="col-12 col-lg-6"> 
					        <p class="text-primary mb-1">Estado</p>
					        <div class="input-group mb-3">
					          <div class="input-group-prepend">
					            <label class="input-group-text" for="selectTipo"><i class="fas fa-user-cog"></i></label>
					          </div> 
					          <select class="custom-select is-requerido" id="activo" name="activo" required>
					            <option value="1" <?php if ($vehiculo['ESTADO']=='1'){echo 'selected';} ?>>ACTIVO</option>
					            <option value="2" <?php if ($vehiculo['ESTADO']=='2'){echo 'selected';} ?>>NO ACTIVO</option>

					          </select>
					        </div>
					      </div>
					    </div>    
					    <div class="row mb-4">
					      <div class="col-12">
					        <button class="btn btn-block btn-primary" id="actualizar" name="actualizar">Actualizar Vehiculo</button>
					      </div>
					    </div>
					  </div>
        </form>
     </div>
    </div>
  </div>
</div>
</div>


 

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


