From 0a038b777181a70abb69c2b850992be25fb6a92c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Glasn=C3=A1k?= Date: Tue, 31 Jan 2023 15:05:26 +0100 Subject: [PATCH 1/6] [tm@modals] Refactoring --- .../app/_theme/_components/buttons.sass | 18 ++ .../app/_theme/_components/modals.sass | 13 + .../app/_theme/_components/z-cancel-btn.sass | 3 - .../app/_theme/_components/z-default-btn.sass | 4 - app/src/plugins/app/_theme/index.sass | 5 +- app/src/plugins/app/_theme/modals.sass | 17 ++ .../_components/a-reset-password-form.vue | 2 +- app/src/plugins/lib@search/search/search.vue | 1 - app/src/plugins/tm@_utils/tm.utils.ts | 19 ++ .../tm@modal/_mixins/vuetify-fix-focus.ts | 23 ++ .../tm@modal/blocker/z-blocker-modal.vue | 139 +++------- .../master-task/z-master-task-modal.vue | 232 ++++++----------- .../tm@modal/task/z-complete-task-modal.vue | 15 +- .../tm@modal/task/z-delete-task-modal.vue | 12 +- .../tm@modal/task/z-task-add-time-modal.vue | 8 +- .../plugins/tm@modal/task/z-task-modal.vue | 246 ++++-------------- .../tm@modal/team/z-delete-team-modal.vue | 12 +- .../plugins/tm@modal/team/z-team-modal.vue | 113 ++------ .../plugins/tm@profile/profile/my-profile.vue | 2 +- 19 files changed, 302 insertions(+), 582 deletions(-) create mode 100644 app/src/plugins/app/_theme/_components/buttons.sass create mode 100644 app/src/plugins/app/_theme/_components/modals.sass delete mode 100644 app/src/plugins/app/_theme/_components/z-cancel-btn.sass delete mode 100644 app/src/plugins/app/_theme/_components/z-default-btn.sass create mode 100644 app/src/plugins/app/_theme/modals.sass create mode 100644 app/src/plugins/tm@_utils/tm.utils.ts create mode 100644 app/src/plugins/tm@modal/_mixins/vuetify-fix-focus.ts 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..0c80d0f --- /dev/null +++ b/app/src/plugins/app/_theme/_components/modals.sass @@ -0,0 +1,13 @@ +.modal-header + .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 \ 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..a99f3f1 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 './_components/buttons' @import './date-picker' @import './global' @import '@/plugins/lib@auth/_theme/auth.theme' +@import './modals' + * font-family: 'Roboto', sans-serif diff --git a/app/src/plugins/app/_theme/modals.sass b/app/src/plugins/app/_theme/modals.sass new file mode 100644 index 0000000..136bd51 --- /dev/null +++ b/app/src/plugins/app/_theme/modals.sass @@ -0,0 +1,17 @@ +.modal-input + width: 100% !important + flex: 0 0 auto +.modal-header + 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/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@modal/_mixins/vuetify-fix-focus.ts b/app/src/plugins/tm@modal/_mixins/vuetify-fix-focus.ts new file mode 100644 index 0000000..cadcb57 --- /dev/null +++ b/app/src/plugins/tm@modal/_mixins/vuetify-fix-focus.ts @@ -0,0 +1,23 @@ +export default { + // Mixin to fix autofocus on v-input in modals where date selects are used + data() { + return { + preventInputFocus: false + } + }, + + methods: { + onDateFocus($event) { + if ($event == undefined) { + this.preventInputFocus = true + } + }, + + onInputFocus($event) { + if (this.preventInputFocus) { + $event.target.blur() + this.preventInputFocus = false + } + } + } +} \ No newline at end of file diff --git a/app/src/plugins/tm@modal/blocker/z-blocker-modal.vue b/app/src/plugins/tm@modal/blocker/z-blocker-modal.vue index 5879ce9..7805a7b 100644 --- a/app/src/plugins/tm@modal/blocker/z-blocker-modal.vue +++ b/app/src/plugins/tm@modal/blocker/z-blocker-modal.vue @@ -5,7 +5,7 @@
- ULOŽIŤ ZMENY + ULOŽIŤ ZMENY
From aaafb6534cd359e8b83a2f08137dcbac97849360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Glasn=C3=A1k?= Date: Tue, 31 Jan 2023 15:27:44 +0100 Subject: [PATCH 2/6] [Modals] Refactoring --- .../app/_theme/_components/modals.sass | 21 +++++++++++++- app/src/plugins/app/_theme/index.sass | 4 +-- app/src/plugins/app/_theme/modals.sass | 17 ----------- .../master-task/z-master-task-modal.vue | 16 ++--------- .../plugins/tm@modal/task/z-task-modal.vue | 28 ++++++++----------- app/src/plugins/tm@overview/teams/teams.vue | 2 +- .../w/loadable/_components/w-loadable.vue | 3 +- 7 files changed, 40 insertions(+), 51 deletions(-) delete mode 100644 app/src/plugins/app/_theme/modals.sass diff --git a/app/src/plugins/app/_theme/_components/modals.sass b/app/src/plugins/app/_theme/_components/modals.sass index 0c80d0f..1f85865 100644 --- a/app/src/plugins/app/_theme/_components/modals.sass +++ b/app/src/plugins/app/_theme/_components/modals.sass @@ -1,4 +1,6 @@ .modal-header + flex: 0 0 auto + .trash-icon padding: 10px background: rgba(0, 0, 0, 0.04) @@ -10,4 +12,21 @@ padding: 10px background: rgba(0, 0, 0, 0.04) border-radius: 50% - cursor: pointer \ No newline at end of file + 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/index.sass b/app/src/plugins/app/_theme/index.sass index a99f3f1..999698f 100644 --- a/app/src/plugins/app/_theme/index.sass +++ b/app/src/plugins/app/_theme/index.sass @@ -1,13 +1,13 @@ @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap') @import './vuetify/v-dialog' -@import './_components/buttons' @import './date-picker' @import './global' @import '@/plugins/lib@auth/_theme/auth.theme' -@import './modals' +@import './_components/buttons' +@import './_components/modals' * font-family: 'Roboto', sans-serif diff --git a/app/src/plugins/app/_theme/modals.sass b/app/src/plugins/app/_theme/modals.sass deleted file mode 100644 index 136bd51..0000000 --- a/app/src/plugins/app/_theme/modals.sass +++ /dev/null @@ -1,17 +0,0 @@ -.modal-input - width: 100% !important - flex: 0 0 auto -.modal-header - 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/tm@modal/master-task/z-master-task-modal.vue b/app/src/plugins/tm@modal/master-task/z-master-task-modal.vue index 0cb536c..3086ec0 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 @@ -101,17 +101,7 @@ @option-selected="employeeSelected" /> - - - - + Pridať zamestnanca @@ -318,7 +308,7 @@ import ZFilesUpload from '@/plugins/tm@_components/z-files-upload.vue' 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 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' @@ -335,7 +325,7 @@ export default { components: { Datepicker, ZFilesUpload, - // ZAutocomplete, + ZAutocomplete, QuillEditor }, diff --git a/app/src/plugins/tm@modal/task/z-task-modal.vue b/app/src/plugins/tm@modal/task/z-task-modal.vue index 991e947..db9dc08 100644 --- a/app/src/plugins/tm@modal/task/z-task-modal.vue +++ b/app/src/plugins/tm@modal/task/z-task-modal.vue @@ -19,7 +19,7 @@ masterTask.id == value - ) + this.task.master_task = this.masterTasks.find(masterTask => masterTask.id == value) }, - selectedEmployeeId(value) { + employeeIdSelect(value) { if (!value || !this.task) return - this.task.employee = this.task.master_task.employees.find( - (employee) => employee.id == value - ) + this.task.employee = this.task.master_task.employees.find(employee => employee.id == value) }, }, } diff --git a/app/src/plugins/tm@overview/teams/teams.vue b/app/src/plugins/tm@overview/teams/teams.vue index 8b8bf6d..48ef321 100644 --- a/app/src/plugins/tm@overview/teams/teams.vue +++ b/app/src/plugins/tm@overview/teams/teams.vue @@ -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/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 @@