Direct liunk to current event in mobile mode
This commit is contained in:
@@ -26,28 +26,7 @@ class GlobalDataProvider {
|
|||||||
'tenant' => app('tenant'),
|
'tenant' => app('tenant'),
|
||||||
'activeUsers' => $this->getActiveUsers(),
|
'activeUsers' => $this->getActiveUsers(),
|
||||||
'version' => config('app.version'),
|
'version' => config('app.version'),
|
||||||
]);
|
'currentEvent' => $this->getCurrentEventData(),
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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 {
|
private function generateNavbar() : array {
|
||||||
$eventRepository = new EventRepository();
|
$eventRepository = new EventRepository();
|
||||||
|
|
||||||
|
|
||||||
$navigation = [
|
$navigation = [
|
||||||
'personal' => [],
|
'personal' => [],
|
||||||
'common' => [],
|
'common' => [],
|
||||||
|
|||||||
@@ -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 {
|
public function getUpcoming(int $maxCount = 5, bool $accessCheck = true) : array {
|
||||||
$events = [];
|
$events = [];
|
||||||
foreach ( $this->getEventsByCriteria([
|
foreach ( $this->getEventsByCriteria([
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {reactive, onMounted, ref} from 'vue';
|
import {reactive, onMounted, ref, computed} from 'vue';
|
||||||
import Icon from "../../../app/Views/Components/Icon.vue";
|
import Icon from "../../../app/Views/Components/Icon.vue";
|
||||||
import GlobalWidgets from "../../../app/Views/Partials/GlobalWidgets/GlobalWidgets.vue";
|
import GlobalWidgets from "../../../app/Views/Partials/GlobalWidgets/GlobalWidgets.vue";
|
||||||
import {toast} from "vue3-toastify";
|
import {toast} from "vue3-toastify";
|
||||||
@@ -20,7 +20,8 @@ const globalProps = reactive({
|
|||||||
currentPath: '/',
|
currentPath: '/',
|
||||||
errors: {},
|
errors: {},
|
||||||
availableLocalGroups: [],
|
availableLocalGroups: [],
|
||||||
message: ''
|
message: '',
|
||||||
|
currentEvent: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const sidebarOpen = ref(false);
|
const sidebarOpen = ref(false);
|
||||||
@@ -51,13 +52,15 @@ onMounted(async () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const currentPath = window.location.pathname;
|
const currentPath = window.location.pathname;
|
||||||
|
|
||||||
|
const showCurrentEventLink = computed(() => {
|
||||||
|
if (!globalProps.currentEvent) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return currentPath !== '/event/details/' + globalProps.currentEvent.identifier;
|
||||||
|
});
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
title: { type: String, default: 'App' },
|
title: { type: String, default: 'App' },
|
||||||
flash: { type: Object, default: () => ({}) }
|
flash: { type: Object, default: () => ({}) }
|
||||||
@@ -84,6 +87,16 @@ const props = defineProps({
|
|||||||
<label id="show_username" v-if="globalProps.user !== null">Willkommen, {{ globalProps.user.nicename }}</label>
|
<label id="show_username" v-if="globalProps.user !== null">Willkommen, {{ globalProps.user.nicename }}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<a
|
||||||
|
v-if="showCurrentEventLink"
|
||||||
|
:href="'/event/details/' + globalProps.currentEvent.identifier"
|
||||||
|
class="current-event-link"
|
||||||
|
:title="'Zur Veranstaltung: ' + globalProps.currentEvent.name"
|
||||||
|
>
|
||||||
|
<Icon name="calendar-day" />
|
||||||
|
<span class="current-event-link-label">{{ globalProps.currentEvent.name }}</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
<div class="header-actions" v-if="globalProps.user !== null">
|
<div class="header-actions" v-if="globalProps.user !== null">
|
||||||
<div class="user-info">
|
<div class="user-info">
|
||||||
<a href="/messages" class="header-link-anonymous" title="Meine Nachrichten">
|
<a href="/messages" class="header-link-anonymous" title="Meine Nachrichten">
|
||||||
@@ -394,6 +407,34 @@ const props = defineProps({
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ─── Direktlink zum aktuellen Event ─── */
|
||||||
|
.current-event-link {
|
||||||
|
display: none; /* per Default ausgeblendet – nur auf Mobile sichtbar */
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
|
||||||
|
color: #1d4899;
|
||||||
|
font-weight: bold;
|
||||||
|
text-decoration: none;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-right: 10px;
|
||||||
|
max-width: 50%;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.current-event-link:hover {
|
||||||
|
background-color: #1d4899;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.current-event-link-label {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
/* ═══════════════════════════════════════════
|
/* ═══════════════════════════════════════════
|
||||||
TABLET (640px – 1023px)
|
TABLET (640px – 1023px)
|
||||||
═══════════════════════════════════════════ */
|
═══════════════════════════════════════════ */
|
||||||
@@ -455,6 +496,14 @@ const props = defineProps({
|
|||||||
height: 60px;
|
height: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.current-event-link {
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.current-event-link-label {
|
||||||
|
max-width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
.left-side h1 {
|
.left-side h1 {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user