Files
webapp/app/components/GoodsContent.vue
Ruslan Bakiev 2b6cccdead
All checks were successful
Build Docker Image / build (push) Successful in 5m8s
Fix all TypeScript errors and remove Storybook
- Remove all Storybook files and configuration
- Add type declarations for @vueuse/core, @formkit/core, vue3-apexcharts
- Fix TypeScript configuration (typeRoots, include paths)
- Fix Sentry config - move settings to plugin
- Fix nullable prop assignments with ?? operator
- Fix type narrowing issues with explicit type assertions
- Fix Card component linkable computed properties
- Update codegen with operationResultSuffix
- Fix GraphQL operation type definitions
2026-01-26 00:32:36 +07:00

65 lines
1.8 KiB
Vue

<template>
<Stack gap="6">
<PageHeader
:title="$t('goods.title')"
:description="$t('goods.description')"
/>
<div v-if="pending" class="flex items-center justify-center p-8">
<span class="loading loading-spinner loading-lg" />
</div>
<Alert v-else-if="error" variant="error">
<Stack gap="2">
<Heading :level="4" weight="semibold">{{ $t('goods.error.title') }}</Heading>
<Button @click="refresh()">{{ $t('goods.error.retry') }}</Button>
</Stack>
</Alert>
<EmptyState
v-else-if="!productsData?.length"
:title="$t('goods.empty.title')"
:description="$t('goods.empty.description')"
/>
<Grid v-else :cols="1" :md="2" :lg="3" :gap="4">
<ProductCard
v-for="(product, index) in productsData"
:key="product?.uuid ?? index"
:product="product!"
selectable
@select="selectProduct(product!)"
/>
</Grid>
</Stack>
</template>
<script setup lang="ts">
import { GetProductsDocument } from '~/composables/graphql/public/exchange-generated'
const searchStore = useSearchStore()
const { data, pending, error, refresh } = await useServerQuery('products', GetProductsDocument, {}, 'public', 'exchange')
const productsData = computed(() => data.value?.getProducts || [])
const selectProduct = (product: any) => {
searchStore.setProduct(product.name)
searchStore.setProductUuid(product.uuid)
const locationUuid = searchStore.searchForm.locationUuid
const quantity = searchStore.searchForm.quantity
const query: Record<string, string> = {}
if (quantity) query.quantity = String(quantity)
if (locationUuid) {
// Both product and hub selected -> show offers
navigateTo({
path: `/catalog`,
query: { product: product.uuid, hub: locationUuid, ...query }
})
return
}
history.back()
}
</script>