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
+57 -7

No files matched your search

@@ -70,7 +70,16 @@ export default {
projectsOptions() { projectsOptions() {
// Added to "paginate" projects, because v-autocomplete was unable to handle so many projects at once // 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) return projects?.length ? projects.slice(0, 10) : this.projects.slice(0, 10)
} }
}, },
@@ -11,7 +11,17 @@ export default {
projectsOptions() { projectsOptions() {
// Added to "paginate" projects, because v-autocomplete was unable to handle so many projects at once // 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) let filteredProjects = projects?.length ? projects.slice(0, 10) : this.projects.slice(0, 10)
if (!this.mastertask?.project_id) 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> <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 }"> <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> </div>
<Z-files-upload class="mt-15 files" :files="mastertask.files" @files-uploaded="filesUploaded" :is-saving="isSaving" /> <Z-files-upload class="mt-15 files" :files="mastertask.files" @files-uploaded="filesUploaded" :is-saving="isSaving" />
@@ -163,12 +163,19 @@ export default {
}, },
validations() { validations() {
const quillEditorRequired = (value) => {
if (!value || !value.length || !value.replace(/<[^>]*>/g, '').length)
return false
return true
}
return { return {
mastertask: { mastertask: {
employees: { required, minLength: minLength(1), $each: {duration: { required}} }, employees: { required, minLength: minLength(1), $each: {duration: { required}} },
project_id: { required }, project_id: { required },
name: { required }, name: { required },
description: { required }, description: { quillEditorRequired },
deadline: { required }, deadline: { required },
_deadline_time: { required } _deadline_time: { required }
} }
@@ -303,6 +310,10 @@ export default {
this.$events.emit('show-subtask-modal', { subtask: null, editMode: false, mastertask: this.mastertask }) this.$events.emit('show-subtask-modal', { subtask: null, editMode: false, mastertask: this.mastertask })
}, },
onQuillEditorInput() {
this.mastertask.description = this.$refs['description'].getHTML()
},
_mergeDeadlineTimeDate() { _mergeDeadlineTimeDate() {
const date = new Date(this.mastertask.deadline) const date = new Date(this.mastertask.deadline)
const timeParts = this.mastertask._deadline_time.split(':') 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')}` this.mastertask._deadline_time = `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`
}) })
} },
// mastertask: {
// handler(value) {
// console.log(value.description)
// },
// deep: true
// }
} }
} }
</script> </script>
+15 -2
View File
@@ -26,7 +26,7 @@ export class I18n {
postTranslation: this._postTranslation, postTranslation: this._postTranslation,
}) })
this.changeLanguage({title: "Slovenský", flag: "sk", value: "sk"}) this.changeLanguage({ title: "Slovenský", flag: "sk", value: "sk" })
this.initCurrentLanguage() this.initCurrentLanguage()
} }
@@ -76,6 +76,19 @@ export class I18n {
return config 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') { public _loadLocaleMessages(path = '@/locales') {
@@ -91,7 +104,7 @@ export class I18n {
return {} return {}
} }
const messages: {[key: string]: {[key: string]: string}} = {} const messages: { [key: string]: { [key: string]: string } } = {}
locales.keys().forEach((key) => { locales.keys().forEach((key) => {
const matched = key.match(/([A-Za-z0-9-_]+)\./i) const matched = key.match(/([A-Za-z0-9-_]+)\./i)