feature: copy ranges

This commit is contained in:
2022-06-27 21:27:37 +02:00
parent b5d5338002
commit 13dae00a2c
4 changed files with 69 additions and 4 deletions

View File

@@ -35,6 +35,22 @@
</span>
</template>
</FullCalendar>
<div id="copy-widget">
<h4 class="chill-red" style="margin-top: 2rem;">{{ 'copy_range_from_to' }}</h4>
<div style="display: flex; margin-top: 1rem;">
<div class="col-sm-3" style="margin-right: 1rem">
<input class="form-control" type="date" v-model="copyFrom" />
</div>
<i class="fa fa-angle-double-right" style="font-size: 2rem; margin-right: 1rem"></i>
<div class="col-sm-3" style="margin-right: 1rem">
<input class="form-control" type="date" v-model="copyTo" />
</div>
<button class="btn btn-action" @click="copyDay">
{{ 'copy_range' }}
</button>
</div>
</div>
</template>
<script setup lang="ts">
@@ -54,11 +70,14 @@ import frLocale from '@fullcalendar/core/locales/fr';
import interactionPlugin, {DropArg, EventResizeDoneArg} from "@fullcalendar/interaction";
import timeGridPlugin from "@fullcalendar/timegrid";
import {EventApi, DateSelectArg, EventDropArg} from "@fullcalendar/core";
import {ISOToDate, ISOToDatetime} from "../../../../../ChillMainBundle/Resources/public/chill/js/date";
const store = useStore(key);
const showWeekends = ref(true);
const slotDuration = ref('00:15:00');
const copyFrom = ref<string | null>(null);
const copyTo = ref<string | null>(null);
const baseOptions = ref<CalendarOptions>({
locale: frLocale,
@@ -162,6 +181,14 @@ function onEventDropOrResize(payload: EventDropArg | EventResizeDoneArg) {
});
};
function copyDay() {
if (null === copyFrom.value || null === copyTo.value) {
return;
}
store.dispatch('calendarRanges/copyFromDayToAnotherDay', {from: ISOToDate(copyFrom.value), to: ISOToDate(copyTo.value)})
}
</script>
<style scoped>