<?php
session_start();
require_once('../conexion.php');
require_once('../include/sesiones.php');
$can=mysqli_query($con,"SELECT * FROM cliente c, cliente_cotizacion_temp cc where c.clie_id=cc.cct_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=mb_strtoupper($dato['clie_nombre']);
    $clie_telefono=$dato['clie_telefono'];
?>

    <label>Nombre</label>
    <div class="input-group">
        <input type="text" style="color: black;font-weight: bold;" value="<?php echo $clie_cc; ?> - <?php echo $clie_nombre; ?>" class="form-control input-sm" readonly >
        <span class="input-group-addon">
             <?php if($clie_nombre<>'CLIENTE MOSTRADOR'){ ?><a data-id="<?php echo $clie_id;?>" style="width:100%;" class=" btn-edit_cli"><span class="btn-icon-only icon-edit "></span></a> <?php } ?>
        </span>
    </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>
    </br>
    </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'];
?>
    <div class="form-group">
        <label>Nombre</label>
        <input type="text" style="color: black;font-weight: bold;" value="<?php echo $clie_cc; ?> - <?php echo $clie_nombre; ?>" 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> 
<?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 -->
