Merge branch 'main' of bitbucket.org:studiotem/jandl-taskmanager-app

This commit is contained in:
StudioTem committed 2023-07-26 14:19:12 +02:00
commit 50132fd098
4 files changed
+67 -17

No files matched your search

@@ -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)
}
},
@@ -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)
@@ -42,7 +42,7 @@
<v-btn class="w-100 mb-5 button secondary" :class="{error: v$.mastertask.project_id.$errors.length}" @click="showAddEmployeeInput = true"> <v-icon class="mx-1" icon="mdi-plus" />Pridať zamestnanca </v-btn>
<div class="w-100 modal-input" :class="{ error: v$.mastertask.description.$errors.length }">
<QuillEditor ref="description" v-model="mastertask.description" placeholder="Popis" theme="snow" class="rich-text-editor" @input="mastertask.description = $event.srcElement.innerHTML" />
<QuillEditor ref="description" v-model="mastertask.description" placeholder="Popis" theme="snow" class="rich-text-editor" @keyup="onQuillEditorInput" />
</div>
<Z-files-upload class="mt-15 files" :files="mastertask.files" @files-uploaded="filesUploaded" :is-saving="isSaving" />
@@ -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
// }
}
}
</script>
+25 -12
View File
@@ -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)