diff --git a/public/images/favicon.ico b/public/images/favicon.ico new file mode 100644 index 0000000..144dc9f Binary files /dev/null and b/public/images/favicon.ico differ diff --git a/public/images/logo-abb.png b/public/images/logo-abb.png new file mode 100644 index 0000000..7690ed2 Binary files /dev/null and b/public/images/logo-abb.png differ diff --git a/src/actions/CEP/FormatCEP.ts b/src/actions/CEP/FormatCEP.ts new file mode 100644 index 0000000..410452a --- /dev/null +++ b/src/actions/CEP/FormatCEP.ts @@ -0,0 +1,20 @@ +/** + * Formata um número de CEP no padrão 99999-999 + * + * @param value - CEP em string ou number + * @returns CEP formatado ou string vazia se inválido + */ +export function FormatCEP(value: string | number): string { + if (!value) return ''; + + // Converte para string e remove tudo que não seja número + const digits = String(value).replace(/\D/g, ''); + + // Garante que tenha no máximo 8 dígitos + const cleanValue = digits.slice(0, 8); + + // Retorna formatado ou valor limpo se não tiver tamanho suficiente + if (cleanValue.length !== 8) return cleanValue; + + return cleanValue.replace(/(\d{5})(\d{3})/, '$1-$2'); +} diff --git a/src/actions/form/ResetFormIfData.ts b/src/actions/form/ResetFormIfData.ts new file mode 100644 index 0000000..09fa8df --- /dev/null +++ b/src/actions/form/ResetFormIfData.ts @@ -0,0 +1,15 @@ +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( + form: UseFormReturn, + data: T | null +) { + if (data) { + form.reset(data); + } +} diff --git a/src/actions/form/parseNumberInput.ts b/src/actions/form/parseNumberInput.ts new file mode 100644 index 0000000..154b96f --- /dev/null +++ b/src/actions/form/parseNumberInput.ts @@ -0,0 +1,6 @@ +/** + * Converte o valor do input para número, enviando undefined se estiver vazio + */ +export function parseNumberInput(e: React.ChangeEvent): number | undefined { + return e.target.value ? Number(e.target.value) : undefined; +} diff --git a/src/app/(protected)/(cadastros)/cadastros/(t_pessoa)/pessoa/fisica/page.tsx b/src/app/(protected)/(administrativo)/administrativo/pessoas/fisicas/page.tsx similarity index 87% rename from src/app/(protected)/(cadastros)/cadastros/(t_pessoa)/pessoa/fisica/page.tsx rename to src/app/(protected)/(administrativo)/administrativo/pessoas/fisicas/page.tsx index eb28403..3e44744 100644 --- a/src/app/(protected)/(cadastros)/cadastros/(t_pessoa)/pessoa/fisica/page.tsx +++ b/src/app/(protected)/(administrativo)/administrativo/pessoas/fisicas/page.tsx @@ -3,17 +3,17 @@ import React, { useEffect, useState, useCallback } from 'react'; import Loading from '@/app/_components/loading/loading'; -import TPessoaTable from '../../../_components/t_pessoa/TPessoaTable'; -import TPessoaForm from '../../../_components/t_pessoa/TPessoaForm'; +import TPessoaTable from '@/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaTable'; +import TPessoaForm from '@/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaForm'; -import { useTPessoaIndexHook } from '../../../_hooks/t_pessoa/useTPessoaIndexHook'; -import { useTPessoaSaveHook } from '../../../_hooks/t_pessoa/useTPessoaSaveHook'; -import { useTPessoaDeleteHook } from '../../../_hooks/t_pessoa/useTPessoaDeleteHook'; +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 '../../../_interfaces/TPessoaInterface'; +import TPessoaInterface from '@/packages/administrativo/interfaces/TPessoa/TPessoaInterface'; import Header from '@/app/_components/structure/Header'; export default function TPessoaFisica() { diff --git a/src/app/(protected)/(cadastros)/cadastros/(t_pessoa)/pessoa/juridica/page.tsx b/src/app/(protected)/(administrativo)/administrativo/pessoas/juridicas/page.tsx similarity index 86% rename from src/app/(protected)/(cadastros)/cadastros/(t_pessoa)/pessoa/juridica/page.tsx rename to src/app/(protected)/(administrativo)/administrativo/pessoas/juridicas/page.tsx index 45fc62d..f2486f3 100644 --- a/src/app/(protected)/(cadastros)/cadastros/(t_pessoa)/pessoa/juridica/page.tsx +++ b/src/app/(protected)/(administrativo)/administrativo/pessoas/juridicas/page.tsx @@ -4,17 +4,17 @@ import React, { useEffect, useState, useCallback } from 'react'; import Loading from '@/app/_components/loading/loading'; -import { useTPessoaSaveHook } from '../../../_hooks/t_pessoa/useTPessoaSaveHook'; -import { useTPessoaDeleteHook } from '../../../_hooks/t_pessoa/useTPessoaDeleteHook'; +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 '../../../_interfaces/TPessoaInterface'; +import TPessoaInterface from '@/packages/administrativo/interfaces/TPessoa/TPessoaInterface'; import Header from '@/app/_components/structure/Header'; -import TPessoaJuridicaTable from '../../../_components/t_pessoa/juridica/TPessoaJuridicaTable'; -import { useTPessoaJuridicaIndexHook } from '../../../_hooks/t_pessoa/juridica/useTPessoaJuridicaIndexHook'; -import TPessoaJuridicaForm from '../../../_components/t_pessoa/juridica/TPessoaJuridicaForm'; +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'; export default function TPessoaFisica() { // Controle de estado do botão diff --git a/src/app/(protected)/(cadastros)/cadastros/(t_imovel)/imoveis/urbanos/page.tsx b/src/app/(protected)/(cadastros)/cadastros/(t_imovel)/imoveis/urbanos/page.tsx new file mode 100644 index 0000000..52b4f0d --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/(t_imovel)/imoveis/urbanos/page.tsx @@ -0,0 +1,171 @@ +'use client'; + +import { useEffect, useState, useCallback } from 'react'; +import { Card, CardContent } from '@/components/ui/card'; + +import Loading from '@/app/_components/loading/loading'; +import TImovelTable from '@/packages/administrativo/components/t_imovel/TImovelTable'; +import TImovelForm from '@/packages/administrativo/components/t_imovel/TImovelForm'; + +import { useTImovelIndexHook } from '@/packages/administrativo/hooks/t_imovel/useTImovelIndexHook'; +import { useTImovelSaveHook } from '@/packages/administrativo/hooks/t_imovel/useTImovelSaveHook'; +import { useTImovelDeleteHook } from '@/packages/administrativo/hooks/t_imovel/useTImovelDeleteHook'; + +import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog'; +import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog'; + +import TImovelInterface from '@/packages/administrativo/interfaces/TImovelInterface'; +import Header from '@/app/_components/structure/Header'; + +export default function TTBAndamentoServico() { + // Controle de estado do botão + const [buttonIsLoading, setButtonIsLoading] = useState(false); + + // Hooks para leitura e salvamento + const { tImovel, indexTImovel } = useTImovelIndexHook(); + const { saveTImovel } = useTImovelSaveHook(); + const { deleteTImovel } = useTImovelDeleteHook(); + + // Estados + const [selectedAndamento, setSelectedAndamento] = useState(null); + const [isFormOpen, setIsFormOpen] = useState(false); + + // Estado para saber qual item será deletado + const [itemToDelete, setItemToDelete] = useState(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: TImovelInterface | 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: TImovelInterface) => { + // Coloca o botão em estado de loading + setButtonIsLoading(true); + + // Aguarda salvar o registro + await saveTImovel(formData); + + // Remove o botão em estado de loading + setButtonIsLoading(false); + + // Atualiza a lista de dados + indexTImovel(); + }, + [saveTImovel, indexTImovel, handleCloseForm], + ); + + /** + * Quando o usuário clica em "remover" na tabela + */ + const handleConfirmDelete = useCallback( + (item: TImovelInterface) => { + // 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 deleteTImovel(itemToDelete); + + // Atualiza a lista + await indexTImovel(); + + // Limpa o item selecionado + setItemToDelete(null); + + // Fecha o modal + handleCancel(); + }, [itemToDelete, indexTImovel, handleCancel]); + + /** + * Busca inicial dos dados + */ + useEffect(() => { + indexTImovel(); + }, []); + + /** + * Tela de loading enquanto carrega os dados + */ + if (tImovel?.length == 0) { + return ; + } + + return ( +
+ {/* Cabeçalho */} +
{ + handleOpenForm(null); + }} + /> + + {/* Tabela de andamentos */} + + + {/* Modal de confirmação */} + + + {/* Formulário de criação/edição */} + +
+ ); + 4; +} diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/g_tb_bairro/GTBBairroForm.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/g_tb_bairro/GTBBairroForm.tsx index 2ef3fa9..d88f690 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/g_tb_bairro/GTBBairroForm.tsx +++ b/src/app/(protected)/(cadastros)/cadastros/_components/g_tb_bairro/GTBBairroForm.tsx @@ -1,7 +1,7 @@ 'use client'; import z from 'zod'; -import { useEffect, useState } from 'react'; +import { useEffect } from 'react'; import { useForm, Controller } from 'react-hook-form'; import { zodResolver } from '@hookform/resolvers/zod'; @@ -73,10 +73,13 @@ export default function GTBBairroForm({ > - Bairro - Crie ou edite um bairro + + Bairro + + + Crie ou edite um bairro + -
{/* Descrição */} @@ -93,7 +96,6 @@ export default function GTBBairroForm({ )} /> - {/* Situação */} )} /> - {/* Rodapé do Dialog */} diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/juridica/TPessoaJuridicaTable.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/juridica/TPessoaJuridicaTable.tsx deleted file mode 100644 index dca276c..0000000 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/juridica/TPessoaJuridicaTable.tsx +++ /dev/null @@ -1,205 +0,0 @@ -'use client'; - -import { Button } from '@/components/ui/button'; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuGroup, - DropdownMenuItem, - DropdownMenuSeparator, - DropdownMenuTrigger, -} from '@/components/ui/dropdown-menu'; - -import { ArrowUpDownIcon, EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react'; -import { ColumnDef } from '@tanstack/react-table'; - -import GetNameInitials from '@/actions/text/GetNameInitials'; -import { DataTable } from '@/app/_components/dataTable/DataTable'; - -import TPessoaInterface from '../../../_interfaces/TPessoaInterface'; -import { FormatCPF } from '@/actions/CPF/FormatCPF'; -import { FormatPhone } from '@/actions/phone/FormatPhone'; -import { FormatDateTime } from '@/actions/dateTime/FormatDateTime'; -import empty from '@/actions/validations/empty'; -import { FormatCNPJ } from '@/actions/CNPJ/FormatCNPJ'; - -// Tipagem das props -interface TPessoaJuridicaTableProps { - data: TPessoaInterface[]; - onEdit: (item: TPessoaInterface, isEditingFormStatus: boolean) => void; - onDelete: (item: TPessoaInterface, isEditingFormStatus: boolean) => void; -} - -/** - * Função para criar a definição das colunas da tabela - */ -function createPessoaColumns( - onEdit: (item: TPessoaInterface, isEditingFormStatus: boolean) => void, - onDelete: (item: TPessoaInterface, isEditingFormStatus: boolean) => void, -): ColumnDef[] { - return [ - // ID - { - accessorKey: 'pessoa_id', - header: ({ column }) => ( - - ), - cell: ({ row }) => Number(row.getValue('pessoa_id')), - enableSorting: false, - }, - - // Nome / Email / Foto - { - id: 'nome_completo', - accessorFn: (row) => row, - header: ({ column }) => ( - - ), - cell: ({ row }) => { - const pessoa = row.original; - return ( -
- {/* Nome e Email */} -
-
{pessoa.nome || '-'}
-
- {empty(pessoa.email) ? 'Email não informado' : pessoa.email} -
-
-
- ); - }, - sortingFn: (a, b) => - (a.original.nome?.toLowerCase() || '').localeCompare(b.original.nome?.toLowerCase() || ''), - }, - - // CPF - { - accessorKey: 'cpf_cnpj', - header: ({ column }) => ( - - ), - cell: ({ row }) => FormatCNPJ(row.getValue('cpf_cnpj')), - }, - - // Telefone - { - accessorKey: 'telefone', - header: ({ column }) => ( - - ), - cell: ({ row }) => FormatPhone(row.getValue('telefone')), - }, - - // Cidade / UF - { - id: 'cidade_uf', - accessorFn: (row) => `${row.cidade}/${row.uf}`, - header: ({ column }) => ( - - ), - cell: ({ row }) => {row.getValue('cidade_uf') || '-'}, - sortingFn: (a, b) => - `${a.original.cidade}/${a.original.uf}` - .toLowerCase() - .localeCompare(`${b.original.cidade}/${b.original.uf}`.toLowerCase()), - }, - - // Data de cadastro - { - accessorKey: 'data_cadastro', - header: ({ column }) => ( - - ), - cell: ({ row }) => FormatDateTime(row.getValue('data_cadastro')), - sortingFn: 'datetime', - }, - - // Ações - { - id: 'actions', - header: 'Ações', - cell: ({ row }) => { - const pessoa = row.original; - return ( - - - - - - - onEdit(pessoa, true)}> - - Editar - - - onDelete(pessoa, true)} - > - - Remover - - - - - ); - }, - enableSorting: false, - enableHiding: false, - }, - ]; -} - -/** - * Componente principal da tabela - */ -export default function TPessoaJuridicaTable({ - data, - onEdit, - onDelete, -}: TPessoaJuridicaTableProps) { - const columns = createPessoaColumns(onEdit, onDelete); - return ( -
- -
- ); -} diff --git a/src/app/(protected)/(cadastros)/cadastros/_interfaces/TPessoaInterface.ts b/src/app/(protected)/(cadastros)/cadastros/_interfaces/TPessoaInterface.ts deleted file mode 100644 index f7e7711..0000000 --- a/src/app/(protected)/(cadastros)/cadastros/_interfaces/TPessoaInterface.ts +++ /dev/null @@ -1,63 +0,0 @@ -export default interface TPessoaInterface { - pessoa_id?: number; - pessoa_tipo?: string; - nome?: string; - nacionalidade?: string; - documento?: string; - tb_documentotipo_id?: number; - tb_profissao_id?: number; - tb_estadocivil_id?: number; - nome_pai?: string; - nome_mae?: string; - data_cadastro?: string; // ou Date - naturalidade?: string; - telefone?: string; - endereco?: string; - cidade?: string; - uf?: string; - data_nascimento?: string; // ou Date - sexo?: string; - tb_regimecomunhao_id?: number; - pessoa_conjuge_id?: number; - email?: string; - documento_numero?: string; - bairro?: string; - cep?: string; - documento_expedicao?: string; // ou Date - documento_validade?: string; // ou Date - observacao?: string; - cpf_cnpj?: string; - cpf_terceiro?: string; - nome_fantasia?: string; - texto?: string; - ddd?: number; - cert_casamento_numero?: string; - cert_casamento_folha?: string; - cert_casamento_livro?: string; - cert_casamento_cartorio?: string; - cert_casamento_data?: string; // ou Date - cert_casamento_lei?: string; - pessoa_conjuge_nome?: string; - estrangeiro_nat?: string; - estrangeiro_nat_tb_pais_id?: number; - estrangeiro_res_tb_pais_id?: number; - estrangeiro_res?: string; - municipio_id?: number; - documento_orgao?: string; - documento_uf?: string; - uf_residencia?: string; - inscricao_municipal?: string; - enviado_cnncnb?: boolean; - data_auteracao?: string; // ou Date - data_envioccn?: string; // ou Date - ccnregistros_id?: number; - observacao_envioccn?: string; - observacao_envio_ccn?: string; - deficiencias?: string; - grau_instrucao?: string; - cidade_nat_id?: number; - tb_tipologradouro_id?: number; - unidade?: string; - numero_end?: string; - foto?: string; -} diff --git a/src/app/(protected)/(cadastros)/cadastros/_interfaces/TPessoaJuridicaInterface.ts b/src/app/(protected)/(cadastros)/cadastros/_interfaces/TPessoaJuridicaInterface.ts deleted file mode 100644 index ba2c551..0000000 --- a/src/app/(protected)/(cadastros)/cadastros/_interfaces/TPessoaJuridicaInterface.ts +++ /dev/null @@ -1,63 +0,0 @@ -export default interface TPessoaJuridicaInterface { - pessoa_id?: number; - pessoa_tipo?: string; - nome?: string; - nacionalidade?: string; - documento?: string; - tb_documentotipo_id?: number; - tb_profissao_id?: number; - tb_estadocivil_id?: number; - nome_pai?: string; - nome_mae?: string; - data_cadastro?: string; // ou Date - naturalidade?: string; - telefone?: string; - endereco?: string; - cidade?: string; - uf?: string; - data_nascimento?: string; // ou Date - sexo?: string; - tb_regimecomunhao_id?: number; - pessoa_conjuge_id?: number; - email?: string; - documento_numero?: string; - bairro?: string; - cep?: string; - documento_expedicao?: string; // ou Date - documento_validade?: string; // ou Date - observacao?: string; - cpf_cnpj?: string; - cpf_terceiro?: string; - nome_fantasia?: string; - texto?: string; - ddd?: number; - cert_casamento_numero?: string; - cert_casamento_folha?: string; - cert_casamento_livro?: string; - cert_casamento_cartorio?: string; - cert_casamento_data?: string; // ou Date - cert_casamento_lei?: string; - pessoa_conjuge_nome?: string; - estrangeiro_nat?: string; - estrangeiro_nat_tb_pais_id?: number; - estrangeiro_res_tb_pais_id?: number; - estrangeiro_res?: string; - municipio_id?: number; - documento_orgao?: string; - documento_uf?: string; - uf_residencia?: string; - inscricao_municipal?: string; - enviado_cnncnb?: boolean; - data_auteracao?: string; // ou Date - data_envioccn?: string; // ou Date - ccnregistros_id?: number; - observacao_envioccn?: string; - observacao_envio_ccn?: string; - deficiencias?: string; - grau_instrucao?: string; - cidade_nat_id?: number; - tb_tipologradouro_id?: number; - unidade?: string; - numero_end?: string; - foto?: string; -} diff --git a/src/app/(protected)/(cadastros)/cadastros/_interfaces/TPessoaRepresentante.ts b/src/app/(protected)/(cadastros)/cadastros/_interfaces/TPessoaRepresentante.ts deleted file mode 100644 index 62eda11..0000000 --- a/src/app/(protected)/(cadastros)/cadastros/_interfaces/TPessoaRepresentante.ts +++ /dev/null @@ -1,5 +0,0 @@ -export default interface TPessoaJuridicaInterface { - pessoa_representante_id: number; - nome: string; - tipo: string; -} diff --git a/src/app/(protected)/(cadastros)/cadastros/_schemas/TPessoaSchema.ts b/src/app/(protected)/(cadastros)/cadastros/_schemas/TPessoaSchema.ts deleted file mode 100644 index b5d0ba7..0000000 --- a/src/app/(protected)/(cadastros)/cadastros/_schemas/TPessoaSchema.ts +++ /dev/null @@ -1,64 +0,0 @@ -import z from 'zod'; - -export const TPessoaSchema = z.object({ - pessoa_id: z.number().optional(), - pessoa_tipo: z.string().optional(), - nome: z.string().min(1, 'O campo deve ser preenchido').max(120, 'O nome excede 120 caracteres'), - nacionalidade: z.string().optional(), - documento: z.string().optional(), - tb_documentotipo_id: z.number().optional(), - tb_profissao_id: z.number().optional(), - tb_estadocivil_id: z.number().optional(), - nome_pai: z.string().optional(), - nome_mae: z.string().optional(), - data_cadastro: z.string().optional(), // ou z.string().datetime() - naturalidade: z.string().optional(), - telefone: z.string().optional(), - endereco: z.string().optional(), - cidade: z.string().optional(), - uf: z.string().optional(), - data_nascimento: z.string().optional(), // ou z.string().datetime() - sexo: z.string().optional(), - tb_regimecomunhao_id: z.number().optional(), - pessoa_conjuge_id: z.number().optional(), - email: z.string().email().optional(), - documento_numero: z.string().optional(), - bairro: z.string().optional(), - cep: z.string().optional(), - documento_expedicao: z.string().optional(), // ou z.string().datetime() - documento_validade: z.string().optional(), // ou z.string().datetime() - observacao: z.string().optional(), - cpf_cnpj: z.string().optional(), - cpf_terceiro: z.string().optional(), - nome_fantasia: z.string().optional(), - texto: z.string().optional(), - ddd: z.number().optional(), - cert_casamento_numero: z.string().optional(), - cert_casamento_folha: z.string().optional(), - cert_casamento_livro: z.string().optional(), - cert_casamento_cartorio: z.string().optional(), - cert_casamento_data: z.string().optional(), // ou z.string().datetime() - cert_casamento_lei: z.string().optional(), - pessoa_conjuge_nome: z.string().optional(), - estrangeiro_nat: z.string().optional(), - estrangeiro_nat_tb_pais_id: z.number().optional(), - estrangeiro_res_tb_pais_id: z.number().optional(), - estrangeiro_res: z.string().optional(), - municipio_id: z.number().optional(), - documento_orgao: z.string().optional(), - documento_uf: z.string().optional(), - uf_residencia: z.string().optional(), - inscricao_municipal: z.string().optional(), - enviado_cnncnb: z.boolean().optional(), - data_auteracao: z.string().optional(), // ou z.string().datetime() - data_envioccn: z.string().optional(), // ou z.string().datetime() - ccnregistros_id: z.number().optional(), - observacao_envioccn: z.string().optional(), - observacao_envio_ccn: z.string().optional(), - deficiencias: z.string().optional(), - grau_instrucao: z.string().optional(), - cidade_nat_id: z.number().optional(), - tb_tipologradouro_id: z.number().optional(), - unidade: z.string().optional(), - numero_end: z.string().optional(), -}); diff --git a/src/app/(protected)/layout.tsx b/src/app/(protected)/layout.tsx index c835548..bc7c9f4 100644 --- a/src/app/(protected)/layout.tsx +++ b/src/app/(protected)/layout.tsx @@ -28,8 +28,11 @@ const geistMono = Geist_Mono({ }); export const metadata: Metadata = { - title: 'Create Next App', - description: 'Generated by create next app', + title: 'SAAS - Orius Tecnologia', + description: 'Evolução tecnológica com toque humano', + icons: { + icon: '/images/favicon.ico', + }, }; export default function RootLayout({ @@ -53,11 +56,15 @@ export default function RootLayout({ - Building Your Application + + Building Your Application + - Data Fetching + + Data Fetching + diff --git a/src/app/_components/dataTable/SortableHeader.tsx b/src/app/_components/dataTable/SortableHeader.tsx new file mode 100644 index 0000000..29cde35 --- /dev/null +++ b/src/app/_components/dataTable/SortableHeader.tsx @@ -0,0 +1,12 @@ +import { Button } from "@/components/ui/button"; +import { ArrowUpDownIcon } from "lucide-react"; + +export const SortableHeader = (label: string, column: any) => ( + +); \ No newline at end of file diff --git a/src/app/_components/dataTable/dataTable.tsx b/src/app/_components/dataTable/dataTable.tsx index 138a411..e665f31 100644 --- a/src/app/_components/dataTable/dataTable.tsx +++ b/src/app/_components/dataTable/dataTable.tsx @@ -31,16 +31,21 @@ import { TableHeader, TableRow, } from '@/components/ui/table'; -import { ChevronLeftIcon, ChevronRightIcon, EyeIcon } from 'lucide-react'; +import { + ChevronLeftIcon, + ChevronRightIcon, + EyeIcon, +} from 'lucide-react'; // Tipagem genérica export interface DataTableProps { - data: TData[]; + data?: TData[] | null; columns: ColumnDef[]; filterColumn?: string; // Define qual coluna será usada para filtro filterPlaceholder?: string; onEdit?: (item: TData) => void; onDelete?: (item: TData) => void; + onRowClick?: (item: TData) => void; } export function DataTable({ @@ -50,7 +55,11 @@ export function DataTable({ filterPlaceholder = 'Buscar...', onEdit, onDelete, + onRowClick, }: DataTableProps) { + // Garante que data sempre seja array + const safeData = Array.isArray(data) ? data : []; + // Estados internos da tabela const [sorting, setSorting] = React.useState([]); const [columnFilters, setColumnFilters] = React.useState([]); @@ -59,8 +68,40 @@ export function DataTable({ // Configuração da tabela const table = useReactTable({ - data, - columns, + data: safeData, + columns: [ + ...columns, + ...(onEdit || onDelete + ? [ + { + id: 'actions', + header: 'Ações', + cell: ({ row }: any) => ( +
+ {onEdit && ( + + )} + {onDelete && ( + + )} +
+ ), + } as ColumnDef, + ] + : []), + ], state: { sorting, columnFilters, @@ -84,9 +125,9 @@ export function DataTable({ {filterColumn && ( - table.getColumn(filterColumn as string)?.setFilterValue(e.target.value) + table.getColumn(filterColumn)?.setFilterValue(e.target.value) } className="w-full" /> @@ -95,7 +136,8 @@ export function DataTable({ @@ -133,9 +175,13 @@ export function DataTable({ ))} - {table.getRowModel().rows.length ? ( + {table.getRowModel().rows?.length ? ( table.getRowModel().rows.map((row) => ( - + onRowClick?.(row.original)} + > {row.getVisibleCells().map((cell) => ( {flexRender(cell.column.columnDef.cell, cell.getContext())} @@ -145,7 +191,10 @@ export function DataTable({ )) ) : ( - + Nenhum resultado encontrado. @@ -155,27 +204,55 @@ export function DataTable({ {/* Paginação */} -
- - +
+ + Página {table.getState().pagination.pageIndex + 1} de {table.getPageCount()} + + +
+ + + + +
); diff --git a/src/components/app-sidebar.tsx b/src/components/app-sidebar.tsx index 6331a5c..c2ec53c 100644 --- a/src/components/app-sidebar.tsx +++ b/src/components/app-sidebar.tsx @@ -30,6 +30,7 @@ import { } from '@/components/ui/sidebar'; import useGUsuarioGetJWTHook from '@/hooks/auth/useGUsuarioGetJWTHook'; +import Image from 'next/image'; // This is sample data. const data = { @@ -75,6 +76,22 @@ const data = { }, ], }, + { + title: 'Pessoas', + url: '#', + icon: SquareTerminal, + isActive: false, + items: [ + { + title: 'Físicas', + url: '/administrativo/pessoas/fisicas', + }, + { + title: 'Jurídicas', + url: '/administrativo/pessoas/fisicas', + }, + ], + }, { title: 'Cadastros', url: '#', @@ -149,12 +166,8 @@ const data = { url: '/cadastros/censec/', }, { - title: 'Pessoas/Físicas', - url: '/cadastros/pessoa/fisica', - }, - { - title: 'Pessoas/Jurídica', - url: '/cadastros/pessoa/juridica', + title: 'Imovel/Urbano', + url: '/cadastros/imoveis/urbanos', }, ], }, @@ -226,7 +239,6 @@ const data = { export function AppSidebar({ ...props }: React.ComponentProps) { const { userAuthenticated } = useGUsuarioGetJWTHook(); - return ( @@ -236,28 +248,34 @@ export function AppSidebar({ ...props }: React.ComponentProps) {
+ Logo do site
-
- Orius Tecnologia - - 25.9.1 + + Orius Tecnologia + + + 25.9.1 +
- - {userAuthenticated?.data ? : 'Carregando...'} -
); diff --git a/src/enums/ImovelConstrucaoEnum.ts b/src/enums/ImovelConstrucaoEnum.ts new file mode 100644 index 0000000..a28f354 --- /dev/null +++ b/src/enums/ImovelConstrucaoEnum.ts @@ -0,0 +1,5 @@ +export const ImovelConstrucaoEnum: { [key: number]: string } = { + 0: 'Construção averbada', + 1: 'Em construção', + 2: 'Não se aplica', +}; \ No newline at end of file diff --git a/src/enums/ImovelTipoClasseEnum.ts b/src/enums/ImovelTipoClasseEnum.ts new file mode 100644 index 0000000..0f4a3dc --- /dev/null +++ b/src/enums/ImovelTipoClasseEnum.ts @@ -0,0 +1,4 @@ +export const ImovelTipoClasseEnum: { [key: number]: string } = { + 1: 'Urbano', + 3: 'Rural', +}; \ No newline at end of file diff --git a/src/enums/ImovelTipoEnum.ts b/src/enums/ImovelTipoEnum.ts new file mode 100644 index 0000000..edebfa5 --- /dev/null +++ b/src/enums/ImovelTipoEnum.ts @@ -0,0 +1,22 @@ +export const ImovelTipoEnum: { [key: number]: string } = { + 15: 'Loja', + 31: 'Galpão', + 65: 'Apartamento', + 67: 'Casa', + 69: 'Fazenda / Sítio / Chácara', + 71: 'Terreno / Fração', + 89: 'Outros', + 90: 'Sala', + 91: 'Conjunto de salas', + 92: 'Sobreloja', + 17: 'Sala / Conjunto', + 33: 'Prédio Comercial', + 35: 'Prédio Residencial', + 73: 'Sala ou Loja', + 85: 'Construções', + 87: 'Desmembramento', + 93: 'Vaga de Garagem', + 94: 'Laje', + 95: 'Estacionamento', + 96: 'Barraco' +}; \ No newline at end of file diff --git a/src/enums/ImovelTipoRegistro.ts b/src/enums/ImovelTipoRegistro.ts new file mode 100644 index 0000000..5476b98 --- /dev/null +++ b/src/enums/ImovelTipoRegistro.ts @@ -0,0 +1,5 @@ +export enum ImovelTipoRegistro { + M = 'Matrícula', + T = 'Transcrição', + I = 'Inscrição', +} \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaTable.tsx b/src/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaColumns.tsx similarity index 76% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaTable.tsx rename to src/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaColumns.tsx index 8de3217..120b85c 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaTable.tsx +++ b/src/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaColumns.tsx @@ -1,41 +1,21 @@ -'use client'; - -import { Button } from '@/components/ui/button'; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuGroup, - DropdownMenuItem, - DropdownMenuSeparator, - DropdownMenuTrigger, -} from '@/components/ui/dropdown-menu'; - -import { ArrowUpDownIcon, EllipsisIcon, PencilIcon, Trash2Icon } from 'lucide-react'; -import { ColumnDef } from '@tanstack/react-table'; - -import GetNameInitials from '@/actions/text/GetNameInitials'; -import { DataTable } from '@/app/_components/dataTable/DataTable'; - -import TPessoaInterface from '../../_interfaces/TPessoaInterface'; -import { FormatCPF } from '@/actions/CPF/FormatCPF'; -import { FormatPhone } from '@/actions/phone/FormatPhone'; -import { FormatDateTime } from '@/actions/dateTime/FormatDateTime'; -import empty from '@/actions/validations/empty'; - -// Tipagem das props -interface TPessoaTableProps { - data: TPessoaInterface[]; - onEdit: (item: TPessoaInterface, isEditingFormStatus: boolean) => void; - onDelete: (item: TPessoaInterface, isEditingFormStatus: boolean) => void; -} +import { FormatCPF } from "@/actions/CPF/FormatCPF"; +import { FormatDateTime } from "@/actions/dateTime/FormatDateTime"; +import { FormatPhone } from "@/actions/phone/FormatPhone"; +import GetNameInitials from "@/actions/text/GetNameInitials"; +import empty from "@/actions/validations/empty"; +import { Button } from "@/components/ui/button"; +import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; +import TPessoaFisicaInterface from "@/packages/administrativo/interfaces/TPessoa/TPessoaFisica/TPessoaFisicaInterface"; +import { ColumnDef } from "@tanstack/react-table"; +import { ArrowUpDownIcon, EllipsisIcon, PencilIcon, Trash2Icon } from "lucide-react"; /** * Função para criar a definição das colunas da tabela */ -function createPessoaColumns( - onEdit: (item: TPessoaInterface, isEditingFormStatus: boolean) => void, - onDelete: (item: TPessoaInterface, isEditingFormStatus: boolean) => void, -): ColumnDef[] { +export function TPessoaFisicaColumns( + onEdit: (item: TPessoaFisicaInterface, isEditingFormStatus: boolean) => void, + onDelete: (item: TPessoaFisicaInterface, isEditingFormStatus: boolean) => void, +): ColumnDef[] { return [ // ID { @@ -196,21 +176,4 @@ function createPessoaColumns( enableHiding: false, }, ]; -} - -/** - * Componente principal da tabela - */ -export default function TPessoaTable({ data, onEdit, onDelete }: TPessoaTableProps) { - const columns = createPessoaColumns(onEdit, onDelete); - return ( -
- -
- ); -} +} \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaForm.tsx b/src/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaForm.tsx similarity index 94% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaForm.tsx rename to src/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaForm.tsx index a44d02d..3af6e23 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaForm.tsx +++ b/src/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaForm.tsx @@ -1,9 +1,6 @@ 'use client'; -import z from 'zod'; import React, { useEffect } from 'react'; -import { useForm, Controller } from 'react-hook-form'; -import { zodResolver } from '@hookform/resolvers/zod'; import { Button } from '@/components/ui/button'; import { @@ -25,7 +22,6 @@ import { } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; -import { TPessoaSchema } from '../../_schemas/TPessoaSchema'; import LoadingButton from '@/app/_components/loadingButton/LoadingButton'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { @@ -33,14 +29,13 @@ import { SelectContent, SelectItem, SelectTrigger, - SelectValue, } from '@/components/ui/select'; import { CheckIcon, ChevronsUpDownIcon, HouseIcon, IdCardIcon, UserIcon } from 'lucide-react'; import { Sexo } from '@/enums/SexoEnum'; -import { useGTBEstadoCivilReadHook } from '../../_hooks/g_tb_estadocivil/useGTBEstadoCivilReadHook'; +import { useGTBEstadoCivilReadHook } from '../../../../../app/(protected)/(cadastros)/cadastros/_hooks/g_tb_estadocivil/useGTBEstadoCivilReadHook'; import GetCapitalize from '@/actions/text/GetCapitalize'; -import { useGTBRegimeComunhaoReadHook } from '../../_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoReadHook'; -import { useGTBProfissaoReadHook } from '../../_hooks/g_tb_profissao/useGTBProfissaoReadHook'; +import { useGTBRegimeComunhaoReadHook } from '../../../../../app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoReadHook'; +import { useGTBProfissaoReadHook } from '../../../../../app/(protected)/(cadastros)/cadastros/_hooks/g_tb_profissao/useGTBProfissaoReadHook'; import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; import { Command, @@ -51,50 +46,36 @@ import { CommandList, } from '@/components/ui/command'; import { cn } from '@/lib/utils'; +import TPessoaFisicaFormInterface from '../../../interfaces/TPessoa/TPessoaFisica/TPessoaFisicaFormInterface'; +import { ResetFormIfData } from '@/actions/form/ResetFormIfData'; +import { useTPessoaForm } from '@/packages/administrativo/hooks/t_pessoa/fisica/usetTPessoaFormHook'; -type FormValues = z.infer; - -interface TPessoaFormProps { - isOpen: boolean; - data: FormValues | null; - onClose: (item: null, isFormStatus: boolean) => void; - onSave: (data: FormValues) => void; - buttonIsLoading: boolean; -} - -export default function TCensecForm({ +export default function TPessoaFisicaForm({ isOpen, data, onClose, onSave, buttonIsLoading, -}: TPessoaFormProps) { +}: TPessoaFisicaFormInterface) { + const { gTBProfissao, fetchGTBProfissao } = useGTBProfissaoReadHook(); const { gTBEstadoCivil, fetchGTBEstadoCivil } = useGTBEstadoCivilReadHook(); const { gTBRegimeComunhao, fetchGTBRegimeComunhao } = useGTBRegimeComunhaoReadHook(); // Inicializa o react-hook-form com schema zod - const form = useForm({ - resolver: zodResolver(TPessoaSchema), - defaultValues: { - nome: '', - pessoa_id: 0, - }, - }); + const form = useTPessoaForm({}); // Atualiza o formulário quando recebe dados para edição useEffect(() => { // Função para carregar os dados de forma sincrona const loadData = async () => { // Se existir dados, reseta o formulário com os dados informados - if (data) form.reset(data); - + ResetFormIfData(form, data) // Aguarda a busca terminar await fetchGTBProfissao(); await fetchGTBEstadoCivil(); await fetchGTBRegimeComunhao(); }; - // Dispara a função loadData(); }, [data, form]); @@ -108,10 +89,13 @@ export default function TCensecForm({ > - Pessoa - Preencha os dados da pessoa + + Pessoa Física + + + Preencha os dados da pessoa + - {/* Tabs */} @@ -128,7 +112,6 @@ export default function TCensecForm({ Documentos - {/* Dados Pessoais */}
@@ -312,10 +295,10 @@ export default function TCensecForm({ className="justify-between" > {field.value - ? gTBEstadoCivil.find( - (item) => - String(item.tb_estadocivil_id) === String(field.value), - )?.descricao + ? gTBEstadoCivil?.find( + (item) => + String(item.tb_estadocivil_id) === String(field.value), + )?.descricao : 'Escolha o estado civil'} @@ -378,11 +361,11 @@ export default function TCensecForm({ className="justify-between" > {field.value - ? gTBRegimeComunhao.find( - (item) => - String(item.tb_regimecomunhao_id) === - String(field.value), - )?.descricao + ? gTBRegimeComunhao?.find( + (item) => + String(item.tb_regimecomunhao_id) === + String(field.value), + )?.descricao : 'Escolha o regime'} @@ -446,10 +429,10 @@ export default function TCensecForm({ className="justify-between" > {field.value - ? gTBProfissao.find( - (item) => - String(item.tb_profissao_id) === String(field.value), - )?.descricao + ? gTBProfissao?.find( + (item) => + String(item.tb_profissao_id) === String(field.value), + )?.descricao : 'Escolha a profissão'} @@ -534,7 +517,6 @@ export default function TCensecForm({
- {/* Endereço */}
@@ -700,7 +682,6 @@ export default function TCensecForm({
- {/* Documentos */}
@@ -720,7 +701,6 @@ export default function TCensecForm({ )} />
- {/* Número */}
- {/* CPF */}
- {/* Órgão Emissor */}
- {/* UF */}
- {/* Data de Expedição */}
- {/* Validade */}
- {/* Rodapé do Dialog */} @@ -849,7 +823,6 @@ export default function TCensecForm({ loading={buttonIsLoading} /> - {/* Campo oculto */} diff --git a/src/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaTable.tsx b/src/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaTable.tsx new file mode 100644 index 0000000..4179571 --- /dev/null +++ b/src/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaTable.tsx @@ -0,0 +1,22 @@ +'use client'; + +import { DataTable } from '@/app/_components/dataTable/DataTable'; +import TPessoaFisicaTableInterface from '@/packages/administrativo/interfaces/TPessoa/TPessoaFisica/TPessoaFisicaTableInterface'; +import { TPessoaFisicaColumns } from './TPessoaFisicaColumns'; + +/** + * Componente principal da tabela + */ +export default function TPessoaFisicaTable({ data, onEdit, onDelete }: TPessoaFisicaTableInterface) { + const columns = TPessoaFisicaColumns(onEdit, onDelete); + return ( +
+ +
+ ); +} diff --git a/src/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaColumns.tsx b/src/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaColumns.tsx new file mode 100644 index 0000000..9adc96c --- /dev/null +++ b/src/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaColumns.tsx @@ -0,0 +1,159 @@ +import { FormatCNPJ } from "@/actions/CNPJ/FormatCNPJ"; +import { FormatDateTime } from "@/actions/dateTime/FormatDateTime"; +import { FormatPhone } from "@/actions/phone/FormatPhone"; +import empty from "@/actions/validations/empty"; +import { Button } from "@/components/ui/button"; +import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"; +import TPessoaJuridicaInterface from "@/packages/administrativo/interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaInterface"; +import { ColumnDef } from "@tanstack/react-table"; +import { ArrowUpDownIcon, EllipsisIcon, PencilIcon, Trash2Icon } from "lucide-react"; + +export default function TPessoaJuridicaColumns( + onEdit: (item: TPessoaJuridicaInterface, isEditingFormStatus: boolean) => void, + onDelete: (item: TPessoaJuridicaInterface, isEditingFormStatus: boolean) => void, +): ColumnDef[] { + return [ + // ID + { + accessorKey: 'pessoa_id', + header: ({ column }) => ( + + ), + cell: ({ row }) => Number(row.getValue('pessoa_id')), + enableSorting: false, + }, + + // Nome / Email / Foto + { + id: 'nome_completo', + accessorFn: (row) => row, + header: ({ column }) => ( + + ), + cell: ({ row }) => { + const pessoa = row.original; + return ( +
+ {/* Nome e Email */} +
+
{pessoa.nome || '-'}
+
+ {empty(pessoa.email) ? 'Email não informado' : pessoa.email} +
+
+
+ ); + }, + sortingFn: (a, b) => + (a.original.nome?.toLowerCase() || '').localeCompare(b.original.nome?.toLowerCase() || ''), + }, + + // CPF + { + accessorKey: 'cpf_cnpj', + header: ({ column }) => ( + + ), + cell: ({ row }) => FormatCNPJ(row.getValue('cpf_cnpj')), + }, + + // Telefone + { + accessorKey: 'telefone', + header: ({ column }) => ( + + ), + cell: ({ row }) => FormatPhone(row.getValue('telefone')), + }, + + // Cidade / UF + { + id: 'cidade_uf', + accessorFn: (row) => `${row.cidade}/${row.uf}`, + header: ({ column }) => ( + + ), + cell: ({ row }) => {row.getValue('cidade_uf') || '-'}, + sortingFn: (a, b) => + `${a.original.cidade}/${a.original.uf}` + .toLowerCase() + .localeCompare(`${b.original.cidade}/${b.original.uf}`.toLowerCase()), + }, + + // Data de cadastro + { + accessorKey: 'data_cadastro', + header: ({ column }) => ( + + ), + cell: ({ row }) => FormatDateTime(row.getValue('data_cadastro')), + sortingFn: 'datetime', + }, + + // Ações + { + id: 'actions', + header: 'Ações', + cell: ({ row }) => { + const pessoa = row.original; + return ( + + + + + + + onEdit(pessoa, true)}> + + Editar + + + onDelete(pessoa, true)} + > + + Remover + + + + + ); + }, + enableSorting: false, + enableHiding: false, + }, + ]; +} diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/juridica/TPessoaJuridicaForm.tsx b/src/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaForm.tsx similarity index 98% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/juridica/TPessoaJuridicaForm.tsx rename to src/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaForm.tsx index ce2f5ff..8db35d4 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/juridica/TPessoaJuridicaForm.tsx +++ b/src/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaForm.tsx @@ -25,12 +25,12 @@ import { } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; -import { TPessoaSchema } from '../../../_schemas/TPessoaSchema'; +import { TPessoaSchema } from '../../../schemas/TPessoa/TPessoaSchema'; import LoadingButton from '@/app/_components/loadingButton/LoadingButton'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { HouseIcon, IdCardIcon, UserIcon } from 'lucide-react'; import { Textarea } from '@/components/ui/textarea'; -import { useTPessoaRepresentanteIndexHook } from '../../../_hooks/t_pessoa_representante/useTPessoaRepresentanteIndexHook'; +import { useTPessoaRepresentanteIndexHook } from '../../../hooks/t_pessoa_representante/useTPessoaRepresentanteIndexHook'; import TPessoaRepresentantePage from '../../t_pessoa_representante/TPessoaRepresentantePage'; type FormValues = z.infer; diff --git a/src/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaTable.tsx b/src/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaTable.tsx new file mode 100644 index 0000000..eafa92c --- /dev/null +++ b/src/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaTable.tsx @@ -0,0 +1,27 @@ +'use client'; + +import { DataTable } from '@/app/_components/dataTable/DataTable'; + +import TPessoaJuridicaColumns from './TPessoaJuridicaColumns'; +import TPessoaJuridicaTableInterface from '@/packages/administrativo/interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaTableInterface'; + +/** + * Componente principal da tabela + */ +export default function TPessoaJuridicaTable({ + data, + onEdit, + onDelete, +}: TPessoaJuridicaTableInterface) { + const columns = TPessoaJuridicaColumns(onEdit, onDelete); + return ( +
+ +
+ ); +} diff --git a/src/packages/administrativo/components/t_imovel/TImovelColumns.tsx b/src/packages/administrativo/components/t_imovel/TImovelColumns.tsx new file mode 100644 index 0000000..f999aac --- /dev/null +++ b/src/packages/administrativo/components/t_imovel/TImovelColumns.tsx @@ -0,0 +1,125 @@ +import { ColumnDef } from "@tanstack/react-table"; +import TImovelInterface from "../../interfaces/TImovelInterface"; +import { Button } from "@/components/ui/button"; +import { + EllipsisIcon, + PencilIcon, + Trash2Icon, +} from "lucide-react"; +import { FormatDateTime } from "@/actions/dateTime/FormatDateTime"; +import { FormatCEP } from "@/actions/CEP/FormatCEP"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuGroup, + DropdownMenuItem, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import { ImovelTipoRegistro } from "@/enums/ImovelTipoRegistro"; +import { SortableHeader } from "@/app/_components/dataTable/SortableHeader"; + +export default function TImovelColumns( + onEdit: (item: TImovelInterface, isEditingFormStatus: boolean) => void, + onDelete: (item: TImovelInterface, isEditingFormStatus: boolean) => void +): ColumnDef[] { + return [ + // ID + { + accessorKey: "imovel_id", + header: ({ column }) => SortableHeader("#", column), + cell: ({ row }) => Number(row.getValue("imovel_id")), + enableSorting: false, + }, + + // Tipo Registro + { + accessorKey: "tipo_registro", + header: ({ column }) => SortableHeader("Tipo Registro", column), + cell: ({ row }) => { + const value = row.getValue("tipo_registro") as keyof typeof ImovelTipoRegistro; + return ImovelTipoRegistro[value] ?? value; + }, + }, + + // Número + { + accessorKey: "numero", + header: ({ column }) => SortableHeader("Número", column), + cell: ({ row }) => row.getValue("numero"), + }, + + // UF / Cidade / Bairro + { + id: "uf_cidade_bairro", + accessorFn: (row) => row, + header: ({ column }) => SortableHeader("Cidade / UF / Bairro", column), + cell: ({ row }) => { + const imovel = row.original; + return ( +
+ + {imovel.cidade}/{imovel.uf} + + {imovel.gtb_descricao} +
+ ); + }, + sortingFn: (a, b) => + (a.original.cartorio?.toLowerCase() || "").localeCompare( + b.original.cartorio?.toLowerCase() || "" + ), + }, + + // CEP + { + accessorKey: "cep", + header: ({ column }) => SortableHeader("CEP", column), + cell: ({ row }) => FormatCEP(row.getValue("cep")), + }, + + // Data de Registro + { + accessorKey: "data_registro", + header: ({ column }) => SortableHeader("Cadastro", column), + cell: ({ row }) => FormatDateTime(row.getValue("data_registro")), + sortingFn: "datetime", + }, + + // Ações + { + id: "actions", + header: "Ações", + cell: ({ row }) => { + const imovel = row.original; + return ( + + + + + + + onEdit(imovel, true)}> + + Editar + + + onDelete(imovel, true)} + > + + Remover + + + + + ); + }, + enableSorting: false, + enableHiding: false, + }, + ]; +} diff --git a/src/packages/administrativo/components/t_imovel/TImovelForm.tsx b/src/packages/administrativo/components/t_imovel/TImovelForm.tsx new file mode 100644 index 0000000..0638319 --- /dev/null +++ b/src/packages/administrativo/components/t_imovel/TImovelForm.tsx @@ -0,0 +1,386 @@ +'use client'; + +import React, { useEffect } from 'react'; +import { useForm } from 'react-hook-form'; +import { zodResolver } from '@hookform/resolvers/zod'; + +import { Button } from '@/components/ui/button'; +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 { TImovelFormValues, TImovelSchema } from '../../schemas/TImovelSchema'; +import LoadingButton from '@/app/_components/loadingButton/LoadingButton'; +import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; +import { CheckIcon, ChevronsUpDownIcon, HouseIcon, IdCardIcon } from 'lucide-react'; +import { Select, SelectContent, SelectItem, SelectTrigger } from '@/components/ui/select'; +import TImovelUnidadePage from '../t_imovel_unidade/TImovelUnidadePage'; +import { ImovelTipoRegistro } from '@/enums/ImovelTipoRegistro'; +import { ImovelTipoClasseEnum } from '@/enums/ImovelTipoClasseEnum'; +import { ResetFormIfData } from '@/actions/form/ResetFormIfData'; +import { TImovelFormProps } from './TImovelFormProps'; +import { useGTBBairroReadHook } from '../../../../app/(protected)/(cadastros)/cadastros/_hooks/g_tb_bairro/useGTBBairroReadHook'; +import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; +import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from '@/components/ui/command'; +import { cn } from '@/lib/utils'; +import GetCapitalize from '@/actions/text/GetCapitalize'; + +export default function TImovelForm({ isOpen, data, onClose, onSave, buttonIsLoading }: TImovelFormProps) { + + const { gTBBairro, fetchGTBBairro } = useGTBBairroReadHook(); + + // Inicializa o react-hook-form com schema zod + const form = useForm({ + resolver: zodResolver(TImovelSchema), + defaultValues: {}, + }); + + // Atualiza o formulário quando recebe dados para edição + useEffect(() => { + + // Se existir dados, reseta o formulário com os mesmos + ResetFormIfData(form, data); + + // Função sincrona para carregamento de dados + async function loadData() { + + // Busca os bairros + await fetchGTBBairro(); + + } + + // Executa a função + loadData(); + + }, [data, form]); + + return ( + { + if (!open) onClose(null, false); + }} + > + + + + Imóvel Urbano + + + Cadastro de imóvel urbano + + +
+ + {/* Tabs */} + + + + + Dados do Imóvel + + + + Unidades + + + {/* Dados do Imóvel */} + +
+ {/* UF */} +
+ ( + + UF + + + + + + )} + /> +
+ {/* CEP */} +
+ ( + + CEP + + + + + + )} + /> +
+ {/* Cidade */} +
+ ( + + Cidade + + + + + + )} + /> +
+ {/* Bairro */} +
+ { + const [open, setOpen] = React.useState(false); + return ( + + Bairro + + + + + + + + + + + Nenhum resultado encontrado. + + {gTBBairro?.map((item) => ( + { + field.onChange(Number(item.tb_bairro_id)); + setOpen(false); + }} + > + + {GetCapitalize(item.descricao)} + + ))} + + + + + + + + ); + }} + /> +
+ {/* Cartório */} +
+ ( + + Cartório + + + + + + )} + /> +
+ {/* CNS */} +
+ ( + + CNS + + + + + + )} + /> +
+ {/* Livro */} +
+ ( + + Livro + + + + + + )} + /> +
+ {/* Tipo Registro */} +
+ ( + + Tipo Registro + + + + + + )} + /> +
+ {/* Número */} +
+ ( + + Número + + + + + + )} + /> +
+ {/* Número Letra */} +
+ ( + + Número Letra + + + + + + )} + /> +
+ {/* Tipo Registro */} +
+ ( + + Tipo Classe + + + + + + )} + /> +
+
+
+ {/* Unidades */} + + {/* Conteúdo das unidades */} + < TImovelUnidadePage /> + +
+ {/* Rodapé do Dialog */} + + + + + + + {/* Campo oculto */} + +
+ +
+
+ ); +} \ No newline at end of file diff --git a/src/packages/administrativo/components/t_imovel/TImovelFormProps.ts b/src/packages/administrativo/components/t_imovel/TImovelFormProps.ts new file mode 100644 index 0000000..23a41b1 --- /dev/null +++ b/src/packages/administrativo/components/t_imovel/TImovelFormProps.ts @@ -0,0 +1,7 @@ +export interface TImovelFormProps { + isOpen: boolean; + data: FormValues | null; + onClose: (item: null, isFormStatus: boolean) => void; + onSave: (data: FormValues) => void; + buttonIsLoading: boolean; +} \ No newline at end of file diff --git a/src/packages/administrativo/components/t_imovel/TImovelTable.tsx b/src/packages/administrativo/components/t_imovel/TImovelTable.tsx new file mode 100644 index 0000000..db08e6a --- /dev/null +++ b/src/packages/administrativo/components/t_imovel/TImovelTable.tsx @@ -0,0 +1,28 @@ +'use client'; + +import { DataTable } from '@/app/_components/dataTable/DataTable'; +import TImovelColumns from './TImovelColumns'; +import TImovelInterface from '../../interfaces/TImovelInterface'; + +interface TImovelTableProps { + data?: TImovelInterface[]; + onEdit: (item: TImovelInterface, isEditingFormStatus: boolean) => void; + onDelete: (item: TImovelInterface, isEditingFormStatus: boolean) => void; +} + +/** + * Componente principal da tabela + */ +export default function TPessoaTable({ data, onEdit, onDelete }: TImovelTableProps) { + const columns = TImovelColumns(onEdit, onDelete); + return ( +
+ +
+ ); +} \ No newline at end of file diff --git a/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeColumns.tsx b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeColumns.tsx new file mode 100644 index 0000000..486c30c --- /dev/null +++ b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeColumns.tsx @@ -0,0 +1,90 @@ +import { ColumnDef } from "@tanstack/react-table"; +import TImovelUnidadeInterface from "../../interfaces/TImovelUnidadeInterface"; +import { Button } from "@/components/ui/button"; +import { + EllipsisIcon, + PencilIcon, + Trash2Icon, +} from "lucide-react"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuGroup, + DropdownMenuItem, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import { SortableHeader } from "@/app/_components/dataTable/SortableHeader"; + +export default function TImovelUnidadeColumns( + onEdit: (item: TImovelUnidadeInterface, isEditingFormStatus: boolean) => void, + onDelete: (item: TImovelUnidadeInterface, isEditingFormStatus: boolean) => void +): ColumnDef[] { + return [ + // ID + { + accessorKey: "imovel_unidade_id", + header: ({ column }) => SortableHeader("#", column), + cell: ({ row }) => Number(row.getValue("imovel_unidade_id")), + }, + // Número da Unidade + { + accessorKey: "numero_unidade", + header: ({ column }) => SortableHeader("Número da Unidade", column), + cell: ({ row }) => row.getValue("numero_unidade"), + }, + // Quadra + { + accessorKey: "quadra", + header: ({ column }) => SortableHeader("Quadra", column), + cell: ({ row }) => row.getValue("quadra"), + }, + // Area + { + accessorKey: "area", + header: ({ column }) => SortableHeader("Área", column), + cell: ({ row }) => row.getValue("area"), + }, + // Logradouros + { + accessorKey: "logradouro", + header: ({ column }) => SortableHeader("Logradouro", column), + cell: ({ row }) => row.getValue("logradouro"), + }, + // Ações + { + id: "actions", + header: "Ações", + cell: ({ row }) => { + const imovel = row.original; + return ( + + + + + + + onEdit(imovel, true)}> + + Editar + + + onDelete(imovel, true)} + > + + Remover + + + + + ); + }, + enableSorting: false, + enableHiding: false, + }, + ]; +} diff --git a/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeForm.tsx b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeForm.tsx new file mode 100644 index 0000000..89f5174 --- /dev/null +++ b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeForm.tsx @@ -0,0 +1,545 @@ +'use client'; + +import React, { useEffect } from 'react'; +import { useForm } from 'react-hook-form'; +import { zodResolver } from '@hookform/resolvers/zod'; + +import { Button } from '@/components/ui/button'; +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 LoadingButton from '@/app/_components/loadingButton/LoadingButton'; +import { TImovelUnidadeFormValues, TImovelUnidadeSchema } from '../../schemas/TImovelUnidadeSchema'; +import TImovelUnidadeProps from './TImovelUnidadeFormProps'; +import { useGTBTipoLogradouroReadHook } from '../../../../app/(protected)/(cadastros)/cadastros/_hooks/g_tb_tipologradouro/useGTBTipoLogradouroReadHook'; +import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; +import { CheckIcon, ChevronsUpDownIcon } from 'lucide-react'; +import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from '@/components/ui/command'; +import { cn } from '@/lib/utils'; +import GetCapitalize from '@/actions/text/GetCapitalize'; +import { ResetFormIfData } from '@/actions/form/ResetFormIfData'; +import { parseNumberInput } from '@/actions/form/parseNumberInput'; +import { ImovelTipoEnum } from '@/enums/ImovelTipoEnum'; +import { ImovelConstrucaoEnum } from '@/enums/ImovelConstrucaoEnum'; + +export default function TImovelUnidadeForm({ isOpen, data, onClose, onSave, buttonIsLoading }: TImovelUnidadeProps) { + + const { gTBTipoLogradouro, fetchGTBTipoLogradouro } = useGTBTipoLogradouroReadHook(); + + // Inicializa o react-hook-form com schema zod + const form = useForm({ + resolver: zodResolver(TImovelUnidadeSchema), + defaultValues: { + imovel_id: 1, + }, + }); + + // Atualiza o formulário quando recebe dados para edição + useEffect(() => { + + // Se existir dados, reseta o formulário com os mesmos + ResetFormIfData(form, data); + + // Carregamento de dados iniciais + async function loadData() { + + // Carrega o tipo de logradouro + await fetchGTBTipoLogradouro(); + + } + + // Executa a função + loadData(); + + }, [data, form]); + + return ( + { + if (!open) onClose(null, false); + }} + > + + + + Unidades do Imóvel + + + Cadastro de unidades do imóvel + + +
+ +
+ {/* Quadra */} +
+ ( + + Quadra + + + + + + )} + /> +
+ {/* Lote */} +
+ ( + + Lote + + + + + + )} + /> +
+ {/* Area */} +
+ ( + + Área(m2) + + field.onChange(parseNumberInput(e))} + /> + + + + )} + /> +
+ {/* Inscrição Municipal */} +
+ ( + + Inscrição Municipal + + + + + + )} + /> +
+ {/* Tipo Logradouro */} +
+ { + const [open, setOpen] = React.useState(false); + return ( + + Tipo logradouro + + + + + + + + + + + Nenhum resultado encontrado. + + {gTBTipoLogradouro?.map((item) => ( + { + field.onChange(Number(item.tb_tipologradouro_id)); + setOpen(false); + }} + > + + {GetCapitalize(item.descricao)} + + ))} + + + + + + + + ); + }} + /> +
+ {/* Logradouro */} +
+ ( + + Logradouro + + + + + + )} + /> +
+ {/* Tipo Imóvel */} +
+ { + const [open, setOpen] = React.useState(false); + // transforma o objeto em um array [{value, label}] + const options = Object.entries(ImovelTipoEnum).map(([id, label]) => ({ + value: Number(id), + label, + })); + return ( + + Tipo Imóvel + + + + + + + + + + + Nenhum resultado encontrado. + + {options.map((item) => ( + { + field.onChange(item.value); // salva o número (id) + setOpen(false); + }} + > + + {item.label} + + ))} + + + + + + + + ); + }} + /> +
+ {/* Construção */} +
+ { + const [open, setOpen] = React.useState(false); + const options = Object.entries(ImovelConstrucaoEnum).map(([id, label]) => ({ + value: Number(id), + label, + })); + return ( + + Construção + + + + + + + + + + + Nenhum resultado encontrado. + + {options.map((item) => ( + { + field.onChange(item.value); + setOpen(false); + }} + > + + {item.label} + + ))} + + + + + + + + ); + }} + /> +
+ {/* Iptu */} +
+ ( + + IPTU + + + + + + )} + /> +
+ {/* Unidade */} +
+ ( + + Unidade + + + + + + )} + /> +
+ {/* Torre */} +
+ ( + + Torre + + + + + + )} + /> +
+ {/* Condominio */} +
+ ( + + Condominio + + + + + + )} + /> +
+ {/* Loteamento */} +
+ ( + + Loteamento + + + + + + )} + /> +
+ {/* CNM */} +
+ ( + + CNM + + + + + + )} + /> +
+ {/* CIB */} +
+ ( + + CIB + + + + + + )} + /> +
+ + {/* Numero da Edificação */} +
+ ( + + Número da Edificação + + + + + + )} + /> +
+ {/* Complemento */} +
+ ( + + Complemento + + + + + + )} + /> +
+
+ {/* Rodapé do Dialog */} + + + + + + + {/* Campo oculto */} + + +
+ +
+
+ ); +} diff --git a/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeFormProps.ts b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeFormProps.ts new file mode 100644 index 0000000..9df2ab7 --- /dev/null +++ b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeFormProps.ts @@ -0,0 +1,9 @@ +import { TImovelUnidadeFormValues } from "../../schemas/TImovelUnidadeSchema"; + +export default interface TImovelUnidadeProps { + isOpen: boolean; + data: TImovelUnidadeFormValues | null; + onClose: (item: null, isFormStatus: boolean) => void; + onSave: (data: TImovelUnidadeFormValues) => void; + buttonIsLoading: boolean; +} \ No newline at end of file diff --git a/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadePage.tsx b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadePage.tsx new file mode 100644 index 0000000..025a1e3 --- /dev/null +++ b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadePage.tsx @@ -0,0 +1,166 @@ +'use client'; + +import { useEffect, useState, useCallback } from 'react'; + +import Loading from '@/app/_components/loading/loading'; +import TImovelUnidadeTable from './TImovelUnidadeTable'; +import TImovelUnidadeForm from './TImovelUnidadeForm'; + +import { useTImovelUnidadeIndexHook } from '../../hooks/t_imovel_unidade/useTImovelUnidadeIndexHook'; +import { useTImovelUnidadeSaveHook } from '../../hooks/t_imovel_unidade/useTImovelUnidadeSaveHook'; +import { useTImovelUnidadeDeleteHook } from '../../hooks/t_imovel_unidade/useTImovelUnidadeDeleteHook'; + +import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog'; +import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog'; + +import TImovelUnidadeInterface from '../../interfaces/TImovelUnidadeInterface'; +import Header from '@/app/_components/structure/Header'; + +export default function TImovelUnidadePage() { + // Controle de estado do botão + const [buttonIsLoading, setButtonIsLoading] = useState(false); + + // Hooks para leitura e salvamento + const { tImovelUnidade, indexTImovelUnidade } = useTImovelUnidadeIndexHook(); + const { saveTImovelUnidade } = useTImovelUnidadeSaveHook(); + const { deleteTImovelUnidade } = useTImovelUnidadeDeleteHook(); + + // Estados + const [selectedAndamento, setSelectedAndamento] = useState(null); + const [isFormOpen, setIsFormOpen] = useState(false); + + // Estado para saber qual item será deletado + const [itemToDelete, setItemToDelete] = useState(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: TImovelUnidadeInterface | 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: TImovelUnidadeInterface) => { + // Coloca o botão em estado de loading + setButtonIsLoading(true); + + // Aguarda salvar o registro + await saveTImovelUnidade(formData); + + // Remove o botão em estado de loading + setButtonIsLoading(false); + + // Atualiza a lista de dados + indexTImovelUnidade(); + }, + [saveTImovelUnidade, indexTImovelUnidade, handleCloseForm], + ); + + /** + * Quando o usuário clica em "remover" na tabela + */ + const handleConfirmDelete = useCallback( + (item: TImovelUnidadeInterface) => { + // 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 deleteTImovelUnidade(itemToDelete); + + // Atualiza a lista + await indexTImovelUnidade(); + + // Limpa o item selecionado + setItemToDelete(null); + + // Fecha o modal + handleCancel(); + }, [itemToDelete, indexTImovelUnidade, handleCancel]); + + /** + * Busca inicial dos dados + */ + useEffect(() => { + indexTImovelUnidade(); + }, []); + + /** + * Tela de loading enquanto carrega os dados + */ + if (tImovelUnidade?.length == 0) { + return ; + } + + return ( +
+ {/* Cabeçalho */} +
{ + handleOpenForm(null); + }} + /> + {/* Tabela de andamentos */} + + {/* Modal de confirmação */} + + {/* Formulário de criação/edição */} + +
+ ); +} diff --git a/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeTable.tsx b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeTable.tsx new file mode 100644 index 0000000..b7323fe --- /dev/null +++ b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeTable.tsx @@ -0,0 +1,28 @@ +'use client'; + +import { DataTable } from '@/app/_components/dataTable/DataTable'; +import TImovelUnidadeInterface from '../../interfaces/TImovelUnidadeInterface'; +import TImovelUnidadeColumns from './TImovelUnidadeColumns'; + +interface TImovelUnidadeTableProps { + data: TImovelUnidadeInterface[]; + onEdit: (item: TImovelUnidadeInterface, isEditingFormStatus: boolean) => void; + onDelete: (item: TImovelUnidadeInterface, isEditingFormStatus: boolean) => void; +} + +/** + * Componente principal da tabela + */ +export default function TImovelUnidadeTable({ data, onEdit, onDelete }: TImovelUnidadeTableProps) { + const columns = TImovelUnidadeColumns(onEdit, onDelete); + return ( +
+ +
+ ); +} \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa_representante/TPessoaRepresentanteForm.tsx b/src/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentanteForm.tsx similarity index 92% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa_representante/TPessoaRepresentanteForm.tsx rename to src/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentanteForm.tsx index 145d2d5..7de7356 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa_representante/TPessoaRepresentanteForm.tsx +++ b/src/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentanteForm.tsx @@ -25,7 +25,7 @@ import { } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; -import { TPessoaSchema } from '../../_schemas/TPessoaSchema'; +import { TPessoaSchema } from '../../schemas/TPessoa/TPessoaSchema'; import LoadingButton from '@/app/_components/loadingButton/LoadingButton'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { @@ -47,10 +47,10 @@ import { UserIcon, } from 'lucide-react'; import { Sexo } from '@/enums/SexoEnum'; -import { useGTBEstadoCivilReadHook } from '../../_hooks/g_tb_estadocivil/useGTBEstadoCivilReadHook'; +import { useGTBEstadoCivilReadHook } from '../../../../app/(protected)/(cadastros)/cadastros/_hooks/g_tb_estadocivil/useGTBEstadoCivilReadHook'; import GetCapitalize from '@/actions/text/GetCapitalize'; -import { useGTBRegimeComunhaoReadHook } from '../../_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoReadHook'; -import { useGTBProfissaoReadHook } from '../../_hooks/g_tb_profissao/useGTBProfissaoReadHook'; +import { useGTBRegimeComunhaoReadHook } from '../../../../app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimecomunhao/useGTBRegimeComunhaoReadHook'; +import { useGTBProfissaoReadHook } from '../../../../app/(protected)/(cadastros)/cadastros/_hooks/g_tb_profissao/useGTBProfissaoReadHook'; import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; import { Command, @@ -61,9 +61,9 @@ import { CommandList, } from '@/components/ui/command'; import { cn } from '@/lib/utils'; -import { useTPessoaIndexHook } from '../../_hooks/t_pessoa/useTPessoaIndexHook'; -import TPessoaTable from '../t_pessoa/TPessoaTable'; -import TPessoaInterface from '../../_interfaces/TPessoaInterface'; +import { useTPessoaIndexHook } from '../../hooks/t_pessoa/useTPessoaIndexHook'; +import TPessoaTable from '../TPessoa/TPessoaFisica/TPessoaFisicaTable'; +import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface'; import { ColumnDef } from '@tanstack/react-table'; import GetNameInitials from '@/actions/text/GetNameInitials'; import empty from '@/actions/validations/empty'; diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa_representante/TPessoaRepresentantePage.tsx b/src/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentantePage.tsx similarity index 89% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa_representante/TPessoaRepresentantePage.tsx rename to src/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentantePage.tsx index f128564..5d8a5d7 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa_representante/TPessoaRepresentantePage.tsx +++ b/src/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentantePage.tsx @@ -3,18 +3,18 @@ import React, { useEffect, useState, useCallback } from 'react'; import Loading from '@/app/_components/loading/loading'; -import TPessoaForm from '../../_components/t_pessoa/TPessoaForm'; +import TPessoaForm from '../TPessoa/TPessoaFisica/TPessoaFisicaForm'; -import { useTPessoaIndexHook } from '../../_hooks/t_pessoa/useTPessoaIndexHook'; -import { useTPessoaSaveHook } from '../../_hooks/t_pessoa/useTPessoaSaveHook'; -import { useTPessoaDeleteHook } from '../../_hooks/t_pessoa/useTPessoaDeleteHook'; +import { useTPessoaIndexHook } from '../../hooks/t_pessoa/useTPessoaIndexHook'; +import { useTPessoaSaveHook } from '../../hooks/t_pessoa/useTPessoaSaveHook'; +import { useTPessoaDeleteHook } from '../../hooks/t_pessoa/useTPessoaDeleteHook'; import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog'; import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog'; -import TPessoaInterface from '../../_interfaces/TPessoaInterface'; +import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface'; import TPessoaRepresentanteTable from './TPessoaRepresentanteTable'; -import { useTPessoaRepresentanteIndexHook } from '../../_hooks/t_pessoa_representante/useTPessoaRepresentanteIndexHook'; +import { useTPessoaRepresentanteIndexHook } from '../../hooks/t_pessoa_representante/useTPessoaRepresentanteIndexHook'; import { Button } from '@/components/ui/button'; import Header from '@/app/_components/structure/Header'; import TPessoaRepresentanteForm from './TPessoaRepresentanteForm'; diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa_representante/TPessoaRepresentanteTable.tsx b/src/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentanteTable.tsx similarity index 98% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa_representante/TPessoaRepresentanteTable.tsx rename to src/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentanteTable.tsx index 1d0da91..dd7efe3 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa_representante/TPessoaRepresentanteTable.tsx +++ b/src/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentanteTable.tsx @@ -16,7 +16,7 @@ import { ColumnDef } from '@tanstack/react-table'; import GetNameInitials from '@/actions/text/GetNameInitials'; import { DataTable } from '@/app/_components/dataTable/DataTable'; -import TPessoaInterface from '../../_interfaces/TPessoaInterface'; +import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface'; import { FormatCPF } from '@/actions/CPF/FormatCPF'; import { FormatPhone } from '@/actions/phone/FormatPhone'; import empty from '@/actions/validations/empty'; diff --git a/src/packages/administrativo/data/TImovel/TImovelDeleteData.ts b/src/packages/administrativo/data/TImovel/TImovelDeleteData.ts new file mode 100644 index 0000000..ef3be0c --- /dev/null +++ b/src/packages/administrativo/data/TImovel/TImovelDeleteData.ts @@ -0,0 +1,13 @@ +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; +import TImovelInterface from "../../interfaces/TImovelInterface"; + +async function executeTImovelDeleteData(data: TImovelInterface) { + + return Promise.resolve({ + status: 200, + message: 'Dados Removidos' + }); + +} + +export const TImovelDeleteData = withClientErrorHandler(executeTImovelDeleteData); \ No newline at end of file diff --git a/src/packages/administrativo/data/TImovel/TImovelIndexData.ts b/src/packages/administrativo/data/TImovel/TImovelIndexData.ts new file mode 100644 index 0000000..c8eb517 --- /dev/null +++ b/src/packages/administrativo/data/TImovel/TImovelIndexData.ts @@ -0,0 +1,1614 @@ +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; + +async function executeTImovelIndexData() { + + return Promise.resolve({ + status: 200, + message: 'Dados Salvos', + data: [ + { + "imovel_id": 5459.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-10-30T14:49:45.000Z", + "numero": 12344.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "AP", + "tb_bairro_id": 189.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos", + }, + { + "imovel_id": 5456.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-10-30T13:32:18.000Z", + "numero": 412525.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 8.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5454.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-10-30T13:29:19.000Z", + "numero": 12344.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 69.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5453.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-10-25T11:42:49.000Z", + "numero": 16991.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 230.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5452.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-10-25T11:22:06.000Z", + "numero": 19550.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 44.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5451.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-10-23T19:16:26.000Z", + "numero": 3728.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 73.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5450.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-10-21T19:59:56.000Z", + "numero": 15248.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 118.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5449.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-10-16T11:28:22.000Z", + "numero": 19134.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 28.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5448.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-10-15T16:35:03.000Z", + "numero": 5313.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 110.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5447.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-10-14T17:39:48.000Z", + "numero": 10478.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 86.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5446.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-10-09T12:14:44.000Z", + "numero": 10014.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 72.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5445.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-10-07T19:49:40.000Z", + "numero": 10098.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 97.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5444.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-10-07T19:33:54.000Z", + "numero": 15781.00, + "numero_letra": "", + "cidade": "Abadiânia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 373.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5443.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-10-07T13:19:31.000Z", + "numero": 19255.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 87.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5442.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-10-07T12:48:41.000Z", + "numero": 19254.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 233.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5441.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-10-04T11:37:14.000Z", + "numero": 1250.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 89.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5440.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-10-03T12:27:14.000Z", + "numero": 19523.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 86.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5439.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-10-01T12:43:04.000Z", + "numero": 42782.00, + "numero_letra": "", + "cidade": "CAMPINAS", + "cep": 75850000.00, + "uf": "SP", + "tb_bairro_id": 372.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5438.00, + "tipo_classe": "1", + "tipo_registro": "T", + "data_registro": "2024-10-01T11:50:54.000Z", + "numero": 18418.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 73.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5437.00, + "tipo_classe": "1", + "tipo_registro": "T", + "data_registro": "2024-10-01T11:45:17.000Z", + "numero": 18417.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 73.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5436.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-10-01T11:40:42.000Z", + "numero": 12045.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 129.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5435.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-09-30T11:42:45.000Z", + "numero": 16368.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 68.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5434.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-09-27T20:15:07.000Z", + "numero": 7434.00, + "numero_letra": "", + "cidade": "Piranhas", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 371.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5432.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-09-27T18:11:19.000Z", + "numero": 15779.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 43.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5431.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-09-27T11:25:13.000Z", + "numero": 17255.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 39.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5430.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-26T19:42:10.000Z", + "numero": 19574.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 8.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5429.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-09-26T13:33:52.000Z", + "numero": 19554.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 68.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5428.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-09-26T12:54:18.000Z", + "numero": 19555.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 68.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5427.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-09-25T17:35:16.000Z", + "numero": 18755.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 109.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5426.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-09-25T11:33:04.000Z", + "numero": 19576.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 370.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5425.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-23T11:38:35.000Z", + "numero": 7780.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 72.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5423.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-19T11:13:01.000Z", + "numero": 19125.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 86.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5422.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-13T20:05:40.000Z", + "numero": 31806.00, + "numero_letra": "", + "cidade": "Jataí", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 369.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5421.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-13T11:35:23.000Z", + "numero": 18472.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 93.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5420.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-12T18:07:24.000Z", + "numero": 17826.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 80.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5419.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-09-11T14:20:51.000Z", + "numero": 19553.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 68.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5418.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-09-10T16:51:46.000Z", + "numero": 18860.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 68.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5417.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-09-10T16:32:29.000Z", + "numero": 19533.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 68.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5416.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-09-10T16:22:14.000Z", + "numero": 1960.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 68.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5415.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-09-10T11:23:25.000Z", + "numero": 11024.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 39.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5414.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-06T14:16:34.000Z", + "numero": 2835.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 8.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5413.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-09-05T11:56:22.000Z", + "numero": 12962.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 39.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5412.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-04T17:54:09.000Z", + "numero": 3591.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 97.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5411.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-04T14:41:26.000Z", + "numero": 10579.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 72.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5410.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-04T14:34:01.000Z", + "numero": 10578.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 73.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5408.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-03T17:35:35.000Z", + "numero": 14617.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 96.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5407.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-03T17:32:40.000Z", + "numero": 14616.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 110.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5406.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-03T17:28:27.000Z", + "numero": 14615.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 110.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5405.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-03T17:25:02.000Z", + "numero": 14614.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 110.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5404.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-03T17:19:06.000Z", + "numero": 387.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 73.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5403.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-03T11:57:46.000Z", + "numero": 6880.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 110.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5402.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-09-02T11:26:06.000Z", + "numero": 8374.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 110.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5401.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-08-30T19:37:18.000Z", + "numero": 2818.00, + "numero_letra": "", + "cidade": "PALESTINA DE GOIÁS", + "cep": null, + "uf": "GO", + "tb_bairro_id": 210.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5399.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-08-30T11:27:20.000Z", + "numero": 19512.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 39.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5398.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-08-28T16:20:04.000Z", + "numero": 19388.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 60.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5397.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-08-28T11:46:22.000Z", + "numero": 1984.00, + "numero_letra": "", + "cidade": "ARENÓPOLIS", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 8.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5396.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-08-28T11:36:46.000Z", + "numero": 1293.00, + "numero_letra": "", + "cidade": "ARENÓPOLIS", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 8.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5395.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-08-26T16:38:00.000Z", + "numero": 15195.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 97.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5394.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-08-23T18:08:13.000Z", + "numero": 2907.00, + "numero_letra": "", + "cidade": "Montividiu", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 273.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5392.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-08-21T17:11:17.000Z", + "numero": 18764.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 308.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5391.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-08-20T11:47:42.000Z", + "numero": 11933.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 109.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5390.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-08-16T19:16:28.000Z", + "numero": 10230.00, + "numero_letra": "", + "cidade": "CORUMBÁ", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 368.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5389.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-08-13T14:02:41.000Z", + "numero": 15846.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 367.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5388.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-08-09T15:57:07.000Z", + "numero": 6614.00, + "numero_letra": "", + "cidade": "Barra do Garças", + "cep": 75850000.00, + "uf": "MT", + "tb_bairro_id": 366.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5387.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-08-08T11:46:23.000Z", + "numero": 18468.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 80.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5386.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-08-02T18:35:18.000Z", + "numero": 585.00, + "numero_letra": "", + "cidade": "PEIXOTO DE AZEVEDO", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 2.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5385.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-08-02T11:13:10.000Z", + "numero": 17831.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 89.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5384.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-08-01T11:27:52.000Z", + "numero": 13751.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 60.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5383.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-31T12:08:07.000Z", + "numero": 9793.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 94.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5382.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-30T14:17:15.000Z", + "numero": 18850.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 82.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5381.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-30T13:38:54.000Z", + "numero": 18849.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 82.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5380.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-26T17:42:31.000Z", + "numero": 6314.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 73.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5379.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-25T16:55:12.000Z", + "numero": 5624.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 73.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5378.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-24T19:01:38.000Z", + "numero": 994.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 73.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5377.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-24T18:58:02.000Z", + "numero": 5862.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 73.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5376.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-24T18:55:41.000Z", + "numero": 5863.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 73.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5375.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-24T18:51:34.000Z", + "numero": 1454.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 87.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5374.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-07-22T19:06:29.000Z", + "numero": 5279.00, + "numero_letra": "", + "cidade": "FORMOSO", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 297.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5373.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-07-22T16:30:01.000Z", + "numero": 19276.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 111.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5371.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-18T17:38:07.000Z", + "numero": 13698.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 97.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5370.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-17T16:44:24.000Z", + "numero": 21423.00, + "numero_letra": "", + "cidade": "APARECIDA DE GOIÂNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 365.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5369.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-17T11:27:24.000Z", + "numero": 7120.00, + "numero_letra": "", + "cidade": "JATAÍ", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 249.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5368.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-15T11:09:37.000Z", + "numero": 3639.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 87.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5367.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-07-12T11:19:20.000Z", + "numero": 8106.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 60.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5366.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-10T11:54:16.000Z", + "numero": 17782.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 94.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5365.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-07-09T17:07:43.000Z", + "numero": 15845.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 60.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5364.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-09T14:33:00.000Z", + "numero": 18596.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 82.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5363.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-07-09T12:28:40.000Z", + "numero": 1310.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 60.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5362.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-07-09T11:33:06.000Z", + "numero": 1306.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 60.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5361.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-07-08T18:21:30.000Z", + "numero": 1312.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 60.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5360.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-07-05T18:37:23.000Z", + "numero": 1309.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 60.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5359.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-07-05T15:24:15.000Z", + "numero": 15660.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 210.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5358.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-07-04T17:39:53.000Z", + "numero": 18985.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 39.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5357.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-04T13:45:01.000Z", + "numero": 17878.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 104.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5356.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-04T11:23:23.000Z", + "numero": 44242.00, + "numero_letra": "", + "cidade": "GOIÂNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 364.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5355.00, + "tipo_classe": "3", + "tipo_registro": "M", + "data_registro": "2024-07-03T17:21:21.000Z", + "numero": 8713.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 68.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5354.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-03T13:11:20.000Z", + "numero": 18779.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 73.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5353.00, + "tipo_classe": "1", + "tipo_registro": "M", + "data_registro": "2024-07-01T20:14:04.000Z", + "numero": 16484.00, + "numero_letra": "", + "cidade": "CAIAPÔNIA", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 86.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5352.00, + "tipo_classe": "1", + "tipo_registro": "T", + "data_registro": "2024-06-28T14:33:26.000Z", + "numero": 21449.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 233.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + }, + { + "imovel_id": 5351.00, + "tipo_classe": "1", + "tipo_registro": "T", + "data_registro": "2024-06-28T14:30:55.000Z", + "numero": 21448.00, + "numero_letra": "", + "cidade": "Caiapônia", + "cep": 75850000.00, + "uf": "GO", + "tb_bairro_id": 233.00, + "cartorio": "1", + "livro": null, + "cns": null, + "gtb_descricao": "Setor dos Afonsos" + } + ] + }); + +} + +export const TImovelIndexData = withClientErrorHandler(executeTImovelIndexData); \ No newline at end of file diff --git a/src/packages/administrativo/data/TImovel/TImovelSaveData.ts b/src/packages/administrativo/data/TImovel/TImovelSaveData.ts new file mode 100644 index 0000000..34b6bc0 --- /dev/null +++ b/src/packages/administrativo/data/TImovel/TImovelSaveData.ts @@ -0,0 +1,18 @@ +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; +import TImovelInterface from "../../interfaces/TImovelInterface"; + +async function executeTImovelSaveData(data: TImovelInterface) { + + console.log({ + status: 200, + message: 'Dados salvos', + }); + + return Promise.resolve({ + status: 200, + message: 'Dados salvos', + }); + +} + +export const TImovelSaveData = withClientErrorHandler(executeTImovelSaveData); \ No newline at end of file diff --git a/src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeDeleteData.ts b/src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeDeleteData.ts new file mode 100644 index 0000000..c695584 --- /dev/null +++ b/src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeDeleteData.ts @@ -0,0 +1,13 @@ +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; +import TImovelUnidadeInterface from "../../interfaces/TImovelUnidadeInterface"; + +async function executeTImovelUnidadeDeleteData(data: TImovelUnidadeInterface) { + + return Promise.resolve({ + status: 200, + message: 'Dados Removidos' + }); + +} + +export const TImovelUnidadeDeleteData = withClientErrorHandler(executeTImovelUnidadeDeleteData); \ No newline at end of file diff --git a/src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeIndexData.ts b/src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeIndexData.ts new file mode 100644 index 0000000..248b3e6 --- /dev/null +++ b/src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeIndexData.ts @@ -0,0 +1,162 @@ +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; + +async function executeTImovelUnidadeIndexData() { + + return Promise.resolve({ + status: 200, + message: 'Dados Salvos', + data: [ + { + "imovel_unidade_id": 3921.00, + "imovel_id": 5459.00, + "numero_unidade": "asdfasd", + "quadra": null, + "area": null, + "superquadra": null, + "conjunto": null, + "bloco": null, + "area_descritiva": null, + "caracteristica": null, + "reserva_florestal": null, + "geo_referenciamento": null, + "logradouro": null, + "tb_tipologradouro_id": null, + "selecionado": "S", + "complemento": null, + "tipo_imovel": 67.00, + "tipo_construcao": 0.00, + "texto": null, + "numero_edificacao": null, + "iptu": "", + "ccir": null, + "nirf": null, + "lote": null, + "torre": null, + "nomeloteamento": null, + "nomecondominio": null, + "numero": null, + "cnm_numero": null, + "imovel_publico_uniao": null, + "spu_rip": null, + "cat": null, + "inscricao_municipal": null, + "cib": null, + "area_construida": null + }, + { + "imovel_unidade_id": 3918.00, + "imovel_id": 5456.00, + "numero_unidade": null, + "quadra": "45", + "area": null, + "superquadra": null, + "conjunto": null, + "bloco": null, + "area_descritiva": null, + "caracteristica": null, + "reserva_florestal": null, + "geo_referenciamento": null, + "logradouro": null, + "tb_tipologradouro_id": null, + "selecionado": "S", + "complemento": null, + "tipo_imovel": 67.00, + "tipo_construcao": 0.00, + "texto": null, + "numero_edificacao": null, + "iptu": null, + "ccir": null, + "nirf": null, + "lote": null, + "torre": null, + "nomeloteamento": null, + "nomecondominio": null, + "numero": null, + "cnm_numero": null, + "imovel_publico_uniao": null, + "spu_rip": null, + "cat": null, + "inscricao_municipal": null, + "cib": null, + "area_construida": null + }, + { + "imovel_unidade_id": 3917.00, + "imovel_id": 5454.00, + "numero_unidade": null, + "quadra": "45", + "area": 160.00, + "superquadra": null, + "conjunto": null, + "bloco": null, + "area_descritiva": null, + "caracteristica": null, + "reserva_florestal": null, + "geo_referenciamento": null, + "logradouro": "RUA P 3", + "tb_tipologradouro_id": 1.00, + "selecionado": "", + "complemento": null, + "tipo_imovel": 67.00, + "tipo_construcao": 0.00, + "texto": null, + "numero_edificacao": null, + "iptu": "1200", + "ccir": null, + "nirf": null, + "lote": "12", + "torre": null, + "nomeloteamento": null, + "nomecondominio": null, + "numero": 125.00, + "cnm_numero": null, + "imovel_publico_uniao": null, + "spu_rip": null, + "cat": null, + "inscricao_municipal": null, + "cib": null, + "area_construida": null + }, + { + "imovel_unidade_id": 3916.00, + "imovel_id": 5453.00, + "numero_unidade": null, + "quadra": "06", + "area": 461.51, + "superquadra": null, + "conjunto": null, + "bloco": null, + "area_descritiva": null, + "caracteristica": null, + "reserva_florestal": null, + "geo_referenciamento": null, + "logradouro": "Mariana Vilela", + "tb_tipologradouro_id": 3.00, + "selecionado": "S", + "complemento": null, + "tipo_imovel": 71.00, + "tipo_construcao": 2.00, + "texto": "{...}", + "numero_edificacao": null, + "iptu": "001.211.0006.0012.0001", + "ccir": null, + "nirf": null, + "lote": "12", + "torre": null, + "nomeloteamento": null, + "nomecondominio": null, + "numero": null, + "cnm_numero": null, + "imovel_publico_uniao": null, + "spu_rip": null, + "cat": null, + "inscricao_municipal": null, + "cib": null, + "area_construida": null + } + ] + }); + +} + +export const TImovelUnidadeIndexData = withClientErrorHandler(executeTImovelUnidadeIndexData); \ No newline at end of file diff --git a/src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeSaveData.ts b/src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeSaveData.ts new file mode 100644 index 0000000..7515972 --- /dev/null +++ b/src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeSaveData.ts @@ -0,0 +1,13 @@ +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; +import TImovelUnidadeInterface from "../../interfaces/TImovelUnidadeInterface"; + +async function executeTImovelUnidadeSaveData(data: TImovelUnidadeInterface) { + + return Promise.resolve({ + status: 200, + message: 'Dados salvos', + }); + +} + +export const TImovelUnidadeSaveData = withClientErrorHandler(executeTImovelUnidadeSaveData); \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TPessoa/TPessoaIndexData.ts b/src/packages/administrativo/data/TPessoa/TPessoaIndexData.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_data/TPessoa/TPessoaIndexData.ts rename to src/packages/administrativo/data/TPessoa/TPessoaIndexData.ts diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TPessoa/juridica/TPessoaJuridicaIndexData.ts b/src/packages/administrativo/data/TPessoa/juridica/TPessoaJuridicaIndexData.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_data/TPessoa/juridica/TPessoaJuridicaIndexData.ts rename to src/packages/administrativo/data/TPessoa/juridica/TPessoaJuridicaIndexData.ts diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TPessoaRepresentante/TPessoaRepresentanteIndexData.ts b/src/packages/administrativo/data/TPessoaRepresentante/TPessoaRepresentanteIndexData.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_data/TPessoaRepresentante/TPessoaRepresentanteIndexData.ts rename to src/packages/administrativo/data/TPessoaRepresentante/TPessoaRepresentanteIndexData.ts diff --git a/src/packages/administrativo/hooks/t_imovel/useTImovelDeleteHook.ts b/src/packages/administrativo/hooks/t_imovel/useTImovelDeleteHook.ts new file mode 100644 index 0000000..620ff87 --- /dev/null +++ b/src/packages/administrativo/hooks/t_imovel/useTImovelDeleteHook.ts @@ -0,0 +1,20 @@ +import { useResponse } from '@/app/_response/ResponseContext'; +import { useState } from 'react'; +import TImovelInterface from '../../interfaces/TImovelInterface'; +import { TImovelDeleteService } from '../../services/t_imovel/TImovelDeleteService'; + +export const useTImovelDeleteHook = () => { + const { setResponse } = useResponse(); + + const [tImovel, setTImovel] = useState(); + + const deleteTImovel = async (data: TImovelInterface) => { + const response = await TImovelDeleteService(data); + + setTImovel(data); + + setResponse(response); + }; + + return { tImovel, deleteTImovel }; +}; diff --git a/src/packages/administrativo/hooks/t_imovel/useTImovelIndexHook.ts b/src/packages/administrativo/hooks/t_imovel/useTImovelIndexHook.ts new file mode 100644 index 0000000..ee83fb7 --- /dev/null +++ b/src/packages/administrativo/hooks/t_imovel/useTImovelIndexHook.ts @@ -0,0 +1,27 @@ +'use client'; + +import { useResponse } from '@/app/_response/ResponseContext'; +import { useState } from 'react'; +import TImovelInterface from '../../interfaces/TImovelInterface'; +import { TImovelIndexData } from '../../data/TImovel/TImovelIndexData'; + +export const useTImovelIndexHook = () => { + const { setResponse } = useResponse(); + + const [tImovel, setTImovel] = useState(); + + const indexTImovel = async () => { + const response = await TImovelIndexData(); + + // Armazena os dados consultados + setTImovel(response.data); + + // Define os dados do componente de resposta (toast, modal, etc) + setResponse(response); + }; + + return { + tImovel, + indexTImovel + }; +}; diff --git a/src/packages/administrativo/hooks/t_imovel/useTImovelSaveHook.ts b/src/packages/administrativo/hooks/t_imovel/useTImovelSaveHook.ts new file mode 100644 index 0000000..710419b --- /dev/null +++ b/src/packages/administrativo/hooks/t_imovel/useTImovelSaveHook.ts @@ -0,0 +1,33 @@ +'use client'; + +import { useResponse } from '@/app/_response/ResponseContext'; +import { useState } from 'react'; +import TImovelInterface from '../../interfaces/TImovelInterface'; +import { TImovelSaveService } from '../../services/t_imovel/TImovelSaveService'; + +export const useTImovelSaveHook = () => { + const { setResponse } = useResponse(); + + const [tImovel, setTImovel] = useState(); + + // controla se o formulário está aberto ou fechado + const [isOpen, setIsOpen] = useState(false); + + const saveTImovel = async (data: TImovelInterface) => { + const response = await TImovelSaveService(data); + + // Armazena os dados da repsota + setTImovel(response.data); + + // Define os dados da respota(toast, modal, etc) + setResponse(response); + + // Fecha o formulário automaticamente após salvar + setIsOpen(false); + + // Retorna os valores de forma imediata + return response.data; + }; + + return { tImovel, saveTImovel }; +}; diff --git a/src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeDeleteHook.ts b/src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeDeleteHook.ts new file mode 100644 index 0000000..19fb252 --- /dev/null +++ b/src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeDeleteHook.ts @@ -0,0 +1,20 @@ +import { useResponse } from '@/app/_response/ResponseContext'; +import { useState } from 'react'; +import TImovelUnidadeInterface from '../../interfaces/TImovelUnidadeInterface'; +import { TImovelDeleteService } from '../../services/t_imovel/TImovelDeleteService'; + +export const useTImovelUnidadeDeleteHook = () => { + const { setResponse } = useResponse(); + + const [tImovelUnidade, setTImovelUnidade] = useState(); + + const deleteTImovelUnidade = async (data: TImovelUnidadeInterface) => { + const response = await TImovelDeleteService(data); + + setTImovelUnidade(data); + + setResponse(response); + }; + + return { tImovelUnidade, deleteTImovelUnidade }; +}; diff --git a/src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts b/src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts new file mode 100644 index 0000000..2e854c6 --- /dev/null +++ b/src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts @@ -0,0 +1,28 @@ +'use client'; + +import { useResponse } from '@/app/_response/ResponseContext'; +import { useState } from 'react'; +import TImovelUnidadeInterface from '../../interfaces/TImovelUnidadeInterface'; +import { TImovelUnidadeIndexData } from '../../data/TImovelUnidade/TImovelUnidadeIndexData'; + +export const useTImovelUnidadeIndexHook = () => { + const { setResponse } = useResponse(); + + const [tImovelUnidade, setTImovelUnidade] = useState< + TImovelUnidadeInterface[]>(); + + const indexTImovelUnidade = async () => { + const response = await TImovelUnidadeIndexData(); + + // Armazena os dados consultados + setTImovelUnidade(response.data); + + // Define os dados do componente de resposta (toast, modal, etc) + setResponse(response); + }; + + return { + tImovelUnidade, + indexTImovelUnidade + }; +}; diff --git a/src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts b/src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts new file mode 100644 index 0000000..d7509fe --- /dev/null +++ b/src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts @@ -0,0 +1,34 @@ +'use client'; + +import { useResponse } from '@/app/_response/ResponseContext'; +import { useState } from 'react'; +import TImovelUnidadeInterface from '../../interfaces/TImovelUnidadeInterface'; +import { TImovelUnidadeSaveService } from '../../services/t_imovel_unidade/TImovelUnidadeSaveService'; + +export const useTImovelUnidadeSaveHook = () => { + const { setResponse } = useResponse(); + + const [tImovelUnidade, setTImovelUnidade] = useState(); + + // controla se o formulário está aberto ou fechado + const [isOpen, setIsOpen] = useState(false); + + const saveTImovelUnidade = async (data: TImovelUnidadeInterface) => { + const response = await TImovelUnidadeSaveService(data); + + // Armazena os dados da repsota + setTImovelUnidade(response.data); + + // Define os dados da respota(toast, modal, etc) + setResponse(response); + + // Fecha o formulário automaticamente após salvar + setIsOpen(false); + + // Retorna os valores de forma imediata + return response.data; + }; + + return { tImovelUnidade, saveTImovelUnidade }; + +}; diff --git a/src/packages/administrativo/hooks/t_pessoa/fisica/usetTPessoaFormHook.ts b/src/packages/administrativo/hooks/t_pessoa/fisica/usetTPessoaFormHook.ts new file mode 100644 index 0000000..f9269b1 --- /dev/null +++ b/src/packages/administrativo/hooks/t_pessoa/fisica/usetTPessoaFormHook.ts @@ -0,0 +1,16 @@ +// hooks/useTPessoaForm.ts +import { useForm } from "react-hook-form"; +import { zodResolver } from "@hookform/resolvers/zod"; +import { TPessoaFormValues, TPessoaSchema } from "@/packages/administrativo/schemas/TPessoa/TPessoaSchema"; + +// Hook customizado +export function useTPessoaForm(defaults?: Partial) { + return useForm({ + resolver: zodResolver(TPessoaSchema), + defaultValues: { + nome: "", + pessoa_id: 0, + ...defaults, // sobrescreve valores iniciais se forem passados + }, + }); +} \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/juridica/useTPessoaJuridicaDeleteHook.ts b/src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaDeleteHook.ts similarity index 58% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/juridica/useTPessoaJuridicaDeleteHook.ts rename to src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaDeleteHook.ts index 1948605..89f74df 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/juridica/useTPessoaJuridicaDeleteHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaDeleteHook.ts @@ -1,6 +1,6 @@ import { useResponse } from '@/app/_response/ResponseContext'; -import TPessoaJuridicaInterface from '../../../_interfaces/TPessoaJuridicaInterface'; -import { TCensecDeleteService } from '../../../_services/t_censec/TCensecDeleteService'; +import TPessoaJuridicaInterface from '../../../interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaInterface'; +import { TCensecDeleteService } from '../../../../../app/(protected)/(cadastros)/cadastros/_services/t_censec/TCensecDeleteService'; export const useTPessoaJuridicaDeleteHook = () => { const { setResponse } = useResponse(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/juridica/useTPessoaJuridicaIndexHook.ts b/src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaIndexHook.ts similarity index 67% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/juridica/useTPessoaJuridicaIndexHook.ts rename to src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaIndexHook.ts index 3c175a3..ecb0720 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/juridica/useTPessoaJuridicaIndexHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaIndexHook.ts @@ -1,7 +1,7 @@ import { useResponse } from '@/app/_response/ResponseContext'; -import { TPessoaJuridicaIndexService } from '../../../_services/t_pessoa/juridica/TPessoaJuridicaIndexService'; +import { TPessoaJuridicaIndexService } from '../../../services/t_pessoa/juridica/TPessoaJuridicaIndexService'; import { useState } from 'react'; -import TPessoaJuridicaInterface from '../../../_interfaces/TPessoaJuridicaInterface'; +import TPessoaJuridicaInterface from '../../../interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaInterface'; export const useTPessoaJuridicaIndexHook = () => { const { setResponse } = useResponse(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/juridica/useTPessoaJuridicaSaveHook.ts b/src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaSaveHook.ts similarity index 80% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/juridica/useTPessoaJuridicaSaveHook.ts rename to src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaSaveHook.ts index 3bd9768..c5f1ff3 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/juridica/useTPessoaJuridicaSaveHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaSaveHook.ts @@ -2,8 +2,8 @@ import { useResponse } from '@/app/_response/ResponseContext'; import { useState } from 'react'; -import TPessoaInterface from '../../../_interfaces/TPessoaInterface'; -import { TCensecSaveService } from '../../../_services/t_censec/TCensecSaveService'; +import TPessoaInterface from '../../../interfaces/TPessoa/TPessoaInterface'; +import { TCensecSaveService } from '../../../../../app/(protected)/(cadastros)/cadastros/_services/t_censec/TCensecSaveService'; export const useTPessoaJuridicaSaveHook = () => { const { setResponse } = useResponse(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa_representante/useTPessoaDeleteHook.ts b/src/packages/administrativo/hooks/t_pessoa/useTPessoaDeleteHook.ts similarity index 61% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa_representante/useTPessoaDeleteHook.ts rename to src/packages/administrativo/hooks/t_pessoa/useTPessoaDeleteHook.ts index 4ec454f..8764a52 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa_representante/useTPessoaDeleteHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa/useTPessoaDeleteHook.ts @@ -1,6 +1,6 @@ import { useResponse } from '@/app/_response/ResponseContext'; -import TPessoaInterface from '../../_interfaces/TPessoaInterface'; -import { TCensecDeleteService } from '../../_services/t_censec/TCensecDeleteService'; +import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface'; +import { TCensecDeleteService } from '../../../../app/(protected)/(cadastros)/cadastros/_services/t_censec/TCensecDeleteService'; export const useTPessoaDeleteHook = () => { const { setResponse } = useResponse(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/useTPessoaIndexHook.ts b/src/packages/administrativo/hooks/t_pessoa/useTPessoaIndexHook.ts similarity index 73% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/useTPessoaIndexHook.ts rename to src/packages/administrativo/hooks/t_pessoa/useTPessoaIndexHook.ts index a12ccb6..e1fc3a2 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/useTPessoaIndexHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa/useTPessoaIndexHook.ts @@ -1,7 +1,7 @@ import { useResponse } from '@/app/_response/ResponseContext'; -import { TPessoaIndexService } from '../../_services/t_pessoa/TPessoaIndexService'; +import { TPessoaIndexService } from '../../services/t_pessoa/TPessoaIndexService'; import { useState } from 'react'; -import TPessoaInterface from '../../_interfaces/TPessoaInterface'; +import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface'; export const useTPessoaIndexHook = () => { const { setResponse } = useResponse(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa_representante/useTPessoaSaveHook.ts b/src/packages/administrativo/hooks/t_pessoa/useTPessoaSaveHook.ts similarity index 80% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa_representante/useTPessoaSaveHook.ts rename to src/packages/administrativo/hooks/t_pessoa/useTPessoaSaveHook.ts index 4998735..c349302 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa_representante/useTPessoaSaveHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa/useTPessoaSaveHook.ts @@ -2,8 +2,8 @@ import { useResponse } from '@/app/_response/ResponseContext'; import { useState } from 'react'; -import TPessoaInterface from '../../_interfaces/TPessoaInterface'; -import { TCensecSaveService } from '../../_services/t_censec/TCensecSaveService'; +import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface'; +import { TCensecSaveService } from '../../../../app/(protected)/(cadastros)/cadastros/_services/t_censec/TCensecSaveService'; export const useTPessoaSaveHook = () => { const { setResponse } = useResponse(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/useTPessoaDeleteHook.ts b/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaDeleteHook.ts similarity index 61% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/useTPessoaDeleteHook.ts rename to src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaDeleteHook.ts index 4ec454f..8764a52 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/useTPessoaDeleteHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaDeleteHook.ts @@ -1,6 +1,6 @@ import { useResponse } from '@/app/_response/ResponseContext'; -import TPessoaInterface from '../../_interfaces/TPessoaInterface'; -import { TCensecDeleteService } from '../../_services/t_censec/TCensecDeleteService'; +import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface'; +import { TCensecDeleteService } from '../../../../app/(protected)/(cadastros)/cadastros/_services/t_censec/TCensecDeleteService'; export const useTPessoaDeleteHook = () => { const { setResponse } = useResponse(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa_representante/useTPessoaRepresentanteIndexHook.ts b/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaRepresentanteIndexHook.ts similarity index 66% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa_representante/useTPessoaRepresentanteIndexHook.ts rename to src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaRepresentanteIndexHook.ts index b4c0e44..f163fa9 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa_representante/useTPessoaRepresentanteIndexHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaRepresentanteIndexHook.ts @@ -1,8 +1,8 @@ import { useResponse } from '@/app/_response/ResponseContext'; -import { TPessoaIndexService } from '../../_services/t_pessoa/TPessoaIndexService'; +import { TPessoaIndexService } from '../../services/t_pessoa/TPessoaIndexService'; import { useState } from 'react'; -import TPessoaInterface from '../../_interfaces/TPessoaInterface'; -import { TPessoaRepresentanteIndexData } from '../../_data/TPessoaRepresentante/TPessoaRepresentanteIndexData'; +import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface'; +import { TPessoaRepresentanteIndexData } from '../../data/TPessoaRepresentante/TPessoaRepresentanteIndexData'; export const useTPessoaRepresentanteIndexHook = () => { const { setResponse } = useResponse(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/useTPessoaSaveHook.ts b/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaSaveHook.ts similarity index 80% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/useTPessoaSaveHook.ts rename to src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaSaveHook.ts index 4998735..c349302 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/useTPessoaSaveHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaSaveHook.ts @@ -2,8 +2,8 @@ import { useResponse } from '@/app/_response/ResponseContext'; import { useState } from 'react'; -import TPessoaInterface from '../../_interfaces/TPessoaInterface'; -import { TCensecSaveService } from '../../_services/t_censec/TCensecSaveService'; +import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface'; +import { TCensecSaveService } from '../../../../app/(protected)/(cadastros)/cadastros/_services/t_censec/TCensecSaveService'; export const useTPessoaSaveHook = () => { const { setResponse } = useResponse(); diff --git a/src/packages/administrativo/interfaces/TImovelInterface.ts b/src/packages/administrativo/interfaces/TImovelInterface.ts new file mode 100644 index 0000000..2ec0c67 --- /dev/null +++ b/src/packages/administrativo/interfaces/TImovelInterface.ts @@ -0,0 +1,16 @@ +export default interface TImovelInterface { + imovel_id?: number, + tipo_classe?: string, + tipo_registro?: string, + data_registro?: string, + numero?: number, + numero_letra?: string, + cidade?: string, + cep?: string, + uf?: string, + tb_bairro_id?: number, + cartorio?: string, + livro?: string, + cns?: number, + gtb_descricao?: string, +} \ No newline at end of file diff --git a/src/packages/administrativo/interfaces/TImovelUnidadeInterface.ts b/src/packages/administrativo/interfaces/TImovelUnidadeInterface.ts new file mode 100644 index 0000000..6aaa723 --- /dev/null +++ b/src/packages/administrativo/interfaces/TImovelUnidadeInterface.ts @@ -0,0 +1,37 @@ +export default interface TImovelUnidadeInterface { + imovel_unidade_id?: number; + imovel_id?: number; + numero_unidade?: string; + quadra?: string; + area?: number; + superquadra?: string; + conjunto?: string; + bloco?: string; + area_descritiva?: string; + caracteristica?: string; + reserva_florestal?: string; + geo_referenciamento?: string; + logradouro: string; + tb_tipologradouro_id?: number; + selecionado?: string; + complemento?: string; + tipo_imovel?: number; + tipo_construcao?: number; + texto?: string; + numero_edificacao?: string; + iptu?: string; + ccir?: string; + nirf?: string; + lote?: string; + torre?: string; + nomeloteamento?: string; + nomecondominio?: string; + numero?: number; + cnm_numero?: string; + imovel_publico_uniao?: string; + spu_rip?: string; + cat?: string; + inscricao_municipal?: string; + cib?: string; + area_construida?: number; +} \ No newline at end of file diff --git a/src/packages/administrativo/interfaces/TPessoa/TPessoaFisica/TPessoaFisicaFormInterface.ts b/src/packages/administrativo/interfaces/TPessoa/TPessoaFisica/TPessoaFisicaFormInterface.ts new file mode 100644 index 0000000..1f9425e --- /dev/null +++ b/src/packages/administrativo/interfaces/TPessoa/TPessoaFisica/TPessoaFisicaFormInterface.ts @@ -0,0 +1,9 @@ +import { TPessoaFisicaFormValues } from "../../../schemas/TPessoa/TPessoaFisicaSchema"; + +export default interface TPessoaFisicaFormInterface { + isOpen: boolean; + data: TPessoaFisicaFormValues | null; + onClose: (item: null, isFormStatus: boolean) => void; + onSave: (data: TPessoaFisicaFormValues) => void; + buttonIsLoading: boolean; +} \ No newline at end of file diff --git a/src/packages/administrativo/interfaces/TPessoa/TPessoaFisica/TPessoaFisicaInterface.ts b/src/packages/administrativo/interfaces/TPessoa/TPessoaFisica/TPessoaFisicaInterface.ts new file mode 100644 index 0000000..ffe56df --- /dev/null +++ b/src/packages/administrativo/interfaces/TPessoa/TPessoaFisica/TPessoaFisicaInterface.ts @@ -0,0 +1,33 @@ +import TPessoaInterface from "../TPessoaInterface"; + +export default interface TPessoaFisicaInterface extends TPessoaInterface { + nacionalidade?: string; + tb_documentotipo_id?: number; + tb_profissao_id?: number; + tb_estadocivil_id?: number; + nome_pai?: string; + nome_mae?: string; + data_nascimento?: string; + sexo?: string; + tb_regimecomunhao_id?: number; + pessoa_conjuge_id?: number; + documento_expedicao?: string; + documento_validade?: string; + cert_casamento_numero?: string; + cert_casamento_folha?: string; + cert_casamento_livro?: string; + cert_casamento_cartorio?: string; + cert_casamento_data?: string; + cert_casamento_lei?: string; + pessoa_conjuge_nome?: string; + estrangeiro_nat?: string; + estrangeiro_nat_tb_pais_id?: number; + estrangeiro_res_tb_pais_id?: number; + estrangeiro_res?: string; + documento_orgao?: string; + documento_uf?: string; + uf_residencia?: string; + deficiencias?: string; + grau_instrucao?: string; + cidade_nat_id?: number; +} diff --git a/src/packages/administrativo/interfaces/TPessoa/TPessoaFisica/TPessoaFisicaTableInterface.ts b/src/packages/administrativo/interfaces/TPessoa/TPessoaFisica/TPessoaFisicaTableInterface.ts new file mode 100644 index 0000000..10898d3 --- /dev/null +++ b/src/packages/administrativo/interfaces/TPessoa/TPessoaFisica/TPessoaFisicaTableInterface.ts @@ -0,0 +1,7 @@ +import TPessoaFisicaInterface from "./TPessoaFisicaInterface"; + +export default interface TPessoaFisicaTableInterface { + data: TPessoaFisicaInterface[]; + onEdit: (item: TPessoaFisicaInterface, isEditingFormStatus: boolean) => void; + onDelete: (item: TPessoaFisicaInterface, isEditingFormStatus: boolean) => void; +} \ No newline at end of file diff --git a/src/packages/administrativo/interfaces/TPessoa/TPessoaInterface.ts b/src/packages/administrativo/interfaces/TPessoa/TPessoaInterface.ts new file mode 100644 index 0000000..b45137c --- /dev/null +++ b/src/packages/administrativo/interfaces/TPessoa/TPessoaInterface.ts @@ -0,0 +1,32 @@ +export default interface TPessoaInterface { + pessoa_id?: number; + pessoa_tipo?: string; + nome?: string; + documento?: string; + data_cadastro?: string; + naturalidade?: string; + telefone?: string; + endereco?: string; + cidade?: string; + uf?: string; + email?: string; + documento_numero?: string; + bairro?: string; + cep?: string; + observacao?: string; + cpf_cnpj?: string; + cpf_terceiro?: string; + texto?: string; + ddd?: number; + municipio_id?: number; + enviado_cnncnb?: boolean; + data_auteracao?: string; + data_envioccn?: string; + ccnregistros_id?: number; + observacao_envioccn?: string; + observacao_envio_ccn?: string; + tb_tipologradouro_id?: number; + unidade?: string; + numero_end?: string; + foto?: string; +} \ No newline at end of file diff --git a/src/packages/administrativo/interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaFormInterface.ts b/src/packages/administrativo/interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaFormInterface.ts new file mode 100644 index 0000000..8ea81b9 --- /dev/null +++ b/src/packages/administrativo/interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaFormInterface.ts @@ -0,0 +1,9 @@ +import TPessoaJuridicaInterface from "./TPessoaJuridicaInterface"; + +export default interface TPessoaJuridicaFormInterface { + isOpen: boolean; + data: TPessoaJuridicaInterface | null; + onClose: (item: null, isFormStatus: boolean) => void; + onSave: (data: TPessoaJuridicaInterface) => void; + buttonIsLoading: boolean; +} \ No newline at end of file diff --git a/src/packages/administrativo/interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaInterface.ts b/src/packages/administrativo/interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaInterface.ts new file mode 100644 index 0000000..6ca5fe6 --- /dev/null +++ b/src/packages/administrativo/interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaInterface.ts @@ -0,0 +1,12 @@ +import TPessoaInterface from "../TPessoaInterface"; + +export default interface TPessoaJuridicaInterface extends TPessoaInterface { + razao_social?: string; + nome_fantasia?: string; + inscricao_estadual?: string; + inscricao_municipal?: string; + capital_social?: number; + data_abertura?: string; + cnae_principal?: string; + cnae_secundario?: string[]; +} diff --git a/src/packages/administrativo/interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaTableInterface.ts b/src/packages/administrativo/interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaTableInterface.ts new file mode 100644 index 0000000..1538e35 --- /dev/null +++ b/src/packages/administrativo/interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaTableInterface.ts @@ -0,0 +1,7 @@ +import TPessoaJuridicaInterface from "./TPessoaJuridicaInterface"; + +export default interface TPessoaJuridicaTableInterface { + data: TPessoaJuridicaInterface[]; + onEdit: (item: TPessoaJuridicaInterface, isEditingFormStatus: boolean) => void; + onDelete: (item: TPessoaJuridicaInterface, isEditingFormStatus: boolean) => void; +} \ No newline at end of file diff --git a/src/packages/administrativo/schemas/TImovelSchema.ts b/src/packages/administrativo/schemas/TImovelSchema.ts new file mode 100644 index 0000000..f7653b2 --- /dev/null +++ b/src/packages/administrativo/schemas/TImovelSchema.ts @@ -0,0 +1,19 @@ +import z from "zod"; + +export const TImovelSchema = z.object({ + imovel_id: z.number().optional(), + tipo_classe: z.string().optional(), + tipo_registro: z.string().optional(), + data_registro: z.string().optional(), + numero: z.number().optional(), + numero_letra: z.string().optional(), + cidade: z.string().optional(), + cep: z.string().optional(), + uf: z.string().optional(), + tb_bairro_id: z.number().optional(), + cartorio: z.string().optional(), + livro: z.string().optional(), + cns: z.number().optional(), +}); + +export type TImovelFormValues = z.infer; \ No newline at end of file diff --git a/src/packages/administrativo/schemas/TImovelUnidadeSchema.ts b/src/packages/administrativo/schemas/TImovelUnidadeSchema.ts new file mode 100644 index 0000000..20f00a9 --- /dev/null +++ b/src/packages/administrativo/schemas/TImovelUnidadeSchema.ts @@ -0,0 +1,42 @@ +import z from "zod"; + +export const TImovelUnidadeSchema = z.object({ + imovel_unidade_id: z.number().optional(), + imovel_id: z.number().optional(), + numero_unidade: z.string().optional(), + quadra: z.string().optional(), + area: z.number().optional(), + superquadra: z.string().optional(), + conjunto: z.string().optional(), + bloco: z.string().optional(), + area_descritiva: z.string().optional(), + caracteristica: z.string().optional(), + reserva_florestal: z.string().optional(), + geo_referenciamento: z.string().optional(), + logradouro: z.string().min(1, 'O campo deve ser preenchido').max(90, 'O campo não deve exceder 90 caracteres'), + tb_tipologradouro_id: z.number().optional(), + selecionado: z.string().optional(), + complemento: z.string().optional(), + tipo_imovel: z.number().optional(), + tipo_construcao: z.number().optional(), + texto: z.string().optional(), + numero_edificacao: z.string().optional(), + iptu: z.string().optional(), + ccir: z.string().optional(), + nirf: z.string().optional(), + lote: z.string().optional(), + torre: z.string().optional(), + nomeloteamento: z.string().optional(), + nomecondominio: z.string().optional(), + numero: z.number().optional(), + cnm_numero: z.string().optional(), + imovel_publico_uniao: z.string().optional(), + spu_rip: z.string().optional(), + cat: z.string().optional(), + inscricao_municipal: z.string().optional(), + cib: z.string().optional(), + area_construida: z.number().optional(), +}); + +// Exportar o tipo inferido junto (opcional) +export type TImovelUnidadeFormValues = z.infer; \ No newline at end of file diff --git a/src/packages/administrativo/schemas/TPessoa/TPessoaFisicaSchema.ts b/src/packages/administrativo/schemas/TPessoa/TPessoaFisicaSchema.ts new file mode 100644 index 0000000..bd7a041 --- /dev/null +++ b/src/packages/administrativo/schemas/TPessoa/TPessoaFisicaSchema.ts @@ -0,0 +1,36 @@ +import { TPessoaSchema } from "./TPessoaSchema"; +import z from "zod"; + +export const TPessoaFisicaSchema = TPessoaSchema.extend({ + nacionalidade: z.string().optional(), + tb_documentotipo_id: z.number().optional(), + tb_profissao_id: z.number().optional(), + tb_estadocivil_id: z.number().optional(), + nome_pai: z.string().optional(), + nome_mae: z.string().optional(), + data_nascimento: z.string().optional(), + sexo: z.string().optional(), + tb_regimecomunhao_id: z.number().optional(), + pessoa_conjuge_id: z.number().optional(), + documento_expedicao: z.string().optional(), + documento_validade: z.string().optional(), + cert_casamento_numero: z.string().optional(), + cert_casamento_folha: z.string().optional(), + cert_casamento_livro: z.string().optional(), + cert_casamento_cartorio: z.string().optional(), + cert_casamento_data: z.string().optional(), + cert_casamento_lei: z.string().optional(), + pessoa_conjuge_nome: z.string().optional(), + estrangeiro_nat: z.string().optional(), + estrangeiro_nat_tb_pais_id: z.number().optional(), + estrangeiro_res_tb_pais_id: z.number().optional(), + estrangeiro_res: z.string().optional(), + documento_orgao: z.string().optional(), + documento_uf: z.string().optional(), + uf_residencia: z.string().optional(), + deficiencias: z.string().optional(), + grau_instrucao: z.string().optional(), + cidade_nat_id: z.number().optional(), +}); + +export type TPessoaFisicaFormValues = z.infer; diff --git a/src/packages/administrativo/schemas/TPessoa/TPessoaJuridicaSchema.ts b/src/packages/administrativo/schemas/TPessoa/TPessoaJuridicaSchema.ts new file mode 100644 index 0000000..a802df7 --- /dev/null +++ b/src/packages/administrativo/schemas/TPessoa/TPessoaJuridicaSchema.ts @@ -0,0 +1,15 @@ +import { TPessoaSchema } from "./TPessoaSchema"; +import z from "zod"; + +export const TPessoaJuridicaSchema = TPessoaSchema.extend({ + razao_social: z.string().min(1, "Razão social é obrigatória"), + nome_fantasia: z.string().optional(), + inscricao_estadual: z.string().optional(), + inscricao_municipal: z.string().optional(), + capital_social: z.number().optional(), + data_abertura: z.string().optional(), + cnae_principal: z.string().optional(), + cnae_secundario: z.array(z.string()).optional(), +}); + +export type TPessoaJuridicaFormValues = z.infer; \ No newline at end of file diff --git a/src/packages/administrativo/schemas/TPessoa/TPessoaSchema.ts b/src/packages/administrativo/schemas/TPessoa/TPessoaSchema.ts new file mode 100644 index 0000000..244ef1f --- /dev/null +++ b/src/packages/administrativo/schemas/TPessoa/TPessoaSchema.ts @@ -0,0 +1,33 @@ +import z from 'zod'; + +export const TPessoaSchema = z.object({ + pessoa_id: z.number().optional(), + pessoa_tipo: z.string().optional(), + nome: z.string().min(1, 'O campo deve ser preenchido').max(120, 'O nome excede 120 caracteres'), + documento: z.string().optional(), + data_cadastro: z.string().optional(), + telefone: z.string().optional(), + endereco: z.string().optional(), + cidade: z.string().optional(), + uf: z.string().optional(), + email: z.string().email().optional(), + documento_numero: z.string().optional(), + bairro: z.string().optional(), + cep: z.string().optional(), + observacao: z.string().optional(), + cpf_cnpj: z.string().optional(), + cpf_terceiro: z.string().optional(), + texto: z.string().optional(), + ddd: z.number().optional(), + municipio_id: z.number().optional(), + enviado_cnncnb: z.boolean().optional(), + data_auteracao: z.string().optional(), + data_envioccn: z.string().optional(), + ccnregistros_id: z.number().optional(), + observacao_envioccn: z.string().optional(), + observacao_envio_ccn: z.string().optional(), + tb_tipologradouro_id: z.number().optional(), + unidade: z.string().optional(), + numero_end: z.string().optional(), + foto: z.string().optional(), +}); diff --git a/src/app/(protected)/(cadastros)/cadastros/_schemas/TPessoaJuridicaSchema.ts b/src/packages/administrativo/schemas/TPessoaJuridicaSchema.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_schemas/TPessoaJuridicaSchema.ts rename to src/packages/administrativo/schemas/TPessoaJuridicaSchema.ts diff --git a/src/app/(protected)/(cadastros)/cadastros/_schemas/TPessoaRepresentante.ts b/src/packages/administrativo/schemas/TPessoaRepresentanteSchema.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_schemas/TPessoaRepresentante.ts rename to src/packages/administrativo/schemas/TPessoaRepresentanteSchema.ts diff --git a/src/packages/administrativo/services/t_imovel/TImovelDeleteService.ts b/src/packages/administrativo/services/t_imovel/TImovelDeleteService.ts new file mode 100644 index 0000000..895794e --- /dev/null +++ b/src/packages/administrativo/services/t_imovel/TImovelDeleteService.ts @@ -0,0 +1,11 @@ +import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler'; +import { TImovelDeleteData } from '../../data/TImovel/TImovelDeleteData'; +import TImovelInterface from '../../interfaces/TImovelInterface'; + +async function executeTImovelDeleteService(data: TImovelInterface) { + const response = await TImovelDeleteData(data); + + return response; +} + +export const TImovelDeleteService = withClientErrorHandler(executeTImovelDeleteService); diff --git a/src/packages/administrativo/services/t_imovel/TImovelIndexService.ts b/src/packages/administrativo/services/t_imovel/TImovelIndexService.ts new file mode 100644 index 0000000..f392a20 --- /dev/null +++ b/src/packages/administrativo/services/t_imovel/TImovelIndexService.ts @@ -0,0 +1,10 @@ +import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler'; +import { TImovelIndexData } from '../../data/TImovel/TImovelIndexData'; + +export default async function executeTImovelIndexService() { + const response = await TImovelIndexData(); + + return response; +} + +export const TImovelIndexService = withClientErrorHandler(executeTImovelIndexService); diff --git a/src/packages/administrativo/services/t_imovel/TImovelSaveService.ts b/src/packages/administrativo/services/t_imovel/TImovelSaveService.ts new file mode 100644 index 0000000..82ffce0 --- /dev/null +++ b/src/packages/administrativo/services/t_imovel/TImovelSaveService.ts @@ -0,0 +1,11 @@ +import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler'; +import { TImovelSaveData } from '../../data/TImovel/TImovelSaveData'; +import TImovelInterface from '../../interfaces/TImovelInterface'; + +async function executeTImovelSaveService(data: TImovelInterface) { + const response = await TImovelSaveData(data); + + return response; +} + +export const TImovelSaveService = withClientErrorHandler(executeTImovelSaveService); \ No newline at end of file diff --git a/src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeDeleteService.ts b/src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeDeleteService.ts new file mode 100644 index 0000000..0b5553f --- /dev/null +++ b/src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeDeleteService.ts @@ -0,0 +1,11 @@ +import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler'; +import TImovelUnidadeInterface from '../../interfaces/TImovelUnidadeInterface'; +import { TImovelUnidadeDeleteData } from '../../data/TImovelUnidade/TImovelUnidadeDeleteData'; + +async function executeTImovelUnidadeDeleteService(data: TImovelUnidadeInterface) { + const response = await TImovelUnidadeDeleteData(data); + + return response; +} + +export const TImovelUnidadeDeleteService = withClientErrorHandler(executeTImovelUnidadeDeleteService); diff --git a/src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeIndexService.ts b/src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeIndexService.ts new file mode 100644 index 0000000..31eba39 --- /dev/null +++ b/src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeIndexService.ts @@ -0,0 +1,10 @@ +import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler'; +import { TImovelUnidadeIndexData } from '../../data/TImovelUnidade/TImovelUnidadeIndexData'; + +export default async function executeTImovelUnidadeIndexService() { + const response = await TImovelUnidadeIndexData(); + + return response; +} + +export const TImovelUnidadeIndexService = withClientErrorHandler(executeTImovelUnidadeIndexService); diff --git a/src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeSaveService.ts b/src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeSaveService.ts new file mode 100644 index 0000000..cf786c0 --- /dev/null +++ b/src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeSaveService.ts @@ -0,0 +1,11 @@ +import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler'; +import TImovelUnidadeInterface from '../../interfaces/TImovelUnidadeInterface'; +import { TImovelUnidadeSaveData } from '../../data/TImovelUnidade/TImovelUnidadeSaveData'; + +async function executeTImovelUnidadeSaveService(data: TImovelUnidadeInterface) { + const response = await TImovelUnidadeSaveData(data); + + return response; +} + +export const TImovelUnidadeSaveService = withClientErrorHandler(executeTImovelUnidadeSaveService); \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/t_pessoa/TPessoaIndexService.ts b/src/packages/administrativo/services/t_pessoa/TPessoaIndexService.ts similarity index 80% rename from src/app/(protected)/(cadastros)/cadastros/_services/t_pessoa/TPessoaIndexService.ts rename to src/packages/administrativo/services/t_pessoa/TPessoaIndexService.ts index be133ff..18aa696 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/t_pessoa/TPessoaIndexService.ts +++ b/src/packages/administrativo/services/t_pessoa/TPessoaIndexService.ts @@ -1,5 +1,5 @@ import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler'; -import { TPessoaIndexData } from '../../_data/TPessoa/TPessoaIndexData'; +import { TPessoaIndexData } from '../../data/TPessoa/TPessoaIndexData'; async function executeTPessoaIndexService() { const response = TPessoaIndexData(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/t_pessoa/juridica/TPessoaJuridicaIndexService.ts b/src/packages/administrativo/services/t_pessoa/juridica/TPessoaJuridicaIndexService.ts similarity index 76% rename from src/app/(protected)/(cadastros)/cadastros/_services/t_pessoa/juridica/TPessoaJuridicaIndexService.ts rename to src/packages/administrativo/services/t_pessoa/juridica/TPessoaJuridicaIndexService.ts index 5385758..cc92eab 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/t_pessoa/juridica/TPessoaJuridicaIndexService.ts +++ b/src/packages/administrativo/services/t_pessoa/juridica/TPessoaJuridicaIndexService.ts @@ -1,5 +1,5 @@ import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler'; -import { TPessoaJuridicaIndexData } from '../../../_data/TPessoa/juridica/TPessoaJuridicaIndexData'; +import { TPessoaJuridicaIndexData } from '../../../data/TPessoa/juridica/TPessoaJuridicaIndexData'; async function executeTPessoaJuridicaIndexService() { const response = TPessoaJuridicaIndexData(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/t_pessoa_representante/TPessoaRepresentante.ts b/src/packages/administrativo/services/t_pessoa_representante/TPessoaRepresentante.ts similarity index 75% rename from src/app/(protected)/(cadastros)/cadastros/_services/t_pessoa_representante/TPessoaRepresentante.ts rename to src/packages/administrativo/services/t_pessoa_representante/TPessoaRepresentante.ts index 0271c27..591a9c2 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/t_pessoa_representante/TPessoaRepresentante.ts +++ b/src/packages/administrativo/services/t_pessoa_representante/TPessoaRepresentante.ts @@ -1,5 +1,5 @@ import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler'; -import { TPessoaRepresentanteIndexData } from '../../_data/TPessoaRepresentante/TPessoaRepresentanteIndexData'; +import { TPessoaRepresentanteIndexData } from '../../data/TPessoaRepresentante/TPessoaRepresentanteIndexData'; async function executeTPessoaRepresentanteIndexService() { const response = TPessoaRepresentanteIndexData();