Compare commits

...

4 Commits

Author SHA1 Message Date
ec6dd68e70 Merge pull request 'feat: add search and filter UI for inventory (#66)' (#71) from feature/issue-66-search-filter into develop
Some checks failed
Deploy to Coolify / Code Quality (push) Has been cancelled
Deploy to Coolify / Run Tests (push) Has been cancelled
Deploy to Coolify / Deploy to Development (push) Has been cancelled
Deploy to Coolify / Deploy to Production (push) Has been cancelled
Deploy to Coolify / Deploy to Test (push) Has been cancelled
2026-02-25 01:25:29 +00:00
Pantry Lead Agent
76c4a875ff feat: implement search filtering in InventoryList (#66)
Some checks failed
Pull Request Checks / Validate PR (pull_request) Has been cancelled
Deploy to Coolify / Code Quality (pull_request) Has been cancelled
Deploy to Coolify / Run Tests (pull_request) Has been cancelled
Deploy to Coolify / Deploy to Development (pull_request) Has been cancelled
Deploy to Coolify / Deploy to Production (pull_request) Has been cancelled
Deploy to Coolify / Deploy to Test (pull_request) Has been cancelled
2026-02-25 01:25:16 +00:00
Pantry Lead Agent
2635483dbc feat: add search bar to inventory page (#66) 2026-02-25 01:25:05 +00:00
f6300c890b Merge pull request 'feat: add expiry tracking and low-stock threshold (#63 #67)' (#70) from feature/issue-63-67-expiry-lowstock-fields into develop
Some checks failed
Deploy to Coolify / Code Quality (push) Has been cancelled
Deploy to Coolify / Run Tests (push) Has been cancelled
Deploy to Coolify / Deploy to Development (push) Has been cancelled
Deploy to Coolify / Deploy to Production (push) Has been cancelled
Deploy to Coolify / Deploy to Test (push) Has been cancelled
2026-02-25 01:24:25 +00:00
2 changed files with 52 additions and 12 deletions

View File

@@ -60,6 +60,7 @@ const { getInventory, deleteInventoryItem, updateQuantity } = useInventory()
const props = defineProps<{
refresh?: boolean
tagFilters?: string[]
searchQuery?: string
}>()
const emit = defineEmits<{
@@ -89,17 +90,27 @@ const loadInventory = async () => {
// Computed filtered items
const filteredItems = computed(() => {
if (!props.tagFilters || props.tagFilters.length === 0) {
return items.value
let result = items.value
// Filter by search query (case-insensitive)
if (props.searchQuery && props.searchQuery.trim()) {
const query = props.searchQuery.trim().toLowerCase()
result = result.filter(item =>
item.name.toLowerCase().includes(query)
)
}
// Filter items that have at least one of the selected tags
return items.value.filter(item => {
// Filter by tags
if (props.tagFilters && props.tagFilters.length > 0) {
result = result.filter(item => {
if (!item.tags || item.tags.length === 0) return false
const itemTagIds = item.tags.map((t: any) => t.tag.id)
return props.tagFilters!.some(filterId => itemTagIds.includes(filterId))
})
}
return result
})
const handleDelete = async (id: string) => {

View File

@@ -33,9 +33,36 @@
</div>
</div>
<!-- Search & Filters -->
<UCard v-if="showFilters" class="mb-6 space-y-4">
<!-- Search Bar -->
<div>
<UFormGroup label="Search Items">
<UInput
v-model="searchQuery"
placeholder="Search by item name..."
icon="i-heroicons-magnifying-glass"
size="lg"
:ui="{ icon: { trailing: { pointer: '' } } }"
>
<template #trailing>
<UButton
v-if="searchQuery"
color="gray"
variant="link"
icon="i-heroicons-x-mark"
:padded="false"
@click="searchQuery = ''"
/>
</template>
</UInput>
</UFormGroup>
</div>
<!-- Tag Filters -->
<UCard v-if="showFilters" class="mb-6">
<div>
<TagsTagFilter v-model="selectedTagFilters" />
</div>
</UCard>
<!-- Add Item Form (Overlay) -->
@@ -61,6 +88,7 @@
ref="inventoryListRef"
:refresh="refreshKey"
:tag-filters="selectedTagFilters"
:search-query="searchQuery"
@add-item="showAddForm = true"
@edit-item="editingItem = $event"
/>
@@ -82,6 +110,7 @@ const refreshKey = ref(0)
const inventoryListRef = ref()
const prefilledData = ref<any>(null)
const selectedTagFilters = ref<string[]>([])
const searchQuery = ref('')
// Handle scan-to-add flow (Issue #25)
onMounted(() => {