<?php
session_start();
require_once('../conexion.php');
require_once('../include/sesiones.php');
$can=mysqli_query($con,"SELECT * FROM cliente c, cliente_orden_temp cc where c.clie_id=cc.ordt_clie_id and cc.usuario='$usu_id' and cc.empresa='$empresa'") or die(mysqli_error($con)); 
if($dato=mysqli_fetch_array($can))
{ 
    $clie_id=$dato['clie_id'];
    $clie_cc=$dato['clie_cc'];
    $clie_nombre=$dato['clie_nombre'];
    $clie_telefono=$dato['clie_telefono'];
    $clie_correo=$dato['clie_correo'];
?>
    <div class="form-group">
        <label>Nombre</label>
        <input type="text" style="color: black;font-weight: bold;" value="<?php echo $clie_nombre; ?>" class="form-control input-sm" readonly >
    </div> 
    <div class="form-group">
        <label>Documento</label>
        <input type="text" style="color: black;font-weight: bold;" value="<?php echo $clie_cc; ?>" class="form-control input-sm" readonly >
    </div> 
    <div class="form-group">
        <label>Telefono</label>
        <input type="text" style="color: black;font-weight: bold;" value="<?php echo $clie_telefono; ?>" class="form-control input-sm" readonly >
    </div>
    <div class="form-group">
        <label>Correo</label>
        <input type="text" style="color: black;font-weight: bold;" value="<?php echo $clie_correo; ?>" class="form-control input-sm" readonly>
    </div>  
    </br>
    <?php if($clie_nombre<>'CLIENTE MOSTRADOR'){ ?>
    <a data-id="<?php echo $clie_id;?>" style="width:100%;" class="btn btn-edit_cli btn-warning"><span class="btn-icon-only icon-edit "></span>Editar</a>
    <?php } ?>
    </div>     
<?php 
} 
else 
{
    $can=mysqli_query($con,"SELECT * FROM cliente where clie_destacado='si' and empresa='$empresa'") or die(mysqli_error($con));
    $row=mysqli_fetch_array($can);
    $clie_id=$row['clie_id'];
    $clie_cc=$row['clie_cc'];
    $clie_nombre=$row['clie_nombre'];
    $clie_telefono=$row['clie_telefono'];
    $clie_correo=$row['clie_correo'];
?>
    <div class="form-group">
        <label>Nombre</label>
        <input type="text" style="color: black;font-weight: bold;" value="<?php echo $clie_nombre; ?>" class="form-control input-sm" readonly>
    </div>
        <div class="form-group">
        <label>Documento</label>
        <input type="text" style="color: black;font-weight: bold;" value="<?php echo $clie_cc; ?>" class="form-control input-sm" readonly >
    </div> 
    <div class="form-group">
        <label>Telefono</label>
        <input type="text" style="color: black;font-weight: bold;" value="<?php echo $clie_telefono; ?>" class="form-control input-sm"readonly>
    </div> 
    <div class="form-group">
        <label>Correo</label>
        <input type="text" style="color: black;font-weight: bold;" value="<?php echo $clie_correo; ?>" class="form-control input-sm" readonly>
    </div>
<?php } ?>


<script>
$(".btn-edit_cli").click(function(){
    id = $(this).data("id");
    $.get("./php_clientes/form_modificar_cliente_ven.php","id="+id,function(data){
        $("#cli-edit").html(data);
    });
    $('#edit_cliente').modal('show');
});
</script>

<div class="modal fade" id="edit_cliente" tabindex="-1" role="dialog" aria-labelledby="editModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Modificar Cliente</h4>
            </div>
            <div id="cli-edit"></div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->