|
- <?php
- $maxCount = 0;
- foreach ($model->campaignsByType as $row) {
- if ((int) $row['campaign_count'] > $maxCount) {
- $maxCount = (int) $row['campaign_count'];
- }
- }
- ?>
- <section class="content-stack">
-
- <div class="page-toolbar">
- <div class="section-heading">
- <h1>Dashboard</h1>
- <p>Overview of your campaign tracking data.</p>
- </div>
- </div>
-
- <div class="stats-grid stats-grid-4">
- <a class="stat-card" href="/campaign-types">
- <span>Campaign Types</span>
- <strong><?= e((string) $model->totalCampaignTypes) ?></strong>
- </a>
- <a class="stat-card" href="/campaigns">
- <span>Campaigns</span>
- <strong><?= e((string) $model->totalCampaigns) ?></strong>
- </a>
- <a class="stat-card" href="/job-types">
- <span>Job Types</span>
- <strong><?= e((string) $model->totalJobTypes) ?></strong>
- </a>
- <a class="stat-card" href="/jobs">
- <span>Jobs</span>
- <strong><?= e((string) $model->totalJobs) ?></strong>
- </a>
- </div>
-
- <div class="dashboard-panels">
-
- <section class="section-panel">
- <div class="panel-header">
- <div>
- <h2>Recent Campaigns</h2>
- <p>The 5 most recently created campaigns.</p>
- </div>
- <a class="button button-secondary button-sm" href="/campaigns">View All</a>
- </div>
-
- <?php if (empty($model->recentCampaigns)): ?>
- <div class="empty-state">
- <p>No campaigns yet.</p>
- <p><a href="/campaigns/create">Create your first campaign</a></p>
- </div>
- <?php else: ?>
- <table class="dashboard-table">
- <thead>
- <tr>
- <th>ID</th>
- <th>Type</th>
- <th>Created</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- <?php foreach ($model->recentCampaigns as $row): ?>
- <tr>
- <td class="dashboard-table-id">#<?= e((string) $row['id']) ?></td>
- <td><?= e($row['campaign_type_name']) ?></td>
- <td class="dashboard-table-date"><?= e(date('M j, Y', strtotime((string) $row['created_at']))) ?></td>
- <td class="dashboard-table-action"><a href="/campaigns/<?= e((string) $row['id']) ?>/edit">Edit</a></td>
- </tr>
- <?php endforeach; ?>
- </tbody>
- </table>
- <?php endif; ?>
- </section>
-
- <section class="section-panel">
- <div class="panel-header">
- <div>
- <h2>Campaigns by Type</h2>
- <p>Campaign count per campaign type.</p>
- </div>
- <a class="button button-secondary button-sm" href="/campaign-types">Manage Types</a>
- </div>
-
- <?php if (empty($model->campaignsByType)): ?>
- <div class="empty-state">
- <p>No campaign types yet.</p>
- <p><a href="/campaign-types/create">Create your first type</a></p>
- </div>
- <?php else: ?>
- <div class="type-breakdown">
- <?php foreach ($model->campaignsByType as $row): ?>
- <?php $pct = $maxCount > 0 ? round((int) $row['campaign_count'] / $maxCount * 100) : 0; ?>
- <a class="type-breakdown-row" href="/campaigns">
- <span class="type-name"><?= e($row['campaign_type_name']) ?></span>
- <span class="type-bar-wrap">
- <span class="type-bar" style="width: <?= e((string) $pct) ?>%"></span>
- </span>
- <span class="type-count"><?= e((string) $row['campaign_count']) ?></span>
- </a>
- <?php endforeach; ?>
- </div>
- <?php endif; ?>
- </section>
-
- </div>
-
- </section>
|