ver productos y detalles

This commit is contained in:
2025-07-09 14:56:58 -04:00
parent 365cbd0d7a
commit 3a0b29d3c1
14 changed files with 144 additions and 91 deletions

View File

@@ -1,7 +1,16 @@
import PageContainer from '@/components/layout/page-container';
import { getSurveyByIdAction } from '@/feactures/surveys/actions/surveys-actions';
import { SurveyResponse } from '@/feactures/surveys/components/survey-response';
// 'use client';
// import PageContainer from '@/components/layout/page-container';
import { getProductById } from '@/feactures/inventory/actions/actions';
// import { SurveyResponse } from '@/feactures/surveys/components/survey-response';
import {
Card,
CardContent,
CardFooter,
CardHeader,
CardTitle,
} from '@repo/shadcn/card';
import { Edit } from 'lucide-react';
export default async function SurveyResponsePage({
@@ -17,17 +26,47 @@ export default async function SurveyResponsePage({
}
// Call the function passing the dynamic id
const data = await getSurveyByIdAction(Number(id));
const data = await getProductById(Number(id));
if (!data?.data) {
return <div>Encuesta no encontrada</div>;
}
const product = data.data
// console.log(data.data);
return (
<PageContainer>
<div className="flex flex-1 flex-col space-y-4">
<SurveyResponse survey={data?.data} />
</div>
</PageContainer>
// <PageContainer>
<main className='p-4 md:px-6 flex flex-col md:flex-row gap-4 md:relative'>
<img
className="border-2 object-cover w-full h-full aspect-square rounded-2xl"
src={`http://localhost:3000/${product.urlImg}`}
alt=""
/>
<Card className="flex flex-col md:w-[500px] md:max-h-[90vh] md:overflow-auto md:sticky top-0 right-0">
<CardHeader>
<CardTitle className="font-bold text-2xl">
{product.title.charAt(0).toUpperCase() + product.title.slice(1)}
</CardTitle>
<p className='font-semibold'>$ {product.price}</p>
</CardHeader>
<CardContent className="flex-grow">
<p className='font-semibold text-lg border-t border-b'> Descripción</p>
<p className='p-1'>{product.description}</p>
</CardContent>
<CardFooter className="">
<div>
<p className='font-semibold text-lg border-t border-b mt-4'>Información del vendedor</p>
<p>{product.fullname}</p>
<p>Correo@gmail.com</p>
<p>0412-7848101</p>
</div>
{/* <p className="font-semibold text-lg">$ {product.price}</p> */}
</CardFooter>
</Card>
</main>
);
}

View File

@@ -1,5 +1,6 @@
import PageContainer from '@/components/layout/page-container';
import { SurveyList } from '@/feactures/inventory/components/products/product-list';
import { ProductList } from '@/feactures/inventory/components/products/product-list';
import { Button } from '@repo/shadcn/components/ui/button';
import { Metadata } from 'next';
export const metadata: Metadata = {
@@ -8,14 +9,18 @@ export const metadata: Metadata = {
};
export default function SurveysPage() {
return (
<PageContainer>
<div className="w-full">
<h1 className="text-2xl font-bold mb-6">Productos Disponibles</h1>
<SurveyList />
</div>
</PageContainer>
// <PageContainer>
<main className='p-4 md:px-6'>
<header className="w-full flex flex-col sm:flex-row sm:justify-between">
<h1 className="text-2xl font-bold mb-1">Productos Disponibles</h1>
<a className='mb-1' href="/dashboard/inventario">
<Button>Mi inventario</Button>
</a>
</header>
<ProductList />
</main>
// </PageContainer>
);
}