From b7051216fe27ce17fd2359fe772803fa9297ac72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Glasn=C3=A1k?= Date: Mon, 24 Jul 2023 13:43:25 +0200 Subject: [PATCH 1/5] [Project code] Fixed autocomplete --- .../tm@modal/master-task/_mixins/selects.mixin.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/src/plugins/tm@modal/master-task/_mixins/selects.mixin.ts b/app/src/plugins/tm@modal/master-task/_mixins/selects.mixin.ts index dc22da2..4f6a238 100644 --- a/app/src/plugins/tm@modal/master-task/_mixins/selects.mixin.ts +++ b/app/src/plugins/tm@modal/master-task/_mixins/selects.mixin.ts @@ -11,7 +11,17 @@ export default { projectsOptions() { // Added to "paginate" projects, because v-autocomplete was unable to handle so many projects at once - const projects = this.projects.filter(project => project.code.includes(this.projectCodeSearch)) + const pattern = /[^a-zA-Z0-9 ]/g + + const normalizedInput = this.projectCodeSearch + ? this.projectCodeSearch.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(pattern, '') + : '' + + const projects = this.projects.filter(project => { + const normalizedProjectCode = project.code.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(pattern, '') + return normalizedProjectCode.toLowerCase().includes(normalizedInput.toLowerCase()) + }) + let filteredProjects = projects?.length ? projects.slice(0, 10) : this.projects.slice(0, 10) if (!this.mastertask?.project_id) From 886a44229f4aa5e5912b76715256854758313f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Glasn=C3=A1k?= Date: Mon, 24 Jul 2023 14:09:52 +0200 Subject: [PATCH 2/5] [QuillEditor] Fixed required validations --- .../master-task/z-master-task-modal.vue | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) 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 0e23fd6..bebd636 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 @@ -42,7 +42,7 @@ Pridať zamestnanca @@ -163,12 +163,19 @@ export default { }, validations() { + const quillEditorRequired = (value) => { + if (!value || !value.length || !value.replace(/<[^>]*>/g, '').length) + return false + + return true + } + return { mastertask: { employees: { required, minLength: minLength(1), $each: {duration: { required}} }, project_id: { required }, name: { required }, - description: { required }, + description: { quillEditorRequired }, deadline: { required }, _deadline_time: { required } } @@ -303,6 +310,10 @@ export default { this.$events.emit('show-subtask-modal', { subtask: null, editMode: false, mastertask: this.mastertask }) }, + onQuillEditorInput() { + this.mastertask.description = this.$refs['description'].getHTML() + }, + _mergeDeadlineTimeDate() { const date = new Date(this.mastertask.deadline) const timeParts = this.mastertask._deadline_time.split(':') @@ -341,7 +352,14 @@ export default { this.mastertask._deadline_time = `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}` }) - } + }, + + // mastertask: { + // handler(value) { + // console.log(value.description) + // }, + // deep: true + // } } } From da63ed5ed2985b37758d4914438ff6a333b8580e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Glasn=C3=A1k?= Date: Mon, 24 Jul 2023 14:20:36 +0200 Subject: [PATCH 3/5] [Axios] Error logger --- app/src/plugins/w/i18n/models/i18n.ts | 37 ++++++++++++++++++--------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/app/src/plugins/w/i18n/models/i18n.ts b/app/src/plugins/w/i18n/models/i18n.ts index 070f734..f18da88 100644 --- a/app/src/plugins/w/i18n/models/i18n.ts +++ b/app/src/plugins/w/i18n/models/i18n.ts @@ -1,8 +1,8 @@ -import { Language, Options } from "../types" -import { Ref, ref } from 'vue' -import axios from 'axios' +import { Language, Options } from "../types" +import { Ref, ref } from 'vue' +import axios from 'axios' import { createI18n, I18n as I18nType } from 'vue-i18n' -import { Preferences } from '@capacitor/preferences' +import { Preferences } from '@capacitor/preferences' export class I18n { @@ -15,10 +15,10 @@ export class I18n { constructor(properties: Options) { this.availableLanguages = properties.languages || [] - this.defaultLanguage = properties.languages.find(language => language.value == properties.defaultLanguage) - this.languageKey = properties.languageKey || process.env.VUE_APP_PLATFORM + '_language' || 'w18n_language' - - this.vendorI18n = createI18n({ + this.defaultLanguage = properties.languages.find(language => language.value == properties.defaultLanguage) + this.languageKey = properties.languageKey || process.env.VUE_APP_PLATFORM + '_language' || 'w18n_language' + + this.vendorI18n = createI18n({ legacy: true, fallbackLocale: this.defaultLanguage.value, messages: this._loadLocaleMessages(), @@ -26,7 +26,7 @@ export class I18n { postTranslation: this._postTranslation, }) - this.changeLanguage({title: "Slovenský", flag: "sk", value: "sk"}) + this.changeLanguage({ title: "Slovenský", flag: "sk", value: "sk" }) this.initCurrentLanguage() } @@ -73,9 +73,22 @@ export class I18n { if (this.currentLanguage.value && this.currentLanguage.value.value) { config.headers['Accept-Language'] = this.currentLanguage.value.value } - + return config }) + + // axios.interceptors.response.use( + // (response) => { + // return response + // }, + // (error) => { + // axios.post('https://logger.wezeo.dev/api/v1/log', { + // data: JSON.stringify(error) + // }) + + // return Promise.reject(error) + // } + // ); } public _loadLocaleMessages(path = '@/locales') { @@ -90,8 +103,8 @@ export class I18n { console.warn('[@wezeo/i18n] Could not initialize i18n. Missing folder /src/locales.') return {} } - - const messages: {[key: string]: {[key: string]: string}} = {} + + const messages: { [key: string]: { [key: string]: string } } = {} locales.keys().forEach((key) => { const matched = key.match(/([A-Za-z0-9-_]+)\./i) From 15711cb7908b74c89af11eb928854e50767ef233 Mon Sep 17 00:00:00 2001 From: romankko2 Date: Mon, 24 Jul 2023 15:03:24 +0200 Subject: [PATCH 4/5] [project-filter] fixed search --- .../projects/_components/a-project-filter.vue | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/plugins/tm@dashboard/projects/_components/a-project-filter.vue b/app/src/plugins/tm@dashboard/projects/_components/a-project-filter.vue index 4a37aa8..a113aeb 100644 --- a/app/src/plugins/tm@dashboard/projects/_components/a-project-filter.vue +++ b/app/src/plugins/tm@dashboard/projects/_components/a-project-filter.vue @@ -70,7 +70,16 @@ export default { projectsOptions() { // Added to "paginate" projects, because v-autocomplete was unable to handle so many projects at once - const projects = this.projects.filter(project => project.code.includes(this.projectCodeSearch)) + const pattern = /[^a-zA-Z0-9 ]/g + + const normalizedInput = this.projectCodeSearch + ? this.projectCodeSearch.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(pattern, '') + : '' + + const projects = this.projects.filter(project => { + const normalizedProjectCode = project.code.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(pattern, '') + return normalizedProjectCode.toLowerCase().includes(normalizedInput.toLowerCase()) + }) return projects?.length ? projects.slice(0, 10) : this.projects.slice(0, 10) } }, From fe5796c4523b8ec44a213c53665cc51da9c8b3cf Mon Sep 17 00:00:00 2001 From: romankko2 Date: Wed, 26 Jul 2023 13:27:27 +0200 Subject: [PATCH 5/5] [i18n] axios error endpoint --- app/src/plugins/w/i18n/models/i18n.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/src/plugins/w/i18n/models/i18n.ts b/app/src/plugins/w/i18n/models/i18n.ts index f18da88..37ec40c 100644 --- a/app/src/plugins/w/i18n/models/i18n.ts +++ b/app/src/plugins/w/i18n/models/i18n.ts @@ -77,18 +77,18 @@ export class I18n { return config }) - // axios.interceptors.response.use( - // (response) => { - // return response - // }, - // (error) => { - // axios.post('https://logger.wezeo.dev/api/v1/log', { - // data: JSON.stringify(error) - // }) + axios.interceptors.response.use( + (response) => { + return response + }, + (error) => { + axios.post('https://logger.wezeo.dev/cms/api/data/new', { + data: JSON.stringify(error) + }) - // return Promise.reject(error) - // } - // ); + return Promise.reject(error) + } + ) } public _loadLocaleMessages(path = '@/locales') {