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 @@ + + + + + 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}}
+ Event Code +
+
+ +
    -   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";