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)