From 4eabe19ee371ac776a656d6af32065458a8179ed Mon Sep 17 00:00:00 2001 From: keven Date: Wed, 1 Oct 2025 18:11:21 -0300 Subject: [PATCH 1/5] =?UTF-8?q?[MVPTN-87]=20feat(CRUD):=20Cria=20crud=20de?= =?UTF-8?q?=20dados=20mocados=20da=20Imovel=20e=20da=20Unidade=20do=20Im?= =?UTF-8?q?=C3=B3vel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/actions/CEP/FormatCEP.ts | 20 + .../(t_imovel)/imoveis/urbanos/page.tsx | 171 ++ .../_components/t_imovel/TImovelColumns.tsx | 125 ++ .../_components/t_imovel/TImovelForm.tsx | 304 ++++ .../_components/t_imovel/TImovelTable.tsx | 28 + .../TImovelUnidadeColumns.tsx | 67 + .../t_imovel_unidade/TImovelUnidadeForm.tsx | 306 ++++ .../t_imovel_unidade/TImovelUnidadePage.tsx | 166 ++ .../t_imovel_unidade/TImovelUnidadeTable.tsx | 28 + .../_components/t_pessoa/TPessoaForm.tsx | 4 - .../_data/TImovel/TImovelDeleteData.ts | 13 + .../_data/TImovel/TImovelIndexData.ts | 1614 +++++++++++++++++ .../_data/TImovel/TImovelSaveData.ts | 13 + .../TImovelUnidadeDeleteData.ts | 13 + .../TImovelUnidade/TImovelUnidadeIndexData.ts | 162 ++ .../TImovelUnidade/TImovelUnidadeSaveData.ts | 13 + .../_hooks/t_imovel/useTImovelDeleteHook.ts | 20 + .../_hooks/t_imovel/useTImovelIndexHook.ts | 29 + .../_hooks/t_imovel/useTImovelSaveHook.ts | 33 + .../useTImovelUnidadeDeleteHook.ts | 20 + .../useTImovelUnidadeIndexHook.ts | 29 + .../useTImovelUnidadeSaveHook.ts | 33 + .../cadastros/_interfaces/TImovelInterface.ts | 16 + .../_interfaces/TImovelUnidadeInterface.ts | 37 + .../cadastros/_schemas/TImovelSchema.ts | 17 + .../_schemas/TImovelUnidadeSchema.ts | 39 + .../t_imovel/TImovelDeleteService.ts | 11 + .../_services/t_imovel/TImovelIndexService.ts | 10 + .../_services/t_imovel/TImovelSaveService.ts | 11 + .../TImovelUnidadeDeleteService.ts | 11 + .../TImovelUnidadeIndexService.ts | 10 + .../TImovelUnidadeSaveService.ts | 11 + .../_components/dataTable/SortableHeader.tsx | 12 + src/app/_components/dataTable/dataTable.tsx | 135 +- src/components/app-sidebar.tsx | 4 + src/enums/ImovelTipoRegistro.ts | 4 + 36 files changed, 3504 insertions(+), 35 deletions(-) create mode 100644 src/actions/CEP/FormatCEP.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/(t_imovel)/imoveis/urbanos/page.tsx create mode 100644 src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelColumns.tsx create mode 100644 src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelForm.tsx create mode 100644 src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelTable.tsx create mode 100644 src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeColumns.tsx create mode 100644 src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeForm.tsx create mode 100644 src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadePage.tsx create mode 100644 src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeTable.tsx create mode 100644 src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelDeleteData.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelIndexData.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelSaveData.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeDeleteData.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeIndexData.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeSaveData.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelDeleteHook.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelIndexHook.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelSaveHook.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeDeleteHook.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_interfaces/TImovelInterface.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_interfaces/TImovelUnidadeInterface.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelSchema.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelUnidadeSchema.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelDeleteService.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelIndexService.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelSaveService.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeDeleteService.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeIndexService.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeSaveService.ts create mode 100644 src/app/_components/dataTable/SortableHeader.tsx create mode 100644 src/enums/ImovelTipoRegistro.ts 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/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..424f95d --- /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 '../../../_components/t_imovel/TImovelTable'; +import TImovelForm from '../../../_components/t_imovel/TImovelForm'; + +import { useTImovelIndexHook } from '../../../_hooks/t_imovel/useTImovelIndexHook'; +import { useTImovelSaveHook } from '../../../_hooks/t_imovel/useTImovelSaveHook'; +import { useTImovelDeleteHook } from '../../../_hooks/t_imovel/useTImovelDeleteHook'; + +import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog'; +import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog'; + +import TImovelInterface from '../../../_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/t_imovel/TImovelColumns.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelColumns.tsx new file mode 100644 index 0000000..71a6181 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelForm.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelForm.tsx new file mode 100644 index 0000000..3917493 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelForm.tsx @@ -0,0 +1,304 @@ +'use client'; + +import z from 'zod'; +import { useEffect } from 'react'; +import { useForm, Controller } from 'react-hook-form'; +import { zodResolver } from '@hookform/resolvers/zod'; + +import { Button } from '@/components/ui/button'; +import { Checkbox } from '@/components/ui/checkbox'; +import { + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from '@/components/ui/dialog'; +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '@/components/ui/form'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; + +import { TImovelSchema } from '../../_schemas/TImovelSchema'; +import LoadingButton from '@/app/_components/loadingButton/LoadingButton'; +import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; +import { HouseIcon, IdCardIcon, UserIcon } from 'lucide-react'; +import { Select } from '@/components/ui/select'; +import TImovelUnidadePage from '../t_imovel_unidade/TImovelUnidadePage'; + +type FormValues = z.infer; + +interface Props { + isOpen: boolean; + data: FormValues | null; + onClose: (item: null, isFormStatus: boolean) => void; + onSave: (data: FormValues) => void; + buttonIsLoading: boolean; +} + +export default function TCensecForm({ isOpen, data, onClose, onSave, buttonIsLoading }: Props) { + // 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(() => { + if (data) form.reset(data); + }, [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 */} + +
+ {/* Tipo Classe */} + ( + + Tipo Classe + + + + + + )} + /> + + {/* Tipo Registro */} + ( + + Tipo Registro + + + + + + )} + /> + + {/* Número */} + ( + + Número + + + + + + )} + /> + + {/* Número Letra */} + ( + + Número Letra + + + + + + )} + /> + + {/* Cidade */} + ( + + Cidade + + + + + + )} + /> + + {/* UF */} + ( + + UF + + + + + + )} + /> + + {/* Bairro */} + ( + + Bairro + + + + + + )} + /> + + {/* CEP */} + ( + + CEP + + + + + + )} + /> + + {/* Cartório */} + ( + + Cartório + + + + + + )} + /> + + {/* Livro */} + ( + + Livro + + + + + + )} + /> + + {/* CNS */} + ( + + CNS + + + + + + )} + /> + + {/* GTB Descrição */} + ( + + GTB Descrição + + + + + + )} + /> +
+
+ {/* Unidades */} + + {/* Conteúdo das unidades */} + < TImovelUnidadePage /> + +
+ {/* Rodapé do Dialog */} + + + + + + + + {/* Campo oculto */} + +
+ +
+
+ ); +} diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelTable.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelTable.tsx new file mode 100644 index 0000000..77f04a0 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeColumns.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeColumns.tsx new file mode 100644 index 0000000..fa594fa --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeColumns.tsx @@ -0,0 +1,67 @@ +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")), + enableSorting: false, + }, + // 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/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeForm.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeForm.tsx new file mode 100644 index 0000000..3083ed9 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeForm.tsx @@ -0,0 +1,306 @@ +'use client'; + +import z from 'zod'; +import { useEffect } from 'react'; +import { useForm, Controller } from 'react-hook-form'; +import { zodResolver } from '@hookform/resolvers/zod'; + +import { Button } from '@/components/ui/button'; +import { Checkbox } from '@/components/ui/checkbox'; +import { + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from '@/components/ui/dialog'; +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '@/components/ui/form'; +import { Input } from '@/components/ui/input'; +import { Label } from '@/components/ui/label'; + +import { TImovelSchema } from '../../_schemas/TImovelSchema'; +import LoadingButton from '@/app/_components/loadingButton/LoadingButton'; +import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; +import { HouseIcon, IdCardIcon, UserIcon } from 'lucide-react'; +import { Select } from '@/components/ui/select'; + +type FormValues = z.infer; + +interface Props { + isOpen: boolean; + data: FormValues | null; + onClose: (item: null, isFormStatus: boolean) => void; + onSave: (data: FormValues) => void; + buttonIsLoading: boolean; +} + +export default function TImovelUnidadeForm({ isOpen, data, onClose, onSave, buttonIsLoading }: Props) { + // 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(() => { + if (data) form.reset(data); + }, [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 */} + +
+ {/* Tipo Classe */} + ( + + Tipo Classe + + + + + + )} + /> + + {/* Tipo Registro */} + ( + + Tipo Registro + + + + + + )} + /> + + {/* Número */} + ( + + Número + + + + + + )} + /> + + {/* Número Letra */} + ( + + Número Letra + + + + + + )} + /> + + {/* Cidade */} + ( + + Cidade + + + + + + )} + /> + + {/* UF */} + ( + + UF + + + + + + )} + /> + + {/* Bairro */} + ( + + Bairro + + + + + + )} + /> + + {/* CEP */} + ( + + CEP + + + + + + )} + /> + + {/* Cartório */} + ( + + Cartório + + + + + + )} + /> + + {/* Livro */} + ( + + Livro + + + + + + )} + /> + + {/* CNS */} + ( + + CNS + + + + + + )} + /> + + {/* GTB Descrição */} + ( + + GTB Descrição + + + + + + )} + /> +
+
+ + {/* Unidades */} + + {/* Conteúdo das unidades */} + +
+ + {/* Rodapé do Dialog */} + + + + + + + + + {/* Campo oculto */} + +
+ +
+
+ ); +} diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadePage.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadePage.tsx new file mode 100644 index 0000000..cfc5372 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeTable.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeTable.tsx new file mode 100644 index 0000000..344dcdf --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/TPessoaForm.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaForm.tsx index a44d02d..17c3580 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaForm.tsx +++ b/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaForm.tsx @@ -111,7 +111,6 @@ export default function TCensecForm({ Pessoa Preencha os dados da pessoa -
{/* Tabs */} @@ -128,7 +127,6 @@ export default function TCensecForm({ Documentos - {/* Dados Pessoais */}
@@ -534,7 +532,6 @@ export default function TCensecForm({
- {/* Endereço */}
@@ -700,7 +697,6 @@ export default function TCensecForm({
- {/* Documentos */}
diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelDeleteData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelDeleteData.ts new file mode 100644 index 0000000..4f8248a --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelIndexData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelIndexData.ts new file mode 100644 index 0000000..c8eb517 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelSaveData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelSaveData.ts new file mode 100644 index 0000000..5315bd2 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelSaveData.ts @@ -0,0 +1,13 @@ +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; +import TImovelInterface from "../../_interfaces/TImovelInterface"; + +async function executeTImovelSaveData(data: TImovelInterface) { + + return Promise.resolve({ + status: 200, + message: 'Dados salvos', + }); + +} + +export const TImovelSaveData = withClientErrorHandler(executeTImovelSaveData); \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeDeleteData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeDeleteData.ts new file mode 100644 index 0000000..bda2703 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeIndexData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeIndexData.ts new file mode 100644 index 0000000..248b3e6 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeSaveData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeSaveData.ts new file mode 100644 index 0000000..48a305a --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/_hooks/t_imovel/useTImovelDeleteHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelDeleteHook.ts new file mode 100644 index 0000000..78d9577 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelIndexHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelIndexHook.ts new file mode 100644 index 0000000..5bc3139 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelIndexHook.ts @@ -0,0 +1,29 @@ +'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< + TImovelInterface[] | null + >(null); + + 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/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelSaveHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelSaveHook.ts new file mode 100644 index 0000000..75f37c6 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeDeleteHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeDeleteHook.ts new file mode 100644 index 0000000..84b6fb0 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts new file mode 100644 index 0000000..83e6f52 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts @@ -0,0 +1,29 @@ +'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[] | null + >(null); + + 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/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts new file mode 100644 index 0000000..c129b16 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts @@ -0,0 +1,33 @@ +'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/app/(protected)/(cadastros)/cadastros/_interfaces/TImovelInterface.ts b/src/app/(protected)/(cadastros)/cadastros/_interfaces/TImovelInterface.ts new file mode 100644 index 0000000..2ec0c67 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_interfaces/TImovelUnidadeInterface.ts b/src/app/(protected)/(cadastros)/cadastros/_interfaces/TImovelUnidadeInterface.ts new file mode 100644 index 0000000..83a52d1 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_schemas/TImovelSchema.ts b/src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelSchema.ts new file mode 100644 index 0000000..450a09f --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelSchema.ts @@ -0,0 +1,17 @@ +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, +}); \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelUnidadeSchema.ts b/src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelUnidadeSchema.ts new file mode 100644 index 0000000..99fe817 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelUnidadeSchema.ts @@ -0,0 +1,39 @@ +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().optional(), + 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(), +}); \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelDeleteService.ts b/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelDeleteService.ts new file mode 100644 index 0000000..da4ae95 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelIndexService.ts b/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelIndexService.ts new file mode 100644 index 0000000..c0f5754 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelSaveService.ts b/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelSaveService.ts new file mode 100644 index 0000000..c85effd --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeDeleteService.ts b/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeDeleteService.ts new file mode 100644 index 0000000..7df9afc --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeIndexService.ts b/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeIndexService.ts new file mode 100644 index 0000000..e2a9fac --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeSaveService.ts b/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeSaveService.ts new file mode 100644 index 0000000..cd8b928 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/_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..39f7549 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,51 @@ 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 142473d..8831b8a 100644 --- a/src/components/app-sidebar.tsx +++ b/src/components/app-sidebar.tsx @@ -152,6 +152,10 @@ const data = { title: 'Pessoas/Jurídica', url: '/cadastros/pessoa/juridica', }, + { + title: 'Imovel/Urbano', + url: '/cadastros/imoveis/urbanos', + }, ], }, { diff --git a/src/enums/ImovelTipoRegistro.ts b/src/enums/ImovelTipoRegistro.ts new file mode 100644 index 0000000..2d91f88 --- /dev/null +++ b/src/enums/ImovelTipoRegistro.ts @@ -0,0 +1,4 @@ +export enum ImovelTipoRegistro { + M = 'Matrícula', + T = 'Transcrição' +} \ No newline at end of file From 1fcc5e442da3a3c978b68cba9face8b4e161a070 Mon Sep 17 00:00:00 2001 From: keven Date: Thu, 2 Oct 2025 15:30:15 -0300 Subject: [PATCH 2/5] [MVPTN-87] feat(CRUD): Ajustes diversos no crud de imovel e unidade --- src/actions/form/ResetFormIfData.ts | 15 + src/actions/form/parseNumberInput.ts | 6 + .../_components/g_tb_bairro/GTBBairroForm.tsx | 13 +- .../_components/t_imovel/TImovelForm.tsx | 488 +++++++------ .../_components/t_imovel/TImovelFormProps.ts | 7 + .../_components/t_imovel/TImovelTable.tsx | 2 +- .../TImovelUnidadeColumns.tsx | 25 +- .../t_imovel_unidade/TImovelUnidadeForm.tsx | 687 ++++++++++++------ .../TImovelUnidadeFormProps.ts | 9 + .../t_imovel_unidade/TImovelUnidadeTable.tsx | 4 +- .../_components/t_pessoa/TPessoaForm.tsx | 5 - .../_data/TImovel/TImovelSaveData.ts | 5 + .../_hooks/t_imovel/useTImovelIndexHook.ts | 4 +- .../useTImovelUnidadeIndexHook.ts | 3 +- .../useTImovelUnidadeSaveHook.ts | 1 + .../_interfaces/TImovelUnidadeInterface.ts | 2 +- .../cadastros/_schemas/TImovelSchema.ts | 30 +- .../_schemas/TImovelUnidadeSchema.ts | 7 +- src/app/_components/dataTable/dataTable.tsx | 4 + src/enums/ImovelConstrucaoEnum.ts | 5 + src/enums/ImovelTipoClasseEnum.ts | 4 + src/enums/ImovelTipoEnum.ts | 22 + src/enums/ImovelTipoRegistro.ts | 3 +- 23 files changed, 886 insertions(+), 465 deletions(-) create mode 100644 src/actions/form/ResetFormIfData.ts create mode 100644 src/actions/form/parseNumberInput.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelFormProps.ts create mode 100644 src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeFormProps.ts create mode 100644 src/enums/ImovelConstrucaoEnum.ts create mode 100644 src/enums/ImovelTipoClasseEnum.ts create mode 100644 src/enums/ImovelTipoEnum.ts 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/_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_imovel/TImovelForm.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelForm.tsx index 3917493..e3774ba 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelForm.tsx +++ b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelForm.tsx @@ -1,12 +1,10 @@ 'use client'; -import z from 'zod'; -import { useEffect } from 'react'; -import { useForm, Controller } from 'react-hook-form'; +import React, { useEffect } from 'react'; +import { useForm } from 'react-hook-form'; import { zodResolver } from '@hookform/resolvers/zod'; import { Button } from '@/components/ui/button'; -import { Checkbox } from '@/components/ui/checkbox'; import { Dialog, DialogClose, @@ -25,35 +23,50 @@ import { FormMessage, } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; -import { Label } from '@/components/ui/label'; -import { TImovelSchema } from '../../_schemas/TImovelSchema'; +import { TImovelFormValues, TImovelSchema } from '../../_schemas/TImovelSchema'; import LoadingButton from '@/app/_components/loadingButton/LoadingButton'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; -import { HouseIcon, IdCardIcon, UserIcon } from 'lucide-react'; -import { Select } from '@/components/ui/select'; +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 '../../_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'; -type FormValues = z.infer; +export default function TImovelForm({ isOpen, data, onClose, onSave, buttonIsLoading }: TImovelFormProps) { -interface Props { - isOpen: boolean; - data: FormValues | null; - onClose: (item: null, isFormStatus: boolean) => void; - onSave: (data: FormValues) => void; - buttonIsLoading: boolean; -} + const { gTBBairro, fetchGTBBairro } = useGTBBairroReadHook(); -export default function TCensecForm({ isOpen, data, onClose, onSave, buttonIsLoading }: Props) { // Inicializa o react-hook-form com schema zod - const form = useForm({ + const form = useForm({ resolver: zodResolver(TImovelSchema), defaultValues: {}, }); // Atualiza o formulário quando recebe dados para edição useEffect(() => { - if (data) form.reset(data); + + // 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 ( @@ -77,200 +90,270 @@ export default function TCensecForm({ isOpen, data, onClose, onSave, buttonIsLoa {/* Tabs */} - - + + Dados do Imóvel - + Unidades {/* Dados do Imóvel */} -
- {/* Tipo Classe */} - ( - - Tipo Classe - - - - - - )} - /> - - {/* Tipo Registro */} - ( - - Tipo Registro - - - - - - )} - /> - - {/* Número */} - ( - - Número - - - - - - )} - /> - - {/* Número Letra */} - ( - - Número Letra - - - - - - )} - /> - - {/* Cidade */} - ( - - Cidade - - - - - - )} - /> - +
{/* UF */} - ( - - UF - - - - - - )} - /> - - {/* Bairro */} - ( - - Bairro - - - - - - )} - /> - +
+ ( + + UF + + + + + + )} + /> +
{/* CEP */} - ( - - 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 - - - - - - )} - /> - - {/* Livro */} - ( - - Livro - - - - - - )} - /> - +
+ ( + + Cartório + + + + + + )} + /> +
{/* CNS */} - ( - - CNS - - - - - - )} - /> - - {/* GTB Descrição */} - ( - - GTB Descrição - - - - - - )} - /> +
+ ( + + CNS + + + + + + )} + /> +
+ {/* Livro */} +
+ ( + + Livro + + + + + + )} + /> +
+ {/* Tipo Registro */} +
+ ( + + Tipo Registro + + + + + + )} + /> +
+ {/* Número */} +
+ ( + + Número + + + + + + )} + /> +
+ {/* Número Letra */} +
+ ( + + Número Letra + + + + + + )} + /> +
+ {/* Tipo Registro */} +
+ ( + + Tipo Classe + + + + + + )} + /> +
{/* Unidades */} @@ -286,7 +369,6 @@ export default function TCensecForm({ isOpen, data, onClose, onSave, buttonIsLoa Cancelar - ); -} +} \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelFormProps.ts b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelFormProps.ts new file mode 100644 index 0000000..23a41b1 --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelTable.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelTable.tsx index 77f04a0..45f6696 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelTable.tsx +++ b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelTable.tsx @@ -5,7 +5,7 @@ import TImovelColumns from './TImovelColumns'; import TImovelInterface from '../../_interfaces/TImovelInterface'; interface TImovelTableProps { - data: TImovelInterface[]; + data?: TImovelInterface[]; onEdit: (item: TImovelInterface, isEditingFormStatus: boolean) => void; onDelete: (item: TImovelInterface, isEditingFormStatus: boolean) => void; } diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeColumns.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeColumns.tsx index fa594fa..ac1657e 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeColumns.tsx +++ b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeColumns.tsx @@ -26,7 +26,30 @@ export default function TImovelUnidadeColumns( accessorKey: "imovel_unidade_id", header: ({ column }) => SortableHeader("#", column), cell: ({ row }) => Number(row.getValue("imovel_unidade_id")), - enableSorting: false, + }, + // 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 { diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeForm.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeForm.tsx index 3083ed9..1648914 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeForm.tsx +++ b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeForm.tsx @@ -1,12 +1,10 @@ 'use client'; -import z from 'zod'; -import { useEffect } from 'react'; -import { useForm, Controller } from 'react-hook-form'; +import React, { useEffect } from 'react'; +import { useForm } from 'react-hook-form'; import { zodResolver } from '@hookform/resolvers/zod'; import { Button } from '@/components/ui/button'; -import { Checkbox } from '@/components/ui/checkbox'; import { Dialog, DialogClose, @@ -25,34 +23,50 @@ import { FormMessage, } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; -import { Label } from '@/components/ui/label'; -import { TImovelSchema } from '../../_schemas/TImovelSchema'; import LoadingButton from '@/app/_components/loadingButton/LoadingButton'; -import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; -import { HouseIcon, IdCardIcon, UserIcon } from 'lucide-react'; -import { Select } from '@/components/ui/select'; +import { TImovelUnidadeFormValues, TImovelUnidadeSchema } from '../../_schemas/TImovelUnidadeSchema'; +import TImovelUnidadeProps from './TImovelUnidadeFormProps'; +import { useGTBTipoLogradouroReadHook } from '../../_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'; -type FormValues = z.infer; +export default function TImovelUnidadeForm({ isOpen, data, onClose, onSave, buttonIsLoading }: TImovelUnidadeProps) { -interface Props { - isOpen: boolean; - data: FormValues | null; - onClose: (item: null, isFormStatus: boolean) => void; - onSave: (data: FormValues) => void; - buttonIsLoading: boolean; -} + const { gTBTipoLogradouro, fetchGTBTipoLogradouro } = useGTBTipoLogradouroReadHook(); -export default function TImovelUnidadeForm({ isOpen, data, onClose, onSave, buttonIsLoading }: Props) { // Inicializa o react-hook-form com schema zod - const form = useForm({ - resolver: zodResolver(TImovelSchema), - defaultValues: {}, + const form = useForm({ + resolver: zodResolver(TImovelUnidadeSchema), + defaultValues: { + imovel_id: 1, + }, }); // Atualiza o formulário quando recebe dados para edição useEffect(() => { - if (data) form.reset(data); + + // 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 ( @@ -62,224 +76,450 @@ export default function TImovelUnidadeForm({ isOpen, data, onClose, onSave, butt if (!open) onClose(null, false); }} > - + - Imóvel Urbano + Unidades do Imóvel - Cadastro de imóvel urbano + Cadastro de unidades do imóvel - {/* Tabs */} - - - - - Dados do Imóvel - - - - Unidades - - - - {/* Dados do Imóvel */} - -
- {/* Tipo Classe */} - ( +
+ {/* 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 Classe - - - + Tipo logradouro + + + + + + + + + + + Nenhum resultado encontrado. + + {gTBTipoLogradouro?.map((item) => ( + { + field.onChange(Number(item.tb_tipologradouro_id)); + setOpen(false); + }} + > + + {GetCapitalize(item.descricao)} + + ))} + + + + + - )} - /> - - {/* Tipo Registro */} - ( + ); + }} + /> +
+ {/* 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 Registro - - - + Tipo Imóvel + + + + + + + + + + + Nenhum resultado encontrado. + + {options.map((item) => ( + { + field.onChange(item.value); // salva o número (id) + setOpen(false); + }} + > + + {item.label} + + ))} + + + + + - )} - /> - - {/* Número */} - ( + ); + }} + /> +
+ {/* Construção */} +
+ { + const [open, setOpen] = React.useState(false); + const options = Object.entries(ImovelConstrucaoEnum).map(([id, label]) => ({ + value: Number(id), + label, + })); + return ( - Número - - - + Construção + + + + + + + + + + + Nenhum resultado encontrado. + + {options.map((item) => ( + { + field.onChange(item.value); + setOpen(false); + }} + > + + {item.label} + + ))} + + + + + - )} - /> - - {/* Número Letra */} - ( - - Número Letra - - - - - - )} - /> - - {/* Cidade */} - ( - - Cidade - - - - - - )} - /> - - {/* UF */} - ( - - UF - - - - - - )} - /> - - {/* Bairro */} - ( - - Bairro - - - - - - )} - /> - - {/* CEP */} - ( - - CEP - - - - - - )} - /> - - {/* Cartório */} - ( - - Cartório - - - - - - )} - /> - - {/* Livro */} - ( - - Livro - - - - - - )} - /> - - {/* CNS */} - ( - - CNS - - - - - - )} - /> - - {/* GTB Descrição */} - ( - - GTB Descrição - - - - - - )} - /> -
- - - {/* Unidades */} - - {/* Conteúdo das unidades */} - - + ); + }} + /> +
+ {/* 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 */} @@ -287,7 +527,6 @@ export default function TImovelUnidadeForm({ isOpen, data, onClose, onSave, butt Cancelar - - {/* Campo oculto */} + diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeFormProps.ts b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeFormProps.ts new file mode 100644 index 0000000..032744e --- /dev/null +++ b/src/app/(protected)/(cadastros)/cadastros/_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/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeTable.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeTable.tsx index 344dcdf..6c49ecf 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeTable.tsx +++ b/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeTable.tsx @@ -20,8 +20,8 @@ export default function TImovelUnidadeTable({ data, onEdit, onDelete }: TImovelU
); diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaForm.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaForm.tsx index 17c3580..8855a6e 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaForm.tsx +++ b/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaForm.tsx @@ -716,7 +716,6 @@ export default function TCensecForm({ )} /> - {/* Número */}
- {/* CPF */}
- {/* Órgão Emissor */}
- {/* UF */}
- {/* Data de Expedição */}
{ const { setResponse } = useResponse(); - const [tImovel, setTImovel] = useState< - TImovelInterface[] | null - >(null); + const [tImovel, setTImovel] = useState(); const indexTImovel = async () => { const response = await TImovelIndexData(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts index 83e6f52..1a38494 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts @@ -9,8 +9,7 @@ export const useTImovelUnidadeIndexHook = () => { const { setResponse } = useResponse(); const [tImovelUnidade, setTImovelUnidade] = useState< - TImovelUnidadeInterface[] | null - >(null); + TImovelUnidadeInterface[]>(); const indexTImovelUnidade = async () => { const response = await TImovelUnidadeIndexData(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts index c129b16..efa5c5d 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts @@ -30,4 +30,5 @@ export const useTImovelUnidadeSaveHook = () => { }; return { tImovelUnidade, saveTImovelUnidade }; + }; diff --git a/src/app/(protected)/(cadastros)/cadastros/_interfaces/TImovelUnidadeInterface.ts b/src/app/(protected)/(cadastros)/cadastros/_interfaces/TImovelUnidadeInterface.ts index 83a52d1..6aaa723 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_interfaces/TImovelUnidadeInterface.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_interfaces/TImovelUnidadeInterface.ts @@ -11,7 +11,7 @@ export default interface TImovelUnidadeInterface { caracteristica?: string; reserva_florestal?: string; geo_referenciamento?: string; - logradouro?: string; + logradouro: string; tb_tipologradouro_id?: number; selecionado?: string; complemento?: string; diff --git a/src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelSchema.ts b/src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelSchema.ts index 450a09f..f7653b2 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelSchema.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelSchema.ts @@ -1,17 +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, -}); \ No newline at end of file + 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/app/(protected)/(cadastros)/cadastros/_schemas/TImovelUnidadeSchema.ts b/src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelUnidadeSchema.ts index 99fe817..20f00a9 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelUnidadeSchema.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelUnidadeSchema.ts @@ -13,7 +13,7 @@ export const TImovelUnidadeSchema = z.object({ caracteristica: z.string().optional(), reserva_florestal: z.string().optional(), geo_referenciamento: z.string().optional(), - logradouro: 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(), @@ -36,4 +36,7 @@ export const TImovelUnidadeSchema = z.object({ inscricao_municipal: z.string().optional(), cib: z.string().optional(), area_construida: z.number().optional(), -}); \ No newline at end of file +}); + +// Exportar o tipo inferido junto (opcional) +export type TImovelUnidadeFormValues = z.infer; \ No newline at end of file diff --git a/src/app/_components/dataTable/dataTable.tsx b/src/app/_components/dataTable/dataTable.tsx index 39f7549..e665f31 100644 --- a/src/app/_components/dataTable/dataTable.tsx +++ b/src/app/_components/dataTable/dataTable.tsx @@ -216,6 +216,7 @@ export function DataTable({ onClick={() => table.setPageIndex(0)} disabled={!table.getCanPreviousPage()} aria-label="Primeira página" + className='cursor-pointer' > Primeira @@ -225,6 +226,7 @@ export function DataTable({ onClick={() => table.previousPage()} disabled={!table.getCanPreviousPage()} aria-label="Página anterior" + className='cursor-pointer' > Anterior @@ -235,6 +237,7 @@ export function DataTable({ onClick={() => table.nextPage()} disabled={!table.getCanNextPage()} aria-label="Próxima página" + className='cursor-pointer' > Próxima @@ -245,6 +248,7 @@ export function DataTable({ onClick={() => table.setPageIndex(table.getPageCount() - 1)} disabled={!table.getCanNextPage()} aria-label="Última página" + className='cursor-pointer' > Última 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 index 2d91f88..5476b98 100644 --- a/src/enums/ImovelTipoRegistro.ts +++ b/src/enums/ImovelTipoRegistro.ts @@ -1,4 +1,5 @@ export enum ImovelTipoRegistro { M = 'Matrícula', - T = 'Transcrição' + T = 'Transcrição', + I = 'Inscrição', } \ No newline at end of file From 3aa4c734539f3ff3859a2ed4a407f5d1faef9065 Mon Sep 17 00:00:00 2001 From: keven Date: Thu, 2 Oct 2025 15:47:06 -0300 Subject: [PATCH 3/5] =?UTF-8?q?[MVPTN-87]=20refactor(Dir):=20Reestrutura?= =?UTF-8?q?=C3=A7=C3=A3o=20de=20Pastas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cadastros/(t_imovel)/imoveis/urbanos/page.tsx | 12 ++++++------ .../components}/t_imovel/TImovelColumns.tsx | 2 +- .../components}/t_imovel/TImovelForm.tsx | 4 ++-- .../components}/t_imovel/TImovelFormProps.ts | 0 .../components}/t_imovel/TImovelTable.tsx | 2 +- .../t_imovel_unidade/TImovelUnidadeColumns.tsx | 2 +- .../t_imovel_unidade/TImovelUnidadeForm.tsx | 4 ++-- .../t_imovel_unidade/TImovelUnidadeFormProps.ts | 2 +- .../t_imovel_unidade/TImovelUnidadePage.tsx | 8 ++++---- .../t_imovel_unidade/TImovelUnidadeTable.tsx | 2 +- .../data}/TImovel/TImovelDeleteData.ts | 2 +- .../administrativo/data}/TImovel/TImovelIndexData.ts | 0 .../administrativo/data}/TImovel/TImovelSaveData.ts | 2 +- .../data}/TImovelUnidade/TImovelUnidadeDeleteData.ts | 2 +- .../data}/TImovelUnidade/TImovelUnidadeIndexData.ts | 0 .../data}/TImovelUnidade/TImovelUnidadeSaveData.ts | 2 +- .../hooks}/t_imovel/useTImovelDeleteHook.ts | 4 ++-- .../hooks}/t_imovel/useTImovelIndexHook.ts | 4 ++-- .../hooks}/t_imovel/useTImovelSaveHook.ts | 4 ++-- .../t_imovel_unidade/useTImovelUnidadeDeleteHook.ts | 4 ++-- .../t_imovel_unidade/useTImovelUnidadeIndexHook.ts | 4 ++-- .../t_imovel_unidade/useTImovelUnidadeSaveHook.ts | 4 ++-- .../administrativo/interfaces}/TImovelInterface.ts | 0 .../interfaces}/TImovelUnidadeInterface.ts | 0 .../administrativo/schemas}/TImovelSchema.ts | 0 .../administrativo/schemas}/TImovelUnidadeSchema.ts | 0 .../services}/t_imovel/TImovelDeleteService.ts | 4 ++-- .../services}/t_imovel/TImovelIndexService.ts | 2 +- .../services}/t_imovel/TImovelSaveService.ts | 4 ++-- .../t_imovel_unidade/TImovelUnidadeDeleteService.ts | 4 ++-- .../t_imovel_unidade/TImovelUnidadeIndexService.ts | 2 +- .../t_imovel_unidade/TImovelUnidadeSaveService.ts | 4 ++-- 32 files changed, 45 insertions(+), 45 deletions(-) rename src/{app/(protected)/(cadastros)/cadastros/_components => packages/administrativo/components}/t_imovel/TImovelColumns.tsx (98%) rename src/{app/(protected)/(cadastros)/cadastros/_components => packages/administrativo/components}/t_imovel/TImovelForm.tsx (98%) rename src/{app/(protected)/(cadastros)/cadastros/_components => packages/administrativo/components}/t_imovel/TImovelFormProps.ts (100%) rename src/{app/(protected)/(cadastros)/cadastros/_components => packages/administrativo/components}/t_imovel/TImovelTable.tsx (91%) rename src/{app/(protected)/(cadastros)/cadastros/_components => packages/administrativo/components}/t_imovel_unidade/TImovelUnidadeColumns.tsx (97%) rename src/{app/(protected)/(cadastros)/cadastros/_components => packages/administrativo/components}/t_imovel_unidade/TImovelUnidadeForm.tsx (99%) rename src/{app/(protected)/(cadastros)/cadastros/_components => packages/administrativo/components}/t_imovel_unidade/TImovelUnidadeFormProps.ts (76%) rename src/{app/(protected)/(cadastros)/cadastros/_components => packages/administrativo/components}/t_imovel_unidade/TImovelUnidadePage.tsx (91%) rename src/{app/(protected)/(cadastros)/cadastros/_components => packages/administrativo/components}/t_imovel_unidade/TImovelUnidadeTable.tsx (91%) rename src/{app/(protected)/(cadastros)/cadastros/_data => packages/administrativo/data}/TImovel/TImovelDeleteData.ts (83%) rename src/{app/(protected)/(cadastros)/cadastros/_data => packages/administrativo/data}/TImovel/TImovelIndexData.ts (100%) rename src/{app/(protected)/(cadastros)/cadastros/_data => packages/administrativo/data}/TImovel/TImovelSaveData.ts (86%) rename src/{app/(protected)/(cadastros)/cadastros/_data => packages/administrativo/data}/TImovelUnidade/TImovelUnidadeDeleteData.ts (82%) rename src/{app/(protected)/(cadastros)/cadastros/_data => packages/administrativo/data}/TImovelUnidade/TImovelUnidadeIndexData.ts (100%) rename src/{app/(protected)/(cadastros)/cadastros/_data => packages/administrativo/data}/TImovelUnidade/TImovelUnidadeSaveData.ts (81%) rename src/{app/(protected)/(cadastros)/cadastros/_hooks => packages/administrativo/hooks}/t_imovel/useTImovelDeleteHook.ts (75%) rename src/{app/(protected)/(cadastros)/cadastros/_hooks => packages/administrativo/hooks}/t_imovel/useTImovelIndexHook.ts (80%) rename src/{app/(protected)/(cadastros)/cadastros/_hooks => packages/administrativo/hooks}/t_imovel/useTImovelSaveHook.ts (84%) rename src/{app/(protected)/(cadastros)/cadastros/_hooks => packages/administrativo/hooks}/t_imovel_unidade/useTImovelUnidadeDeleteHook.ts (75%) rename src/{app/(protected)/(cadastros)/cadastros/_hooks => packages/administrativo/hooks}/t_imovel_unidade/useTImovelUnidadeIndexHook.ts (78%) rename src/{app/(protected)/(cadastros)/cadastros/_hooks => packages/administrativo/hooks}/t_imovel_unidade/useTImovelUnidadeSaveHook.ts (82%) rename src/{app/(protected)/(cadastros)/cadastros/_interfaces => packages/administrativo/interfaces}/TImovelInterface.ts (100%) rename src/{app/(protected)/(cadastros)/cadastros/_interfaces => packages/administrativo/interfaces}/TImovelUnidadeInterface.ts (100%) rename src/{app/(protected)/(cadastros)/cadastros/_schemas => packages/administrativo/schemas}/TImovelSchema.ts (100%) rename src/{app/(protected)/(cadastros)/cadastros/_schemas => packages/administrativo/schemas}/TImovelUnidadeSchema.ts (100%) rename src/{app/(protected)/(cadastros)/cadastros/_services => packages/administrativo/services}/t_imovel/TImovelDeleteService.ts (69%) rename src/{app/(protected)/(cadastros)/cadastros/_services => packages/administrativo/services}/t_imovel/TImovelIndexService.ts (81%) rename src/{app/(protected)/(cadastros)/cadastros/_services => packages/administrativo/services}/t_imovel/TImovelSaveService.ts (69%) rename src/{app/(protected)/(cadastros)/cadastros/_services => packages/administrativo/services}/t_imovel_unidade/TImovelUnidadeDeleteService.ts (67%) rename src/{app/(protected)/(cadastros)/cadastros/_services => packages/administrativo/services}/t_imovel_unidade/TImovelUnidadeIndexService.ts (78%) rename src/{app/(protected)/(cadastros)/cadastros/_services => packages/administrativo/services}/t_imovel_unidade/TImovelUnidadeSaveService.ts (67%) 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 index 424f95d..52b4f0d 100644 --- a/src/app/(protected)/(cadastros)/cadastros/(t_imovel)/imoveis/urbanos/page.tsx +++ b/src/app/(protected)/(cadastros)/cadastros/(t_imovel)/imoveis/urbanos/page.tsx @@ -4,17 +4,17 @@ import { useEffect, useState, useCallback } from 'react'; import { Card, CardContent } from '@/components/ui/card'; import Loading from '@/app/_components/loading/loading'; -import TImovelTable from '../../../_components/t_imovel/TImovelTable'; -import TImovelForm from '../../../_components/t_imovel/TImovelForm'; +import TImovelTable from '@/packages/administrativo/components/t_imovel/TImovelTable'; +import TImovelForm from '@/packages/administrativo/components/t_imovel/TImovelForm'; -import { useTImovelIndexHook } from '../../../_hooks/t_imovel/useTImovelIndexHook'; -import { useTImovelSaveHook } from '../../../_hooks/t_imovel/useTImovelSaveHook'; -import { useTImovelDeleteHook } from '../../../_hooks/t_imovel/useTImovelDeleteHook'; +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 '../../../_interfaces/TImovelInterface'; +import TImovelInterface from '@/packages/administrativo/interfaces/TImovelInterface'; import Header from '@/app/_components/structure/Header'; export default function TTBAndamentoServico() { diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelColumns.tsx b/src/packages/administrativo/components/t_imovel/TImovelColumns.tsx similarity index 98% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelColumns.tsx rename to src/packages/administrativo/components/t_imovel/TImovelColumns.tsx index 71a6181..f999aac 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelColumns.tsx +++ b/src/packages/administrativo/components/t_imovel/TImovelColumns.tsx @@ -1,5 +1,5 @@ import { ColumnDef } from "@tanstack/react-table"; -import TImovelInterface from "../../_interfaces/TImovelInterface"; +import TImovelInterface from "../../interfaces/TImovelInterface"; import { Button } from "@/components/ui/button"; import { EllipsisIcon, diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelForm.tsx b/src/packages/administrativo/components/t_imovel/TImovelForm.tsx similarity index 98% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelForm.tsx rename to src/packages/administrativo/components/t_imovel/TImovelForm.tsx index e3774ba..0638319 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelForm.tsx +++ b/src/packages/administrativo/components/t_imovel/TImovelForm.tsx @@ -24,7 +24,7 @@ import { } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; -import { TImovelFormValues, TImovelSchema } from '../../_schemas/TImovelSchema'; +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'; @@ -34,7 +34,7 @@ import { ImovelTipoRegistro } from '@/enums/ImovelTipoRegistro'; import { ImovelTipoClasseEnum } from '@/enums/ImovelTipoClasseEnum'; import { ResetFormIfData } from '@/actions/form/ResetFormIfData'; import { TImovelFormProps } from './TImovelFormProps'; -import { useGTBBairroReadHook } from '../../_hooks/g_tb_bairro/useGTBBairroReadHook'; +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'; diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelFormProps.ts b/src/packages/administrativo/components/t_imovel/TImovelFormProps.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelFormProps.ts rename to src/packages/administrativo/components/t_imovel/TImovelFormProps.ts diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelTable.tsx b/src/packages/administrativo/components/t_imovel/TImovelTable.tsx similarity index 91% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelTable.tsx rename to src/packages/administrativo/components/t_imovel/TImovelTable.tsx index 45f6696..db08e6a 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel/TImovelTable.tsx +++ b/src/packages/administrativo/components/t_imovel/TImovelTable.tsx @@ -2,7 +2,7 @@ import { DataTable } from '@/app/_components/dataTable/DataTable'; import TImovelColumns from './TImovelColumns'; -import TImovelInterface from '../../_interfaces/TImovelInterface'; +import TImovelInterface from '../../interfaces/TImovelInterface'; interface TImovelTableProps { data?: TImovelInterface[]; diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeColumns.tsx b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeColumns.tsx similarity index 97% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeColumns.tsx rename to src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeColumns.tsx index ac1657e..486c30c 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeColumns.tsx +++ b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeColumns.tsx @@ -1,5 +1,5 @@ import { ColumnDef } from "@tanstack/react-table"; -import TImovelUnidadeInterface from "../../_interfaces/TImovelUnidadeInterface"; +import TImovelUnidadeInterface from "../../interfaces/TImovelUnidadeInterface"; import { Button } from "@/components/ui/button"; import { EllipsisIcon, diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeForm.tsx b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeForm.tsx similarity index 99% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeForm.tsx rename to src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeForm.tsx index 1648914..89f5174 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeForm.tsx +++ b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeForm.tsx @@ -25,9 +25,9 @@ import { import { Input } from '@/components/ui/input'; import LoadingButton from '@/app/_components/loadingButton/LoadingButton'; -import { TImovelUnidadeFormValues, TImovelUnidadeSchema } from '../../_schemas/TImovelUnidadeSchema'; +import { TImovelUnidadeFormValues, TImovelUnidadeSchema } from '../../schemas/TImovelUnidadeSchema'; import TImovelUnidadeProps from './TImovelUnidadeFormProps'; -import { useGTBTipoLogradouroReadHook } from '../../_hooks/g_tb_tipologradouro/useGTBTipoLogradouroReadHook'; +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'; diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeFormProps.ts b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeFormProps.ts similarity index 76% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeFormProps.ts rename to src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeFormProps.ts index 032744e..9df2ab7 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeFormProps.ts +++ b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeFormProps.ts @@ -1,4 +1,4 @@ -import { TImovelUnidadeFormValues } from "../../_schemas/TImovelUnidadeSchema"; +import { TImovelUnidadeFormValues } from "../../schemas/TImovelUnidadeSchema"; export default interface TImovelUnidadeProps { isOpen: boolean; diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadePage.tsx b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadePage.tsx similarity index 91% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadePage.tsx rename to src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadePage.tsx index cfc5372..025a1e3 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadePage.tsx +++ b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadePage.tsx @@ -6,14 +6,14 @@ 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 { 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 TImovelUnidadeInterface from '../../interfaces/TImovelUnidadeInterface'; import Header from '@/app/_components/structure/Header'; export default function TImovelUnidadePage() { diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeTable.tsx b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeTable.tsx similarity index 91% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeTable.tsx rename to src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeTable.tsx index 6c49ecf..b7323fe 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_imovel_unidade/TImovelUnidadeTable.tsx +++ b/src/packages/administrativo/components/t_imovel_unidade/TImovelUnidadeTable.tsx @@ -1,7 +1,7 @@ 'use client'; import { DataTable } from '@/app/_components/dataTable/DataTable'; -import TImovelUnidadeInterface from '../../_interfaces/TImovelUnidadeInterface'; +import TImovelUnidadeInterface from '../../interfaces/TImovelUnidadeInterface'; import TImovelUnidadeColumns from './TImovelUnidadeColumns'; interface TImovelUnidadeTableProps { diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelDeleteData.ts b/src/packages/administrativo/data/TImovel/TImovelDeleteData.ts similarity index 83% rename from src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelDeleteData.ts rename to src/packages/administrativo/data/TImovel/TImovelDeleteData.ts index 4f8248a..ef3be0c 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelDeleteData.ts +++ b/src/packages/administrativo/data/TImovel/TImovelDeleteData.ts @@ -1,5 +1,5 @@ import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; -import TImovelInterface from "../../_interfaces/TImovelInterface"; +import TImovelInterface from "../../interfaces/TImovelInterface"; async function executeTImovelDeleteData(data: TImovelInterface) { diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelIndexData.ts b/src/packages/administrativo/data/TImovel/TImovelIndexData.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelIndexData.ts rename to src/packages/administrativo/data/TImovel/TImovelIndexData.ts diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelSaveData.ts b/src/packages/administrativo/data/TImovel/TImovelSaveData.ts similarity index 86% rename from src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelSaveData.ts rename to src/packages/administrativo/data/TImovel/TImovelSaveData.ts index bb37d2f..34b6bc0 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/TImovel/TImovelSaveData.ts +++ b/src/packages/administrativo/data/TImovel/TImovelSaveData.ts @@ -1,5 +1,5 @@ import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; -import TImovelInterface from "../../_interfaces/TImovelInterface"; +import TImovelInterface from "../../interfaces/TImovelInterface"; async function executeTImovelSaveData(data: TImovelInterface) { diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeDeleteData.ts b/src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeDeleteData.ts similarity index 82% rename from src/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeDeleteData.ts rename to src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeDeleteData.ts index bda2703..c695584 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeDeleteData.ts +++ b/src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeDeleteData.ts @@ -1,5 +1,5 @@ import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; -import TImovelUnidadeInterface from "../../_interfaces/TImovelUnidadeInterface"; +import TImovelUnidadeInterface from "../../interfaces/TImovelUnidadeInterface"; async function executeTImovelUnidadeDeleteData(data: TImovelUnidadeInterface) { diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeIndexData.ts b/src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeIndexData.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeIndexData.ts rename to src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeIndexData.ts diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeSaveData.ts b/src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeSaveData.ts similarity index 81% rename from src/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeSaveData.ts rename to src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeSaveData.ts index 48a305a..7515972 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/TImovelUnidade/TImovelUnidadeSaveData.ts +++ b/src/packages/administrativo/data/TImovelUnidade/TImovelUnidadeSaveData.ts @@ -1,5 +1,5 @@ import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; -import TImovelUnidadeInterface from "../../_interfaces/TImovelUnidadeInterface"; +import TImovelUnidadeInterface from "../../interfaces/TImovelUnidadeInterface"; async function executeTImovelUnidadeSaveData(data: TImovelUnidadeInterface) { diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelDeleteHook.ts b/src/packages/administrativo/hooks/t_imovel/useTImovelDeleteHook.ts similarity index 75% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelDeleteHook.ts rename to src/packages/administrativo/hooks/t_imovel/useTImovelDeleteHook.ts index 78d9577..620ff87 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelDeleteHook.ts +++ b/src/packages/administrativo/hooks/t_imovel/useTImovelDeleteHook.ts @@ -1,7 +1,7 @@ import { useResponse } from '@/app/_response/ResponseContext'; import { useState } from 'react'; -import TImovelInterface from '../../_interfaces/TImovelInterface'; -import { TImovelDeleteService } from '../../_services/t_imovel/TImovelDeleteService'; +import TImovelInterface from '../../interfaces/TImovelInterface'; +import { TImovelDeleteService } from '../../services/t_imovel/TImovelDeleteService'; export const useTImovelDeleteHook = () => { const { setResponse } = useResponse(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelIndexHook.ts b/src/packages/administrativo/hooks/t_imovel/useTImovelIndexHook.ts similarity index 80% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelIndexHook.ts rename to src/packages/administrativo/hooks/t_imovel/useTImovelIndexHook.ts index 91b0b33..ee83fb7 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelIndexHook.ts +++ b/src/packages/administrativo/hooks/t_imovel/useTImovelIndexHook.ts @@ -2,8 +2,8 @@ import { useResponse } from '@/app/_response/ResponseContext'; import { useState } from 'react'; -import TImovelInterface from '../../_interfaces/TImovelInterface'; -import { TImovelIndexData } from '../../_data/TImovel/TImovelIndexData'; +import TImovelInterface from '../../interfaces/TImovelInterface'; +import { TImovelIndexData } from '../../data/TImovel/TImovelIndexData'; export const useTImovelIndexHook = () => { const { setResponse } = useResponse(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelSaveHook.ts b/src/packages/administrativo/hooks/t_imovel/useTImovelSaveHook.ts similarity index 84% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelSaveHook.ts rename to src/packages/administrativo/hooks/t_imovel/useTImovelSaveHook.ts index 75f37c6..710419b 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel/useTImovelSaveHook.ts +++ b/src/packages/administrativo/hooks/t_imovel/useTImovelSaveHook.ts @@ -2,8 +2,8 @@ import { useResponse } from '@/app/_response/ResponseContext'; import { useState } from 'react'; -import TImovelInterface from '../../_interfaces/TImovelInterface'; -import { TImovelSaveService } from '../../_services/t_imovel/TImovelSaveService'; +import TImovelInterface from '../../interfaces/TImovelInterface'; +import { TImovelSaveService } from '../../services/t_imovel/TImovelSaveService'; export const useTImovelSaveHook = () => { const { setResponse } = useResponse(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeDeleteHook.ts b/src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeDeleteHook.ts similarity index 75% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeDeleteHook.ts rename to src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeDeleteHook.ts index 84b6fb0..19fb252 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeDeleteHook.ts +++ b/src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeDeleteHook.ts @@ -1,7 +1,7 @@ import { useResponse } from '@/app/_response/ResponseContext'; import { useState } from 'react'; -import TImovelUnidadeInterface from '../../_interfaces/TImovelUnidadeInterface'; -import { TImovelDeleteService } from '../../_services/t_imovel/TImovelDeleteService'; +import TImovelUnidadeInterface from '../../interfaces/TImovelUnidadeInterface'; +import { TImovelDeleteService } from '../../services/t_imovel/TImovelDeleteService'; export const useTImovelUnidadeDeleteHook = () => { const { setResponse } = useResponse(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts b/src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts similarity index 78% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts rename to src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts index 1a38494..2e854c6 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts +++ b/src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeIndexHook.ts @@ -2,8 +2,8 @@ import { useResponse } from '@/app/_response/ResponseContext'; import { useState } from 'react'; -import TImovelUnidadeInterface from '../../_interfaces/TImovelUnidadeInterface'; -import { TImovelUnidadeIndexData } from '../../_data/TImovelUnidade/TImovelUnidadeIndexData'; +import TImovelUnidadeInterface from '../../interfaces/TImovelUnidadeInterface'; +import { TImovelUnidadeIndexData } from '../../data/TImovelUnidade/TImovelUnidadeIndexData'; export const useTImovelUnidadeIndexHook = () => { const { setResponse } = useResponse(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts b/src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts similarity index 82% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts rename to src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts index efa5c5d..d7509fe 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts +++ b/src/packages/administrativo/hooks/t_imovel_unidade/useTImovelUnidadeSaveHook.ts @@ -2,8 +2,8 @@ import { useResponse } from '@/app/_response/ResponseContext'; import { useState } from 'react'; -import TImovelUnidadeInterface from '../../_interfaces/TImovelUnidadeInterface'; -import { TImovelUnidadeSaveService } from '../../_services/t_imovel_unidade/TImovelUnidadeSaveService'; +import TImovelUnidadeInterface from '../../interfaces/TImovelUnidadeInterface'; +import { TImovelUnidadeSaveService } from '../../services/t_imovel_unidade/TImovelUnidadeSaveService'; export const useTImovelUnidadeSaveHook = () => { const { setResponse } = useResponse(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_interfaces/TImovelInterface.ts b/src/packages/administrativo/interfaces/TImovelInterface.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_interfaces/TImovelInterface.ts rename to src/packages/administrativo/interfaces/TImovelInterface.ts diff --git a/src/app/(protected)/(cadastros)/cadastros/_interfaces/TImovelUnidadeInterface.ts b/src/packages/administrativo/interfaces/TImovelUnidadeInterface.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_interfaces/TImovelUnidadeInterface.ts rename to src/packages/administrativo/interfaces/TImovelUnidadeInterface.ts diff --git a/src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelSchema.ts b/src/packages/administrativo/schemas/TImovelSchema.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelSchema.ts rename to src/packages/administrativo/schemas/TImovelSchema.ts diff --git a/src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelUnidadeSchema.ts b/src/packages/administrativo/schemas/TImovelUnidadeSchema.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_schemas/TImovelUnidadeSchema.ts rename to src/packages/administrativo/schemas/TImovelUnidadeSchema.ts diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelDeleteService.ts b/src/packages/administrativo/services/t_imovel/TImovelDeleteService.ts similarity index 69% rename from src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelDeleteService.ts rename to src/packages/administrativo/services/t_imovel/TImovelDeleteService.ts index da4ae95..895794e 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelDeleteService.ts +++ b/src/packages/administrativo/services/t_imovel/TImovelDeleteService.ts @@ -1,6 +1,6 @@ import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler'; -import { TImovelDeleteData } from '../../_data/TImovel/TImovelDeleteData'; -import TImovelInterface from '../../_interfaces/TImovelInterface'; +import { TImovelDeleteData } from '../../data/TImovel/TImovelDeleteData'; +import TImovelInterface from '../../interfaces/TImovelInterface'; async function executeTImovelDeleteService(data: TImovelInterface) { const response = await TImovelDeleteData(data); diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelIndexService.ts b/src/packages/administrativo/services/t_imovel/TImovelIndexService.ts similarity index 81% rename from src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelIndexService.ts rename to src/packages/administrativo/services/t_imovel/TImovelIndexService.ts index c0f5754..f392a20 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelIndexService.ts +++ b/src/packages/administrativo/services/t_imovel/TImovelIndexService.ts @@ -1,5 +1,5 @@ import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler'; -import { TImovelIndexData } from '../../_data/TImovel/TImovelIndexData'; +import { TImovelIndexData } from '../../data/TImovel/TImovelIndexData'; export default async function executeTImovelIndexService() { const response = await TImovelIndexData(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelSaveService.ts b/src/packages/administrativo/services/t_imovel/TImovelSaveService.ts similarity index 69% rename from src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelSaveService.ts rename to src/packages/administrativo/services/t_imovel/TImovelSaveService.ts index c85effd..82ffce0 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel/TImovelSaveService.ts +++ b/src/packages/administrativo/services/t_imovel/TImovelSaveService.ts @@ -1,6 +1,6 @@ import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler'; -import { TImovelSaveData } from '../../_data/TImovel/TImovelSaveData'; -import TImovelInterface from '../../_interfaces/TImovelInterface'; +import { TImovelSaveData } from '../../data/TImovel/TImovelSaveData'; +import TImovelInterface from '../../interfaces/TImovelInterface'; async function executeTImovelSaveService(data: TImovelInterface) { const response = await TImovelSaveData(data); diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeDeleteService.ts b/src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeDeleteService.ts similarity index 67% rename from src/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeDeleteService.ts rename to src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeDeleteService.ts index 7df9afc..0b5553f 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeDeleteService.ts +++ b/src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeDeleteService.ts @@ -1,6 +1,6 @@ import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler'; -import TImovelUnidadeInterface from '../../_interfaces/TImovelUnidadeInterface'; -import { TImovelUnidadeDeleteData } from '../../_data/TImovelUnidade/TImovelUnidadeDeleteData'; +import TImovelUnidadeInterface from '../../interfaces/TImovelUnidadeInterface'; +import { TImovelUnidadeDeleteData } from '../../data/TImovelUnidade/TImovelUnidadeDeleteData'; async function executeTImovelUnidadeDeleteService(data: TImovelUnidadeInterface) { const response = await TImovelUnidadeDeleteData(data); diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeIndexService.ts b/src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeIndexService.ts similarity index 78% rename from src/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeIndexService.ts rename to src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeIndexService.ts index e2a9fac..31eba39 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeIndexService.ts +++ b/src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeIndexService.ts @@ -1,5 +1,5 @@ import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler'; -import { TImovelUnidadeIndexData } from '../../_data/TImovelUnidade/TImovelUnidadeIndexData'; +import { TImovelUnidadeIndexData } from '../../data/TImovelUnidade/TImovelUnidadeIndexData'; export default async function executeTImovelUnidadeIndexService() { const response = await TImovelUnidadeIndexData(); diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeSaveService.ts b/src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeSaveService.ts similarity index 67% rename from src/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeSaveService.ts rename to src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeSaveService.ts index cd8b928..cf786c0 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/t_imovel_unidade/TImovelUnidadeSaveService.ts +++ b/src/packages/administrativo/services/t_imovel_unidade/TImovelUnidadeSaveService.ts @@ -1,6 +1,6 @@ import { withClientErrorHandler } from '@/actions/withClientErrorHandler/withClientErrorHandler'; -import TImovelUnidadeInterface from '../../_interfaces/TImovelUnidadeInterface'; -import { TImovelUnidadeSaveData } from '../../_data/TImovelUnidade/TImovelUnidadeSaveData'; +import TImovelUnidadeInterface from '../../interfaces/TImovelUnidadeInterface'; +import { TImovelUnidadeSaveData } from '../../data/TImovelUnidade/TImovelUnidadeSaveData'; async function executeTImovelUnidadeSaveService(data: TImovelUnidadeInterface) { const response = await TImovelUnidadeSaveData(data); From 7f9b7944dbee2fdef8d55af4018d36f0d0e9cde8 Mon Sep 17 00:00:00 2001 From: keven Date: Thu, 2 Oct 2025 18:13:06 -0300 Subject: [PATCH 4/5] =?UTF-8?q?[MVPTN-99]=20refactor(Estrutura):=20Refator?= =?UTF-8?q?a=C3=A7=C3=A3o=20de=20estrutura=20do=20projeto,=20adicionado=20?= =?UTF-8?q?favicon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/images/favicon.ico | Bin 0 -> 41662 bytes public/images/logo-abb.png | Bin 0 -> 2871 bytes .../administrativo/pessoas/fisicas}/page.tsx | 12 ++--- .../pessoas/juridicas}/page.tsx | 12 ++--- src/app/(protected)/layout.tsx | 15 ++++-- src/components/app-sidebar.tsx | 46 ++++++++++++------ .../t_pessoa/fisica/TPessoaFisicaForm.tsx} | 8 +-- .../t_pessoa/fisica/TPessoaFisicaTable.tsx} | 2 +- .../t_pessoa/juridica/TPessoaJuridicaForm.tsx | 4 +- .../juridica/TPessoaJuridicaTable.tsx | 2 +- .../TPessoaRepresentanteForm.tsx | 14 +++--- .../TPessoaRepresentantePage.tsx | 12 ++--- .../TPessoaRepresentanteTable.tsx | 2 +- .../data}/TPessoa/TPessoaIndexData.ts | 0 .../juridica/TPessoaJuridicaIndexData.ts | 0 .../TPessoaRepresentanteIndexData.ts | 0 .../juridica/useTPessoaJuridicaDeleteHook.ts | 4 +- .../juridica/useTPessoaJuridicaIndexHook.ts | 4 +- .../juridica/useTPessoaJuridicaSaveHook.ts | 4 +- .../hooks/t_pessoa}/useTPessoaDeleteHook.ts | 4 +- .../hooks}/t_pessoa/useTPessoaIndexHook.ts | 4 +- .../hooks/t_pessoa}/useTPessoaSaveHook.ts | 4 +- .../useTPessoaDeleteHook.ts | 4 +- .../useTPessoaRepresentanteIndexHook.ts | 6 +-- .../useTPessoaSaveHook.ts | 4 +- .../interfaces}/TPessoaInterface.ts | 0 .../interfaces}/TPessoaJuridicaInterface.ts | 0 .../interfaces}/TPessoaRepresentante.ts | 0 .../schemas/TPessoaFisicaSchema.ts} | 0 .../schemas}/TPessoaJuridicaSchema.ts | 0 .../schemas/TPessoaRepresentanteSchema.ts} | 0 .../services}/t_pessoa/TPessoaIndexService.ts | 2 +- .../juridica/TPessoaJuridicaIndexService.ts | 2 +- .../TPessoaRepresentante.ts | 2 +- 34 files changed, 97 insertions(+), 76 deletions(-) create mode 100644 public/images/favicon.ico create mode 100644 public/images/logo-abb.png rename src/app/(protected)/{(cadastros)/cadastros/(t_pessoa)/pessoa/fisica => (administrativo)/administrativo/pessoas/fisicas}/page.tsx (87%) rename src/app/(protected)/{(cadastros)/cadastros/(t_pessoa)/pessoa/juridica => (administrativo)/administrativo/pessoas/juridicas}/page.tsx (86%) rename src/{app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaForm.tsx => packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaForm.tsx} (98%) rename src/{app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaTable.tsx => packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaTable.tsx} (98%) rename src/{app/(protected)/(cadastros)/cadastros/_components => packages/administrativo/components}/t_pessoa/juridica/TPessoaJuridicaForm.tsx (98%) rename src/{app/(protected)/(cadastros)/cadastros/_components => packages/administrativo/components}/t_pessoa/juridica/TPessoaJuridicaTable.tsx (98%) rename src/{app/(protected)/(cadastros)/cadastros/_components => packages/administrativo/components}/t_pessoa_representante/TPessoaRepresentanteForm.tsx (93%) rename src/{app/(protected)/(cadastros)/cadastros/_components => packages/administrativo/components}/t_pessoa_representante/TPessoaRepresentantePage.tsx (90%) rename src/{app/(protected)/(cadastros)/cadastros/_components => packages/administrativo/components}/t_pessoa_representante/TPessoaRepresentanteTable.tsx (98%) rename src/{app/(protected)/(cadastros)/cadastros/_data => packages/administrativo/data}/TPessoa/TPessoaIndexData.ts (100%) rename src/{app/(protected)/(cadastros)/cadastros/_data => packages/administrativo/data}/TPessoa/juridica/TPessoaJuridicaIndexData.ts (100%) rename src/{app/(protected)/(cadastros)/cadastros/_data => packages/administrativo/data}/TPessoaRepresentante/TPessoaRepresentanteIndexData.ts (100%) rename src/{app/(protected)/(cadastros)/cadastros/_hooks => packages/administrativo/hooks}/t_pessoa/juridica/useTPessoaJuridicaDeleteHook.ts (61%) rename src/{app/(protected)/(cadastros)/cadastros/_hooks => packages/administrativo/hooks}/t_pessoa/juridica/useTPessoaJuridicaIndexHook.ts (70%) rename src/{app/(protected)/(cadastros)/cadastros/_hooks => packages/administrativo/hooks}/t_pessoa/juridica/useTPessoaJuridicaSaveHook.ts (80%) rename src/{app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa_representante => packages/administrativo/hooks/t_pessoa}/useTPessoaDeleteHook.ts (62%) rename src/{app/(protected)/(cadastros)/cadastros/_hooks => packages/administrativo/hooks}/t_pessoa/useTPessoaIndexHook.ts (74%) rename src/{app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa_representante => packages/administrativo/hooks/t_pessoa}/useTPessoaSaveHook.ts (80%) rename src/{app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa => packages/administrativo/hooks/t_pessoa_representante}/useTPessoaDeleteHook.ts (62%) rename src/{app/(protected)/(cadastros)/cadastros/_hooks => packages/administrativo/hooks}/t_pessoa_representante/useTPessoaRepresentanteIndexHook.ts (67%) rename src/{app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa => packages/administrativo/hooks/t_pessoa_representante}/useTPessoaSaveHook.ts (80%) rename src/{app/(protected)/(cadastros)/cadastros/_interfaces => packages/administrativo/interfaces}/TPessoaInterface.ts (100%) rename src/{app/(protected)/(cadastros)/cadastros/_interfaces => packages/administrativo/interfaces}/TPessoaJuridicaInterface.ts (100%) rename src/{app/(protected)/(cadastros)/cadastros/_interfaces => packages/administrativo/interfaces}/TPessoaRepresentante.ts (100%) rename src/{app/(protected)/(cadastros)/cadastros/_schemas/TPessoaSchema.ts => packages/administrativo/schemas/TPessoaFisicaSchema.ts} (100%) rename src/{app/(protected)/(cadastros)/cadastros/_schemas => packages/administrativo/schemas}/TPessoaJuridicaSchema.ts (100%) rename src/{app/(protected)/(cadastros)/cadastros/_schemas/TPessoaRepresentante.ts => packages/administrativo/schemas/TPessoaRepresentanteSchema.ts} (100%) rename src/{app/(protected)/(cadastros)/cadastros/_services => packages/administrativo/services}/t_pessoa/TPessoaIndexService.ts (80%) rename src/{app/(protected)/(cadastros)/cadastros/_services => packages/administrativo/services}/t_pessoa/juridica/TPessoaJuridicaIndexService.ts (76%) rename src/{app/(protected)/(cadastros)/cadastros/_services => packages/administrativo/services}/t_pessoa_representante/TPessoaRepresentante.ts (75%) diff --git a/public/images/favicon.ico b/public/images/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..144dc9fd91d05ff1fae08baba7ec5f658f464057 GIT binary patch literal 41662 zcmeI4*>4+F6vl^tfJa_E<0T%iGfvW^OPZz$Eef59q!Qu*34~al z5QwEf1*p6fka$1>2_8TY*78zRfj~%X0anJSX&+Rk-6cj_5`iN=m6p3%MM z_nmX^oH=(i?K1i;6f}C(wUZ|_?FvoPOxkFd_BL(2pMQFeYufVV=Qn2uy|h}UsAmfw z{z!z53T0bn%f7nWS5M#kcx=nwlgd~y=lFF`fJY5JlkC4)DGy`zOYo?Hhqa+!DG&CM zY}X)|)WF1;{YohlGyf2H)W9P?{G?JI#?0s7Q3H>3?|!8`IA&#fC&5ILNzTp)eeqYN zOk!g%frlgyo~O6$dsZor(9*xc?&t;+Nhayuf?6IFv&_N!z(bNp&Pob>{zs)u^!Xn| zE@y*@B$N2?38g%ETu%(#2_BL>vR%8B^U#lcPd;LSi6oQo!4H%(N$k8GJS2G}cig6& zhkoQcj3bgfc)ZmYepb#TKJ*BDM3RX)^r&(kp&S1e*2aD?kzitXY!+-Uo)4+qqLXie zhXfDjdVS;>r7TuBr>&FFDU21eiA9XD{^)c zOjcpS<1Oa_S7M9GcQbzsJXYaxejIt)6CNBJGh4^OWECbH+e0_}=?N3Q?y)vr4JNBF zG4l_4!h_?XG4qA6+c$to6(*ejlPWx{&aE`I|KTZLRqPw38{IQA2k(Wi6fv>abqQnc>x*qw zYCDCW!-qaZy><~3jvK1$u`lwCGJKyZsh>E^XuRk9Xk6RJ zd7ft8QrqS{xyLKxE1{$31lLQX`=*+jiL*YGG%9DaGGla^I8^Vs!iPT=$sM;g?KM8v zgR(yBwWI6DFa0B;6R(L>|4ky-*4|Wp<1lG3Ke>P}-Sdo2z9GzO?-7~qy-hJ^<`{8- z4HU#8*UrEAyW>0N?)ydh%4uPD_5{*@xZcf+T1VHo6lq4EKTC{W7rZVeF>p8K&K5+r zd)Qfb$9Yx1&fPLSV|0D;n}2+zh)G4xR0qX5RbI;-o;u@ji;X_-8%A6=V$6INEGA{R z`N?POwhq$Ka-f;`i3hipbC6E`kO#HF6=O{qUAy&NzwuaUFOMn4+&6*qm6iVa@!f7; z@8p`?(q{)LcO8e&5&vsjM5a#r z)>kU^%kTU7TG*KW)OTF`Zue^K=NgjaHMh__>|5V(sn(yM{EzGF69aeA^KQ;IJeQ!@ zT&5pf$D5>kE8*!+8kUPpKZ5ujeqI+pbFR^H$3e7pEq&s(R9xfDH9z%UJGgOtEo~3_ zce9&ziTIw!gh9`%al^K2IY-cKyq5lP&XVuJn!6vMy3#YAUSqDMz0GzE=gBxH6W{Z= zQ}?Sf2heP`b)&yrTaxZOKzaXTRDXQR)wL6Dv=8Sn1=k_-^9Z;GgX{KVV=p?sq%ZtZ z(^v#ss;>#P+txX2v(i+5$-KBmC{E7^YZ-Y;#IAqNVHX{L#i@q`5A{4?W7rrPfCiue zXaE|32A~0G02+V>paEzA8h{3%0cZdkfCiueXaE|32A~0G02+V>paEzA8h{3%0cZdk zfCiueXaE|32A~0G02+V>paEzA8h{3%0cZdkfCidD0~&r{0aySQfCXTIHCW((Q1W>? literal 0 HcmV?d00001 diff --git a/public/images/logo-abb.png b/public/images/logo-abb.png new file mode 100644 index 0000000000000000000000000000000000000000..7690ed248d57866264188c43b32fa8acb7db0d8c GIT binary patch literal 2871 zcmcImc~nzp77qnk63_?=D2Pc}fXM@@h&#}G7txTBSRqOwyJNfU5;}t5D1-GK05}A z2??fgMJdhzPs9P8(^JGS8iAmDrHcV>G6-Qf;0C^sfg5RP!eRJ41}>T$LJSf6f{FaV zOeq+V8Or8nCUf0+I4@5mJ)H&r|xB&HDvX=!QBX|B#9=>~#}ySqDqNFtC(co>0~We6c49WRtw!wg7_hJy*pxKh3t z;){eBH7CFk$sq;~hs4ZKdqa?v&zWTx%A5hsh+OUB3EGf}-Q42C|9r+M>a zYIAy#2vDLirY!+qvyvE)%0PC87-ZnWL77M{<$@XpwbKlVuM`9zkmpGvlE`=$BA!U1 z6aF-%UgML4UpmBs;UsQ?8@QZ{cL7{Myc>za!&50_5KrZhNdS=o@Dg09vqaM_U()z< zU=}ioOrnt8UEExjyOXKJSqIJJmw2{F&P`N@;`wQVpT;y;IzgRX0e?Cv8e=9av&7RW zn+ASXmjAp|Jnn3n#B!-XBLNuEO9kE`Jfqj5nR|8S(!Ri1;%(s|BYyRcfih6L1u+Gf}`6&07v7 zilm-FU@9oYMDqm#J|Lv4asQryb*{!)O|Xv9K)w#I8s2!WB8~? z{J_<0S2qjpXvWHr0FQ(mH;;g!fXqHjoBsy?}mYs!YyWxoNkFg=n_~= zZ+3dca7C#VgTUS6|AlQW)rF-?FzizxrLZ z&7o2~Yff${Sl9e|i%!WRJ=#@pIS*Z+$iN4q_66z$x4ySqeBJ3zvfXcF6mV{$jhd%y zz*P4oZa4pK>9Y8Bcdqeniw=b{@d0Sv3WUru_h{}-EK7LE0W;s zPP3OQIKaa+*nW zdowG89(jr@0j(SYPMkKdt?J|+X4DQm&$l$z8b1u!*yW=43%H=~T!NiSkvaM8xgZv5 zG?22pOht>cr@q$Q_9J0AV8*@I~qA@xZpK&3Zipk*DXnuvPGmHvVC z9H6DxFsfCaR75r2nX9yo%(&E3;osSocGX!o8nvz3ltP}z;fMSncPQy!gH2hj9XnXH zdbsSxv6wgdasG+i+=Zy6=c-N<6Y4_q%xmY9Y~wir$;Ra!E0YT^ zE{xXa7cK64xX&j{vdN5G%-24)CAZ4u_eDgW;R2fvc}^#9k6vx$*QWA{e)J+7v_AGI z>)O`Zn&R3D_|jYJz90Y;|<(l1P-qhal_z_#LxzNVjA|*Z{&LE?DW!vE0tx9SgpiS*Q z%DFkm>vH37Kbr2bz`pS_5~Q$P*Jt0Oh!31IAfU)IKV00F?1xXC9$oyZu6?H z^7E8NW?&Ea7(^KWUPQOUkKf36w zikp*}ded$2R+RSzVTEN_-C&|(!r`7lHS*Z&?_<0wU*z|%dXMb2G_vN7MHBqD99O1o zF!FhItLV*x$c6tbDL4@OLa7y&<&?>av?{WHi268KSh#0LeUR=7mSWZU(FBu5ix6C` zW1skIovkhB$3w&Bt1?%bO15_;O@;ek3v#wx)Pgn(A3pQ){u8I?M8sw--{yT>AR3A| z>`i}lF2eQYYWpXu$2w|8Go zK{NY}{fgkg!wHZ3lg5sApRzDs=e20d)8>*S8-+nePB-xEO{m_j!wnY{ z|3H?m4}X59uBIewn0o&xXVdZ~j|*wq^RYK6gNmi^-JIfIjcBR7%^yvGuR17EcgmYa z&kk)_TInp31T;&q@S%O0J0g#}ZTl~3w7;9KqovsxuVU&MTsrJf_sLR^{%YlsFs&Pa zY6M+>JZR#v$m_PblZ4$aMV=U2^|3pyK@wwFVo(YUoL;Q*c{^t8*~GqhSX&&{{=VFh zjsCW$>tWG{vXe_%sCG|ouTkBzIbxKRQGYf-?~xK6sXAR%Sff0(vGE!HAinIj_=(y1 zNb}ZtL7SqQD}UZj{hBASz1xB^b0wMKdiakNNSAybWryLr68%;Jqh|pqm^St|(6)SocBBoGTPk(~U T--IQqe{ETQq0CyJ_$_|`C0=Yh literal 0 HcmV?d00001 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..3d69165 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/t_pessoa/fisica/TPessoaFisicaTable'; +import TPessoaForm from '@/packages/administrativo/components/t_pessoa/fisica/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/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..00e6713 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/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/t_pessoa/juridica/TPessoaJuridicaTable'; +import { useTPessoaJuridicaIndexHook } from '@/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaIndexHook'; +import TPessoaJuridicaForm from '@/packages/administrativo/components/t_pessoa/juridica/TPessoaJuridicaForm'; export default function TPessoaFisica() { // Controle de estado do botão 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/components/app-sidebar.tsx b/src/components/app-sidebar.tsx index 8831b8a..97134b7 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: '#', @@ -144,14 +161,6 @@ const data = { title: 'Censec/Centrais', 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 +235,6 @@ const data = { export function AppSidebar({ ...props }: React.ComponentProps) { const { userAuthenticated } = useGUsuarioGetJWTHook(); - return ( @@ -236,28 +244,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/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaForm.tsx b/src/packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaForm.tsx similarity index 98% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaForm.tsx rename to src/packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaForm.tsx index 8855a6e..6575600 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaForm.tsx +++ b/src/packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaForm.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/TPessoaFisicaSchema'; import LoadingButton from '@/app/_components/loadingButton/LoadingButton'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { @@ -37,10 +37,10 @@ import { } 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, diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaTable.tsx b/src/packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaTable.tsx similarity index 98% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaTable.tsx rename to src/packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaTable.tsx index 8de3217..fbe1b6d 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/TPessoaTable.tsx +++ b/src/packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaTable.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/TPessoaInterface'; import { FormatCPF } from '@/actions/CPF/FormatCPF'; import { FormatPhone } from '@/actions/phone/FormatPhone'; import { FormatDateTime } from '@/actions/dateTime/FormatDateTime'; diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/juridica/TPessoaJuridicaForm.tsx b/src/packages/administrativo/components/t_pessoa/juridica/TPessoaJuridicaForm.tsx similarity index 98% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/juridica/TPessoaJuridicaForm.tsx rename to src/packages/administrativo/components/t_pessoa/juridica/TPessoaJuridicaForm.tsx index ce2f5ff..c3a4d77 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/juridica/TPessoaJuridicaForm.tsx +++ b/src/packages/administrativo/components/t_pessoa/juridica/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/TPessoaFisicaSchema'; 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/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/juridica/TPessoaJuridicaTable.tsx b/src/packages/administrativo/components/t_pessoa/juridica/TPessoaJuridicaTable.tsx similarity index 98% rename from src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/juridica/TPessoaJuridicaTable.tsx rename to src/packages/administrativo/components/t_pessoa/juridica/TPessoaJuridicaTable.tsx index dca276c..9996da6 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_pessoa/juridica/TPessoaJuridicaTable.tsx +++ b/src/packages/administrativo/components/t_pessoa/juridica/TPessoaJuridicaTable.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/TPessoaInterface'; import { FormatCPF } from '@/actions/CPF/FormatCPF'; import { FormatPhone } from '@/actions/phone/FormatPhone'; import { FormatDateTime } from '@/actions/dateTime/FormatDateTime'; 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 93% 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..253ebaa 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/TPessoaFisicaSchema'; 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 '../t_pessoa/fisica/TPessoaFisicaTable'; +import TPessoaInterface from '../../interfaces/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 90% 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..4f078c2 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 '../t_pessoa/fisica/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/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..655a6d8 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/TPessoaInterface'; import { FormatCPF } from '@/actions/CPF/FormatCPF'; import { FormatPhone } from '@/actions/phone/FormatPhone'; import empty from '@/actions/validations/empty'; 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/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/juridica/useTPessoaJuridicaDeleteHook.ts b/src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaDeleteHook.ts similarity index 61% 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..fdbb302 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/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 70% 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..634db61 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/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..852c89e 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/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 62% 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..3958370 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/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 74% rename from src/app/(protected)/(cadastros)/cadastros/_hooks/t_pessoa/useTPessoaIndexHook.ts rename to src/packages/administrativo/hooks/t_pessoa/useTPessoaIndexHook.ts index a12ccb6..d5ab376 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/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..87b03ee 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/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 62% 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..3958370 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/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 67% 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..abd014b 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/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..87b03ee 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/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/_interfaces/TPessoaInterface.ts b/src/packages/administrativo/interfaces/TPessoaInterface.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_interfaces/TPessoaInterface.ts rename to src/packages/administrativo/interfaces/TPessoaInterface.ts diff --git a/src/app/(protected)/(cadastros)/cadastros/_interfaces/TPessoaJuridicaInterface.ts b/src/packages/administrativo/interfaces/TPessoaJuridicaInterface.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_interfaces/TPessoaJuridicaInterface.ts rename to src/packages/administrativo/interfaces/TPessoaJuridicaInterface.ts diff --git a/src/app/(protected)/(cadastros)/cadastros/_interfaces/TPessoaRepresentante.ts b/src/packages/administrativo/interfaces/TPessoaRepresentante.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_interfaces/TPessoaRepresentante.ts rename to src/packages/administrativo/interfaces/TPessoaRepresentante.ts diff --git a/src/app/(protected)/(cadastros)/cadastros/_schemas/TPessoaSchema.ts b/src/packages/administrativo/schemas/TPessoaFisicaSchema.ts similarity index 100% rename from src/app/(protected)/(cadastros)/cadastros/_schemas/TPessoaSchema.ts rename to src/packages/administrativo/schemas/TPessoaFisicaSchema.ts 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/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(); From f5ffe5739ca470e94f9c9217a3290c8595458870 Mon Sep 17 00:00:00 2001 From: keven Date: Fri, 3 Oct 2025 10:35:43 -0300 Subject: [PATCH 5/5] =?UTF-8?q?[MVPTN-99]=20refactor(Arquitetura):=20Refat?= =?UTF-8?q?ora=C3=A7=C3=A3o=20da=20arquitetura=C3=A7=C3=A3o=20do=20Tpessoa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../administrativo/pessoas/fisicas/page.tsx | 6 +- .../administrativo/pessoas/juridicas/page.tsx | 6 +- .../TPessoaFisica/TPessoaFisicaColumns.tsx} | 67 ++---- .../TPessoaFisica}/TPessoaFisicaForm.tsx | 72 +++--- .../TPessoaFisica/TPessoaFisicaTable.tsx | 22 ++ .../TPessoaJuridicaColumns.tsx | 159 ++++++++++++++ .../TPessoaJuridica}/TPessoaJuridicaForm.tsx | 2 +- .../TPessoaJuridica/TPessoaJuridicaTable.tsx | 27 +++ .../juridica/TPessoaJuridicaTable.tsx | 205 ------------------ .../TPessoaRepresentanteForm.tsx | 6 +- .../TPessoaRepresentantePage.tsx | 4 +- .../TPessoaRepresentanteTable.tsx | 2 +- .../t_pessoa/fisica/usetTPessoaFormHook.ts | 16 ++ .../juridica/useTPessoaJuridicaDeleteHook.ts | 2 +- .../juridica/useTPessoaJuridicaIndexHook.ts | 2 +- .../juridica/useTPessoaJuridicaSaveHook.ts | 2 +- .../hooks/t_pessoa/useTPessoaDeleteHook.ts | 2 +- .../hooks/t_pessoa/useTPessoaIndexHook.ts | 2 +- .../hooks/t_pessoa/useTPessoaSaveHook.ts | 2 +- .../useTPessoaDeleteHook.ts | 2 +- .../useTPessoaRepresentanteIndexHook.ts | 2 +- .../useTPessoaSaveHook.ts | 2 +- .../TPessoaFisicaFormInterface.ts | 9 + .../TPessoaFisica/TPessoaFisicaInterface.ts | 33 +++ .../TPessoaFisicaTableInterface.ts | 7 + .../interfaces/TPessoa/TPessoaInterface.ts | 32 +++ .../TPessoaJuridicaFormInterface.ts | 9 + .../TPessoaJuridicaInterface.ts | 12 + .../TPessoaJuridicaTableInterface.ts | 7 + .../interfaces/TPessoaInterface.ts | 63 ------ .../interfaces/TPessoaJuridicaInterface.ts | 63 ------ .../interfaces/TPessoaRepresentante.ts | 5 - .../schemas/TPessoa/TPessoaFisicaSchema.ts | 36 +++ .../schemas/TPessoa/TPessoaJuridicaSchema.ts | 15 ++ .../schemas/TPessoa/TPessoaSchema.ts | 33 +++ .../schemas/TPessoaFisicaSchema.ts | 64 ------ 36 files changed, 481 insertions(+), 519 deletions(-) rename src/packages/administrativo/components/{t_pessoa/fisica/TPessoaFisicaTable.tsx => TPessoa/TPessoaFisica/TPessoaFisicaColumns.tsx} (76%) rename src/packages/administrativo/components/{t_pessoa/fisica => TPessoa/TPessoaFisica}/TPessoaFisicaForm.tsx (95%) create mode 100644 src/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaTable.tsx create mode 100644 src/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaColumns.tsx rename src/packages/administrativo/components/{t_pessoa/juridica => TPessoa/TPessoaJuridica}/TPessoaJuridicaForm.tsx (99%) create mode 100644 src/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaTable.tsx delete mode 100644 src/packages/administrativo/components/t_pessoa/juridica/TPessoaJuridicaTable.tsx create mode 100644 src/packages/administrativo/hooks/t_pessoa/fisica/usetTPessoaFormHook.ts create mode 100644 src/packages/administrativo/interfaces/TPessoa/TPessoaFisica/TPessoaFisicaFormInterface.ts create mode 100644 src/packages/administrativo/interfaces/TPessoa/TPessoaFisica/TPessoaFisicaInterface.ts create mode 100644 src/packages/administrativo/interfaces/TPessoa/TPessoaFisica/TPessoaFisicaTableInterface.ts create mode 100644 src/packages/administrativo/interfaces/TPessoa/TPessoaInterface.ts create mode 100644 src/packages/administrativo/interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaFormInterface.ts create mode 100644 src/packages/administrativo/interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaInterface.ts create mode 100644 src/packages/administrativo/interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaTableInterface.ts delete mode 100644 src/packages/administrativo/interfaces/TPessoaInterface.ts delete mode 100644 src/packages/administrativo/interfaces/TPessoaJuridicaInterface.ts delete mode 100644 src/packages/administrativo/interfaces/TPessoaRepresentante.ts create mode 100644 src/packages/administrativo/schemas/TPessoa/TPessoaFisicaSchema.ts create mode 100644 src/packages/administrativo/schemas/TPessoa/TPessoaJuridicaSchema.ts create mode 100644 src/packages/administrativo/schemas/TPessoa/TPessoaSchema.ts delete mode 100644 src/packages/administrativo/schemas/TPessoaFisicaSchema.ts diff --git a/src/app/(protected)/(administrativo)/administrativo/pessoas/fisicas/page.tsx b/src/app/(protected)/(administrativo)/administrativo/pessoas/fisicas/page.tsx index 3d69165..3e44744 100644 --- a/src/app/(protected)/(administrativo)/administrativo/pessoas/fisicas/page.tsx +++ b/src/app/(protected)/(administrativo)/administrativo/pessoas/fisicas/page.tsx @@ -3,8 +3,8 @@ import React, { useEffect, useState, useCallback } from 'react'; import Loading from '@/app/_components/loading/loading'; -import TPessoaTable from '@/packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaTable'; -import TPessoaForm from '@/packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaForm'; +import TPessoaTable from '@/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaTable'; +import TPessoaForm from '@/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaForm'; import { useTPessoaIndexHook } from '@/packages/administrativo/hooks/t_pessoa/useTPessoaIndexHook'; import { useTPessoaSaveHook } from '@/packages/administrativo/hooks/t_pessoa/useTPessoaSaveHook'; @@ -13,7 +13,7 @@ import { useTPessoaDeleteHook } from '@/packages/administrativo/hooks/t_pessoa/u import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog'; import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog'; -import TPessoaInterface from '@/packages/administrativo/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)/(administrativo)/administrativo/pessoas/juridicas/page.tsx b/src/app/(protected)/(administrativo)/administrativo/pessoas/juridicas/page.tsx index 00e6713..f2486f3 100644 --- a/src/app/(protected)/(administrativo)/administrativo/pessoas/juridicas/page.tsx +++ b/src/app/(protected)/(administrativo)/administrativo/pessoas/juridicas/page.tsx @@ -10,11 +10,11 @@ import { useTPessoaDeleteHook } from '@/packages/administrativo/hooks/t_pessoa/u import ConfirmDialog from '@/app/_components/confirm_dialog/ConfirmDialog'; import { useConfirmDialog } from '@/app/_components/confirm_dialog/useConfirmDialog'; -import TPessoaInterface from '@/packages/administrativo/interfaces/TPessoaInterface'; +import TPessoaInterface from '@/packages/administrativo/interfaces/TPessoa/TPessoaInterface'; import Header from '@/app/_components/structure/Header'; -import TPessoaJuridicaTable from '@/packages/administrativo/components/t_pessoa/juridica/TPessoaJuridicaTable'; +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/t_pessoa/juridica/TPessoaJuridicaForm'; +import TPessoaJuridicaForm from '@/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaForm'; export default function TPessoaFisica() { // Controle de estado do botão diff --git a/src/packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaTable.tsx b/src/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaColumns.tsx similarity index 76% rename from src/packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaTable.tsx rename to src/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaColumns.tsx index fbe1b6d..120b85c 100644 --- a/src/packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaTable.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/packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaForm.tsx b/src/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaForm.tsx similarity index 95% rename from src/packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaForm.tsx rename to src/packages/administrativo/components/TPessoa/TPessoaFisica/TPessoaFisicaForm.tsx index 6575600..3af6e23 100644 --- a/src/packages/administrativo/components/t_pessoa/fisica/TPessoaFisicaForm.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/TPessoaFisicaSchema'; import LoadingButton from '@/app/_components/loadingButton/LoadingButton'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { @@ -33,7 +29,6 @@ import { SelectContent, SelectItem, SelectTrigger, - SelectValue, } from '@/components/ui/select'; import { CheckIcon, ChevronsUpDownIcon, HouseIcon, IdCardIcon, UserIcon } from 'lucide-react'; import { Sexo } from '@/enums/SexoEnum'; @@ -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,8 +89,12 @@ export default function TCensecForm({ > - Pessoa - Preencha os dados da pessoa + + Pessoa Física + + + Preencha os dados da pessoa +
@@ -310,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'} @@ -376,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'} @@ -444,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'} @@ -800,7 +785,6 @@ export default function TCensecForm({ )} />
- {/* Validade */}
- {/* Rodapé do Dialog */} @@ -840,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/packages/administrativo/components/t_pessoa/juridica/TPessoaJuridicaForm.tsx b/src/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaForm.tsx similarity index 99% rename from src/packages/administrativo/components/t_pessoa/juridica/TPessoaJuridicaForm.tsx rename to src/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaForm.tsx index c3a4d77..8db35d4 100644 --- a/src/packages/administrativo/components/t_pessoa/juridica/TPessoaJuridicaForm.tsx +++ b/src/packages/administrativo/components/TPessoa/TPessoaJuridica/TPessoaJuridicaForm.tsx @@ -25,7 +25,7 @@ import { } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; -import { TPessoaSchema } from '../../../schemas/TPessoaFisicaSchema'; +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'; 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_pessoa/juridica/TPessoaJuridicaTable.tsx b/src/packages/administrativo/components/t_pessoa/juridica/TPessoaJuridicaTable.tsx deleted file mode 100644 index 9996da6..0000000 --- a/src/packages/administrativo/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/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentanteForm.tsx b/src/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentanteForm.tsx index 253ebaa..7de7356 100644 --- a/src/packages/administrativo/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/TPessoaFisicaSchema'; +import { TPessoaSchema } from '../../schemas/TPessoa/TPessoaSchema'; import LoadingButton from '@/app/_components/loadingButton/LoadingButton'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { @@ -62,8 +62,8 @@ import { } from '@/components/ui/command'; import { cn } from '@/lib/utils'; import { useTPessoaIndexHook } from '../../hooks/t_pessoa/useTPessoaIndexHook'; -import TPessoaTable from '../t_pessoa/fisica/TPessoaFisicaTable'; -import TPessoaInterface from '../../interfaces/TPessoaInterface'; +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/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentantePage.tsx b/src/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentantePage.tsx index 4f078c2..5d8a5d7 100644 --- a/src/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentantePage.tsx +++ b/src/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentantePage.tsx @@ -3,7 +3,7 @@ import React, { useEffect, useState, useCallback } from 'react'; import Loading from '@/app/_components/loading/loading'; -import TPessoaForm from '../t_pessoa/fisica/TPessoaFisicaForm'; +import TPessoaForm from '../TPessoa/TPessoaFisica/TPessoaFisicaForm'; import { useTPessoaIndexHook } from '../../hooks/t_pessoa/useTPessoaIndexHook'; import { useTPessoaSaveHook } from '../../hooks/t_pessoa/useTPessoaSaveHook'; @@ -12,7 +12,7 @@ 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 { Button } from '@/components/ui/button'; diff --git a/src/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentanteTable.tsx b/src/packages/administrativo/components/t_pessoa_representante/TPessoaRepresentanteTable.tsx index 655a6d8..dd7efe3 100644 --- a/src/packages/administrativo/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/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/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaDeleteHook.ts b/src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaDeleteHook.ts index fdbb302..89f74df 100644 --- a/src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaDeleteHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaDeleteHook.ts @@ -1,5 +1,5 @@ import { useResponse } from '@/app/_response/ResponseContext'; -import TPessoaJuridicaInterface from '../../../interfaces/TPessoaJuridicaInterface'; +import TPessoaJuridicaInterface from '../../../interfaces/TPessoa/TPessoaJuridica/TPessoaJuridicaInterface'; import { TCensecDeleteService } from '../../../../../app/(protected)/(cadastros)/cadastros/_services/t_censec/TCensecDeleteService'; export const useTPessoaJuridicaDeleteHook = () => { diff --git a/src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaIndexHook.ts b/src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaIndexHook.ts index 634db61..ecb0720 100644 --- a/src/packages/administrativo/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 { 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/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaSaveHook.ts b/src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaSaveHook.ts index 852c89e..c5f1ff3 100644 --- a/src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaSaveHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa/juridica/useTPessoaJuridicaSaveHook.ts @@ -2,7 +2,7 @@ import { useResponse } from '@/app/_response/ResponseContext'; import { useState } from 'react'; -import TPessoaInterface from '../../../interfaces/TPessoaInterface'; +import TPessoaInterface from '../../../interfaces/TPessoa/TPessoaInterface'; import { TCensecSaveService } from '../../../../../app/(protected)/(cadastros)/cadastros/_services/t_censec/TCensecSaveService'; export const useTPessoaJuridicaSaveHook = () => { diff --git a/src/packages/administrativo/hooks/t_pessoa/useTPessoaDeleteHook.ts b/src/packages/administrativo/hooks/t_pessoa/useTPessoaDeleteHook.ts index 3958370..8764a52 100644 --- a/src/packages/administrativo/hooks/t_pessoa/useTPessoaDeleteHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa/useTPessoaDeleteHook.ts @@ -1,5 +1,5 @@ import { useResponse } from '@/app/_response/ResponseContext'; -import TPessoaInterface from '../../interfaces/TPessoaInterface'; +import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface'; import { TCensecDeleteService } from '../../../../app/(protected)/(cadastros)/cadastros/_services/t_censec/TCensecDeleteService'; export const useTPessoaDeleteHook = () => { diff --git a/src/packages/administrativo/hooks/t_pessoa/useTPessoaIndexHook.ts b/src/packages/administrativo/hooks/t_pessoa/useTPessoaIndexHook.ts index d5ab376..e1fc3a2 100644 --- a/src/packages/administrativo/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 { useState } from 'react'; -import TPessoaInterface from '../../interfaces/TPessoaInterface'; +import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface'; export const useTPessoaIndexHook = () => { const { setResponse } = useResponse(); diff --git a/src/packages/administrativo/hooks/t_pessoa/useTPessoaSaveHook.ts b/src/packages/administrativo/hooks/t_pessoa/useTPessoaSaveHook.ts index 87b03ee..c349302 100644 --- a/src/packages/administrativo/hooks/t_pessoa/useTPessoaSaveHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa/useTPessoaSaveHook.ts @@ -2,7 +2,7 @@ import { useResponse } from '@/app/_response/ResponseContext'; import { useState } from 'react'; -import TPessoaInterface from '../../interfaces/TPessoaInterface'; +import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface'; import { TCensecSaveService } from '../../../../app/(protected)/(cadastros)/cadastros/_services/t_censec/TCensecSaveService'; export const useTPessoaSaveHook = () => { diff --git a/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaDeleteHook.ts b/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaDeleteHook.ts index 3958370..8764a52 100644 --- a/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaDeleteHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaDeleteHook.ts @@ -1,5 +1,5 @@ import { useResponse } from '@/app/_response/ResponseContext'; -import TPessoaInterface from '../../interfaces/TPessoaInterface'; +import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface'; import { TCensecDeleteService } from '../../../../app/(protected)/(cadastros)/cadastros/_services/t_censec/TCensecDeleteService'; export const useTPessoaDeleteHook = () => { diff --git a/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaRepresentanteIndexHook.ts b/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaRepresentanteIndexHook.ts index abd014b..f163fa9 100644 --- a/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaRepresentanteIndexHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaRepresentanteIndexHook.ts @@ -1,7 +1,7 @@ import { useResponse } from '@/app/_response/ResponseContext'; import { TPessoaIndexService } from '../../services/t_pessoa/TPessoaIndexService'; import { useState } from 'react'; -import TPessoaInterface from '../../interfaces/TPessoaInterface'; +import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface'; import { TPessoaRepresentanteIndexData } from '../../data/TPessoaRepresentante/TPessoaRepresentanteIndexData'; export const useTPessoaRepresentanteIndexHook = () => { diff --git a/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaSaveHook.ts b/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaSaveHook.ts index 87b03ee..c349302 100644 --- a/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaSaveHook.ts +++ b/src/packages/administrativo/hooks/t_pessoa_representante/useTPessoaSaveHook.ts @@ -2,7 +2,7 @@ import { useResponse } from '@/app/_response/ResponseContext'; import { useState } from 'react'; -import TPessoaInterface from '../../interfaces/TPessoaInterface'; +import TPessoaInterface from '../../interfaces/TPessoa/TPessoaInterface'; import { TCensecSaveService } from '../../../../app/(protected)/(cadastros)/cadastros/_services/t_censec/TCensecSaveService'; export const useTPessoaSaveHook = () => { 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/interfaces/TPessoaInterface.ts b/src/packages/administrativo/interfaces/TPessoaInterface.ts deleted file mode 100644 index f7e7711..0000000 --- a/src/packages/administrativo/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/packages/administrativo/interfaces/TPessoaJuridicaInterface.ts b/src/packages/administrativo/interfaces/TPessoaJuridicaInterface.ts deleted file mode 100644 index ba2c551..0000000 --- a/src/packages/administrativo/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/packages/administrativo/interfaces/TPessoaRepresentante.ts b/src/packages/administrativo/interfaces/TPessoaRepresentante.ts deleted file mode 100644 index 62eda11..0000000 --- a/src/packages/administrativo/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/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/packages/administrativo/schemas/TPessoaFisicaSchema.ts b/src/packages/administrativo/schemas/TPessoaFisicaSchema.ts deleted file mode 100644 index b5d0ba7..0000000 --- a/src/packages/administrativo/schemas/TPessoaFisicaSchema.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(), -});