diff --git a/package-lock.json b/package-lock.json index ed435efa684a9eda2e377829455c27e01ac5955e..7bc71711e3314c14c37deb1b6013a78529a4abee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1777,6 +1777,16 @@ "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==", "dev": true }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "optional": true, + "requires": { + "color-convert": "^2.0.1" + } + }, "cacache": { "version": "13.0.1", "resolved": "https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz", @@ -1803,6 +1813,34 @@ "unique-filename": "^1.1.1" } }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "optional": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "optional": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "optional": true + }, "find-cache-dir": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", @@ -1824,6 +1862,25 @@ "path-exists": "^4.0.0" } }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "optional": true + }, + "loader-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", + "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", + "dev": true, + "optional": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + } + }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -1888,6 +1945,16 @@ "minipass": "^3.1.1" } }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "optional": true, + "requires": { + "has-flag": "^4.0.0" + } + }, "terser-webpack-plugin": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.8.tgz", @@ -1904,6 +1971,18 @@ "terser": "^4.6.12", "webpack-sources": "^1.4.3" } + }, + "vue-loader-v16": { + "version": "npm:vue-loader@16.0.0-beta.8", + "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-beta.8.tgz", + "integrity": "sha512-oouKUQWWHbSihqSD7mhymGPX1OQ4hedzAHyvm8RdyHh6m3oIvoRF+NM45i/bhNOlo8jCnuJhaSUf/6oDjv978g==", + "dev": true, + "optional": true, + "requires": { + "chalk": "^4.1.0", + "hash-sum": "^2.0.0", + "loader-utils": "^2.0.0" + } } } }, @@ -2485,6 +2564,14 @@ "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", "dev": true }, + "async-validator": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/async-validator/-/async-validator-1.8.5.tgz", + "integrity": "sha512-tXBM+1m056MAX0E8TL2iCjg8WvSyXu0Zc8LNtYqrVeyoL3+esHRZ4SieE9fKQyyU09uONjnMEjrNBMqT0mbvmA==", + "requires": { + "babel-runtime": "6.x" + } + }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -2546,6 +2633,11 @@ "resolve": "^1.12.0" } }, + "babel-helper-vue-jsx-merge-props": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz", + "integrity": "sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg==" + }, "babel-loader": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.1.0.tgz", @@ -2568,6 +2660,27 @@ "object.assign": "^4.1.0" } }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + }, + "dependencies": { + "core-js": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz", + "integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==" + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + } + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -4239,8 +4352,7 @@ "deepmerge": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz", - "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==", - "dev": true + "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==" }, "default-gateway": { "version": "5.0.5", @@ -4692,6 +4804,19 @@ "integrity": "sha512-j9MlEwgTHVW/lq93Hw8yhzA886oLjDm3Hz7eDkWP2v4fzLVuqOWhpNluziSnmR/tBqgoYldagbLknrdg+B7Tlw==", "dev": true }, + "element-ui": { + "version": "2.13.2", + "resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.13.2.tgz", + "integrity": "sha512-r761DRPssMPKDiJZWFlG+4e4vr0cRG/atKr3Eqr8Xi0tQMNbtmYU1QXvFnKiFPFFGkgJ6zS6ASkG+sellcoHlQ==", + "requires": { + "async-validator": "~1.8.1", + "babel-helper-vue-jsx-merge-props": "^2.0.0", + "deepmerge": "^1.2.0", + "normalize-wheel": "^1.0.1", + "resize-observer-polyfill": "^1.5.0", + "throttle-debounce": "^1.0.1" + } + }, "elliptic": { "version": "6.5.3", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", @@ -5957,8 +6082,7 @@ "highlight.js": { "version": "9.18.3", "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.18.3.tgz", - "integrity": "sha512-zBZAmhSupHIl5sITeMqIJnYCDfAEc3Gdkqj65wC1lpI468MMQeeQkhcIAvk+RylAkxrCcI9xy9piHiXeQ1BdzQ==", - "dev": true + "integrity": "sha512-zBZAmhSupHIl5sITeMqIJnYCDfAEc3Gdkqj65wC1lpI468MMQeeQkhcIAvk+RylAkxrCcI9xy9piHiXeQ1BdzQ==" }, "hmac-drbg": { "version": "1.0.1", @@ -6953,6 +7077,15 @@ "verror": "1.10.0" } }, + "kalendar-vue": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/kalendar-vue/-/kalendar-vue-2.1.1.tgz", + "integrity": "sha512-hSx+Vhjgb/Tar/zouWlPigwDXJtEek68CkfzY8hVQisHBR7+MebJ4Wa0thB8ox47X7+XodecAp47ifP6lvJmBg==", + "requires": { + "element-ui": "^2.13.1", + "vue-highlightjs": "^1.3.3" + } + }, "killable": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz", @@ -7725,6 +7858,11 @@ "integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==", "dev": true }, + "normalize-wheel": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz", + "integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU=" + }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -9462,6 +9600,11 @@ "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", "dev": true }, + "resize-observer-polyfill": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz", + "integrity": "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==" + }, "resolve": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", @@ -10645,6 +10788,11 @@ "neo-async": "^2.6.0" } }, + "throttle-debounce": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-1.1.0.tgz", + "integrity": "sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg==" + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -11272,6 +11420,14 @@ "resolved": "https://registry.npmjs.org/vue-functional-data-merge/-/vue-functional-data-merge-3.1.0.tgz", "integrity": "sha512-leT4kdJVQyeZNY1kmnS1xiUlQ9z1B/kdBFCILIjYYQDqZgLqCLa0UhjSSeRX6c3mUe6U5qYeM8LrEqkHJ1B4LA==" }, + "vue-highlightjs": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/vue-highlightjs/-/vue-highlightjs-1.3.3.tgz", + "integrity": "sha1-KaDVcTL8HOFc+mHolpGPW3GMXVI=", + "requires": { + "highlight.js": "*" + } + }, "vue-hot-reload-api": { "version": "2.3.4", "resolved": "https://registry.npmjs.org/vue-hot-reload-api/-/vue-hot-reload-api-2.3.4.tgz", @@ -11307,87 +11463,6 @@ } } }, - "vue-loader-v16": { - "version": "npm:vue-loader@16.0.0-beta.8", - "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-beta.8.tgz", - "integrity": "sha512-oouKUQWWHbSihqSD7mhymGPX1OQ4hedzAHyvm8RdyHh6m3oIvoRF+NM45i/bhNOlo8jCnuJhaSUf/6oDjv978g==", - "dev": true, - "optional": true, - "requires": { - "chalk": "^4.1.0", - "hash-sum": "^2.0.0", - "loader-utils": "^2.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "optional": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, - "optional": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "optional": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "optional": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "optional": true - }, - "loader-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", - "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", - "dev": true, - "optional": true, - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "optional": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, "vue-password": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/vue-password/-/vue-password-3.0.0.tgz", diff --git a/package.json b/package.json index 596088a963d369980eb6b71ab8810febae3d83ee..39cc8154eb5c792d590b0a13b7ac515edee63838 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "dayjs": "^1.9.1", "file-saver": "^2.0.2", "jquery": "^3.5.1", + "kalendar-vue": "^2.1.1", "lodash.trim": "^4.5.1", "popper.js": "^1.16.1", "vee-validate": "^2.2.15", @@ -38,6 +39,7 @@ "babel-eslint": "^10.1.0", "eslint": "^6.7.2", "eslint-plugin-vue": "^6.2.2", + "portal-vue": "^2.1.7", "script-loader": "^0.7.2", "vue-password": "^3.0.0", "vue-template-compiler": "^2.6.11" diff --git a/src/App.vue b/src/App.vue index e530f0e39509c5076c531f1b9788465c4c0cb1f8..a46f5c3adba0e574373709077d06250f44c5f6dd 100644 --- a/src/App.vue +++ b/src/App.vue @@ -19,7 +19,25 @@ export default { data(){ return{ sidebarStyle: "", - contentClass: "content col-md-10" + contentClass: "content col-md-10", + events: [ + { + from: '2020-10-09T18:00:00Z', + to: '2020-10-09T19:00:00Z', + data: { + title: "Hello", + description: "Ola" + } + }, + { + from: '2020-10-09T10:00:00Z', + to: '2020-10-09T15:00:00Z', + data: { + title: "Hello2", + description: "Ola" + } + } + ] } }, @@ -43,6 +61,30 @@ export default { } else { this.sidebarStyle = ""; this.contentClass = "content col-md-10"; + + this.$store.dispatch('event/get').then( + (data) => { + data.forEach(row => { + console.log("loop") + let title = row.title; + let description = row.description; + let from = '2020-10-11T10:00:00Z'; + let to = '2020-10-11T19:00:00Z'; + + let payload = { + from, + to, + data: { + title, + description + } + } + this.events.push(payload); + }) + } + ) + console.log(this.events); + localStorage.setItem('events', JSON.stringify(this.events) ); } } } diff --git a/src/components/Calendar.vue b/src/components/Calendar.vue index 404c6bccb134cb896061182319c8f50d31a1a89b..d0a150447d5e1127075c4eaea13034887ec3de19 100644 --- a/src/components/Calendar.vue +++ b/src/components/Calendar.vue @@ -1,10 +1,195 @@ <template> <div class="content col-md-12"> + <kalendar :configuration="calendar_settings" :events.sync="events"> + + <!-- CREATED CARD SLOT --> + <div slot="created-card" slot-scope="{ event_information }" class="details-card"> + <table> + <div> + <button style="margin-bottom: 10px" @click="removeEvent(event_information)" class="remove">X</button> + </div> + <tr><h2 style="color: #252529" class="appointment-title">{{event_information.data.title}}</h2></tr> + <tr><h5 style="color: #252529; margin-bottom: 20px" >{{event_information.data.description}}</h5></tr> + <tr>Am: {{new Date(event_information.start_time).toLocaleDateString()}}</tr> + <tr>Von: {{event_information.start_time.match(/\d\d:\d\d/)[0]}} - {{event_information.end_time.match(/\d\d:\d\d/)[0]}}</tr> + </table> + </div> + + <!-- CREATING CARD SLOT --> + <div slot="creating-card" slot-scope="{ event_information }"> + <h4 class="appointment-title" style="text-align: left;"> + Neuen Event erstellen + </h4> + <span class="time"> + {{event_information.start_time.match(/\d\d:\d\d/)[0]}} + - + {{event_information.end_time.match(/\d\d:\d\d/)[0]}} + </span> + </div> + + <!-- POPUP CARD SLOT --> + <div slot="popup-form" slot-scope="{ popup_information }" style="display: flex; flex-direction: column;"> + <h4 style="margin-bottom: 10px">Neuen Event erstellen</h4> + <input v-model="new_appointment['title']" type="text" name="title" placeholder="Title"> + <textarea v-model="new_appointment['description']" type="text" name="description" placeholder="Description" rows="2"></textarea> + <div class="buttons"> + <button class="cancel" @click="closePopups()"> + Cancel + </button> + <button @click="addEvent(popup_information)"> + Save + </button> + </div> + </div> + </kalendar> </div> </template> <script> +import Event from "@/models/event"; +import { Kalendar } from 'kalendar-vue'; +import Vue from 'vue'; +import PortalVue from "portal-vue"; +Vue.use(PortalVue); + export default { name: "Calendar", + components: { + Kalendar + }, + + data: () => ({ + event: new Event('','','',''), + events: JSON.parse(localStorage.getItem("events")), + formData: { + from: null, + to: null, + description: null, + title: null + }, + calendar_settings: { + style: 'material_design', + view_type: 'week', + cell_height: 20, + scrollToNow: true, + current_day: new Date(), + read_only: false, + military_time: true, // Boolean + day_starts_at: 0, + day_ends_at: 24, + overlap: true, + past_event_creation: true + }, + new_appointment: { + title: null, + description: null + }, + }), + + created() { + this.addManually(); + }, + + methods:{ + + loadData(){ + this.$store.dispatch('event/get').then( + (data) => { + data.forEach(row => { + console.log("loop") + let title = row.title; + let description = row.description; + let from = row.startTime; + let to = row.endTime; + + let payload = { + from, + to, + data: { + title, + description + } + } + this.events.push(payload); + }) + console.log(this.events); + } + ) + }, + + "addManually": function addManually() { + let title = 'New one'; + let description = 'Lorem dsr'; + let from = '2020-09-10T10:22:00+02:00'; + let to = '2020-09-10T11:20:00+02:00'; + let payload = { + data: { title, description }, + from, + to, + }; + this.$kalendar.addNewEvent(payload); + }, + + // Create Event + "addEvent": function addEvent(popup_data, form_data) { + + console.log("yesss") + let payload = { + data: { + placeholder: form_data, + title: this.new_appointment.title, + description: this.new_appointment.description + }, + from: popup_data.start_time, + to: popup_data.end_time, + }; + + this.$kalendar.addNewEvent(payload); + + this.event.title = payload.data.title; + this.event.description = payload.data.description; + this.event.startTime = payload.from; + this.event.endTime = payload.to; + + this.$store.dispatch('event/insert', this.event); + this.$kalendar.closePopups(); + //this.clearFormData(); + }, + + // Remove Event + removeEvent(kalendarEvent) { + let day = kalendarEvent.start_time.slice(0, 10); + this.$kalendar.removeEvent({ + day, + key: kalendarEvent.key, + id: kalendarEvent.kalendar_id, + }) + }, + } +} +</script> + +<style scoped> + +/* Links on mouse-over */ +.sidebar a:hover:not(.active) { + background-color: #c4defa; + color: white; +} + +content { + background-color: whitesmoke; } -</script> \ No newline at end of file + +.cbtn add { + float: left; + position: relative; + left: 50%; +} + +.details-card { + height: 100%; +} + + +</style> \ No newline at end of file diff --git a/src/components/Certifications.vue b/src/components/Certifications.vue index b9aba63a6571d6c83234444d7f101b9b0e71c773..1140b296b25683269d2261f3ff0225687e68d313 100644 --- a/src/components/Certifications.vue +++ b/src/components/Certifications.vue @@ -75,7 +75,6 @@ export default { this.$store.dispatch('certification/delete', this.checkedBoxes[x]).then( data => { this.message = data.message; - this.successful = true; }, error => { this.message = (error.response && error.response.data) || error.message || error.toString(); @@ -105,9 +104,10 @@ export default { loadData(){ this.$store.dispatch('certification/getAll').then( (data) => { + console.log(data) let x; for(x = 0; x < data.length; x++){ - this.rows.push({certificationid: data[x].certificationid, certificationtype: data[x].certificationtype, certificationowner: data[x].certificationowner, certificationdate: data[x].certificationdate, certificationexpiredate: data[x].certificationexpiredate}); + this.rows.push({id: data[x].id, certificationid: data[x].certifications_id, certificationtype: data[x].certificationtype, certificationname: data[x].certificationname, certificationowner: data[x].certificationowner, certificationdate: data[x].certificationdate, certificationexpiredate: data[x].certificationexpiredate}); } }, error => { diff --git a/src/components/Courses.vue b/src/components/Courses.vue index bf5adba9a58df28f76fdbaf15ac8a8f6f9eddfcd..8e92918ecf974c00f83a1f83c49aaa9570dc865c 100644 --- a/src/components/Courses.vue +++ b/src/components/Courses.vue @@ -1,67 +1,69 @@ <template> - <div class="content col-md-12"> - <div id="search_box" class="search_box col-md-4"> - <div class="entry_box-inner"> - <a id="editbutton" class="button" href="./editcourse" style="visibility: hidden">Eintrag bearbeiten</a> - <a id="addbutton" class="button" href="./createcourse">neuen Eintrag hinzufügen</a> - <a id="deletebutton" class="button" @click="deleterows">ausgewählte Einträge löschen</a> - <a id="exportbutton" class="button" href="./exporttablecourse">Tabelle exportieren</a> - </div> - <div class="search_box-inner"> - <i><img src="../assets/search.svg"></i> - <input id="inpt_search" v-model="filter" type="text" class="search__input" placeholder="Suchen..." /> + <div class="card"> + <div class="content col-md-12"> + <div id="search_box" class="search_box col-md-4"> + <div class="entry_box-inner"> + <a id="editbutton" class="button" href="./editcourse" style="visibility: hidden">Eintrag bearbeiten</a> + <a id="addbutton" class="button" href="./createcourse">neuen Eintrag hinzufügen</a> + <a id="deletebutton" class="button" @click="deleterows">ausgewählte Einträge löschen</a> + <a id="exportbutton" class="button" @click="exportExcel">Tabelle exportieren</a> + </div> + <div class="search_box-inner"> + <i><img src="../assets/search.svg"></i> + <input id="inpt_search" v-model="filter" type="text" class="search__input" placeholder="Suchen..." /> + </div> </div> + <table id="Table"> + <tr> + <th scope="row"> + <div class="form-check"> + <input name="checkbox" type="checkbox" class="form-check-input" id="checkbox_headerline" @click="checkAllBoxes"> + <label class="form-check-label" for="checkbox_headerline"></label> + </div> + </th> + <th v-on:click="sortTable('imgsortcoursenumber')"><img id='imgsortcoursenumber' :src="require('../assets/'+sortImg)">Angebotsnummer</th> + <th v-on:click="sortTable('imgsortcourseoffer')"><img id="imgsortcourseoffer" :src="require('../assets/'+sortImg)">Angebot</th> + <th v-on:click="sortTable('imgsortcoursename')"><img id="imgsortcoursename" :src="require('../assets/'+sortImg)">Kursname</th> + <th v-on:click="sortTable('imgsorteventtype')"><img id="imgsorteventtype" :src="require('../assets/'+sortImg)">Veranstaltungsart</th> + <th v-on:click="sortTable('imgsortcoursedate')"><img id="imgsortcoursedate" :src="require('../assets/'+sortImg)">Kursdatum</th> + <th v-on:click="sortTable('imgsorttopic')"><img id="imgsorttopic" :src="require('../assets/'+sortImg)">Thema</th> + <th v-on:click="sortTable('imgsortcourselocation')"><img id="imgsortcourselocation" :src="require('../assets/'+sortImg)">Kursort</th> + <th v-on:click="sortTable('imgsortaccompanyingteacher')"><img id="imgsortaccompanyingteacher" :src="require('../assets/'+sortImg)">begleitende Lehrkraft</th> + <th v-on:click="sortTable('imgsortsupervisingstudents')"><img id="imgsortsupervisingstudents" :src="require('../assets/'+sortImg)">betreuende Studenten</th> + <th v-on:click="sortTable('imgsortpresentstudents')"><img id="imgsortpresentstudents" :src="require('../assets/'+sortImg)">Anzahl der Anwesenden</th> + <th v-on:click="sortTable('imgsortregisteredstudents')"><img id="imgsortregisteredstudents" :src="require('../assets/'+sortImg)">Anzahl der Angemeldeten</th> + <th v-on:click="sortTable('imgsortanzahlung')"><img id="imgsortanzahlung" :src="require('../assets/'+sortImg)">Anzahlung</th> + <th v-on:click="sortTable('imgsorthonorar')"><img id="imgsorthonorar" :src="require('../assets/'+sortImg)">Honorar</th> + <th v-on:click="sortTable('imgsortinstructor')"><img id="imgsortinstructor" :src="require('../assets/'+sortImg)">Kursleiter</th> + <th v-on:click="sortTable('imgsortstatus')"><img id="imgsortstatus" :src="require('../assets/'+sortImg)">Aktiv</th> + <th v-on:click="sortTable('imgsortnotefield')"><img id="imgsortnotefield" :src="require('../assets/'+sortImg)">Notiz</th> + </tr> + <tr v-for="row in filteredRows" :key="row.id"> + <td scope="row"> + <div class="form-check"> + <input type="checkbox" class="form-check-input" name="checkbox_tablerow" id="checkbox_tablerow" v-model="checkedBoxes" :value="row.id"> + <label class="form-check-label" for="checkbox_tablerow"></label> + </div> + </td> + <td>{{row.coursenumber}}</td> + <td style="padding-right:200px;">{{row.courseoffer}}</td> + <td style="padding-right:200px;">{{row.coursename}}</td> + <td>{{row.eventtype}}</td> + <td>{{row.coursedate}}</td> + <td>{{row.topic}}</td> + <td style="padding-right:200px;">{{row.courselocation}}</td> + <td>{{row.accompanyingteacher}}</td> + <td>{{row.supervisingstudents}}</td> + <td>{{row.presentstudents}}</td> + <td>{{row.registeredstudents}}</td> + <td>{{row.anzahlung}}</td> + <td>{{row.honorar}}</td> + <td>{{row.instructor}}</td> + <td>{{row.status}}</td> + <td style="padding-right:300px;">{{row.notefield}}</td> + </tr> + </table> </div> - <table id="Table"> - <tr> - <th scope="row"> - <div class="form-check"> - <input name="checkbox" type="checkbox" class="form-check-input" id="checkbox_headerline" @click="checkAllBoxes"> - <label class="form-check-label" for="checkbox_headerline"></label> - </div> - </th> - <th v-on:click="sortTable('imgsortcoursenumber')"><img id='imgsortcoursenumber' :src="require('../assets/'+sortImg)">Angebotsnummer</th> - <th v-on:click="sortTable('imgsortcourseoffer')"><img id="imgsortcourseoffer" :src="require('../assets/'+sortImg)">Angebot</th> - <th v-on:click="sortTable('imgsortcoursename')"><img id="imgsortcoursename" :src="require('../assets/'+sortImg)">Kursname</th> - <th v-on:click="sortTable('imgsorteventtype')"><img id="imgsorteventtype" :src="require('../assets/'+sortImg)">Veranstaltungsart</th> - <th v-on:click="sortTable('imgsortcoursedate')"><img id="imgsortcoursedate" :src="require('../assets/'+sortImg)">Kursdatum</th> - <th v-on:click="sortTable('imgsorttopic')"><img id="imgsorttopic" :src="require('../assets/'+sortImg)">Thema</th> - <th v-on:click="sortTable('imgsortcourselocation')"><img id="imgsortcourselocation" :src="require('../assets/'+sortImg)">Kursort</th> - <th v-on:click="sortTable('imgsortaccompanyingteacher')"><img id="imgsortaccompanyingteacher" :src="require('../assets/'+sortImg)">begleitende Lehrkraft</th> - <th v-on:click="sortTable('imgsortsupervisingstudents')"><img id="imgsortsupervisingstudents" :src="require('../assets/'+sortImg)">betreuende Studenten</th> - <th v-on:click="sortTable('imgsortpresentstudents')"><img id="imgsortpresentstudents" :src="require('../assets/'+sortImg)">Anzahl der Anwesenden</th> - <th v-on:click="sortTable('imgsortregisteredstudents')"><img id="imgsortregisteredstudents" :src="require('../assets/'+sortImg)">Anzahl der Angemeldeten</th> - <th v-on:click="sortTable('imgsortanzahlung')"><img id="imgsortanzahlung" :src="require('../assets/'+sortImg)">Anzahlung</th> - <th v-on:click="sortTable('imgsorthonorar')"><img id="imgsorthonorar" :src="require('../assets/'+sortImg)">Honorar</th> - <th v-on:click="sortTable('imgsortinstructor')"><img id="imgsortinstructor" :src="require('../assets/'+sortImg)">Kursleiter</th> - <th v-on:click="sortTable('imgsortstatus')"><img id="imgsortstatus" :src="require('../assets/'+sortImg)">Aktiv</th> - <th v-on:click="sortTable('imgsortnotefield')"><img id="imgsortnotefield" :src="require('../assets/'+sortImg)">Notiz</th> - </tr> - <tr v-for="row in filteredRows" :key="row.id"> - <td scope="row"> - <div class="form-check"> - <input type="checkbox" class="form-check-input" name="checkbox_tablerow" id="checkbox_tablerow" v-model="checkedBoxes" :value="row.id"> - <label class="form-check-label" for="checkbox_tablerow"></label> - </div> - </td> - <td>{{row.coursenumber}}</td> - <td style="padding-right:200px;">{{row.courseoffer}}</td> - <td style="padding-right:200px;">{{row.coursename}}</td> - <td>{{row.eventtype}}</td> - <td>{{row.coursedate}}</td> - <td>{{row.topic}}</td> - <td style="padding-right:200px;">{{row.courselocation}}</td> - <td>{{row.accompanyingteacher}}</td> - <td>{{row.supervisingstudents}}</td> - <td>{{row.presentstudents}}</td> - <td>{{row.registeredstudents}}</td> - <td>{{row.anzahlung}}</td> - <td>{{row.honorar}}</td> - <td>{{row.instructor}}</td> - <td>{{row.status}}</td> - <td style="padding-right:300px;">{{row.notefield}}</td> - </tr> - </table> </div> </template> @@ -135,6 +137,31 @@ export default { ); }, + exportExcel(){ + this.$store.dispatch('event/get').then( + (data) => { + data.forEach(row => { + console.log("loop") + let title = row.title; + let description = row.description; + let from = row.startTime; + let to = row.endTime; + + let payload = { + from, + to, + data: { + title, + description + } + } + this.events.push(payload); + }) + console.log(this.events); + } + ) + }, + "sortTable": function sortTable(col) { this.currentSort = col; if (this.currentSortDir === 'asc') { @@ -209,6 +236,7 @@ export default { localStorage.setItem('checkedBoxID', this.checkedBoxes[0]); } }, + computed: { "columns": function columns() { if (this.rows.length === 0) { @@ -244,8 +272,9 @@ export default { </script> <style scoped> + .content{ - background-color: whitesmoke; + background-color: transparent; width: 100%; height: 100vh; overflow: auto; @@ -316,8 +345,7 @@ export default { } .content table { - margin-top: 50px; - margin-right: 1275px; + margin-top: 10px; display: inline-block; font-family: arial, sans-serif; border-collapse: collapse; @@ -343,6 +371,18 @@ export default { } .content table tbody tr:nth-child(2n) td { - background: #D4D8F9; + background: #8f0c4f; } + +.card { + /* Add shadows to create the "card" effect */ + box-shadow: 0 4px 30px 0 rgba(0,0,0,0.1); + transition: 0.2s; + margin-top: 20px; + margin-right: 10px; + height: 95vh; + border-radius: 20px; + border-color: transparent; +} + </style> \ No newline at end of file diff --git a/src/components/CreateEditComponents/CreateCertification.vue b/src/components/CreateEditComponents/CreateCertification.vue index 12352bbf5bed948c3c285d54c992d6b97abbf5df..039e63d879cfc82f46eb16146c11cc4b64428ddd 100644 --- a/src/components/CreateEditComponents/CreateCertification.vue +++ b/src/components/CreateEditComponents/CreateCertification.vue @@ -75,7 +75,7 @@ export default { data(){ return { message: "", - certification: new Certification('', '', '', '', '', ''), + certification: new Certification('', '', '', '', '', '', ''), } }, @@ -83,10 +83,9 @@ export default { validateBeforeSubmit() { this.$validator.validate().then(isValid => { if (isValid) { - console.log("isvalid") this.$store.dispatch('certification/insert', this.certification).then( data => { - this.$router.push('/certification'); + this.$router.push('/certifications'); this.message = data.message; this.successful = true; }, @@ -95,9 +94,6 @@ export default { this.successful = false; } ); - } else { - - console.log("not isvalid") } }); } diff --git a/src/components/CreateEditComponents/EditCertificate.vue b/src/components/CreateEditComponents/EditCertificate.vue index 1f69c07d7a0acc1cf168bf280865c3ee58584c58..1112d23a45728ba4b554b555c496451e3162791f 100644 --- a/src/components/CreateEditComponents/EditCertificate.vue +++ b/src/components/CreateEditComponents/EditCertificate.vue @@ -13,7 +13,7 @@ </div> <div class="form-row"> <div class="col-md-11 mb-3"> - <h1 class="formTitle">Angebot</h1> + <h1 class="formTitle">Zertifikatsart</h1> <div class="input_container"> <input v-model="certification.certificationtype" type="text" class="form-control inputField" placeholder="Zertifikatsart" aria-label="certificationtype" required> </div> @@ -21,7 +21,7 @@ </div> <div class="form-row"> <div class="col-md-11 mb-3"> - <h1 class="formTitle">Angebot</h1> + <h1 class="formTitle">Zertifikatsname</h1> <div class="input_container"> <input v-model="certification.certificationname" type="text" class="form-control inputField" placeholder="Zertifikatsname" aria-label="certificationname" required> </div> @@ -29,7 +29,7 @@ </div> <div class="form-row"> <div class="col-md-11 mb-3"> - <h1 class="formTitle">Angebot</h1> + <h1 class="formTitle">Zertifikatsbesitzer</h1> <div class="input_container"> <input v-model="certification.certificationowner" type="text" class="form-control inputField" placeholder="Zertifikatsbesitzer" aria-label="certificationowner" required> </div> @@ -37,7 +37,7 @@ </div> <div class="form-row"> <div class="col-md-11 mb-3"> - <h1 class="formTitle">Angebot</h1> + <h1 class="formTitle">Austellungsdatum</h1> <div class="input_container"> <input v-model="certification.certificationdate" type="text" class="form-control inputField" placeholder="Austellungsdatum" aria-label="certificationdate" required> </div> @@ -45,7 +45,7 @@ </div> <div class="form-row"> <div class="col-md-11 mb-3"> - <h1 class="formTitle">Angebot</h1> + <h1 class="formTitle">Ablaufdatum</h1> <div class="input_container"> <input v-model="certification.certificationexpiredate" type="text" class="form-control inputField" placeholder="Ablaufdatum" aria-label="certificationexpiredate" required> </div> @@ -76,7 +76,7 @@ export default { return { id: JSON.parse(localStorage.getItem('checkedBoxID')), message: "", - certification: new Certification('', '', '', '', '', ''), + certification: new Certification('', '', '', '', '', '','',''), } }, @@ -90,12 +90,13 @@ export default { getData(){ this.$store.dispatch('certification/getByID', this.id).then( (data) => { - this.certification.certificationid = this.certificationid; + this.certification.certificationid = data.certifications_id; this.certification.certificationtype = data.certificationtype; this.certification.certificationname = data.certificationname; this.certification.certificationowner = data.certificationowner; this.certification.certificationdate = data.certificationdate; this.certification.certificationexpiredate = data.certificationexpiredate; + this.certification.status = data.status; }, error => { @@ -108,10 +109,10 @@ export default { validateBeforeSubmit() { this.$validator.validate().then(isValid => { if (isValid) { - this.certification.certificationidid = this.id; + this.certification.id = this.id; this.$store.dispatch('certification/update', this.certification).then( data => { - this.$router.push('/certification'); + this.$router.push('/certifications'); this.message = data.message; this.successful = true; }, diff --git a/src/models/certification.js b/src/models/certification.js index bc0a8d4096b663f90d42f374dbe53a4383d5e492..2dae818eb6b781f29d69c2fa8feabb0ac0b213e8 100644 --- a/src/models/certification.js +++ b/src/models/certification.js @@ -1,11 +1,13 @@ export default class Certification { - constructor(certificationid, certificationtype, certificationname, certificationowner, certificationdate, certificationexpiredate) { + constructor(id, certificationid, certificationtype, certificationname, certificationowner, certificationdate, certificationexpiredate, status) { + this.id = id; this.certificationid = certificationid; this.certificationtype = certificationtype; this.certificationname = certificationname; this.certificationowner = certificationowner; this.certificationdate = certificationdate; this.certificationexpiredate = certificationexpiredate; + this.status = status; } } diff --git a/src/models/event.js b/src/models/event.js new file mode 100644 index 0000000000000000000000000000000000000000..aca80d1a53c8d64e17b5f39c756204ea6c160161 --- /dev/null +++ b/src/models/event.js @@ -0,0 +1,10 @@ +export default class Event { + + constructor(title, description, startTime, endTime) { + this.title = title; + this.description = description; + this.startTime = startTime; + this.endTime = endTime; + } + +} \ No newline at end of file diff --git a/src/router.js b/src/router.js index 3ca359a55b2b17c66047ee95131eb7bc90b09b0c..5f70384dbecdb9fb42e593e84314789d624ab4d9 100644 --- a/src/router.js +++ b/src/router.js @@ -34,10 +34,6 @@ const router = new Router({ name: 'Eintrag bearbeiten', component: EditCourse }, - { - path: '/deletecourse', - name: 'Eintrag löschen' - }, // Button from Teachers { @@ -50,10 +46,6 @@ const router = new Router({ name: 'Eintrag bearbeiten', component: EditTeacher }, - { - path: '/deleteteacher', - name: 'Eintrag löschen' - }, // Button from Certification { @@ -122,7 +114,7 @@ const router = new Router({ }) router.beforeEach((to, from, next) => { - const publicPages = ['/login', '/register']; + const publicPages = ['/login']; const authRequired = !publicPages.includes(to.path); const loggedIn = localStorage.getItem('user'); diff --git a/src/services/certification.service.js b/src/services/certification.service.js new file mode 100644 index 0000000000000000000000000000000000000000..e19c1e849959d117bbcbb5143e3e6a7a08f4405e --- /dev/null +++ b/src/services/certification.service.js @@ -0,0 +1,77 @@ +import axios from 'axios'; +import authHeader from "@/services/auth-header"; + +const API_URL = 'http://localhost:9192/'; + +class CertificationService { + + insert(certification) { + return axios + .post(API_URL + 'insertCertification', { + certifications_id: certification.certificationid, + certificationtype: certification.certificationtype, + certificationname: certification.certificationname, + certificationowner: certification.certificationowner, + certificationdate: certification.certificationdate, + certificationexpiredate: certification.certificationexpiredate, + status: certification.status + } + + ,{headers: authHeader() }) + .then(response => { + return response.data; + }); + } + + update(certification) { + return axios + .post(API_URL + 'updateCertification', { + id: certification.id, + certifications_id: certification.certificationid, + certificationtype: certification.certificationtype, + certificationname: certification.certificationname, + certificationowner: certification.certificationowner, + certificationdate: certification.certificationdate, + certificationexpiredate: certification.certificationexpiredate, + status: certification.status + } + ,{headers: authHeader() }) + .then(response => { + return response.data; + }); + } + + delete(id) { + return axios + .post(API_URL + 'deleteCertification', { + id: id + } + ,{headers: authHeader() }) + .then(response => { + return response.data; + }); + } + + getAll() { + return axios + .get(API_URL + 'getCertifications', { + headers: authHeader() + }) + .then(response => { + return response.data; + }); + } + + getByID(idValue) { + return axios + .get(API_URL + 'getCertificationByID/'+idValue, { + headers: authHeader() + }) + .then(response => { + return response.data; + }); + } +} + + +export default new CertificationService(); \ No newline at end of file diff --git a/src/services/event.service.js b/src/services/event.service.js new file mode 100644 index 0000000000000000000000000000000000000000..bd79668d502c2484798e50034b90a8c6e37dc071 --- /dev/null +++ b/src/services/event.service.js @@ -0,0 +1,35 @@ +import axios from 'axios'; +import authHeader from "@/services/auth-header"; + +const API_URL = 'http://localhost:9192/'; + +class EventService { + + insert(event) { + return axios + .post(API_URL + 'insertEvent', { + title: event.title, + description: event.description, + startTime: event.startTime, + endTime: event.endTime + } + ,{headers: authHeader() }) + .then(response => { + return response.data; + }); + } + + get() { + return axios + .get(API_URL + 'getEvents', { + headers: authHeader() + }) + .then(response => { + return response.data; + }); + } + +} + + +export default new EventService(); \ No newline at end of file diff --git a/src/store/certification.module.js b/src/store/certification.module.js new file mode 100644 index 0000000000000000000000000000000000000000..2b7d95734417d45d37f8ad75cee1047e04c12d24 --- /dev/null +++ b/src/store/certification.module.js @@ -0,0 +1,85 @@ +import CertificationService from '../services/certification.service'; + +const initialState = null; + +export const certification = { + + namespaced: true, + state: initialState, + actions: { + + insert({ commit }, certification) { + return CertificationService.insert(certification).then( + response => { + commit('insertSuccess', response); + return Promise.resolve(response); + }, + error => { + commit('insertFailure'); + return Promise.reject(error); + } + ); + }, + + update({ commit }, certification) { + return CertificationService.update(certification).then( + response => { + commit('insertSuccess', response); + return Promise.resolve(response); + }, + error => { + commit('insertFailure'); + return Promise.reject(error); + } + ); + }, + + delete({ commit }, id) { + return CertificationService.delete(id).then( + response => { + commit('insertSuccess', response); + return Promise.resolve(response); + }, + error => { + commit('insertFailure'); + return Promise.reject(error); + } + ); + }, + + getAll({ commit }) { + return CertificationService.getAll().then( + response => { + commit('insertSuccess', response); + return Promise.resolve(response); + }, + error => { + commit('insertFailure'); + return Promise.reject(error); + } + ); + }, + + getByID({ commit }, id) { + return CertificationService.getByID(id).then( + response => { + commit('insertSuccess', response); + return Promise.resolve(response); + }, + error => { + commit('insertFailure'); + return Promise.reject(error); + } + ); + } + }, + + mutations: { + insertSuccess(state, response) { + state.response = response; + }, + insertFailure(state, response) { + state.response = response; + } + } +}; \ No newline at end of file diff --git a/src/store/event.module.js b/src/store/event.module.js new file mode 100644 index 0000000000000000000000000000000000000000..775225dd399769d935e644ef24edb4a423a32c10 --- /dev/null +++ b/src/store/event.module.js @@ -0,0 +1,47 @@ +import EventService from '../services/event.service'; + +const initialState = null; + +export const event = { + + namespaced: true, + state: initialState, + actions: { + + insert({ commit }, event) { + return EventService.insert(event).then( + response => { + commit('insertSuccess', response); + return Promise.resolve(response); + }, + error => { + commit('insertFailure'); + return Promise.reject(error); + } + ); + }, + + get({ commit }) { + return EventService.get().then( + response => { + commit('insertSuccess', response); + return Promise.resolve(response); + }, + error => { + commit('insertFailure'); + return Promise.reject(error); + } + ); + }, + + }, + + mutations: { + insertSuccess(state, response) { + state.response = response; + }, + insertFailure(state, response) { + state.response = response; + } + } +}; \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js index bf3991401ed8cff280d58d4f4008ae8c2fd1ea29..60940086c4a7d991c663abf30359023fbe1b0af4 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -5,6 +5,8 @@ import { auth } from './auth.module'; import { user } from './user.module'; import { course } from './course.module'; import { teacher } from './teacher.module'; +import { event } from './event.module'; +import { certification } from './certification.module'; Vue.use(Vuex); @@ -13,6 +15,8 @@ export default new Vuex.Store({ auth, user, course, - teacher + event, + teacher, + certification } }); \ No newline at end of file