Some checks failed
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 / Code Quality (pull_request) Has been cancelled
Deploy to Coolify / Run Tests (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
Week 2 core inventory management: **Composables:** - useInventory: Full CRUD operations for inventory items - useUnits: Unit fetching and conversion helpers - useTags: Tag fetching and category filtering **Components:** - InventoryList (#18): Grid view with loading/empty/error states - InventoryCard: Item card with image, quantity controls, tags, expiry - AddItemForm (#19): Form with tag picker, unit selector, validation - EditItemModal (#20): Modal form for editing existing items - Delete functionality (#21): Confirm dialog + cascade tag cleanup **Features:** - Quantity quick-actions (+/- buttons on cards) - Auto-delete when quantity reaches zero - Expiry date tracking with color-coded warnings - Tag selection by category in add form - Responsive grid layout (1-4 columns) - Product image display from barcode cache - Form validation and loading states Closes #18, #19, #20, #21
75 lines
1.7 KiB
Vue
75 lines
1.7 KiB
Vue
<template>
|
|
<div>
|
|
<div class="flex items-center justify-between mb-6">
|
|
<h1 class="text-3xl font-bold text-gray-900">Inventory</h1>
|
|
|
|
<div class="flex gap-2">
|
|
<UButton
|
|
to="/scan"
|
|
color="primary"
|
|
size="lg"
|
|
icon="i-heroicons-qr-code"
|
|
>
|
|
Scan Item
|
|
</UButton>
|
|
|
|
<UButton
|
|
color="white"
|
|
size="lg"
|
|
icon="i-heroicons-plus"
|
|
@click="showAddForm = true"
|
|
>
|
|
Add Manually
|
|
</UButton>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Add Item Form (Overlay) -->
|
|
<div v-if="showAddForm" class="fixed inset-0 z-50 flex items-start justify-center pt-20 px-4 bg-black/50">
|
|
<div class="w-full max-w-lg">
|
|
<AddItemForm
|
|
@close="showAddForm = false"
|
|
@added="handleItemAdded"
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Edit Item Modal -->
|
|
<EditItemModal
|
|
:item="editingItem"
|
|
@close="editingItem = null"
|
|
@updated="handleItemUpdated"
|
|
/>
|
|
|
|
<!-- Inventory List -->
|
|
<InventoryList
|
|
ref="inventoryListRef"
|
|
:refresh="refreshKey"
|
|
@add-item="showAddForm = true"
|
|
@edit-item="editingItem = $event"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
definePageMeta({
|
|
layout: 'default'
|
|
})
|
|
|
|
const showAddForm = ref(false)
|
|
const editingItem = ref<any>(null)
|
|
const refreshKey = ref(0)
|
|
const inventoryListRef = ref()
|
|
|
|
const handleItemAdded = (item: any) => {
|
|
showAddForm.value = false
|
|
// Reload the inventory list
|
|
inventoryListRef.value?.reload()
|
|
}
|
|
|
|
const handleItemUpdated = (item: any) => {
|
|
editingItem.value = null
|
|
inventoryListRef.value?.reload()
|
|
}
|
|
</script>
|