<?php
require_once("inc/protecao-admin.php");

?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>Administra&ccedil;&atilde;o</title>
  <link rel="stylesheet" href="/inc/materialdesignicons.min.css">
  <link rel="stylesheet" href="/inc/font-awesome.min.css">
  <link rel="stylesheet" href="/inc/vendor.bundle.base.css">
  <link rel="stylesheet" href="/inc/vendor.bundle.addons.css">
  <link rel="stylesheet" href="/inc/theme.css">
  <link rel="shortcut icon" href="/img/favicon.ico">
  <script type="text/javascript" src="/admin/inc/ajax.js"></script>
  <script type="text/javascript" src="/admin/inc/javascript.js"></script>
</head>

<body>
  <div class="container-scroller">
      <nav class="navbar col-lg-12 col-12 p-0 fixed-top d-flex flex-row">
      <div class="text-center navbar-brand-wrapper d-flex align-items-center justify-content-center">
        <a class="navbar-brand brand-logo" href="/admin/admin-configuracoes"><span>Administra&ccedil;&atilde;o</span></a>
        <a class="navbar-brand brand-logo-mini" href="/admin/admin-configuracoes"><img src="/img/icones/img-icone-logo.png" title="Painel" width="32" height="32" border="0"></a>
      </div>
      <div class="navbar-menu-wrapper d-flex align-items-center justify-content-end justify-content-lg-start">
        <button class="navbar-toggler navbar-toggler align-self-center" type="button" data-toggle="minimize">
          <span class="mdi mdi-menu text-icones"></span>
        </button>
        <li class="nav-item nav-search d-none d-lg-block">
            <div class="input-group">
              <div class="input-group-prepend">
                <span class="input-group-text" id="search">
                  <i class="mdi mdi-magnify"></i>
                </span>
              </div>
              <input type="text" class="form-control" id="busca_chave" placeholder="Busca" aria-label="search" aria-describedby="search">
            </div>
          </li>
        <ul class="navbar-nav navbar-nav-right">
          <li class="nav-item">
            <a class="nav-link" href="/admin/sair"><i class="mdi mdi-logout f-22 text-icones" data-toggle="tooltip" data-placement="bottom" title="Sair/logout"></i></a>
          </li>
        </ul>
        <button class="navbar-toggler navbar-toggler-right d-lg-none align-self-center" type="button" data-toggle="offcanvas">
          <span class="mdi mdi-menu text-icones"></span>
        </button>
      </div>
    </nav>

    <!-- modal -->                
      <div class="modal fade" id="log-sistema" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
            <div class="modal-content">
                <div class="modal-body" id="log-sistema-conteudo" style="text-align:center"><img src="/img/ajax-loader.gif" /></div>
            </div>
        </div>
      </div>
      
    <div class="container-fluid page-body-wrapper">      
    <?php require_once("menu-admin.php"); ?>
      <div class="main-panel">
        <div class="content-wrapper">
          <div id="local-status-acoes"><?php echo $_SESSION['status_acao'];unset($_SESSION['status_acao']); ?></div>
          <div class="row">            

            <div class="col-lg-12">
              <div class="card">
                  <div class="card-header">
                    <header><?php echo lang_pagina_avisos_cadastrar_titulo; ?></header>
                  </div>
                <div class="card-body">
                    <form method="post" action="/admin/admin-cadastra-aviso" name="cadastrar">
                                        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td width="120" height="50" align="left" style="padding-left:5px;"><strong><?php echo lang_pagina_avisos_cadastrar_servidor; ?></strong></td>
                                            <td align="left">
                                            <select name="codigo_servidor" class="form-control" id="codigo_servidor" style="width:100%;">
                                            <option value="0" selected="selected"><?php echo lang_pagina_avisos_cadastrar_todos; ?></option>
                                    <?php

                                    $query = mysqli_query($conexao,"SELECT * FROM servidores WHERE tipo = 'streaming' ORDER by ordem ASC");
                                    while ($dados_servidor = mysqli_fetch_array($query)) {

                                    echo '<option value="' . $dados_servidor["codigo"] . '">' . $dados_servidor["nome"] . ' - ' . $dados_servidor["ip"] . '</option>';

                                    }
                                    ?>
                                              </select>          </td>
                                          </tr>
                                          <tr>
                                            <td width="120" height="50" align="left" style="padding-left:5px;"><strong><?php echo lang_pagina_avisos_cadastrar_area; ?></strong></td>
                                            <td width="380" align="left">
                                            <select name="area" class="form-control" id="area" style="width:100%;">
                                            <option value="streaming" selected="selected">Streamings</option>
                                            <option value="revenda">Revendas</option>
                                            </select>          </td>
                                          </tr>
                                          <tr>
                                            <td width="120" height="50" align="left" style="padding-left:5px;"><strong><?php echo lang_pagina_avisos_cadastrar_titulo_aviso; ?></strong></td>
                                            <td width="380" align="left"><input name="titulo" type="text" class="form-control" id="titulo" style="width:100%;" value="Migra&ccedil;&atilde;o " /></td>
                                          </tr>
                                          <tr>
                                            <td width="120" height="50" align="left" style="padding-left:5px;"><strong><?php echo lang_pagina_avisos_cadastrar_descricao; ?></strong></td>
                                            <td width="380" align="left"><div class="input-group"><input name="descricao" type="text" class="form-control" id="descricao" style="width:60%;" onkeyup="contar_caracteres(this.id,'120');" /><span class="input-group-append" id="basic-addon3"><label class="input-group-text" id="total_caracteres">120</label></span></td>
                                          </tr>
                                          <tr>
                                            <td height="50" align="left" style="padding-left:5px;"><strong><?php echo lang_pagina_avisos_cadastrar_aviso; ?></strong></td>
                                            <td align="left"><textarea name="mensagem" id="mensagem" class="form-control" style="width:100%;" rows="10"></textarea></td>
                                          </tr>
                                          
                                          <tr>
                                            <td height="50" align="left" style="padding-left:5px;"><strong><?php echo lang_pagina_avisos_exibir; ?></strong></td>
                                            <td align="left"><input name="status" id="status" type="checkbox" value="sim" checked /></td>
                                          </tr>
                                          <tr>
                                            <td height="50" colspan="2" align="right"><button type="button" class="btn btn-info" onClick="document.cadastrar.submit();"><?php echo lang_botao_titulo_cadastrar; ?></button></td>
                                          </tr>
                                        </table>
                                      </form>
                </div>
              </div>
            </div>

          </div>
        </div>
      </div>      

    </div>
  </div>
  <script src="/inc/vendor.bundle.base.js"></script>
  <script src="/inc/vendor.bundle.addons.js"></script>
  <script src="/inc/theme.js"></script>
  <script>
  $('#busca_chave').keypress(function (e) {
    if (e.which == 13) {
       window.location = "/admin/admin-streamings/resultado/"+document.getElementById("busca_chave").value;
    }
  }); 
  </script>
</body>
</html>