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

if(isset($_GET['idedit'])){
    $id = base64_decode($_GET['idedit']);
}elseif(isset($_GET['idrmv'])){
    $id = base64_decode($_GET['idrmv']);
}

$sql = "select * from erpc_contabilidades where id = $id";
$result = mysqli_query($conexao, $sql) or die($conexao);
if(mysqli_num_rows($result) > 0){
    while($row = mysqli_fetch_assoc($result)){
        $ds_contabilidade = $row['ds_contabilidade'];
        $ds_telefone = $row['ds_telefone'];
        $ds_email = $row['ds_email'];
        $ds_texto = $row['ds_msg_email_xml'];
    }  
}


?>

<!-- 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>
</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_contabilidades_ws.php">
  <div class=block>
    <div class=header>
      <!--h2>Incluir Banco</h2-->
    </div>

    <div class="content controls nouppercase">
      <div class=form-row>
        <div class=col-md-2>ID da Contabilidade:</div>
        <div class=col-md-9> <input type=text readonly required name="id_contabilidade" value="<?=$id; ?>" class="form-control" /> </div>
      </div>
      <div class=form-row>
        <div class=col-md-2>Nome da Contabilidade:</div>
        <div class=col-md-9> <input type=text <? if(isset($_GET['idrmv'])){ echo "readonly"; } ?> required name="ds_contabilidade" value="<?=$ds_contabilidade; ?>" class="form-control nouppercase" /> </div>
      </div>
	  <div class=form-row>
        <div class=col-md-2>Telefone:</div>
        <div class=col-md-9> <input type=text <? if(isset($_GET['idrmv'])){ echo "readonly"; } ?> required name="ds_telefone" value="<?=$ds_telefone; ?>" class="form-control" /> </div>
      </div>
	  <div class=form-row>
        <div class=col-md-2>E-mail:</div>
        <div class=col-md-9> <input type=text <? if(isset($_GET['idrmv'])){ echo "readonly"; } ?> required name="ds_email" value="<?=$ds_email; ?>" class="form-control nouppercase" /> </div>
      </div>
      <div class=form-row>
        <div class=col-md-2>Texto do e-mail para envio do XML:</div>
        <div class=col-md-9> <input required type=text <? if(isset($_GET['idrmv'])){ echo "readonly"; } ?> name="ds_texto" value="<?=$ds_texto; ?>" class="form-control nouppercase" /> </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>
        <? if(isset($_GET['idedit'])){ ?>
            <button class="btn btn-success" type="submit" value="editar" onClick="$('#validate_custom').validationEngine('hide');" name="editar">Editar</button>
        <? }else{ ?>
            <button class="btn btn-warning" type="submit" value="remover" onClick="$('#validate_custom').validationEngine('hide');" name="remover">Excluir</button>
        <? } ?>
        </div>
      </div>
    </div>
  </div>
</form>

  </div>
  
</div>


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