Files
scoutiq/resources/views/admin/dashboard.php
2026-06-05 16:08:53 +03:00

108 lines
6.1 KiB
PHP

<div class="dashboard-header">
<div style="display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;">
<div>
<h1><?= $t['dashboard'] ?? 'Dashboard' ?></h1>
<p><?= $t['welcome'] ?? 'Welcome' ?>, <?= $this->escape($user['name']) ?></p>
</div>
<a href="/admin/sources" class="btn btn-primary"><?= $t['run_collector'] ?? 'Run Collector' ?></a>
</div>
</div>
<!-- Metrics Row -->
<div class="metrics-grid">
<div class="glass-panel metric-card">
<span class="metric-title"><?= $t['total_organizations'] ?? 'Organizations' ?></span>
<span class="metric-value"><?= $stats['organizations'] ?></span>
<span class="metric-footer">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="23 6 13.5 15.5 8.5 10.5 1 18"></polyline><polyline points="17 6 23 6 23 12"></polyline></svg>
<span><?= $stats['vc'] ?> VC • <?= $stats['accelerators'] ?> Accelerators</span>
</span>
</div>
<div class="glass-panel metric-card">
<span class="metric-title"><?= $t['total_opportunities'] ?? 'Opportunities' ?></span>
<span class="metric-value"><?= $stats['opportunities'] ?></span>
<span class="metric-footer">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="23 6 13.5 15.5 8.5 10.5 1 18"></polyline><polyline points="17 6 23 6 23 12"></polyline></svg>
<span><?= $stats['today'] ?> new today</span>
</span>
</div>
<div class="glass-panel metric-card">
<span class="metric-title"><?= $t['total_contacts'] ?? 'Contacts' ?></span>
<span class="metric-value"><?= $stats['contacts'] ?></span>
<span class="metric-footer">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="23 6 13.5 15.5 8.5 10.5 1 18"></polyline><polyline points="17 6 23 6 23 12"></polyline></svg>
<span><?= $t['view_all'] ?? 'View all' ?></span>
</span>
</div>
<div class="glass-panel metric-card">
<span class="metric-title"><?= $t['active_sources'] ?? 'Sources' ?></span>
<span class="metric-value"><?= $stats['sources'] ?></span>
<span class="metric-footer">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>
<span>RSS feeds active</span>
</span>
</div>
</div>
<div class="charts-grid">
<!-- Recent Opportunities -->
<div class="glass-panel chart-card">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;">
<span class="chart-title"><?= $t['recent_opportunities'] ?? 'Recent Opportunities' ?></span>
<a href="/admin/opportunities" class="btn btn-sm btn-secondary"><?= $t['view_all'] ?? 'View All' ?></a>
</div>
<div style="max-height: 400px; overflow-y: auto;">
<?php if (empty($recent_opportunities)): ?>
<p style="color: var(--text-muted); text-align: center; padding: 40px;">No opportunities yet. Run the collector to start gathering data.</p>
<?php else: ?>
<?php foreach ($recent_opportunities as $opp): ?>
<div class="list-item">
<div style="display: flex; justify-content: space-between; gap: 10px;">
<div style="flex: 1; min-width: 0;">
<a href="/admin/opportunities/<?= $opp['id'] ?>" style="font-weight: 600;"><?= $this->escape(mb_substr($opp['title'], 0, 80)) ?></a>
<div style="display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap;">
<span class="badge badge-type-<?= $opp['type'] ?>"><?= $this->escape($opp['type']) ?></span>
<span style="font-size: 0.8rem; color: var(--text-muted);">Score: <?= $opp['score'] ?></span>
</div>
</div>
<small style="color: var(--text-muted); white-space: nowrap;"><?= date('M j', strtotime($opp['created_at'])) ?></small>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
<!-- Recent Activities -->
<div class="glass-panel chart-card">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;">
<span class="chart-title"><?= $t['recent_activities'] ?? 'Recent Activity' ?></span>
</div>
<div style="max-height: 400px; overflow-y: auto;">
<?php if (empty($recent_activities)): ?>
<p style="color: var(--text-muted); text-align: center; padding: 40px;">No recent activity.</p>
<?php else: ?>
<?php foreach ($recent_activities as $activity): ?>
<div class="list-item">
<div style="display: flex; justify-content: space-between; gap: 10px;">
<div>
<span class="badge" style="background: rgba(139, 92, 246, 0.2); color: #a78bfa;"><?= $this->escape($activity['action'] ?? 'info') ?></span>
<span style="font-size: 0.85rem; color: var(--text-muted); margin-left: 8px;"><?= $this->escape(mb_substr($activity['description'] ?? '', 0, 100)) ?></span>
</div>
<small style="color: var(--text-muted); white-space: nowrap;"><?= date('M j, g:i a', strtotime($activity['created_at'])) ?></small>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
</div>
<style>
.list-item { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.list-item:last-child { border-bottom: none; }
</style>