Direct liunk to current event in mobile mode

This commit is contained in:
2026-06-21 00:35:25 +02:00
parent 51c4055c47
commit e9aa66a860
3 changed files with 107 additions and 30 deletions
+39 -23
View File
@@ -26,28 +26,7 @@ class GlobalDataProvider {
'tenant' => app('tenant'),
'activeUsers' => $this->getActiveUsers(),
'version' => config('app.version'),
]);
}
public function getAllInvoiceTypes() : JsonResponse {
$invoiceTypes = [];
foreach (InvoiceType::orderBy('sort_order')->get() as $invoiceType) {
if (
$invoiceType->slug === InvoiceType::INVOICE_TYPE_OTHER
) {
continue;
}
$invoiceTypes[] = [
'slug' => $invoiceType->slug,
'name' => $invoiceType->name
];
}
$invoiceTypes[] = ['slug' => InvoiceType::INVOICE_TYPE_OTHER, 'name' => 'Sonstige Kosten'];
return response()->json([
'invoiceTypes' => $invoiceTypes
'currentEvent' => $this->getCurrentEventData(),
]);
}
@@ -99,10 +78,47 @@ class GlobalDataProvider {
]);
}
private function getCurrentEventData() : ?array {
if (null === $this->user) {
return null;
}
$currentEvent = new EventRepository()->getMyCurrentEvent();
if (null === $currentEvent) {
return null;
}
return [
'identifier' => $currentEvent->identifier,
'name' => $currentEvent->name,
];
}
public function getAllInvoiceTypes() : JsonResponse {
$invoiceTypes = [];
foreach (InvoiceType::orderBy('sort_order')->get() as $invoiceType) {
if (
$invoiceType->slug === InvoiceType::INVOICE_TYPE_OTHER
) {
continue;
}
$invoiceTypes[] = [
'slug' => $invoiceType->slug,
'name' => $invoiceType->name
];
}
$invoiceTypes[] = ['slug' => InvoiceType::INVOICE_TYPE_OTHER, 'name' => 'Sonstige Kosten'];
return response()->json([
'invoiceTypes' => $invoiceTypes
]);
}
private function generateNavbar() : array {
$eventRepository = new EventRepository();
$navigation = [
'personal' => [],
'common' => [],
+12
View File
@@ -20,6 +20,18 @@ class EventRepository {
}
public function getMyCurrentEvent() : ?Event {
$events = $this->getEventsByCriteria([
['archived', '=', false],
['start_date', '<=', now()],
['end_date', '>=', now()],
], true);
if (count($events) !== 1) {
return null;
}
return $events[0];
}
public function getUpcoming(int $maxCount = 5, bool $accessCheck = true) : array {
$events = [];
foreach ( $this->getEventsByCriteria([