diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..0a2de9b
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "tabnine.experimentalAutoImports": true,
+}
\ No newline at end of file
diff --git a/public/usuario.jpg b/public/usuario.jpg
new file mode 100644
index 0000000..4da9c77
Binary files /dev/null and b/public/usuario.jpg differ
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 71b3fbf..431f783 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -1,5 +1,7 @@
+import Navbar from '@/components/Navbar'
import './globals.css'
import { Inter } from 'next/font/google'
+import Sidebar from '@/components/Sidebar'
const inter = Inter({ subsets: ['latin'] })
@@ -15,7 +17,15 @@ export default function RootLayout({
}) {
return (
-
{children}
+
+
+
+
+ {children}
+
+
+
+
)
}
diff --git a/src/app/login/LoginForm.tsx b/src/app/login/LoginForm.tsx
index 94693c5..f77367c 100644
--- a/src/app/login/LoginForm.tsx
+++ b/src/app/login/LoginForm.tsx
@@ -15,7 +15,7 @@ export const LoginForm = () => {
console.log("ingreso en el submit")
const { bearerToken } = await useBasicAuth(getValues("user"), getValues("password"));
Cookies.set("token",bearerToken);
- router.push("/hola")
+ router.push("/pedidos/cliente")
}
return (
diff --git a/src/app/pedidos/cliente/form.tsx b/src/app/pedidos/cliente/form.tsx
new file mode 100644
index 0000000..6656882
--- /dev/null
+++ b/src/app/pedidos/cliente/form.tsx
@@ -0,0 +1,21 @@
+import { NextPage } from 'next';
+import { useRouter } from 'next/router'
+import { FC } from 'react'
+
+interface Props {
+}
+
+const Form:NextPage = () => {
+
+ const router = useRouter();
+ const entidadId = router.query.id ? router.query.id as string : "0";
+
+
+ return (
+ <>
+ formulario
+ >
+ )
+}
+
+export default Form
\ No newline at end of file
diff --git a/src/app/pedidos/cliente/page.tsx b/src/app/pedidos/cliente/page.tsx
new file mode 100644
index 0000000..4cc50dc
--- /dev/null
+++ b/src/app/pedidos/cliente/page.tsx
@@ -0,0 +1,26 @@
+import Head from '@/components/table/Head'
+import TBody from '@/components/table/TBody';
+import { FC } from 'react'
+
+interface Props {
+}
+
+const ListadoCliente:FC = () => {
+ return (
+ <>
+
+
+
Listado de cliente
+
+
+
+ >
+ )
+}
+
+export default ListadoCliente;
\ No newline at end of file
diff --git a/src/app/pedidos/layout.tsx b/src/app/pedidos/layout.tsx
new file mode 100644
index 0000000..4a4b2ad
--- /dev/null
+++ b/src/app/pedidos/layout.tsx
@@ -0,0 +1,31 @@
+import Navbar from '@/components/Navbar'
+import './../globals.css'
+import { Inter } from 'next/font/google'
+import Sidebar from '@/components/Sidebar'
+
+const inter = Inter({ subsets: ['latin'] })
+
+export const metadata = {
+ title: 'Create Next App',
+ description: 'Generated by create next app',
+}
+
+export default function RootLayout({
+ children,
+}: {
+ children: React.ReactNode
+}) {
+ return (
+
+
+
+
+
+ {children}
+
+
+
+
+
+ )
+}
diff --git a/src/app/pedidos/producto/page.tsx b/src/app/pedidos/producto/page.tsx
new file mode 100644
index 0000000..72af797
--- /dev/null
+++ b/src/app/pedidos/producto/page.tsx
@@ -0,0 +1,26 @@
+import Navbar from '@/components/Navbar'
+import Head from '@/components/table/Head'
+import TBody from '@/components/table/TBody'
+import { FC } from 'react'
+
+interface Props {
+}
+
+const ListadoProducto:FC = () => {
+ return (
+ <>
+
+
Listado de producto
+
+
+
+ >
+ )
+}
+
+export default ListadoProducto
\ No newline at end of file
diff --git a/src/components/Button.tsx b/src/components/Button.tsx
new file mode 100644
index 0000000..1f7e2e8
--- /dev/null
+++ b/src/components/Button.tsx
@@ -0,0 +1,23 @@
+
+'use client'
+
+import { FC } from 'react'
+
+interface Props {
+ label: string,
+ onClick: () => void
+
+}
+
+const Button:FC = ({label, onClick}) => {
+ return (
+ <>
+
+ >
+ )
+}
+
+export default Button
\ No newline at end of file
diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx
new file mode 100644
index 0000000..d355c15
--- /dev/null
+++ b/src/components/Navbar.tsx
@@ -0,0 +1,57 @@
+'use client'
+
+import { FC } from 'react'
+import Button from './Button'
+import Cookies from 'js-cookie'
+import { useRouter } from 'next/navigation';
+
+interface Props {
+}
+
+const name:FC = () => {
+
+ const router = useRouter();
+
+ const logout = () => {
+ console.log("Saliendo de sesion")
+ Cookies.remove("token")
+ router.push("/login")
+ }
+
+
+ return (
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ )
+}
+
+export default name
\ No newline at end of file
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
new file mode 100644
index 0000000..8684fcf
--- /dev/null
+++ b/src/components/Sidebar.tsx
@@ -0,0 +1,34 @@
+import Link from 'next/link'
+import { FC } from 'react'
+
+interface Props {
+}
+
+const Sidebar:FC = () => {
+ return (
+ <>
+
+ -
+
+
+ Producto
+
+
+ -
+
+
+ Cliente
+
+
+ -
+
+
+ Pedido
+
+
+
+ >
+ )
+}
+
+export default Sidebar
\ No newline at end of file
diff --git a/src/components/table/Head.tsx b/src/components/table/Head.tsx
new file mode 100644
index 0000000..1f5bd77
--- /dev/null
+++ b/src/components/table/Head.tsx
@@ -0,0 +1,19 @@
+import { FC } from 'react'
+
+interface Props {
+ columnas: string[]
+}
+
+const Head:FC = ({columnas}) => {
+ return (
+ <>
+
+
+ {columnas.map((columna) =>(| {columna} | ))}
+
+
+ >
+ )
+}
+
+export default Head
\ No newline at end of file
diff --git a/src/components/table/TBody.tsx b/src/components/table/TBody.tsx
new file mode 100644
index 0000000..8e3be76
--- /dev/null
+++ b/src/components/table/TBody.tsx
@@ -0,0 +1,55 @@
+'use client'
+
+import useFetchWithAuth from '@/hooks/useFetchWithAuth';
+import Link from 'next/link';
+import { FC, useEffect, useState } from 'react'
+
+interface Props {
+ columnas: string[],
+ endpoint: string
+}
+
+const TBody:FC = ({columnas, endpoint}) => {
+
+
+
+ const [ entidades, setEntidades ] = useState([])
+
+ const getInitData = async() => {
+ const {data } = await useFetchWithAuth(endpoint);
+ setEntidades(data);
+ }
+
+ useEffect(() => {
+ getInitData();
+ }, [])
+
+
+ return (
+ <>
+
+ {entidades && entidades.map((entidad) => (
+
+
+ |
+
+ Editar
+
+ |
+ {columnas.map((columna)=> (
+ {entidad[columna]} |
+ ))}
+
+ ))}
+
+
+
+
+ >
+ )
+}
+
+export default TBody
\ No newline at end of file
diff --git a/src/hooks/useFetchWithAuth.tsx b/src/hooks/useFetchWithAuth.tsx
new file mode 100644
index 0000000..6fd99eb
--- /dev/null
+++ b/src/hooks/useFetchWithAuth.tsx
@@ -0,0 +1,35 @@
+import Cookies from "js-cookie";
+
+const fecher = async (url:string, token: string) => {
+ return await fetch(url, {
+ method: 'GET',
+ headers:{
+ 'Authorization': token
+ }
+ })
+}
+
+const useBasicAuth = async (endpoint:string) => {
+ let data = null;
+ try {
+
+ const token = Cookies.get("token")|| "";
+
+ const baseUrl = process.env.API_URL + "/"+ endpoint + "/";
+
+ const response = await fecher(baseUrl, token);
+
+ if (response.ok){
+ data = await response.json();
+
+ }
+ } catch (error) {
+ console.log(error)
+ }
+
+ return{
+ data
+ }
+}
+
+export default useBasicAuth;
\ No newline at end of file