diff --git a/src/components/CreateThermographForm.vue b/src/components/CreateThermographForm.vue index 0b7e4c5c6..54844ee8f 100644 --- a/src/components/CreateThermographForm.vue +++ b/src/components/CreateThermographForm.vue @@ -38,7 +38,7 @@ const onDataSaved = (dataSaved) => { @on-fetch="(data) => (warehousesOptions = data)" auto-load url="Warehouses" - :filter="{ fields: ['id', 'name'], order: 'name ASC', limit: 30 }" + :filter="{ fields: ['id', 'name'], order: 'name ASC' }" /> import axios from 'axios'; -import { onMounted, watch, ref, reactive } from 'vue'; +import { onMounted, watch, ref, reactive, computed } from 'vue'; import { useI18n } from 'vue-i18n'; import { QSeparator, useQuasar } from 'quasar'; import { useRoute } from 'vue-router'; @@ -9,6 +9,7 @@ import { toLowerCamel } from 'src/filters'; import routes from 'src/router/modules'; import LeftMenuItem from './LeftMenuItem.vue'; import LeftMenuItemGroup from './LeftMenuItemGroup.vue'; +import VnInput from './common/VnInput.vue'; const { t } = useI18n(); const route = useRoute(); @@ -22,7 +23,32 @@ const props = defineProps({ }, }); +const items = ref([]); const expansionItemElements = reactive({}); +const pinnedModules = computed(() => { + const map = new Map(); + items.value.forEach((item) => item.isPinned && map.set(item.name, item)); + return map; +}); +const search = ref(null); + +const filteredItems = computed(() => { + if (!search.value) return items.value; + return items.value.filter((item) => { + const locale = t(item.title).toLowerCase(); + return locale.includes(search.value.toLowerCase()); + }); +}); + +const filteredPinnedModules = computed(() => { + if (!search.value) return pinnedModules.value; + const map = new Map(); + for (const [key, pinnedModule] of pinnedModules.value) { + const locale = t(pinnedModule.title).toLowerCase(); + if (locale.includes(search.value.toLowerCase())) map.set(key, pinnedModule); + } + return map; +}); onMounted(async () => { await navigation.fetchPinned(); @@ -66,8 +92,6 @@ function addChildren(module, route, parent) { } } -const items = ref([]); - function getRoutes() { if (props.source === 'main') { const modules = Object.assign([], navigation.getModules().value); @@ -129,15 +153,44 @@ const handleItemExpansion = (itemName) => {