<script language='JavaScript'>
function SomenteNumero(e){
    var tecla=(window.event)?event.keyCode:e.which;   
    if((tecla>47 && tecla<58)) return true;
    else{
    	if (tecla==8 || tecla==0) return true;
	else  return false;
    }
}
</script>



<?php
if (isset($this->Dados[0])):
    $catArtigos = $this->Dados[0];
    //var_dump($catArtigos);
endif;
if (isset($this->Dados[1][0])):
    $valorForm = $this->Dados[1][0];
    //var_dump($valorForm);
elseif (isset($this->Dados[1])):
    $valorForm = $this->Dados[1];
    //var_dump($valorForm);
endif;
?>
<div class="well">
    <div class="pull-right">
        <a href="<?php echo URL; ?>controle-artigo/index"><button type="button" class="btn btn-sm btn-success">Listar</button></a>
        <a href="<?php echo URL; ?>controle-artigo/visualizar/<?php echo $valorForm['id']; ?>"><button type="button" class="btn btn-sm btn-primary">Visualizar</button></a>
        <!--<a href="<?php echo URL; ?>controle-artigo/apagar/<?php echo $valorForm['id']; ?>"><button type="button" class="btn btn-sm btn-danger">Apagar</button></a>-->
    </div>
    <div class="page-header">
        <h1>Alterar Chamada de Encalhe</h1>
    </div>
    <?php
    if (isset($_SESSION['msg'])):
        echo $_SESSION['msg'];
        unset($_SESSION['msg']);
    endif;
    if (isset($_SESSION['msgcad'])):
        echo $_SESSION['msgcad'];
        unset($_SESSION['msgcad']);
    endif;
    ?>
    
    <form name="CadArtigo"  class="form-horizontal" action="" method="post" enctype="multipart/form-data">
        
        <input type="hidden" name="id" value="<?php
        if (isset($valorForm['id'])):
            echo $valorForm['id'];
        endif;
        ?>">
        
        
        <div class="form-group">
            <label class="col-sm-2 control-label">Nº da CE:</label>
            <div class="col-sm-10">
                <input type="text"  class="form-control" name="cde_number" placeholder="Nº da CE" value="<?php
                if (isset($valorForm['cde_number'])): echo $valorForm['cde_number'];
                endif;
                ?> "readonly>
            </div>
        </div>
        
        <div class="form-group">
            <label class="col-sm-2 control-label">Tipo de chamada:</label>
            <div class="col-sm-10">
                <input type="text"  class="form-control" name="recall_type"  placeholder="Tipo de chamada" value="<?php
                if (isset($valorForm['recall_type'])): echo $valorForm['recall_type'];
                endif;
                ?>"readonly="">
            </div>
        </div>
        
         <div class="form-group">
            <label class="col-sm-2 control-label">Distribuído:</label>
            <div class="col-sm-10">
                <input type="text"  class="form-control" name="total_distributed" placeholder="Distribuído" value="<?php
                if (isset($valorForm['total_distributed'])): echo $valorForm['total_distributed'];
                endif;
                ?>"readonly="">
            </div>
        </div>
        
        
       <?php
        if (trim($valorForm['recall_type']) == "NORMAL"):?>
        
        
                     <div class="form-group">
                     <label class="col-sm-2 control-label">Devolução:</label>
                     <div class="col-sm-10">
                     <input type="test"  class="form-control" name="return2" onkeypress="return SomenteNumero(event)" placeholder="Devolução" value="<?php
                     if (isset($valorForm['return2'])): echo $valorForm['return2'];
                     endif;
                     
                     
                     ?>">
                     </div>
                     </div>       
            <?php
            
            
        
                    endif;
            ?>
        
        <?php
        if (trim($valorForm['recall_type']) == "PARCIAL"):?>
        
        <div class="form-group">
            <label class="col-sm-2 control-label">Venda:</label>
            <div class="col-sm-10">
                <input type="text"  class="form-control" name="sales" onkeypress="return SomenteNumero(event)" placeholder="Venda" value="<?php
                if (isset($valorForm['sales'])): echo $valorForm['sales'];
                endif;
                ?>">
            </div>
        </div>
        
        
        
                       
            <?php
            
           
        
                    endif;
            ?>
                
        <input type="hidden" name="modified" value="<?php echo date("Y-m-d H:i:s"); ?>">
        <input type="hidden" name="user" value="<?php echo $_SESSION['name']; ?>">
        
        

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <input type="submit" class="btn btn-warning" value="Alterar" name="SendEditArtigo">
            </div>
        </div>
    </form>
</div>
