diff --git a/src/app/(protected)/(cadastros)/cadastros/(t_tb_reconhecimentotipo)/reconhecimentos/page.tsx b/src/app/(protected)/(cadastros)/cadastros/(t_tb_reconhecimentotipo)/reconhecimentos/page.tsx new file mode 100644 index 0000000..1147a6b --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/(t_tb_reconhecimentotipo)/reconhecimentos/page.tsx @@ -0,0 +1,91 @@ +'use client' + +import { Card, CardContent } from "@/components/ui/card"; +import { + Table, + TableBody, + TableCaption, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table" +import { useTTBReconhecimentoTipoReadHooks } from "../../_hooks/useTTBReconhecimentoTipoReadHooks"; +import { useEffect } from "react"; +import ITTTBReconhecimentoTipo from '../../_interfaces/ITTTBReconhecimentoTipo' +import Loading from "@/app/_components/loading/loading"; +import { Button } from "@/components/ui/button"; +import Link from "next/link"; + +export default function TTBReconhecimentoTipoPage() { + + const { reconhecimentosTipos, fetchReconhecimentosTipos } = useTTBReconhecimentoTipoReadHooks(); + + useEffect(() => { + fetchReconhecimentosTipos(); + }, []); + + if (!reconhecimentosTipos) return + + return ( + +
+ +
+
+
+ Tipos de Reconhecimentos +
+
+ Gerenciamento de tipos de reconhecimentos +
+
+
+ +
+
+ + + + + + + # + + + Descrição + + + Situação + + Amount + + + + {reconhecimentosTipos.map((reconhecimentosTipos: ITTTBReconhecimentoTipo) => ( + + + {reconhecimentosTipos.tb_reconhecimentotipo_id} + + + {reconhecimentosTipos.descricao} + + + {reconhecimentosTipos.tb_reconhecimentotipo_id} + + $250.00 + + ))} + +
+
+
+
+ + ); + +} \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndexData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndexData.ts new file mode 100644 index 0000000..869a90a --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndexData.ts @@ -0,0 +1,25 @@ +'use server' + +import API from "@/services/api/Api" +import { Methods } from "@/services/api/enums/ApiMethodEnum"; + +export default async function TTBReconhecimentoTipoIndexData() { + + // const api = new API(); + + // const response = await api.send({ + // 'method': Methods.GET, + // 'endpoint': `cadastros/reconhecimentos` + // }); + + // return response; + + return Promise.resolve({ + data: [ + { tb_reconhecimentotipo_id: 1, descricao: 'SEMELHANÇA', situacao: 'A' }, + { tb_reconhecimentotipo_id: 2, descricao: 'VERDADEIRO', situacao: 'A' }, + { tb_reconhecimentotipo_id: 3, descricao: 'ABONO', situacao: 'A' } + ] + }); + +} \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/useTTBReconhecimentoTipoReadHooks.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/useTTBReconhecimentoTipoReadHooks.ts new file mode 100644 index 0000000..e626769 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/useTTBReconhecimentoTipoReadHooks.ts @@ -0,0 +1,26 @@ +'use client' + +import ITTTBReconhecimentoTipo from '../_interfaces/ITTTBReconhecimentoTipo' +import { useResponse } from "@/app/_response/ResponseContext" +import { useState } from "react"; +import TTBReconhecimentoTipoIndexData from '../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndexData'; + +export const useTTBReconhecimentoTipoReadHooks = () => { + + const { setResponse } = useResponse(); + + const [reconhecimentosTipos, setReconhecimenntosTipos] = useState(); + + const fetchReconhecimentosTipos = async () => { + + const response = await TTBReconhecimentoTipoIndexData(); + + setReconhecimenntosTipos(response.data); + + setResponse(response); + + } + + return { reconhecimentosTipos, fetchReconhecimentosTipos } + +} \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_interfaces/ITTTBReconhecimentoTipo.ts b/src/app/(protected)/(cadastros)/cadastros/_interfaces/ITTTBReconhecimentoTipo.ts new file mode 100644 index 0000000..d0f4dda --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_interfaces/ITTTBReconhecimentoTipo.ts @@ -0,0 +1,5 @@ +export default interface ITTTBReconhecimentoTipo{ + tb_reconhecimentotipo_id: number, + descricao: string, + situacao: string, +} \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_schemas/TTTBReconhecimentoTipo.ts b/src/app/(protected)/(cadastros)/cadastros/_schemas/TTTBReconhecimentoTipo.ts new file mode 100644 index 0000000..18d493e --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_schemas/TTTBReconhecimentoTipo.ts @@ -0,0 +1,7 @@ +import { z } from 'zod'; + +export const TTBReconhecimentoTipoSchema = z.object({ + tb_reconhecimentotipo_id: z.number(), + descricao: z.string().min(1), + situacao: z.string().min(1), +}); \ No newline at end of file diff --git a/src/components/app-sidebar.tsx b/src/components/app-sidebar.tsx index 0e30057..0f56829 100644 --- a/src/components/app-sidebar.tsx +++ b/src/components/app-sidebar.tsx @@ -64,21 +64,13 @@ const data = { ], }, { - title: "Models", + title: "Cadastros", url: "#", icon: Bot, items: [ { - title: "Genesis", - url: "#", - }, - { - title: "Explorer", - url: "#", - }, - { - title: "Quantum", - url: "#", + title: "Reconhecimentos", + url: "/cadastros/reconhecimentos/", }, ], },