<?php
include 'header.php';
include 'erpc_vendedores_metas_toolbar.php';
include_once 'connect.php';

$dt_hoje = date("dmY");
$ar_meses = array(
    'Janeiro',
    'Fevereiro',
    'Março',
    'Abril',
    'Maio',
    'Junho',
    'Julho',
    'Agosto',
    'Setembro',
    'Outubro',
    'Novembro',
    'Dezembro'
);
?>

<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
  <li role="presentation" class="active"><a href="#form1" aria-controls="form1" role="tab" data-toggle="tab">Meta do Vendedor</a></li>
  <!--
  <li role="presentation"><a href="#form2" aria-controls="form2" role="tab" data-toggle="tab">Form #2</a></li>
  <li role="presentation"><a href="#form3" aria-controls="form3" role="tab" data-toggle="tab">Form #3</a></li>
  <li role="presentation"><a href="#form4" aria-controls="form4" role="tab" data-toggle="tab">Form #4</a></li>
  -->
</ul>

<!-- Tab panes -->
<div class="tab-content">
  <div role="tabpanel" class="tab-pane fade in active" id="form1">
<form id=validate_custom method="POST" action="erpc_vendedores_metas_ws.php">
  <div class="block">
        
    <div class="content controls">
      	
	  
	  <div class="form-row">
          <div class="col-md-2">Vendedor</div>
            <div class="col-md-2">
              <div class="input-group">
              <input type="text" required id="id_vendedor" name="id_vendedor" class="validate[required] form-control" value="" />
        
              <div class="input-group-addon">
                <a href="erpc_vendedores_helper.php" class='input-helper' data-remote="false" data-toggle="modal" data-target="#helper-modal-div" data-value="input[name='id_vendedor']" data-description="input[name='ds_vendedor']" data-title="Selecione:">
                <span class="fa fa-search"></span></a>
               </div>
               </div>
            </div>
          <div class="col-md-4"><input readonly name="ds_vendedor" id="ds_vendedor" value="" /></div>
        </div>
        
        <div class="form-row">
        	<div class="col-md-2">Mês:</div>					
        	<div class="col-md-2">
        		<select required name="nr_mes" required class="form-control">
        		<?php 
        		for($i=0; $i< sizeof($ar_meses); $i++){
        		    $j=$i+1;
        		      echo "<option value=$j>$ar_meses[$i]</option>";
        		}        		
        		?>

        		</select>
        	</div>
        </div>
        
        <div class="form-row">
        	<div class="col-md-2">Ano:</div>	
        	<div class="col-md-4">
        		<select required name="nr_ano" class="form-control">
            		<?php 
            		$anoInicial = date('Y');
            		foreach (range($anoInicial, $anoInicial+5) as $nr_ano) {
            		    if($nr_ano == date('Y')){
            		        echo "<option selected value='$nr_ano'>$nr_ano</option>";
            		    }else{
            		        echo "<option value='$nr_ano'>$nr_ano</option>";
            		    } 
            		}
            		?>
        		</select>
        	</div>
        </div> 
            	
    	<div class="form-row">
    		<div class="col-md-2">
    			<label>Meta</label>
    		</div>
    		<div class="col-md-4">
    			<input required class="form-control mask_money" name="vl_meta"></input>	
    		</div>
    	</div>	
	  
	  
	  

    </div>
    <div class=footer>
      <div class="side pull-right">
        <div class=btn-group> 
		<button class="btn btn-default" type="button" onClick="window.history.go(-1)" value="Voltar">Voltar</button>
              <button class="btn btn-success" type="submit" value="adicionar" onClick="$('#validate_custom').validationEngine('hide');" name="btn-add">Adicionar</button>
			  <!--botao antigo
		<button class="btn btn-default" type=button onClick="$('#validate_custom').validationEngine('hide');">Hide prompts</button>            <button class="btn btn-success" type=submit>Submit</button> 
		-->
		</div>
      </div>
    </div>
  </div>
</form>

  </div>
  
</div>

<?php
include 'inc/helper_modal_div.php';
include 'footer.php';
?>