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) } }, 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) 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 + // } } } diff --git a/app/src/plugins/w/i18n/models/i18n.ts b/app/src/plugins/w/i18n/models/i18n.ts index 070f734..37ec40c 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/cms/api/data/new', { + 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)