diff --git a/README.md b/README.md index 44e5327..7148bbb 100755 --- a/README.md +++ b/README.md @@ -23,13 +23,16 @@ Le front de calendz est développé avec les frameworks et outils suivants* : | Librairie | Version | Description | | ---------------- | ------- | ----------------------------------------------------------------------------------------------------------------- | -| [Vue.js] | 2.6.10 | Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web. | -| [vue-cli] | 3.1.3 | Standard Tooling for Vue.js Development. | -| [vue-router] | 3.0.6 | The official router for Vue.js | -| [vuex] | 3.1.1 | Centralized State Management for Vue.js. | -| [vee-validate] | 2.2.11 | Template Based Validation Framework for Vue.js | -| [Babel] | 7.4.5 | Babel is a compiler for writing next generation JavaScript. | -| [Node-sass] | 4.12.0 | Node.js bindings to libsass. | +| [Vue.js] | 2.6.12 | Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web. | +| [vue-cli] | 3.12.1 | Standard Tooling for Vue.js Development. | +| [vue-router] | 3.4.3 | The official router for Vue.js | +| [vuex] | 3.5.1 | Centralized State Management for Vue.js. | +| [vee-validate] | 2.2.15 | Template Based Validation Framework for Vue.js | +| [Axios] | 0.20.0 | Promise based HTTP client for the browser and node.js | +| [Fullcalendar] | 4.4.2 | Full-sized drag & drop event calendar | +| [SweetAlert2] | 9.17.1 | A beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes. | +| [Babel] | 7.9.6 | Babel is a compiler for writing next generation JavaScript. | +| [Node-sass] | 4.14.1 | Node.js bindings to libsass. | | [Bootstrap] | 4.3.1 | The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web. | **(Liste non exhaustive, uniquement les librairies principales sont présentées)* @@ -38,7 +41,7 @@ Le front de calendz est développé avec les frameworks et outils suivants* : ### Pré-requis -* Installer Node 10.15.3 +* Installer Node 12.18.3 * Créer un fichier `.env` à la source de ce repository contenant les valeurs suivantes (modifiables selon vos besoins) NODE_ENV=development @@ -57,6 +60,9 @@ Le front de calendz est développé avec les frameworks et outils suivants* : [vue-router]: https://github.com/vuejs/vue-router [vuex]: https://github.com/vuejs/vuex [vee-validate]: https://github.com/baianat/vee-validate +[Axios]: https://github.com/axios/axios +[Fullcalendar]: https://github.com/fullcalendar/fullcalendar +[SweetAlert2]: https://github.com/sweetalert2/sweetalert2 [Babel]: https://github.com/babel/babel [Node-sass]: https://github.com/sass/node-sass [Bootstrap]: https://github.com/twbs/bootstrap diff --git a/package-lock.json b/package-lock.json index 191d9b4..a4e9068 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4165,9 +4165,9 @@ "dev": true }, "cz-conventional-changelog": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/cz-conventional-changelog/-/cz-conventional-changelog-3.2.1.tgz", - "integrity": "sha512-MroXCfO8sahklT0KSwZ1oaNwKxZaZ2A8ONc+MH+is8QDZ2zBhGOFFiAXuWpcWFJLpxlGPvnYlhvOlYiSOAGc7w==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/cz-conventional-changelog/-/cz-conventional-changelog-3.3.0.tgz", + "integrity": "sha512-U466fIzU5U22eES5lTNiNbZ+d8dfcHcssH4o7QsdWaCcRs/feIPCxKYSWkYBNs5mny7MvEfwpTLWjvbm94hecw==", "dev": true, "requires": { "@commitlint/load": ">6.1.1", @@ -4189,9 +4189,9 @@ } }, "date-fns": { - "version": "2.15.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.15.0.tgz", - "integrity": "sha512-ZCPzAMJZn3rNUvvQIMlXhDr4A+Ar07eLeGsGREoWU19a3Pqf5oYa+ccd+B3F6XVtQY6HANMFdOQ8A+ipFnvJdQ==" + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.16.0.tgz", + "integrity": "sha512-DWTRyfOA85sZ4IiXPHhiRIOs3fW5U6Msrp+gElXARa6EpoQTXPyHQmh7hr+ssw2nx9FtOQWnAMJKgL5vaJqILw==" }, "de-indent": { "version": "1.0.2", @@ -7728,9 +7728,9 @@ "dev": true }, "klona": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/klona/-/klona-1.1.2.tgz", - "integrity": "sha512-xf88rTeHiXk+XE2Vhi6yj8Wm3gMZrygGdKjJqN8HkV+PwF/t50/LdAKHoHpPcxFAlmQszTZ1CugrK25S7qDRLA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/klona/-/klona-2.0.3.tgz", + "integrity": "sha512-CgPOT3ZadDpXxKcfV56lEQ9OQSZ42Mk26gnozI+uN/k39vzD8toUhRQoqsX0m9Q3eMPEfsLWmtyUpK/yqST4yg==", "dev": true }, "launch-editor": { @@ -11065,12 +11065,12 @@ } }, "sass-loader": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-9.0.3.tgz", - "integrity": "sha512-fOwsP98ac1VMme+V3+o0HaaMHp8Q/C9P+MUazLFVi3Jl7ORGHQXL1XeRZt3zLSGZQQPC8xE42Y2WptItvGjDQg==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-10.0.1.tgz", + "integrity": "sha512-b2PSldKVTS3JcFPHSrEXh3BeAfR7XknGiGCAO5aHruR3Pf3kqLP3Gb2ypXLglRrAzgZkloNxLZ7GXEGDX0hBUQ==", "dev": true, "requires": { - "klona": "^1.1.2", + "klona": "^2.0.3", "loader-utils": "^2.0.0", "neo-async": "^2.6.2", "schema-utils": "^2.7.0", @@ -13239,11 +13239,11 @@ } }, "vue-flatpickr-component": { - "version": "8.1.5", - "resolved": "https://registry.npmjs.org/vue-flatpickr-component/-/vue-flatpickr-component-8.1.5.tgz", - "integrity": "sha512-whrR+WM7fWyHW+1ZxCx7uVSuOlTeZXEMzhsgcILXGxIzQxr5uX5RlS5amLXdGGSSVf+zukrb6MvYit/uIkhk3Q==", + "version": "8.1.6", + "resolved": "https://registry.npmjs.org/vue-flatpickr-component/-/vue-flatpickr-component-8.1.6.tgz", + "integrity": "sha512-RUu/M/1lbuzQT+U3yP7O5/M2EIizr9vXLXqSc1eFOvCT3AHurQg8+iO02rjW+2l78Kit8pCNAUvHw7eexws6hw==", "requires": { - "flatpickr": "^4.6.1" + "flatpickr": "^4.6.6" } }, "vue-hot-reload-api": { diff --git a/package.json b/package.json index 296eabf..8926f06 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "axios": "^0.20.0", "bootstrap": "4.3.1", "chart.js": "^2.9.3", - "date-fns": "^2.15.0", + "date-fns": "^2.16.0", "dropzone": "^5.7.2", "element-ui": "2.13.2", "es6-promise": "^4.1.1", @@ -35,7 +35,7 @@ "vue-analytics": "^5.22.1", "vue-chartjs": "^3.5.1", "vue-clipboard2": "^0.3.1", - "vue-flatpickr-component": "^8.1.5", + "vue-flatpickr-component": "^8.1.6", "vue-router": "^3.4.3", "vue2-touch-events": "^2.3.1", "vue2-transitions": "^0.3.0", @@ -49,10 +49,10 @@ "@vue/eslint-config-standard": "^4.0.0", "babel-plugin-component": "^1.1.0", "commitizen": "^4.2.1", - "cz-conventional-changelog": "^3.2.1", + "cz-conventional-changelog": "^3.3.0", "husky": "^4.2.5", "node-sass": "^4.14.1", - "sass-loader": "^9.0.3", + "sass-loader": "^10.0.1", "vue-template-compiler": "^2.6.12" }, "babel": { diff --git a/src/services/sysconf.service.js b/src/services/sysconf.service.js index cdc0f3e..9fb5392 100644 --- a/src/services/sysconf.service.js +++ b/src/services/sysconf.service.js @@ -31,6 +31,12 @@ const SysconfService = { .catch(err => Promise.reject(err.data)) }, + toggleEditGroup: (value) => { + return ApiService.patch(`/sysconf/settings/edit-group-enabled/${value}`) + .then(res => res) + .catch(err => Promise.reject(err.data)) + }, + disconnectAllUsers: () => { return ApiService.delete(`/sysconf/refresh-tokens/all`) .then(res => res) diff --git a/src/services/user.service.js b/src/services/user.service.js index fff563a..013cdd8 100644 --- a/src/services/user.service.js +++ b/src/services/user.service.js @@ -40,9 +40,9 @@ const UserService = { .catch(err => Promise.reject(err)) }, - // change user's bts status - changeBts: (bts) => { - return ApiService.patch(`/user/bts/${bts}`) + // user self updates its profile + updateProfile: (data) => { + return ApiService.patch(`/user/profile`, data) .then(res => res.data) .catch(err => Promise.reject(err)) }, diff --git a/src/store/modules/account.module.js b/src/store/modules/account.module.js index 1e72e6a..637b25f 100644 --- a/src/store/modules/account.module.js +++ b/src/store/modules/account.module.js @@ -80,15 +80,16 @@ const accountModule = { state.status = { isMigrating: false, migrationError: reason } }, - CHANGE_BTS_REQUEST: (state) => { - state.status = { isChanging: true } + UPDATE_PROFILE_REQUEST: (state) => { + state.status = { isUpdating: true } }, - CHANGE_BTS_SUCCESS: (state, bts) => { + UPDATE_PROFILE_SUCCESS: (state, data) => { state.status = {} - state.user.bts = bts + state.user.bts = data.bts + state.user.group = data.group }, - CHANGE_BTS_FAILURE: (state, reason) => { - state.status = { changeBtsError: reason } + UPDATE_PROFILE_FAILURE: (state, reason) => { + state.status = { updateProfileError: reason } }, CHANGE_PASSWORD_REQUEST: (state) => { @@ -335,19 +336,20 @@ const accountModule = { router.push('/login') }, - changeBts: ({ commit }, { bts }) => { - commit('CHANGE_BTS_REQUEST') - UserService.changeBts(bts) + updateProfile: ({ commit }, { bts, group }) => { + commit('UPDATE_PROFILE_REQUEST') + UserService.updateProfile({ bts, group }) .then( res => { - commit('CHANGE_BTS_SUCCESS', bts) + commit('UPDATE_PROFILE_SUCCESS', { bts, group }) const user = JSON.parse(localStorage.user) user.bts = bts + user.group = group localStorage.user = JSON.stringify(user) Vue.prototype.$notify({ type: 'success', message: `Modification effectuée avec succès !` }) }, err => { - commit('CHANGE_BTS_FAILURE', err.data.message) + commit('UPDATE_PROFILE_FAILURE', err.data.message) Vue.prototype.$notify({ type: 'danger', message: `Erreur ! ${err.data.message || 'Erreur inconnue...'}` }) }) }, diff --git a/src/store/modules/sysconf.module.js b/src/store/modules/sysconf.module.js index 93fbf87..4f5ca7b 100644 --- a/src/store/modules/sysconf.module.js +++ b/src/store/modules/sysconf.module.js @@ -11,7 +11,8 @@ const sysconfModule = { stats: {}, settings: { loginEnabled: true, - registerEnabled: true + registerEnabled: true, + editGroupEnabled: false } }, @@ -24,15 +25,16 @@ const sysconfModule = { state.stats = {} state.settings = { loginEnabled: true, - registerEnabled: true + registerEnabled: true, + editGroupEnabled: false } }, FETCH_SETTINGS_REQUEST: (state) => { state.status = { isLoading: true } }, - FETCH_SETTINGS_SUCCESS: (state, { loginEnabled, registerEnabled }) => { - state.settings = { loginEnabled, registerEnabled } + FETCH_SETTINGS_SUCCESS: (state, { loginEnabled, registerEnabled, editGroupEnabled }) => { + state.settings = { loginEnabled, registerEnabled, editGroupEnabled } state.status = {} }, FETCH_SETTINGS_FAILURE: (state, reason) => { @@ -72,6 +74,17 @@ const sysconfModule = { state.status = { toggleRegisterError: reason } }, + TOGGLE_EDITGROUP_REQUEST: (state) => { + state.status = { isUpdatingEditGroup: true } + }, + TOGGLE_EDITGROUP_SUCCESS: (state, value) => { + state.status = { isUpdatingEditGroup: false } + state.settings.editGroupEnabled = value + }, + TOGGLE_EDITGROUP_FAILURE: (state, reason) => { + state.status = { toggleEditGroupError: reason } + }, + DISCONNECT_USERS_REQUEST: (state) => { state.status = { isDisconnecting: true } }, @@ -104,7 +117,8 @@ const sysconfModule = { res => { const loginEnabled = res.data.loginEnabled || false const registerEnabled = res.data.registerEnabled || false - commit('FETCH_SETTINGS_SUCCESS', { loginEnabled, registerEnabled }) + const editGroupEnabled = res.data.editGroupEnabled || false + commit('FETCH_SETTINGS_SUCCESS', { loginEnabled, registerEnabled, editGroupEnabled }) }, err => { commit('FETCH_SETTINGS_FAILURE', err.message) @@ -161,6 +175,25 @@ const sysconfModule = { Vue.prototype.$notify({ type: 'danger', message: `Erreur ! ${err.message || 'Une erreur est survenue...'}` }) }) }, + toggleEditGroup: ({ commit }, { value }) => { + commit('TOGGLE_EDITGROUP_REQUEST') + SysconfService.toggleEditGroup(value) + .then( + res => { + const message = value + ? 'Les utilisateurs peuvent désormais modifier leur groupe !' + : 'Les utilisateurs ne peuvent désormais plus modifier leur groupe !' + const type = value + ? 'success' + : 'warning' + commit('TOGGLE_EDITGROUP_SUCCESS', value) + Vue.prototype.$notify({ type, message }) + }, + err => { + commit('TOGGLE_EDITGROUP_FAILURE', err.message) + Vue.prototype.$notify({ type: 'danger', message: `Erreur ! ${err.message || 'Une erreur est survenue...'}` }) + }) + }, disconnectAllUsers: ({ commit }) => { commit('DISCONNECT_USERS_REQUEST') SysconfService.disconnectAllUsers() diff --git a/src/views/Pages/Dashboard/Admin/DashboardAdmin.vue b/src/views/Pages/Dashboard/Admin/DashboardAdmin.vue index ceb69f8..6629175 100644 --- a/src/views/Pages/Dashboard/Admin/DashboardAdmin.vue +++ b/src/views/Pages/Dashboard/Admin/DashboardAdmin.vue @@ -23,22 +23,25 @@
+