<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?= esc($title ?? 'Dashboard') ?> | PULSE</title>
    <meta name="csrf-token" content="<?= csrf_hash() ?>">
    <link rel="icon" type="image/svg+xml" href="<?= base_url('assets/img/pulse-logo.svg') ?>">

    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css">
    <link rel="stylesheet" href="<?= base_url('assets/css/enterprise.css') ?>">
    <?= $this->renderSection('styles') ?>
</head>
<body class="enterprise-body">

<?= $this->include('partials/enterprise_navbar') ?>

<div class="enterprise-shell">
<?= $this->include('partials/enterprise_sidebar') ?>

<main class="enterprise-main">
    <?php if (! empty($breadcrumbs)): ?>
        <nav aria-label="breadcrumb" class="enterprise-breadcrumb">
            <ol class="breadcrumb mb-0">
                <?php foreach ($breadcrumbs as $label => $url): ?>
                    <?php if (is_int($label)): ?>
                        <li class="breadcrumb-item active" aria-current="page"><?= esc($url) ?></li>
                    <?php else: ?>
                        <li class="breadcrumb-item"><a href="<?= esc($url) ?>"><?= esc($label) ?></a></li>
                    <?php endif; ?>
                <?php endforeach; ?>
            </ol>
        </nav>
    <?php endif; ?>

    <?php if (session()->getFlashdata('success')): ?>
        <div class="alert alert-success alert-dismissible fade show enterprise-alert" role="alert">
            <i class="fa-solid fa-circle-check me-2"></i><?= esc(session()->getFlashdata('success')) ?>
            <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
        </div>
    <?php endif; ?>
    <?php if (session()->getFlashdata('error')): ?>
        <div class="alert alert-danger alert-dismissible fade show enterprise-alert" role="alert">
            <i class="fa-solid fa-triangle-exclamation me-2"></i><?= esc(session()->getFlashdata('error')) ?>
            <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
        </div>
    <?php endif; ?>
    <?php if (session()->getFlashdata('warning')): ?>
        <div class="alert alert-warning alert-dismissible fade show enterprise-alert" role="alert">
            <i class="fa-solid fa-circle-exclamation me-2"></i><?= esc(session()->getFlashdata('warning')) ?>
            <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
        </div>
    <?php endif; ?>

    <?= $this->renderSection('content') ?>
</main>
</div>

<?= $this->include('partials/enterprise_footer') ?>

<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.bundle.min.js"></script>
<script src="<?= base_url('assets/js/app.js') ?>"></script>
<?php if (! empty($loadCharts)): ?>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/4.4.3/chart.umd.min.js"></script>
    <script src="<?= base_url('assets/js/dashboard.js') ?>"></script>
<?php endif; ?>
<?= $this->renderSection('scripts') ?>
</body>
</html>
