<h1>
    Bienvenid@ a <?= $_settings->info('name') ?>
    <small class="text-muted">
        (<?= $_settings->userdata('role') ?>)
    </small>
</h1>

<hr class="border-info">

<?php
function format_hours($hours = 0){
    if($hours <= 0){
        return "00:00";
    }
    $h = floor($hours);
    $m = round(($hours - $h) * 60);
    return sprintf("%02d:%02d", $h, $m);
}
?>

<div class="row">

    <!-- PROYECTOS REGISTRADOS -->
    <div class="col-lg-3 col-md-4 col-sm-6">
        <div class="info-box bg-gradient-light shadow">
            <span class="info-box-icon bg-gradient-primary">
                <i class="fas fa-tasks"></i>
            </span>
            <div class="info-box-content">
                <span class="info-box-text">Proyectos Registrados</span>
                <span class="info-box-number">
                    <?= $conn->query("SELECT id FROM projects")->num_rows ?>
                </span>
            </div>
        </div>
    </div>

    <!-- EN REVISIÓN / SEGUIMIENTO -->
    <div class="col-lg-3 col-md-4 col-sm-6">
        <div class="info-box bg-gradient-light shadow">
            <span class="info-box-icon bg-gradient-info">
                <i class="fas fa-spinner"></i>
            </span>
            <div class="info-box-content">
                <span class="info-box-text">En Seguimiento PMO</span>
                <span class="info-box-number">
                    <?= $conn->query("
                        SELECT id FROM projects
                        WHERE approval_status IN (1,3)
                    ")->num_rows ?>
                </span>
            </div>
        </div>
    </div>

    <!-- OBSERVADOS -->
    <div class="col-lg-3 col-md-4 col-sm-6">
        <div class="info-box bg-gradient-light shadow">
            <span class="info-box-icon bg-gradient-warning">
                <i class="fas fa-exclamation-triangle"></i>
            </span>
            <div class="info-box-content">
                <span class="info-box-text">Observados</span>
                <span class="info-box-number">
                    <?= $conn->query("
                        SELECT id FROM projects
                        WHERE approval_status IN (2,4)
                    ")->num_rows ?>
                </span>
            </div>
        </div>
    </div>

    <!-- LISTOS PARA COMITÉ -->
    <div class="col-lg-3 col-md-4 col-sm-6">
        <div class="info-box bg-gradient-light shadow">
            <span class="info-box-icon bg-gradient-success">
                <i class="fas fa-check-circle"></i>
            </span>
            <div class="info-box-content">
                <span class="info-box-text">Listos para Comité</span>
                <span class="info-box-number">
                    <?= $conn->query("
                        SELECT id FROM projects
                        WHERE approval_status = 7
                    ")->num_rows ?>
                </span>
            </div>
        </div>
    </div>

</div>

<hr>
