Items view #129

Merged
jsegarra merged 3 commits from wbuezas/hedera-web-mindshore:feature/items-view into beta 2025-03-24 13:56:15 +00:00
3 changed files with 6986 additions and 5591 deletions

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@ const props = defineProps({
default: null default: null
}, },
filter: { filter: {
type: String, type: Object,
default: null default: null
}, },
searchField: { searchField: {
@ -64,7 +64,6 @@ const search = async () => {
params, params,
exprBuilder: props.exprBuilder exprBuilder: props.exprBuilder
}); });
emit('onSearch', data); emit('onSearch', data);
} }
} catch (error) { } catch (error) {
@ -83,7 +82,7 @@ onMounted(() => {
<template> <template>
<VnInput <VnInput
v-model="searchTerm" v-model="searchTerm"
@keyup.enter="search()" @keyup.enter.stop="search()"
:placeholder="props.placeholder || t('search')" :placeholder="props.placeholder || t('search')"
bg-color="white" bg-color="white"
is-outlined is-outlined

View File

@ -3,28 +3,46 @@ import { ref } from 'vue';
import CardList from 'src/components/ui/CardList.vue'; import CardList from 'src/components/ui/CardList.vue';
import VnImg from 'src/components/ui/VnImg.vue'; import VnImg from 'src/components/ui/VnImg.vue';
import VnSearchBar from 'src/components/ui/VnSearchBar.vue';
import VnList from 'src/components/ui/VnList.vue'; import VnList from 'src/components/ui/VnList.vue';
import VnSearchBar from 'src/components/ui/NewVnSearchBar.vue';
import { useAppStore } from 'stores/app'; import { useAppStore } from 'stores/app';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
const appStore = useAppStore(); const appStore = useAppStore();
const { isHeaderMounted } = storeToRefs(appStore); const { isHeaderMounted } = storeToRefs(appStore);
const loading = ref(false); const loading = ref(false);
const items = ref([]); const items = ref([]);
const itemFilterProps = {
const query = `SELECT i.id, i.longName, i.size, i.category, include: [
i.value5, i.value6, i.value7, {
i.image, im.updated relation: 'itemType',
FROM vn.item i scope: {
LEFT JOIN image im fields: ['id', 'name']
ON im.collectionFk = 'catalog' }
AND im.name = i.image },
WHERE (i.longName LIKE CONCAT('%', #search, '%') {
OR i.id = #search) AND i.isActive relation: 'intrastat',
ORDER BY i.longName LIMIT 50`; scope: {
fields: ['id', 'description']
}
},
{
relation: 'origin',
scope: {
fields: ['id', 'name']
}
},
{
relation: 'production',
scope: {
fields: ['id', 'name']
}
}
],
isActive: true,
order: 'name ASC'
};
const onSearch = data => (items.value = data || []); const onSearch = data => (items.value = data || []);
</script> </script>
@ -32,9 +50,10 @@ const onSearch = data => (items.value = data || []);
<template> <template>
<Teleport v-if="isHeaderMounted" to="#actions"> <Teleport v-if="isHeaderMounted" to="#actions">
<VnSearchBar <VnSearchBar
:sql-query="query" url="Items/filter"
@on-search="onSearch" @on-search="onSearch"
@on-search-error="items = []" @on-search-error="items = []"
:filter="itemFilterProps"
/> />
</Teleport> </Teleport>
<QPage class="vn-w-xs"> <QPage class="vn-w-xs">
@ -68,7 +87,7 @@ const onSearch = data => (items.value = data || []);
</template> </template>
<template #content> <template #content>
<span class="text-bold q-mb-sm"> <span class="text-bold q-mb-sm">
{{ item.longName }} {{ item.name }}
</span> </span>
<span> <span>
{{ item.value5 }} {{ item.value6 }} {{ item.value5 }} {{ item.value6 }}