mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix list of locations in calendar
This commit is contained in:
parent
d87c6305fd
commit
71b6b158ba
@ -35,6 +35,13 @@ const getLocationTypeByDefaultFor = (entity) => {
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Post a location
|
||||
*
|
||||
* **NOTE**: also in use for Calendar
|
||||
* @param body
|
||||
* @returns {Promise<T>}
|
||||
*/
|
||||
const postLocation = (body) => {
|
||||
const url = `/api/1.0/main/location.json`;
|
||||
return fetch(url, {
|
||||
|
@ -111,7 +111,7 @@ export default function prepareLocations(store) {
|
||||
if (window.default_location_id) {
|
||||
for (let group of store.state.availableLocations) {
|
||||
let location = group.locations.find((l) => l.id === window.default_location_id);
|
||||
if (location !== undefined & store.state.activity.location === null) {
|
||||
if (location !== undefined && store.state.activity.location === null) {
|
||||
store.dispatch('updateLocation', location);
|
||||
break;
|
||||
}
|
||||
|
@ -1,14 +1,13 @@
|
||||
import {toRaw} from "vue";
|
||||
import {
|
||||
addIdToValue,
|
||||
removeIdFromValue,
|
||||
mapEntity
|
||||
} from './utils';
|
||||
import {
|
||||
fetchCalendarRangeForUser,
|
||||
fetchCalendarRemoteForUser,
|
||||
} from './../api';
|
||||
import {datetimeToISO} from 'ChillMainAssets/chill/js/date';
|
||||
import {postLocation} from 'ChillActivityAssets/vuejs/Activity/api';
|
||||
|
||||
/**
|
||||
* This will store a unique key for each value, and prevent to launch the same
|
||||
|
@ -1,17 +1,12 @@
|
||||
import 'es6-promise/auto';
|
||||
import { createStore } from 'vuex';
|
||||
import { toRaw } from 'vue';
|
||||
import { postLocation } from 'ChillActivityAssets/vuejs/Activity/api';
|
||||
import getters from './getters';
|
||||
import actions from './actions';
|
||||
import mutations from './mutations';
|
||||
import { mapEntity } from './utils';
|
||||
import { whoami } from '../api';
|
||||
|
||||
import {
|
||||
getLocations, getLocationTypeByDefaultFor,
|
||||
getUserCurrentLocation
|
||||
} from "ChillActivityAssets/vuejs/Activity/api";
|
||||
import prepareLocations from "ChillActivityAssets/vuejs/Activity/store.locations";
|
||||
|
||||
const debug = process.env.NODE_ENV !== 'production';
|
||||
|
||||
@ -59,4 +54,6 @@ for (let u of store.state.activity.users) {
|
||||
store.commit('showUserOnCalendar', {ranges: false, remotes: false, user: u});
|
||||
}
|
||||
|
||||
prepareLocations(store);
|
||||
|
||||
export default store;
|
||||
|
@ -162,15 +162,12 @@ export default {
|
||||
userData.remotes = userData.remotes.concat(eventRemotes);
|
||||
userData.remotesLoaded.push({start, end});
|
||||
},
|
||||
/*
|
||||
// Calendar
|
||||
setEvents(state, payload) {
|
||||
console.log(payload)
|
||||
state.currentEvent = {start: payload.start, end: payload.end}
|
||||
},*/
|
||||
// Location
|
||||
updateLocation(state, value) {
|
||||
console.log('### mutation: updateLocation', value);
|
||||
state.activity.location = value;
|
||||
}
|
||||
},
|
||||
addAvailableLocationGroup(state, group) {
|
||||
state.availableLocations.push(group);
|
||||
},
|
||||
};
|
||||
|
@ -18,6 +18,7 @@
|
||||
{{ encore_entry_script_tags('mod_pickentity_type') }}
|
||||
<script type="text/javascript">
|
||||
window.entity = {{ entity_json|json_encode|raw }};
|
||||
{% if app.user.currentLocation is not null %}window.default_location_id = {{ app.user.currentLocation.id }};{% endif %};
|
||||
</script>
|
||||
{{ encore_entry_script_tags('vue_calendar') }}
|
||||
{% endblock %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user