Reporting – Showcase Reporting
The Showcase Reporting section provides a leadership dashboard that aggregates registration totals for all Prep Network websites by season. It enables administrators and event managers to select a season, view per-site registration data, and analyze trends at a glance.
Purpose
- Aggregate and display registration counts for showcase events across all websites.
- Support current or selected seasons.
- Render a tabbed dashboard for easy comparison.
Architecture
- Route:
GET /showcase-report→ protected byauthandrole:Admin|Event Manager - Controller:
DashboardController@showcaseReport()instantiatesShowcaseReport - Report Class:
App\Reports\ShowcaseReport– builds data array - Blade View:
resources/views/dashboard/reports/showcase-report.blade.php– renders tabs & Livewire components - Livewire Component:
showcase-report– handles per-tab rendering and charting
Route Definition
| Method | URI | Controller | Middleware |
|---|---|---|---|
| GET | /showcase-report |
DashboardController@showcaseReport |
auth, `role:Admin |
ShowcaseReport Class
Located at app/Reports/ShowcaseReport.php, this class encapsulates data collection and view rendering.
registrations()
Fetches all websites, counts showcase events per site, and builds a registration data array:
public function registrations()
{
$websites = Website::all();
$season = request()->get('season') ?: 'current_season';
if ($season === 'current_season') {
$season = date('Y');
}
$registration_data = [];
foreach ($websites as $site) {
$count = Event::where('type','showcase')
->where('internal_status','!=','Cancelled')
->where('season',$season)
->where('website_id',$site->id)
->count();
if ($count) {
$registration_data[] = [
'website' => $site->name,
'current_season' => $season,
'color' => $site->color,
];
}
}
// Prepend "All" tab
array_unshift($registration_data, [
'website' => 'All',
'current_season' => 'current_season',
'color' => '#000000',
]);
return $registration_data;
}
- Loops through Website models.
- Filters Event by type, status, season, and site.
- Excludes cancelled events.
view()
Returns the Blade view with the computed data:
public function view()
{
return view('dashboard.reports.showcase-report', [
'registration_data' => $this->registrations(),
]);
}
Blade View: Showcase Report
File: resources/views/dashboard/reports/showcase-report.blade.php
<div class="block block-rounded">
<div class="block-header">
<h3 class="block-title">Showcase Registrations</h3>
<form>
<input hidden name="reportType" value="showcase">
<label for="season">Season:</label>
<select name="season" onchange="this.form.submit()">
<option value="current_season">Current Season</option>
@foreach(range(date('Y',strtotime('+1 year')), 2020) as $yr)
<option {{ request()->get('season') == $yr ? 'selected' : '' }}>
{{ $yr }}
</option>
@endforeach
</select>
</form>
</div>
<ul class="nav nav-tabs">
@foreach($registration_data as $i => $site)
<li class="nav-item">
<a class="nav-link {{ $i==0?'active':'' }}"
style="color: {{ $site['color'] }}"
data-toggle="tab"
href="#{{ slugify($site['website']) }}">
{{ $site['website'] }}
</a>
</li>
@endforeach
</ul>
<div class="tab-content">
@foreach($registration_data as $site)
@livewire('showcase-report', [
'website' => $site,
'season' => request()->get('season')
], key($site['website']))
@endforeach
</div>
</div>
- Header: Title + season selector.
- Tabs: One per website (including “All”), colored by site.
- Content: Each tab mounts Livewire to render details.
Data Flow Sequence
sequenceDiagram
participant U as User
participant B as Browser
participant S as Server
U->>B: Select "Showcases"
B->>S: GET /showcase-report?season=2024
S->>S: DashboardController@showcaseReport()
S->>R: ShowcaseReport->view()
R->>Website: Website::all()
R->>Event: Event::count() per site
R-->>S: registration_data array
S-->>B: Render Blade with tabs
B->>Livewire: Init 'showcase-report' components
Chart Rendering
Within each Livewire component panel, a Chart.js bar chart visualizes registrations by state. The component exposes:
states: array of state namesregistration_count: registration totals per statecolor: RGBA for bars
var ctx = document.getElementById('{{ slugify($website['website']) }}registrationChart').getContext('2d');
new Chart(ctx, {
type: 'bar',
data: {
labels: {!! json_encode($website['states']) !!},
datasets: [{
label: '# of Registrations',
data: {!! json_encode($website['registration_count']) !!},
backgroundColor: '{{ hex2rgba($website['color'],0.6) }}',
borderColor: '{{ hex2rgba($website['color']) }}',
borderWidth: 1
}]
},
options: { scales: { yAxes: [{ ticks: { beginAtZero:true, stepSize:10 } }] } }
});
Dependencies & Integration
- Models:
App\Models\Website,App\Models\Event. - Livewire:
showcase-reportcomponent (renders chart and details). - Front-end: Bootstrap/OneUI for layout, Chart.js for graphs.
- Routes: Defined in
routes/reports.phpunder Admin/Event Manager scope.
Best Practices & Notes 📌
{
"title": "Requirement",
"content": "Ensure Livewire is installed and Chart.js is loaded globally for the graphs."
}
- Always filter out cancelled events.
- Use consistent color schemes per site.
- Support season rollover by defaulting
current_seasonto current year.
This section empowers leadership with a clear, interactive overview of showcase event registrations, facilitating data-driven decisions across the Prep Network.