<?php include('fncr-geral/configuracao_geral.php');
$pagina = "campanhas";
$blq_pag = "campanhas";
include('fncr-geral/permissoes_restricao.php');

$sql = $bd->getConexao()->prepare('SELECT clubes.*, clubes_configuracao.* FROM clubes
 LEFT JOIN clubes_configuracao on clubes_configuracao.id_clube = clubes.id
WHERE status = 2 ORDER BY nome ASC');
if( $sql->execute() ) { $resul_clubes = $sql->fetchall(PDO::FETCH_ASSOC);}

?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
    <?php include('fncr-geral/html-head.php');?>

  <link rel="stylesheet" type="text/css" href="js/datatables2/media/css/jquery.dataTables.css">
  <script type="text/javascript" language="javascript" src="js/datatables2/media/js/jquery.dataTables.js"></script>

  <script type="text/javascript" language="javascript" class="init">

    $(document).ready(function() {
      $('.table_clubes').DataTable({

        stateSave: false, // Salvar última pesquisa
        "dom": '<"top"fl>rt<"bottom"ip><"clear">', // Layout
        "pagingType": "full_numbers", // Modo Paginação
        "iDisplayLength": 50,

        "aoColumns": [
          { "orderSequence": [ "" ] },
          { "orderSequence": [ "" ] },
          null,
          null,
          null,
          null,
          null,
          null,
          null
        ],

        "language": { // Tradução
          "lengthMenu": "Resultados por P&aacute;gina: _MENU_ ",
          "zeroRecords": "N&atilde;o existe Clubes para esta pesquisa",
          "info": "P&aacute;gina _PAGE_ de _PAGES_",
          "infoEmpty": "N&atilde;o existe Clubes para esta pesquisa",
          "infoFiltered": "(Filtrando de um total de _MAX_ Clubes)",
          "search": "Localizar Clubes: ",
          "paginate": {
            "first": "Primeira",
            "previous": "Anterior",
            "next": "Pr&oacute;xima",
            "last": "&Uacute;ltima"
          }
        }
      });
    });

    // Script Modal E-mails Enviar
    $(document).ready(function(){
      $("#modal_manutencao_conf").on('show.bs.modal', function(event){
        var button = $(event.relatedTarget);
        var tipo = button.data('tipo');
        $(this).find('.tipo').val(tipo);
      });
    });

  </script>
</head>
<body>

<!-- BARRA SUPERIOR -->
<?php include('barra-sup.php');?>
<!-- MENU PRINCIPAL -->
<?php include('menu.php');?>

<section id="content">

<div class="clearfix padder bg-fncr-clearfix">
    <h3 class="m-b">Campanha: WSOP - Satélites</h3>
</div>

<section id="content" class="content-sidebar bg-white" style="padding-bottom: 100px">
<!-- .main -->
<section class="main">
<br>

  <div class="col-lg-12">
    <section class="panel">
      <header class="panel-heading bg-info">
        Clubes
      </header>
      <div class="table-responsive">
        <table class="table table-striped b-t text-small table_clubes">
          <thead>
          <tr>
            <th class="text-center" width="1"></th>
            <th class="text-center" width="1">Link</th>
            <th width="300">Clube</th>
            <th class="text-center" width="150">Cidade</th>
            <th class="text-center" width="35">UF</th>
            <th class="text-center" width="150">Planos Exibir</th>
            <th class="text-center" width="150">Bt. Participar</th>
            <th class="text-center" width="150">Bt. Contratar</th>
            <th class="text-center" width="150">Contratado</th>
          </tr>
          </thead>
          <tbody>
          <?php foreach($resul_clubes as $l){

            $planos_exibir = $l['wsop_plano_exibir']==0 ? "Todos" : "5 e 10 Pacotes" ;

            if($l['wsop_plano']==1){$qtd_pacotes = 3;}
            if($l['wsop_plano']==2){$qtd_pacotes = 5;}
            if($l['wsop_plano']==3){$qtd_pacotes = 10;}

            $contratado = $l['wsop_contratado']==1 && $l['wsop_plano']>0 ? $qtd_pacotes." Pacotes" : "Não Contratado";
            $contratado_class = $l['wsop_contratado']==1 && $l['wsop_plano']>0 ? "status-ati" : "status-sis";

            if($l['wsop_bt_contratar']==1){$qtd_pacotes = 3;}
            if($l['wsop_bt_contratar']==2){$qtd_pacotes = 5;}
            if($l['wsop_bt_contratar']==3){$qtd_pacotes = 10;}

            $bt_participar = $l['wsop_bt_participar']==1 ? "Clicado" : "" ;
            $bt_contratar = $l['wsop_bt_contratar']>0 ? $qtd_pacotes." Pacotes" : "" ;

            ?>
              <tr>
                  <td class="text-info">
                      <a href="clube.php?clube=<?php echo $l['id']?>"><i class="fa fa-folder-open fa-lg"></i></a>
                  </td>
                  <td class="text-info text-center">
                      <a href="https://<?php echo $l['link_sistema']?>.pokerweb.com.br" target="_blank" title="Acessar Sistema"><i class="fa fa-external-link fa-lg"></i></a>
                  </td>
                  <td class="text-info"><?php echo $l['nome']?></td>
                  <td class="text-info text-center"><?php echo $l['cidade']?></td>
                  <td class="text-info text-center"><?php echo $l['uf']?></td>
                  <td class="text-info text-center"><?php echo $planos_exibir?></td>
                  <td class="text-info text-center"><?php echo $bt_participar?></td>
                  <td class="text-info text-center"><?php echo $bt_contratar?></td>
                  <td class="text-info text-center <?php echo $contratado_class?>"><?php echo $contratado?></td>
              </tr>
          <?php } ?>
          </tbody>
        </table>
      </div>
    </section>
  </div>

</section>
</section>

<!-- FOOTER -->
<?php include('footer.php');?>

<!-- Modal MANUTENÇÃO -->
<div id="modal_manutencao" class="modal fade bs-example-modal-sm">
  <div class="modal-dialog  modal-sm" style="width: 600px;">
    <div class="modal-content">
      <div class="modal-header bg-info">
        <button type="button" class="close" data-dismiss="modal"><i class="fa fa-times"></i></button>
        <h4 class="modal-title" id="myModalLabel">Manuten&ccedil;&atilde;o</h4>
      </div>
      <div class="modal-body scrollbar_modal">
        <div class="row">
          <div class="col-lg-12">
            <section class="panel">
              <table class="table table-striped m-b-none text-small">
                <thead>
                <tr>
                  <th class="text-center" width="150">A&ccedil;&atilde;o</th>
                  <th class="text-center" width="150">A&ccedil;&atilde;o</th>
                </tr>
                </thead>
                <tbody>
                <tr>
                  <td class="text-center"><a data-toggle="modal" href="#modal_manutencao_conf" data-backdrop="static" data-tipo="1" class="btn btn-inverse btn-xs">Travar</a></td>
                  <td class="text-center"><a data-toggle="modal" href="#modal_manutencao_conf" data-backdrop="static" data-tipo="0" class="btn btn-inverse btn-xs">Destravar</a></td>
                </tr>
                </tbody>
              </table>
            </section>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">Fechar</button>
      </div>
    </div>
  </div>
</div>

<!-- Modal EMAIL confirmar envio -->
<div id="modal_manutencao_conf" class="modal fade bs-example-modal-sm">
  <form class="m-b-none" method="post" action="" enctype="multipart/form-data">
    <input type="hidden" name="manutencao" value="acao" />
    <input type="hidden" class="tipo" name="tipo" value="" />
    <div class="modal-dialog modal-sm" style="width: 350px;">
      <div class="modal-content">
        <div class="modal-header bg-info">
          <button type="button" class="close" data-dismiss="modal"><i class="fa fa-times"></i></button>
          <h4 class="modal-title" id="myModalLabel">Manutencao</h4>
        </div>
        <div class="modal-body">
          <div class="row">
            <div class="col-lg-12 text-center">
              Realizar a&ccedil;&atilde;o?
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">Cancelar</button>
          <button type="submit" class="btn btn-sm btn-inverse" data-loading-text="Enviando...">Realizar</button>
        </div>
      </div>
    </div>
  </form>
</div>

  <!-- app -->
<script src="js/app.js"></script>
<script src="js/app.plugin.js"></script>
<script src="js/app.data.js"></script>
<!-- Sparkline Chart -->
<script src="js/charts/sparkline/jquery.sparkline.min.js"></script>
<!-- Easy Pie Chart -->
<script src="js/charts/easypiechart/jquery.easy-pie-chart.js"></script>
  <!-- select2 -->
<script src="js/select2/select2.min.js"></script>
  <!-- fuelux -->
<script src="js/fuelux/fuelux.js"></script>
<!-- datepicker -->
<script src="js/datepicker/bootstrap-datepicker.js"></script>
<!-- slider -->
<script src="js/slider/bootstrap-slider.js"></script>
<!-- file input -->
<script src="js/file-input/bootstrap.file-input.js"></script>
<!-- combodate -->
<script src="js/combodate/moment.min.js"></script>
<script src="js/combodate/combodate.js"></script>
<!-- parsley -->
<script src="js/parsley/parsley.min.js"></script>

</body>
</html>
<?php $bd = null; $bd_fn = null;?>