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' }" /> [ { - label: t('entry.buys.id'), + label: t('globals.id'), name: 'id', field: 'id', align: 'left', }, { - label: t('entry.buys.name'), + label: t('globals.name'), name: 'name', field: 'name', align: 'left', }, { - label: t('entry.buys.size'), + label: t('globals.size'), name: 'size', field: 'size', align: 'left', }, { - label: t('entry.buys.producer'), + label: t('globals.producer'), name: 'producerName', field: 'producer', align: 'left', @@ -152,10 +152,10 @@ const selectItem = ({ id }) => {

{{ t('Filter item') }}

- + { v-model="itemFilterParams.producerFk" /> [ { - label: t('entry.basicData.id'), + label: t('globals.id'), name: 'id', field: 'id', align: 'left', }, { - label: t('entry.basicData.warehouseOut'), + label: t('globals.warehouseOut'), name: 'warehouseOutFk', field: 'warehouseOutFk', align: 'left', @@ -62,7 +62,7 @@ const tableColumns = computed(() => [ warehousesOptions.value.find((warehouse) => warehouse.id === val).name, }, { - label: t('entry.basicData.warehouseIn'), + label: t('globals.warehouseIn'), name: 'warehouseInFk', field: 'warehouseInFk', align: 'left', @@ -70,14 +70,14 @@ const tableColumns = computed(() => [ warehousesOptions.value.find((warehouse) => warehouse.id === val).name, }, { - label: t('entry.basicData.shipped'), + label: t('globals.shipped'), name: 'shipped', field: 'shipped', align: 'left', format: (val) => toDate(val), }, { - label: t('entry.basicData.landed'), + label: t('globals.landed'), name: 'landed', field: 'landed', align: 'left', @@ -146,7 +146,7 @@ const selectTravel = ({ id }) => {

{{ t('Filter travels') }}

{ v-model="travelFilterParams.agencyModeFk" /> { v-model="travelFilterParams.warehouseOutFk" /> { v-model="travelFilterParams.warehouseInFk" /> diff --git a/src/components/ItemsFilterPanel.vue b/src/components/ItemsFilterPanel.vue index e89d32da4..938dceb4d 100644 --- a/src/components/ItemsFilterPanel.vue +++ b/src/components/ItemsFilterPanel.vue @@ -248,7 +248,7 @@ const removeTag = (index, params, search) => { > 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,40 @@ 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; + const normalizedSearch = normalize(search.value); + return items.value.filter((item) => { + const locale = normalize(t(item.title)); + return locale.includes(normalizedSearch); + }); +}); + +const filteredPinnedModules = computed(() => { + if (!search.value) return pinnedModules.value; + const normalizedSearch = search.value + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, '') + .toLowerCase(); + const map = new Map(); + for (const [key, pinnedModule] of pinnedModules.value) { + const locale = t(pinnedModule.title) + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, '') + .toLowerCase(); + if (locale.includes(normalizedSearch)) map.set(key, pinnedModule); + } + return map; +}); onMounted(async () => { await navigation.fetchPinned(); @@ -66,8 +100,6 @@ function addChildren(module, route, parent) { } } -const items = ref([]); - function getRoutes() { if (props.source === 'main') { const modules = Object.assign([], navigation.getModules().value); @@ -123,21 +155,57 @@ async function togglePinned(item, event) { const handleItemExpansion = (itemName) => { expansionItemElements[itemName].scrollToLastElement(); }; + +function normalize(text) { + return text + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, '') + .toLowerCase(); +}