<?php
$path = '';
if (file_exists('../../configuracao/get_config.php')) {
    $path = '../../configuracao/get_config.php';
} elseif (file_exists('../configuracao/get_config.php')) {
    $path = '../configuracao/get_config.php';
} elseif (file_exists('./configuracao/get_config.php')) {
    $path = './configuracao/get_config.php';
}
if ($path) {
    require_once $path;
} else {
    die("Arquivo de conexão não encontrado.");
}
$configuracoes = new Configuracoes();
$nome_para_vendedores = $configuracoes->get_nomeclatura_vendedor(true);
$nome_para_vendedor = $configuracoes->get_nomeclatura_vendedor();

$personalizacao = new Personalizacao($connectionmysql);
$foto = $personalizacao->getPreferencias()[0];
?>

<style>
    /*========= Menu =========*/

    .navbar-custom {
        background-color: transparent;
        background-image: linear-gradient(200deg, #367ef2ff 47%, #2F5F9E 88%); 
    }

    .navbar-top-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 16px;
        min-width: 0;
    }

    .navbar-brand-area {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        align-items: center;
    }

    .navbar-brand-area .logo-box {
        float: none;
        padding-right: 0;
        max-width: 100%;
        display: flex;
        align-items: center;
    }

    .navbar-brand-area .logo {
        display: flex;
        align-items: center;
        line-height: normal;
        max-width: 100%;
    }

    .navbar-brand-area .logo img {
        width: auto !important;
        max-width: 100%;
        max-height: 52px;
        display: block;
    }

    .navbar-actions {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        min-width: 0;
    }

    .navbar-user-menu,
    .navbar-shortcuts {
        display: flex;
        align-items: center;
    }

    .navbar-user-menu .topnav-menu,
    .navbar-shortcuts .topnav-menu {
        display: flex;
        align-items: center;
    }

    .navbar-user-menu .nav-user,
    .navbar-shortcuts .nav-link {
        display: flex;
        align-items: center;
        white-space: nowrap;
    }


    /* Nome do usuário no topo */
    .navbar-custom .pro-user-name {
        color: #fff !important;
        white-space: nowrap;
    }

    /* Ícones da navbar (usuário, engrenagem, escudo, etc.) */
    .navbar-custom .nav-link i,
    .navbar-custom .navbar-icons i {
        color: #fff !important;
    }

    @media (max-width: 1400px) {
        .navbar-custom .pro-user-name {
            max-width: 180px;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    }

    @media (max-width: 1200px) {
        .navbar-custom .pro-user-name {
            display: none;
        }
    }

    @media (max-width: 991.98px) {
        .navbar-top-content {
            gap: 8px;
        }

        .navbar-brand-area .logo img {
            max-height: 44px;
        }
    }

    /*========= Menu =========*/

    /*========= Footer =========*/
    .footer {
        background-color: #2F5F9E;
        color: #fff;
    }

    /*========= Footer =========*/
</style>

<!-- Navigation Bar-->
<header id="topnav">

    <!-- Topbar Start -->
    <div class="navbar-custom">
        <div class="container-fluid">

            <div class="row navbar-top-content">

                <div class="col text-left navbar-brand-area">
                    <!-- LOGO -->
                    <div class="logo-box">
                        <a href="<?php echo PATH_SIS; ?>index.php" class="logo text-left">
                                                        <img src="<?php echo PATH_IMAGE; ?><?= $foto['logo'] ?? '../assets/images/logomanda.jpeg' ?>" class="w-25" alt="">
                            <!--  <h2 class="ml-2">@MANDA RECEITA</h2> -->
                        </a>
                    </div>

                </div>

                <div class="col-auto navbar-actions">
                    <div class="navbar-user-menu">
                    <ul class="list-unstyled topnav-menu mb-0">
                        <li class="dropdown notification-list" style="right: 35px;">
                            <a href="#" class="nav-link dropdown-toggle nav-user mr-0 waves-effect" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                                <!-- Ícone de usuário -->
                                <i class="fas fa-user-circle"></i>
                                <span class="pro-user-name ml-1">
                                    <?php if (isset($_SESSION['NomeUsuario'])) {
                                        echo "Olá, " . $_SESSION['NomeUsuario'] . "!";
                                    } else {
                                        echo "Sessão 'NomeUsuario' não está definida!";
                                    } ?>
                                </span>
                                <!-- Ícone de seta -->
                                <i class="fas fa-caret-down"></i>
                            </a>
                            <div class="dropdown-menu dropdown-menu-end">
                                <!-- Opções do dropdown aqui -->

                                <a href="<?php echo PATH_SIS; ?>logoff.php?id=3" class="dropdown-item notify-item">
                                    <i class="fe-log-out"></i>
                                    <span>Logout</span>
                                </a>
                                <a href="<?php echo PATH_SIS; ?>/senha" class="dropdown-item notify-item">
                                    <i class="fe-lock"></i>
                                    <span>Alterar Senha</span>
                                </a>
                            </div>
                        </li>
                    </ul>
                    </div>
                    <div class="navbar-shortcuts">
                    <ul class="list-unstyled topnav-menu mb-0">
                        <li>
                            <a href="<?php echo PATH_SIS; ?>validacao/home/index.php" class="nav-link waves-effect">
                                <i class="mdi mdi-shield-check" style="font-size: 21px;"></i>
                            </a>
                        </li>
                        <li class="dropdown notification-list">
                            <a href="<?php echo PATH_SIS; ?>configuracoes/home/index.php" class="nav-link dropdown-toggle nav-user mr-0 ml-1 waves-effect" aria-haspopup="true" aria-expanded="false">
                                <!-- Ícone de seta -->
                                <i class="mdi mdi-cog-outline" style="font-size: 20px;"></i>
                            </a>
                        </li>
                    </ul>
                    </div>
                </div>



            </div>

        </div> <!-- end container-fluid-->
    </div>
    <!-- end Topbar -->

    <div class="topbar-menu">
        <div class="container-fluid">
            <div id="navigation">
                <!-- Navigation Menu-->
                <ul class="navigation-menu">
                    <li class="has-submenu">
                        <a href="<?php echo PATH_SIS; ?>index.php"><i class="mdi mdi-view-dashboard"></i>Home</a>
                    </li>

                    <li class="has-submenu">
                        <a href="#"> <i class="mdi mdi-badge-account-horizontal-outline" style="font-size: 20px;"></i>Comercial <div class="arrow-down"></div></a>
                        <ul class="submenu megamenu">
                            <li>
                                <ul>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>comercial/painel-gerencial.php">Visão Comercial</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>metas_comercial/index.php">Metas - Lojas</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>metas_comercial/metas_vendedor.php">Metas - Vendedores</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>caixa/index.php">Caixa</a>
                                    </li>
                                    <!-- <li><a href="<?php echo PATH_SIS; ?>inclusao/painel-gerencial.php">Visão Inclusão</a></li> -->
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>terceiros/index.php">Terceiros</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>vendedores/index.php">Dash Vendedores</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>painel_vendedores/index.php"><?= $nome_para_vendedores ?></a>
                                                   
                                    </li>
                                </ul>
                            </li>
                        </ul>
                    </li>

                    <li class="has-submenu">
                        <a href="#">
                            <i class="mdi mdi-clipboard-edit-outline" style="font-size: 20px;"></i>PCP <div class="arrow-down"></div></a>
                        <ul class="submenu megamenu">
                            <li>
                                <ul>

                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>monitoramento/painel_gerencial_monitoramento.php">Resultado - PCP</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>produtividade/index.php">Produtividade/Horas </a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>lead_time/index.php">Lead Time</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>comissao_prod/index.php">Comissões</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>metas_pcp/metas_etapas.php">Metas Etapas</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>metas_pcp/index.php">Metas Colaboradores</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>resumo_funcionario/index.php"> Resumo Funcionario</a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                    </li>

                    <li class="has-submenu">
                        <a href="#">
                            <i class="mdi mdi-view-grid-outline" style="font-size: 20px;"></i>Geral<div class="arrow-down"></div></a>
                        <ul class="submenu megamenu">
                            <li>
                                <ul>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>produtos_falta/index.php">Produtos - Faltantes</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>lancamento_erros/index.php">Lançamento de Erros</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>pagamentos/index.php">Pagamentos</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>estoque/index.php">Estoque</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>link_orcamento/link_orcamento.php">PDF Orçamentos</a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                    </li>

                    <!-- <li class="has-submenu">
                        <a href="#">
                            <i class="mdi mdi-cog-outline" style="font-size: 20px;"></i>Configurações <div class="arrow-down"></div></a>
                        <ul class="submenu megamenu">
                            <li>
                                <ul>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>usuarios/index.php">Usuários</a>

                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>funcionario/index.php">Funcionários</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>dia_trabalho/index.php">Dia Úteis</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>departamento/index.php">Departamentos e Setores</a>
                                    </li>
                                    <?php if ($_SESSION['NomePerfil'] === 'Administrador') {  ?>
                                        <li>
                                            <a href="<?php echo PATH_SIS; ?>permissao/index.php" class="dropdown-item notify-item">
                                                <span>Permissões</span>
                                            </a>
                                        </li>
                                        <li>
                                            <a href="<?php echo PATH_SIS; ?>percentual/index.php">Gestão de Percentual</a>
                                        </li>
                                    <?php } ?>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>preferencias/index.php">Preferências</a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                    </li> -->

                    <li class="has-submenu">
                        <a href="#">
                            <i class="mdi mdi-doctor" style="font-size: 20px;"></i>Médicos <div class="arrow-down"></div></a>

                        <ul class="submenu megamenu">
                            <li>
                                <ul>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>medicos_recebidos/index.php">Recebidos</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>relacao_medicos/index.php">Comparativo Médicos</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>medicos_orcamentos/index.php">Orçamentos</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>medicos_autorizacao/index.php">Medicos Autorização</a>
                                    </li>
                                    <!-- <li>
                                        <a href="<?php echo PATH_SIS; ?>medicos_varejo/index.php">Varejo</a>
                                    </li> -->


                                </ul>
                            </li>
                        </ul>
                    </li>

                    <li class="has-submenu">
                        <a href="#">
                            <i class="mdi mdi-account-heart-outline" style="font-size: 20px;"></i>Clientes <div class="arrow-down"></div></a>

                        <ul class="submenu megamenu">
                            <li>
                                <ul>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>clientes_novos/index.php">Clientes Novos</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>aniversariantes/index.php">Aniversariantes</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>clientes_orcamentos/index.php">Clientes Orçamentos</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>clientes_recebidos/index.php">Clientes Recebidos</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>clientes_inativos/index.php">Dias sem Orçamentos</a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                    </li>

                    <li class="has-submenu">
                        <a href="#">
                            <i class="mdi mdi-file-chart-outline" style="font-size: 20px;"></i>Relatórios <div class="arrow-down"></div></a>
                        <ul class="submenu megamenu">
                            <li>
                                <ul>
                                    <!-- <li>
                                        <a href="<?php echo PATH_SIS; ?>medico/medico-list.php">Orçamentos</a>
                                    </li> -->
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>vendas/index.php">Vendas em Aberto</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>mapa_erros/index.php">Mapa de Erros</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>mapa_erros_etapa/index.php">Mapa de Erros Por Etapa</a>
                                    </li>

                                    <!-- <li>
                                        <a href="<?php echo PATH_SIS; ?>produtos_inativos/index.php">Prod. Nao Movimentados</a>
                                    </li> -->
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>produtos_varejo/index.php">Produtos Varejo</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>vendedores_orcamentos/index.php">Vendedores Orçamentos</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>logs/index.php">Logs</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>descontos/index.php">Descontos</a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                    </li>

                    <li class="has-submenu">
                        <a href="#">
                            <i class="mdi mdi-file-chart-outline" style="font-size: 20px;"></i>Performance <div class="arrow-down"></div></a>
                        <ul class="submenu megamenu">
                            <li>
                                <ul>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>performance/index.php">Faturamento Geral</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>performance_vendedores/index.php">Fat. Geral (<?= $nome_para_vendedores ?>)</a>
                                    </li>
                                    <li>
                                        <a href="<?php echo PATH_SIS; ?>performance_medicos/index.php">Fat. Geral (Médicos)</a>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                    </li>

                </ul>
                <!-- End navigation menu -->


                <div class="clearfix"></div>
            </div>
            <!-- end #navigation -->
        </div>
        <!-- end container -->
    </div>
    <!-- end navbar-custom -->

</header>
<!-- End Navigation Bar-->