From 5fb23a829b9e8ce6e47a3c09c6027ec2e85e485d Mon Sep 17 00:00:00 2001 From: DaviMoreira27 Date: Sat, 21 Nov 2026 14:39:29 -0300 Subject: [PATCH 1/6] =?UTF-8?q?feat(estabelecimento):=20adiciona=20a=20p?= =?UTF-8?q?=C3=A1gina=20meu=20estabelecimento=20do=20parceiro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/rotas.test.tsx | 1 + src/app/rotas.tsx | 7 + .../EstabelecimentoFormulario.tsx | 89 ++++---- .../estabelecimentos/estabelecimentos.ts | 17 +- .../MeuEstabelecimentoCard.module.css | 48 ++++ .../MeuEstabelecimentoCard.tsx | 207 ++++++++++++++++++ .../MeuEstabelecimentoPage.module.css | 5 + .../MeuEstabelecimentoPage.test.tsx | 138 ++++++++++++ .../MeuEstabelecimentoPage.tsx | 74 +++++++ src/features/estabelecimento/chaves.ts | 1 + 10 files changed, 541 insertions(+), 46 deletions(-) create mode 100644 src/features/estabelecimento/MeuEstabelecimentoCard.module.css create mode 100644 src/features/estabelecimento/MeuEstabelecimentoCard.tsx create mode 100644 src/features/estabelecimento/MeuEstabelecimentoPage.module.css create mode 100644 src/features/estabelecimento/MeuEstabelecimentoPage.test.tsx create mode 100644 src/features/estabelecimento/MeuEstabelecimentoPage.tsx create mode 100644 src/features/estabelecimento/chaves.ts diff --git a/src/app/rotas.test.tsx b/src/app/rotas.test.tsx index 0f8ad75..9afc0fa 100644 --- a/src/app/rotas.test.tsx +++ b/src/app/rotas.test.tsx @@ -204,6 +204,7 @@ const ROTAS_DAS_PESQUISAS: { caminho: string; titulo: string | RegExp; perfis: P titulo: 'Prévia e publicação', perfis: ['ADMIN'], }, + { caminho: '/meu-estabelecimento', titulo: 'Meu estabelecimento', perfis: ['PARCEIRO'] }, { caminho: '/resultados/21', titulo: 'Consolidada de setembro de 2026', diff --git a/src/app/rotas.tsx b/src/app/rotas.tsx index 0763894..3409142 100644 --- a/src/app/rotas.tsx +++ b/src/app/rotas.tsx @@ -138,6 +138,13 @@ export const rotas: RouteObject[] = [ .ResponderPesquisaPage, }), }, + { + path: '/meu-estabelecimento', + lazy: async () => ({ + Component: (await import('@/features/estabelecimento/MeuEstabelecimentoPage')) + .MeuEstabelecimentoPage, + }), + }, ], }, ], diff --git a/src/features/cadastros/estabelecimentos/EstabelecimentoFormulario.tsx b/src/features/cadastros/estabelecimentos/EstabelecimentoFormulario.tsx index 1362cef..0b68129 100644 --- a/src/features/cadastros/estabelecimentos/EstabelecimentoFormulario.tsx +++ b/src/features/cadastros/estabelecimentos/EstabelecimentoFormulario.tsx @@ -19,7 +19,9 @@ import { type EstabelecimentoFormularioProps = { estabelecimento?: Esquemas['EstabelecimentoResponse'] - tipos: Esquemas['TipoRef'][] + tipos?: Esquemas['TipoRef'][] + /** PARCEIRO: sem o bloco da Secretaria */ + somenteDados?: boolean hoje: string enviando: boolean falha: FalhaDaApi | null @@ -29,7 +31,8 @@ type EstabelecimentoFormularioProps = { export function EstabelecimentoFormulario({ estabelecimento, - tipos, + tipos = [], + somenteDados = false, hoje, enviando, falha, @@ -39,7 +42,7 @@ export function EstabelecimentoFormulario({ const [form, setForm] = useState(() => formDoEstabelecimento(estabelecimento, hoje)) const [tentouEnviar, setTentouEnviar] = useState(false) const novo = estabelecimento === undefined - const erros = errosVisiveis(errosDoEstabelecimento(form, novo), tentouEnviar, falha) + const erros = errosVisiveis(errosDoEstabelecimento(form, novo, somenteDados), tentouEnviar, falha) const mudar = (nome: string, valor: string | boolean) => setForm((atual) => ({ ...atual, [nome]: valor })) @@ -67,7 +70,7 @@ export function EstabelecimentoFormulario({ function enviar() { setTentouEnviar(true) - if (Object.keys(errosDoEstabelecimento(form, novo)).length === 0) aoEnviar(form) + if (Object.keys(errosDoEstabelecimento(form, novo, somenteDados)).length === 0) aoEnviar(form) } const { cadastrais, endereco, contato, cadastur, funcionamento } = GRUPOS_DADOS @@ -120,48 +123,50 @@ export function EstabelecimentoFormulario({ -
- Dados da Secretaria -

- Só a equipe do OTO vê e altera. Estabelecimento irregular fica fora das pesquisas e dos - cálculos. -

-
-
+ {!somenteDados && ( +
+ Dados da Secretaria +

+ Só a equipe do OTO vê e altera. Estabelecimento irregular fica fora das pesquisas e dos + cálculos. +

+
+
+ ({ valor: codigo, rotulo: nome })), - ]} - aoMudar={(valor) => mudar('secretaria.tipoHospedagemCodigo', valor)} - required - aria-invalid={erros['secretaria.tipoHospedagemCodigo'] ? true : undefined} - aria-describedby={ - erros['secretaria.tipoHospedagemCodigo'] ? 'erro-tipo-hospedagem' : undefined - } + valor={String(form['secretaria.situacao'])} + opcoes={SITUACOES} + aoMudar={(valor) => mudar('secretaria.situacao', valor)} /> - {erros['secretaria.tipoHospedagemCodigo'] && ( -

- {erros['secretaria.tipoHospedagemCodigo']} -

- )} + {CAMPOS_SECRETARIA.map(campo)} +
+ {marcacao('secretaria.aceitaPesquisas', 'Aceita participar das pesquisas')} +
-