Files
PORTAL_COD2/src/front/src/components/UI/event-calendar.vue
T
2023-11-10 15:38:12 +03:00

164 lines
4.1 KiB
Vue

<template>
<v-row>
<v-col>
<!-- xsmall
:time="false"
hide-view-selector
active-view="month"
:disable-views="['years', 'year', 'week', 'day']"
@cell-focus="selectedDate = $event"
:events="events"
class="vuecal--blue-theme vuecal--rounded-theme" -->
<vue-cal
locale="ru"
xsmall
:time="false"
hide-view-selector
:disable-views="['years', 'year', 'week', 'day']"
events-count-on-year-view
active-view="month"
:events="events"
class="vuecal--blue-theme"
@cell-focus="selectedDate = $event"
>
<template #arrow-prev>
<v-icon icon="mdi-menu-left"></v-icon>
</template>
<template #arrow-next>
<v-icon icon="mdi-menu-right"></v-icon>
</template>
</vue-cal>
</v-col>
<v-col>
<vue-cal
locale="ru"
xsmall
:time="false"
hide-view-selector
:events="events"
active-view="day"
:disable-views="['years', 'year', 'month', 'week']"
:selected-date="selectedDate"
class="vuecal--blue-theme vuecal--rounded-theme"
>
<template #arrow-prev>
<v-icon icon="mdi-menu-left"></v-icon>
</template>
<template #arrow-next>
<v-icon icon="mdi-menu-right"></v-icon>
</template>
</vue-cal>
</v-col>
</v-row>
</template>
<script>
import VueCal from 'vue-cal'
import 'vue-cal/dist/vuecal.css'
import { ref, onMounted } from 'vue'
import { axiosApiInstance } from '@/utils/axios-api'
export default {
components: { VueCal },
setup() {
const events = ref([
// {
// start: '2023-11-15',
// end: '2023-11-21',
// title: 'Need to go shopping',
// content: '<i class="icon material-icons">shopping_cart</i>',
// class: 'leisure'
// },
])
function f_generalvacation() {
axiosApiInstance.get('api/general_vacation/generalvacation/')
.then(data => {
console.log(data.data,'----------------------');
for (let x in data.data) {
if (x=="План-график") {
data.data[x].map(e=>{
events.value.push({ name: e.name, start: e.start_work_period, end: e.end_work_period, content: e.name})
}
)
}
}
})
}
onMounted(() => {
f_generalvacation()
})
const selectedDate = ref(null)
// {
// start: '2023-11-20 14:00',
// end: '2023-11-20 18:00',
// title: 'Need to go shopping',
// icon: 'shopping_cart', // Custom attribute.
// content: 'Click to see my shopping list',
// contentFull: 'My shopping list is rather long:<br><ul><li>Avocados</li><li>Tomatoes</li><li>Potatoes</li><li>Mangoes</li></ul>', // Custom attribute.
// class: 'leisure'
// },
// {
// start: '2023-10-10 14:00',
// end: '2023-10-20 14:00',
// title: 'Golf with John',
// icon: 'golf_course', // Custom attribute.
// content: 'Do I need to tell how many holes?',
// contentFull: 'Okay.<br>It will be a 18 hole golf course.', // Custom attribute.
// class: 'sport'
// }
return { events, selectedDate, f_generalvacation }
}
}
</script>
<style>
/* Dot indicator */
.vuecal__cell-events-count {
width: 20px;
min-width: 0;
height: 11px;
padding: 0;
color: transparent;
}
</style>