--- export const prerender = false; import Layout from '../layouts/Layout.astro'; import { supabase } from '../lib/supabase'; // Check authentication const cookieHeader = Astro.request.headers.get('cookie'); const { data: { session } } = cookieHeader ? await supabase.auth.getSession() : { data: { session: null } }; if (!session) { return Astro.redirect('/'); } // Get user profile to check organization const { data: userProfile } = await supabase .from('users') .select('organization_id, role') .eq('id', session.user.id) .single(); if (!userProfile?.organization_id && userProfile?.role !== 'admin') { return Astro.redirect('/dashboard'); } // Load inventory pools for the organization const { data: inventoryPools } = await supabase .from('inventory_pools') .select(` *, ticket_type_pool_allocations ( allocated_quantity, ticket_types ( name, event_id, events ( title ) ) ) `) .eq('organization_id', userProfile?.organization_id || ''); ---

Inventory Pools

Manage ticket inventory across events

{inventoryPools?.length === 0 ? (

No inventory pools

Get started by creating your first inventory pool.

) : ( inventoryPools?.map(pool => (

{pool.name}

{pool.description && (

{pool.description}

)}
{pool.is_active ? 'Active' : 'Inactive'}
Total Capacity
{pool.total_capacity}
Allocated
{pool.allocated_capacity}
Available
{pool.total_capacity - (pool.allocated_capacity || 0)}
{pool.ticket_type_pool_allocations?.length > 0 && (

Allocations

{pool.ticket_type_pool_allocations.map(allocation => (
{allocation.ticket_types.events.title} - {allocation.ticket_types.name}
{allocation.allocated_quantity} tickets
))}
)}
)) )}