<?php
  $page_title = 'Agregar Vehiculo';
  require_once('../../includes/load.php');
  // Checkin What level user has permission to view this page
  page_require_level(4);
?>
<?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> Mantenimiento</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> Vehiculo</span>
                  </strong> 
                </div>

                 <div class="card-body">
		              <div class="form-group">
		                <div class="row">
		                	<div class="col-md-3">
		                      <label for="placa" class="control-label">Placa:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="placa" name="placa" class="form-control">		
		                              <span class="input-group-btn">
			                               <button type="button" class="form-control"  id="buscar" class="form-control">
			                                   <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
			                                   <path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z" />
			                                   </svg>
			                                </button>
			                             </span>                                                                                                 
		                        </div>                 
		                    </div>		                  
		                    <div class="col-md-3">
		                      <label for="nombre" class="control-label">Nombre:</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">                                            
		                      </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="cod_patrimonial" class="control-label">Codigo Patrimonial:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="cod_patrimonial" name="cod_patrimonial" class="form-control" placeholder="Cp-PSP">                                           
		                      </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="marca" class="control-label">Marca:</label>
		                      <div class="input-group">   
		                              <input class="form-control" id="marca" name="marca">                             
		                        </div>               
		                    </div>
		                    
		                </div>
		               </div>

		               <div class="form-group">
		                <div class="row">
		                	  <div class="col-md-3">
		                      <label for="modelo" class="control-label">Modelo:</label>
		                      <div class="input-group">   
		                              <input class="form-control" id="modelo" name="modelo">                            
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="propietario" class="control-label">Propietario:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <select id="propietario" name="propietario" class="form-control">
		                                <?php   
																		  $consulta = $db->query("SELECT * FROM cliente");
																		    while ($row = $db->fetch_assoc($consulta)) {   
																		      $id = $row['IdCliente']; 
																		      $RazonSocial = $row['RazonSocial'];    
																		      echo "<option value='$id'>$RazonSocial</option>";
																		    }
																		?>
		                              </select> 
		                                                                        
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="color" class="control-label">Color:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="color" name="color" class="form-control">                                      
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="potencia" class="control-label">Potencia:</label>
		                      <div class="input-group">   
		                              <input type="text" id="potencia" name="potencia" class="form-control">                             
		                        </div>               
		                    </div>
		                </div>
		              </div>


		              <div class="form-group">
		                <div class="row">
		                	  <div class="col-md-3">
		                      <label for="cilindro" class="control-label">Clindro:</label>
		                      <div class="input-group">  
		                              <input type="text" id="cilindro" name="cilindro" class="form-control">                            
		                        </div>               
		                    </div>
		                		<div class="col-md-3">
		                      <label for="traccion" class="control-label">Traccion:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                             <input type="text" id="traccion" name="traccion" class="form-control">		                                                                        
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="accesorio" class="control-label">Accesorios:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="accesorio" name="accesorio" class="form-control">	                                                                        
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="anio_produccion" class="control-label">Año Produccion:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="anio_produccion" name="anio_produccion" class="form-control">                                      
		                        </div>               
		                    </div>  
		                </div>
		              </div>
              
		              <div class="form-group">
		                <div class="row">
		                	  <div class="col-md-3">
		                      <label for="anio_compra" class="control-label">Año Compra:</label>
		                      <div class="input-group">   
		                              <input type="text" id="anio_compra" name="anio_compra" class="form-control">                             
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="pre_compra" class="control-label">Precio Compra:</label>
		                      <div class="input-group">  
		                              <input type="text" id="pre_compra" name="pre_compra" class="form-control" placeholder="s/.">                            
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="combustible" class="control-label">Combustible:</label>
		                      <div class="input-group">   
		                              <select id="combustible" name="combustible" class="form-control">
		                                <?php   
																		  $consulta = $db->query("SELECT * FROM combustible");
																		    while ($row = $db->fetch_assoc($consulta)) {   
																		      $id = $row['IdCombustible']; 
																		      $NombreCombustible = $row['NombreCombustible'];    
																		      echo "<option value='$id'>$NombreCombustible</option>";
																		    }
																		?>
		                              </select>                              
		                        </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>  
		                              <select id="responsable" name="responsable" class="form-control">
		                                <?php   
																		  $consulta = $db->query("SELECT * FROM responsableactivo");
																		    while ($row = $db->fetch_assoc($consulta)) {   
																		      $id = $row['id']; 
																		      $NombreResponsableActivo = $row['NombreResponsableActivo'];
																		      $ApellidoResponsableActivo = $row['ApellidoResponsableActivo'];    
																		      echo "<option value='$id'>$NombreResponsableActivo $ApellidoResponsableActivo</option>";
																		    }
																		?>
		                              </select>                                      
		                        </div>               
		                    </div>
		                </div>
		               </div>

		               <div class="form-group">
		                <div class="row">
		                	<div class="col-md-3">
		                      <label for="estado" class="control-label">Estado:</label>
		                      <div class="input-group">   
		                              <select class="form-control" id="estado" name="estado">
		                              	<option id="1">Activo</option>
		                              	<option id="2">Inactivo</option>
		                              </select>                            
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="observacion" class="control-label">Observaciones:</label>
		                      <div class="input-group">  
		                              <input type="text" id="observacion" name="observacion" class="form-control">                            
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="transmision" class="control-label">Tansmision:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="transmision" name="transmision" class="form-control">	                                                                        
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="motor" class="control-label">Motor:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="motor" name="motor" class="form-control" placeholder="Serie Motor">                                      
		                        </div>               
		                    </div>                   
		                </div>
		              </div>
		              <div class="form-group">
		                <div class="row">
		                    <div class="col-md-3">
		                      <label for="chasis" class="control-label">Chasis:</label>
		                      <div class="input-group"> 
		                        <span class="input-group-addon">
		                          <i class="fi fi-sr-interlining"></i>
		                        </span>  
		                              <input type="text" id="chasis" name="chasis" class="form-control" placeholder="Serie de Chasis">                                      
		                        </div>               
		                    </div>
		                    <div class="col-md-3">
		                      <label for="compra" class="control-label">Compra:</label>
		                      <div class="input-group">  
		                              <input type="date" id="compra" name="compra" class="form-control" required>                            
		                        </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_vehiculo.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/vehiculo.js"></script>


