diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue deleted file mode 100644 index 35d9d2ca2..000000000 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/App.vue +++ /dev/null @@ -1,328 +0,0 @@ - - - diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/index.js b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/index.js deleted file mode 100644 index 02b2df469..000000000 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/index.js +++ /dev/null @@ -1,18 +0,0 @@ -import { createApp } from 'vue'; -import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n' -import { appMessages } from './i18n' -import futureStore from './store/index' - -import App from './App.vue'; - -futureStore().then((store) => { - const i18n = _createI18n(appMessages); - - const app = createApp({ - template: ``, - }) - .use(store) - .use(i18n) - .component('app', App) - .mount('#myCalendar'); -}); diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/actions.ts.backup b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/actions.ts.backup deleted file mode 100644 index d6b12cfa6..000000000 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/actions.ts.backup +++ /dev/null @@ -1,114 +0,0 @@ -import {makeFetch, fetchResults} from 'ChillMainAssets/lib/api/apiMethods'; -import {fetchCalendarRangeForUser} from 'ChillCalendarAssets/vuejs/Calendar/api'; -import {ActionContext} from 'vuex'; -import {State} from './index'; - -type Context = ActionContext; - -const actions = { - setCurrentDatesView(, {start, end}) { - commit('setCurrentDatesView', {start, end}); - dispatch('fetchRanges'); - }, - fetchRanges({commit, state}, payload = null) { - if (state.me === null) { - console.log('me is not there'); - return Promise.resolve(); - } - - if (state.currentView.start === null || state.currentView.end === null) { - console.log('current view dates are null'); - return Promise.resolve(); - } - - if (getters.isRangeLoaded) { - console.log('range already loaded'); - return Promise.resolve(); - } - - commit('addLoaded', {start: state.currentView.start, end: state.currentView.end}); - - return fetchCalendarRangeForUser(state.me, state.currentView.start, state.currentView.end) - .then(ranges => { - commit('setRanges', ranges); - return Promise.resolve(); - }) - .catch(err => { - console.error(err); - return Promise.resolve(); - }) - ; - }, - postRange({commit}, payload) { - const url = `/api/1.0/calendar/calendar-range.json?`; - makeFetch('POST', url, payload) - .then((response) => { - const newRange = - { - start: response.startDate.datetime, - end: response.endDate.datetime, - calendarRangeId: response.id, - toDelete: false - } - commit('addRange', newRange) - }) - .catch((error) => { - console.log(error); - }) - }, - deleteRange({commit}, payload) { - const url = `/api/1.0/calendar/calendar-range/${payload}.json`; - makeFetch('DELETE', url) - .then((response) => { - if (response == 200) { - commit('removeRange', payload); - } - }) - .catch((error) => { - console.log(error); - }) - }, - patchRange({commit}, payload) { - const url = `/api/1.0/calendar/calendar-range/${payload.extendedProps.calendarRangeId}.json`; - const body = { - startDate: { - datetime: `${payload.start.toISOString().split('.')[0]}+0000`, //should be like "2021-08-20T15:00:00+0200", - }, - endDate: { - datetime: `${payload.end.toISOString().split('.')[0]}+0000`, // TODO check if OK with time zone - }, - } - makeFetch('PATCH', url, body) - .then((response) => { - console.log('response', response); - }) - .catch((error) => { - console.log(error); - }) - }, - fetchAppointments({commit}, payload) { - const url = `/api/1.0/calendar/calendar.json?main_user=${payload}&item_per_page=1000` - makeFetch('GET', url) - .then((response) => { - const appointments = response.results.map(a => ( - { - myCalendar: true, - calendarId: a.id, - start: a.startDate.datetime, - end: a.endDate.datetime, - user: a.user, - mainUser: a.mainUser, - persons: a.persons, - professionals: a.professionals, - comment: a.comment - }) - ); - commit('setAppointments', appointments) - }) - .catch((error) => { - console.log(error); - }) - }, -}; - -export default actions; diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/getters.ts.backup b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/getters.ts.backup deleted file mode 100644 index efb4bf9eb..000000000 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/getters.ts.backup +++ /dev/null @@ -1,33 +0,0 @@ -const getters = { - rangeSource(state) { - return { - events: state.ranges, - borderColor: "#3788d8", - backgroundColor: '#ffffff', - textColor: '#444444', - } - }, - appointmentSource(state) { - if (state.appointmentsShown) { - return { - events: state.appointments, - color: "darkblue", - id: 1000, - editable: false - } - } else { - return null - } - }, - isRangeLoaded: (state) => (start, end) => { - for (let {rStart, rEnd} of state.rangesLoaded) { - if (start === rStart && end === rEnd) { - return true; - } - } - - return false; - }, -}; - -export default getters; diff --git a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/mutations.ts.backup b/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/mutations.ts.backup deleted file mode 100644 index d3c722762..000000000 --- a/src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/store/mutations.ts.backup +++ /dev/null @@ -1,39 +0,0 @@ -import {State} from './index'; -import {CalendarRange, Calendar, User} from 'ChillCalendarAssets/types'; - -const mutations = { - setCurrentDatesView(state: State, payload: {start: Date, end: Date}) { - state.currentView.start = payload.start; - state.currentView.end = payload.end; - }, - addRanges(state: State, ranges: CalendarRange[]) { - console.log('addRanges', ranges); - - const toAdd = ranges.filter(r => !state.rangesIndex.has(r.id)); - state.ranges.push(...toAdd); - toAdd.forEach((r) => {state.rangesIndex.add(r.id)}); - }, - addLoaded(state: State, payload: {start: Date, end: Date}) { - state.rangesLoaded.push({start: payload.start, end: payload.end}); - },/* - setRangesToCopy(state: State, payload: CalendarRange[]) { - state.rangesToCopy = payload - },*/ - addRange(state: State, payload: CalendarRange) { - state.ranges = [...state.ranges, payload]; - }, - removeRange(state: State, payload: CalendarRange) { - const filteredCollection = state.ranges.filter( - (r) => r.calendarRangeId !== payload - ) - state.ranges = filteredCollection; - }, - setAppointments(state: State, payload: Calendar) { - state.appointments = payload; - }, - setAppointmentShown(state: State, payload: boolean) { - state.appointmentsShown = payload - } -}; - -export default mutations;