89 lines
4.7 KiB
PHP
89 lines
4.7 KiB
PHP
<?= $this->extend($layout ?? 'layouts/embed') ?>
|
|
|
|
<?= $this->section('styles') ?>
|
|
<link href="https://cdn.jsdelivr.net/npm/gridstack@10.3.1/dist/gridstack.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="<?= base_url('assets/css/dashboard.css') ?>">
|
|
<?= $this->endSection() ?>
|
|
|
|
<?= $this->section('content') ?>
|
|
<?php
|
|
$theme = (string) ($dashboard['theme'] ?? 'system');
|
|
$themeClass = match ($theme) {
|
|
'dark' => 'cb-theme-dark',
|
|
'light' => 'cb-theme-light',
|
|
default => 'cb-theme-system',
|
|
};
|
|
?>
|
|
<div class="cb-dash-shell <?= esc($themeClass) ?>" id="cbDashShell">
|
|
<div class="cb-dash-toolbar">
|
|
<div class="flex-grow-1 min-w-0">
|
|
<h1><?= esc($dashboard['name']) ?></h1>
|
|
<div class="cb-dash-meta"><?= esc($dashboard['description'] ?? '') ?></div>
|
|
</div>
|
|
<div class="d-flex flex-wrap align-items-center gap-1">
|
|
<button type="button" class="btn btn-sm btn-outline-secondary d-none cb-dash-icon-btn cb-dash-fs-btn" id="cbBtnFs" title="Fullscreen" aria-label="Fullscreen">
|
|
<span class="material-symbols-outlined cb-btn-icon" aria-hidden="true">open_in_full</span>
|
|
</button>
|
|
<div class="dropdown">
|
|
<button type="button" class="btn btn-sm btn-outline-secondary cb-dash-icon-btn dropdown-toggle-hide-caret" id="cbDashPdfMenuBtn" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false" title="PDF export & page breaks" aria-label="PDF export and page break options">
|
|
<span class="material-symbols-outlined cb-btn-icon" aria-hidden="true">picture_as_pdf</span>
|
|
</button>
|
|
<ul class="dropdown-menu dropdown-menu-end shadow border-0 rounded-3 p-2 cb-dash-pdf-dd" aria-labelledby="cbDashPdfMenuBtn">
|
|
<li>
|
|
<button type="button" class="dropdown-item rounded-2 d-flex align-items-center gap-2 fw-semibold" id="cbBtnExportDashPdf">
|
|
<span class="material-symbols-outlined flex-shrink-0" style="font-size:20px;">picture_as_pdf</span>
|
|
Export PDF
|
|
</button>
|
|
</li>
|
|
<li><hr class="dropdown-divider my-2"></li>
|
|
<li class="px-2 pb-1">
|
|
<div class="form-check form-switch mb-0">
|
|
<input class="form-check-input" type="checkbox" role="switch" id="cbChkDashPdfPageBreaks" checked>
|
|
<label class="form-check-label small" for="cbChkDashPdfPageBreaks">Page breaks in PDF</label>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="cb-dash-grid-wrap">
|
|
<div class="grid-stack" id="cbGridStack">
|
|
<?php foreach ($widgets as $w): ?>
|
|
<?php
|
|
$wid = (int) $w['id'];
|
|
$gx = (int) ($w['grid_x'] ?? 0);
|
|
$gy = (int) ($w['grid_y'] ?? 0);
|
|
$gw = max(1, (int) ($w['grid_w'] ?? 4));
|
|
$gh = max(1, (int) ($w['grid_h'] ?? 3));
|
|
?>
|
|
<div class="grid-stack-item" gs-id="<?= $wid ?>" gs-x="<?= $gx ?>" gs-y="<?= $gy ?>" gs-w="<?= $gw ?>" gs-h="<?= $gh ?>">
|
|
<div class="grid-stack-item-content p-0">
|
|
<div class="cb-dash-widget-mount" id="cb-w-<?= $wid ?>" data-widget-id="<?= $wid ?>"></div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<span id="cbEditHint" hidden></span>
|
|
<button type="button" id="cbBtnDiscard" hidden></button>
|
|
<button type="button" id="cbBtnSaveLayout" hidden></button>
|
|
<button type="button" id="cbBtnToggleEdit" hidden></button>
|
|
<span id="cbBtnToggleEditLabel" hidden></span>
|
|
<button type="button" id="cbBtnAddWidget" hidden></button>
|
|
|
|
<script id="cb-dash-boot" type="application/json"><?= json_encode($dashBoot, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT) ?></script>
|
|
<?= $this->endSection() ?>
|
|
|
|
<?= $this->section('scripts') ?>
|
|
<link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght@400;600&display=swap" rel="stylesheet">
|
|
<script src="https://cdn.jsdelivr.net/npm/gridstack@10.3.1/dist/gridstack-all.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/dompurify@3.1.6/dist/purify.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/jspdf@2.5.1/dist/jspdf.umd.min.js"></script>
|
|
<?= view('dashboard/_view_scripts') ?>
|
|
<?= $this->endSection() ?>
|