mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
finalization of my calendar ranges
This commit is contained in:
parent
9e93e2a3f9
commit
4aa8436399
@ -1,11 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<label>Localisation</label>
|
<label class="form-label">Lieu des plages de disponibilités créées</label>
|
||||||
<vue-multiselect v-model="pickedLocation" :options="locations" :label="'name'" :track-by="'id'"></vue-multiselect>
|
<vue-multiselect
|
||||||
|
v-model="pickedLocation"
|
||||||
|
:options="locations"
|
||||||
|
:label="'name'"
|
||||||
|
:track-by="'id'"
|
||||||
|
:selectLabel="'Presser \'Entrée\' pour choisir'"
|
||||||
|
:selectedLabel="'Choisir'"
|
||||||
|
:deselectLabel="'Presser \'Entrée\' pour enlever'"
|
||||||
|
:placeholder="'Choisir'"
|
||||||
|
></vue-multiselect>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="display-options row justify-content-between">
|
<div class="display-options row justify-content-between" style="margin-top: 1rem;">
|
||||||
<div class="col-sm col-xs-12">
|
<div class="col-sm col-xs-12">
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<label class="input-group-text" for="slotDuration">Durée des créneaux</label>
|
<label class="input-group-text" for="slotDuration">Durée des créneaux</label>
|
||||||
@ -51,9 +60,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm col-xs-12">
|
<div class="col-sm col-xs-12">
|
||||||
<div class="float-end">
|
<div class="float-end">
|
||||||
<div class="form-check form-switch">
|
<div class="form-check input-group">
|
||||||
<input id="showHideWE" class="form-check-input mt-0" type="checkbox" v-model="showWeekends">
|
<span class="input-group-text">
|
||||||
<label for="showHideWE" class="form-check-label">Week-ends</label>
|
<input id="showHideWE" class="mt-0" type="checkbox" v-model="showWeekends">
|
||||||
|
</span>
|
||||||
|
<label for="showHideWE" class="form-check-label input-group-text">Week-ends</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -72,18 +83,26 @@
|
|||||||
</FullCalendar>
|
</FullCalendar>
|
||||||
|
|
||||||
<div id="copy-widget">
|
<div id="copy-widget">
|
||||||
<h4 class="chill-red" style="margin-top: 2rem;">{{ $t('copy_range_from_to') }}</h4>
|
<div class="container">
|
||||||
<div style="display: flex; margin-top: 1rem;">
|
<div class="row align-items-center">
|
||||||
<div class="col-sm-3" style="margin-right: 1rem">
|
<div class="col-sm-4 col-xs-12">
|
||||||
<input class="form-control" type="date" v-model="copyFrom" />
|
<h6 class="chill-red">{{ $t('copy_range_from_to') }}</h6>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-3 col-xs-12">
|
||||||
|
<input class="form-control" type="date" v-model="copyFrom" />
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1 col-xs-12" style="text-align: center; font-size: x-large;">
|
||||||
|
<i class="fa fa-angle-double-right"></i>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-3 col-xs-12" >
|
||||||
|
<input class="form-control" type="date" v-model="copyTo" />
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1">
|
||||||
|
<button class="btn btn-action" @click="copyDay">
|
||||||
|
{{ $t('copy_range') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</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">
|
|
||||||
{{ $t('copy_range') }}
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -108,17 +127,20 @@ import frLocale from '@fullcalendar/core/locales/fr';
|
|||||||
import interactionPlugin, {DropArg, EventResizeDoneArg} from "@fullcalendar/interaction";
|
import interactionPlugin, {DropArg, EventResizeDoneArg} from "@fullcalendar/interaction";
|
||||||
import timeGridPlugin from "@fullcalendar/timegrid";
|
import timeGridPlugin from "@fullcalendar/timegrid";
|
||||||
import {EventApi, DateSelectArg, EventDropArg, EventClickArg} from "@fullcalendar/core";
|
import {EventApi, DateSelectArg, EventDropArg, EventClickArg} from "@fullcalendar/core";
|
||||||
import {ISOToDate, ISOToDatetime} from "../../../../../ChillMainBundle/Resources/public/chill/js/date";
|
import {ISOToDate} from "../../../../../ChillMainBundle/Resources/public/chill/js/date";
|
||||||
import VueMultiselect from "vue-multiselect";
|
import VueMultiselect from "vue-multiselect";
|
||||||
import {Location} from "../../../../../ChillMainBundle/Resources/public/types";
|
import {Location} from "../../../../../ChillMainBundle/Resources/public/types";
|
||||||
import EditLocation from "./Components/EditLocation.vue";
|
import EditLocation from "./Components/EditLocation.vue";
|
||||||
|
import {useI18n} from "vue-i18n";
|
||||||
|
|
||||||
const store = useStore(key);
|
const store = useStore(key);
|
||||||
|
|
||||||
|
const {t} = useI18n();
|
||||||
|
|
||||||
const showWeekends = ref(false);
|
const showWeekends = ref(false);
|
||||||
const slotDuration = ref('00:15:00');
|
const slotDuration = ref('00:05:00');
|
||||||
const slotMinTime = ref('08:00:00');
|
const slotMinTime = ref('09:00:00');
|
||||||
const slotMaxTime = ref('19:00:00');
|
const slotMaxTime = ref('18:00:00');
|
||||||
const copyFrom = ref<string | null>(null);
|
const copyFrom = ref<string | null>(null);
|
||||||
const copyTo = ref<string | null>(null);
|
const copyTo = ref<string | null>(null);
|
||||||
const editLocation = ref<InstanceType<typeof EditLocation> | null>(null)
|
const editLocation = ref<InstanceType<typeof EditLocation> | null>(null)
|
||||||
@ -271,5 +293,11 @@ function copyDay() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
#copy-widget {
|
||||||
|
position: sticky;
|
||||||
|
bottom: 0px;
|
||||||
|
background-color: white;
|
||||||
|
z-index: 9999999999;
|
||||||
|
padding: 0.25rem 0 0.25rem;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -4,18 +4,19 @@
|
|||||||
@close="showModal = false">
|
@close="showModal = false">
|
||||||
|
|
||||||
<template v-slot:header>
|
<template v-slot:header>
|
||||||
<div>boum!</div>
|
<h3>{{ 'Modifier le lieu' }}</h3>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:body>
|
<template v-slot:body>
|
||||||
|
<div>
|
||||||
|
|
||||||
|
</div>
|
||||||
<label>Localisation</label>
|
<label>Localisation</label>
|
||||||
<vue-multiselect v-model="pickedLocation" :options="locations" :label="'name'" :track-by="'id'"></vue-multiselect>
|
<vue-multiselect v-model="location" :options="locations" :label="'name'" :track-by="'id'"></vue-multiselect>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<ul class="record_actions">
|
<button class="btn btn-save" @click="saveAndClose">{{ 'Enregistrer' }}</button>
|
||||||
<li>close</li>
|
|
||||||
</ul>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</modal>
|
</modal>
|
||||||
@ -41,17 +42,6 @@ const locations = computed<Location[]>(() => {
|
|||||||
return store.state.locations.locations;
|
return store.state.locations.locations;
|
||||||
});
|
});
|
||||||
|
|
||||||
const pickedLocation = computed<Location | null>({
|
|
||||||
get(): Location | null {
|
|
||||||
return location.value;
|
|
||||||
},
|
|
||||||
set(newLocation: Location | null): void {
|
|
||||||
console.log('newLocation', newLocation);
|
|
||||||
store.dispatch('calendarRanges/patchRangeLocation', {location: newLocation, calendarRangeId: calendarRangeId.value})
|
|
||||||
.then(_ => {showModal.value = false;})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const startEdit = function(event: EventApi): void {
|
const startEdit = function(event: EventApi): void {
|
||||||
console.log('startEditing', event);
|
console.log('startEditing', event);
|
||||||
calendarRangeId.value = event.extendedProps.calendarRangeId;
|
calendarRangeId.value = event.extendedProps.calendarRangeId;
|
||||||
@ -62,6 +52,13 @@ const startEdit = function(event: EventApi): void {
|
|||||||
showModal.value = true;
|
showModal.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const saveAndClose = function(e: Event): void {
|
||||||
|
console.log('saveEditAndClose', e);
|
||||||
|
|
||||||
|
store.dispatch('calendarRanges/patchRangeLocation', {location: location.value, calendarRangeId: calendarRangeId.value})
|
||||||
|
.then(_ => {showModal.value = false;})
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({startEdit});
|
defineExpose({startEdit});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -4,9 +4,10 @@ import { appMessages } from './i18n'
|
|||||||
import futureStore, {key} from './store/index'
|
import futureStore, {key} from './store/index'
|
||||||
|
|
||||||
import App2 from './App2.vue';
|
import App2 from './App2.vue';
|
||||||
|
import {useI18n} from "vue-i18n";
|
||||||
|
|
||||||
futureStore().then((store) => {
|
futureStore().then((store) => {
|
||||||
const i18n = _createI18n(appMessages);
|
const i18n = _createI18n(appMessages, true);
|
||||||
|
|
||||||
const app = createApp({
|
const app = createApp({
|
||||||
template: `<app></app>`,
|
template: `<app></app>`,
|
||||||
|
@ -241,8 +241,9 @@ export default <Module<CalendarRangesState, State>>{
|
|||||||
start.setFullYear(to.getFullYear(), to.getMonth(), to.getDate())
|
start.setFullYear(to.getFullYear(), to.getMonth(), to.getDate())
|
||||||
let end = new Date(<Date>ISOToDatetime(r.end));
|
let end = new Date(<Date>ISOToDatetime(r.end));
|
||||||
end.setFullYear(to.getFullYear(), to.getMonth(), to.getDate());
|
end.setFullYear(to.getFullYear(), to.getMonth(), to.getDate());
|
||||||
|
let location = ctx.rootGetters['locations/getLocationById'](r.locationId);
|
||||||
|
|
||||||
promises.push(ctx.dispatch('createRange', {start, end}));
|
promises.push(ctx.dispatch('createRange', {start, end, location}));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.all(promises).then(_ => Promise.resolve(null));
|
return Promise.all(promises).then(_ => Promise.resolve(null));
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<div id="myCalendar"></div>
|
<div id="myCalendar"></div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -21,6 +21,5 @@
|
|||||||
|
|
||||||
{% block css %}
|
{% block css %}
|
||||||
{{ parent() }}
|
{{ parent() }}
|
||||||
{{ encore_entry_link_tags('vue_calendar') }}
|
{{ encore_entry_link_tags('vue_mycalendarrange') }}
|
||||||
{{ encore_entry_link_tags('page_calendar') }}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -55,9 +55,10 @@ const messages = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const _createI18n = (appMessages: any) => {
|
const _createI18n = (appMessages: any, legacy?: boolean) => {
|
||||||
Object.assign(messages.fr, appMessages.fr);
|
Object.assign(messages.fr, appMessages.fr);
|
||||||
return createI18n({
|
return createI18n({
|
||||||
|
legacy: typeof legacy === undefined ? true : legacy,
|
||||||
locale: 'fr',
|
locale: 'fr',
|
||||||
fallbackLocale: 'fr',
|
fallbackLocale: 'fr',
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
Loading…
x
Reference in New Issue
Block a user