diff --git a/frontend/components/ProfessionalForm.tsx b/frontend/components/ProfessionalForm.tsx index 35f1ca4..b74766d 100644 --- a/frontend/components/ProfessionalForm.tsx +++ b/frontend/components/ProfessionalForm.tsx @@ -261,6 +261,56 @@ export const ProfessionalForm: React.FC = ({
+ {/* Seleção de Função (Movido para o topo) */} +
+

+ Função +

+
+ + {isLoadingFunctions ? ( +

Carregando funções...

+ ) : functionsError ? ( +

+ ❌ Erro ao carregar funções. Verifique se o backend está + rodando. +

+ ) : ( +
+ {functions.map((func) => ( + + ))} +
+ )} +
+
+ {/* Informações Pessoais */}

@@ -275,42 +325,45 @@ export const ProfessionalForm: React.FC = ({ onChange={(e) => handleChange("nome", e.target.value)} /> -
- - { - const value = e.target.value.replace(/\D/g, ""); - let formatted = ""; - if (value.length <= 11) { - // CPF: 000.000.000-00 - formatted = value.replace( - /(\d{3})(\d{3})(\d{3})(\d{0,2})/, - "$1.$2.$3-$4" - ); - } else { - // CNPJ: 00.000.000/0000-00 - formatted = value - .slice(0, 14) - .replace( - /(\d{2})(\d{3})(\d{3})(\d{4})(\d{0,2})/, - "$1.$2.$3/$4-$5" + {/* Conditional CPF Display */} + {(!formData.funcoesIds?.every(id => functions.find(f => f.id === id)?.nome.toLowerCase().includes("pesquisa")) || (formData.funcoesIds?.length === 0)) && ( +
+ + { + const value = e.target.value.replace(/\D/g, ""); + let formatted = ""; + if (value.length <= 11) { + // CPF: 000.000.000-00 + formatted = value.replace( + /(\d{3})(\d{3})(\d{3})(\d{0,2})/, + "$1.$2.$3-$4" ); - } - handleChange("cpfCnpj", formatted); - }} - onBlur={handleCpfBlur} - className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-[#B9CF33] focus:border-transparent" - placeholder="000.000.000-00 ou 00.000.000/0000-00" - /> -

- Informe seu CPF para verificarmos se você já possui cadastro. -

-
+ } else { + // CNPJ: 00.000.000/0000-00 + formatted = value + .slice(0, 14) + .replace( + /(\d{2})(\d{3})(\d{3})(\d{4})(\d{0,2})/, + "$1.$2.$3/$4-$5" + ); + } + handleChange("cpfCnpj", formatted); + }} + onBlur={handleCpfBlur} + className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-[#B9CF33] focus:border-transparent" + placeholder="000.000.000-00 ou 00.000.000/0000-00" + /> +

+ Informe seu CPF para verificarmos se você já possui cadastro. +

+
+ )}
{/* Endereço */} + {(!formData.funcoesIds?.every(id => functions.find(f => f.id === id)?.nome.toLowerCase().includes("pesquisa")) || (formData.funcoesIds?.length === 0)) && (

Endereço @@ -527,6 +537,7 @@ export const ProfessionalForm: React.FC = ({

+ )} {/* Contato */}
@@ -546,145 +557,145 @@ export const ProfessionalForm: React.FC = ({
{/* Dados Bancários */} -
-

- Dados Bancários -

+ {(!formData.funcoesIds?.every(id => functions.find(f => f.id === id)?.nome.toLowerCase().includes("pesquisa")) || (formData.funcoesIds?.length === 0)) && ( + <> +
+

+ Dados Bancários +

-
- {/* CPF moved to personal info */} -
- -
- handleChange("banco", e.target.value)} - /> - { - const value = e.target.value.replace(/\D/g, ""); - handleChange("agencia", value); - }} - /> -
- -
- handleChange("conta", e.target.value)} - /> - handleChange("pix", e.target.value)} - /> -
-
- - {/* Informações Profissionais */} -
-

- Informações Profissionais -

- -
-
- - - handleChange("carroDisponivel", e.target.value) - } - className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-[#B9CF33] focus:border-transparent" - > - - - -
- -
- - { - handleChange("possuiEstudio", e.target.value); - if (e.target.value === "nao") { - handleChange("qtdEstudios", "0"); - } + const value = e.target.value.replace(/\D/g, ""); + handleChange("agencia", value); }} - className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-[#B9CF33] focus:border-transparent" - > - - - + /> +
+ +
+ handleChange("conta", e.target.value)} + /> + handleChange("pix", e.target.value)} + /> +
+
+ + {/* Informações Profissionais - Resources */} +
+

+ Informações Profissionais +

+ +
+
+ + +
+ +
+ + +
+
+ + {formData.possuiEstudio === "sim" && ( + handleChange("qtdEstudios", e.target.value)} + /> + )} + +
+ +