base con autenticacion, registro, modulo encuestas
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import { SurveyBuilder } from '@/feactures/surveys/components/admin/survey-builder';
|
||||
|
||||
export default function CreateSurveyPage() {
|
||||
return (
|
||||
<PageContainer>
|
||||
<div className="w-full">
|
||||
<h1 className="text-2xl font-bold mb-6">Crear Nueva Encuesta</h1>
|
||||
<SurveyBuilder />
|
||||
</div>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import PageContainer from "@/components/layout/page-container";
|
||||
import { SurveyBuilder } from "@/feactures/surveys/components/admin/survey-builder";
|
||||
|
||||
export default function EditSurveyPage() {
|
||||
return (
|
||||
<PageContainer>
|
||||
<div className="w-full">
|
||||
<h1 className="text-2xl font-bold mb-6">Editar Encuesta</h1>
|
||||
<SurveyBuilder />
|
||||
</div>
|
||||
</PageContainer>
|
||||
)
|
||||
}
|
||||
37
apps/web/app/dashboard/administracion/encuestas/page.tsx
Normal file
37
apps/web/app/dashboard/administracion/encuestas/page.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import SurveysAdminList from '@/feactures/surveys/components/admin/surveys-admin-list';
|
||||
import { SurveysHeader } from '@/feactures/surveys/components/admin/surveys-header';
|
||||
import SurveysTableAction from '@/feactures/surveys/components/admin/surveys-tables/survey-table-action';
|
||||
import { searchParamsCache, serialize } from '@/feactures/surveys/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">
|
||||
<SurveysHeader />
|
||||
<SurveysTableAction />
|
||||
<SurveysAdminList
|
||||
initialPage={page}
|
||||
initialSearch={search}
|
||||
initialLimit={pageLimit}
|
||||
initialType={type}
|
||||
/>
|
||||
</div>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
37
apps/web/app/dashboard/administracion/usuario/page.tsx
Normal file
37
apps/web/app/dashboard/administracion/usuario/page.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import UsersAdminList from '@/feactures/users/components/admin/users-admin-list';
|
||||
import { UsersHeader } from '@/feactures/users/components/admin/users-header';
|
||||
import UsersTableAction from '@/feactures/users/components/admin/surveys-tables/users-table-action';
|
||||
import { searchParamsCache, serialize } from '@/feactures/users/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>
|
||||
);
|
||||
}
|
||||
19
apps/web/app/dashboard/configuraciones/caja-ahorro/page.tsx
Normal file
19
apps/web/app/dashboard/configuraciones/caja-ahorro/page.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
|
||||
const Page = () => {
|
||||
return (
|
||||
<PageContainer>
|
||||
<div className="flex flex-1 flex-col gap-4 p-4 pt-0">
|
||||
En mantenimiento
|
||||
</div>
|
||||
|
||||
</PageContainer>
|
||||
// <div className="flex min-h-svh flex-col items-center justify-center gap-6 bg-muted p-6 md:p-10">
|
||||
// <div className="flex w-full max-w-sm flex-col gap-6">
|
||||
|
||||
// </div>
|
||||
// </div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Page;
|
||||
24
apps/web/app/dashboard/encuestas/[id]/responder/page.tsx
Normal file
24
apps/web/app/dashboard/encuestas/[id]/responder/page.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import { getSurveyByIdAction } from '@/feactures/surveys/actions/surveys-actions';
|
||||
import { SurveyResponse } from '@/feactures/surveys/components/survey-response';
|
||||
|
||||
// La función ahora recibe 'params' con el parámetro dinámico 'id'
|
||||
export default async function SurveyResponsePage({ params }: { params: { id: string } }) {
|
||||
const { id } = await params; // Obtienes el id desde los params de la URL
|
||||
|
||||
if (!id || id === '') {
|
||||
// Maneja el caso en el que no se proporciona un id
|
||||
return null;
|
||||
}
|
||||
|
||||
// Llamas a la función pasando el id dinámico
|
||||
const data = await getSurveyByIdAction(Number(id));
|
||||
|
||||
return (
|
||||
<PageContainer>
|
||||
<div className="flex flex-1 flex-col space-y-4">
|
||||
<SurveyResponse survey={data?.data!} />
|
||||
</div>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
21
apps/web/app/dashboard/encuestas/page.tsx
Normal file
21
apps/web/app/dashboard/encuestas/page.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import { SurveyList } from '@/feactures/surveys/components/survey-list';
|
||||
import { Metadata } from 'next';
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Encuestas - Fondemi',
|
||||
description: 'Listado de encuestas disponibles',
|
||||
};
|
||||
|
||||
export default function SurveysPage() {
|
||||
|
||||
return (
|
||||
<PageContainer>
|
||||
<div className="w-full">
|
||||
<h1 className="text-2xl font-bold mb-6">Encuestas Disponibles</h1>
|
||||
<SurveyList />
|
||||
</div>
|
||||
</PageContainer>
|
||||
|
||||
);
|
||||
}
|
||||
19
apps/web/app/dashboard/estadisticas/encuestas/page.tsx
Normal file
19
apps/web/app/dashboard/estadisticas/encuestas/page.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import PageContainer from '@/components/layout/page-container';
|
||||
import { SurveyStatistics } from '@/feactures/statistics/components/survey-statistics';
|
||||
import { Metadata } from 'next';
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Estadísticas de Encuestas - Fondemi',
|
||||
description: 'Análisis y estadísticas de las encuestas realizadas',
|
||||
};
|
||||
|
||||
export default function SurveyStatisticsPage() {
|
||||
return (
|
||||
<PageContainer>
|
||||
<div className="w-full">
|
||||
<h1 className="text-2xl font-bold mb-6">Estadísticas de Encuestas</h1>
|
||||
<SurveyStatistics />
|
||||
</div>
|
||||
</PageContainer>
|
||||
);
|
||||
}
|
||||
11
apps/web/app/dashboard/inicio/page.tsx
Normal file
11
apps/web/app/dashboard/inicio/page.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
export default async function Page() {
|
||||
|
||||
return (
|
||||
// <PageContainer>
|
||||
<div className="flex justify-center items-center h-full">
|
||||
<img src="../logo.png" alt="Image" className="w-1/4"/>
|
||||
</div>
|
||||
// </PageContainer>
|
||||
);
|
||||
}
|
||||
31
apps/web/app/dashboard/layout.tsx
Normal file
31
apps/web/app/dashboard/layout.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import { AppSidebar } from '@/components/layout/app-sidebar';
|
||||
import Header from '@/components/layout/header';
|
||||
import { SidebarInset, SidebarProvider } from '@repo/shadcn/sidebar';
|
||||
import type { Metadata } from 'next';
|
||||
import { cookies } from 'next/headers';
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Dashboard',
|
||||
description: 'Sistema integral para Cajas de Ahorro',
|
||||
};
|
||||
|
||||
export default async function DashboardLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
// Persisting the sidebar state in the cookie.
|
||||
const cookieStore = await cookies();
|
||||
//const defaultOpen = cookieStore.get('sidebar:state')?.value === 'false';
|
||||
return (
|
||||
<SidebarProvider defaultOpen={true}>
|
||||
<AppSidebar />
|
||||
<SidebarInset>
|
||||
<Header />
|
||||
{/* page main content */}
|
||||
{children}
|
||||
{/* page main content ends */}
|
||||
</SidebarInset>
|
||||
</SidebarProvider>
|
||||
);
|
||||
}
|
||||
12
apps/web/app/dashboard/page.tsx
Normal file
12
apps/web/app/dashboard/page.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { auth } from '@/lib/auth';
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
export default async function Dashboard() {
|
||||
const session = await auth();
|
||||
|
||||
if (!session?.user) {
|
||||
return redirect('/');
|
||||
} else {
|
||||
redirect('/dashboard/inicio');
|
||||
}
|
||||
}
|
||||
17
apps/web/app/dashboard/profile/page.tsx
Normal file
17
apps/web/app/dashboard/profile/page.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import PageContainer from "@/components/layout/page-container";
|
||||
import {Profile} from '@/feactures/users/components/user-profile'
|
||||
|
||||
|
||||
export default function ProfilePage() {
|
||||
|
||||
return (
|
||||
<PageContainer>
|
||||
<div className="w-full">
|
||||
<h1 className="text-2xl font-bold">Perfil</h1>
|
||||
<p className="text-muted-foreground mb-6">Aquí puede ver y editar sus datos de perfil</p>
|
||||
<Profile />
|
||||
</div>
|
||||
</PageContainer>
|
||||
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user