<?php

session_start();



require_once ("../../config/Cado.php");

require_once("cUsuariopv.php");

$oUsuario = new cUsuariopv();

require_once ("../formatos/formatos.php");



$dts=$oUsuario->mostrar_puntosdevista($_POST['usuarioid']);

$num_rows= mysql_num_rows($dts);



require_once ("../acceso/cAcceso.php");

$oAcceso = new cAcceso();



?>

<style>

    .not-active {

     pointer-events: none;

     cursor: default;

 }

</style>



<section class="content" id="table" style="min-height:0px;padding-bottom:0px;margin-bottom:-30px;">

  <div class="row">

    <div class="col-xs-12">

      <div class="box">

        <div class="box-body">

          <table id="tabla_usariopv_tabla" class="table table-bordered table-striped">

            <thead>

                <tr>

                    <th>PUNTO DE VENTA</th>

                    <th>POR DEFECTO</th> 

                    <th>&nbsp;</th>

                </tr>

            </thead>

            <?php

            if($num_rows>=1){

                ?>  

                <tbody>

                    <?php

                    while($dt = mysql_fetch_array($dts)){

                        ?>

                        <tr class="even">

                            <td><?php echo $dt['tb_puntoventa_nom']?></td>





                            <td><?php  echo ($dt['tb_usuariopv_def'] == '1') ? '<span class="ui-icon ui-icon-star" style="display: inline-block;vertical-align: middle;"></span><label>POR DEFECTO</label>' : '<span class="ui-icon ui-icon-star" style="opacity:0;display: inline-block;vertical-align: middle;"></span><a class="btn_deshabilitar" href="#" onClick="marcar_pordefecto('.$_POST['usuarioid'].','.$dt['tb_usuariopv_id'].')">HABILITAR</a>';?></td>  

                            <td nowrap align="center">



                                <?php  echo ($dt['tb_usuariopv_def'] == '1') ? '<a class="btn_marcardefecto not-active" style="opacity:0.5">ASIGNADO</a>' : '<a title="MARCAR POR DEFECTO" class="btn btn-primary" style="padding:2px 5px;margin:0px 2px" href="#" onClick="marcar_pordefecto(\''.$_POST['usuarioid'].'\',\''.$dt['tb_usuariopv_id'].'\')"><i class="fa fa-star"></i> Defecto</a>';?>



                                <!-- <button onClick="talonario_form('editar','<?php echo $dt['tb_talonario_id']?>')" class="btn btn-primary" style="padding:2px 5px;margin:0px 2px"><i class="fa fa-pencil"></i></button> -->



                                <a title="QUITAR PUNTO" class="btn btn-primary" style="padding:2px 5px;margin:0px 2px" href="#" onClick="eliminar_usuariopv('<?php echo $dt['tb_usuariopv_id']?>')"><i class="fa fa-trash"></i> Quitar</a>                   

                            </td>

                        </tr>

                        <?php



                    }

                    mysql_free_result($dts);

                    ?>

                </tbody>

                <?php

            }

            ?>

        </table>

    </div>

</div>

</div>

</div>

</section>



<!-- <script type="text/javascript">

  $(function() {  

    $("#tabla_usariopv_tabla").DataTable( {

      "columnDefs": [

      { "orderable": false, "targets": [1] }

      ],

      "searching": false,

      "order":[[0,"asc"]]

  });

}); 

</script> -->

