Overview of upcoming events

This commit is contained in:
2026-04-25 21:23:32 +02:00
parent f813056bf7
commit 8348f677a5
7 changed files with 108 additions and 8 deletions

View File

@@ -41,7 +41,10 @@ class DashboardController extends CommonController {
} }
public function getMyParticipations() : JsonResponse { public function getMyParticipations() : JsonResponse {
//dd($this->eventParticipants->getMyParticipations());
return response()->json(['myParticipations' => $this->eventParticipants->getMyParticipations()]); return response()->json(['myParticipations' => $this->eventParticipants->getMyParticipations()]);
} }
public function getUpcomingEvents() : JsonResponse {
return response()->json(['upcomingEvents' => $this->events->getUpcoming()]);
}
} }

View File

@@ -9,6 +9,7 @@ Route::middleware(IdentifyTenant::class)->group(function () {
Route::prefix('api/v1/dashboard')->group(function () { Route::prefix('api/v1/dashboard')->group(function () {
Route::get('/my-invoices', [DashboardController::class, 'getMyInvoices']); Route::get('/my-invoices', [DashboardController::class, 'getMyInvoices']);
Route::get('/open-cost-units', [DashboardController::class, 'getOpenCostUnits']); Route::get('/open-cost-units', [DashboardController::class, 'getOpenCostUnits']);
Route::get('/upcoming-events', [DashboardController::class, 'getUpcomingEvents']);
Route::get('/my-participations', [DashboardController::class, 'getMyParticipations']); Route::get('/my-participations', [DashboardController::class, 'getMyParticipations']);
}); });

View File

@@ -0,0 +1,40 @@
<script setup>
import {onMounted, reactive} from "vue";
const events = reactive({
'upcomingEvents': '',
})
onMounted(async () => {
const response = await fetch('/api/v1/dashboard/upcoming-events');
const data = await response.json();
Object.assign(events, data);
});
</script>
<template>
<table class="widget-content-item" v-if="events.upcomingEvents.length > 0">
<tr>
<td style="font-weight: bold">Veranstaltung</td>
<td style="font-weight: bold">Teilis</td>
<td style="font-weight: bold">Team</td>
<td style="font-weight: bold">GruFüs</td>
</tr>
<tr v-for="event in events.upcomingEvents">
<td><a :href="'/event/details/' + event.identifier" class="link">{{event.nameShort}}</a></td>
<td style="text-align: center;">{{event.countParticipant}}</td>
<td style="text-align: center;">{{event.countTeam}}</td>
<td style="text-align: center;">{{event.countVolunteer}}</td>
</tr>
</table>
<p v-else style="padding: 10px; font-weight: bold">Es existieren im Moment keine Veranstaltungen, für die du verantwortlich bist.</p>
</template>
<style scoped>
</style>

View File

@@ -107,10 +107,47 @@
<input type="button" value="Rundmail senden" @click="mailToGroup" /><br/> <input type="button" value="Rundmail senden" @click="mailToGroup" /><br/>
</div> </div>
</div> </div>
<div>
<table>
<tr>
<th style="width: 200px">Veranstaltung</th>
<td>{{ dynamicProps.event.name }}</td>
</tr>
<tr>
<th style="width: 200px">Beginn</th>
<td>{{ dynamicProps.event.eventBegin }}</td>
</tr>
<tr>
<th>Ende</th>
<td>{{ dynamicProps.event.eventEnd }}</td>
</tr>
<tr>
<th>Anmeldeschluss</th>
<td>{{dynamicProps.event.earlyBirdEnd.formatted}}</td>
</tr>
<tr>
<th>Nachmeldeschluss</th>
<td>{{dynamicProps.event.registrationFinalEnd.formatted}}</td>
</tr>
<tr>
<th>Anmelde-URL</th>
<td>
{{dynamicProps.event.url}}<br />
<img :src="'/print-event-code/' + dynamicProps.event.identifier" alt="Event Code" style="width: 150px; height: 150px; margin-top: 20px;" />
</td>
</tr>
</table>
</div>
<div class="event-flexbox-row bottom"> <div class="event-flexbox-row bottom">
<label style="font-size: 9pt;" class="link" @click="showCommonSettings">Allgemeine Einstellungen</label> &nbsp; <label style="font-size: 9pt;" class="link" @click="showCommonSettings">Allgemeine Einstellungen</label> &nbsp;
<label style="font-size: 9pt;" class="link" @click="showEventManagement">Veranstaltungsleitung</label> &nbsp; <label style="font-size: 9pt;" class="link" @click="showEventManagement">Veranstaltungsleitung</label> &nbsp;
<label style="font-size: 9pt;" class="link" @click="eventData()">Details für Einladung</label> &nbsp;
<label style="font-size: 9pt;" class="link" @click="showParticipationFees">Teilnahmegebühren</label> <label style="font-size: 9pt;" class="link" @click="showParticipationFees">Teilnahmegebühren</label>
<a style="font-size: 9pt;" class="link" :href="'/cost-unit/' + props.data.event.costUnit.id">Ausgabenübersicht</a> <a style="font-size: 9pt;" class="link" :href="'/cost-unit/' + props.data.event.costUnit.id">Ausgabenübersicht</a>
</div> </div>

View File

@@ -2,11 +2,13 @@
namespace App\Repositories; namespace App\Repositories;
use App\Enumerations\ParticipationType;
use App\Enumerations\UserRole; use App\Enumerations\UserRole;
use App\Models\CostUnit; use App\Models\CostUnit;
use App\Models\Event; use App\Models\Event;
use App\Resources\CostUnitResource; use App\Resources\CostUnitResource;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\Request;
use Psy\Readline\Hoa\EventBucket; use Psy\Readline\Hoa\EventBucket;
class EventRepository { class EventRepository {
@@ -17,11 +19,20 @@ class EventRepository {
} }
public function getUpcomming() : array { public function getUpcoming(int $maxCount = 5, bool $accessCheck = true) : array {
return $this->getEventsByCriteria([ $events = [];
foreach ( $this->getEventsByCriteria([
'archived' => false, '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 { public function getAvailable(bool $accessCheck = true) : array {

View File

@@ -64,7 +64,14 @@ class EventResource extends JsonResource{
ParticipationType::PARTICIPATION_TYPE_VOLUNTEER, ParticipationType::PARTICIPATION_TYPE_VOLUNTEER,
ParticipationType::PARTICIPATION_TYPE_OTHER, ParticipationType::PARTICIPATION_TYPE_OTHER,
] as $participationType) { ] 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); $returnArray['costUnit'] = new CostUnitResource($this->event->costUnit()->first())->toArray(true);

View File

@@ -4,6 +4,7 @@ import ShadowedBox from "../../Components/ShadowedBox.vue";
import MyInvoices from "../../../Domains/Dashboard/Views/Partials/Widgets/MyInvoices.vue"; import MyInvoices from "../../../Domains/Dashboard/Views/Partials/Widgets/MyInvoices.vue";
import OpenCostUnits from "../../../Domains/Dashboard/Views/Partials/Widgets/OpenCostUnits.vue"; import OpenCostUnits from "../../../Domains/Dashboard/Views/Partials/Widgets/OpenCostUnits.vue";
import MyParticipationsShort from "../../../Domains/Dashboard/Views/Partials/Widgets/MyParticipationsShort.vue"; import MyParticipationsShort from "../../../Domains/Dashboard/Views/Partials/Widgets/MyParticipationsShort.vue";
import UpcomingEvents from "../../../Domains/Dashboard/Views/Partials/Widgets/UpcomingEvents.vue";
</script> </script>
<template> <template>
@@ -16,7 +17,7 @@ import MyParticipationsShort from "../../../Domains/Dashboard/Views/Partials/Wid
<MyInvoices /> <MyInvoices />
</shadowed-box> </shadowed-box>
<shadowed-box class="widget-box"> <shadowed-box class="widget-box">
Widget 3 <UpcomingEvents />
</shadowed-box> </shadowed-box>
<shadowed-box class="widget-box"> <shadowed-box class="widget-box">
<OpenCostUnits /> <OpenCostUnits />