fix [P-293]: создание календаря при создании события
This commit is contained in:
1 parent
27b5a7c953
commit
8595b3e75b
5 files changed
+649
-641
No files matched your search
@@ -34,7 +34,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref, onMounted, watch, computed } from 'vue';
|
import { ref, onMounted, watch, computed, provide } from 'vue';
|
||||||
import { useWeekendsStore } from '@/store/WeekendsStore';
|
import { useWeekendsStore } from '@/store/WeekendsStore';
|
||||||
import EventCreate from '@/components/calendar_of_events/event-create.vue';
|
import EventCreate from '@/components/calendar_of_events/event-create.vue';
|
||||||
import CustomCalendar from '@/components/calendar_of_events/UI_calendar/CustomCalendar.vue';
|
import CustomCalendar from '@/components/calendar_of_events/UI_calendar/CustomCalendar.vue';
|
||||||
@@ -56,6 +56,7 @@ export default {
|
|||||||
const eventFromCalendar = ref({});
|
const eventFromCalendar = ref({});
|
||||||
const eventKey = ref(0);
|
const eventKey = ref(0);
|
||||||
const calendarKey = ref(0);
|
const calendarKey = ref(0);
|
||||||
|
const miniCalendarRef = ref(null);
|
||||||
|
|
||||||
const calendarStore = useCalendarStore();
|
const calendarStore = useCalendarStore();
|
||||||
const accountStore = useAccountStore();
|
const accountStore = useAccountStore();
|
||||||
@@ -150,6 +151,12 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const openCalendarCreate = () => {
|
||||||
|
miniCalendarRef.value?.openCalendarCreate();
|
||||||
|
};
|
||||||
|
|
||||||
|
provide('openCalendarCreate', openCalendarCreate);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => calendarStore.showEventDialog,
|
() => calendarStore.showEventDialog,
|
||||||
(newValue, oldValue) => {
|
(newValue, oldValue) => {
|
||||||
@@ -226,6 +233,7 @@ export default {
|
|||||||
allCalendars,
|
allCalendars,
|
||||||
eventKey,
|
eventKey,
|
||||||
calendarKey,
|
calendarKey,
|
||||||
|
openCalendarCreate,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,9 +13,9 @@
|
|||||||
block
|
block
|
||||||
elevation="1"
|
elevation="1"
|
||||||
@click="openEventDialog"
|
@click="openEventDialog"
|
||||||
:disabled="!myCalendars || myCalendars.length === 0"
|
|
||||||
>Создать событие</v-btn
|
>Создать событие</v-btn
|
||||||
>
|
>
|
||||||
|
<!-- :disabled="!myCalendars || myCalendars.length === 0" -->
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col lg="3">
|
<v-col lg="3">
|
||||||
<v-locale-provider locale="ru">
|
<v-locale-provider locale="ru">
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
<v-col class="flex-column d-flex">
|
<v-col class="flex-column d-flex">
|
||||||
<v-row no-gutters class=" overflow-hidden flex-column flex-nowrap">
|
<v-row no-gutters class="overflow-hidden flex-column flex-nowrap">
|
||||||
<v-col>
|
<v-col>
|
||||||
<calendar-my
|
<calendar-my
|
||||||
:calendars="myCalendars"
|
:calendars="myCalendars"
|
||||||
@@ -68,6 +68,10 @@ export default {
|
|||||||
|
|
||||||
const { selectedDate, myCalendars, subscribedCalendars } = storeToRefs(calendarStore);
|
const { selectedDate, myCalendars, subscribedCalendars } = storeToRefs(calendarStore);
|
||||||
|
|
||||||
|
// const selectedDate = computed(() => calendarStore.selectedDate);
|
||||||
|
// const myCalendars = computed(() => calendarStore.myCalendars);
|
||||||
|
// const subscribedCalendars = computed(() => calendarStore.subscribedCalendars);
|
||||||
|
|
||||||
const { user } = storeToRefs(accountStore);
|
const { user } = storeToRefs(accountStore);
|
||||||
|
|
||||||
const currentDisplay = ref(null);
|
const currentDisplay = ref(null);
|
||||||
@@ -181,7 +185,7 @@ export default {
|
|||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
[myCalendars, subscribedCalendars],
|
() => [calendarStore.myCalendars, calendarStore.subscribedCalendars],
|
||||||
() => {
|
() => {
|
||||||
updateCalendarDays();
|
updateCalendarDays();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ export default {
|
|||||||
cl_descr: [(val) => req(val)],
|
cl_descr: [(val) => req(val)],
|
||||||
};
|
};
|
||||||
|
|
||||||
const isNewCalendar = computed(() => !propsCalendar.value.id);
|
const isNewCalendar = computed(() => !propsCalendar.value?.id);
|
||||||
const isAuthor = computed(() => propsCalendar.value.author === accountStore.user.is_idEmployee);
|
const isAuthor = computed(() => propsCalendar.value.author === accountStore.user.is_idEmployee);
|
||||||
|
|
||||||
const titleCard = computed(() =>
|
const titleCard = computed(() =>
|
||||||
@@ -217,41 +217,41 @@ export default {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// const color = [
|
const color = [
|
||||||
// '#0ea5e9', // Яркий голубой
|
'#0ea5e9', // Яркий голубой
|
||||||
// '#3b82f6', // Королевский синий
|
'#3b82f6', // Королевский синий
|
||||||
// '#10b981', // Изумрудно-зеленый
|
'#10b981', // Изумрудно-зеленый
|
||||||
// '#f59e0b', // Теплый янтарный
|
'#f59e0b', // Теплый янтарный
|
||||||
// '#ef4444', // Акцентный красный
|
'#ef4444', // Акцентный красный
|
||||||
// '#8b5cf6', // Фиолетовый
|
'#8b5cf6', // Фиолетовый
|
||||||
// '#4f46e5', // Индиго (профессиональный синий)
|
'#4f46e5', // Индиго (профессиональный синий)
|
||||||
// '#06b6d4', // Бирюзовый
|
'#06b6d4', // Бирюзовый
|
||||||
// '#84cc16', // Лаймовый
|
'#84cc16', // Лаймовый
|
||||||
// '#f97316', // Оранжевый
|
'#f97316', // Оранжевый
|
||||||
// '#ec4899', // Розовый
|
'#ec4899', // Розовый
|
||||||
// '#6366f1', // Фиолетово-синий
|
'#6366f1', // Фиолетово-синий
|
||||||
// '#14b8a6', // Бирюзово-зеленый
|
'#14b8a6', // Бирюзово-зеленый
|
||||||
// '#eab308', // Золотисто-желтый
|
'#eab308', // Золотисто-желтый
|
||||||
// '#22c55e', // Зеленый
|
'#22c55e', // Зеленый
|
||||||
// ];
|
];
|
||||||
|
|
||||||
const color = [
|
// const color = [
|
||||||
'#3b82f6', // Синий
|
// '#3b82f6', // Синий
|
||||||
'#10b981', // Зеленый
|
// '#10b981', // Зеленый
|
||||||
'#dc2626', // Красный
|
// '#dc2626', // Красный
|
||||||
'#d97706', // Оранжевый
|
// '#d97706', // Оранжевый
|
||||||
'#7c3aed', // Фиолетовый
|
// '#7c3aed', // Фиолетовый
|
||||||
'#0ea5e9', // Голубой
|
// '#0ea5e9', // Голубой
|
||||||
'#84cc16', // Лаймовый
|
// '#84cc16', // Лаймовый
|
||||||
'#f59e0b', // Янтарный
|
// '#f59e0b', // Янтарный
|
||||||
'#8b5cf6', // Пурпурный
|
// '#8b5cf6', // Пурпурный
|
||||||
'#06b6d4', // Бирюзовый
|
// '#06b6d4', // Бирюзовый
|
||||||
'#f97316', // Теплый оранжевый
|
// '#f97316', // Теплый оранжевый
|
||||||
'#6366f1', // Фиолетово-синий
|
// '#6366f1', // Фиолетово-синий
|
||||||
'#14b8a6', // Морской волны
|
// '#14b8a6', // Морской волны
|
||||||
'#ec4899', // Розовый
|
// '#ec4899', // Розовый
|
||||||
'#64748b', // Серо-синий
|
// '#64748b', // Серо-синий
|
||||||
];
|
// ];
|
||||||
const colorPik = (col) => {
|
const colorPik = (col) => {
|
||||||
if (propsCalendar.value.cl_color === col) {
|
if (propsCalendar.value.cl_color === col) {
|
||||||
propsCalendar.value.cl_color = null;
|
propsCalendar.value.cl_color = null;
|
||||||
|
|||||||
@@ -73,89 +73,78 @@
|
|||||||
</v-expansion-panels>
|
</v-expansion-panels>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
import { ref, watch } from 'vue';
|
import { onMounted, ref, watch } from 'vue';
|
||||||
import calendarCreate from '@/components/calendar_of_events/calendar-create.vue';
|
import calendarCreate from '@/components/calendar_of_events/calendar-create.vue';
|
||||||
import { useAccountStore } from '@/store/AccountStore';
|
import { useAccountStore } from '@/store/AccountStore';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { useCalendarStore } from '@/store/calendarStore';
|
import { useCalendarStore } from '@/store/calendarStore';
|
||||||
|
|
||||||
export default {
|
const props = defineProps({
|
||||||
components: { calendarCreate },
|
calendars: Array,
|
||||||
|
title: String,
|
||||||
|
});
|
||||||
|
|
||||||
props: {
|
const emit = defineEmits(['getCalendar']);
|
||||||
calendars: {
|
|
||||||
type: Array,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
|
|
||||||
title: {
|
const showDialog = ref(false);
|
||||||
type: String,
|
const accountStore = useAccountStore();
|
||||||
default: '',
|
const { user } = storeToRefs(accountStore);
|
||||||
},
|
const calendarStore = useCalendarStore();
|
||||||
},
|
const { toggleCalendarVisibility, hiddenCalendarIds } = calendarStore;
|
||||||
|
|
||||||
setup(props) {
|
const calendar = ref(null);
|
||||||
const showDialog = ref(false);
|
const openGroup = ref([0]);
|
||||||
const accountStore = useAccountStore();
|
// const trans = ref(false);
|
||||||
const { user } = storeToRefs(accountStore);
|
const hover = ref(0);
|
||||||
const calendarStore = useCalendarStore();
|
|
||||||
const { toggleCalendarVisibility, hiddenCalendarIds } = calendarStore;
|
|
||||||
|
|
||||||
const calendar = ref(null);
|
const editCreatedCalendar = (cal) => {
|
||||||
const openGroup = ref([0]);
|
if (cal === undefined) {
|
||||||
const trans = ref(false);
|
calendar.value = {
|
||||||
const hover = ref(0);
|
cl_name: '',
|
||||||
|
participant: [{ editor: true, participant_calendar: user.value.is_idEmployee }],
|
||||||
const editCreatedCalendar = (cal) => {
|
cl_color: 'red',
|
||||||
if (cal === undefined) {
|
cl_descr: '',
|
||||||
calendar.value = {
|
|
||||||
cl_name: '',
|
|
||||||
participant: [{ editor: true, participant_calendar: user.value.is_idEmployee }],
|
|
||||||
cl_color: 'red',
|
|
||||||
cl_descr: '',
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
calendar.value = { ...cal };
|
|
||||||
}
|
|
||||||
showDialog.value = true;
|
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
const handleCloseDialog = () => {
|
calendar.value = { ...cal };
|
||||||
showDialog.value = false;
|
}
|
||||||
};
|
showDialog.value = true;
|
||||||
|
|
||||||
const resetCalendar = () => {
|
|
||||||
calendar.value = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
const toggleVisiblityEvents = (cal) => {
|
|
||||||
toggleCalendarVisibility(cal.id);
|
|
||||||
};
|
|
||||||
|
|
||||||
watch(hiddenCalendarIds, (newHiddenIds) => {}, { deep: true });
|
|
||||||
|
|
||||||
watch(
|
|
||||||
() => props.calendars,
|
|
||||||
(newCalendars) => {},
|
|
||||||
{ deep: true },
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
accountStore,
|
|
||||||
user,
|
|
||||||
calendar,
|
|
||||||
showDialog,
|
|
||||||
editCreatedCalendar,
|
|
||||||
toggleVisiblityEvents,
|
|
||||||
openGroup,
|
|
||||||
trans,
|
|
||||||
hover,
|
|
||||||
handleCloseDialog,
|
|
||||||
resetCalendar,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
window.$createCalendar = () => {
|
||||||
|
editCreatedCalendar();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleCloseDialog = () => {
|
||||||
|
if (calendar.value.cl_name.length > 1) {
|
||||||
|
const calendarData = JSON.parse(JSON.stringify(calendar.value));
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent('calendarCreated', {
|
||||||
|
detail: calendarData,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
showDialog.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
const resetCalendar = () => {
|
||||||
|
calendar.value = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
const toggleVisiblityEvents = (cal) => {
|
||||||
|
toggleCalendarVisibility(cal.id);
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(hiddenCalendarIds, (newHiddenIds) => {}, { deep: true });
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.calendars,
|
||||||
|
(newCalendars) => {},
|
||||||
|
{ deep: true },
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -165,14 +154,14 @@ export default {
|
|||||||
height: 22px !important;
|
height: 22px !important;
|
||||||
border-radius: 3px !important;
|
border-radius: 3px !important;
|
||||||
margin-left: 0.5rem;
|
margin-left: 0.5rem;
|
||||||
background-color: #00897B !important;
|
background-color: #00897b !important;
|
||||||
color: white;
|
color: white;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.simple-hover:hover {
|
.simple-hover:hover {
|
||||||
background-color: #004D40 !important;
|
background-color: #004d40 !important;
|
||||||
transform: scale(1.1);
|
transform: scale(1.1);
|
||||||
}
|
}
|
||||||
.fade-enter-active,
|
.fade-enter-active,
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user