diff --git a/app/src/plugins/app/_config/App.vue b/app/src/plugins/app/_config/App.vue index b82e138..19efa9f 100644 --- a/app/src/plugins/app/_config/App.vue +++ b/app/src/plugins/app/_config/App.vue @@ -5,11 +5,11 @@ - - + + - + @@ -76,7 +76,7 @@ export default { }, methods: { - onTeamDeleted(team) { + onTeamUpdate(team) { this.$events.emit('on-team-deleted', team) }, diff --git a/app/src/plugins/app/_config/main.ts b/app/src/plugins/app/_config/main.ts index 9192b5b..ccae222 100644 --- a/app/src/plugins/app/_config/main.ts +++ b/app/src/plugins/app/_config/main.ts @@ -47,8 +47,8 @@ const options: Options = { 'POST v1/auth/login': true, 'POST v1/auth/post': true, - 'GET v1/master-tasks/(id)': true, - 'GET v1/master-tasks': true, + // 'GET v1/master-tasks/(id)': true, + // 'GET v1/master-tasks': true, 'POST v1/master-tasks/(id)': true, 'DELETE v1/master-tasks/(id)': true, 'POST v1/master-tasks': true, @@ -64,11 +64,11 @@ const options: Options = { 'DELETE v1/tasks/(id)': true, // 'GET v1/teams/(id)': true, - 'POST v1/teams/(id)': true, - 'DELETE v1/teams/(id)': true, + // 'POST v1/teams/(id)': true, + // 'DELETE v1/teams/(id)': true, // 'GET v1/teams': true, // 'GET v1/teamsx': true, - 'POST v1/teams': true, + // 'POST v1/teams': true, // 'GET v1/employees': true, 'GET v1/search': true, diff --git a/app/src/plugins/app/_theme/_components/buttons.sass b/app/src/plugins/app/_theme/_components/buttons.sass new file mode 100644 index 0000000..5597018 --- /dev/null +++ b/app/src/plugins/app/_theme/_components/buttons.sass @@ -0,0 +1,18 @@ +.button.primary + background: #7f39fb !important + border-radius: 4px !important + color: #fff !important + height: 50px + width: 100% + flex: 0 0 auto + +.button.secondary + color: #6200EE + border: 1px solid #E0E0E0 + border-radius: 4px + height: 50px + width: 203px + +.button.cancel + border: thin solid rgba(var(--v-border-color), var(--v-border-opacity)) !important + color: #7f39fb !important \ No newline at end of file diff --git a/app/src/plugins/app/_theme/_components/modals.sass b/app/src/plugins/app/_theme/_components/modals.sass new file mode 100644 index 0000000..1f85865 --- /dev/null +++ b/app/src/plugins/app/_theme/_components/modals.sass @@ -0,0 +1,32 @@ +.modal-header + flex: 0 0 auto + + .trash-icon + padding: 10px + background: rgba(0, 0, 0, 0.04) + margin-left: 12px + border-radius: 50% + cursor: pointer + + .pencil-icon + padding: 10px + background: rgba(0, 0, 0, 0.04) + border-radius: 50% + cursor: pointer + + +.modal-input + width: 100% !important + flex: 0 0 auto + +.modal-content + flex: 1 1 100% + margin: 10px 0 + overflow-y: scroll + +.remove-input + pointer-events: auto + opacity: 2 + position: absolute + left: 92% + top: 25% \ No newline at end of file diff --git a/app/src/plugins/app/_theme/_components/z-cancel-btn.sass b/app/src/plugins/app/_theme/_components/z-cancel-btn.sass deleted file mode 100644 index 6729a38..0000000 --- a/app/src/plugins/app/_theme/_components/z-cancel-btn.sass +++ /dev/null @@ -1,3 +0,0 @@ -.cancel-btn - border: thin solid rgba(var(--v-border-color), var(--v-border-opacity)) !important - color: #7f39fb !important \ No newline at end of file diff --git a/app/src/plugins/app/_theme/_components/z-default-btn.sass b/app/src/plugins/app/_theme/_components/z-default-btn.sass deleted file mode 100644 index 3b84a60..0000000 --- a/app/src/plugins/app/_theme/_components/z-default-btn.sass +++ /dev/null @@ -1,4 +0,0 @@ -.z-btn - background: #7f39fb !important - border-radius: 4px !important - color: #fff !important \ No newline at end of file diff --git a/app/src/plugins/app/_theme/index.sass b/app/src/plugins/app/_theme/index.sass index 2631e0f..999698f 100644 --- a/app/src/plugins/app/_theme/index.sass +++ b/app/src/plugins/app/_theme/index.sass @@ -1,13 +1,14 @@ @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap') @import './vuetify/v-dialog' -@import './_components/z-default-btn' -@import './_components/z-cancel-btn' @import './date-picker' @import './global' @import '@/plugins/lib@auth/_theme/auth.theme' +@import './_components/buttons' +@import './_components/modals' + * font-family: 'Roboto', sans-serif diff --git a/app/src/plugins/lib@auth/reset-password/_components/a-reset-password-form.vue b/app/src/plugins/lib@auth/reset-password/_components/a-reset-password-form.vue index 21229f1..b5515ff 100644 --- a/app/src/plugins/lib@auth/reset-password/_components/a-reset-password-form.vue +++ b/app/src/plugins/lib@auth/reset-password/_components/a-reset-password-form.vue @@ -43,7 +43,7 @@ export default { methods: { async submit() { - if (!(await this.v$.$validate())) return console.log(this.v$) + if (!(await this.v$.$validate())) return try { await this.$axios.post_data('v1/auth/reset', this.form) diff --git a/app/src/plugins/lib@search/search/search.vue b/app/src/plugins/lib@search/search/search.vue index fe5982e..9d71c2e 100644 --- a/app/src/plugins/lib@search/search/search.vue +++ b/app/src/plugins/lib@search/search/search.vue @@ -24,7 +24,6 @@ export default { created() { try { this.searchResults = this.$axios.get_auth_data('v1/search') - console.log(this.searchResults) } catch (error) { this.$toast.error(error) } diff --git a/app/src/plugins/tm@_utils/tm.utils.ts b/app/src/plugins/tm@_utils/tm.utils.ts new file mode 100644 index 0000000..2fad043 --- /dev/null +++ b/app/src/plugins/tm@_utils/tm.utils.ts @@ -0,0 +1,19 @@ +import moment from 'moment' + +export default { + enrichEmployeesByFullName(employees) { + return employees.map(employee => ({...employee, _fullName: `${ employee.name } ${ employee.surname }`})) + }, + + formatDateTime(date) { + return moment(date).format('DD.MM.yyyy, HH:mm') + }, + + isBefore(date, compareTo = null) { + return moment(date).isBefore(moment(compareTo)) + }, + + isAfter(date, compareTo = null) { + return moment(date).isAfter(moment(compareTo)) + } +} \ No newline at end of file diff --git a/app/src/plugins/tm@dashboard/projects/projects.vue b/app/src/plugins/tm@dashboard/projects/projects.vue index d6d2b4f..c796d01 100644 --- a/app/src/plugins/tm@dashboard/projects/projects.vue +++ b/app/src/plugins/tm@dashboard/projects/projects.vue @@ -53,7 +53,7 @@ export default { // format masterTasks to event format for calendar events = events.map(event => { - const color = this._stringToHexColor(`${event.project_code}${event.name}`) + const color = this._stringToHexColor(event.color) return { id: event.id, @@ -81,7 +81,7 @@ export default { try { this.teams = await this.$axios.get_auth_data('v1/teams') this.employees = await this.$axios.get_auth_data('v1/employees') - this.masterTasks = await this.$axios.get_auth_data('v1/master-tasks') + this.masterTasks = await this.$axios.get_auth_data('v1/mastertasks') } catch (error) { this.masterTasks = {error} } @@ -98,19 +98,19 @@ export default { }, _stringToHexColor(string) { - let hash = 0; + let hash = 0 for (let i = 0; i < string.length; i++) { - hash = string.charCodeAt(i) + ((hash << 5) - hash); + hash = string.charCodeAt(i) + ((hash << 5) - hash) } - let color = '#'; + let color = '#' for (let i = 0; i < 3; i++) { - let value = (hash >> (i * 8)) & 0xFF; - color += ('00' + value.toString(16)).substr(-2); + let value = (hash >> (i * 8)) & 0xFF + color += ('00' + value.toString(16)).substr(-2) } - return color; + return color } } } - + \ No newline at end of file diff --git a/app/src/plugins/tm@dashboard/tasks/_components/a-tasks-filter.vue b/app/src/plugins/tm@dashboard/tasks/_components/a-tasks-filter.vue index 07a0e32..9af6910 100644 --- a/app/src/plugins/tm@dashboard/tasks/_components/a-tasks-filter.vue +++ b/app/src/plugins/tm@dashboard/tasks/_components/a-tasks-filter.vue @@ -3,7 +3,7 @@

{{ blocker.id ? 'Upraviť' : 'Vytvoriť'}} blocker

@@ -26,7 +26,7 @@ variant="solo" >
@@ -66,22 +66,26 @@ /> - {{ blocker.id ? 'UPRAVIŤ' : 'VYTVORIŤ'}} + {{ blocker.id ? 'UPRAVIŤ' : 'VYTVORIŤ'}} - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue b/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue index f50a0e0..c0cd11d 100644 --- a/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue +++ b/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue @@ -5,7 +5,7 @@
- Ukončiť mastertask + Ukončiť mastertask
@@ -309,8 +309,10 @@ import useVuelidate from '@vuelidate/core' import { required } from '@vuelidate/validators' import errorUtils from '@/plugins/lib@auth/_utils/error.utils' import ZAutocomplete from '@/plugins/tm@_components/z-autocomplete.vue' +import VuetifyFixFocusMixin from '@/plugins/tm@modal/_mixins/vuetify-fix-focus' import moment from 'moment' import { QuillEditor } from '@vueup/vue-quill' +import tmUtils from '@/plugins/tm@_utils/tm.utils' import * as FileSaver from 'file-saver' import '@vueup/vue-quill/dist/vue-quill.snow.css' @@ -318,6 +320,7 @@ const atLeastOne = (value) => value.length export default { emits: ['close'], + mixins: [VuetifyFixFocusMixin], components: { Datepicker, @@ -328,16 +331,18 @@ export default { data() { return { + tmUtils, editMode: false, visible: false, errorUtils, v$: useVuelidate(), - preventInputFocus: false, teams: null, employees: null, - selectedTeam: '', - showAddEmployeeInput: false, - masterTask: null + employeeSelect: null, + teamSelect: '', + masterTask: null, + + showAddEmployeeInput: false } }, @@ -354,47 +359,31 @@ export default { }, methods: { - // async downloadFile() { - // try { - // const file = await this.$axios.get_auth(`v1/files/${this.file.basename}`, { responseType: 'arraybuffer' }) - // const blob = new Blob([file], { type: this.file.mimetype }) - // FileSaver.saveAs(blob, this.file.name) - // this.isLoading = false - // } catch(error) { - // this.$toast.error(error) - // } - // }, + itemSelected(x) { + console.log(x) + }, async showModal(masterTask, editMode = false) { - this.visible = true - this.masterTask = null + this.visible = true + this.masterTask = null + this.teamSelect = null + this.employeeSelect = null try { this.teams = await this.$axios.get_auth_data('v1/teams') - this.employees = await this.$axios.get_auth_data('v1/employees') - } catch (error) { - this.$toast.error(error) - } + const employees = await this.$axios.get_auth_data('v1/employees') + this.employees = tmUtils.enrichEmployeesByFullName(employees) - if (masterTask?.id) { - await this._load(masterTask.id) - this.editMode = editMode || !masterTask?.id - } else { - const masterTask = { - project_code: null, - name: null, - deadline: null, - duration: null, - team: {}, - description: null, - employees: [], - files: [] + if (masterTask?.id) { + this.masterTask = await this.$axios.get_auth_data(`v1/master-tasks/${masterTask.id}`) + this.teamSelect = this.masterTask.team.id + } else { + this.masterTask = {team: {}, employees: []} } - setTimeout(() => { - this.masterTask = masterTask - this.editMode = editMode || !this.masterTask.id - }) + this.editMode = (editMode || !this.masterTask.id) + } catch (error) { + this.$toast.error(error) } }, @@ -404,54 +393,32 @@ export default { try { if (this.masterTask.id) - await this._update() + await this.$axios.patch_auth(`v1/master-tasks/${this.masterTask.id}`, this.masterTask) else - await this._create() + await this.$axios.post_auth('v1/mastertasks', this.masterTask) - this.close() - this.$router.push({ name: 'Dashboard - Tasks' }) + this.closeModal() + // this.$router.push({ name: 'Dashboard - Tasks' }) } catch (error) { this.$toast(error) } }, - close() { + closeModal() { this.visible = false this.$emit('close', this.masterTask) }, - async _load(masterTaskId) { - try { - this.masterTask = await this.$axios.get_auth_data(`v1/master-tasks/${masterTaskId}`) - } catch (error) { - this.$toast.error(error) - } - }, + async _delete() { + // Kravarik: Tu sa ma volat delete-master-task-modal, ak taka funkcionalita vlastne je - async _create() { - try { - await this.$axios.post_auth('v1/mastertasks') - } catch (error) { - this.$toast.error(error) - } - }, - - async _update() { - try { - await this.$axios.post_auth(`v1/master-tasks/${this.masterTask.id}`) - } catch (error) { - this.$toast.error(error) - } - }, - - async deleteTask(masterTaskId) { - try { - await this.$axios.delete(`v1/master-tasks/${masterTaskId}`) - this.close() - } catch (error) { - this.$toast.error(error) - } + // try { + // await this.$axios.delete(`v1/master-tasks/${this.masterTask.id}`) + // this.closeModal() + // } catch (error) { + // this.$toast.error(error) + // } }, employeeSelected(selectedOption) { @@ -460,27 +427,12 @@ export default { this.showAddEmployeeInput = false }, - // Vuetify input was automatically focus after date input was clicked. This will prevent this unwanted behavior - onDateFocus($event) { - if ($event == undefined) { - this.preventInputFocus = true - } - }, - - onInputFocus($event) { - if (this.preventInputFocus) { - $event.target.blur() - this.preventInputFocus = false - } - }, - filesUploaded(files) { this.masterTask.files = files } }, computed: { - totalHours() { let hours = 0 @@ -505,57 +457,36 @@ export default { value: `${employee.name} ${employee.surname}`, } }) - }, - - formattedDeadline() { - let deadline = moment(this.masterTask.deadline) - let date = deadline.format('DD.MM.yyyy') - return date - }, - - compareDates() { - const date1 = moment() - const date2 = moment(this.masterTask.deadline) - return moment(date1).isBefore(date2) } }, watch: { - selectedTeam() { - this.masterTask.team = this.teams.find(team => team.id == this.selectedTeam) + teamSelect(value) { + if (!value || !this.masterTask) return + + this.masterTask.team = this.teams.find(team => team.id == value) this.masterTask.employees = this.masterTask.team.employees + }, + + employeeSelect(value) { + if (!value || !this.masterTask) return + + const employee = this.employees.find(employee => employee.id == value) + this.masterTask.employees.push(employee) + + this.$nextTick(() => { + this.employeeSelect = null + this.$el.activeElement.blur() + // console.log(this.$refs['employee-select']) + // this.$refs['employee-select'].focused = false + // this.employeeSelect = '' + }) } } } + \ No newline at end of file diff --git a/app/src/plugins/tm@overview/_components/z-tasks-search.vue b/app/src/plugins/tm@overview/_components/z-tasks-search.vue index de44967..a7caeb7 100644 --- a/app/src/plugins/tm@overview/_components/z-tasks-search.vue +++ b/app/src/plugins/tm@overview/_components/z-tasks-search.vue @@ -5,7 +5,7 @@ class="subheader-input" variant="outlined" label="Zamestanec" - :items="allEmployees" + :items="[null, ...allEmployees]" item-title="fullName" item-value="id" >
diff --git a/app/src/plugins/tm@overview/teams/teams.vue b/app/src/plugins/tm@overview/teams/teams.vue index 8b8bf6d..692ae86 100644 --- a/app/src/plugins/tm@overview/teams/teams.vue +++ b/app/src/plugins/tm@overview/teams/teams.vue @@ -1,6 +1,6 @@ @@ -29,7 +29,7 @@ export default { methods: { async _loadData() { this.teams = null - + try { this.teams = await this.$axios.get_auth_data('v1/teams') } catch (error) { diff --git a/app/src/plugins/tm@profile/profile/my-profile.vue b/app/src/plugins/tm@profile/profile/my-profile.vue index aec5e13..7ddb45d 100644 --- a/app/src/plugins/tm@profile/profile/my-profile.vue +++ b/app/src/plugins/tm@profile/profile/my-profile.vue @@ -58,7 +58,7 @@ >
- ULOŽIŤ ZMENY + ULOŽIŤ ZMENY
diff --git a/app/src/plugins/w/axios/models/axios.ts b/app/src/plugins/w/axios/models/axios.ts index 7eefda8..d379522 100644 --- a/app/src/plugins/w/axios/models/axios.ts +++ b/app/src/plugins/w/axios/models/axios.ts @@ -34,7 +34,7 @@ export default { async post(url: string, params = null, config?: any) { - return axios.post(url, params, config) + return axios.post(url, {data: params}, config) .then(response => response.data) .catch(error => Promise.reject(error)) }, @@ -42,14 +42,14 @@ export default { async post_auth(url: string, params = null, config?: any) { config = this._config(config) - return axios.post(url, params, config) + return axios.post(url, {data: params}, config) .then(response => response.data) .catch(error => Promise.reject(error)) }, async post_data(url: string, params = null, config?: any) { - return axios.post(url, params, config) + return axios.post(url, {data: params}, config) .then(response => response.data.data) .catch(error => Promise.reject(error.response || error)) }, @@ -57,7 +57,7 @@ export default { async post_auth_data(url: string, params = null, config?: any) { config = this._config(config) - return axios.post(url, params, config) + return axios.post(url, {data: params}, config) .then(response => response.data.data) .catch(error => Promise.reject(error.response || error)) }, @@ -91,7 +91,7 @@ export default { }, async patch(url: string, params = null, config?: any) { - return axios.patch(url, params, config) + return axios.patch(url, {data: params}, config) .then(response => response.data) .catch(error => Promise.reject(error)) }, @@ -99,13 +99,13 @@ export default { async patch_auth(url: string, params = null, config?: any) { config = this._config(config) - return axios.patch(url, params, config) + return axios.patch(url, {data: params}, config) .then(response => response.data) .catch(error => Promise.reject(error)) }, async patch_data(url: string, params = null, config?: any) { - return axios.patch(url, params, config) + return axios.patch(url, {data: params}, config) .then(response => response.data.data) .catch(error => Promise.reject(error.response || error)) }, @@ -113,7 +113,7 @@ export default { async patch_auth_data(url: string, params = null, config?: any) { config = this._config(config) - return axios.patch(url, params, config) + return axios.patch(url, {data: params}, config) .then(response => response.data.data) .catch(error => Promise.reject(error.response || error)) }, diff --git a/app/src/plugins/w/loadable/_components/w-loadable.vue b/app/src/plugins/w/loadable/_components/w-loadable.vue index 990860a..22e0ba9 100644 --- a/app/src/plugins/w/loadable/_components/w-loadable.vue +++ b/app/src/plugins/w/loadable/_components/w-loadable.vue @@ -1,5 +1,5 @@