<?php
  $modulo = 'cursos-inscricoes';
?>
<div class="row-fluid">
  <div class="span12 btn-inverse div-top-borded">
    Ficha de inscrição
    <a href="<?=$this->linkTo($modulo, "list", array('r'=>$this->category->id));?>" class="btn btn-small btn-info">&laquo; Voltar</a>
    <!-- <a href="<?=$this->linkTo($modulo, "new", array('r'=>$this->category->id));?>" class="btn btn-small btn-primary">Novo »</a> -->

  </div>
</div>
<div class="row-fluid box">
  <form class="span12 well pampa_form" onsubmit="SubmitForm()" action="<?=$this->linkTo($modulo, "update");?>" method="post" enctype="multipart/form-data">
    <h3>Dados do usuário</h3>
    <div class="clearfix">
      
<div class="control-group" style="float: left;margin-right: 20px;">
  <strong class="control-label" for="page-label" >Usuário: </strong>
  <div class="controls"><span><?=$this->user->firstname?></span></div>
</div>
<div class="control-group" style="float: left;margin-right: 20px;">
  <strong class="control-label" for="page-label" >CPF: </strong>
  <div class="controls"><span><?=$this->user->username?></span></div>
</div>
<div class="control-group" style="float: left;margin-right: 20px;">
  <strong class="control-label" for="page-label" >Email: </strong>
  <div class="controls"><span><?=$this->user->email?></span></div>
</div>
<div class="control-group" style="float: left;margin-right: 20px;">
  <strong class="control-label" for="page-label" >Telefone: </strong>
  <div class="controls"><span><?=$this->user->telefone?></span></div>
</div>
<div class="control-group" style="float: left;margin-right: 20px;">
  <strong class="control-label" for="page-label" >Celular: </strong>
  <div class="controls"><span><?=$this->user->celular?></span></div>
</div>
<div class="control-group" style="float: left;margin-right: 20px;">
  <strong class="control-label" for="page-label" >Data de nascimento: </strong>
  <div class="controls"><span><?=$this->user->data_nasc?></span></div>
</div>
    </div>
    <div class="clearfix">
      <div class="control-group" style="float: left;margin-right: 20px;">
  <strong class="control-label" for="page-label" >Endereço: </strong>
  <div class="controls"><span><?=$this->user->endereco?></span></div>
</div>
<div class="control-group" style="float: left;margin-right: 20px;">
  <strong class="control-label" for="page-label" >Cidade: </strong>
  <div class="controls"><span><?=$this->user->cidade?></span></div>
</div>
    </div>
<hr>
<h3>Dados da inscrição</h3>
<?php 


foreach ($this->campos as  $campo) {
  // $campo = $value->getCampo();
  $valor = null;
  foreach ($this->page as  $value) {
    if($value->campo_id == $campo->id){
      $valor = $value;
      break;
    }
    // else if($value->campo_id==99){
    //   echo "Inscrição OK ";
    // }
  }
  ?>

  <div class="control-group">
  <strong class="control-label" for="page-label" style="text-transform: capitalize;"><?=$campo->label?>: </strong>
  <div class="controls">
<span>
  <?php 
  if($campo->tipo == 'file' && !empty($valor)){
    ?>
    <a href="<?=BASE_URL.'uploads/inscricoes/'.$value->valor?>" target="_blank">Visualizar arquivo</a>
    <?php
  }else if($campo->tipo == 'checkbox'){
    echo !empty($valor) == '1' ? 'Sim' : 'Não';
  }else{
    if(!empty($valor)){
      echo $valor->valor;
    }
  }
  ?></span>
    
  </div>
</div>
  <?php
}
?>

    <div class="form-actions">
      <input class="btn" type="button" value="Cancelar" onclick="window.location.href = $.baseURL('<?=$this->linkTo($modulo, "list");?>');" />
      <!-- <button type="submit" class="btn btn-primary">Enviar</button> -->
    </div>
  </form>
</div>

<script type="text/javascript">
  function SubmitForm() {
        tinyMCE.triggerSave();

      }
</script>
