Compare commits
22 commits
milestone/
...
main
Author | SHA1 | Date | |
---|---|---|---|
caf1919930 | |||
d25fa07512 | |||
48502efc1d | |||
9a9742597a | |||
ea38b1835c | |||
802b7d25f0 | |||
d1bde66e1e | |||
dea2a1c40f | |||
f94cc8b365 | |||
238a35da9f | |||
d39ebc5029 | |||
9a7785917c | |||
fc1185d1c8 | |||
68b0aeffa8 | |||
8087108b90 | |||
5ce7aa8a17 | |||
d018f97274 | |||
6d45325543 | |||
1296331796 | |||
303ce7a58d | |||
e4c2f47eb0 | |||
387736721f |
17 changed files with 540 additions and 256 deletions
14
package-lock.json
generated
14
package-lock.json
generated
|
@ -1,17 +1,18 @@
|
||||||
{
|
{
|
||||||
"name": "ff-admin",
|
"name": "ff-admin",
|
||||||
"version": "1.3.5",
|
"version": "1.4.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ff-admin",
|
"name": "ff-admin",
|
||||||
"version": "1.3.5",
|
"version": "1.4.1",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fullcalendar/core": "^6.1.15",
|
"@fullcalendar/core": "^6.1.15",
|
||||||
"@fullcalendar/daygrid": "^6.1.15",
|
"@fullcalendar/daygrid": "^6.1.15",
|
||||||
"@fullcalendar/interaction": "^6.1.15",
|
"@fullcalendar/interaction": "^6.1.15",
|
||||||
|
"@fullcalendar/list": "^6.1.17",
|
||||||
"@fullcalendar/timegrid": "^6.1.15",
|
"@fullcalendar/timegrid": "^6.1.15",
|
||||||
"@fullcalendar/vue3": "^6.1.15",
|
"@fullcalendar/vue3": "^6.1.15",
|
||||||
"@headlessui/vue": "^1.7.23",
|
"@headlessui/vue": "^1.7.23",
|
||||||
|
@ -2379,6 +2380,15 @@
|
||||||
"@fullcalendar/core": "~6.1.17"
|
"@fullcalendar/core": "~6.1.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@fullcalendar/list": {
|
||||||
|
"version": "6.1.17",
|
||||||
|
"resolved": "https://registry.npmjs.org/@fullcalendar/list/-/list-6.1.17.tgz",
|
||||||
|
"integrity": "sha512-fkyK49F9IxwlGUBVhJGsFpd/LTi/vRVERLIAe1HmBaGkjwpxnynm8TMLb9mZip97wvDk3CmZWduMe6PxscAlow==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peerDependencies": {
|
||||||
|
"@fullcalendar/core": "~6.1.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@fullcalendar/timegrid": {
|
"node_modules/@fullcalendar/timegrid": {
|
||||||
"version": "6.1.17",
|
"version": "6.1.17",
|
||||||
"resolved": "https://registry.npmjs.org/@fullcalendar/timegrid/-/timegrid-6.1.17.tgz",
|
"resolved": "https://registry.npmjs.org/@fullcalendar/timegrid/-/timegrid-6.1.17.tgz",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "ff-admin",
|
"name": "ff-admin",
|
||||||
"version": "1.3.5",
|
"version": "1.4.1",
|
||||||
"description": "Feuerwehr/Verein Mitgliederverwaltung UI",
|
"description": "Feuerwehr/Verein Mitgliederverwaltung UI",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
"@fullcalendar/core": "^6.1.15",
|
"@fullcalendar/core": "^6.1.15",
|
||||||
"@fullcalendar/daygrid": "^6.1.15",
|
"@fullcalendar/daygrid": "^6.1.15",
|
||||||
"@fullcalendar/interaction": "^6.1.15",
|
"@fullcalendar/interaction": "^6.1.15",
|
||||||
|
"@fullcalendar/list": "^6.1.17",
|
||||||
"@fullcalendar/timegrid": "^6.1.15",
|
"@fullcalendar/timegrid": "^6.1.15",
|
||||||
"@fullcalendar/vue3": "^6.1.15",
|
"@fullcalendar/vue3": "^6.1.15",
|
||||||
"@headlessui/vue": "^1.7.23",
|
"@headlessui/vue": "^1.7.23",
|
||||||
|
|
181
src/components/CustomCalendar.vue
Normal file
181
src/components/CustomCalendar.vue
Normal file
|
@ -0,0 +1,181 @@
|
||||||
|
<template>
|
||||||
|
<div class="flex flex-col w-full h-full gap-2 justify-between overflow-hidden">
|
||||||
|
<div
|
||||||
|
class="flex flex-row gap-2 justify-between max-sm:justify-center"
|
||||||
|
:class="smallStyling ? 'max-lg:flex-wrap' : 'max-xl:flex-wrap'"
|
||||||
|
>
|
||||||
|
<div class="flex flex-row" :class="smallStyling ? 'max-lg:order-2' : 'max-xl:order-2'">
|
||||||
|
<button
|
||||||
|
:primary="view == 'dayGridMonth'"
|
||||||
|
:primary-outline="view != 'dayGridMonth'"
|
||||||
|
class="rounded-r-none!"
|
||||||
|
@click="setView('dayGridMonth')"
|
||||||
|
>
|
||||||
|
Monat
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
:primary="view == 'timeGridWeek'"
|
||||||
|
:primary-outline="view != 'timeGridWeek'"
|
||||||
|
class="rounded-none! border-x-0!"
|
||||||
|
@click="setView('timeGridWeek')"
|
||||||
|
>
|
||||||
|
Woche
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
:primary="view == 'listMonth'"
|
||||||
|
:primary-outline="view != 'listMonth'"
|
||||||
|
class="rounded-l-none!"
|
||||||
|
@click="setView('listMonth')"
|
||||||
|
>
|
||||||
|
Liste
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<p class="text-3xl w-full text-center" :class="smallStyling ? 'max-lg:order-1' : 'max-xl:order-1'">
|
||||||
|
{{ currentTitle }}
|
||||||
|
</p>
|
||||||
|
<div class="flex flex-row" :class="smallStyling ? 'max-lg:order-3' : 'max-xl:order-3'">
|
||||||
|
<button primary-outline class="rounded-r-none!" @click="navigateView('prev')">
|
||||||
|
<ChevronLeftIcon />
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
:primary="containsToday"
|
||||||
|
:primary-outline="!containsToday"
|
||||||
|
class="rounded-none! border-x-0!"
|
||||||
|
@click="
|
||||||
|
calendarApi?.today();
|
||||||
|
containsToday = true;
|
||||||
|
"
|
||||||
|
>
|
||||||
|
heute
|
||||||
|
</button>
|
||||||
|
<button primary-outline class="rounded-l-none!" @click="navigateView('next')">
|
||||||
|
<ChevronRightIcon />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col w-full grow overflow-hidden">
|
||||||
|
<FullCalendar ref="fullCalendar" :options="calendarOptions" class="max-h-full h-full" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { defineComponent, type PropType } from "vue";
|
||||||
|
import FullCalendar from "@fullcalendar/vue3";
|
||||||
|
import deLocale from "@fullcalendar/core/locales/de";
|
||||||
|
import dayGridPlugin from "@fullcalendar/daygrid";
|
||||||
|
import timeGridPlugin from "@fullcalendar/timegrid";
|
||||||
|
import listPlugin from "@fullcalendar/list";
|
||||||
|
import interactionPlugin from "@fullcalendar/interaction";
|
||||||
|
import { ChevronLeftIcon, ChevronRightIcon } from "@heroicons/vue/24/outline";
|
||||||
|
import type { CalendarOptions } from "@fullcalendar/core/index.js";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default defineComponent({
|
||||||
|
props: {
|
||||||
|
items: {
|
||||||
|
type: Array as PropType<
|
||||||
|
{
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
start: string;
|
||||||
|
end: string;
|
||||||
|
backgroundColor: string;
|
||||||
|
}[]
|
||||||
|
>,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
allowInteraction: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
smallStyling: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
emits: {
|
||||||
|
dateSelect: ({ start, end, allDay }: { start: string; end: string; allDay: boolean }) => {
|
||||||
|
return typeof start == "string" && typeof end == "string" && typeof allDay === "boolean";
|
||||||
|
},
|
||||||
|
eventSelect: (id: string) => {
|
||||||
|
return typeof id == "string";
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
view: "dayGridMonth" as "dayGridMonth" | "timeGridWeek" | "listMonth",
|
||||||
|
calendarApi: null as null | typeof FullCalendar,
|
||||||
|
currentTitle: "" as string,
|
||||||
|
containsToday: false as boolean,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
calendarOptions() {
|
||||||
|
return {
|
||||||
|
timeZone: "local",
|
||||||
|
locale: deLocale,
|
||||||
|
plugins: [dayGridPlugin, timeGridPlugin, listPlugin, interactionPlugin],
|
||||||
|
initialView: "dayGridMonth",
|
||||||
|
eventDisplay: "block",
|
||||||
|
headerToolbar: false,
|
||||||
|
weekends: true,
|
||||||
|
editable: this.allowInteraction,
|
||||||
|
selectable: this.allowInteraction,
|
||||||
|
selectMirror: false,
|
||||||
|
dayMaxEvents: true,
|
||||||
|
weekNumbers: true,
|
||||||
|
displayEventTime: true,
|
||||||
|
nowIndicator: true,
|
||||||
|
weekText: "KW",
|
||||||
|
allDaySlot: false,
|
||||||
|
events: this.items,
|
||||||
|
select: this.select,
|
||||||
|
eventClick: this.eventClick,
|
||||||
|
} as CalendarOptions;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.calendarApi = (this.$refs.fullCalendar as typeof FullCalendar).getApi();
|
||||||
|
this.setTitle();
|
||||||
|
this.setContainsToday();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
setTitle() {
|
||||||
|
this.currentTitle = this.calendarApi?.view.title ?? "";
|
||||||
|
},
|
||||||
|
setView(view: "dayGridMonth" | "timeGridWeek" | "listMonth") {
|
||||||
|
this.calendarApi?.changeView(view);
|
||||||
|
this.view = view;
|
||||||
|
this.setTitle();
|
||||||
|
this.setContainsToday();
|
||||||
|
},
|
||||||
|
navigateView(change: "prev" | "next") {
|
||||||
|
if (change == "prev") {
|
||||||
|
this.calendarApi?.prev();
|
||||||
|
} else {
|
||||||
|
this.calendarApi?.next();
|
||||||
|
}
|
||||||
|
this.setTitle();
|
||||||
|
this.setContainsToday();
|
||||||
|
},
|
||||||
|
setContainsToday() {
|
||||||
|
const start = this.calendarApi?.view.currentStart;
|
||||||
|
const end = this.calendarApi?.view.currentEnd;
|
||||||
|
const today = new Date();
|
||||||
|
this.containsToday = today >= start && today < end;
|
||||||
|
},
|
||||||
|
select(e: any) {
|
||||||
|
this.$emit("dateSelect", {
|
||||||
|
start: e?.startStr ?? new Date().toISOString(),
|
||||||
|
end: e?.endStr ?? new Date().toISOString(),
|
||||||
|
allDay: e?.allDay ?? false,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
eventClick(e: any) {
|
||||||
|
this.$emit("eventSelect", e.event.id);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -30,6 +30,9 @@
|
||||||
v-if="allowPredefinedSelect && can('read', 'configuration', 'query_store')"
|
v-if="allowPredefinedSelect && can('read', 'configuration', 'query_store')"
|
||||||
class="flex flex-row gap-2 max-lg:w-full max-lg:order-10"
|
class="flex flex-row gap-2 max-lg:w-full max-lg:order-10"
|
||||||
>
|
>
|
||||||
|
<div v-if="!isAsStored" class="p-1 border border-gray-400 bg-gray-100 rounded-md" title="Änderung erkannt">
|
||||||
|
<DocumentCurrencyRupeeIcon class="text-gray-500 h-6 w-6 cursor-pointer" />
|
||||||
|
</div>
|
||||||
<select v-model="activeQueryId" class="max-h-[34px] py-0!">
|
<select v-model="activeQueryId" class="max-h-[34px] py-0!">
|
||||||
<option :value="undefined" disabled>gepeicherte Anfrage auswählen</option>
|
<option :value="undefined" disabled>gepeicherte Anfrage auswählen</option>
|
||||||
<option v-for="query in queries" :key="query.id" :value="query.id">
|
<option v-for="query in queries" :key="query.id" :value="query.id">
|
||||||
|
@ -70,7 +73,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="p-2 h-44 md:h-60 w-full overflow-y-auto">
|
<div class="p-2 h-44 md:h-60 w-full overflow-y-auto">
|
||||||
<textarea v-if="typeof value == 'string'" v-model="value" placeholder="SQL Query" class="h-full w-full" />
|
<textarea v-if="typeof value == 'string'" v-model="value" placeholder="SQL Query" class="h-full w-full" />
|
||||||
<Table v-else v-model="value" />
|
<Table v-else v-model="value" enableOrder />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -78,7 +81,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineAsyncComponent, defineComponent, markRaw, type PropType } from "vue";
|
import { defineAsyncComponent, defineComponent, markRaw, type PropType } from "vue";
|
||||||
import { mapActions, mapState, mapWritableState } from "pinia";
|
import { mapActions, mapState, mapWritableState } from "pinia";
|
||||||
import type { DynamicQueryStructure } from "@/types/dynamicQueries";
|
import { type DynamicQueryStructure } from "@/types/dynamicQueries";
|
||||||
import {
|
import {
|
||||||
ArchiveBoxArrowDownIcon,
|
ArchiveBoxArrowDownIcon,
|
||||||
CommandLineIcon,
|
CommandLineIcon,
|
||||||
|
@ -88,12 +91,15 @@ import {
|
||||||
RectangleGroupIcon,
|
RectangleGroupIcon,
|
||||||
TrashIcon,
|
TrashIcon,
|
||||||
SparklesIcon,
|
SparklesIcon,
|
||||||
|
DocumentCurrencyRupeeIcon,
|
||||||
} from "@heroicons/vue/24/outline";
|
} from "@heroicons/vue/24/outline";
|
||||||
import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder";
|
import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder";
|
||||||
import { useModalStore } from "@/stores/modal";
|
import { useModalStore } from "@/stores/modal";
|
||||||
import Table from "./Table.vue";
|
import Table from "./Table.vue";
|
||||||
import { useAbilityStore } from "@/stores/ability";
|
import { useAbilityStore } from "@/stores/ability";
|
||||||
import { useQueryStoreStore } from "@/stores/admin/configuration/queryStore";
|
import { useQueryStoreStore } from "@/stores/admin/configuration/queryStore";
|
||||||
|
import { v4 as uuid } from "uuid";
|
||||||
|
import cloneDeep from "lodash.clonedeep";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -102,6 +108,7 @@ export default defineComponent({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: [Object, String] as PropType<DynamicQueryStructure | string>,
|
type: [Object, String] as PropType<DynamicQueryStructure | string>,
|
||||||
default: {
|
default: {
|
||||||
|
id: uuid(),
|
||||||
select: "*",
|
select: "*",
|
||||||
table: "",
|
table: "",
|
||||||
where: [],
|
where: [],
|
||||||
|
@ -126,7 +133,12 @@ export default defineComponent({
|
||||||
} else {
|
} else {
|
||||||
this.queryMode = "builder";
|
this.queryMode = "builder";
|
||||||
}
|
}
|
||||||
this.value = query;
|
this.value = cloneDeep(query);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
value() {
|
||||||
|
if (typeof this.value != "string" && !this.value.id) {
|
||||||
|
this.value.id = uuid();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -149,6 +161,11 @@ export default defineComponent({
|
||||||
this.$emit("update:model-value", val);
|
this.$emit("update:model-value", val);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
isAsStored() {
|
||||||
|
let stored = this.queries.find((q) => q.id == this.activeQueryId);
|
||||||
|
if (!stored) return true;
|
||||||
|
return JSON.stringify(this.value) == JSON.stringify(stored.query);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchTableMetas();
|
this.fetchTableMetas();
|
||||||
|
@ -163,6 +180,7 @@ export default defineComponent({
|
||||||
this.activeQueryId = undefined;
|
this.activeQueryId = undefined;
|
||||||
if (typeof this.value != "string") {
|
if (typeof this.value != "string") {
|
||||||
this.value = {
|
this.value = {
|
||||||
|
id: uuid(),
|
||||||
select: "*",
|
select: "*",
|
||||||
table: "",
|
table: "",
|
||||||
where: [],
|
where: [],
|
||||||
|
@ -182,6 +200,7 @@ export default defineComponent({
|
||||||
this.activeQueryId = undefined;
|
this.activeQueryId = undefined;
|
||||||
if (this.queryMode == "builder") {
|
if (this.queryMode == "builder") {
|
||||||
this.value = {
|
this.value = {
|
||||||
|
id: uuid(),
|
||||||
select: "*",
|
select: "*",
|
||||||
table: "",
|
table: "",
|
||||||
where: [],
|
where: [],
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-row gap-2 items-center w-full">
|
<div class="flex flex-row gap-2 items-center w-full">
|
||||||
<select v-if="concat != '_'" v-model="concat" class="w-20! h-fit!">
|
<select v-if="!isFirst" v-model="concat" class="w-20! h-fit!">
|
||||||
<option value="" disabled>Verknüpfung auswählen</option>
|
<option value="" disabled>Verknüpfung auswählen</option>
|
||||||
<option v-for="operation in ['AND', 'OR']" :value="operation">
|
<option v-for="operation in ['AND', 'OR']" :value="operation">
|
||||||
{{ operation }}
|
{{ operation }}
|
||||||
|
@ -68,6 +68,10 @@ import { TrashIcon } from "@heroicons/vue/24/outline";
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
|
isFirst: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
table: {
|
table: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: "",
|
||||||
|
@ -78,9 +82,6 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
emits: ["update:model-value", "remove"],
|
emits: ["update:model-value", "remove"],
|
||||||
data() {
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useQueryBuilderStore, ["tableMetas"]),
|
...mapState(useQueryBuilderStore, ["tableMetas"]),
|
||||||
activeTable() {
|
activeTable() {
|
||||||
|
@ -144,5 +145,10 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
if (this.concat == "_") {
|
||||||
|
this.concat = "AND";
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-row gap-2">
|
<div class="flex flex-row gap-2">
|
||||||
<p class="w-14 min-w-14 pt-2">JOIN</p>
|
<p class="w-14 min-w-14 pt-2">I_JOIN</p>
|
||||||
<div class="flex flex-row flex-wrap gap-2 items-center w-full">
|
<div class="flex flex-row flex-wrap gap-2 items-center w-full">
|
||||||
<div class="flex flex-row flex-wrap gap-2 items-center justify-end w-full">
|
<div class="flex flex-row flex-wrap gap-2 items-center justify-end w-full">
|
||||||
<JoinTable
|
<JoinTable
|
||||||
v-for="(join, index) in value"
|
v-for="(join, index) in value"
|
||||||
:model-value="join"
|
:model-value="join"
|
||||||
:table="table"
|
:table="table"
|
||||||
|
:alreadyJoined="alreadyJoined"
|
||||||
@update:model-value="($event) => (value[index] = $event)"
|
@update:model-value="($event) => (value[index] = $event)"
|
||||||
@remove="removeAtIndex(index)"
|
@remove="removeAtIndex(index)"
|
||||||
/>
|
/>
|
||||||
|
@ -21,10 +22,11 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineComponent, type PropType } from "vue";
|
import { defineComponent, type PropType } from "vue";
|
||||||
import { mapActions, mapState } from "pinia";
|
import { mapActions, mapState } from "pinia";
|
||||||
import type { DynamicQueryStructure } from "@/types/dynamicQueries";
|
import { type DynamicQueryStructure, type JoinStructure } from "@/types/dynamicQueries";
|
||||||
import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder";
|
import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder";
|
||||||
import { PlusIcon } from "@heroicons/vue/24/outline";
|
import { PlusIcon } from "@heroicons/vue/24/outline";
|
||||||
import JoinTable from "./JoinTable.vue";
|
import JoinTable from "./JoinTable.vue";
|
||||||
|
import { v4 as uuid } from "uuid";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -35,24 +37,22 @@ export default defineComponent({
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Array as PropType<Array<DynamicQueryStructure & { foreignColumn: string }>>,
|
type: Array as PropType<Array<DynamicQueryStructure & JoinStructure>>,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
alreadyJoined: {
|
||||||
|
type: Array as PropType<Array<string>>,
|
||||||
default: [],
|
default: [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
emits: ["update:model-value"],
|
emits: ["update:model-value"],
|
||||||
data() {
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useQueryBuilderStore, ["tableMetas"]),
|
...mapState(useQueryBuilderStore, ["tableMetas"]),
|
||||||
activeTable() {
|
|
||||||
return this.tableMetas.find((tm) => tm.tableName == this.table);
|
|
||||||
},
|
|
||||||
value: {
|
value: {
|
||||||
get() {
|
get() {
|
||||||
return this.modelValue;
|
return this.modelValue;
|
||||||
},
|
},
|
||||||
set(val: Array<DynamicQueryStructure & { foreignColumn: string }>) {
|
set(val: Array<DynamicQueryStructure & JoinStructure>) {
|
||||||
this.$emit("update:model-value", val);
|
this.$emit("update:model-value", val);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -60,11 +60,13 @@ export default defineComponent({
|
||||||
methods: {
|
methods: {
|
||||||
addToValue() {
|
addToValue() {
|
||||||
this.value.push({
|
this.value.push({
|
||||||
|
id: uuid(),
|
||||||
select: "*",
|
select: "*",
|
||||||
table: "",
|
table: "",
|
||||||
where: [],
|
where: [],
|
||||||
join: [],
|
join: [],
|
||||||
orderBy: [],
|
orderBy: [],
|
||||||
|
type: "defined",
|
||||||
foreignColumn: "",
|
foreignColumn: "",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,13 +2,52 @@
|
||||||
<div class="flex flex-row gap-2 w-full">
|
<div class="flex flex-row gap-2 w-full">
|
||||||
<div class="flex flex-row gap-2 w-full">
|
<div class="flex flex-row gap-2 w-full">
|
||||||
<div class="flex flex-col gap-2 w-full">
|
<div class="flex flex-col gap-2 w-full">
|
||||||
<select v-model="foreignColumn" class="w-full">
|
<div class="flex flex-row gap-2 w-full">
|
||||||
<option value="" disabled>Relation auswählen</option>
|
<div
|
||||||
<option v-for="relation in activeTable?.relations" :value="relation.column">
|
v-if="false"
|
||||||
{{ relation.column }} -> {{ joinTableName(relation.referencedTableName) }}
|
class="h-fit p-1 border border-gray-400 hover:bg-gray-200 rounded-md"
|
||||||
</option>
|
title="Join Modus wechseln"
|
||||||
</select>
|
@click="swapJoinType(value.type)"
|
||||||
<Table v-model="value" disable-table-select />
|
>
|
||||||
|
<ArrowsUpDownIcon class="text-gray-500 h-6 w-6 cursor-pointer" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<select v-if="value.type == 'defined'" v-model="context" class="w-full">
|
||||||
|
<option value="" disabled>Relation auswählen</option>
|
||||||
|
<option
|
||||||
|
v-for="relation in activeTable?.relations"
|
||||||
|
:value="relation.column"
|
||||||
|
:disabled="
|
||||||
|
alreadyJoined.includes(joinTableName(relation.referencedTableName)) &&
|
||||||
|
joinTableName(relation.referencedTableName) != value.table
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{{ relation.column }} -> {{ joinTableName(relation.referencedTableName) }}
|
||||||
|
<span
|
||||||
|
v-if="
|
||||||
|
alreadyJoined.includes(joinTableName(relation.referencedTableName)) &&
|
||||||
|
joinTableName(relation.referencedTableName) != value.table
|
||||||
|
"
|
||||||
|
>
|
||||||
|
(Join auf dieser Ebene besteht schon)
|
||||||
|
</span>
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<div v-else class="flex flex-col w-full">
|
||||||
|
<select v-model="joinTable">
|
||||||
|
<option value="" disabled>Tabelle auswählen</option>
|
||||||
|
<option
|
||||||
|
v-for="table in tableMetas"
|
||||||
|
:value="table.tableName"
|
||||||
|
:disabled="alreadyJoined.includes(table.tableName) && table.tableName != value.table"
|
||||||
|
>
|
||||||
|
{{ table.tableName }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<input v-model="context" type="text" placeholder="Join Condition tabA.col = tabB.col" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Table v-model="value" disable-table-select :show-table-select="false" />
|
||||||
</div>
|
</div>
|
||||||
<div class="h-fit p-1 border border-gray-400 hover:bg-gray-200 rounded-md" @click="$emit('remove')">
|
<div class="h-fit p-1 border border-gray-400 hover:bg-gray-200 rounded-md" @click="$emit('remove')">
|
||||||
<TrashIcon class="text-gray-500 h-6 w-6 cursor-pointer" />
|
<TrashIcon class="text-gray-500 h-6 w-6 cursor-pointer" />
|
||||||
|
@ -20,11 +59,12 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineComponent, type PropType } from "vue";
|
import { defineComponent, type PropType } from "vue";
|
||||||
import { mapActions, mapState } from "pinia";
|
import { mapActions, mapState } from "pinia";
|
||||||
import type { DynamicQueryStructure } from "@/types/dynamicQueries";
|
import { type DynamicQueryStructure, type JoinStructure } from "@/types/dynamicQueries";
|
||||||
import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder";
|
import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder";
|
||||||
import Table from "./Table.vue";
|
import Table from "./Table.vue";
|
||||||
import { TrashIcon } from "@heroicons/vue/24/outline";
|
import { ArrowsUpDownIcon, TrashIcon } from "@heroicons/vue/24/outline";
|
||||||
import { joinTableName } from "@/helpers/queryFormatter";
|
import { joinTableName } from "@/helpers/queryFormatter";
|
||||||
|
import { v4 as uuid } from "uuid";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -35,25 +75,15 @@ export default defineComponent({
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Object as PropType<
|
type: Object as PropType<DynamicQueryStructure & JoinStructure>,
|
||||||
DynamicQueryStructure & {
|
required: true,
|
||||||
foreignColumn: string;
|
},
|
||||||
}
|
alreadyJoined: {
|
||||||
>,
|
type: Array as PropType<Array<string>>,
|
||||||
default: {
|
default: [],
|
||||||
select: "*",
|
|
||||||
table: "",
|
|
||||||
where: [],
|
|
||||||
join: [],
|
|
||||||
orderBy: [],
|
|
||||||
foreignColumn: "",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
emits: ["update:model-value", "remove"],
|
emits: ["update:model-value", "remove"],
|
||||||
data() {
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useQueryBuilderStore, ["tableMetas"]),
|
...mapState(useQueryBuilderStore, ["tableMetas"]),
|
||||||
activeTable() {
|
activeTable() {
|
||||||
|
@ -63,27 +93,59 @@ export default defineComponent({
|
||||||
get() {
|
get() {
|
||||||
return this.modelValue;
|
return this.modelValue;
|
||||||
},
|
},
|
||||||
set(
|
set(val: DynamicQueryStructure & JoinStructure) {
|
||||||
val: DynamicQueryStructure & {
|
|
||||||
foreignColumn: string;
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
this.$emit("update:model-value", val);
|
this.$emit("update:model-value", val);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
foreignColumn: {
|
context: {
|
||||||
get() {
|
get() {
|
||||||
return this.modelValue.foreignColumn;
|
if (this.modelValue.type == "defined") {
|
||||||
|
return this.modelValue.foreignColumn ?? "";
|
||||||
|
} else {
|
||||||
|
return this.modelValue.condition ?? "";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
set(val: string) {
|
||||||
|
if (this.modelValue.type == "defined") {
|
||||||
|
let relTable = this.activeTable?.relations.find((r) => r.column == val);
|
||||||
|
this.$emit("update:model-value", {
|
||||||
|
...this.modelValue,
|
||||||
|
foreignColumn: val,
|
||||||
|
table: joinTableName(relTable?.referencedTableName ?? ""),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$emit("update:model-value", {
|
||||||
|
...this.modelValue,
|
||||||
|
condition: val,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
joinTable: {
|
||||||
|
get(): string {
|
||||||
|
return this.modelValue.table;
|
||||||
},
|
},
|
||||||
set(val: string) {
|
set(val: string) {
|
||||||
let relTable = this.activeTable?.relations.find((r) => r.column == val);
|
|
||||||
this.$emit("update:model-value", {
|
this.$emit("update:model-value", {
|
||||||
...this.modelValue,
|
...this.modelValue,
|
||||||
foreignColumn: val,
|
table: val,
|
||||||
table: joinTableName(relTable?.referencedTableName ?? ""),
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
if (!this.value.id) {
|
||||||
|
this.value.id = uuid();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
swapJoinType(type: string) {
|
||||||
|
if (type == "defined") {
|
||||||
|
this.value.type = "custom";
|
||||||
|
} else {
|
||||||
|
this.value.type = "defined";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-row gap-2 w-full border border-gray-300 rounded-md p-1">
|
<div class="flex flex-row gap-2 w-full border border-gray-300 rounded-md p-1">
|
||||||
<select v-if="concat != '_'" v-model="concat" class="w-20! h-fit!">
|
<select v-if="isFirst" v-model="concat" class="w-20! h-fit!">
|
||||||
<option value="" disabled>Verknüpfung auswählen</option>
|
<option value="" disabled>Verknüpfung auswählen</option>
|
||||||
<option v-for="operation in ['AND', 'OR']" :value="operation">
|
<option v-for="operation in ['AND', 'OR']" :value="operation">
|
||||||
{{ operation }}
|
{{ operation }}
|
||||||
|
@ -28,6 +28,10 @@ import NestedWhere from "./NestedWhere.vue";
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
|
isFirst: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
table: {
|
table: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: "",
|
||||||
|
@ -38,9 +42,6 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
emits: ["update:model-value", "remove"],
|
emits: ["update:model-value", "remove"],
|
||||||
data() {
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useQueryBuilderStore, ["tableMetas"]),
|
...mapState(useQueryBuilderStore, ["tableMetas"]),
|
||||||
concat: {
|
concat: {
|
||||||
|
@ -60,5 +61,10 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
if (this.concat == "_") {
|
||||||
|
this.concat = "AND";
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,12 +1,17 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-row gap-2">
|
<div class="flex flex-row gap-2">
|
||||||
<p class="w-14 min-w-14 pt-2">ORDER</p>
|
<p class="w-14 min-w-14 pt-2">SORT</p>
|
||||||
<div class="flex flex-row flex-wrap gap-2 items-center w-full">
|
<div class="flex flex-row flex-wrap gap-2 items-center w-full">
|
||||||
<OrderStructure
|
<OrderStructure
|
||||||
v-for="(order, index) in value"
|
v-for="(order, index) in value"
|
||||||
:model-value="order"
|
:model-value="order"
|
||||||
:table="table"
|
:table="table"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
|
:alreadySorted="alreadySorted"
|
||||||
|
:notFirst="index != 0"
|
||||||
|
:notLast="index != value.length - 1"
|
||||||
|
@up="changeSort('up', index)"
|
||||||
|
@down="changeSort('down', index)"
|
||||||
@update:model-value="($event) => (value[index] = $event)"
|
@update:model-value="($event) => (value[index] = $event)"
|
||||||
@remove="removeAtIndex(index)"
|
@remove="removeAtIndex(index)"
|
||||||
/>
|
/>
|
||||||
|
@ -35,9 +40,15 @@ export default defineComponent({
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
|
// columns: {
|
||||||
|
// type: [Array, String] as PropType<"*" | Array<string>>,
|
||||||
|
// default: "*",
|
||||||
|
// },
|
||||||
columns: {
|
columns: {
|
||||||
type: [Array, String] as PropType<"*" | Array<string>>,
|
type: Array as PropType<
|
||||||
default: "*",
|
Array<{ table: string; id: string; depth: number; path: string[]; columns: "*" | string[] }>
|
||||||
|
>,
|
||||||
|
default: [],
|
||||||
},
|
},
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Array as PropType<Array<OrderByStructure>>,
|
type: Array as PropType<Array<OrderByStructure>>,
|
||||||
|
@ -50,6 +61,9 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useQueryBuilderStore, ["tableMetas"]),
|
...mapState(useQueryBuilderStore, ["tableMetas"]),
|
||||||
|
alreadySorted() {
|
||||||
|
return this.modelValue.map((m) => ({ id: m.id, col: m.column }));
|
||||||
|
},
|
||||||
value: {
|
value: {
|
||||||
get() {
|
get() {
|
||||||
return this.modelValue;
|
return this.modelValue;
|
||||||
|
@ -62,6 +76,9 @@ export default defineComponent({
|
||||||
methods: {
|
methods: {
|
||||||
addToValue() {
|
addToValue() {
|
||||||
this.value.push({
|
this.value.push({
|
||||||
|
id: "",
|
||||||
|
depth: 0,
|
||||||
|
table: "",
|
||||||
column: "",
|
column: "",
|
||||||
order: "ASC",
|
order: "ASC",
|
||||||
});
|
});
|
||||||
|
@ -69,6 +86,12 @@ export default defineComponent({
|
||||||
removeAtIndex(index: number) {
|
removeAtIndex(index: number) {
|
||||||
this.value.splice(index, 1);
|
this.value.splice(index, 1);
|
||||||
},
|
},
|
||||||
|
changeSort(dir: "up" | "down", index: number) {
|
||||||
|
const swapIndex = dir === "up" ? index - 1 : index + 1;
|
||||||
|
if (swapIndex >= 0 && swapIndex < this.value.length) {
|
||||||
|
[this.value[index], this.value[swapIndex]] = [this.value[swapIndex], this.value[index]];
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,15 +1,26 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-row gap-2 items-center w-full">
|
<div class="flex flex-row gap-2 items-center w-full">
|
||||||
|
<div class="flex flex-col min-w-fit">
|
||||||
|
<ChevronUpIcon v-if="notFirst" class="w-4 h-4 stroke-2 cursor-pointer" @click.prevent="$emit('up')" />
|
||||||
|
<ChevronDownIcon v-if="notLast" class="w-4 h-4 stroke-2 cursor-pointer" @click.prevent="$emit('down')" />
|
||||||
|
</div>
|
||||||
<select v-model="column" class="w-full">
|
<select v-model="column" class="w-full">
|
||||||
<option value="" disabled>Spalte auswählen</option>
|
<option value="" disabled>Spalte auswählen</option>
|
||||||
<option v-for="column in selectableColumns" :value="column">
|
<option
|
||||||
{{ column }}
|
v-for="selectable in selectableColumns"
|
||||||
|
:value="`${selectable.id}_${selectable.column}`"
|
||||||
|
:disabled="
|
||||||
|
alreadySorted.some((as) => as.id == selectable.id && as.col == selectable.column) &&
|
||||||
|
`${selectable.id}_${selectable.column}` != column
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{{ [...selectable.path, selectable.table].join("-") }} -> {{ selectable.column }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<select v-model="order">
|
<select v-model="order">
|
||||||
<option value="" disabled>Sortierung auswählen</option>
|
<option value="" disabled>Sortierung auswählen</option>
|
||||||
<option v-for="order in ['ASC', 'DESC']" :value="order">
|
<option v-for="order in orderable" :value="order.key">
|
||||||
{{ order }}
|
{{ order.val }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<div class="p-1 border border-gray-400 hover:bg-gray-200 rounded-md" @click="$emit('remove')">
|
<div class="p-1 border border-gray-400 hover:bg-gray-200 rounded-md" @click="$emit('remove')">
|
||||||
|
@ -23,47 +34,102 @@ import { defineComponent, type PropType } from "vue";
|
||||||
import { mapActions, mapState } from "pinia";
|
import { mapActions, mapState } from "pinia";
|
||||||
import type { OrderByStructure, OrderByType } from "@/types/dynamicQueries";
|
import type { OrderByStructure, OrderByType } from "@/types/dynamicQueries";
|
||||||
import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder";
|
import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder";
|
||||||
import { TrashIcon } from "@heroicons/vue/24/outline";
|
import { TrashIcon, ChevronDownIcon, ChevronUpIcon } from "@heroicons/vue/24/outline";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
|
notFirst: {
|
||||||
|
type: Boolean,
|
||||||
|
defailt: false,
|
||||||
|
},
|
||||||
|
notLast: {
|
||||||
|
type: Boolean,
|
||||||
|
defailt: false,
|
||||||
|
},
|
||||||
table: {
|
table: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
|
// columns: {
|
||||||
|
// type: [Array, String] as PropType<"*" | Array<string>>,
|
||||||
|
// default: "*",
|
||||||
|
// },
|
||||||
columns: {
|
columns: {
|
||||||
type: [Array, String] as PropType<"*" | Array<string>>,
|
type: Array as PropType<
|
||||||
default: "*",
|
Array<{ table: string; id: string; depth: number; path: string[]; columns: "*" | string[] }>
|
||||||
|
>,
|
||||||
|
default: [],
|
||||||
},
|
},
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Object as PropType<OrderByStructure>,
|
type: Object as PropType<OrderByStructure>,
|
||||||
default: {},
|
default: {},
|
||||||
},
|
},
|
||||||
|
alreadySorted: {
|
||||||
|
type: Array as PropType<Array<{ id: string; col: string }>>,
|
||||||
|
default: [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
emits: ["update:model-value", "remove", "up", "down"],
|
||||||
|
watch: {
|
||||||
|
columns() {
|
||||||
|
if (!this.columns.some((c) => c.id == this.modelValue.id)) {
|
||||||
|
this.$emit("remove");
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
emits: ["update:model-value", "remove"],
|
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {
|
||||||
|
orderable: [
|
||||||
|
{ key: "ASC", val: "Aufsteigend (ABC)" },
|
||||||
|
{ key: "DESC", val: "Absteigend (CBA)" },
|
||||||
|
],
|
||||||
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useQueryBuilderStore, ["tableMetas"]),
|
...mapState(useQueryBuilderStore, ["tableMetas"]),
|
||||||
|
// selectableColumns() {
|
||||||
|
// if (this.columns == "*") {
|
||||||
|
// let meta = this.tableMetas.find((tm) => tm.tableName == this.table);
|
||||||
|
// if (!meta) return [];
|
||||||
|
// let relCols = meta.relations.map((r) => r.column);
|
||||||
|
// return meta.columns.map((c) => c.column).filter((c) => !relCols.includes(c));
|
||||||
|
// } else {
|
||||||
|
// return this.columns;
|
||||||
|
// }
|
||||||
|
// },
|
||||||
selectableColumns() {
|
selectableColumns() {
|
||||||
if (this.columns == "*") {
|
return this.columns.reduce(
|
||||||
let meta = this.tableMetas.find((tm) => tm.tableName == this.table);
|
(acc, curr) => {
|
||||||
if (!meta) return [];
|
if (curr.columns == "*") {
|
||||||
let relCols = meta.relations.map((r) => r.column);
|
let meta = this.tableMetas.find((tm) => tm.tableName == curr.table);
|
||||||
return meta.columns.map((c) => c.column).filter((c) => !relCols.includes(c));
|
if (meta) {
|
||||||
} else {
|
let relCols = meta.relations.map((r) => r.column);
|
||||||
return this.columns;
|
meta.columns
|
||||||
}
|
.map((c) => c.column)
|
||||||
|
.filter((c) => !relCols.includes(c))
|
||||||
|
.forEach((c) =>
|
||||||
|
acc.push({ id: curr.id, depth: curr.depth, table: curr.table, column: c, path: curr.path })
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
curr.columns.forEach((c) =>
|
||||||
|
acc.push({ id: curr.id, depth: curr.depth, table: curr.table, column: c, path: curr.path })
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
[] as Array<{ id: string; depth: number; table: string; column: string; path: string[] }>
|
||||||
|
);
|
||||||
},
|
},
|
||||||
column: {
|
column: {
|
||||||
get() {
|
get() {
|
||||||
return this.modelValue.column;
|
return `${this.modelValue.id}_${this.modelValue.column}`;
|
||||||
},
|
},
|
||||||
set(val: string) {
|
set(val: `${string}_${string}`) {
|
||||||
this.$emit("update:model-value", { ...this.modelValue, column: val });
|
let col = this.selectableColumns.find((sc) => sc.id == val.split("_")[0] && sc.column == val.split("_")[1]);
|
||||||
|
this.$emit("update:model-value", { ...this.modelValue, ...col });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
order: {
|
order: {
|
||||||
|
|
|
@ -1,23 +1,22 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col gap-2 w-full">
|
<div class="flex flex-col gap-2 w-full">
|
||||||
<TableSelect v-model="table" :disableTableSelect="disableTableSelect" />
|
<TableSelect v-if="showTableSelect" v-model="table" :disableTableSelect="disableTableSelect" />
|
||||||
<ColumnSelect v-if="table != ''" v-model="columnSelect" :table="table" />
|
<ColumnSelect v-if="table != ''" v-model="columnSelect" :table="table" />
|
||||||
<Where v-if="table != ''" v-model="where" :table="table" />
|
<Where v-if="table != ''" v-model="where" :table="table" />
|
||||||
<Order v-if="table != ''" v-model="order" :table="table" :columns="columnSelect" />
|
<Join v-if="table != ''" v-model="modelValue.join" :table="table" :alreadyJoined="alreadyJoined" />
|
||||||
<Join v-if="table != ''" v-model="modelValue.join" :table="table" />
|
<Order v-if="table != '' && enableOrder" v-model="order" :table="table" :columns="nestedTablesByDepth" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineComponent, type PropType } from "vue";
|
import { defineComponent, type PropType } from "vue";
|
||||||
import { mapActions, mapState } from "pinia";
|
import { type ConditionStructure, type DynamicQueryStructure, type OrderByStructure } from "@/types/dynamicQueries";
|
||||||
import type { ConditionStructure, DynamicQueryStructure, OrderByStructure } from "@/types/dynamicQueries";
|
|
||||||
import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder";
|
|
||||||
import ColumnSelect from "./ColumnSelect.vue";
|
import ColumnSelect from "./ColumnSelect.vue";
|
||||||
import Where from "./Where.vue";
|
import Where from "./Where.vue";
|
||||||
import Order from "./Order.vue";
|
import Order from "./Order.vue";
|
||||||
import Join from "./Join.vue";
|
import Join from "./Join.vue";
|
||||||
import TableSelect from "./TableSelect.vue";
|
import TableSelect from "./TableSelect.vue";
|
||||||
|
import { v4 as uuid } from "uuid";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -25,21 +24,50 @@ export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Object as PropType<DynamicQueryStructure>,
|
type: Object as PropType<DynamicQueryStructure>,
|
||||||
default: {
|
required: true,
|
||||||
select: "*",
|
|
||||||
table: "",
|
|
||||||
where: [],
|
|
||||||
join: [],
|
|
||||||
orderBy: [],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
disableTableSelect: {
|
disableTableSelect: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
enableOrder: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
showTableSelect: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
emits: ["update:model-value"],
|
emits: ["update:model-value"],
|
||||||
computed: {
|
computed: {
|
||||||
|
alreadyJoined() {
|
||||||
|
return this.modelValue.join?.map((j) => j.table);
|
||||||
|
},
|
||||||
|
nestedTablesByDepth() {
|
||||||
|
const tables: Array<{ table: string; id: string; depth: number; path: string[]; columns: "*" | string[] }> = [];
|
||||||
|
|
||||||
|
function recurse(item: DynamicQueryStructure, path: string[]) {
|
||||||
|
tables.push({ table: item.table, id: item.id, depth: path.length, path, columns: item.select });
|
||||||
|
if (item.join) {
|
||||||
|
item.join.forEach((child) => {
|
||||||
|
recurse(child, [...path, item.table]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
recurse(this.modelValue, []);
|
||||||
|
|
||||||
|
return tables;
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
get() {
|
||||||
|
return this.modelValue;
|
||||||
|
},
|
||||||
|
set(val: DynamicQueryStructure) {
|
||||||
|
this.$emit("update:model-value", val);
|
||||||
|
},
|
||||||
|
},
|
||||||
table: {
|
table: {
|
||||||
get() {
|
get() {
|
||||||
return this.modelValue.table || "";
|
return this.modelValue.table || "";
|
||||||
|
@ -81,5 +109,10 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
if (!this.value.id) {
|
||||||
|
this.value.id = uuid();
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<div v-for="(condition, index) in value" class="contents">
|
<div v-for="(condition, index) in value" class="contents">
|
||||||
<NestedCondition
|
<NestedCondition
|
||||||
v-if="condition.structureType == 'nested'"
|
v-if="condition.structureType == 'nested'"
|
||||||
|
:isFirst="index == 0"
|
||||||
:model-value="condition"
|
:model-value="condition"
|
||||||
:table="table"
|
:table="table"
|
||||||
@update:model-value="($event) => (value[index] = $event)"
|
@update:model-value="($event) => (value[index] = $event)"
|
||||||
|
@ -12,6 +13,7 @@
|
||||||
/>
|
/>
|
||||||
<Condition
|
<Condition
|
||||||
v-else
|
v-else
|
||||||
|
:isFirst="index == 0"
|
||||||
:model-value="condition"
|
:model-value="condition"
|
||||||
:table="table"
|
:table="table"
|
||||||
@update:model-value="($event) => (value[index] = $event)"
|
@update:model-value="($event) => (value[index] = $event)"
|
||||||
|
@ -74,14 +76,14 @@ export default defineComponent({
|
||||||
addNestedToValue() {
|
addNestedToValue() {
|
||||||
this.value.push({
|
this.value.push({
|
||||||
structureType: "nested",
|
structureType: "nested",
|
||||||
concat: this.value.length == 0 ? "_" : "AND",
|
concat: "AND",
|
||||||
conditions: [],
|
conditions: [],
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addConditionToValue() {
|
addConditionToValue() {
|
||||||
this.value.push({
|
this.value.push({
|
||||||
structureType: "condition",
|
structureType: "condition",
|
||||||
concat: this.value.length == 0 ? "_" : "AND",
|
concat: "AND",
|
||||||
operation: "eq",
|
operation: "eq",
|
||||||
column: "",
|
column: "",
|
||||||
value: "",
|
value: "",
|
||||||
|
|
28
src/main.css
28
src/main.css
|
@ -72,7 +72,7 @@ a[button] {
|
||||||
|
|
||||||
button[primary]:not([primary="false"]),
|
button[primary]:not([primary="false"]),
|
||||||
a[button][primary]:not([primary="false"]) {
|
a[button][primary]:not([primary="false"]) {
|
||||||
@apply border border-transparent text-white bg-primary hover:bg-primary;
|
@apply border-2 border-transparent text-white bg-primary hover:bg-primary;
|
||||||
}
|
}
|
||||||
|
|
||||||
button[primary-outline]:not([primary-outline="false"]),
|
button[primary-outline]:not([primary-outline="false"]),
|
||||||
|
@ -131,29 +131,3 @@ summary > svg {
|
||||||
summary::-webkit-details-marker {
|
summary::-webkit-details-marker {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fc-button-primary {
|
|
||||||
@apply bg-primary! border-primary! outline-hidden! ring-0! hover:bg-red-700! hover:border-red-700! h-10 text-center;
|
|
||||||
}
|
|
||||||
.fc-button-active {
|
|
||||||
@apply bg-red-500! border-red-500!;
|
|
||||||
}
|
|
||||||
.fc-toolbar {
|
|
||||||
@apply flex-wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For screens between 850px and 768px */
|
|
||||||
@media (max-width: 850px) and (min-width: 768px) {
|
|
||||||
.fc-header-toolbar.fc-toolbar.fc-toolbar-ltr > .fc-toolbar-chunk:nth-child(2) {
|
|
||||||
@apply order-1!;
|
|
||||||
}
|
|
||||||
/* Your styles for this range */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For screens between 525px and 0px */
|
|
||||||
@media (max-width: 525px) and (min-width: 0px) {
|
|
||||||
/* Your styles for this range */
|
|
||||||
.fc-header-toolbar.fc-toolbar.fc-toolbar-ltr > .fc-toolbar-chunk:nth-child(2) {
|
|
||||||
@apply order-1!;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
export interface DynamicQueryStructure {
|
export interface DynamicQueryStructure {
|
||||||
|
id: string;
|
||||||
select: string[] | "*";
|
select: string[] | "*";
|
||||||
table: string;
|
table: string;
|
||||||
where?: Array<ConditionStructure>;
|
where?: Array<ConditionStructure>;
|
||||||
join?: Array<DynamicQueryStructure & { foreignColumn: string }>;
|
join?: Array<DynamicQueryStructure & JoinStructure>;
|
||||||
orderBy?: Array<OrderByStructure>;
|
orderBy?: Array<OrderByStructure>; // only at top level
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ConditionStructure = (
|
export type ConditionStructure = (
|
||||||
|
@ -47,7 +48,12 @@ export type WhereOperation =
|
||||||
| "timespanEq"; // Date before x years (YYYY-01-01 <bis> YYYY-12-31)
|
| "timespanEq"; // Date before x years (YYYY-01-01 <bis> YYYY-12-31)
|
||||||
// TODO: age between | age equals | age greater | age smaller
|
// TODO: age between | age equals | age greater | age smaller
|
||||||
|
|
||||||
|
export type JoinStructure = { foreignColumn: string; type: "defined" } | { condition: string; type: "custom" };
|
||||||
|
|
||||||
export type OrderByStructure = {
|
export type OrderByStructure = {
|
||||||
|
id: string;
|
||||||
|
depth: number;
|
||||||
|
table: string;
|
||||||
column: string;
|
column: string;
|
||||||
order: OrderByType;
|
order: OrderByType;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,14 +4,17 @@
|
||||||
<div class="flex flex-row items-center justify-between pt-5 pb-3 px-7">
|
<div class="flex flex-row items-center justify-between pt-5 pb-3 px-7">
|
||||||
<h1 class="font-bold text-xl h-8">Kalender</h1>
|
<h1 class="font-bold text-xl h-8">Kalender</h1>
|
||||||
<div class="flex flex-row gap-2">
|
<div class="flex flex-row gap-2">
|
||||||
<PlusIcon class="text-gray-500 h-5 w-5 cursor-pointer" @click="select" />
|
<PlusIcon
|
||||||
|
class="text-gray-500 h-5 w-5 cursor-pointer"
|
||||||
|
@click="select({ start: '', end: '', allDay: false })"
|
||||||
|
/>
|
||||||
<LinkIcon class="text-gray-500 h-5 w-5 cursor-pointer" @click="openLinkModal" />
|
<LinkIcon class="text-gray-500 h-5 w-5 cursor-pointer" @click="openLinkModal" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #diffMain>
|
<template #diffMain>
|
||||||
<div class="flex flex-col w-full h-full gap-2 justify-between px-7 overflow-hidden">
|
<div class="flex flex-col w-full h-full gap-2 justify-between px-7 overflow-hidden">
|
||||||
<FullCalendar :options="calendarOptions" class="max-h-full h-full" />
|
<CustomCalendar :items="formattedItems" @date-select="select" @event-select="eventClick" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</MainTemplate>
|
</MainTemplate>
|
||||||
|
@ -22,14 +25,10 @@ import { defineComponent, markRaw, defineAsyncComponent } from "vue";
|
||||||
import { mapActions, mapState } from "pinia";
|
import { mapActions, mapState } from "pinia";
|
||||||
import { useModalStore } from "@/stores/modal";
|
import { useModalStore } from "@/stores/modal";
|
||||||
import MainTemplate from "@/templates/Main.vue";
|
import MainTemplate from "@/templates/Main.vue";
|
||||||
import FullCalendar from "@fullcalendar/vue3";
|
|
||||||
import deLocale from "@fullcalendar/core/locales/de";
|
|
||||||
import dayGridPlugin from "@fullcalendar/daygrid";
|
|
||||||
import timeGridPlugin from "@fullcalendar/timegrid";
|
|
||||||
import interactionPlugin from "@fullcalendar/interaction";
|
|
||||||
import { useCalendarStore } from "@/stores/admin/club/calendar";
|
import { useCalendarStore } from "@/stores/admin/club/calendar";
|
||||||
import { useAbilityStore } from "@/stores/ability";
|
import { useAbilityStore } from "@/stores/ability";
|
||||||
import { LinkIcon, PlusIcon } from "@heroicons/vue/24/outline";
|
import { LinkIcon, PlusIcon } from "@heroicons/vue/24/outline";
|
||||||
|
import CustomCalendar from "@/components/CustomCalendar.vue";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -40,33 +39,6 @@ export default defineComponent({
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useCalendarStore, ["formattedItems"]),
|
...mapState(useCalendarStore, ["formattedItems"]),
|
||||||
...mapState(useAbilityStore, ["can"]),
|
...mapState(useAbilityStore, ["can"]),
|
||||||
calendarOptions() {
|
|
||||||
return {
|
|
||||||
timeZone: "local",
|
|
||||||
locale: deLocale,
|
|
||||||
plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin],
|
|
||||||
initialView: "dayGridMonth",
|
|
||||||
headerToolbar: {
|
|
||||||
left: "dayGridMonth,timeGridWeek",
|
|
||||||
center: "title",
|
|
||||||
right: "prev,today,next",
|
|
||||||
},
|
|
||||||
eventDisplay: "block",
|
|
||||||
weekends: true,
|
|
||||||
editable: true,
|
|
||||||
selectable: true,
|
|
||||||
selectMirror: false,
|
|
||||||
dayMaxEvents: true,
|
|
||||||
weekNumbers: true,
|
|
||||||
displayEventTime: true,
|
|
||||||
nowIndicator: true,
|
|
||||||
weekText: "KW",
|
|
||||||
allDaySlot: false,
|
|
||||||
events: this.formattedItems,
|
|
||||||
select: this.select,
|
|
||||||
eventClick: this.eventClick,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchCalendars();
|
this.fetchCalendars();
|
||||||
|
@ -74,22 +46,22 @@ export default defineComponent({
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useModalStore, ["openModal"]),
|
...mapActions(useModalStore, ["openModal"]),
|
||||||
...mapActions(useCalendarStore, ["fetchCalendars"]),
|
...mapActions(useCalendarStore, ["fetchCalendars"]),
|
||||||
select(e: any) {
|
select({ start, end, allDay }: { start: string; end: string; allDay: boolean }) {
|
||||||
if (!this.can("create", "club", "calendar")) return;
|
if (!this.can("create", "club", "calendar")) return;
|
||||||
this.openModal(
|
this.openModal(
|
||||||
markRaw(defineAsyncComponent(() => import("@/components/admin/club/calendar/CreateCalendarModal.vue"))),
|
markRaw(defineAsyncComponent(() => import("@/components/admin/club/calendar/CreateCalendarModal.vue"))),
|
||||||
{
|
{
|
||||||
start: e?.startStr ?? new Date().toISOString(),
|
start,
|
||||||
end: e?.endStr ?? new Date().toISOString(),
|
end,
|
||||||
allDay: e?.allDay ?? false,
|
allDay,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
eventClick(e: any) {
|
eventClick(id: string) {
|
||||||
if (!this.can("update", "club", "calendar")) return;
|
if (!this.can("update", "club", "calendar")) return;
|
||||||
this.openModal(
|
this.openModal(
|
||||||
markRaw(defineAsyncComponent(() => import("@/components/admin/club/calendar/UpdateCalendarModal.vue"))),
|
markRaw(defineAsyncComponent(() => import("@/components/admin/club/calendar/UpdateCalendarModal.vue"))),
|
||||||
e.event.id
|
id
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
openLinkModal(e: any) {
|
openLinkModal(e: any) {
|
||||||
|
@ -99,55 +71,4 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
locale: deLocale,
|
|
||||||
events: this.absencesList.map((x) => ({
|
|
||||||
id: x.absenceId,
|
|
||||||
start: x.startDate,
|
|
||||||
end: x.endDate,
|
|
||||||
allday: true,
|
|
||||||
backgroundColor: this.getColorForAbsenceType(x.absenceType),
|
|
||||||
borderColor: '#ffffff',
|
|
||||||
title: this.getAbsenceType(x.absenceType) + ' ' + x.fullName,
|
|
||||||
})),
|
|
||||||
plugins: [
|
|
||||||
interactionPlugin,
|
|
||||||
dayGridPlugin,
|
|
||||||
timeGridPlugin,
|
|
||||||
listPlugin,
|
|
||||||
multiMonthPlugin,
|
|
||||||
],
|
|
||||||
initialView: 'dayGridMonth',
|
|
||||||
eventDisplay: 'block',
|
|
||||||
weekends: false,
|
|
||||||
editable: true,
|
|
||||||
selectable: true,
|
|
||||||
selectMirror: true,
|
|
||||||
dayMaxEvents: true,
|
|
||||||
weekNumbers: true,
|
|
||||||
displayEventTime: false,
|
|
||||||
weekText: 'KW',
|
|
||||||
validRange: { start: '2023-01-01', end: '' },
|
|
||||||
headerToolbar: {
|
|
||||||
left: 'today prev,next',
|
|
||||||
center: 'title',
|
|
||||||
right: 'listMonth,dayGridMonth,multiMonthYear,customview',
|
|
||||||
},
|
|
||||||
views: {
|
|
||||||
customview: {
|
|
||||||
type: 'multiMonth',
|
|
||||||
multiMonthMaxColumns: 1,
|
|
||||||
duration: { month: 12 },
|
|
||||||
buttonText: 'grid',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
dateClick: this.handleDateSelect.bind(this),
|
|
||||||
datesSet: this.handleMonthChange.bind(this),
|
|
||||||
select: this.handleDateSelect.bind(this),
|
|
||||||
eventClick: this.handleEventClick.bind(this),
|
|
||||||
eventsSet: this.handleEvents.bind(this),
|
|
||||||
};
|
|
||||||
|
|
||||||
*/
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -70,14 +70,11 @@ import { useQueryStoreStore } from "@/stores/admin/configuration/queryStore";
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useQueryBuilderStore, ["loading", "loadingData", "tableMetas", "data", "totalLength", "queryError"]),
|
...mapState(useQueryBuilderStore, ["loading", "loadingData", "data", "totalLength", "queryError"]),
|
||||||
...mapWritableState(useQueryBuilderStore, ["query"]),
|
...mapWritableState(useQueryBuilderStore, ["query"]),
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
this.fetchTableMetas();
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useQueryBuilderStore, ["fetchTableMetas", "sendQuery", "clearResults", "exportData"]),
|
...mapActions(useQueryBuilderStore, ["sendQuery", "clearResults", "exportData"]),
|
||||||
...mapActions(useQueryStoreStore, ["triggerSave"]),
|
...mapActions(useQueryStoreStore, ["triggerSave"]),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,12 @@
|
||||||
</template>
|
</template>
|
||||||
<template #diffMain>
|
<template #diffMain>
|
||||||
<div class="flex flex-col w-full h-full gap-2 justify-between px-7 overflow-hidden">
|
<div class="flex flex-col w-full h-full gap-2 justify-between px-7 overflow-hidden">
|
||||||
<FullCalendar :options="calendarOptions" class="max-h-full h-full" />
|
<CustomCalendar
|
||||||
|
:items="formattedItems"
|
||||||
|
:allow-interaction="false"
|
||||||
|
:small-styling="true"
|
||||||
|
@event-select="eventClick"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</MainTemplate>
|
</MainTemplate>
|
||||||
|
@ -23,14 +28,10 @@ import { defineComponent, markRaw, defineAsyncComponent } from "vue";
|
||||||
import { mapActions, mapState } from "pinia";
|
import { mapActions, mapState } from "pinia";
|
||||||
import { useModalStore } from "@/stores/modal";
|
import { useModalStore } from "@/stores/modal";
|
||||||
import MainTemplate from "@/templates/Main.vue";
|
import MainTemplate from "@/templates/Main.vue";
|
||||||
import FullCalendar from "@fullcalendar/vue3";
|
|
||||||
import deLocale from "@fullcalendar/core/locales/de";
|
|
||||||
import dayGridPlugin from "@fullcalendar/daygrid";
|
|
||||||
import timeGridPlugin from "@fullcalendar/timegrid";
|
|
||||||
import interactionPlugin from "@fullcalendar/interaction";
|
|
||||||
import { InformationCircleIcon, LinkIcon } from "@heroicons/vue/24/outline";
|
import { InformationCircleIcon, LinkIcon } from "@heroicons/vue/24/outline";
|
||||||
import type { CalendarViewModel } from "@/viewmodels/admin/club/calendar.models";
|
import type { CalendarViewModel } from "@/viewmodels/admin/club/calendar.models";
|
||||||
import { RouterLink } from "vue-router";
|
import { RouterLink } from "vue-router";
|
||||||
|
import CustomCalendar from "@/components/CustomCalendar.vue";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -50,32 +51,6 @@ export default defineComponent({
|
||||||
backgroundColor: c.type.color,
|
backgroundColor: c.type.color,
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
calendarOptions() {
|
|
||||||
return {
|
|
||||||
timeZone: "local",
|
|
||||||
locale: deLocale,
|
|
||||||
plugins: [dayGridPlugin, timeGridPlugin, interactionPlugin],
|
|
||||||
initialView: "dayGridMonth",
|
|
||||||
headerToolbar: {
|
|
||||||
left: "dayGridMonth,timeGridWeek",
|
|
||||||
center: "title",
|
|
||||||
right: "prev,today,next",
|
|
||||||
},
|
|
||||||
eventDisplay: "block",
|
|
||||||
weekends: true,
|
|
||||||
editable: false,
|
|
||||||
selectable: false,
|
|
||||||
selectMirror: false,
|
|
||||||
dayMaxEvents: true,
|
|
||||||
weekNumbers: true,
|
|
||||||
displayEventTime: true,
|
|
||||||
nowIndicator: true,
|
|
||||||
weekText: "KW",
|
|
||||||
allDaySlot: false,
|
|
||||||
events: this.formattedItems,
|
|
||||||
eventClick: this.eventClick,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchCalendars();
|
this.fetchCalendars();
|
||||||
|
@ -93,10 +68,10 @@ export default defineComponent({
|
||||||
openLinkModal(e: any) {
|
openLinkModal(e: any) {
|
||||||
this.openModal(markRaw(defineAsyncComponent(() => import("@/components/public/calendar/CalendarLinkModal.vue"))));
|
this.openModal(markRaw(defineAsyncComponent(() => import("@/components/public/calendar/CalendarLinkModal.vue"))));
|
||||||
},
|
},
|
||||||
eventClick(e: any) {
|
eventClick(id: string) {
|
||||||
this.openModal(
|
this.openModal(
|
||||||
markRaw(defineAsyncComponent(() => import("@/components/public/calendar/ShowCalendarEntryModal.vue"))),
|
markRaw(defineAsyncComponent(() => import("@/components/public/calendar/ShowCalendarEntryModal.vue"))),
|
||||||
this.calendars.find((c) => c.id == e.event.id)
|
this.calendars.find((c) => c.id == id)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue