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

$id = base64_decode($_GET['id']);

$consulta = "select  p.id
            		,ds_chave
            		,ds_valor
                    ,id_tipocontrato
                    ,ds_tipo_contrato
            	from erpc_gp_parametros p
            		inner join erpc_gp_tipos_contrato tc
            			on p.id_tipocontrato = tc.id
            	where p.id = $id and p.st_ativo = 1";

$parametro;
$result = mysqli_query($conexao, $consulta);
if(mysqli_num_rows($result)>0){
    $parametro = mysqli_fetch_array($result);
}


?>

<!-- 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">Dados Cadastrais</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_gp_parametros_ws.php">
  <div class=block>
    <div class=header>
      <h2>Incluir Parâmetro</h2>
    </div>


    <div class="content controls">

		<div class=form-row>
          <div class=col-md-2><label>ID</label></div>
          <div class=col-md-6><input readonly name="id" value="<?= sgcws_attr($parametro['id']); ?>" maxlength=11  class="validate[required] nouppercase"/> </div>
        </div>

        <div class=form-row>
          <div class=col-md-2><label>Chave</label></div>
          <div class=col-md-6><input name="ds_chave" value="<?= sgcws_attr($parametro['ds_chave']); ?>" maxlength=255 class="validate[required] nouppercase"/> </div>
        </div>
        
        <div class=form-row>
          <div class=col-md-2><label>Valor</label></div>
          <div class=col-md-6><input name="ds_valor" value="<?= sgcws_attr($parametro['ds_valor']); ?>" maxlength=255 class="validate[required] nouppercase"/> </div>
        </div>
        
        <div class="form-row">
          <div class="col-md-2"><label>Tipo de Contrato</label></div>
          <div class="col-md-2">
            <div class="input-group">
              <input requerid maxlength=11 value="<?= sgcws_attr($parametro['id_tipocontrato']); ?>"  type="number" id="id_tipo_contrato" name="id_tipo_contrato" class="form-control" />
    
            <div class="input-group-addon">
              <a href="erpc_gp_tipos_contrato_helper.php" class='input-helper' data-remote="false" data-toggle="modal" data-target="#helper-modal-div" data-value="input[name='id_tipo_contrato']" data-description="input[name='ds_tipo_contrato']" data-title="Selecione:">
              <span class="fa fa-search"></span></a>
             </div>
             </div>
             </div>
          <div class="col-md-4"><input readonly value="<?= sgcws_attr($parametro['ds_tipo_contrato']); ?>"  name="ds_tipo_contrato" id="ds_tipo_contrato"/></div>
      </div>

      </div>
  	  <!-- modal do helper -->
        <div class="row-clear">&nbsp;</div>
        <div class="modal modal-white modal-draggable fade" id="helper-modal-div" tabindex="-1" role="dialog" aria-labelledby="helper-modal-label" aria-hidden="true">
          <div class="modal-dialog modal-lg">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="helper-modal-label">Helper</h4>
              </div>
              <div class="modal-body">
                Aguarde ...
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal" id="modalCancel">Cancelar</button>
                <button type="button" class="btn btn-primary" data-dismiss="modal" id="modalOk" disabled="disabled">Selecionar</button>
              </div>
            </div>
          </div>
        </div>
      <!-- fim modal do helper -->

    <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="editar" onClick="$('#validate_custom').validationEngine('hide');" name="editar">Editar</button>
		    </div>
      </div>
    </div>

  </div>
</form>

  </div>

</div>


  <?php
include 'footer.php';
?>
