Merge branch 'release(MVP/Sprint2)' into homologacao

This commit is contained in:
Keven Willian Pereira de Souza 2025-09-15 09:04:04 -03:00
commit af63a59c2f
52 changed files with 2396 additions and 108 deletions

187
package-lock.json generated
View file

@ -8,18 +8,24 @@
"name": "app",
"version": "0.1.0",
"dependencies": {
"@faker-js/faker": "^10.0.0",
"@hookform/resolvers": "^5.2.1",
"@radix-ui/react-alert-dialog": "^1.1.15",
"@radix-ui/react-avatar": "^1.1.10",
"@radix-ui/react-checkbox": "^1.3.3",
"@radix-ui/react-collapsible": "^1.1.12",
"@radix-ui/react-dialog": "^1.1.15",
"@radix-ui/react-dropdown-menu": "^2.1.16",
"@radix-ui/react-label": "^2.1.7",
"@radix-ui/react-popover": "^1.1.15",
"@radix-ui/react-select": "^2.2.6",
"@radix-ui/react-separator": "^1.1.7",
"@radix-ui/react-slot": "^1.2.3",
"@radix-ui/react-tooltip": "^1.2.8",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cookies-next": "^6.1.0",
"faker-js": "^1.0.0",
"jsonwebtoken": "^9.0.2",
"lucide-react": "^0.540.0",
"next": "^15.5.3",
@ -65,6 +71,22 @@
"tslib": "^2.4.0"
}
},
"node_modules/@faker-js/faker": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-10.0.0.tgz",
"integrity": "sha512-UollFEUkVXutsaP+Vndjxar40Gs5JL2HeLcl8xO1QAjJgOdhc3OmBFWyEylS+RddWaaBiAzH+5/17PLQJwDiLw==",
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/fakerjs"
}
],
"license": "MIT",
"engines": {
"node": "^20.19.0 || ^22.13.0 || ^23.5.0 || >=24.0.0",
"npm": ">=10"
}
},
"node_modules/@floating-ui/core": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.7.3.tgz",
@ -730,12 +752,46 @@
"node": ">= 10"
}
},
"node_modules/@radix-ui/number": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.1.1.tgz",
"integrity": "sha512-MkKCwxlXTgz6CFoJx3pCwn07GKp36+aZyu/u2Ln2VrA5DcdyCZkASEDBTd8x5whTQQL5CiYf4prXKLcgQdv29g==",
"license": "MIT"
},
"node_modules/@radix-ui/primitive": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.3.tgz",
"integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg==",
"license": "MIT"
},
"node_modules/@radix-ui/react-alert-dialog": {
"version": "1.1.15",
"resolved": "https://registry.npmjs.org/@radix-ui/react-alert-dialog/-/react-alert-dialog-1.1.15.tgz",
"integrity": "sha512-oTVLkEw5GpdRe29BqJ0LSDFWI3qu0vR1M0mUkOQWDIUnY/QIkLpgDMWuKxP94c2NAC2LGcgVhG1ImF3jkZ5wXw==",
"license": "MIT",
"dependencies": {
"@radix-ui/primitive": "1.1.3",
"@radix-ui/react-compose-refs": "1.1.2",
"@radix-ui/react-context": "1.1.2",
"@radix-ui/react-dialog": "1.1.15",
"@radix-ui/react-primitive": "2.1.3",
"@radix-ui/react-slot": "1.2.3"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-arrow": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.7.tgz",
@ -786,6 +842,36 @@
}
}
},
"node_modules/@radix-ui/react-checkbox": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/@radix-ui/react-checkbox/-/react-checkbox-1.3.3.tgz",
"integrity": "sha512-wBbpv+NQftHDdG86Qc0pIyXk5IR3tM8Vd0nWLKDcX8nNn4nXFOFwsKuqw2okA/1D/mpaAkmuyndrPJTYDNZtFw==",
"license": "MIT",
"dependencies": {
"@radix-ui/primitive": "1.1.3",
"@radix-ui/react-compose-refs": "1.1.2",
"@radix-ui/react-context": "1.1.2",
"@radix-ui/react-presence": "1.1.5",
"@radix-ui/react-primitive": "2.1.3",
"@radix-ui/react-use-controllable-state": "1.2.2",
"@radix-ui/react-use-previous": "1.1.1",
"@radix-ui/react-use-size": "1.1.1"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-collapsible": {
"version": "1.1.12",
"resolved": "https://registry.npmjs.org/@radix-ui/react-collapsible/-/react-collapsible-1.1.12.tgz",
@ -1100,6 +1186,43 @@
}
}
},
"node_modules/@radix-ui/react-popover": {
"version": "1.1.15",
"resolved": "https://registry.npmjs.org/@radix-ui/react-popover/-/react-popover-1.1.15.tgz",
"integrity": "sha512-kr0X2+6Yy/vJzLYJUPCZEc8SfQcf+1COFoAqauJm74umQhta9M7lNJHP7QQS3vkvcGLQUbWpMzwrXYwrYztHKA==",
"license": "MIT",
"dependencies": {
"@radix-ui/primitive": "1.1.3",
"@radix-ui/react-compose-refs": "1.1.2",
"@radix-ui/react-context": "1.1.2",
"@radix-ui/react-dismissable-layer": "1.1.11",
"@radix-ui/react-focus-guards": "1.1.3",
"@radix-ui/react-focus-scope": "1.1.7",
"@radix-ui/react-id": "1.1.1",
"@radix-ui/react-popper": "1.2.8",
"@radix-ui/react-portal": "1.1.9",
"@radix-ui/react-presence": "1.1.5",
"@radix-ui/react-primitive": "2.1.3",
"@radix-ui/react-slot": "1.2.3",
"@radix-ui/react-use-controllable-state": "1.2.2",
"aria-hidden": "^1.2.4",
"react-remove-scroll": "^2.6.3"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-popper": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.2.8.tgz",
@ -1234,6 +1357,49 @@
}
}
},
"node_modules/@radix-ui/react-select": {
"version": "2.2.6",
"resolved": "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-2.2.6.tgz",
"integrity": "sha512-I30RydO+bnn2PQztvo25tswPH+wFBjehVGtmagkU78yMdwTwVf12wnAOF+AeP8S2N8xD+5UPbGhkUfPyvT+mwQ==",
"license": "MIT",
"dependencies": {
"@radix-ui/number": "1.1.1",
"@radix-ui/primitive": "1.1.3",
"@radix-ui/react-collection": "1.1.7",
"@radix-ui/react-compose-refs": "1.1.2",
"@radix-ui/react-context": "1.1.2",
"@radix-ui/react-direction": "1.1.1",
"@radix-ui/react-dismissable-layer": "1.1.11",
"@radix-ui/react-focus-guards": "1.1.3",
"@radix-ui/react-focus-scope": "1.1.7",
"@radix-ui/react-id": "1.1.1",
"@radix-ui/react-popper": "1.2.8",
"@radix-ui/react-portal": "1.1.9",
"@radix-ui/react-primitive": "2.1.3",
"@radix-ui/react-slot": "1.2.3",
"@radix-ui/react-use-callback-ref": "1.1.1",
"@radix-ui/react-use-controllable-state": "1.2.2",
"@radix-ui/react-use-layout-effect": "1.1.1",
"@radix-ui/react-use-previous": "1.1.1",
"@radix-ui/react-visually-hidden": "1.2.3",
"aria-hidden": "^1.2.4",
"react-remove-scroll": "^2.6.3"
},
"peerDependencies": {
"@types/react": "*",
"@types/react-dom": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc",
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
},
"@types/react-dom": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-separator": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/@radix-ui/react-separator/-/react-separator-1.1.7.tgz",
@ -1412,6 +1578,21 @@
}
}
},
"node_modules/@radix-ui/react-use-previous": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-previous/-/react-use-previous-1.1.1.tgz",
"integrity": "sha512-2dHfToCj/pzca2Ck724OZ5L0EVrr3eHRNsG/b3xQJLA2hZpVCS99bLAX+hm1IHXDEnzU6by5z/5MIY794/a8NQ==",
"license": "MIT",
"peerDependencies": {
"@types/react": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
}
},
"node_modules/@radix-ui/react-use-rect": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@radix-ui/react-use-rect/-/react-use-rect-1.1.1.tgz",
@ -2004,6 +2185,12 @@
"node": ">=10.13.0"
}
},
"node_modules/faker-js": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/faker-js/-/faker-js-1.0.0.tgz",
"integrity": "sha512-kaToadbN63LWhHjl69pqG+YHlxAK0aZAPhQDUpVP7v7+RG//ZpK0OzXjCwaAQq98awOii0WSHxtJmIz0X7/UqQ==",
"license": "ISC"
},
"node_modules/get-nonce": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/get-nonce/-/get-nonce-1.0.1.tgz",

View file

@ -9,18 +9,24 @@
"lint": "next lint"
},
"dependencies": {
"@faker-js/faker": "^10.0.0",
"@hookform/resolvers": "^5.2.1",
"@radix-ui/react-alert-dialog": "^1.1.15",
"@radix-ui/react-avatar": "^1.1.10",
"@radix-ui/react-checkbox": "^1.3.3",
"@radix-ui/react-collapsible": "^1.1.12",
"@radix-ui/react-dialog": "^1.1.15",
"@radix-ui/react-dropdown-menu": "^2.1.16",
"@radix-ui/react-label": "^2.1.7",
"@radix-ui/react-popover": "^1.1.15",
"@radix-ui/react-select": "^2.2.6",
"@radix-ui/react-separator": "^1.1.7",
"@radix-ui/react-slot": "^1.2.3",
"@radix-ui/react-tooltip": "^1.2.8",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cookies-next": "^6.1.0",
"faker-js": "^1.0.0",
"jsonwebtoken": "^9.0.2",
"lucide-react": "^0.540.0",
"next": "^15.5.3",

View file

@ -1,16 +1,6 @@
import appConfig from '../../config/app.json';
export default class Json {
static execute(path: string) {
return {
"state": "go",
"api": {
"url": "http://localhost:8000/",
"prefix": "api/v1",
"content_type": "application/json"
}
}
static execute() {
return appConfig;
}
}

View file

@ -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() {

View file

@ -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: '',

View file

@ -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";

View file

@ -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;

View file

@ -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;

View file

@ -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
});

View file

@ -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

View file

@ -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
});

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -1,4 +1,4 @@
export default interface Usuario {
export default interface GUsuario {
usuario_id: number,
trocarsenha: string,
login: string,

View file

@ -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(),

View file

@ -8,4 +8,4 @@ export default async function GUsuarioIndex() {
return response;
}
}

View file

@ -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) {

View file

@ -0,0 +1,166 @@
'use client';
import { useEffect, useState, useCallback } from "react";
import { Card, CardContent } from "@/components/ui/card";
import Loading from "@/app/_components/loading/loading";
import TTBAndamentoServicoTable from "../../_components/t_tb_andamentoservico/TTBAndamentoServicoTable";
import TTBAndamentoServicoForm from "../../_components/t_tb_andamentoservico/TTBAndamentoServicoForm";
import { useTTBAndamentoServicoReadHook } from "../../_hooks/t_tb_andamentoservico/useTTBAndamentoServicoReadHook";
import { useTTBAndamentoServicoSaveHook } from "../../_hooks/t_tb_andamentoservico/useTTBAndamentoServicoSaveHook";
import ConfirmDialog from "@/app/_components/confirm_dialog/ConfirmDialog";
import { useConfirmDialog } from "@/app/_components/confirm_dialog/useConfirmDialog";
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
const { tTBAndamentosServicos, fetchTTBAndamentoServico } = useTTBAndamentoServicoReadHook();
const { saveTTBAndamentoServico } = useTTBAndamentoServicoSaveHook();
const { deleteTTBAndamentoServico } = useTTBAndamentoServicoDeleteHook();
// Estados
const [selectedAndamento, setSelectedAndamento] = useState<TTBAndamentoServicoInterface | null>(null);
const [isFormOpen, setIsFormOpen] = useState(false);
// Estado para saber qual item será deletado
const [itemToDelete, setItemToDelete] = useState<TTBAndamentoServicoInterface | null>(null);
/**
* Hook do modal de confirmação
*/
const {
isOpen: isConfirmOpen,
openDialog: openConfirmDialog,
handleConfirm,
handleCancel,
} = useConfirmDialog();
/**
* Abre o formulário no modo de edição ou criação
*/
const handleOpenForm = useCallback((data: TTBAndamentoServicoInterface | null) => {
setSelectedAndamento(data);
setIsFormOpen(true);
}, []);
/**
* Fecha o formulário e limpa o andamento selecionado
*/
const handleCloseForm = useCallback(() => {
setSelectedAndamento(null);
setIsFormOpen(false);
}, []);
/**
* Salva os dados do formulário
*/
const handleSave = useCallback(async (formData: TTBAndamentoServicoInterface) => {
// Aguarda salvar o registro
await saveTTBAndamentoServico(formData);
// Encerra o fomulário
handleCloseForm();
// Atualiza a lista de dados
fetchTTBAndamentoServico();
}, [saveTTBAndamentoServico, fetchTTBAndamentoServico, handleCloseForm]);
/**
* Quando o usuário clica em "remover" na tabela
*/
const handleConfirmDelete = useCallback((item: TTBAndamentoServicoInterface) => {
// Define o item atual para remoção
setItemToDelete(item);
// Abre o modal de confirmação
openConfirmDialog();
}, [openConfirmDialog]);
/**
* Executa a exclusão de fato quando o usuário confirma
*/
const handleDelete = useCallback(async () => {
// Protege contra null
if (!itemToDelete) return;
// Executa o Hook de remoção
await deleteTTBAndamentoServico(itemToDelete);
// Atualiza a lista
await fetchTTBAndamentoServico();
// Limpa o item selecionado
setItemToDelete(null);
// Fecha o modal
handleCancel();
}, [itemToDelete, fetchTTBAndamentoServico, handleCancel]);
/**
* Busca inicial dos dados
*/
useEffect(() => {
fetchTTBAndamentoServico();
}, []);
/**
* Tela de loading enquanto carrega os dados
*/
if (!tTBAndamentosServicos) {
return <Loading type={2} />;
}
return (
<div>
{/* Cabeçalho */}
<Header
title={"Andamentos"}
description={"Gerenciamento de Andamentos de Atos"}
buttonText={"Novo Andamento"}
buttonAction={() => { handleOpenForm(null) }}
/>
{/* Tabela de andamentos */}
<Card>
<CardContent>
<TTBAndamentoServicoTable
data={tTBAndamentosServicos}
onEdit={handleOpenForm}
onDelete={handleConfirmDelete}
/>
</CardContent>
</Card>
{/* Modal de confirmação */}
<ConfirmDialog
isOpen={isConfirmOpen}
title="Confirmar exclusão"
description="Atenção"
message={`Deseja realmente excluir o andamento "${itemToDelete?.descricao}"?`}
confirmText="Sim, excluir"
cancelText="Cancelar"
onConfirm={handleDelete}
onCancel={handleCancel}
/>
{/* Formulário de criação/edição */}
<TTBAndamentoServicoForm
isOpen={isFormOpen}
data={selectedAndamento}
onClose={handleCloseForm}
onSave={handleSave}
/>
</div>
); 4
}

View file

@ -0,0 +1,167 @@
'use client';
import { useEffect, useState, useCallback } from "react";
import { Card, CardContent } from "@/components/ui/card";
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";
import { useTTBReconhecimentoTipoReadHook } from "../../_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoReadHook";
import { useTTBReconhecimentoTipoSaveHook } from "../../_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoSaveHook";
import { useTTBReconhecimentoTipoDeleteHook } from "../../_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoDeleteHook";
import ConfirmDialog from "@/app/_components/confirm_dialog/ConfirmDialog";
import { useConfirmDialog } from "@/app/_components/confirm_dialog/useConfirmDialog";
import TTBReconhecimentoTipoInterface from "../../_interfaces/TTBReconhecimentoTipoInterface";
export default function TTBAndamentoServico() {
// Hooks para leitura e salvamento
const { tTBReconhecimentosTipos, fetchTTBReconhecimentosTipos } = useTTBReconhecimentoTipoReadHook();
const { saveTTBReconhecimentoTipo } = useTTBReconhecimentoTipoSaveHook();
const { deleteTTBReconhecimentoTipo } = useTTBReconhecimentoTipoDeleteHook();
// Estados
const [selectedReconhecimentoTipo, setReconhecimentoTipo] = useState<TTBReconhecimentoTipoInterface | null>(null);
const [isFormOpen, setIsFormOpen] = useState(false);
// Estado para saber qual item será deletado
const [itemToDelete, setItemToDelete] = useState<TTBReconhecimentoTipoInterface | null>(null);
/**
* Hook do modal de confirmação
*/
const {
isOpen: isConfirmOpen,
openDialog: openConfirmDialog,
handleConfirm,
handleCancel,
} = useConfirmDialog();
/**
* Abre o formulário no modo de edição ou criação
*/
const handleOpenForm = useCallback((data: TTBReconhecimentoTipoInterface | null) => {
setReconhecimentoTipo(data);
setIsFormOpen(true);
}, []);
/**
* Fecha o formulário e limpa o andamento selecionado
*/
const handleCloseForm = useCallback(() => {
setReconhecimentoTipo(null);
setIsFormOpen(false);
}, []);
/**
* Salva os dados do formulário
*/
const handleSave = useCallback(async (formData: TTBReconhecimentoTipoInterface) => {
// Aguarda salvar o registro
await saveTTBReconhecimentoTipo(formData);
// Encerra o fomulário
handleCloseForm();
// Atualiza a lista de dados
fetchTTBReconhecimentosTipos();
}, [saveTTBReconhecimentoTipo, fetchTTBReconhecimentosTipos, handleCloseForm]);
/**
* Quando o usuário clica em "remover" na tabela
*/
const handleConfirmDelete = useCallback((item: TTBReconhecimentoTipoInterface) => {
// Define o item atual para remoção
setItemToDelete(item);
// Abre o modal de confirmação
openConfirmDialog();
}, [openConfirmDialog]);
/**
* Executa a exclusão de fato quando o usuário confirma
*/
const handleDelete = useCallback(async () => {
// Protege contra null
if (!itemToDelete) return;
// Executa o Hook de remoção
await deleteTTBReconhecimentoTipo(itemToDelete);
// Atualiza a lista
await fetchTTBReconhecimentosTipos();
// Limpa o item selecionado
setItemToDelete(null);
// Fecha o modal
handleCancel();
}, [itemToDelete, fetchTTBReconhecimentosTipos, handleCancel]);
/**
* Busca inicial dos dados
*/
useEffect(() => {
fetchTTBReconhecimentosTipos();
}, []);
/**
* Tela de loading enquanto carrega os dados
*/
if (!tTBReconhecimentosTipos) {
return <Loading type={2} />;
}
return (
<div>
{/* Cabeçalho */}
<Header
title={"Reconhecimentos"}
description={"Gerenciamento de tipos de reconhecimentos"}
buttonText={"Novo Tipo"}
buttonAction={() => { handleOpenForm(null) }}
/>
{/* Tabela de andamentos */}
<Card>
<CardContent>
<TTBReconhecimentoTipoTable
data={tTBReconhecimentosTipos}
onEdit={handleOpenForm}
onDelete={handleConfirmDelete}
/>
</CardContent>
</Card>
{/* Modal de confirmação */}
<ConfirmDialog
isOpen={isConfirmOpen}
title="Confirmar exclusão"
description="Atenção"
message={`Deseja realmente excluir o andamento "${itemToDelete?.descricao}"?`}
confirmText="Sim, excluir"
cancelText="Cancelar"
onConfirm={handleDelete}
onCancel={handleCancel}
/>
{/* Formulário de criação/edição */}
<TTBReconhecimentoTipoForm
isOpen={isFormOpen}
data={selectedReconhecimentoTipo}
onClose={handleCloseForm}
onSave={handleSave}
/>
</div>
);
}

View file

@ -0,0 +1,189 @@
'use client';
import z from "zod";
import { useEffect } from "react";
import { useForm, Controller } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
import {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle
} from "@/components/ui/dialog";
import {
Form,
FormControl,
FormField,
FormItem,
FormLabel,
FormMessage
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue
} from "@/components/ui/select";
import { TTBAndamentoServicoSchema } from "../../_schemas/TTBAndamentoServicoSchema";
import { tipoEnum } from "../../_interfaces/TTBAndamentoServicoInterface";
type FormValues = z.infer<typeof TTBAndamentoServicoSchema>;
interface Props {
isOpen: boolean;
data: FormValues | null;
onClose: (item: null, isFormStatus: boolean) => void;
onSave: (data: FormValues) => void;
}
export default function TTBAndamentoServicoForm({ isOpen, data, onClose, onSave }: Props) {
// Inicializa o react-hook-form com schema zod
const form = useForm<FormValues>({
resolver: zodResolver(TTBAndamentoServicoSchema),
defaultValues: {
descricao: "",
tipo: tipoEnum.OUTROS,
situacao: "A",
usa_email: "I",
tb_andamentoservico_id: 0,
},
});
// Opções do Select mapeadas a partir do enum
const tipoOptions = Object.values(tipoEnum).map((value) => ({
value,
label:
value === "C" ? "Cancelado" :
value === "E" ? "Estornado" :
value === "PT" ? "Protocolado" :
value === "PD" ? "Pedido" :
value === "NC" ? "Não Consta" :
"Outros"
}));
// Atualiza o formulário quando recebe dados para edição
useEffect(() => {
if (data) form.reset(data);
}, [data, form]);
return (
<Dialog
open={isOpen}
onOpenChange={(open) => {
if (!open) onClose(null, false);
}}
>
<DialogContent className="sm:max-w-[425px]">
<DialogHeader>
<DialogTitle>
Andamentos
</DialogTitle>
<DialogDescription>
Controle de andamentos de atos
</DialogDescription>
</DialogHeader>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSave)} className="space-y-6">
{/* Descrição */}
<FormField
control={form.control}
name="descricao"
render={({ field }) => (
<FormItem>
<FormLabel>Descrição</FormLabel>
<FormControl>
<Input {...field} placeholder="Digite a descrição" />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{/* Tipo */}
<FormField
control={form.control}
name="tipo"
render={({ field }) => (
<FormItem>
<FormLabel>Tipo</FormLabel>
<Select value={field.value} onValueChange={field.onChange}>
<FormControl className="w-full">
<SelectTrigger>
<SelectValue placeholder="Escolha o tipo do andamento" />
</SelectTrigger>
</FormControl>
<SelectContent>
{tipoOptions.map((option) => (
<SelectItem key={option.value} value={option.value}>
{option.label}
</SelectItem>
))}
</SelectContent>
</Select>
<FormMessage />
</FormItem>
)}
/>
{/* Situação */}
<Controller
name="situacao"
control={form.control}
render={({ field }) => (
<div className="flex items-center space-x-2">
<Checkbox
checked={field.value === "A"}
onCheckedChange={(checked) => field.onChange(checked ? "A" : "I")}
/>
<Label>Ativo</Label>
</div>
)}
/>
{/* Usar e-mail */}
<Controller
name="usa_email"
control={form.control}
render={({ field }) => (
<div className="flex items-center space-x-2">
<Checkbox
checked={field.value === "A"}
onCheckedChange={(checked) => field.onChange(checked ? "A" : "I")}
/>
<Label>Usar e-mail</Label>
</div>
)}
/>
{/* Rodapé do Dialog */}
<DialogFooter className="mt-4">
<DialogClose asChild>
<Button variant="outline" type="button" onClick={() => onClose(null, false)} className="cursor-pointer">
Cancelar
</Button>
</DialogClose>
<Button type="submit" className="cursor-pointer">
Salvar
</Button>
</DialogFooter>
{/* Campo oculto */}
<input type="hidden" {...form.register("tb_andamentoservico_id")} />
</form>
</Form>
</DialogContent>
</Dialog>
);
}

View file

@ -0,0 +1,124 @@
'use client';
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger
} from "@/components/ui/dropdown-menu";
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow
} from "@/components/ui/table";
import { EllipsisIcon, PencilIcon, Trash2Icon } from "lucide-react";
import TTBAndamentoServicoInteface from "../../_interfaces/TTBAndamentoServicoInterface";
interface TTBAndamentoServicoTableProps {
data: TTBAndamentoServicoInteface[];
onEdit: (item: TTBAndamentoServicoInteface, isEditingFormStatus: boolean) => void;
onDelete: (item: TTBAndamentoServicoInteface, isEditingFormStatus: boolean) => void;
}
/**
* Renderiza o badge de situação
*/
function StatusBadge({ situacao }: { situacao: string }) {
const isActive = situacao === "A";
const baseClasses =
"text-xs font-medium px-2.5 py-0.5 rounded-sm me-2";
const activeClasses =
"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300";
const inactiveClasses =
"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300";
return (
<span className={`${baseClasses} ${isActive ? activeClasses : inactiveClasses}`}>
{isActive ? "Ativo" : "Inativo"}
</span>
);
}
export default function TTBAndamentoServicoTable({
data,
onEdit,
onDelete
}: TTBAndamentoServicoTableProps) {
return (
<Table>
<TableHeader>
<TableRow>
<TableHead>#</TableHead>
<TableHead>Situação</TableHead>
<TableHead>Descrição</TableHead>
<TableHead className="text-right">Ações</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{data.map((item) => (
<TableRow
key={item.tb_andamentoservico_id}
className="cursor-pointer"
>
<TableCell className="font-medium">
{item.tb_andamentoservico_id}
</TableCell>
<TableCell>
<StatusBadge situacao={item.situacao} />
</TableCell>
<TableCell>{item.descricao}</TableCell>
<TableCell className="text-right">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant="outline"
size="icon"
className="cursor-pointer"
>
<EllipsisIcon />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent side="left" align="start">
<DropdownMenuGroup>
<DropdownMenuItem
className="cursor-pointer"
onSelect={() => onEdit(item, true)}
>
<PencilIcon className="mr-2 h-4 w-4" />
Editar
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem
className="cursor-pointer"
onSelect={() => onDelete(item, true)}
>
<Trash2Icon className="mr-2 h-4 w-4" />
Remover
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
);
}

View file

@ -0,0 +1,127 @@
'use client';
import z from "zod";
import { useEffect } from "react";
import { useForm, Controller } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
import {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle
} from "@/components/ui/dialog";
import {
Form,
FormControl,
FormField,
FormItem,
FormLabel,
FormMessage
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { TTBReconhecimentoTipoSchema } from "../../_schemas/TTBReconhecimentoTipoSchema";
import { situacaoEnum } from "../../_interfaces/TTBReconhecimentoTipoInterface";
type FormValues = z.infer<typeof TTBReconhecimentoTipoSchema>;
interface TTBReconhecimentoTipoFormProps {
isOpen: boolean;
data: FormValues | null;
onClose: (item: null, isFormStatus: boolean) => void;
onSave: (data: FormValues) => void;
}
export default function TTBReconhecimentoTipoForm({ isOpen, data, onClose, onSave }: TTBReconhecimentoTipoFormProps) {
// Inicializa o react-hook-form com schema zod
const form = useForm<FormValues>({
resolver: zodResolver(TTBReconhecimentoTipoSchema),
defaultValues: {
tb_reconhecimentotipo_id: 0,
descricao: "",
situacao: situacaoEnum.ATIVO,
},
});
// Atualiza o formulário quando recebe dados para edição
useEffect(() => {
if (data) form.reset(data);
}, [data, form]);
return (
<Dialog
open={isOpen}
onOpenChange={(open) => {
if (!open) onClose(null, false);
}}
>
<DialogContent className="sm:max-w-[425px]">
<DialogHeader>
<DialogTitle>
Reconhecimentos
</DialogTitle>
<DialogDescription>
Tipos de Reconhecimentos
</DialogDescription>
</DialogHeader>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSave)} className="space-y-6">
{/* Descrição */}
<FormField
control={form.control}
name="descricao"
render={({ field }) => (
<FormItem>
<FormLabel>Descrição</FormLabel>
<FormControl>
<Input {...field} placeholder="Digite a descrição" />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{/* Situação */}
<Controller
name="situacao"
control={form.control}
render={({ field }) => (
<div className="flex items-center space-x-2">
<Checkbox
checked={field.value === "A"}
onCheckedChange={(checked) => field.onChange(checked ? "A" : "I")}
/>
<Label>Ativo</Label>
</div>
)}
/>
{/* Rodapé do Dialog */}
<DialogFooter className="mt-4">
<DialogClose asChild>
<Button variant="outline" type="button" onClick={() => onClose(null, false)} className="cursor-pointer">
Cancelar
</Button>
</DialogClose>
<Button type="submit" className="cursor-pointer">
Salvar
</Button>
</DialogFooter>
{/* Campo oculto */}
<input type="hidden" {...form.register("tb_reconhecimentotipo_id")} />
</form>
</Form>
</DialogContent>
</Dialog>
);
}

View file

@ -0,0 +1,124 @@
'use client';
import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger
} from "@/components/ui/dropdown-menu";
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow
} from "@/components/ui/table";
import { EllipsisIcon, PencilIcon, Trash2Icon } from "lucide-react";
import TTBReconhecimentoTipoInterface from "../../_interfaces/TTBReconhecimentoTipoInterface";
interface TTBReconhecimentoTipoTableProps {
data: TTBReconhecimentoTipoInterface[];
onEdit: (item: TTBReconhecimentoTipoInterface, isEditingFormStatus: boolean) => void;
onDelete: (item: TTBReconhecimentoTipoInterface, isEditingFormStatus: boolean) => void;
}
/**
* Renderiza o badge de situação
*/
function StatusBadge({ situacao }: { situacao: string }) {
const isActive = situacao === "A";
const baseClasses =
"text-xs font-medium px-2.5 py-0.5 rounded-sm me-2";
const activeClasses =
"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300";
const inactiveClasses =
"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300";
return (
<span className={`${baseClasses} ${isActive ? activeClasses : inactiveClasses}`}>
{isActive ? "Ativo" : "Inativo"}
</span>
);
}
export default function TTBReconhecimentoTipoTable({
data,
onEdit,
onDelete
}: TTBReconhecimentoTipoTableProps) {
return (
<Table>
<TableHeader>
<TableRow>
<TableHead>#</TableHead>
<TableHead>Situação</TableHead>
<TableHead>Descrição</TableHead>
<TableHead className="text-right">Ações</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{data.map((item) => (
<TableRow
key={item.tb_reconhecimentotipo_id}
className="cursor-pointer"
>
<TableCell className="font-medium">
{item.tb_reconhecimentotipo_id}
</TableCell>
<TableCell>
<StatusBadge situacao={item.situacao} />
</TableCell>
<TableCell>{item.descricao}</TableCell>
<TableCell className="text-right">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant="outline"
size="icon"
className="cursor-pointer"
>
<EllipsisIcon />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent side="left" align="start">
<DropdownMenuGroup>
<DropdownMenuItem
className="cursor-pointer"
onSelect={() => onEdit(item, true)}
>
<PencilIcon className="mr-2 h-4 w-4" />
Editar
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem
className="cursor-pointer"
onSelect={() => onDelete(item, true)}
>
<Trash2Icon className="mr-2 h-4 w-4" />
Remover
</DropdownMenuItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
);
}

View file

@ -0,0 +1,17 @@
'use server'
import API from "@/services/api/Api";
import { Methods } from "@/services/api/enums/ApiMethodEnum";
export default async function TTBAndamentoServicoIndexData() {
const api = new API();
const response = await api.send({
'method': Methods.GET,
'endpoint': `administrativo/t_tb_andamentoservico/`
});
return response;
}

View file

@ -0,0 +1,18 @@
'use server'
import API from "@/services/api/Api";
import TTBAndamentoServicoInteface from "../../_interfaces/TTBAndamentoServicoInterface";
import { Methods } from "@/services/api/enums/ApiMethodEnum";
export default async function TTBAndamentoServicoRemoveData(tTBAndamentoServico: TTBAndamentoServicoInteface) {
const api = new API();
const response = await api.send({
method: Methods.DELETE,
endpoint: `administrativo/t_tb_andamentoservico/${tTBAndamentoServico.tb_andamentoservico_id}`
});
return response;
}

View file

@ -0,0 +1,19 @@
'use server'
import API from "@/services/api/Api";
import TTBAndamentoServicoInteface from "../../_interfaces/TTBAndamentoServicoInterface";
import { Methods } from "@/services/api/enums/ApiMethodEnum";
export default async function TTBAndamentoServicoSaveData(data: TTBAndamentoServicoInteface) {
const api = new API();
const response = await api.send({
method: data.tb_andamentoservico_id ? Methods.PUT : Methods.POST,
endpoint: `administrativo/t_tb_andamentoservico/${data.tb_andamentoservico_id ? data.tb_andamentoservico_id : ''}`,
body: data
});
return response;
}

View file

@ -0,0 +1,16 @@
import API from "@/services/api/Api";
import TTBReconhecimentoTipoInterface from "../../_interfaces/TTBReconhecimentoTipoInterface";
import { Methods } from "@/services/api/enums/ApiMethodEnum";
export default async function TTBReconhecimentoTipoDeleteData(data: TTBReconhecimentoTipoInterface) {
const api = new API();
const response = await api.send({
method: Methods.DELETE,
endpoint: `administrativo/t_tb_reconhecimentotipo/${data.tb_reconhecimentotipo_id}`
});
return response;
}

View file

@ -0,0 +1,17 @@
'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: `administrativo/t_tb_reconhecimentotipo`
});
return response;
}

View file

@ -0,0 +1,17 @@
import API from "@/services/api/Api";
import { Methods } from "@/services/api/enums/ApiMethodEnum";
import TTBReconhecimentoTipoInterface from "../../_interfaces/TTBReconhecimentoTipoInterface";
export default async function TTBReconhecimentoTipoSaveData(data: TTBReconhecimentoTipoInterface) {
const api = new API();
const response = await api.send({
method: data.tb_reconhecimentotipo_id ? Methods.PUT : Methods.POST,
endpoint: `administrativo/t_tb_reconhecimentotipo/${data.tb_reconhecimentotipo_id ? data.tb_reconhecimentotipo_id : ''}`,
body: data
});
return response;
}

View file

@ -0,0 +1,24 @@
import { useResponse } from "@/app/_response/ResponseContext"
import { useState } from "react";
import TTBAndamentoServicoInteface from "../../_interfaces/TTBAndamentoServicoInterface";
import TTBAndamentoServicoRemoveData from "../../_data/TTBAndamentoServico/TTBAndamentoServicoRemoveData";
export const useTTBAndamentoServicoDeleteHook = () => {
const { setResponse } = useResponse();
const [tTBAndamentoServico, setTTBAndamentoServico] = useState<TTBAndamentoServicoInteface>();
const deleteTTBAndamentoServico = async (data: TTBAndamentoServicoInteface) => {
const response = await TTBAndamentoServicoRemoveData(data);
setTTBAndamentoServico(data);
setResponse(response);
}
return { tTBAndamentoServico, deleteTTBAndamentoServico }
}

View file

@ -0,0 +1,34 @@
'use client'
import { useResponse } from "@/app/_response/ResponseContext"
import { useState } from "react";
import TTBAndamentoServicoInteface from "../../_interfaces/TTBAndamentoServicoInterface";
import TTBAndamentoServicoIndexData from "../../_data/TTBAndamentoServico/TTBAndamentoServicoIndexData";
export const useTTBAndamentoServicoReadHook = () => {
const { setResponse } = useResponse();
const [tTBAndamentosServicos, setTTBAndamentosServicos] = useState<TTBAndamentoServicoInteface[] | null>(null);
const fetchTTBAndamentoServico = async () => {
const response = await TTBAndamentoServicoIndexData();
// Armazena os dados consultados
setTTBAndamentosServicos(response.data);
// Define os dados do componente de resposta (toast, modal, etc)
setResponse(response);
}
function addTTBAndamentoServico(tTTBAndamentoServico: TTBAndamentoServicoInteface) {
setTTBAndamentosServicos(prev => [...(prev || []), tTTBAndamentoServico]);
}
return { tTBAndamentosServicos, fetchTTBAndamentoServico, addTTBAndamentoServico }
}

View file

@ -0,0 +1,31 @@
'use client'
import { useResponse } from "@/app/_response/ResponseContext"
import { useState } from "react";
import TTBAndamentoServicoInteface from "../../_interfaces/TTBAndamentoServicoInterface";
import TTBAndamentoServicoSaveData from "../../_data/TTBAndamentoServico/TTBAndamentoServicoSaveData";
export const useTTBAndamentoServicoSaveHook = () => {
const { setResponse } = useResponse();
const [tTBAndamentoServico, setTTBAndamentoServico] = useState<TTBAndamentoServicoInteface>();
const saveTTBAndamentoServico = async (data: TTBAndamentoServicoInteface) => {
const response = await TTBAndamentoServicoSaveData(data);
// Armazena os dados da repsota
setTTBAndamentoServico(response.data);
// Define os dados da respota(toast, modal, etc)
setResponse(response);
// Retorna os valores de forma imediata
return response.data;
}
return { tTBAndamentoServico, saveTTBAndamentoServico }
}

View file

@ -0,0 +1,19 @@
import { useResponse } from "@/app/_response/ResponseContext"
import TTBReconhecimentoTipoInterface from "../../_interfaces/TTBReconhecimentoTipoInterface";
import TTBReconhecimentoTipoDeleteData from "../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoDeleteData";
export const useTTBReconhecimentoTipoDeleteHook = () => {
const { setResponse } = useResponse();
const deleteTTBReconhecimentoTipo = async (data: TTBReconhecimentoTipoInterface) => {
const response = await TTBReconhecimentoTipoDeleteData(data);
setResponse(response);
}
return { deleteTTBReconhecimentoTipo }
}

View file

@ -0,0 +1,26 @@
'use client'
import ITTTBReconhecimentoTipo from '../../_interfaces/TTBReconhecimentoTipoInterface'
import { useResponse } from "@/app/_response/ResponseContext"
import { useState } from "react";
import TTBReconhecimentoTipoIndexData from '../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndexData';
export const useTTBReconhecimentoTipoReadHook = () => {
const { setResponse } = useResponse();
const [tTBReconhecimentosTipos, setReconhecimenntosTipos] = useState<ITTTBReconhecimentoTipo[]>([]);
const fetchTTBReconhecimentosTipos = async () => {
const response = await TTBReconhecimentoTipoIndexData();
setReconhecimenntosTipos(response.data);
setResponse(response);
}
return { tTBReconhecimentosTipos, fetchTTBReconhecimentosTipos }
}

View file

@ -0,0 +1,29 @@
'use client'
import { useResponse } from "@/app/_response/ResponseContext"
import { useState } from "react";
import ITTTBReconhecimentoTipo from '../../_interfaces/TTBReconhecimentoTipoInterface'
import TTBReconhecimentoTipoSaveData from "../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoSaveData";
export const useTTBReconhecimentoTipoSaveHook = () => {
const { setResponse } = useResponse();
const [tTBReconhecimentoTipo, setTTBReconhcimentoTipo] = useState<ITTTBReconhecimentoTipo>();
const saveTTBReconhecimentoTipo = async (reconhecimentoTipo: ITTTBReconhecimentoTipo) => {
const response = await TTBReconhecimentoTipoSaveData(reconhecimentoTipo);
saveTTBReconhecimentoTipo(response.data);
setResponse(response);
// Retorna os valores de forma imediata
return response.data;
}
return { tTBReconhecimentoTipo, saveTTBReconhecimentoTipo }
}

View file

@ -0,0 +1,16 @@
export default interface TTBAndamentoServicoInteface {
tb_andamentoservico_id?: number,
descricao: string,
situacao: string,
tipo: tipoEnum,
usa_email: string
}
export enum tipoEnum {
CANCELADO = "C",
ESTORNADO = "E",
PROTOCOLADO = "PT",
PEDIDO = "PD",
NAO_CONSTA = "NC",
OUTROS = "O",
}

View file

@ -0,0 +1,12 @@
export default interface TTBReconhecimentoTipoInterface {
tb_reconhecimentotipo_id?: number,
descricao: string,
situacao: situacaoEnum,
}
export enum situacaoEnum {
ATIVO = 'A',
INATIVO = 'I',
}

View file

@ -0,0 +1,12 @@
import { z } from 'zod';
import { tipoEnum } from '../_interfaces/TTBAndamentoServicoInterface';
export const TTBAndamentoServicoSchema = z.object({
tb_andamentoservico_id: z.number().optional(),
descricao: z.string().min(1, "Descrição Obrigatória"),
situacao: z.string().min(1, "Situação Obrigatória"),
tipo: z.nativeEnum(tipoEnum, { message: "Tipo inválido" }),
usa_email: z.string().min(1, "Email Obrigatória"),
});

View file

@ -0,0 +1,8 @@
import { z } from 'zod';
import { situacaoEnum } from '../_interfaces/TTBReconhecimentoTipoInterface';
export const TTBReconhecimentoTipoSchema = z.object({
tb_reconhecimentotipo_id: z.number().optional(),
descricao: z.string().min(1, "Campo descrição deve ser preenchido"),
situacao: z.nativeEnum(situacaoEnum, { message: "Tipo inválido" }),
});

View 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>
)
}

View file

@ -0,0 +1,81 @@
'use client';
import React from 'react';
// Shadcn UI components
import {
AlertDialog,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogAction,
} from '@/components/ui/alert-dialog';
interface AlertProps {
/** Controla a abertura do modal */
isOpen: boolean;
/** Título principal do alerta */
title: string;
/** Descrição adicional do alerta */
description?: string;
/** Mensagem do corpo do alerta */
message: string;
/** Texto do botão de confirmação */
confirmText?: string;
/** Texto do botão de cancelamento */
cancelText?: string;
/** Função executada ao confirmar */
onConfirm: () => void;
/** Função executada ao cancelar */
onCancel: () => void;
}
/**
* Componente de alerta genérico e reutilizável.
* Baseado no Radix e Shadcn UI, com suporte a título, descrição,
* mensagem e botões de ação customizáveis.
*/
export default function ConfirmDialog({
isOpen,
title,
description,
message,
confirmText = 'Confirmar',
cancelText = 'Cancelar',
onConfirm,
onCancel,
}: AlertProps) {
return (
<AlertDialog open={isOpen} onOpenChange={onCancel}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{title}</AlertDialogTitle>
{description && (
<AlertDialogDescription>{description}</AlertDialogDescription>
)}
</AlertDialogHeader>
<div className="py-4 text-sm text-muted-foreground">
{message}
</div>
<AlertDialogFooter>
<AlertDialogCancel onClick={onCancel} className="cursor-pointer">
{cancelText}
</AlertDialogCancel>
<AlertDialogAction onClick={onConfirm} className="cursor-pointer">
{confirmText}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
}

View file

@ -0,0 +1,51 @@
// Importa os hooks useCallback e useState do React
import { useCallback, useState } from "react";
// Define a interface para opções do hook
// Permite que o usuário passe callbacks opcionais para confirmação e cancelamento
interface UseConfirmDialogOptions {
onConfirm?: () => void; // Função chamada quando o usuário confirma a ação
onCancel?: () => void; // Função chamada quando o usuário cancela a ação
}
// Declara o hook customizado useConfirmDialog
// Recebe um objeto de opções que contém os callbacks onConfirm e onCancel
export function useConfirmDialog({ onConfirm, onCancel }: UseConfirmDialogOptions = {}) {
// Estado interno que controla se o diálogo de confirmação está aberto
const [isOpen, setIsOpen] = useState(false);
// Função para abrir o diálogo
// useCallback memoriza a função para que não seja recriada em cada renderização
const openDialog = useCallback(() => setIsOpen(true), []);
// Função para fechar o diálogo
const closeDialog = useCallback(() => setIsOpen(false), []);
// Função chamada quando o usuário confirma a ação
// Executa o callback onConfirm, se fornecido, e fecha o diálogo
const handleConfirm = useCallback(() => {
onConfirm?.(); // Chama onConfirm somente se ele existir
closeDialog(); // Fecha o diálogo após a confirmação
}, [onConfirm, closeDialog]);
// Função chamada quando o usuário cancela a ação
// Executa o callback onCancel, se fornecido, e fecha o diálogo
const handleCancel = useCallback(() => {
onCancel?.(); // Chama onCancel somente se ele existir
closeDialog(); // Fecha o diálogo após o cancelamento
}, [onCancel, closeDialog]);
// Retorna os valores e funções que serão usados pelo componente
// isOpen -> estado do modal
// openDialog -> função para abrir o modal
// closeDialog -> função para fechar o modal
// handleConfirm -> função para confirmar a ação
// handleCancel -> função para cancelar a ação
return {
isOpen,
openDialog,
closeDialog,
handleConfirm,
handleCancel,
};
}

View 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>
);
}

View file

@ -6,8 +6,8 @@
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--font-sans: var(--font-geist-sans);
--font-mono: var(--font-geist-mono);
--font-sans: Inter, sans-serif;
--font-mono: JetBrains Mono, monospace;
--color-sidebar-ring: var(--sidebar-ring);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
@ -41,75 +41,142 @@
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
--font-serif: Source Serif 4, serif;
--radius: 0.375rem;
--tracking-tighter: calc(var(--tracking-normal) - 0.05em);
--tracking-tight: calc(var(--tracking-normal) - 0.025em);
--tracking-wide: calc(var(--tracking-normal) + 0.025em);
--tracking-wider: calc(var(--tracking-normal) + 0.05em);
--tracking-widest: calc(var(--tracking-normal) + 0.1em);
--tracking-normal: var(--tracking-normal);
--shadow-2xl: var(--shadow-2xl);
--shadow-xl: var(--shadow-xl);
--shadow-lg: var(--shadow-lg);
--shadow-md: var(--shadow-md);
--shadow: var(--shadow);
--shadow-sm: var(--shadow-sm);
--shadow-xs: var(--shadow-xs);
--shadow-2xs: var(--shadow-2xs);
--spacing: var(--spacing);
--letter-spacing: var(--letter-spacing);
--shadow-offset-y: var(--shadow-offset-y);
--shadow-offset-x: var(--shadow-offset-x);
--shadow-spread: var(--shadow-spread);
--shadow-blur: var(--shadow-blur);
--shadow-opacity: var(--shadow-opacity);
--color-shadow-color: var(--shadow-color);
--color-destructive-foreground: var(--destructive-foreground);
}
:root {
--radius: 0.625rem;
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
--card: oklch(1 0 0);
--card-foreground: oklch(0.145 0 0);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.145 0 0);
--primary: oklch(0.205 0 0);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.97 0 0);
--secondary-foreground: oklch(0.205 0 0);
--muted: oklch(0.97 0 0);
--muted-foreground: oklch(0.556 0 0);
--accent: oklch(0.97 0 0);
--accent-foreground: oklch(0.205 0 0);
--destructive: oklch(0.577 0.245 27.325);
--border: oklch(0.922 0 0);
--input: oklch(0.922 0 0);
--ring: oklch(0.708 0 0);
--chart-1: oklch(0.646 0.222 41.116);
--chart-2: oklch(0.6 0.118 184.704);
--chart-3: oklch(0.398 0.07 227.392);
--chart-4: oklch(0.828 0.189 84.429);
--chart-5: oklch(0.769 0.188 70.08);
--sidebar: oklch(0.985 0 0);
--sidebar-foreground: oklch(0.145 0 0);
--sidebar-primary: oklch(0.205 0 0);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.97 0 0);
--sidebar-accent-foreground: oklch(0.205 0 0);
--sidebar-border: oklch(0.922 0 0);
--sidebar-ring: oklch(0.708 0 0);
--radius: 0.375rem;
--background: oklch(1.0000 0 0);
--foreground: oklch(0.2686 0 0);
--card: oklch(1.0000 0 0);
--card-foreground: oklch(0.2686 0 0);
--popover: oklch(1.0000 0 0);
--popover-foreground: oklch(0.2686 0 0);
--primary: oklch(0.7686 0.1647 70.0804);
--primary-foreground: oklch(0 0 0);
--secondary: oklch(0.9670 0.0029 264.5419);
--secondary-foreground: oklch(0.4461 0.0263 256.8018);
--muted: oklch(0.9846 0.0017 247.8389);
--muted-foreground: oklch(0.5510 0.0234 264.3637);
--accent: oklch(0.9869 0.0214 95.2774);
--accent-foreground: oklch(0.4732 0.1247 46.2007);
--destructive: oklch(0.6368 0.2078 25.3313);
--border: oklch(0.9276 0.0058 264.5313);
--input: oklch(0.9276 0.0058 264.5313);
--ring: oklch(0.7686 0.1647 70.0804);
--chart-1: oklch(0.7686 0.1647 70.0804);
--chart-2: oklch(0.6658 0.1574 58.3183);
--chart-3: oklch(0.5553 0.1455 48.9975);
--chart-4: oklch(0.4732 0.1247 46.2007);
--chart-5: oklch(0.4137 0.1054 45.9038);
--sidebar: oklch(0.9846 0.0017 247.8389);
--sidebar-foreground: oklch(0.2686 0 0);
--sidebar-primary: oklch(0.7686 0.1647 70.0804);
--sidebar-primary-foreground: oklch(1.0000 0 0);
--sidebar-accent: oklch(0.9869 0.0214 95.2774);
--sidebar-accent-foreground: oklch(0.4732 0.1247 46.2007);
--sidebar-border: oklch(0.9276 0.0058 264.5313);
--sidebar-ring: oklch(0.7686 0.1647 70.0804);
--destructive-foreground: oklch(1.0000 0 0);
--font-sans: Inter, sans-serif;
--font-serif: Source Serif 4, serif;
--font-mono: JetBrains Mono, monospace;
--shadow-color: hsl(0 0% 0%);
--shadow-opacity: 0.1;
--shadow-blur: 8px;
--shadow-spread: -1px;
--shadow-offset-x: 0px;
--shadow-offset-y: 4px;
--letter-spacing: 0em;
--spacing: 0.25rem;
--shadow-2xs: 0px 4px 8px -1px hsl(0 0% 0% / 0.05);
--shadow-xs: 0px 4px 8px -1px hsl(0 0% 0% / 0.05);
--shadow-sm: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 1px 2px -2px hsl(0 0% 0% / 0.10);
--shadow: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 1px 2px -2px hsl(0 0% 0% / 0.10);
--shadow-md: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 2px 4px -2px hsl(0 0% 0% / 0.10);
--shadow-lg: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 4px 6px -2px hsl(0 0% 0% / 0.10);
--shadow-xl: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 8px 10px -2px hsl(0 0% 0% / 0.10);
--shadow-2xl: 0px 4px 8px -1px hsl(0 0% 0% / 0.25);
--tracking-normal: 0em;
}
.dark {
--background: oklch(0.145 0 0);
--foreground: oklch(0.985 0 0);
--card: oklch(0.205 0 0);
--card-foreground: oklch(0.985 0 0);
--popover: oklch(0.205 0 0);
--popover-foreground: oklch(0.985 0 0);
--primary: oklch(0.922 0 0);
--primary-foreground: oklch(0.205 0 0);
--secondary: oklch(0.269 0 0);
--secondary-foreground: oklch(0.985 0 0);
--muted: oklch(0.269 0 0);
--muted-foreground: oklch(0.708 0 0);
--accent: oklch(0.269 0 0);
--accent-foreground: oklch(0.985 0 0);
--destructive: oklch(0.704 0.191 22.216);
--border: oklch(1 0 0 / 10%);
--input: oklch(1 0 0 / 15%);
--ring: oklch(0.556 0 0);
--chart-1: oklch(0.488 0.243 264.376);
--chart-2: oklch(0.696 0.17 162.48);
--chart-3: oklch(0.769 0.188 70.08);
--chart-4: oklch(0.627 0.265 303.9);
--chart-5: oklch(0.645 0.246 16.439);
--sidebar: oklch(0.205 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.269 0 0);
--sidebar-accent-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(1 0 0 / 10%);
--sidebar-ring: oklch(0.556 0 0);
--background: oklch(0.2046 0 0);
--foreground: oklch(0.9219 0 0);
--card: oklch(0.2686 0 0);
--card-foreground: oklch(0.9219 0 0);
--popover: oklch(0.2686 0 0);
--popover-foreground: oklch(0.9219 0 0);
--primary: oklch(0.7686 0.1647 70.0804);
--primary-foreground: oklch(0 0 0);
--secondary: oklch(0.2686 0 0);
--secondary-foreground: oklch(0.9219 0 0);
--muted: oklch(0.2686 0 0);
--muted-foreground: oklch(0.7155 0 0);
--accent: oklch(0.4732 0.1247 46.2007);
--accent-foreground: oklch(0.9243 0.1151 95.7459);
--destructive: oklch(0.6368 0.2078 25.3313);
--border: oklch(0.3715 0 0);
--input: oklch(0.3715 0 0);
--ring: oklch(0.7686 0.1647 70.0804);
--chart-1: oklch(0.8369 0.1644 84.4286);
--chart-2: oklch(0.6658 0.1574 58.3183);
--chart-3: oklch(0.4732 0.1247 46.2007);
--chart-4: oklch(0.5553 0.1455 48.9975);
--chart-5: oklch(0.4732 0.1247 46.2007);
--sidebar: oklch(0.1684 0 0);
--sidebar-foreground: oklch(0.9219 0 0);
--sidebar-primary: oklch(0.7686 0.1647 70.0804);
--sidebar-primary-foreground: oklch(1.0000 0 0);
--sidebar-accent: oklch(0.4732 0.1247 46.2007);
--sidebar-accent-foreground: oklch(0.9243 0.1151 95.7459);
--sidebar-border: oklch(0.3715 0 0);
--sidebar-ring: oklch(0.7686 0.1647 70.0804);
--destructive-foreground: oklch(1.0000 0 0);
--radius: 0.375rem;
--font-sans: Inter, sans-serif;
--font-serif: Source Serif 4, serif;
--font-mono: JetBrains Mono, monospace;
--shadow-color: hsl(0 0% 0%);
--shadow-opacity: 0.1;
--shadow-blur: 8px;
--shadow-spread: -1px;
--shadow-offset-x: 0px;
--shadow-offset-y: 4px;
--letter-spacing: 0em;
--spacing: 0.25rem;
--shadow-2xs: 0px 4px 8px -1px hsl(0 0% 0% / 0.05);
--shadow-xs: 0px 4px 8px -1px hsl(0 0% 0% / 0.05);
--shadow-sm: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 1px 2px -2px hsl(0 0% 0% / 0.10);
--shadow: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 1px 2px -2px hsl(0 0% 0% / 0.10);
--shadow-md: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 2px 4px -2px hsl(0 0% 0% / 0.10);
--shadow-lg: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 4px 6px -2px hsl(0 0% 0% / 0.10);
--shadow-xl: 0px 4px 8px -1px hsl(0 0% 0% / 0.10), 0px 8px 10px -2px hsl(0 0% 0% / 0.10);
--shadow-2xl: 0px 4px 8px -1px hsl(0 0% 0% / 0.25);
}
@layer base {
@ -118,8 +185,9 @@
}
body {
@apply bg-background text-foreground;
letter-spacing: var(--tracking-normal);
}
.bg-brand{
background-color: #1A292F;
}
}
}

View file

@ -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: "#",
@ -64,21 +77,17 @@ const data = {
],
},
{
title: "Models",
title: "Cadastros",
url: "#",
icon: Bot,
items: [
{
title: "Genesis",
url: "#",
title: "Reconhecimentos",
url: "/cadastros/reconhecimentos/",
},
{
title: "Explorer",
url: "#",
},
{
title: "Quantum",
url: "#",
title: "Andamentos",
url: "/cadastros/andamentos/",
},
],
},

View file

@ -0,0 +1,157 @@
"use client"
import * as React from "react"
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
import { cn } from "@/lib/utils"
import { buttonVariants } from "@/components/ui/button"
function AlertDialog({
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
}
function AlertDialogTrigger({
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
return (
<AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
)
}
function AlertDialogPortal({
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
return (
<AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
)
}
function AlertDialogOverlay({
className,
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
return (
<AlertDialogPrimitive.Overlay
data-slot="alert-dialog-overlay"
className={cn(
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
className
)}
{...props}
/>
)
}
function AlertDialogContent({
className,
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
return (
<AlertDialogPortal>
<AlertDialogOverlay />
<AlertDialogPrimitive.Content
data-slot="alert-dialog-content"
className={cn(
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
className
)}
{...props}
/>
</AlertDialogPortal>
)
}
function AlertDialogHeader({
className,
...props
}: React.ComponentProps<"div">) {
return (
<div
data-slot="alert-dialog-header"
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
{...props}
/>
)
}
function AlertDialogFooter({
className,
...props
}: React.ComponentProps<"div">) {
return (
<div
data-slot="alert-dialog-footer"
className={cn(
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
className
)}
{...props}
/>
)
}
function AlertDialogTitle({
className,
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
return (
<AlertDialogPrimitive.Title
data-slot="alert-dialog-title"
className={cn("text-lg font-semibold", className)}
{...props}
/>
)
}
function AlertDialogDescription({
className,
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
return (
<AlertDialogPrimitive.Description
data-slot="alert-dialog-description"
className={cn("text-muted-foreground text-sm", className)}
{...props}
/>
)
}
function AlertDialogAction({
className,
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
return (
<AlertDialogPrimitive.Action
className={cn(buttonVariants(), className)}
{...props}
/>
)
}
function AlertDialogCancel({
className,
...props
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
return (
<AlertDialogPrimitive.Cancel
className={cn(buttonVariants({ variant: "outline" }), className)}
{...props}
/>
)
}
export {
AlertDialog,
AlertDialogPortal,
AlertDialogOverlay,
AlertDialogTrigger,
AlertDialogContent,
AlertDialogHeader,
AlertDialogFooter,
AlertDialogTitle,
AlertDialogDescription,
AlertDialogAction,
AlertDialogCancel,
}

View file

@ -0,0 +1,32 @@
"use client"
import * as React from "react"
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
import { CheckIcon } from "lucide-react"
import { cn } from "@/lib/utils"
function Checkbox({
className,
...props
}: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
return (
<CheckboxPrimitive.Root
data-slot="checkbox"
className={cn(
"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
className
)}
{...props}
>
<CheckboxPrimitive.Indicator
data-slot="checkbox-indicator"
className="flex items-center justify-center text-current transition-none"
>
<CheckIcon className="size-3.5" />
</CheckboxPrimitive.Indicator>
</CheckboxPrimitive.Root>
)
}
export { Checkbox }

View file

@ -0,0 +1,143 @@
"use client"
import * as React from "react"
import * as DialogPrimitive from "@radix-ui/react-dialog"
import { XIcon } from "lucide-react"
import { cn } from "@/lib/utils"
function Dialog({
...props
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
return <DialogPrimitive.Root data-slot="dialog" {...props} />
}
function DialogTrigger({
...props
}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
}
function DialogPortal({
...props
}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
}
function DialogClose({
...props
}: React.ComponentProps<typeof DialogPrimitive.Close>) {
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
}
function DialogOverlay({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
return (
<DialogPrimitive.Overlay
data-slot="dialog-overlay"
className={cn(
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
className
)}
{...props}
/>
)
}
function DialogContent({
className,
children,
showCloseButton = true,
...props
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
showCloseButton?: boolean
}) {
return (
<DialogPortal data-slot="dialog-portal">
<DialogOverlay />
<DialogPrimitive.Content
data-slot="dialog-content"
className={cn(
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
className
)}
{...props}
>
{children}
{showCloseButton && (
<DialogPrimitive.Close
data-slot="dialog-close"
className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
>
<XIcon />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
)}
</DialogPrimitive.Content>
</DialogPortal>
)
}
function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="dialog-header"
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
{...props}
/>
)
}
function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="dialog-footer"
className={cn(
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
className
)}
{...props}
/>
)
}
function DialogTitle({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Title>) {
return (
<DialogPrimitive.Title
data-slot="dialog-title"
className={cn("text-lg leading-none font-semibold", className)}
{...props}
/>
)
}
function DialogDescription({
className,
...props
}: React.ComponentProps<typeof DialogPrimitive.Description>) {
return (
<DialogPrimitive.Description
data-slot="dialog-description"
className={cn("text-muted-foreground text-sm", className)}
{...props}
/>
)
}
export {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogOverlay,
DialogPortal,
DialogTitle,
DialogTrigger,
}

View file

@ -0,0 +1,48 @@
"use client"
import * as React from "react"
import * as PopoverPrimitive from "@radix-ui/react-popover"
import { cn } from "@/lib/utils"
function Popover({
...props
}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
return <PopoverPrimitive.Root data-slot="popover" {...props} />
}
function PopoverTrigger({
...props
}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
}
function PopoverContent({
className,
align = "center",
sideOffset = 4,
...props
}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
return (
<PopoverPrimitive.Portal>
<PopoverPrimitive.Content
data-slot="popover-content"
align={align}
sideOffset={sideOffset}
className={cn(
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
className
)}
{...props}
/>
</PopoverPrimitive.Portal>
)
}
function PopoverAnchor({
...props
}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />
}
export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }

View file

@ -0,0 +1,185 @@
"use client"
import * as React from "react"
import * as SelectPrimitive from "@radix-ui/react-select"
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react"
import { cn } from "@/lib/utils"
function Select({
...props
}: React.ComponentProps<typeof SelectPrimitive.Root>) {
return <SelectPrimitive.Root data-slot="select" {...props} />
}
function SelectGroup({
...props
}: React.ComponentProps<typeof SelectPrimitive.Group>) {
return <SelectPrimitive.Group data-slot="select-group" {...props} />
}
function SelectValue({
...props
}: React.ComponentProps<typeof SelectPrimitive.Value>) {
return <SelectPrimitive.Value data-slot="select-value" {...props} />
}
function SelectTrigger({
className,
size = "default",
children,
...props
}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
size?: "sm" | "default"
}) {
return (
<SelectPrimitive.Trigger
data-slot="select-trigger"
data-size={size}
className={cn(
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className
)}
{...props}
>
{children}
<SelectPrimitive.Icon asChild>
<ChevronDownIcon className="size-4 opacity-50" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
)
}
function SelectContent({
className,
children,
position = "popper",
...props
}: React.ComponentProps<typeof SelectPrimitive.Content>) {
return (
<SelectPrimitive.Portal>
<SelectPrimitive.Content
data-slot="select-content"
className={cn(
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
position === "popper" &&
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className
)}
position={position}
{...props}
>
<SelectScrollUpButton />
<SelectPrimitive.Viewport
className={cn(
"p-1",
position === "popper" &&
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
)}
>
{children}
</SelectPrimitive.Viewport>
<SelectScrollDownButton />
</SelectPrimitive.Content>
</SelectPrimitive.Portal>
)
}
function SelectLabel({
className,
...props
}: React.ComponentProps<typeof SelectPrimitive.Label>) {
return (
<SelectPrimitive.Label
data-slot="select-label"
className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
{...props}
/>
)
}
function SelectItem({
className,
children,
...props
}: React.ComponentProps<typeof SelectPrimitive.Item>) {
return (
<SelectPrimitive.Item
data-slot="select-item"
className={cn(
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
className
)}
{...props}
>
<span className="absolute right-2 flex size-3.5 items-center justify-center">
<SelectPrimitive.ItemIndicator>
<CheckIcon className="size-4" />
</SelectPrimitive.ItemIndicator>
</span>
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
</SelectPrimitive.Item>
)
}
function SelectSeparator({
className,
...props
}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
return (
<SelectPrimitive.Separator
data-slot="select-separator"
className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
{...props}
/>
)
}
function SelectScrollUpButton({
className,
...props
}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
return (
<SelectPrimitive.ScrollUpButton
data-slot="select-scroll-up-button"
className={cn(
"flex cursor-default items-center justify-center py-1",
className
)}
{...props}
>
<ChevronUpIcon className="size-4" />
</SelectPrimitive.ScrollUpButton>
)
}
function SelectScrollDownButton({
className,
...props
}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
return (
<SelectPrimitive.ScrollDownButton
data-slot="select-scroll-down-button"
className={cn(
"flex cursor-default items-center justify-center py-1",
className
)}
{...props}
>
<ChevronDownIcon className="size-4" />
</SelectPrimitive.ScrollDownButton>
)
}
export {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectLabel,
SelectScrollDownButton,
SelectScrollUpButton,
SelectSeparator,
SelectTrigger,
SelectValue,
}

View file

@ -1,6 +1,5 @@
import Json from '@/actions/json/Json';
import ApiInterface from './interfaces/ApiInterface';
import Response from '@/services/response/Response';
import TokenGet from '@/actions/token/TokenGet';
import ApiSchema from '@/services/api/schemas/ApiSchema';
@ -17,7 +16,7 @@ export default class API {
this.ApiSchema = new ApiSchema();
// Obtem as configurações da aplicação
this.config = Json.execute('config/app.json');
this.config = Json.execute();
}
@ -49,7 +48,7 @@ export default class API {
console.log("URL:: " + `http://api-saas-api-homologacao:8000/administrativo/g_usuario/authenticate`)
// Realiza a requisição
const response = await fetch(`http://api-saas-api-homologacao:8000/administrativo/g_usuario/authenticate`, {
const response = await fetch(`${this.ApiSchema.url}${this.ApiSchema.prefix}${this.ApiSchema.endpoint}`, {
method: _data.method,
headers: {
"Accept": `${this.ApiSchema.contentType}`,