From 66f285ba741e660e69a2dd4d4f60710d070a3e8d Mon Sep 17 00:00:00 2001 From: = <=> Date: Fri, 3 Oct 2025 13:48:49 -0300 Subject: [PATCH] =?UTF-8?q?[MVPTN-90]=20refactor(Corre=C3=A7=C3=A3o):=20co?= =?UTF-8?q?rrigindo=20observa=C3=A7=C3=B5es=20passadas=20relacionadas=20a?= =?UTF-8?q?=20utilizar=20Enum=20de=20situa=C3=A7=C3=B5es,=20retirar=20tryc?= =?UTF-8?q?atch,=20arrumando=20coluna=20de=20situa=C3=A7=C3=A3o=20com=20ba?= =?UTF-8?q?dges?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 11 ++ package.json | 1 + .../reconhecimentos/page.tsx | 40 ++++-- .../t_censec_tipoato/TCensecTipoAtoForm.tsx | 18 +-- .../t_censec_tipoato/TCensecTipoAtoTable.tsx | 29 +++- .../_schemas/TCensecTipoAtoSchema.ts | 7 +- .../TCensecTipoAtoIndexService.ts | 5 - .../TCensecTipoAtoSaveService.ts | 2 - .../confirm_exclusion/ConfirmExclusion.tsx | 124 ++++++++++++++++++ .../confirm_exclusion/useConfirmExclusion.ts | 51 +++++++ src/components/ui/input-otp.tsx | 77 +++++++++++ 11 files changed, 331 insertions(+), 34 deletions(-) create mode 100644 src/app/_components/confirm_exclusion/ConfirmExclusion.tsx create mode 100644 src/app/_components/confirm_exclusion/useConfirmExclusion.ts create mode 100644 src/components/ui/input-otp.tsx diff --git a/package-lock.json b/package-lock.json index 4c0e5d9..71e2140 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "clsx": "^2.1.1", "cookies-next": "^6.1.0", "faker-js": "^1.0.0", + "input-otp": "^1.4.2", "js-cookie": "^3.0.5", "jsonwebtoken": "^9.0.2", "jwt-decode": "^4.0.0", @@ -2238,6 +2239,16 @@ "dev": true, "license": "ISC" }, + "node_modules/input-otp": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/input-otp/-/input-otp-1.4.2.tgz", + "integrity": "sha512-l3jWwYNvrEa6NTCt7BECfCm48GvwuZzkoeG3gBL2w4CHeOXW3eKFmf9UNYkNfYc3mxMrthMnxjIE07MT0zLBQA==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0.0 || ^19.0.0-rc" + } + }, "node_modules/is-arrayish": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", diff --git a/package.json b/package.json index 45ac7a4..1e5130e 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "clsx": "^2.1.1", "cookies-next": "^6.1.0", "faker-js": "^1.0.0", + "input-otp": "^1.4.2", "js-cookie": "^3.0.5", "jsonwebtoken": "^9.0.2", "jwt-decode": "^4.0.0", diff --git a/src/app/(protected)/(cadastros)/cadastros/(t_tb_reconhecimentotipo)/reconhecimentos/page.tsx b/src/app/(protected)/(cadastros)/cadastros/(t_tb_reconhecimentotipo)/reconhecimentos/page.tsx index 8501ce9..67fc0c4 100644 --- a/src/app/(protected)/(cadastros)/cadastros/(t_tb_reconhecimentotipo)/reconhecimentos/page.tsx +++ b/src/app/(protected)/(cadastros)/cadastros/(t_tb_reconhecimentotipo)/reconhecimentos/page.tsx @@ -12,8 +12,8 @@ import { useTTBReconhecimentoTipoReadHook } from "../../_hooks/t_tb_reconhecimen import { useTTBReconhecimentoTipoSaveHook } from "../../_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoSaveHook"; import { useTTBReconhecimentoTipoDeleteHook } from "../../_hooks/t_tb_reconhecimentotipo/useTTBReconhecimentoTipoDeleteHook"; -import ConfirmDialog from "@/app/_components/confirm_dialog/ConfirmDialog"; -import { useConfirmDialog } from "@/app/_components/confirm_dialog/useConfirmDialog"; +import ConfirmExclusion from "@/app/_components/confirm_exclusion/ConfirmExclusion"; +import { useConfirmExclusion } from "@/app/_components/confirm_exclusion/useConfirmExclusion"; import TTBReconhecimentoTipoInterface from "../../_interfaces/TTBReconhecimentoTipoInterface"; @@ -32,14 +32,26 @@ export default function TTBAndamentoServico() { const [itemToDelete, setItemToDelete] = useState(null); /** - * Hook do modal de confirmação + * Hook do modal de exclusão com OTP */ const { isOpen: isConfirmOpen, openDialog: openConfirmDialog, handleConfirm, handleCancel, - } = useConfirmDialog(); + code, + isValid, + handleChange, + } = useConfirmExclusion({ + expectedCode: "123456", // 🔑 aqui você define o código esperado + onConfirm: () => { + console.log("Confirmação aceita com código OTP válido"); + }, + onCancel: () => { + console.log("Ação cancelada"); + }, + }); + /** * Abre o formulário no modo de edição ou criação @@ -78,7 +90,7 @@ export default function TTBAndamentoServico() { // Define o item atual para remoção setItemToDelete(item); - // Abre o modal de confirmação + // Abre o modal de exclusão openConfirmDialog(); }, [openConfirmDialog]); @@ -105,6 +117,10 @@ export default function TTBAndamentoServico() { }, [itemToDelete, fetchTTBReconhecimentosTipos, handleCancel]); + const handleResendCode = (async () => { + return alert("Reenviando código de exclusão") + }) + /** * Busca inicial dos dados */ @@ -140,18 +156,20 @@ export default function TTBAndamentoServico() { - {/* Modal de confirmação */} - + {/* Formulário de criação/edição */} ); -} \ No newline at end of file +} diff --git a/src/app/(protected)/(cadastros)/cadastros/_components/t_censec_tipoato/TCensecTipoAtoForm.tsx b/src/app/(protected)/(cadastros)/cadastros/_components/t_censec_tipoato/TCensecTipoAtoForm.tsx index 38e9b3a..ff90105 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_components/t_censec_tipoato/TCensecTipoAtoForm.tsx +++ b/src/app/(protected)/(cadastros)/cadastros/_components/t_censec_tipoato/TCensecTipoAtoForm.tsx @@ -29,6 +29,7 @@ import { Label } from "@/components/ui/label"; import { TCensecTipoAtoSchema } from "../../_schemas/TCensecTipoAtoSchema"; import { TCensecTipoAtoInterface } from "../../_interfaces/TCensecTipoAtoInterface"; import TCensecInterface from "../../_interfaces/TCensecInterface"; +import { SituacoesEnum } from "@/enums/SituacoesEnum"; type FormValues = z.infer; @@ -55,7 +56,7 @@ export default function TCensecTipoAtoForm({ censec_id: 0, codigo: null, descricao: "", - situacao: "A", + situacao: SituacoesEnum.A, tipo_separacao: null, tipo_revogacao: null, }, @@ -105,17 +106,17 @@ export default function TCensecTipoAtoForm({ name="censec_id" render={({ field }) => ( - Censec + Central do Censec