Merge branch 'inventory'
This commit is contained in:
37
apps/web/app/dashboard/inventario/page.tsx
Normal file
37
apps/web/app/dashboard/inventario/page.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import UsersAdminList from '@/feactures/inventory/components/inventory/product-inventory-list';
|
||||
import { UsersHeader } from '@/feactures/inventory/components/inventory/users-header';
|
||||
import UsersTableAction from '@/feactures/inventory/components/inventory/product-tables/users-table-action';
|
||||
import { searchParamsCache, serialize } from '@/feactures/inventory/utils/searchparams';
|
||||
import { SearchParams } from 'nuqs';
|
||||
|
||||
type pageProps = {
|
||||
searchParams: Promise<SearchParams>;
|
||||
};
|
||||
|
||||
|
||||
export default async function SurveyAdminPage(props: pageProps) {
|
||||
const searchParams = await props.searchParams;
|
||||
searchParamsCache.parse(searchParams);
|
||||
const key = serialize({ ...searchParams });
|
||||
|
||||
const page = Number(searchParamsCache.get('page')) || 1;
|
||||
const search = searchParamsCache.get('q');
|
||||
const pageLimit = Number(searchParamsCache.get('limit')) || 10;
|
||||
const type = searchParamsCache.get('type');
|
||||
|
||||
return (
|
||||
<PageContainer scrollable={false}>
|
||||
<div className="flex flex-1 flex-col space-y-4">
|
||||
<UsersHeader />
|
||||
<UsersTableAction />
|
||||
<UsersAdminList
|
||||
initialPage={page}
|
||||
initialSearch={search}
|
||||
initialLimit={pageLimit}
|
||||
initialType={type}
|
||||
/>
|
||||
</div>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
28
apps/web/app/dashboard/productos/[id]/page.tsx
Normal file
28
apps/web/app/dashboard/productos/[id]/page.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { getProductById } from '@/feactures/inventory/actions/actions';
|
||||
import {ProductList} from '@/feactures/inventory/components/products/see-product'
|
||||
|
||||
export default async function SurveyResponsePage({
|
||||
params,
|
||||
}: {
|
||||
params: Promise<{ id: string }>
|
||||
}) {
|
||||
const { id } = await params; // You can still destructure id from params
|
||||
|
||||
if (!id || id === '') return null;
|
||||
|
||||
// Call the function passing the dynamic id
|
||||
const data = await getProductById(Number(id));
|
||||
|
||||
if (!data?.data) {
|
||||
return (
|
||||
<main className='flex h-full flex-col items-center justify-center'>
|
||||
<p className='text-2xl'>Lo siento...</p>
|
||||
<p className='text-4xl text-primary'>Producto no encontrado</p>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<ProductList product={data.data} />
|
||||
);
|
||||
}
|
||||
19
apps/web/app/dashboard/productos/page.tsx
Normal file
19
apps/web/app/dashboard/productos/page.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
'use client';
|
||||
import { ProductList } from '@/feactures/inventory/components/products/product-list-scroll';
|
||||
import { Button } from '@repo/shadcn/components/ui/button';
|
||||
// import { Metadata } from 'next';
|
||||
|
||||
export default function SurveysPage() {
|
||||
|
||||
return (
|
||||
<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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user