refactor(API): Ajusta os endpoints para consultar o usuário
This commit is contained in:
parent
477c1cd22a
commit
2256dd367f
21 changed files with 165 additions and 52 deletions
|
|
@ -8,7 +8,7 @@ import {
|
|||
CardContent
|
||||
} from "@/components/ui/card";
|
||||
import { useGUsuarioReadHooks } from "@/app/(protected)/(administrativo)/_hooks/g_usuario/useGUsuarioReadHooks";
|
||||
import Usuario from "@/app/(protected)/(administrativo)/_interfaces/IGUsuario";
|
||||
import Usuario from "@/app/(protected)/(administrativo)/_interfaces/GUsuarioInterface";
|
||||
import Loading from "@/app/_components/loading/loading";
|
||||
|
||||
export default function UsuarioDetalhes() {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { zodResolver } from "@hookform/resolvers/zod"
|
|||
import { useForm } from "react-hook-form"
|
||||
import { z } from "zod"
|
||||
import { Input } from "@/components/ui/input"
|
||||
import { UsuarioFormSchema } from "../../../_schemas/GUsuarioSchema"
|
||||
import { GUsuarioSchema } from "../../../_schemas/GUsuarioSchema"
|
||||
|
||||
import {
|
||||
Button
|
||||
|
|
@ -26,14 +26,14 @@ import {
|
|||
|
||||
import { useGUsuarioSaveHook } from "../../../_hooks/g_usuario/useGUsuarioSaveHook"
|
||||
|
||||
type FormValues = z.infer<typeof UsuarioFormSchema>
|
||||
type FormValues = z.infer<typeof GUsuarioSchema>
|
||||
|
||||
export default function UsuarioFormularioPage() {
|
||||
|
||||
const { usuario, saveUsuario } = useGUsuarioSaveHook();
|
||||
|
||||
const form = useForm<FormValues>({
|
||||
resolver: zodResolver(UsuarioFormSchema),
|
||||
resolver: zodResolver(GUsuarioSchema),
|
||||
defaultValues: {
|
||||
login: '',
|
||||
nome_completo: '',
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import {
|
|||
TableRow,
|
||||
} from "@/components/ui/table"
|
||||
|
||||
import Usuario from "../../_interfaces/IGUsuario";
|
||||
import Usuario from "../../_interfaces/GUsuarioInterface";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import Link from "next/link";
|
||||
import { useGUsuarioIndexHook } from "../../_hooks/g_usuario/useGUsuarioIndexHook";
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default async function GUsuarioDeleteData(usuarioId: number) {
|
|||
|
||||
const response = await api.send({
|
||||
'method': Methods.DELETE,
|
||||
'endpoint': `administrativo/usuarios/${usuarioId}`
|
||||
'endpoint': `administrativo/g_usuario/${usuarioId}`
|
||||
});
|
||||
|
||||
return response;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default async function GUsuarioIndexData() {
|
|||
|
||||
const response = await api.send({
|
||||
'method': Methods.GET,
|
||||
'endpoint': `administrativo/usuarios/`
|
||||
'endpoint': `administrativo/g_usuario/`
|
||||
});
|
||||
|
||||
return response;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export default async function GUsuarioLoginData(form: any) {
|
|||
// Realiza o envio dos dados
|
||||
const response = await api.send({
|
||||
method: Methods.POST,
|
||||
endpoint: `administrativo/usuarios/login`,
|
||||
endpoint: `administrativo/g_usuario/authenticate`,
|
||||
body: form
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default async function GUsuarioReadData(usuarioId: number) {
|
|||
|
||||
const response = await api.send({
|
||||
'method': Methods.GET,
|
||||
'endpoint': `administrativo/usuarios/${usuarioId}`
|
||||
'endpoint': `administrativo/g_usuario/${usuarioId}`
|
||||
});
|
||||
|
||||
return response
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default async function GUsuarioSaveData(form: any) {
|
|||
|
||||
const response = await api.send({
|
||||
'method': Methods.POST,
|
||||
'endpoint': `administrativo/usuarios/`,
|
||||
'endpoint': `administrativo/g_usuario/`,
|
||||
'body': form
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use client'
|
||||
|
||||
import { useState } from "react"
|
||||
import Usuario from "../../_interfaces/IGUsuario"
|
||||
import Usuario from "../../_interfaces/GUsuarioInterface"
|
||||
import GUsuarioIndex from "../../_services/g_usuario/GUsuarioIndex";
|
||||
import { useResponse } from "@/app/_response/ResponseContext";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use client'
|
||||
|
||||
import { useState } from "react"
|
||||
import Usuario from "../../_interfaces/IGUsuario"
|
||||
import Usuario from "../../_interfaces/GUsuarioInterface"
|
||||
import GUsuarioRead from "../../_services/g_usuario/GUsuarioRead";
|
||||
import { useResponse } from "@/app/_response/ResponseContext";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use client'
|
||||
|
||||
import { useState } from "react"
|
||||
import Usuario from "../../_interfaces/IGUsuario"
|
||||
import Usuario from "../../_interfaces/GUsuarioInterface"
|
||||
import GUsuarioSave from "../../_services/g_usuario/GUsuarioSave";
|
||||
import { useResponse } from "@/app/_response/ResponseContext";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export default interface Usuario {
|
||||
export default interface GUsuario {
|
||||
usuario_id: number,
|
||||
trocarsenha: string,
|
||||
login: string,
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { z } from "zod";
|
||||
|
||||
export const UsuarioFormSchema = z.object({
|
||||
export const GUsuarioSchema = z.object({
|
||||
trocarsenha: z.string().optional(),
|
||||
login: z.string().optional(),
|
||||
senha: z.string().optional(),
|
||||
|
|
|
|||
|
|
@ -8,4 +8,4 @@ export default async function GUsuarioIndex() {
|
|||
|
||||
return response;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,6 @@ import {
|
|||
|
||||
import GUsuarioLoginData from "../../_data/g_usuario/GUsuarioLoginData"
|
||||
import { redirect } from "next/navigation";
|
||||
import empty from "@/actions/validations/empty";
|
||||
|
||||
export default async function GUsuarioLoginService(form: any) {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import { useEffect, useState, useCallback } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { PlusIcon } from "lucide-react";
|
||||
|
||||
import Loading from "@/app/_components/loading/loading";
|
||||
import TTBAndamentoServicoTable from "../../_components/t_tb_andamentoservico/TTBAndamentoServicoTable";
|
||||
|
|
@ -17,6 +15,7 @@ import { useConfirmDialog } from "@/app/_components/confirm_dialog/useConfirmDia
|
|||
|
||||
import TTBAndamentoServicoInterface from "../../_interfaces/TTBAndamentoServicoInterface";
|
||||
import { useTTBAndamentoServicoDeleteHook } from "../../_hooks/t_tb_andamentoservico/useTTBAndamentoServicoDeleteHook";
|
||||
import Header from "@/app/_components/structure/Header";
|
||||
|
||||
export default function TTBAndamentoServico() {
|
||||
// Hooks para leitura e salvamento
|
||||
|
|
@ -125,20 +124,12 @@ export default function TTBAndamentoServico() {
|
|||
return (
|
||||
<div>
|
||||
{/* Cabeçalho */}
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<div>
|
||||
<h1 className="text-4xl font-semibold mb-1">
|
||||
Andamentos
|
||||
</h1>
|
||||
<p className="text-base text-muted-foreground">
|
||||
Gerenciamento de tipos de reconhecimentos
|
||||
</p>
|
||||
</div>
|
||||
<Button onClick={() => handleOpenForm(null)} className="cursor-pointer">
|
||||
<PlusIcon className="mr-2" />
|
||||
Novo Tipo
|
||||
</Button>
|
||||
</div>
|
||||
<Header
|
||||
title={"Andamentos"}
|
||||
description={"Gerenciamento de Andamentos de Atos"}
|
||||
buttonText={"Novo Andamento"}
|
||||
buttonAction={() => { handleOpenForm(null) }}
|
||||
/>
|
||||
|
||||
{/* Tabela de andamentos */}
|
||||
<Card>
|
||||
|
|
@ -171,5 +162,5 @@ export default function TTBAndamentoServico() {
|
|||
onSave={handleSave}
|
||||
/>
|
||||
</div>
|
||||
);4
|
||||
); 4
|
||||
}
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
'use client';
|
||||
|
||||
import { useEffect, useState, useCallback } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { PlusIcon } from "lucide-react";
|
||||
|
||||
import Loading from "@/app/_components/loading/loading";
|
||||
import Header from "@/app/_components/structure/Header";
|
||||
import TTBReconhecimentoTipoTable from "../../_components/t_tb_reconhecimentotipo/TTBReconhecimentoTipoTable";
|
||||
import TTBReconhecimentoTipoForm from "../../_components/t_tb_reconhecimentotipo/TTBReconhecimentoTipoForm";
|
||||
|
||||
|
|
@ -126,20 +125,12 @@ export default function TTBAndamentoServico() {
|
|||
return (
|
||||
<div>
|
||||
{/* Cabeçalho */}
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<div>
|
||||
<h1 className="text-4xl font-semibold mb-1">
|
||||
Reconhecimentos
|
||||
</h1>
|
||||
<p className="text-base text-muted-foreground">
|
||||
Gerenciamento de tipos de reconhecimentos
|
||||
</p>
|
||||
</div>
|
||||
<Button onClick={() => handleOpenForm(null)} className="cursor-pointer">
|
||||
<PlusIcon className="mr-2" />
|
||||
Novo Tipo
|
||||
</Button>
|
||||
</div>
|
||||
<Header
|
||||
title={"Reconhecimentos"}
|
||||
description={"Gerenciamento de tipos de reconhecimentos"}
|
||||
buttonText={"Novo Tipo"}
|
||||
buttonAction={() => { handleOpenForm(null) }}
|
||||
/>
|
||||
|
||||
{/* Tabela de andamentos */}
|
||||
<Card>
|
||||
|
|
|
|||
88
src/app/(protected)/(servicos)/servicos/page.tsx
Normal file
88
src/app/(protected)/(servicos)/servicos/page.tsx
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
'use client'
|
||||
|
||||
import { Card, CardAction, CardContent, CardDescription, CardTitle } from "@/components/ui/card"
|
||||
import { BabyIcon, CrossIcon, FileCheckIcon, FileTextIcon, GavelIcon, GlobeIcon, HeartIcon, PenIcon, ScrollIcon, UsersIcon } from "lucide-react";
|
||||
|
||||
const services = [
|
||||
{
|
||||
title: 'Registro de Nascimento',
|
||||
description: 'Emissão e registro de certidões de nascimento, garantindo a cidadania e identidade legal do recém-nascido.',
|
||||
icon: BabyIcon
|
||||
},
|
||||
{
|
||||
title: 'Registro de Casamento',
|
||||
description: 'Processo completo para habilitação, registro e emissão da certidão de casamento.',
|
||||
icon: HeartIcon
|
||||
},
|
||||
{
|
||||
title: 'Registro de Óbito',
|
||||
description: 'Lavratura do registro de óbito e emissão da certidão correspondente para fins legais.',
|
||||
icon: CrossIcon
|
||||
},
|
||||
{
|
||||
title: 'Reconhecimento de Firma',
|
||||
description: 'Autenticação da assinatura de documentos, garantindo sua validade jurídica.',
|
||||
icon: PenIcon
|
||||
},
|
||||
{
|
||||
title: 'Autenticação de Documentos',
|
||||
description: 'Confirmação de que cópias estão de acordo com o documento original apresentado.',
|
||||
icon: FileCheckIcon
|
||||
},
|
||||
{
|
||||
title: 'Procurações',
|
||||
description: 'Elaboração e registro de procurações públicas para representação legal de pessoas físicas ou jurídicas.',
|
||||
icon: ScrollIcon
|
||||
},
|
||||
{
|
||||
title: 'Testamentos',
|
||||
description: 'Lavratura e registro de testamentos públicos com segurança jurídica.',
|
||||
icon: GavelIcon
|
||||
},
|
||||
{
|
||||
title: 'Divórcio Extrajudicial',
|
||||
description: 'Formalização do divórcio por via administrativa, de forma rápida e sem processo judicial.',
|
||||
icon: UsersIcon
|
||||
},
|
||||
{
|
||||
title: 'Apostilamento de Documentos',
|
||||
description: 'Apostilamento conforme a Convenção da Haia para validade internacional de documentos.',
|
||||
icon: GlobeIcon
|
||||
},
|
||||
{
|
||||
title: 'Certidões e Segunda Via',
|
||||
description: 'Emissão de segundas vias e certidões de nascimento, casamento e óbito.',
|
||||
icon: FileTextIcon
|
||||
}
|
||||
];
|
||||
|
||||
export default function ServicosPage() {
|
||||
return (
|
||||
<div>
|
||||
<div className="w-full bg-primary/10 border border-primary/20 rounded-xl p-6">
|
||||
<h2 className="text-2xl font-semibold text-primary">Bem-vindo(a)!</h2>
|
||||
<p className="text-base text-gray-700 mt-2">
|
||||
Olá, <span className="font-bold text-primary">Keven</span>! É um prazer ter você conosco.
|
||||
</p>
|
||||
</div>
|
||||
<div className="grid grid-cols-4 space-x-2 space-y-2 mt-3">
|
||||
{services.map((item: any, index) => (
|
||||
<Card className="cursor-pointer" key={index}>
|
||||
<CardContent>
|
||||
<div className="flex items-center justify-center w-12 h-12 bg-primary rounded-2xl">
|
||||
<item.icon className="h-6 w-6 text-white" />
|
||||
</div>
|
||||
|
||||
<CardTitle className="mt-3">
|
||||
{item.title}
|
||||
</CardTitle>
|
||||
<CardDescription className="mt-3">
|
||||
{item.description}
|
||||
</CardDescription>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -64,11 +64,9 @@ export default function ConfirmDialog({
|
|||
<AlertDialogDescription>{description}</AlertDialogDescription>
|
||||
)}
|
||||
</AlertDialogHeader>
|
||||
|
||||
<div className="py-4 text-sm text-muted-foreground">
|
||||
{message}
|
||||
</div>
|
||||
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel onClick={onCancel} className="cursor-pointer">
|
||||
{cancelText}
|
||||
|
|
|
|||
33
src/app/_components/structure/Header.tsx
Normal file
33
src/app/_components/structure/Header.tsx
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { Button } from "@/components/ui/button";
|
||||
import { PlusIcon } from "lucide-react";
|
||||
|
||||
interface HeaderProps {
|
||||
|
||||
title: string,
|
||||
description: string,
|
||||
buttonText: string,
|
||||
buttonAction: (...args: any[]) => void;
|
||||
};
|
||||
|
||||
export default function Header({ title, description, buttonText, buttonAction }: HeaderProps) {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<div>
|
||||
<h1 className="text-4xl font-semibold mb-1">
|
||||
{title}
|
||||
</h1>
|
||||
<p className="text-base text-muted-foreground">
|
||||
{description}
|
||||
</p>
|
||||
</div>
|
||||
<Button onClick={() => buttonAction()} className="cursor-pointer">
|
||||
<PlusIcon className="mr-2" />
|
||||
{buttonText}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ import {
|
|||
Command,
|
||||
Frame,
|
||||
GalleryVerticalEnd,
|
||||
House,
|
||||
Map,
|
||||
PieChart,
|
||||
Settings2,
|
||||
|
|
@ -51,6 +52,18 @@ const data = {
|
|||
},
|
||||
],
|
||||
navMain: [
|
||||
{
|
||||
title: "Início",
|
||||
url: "#",
|
||||
icon: House,
|
||||
isActive: false,
|
||||
items: [
|
||||
{
|
||||
title: "Serviços",
|
||||
url: "/servicos/",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Administrativo",
|
||||
url: "#",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue