<?php // inc/topBarNav.php ?>
<nav class="main-header navbar navbar-expand navbar-white navbar-light shadow-sm text-sm">

  <ul class="navbar-nav">
    <li class="nav-item">
      <a class="nav-link" data-widget="pushmenu" href="#" role="button">
        <i class="fas fa-bars"></i>
      </a>
    </li>

    <li class="nav-item d-none d-sm-inline-block">
      <a href="<?= base_url ?>admin/" class="nav-link font-weight-bold">
        <i class="fas fa-project-diagram text-danger"></i>
        <?= $_settings->info('short_name') ?>
      </a>
    </li>
  </ul>

  <ul class="navbar-nav ml-auto">

    <li class="nav-item dropdown">
      <a class="nav-link d-flex align-items-center" data-toggle="dropdown" href="#">
        <img src="<?= validate_image($_settings->userdata('avatar')) ?>"
             class="img-circle elevation-2 mr-2"
             style="height:30px;width:30px;object-fit:cover">
        <span class="d-none d-md-inline">
          <?= $_settings->userdata('firstname').' '.$_settings->userdata('lastname') ?>
        </span>
        <i class="fas fa-angle-down ml-2"></i>
      </a>

      <div class="dropdown-menu dropdown-menu-right shadow">
        <span class="dropdown-item-text text-sm">
          Rol: <b><?= $_settings->userdata('role') ?></b>
        </span>

        <div class="dropdown-divider"></div>

        <a href="<?= base_url ?>admin/?page=user" class="dropdown-item">
          <i class="fas fa-user-cog mr-2"></i> Mi cuenta
        </a>

        <div class="dropdown-divider"></div>

        <a href="<?= base_url ?>classes/Login.php?f=logout"
           class="dropdown-item text-danger">
          <i class="fas fa-sign-out-alt mr-2"></i> Cerrar sesión
        </a>
      </div>
    </li>

  </ul>
</nav>
