diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App2.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App2.vue
index aa27f2d1c..3b7557a88 100644
--- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App2.vue
+++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App2.vue
@@ -64,7 +64,7 @@
{{ arg.event.title}}
{{ arg.timeText }} - {{ arg.event.extendedProps.locationName }}
no 'is'
-
@@ -72,7 +72,7 @@
+
+
+
+
+
diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/index2.ts b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/index2.ts
index 46f489f3d..35dc4f050 100644
--- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/index2.ts
+++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/index2.ts
@@ -1,18 +1,18 @@
import { createApp } from 'vue';
-//import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
-//import { appMessages } from './i18n'
+import { _createI18n } from '../../../../../ChillMainBundle/Resources/public/vuejs/_js/i18n'
+import { appMessages } from './i18n'
import futureStore, {key} from './store/index'
import App2 from './App2.vue';
futureStore().then((store) => {
- //const i18n = _createI18n(appMessages);
+ const i18n = _createI18n(appMessages);
const app = createApp({
template: ``,
})
.use(store, key)
- //.use(i18n)
+ .use(i18n)
.component('app', App2)
.mount('#myCalendar');
});
diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/modules/calendarRanges.ts b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/modules/calendarRanges.ts
index a1c7bc51a..4ed5bc5ac 100644
--- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/modules/calendarRanges.ts
+++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/modules/calendarRanges.ts
@@ -53,7 +53,7 @@ export default >{
}
return founds;
- }
+ },
},
mutations: {
addRanges(state: CalendarRangesState, ranges: CalendarRange[]) {
@@ -83,11 +83,7 @@ export default >{
},
addLoaded(state: CalendarRangesState, payload: { start: Date, end: Date }) {
state.rangesLoaded.push({start: payload.start.getTime(), end: payload.end.getTime()});
- },/*
-
- setRangesToCopy(state: State, payload: CalendarRange[]) {
- state.rangesToCopy = payload
- },*/
+ },
addRange(state: CalendarRangesState, payload: CalendarRange) {
const asEvent = calendarRangeToFullCalendarEvent(payload);
state.ranges.push({...asEvent, backgroundColor: 'white', borderColor: '#3788d8', textColor: 'black'});
@@ -116,6 +112,8 @@ export default >{
if (found !== undefined) {
found.start = newEvent.start;
found.end = newEvent.end;
+ found.locationId = range.location.id;
+ found.locationName = range.location.name;
}
state.key = state.key + 1;
@@ -194,7 +192,7 @@ export default >{
ctx.commit('removeRange', calendarRangeId);
});
},
- patchRangeTime(ctx, {calendarRangeId, start, end}: {calendarRangeId: number, start: Date, end: Date}): void {
+ patchRangeTime(ctx, {calendarRangeId, start, end}: {calendarRangeId: number, start: Date, end: Date}): Promise {
const url = `/api/1.0/calendar/calendar-range/${calendarRangeId}.json`;
const body = {
startDate: {
@@ -205,12 +203,33 @@ export default >{
},
} as CalendarRangeEdit;
- makeFetch('PATCH', url, body)
+ return makeFetch('PATCH', url, body)
.then((range) => {
ctx.commit('updateRange', range);
+ return Promise.resolve(null);
})
.catch((error) => {
console.error(error);
+ return Promise.resolve(null);
+ })
+ },
+ patchRangeLocation(ctx, {location, calendarRangeId}: {location: Location, calendarRangeId: number}): Promise {
+ const url = `/api/1.0/calendar/calendar-range/${calendarRangeId}.json`;
+ const body = {
+ location: {
+ id: location.id,
+ type: "location"
+ },
+ } as CalendarRangeEdit;
+
+ return makeFetch('PATCH', url, body)
+ .then((range) => {
+ ctx.commit('updateRange', range);
+ return Promise.resolve(null);
+ })
+ .catch((error) => {
+ console.error(error);
+ return Promise.resolve(null);
})
},
copyFromDayToAnotherDay(ctx, {from, to}: {from: Date, to: Date}): Promise {
diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/modules/calendarRemotes.ts b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/modules/calendarRemotes.ts
index a4bf13e8d..260f79a42 100644
--- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/modules/calendarRemotes.ts
+++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/modules/calendarRemotes.ts
@@ -51,43 +51,18 @@ export default > {
},
addLoaded(state: CalendarRemotesState, payload: {start: Date, end: Date}) {
state.remotesLoaded.push({start: payload.start.getTime(), end: payload.end.getTime()});
- },/*
-
- setRangesToCopy(state: State, payload: CalendarRange[]) {
- state.rangesToCopy = payload
- },*/
- addRemote(state: CalendarRemotesState, payload: CalendarRemote) {
- const asEvent = remoteToFullCalendarEvent(payload);
- state.remotes.push(asEvent);
- state.remotesIndex.add(asEvent.id);
- state.key = state.key + 1;
- },
- removeRemote(state: CalendarRemotesState, payload: EventInput) {
- /*
- state.ranges = state.ranges.filter(
- (r) => r.id !== payload.id
- );
- if (typeof payload.id === "string") {
- state.rangesIndex.delete(payload.id);
- }
- state.key = state.key + 1;
-
- */
},
},
actions: {
fetchRemotes(ctx: Context, payload: {start: Date, end: Date}): Promise {
- console.log('fetchRanges', payload);
const start = payload.start;
const end = payload.end;
if (ctx.rootGetters['me/getMe'] === null) {
- console.log('me is not there');
return Promise.resolve(null);
}
if (ctx.getters.isRemotesLoaded({start, end})) {
- console.log('range already loaded');
return Promise.resolve(ctx.getters.getRangeSource);
}
@@ -102,6 +77,7 @@ export default > {
end
)
.then((remotes: CalendarRemote[]) => {
+ // to be add when reactivity problem will be solve ?
//ctx.commit('addRemotes', remotes);
const inputs = remotes
.map(cr => remoteToFullCalendarEvent(cr))
diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/modules/location.ts b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/modules/location.ts
index 566b96fcd..7fbfe7fce 100644
--- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/modules/location.ts
+++ b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/modules/location.ts
@@ -19,6 +19,11 @@ export default >{
currentLocation: null,
}
},
+ getters: {
+ getLocationById: (state) => (id: number): Location|undefined => {
+ return state.locations.find(l => l.id === id);
+ },
+ },
mutations: {
setLocations(state, locations): void {
state.locations = locations;
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Modal.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Modal.vue
index 1a577274b..39815de3e 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Modal.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/Modal.vue
@@ -26,7 +26,8 @@
-