diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss
index 8f69d7955..fda1cb5ed 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss
+++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/buttons.scss
@@ -145,6 +145,6 @@ div.sticky-buttons {
text-align: center;
padding: 0.45rem 0.7rem;
display: block;
- margin-bottom: 0.35rem;
+ margin-bottom: 0.5rem;
}
}
\ No newline at end of file
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue
index cf8ad2a1d..973dacad6 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/App.vue
@@ -13,6 +13,7 @@
:class="{'active': activeTab === 'MyWorks'}"
@click="selectTab('MyWorks')">
{{ $t('my_works') }}
+
@@ -74,6 +78,7 @@ import MyEvaluations from './MyEvaluations';
import MyTasks from './MyTasks';
import MyAccompanyingCourses from './MyAccompanyingCourses';
import MyNotifications from './MyNotifications';
+import { mapState, mapGetters } from "vuex";
export default {
name: "App",
@@ -91,11 +96,16 @@ export default {
}
},
computed: {
+ ...mapState([
+ 'loading',
+ ]),
+ ...mapGetters([
+ ])
},
methods: {
selectTab(tab) {
- console.log('load tab content', tab);
this.activeTab = tab;
+ this.$store.dispatch('getByTab', tab);
}
}
}
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyAccompanyingCourses.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyAccompanyingCourses.vue
index 31107b564..f94a042dc 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyAccompanyingCourses.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyAccompanyingCourses.vue
@@ -3,8 +3,18 @@
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyCustoms.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyCustoms.vue
index cc7831104..28a2ec93b 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyCustoms.vue
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/MyCustoms.vue
@@ -1,5 +1,11 @@
- MyCustoms
+
+
+
+ Mon bloc personnalisé
+
+
+
\ No newline at end of file
diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/store.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/store.js
index bb9af47e6..b9888da7b 100644
--- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/store.js
+++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/HomepageWidget/js/store.js
@@ -1,14 +1,65 @@
import 'es6-promise/auto';
import { createStore } from 'vuex';
+import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
const debug = process.env.NODE_ENV !== 'production';
+const isEmpty = (obj) => {
+ return obj
+ && Object.keys(obj).length === 0
+ && Object.getPrototypeOf(obj) === Object.prototype;
+};
+
const store = createStore({
strict: debug,
- state: {},
- getters: {},
- mutations: {},
- actions: {},
+ state: {
+ accompanyingCourses: {},
+ errorMsg: [],
+ loading: false
+ },
+ getters: {
+ isAccompanyingCoursesLoaded(state) {
+ return !isEmpty(state.accompanyingCourses);
+ },
+ },
+ mutations: {
+ addCourses(state, courses) {
+ console.log('addCourses', courses);
+ state.accompanyingCourses = courses;
+ },
+ setLoading(state, bool) {
+ state.loading = bool;
+ },
+ catchError(state, error) {
+ state.errorMsg.push(error);
+ }
+ },
+ actions: {
+ getByTab({ commit, getters }, tab) {
+ switch (tab) {
+ case 'MyAccompanyingCourses':
+ if (!getters.isAccompanyingCoursesLoaded) {
+ commit('setLoading', true);
+ const url = `/api/1.0/person/accompanying-period/work/my-near-end`;
+ makeFetch('GET', url)
+ .then((response) => {
+ commit('addCourses', response);
+ commit('setLoading', false);
+ })
+ .catch((error) => {
+ commit('catchError', error);
+ throw error;
+ })
+ }
+ break;
+ case 'MyCustoms':
+ break;
+ default:
+ throw 'tab '+ tab;
+
+ }
+ }
+ },
});
export { store };
\ No newline at end of file