Merge remote-tracking branch 'origin/release(MVP/Sprint6)' into MVPTN-86
This commit is contained in:
commit
742c9bc38f
382 changed files with 4639 additions and 17454 deletions
14
package-lock.json
generated
14
package-lock.json
generated
|
|
@ -30,6 +30,7 @@
|
|||
"cmdk": "^1.1.1",
|
||||
"cookies-next": "^6.1.0",
|
||||
"faker-js": "^1.0.0",
|
||||
"input-otp": "^1.4.2",
|
||||
"js-cookie": "^3.0.5",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"jwt-decode": "^4.0.0",
|
||||
|
|
@ -4936,6 +4937,16 @@
|
|||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/input-otp": {
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/input-otp/-/input-otp-1.4.2.tgz",
|
||||
"integrity": "sha512-l3jWwYNvrEa6NTCt7BECfCm48GvwuZzkoeG3gBL2w4CHeOXW3eKFmf9UNYkNfYc3mxMrthMnxjIE07MT0zLBQA==",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0.0 || ^19.0.0-rc",
|
||||
"react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0.0 || ^19.0.0-rc"
|
||||
}
|
||||
},
|
||||
"node_modules/internal-slot": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz",
|
||||
|
|
@ -5419,7 +5430,6 @@
|
|||
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
<<<<<<< HEAD
|
||||
"node_modules/js-yaml": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||
|
|
@ -5467,8 +5477,6 @@
|
|||
"json5": "lib/cli.js"
|
||||
}
|
||||
},
|
||||
=======
|
||||
>>>>>>> origin/MVPTN-90
|
||||
"node_modules/jsonwebtoken": {
|
||||
"version": "9.0.2",
|
||||
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz",
|
||||
|
|
|
|||
|
|
@ -7,9 +7,7 @@
|
|||
"dev": "next dev --turbopack",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"lint:fix": "npm run lint -- --fix",
|
||||
"format": "prettier --write . --ignore-path .gitignore"
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@faker-js/faker": "^10.0.0",
|
||||
|
|
@ -34,6 +32,7 @@
|
|||
"cmdk": "^1.1.1",
|
||||
"cookies-next": "^6.1.0",
|
||||
"faker-js": "^1.0.0",
|
||||
"input-otp": "^1.4.2",
|
||||
"js-cookie": "^3.0.5",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"jwt-decode": "^4.0.0",
|
||||
|
|
@ -71,4 +70,4 @@
|
|||
"tw-animate-css": "^1.3.7",
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
import { UseFormReturn, FieldValues } from "react-hook-form";
|
||||
|
||||
/**
|
||||
* Reseta o formulário com os dados recebidos (se existirem)
|
||||
* @param form - Instância do react-hook-form
|
||||
* @param data - Dados para popular o formulário
|
||||
*/
|
||||
export function ResetFormIfData<T extends FieldValues>(
|
||||
form: UseFormReturn<T>,
|
||||
data: T | null
|
||||
) {
|
||||
if (data) {
|
||||
form.reset(data);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@ import { useParams } from 'next/navigation';
|
|||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { useGUsuarioReadHooks } from '@/app/(protected)/(administrativo)/_hooks/g_usuario/useGUsuarioReadHooks';
|
||||
import Usuario from '@/app/(protected)/(administrativo)/_interfaces/GUsuarioInterface';
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
|
||||
export default function UsuarioDetalhes() {
|
||||
const params = useParams();
|
||||
|
|
@ -17,7 +17,6 @@ export default function UsuarioDetalhes() {
|
|||
if (params.id) {
|
||||
fetchUsuario({ usuario_id: Number(params.id) } as Usuario);
|
||||
}
|
||||
console.log('pagina', usuario);
|
||||
}, []);
|
||||
|
||||
if (!usuario) return <Loading type={1} />;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import { Button } from '@/components/ui/button';
|
|||
import Link from 'next/link';
|
||||
import { useGUsuarioIndexHook } from '../../_hooks/g_usuario/useGUsuarioIndexHook';
|
||||
import { useEffect } from 'react';
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
|
||||
export default function UsuarioPage() {
|
||||
const { usuarios, fetchUsuarios } = useGUsuarioIndexHook();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use server';
|
||||
|
||||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function GUsuarioDeleteData(usuarioId: number) {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use server';
|
||||
|
||||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function GUsuarioIndexData() {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use server';
|
||||
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import API from '@/shared/services/api/Api';
|
||||
|
||||
export default async function GUsuarioLoginData(form: any) {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use server';
|
||||
|
||||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function GUsuarioReadData(usuarioId: number) {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use server';
|
||||
|
||||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function GUsuarioSaveData(form: any) {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
import { useState } from 'react';
|
||||
import Usuario from '../../_interfaces/GUsuarioInterface';
|
||||
import GUsuarioIndex from '../../_services/g_usuario/GUsuarioIndex';
|
||||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
export const useGUsuarioIndexHook = () => {
|
||||
const { setResponse } = useResponse();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
import { useState } from 'react';
|
||||
import Usuario from '../../_interfaces/GUsuarioInterface';
|
||||
import GUsuarioRead from '../../_services/g_usuario/GUsuarioRead';
|
||||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
export const useGUsuarioReadHooks = () => {
|
||||
const { setResponse } = useResponse();
|
||||
|
|
@ -12,10 +12,7 @@ export const useGUsuarioReadHooks = () => {
|
|||
|
||||
const fetchUsuario = async (Usuario: Usuario) => {
|
||||
const response = await GUsuarioRead(Usuario.usuario_id);
|
||||
console.log('hook', response.data);
|
||||
|
||||
setUsuario(response.data);
|
||||
|
||||
setResponse(response);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
import { useState } from 'react';
|
||||
import Usuario from '../../_interfaces/GUsuarioInterface';
|
||||
import GUsuarioSave from '../../_services/g_usuario/GUsuarioSave';
|
||||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
export const useGUsuarioSaveHook = () => {
|
||||
const { setResponse } = useResponse();
|
||||
|
|
|
|||
|
|
@ -30,5 +30,5 @@ export default async function GUsuarioLoginService(form: any) {
|
|||
});
|
||||
|
||||
// Redireciona para a págian desejada
|
||||
redirect('/servicos');
|
||||
redirect('/');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,12 +11,6 @@ export default async function GUsuarioRead(usuarioId: number) {
|
|||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await GUsuarioReadData(usuarioId);
|
||||
console.log('service', response);
|
||||
return response;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return error;
|
||||
}
|
||||
const response = await GUsuarioReadData(usuarioId);
|
||||
return response;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
'use client';
|
||||
|
||||
import TImovelIndex from "@/packages/administrativo/components/TImovel/TImovelIndex";
|
||||
|
||||
export default function TImovelRuralPage() {
|
||||
return (
|
||||
<TImovelIndex
|
||||
pageTitle="Imóveis Rurais"
|
||||
pageDescription="Gerenciamento de imóveis rurais"
|
||||
tipoClasse={3}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
'use client';
|
||||
|
||||
import TImovelIndex from "@/packages/administrativo/components/TImovel/TImovelIndex";
|
||||
|
||||
export default function TImovelUrbanoPage() {
|
||||
return (
|
||||
<TImovelIndex
|
||||
pageTitle="Imóveis Urbanos"
|
||||
pageDescription="Gerenciamento de imóveis urbanos"
|
||||
tipoClasse={1}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,166 +1,9 @@
|
|||
'use client';
|
||||
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import TPessoaTable from '@/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaTable';
|
||||
import TPessoaForm from '@/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaForm';
|
||||
|
||||
import { useTPessoaIndexHook } from '@/packages/administrativo/hooks/t_pessoa/useTPessoaIndexHook';
|
||||
import { useTPessoaSaveHook } from '@/packages/administrativo/hooks/t_pessoa/useTPessoaSaveHook';
|
||||
import { useTPessoaDeleteHook } from '@/packages/administrativo/hooks/t_pessoa/useTPessoaDeleteHook';
|
||||
|
||||
import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog';
|
||||
|
||||
import TPessoaInterface from '@/packages/administrativo/interfaces/TPessoa/TPessoaInterface';
|
||||
import Header from '@/app/_components/structure/Header';
|
||||
import TPessoaFisicaIndex from '@/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaIndex';
|
||||
|
||||
export default function TPessoaFisica() {
|
||||
// Controle de estado do botão
|
||||
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
||||
|
||||
// Hooks para leitura e salvamento
|
||||
const { tPessoa, fetchTPessoa } = useTPessoaIndexHook();
|
||||
const { saveTCensec } = useTPessoaSaveHook();
|
||||
const { deleteTCensec } = useTPessoaDeleteHook();
|
||||
|
||||
// Estados
|
||||
const [selectedAndamento, setSelectedAndamento] = useState<TPessoaInterface | null>(null);
|
||||
const [isFormOpen, setIsFormOpen] = useState(false);
|
||||
|
||||
// Estado para saber qual item será deletado
|
||||
const [itemToDelete, setItemToDelete] = useState<TPessoaInterface | 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: TPessoaInterface | 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: TPessoaInterface) => {
|
||||
// Coloca o botão em estado de loading
|
||||
setButtonIsLoading(true);
|
||||
|
||||
// Aguarda salvar o registro
|
||||
await saveTCensec(formData);
|
||||
|
||||
// Remove o botão em estado de loading
|
||||
setButtonIsLoading(false);
|
||||
|
||||
// Atualiza a lista de dados
|
||||
fetchTPessoa();
|
||||
},
|
||||
[saveTCensec, fetchTPessoa, handleCloseForm],
|
||||
);
|
||||
|
||||
/**
|
||||
* Quando o usuário clica em "remover" na tabela
|
||||
*/
|
||||
const handleConfirmDelete = useCallback(
|
||||
(item: TPessoaInterface) => {
|
||||
// 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 deleteTCensec(itemToDelete);
|
||||
|
||||
// Atualiza a lista
|
||||
await fetchTPessoa();
|
||||
|
||||
// Limpa o item selecionado
|
||||
setItemToDelete(null);
|
||||
|
||||
// Fecha o modal
|
||||
handleCancel();
|
||||
}, [itemToDelete, fetchTPessoa, handleCancel]);
|
||||
|
||||
/**
|
||||
* Busca inicial dos dados
|
||||
*/
|
||||
useEffect(() => {
|
||||
fetchTPessoa();
|
||||
}, []);
|
||||
|
||||
/**
|
||||
* Tela de loading enquanto carrega os dados
|
||||
*/
|
||||
if (tPessoa.length == 0) {
|
||||
return <Loading type={2} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
{/* Cabeçalho */}
|
||||
<Header
|
||||
title={'Pessoas Físicas'}
|
||||
description={'Gerenciamento de pessoas físicas'}
|
||||
buttonText={'Nova Pessoa'}
|
||||
buttonAction={() => {
|
||||
handleOpenForm(null);
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* Tabela de Registros */}
|
||||
<TPessoaTable data={tPessoa} onDelete={handleConfirmDelete} onEdit={handleOpenForm} />
|
||||
|
||||
{/* Modal de confirmação */}
|
||||
<ConfirmDialog
|
||||
isOpen={isConfirmOpen}
|
||||
title="Confirmar exclusão"
|
||||
description="Atenção"
|
||||
message={`Deseja realmente excluir o andamento "${itemToDelete?.nome}"?`}
|
||||
confirmText="Sim, excluir"
|
||||
cancelText="Cancelar"
|
||||
onConfirm={handleDelete}
|
||||
onCancel={handleCancel}
|
||||
/>
|
||||
|
||||
{/* Formulário de criação/edição */}
|
||||
<TPessoaForm
|
||||
isOpen={isFormOpen}
|
||||
data={selectedAndamento}
|
||||
onClose={handleCloseForm}
|
||||
onSave={handleSave}
|
||||
buttonIsLoading={buttonIsLoading}
|
||||
/>
|
||||
</div>
|
||||
<TPessoaFisicaIndex />
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,166 +1,10 @@
|
|||
'use client';
|
||||
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
|
||||
import { useTPessoaSaveHook } from '@/packages/administrativo/hooks/t_pessoa/useTPessoaSaveHook';
|
||||
import { useTPessoaDeleteHook } from '@/packages/administrativo/hooks/t_pessoa/useTPessoaDeleteHook';
|
||||
|
||||
import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog';
|
||||
|
||||
import TPessoaInterface from '@/packages/administrativo/interfaces/TPessoa/TPessoaInterface';
|
||||
import Header from '@/app/_components/structure/Header';
|
||||
import TPessoaJuridicaTable from '@/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaTable';
|
||||
import { useTPessoaJuridicaIndexHook } from '@/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaIndexHook';
|
||||
import TPessoaJuridicaForm from '@/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaForm';
|
||||
import TPessoaJuridicaIndex from '@/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaIndex';
|
||||
|
||||
export default function TPessoaFisica() {
|
||||
// Controle de estado do botão
|
||||
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
||||
|
||||
// Hooks para leitura e salvamento
|
||||
const { tPessoa, fetchTPessoa } = useTPessoaJuridicaIndexHook();
|
||||
const { saveTCensec } = useTPessoaSaveHook();
|
||||
const { deleteTCensec } = useTPessoaDeleteHook();
|
||||
|
||||
// Estados
|
||||
const [selectedAndamento, setSelectedAndamento] = useState<TPessoaInterface | null>(null);
|
||||
const [isFormOpen, setIsFormOpen] = useState(false);
|
||||
|
||||
// Estado para saber qual item será deletado
|
||||
const [itemToDelete, setItemToDelete] = useState<TPessoaInterface | 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: TPessoaInterface | 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: TPessoaInterface) => {
|
||||
// Coloca o botão em estado de loading
|
||||
setButtonIsLoading(true);
|
||||
|
||||
// Aguarda salvar o registro
|
||||
await saveTCensec(formData);
|
||||
|
||||
// Remove o botão em estado de loading
|
||||
setButtonIsLoading(false);
|
||||
|
||||
// Atualiza a lista de dados
|
||||
fetchTPessoa();
|
||||
},
|
||||
[saveTCensec, fetchTPessoa, handleCloseForm],
|
||||
);
|
||||
|
||||
/**
|
||||
* Quando o usuário clica em "remover" na tabela
|
||||
*/
|
||||
const handleConfirmDelete = useCallback(
|
||||
(item: TPessoaInterface) => {
|
||||
// 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 deleteTCensec(itemToDelete);
|
||||
|
||||
// Atualiza a lista
|
||||
await fetchTPessoa();
|
||||
|
||||
// Limpa o item selecionado
|
||||
setItemToDelete(null);
|
||||
|
||||
// Fecha o modal
|
||||
handleCancel();
|
||||
}, [itemToDelete, fetchTPessoa, handleCancel]);
|
||||
|
||||
/**
|
||||
* Busca inicial dos dados
|
||||
*/
|
||||
useEffect(() => {
|
||||
fetchTPessoa();
|
||||
}, []);
|
||||
|
||||
/**
|
||||
* Tela de loading enquanto carrega os dados
|
||||
*/
|
||||
if (tPessoa.length == 0) {
|
||||
return <Loading type={2} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
{/* Cabeçalho */}
|
||||
<Header
|
||||
title={'Pessoas Jurídicas'}
|
||||
description={'Gerenciamento de pessoas jurídicas'}
|
||||
buttonText={'Nova Pessoa'}
|
||||
buttonAction={() => {
|
||||
handleOpenForm(null);
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* Tabela de Registros */}
|
||||
<TPessoaJuridicaTable data={tPessoa} onDelete={handleConfirmDelete} onEdit={handleOpenForm} />
|
||||
|
||||
{/* Modal de confirmação */}
|
||||
<ConfirmDialog
|
||||
isOpen={isConfirmOpen}
|
||||
title="Confirmar exclusão"
|
||||
description="Atenção"
|
||||
message={`Deseja realmente excluir o andamento "${itemToDelete?.nome}"?`}
|
||||
confirmText="Sim, excluir"
|
||||
cancelText="Cancelar"
|
||||
onConfirm={handleDelete}
|
||||
onCancel={handleCancel}
|
||||
/>
|
||||
|
||||
{/* Formulário de criação/edição */}
|
||||
<TPessoaJuridicaForm
|
||||
isOpen={isFormOpen}
|
||||
data={selectedAndamento}
|
||||
onClose={handleCloseForm}
|
||||
onSave={handleSave}
|
||||
buttonIsLoading={buttonIsLoading}
|
||||
/>
|
||||
</div>
|
||||
<TPessoaJuridicaIndex />
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GCidadeTable from '../../_components/g_cidade/GCidadeTable';
|
||||
import GCidadeForm from '../../_components/g_cidade/GCidadeForm';
|
||||
|
||||
|
|
@ -11,11 +11,11 @@ import { useGCidadeReadHook } from '../../_hooks/g_cidade/useGCidadeReadHook';
|
|||
import { useGCidadeSaveHook } from '../../_hooks/g_cidade/useGCidadeSaveHook';
|
||||
import { useGCidadeRemoveHook } from '../../_hooks/g_cidade/useGCidadeRemoveHook';
|
||||
|
||||
import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
|
||||
import GCidadeInterface from '../../_interfaces/GCidadeInterface';
|
||||
import Header from '@/app/_components/structure/Header';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
|
||||
export default function GCidadePage() {
|
||||
// Hooks para leitura e salvamento
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog';
|
||||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
import Header from '@/app/_components/structure/Header';
|
||||
import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog';
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GMedidaTipoTable from '../../_components/g_medidatipo/GMedidaTipoTable';
|
||||
import GMedidaTipoForm from '../../_components/g_medidatipo/GMedidaTipoForm';
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ import { useGMedidaTipoSaveHook } from '../../_hooks/g_medidatipo/useGMedidaTipo
|
|||
import { useGMedidaTipoRemoveHook } from '../../_hooks/g_medidatipo/useGMedidaTipoRemoveHook';
|
||||
|
||||
import { GMedidaTipoInterface } from '../../_interfaces/GMedidaTipoInterface';
|
||||
import { SituacoesEnum } from '@/enums/SituacoesEnum';
|
||||
import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||
|
||||
const initialMedidaTipo: GMedidaTipoInterface = {
|
||||
medida_tipo_id: 0,
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog';
|
||||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
import Header from '@/app/_components/structure/Header';
|
||||
import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog';
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GTBBairroTable from '../../_components/g_tb_bairro/GTBBairroTable';
|
||||
import GTBBairroForm from '../../_components/g_tb_bairro/GTBBairroForm';
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ import { useGTBBairroSaveHook } from '../../_hooks/g_tb_bairro/useGTBBairroSaveH
|
|||
import { useGTBBairroRemoveHook } from '../../_hooks/g_tb_bairro/useGTBBairroRemoveHook';
|
||||
|
||||
import { GTBBairroInterface } from '../../_interfaces/GTBBairroInterface';
|
||||
import { SituacoesEnum } from '@/enums/SituacoesEnum';
|
||||
import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||
|
||||
const initialBairro: GTBBairroInterface = {
|
||||
sistema_id: null,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
|
||||
import Header from '@/app/_components/structure/Header';
|
||||
import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog';
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GTBEstadoCivilTable from '../../_components/g_tb_estadocivil/GTBEstadoCivilTable';
|
||||
import GTBEstadoCivilForm from '../../_components/g_tb_estadocivil/GTBEstadoCivilForm';
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ import { useGTBEstadoCivilSaveHook } from '../../_hooks/g_tb_estadocivil/useGTBE
|
|||
import { useGTBEstadoCivilRemoveHook } from '../../_hooks/g_tb_estadocivil/useGTBEstadoCivilRemoveHook';
|
||||
|
||||
import { GTBEstadoCivilInterface } from '../../_interfaces/GTBEstadoCivilInterface';
|
||||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
const initalEstadoCivil: GTBEstadoCivilInterface = {
|
||||
tb_estadocivil_id: 0,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GTBProfissaoTable from '../../_components/g_tb_profissao/GTBProfissaoTable';
|
||||
import GTBProfissaoForm from '../../_components/g_tb_profissao/GTBProfissaoForm';
|
||||
|
||||
|
|
@ -11,11 +11,11 @@ import { useGTBProfissaoReadHook } from '../../_hooks/g_tb_profissao/useGTBProfi
|
|||
import { useGTBProfissaoSaveHook } from '../../_hooks/g_tb_profissao/useGTBProfissaoSaveHook';
|
||||
import { useGTBProfissaoRemoveHook } from '../../_hooks/g_tb_profissao/useGTBProfissaoRemoveHook';
|
||||
|
||||
import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
|
||||
import GTBProfissaoInterface from '../../_interfaces/GTBProfissaoInterface';
|
||||
import Header from '@/app/_components/structure/Header';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
|
||||
export default function TTBAndamentoServico() {
|
||||
// Hooks para leitura e salvamento
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GTBRegimeBensTable from '../../_components/g_tb_regimebens/GTBRegimeBensTable';
|
||||
import GTBRegimeBensForm from '../../_components/g_tb_regimebens/GTBRegimeBensForm';
|
||||
|
||||
|
|
@ -11,11 +11,11 @@ import { useGTBRegimeBensReadHook } from '../../_hooks/g_tb_regimebens/useGTBReg
|
|||
import { useGTBRegimeBensSaveHook } from '../../_hooks/g_tb_regimebens/useGTBRegimeBensSaveHook';
|
||||
import { useGTBRegimeBensRemoveHook } from '../../_hooks/g_tb_regimebens/useGTBRegimeBensRemoveHook';
|
||||
|
||||
import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
|
||||
import GTBRegimeBensInterface from '../../_interfaces/GTBRegimeBensInterface';
|
||||
import Header from '@/app/_components/structure/Header';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
|
||||
export default function TTBAndamentoServico() {
|
||||
// Hooks para leitura e salvamento
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GTBRegimeComunhaoTable from '../../_components/g_tb_regimecomunhao/GTBRegimeComunhaoTable';
|
||||
import GTBRegimeComunhaoForm from '../../_components/g_tb_regimecomunhao/GTBRegimeComunhaoForm';
|
||||
|
||||
|
|
@ -11,11 +11,11 @@ import { useGTBRegimeComunhaoReadHook } from '../../_hooks/g_tb_regimecomunhao/u
|
|||
import { useGTBRegimeComunhaoSaveHook } from '../../_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoSaveHook';
|
||||
import { useGTBRegimeComunhaoRemoveHook } from '../../_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoRemoveHook';
|
||||
|
||||
import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
|
||||
import GTBRegimeComunhaoInterface from '../../_interfaces/GTBRegimeComunhaoInterface';
|
||||
import Header from '@/app/_components/structure/Header';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
|
||||
export default function TTBAndamentoServico() {
|
||||
// Hooks para leitura e salvamento
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
|
||||
import Header from '@/app/_components/structure/Header';
|
||||
import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog';
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import GTBTipoLogradouroTable from '../../_components/g_tb_tipologradouro/GTBTipoLogradouroTable';
|
||||
import GTBTipoLogradouroForm from '../../_components/g_tb_tipologradouro/GTBTipoLogradouroForm';
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ import { useGTBTipoLogradouroRemoveHook } from '../../_hooks/g_tb_tipologradouro
|
|||
|
||||
import { GTBTipoLogradouroInterface } from '../../_interfaces/GTBTipoLogradouroInterface';
|
||||
|
||||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
export default function TTBAndamentoServico() {
|
||||
// Controle de exibição de respostas
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import TCensecTable from '../../_components/t_censec/TCensecTable';
|
||||
import TCensecForm from '../../_components/t_censec/TCensecForm';
|
||||
|
||||
|
|
@ -11,11 +11,11 @@ import { useTCensecReadHook } from '../../_hooks/t_censec/useTCensecReadHook';
|
|||
import { useTCensecSaveHook } from '../../_hooks/t_censec/useTCensecSaveHook';
|
||||
import { useTCensecDeleteHook } from '../../_hooks/t_censec/useTCensecDeleteHook';
|
||||
|
||||
import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
|
||||
import TCensecInterface from '../../_interfaces/TCensecInterface';
|
||||
import Header from '@/app/_components/structure/Header';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
|
||||
export default function TTBAndamentoServico() {
|
||||
// Controle de estado do botão
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
import { useEffect, useState, useCallback } from "react";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { useConfirmDialog } from "@/app/_components/confirm_dialog/useConfirmDialog";
|
||||
import { useConfirmDialog } from "@/shared/components/confirmDialog/useConfirmDialog";
|
||||
|
||||
import Header from "@/app/_components/structure/Header";
|
||||
import ConfirmDialog from "@/app/_components/confirm_dialog/ConfirmDialog";
|
||||
import Loading from "@/app/_components/loading/loading";
|
||||
import Header from "@/shared/components/structure/Header";
|
||||
import ConfirmDialog from "@/shared/components/confirmDialog/ConfirmDialog";
|
||||
import Loading from "@/shared/components/loading/loading";
|
||||
|
||||
import TCensecTipoAtoTable from "../../_components/t_censec_tipoato/TCensecTipoAtoTable";
|
||||
import TCensecTipoAtoForm from "../../_components/t_censec_tipoato/TCensecTipoAtoForm";
|
||||
|
|
@ -17,6 +17,7 @@ import { useTCensecTipoAtoRemoveHook } from "../../_hooks/t_censec_tipoato/useTC
|
|||
import { useTCensecReadHook } from "../../_hooks/t_censec/useTCensecReadHook";
|
||||
|
||||
import { TCensecTipoAtoInterface } from "../../_interfaces/TCensecTipoAtoInterface";
|
||||
import { SituacoesEnum } from "@/shared/enums/SituacoesEnum";
|
||||
|
||||
// Estado inicial para criação
|
||||
const initialTCensecTipoAto: TCensecTipoAtoInterface = {
|
||||
|
|
@ -24,7 +25,7 @@ const initialTCensecTipoAto: TCensecTipoAtoInterface = {
|
|||
censec_id: 0,
|
||||
codigo: null,
|
||||
descricao: "",
|
||||
situacao: "A",
|
||||
situacao: SituacoesEnum.A,
|
||||
tipo_separacao: null,
|
||||
tipo_revogacao: null,
|
||||
};
|
||||
|
|
@ -37,6 +38,8 @@ export default function TCensecTipoAtoPage() {
|
|||
|
||||
const { tCensec, fetchTCensec } = useTCensecReadHook()
|
||||
|
||||
const [buttonIsLoading, setButtonIsLoading] = useState(false);
|
||||
|
||||
// Estado para controle do form e item selecionado
|
||||
const [selectedItem, setSelectedItem] = useState<TCensecTipoAtoInterface | null>(null);
|
||||
const [isFormOpen, setIsFormOpen] = useState(false);
|
||||
|
|
@ -141,6 +144,7 @@ export default function TCensecTipoAtoPage() {
|
|||
tCensec={tCensec}
|
||||
onClose={handleCloseForm}
|
||||
onSave={handleSave}
|
||||
buttonIsLoading={buttonIsLoading}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog';
|
||||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
|
||||
import Header from '@/app/_components/structure/Header';
|
||||
import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog';
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
|
||||
import TCensecNaturezaLitigioTable from '../../_components/t_censecnaturezalitigio/TCensecNaturezaLitigioTable';
|
||||
import TCensecNaturezaLitigioForm from '../../_components/t_censecnaturezalitigio/TCensecNaturezaLitigioForm';
|
||||
|
|
@ -17,7 +17,7 @@ import { useTCensecNaturezaLitigioSaveHook } from '../../_hooks/t_censecnatureza
|
|||
import { useTCensecNaturezaLitigioRemoveHook } from '../../_hooks/t_censecnaturezalitigio/useTCensecNaturezaLitigioRemoveHook';
|
||||
|
||||
import { TCensecNaturezaLitigioInterface } from '../../_interfaces/TCensecNaturezaLitigioInterface';
|
||||
import { SituacoesEnum } from '@/enums/SituacoesEnum';
|
||||
import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||
|
||||
const initialCensecNaturezaLitigio: TCensecNaturezaLitigioInterface = {
|
||||
censec_naturezalitigio_id: 0,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { useParams } from 'next/navigation';
|
|||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import MainEditor from '@/components/MainEditor';
|
||||
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
import { useTMinutaReadHook } from '../../../../_hooks/t_minuta/useTMinutaReadHook';
|
||||
import { TMinutaInterface } from '../../../../_interfaces/TMinutaInterface';
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
|
||||
import Header from '@/app/_components/structure/Header';
|
||||
import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog';
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import Loading from '@/shared/components/loading/loading';
|
||||
|
||||
import TMinutaTable from '../../_components/t_minuta/TMinutaTable';
|
||||
import TMinutaForm from '../../_components/t_minuta/TMinutaForm';
|
||||
|
|
|
|||
|
|
@ -3,19 +3,19 @@
|
|||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
|
||||
import Loading from '@/app/_components/loading/loading';
|
||||
import Loading from '@/shared/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 ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
|
||||
import TTBAndamentoServicoInterface from '../../_interfaces/TTBAndamentoServicoInterface';
|
||||
import { useTTBAndamentoServicoDeleteHook } from '../../_hooks/t_tb_andamentoservico/useTTBAndamentoServicoDeleteHook';
|
||||
import Header from '@/app/_components/structure/Header';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
|
||||
export default function TTBAndamentoServico() {
|
||||
// Hooks para leitura e salvamento
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
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 Loading from '@/shared/components/loading/loading';
|
||||
import Header from '@/shared/components/structure/Header';
|
||||
import TTBReconhecimentoTipoTable from '../../_components/t_tb_reconhecimentotipo/TTBReconhecimentoTipoTable';
|
||||
import TTBReconhecimentoTipoForm from '../../_components/t_tb_reconhecimentotipo/TTBReconhecimentoTipoForm';
|
||||
|
||||
|
|
@ -12,8 +12,8 @@ import { useTTBReconhecimentoTipoReadHook } from '../../_hooks/t_tb_reconhecimen
|
|||
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 ConfirmDialog from '@/shared/components/confirmDialog/ConfirmDialog';
|
||||
import { useConfirmDialog } from '@/shared/components/confirmDialog/useConfirmDialog';
|
||||
|
||||
import TTBReconhecimentoTipoInterface from '../../_interfaces/TTBReconhecimentoTipoInterface';
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ export default function TTBAndamentoServico() {
|
|||
// Define o item atual para remoção
|
||||
setItemToDelete(item);
|
||||
|
||||
// Abre o modal de confirmação
|
||||
// Abre o modal de exclusão
|
||||
openConfirmDialog();
|
||||
},
|
||||
[openConfirmDialog],
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import {
|
|||
FormMessage,
|
||||
} from '@/components/ui/form';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import LoadingButton from '@/app/_components/loadingButton/LoadingButton';
|
||||
import LoadingButton from '@/shared/components/loadingButton/LoadingButton';
|
||||
import { GMedidaTipoSchema } from '../../_schemas/GMedidaTipoSchema';
|
||||
import { GMedidaTipoInterface } from '../../_interfaces/GMedidaTipoInterface';
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ import { Input } from '@/components/ui/input';
|
|||
import { Label } from '@/components/ui/label';
|
||||
|
||||
import { GTBBairroSchema } from '../../_schemas/GTBBairroSchema';
|
||||
import LoadingButton from '@/app/_components/loadingButton/LoadingButton';
|
||||
import { SituacoesEnum } from '@/enums/SituacoesEnum';
|
||||
import LoadingButton from '@/shared/components/loadingButton/LoadingButton';
|
||||
import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||
|
||||
type FormValues = z.infer<typeof GTBBairroSchema>;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { useEffect } from 'react';
|
|||
import { useForm, Controller } from 'react-hook-form';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
|
||||
import LoadingButton from '@/app/_components/loadingButton/LoadingButton';
|
||||
import LoadingButton from '@/shared/components/loadingButton/LoadingButton';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import {
|
|||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
|
||||
import LoadingButton from '@/app/_components/loadingButton/LoadingButton';
|
||||
import LoadingButton from '@/shared/components/loadingButton/LoadingButton';
|
||||
|
||||
import { GTBTipoLogradouroSchema } from '../../_schemas/GTBTipoLogradouroSchema';
|
||||
import { GTBTipoLogradouroInterface } from '../../_interfaces/GTBTipoLogradouroInterface';
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ import { Input } from '@/components/ui/input';
|
|||
import { Label } from '@/components/ui/label';
|
||||
|
||||
import { TCensecSchema } from '../../_schemas/TCensecSchema';
|
||||
import { SituacoesEnum } from '@/enums/SituacoesEnum';
|
||||
import LoadingButton from '@/app/_components/loadingButton/LoadingButton';
|
||||
import { SituacoesEnum } from '@/shared/enums/SituacoesEnum';
|
||||
import LoadingButton from '@/shared/components/loadingButton/LoadingButton';
|
||||
|
||||
type FormValues = z.infer<typeof TCensecSchema>;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { useEffect } from "react";
|
|||
import { useForm, Controller } from "react-hook-form";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { Checkbox } from "@/components/ui/checkbox";
|
||||
import LoadingButton from "@/shared/components/loadingButton/LoadingButton";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Dialog,
|
||||
|
|
@ -29,6 +30,7 @@ import { Label } from "@/components/ui/label";
|
|||
import { TCensecTipoAtoSchema } from "../../_schemas/TCensecTipoAtoSchema";
|
||||
import { TCensecTipoAtoInterface } from "../../_interfaces/TCensecTipoAtoInterface";
|
||||
import TCensecInterface from "../../_interfaces/TCensecInterface";
|
||||
import { SituacoesEnum } from "@/shared/enums/SituacoesEnum";
|
||||
|
||||
type FormValues = z.infer<typeof TCensecTipoAtoSchema>;
|
||||
|
||||
|
|
@ -38,6 +40,7 @@ interface TCensecTipoAtoFormProps {
|
|||
tCensec: TCensecInterface[];
|
||||
onClose: (item: null, isFormStatus: boolean) => void;
|
||||
onSave: (data: FormValues) => void;
|
||||
buttonIsLoading: boolean;
|
||||
}
|
||||
|
||||
export default function TCensecTipoAtoForm({
|
||||
|
|
@ -46,6 +49,7 @@ export default function TCensecTipoAtoForm({
|
|||
tCensec,
|
||||
onClose,
|
||||
onSave,
|
||||
buttonIsLoading
|
||||
}: TCensecTipoAtoFormProps) {
|
||||
// react-hook-form com schema Zod
|
||||
const form = useForm<FormValues>({
|
||||
|
|
@ -55,7 +59,7 @@ export default function TCensecTipoAtoForm({
|
|||
censec_id: 0,
|
||||
codigo: null,
|
||||
descricao: "",
|
||||
situacao: "A",
|
||||
situacao: SituacoesEnum.A,
|
||||
tipo_separacao: null,
|
||||
tipo_revogacao: null,
|
||||
},
|
||||
|
|
@ -105,17 +109,17 @@ export default function TCensecTipoAtoForm({
|
|||
name="censec_id"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Censec</FormLabel>
|
||||
<FormLabel>Central do Censec</FormLabel>
|
||||
<Select
|
||||
value={field.value?.toString()}
|
||||
onValueChange={(val) => field.onChange(Number(val))}
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="Selecione um Censec" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
<SelectContent className="w-full">
|
||||
{tCensec.map((c) => (
|
||||
<SelectItem key={c.censec_id} value={String(c.censec_id)}>
|
||||
{c.descricao}
|
||||
|
|
@ -128,6 +132,7 @@ export default function TCensecTipoAtoForm({
|
|||
)}
|
||||
/>
|
||||
|
||||
|
||||
{/* Situação */}
|
||||
<Controller
|
||||
name="situacao"
|
||||
|
|
@ -155,11 +160,11 @@ export default function TCensecTipoAtoForm({
|
|||
value={field.value ?? ""}
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="Selecione" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
<SelectContent className="w-full">
|
||||
<SelectItem value="S">Sim</SelectItem>
|
||||
<SelectItem value="N">Não</SelectItem>
|
||||
</SelectContent>
|
||||
|
|
@ -181,11 +186,11 @@ export default function TCensecTipoAtoForm({
|
|||
value={field.value ?? ""}
|
||||
>
|
||||
<FormControl>
|
||||
<SelectTrigger>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="Selecione" />
|
||||
</SelectTrigger>
|
||||
</FormControl>
|
||||
<SelectContent>
|
||||
<SelectContent className="w-full">
|
||||
<SelectItem value="S">Sim</SelectItem>
|
||||
<SelectItem value="N">Não</SelectItem>
|
||||
</SelectContent>
|
||||
|
|
@ -207,9 +212,7 @@ export default function TCensecTipoAtoForm({
|
|||
Cancelar
|
||||
</Button>
|
||||
</DialogClose>
|
||||
<Button type="submit" className="cursor-pointer">
|
||||
Salvar
|
||||
</Button>
|
||||
<LoadingButton text="Salvar" textLoading="Aguarde..." type="submit" loading={buttonIsLoading} />
|
||||
</DialogFooter>
|
||||
|
||||
{/* Campos ocultos */}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,25 @@ interface TCensecTipoAtoTableProps {
|
|||
onDelete: (item: TCensecTipoAtoInterface, isEditingFormStatus: boolean) => void;
|
||||
}
|
||||
|
||||
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 TCensecTipoAtoTable({
|
||||
data,
|
||||
tCensec,
|
||||
|
|
@ -39,10 +58,10 @@ export default function TCensecTipoAtoTable({
|
|||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>#</TableHead>
|
||||
<TableHead>CENSEC</TableHead>
|
||||
<TableHead>Situação</TableHead>
|
||||
<TableHead>Central do CENSEC</TableHead>
|
||||
{/*<TableHead>Código</TableHead>*/}
|
||||
<TableHead>Descrição</TableHead>
|
||||
<TableHead>Situação</TableHead>
|
||||
<TableHead>Separação</TableHead>
|
||||
<TableHead>Revogação</TableHead>
|
||||
<TableHead className="text-right">Ações</TableHead>
|
||||
|
|
@ -57,12 +76,12 @@ export default function TCensecTipoAtoTable({
|
|||
<TableCell className="font-medium">
|
||||
{item.censec_tipoato_id}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<StatusBadge situacao={item.situacao} />
|
||||
</TableCell>
|
||||
<TableCell>{censecDesc}</TableCell>
|
||||
{/*<TableCell>{item.codigo ?? "-"}</TableCell>*/}
|
||||
<TableCell>{item.descricao}</TableCell>
|
||||
<TableCell>
|
||||
{item.situacao === "A" ? "Ativo" : "Inativo"}
|
||||
</TableCell>
|
||||
<TableCell>{item.tipo_separacao ?? "-"}</TableCell>
|
||||
<TableCell>{item.tipo_revogacao ?? "-"}</TableCell>
|
||||
<TableCell className="text-right">
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { useEffect } from 'react';
|
|||
import { useForm, Controller } from 'react-hook-form';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
|
||||
import LoadingButton from '@/app/_components/loadingButton/LoadingButton';
|
||||
import LoadingButton from '@/shared/components/loadingButton/LoadingButton';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
// Importa o serviço de API que será utilizado para realizar requisições HTTP
|
||||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
|
||||
// Importa o enum que contém os métodos HTTP disponíveis (GET, POST, PUT, DELETE)
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
// Importa função que encapsula chamadas assíncronas e trata erros automaticamente
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
// Função assíncrona que implementa a lógica de salvar (criar/atualizar) uma cidade
|
||||
async function executeGcidadeIndexData() {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
// Importa o serviço de API que será utilizado para realizar requisições HTTP
|
||||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
|
||||
// Importa o enum que contém os métodos HTTP disponíveis (GET, POST, PUT, DELETE)
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
// Importa a interface tipada que define a estrutura dos dados de uma cidade
|
||||
import GCidadeInterface from '../../_interfaces/GCidadeInterface';
|
||||
|
||||
// Importa função que encapsula chamadas assíncronas e trata erros automaticamente
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
// Função assíncrona que implementa a lógica de salvar (criar/atualizar) uma cidade
|
||||
async function executeGcidadeRemoveData(data: GCidadeInterface) {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
// Importa o serviço de API que será utilizado para realizar requisições HTTP
|
||||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
|
||||
// Importa o enum que contém os métodos HTTP disponíveis (GET, POST, PUT, DELETE)
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
// Importa a interface tipada que define a estrutura dos dados de uma cidade
|
||||
import GCidadeInterface from '../../_interfaces/GCidadeInterface';
|
||||
|
||||
// Importa função que encapsula chamadas assíncronas e trata erros automaticamente
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
// Função assíncrona que implementa a lógica de salvar (criar/atualizar) uma cidade
|
||||
async function executeGcidadeSaveData(data: GCidadeInterface) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
async function executeGMedidaTipoIndexData() {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { GMedidaTipoInterface } from '../../_interfaces/GMedidaTipoInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
async function executeGMedidaTipoRemoveData(data: GMedidaTipoInterface) {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { GMedidaTipoInterface } from '../../_interfaces/GMedidaTipoInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
async function executeGMedidaTipoSaveData(data: GMedidaTipoInterface) {
|
||||
const isUpdate = Boolean(data.medida_tipo_id);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
async function executeGTBBairroIndexData() {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { GTBBairroInterface } from '../../_interfaces/GTBBairroInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
async function executeGTBBairroRemoveData(data: GTBBairroInterface) {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { GTBBairroInterface } from '../../_interfaces/GTBBairroInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
async function executeGTBBairroSaveData(data: GTBBairroInterface) {
|
||||
const isUpdate = Boolean(data.tb_bairro_id);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
async function executeGTBEstadoCivilIndexData() {
|
||||
const api = new API();
|
||||
|
||||
return await api.send({
|
||||
method: Methods.GET,
|
||||
endpoint: `administrativo/g_tb_estado_civil/`,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { GTBEstadoCivilInterface } from '../../_interfaces/GTBEstadoCivilInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
async function executeGTBEstadoCivilRemoveData(data: GTBEstadoCivilInterface) {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { GTBEstadoCivilInterface } from '../../_interfaces/GTBEstadoCivilInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
async function executeGTBEstadoCivilSaveData(data: GTBEstadoCivilInterface) {
|
||||
const isUpdate = Boolean(data.tb_estadocivil_id);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function GTBProfissoesIndexData() {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import GTBProfissaoInterface from '../../_interfaces/GTBProfissaoInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function GTBProfissaoRemoveData(data: GTBProfissaoInterface) {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import GTBProfissaoInterface from '../../_interfaces/GTBProfissaoInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function GTBProfissaoSaveData(data: GTBProfissaoInterface) {
|
||||
const isUpdate = Boolean(data.tb_profissao_id);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function GTBRegimeBensIndexData() {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import GTBRegimeBensInterface from '../../_interfaces/GTBRegimeBensInterface';
|
||||
|
||||
export default async function GTBRegimeBensRemoveData(data: GTBRegimeBensInterface) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import GTBRegimeBensInterface from '../../_interfaces/GTBRegimeBensInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
async function executeGTBRegimeBensSaveData(data: GTBRegimeBensInterface) {
|
||||
throw new Error('Nome e email são obrigatórios');
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
async function executeGTBTipoLogradouroIndexData() {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { GTBTipoLogradouroInterface } from '../../_interfaces/GTBTipoLogradouroInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
async function executeGTBTipoLogradouroRemoveData(data: GTBTipoLogradouroInterface) {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { GTBTipoLogradouroInterface } from '../../_interfaces/GTBTipoLogradouroInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
async function executeGTBTipoLogradouroSaveData(data: GTBTipoLogradouroInterface) {
|
||||
const isUpdate = Boolean(data.tb_tipologradouro_id);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import GTBRegimeComunhaoInterface from '../../_interfaces/GTBRegimeComunhaoInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function GTBRegimeComunhaoIndexData() {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import GTBRegimeComunhaoInterface from '../../_interfaces/GTBRegimeComunhaoInterface';
|
||||
|
||||
export default async function GTBRegimeComunhaoRemoveData(data: GTBRegimeComunhaoInterface) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import GTBRegimeComunhaoInterface from '../../_interfaces/GTBRegimeComunhaoInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function GTBRegimeComunhaoSaveData(data: GTBRegimeComunhaoInterface) {
|
||||
const isUpdate = Boolean(data.tb_regimecomunhao_id);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
// Importa a classe API responsável por centralizar chamadas HTTP
|
||||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
|
||||
// Importa o enum de métodos HTTP (GET, POST, PUT, DELETE, etc.)
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
// Exporta por padrão a função assíncrona GUfIndexData
|
||||
export default async function GUfIndexData() {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import TCensecInterface from '../../_interfaces/TCensecInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
async function executeTCensecDeleteData(data: TCensecInterface) {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
async function executeTCensecIndexData() {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import TCensecInterface from '../../_interfaces/TCensecInterface';
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
async function executeTCensecSaveData(data: TCensecInterface) {
|
||||
const isUpdate = Boolean(data.censec_id);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
async function executeTCensecNaturezaLitigioIndexData() {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { TCensecNaturezaLitigioInterface } from '../../_interfaces/TCensecNaturezaLitigioInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
async function executeTCensecNaturezaLitigioRemoveData(data: TCensecNaturezaLitigioInterface) {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { TCensecNaturezaLitigioInterface } from '../../_interfaces/TCensecNaturezaLitigioInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
async function executeTCensecNaturezaLitigioSaveData(data: TCensecNaturezaLitigioInterface) {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,16 +1,11 @@
|
|||
import API from "@/services/api/Api";
|
||||
import { Methods } from "@/services/api/enums/ApiMethodEnum";
|
||||
import API from "@/shared/services/api/Api";
|
||||
import { Methods } from "@/shared/services/api/enums/ApiMethodEnum";
|
||||
import TCensecTipoAtoMockDeDados from "./mockCensecTipoAto";
|
||||
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
|
||||
const useMock = true
|
||||
|
||||
async function executeTCensecTipoAtoIndexData() {
|
||||
if (useMock) {
|
||||
console.log(TCensecTipoAtoMockDeDados())
|
||||
return await TCensecTipoAtoMockDeDados();
|
||||
}
|
||||
|
||||
const api = new API();
|
||||
return await api.send({
|
||||
method: Methods.GET,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import API from "@/services/api/Api";
|
||||
import API from "@/shared/services/api/Api";
|
||||
import { TCensecTipoAtoInterface } from "../../_interfaces/TCensecTipoAtoInterface";
|
||||
import { Methods } from "@/services/api/enums/ApiMethodEnum";
|
||||
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
import { Methods } from "@/shared/services/api/enums/ApiMethodEnum";
|
||||
import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
|
||||
async function executeTCensecTipoAtoRemoveData(data: TCensecTipoAtoInterface) {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import API from "@/services/api/Api";
|
||||
import API from "@/shared/services/api/Api";
|
||||
import { TCensecTipoAtoInterface } from "../../_interfaces/TCensecTipoAtoInterface";
|
||||
import { Methods } from "@/services/api/enums/ApiMethodEnum";
|
||||
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
import { Methods } from "@/shared/services/api/enums/ApiMethodEnum";
|
||||
import { withClientErrorHandler } from "@/shared/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
|
||||
async function executeTCensecTipoAtoSaveData(data: TCensecTipoAtoInterface) {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,11 @@
|
|||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { MinutaMockDeDadosPorId } from './mockMinuta';
|
||||
|
||||
const useMock = true;
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function TMinutaIndex(t_minuta_id: number) {
|
||||
if (useMock) {
|
||||
console.log(await MinutaMockDeDadosPorId(t_minuta_id)); // Retorna o dado específico do mock
|
||||
return await MinutaMockDeDadosPorId(t_minuta_id); // Retorna o dado específico do mock
|
||||
}
|
||||
|
||||
const api = new API();
|
||||
try {
|
||||
const dados = await api.send({
|
||||
method: Methods.GET,
|
||||
endpoint: `administrativo/t_minuta/${t_minuta_id}`,
|
||||
});
|
||||
return dados;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return error;
|
||||
}
|
||||
const dados = await api.send({
|
||||
method: Methods.GET,
|
||||
endpoint: `administrativo/t_minuta/${t_minuta_id}`,
|
||||
});
|
||||
return dados;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,11 @@
|
|||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import MinutaMockDeDados from './mockMinuta';
|
||||
|
||||
const useMock = true;
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function TMinutaIndexData() {
|
||||
if (useMock) {
|
||||
return await MinutaMockDeDados(); // Retorna todos os dados mockados
|
||||
}
|
||||
|
||||
const api = new API();
|
||||
try {
|
||||
const dados = await api.send({
|
||||
method: Methods.GET,
|
||||
endpoint: `administrativo/t_minuta/`,
|
||||
});
|
||||
return dados;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
return error;
|
||||
}
|
||||
const dados = await api.send({
|
||||
method: Methods.GET,
|
||||
endpoint: `administrativo/t_minuta/`,
|
||||
});
|
||||
return dados;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { TMinutaInterface } from '../../_interfaces/TMinutaInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function TMinutaRemoveData(data: TMinutaInterface) {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { TMinutaInterface } from '../../_interfaces/TMinutaInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function TMinutaSaveData(data: TMinutaInterface) {
|
||||
const isUpdate = Boolean(data.t_minuta_id);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use server';
|
||||
|
||||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function TTBAndamentoServicoIndexData() {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
'use server';
|
||||
|
||||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import TTBAndamentoServicoInteface from '../../_interfaces/TTBAndamentoServicoInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function TTBAndamentoServicoRemoveData(
|
||||
tTBAndamentoServico: TTBAndamentoServicoInteface,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
'use server';
|
||||
|
||||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import TTBAndamentoServicoInteface from '../../_interfaces/TTBAndamentoServicoInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import { withClientErrorHandler } from '@/shared/actions/withClientErrorHandler/withClientErrorHandler';
|
||||
|
||||
async function executeTTBAndamentoServicoSaveData(data: TTBAndamentoServicoInteface) {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import API from '@/services/api/Api';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import TTBReconhecimentoTipoInterface from '../../_interfaces/TTBReconhecimentoTipoInterface';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function TTBReconhecimentoTipoDeleteData(
|
||||
data: TTBReconhecimentoTipoInterface,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use server';
|
||||
|
||||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
|
||||
export default async function TTBReconhecimentoTipoIndexData() {
|
||||
const api = new API();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import API from '@/services/api/Api';
|
||||
import { Methods } from '@/services/api/enums/ApiMethodEnum';
|
||||
import API from '@/shared/services/api/Api';
|
||||
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
||||
import TTBReconhecimentoTipoInterface from '../../_interfaces/TTBReconhecimentoTipoInterface';
|
||||
|
||||
export default async function TTBReconhecimentoTipoSaveData(data: TTBReconhecimentoTipoInterface) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useResponse } from '@/app/_response/ResponseContext'; // Contexto global para gerenciar respostas da API
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext'; // Contexto global para gerenciar respostas da API
|
||||
import { useState } from 'react';
|
||||
import { GCidadeIndexService } from '../../_services/g_cidade/GCidadeIndexService'; // Serviço que busca a lista de cidades
|
||||
import GCidadeInterface from '../../_interfaces/GCidadeInterface'; // Interface tipada da cidade
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useResponse } from "@/app/_response/ResponseContext"; // Contexto global para gerenciar respostas da API
|
||||
import { useResponse } from "@/shared/components/response/ResponseContext"; // Contexto global para gerenciar respostas da API
|
||||
import GCidadeInterface from "../../_interfaces/GCidadeInterface"; // Interface tipada da cidade
|
||||
import { GCidadeRemoveData } from "../../_data/GCidade/GCidadeRemoveData"; // Função que remove a cidade via API
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { useState } from 'react';
|
||||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import GCidadeInterface from '../../_interfaces/GCidadeInterface';
|
||||
import { GCidadeSaveService } from '../../_services/g_cidade/GCidadeSaveService';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import { useState } from 'react';
|
||||
import { GMedidaTipoInterface } from '../../_interfaces/GMedidaTipoInterface';
|
||||
import { GMedidaTipoIndexService } from '../../_services/g_medidatipo/GMedidaTipoIndexService';
|
||||
|
|
@ -8,15 +8,11 @@ export const useGMedidaTipoReadHook = () => {
|
|||
const [gMedidaTipo, setGMedidaTipo] = useState<GMedidaTipoInterface[]>([]);
|
||||
|
||||
const fetchGMedidaTipo = async () => {
|
||||
try {
|
||||
const response = await GMedidaTipoIndexService();
|
||||
const response = await GMedidaTipoIndexService();
|
||||
|
||||
setGMedidaTipo(response.data);
|
||||
setGMedidaTipo(response.data);
|
||||
|
||||
setResponse(response);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
setResponse(response);
|
||||
};
|
||||
|
||||
return { gMedidaTipo, fetchGMedidaTipo };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import { GMedidaTipoInterface } from '../../_interfaces/GMedidaTipoInterface';
|
||||
import { GMedidaTipoRemoveService } from '../../_services/g_medidatipo/GMedidaTipoRemoveService';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import { useState } from 'react';
|
||||
import { GMedidaTipoInterface } from '../../_interfaces/GMedidaTipoInterface';
|
||||
import { GMedidaTipoSaveService } from '../../_services/g_medidatipo/GMedidaTipoSaveService';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { use, useState } from 'react';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { GTBBairroInterface } from '../../_interfaces/GTBBairroInterface';
|
||||
import { GTBBairroIndexService } from '../../_services/g_tb_bairro/GTBBairroIndexService';
|
||||
|
||||
|
|
@ -22,5 +22,6 @@ export const useGTBBairroReadHook = () => {
|
|||
setResponse(response);
|
||||
};
|
||||
|
||||
return { gTBBairro, fetchGTBBairro };
|
||||
return useMemo(() => ({ gTBBairro, fetchGTBBairro }), [gTBBairro, fetchGTBBairro]);
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import { GTBBairroInterface } from '../../_interfaces/GTBBairroInterface';
|
||||
import { GTBBairroRemoveService } from '../../_services/g_tb_bairro/GTBBairroRemoveService';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import { useState } from 'react';
|
||||
import { GTBBairroInterface } from '../../_interfaces/GTBBairroInterface';
|
||||
import { GTBBairroSaveService } from '../../_services/g_tb_bairro/GTBBairroSaveService';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import { useState } from 'react';
|
||||
import { GTBEstadoCivilInterface } from '../../_interfaces/GTBEstadoCivilInterface';
|
||||
import { GTBEstadoCivilIndexService } from '../../_services/g_tb_estadocivil/GTBEstadoCivilIndexService';
|
||||
|
|
@ -6,18 +6,10 @@ import { GTBEstadoCivilIndexService } from '../../_services/g_tb_estadocivil/GTB
|
|||
export const useGTBEstadoCivilReadHook = () => {
|
||||
const { setResponse } = useResponse();
|
||||
const [gTBEstadoCivil, setGTBEstadoCivil] = useState<GTBEstadoCivilInterface[]>([]);
|
||||
|
||||
const fetchGTBEstadoCivil = async () => {
|
||||
try {
|
||||
const response = await GTBEstadoCivilIndexService();
|
||||
|
||||
setGTBEstadoCivil(response.data);
|
||||
|
||||
setResponse(response);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
const response = await GTBEstadoCivilIndexService();
|
||||
setGTBEstadoCivil(response.data);
|
||||
setResponse(response);
|
||||
};
|
||||
|
||||
return { gTBEstadoCivil, fetchGTBEstadoCivil };
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import { GTBEstadoCivilInterface } from '../../_interfaces/GTBEstadoCivilInterface';
|
||||
import { GTBEstadoCivilRemoveService } from '../../_services/g_tb_estadocivil/GTBEstadoCivilRemoveService';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import { useState } from 'react';
|
||||
import { GTBEstadoCivilInterface } from '../../_interfaces/GTBEstadoCivilInterface';
|
||||
import { GTBEstadoCivilSaveService } from '../../_services/g_tb_estadocivil/GTBEstadoCivilSaveService';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import { useState } from 'react';
|
||||
import GTBProfissaoInterface from '../../_interfaces/GTBProfissaoInterface';
|
||||
import GTBProfissaoIndexService from '../../_services/g_tb_profissao/GTBProfissaoIndexService';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useResponse } from '@/app/_response/ResponseContext';
|
||||
import { useResponse } from '@/shared/components/response/ResponseContext';
|
||||
import GTBProfissaoInterface from '../../_interfaces/GTBProfissaoInterface';
|
||||
import GTBProfissaoRemoveService from '../../_services/g_tb_profissao/GTBProfissaoRemoveService';
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue