25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

196 satır
8.0KB

  1. <?php
  2. $maxCount = 0;
  3. foreach ($model->campaignsByType as $row) {
  4. if ((int) $row['campaign_count'] > $maxCount) {
  5. $maxCount = (int) $row['campaign_count'];
  6. }
  7. }
  8. $maxCustomerCount = 0;
  9. foreach ($model->customersByType as $row) {
  10. if ((int) $row['customer_count'] > $maxCustomerCount) {
  11. $maxCustomerCount = (int) $row['customer_count'];
  12. }
  13. }
  14. ?>
  15. <section class="content-stack">
  16. <div class="page-toolbar">
  17. <div class="section-heading">
  18. <h1>Dashboard</h1>
  19. <p>Overview of your campaign tracking data.</p>
  20. </div>
  21. </div>
  22. <div class="stats-grid stats-grid-4">
  23. <a class="stat-card" href="/campaign-types">
  24. <span>Campaign Types</span>
  25. <strong><?= e((string) $model->totalCampaignTypes) ?></strong>
  26. </a>
  27. <a class="stat-card" href="/campaigns">
  28. <span>Campaigns</span>
  29. <strong><?= e((string) $model->totalCampaigns) ?></strong>
  30. </a>
  31. <a class="stat-card" href="/job-types">
  32. <span>Job Types</span>
  33. <strong><?= e((string) $model->totalJobTypes) ?></strong>
  34. </a>
  35. <a class="stat-card" href="/jobs">
  36. <span>Jobs</span>
  37. <strong><?= e((string) $model->totalJobs) ?></strong>
  38. </a>
  39. <a class="stat-card" href="/customer-types">
  40. <span>Customer Types</span>
  41. <strong><?= e((string) $model->totalCustomerTypes) ?></strong>
  42. </a>
  43. <a class="stat-card" href="/customers">
  44. <span>Customers</span>
  45. <strong><?= e((string) $model->totalCustomers) ?></strong>
  46. </a>
  47. </div>
  48. <div class="dashboard-panels">
  49. <section class="section-panel">
  50. <div class="panel-header">
  51. <div>
  52. <h2>Recent Campaigns</h2>
  53. <p>The 5 most recently created campaigns.</p>
  54. </div>
  55. <a class="button button-secondary button-sm" href="/campaigns">View All</a>
  56. </div>
  57. <?php if (empty($model->recentCampaigns)): ?>
  58. <div class="empty-state">
  59. <p>No campaigns yet.</p>
  60. <p><a href="/campaigns/create">Create your first campaign</a></p>
  61. </div>
  62. <?php else: ?>
  63. <table class="dashboard-table">
  64. <thead>
  65. <tr>
  66. <th>ID</th>
  67. <th>Type</th>
  68. <th>Created</th>
  69. <th></th>
  70. </tr>
  71. </thead>
  72. <tbody>
  73. <?php foreach ($model->recentCampaigns as $row): ?>
  74. <tr>
  75. <td class="dashboard-table-id">#<?= e((string) $row['id']) ?></td>
  76. <td><?= e($row['campaign_type_name']) ?></td>
  77. <td class="dashboard-table-date"><?= e(date('M j, Y', strtotime((string) $row['created_at']))) ?></td>
  78. <td class="dashboard-table-action"><a href="/campaigns/<?= e((string) $row['id']) ?>/edit">Edit</a></td>
  79. </tr>
  80. <?php endforeach; ?>
  81. </tbody>
  82. </table>
  83. <?php endif; ?>
  84. </section>
  85. <section class="section-panel">
  86. <div class="panel-header">
  87. <div>
  88. <h2>Campaigns by Type</h2>
  89. <p>Campaign count per campaign type.</p>
  90. </div>
  91. <a class="button button-secondary button-sm" href="/campaign-types">Manage Types</a>
  92. </div>
  93. <?php if (empty($model->campaignsByType)): ?>
  94. <div class="empty-state">
  95. <p>No campaign types yet.</p>
  96. <p><a href="/campaign-types/create">Create your first type</a></p>
  97. </div>
  98. <?php else: ?>
  99. <div class="type-breakdown">
  100. <?php foreach ($model->campaignsByType as $row): ?>
  101. <?php $pct = $maxCount > 0 ? round((int) $row['campaign_count'] / $maxCount * 100) : 0; ?>
  102. <a class="type-breakdown-row" href="/campaigns">
  103. <span class="type-name"><?= e($row['campaign_type_name']) ?></span>
  104. <span class="type-bar-wrap">
  105. <span class="type-bar" style="width: <?= e((string) $pct) ?>%"></span>
  106. </span>
  107. <span class="type-count"><?= e((string) $row['campaign_count']) ?></span>
  108. </a>
  109. <?php endforeach; ?>
  110. </div>
  111. <?php endif; ?>
  112. </section>
  113. </div>
  114. <div class="dashboard-panels">
  115. <section class="section-panel">
  116. <div class="panel-header">
  117. <div>
  118. <h2>Recent Customers</h2>
  119. <p>The 5 most recently created customers.</p>
  120. </div>
  121. <a class="button button-secondary button-sm" href="/customers">View All</a>
  122. </div>
  123. <?php if (empty($model->recentCustomers)): ?>
  124. <div class="empty-state">
  125. <p>No customers yet.</p>
  126. <p><a href="/customers/create">Create your first customer</a></p>
  127. </div>
  128. <?php else: ?>
  129. <table class="dashboard-table">
  130. <thead>
  131. <tr>
  132. <th>ID</th>
  133. <th>Type</th>
  134. <th>Created</th>
  135. <th></th>
  136. </tr>
  137. </thead>
  138. <tbody>
  139. <?php foreach ($model->recentCustomers as $row): ?>
  140. <tr>
  141. <td class="dashboard-table-id">#<?= e((string) $row['id']) ?></td>
  142. <td><?= e($row['customer_type_name']) ?></td>
  143. <td class="dashboard-table-date"><?= e(date('M j, Y', strtotime((string) $row['created_at']))) ?></td>
  144. <td class="dashboard-table-action"><a href="/customers/<?= e((string) $row['id']) ?>/edit">Edit</a></td>
  145. </tr>
  146. <?php endforeach; ?>
  147. </tbody>
  148. </table>
  149. <?php endif; ?>
  150. </section>
  151. <section class="section-panel">
  152. <div class="panel-header">
  153. <div>
  154. <h2>Customers by Type</h2>
  155. <p>Customer count per customer type.</p>
  156. </div>
  157. <a class="button button-secondary button-sm" href="/customer-types">Manage Types</a>
  158. </div>
  159. <?php if (empty($model->customersByType)): ?>
  160. <div class="empty-state">
  161. <p>No customer types yet.</p>
  162. <p><a href="/customer-types/create">Create your first type</a></p>
  163. </div>
  164. <?php else: ?>
  165. <div class="type-breakdown">
  166. <?php foreach ($model->customersByType as $row): ?>
  167. <?php $pct = $maxCustomerCount > 0 ? round((int) $row['customer_count'] / $maxCustomerCount * 100) : 0; ?>
  168. <a class="type-breakdown-row" href="/customers">
  169. <span class="type-name"><?= e($row['customer_type_name']) ?></span>
  170. <span class="type-bar-wrap">
  171. <span class="type-bar" style="width: <?= e((string) $pct) ?>%"></span>
  172. </span>
  173. <span class="type-count"><?= e((string) $row['customer_count']) ?></span>
  174. </a>
  175. <?php endforeach; ?>
  176. </div>
  177. <?php endif; ?>
  178. </section>
  179. </div>
  180. </section>

Powered by TurnKey Linux.