diff --git a/apps/web/src/pages/AdminHomePage.stories.js b/apps/web/src/pages/AdminHomePage.stories.js index 168a76c..7305ed0 100644 --- a/apps/web/src/pages/AdminHomePage.stories.js +++ b/apps/web/src/pages/AdminHomePage.stories.js @@ -13,3 +13,14 @@ export const ProviderMappingWorkflow = { }, }, }; + +export const BulkArchiveSelection = { + parameters: { + docs: { + description: { + story: + "The physical inventory section supports selecting active copies and archiving them in one authenticated operation.", + }, + }, + }, +}; diff --git a/apps/web/src/pages/AdminHomePage.vue b/apps/web/src/pages/AdminHomePage.vue index cfe209d..8e32f90 100644 --- a/apps/web/src/pages/AdminHomePage.vue +++ b/apps/web/src/pages/AdminHomePage.vue @@ -7,6 +7,7 @@ import AdminListingStatus from "@/components/molecules/AdminListingStatus.vue"; import { createAdminInventory, createAdminProduct, + archiveAdminInventory, listAdminCategories, listAdminConditions, listAdminInventory, @@ -47,6 +48,7 @@ import { const { principal } = useAuth(); const products = ref([]); const inventory = ref([]); +const selectedInventoryIds = ref([]); const listings = ref([]); const sales = ref([]); const acquisitions = ref([]); @@ -193,6 +195,24 @@ async function createInventory() { } } +async function archiveSelectedInventory() { + if (!selectedInventoryIds.value.length) return; + isSaving.value = true; + try { + const archivedItems = await archiveAdminInventory( + selectedInventoryIds.value, + csrfToken(), + ); + const archivedById = new Map(archivedItems.map((item) => [item.id, item])); + inventory.value = inventory.value.map((item) => archivedById.get(item.id) ?? item); + selectedInventoryIds.value = []; + } catch (requestError) { + error.value = requestError; + } finally { + isSaving.value = false; + } +} + async function createListing() { const item = inventory.value.find( (candidate) => candidate.id === listingInventoryId.value, @@ -927,6 +947,16 @@ onMounted(load); aria-labelledby="inventory-title" >
No physical copies yet.
@@ -936,7 +966,17 @@ onMounted(load); :key="item.id" :data-product-id="item.productId" > - {{ item.id }} · {{ item.status }} + + {{ item.id }} + · {{ item.status }}