From 8348f677a5a1b4242dd0b102793c752fd906533b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20G=C3=BCnther?=
Date: Sat, 25 Apr 2026 21:23:32 +0200
Subject: [PATCH] Overview of upcoming events
---
.../Controllers/DashboardController.php | 5 ++-
app/Domains/Dashboard/Routes/api.php | 1 +
.../Views/Partials/Widgets/UpcomingEvents.vue | 40 +++++++++++++++++++
app/Domains/Event/Views/Partials/Overview.vue | 39 +++++++++++++++++-
app/Repositories/EventRepository.php | 19 +++++++--
app/Resources/EventResource.php | 9 ++++-
.../Partials/GlobalWidgets/GlobalWidgets.vue | 3 +-
7 files changed, 108 insertions(+), 8 deletions(-)
create mode 100644 app/Domains/Dashboard/Views/Partials/Widgets/UpcomingEvents.vue
diff --git a/app/Domains/Dashboard/Controllers/DashboardController.php b/app/Domains/Dashboard/Controllers/DashboardController.php
index 60e933d..db6cdd5 100644
--- a/app/Domains/Dashboard/Controllers/DashboardController.php
+++ b/app/Domains/Dashboard/Controllers/DashboardController.php
@@ -41,7 +41,10 @@ class DashboardController extends CommonController {
}
public function getMyParticipations() : JsonResponse {
- //dd($this->eventParticipants->getMyParticipations());
return response()->json(['myParticipations' => $this->eventParticipants->getMyParticipations()]);
}
+
+ public function getUpcomingEvents() : JsonResponse {
+ return response()->json(['upcomingEvents' => $this->events->getUpcoming()]);
+ }
}
diff --git a/app/Domains/Dashboard/Routes/api.php b/app/Domains/Dashboard/Routes/api.php
index ff48e23..a9d4cc9 100644
--- a/app/Domains/Dashboard/Routes/api.php
+++ b/app/Domains/Dashboard/Routes/api.php
@@ -9,6 +9,7 @@ Route::middleware(IdentifyTenant::class)->group(function () {
Route::prefix('api/v1/dashboard')->group(function () {
Route::get('/my-invoices', [DashboardController::class, 'getMyInvoices']);
Route::get('/open-cost-units', [DashboardController::class, 'getOpenCostUnits']);
+ Route::get('/upcoming-events', [DashboardController::class, 'getUpcomingEvents']);
Route::get('/my-participations', [DashboardController::class, 'getMyParticipations']);
});
diff --git a/app/Domains/Dashboard/Views/Partials/Widgets/UpcomingEvents.vue b/app/Domains/Dashboard/Views/Partials/Widgets/UpcomingEvents.vue
new file mode 100644
index 0000000..47f4557
--- /dev/null
+++ b/app/Domains/Dashboard/Views/Partials/Widgets/UpcomingEvents.vue
@@ -0,0 +1,40 @@
+
+
+
+
+
+ | Veranstaltung |
+ Teilis |
+ Team |
+ GruFüs |
+
+
+
+ | {{event.nameShort}} |
+ {{event.countParticipant}} |
+ {{event.countTeam}} |
+ {{event.countVolunteer}} |
+
+
+
+ Es existieren im Moment keine Veranstaltungen, für die du verantwortlich bist.
+
+
+
+
diff --git a/app/Domains/Event/Views/Partials/Overview.vue b/app/Domains/Event/Views/Partials/Overview.vue
index 22937a1..dfb34ca 100644
--- a/app/Domains/Event/Views/Partials/Overview.vue
+++ b/app/Domains/Event/Views/Partials/Overview.vue
@@ -107,10 +107,47 @@
+
+
+
+
+ | Veranstaltung |
+ {{ dynamicProps.event.name }} |
+
+
+ | Beginn |
+ {{ dynamicProps.event.eventBegin }} |
+
+
+
+ | Ende |
+ {{ dynamicProps.event.eventEnd }} |
+
+
+
+ | Anmeldeschluss |
+ {{dynamicProps.event.earlyBirdEnd.formatted}} |
+
+
+
+ | Nachmeldeschluss |
+ {{dynamicProps.event.registrationFinalEnd.formatted}} |
+
+
+
+ | Anmelde-URL |
+
+ {{dynamicProps.event.url}}
+
+ |
+
+
+
+
+
-
Ausgabenübersicht
diff --git a/app/Repositories/EventRepository.php b/app/Repositories/EventRepository.php
index a6afd28..4d479ea 100644
--- a/app/Repositories/EventRepository.php
+++ b/app/Repositories/EventRepository.php
@@ -2,11 +2,13 @@
namespace App\Repositories;
+use App\Enumerations\ParticipationType;
use App\Enumerations\UserRole;
use App\Models\CostUnit;
use App\Models\Event;
use App\Resources\CostUnitResource;
use Illuminate\Database\Eloquent\Collection;
+use Illuminate\Http\Request;
use Psy\Readline\Hoa\EventBucket;
class EventRepository {
@@ -17,11 +19,20 @@ class EventRepository {
}
- public function getUpcomming() : array {
- return $this->getEventsByCriteria([
+ public function getUpcoming(int $maxCount = 5, bool $accessCheck = true) : array {
+ $events = [];
+ foreach ( $this->getEventsByCriteria([
'archived' => false,
- 'upcomming' => true
- ]);
+
+ ],$accessCheck) as $event) {
+ if ($event->start_date > now()) {
+ $event = $event->toResource()->toArray(new Request());
+
+ $events[] = $event;
+ }
+ };
+
+ return array_slice($events, 0, $maxCount);
}
public function getAvailable(bool $accessCheck = true) : array {
diff --git a/app/Resources/EventResource.php b/app/Resources/EventResource.php
index 61a030b..89e7f12 100644
--- a/app/Resources/EventResource.php
+++ b/app/Resources/EventResource.php
@@ -64,7 +64,14 @@ class EventResource extends JsonResource{
ParticipationType::PARTICIPATION_TYPE_VOLUNTEER,
ParticipationType::PARTICIPATION_TYPE_OTHER,
] as $participationType) {
- $returnArray['participants'][$participationType] = $this->getParticipants($participationType);
+ $_t =$this->getParticipants($participationType);
+ $returnArray['participants'][$participationType] = $_t;
+ $returnArray['count' . ucfirst($participationType)] = $_t['count'];
+ }
+
+ $returnArray['nameShort'] = $returnArray['name'];
+ if (strlen($returnArray['nameShort']) > 15) {
+ $returnArray['nameShort'] = substr($returnArray['nameShort'], 8, 13) . '...';
}
$returnArray['costUnit'] = new CostUnitResource($this->event->costUnit()->first())->toArray(true);
diff --git a/app/Views/Partials/GlobalWidgets/GlobalWidgets.vue b/app/Views/Partials/GlobalWidgets/GlobalWidgets.vue
index 26f0a51..65d1d6b 100644
--- a/app/Views/Partials/GlobalWidgets/GlobalWidgets.vue
+++ b/app/Views/Partials/GlobalWidgets/GlobalWidgets.vue
@@ -4,6 +4,7 @@ import ShadowedBox from "../../Components/ShadowedBox.vue";
import MyInvoices from "../../../Domains/Dashboard/Views/Partials/Widgets/MyInvoices.vue";
import OpenCostUnits from "../../../Domains/Dashboard/Views/Partials/Widgets/OpenCostUnits.vue";
import MyParticipationsShort from "../../../Domains/Dashboard/Views/Partials/Widgets/MyParticipationsShort.vue";
+import UpcomingEvents from "../../../Domains/Dashboard/Views/Partials/Widgets/UpcomingEvents.vue";
@@ -16,7 +17,7 @@ import MyParticipationsShort from "../../../Domains/Dashboard/Views/Partials/Wid
- Widget 3
+