feat(ui): ürün sayfası, fiyat geçmişi grafiği ve birim fiyat karşılaştırması
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import { TypePriceComparison } from "@/features/prices/components/type-price-comparison";
|
||||
import { getTypePriceComparison } from "@/features/prices/service";
|
||||
import { ProductsSection } from "@/features/products/components/products-section";
|
||||
import { listProducts, listProductTypeOptions } from "@/features/products/service";
|
||||
import { ProductDetailView } from "@/features/stock/components/product-detail-view";
|
||||
@@ -13,24 +15,28 @@ export const metadata: Metadata = { title: tr.stock.detail.movements };
|
||||
export default async function ProductTypePage({ params }: PageProps<"/stok/[id]">) {
|
||||
const { user, household } = await requireActiveHousehold("viewer");
|
||||
const { id } = await params;
|
||||
const [data, options, products, types] = await Promise.all([
|
||||
const [data, options, products, types, prices] = await Promise.all([
|
||||
getProductType(user.id, household.id, id),
|
||||
getStockOptions(user.id, household.id),
|
||||
listProducts(user.id, household.id, { productTypeId: id, includeArchived: true }),
|
||||
listProductTypeOptions(user.id, household.id),
|
||||
getTypePriceComparison(user.id, household.id, id),
|
||||
]);
|
||||
if (!data || !options || !products || !types) notFound();
|
||||
if (!data || !options || !products || !types || !prices) notFound();
|
||||
return (
|
||||
<ProductDetailView
|
||||
data={data}
|
||||
categories={options.categories}
|
||||
products={
|
||||
<ProductsSection
|
||||
productTypeId={data.id}
|
||||
products={products.products}
|
||||
types={types}
|
||||
canWrite={products.canWrite}
|
||||
/>
|
||||
<>
|
||||
<TypePriceComparison data={prices} />
|
||||
<ProductsSection
|
||||
productTypeId={data.id}
|
||||
products={products.products}
|
||||
types={types}
|
||||
canWrite={products.canWrite}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { Metadata } from "next";
|
||||
import { notFound } from "next/navigation";
|
||||
import { ProductPriceView } from "@/features/prices/components/product-price-view";
|
||||
import { getProductPrices } from "@/features/prices/service";
|
||||
import { tr } from "@/i18n/tr";
|
||||
import { requireActiveHousehold } from "@/lib/dal";
|
||||
|
||||
export const metadata: Metadata = { title: tr.products.title };
|
||||
|
||||
/** /stok/urunler/:id — ürün (marka/paket): mağaza fiyatları, birim fiyat, fiyat geçmişi. */
|
||||
export default async function ProductPage({ params }: PageProps<"/stok/urunler/[id]">) {
|
||||
const { user, household } = await requireActiveHousehold("viewer");
|
||||
const { id } = await params;
|
||||
const data = await getProductPrices(user.id, household.id, id);
|
||||
if (!data) notFound();
|
||||
return <ProductPriceView data={data} />;
|
||||
}
|
||||
Reference in New Issue
Block a user