Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue3 #1331

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Vue3 #1331

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/admin/schedule/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<script>
'use strict';

import FullCalendar from '@fullcalendar/vue'
import FullCalendar from '@fullcalendar/vue3'
import csLocale from '@fullcalendar/core/locales/cs';
import timeGridPlugin from '@fullcalendar/timegrid'
import resourceTimelinePlugin from '@fullcalendar/resource-timeline'
Expand Down
6 changes: 3 additions & 3 deletions app/assets/admin/schedule/main.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
'use strict';

import Vue from 'vue';
import {createApp} from 'vue';
import Calendar from './Calendar.vue';
import BlocksList from './BlocksList.vue';
import store from './store'

if(document.getElementById("calendar")) {
new Vue({
const calendarApp = createApp({
el: '#calendar',
store,
render: h => h(Calendar),
});
}

if(document.getElementById("blocks-list")) {
new Vue({
const blocksListApp = createApp({
el: '#blocks-list',
store,
render: h => h(BlocksList),
Expand Down
26 changes: 11 additions & 15 deletions app/assets/admin/schedule/store.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
'use strict';

import Vue from 'vue';
import Vuex from 'vuex';
import {createStore} from 'vuex';
import axios from 'axios';
import VueAxios from 'vue-axios'

const COLOR_VOLUNTARY = '#0077F7';
const COLOR_MANDATORY = '#D53343';
const COLOR_AUTO_REGISTERED = '#F7BB07';

Vue.use(Vuex);
Vue.use(VueAxios, axios);
Vue.axios.defaults.baseURL = window.location.origin + '/api/schedule/';
axios.defaults.baseURL = window.location.origin + '/api/schedule/';

export default new Vuex.Store({
export const store = createStore({
state: {
config: {
seminar_from_date: '2000-01-01',
Expand Down Expand Up @@ -94,7 +90,7 @@ export default new Vuex.Store({
*/
loadData({commit}) {
commit('incrementLoading');
Vue.axios.get('get-calendar-config')
axios.get('get-calendar-config')
.then(response => {
const config = JSON.parse(response.data);
commit('setConfig', config);
Expand All @@ -106,9 +102,9 @@ export default new Vuex.Store({

commit('incrementLoading');
axios.all([
Vue.axios.get('get-blocks'),
Vue.axios.get('get-rooms'),
Vue.axios.get('get-programs-admin')
axios.get('get-blocks'),
axios.get('get-rooms'),
axios.get('get-programs-admin')
]).then(axios.spread((blocksResponse, roomsResponse, programsResponse) => {
const blocks = Array.prototype.slice.call(JSON.parse(blocksResponse.data))
.map(function(block) {
Expand Down Expand Up @@ -201,7 +197,7 @@ export default new Vuex.Store({
room_id: info.event.resourceId && info.event.resourceId !== '0' ? info.event.resourceId : null,
start: info.event.start.toISOString()
};
Vue.axios.put('save-program', data)
axios.put('save-program', data)
.then(response => {
const responseObject = JSON.parse(response.data);
info.event.setProp('id', responseObject.program.id);
Expand All @@ -227,7 +223,7 @@ export default new Vuex.Store({
room_id: info.event.getResources()[0].id !== '0' ? info.event.getResources()[0].id : null,
start: info.event.start.toISOString()
};
Vue.axios.put('save-program', data)
axios.put('save-program', data)
.then(response => {
const responseObject = JSON.parse(response.data);
commit('setEventTime', {eventId: info.event.id, start: responseObject.program.start, end: responseObject.program.end});
Expand All @@ -253,7 +249,7 @@ export default new Vuex.Store({
room_id: info.resourceId !== '0' ? info.resourceId : null,
start: info.event.start.toISOString()
};
Vue.axios.put('save-program', data)
axios.put('save-program', data)
.then(response => {
const responseObject = JSON.parse(response.data);
info.event.setResources([String(responseObject.program.room_id || 0)]);
Expand All @@ -271,7 +267,7 @@ export default new Vuex.Store({
*/
removeProgram({commit, state}, info) {
commit('incrementLoading');
Vue.axios.delete('remove-program/' + (info.event.id !== '' ? info.event.id : info.event.extendedProps.id)) // todo: odstranit workaround po oprave bugu (https://github.com/fullcalendar/fullcalendar/issues/4730)
axios.delete('remove-program/' + (info.event.id !== '' ? info.event.id : info.event.extendedProps.id)) // todo: odstranit workaround po oprave bugu (https://github.com/fullcalendar/fullcalendar/issues/4730)
.then(response => {
const responseObject = JSON.parse(response.data);
info.event.remove();
Expand Down
2 changes: 1 addition & 1 deletion app/assets/web/schedule/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
<script>
'use strict';

import FullCalendar from '@fullcalendar/vue'
import FullCalendar from '@fullcalendar/vue3'
import csLocale from '@fullcalendar/core/locales/cs';
import timeGridPlugin from '@fullcalendar/timegrid'
import resourceTimelinePlugin from '@fullcalendar/resource-timeline'
Expand Down
4 changes: 2 additions & 2 deletions app/assets/web/schedule/main.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

import Vue from 'vue';
import {createApp} from 'vue';
import Calendar from './Calendar.vue';
import store from './store'

if(document.getElementById("calendar")) {
new Vue({
const calendarApp = createApp({
el: '#calendar',
store,
render: h => h(Calendar),
Expand Down
22 changes: 9 additions & 13 deletions app/assets/web/schedule/store.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
'use strict';

import Vue from 'vue';
import Vuex from 'vuex';
import {createStore} from 'vuex';
import axios from 'axios';
import VueAxios from 'vue-axios'

var COLOR_VOLUNTARY = '#0077F7';
var COLOR_MANDATORY = '#D53343';
var COLOR_ATTENDS = '#27A243';
var COLOR_ALTERNATES = '#F7BB07';
var COLOR_BLOCKED = '#6C757D';

Vue.use(Vuex);
Vue.use(VueAxios, axios);
Vue.axios.defaults.baseURL = window.location.origin + '/api/schedule/';
axios.defaults.baseURL = window.location.origin + '/api/schedule/';

export default new Vuex.Store({
export const store = createStore({
state: {
config: {
seminar_from_date: '2000-01-01',
Expand Down Expand Up @@ -103,7 +99,7 @@ export default new Vuex.Store({
*/
loadData({commit}) {
commit('incrementLoading');
Vue.axios.get('get-calendar-config')
axios.get('get-calendar-config')
.then(response => {
const config = JSON.parse(response.data);
commit('setConfig', config);
Expand All @@ -115,9 +111,9 @@ export default new Vuex.Store({

commit('incrementLoading');
axios.all([
Vue.axios.get('get-blocks'),
Vue.axios.get('get-rooms'),
Vue.axios.get('get-programs-web')
axios.get('get-blocks'),
axios.get('get-rooms'),
axios.get('get-programs-web')
]).then(axios.spread((blocksResponse, roomsResponse, programsResponse) => {
const blocks = Array.prototype.slice.call(JSON.parse(blocksResponse.data))
.map(function(block) {
Expand Down Expand Up @@ -213,7 +209,7 @@ export default new Vuex.Store({
*/
attendProgram({commit, state}, info) {
commit('incrementLoading');
Vue.axios.put('attend-program/' + info.event.id)
axios.put('attend-program/' + info.event.id)
.then(response => {
const responseObject = JSON.parse(response.data);

Expand Down Expand Up @@ -260,7 +256,7 @@ export default new Vuex.Store({
*/
unattendProgram({commit, state}, info) {
commit('incrementLoading');
Vue.axios.delete('unattend-program/' + info.event.id)
axios.delete('unattend-program/' + info.event.id)
.then(response => {
const responseObject = JSON.parse(response.data);

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@fullcalendar/resource": "^6.1.15",
"@fullcalendar/resource-timeline": "^6.1.15",
"@fullcalendar/timegrid": "^6.1.15",
"@fullcalendar/vue": "^6.1.15",
"@fullcalendar/vue3": "^6.1.15",
"@popperjs/core": "^2.11.8",
"axios": "^1.7.3",
"bootstrap": "^4.6.2",
Expand All @@ -34,8 +34,8 @@
"tinymce": "^5.10.9",
"tinymce-i18n": "^24.6.17",
"ublaboo-datagrid": "^6.9.1",
"vue-axios": "^3.4.1",
"vuex": "^3.6.2"
"vue-axios": "^3.5.2",
"vuex": "^4.1.0"
},
"devDependencies": {
"@babel/core": "^7.24.9",
Expand All @@ -45,8 +45,8 @@
"postcss": "^8.4.41",
"postcss-loader": "^6.2.1",
"script-loader": "^0.7.2",
"vue": "^2.7.15",
"vue-loader": "^15.11.1",
"vue": "^3.4.38",
"vue-loader": "^17.4.2",
"vue-style-loader": "^4.1.3",
"vue-template-compiler": "^2.7.16",
"webpack": "^5.93.0",
Expand Down
Loading
Loading