fix(BE): show calendar and comps
This commit is contained in:
parent
35d7de8b49
commit
bb1c3c63d4
3 changed files with 26 additions and 12 deletions
|
@ -1,20 +1,21 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import CalendarShowEvent from "@/components/content/partials/CalendarShowEvent.vue";
|
|
||||||
import {computed, onMounted, type Ref, ref} from "vue";
|
import {computed, onMounted, type Ref, ref} from "vue";
|
||||||
import {useAuthStore} from "@/stores/auth.store.ts";
|
import {useAuthStore} from "@/stores/auth.store.ts";
|
||||||
import ShowCreateEditForm from "@partials/show/ShowCreateEditForm.vue";
|
|
||||||
import {baseShow, deleteShow} from "@models/show/show.ts";
|
import {baseShow, deleteShow} from "@models/show/show.ts";
|
||||||
import type {calendarShowEvent} from "@models/misc/calendarShowEvent.ts";
|
|
||||||
import { nextTick } from "vue";
|
|
||||||
|
|
||||||
import {baseShowInstance, getShowInstances, type ShowInstance} from "@models/show/showInstance.ts";
|
import {baseShowInstance, getShowInstances, type ShowInstance} from "@models/show/showInstance.ts";
|
||||||
import {setShowInstancesForCalendar} from "@/composables/content/dashboard_page.ts";
|
import {setShowInstancesForCalendar} from "@/composables/content/dashboard_page.ts";
|
||||||
import {baseShowDays, getShowDays} from "@models/show/showDays.ts";
|
import {baseShowDays, getShowDays} from "@models/show/showDays.ts";
|
||||||
|
import type {calendarShowEvent} from "@models/misc/calendarShowEvent.ts";
|
||||||
import ShowInstanceForm from "@partials/show/ShowInstanceForm.vue";
|
import ShowInstanceForm from "@partials/show/ShowInstanceForm.vue";
|
||||||
|
import ShowForm from "@partials/show/ShowForm.vue";
|
||||||
|
import CalendarShowEvent from "@partials/show/CalendarShowEvent.vue"
|
||||||
|
import {extractTime} from "@/helpers/DateFormatter.ts";
|
||||||
|
|
||||||
|
// Store
|
||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
const userRole = auth.userData.user.role;
|
const userRole = auth.userData.user.role;
|
||||||
|
|
||||||
|
// Data
|
||||||
const editMode = ref(false);
|
const editMode = ref(false);
|
||||||
const showCreateEditMode = ref(false);
|
const showCreateEditMode = ref(false);
|
||||||
const showInstanceCreateEditMode = ref(false);
|
const showInstanceCreateEditMode = ref(false);
|
||||||
|
@ -22,6 +23,9 @@ const showInstances = ref<ShowInstance[]>([]);
|
||||||
let showSelected = ref(baseShow());
|
let showSelected = ref(baseShow());
|
||||||
let selectedShowInstance = ref(baseShowInstance());
|
let selectedShowInstance = ref(baseShowInstance());
|
||||||
|
|
||||||
|
const shows: Ref<calendarShowEvent[]> = computed(() => setShowInstancesForCalendar(showInstances.value));
|
||||||
|
|
||||||
|
// Funcs
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const startOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 1);
|
const startOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 1);
|
||||||
|
@ -33,9 +37,6 @@ onMounted(async () => {
|
||||||
showInstances.value = await getShowInstances(options);
|
showInstances.value = await getShowInstances(options);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const shows: Ref<calendarShowEvent[]> = computed(() => setShowInstancesForCalendar(showInstances.value));
|
|
||||||
|
|
||||||
const toggleEditMode = () => {
|
const toggleEditMode = () => {
|
||||||
editMode.value = !editMode.value;
|
editMode.value = !editMode.value;
|
||||||
};
|
};
|
||||||
|
@ -51,7 +52,11 @@ const contextMenuEditInstance = (showInstanceId: number) => {
|
||||||
|
|
||||||
const contextMenuEditShow = async (showInstanceId: number) => {
|
const contextMenuEditShow = async (showInstanceId: number) => {
|
||||||
showSelected.value = showInstances.value[showInstanceId].show;
|
showSelected.value = showInstances.value[showInstanceId].show;
|
||||||
showSelected.value.showDays = await getShowDays({showId: showSelected.value.id, flattenShowDays: true});
|
let showDaysRules = await getShowDays({show_id: showSelected.value.id, flattenShowDays: true});
|
||||||
|
showDaysRules.firstShow = new Date(showDaysRules.firstShow);
|
||||||
|
// TODO Timezone problems
|
||||||
|
showDaysRules.startTime = extractTime(showDaysRules.startTime, true);
|
||||||
|
showSelected.value.showDays = showDaysRules;
|
||||||
showCreateEditMode.value = true;
|
showCreateEditMode.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,7 +84,7 @@ const resetItemEdited = () => {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<template v-if="showCreateEditMode || showInstanceCreateEditMode">
|
<template v-if="showCreateEditMode || showInstanceCreateEditMode">
|
||||||
<ShowCreateEditForm v-if="showCreateEditMode" :show="showSelected" @go-back="resetItemEdited" />
|
<ShowForm v-if="showCreateEditMode" :show="showSelected" @go-back="resetItemEdited" />
|
||||||
<ShowInstanceForm v-if="showInstanceCreateEditMode" :showInstance="selectedShowInstance" @toggle-menu-edit-instance="toggleMenuEditInstance" />
|
<ShowInstanceForm v-if="showInstanceCreateEditMode" :showInstance="selectedShowInstance" @toggle-menu-edit-instance="toggleMenuEditInstance" />
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
|
|
@ -1,8 +1,16 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
||||||
import {WeekDaysData} from "@models/show/ShowRepetition.ts";
|
import {WeekDaysData} from "@models/show/ShowRepetition.ts";
|
||||||
|
import type {PropType} from "vue";
|
||||||
|
import type {Show} from "@models/show/show.ts";
|
||||||
|
|
||||||
const selectedDays = defineModel()
|
const selectedDays = defineModel()
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
fixedDay: {
|
||||||
|
type: Number,
|
||||||
|
required: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -14,6 +22,7 @@ const selectedDays = defineModel()
|
||||||
v-model="selectedDays"
|
v-model="selectedDays"
|
||||||
:label="day.dayName"
|
:label="day.dayName"
|
||||||
:value="day.type"
|
:value="day.type"
|
||||||
|
:disabled="day.type === props.fixedDay"
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import type { PropType} from "vue";
|
||||||
import type {ContextMenuType} from "@models/misc/contextMenu"
|
import type {ContextMenuType} from "@models/misc/contextMenu"
|
||||||
import type {calendarShowEvent, ShowEventActionTrigger} from "@models/misc/calendarShowEvent.ts";
|
import type {calendarShowEvent, ShowEventActionTrigger} from "@models/misc/calendarShowEvent.ts";
|
||||||
import {calendarShowEventMenu} from "@models/misc/calendarShowEvent";
|
import {calendarShowEventMenu} from "@models/misc/calendarShowEvent";
|
||||||
import {ref, computed, onMounted} from 'vue';
|
import { ref } from 'vue';
|
||||||
import ContextMenu from '@partials/ContextMenu.vue';
|
import ContextMenu from '@partials/ContextMenu.vue';
|
||||||
|
|
||||||
const emit = defineEmits([
|
const emit = defineEmits([
|
Loading…
Add table
Add a link
Reference in a new issue