diff --git a/canapGEST/Documentation/journal_travail.xlsx b/canapGEST/Documentation/journal_travail.xlsx index 06875d984190dee28ee29c69b74a7124bf06a099..015c9c445e7acde74f36f904c7d88068c7a440c3 100644 Binary files a/canapGEST/Documentation/journal_travail.xlsx and b/canapGEST/Documentation/journal_travail.xlsx differ diff --git a/canapGEST/Documentation/planification_etatActuel_NicolasCrausaz - Copy.xlsx b/canapGEST/Documentation/planification_etatActuel_NicolasCrausaz - Copy.xlsx index eb5ecb08db96e09526deea5bd94cc597b70b7a79..f557177100e3abe182d259c5599571df41822bda 100644 Binary files a/canapGEST/Documentation/planification_etatActuel_NicolasCrausaz - Copy.xlsx and b/canapGEST/Documentation/planification_etatActuel_NicolasCrausaz - Copy.xlsx differ diff --git a/canapGEST/Site/src/components/alertSnackbar.vue b/canapGEST/Site/src/components/alertSnackbar.vue index 7ab8f3cb146508fce424b4eab1eca4346bcec164..b9f9cf53f8941cca50755d5dc1b8342ec5d61114 100644 --- a/canapGEST/Site/src/components/alertSnackbar.vue +++ b/canapGEST/Site/src/components/alertSnackbar.vue @@ -1,12 +1,7 @@ <template> <div id="alert-snackbar"> - <v-snackbar v-model="$store.state.moduleSnackbar.open" :top="true"> + <v-snackbar v-model="$store.state.moduleSnackbar.open" :top="true" :timeout="3000" :color="$store.state.moduleSnackbar.type" auto-height> {{$store.state.moduleSnackbar.message}} - <v-btn - flat - color="accent" - @click="$store.dispatch('moduleSnackbar/toggle', {open: false, message: '', type: ''})" - >Close</v-btn> </v-snackbar> </div> </template> @@ -15,7 +10,4 @@ export default { name: 'alert-snackbar' } -</script> - -<style> -</style> +</script> \ No newline at end of file diff --git a/canapGEST/Site/src/plugins/axios.js b/canapGEST/Site/src/plugins/axios.js index cf4de35fd9428c2fc8fc1d166f79f7201ff99ced..f349ed6ea18f948ac0c86921c58bb58e8df49f1b 100644 --- a/canapGEST/Site/src/plugins/axios.js +++ b/canapGEST/Site/src/plugins/axios.js @@ -1,8 +1,19 @@ import axios from 'axios' +import store from '@/store/store.js' const instance = axios.create({ headers: { 'Authorization': "Bearer " + localStorage.getItem('stored_token') }, baseURL: 'http://localhost:8000/api' }) +instance.interceptors.response.use(function (response) { + return response; +}, function (error) { + // Affichage des erreurs (snackbar) + Object.values(error.response.data).forEach(errMsg => { + store.commit('moduleSnackbar/toggle', { open: true, message: errMsg[0], type: 'error' }, { root: true }) + }) + return Promise.reject(error) +}) + export default instance \ No newline at end of file diff --git a/canapGEST/Site/src/store/modules/applications/actions.js b/canapGEST/Site/src/store/modules/applications/actions.js index 5bdbcd6f1f0f46df1bf5c21b20c0ebd0a63e87d1..15ff8137a117d8f62e495b6a16b54ffccab27465 100644 --- a/canapGEST/Site/src/store/modules/applications/actions.js +++ b/canapGEST/Site/src/store/modules/applications/actions.js @@ -8,9 +8,6 @@ export function getApplications(context) { .then(response => { context.commit('setApplications', response.data) }) - .catch(err => { - console.log(err) - }) } export function getAvailableStatus(context) { @@ -21,9 +18,6 @@ export function getAvailableStatus(context) { .then(response => { context.commit('setAvailableStatus', response.data) }) - .catch(err => { - console.log(err) - }) } export function changeApplicationStatus(context, data) { @@ -33,10 +27,7 @@ export function changeApplicationStatus(context, data) { data: data }) .then(response => { - console.log(response.data) - }) - .catch(err => { - console.log(err) + context.commit('moduleSnackbar/toggle', { open: true, message: response.data.message, type: 'success' }, { root: true }) }) } @@ -47,9 +38,6 @@ export function deleteApplication(context, data) { data: data }) .then(response => { - console.log(response.data) - }) - .catch(err => { - console.log(err) + context.commit('moduleSnackbar/toggle', { open: true, message: response.data.message, type: 'success' }, { root: true }) }) } \ No newline at end of file diff --git a/canapGEST/Site/src/store/modules/positions/actions.js b/canapGEST/Site/src/store/modules/positions/actions.js index 7854430d71b7e160ef012175802ff3bf3d8129c0..1ac421f4707b94ad8155760467e1b2ab04f9b7aa 100644 --- a/canapGEST/Site/src/store/modules/positions/actions.js +++ b/canapGEST/Site/src/store/modules/positions/actions.js @@ -37,16 +37,7 @@ export function createPosition(context, data) { data: data }) .then(response => { - console.log(response) - // Notif this - }) - .catch(err => { - console.log(err) - // Notif this - // Object.keys(err.reponse).forEach(element => { - // console.log(element) - // }); - context.commit('moduleSnackbar/toggle', {open: true, message: 'yolo'}, { root: true }) + context.commit('moduleSnackbar/toggle', { open: true, message: response.data.message, type: 'success' }, { root: true }) }) } @@ -57,28 +48,18 @@ export function updatePosition(context, data) { data: data }) .then(response => { - console.log(response) - // Notif this - }) - .catch(err => { - console.log(err) - // Notif this + context.commit('moduleSnackbar/toggle', { open: true, message: response.data.message, type: 'success' }, { root: true }) }) } -export function deletePosition (context, data) { +export function deletePosition(context, data) { axios({ method: 'delete', url: '/position/' + data.position_id, data: data }) .then(response => { - console.log(response) - // Notif this - }) - .catch(err => { - console.log(err) - // Notif this + context.commit('moduleSnackbar/toggle', { open: true, message: response.data.message, type: 'success' }, { root: true }) }) } diff --git a/canapGEST/Site/src/store/modules/snackbar/mutations.js b/canapGEST/Site/src/store/modules/snackbar/mutations.js index 8b4c0346d99bcbe9d7861ce6a2ba1d73f49247db..b21a8a51d3e8e43d2b19bed036b5088520676983 100644 --- a/canapGEST/Site/src/store/modules/snackbar/mutations.js +++ b/canapGEST/Site/src/store/modules/snackbar/mutations.js @@ -1,4 +1,5 @@ export function toggle (state, data) { state.open = data.open state.message = data.message + state.type = data.type } \ No newline at end of file diff --git a/canapGEST/Site/src/store/modules/snackbar/state.js b/canapGEST/Site/src/store/modules/snackbar/state.js index 6978e9af6443c03e8f0757a79d61f62f97ec9c00..ab625a2e8d37d434865787c3d15ab01fe20ad93c 100644 --- a/canapGEST/Site/src/store/modules/snackbar/state.js +++ b/canapGEST/Site/src/store/modules/snackbar/state.js @@ -1,4 +1,5 @@ export default { open: false, - message: String + message: String, + type: '' } \ No newline at end of file diff --git a/canapGEST/Site/src/store/modules/user/actions.js b/canapGEST/Site/src/store/modules/user/actions.js index 5e89c0b72855e4076218ca546c3bddb0ede430b4..803bc432da23898e22ea3918399dfbcf26904d20 100644 --- a/canapGEST/Site/src/store/modules/user/actions.js +++ b/canapGEST/Site/src/store/modules/user/actions.js @@ -45,7 +45,4 @@ export function getUserPermittedJobs(context) { .then(response => { context.commit('setPermittedJobs', response.data) }) - .catch(err => { - console.log(err) - }) } \ No newline at end of file diff --git a/canapGEST/Site/src/views/OpenJobsView.vue b/canapGEST/Site/src/views/OpenJobsView.vue index 48308aa26029ccf80ba62194ac864ae62395d364..90643317d91195e7d129646662474a3cd0f4823a 100644 --- a/canapGEST/Site/src/views/OpenJobsView.vue +++ b/canapGEST/Site/src/views/OpenJobsView.vue @@ -114,14 +114,14 @@ export default { ], editedIndex: -1, editedItem: { - job_id: -1, - location_id: -1, + job_id: null, + location_id: null, position_access_group: '', position_spot_number: 0 }, defaultItem: { - job_id: -1, - location_id: -1, + job_id: null, + location_id: null, position_access_group: '', position_spot_number: 0 }, @@ -176,7 +176,7 @@ export default { }, 300) }, save() { - if (this.editedIndex > -1) { + if (this.editedIndex != -1) { // Edit this.$store.dispatch('modulePositions/updatePosition', this.editedItem) } else {