<?php
     
     include("./bd/conexao.php");
      include("protege.php");
     protegePagina();
?>


<head>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    

    <meta name="csrf-token" content="tOkvGAJe58nm5un1M6ktgQfNg1K1zPBqN1BxRFek">

    <title>Provedor Painel</title>

    

    <link rel="stylesheet" href="/painel/admin-assets/vendors/ti-icons/css/themify-icons.css">

    <link rel="stylesheet" href="/painel/admin-assets/vendors/css/vendor.bundle.base.css">

    <link rel="stylesheet" href="/painel/admin-assets/css/horizontal-layout-light/style.css">

    <link rel="shortcut icon" href="/painel/admin-assets/images/favicon.png" />

</head>



<body>

    <div class="container-scroller">

        <div class="horizontal-menu">

    <nav class="navbar top-navbar col-lg-12 col-12 p-0">

        <div class="container">

            <div class="text-center navbar-brand-wrapper d-flex align-items-center justify-content-center">

                <a class="navbar-brand brand-logo" href="/">

                    <!--<img src="admin-assets/images/logo-white.svg" alt="logo" />-->

                    <span style="color: white;">Provedor Painel</span>

                </a>

                <a class="navbar-brand brand-logo-mini" href="/">

                    <!--<img src="admin-assets/images/logo-mini.svg" alt="logo" />-->

                    <span style="color: white; font-size: 18px;">Provedor Painel</span>

                </a>

            </div>

            <div class="navbar-menu-wrapper d-flex align-items-center justify-content-end">

                <ul class="navbar-nav navbar-nav-right">

                    <li class="nav-item nav-profile dropdown">

                        <a class="nav-link" href="#" data-toggle="dropdown" id="profileDropdown">

                                                             Bem Vindo :<?php echo $_SESSION['email'];?>
       

       <?php

          if(isset($_GET['acao']) && $_GET['acao'] == 'sair'){
            sairPagina();
          }
       ?> <span class="caret"></span>

                                                    </a>

                        <div class="dropdown-menu dropdown-menu-right navbar-dropdown" aria-labelledby="profileDropdown">

                            <a class="dropdown-item" href="?acao=sair" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">

                                <i class="ti-power-off text-primary"></i>

                                Logout

                            </a>

                            <form id="logout-form" action="?acao=sair" method="POST" style="display: none;">

                                <input type="hidden" name="_token" value="bP7sD3wDyk6cGiMqsi9ULqnwdj1i4Mtiiu2ZaXwp">                            </form>

                        </div>

                    </li>

                </ul>

                <button class="navbar-toggler navbar-toggler-right d-lg-none align-self-center" type="button"

                    data-toggle="horizontal-menu-toggle">

                    <span class="ti-menu"></span>

                </button>

            </div>

        </div>

    </nav>

    <nav class="bottom-navbar">

        <div class="container">

            <ul class="nav page-navigation">

                <li class="nav-item">

                    <a class="nav-link" href="/painel/admin.php">

                        <i class="ti-settings menu-icon"></i>

                        <span class="menu-title">Config. Gerais</span>

                    </a>

                </li>

                <li class="nav-item">

                    <a href="/painel/pagina-inicial.php" class="nav-link">

                        <i class="ti-home menu-icon"></i>

                        <span class="menu-title">Página Inicial</span>

                    </a>

                </li>

                <li class="nav-item">

                    <a href="/painel/sobre-sobre.php" class="nav-link">

                        <i class="ti-info menu-icon"></i>

                        <span class="menu-title">Página Sobre</span>

                    </a>

                </li>

                <li class="nav-item">

                    <a href="/painel/pagina-planos.php" class="nav-link">

                        <i class="ti-money menu-icon"></i>

                        <span class="menu-title">Página Planos</span>

                    </a>

                </li>

                <li class="nav-item">

                    <a href="/painel/pagina-servicos.php" class="nav-link">

                        <i class="ti-bolt menu-icon"></i>

                        <span class="menu-title">Página Serviços</span>

                    </a>

                </li>

                <li class="nav-item">

                    <a href="/painel/pagina-contato.php" class="nav-link">

                        <i class="ti-email menu-icon"></i>

                        <span class="menu-title">Página Contato</span>

                    </a>

                </li>

                <li class="nav-item" style="visibility: hidden;">

                    <a href="/painel/pagina-contato.php" class="nav-link">

                        <i class="ti-email menu-icon"></i>

                        <span class="menu-title">Página Contato</span>

                    </a>

                </li>

            </ul>

        </div>

    </nav>

</div>



        <div class="container-fluid page-body-wrapper">

            <div class="main-panel">

                <div class="content-wrapper">

                    

                    

    <div class="row">

        <div class="col-12 grid-margin stretch-card">

            <div class="card">

                <div class="card-body">

                    <p class="card-title">Seção de Serviços</p>

                    <p class="text-muted font-weight-light mb-5">

                        <a target="_blank" href="/servicos.php">Visualizar alterações. <i class="ti ti-arrow-top-right"></i></a>

                    </p><?php



    if(isset($_POST['acao']) && $_POST['acao'] == 'Editar_Produto'){

  $tituloservicos    = $_POST['tituloservicos'];

  $servico1          = $_POST['servico1'];

  $servico1texto     = $_POST['servico1texto'];

  $servico2texto     = $_POST['servico2texto'];

  $servico2          = $_POST['servico2'];

  $servico3          = $_POST['servico3'];

  $servico3texto     = $_POST['servico3texto'];

    





        if($tituloservicos == "" || $servico1 == "" || $servico2 == "" || $servico1texto == "" || $servico2texto == "" || $servico2 == "" || $servico3 == "" || $servico3texto == ""){

            echo "<script>alert('Os Campos Não Podem Ficar Vazios!');</script>";

        }else{

            $editaProduto = $link->query("UPDATE servico SET tituloservicos = '$tituloservicos', servico1 = '$servico1', servico2 = '$servico2', servico1texto = '$servico1texto', servico2texto = '$servico2texto', servico3 = '$servico3', servico3texto = '$servico3texto'");

        if($editaProduto){

            echo '<div class="content-wrapper">

                                            <div class="alert alert-success" role="alert">

                            Pagina sobre atualizada com sucesso.

                        </div>';

        }else{

            echo '<div class="content-wrapper">

                                            <div class="alert alert-warning" role="alert">

                            Ouve um erro ao Atualizar.

                        </div>';

        }

        }

    }

   ?>

                <form class="edit" action="" method="POST" enctype="multipart/form-data">

    <?php



     $server = $link->query("SELECT * FROM servico");

       require("./bd/conexao.php");

                            while($ln = mysqli_fetch_array($server)){

                              $tituloservicos    = $ln['tituloservicos'];

                              $servico1          = $ln['servico1'];

                              $servico1texto  = $ln['servico1texto'];

                              $servico2texto = $ln['servico2texto'];

                              $servico2     = $ln['servico2'];

                              $servico3    = $ln['servico3'];

                              $servico3texto = $ln['servico3texto'];



     }



    ?>

                        <input type="hidden" name="_token" value="bP7sD3wDyk6cGiMqsi9ULqnwdj1i4Mtiiu2ZaXwp">                        <input type="hidden" name="_method" value="PATCH">

                        <div class="form-group">

                            <label for="titulo-servicos">Título da secao de servicos</label>

                            <input type="text" name="tituloservicos" class="form-control"  value="<?php echo $tituloservicos;?>">

                        </div>



                        <div class="form-group mt-5">

                            <label for="servico1">Serviço 1</label>

                            <input type="text" name="servico1" class="form-control"  value="<?php echo $servico1;?>">

                        </div>

                        <div class="form-group">

                            <label>Serviço 1 Texto</label>

                            <textarea rows="6" class="form-control" name="servico1texto">

                              <?php echo $servico1texto;?>

                            </textarea>

                        </div>



                        <div class="form-group mt-5">

                            <label for="servico2">Serviço 2</label>

                            <input type="text" name="servico2" class="form-control" id="servico2" value="<?php echo $servico2;?>">

                        </div>

                        <div class="form-group">

                            <label>Serviço 2 Texto</label>

                            <textarea rows="6" class="form-control" name="servico2texto" >

                           <?php echo $servico2texto;?>

                            </textarea>

                        </div>



                        <div class="form-group mt-5">

                            <label for="servico3">Serviço 3</label>

                            <input type="text" name="servico3" class="form-control"  value="<?php echo $servico3;?>">

                        </div>

                        <div class="form-group">

                            <label>Serviço 3 Texto</label>

                            <textarea rows="6" class="form-control" name="servico3texto" >

                               <?php echo $servico3texto;?>

                            </textarea>

                        </div>



                        <button type="hidden" name="acao" value="Editar_Produto"  class="btn btn-block btn-lg btn-success mt-5"><i class="ti ti-save"></i> Salvar Alterações</button>

                    </form>

                </div>

            </div>

        </div>

    </div>



                </div>

                <footer class="footer">

    <div class="w-100 clearfix">

        <span class="text-muted d-block text-center text-sm-left d-sm-inline-block">Copyright © 2019. All rights reserved.</span>

    </div>

</footer>            </div>

        </div>

    </div>



    <script src="/painel/admin-assets/vendors/js/vendor.bundle.base.js"></script>

    <script src="/painel/admin-assets/vendors/chart.js/Chart.min.js"></script>

    <script src="/painel/admin-assets/js/off-canvas.js"></script>

    <script src="/painel/admin-assets/js/hoverable-collapse.js"></script>

    <script src="/painel/admin-assets/js/template.js"></script>

    <script src="/painel/admin-assets/js/settings.js"></script>

    <script src="/painel/admin-assets/js/todolist.js"></script>

    <script src="/painel/admin-assets/js/dashboard.js"></script>

    <script src="/painel/admin-assets/js/todolist.js"></script>

</body>



</html>