Compare commits

..

13 Commits

Author SHA1 Message Date
3209adcf40 Merge pull request 'feat: add Consume and Restock quick actions (#64 #65)' (#72) from feature/issue-64-65-quick-actions into develop
Some checks failed
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
Deploy to Coolify / Code Quality (push) Has been cancelled
Deploy to Coolify / Run Tests (push) Has been cancelled
2026-02-25 01:26:27 +00:00
Pantry Lead Agent
0a020a6681 feat: add Consume and Restock quick action buttons (#64 #65)
Some checks failed
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
Pull Request Checks / Validate PR (pull_request) Has been cancelled
2026-02-25 01:26:12 +00:00
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
Pantry Lead Agent
8a9f8f7fdd feat: add low-stock visual indicator to InventoryCard (#67)
Some checks failed
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
Pull Request Checks / Validate PR (pull_request) Has been cancelled
2026-02-25 01:24:07 +00:00
Pantry Lead Agent
bd000649e3 feat: add low-stock threshold field to EditItemModal (#67) 2026-02-25 01:23:40 +00:00
Pantry Lead Agent
1ed51c3667 feat: add low-stock threshold field to AddItemForm (#67) 2026-02-25 01:23:23 +00:00
Pantry Lead Agent
76a229952f feat: add expires_at and low_stock_threshold to type definitions (#63 #67) 2026-02-25 01:23:00 +00:00
Pantry Lead Agent
c5870f9e6f fix: correct table name to inventory_items in migration 2026-02-25 01:22:51 +00:00
Pantry Lead Agent
0ba695f159 feat: add expiry date and low-stock threshold columns (#63 #67) 2026-02-25 01:22:14 +00:00
7f9a92994c Merge pull request 'feat: add Coolify deployment documentation (#39)' (#62) from feature/issue-39-coolify-deployment 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
 Self-review passed

Complete Coolify deployment documentation ready.
2026-02-25 00:17:35 +00:00
7 changed files with 261 additions and 33 deletions

View File

@@ -57,6 +57,21 @@
/> />
</UFormGroup> </UFormGroup>
<!-- Low Stock Threshold -->
<UFormGroup
label="Low Stock Alert"
hint="Optional - Alert when quantity falls below this"
>
<UInput
v-model.number="form.low_stock_threshold"
type="number"
min="0"
step="0.1"
placeholder="e.g. 2"
size="lg"
/>
</UFormGroup>
<!-- Notes --> <!-- Notes -->
<UFormGroup label="Notes" hint="Optional"> <UFormGroup label="Notes" hint="Optional">
<UTextarea <UTextarea
@@ -121,6 +136,7 @@ const form = reactive({
quantity: 1, quantity: 1,
unit_id: '', unit_id: '',
expiry_date: '', expiry_date: '',
low_stock_threshold: null as number | null,
notes: '' notes: ''
}) })
@@ -210,6 +226,7 @@ const handleSubmit = async () => {
quantity: form.quantity, quantity: form.quantity,
unit_id: form.unit_id, unit_id: form.unit_id,
expiry_date: form.expiry_date || null, expiry_date: form.expiry_date || null,
low_stock_threshold: form.low_stock_threshold,
notes: form.notes.trim() || null notes: form.notes.trim() || null
}) })

View File

@@ -55,6 +55,21 @@
/> />
</UFormGroup> </UFormGroup>
<!-- Low Stock Threshold -->
<UFormGroup
label="Low Stock Alert"
hint="Optional - Alert when quantity falls below this"
>
<UInput
v-model.number="form.low_stock_threshold"
type="number"
min="0"
step="0.1"
placeholder="e.g. 2"
size="lg"
/>
</UFormGroup>
<!-- Notes --> <!-- Notes -->
<UFormGroup label="Notes" hint="Optional"> <UFormGroup label="Notes" hint="Optional">
<UTextarea <UTextarea
@@ -112,6 +127,7 @@ const form = reactive({
quantity: 1, quantity: 1,
unit_id: '', unit_id: '',
expiry_date: '', expiry_date: '',
low_stock_threshold: null as number | null,
notes: '' notes: ''
}) })
@@ -136,6 +152,7 @@ watch(() => props.item, (newItem) => {
form.quantity = Number(newItem.quantity) form.quantity = Number(newItem.quantity)
form.unit_id = newItem.unit_id form.unit_id = newItem.unit_id
form.expiry_date = newItem.expiry_date || '' form.expiry_date = newItem.expiry_date || ''
form.low_stock_threshold = newItem.low_stock_threshold || null
form.notes = newItem.notes || '' form.notes = newItem.notes || ''
isOpen.value = true isOpen.value = true
} }
@@ -168,6 +185,7 @@ const handleSubmit = async () => {
quantity: form.quantity, quantity: form.quantity,
unit_id: form.unit_id, unit_id: form.unit_id,
expiry_date: form.expiry_date || null, expiry_date: form.expiry_date || null,
low_stock_threshold: form.low_stock_threshold,
notes: form.notes.trim() || null notes: form.notes.trim() || null
}) })

View File

@@ -72,32 +72,122 @@
{{ expiryText }} {{ expiryText }}
</UBadge> </UBadge>
</div> </div>
<!-- Low Stock Warning -->
<div v-if="isLowStock" class="text-xs">
<UBadge
color="orange"
variant="soft"
class="w-full justify-center"
>
<UIcon name="i-heroicons-exclamation-triangle" class="mr-1" />
Low stock ({{ item.quantity }}/{{ item.low_stock_threshold }})
</UBadge>
</div>
</div> </div>
<!-- Action Buttons --> <!-- Action Buttons -->
<template #footer> <template #footer>
<div class="flex gap-2"> <div class="flex flex-col gap-2">
<UButton <!-- Quick Actions Row -->
icon="i-heroicons-pencil" <div class="grid grid-cols-2 gap-2">
size="sm" <UButton
color="gray" icon="i-heroicons-arrow-trending-down"
variant="soft" size="sm"
class="flex-1" color="orange"
@click="$emit('edit', item)" variant="soft"
> @click="handleConsume"
Edit :disabled="item.quantity <= 0.01"
</UButton> >
<UButton Consume
icon="i-heroicons-trash" </UButton>
size="sm" <UButton
color="red" icon="i-heroicons-arrow-trending-up"
variant="soft" size="sm"
@click="$emit('delete', item.id)" color="green"
> variant="soft"
Delete @click="showRestockModal = true"
</UButton> >
Restock
</UButton>
</div>
<!-- Management Actions Row -->
<div class="grid grid-cols-2 gap-2">
<UButton
icon="i-heroicons-pencil"
size="sm"
color="gray"
variant="soft"
@click="$emit('edit', item)"
>
Edit
</UButton>
<UButton
icon="i-heroicons-trash"
size="sm"
color="red"
variant="soft"
@click="$emit('delete', item.id)"
>
Delete
</UButton>
</div>
</div> </div>
</template> </template>
<!-- Restock Modal -->
<UModal v-model="showRestockModal">
<UCard>
<template #header>
<h3 class="text-lg font-semibold">Restock {{ item.name }}</h3>
</template>
<div class="space-y-4">
<div class="text-sm text-gray-600">
Current: <span class="font-semibold">{{ item.quantity }} {{ item.unit?.abbreviation }}</span>
</div>
<UFormGroup label="Amount to add">
<UInput
v-model.number="restockAmount"
type="number"
min="0.01"
step="0.01"
size="lg"
autofocus
placeholder="e.g. 5"
/>
</UFormGroup>
<div v-if="restockAmount > 0" class="text-sm text-gray-600">
New total: <span class="font-semibold">{{ (Number(item.quantity) + Number(restockAmount)).toFixed(2) }} {{ item.unit?.abbreviation }}</span>
</div>
</div>
<template #footer>
<div class="flex gap-2">
<UButton
color="primary"
size="lg"
class="flex-1"
@click="handleRestock"
:disabled="!restockAmount || restockAmount <= 0"
>
Add {{ restockAmount || 0 }} {{ item.unit?.abbreviation }}
</UButton>
<UButton
color="gray"
size="lg"
variant="soft"
@click="showRestockModal = false"
>
Cancel
</UButton>
</div>
</template>
</UCard>
</UModal>
</UCard> </UCard>
</template> </template>
@@ -106,12 +196,17 @@ const props = defineProps<{
item: any item: any
}>() }>()
defineEmits<{ const emit = defineEmits<{
edit: [item: any] edit: [item: any]
delete: [id: string] delete: [id: string]
'update-quantity': [id: string, change: number] 'update-quantity': [id: string, change: number]
'consume': [id: string]
'restock': [id: string, amount: number]
}>() }>()
const showRestockModal = ref(false)
const restockAmount = ref<number>(1)
// Calculate days until expiry // Calculate days until expiry
const daysUntilExpiry = computed(() => { const daysUntilExpiry = computed(() => {
if (!props.item.expiry_date) return null if (!props.item.expiry_date) return null
@@ -145,4 +240,30 @@ const expiryText = computed(() => {
if (daysUntilExpiry.value === 1) return 'Expires tomorrow' if (daysUntilExpiry.value === 1) return 'Expires tomorrow'
return `Expires in ${daysUntilExpiry.value} days` return `Expires in ${daysUntilExpiry.value} days`
}) })
// Low stock detection
const isLowStock = computed(() => {
if (!props.item.low_stock_threshold) return false
return Number(props.item.quantity) <= Number(props.item.low_stock_threshold)
})
// Quick actions
const handleConsume = () => {
emit('update-quantity', props.item.id, -1)
}
const handleRestock = () => {
if (restockAmount.value && restockAmount.value > 0) {
emit('update-quantity', props.item.id, restockAmount.value)
showRestockModal.value = false
restockAmount.value = 1 // Reset for next time
}
}
// Reset restock amount when modal closes
watch(showRestockModal, (isOpen) => {
if (!isOpen) {
restockAmount.value = 1
}
})
</script> </script>

View File

@@ -60,6 +60,7 @@ const { getInventory, deleteInventoryItem, updateQuantity } = useInventory()
const props = defineProps<{ const props = defineProps<{
refresh?: boolean refresh?: boolean
tagFilters?: string[] tagFilters?: string[]
searchQuery?: string
}>() }>()
const emit = defineEmits<{ const emit = defineEmits<{
@@ -89,17 +90,27 @@ const loadInventory = async () => {
// Computed filtered items // Computed filtered items
const filteredItems = computed(() => { const filteredItems = computed(() => {
if (!props.tagFilters || props.tagFilters.length === 0) { let result = items.value
return 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 // Filter by tags
return items.value.filter(item => { if (props.tagFilters && props.tagFilters.length > 0) {
if (!item.tags || item.tags.length === 0) return false result = result.filter(item => {
if (!item.tags || item.tags.length === 0) return false
const itemTagIds = item.tags.map((t: any) => t.tag.id) const itemTagIds = item.tags.map((t: any) => t.tag.id)
return props.tagFilters!.some(filterId => itemTagIds.includes(filterId)) return props.tagFilters!.some(filterId => itemTagIds.includes(filterId))
}) })
}
return result
}) })
const handleDelete = async (id: string) => { const handleDelete = async (id: string) => {

View File

@@ -33,9 +33,36 @@
</div> </div>
</div> </div>
<!-- Tag Filters --> <!-- Search & Filters -->
<UCard v-if="showFilters" class="mb-6"> <UCard v-if="showFilters" class="mb-6 space-y-4">
<TagsTagFilter v-model="selectedTagFilters" /> <!-- 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 -->
<div>
<TagsTagFilter v-model="selectedTagFilters" />
</div>
</UCard> </UCard>
<!-- Add Item Form (Overlay) --> <!-- Add Item Form (Overlay) -->
@@ -61,6 +88,7 @@
ref="inventoryListRef" ref="inventoryListRef"
:refresh="refreshKey" :refresh="refreshKey"
:tag-filters="selectedTagFilters" :tag-filters="selectedTagFilters"
:search-query="searchQuery"
@add-item="showAddForm = true" @add-item="showAddForm = true"
@edit-item="editingItem = $event" @edit-item="editingItem = $event"
/> />
@@ -82,6 +110,7 @@ const refreshKey = ref(0)
const inventoryListRef = ref() const inventoryListRef = ref()
const prefilledData = ref<any>(null) const prefilledData = ref<any>(null)
const selectedTagFilters = ref<string[]>([]) const selectedTagFilters = ref<string[]>([])
const searchQuery = ref('')
// Handle scan-to-add flow (Issue #25) // Handle scan-to-add flow (Issue #25)
onMounted(() => { onMounted(() => {

View File

@@ -26,6 +26,8 @@ export interface Database {
quantity: number quantity: number
unit_id: string unit_id: string
expiry_date: string | null expiry_date: string | null
expires_at: string | null
low_stock_threshold: number | null
notes: string | null notes: string | null
added_by: string added_by: string
created_at: string created_at: string
@@ -38,6 +40,8 @@ export interface Database {
quantity: number quantity: number
unit_id: string unit_id: string
expiry_date?: string | null expiry_date?: string | null
expires_at?: string | null
low_stock_threshold?: number | null
notes?: string | null notes?: string | null
added_by: string added_by: string
created_at?: string created_at?: string
@@ -50,6 +54,8 @@ export interface Database {
quantity?: number quantity?: number
unit_id?: string unit_id?: string
expiry_date?: string | null expiry_date?: string | null
expires_at?: string | null
low_stock_threshold?: number | null
notes?: string | null notes?: string | null
added_by?: string added_by?: string
created_at?: string created_at?: string

View File

@@ -0,0 +1,26 @@
-- Migration: Add expiry date and low-stock threshold tracking
-- Issues: #63 (expiry tracking), #67 (low-stock threshold)
-- Created: 2026-02-25
-- Note: expiry_date already exists as DATE type. Adding expires_at as TIMESTAMPTZ for consistency
-- and low_stock_threshold for threshold tracking.
-- Add expires_at column for precise expiry date/time tracking (complementing existing expiry_date)
-- We'll keep both: expiry_date (DATE) for simple day-based expiry, expires_at (TIMESTAMPTZ) for precise tracking
ALTER TABLE inventory_items
ADD COLUMN expires_at TIMESTAMP WITH TIME ZONE DEFAULT NULL;
-- Add low_stock_threshold column for low-stock alerts
ALTER TABLE inventory_items
ADD COLUMN low_stock_threshold NUMERIC(10,2) DEFAULT NULL;
-- Add comments for documentation
COMMENT ON COLUMN inventory_items.expires_at IS 'Optional precise expiration timestamp. Complements expiry_date for items needing time-specific expiry.';
COMMENT ON COLUMN inventory_items.low_stock_threshold IS 'Minimum quantity threshold. Item is considered low-stock when quantity <= threshold. Null means no threshold set.';
-- Create index for efficient expiry queries (finding items expiring soon)
CREATE INDEX idx_inventory_items_expires_at ON inventory_items(expires_at) WHERE expires_at IS NOT NULL;
-- Create index for efficient low-stock queries
CREATE INDEX idx_inventory_items_low_stock ON inventory_items(quantity, low_stock_threshold)
WHERE low_stock_threshold IS NOT NULL;