diff --git a/frontend/types.ts b/frontend/types.ts index 0f5c204..98debbf 100644 --- a/frontend/types.ts +++ b/frontend/types.ts @@ -242,6 +242,8 @@ export interface Procedimento { codigoInterno?: string; descricao?: string; descricao_mobile?: string; + num_faces?: number; + num_raizes?: number; especialidadeId: string; especialidadeNome: string; valorParticular: number; diff --git a/frontend/views/AdminViews.tsx b/frontend/views/AdminViews.tsx index 1d9e050..4471f01 100644 --- a/frontend/views/AdminViews.tsx +++ b/frontend/views/AdminViews.tsx @@ -463,6 +463,8 @@ export const ProcedimentosView: React.FC = () => { valorParticular: parseFloat(data.valorParticular), tipo_regiao: editingProcedimento?.tipo_regiao || 'GERAL', exige_face: editingProcedimento?.tipo_regiao === 'DENTE' ? !!editingProcedimento?.exige_face : false, + num_faces: editingProcedimento?.num_faces || undefined, + num_raizes: editingProcedimento?.num_raizes || undefined, valoresPlanos: planValues.map(pv => ({ planoId: pv.planoId!, planoNome: planos?.find(p => p.id === pv.planoId)?.nome || '', @@ -523,6 +525,12 @@ export const ProcedimentosView: React.FC = () => { } }; + const normEsp = (s: string) => s.normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase(); + const procEspNome = normEsp(especialidades?.find(e => e.id === editingProcedimento?.especialidadeId)?.nome || ''); + const isDentistica = procEspNome.includes('dentistic'); + const isEndodontia = procEspNome.includes('endodont'); + const hideArco = isDentistica || isEndodontia; + return ( { setEditingProcedimento({}); setIsModalOpen(true); }}>
@@ -654,7 +662,24 @@ export const ProcedimentosView: React.FC = () => {
- { + const espId = e.target.value; + const espNorm = normEsp(especialidades?.find(es => es.id === espId)?.nome || ''); + const willHide = espNorm.includes('dentistic') || espNorm.includes('endodont'); + setEditingProcedimento(prev => ({ + ...prev, + especialidadeId: espId, + tipo_regiao: (willHide && prev?.tipo_regiao === 'ARCO') ? 'DENTE' : prev?.tipo_regiao, + num_faces: undefined, + num_raizes: undefined, + })); + }} + className="w-full border border-gray-300 rounded-lg p-2 bg-white uppercase-select" + required + > {especialidades?.map(e => )} @@ -672,11 +697,11 @@ export const ProcedimentosView: React.FC = () => {
-
+
{[ { id: 'GERAL', label: 'PROCED. GERAL', desc: 'SEM ODONTOGRAMA' }, { id: 'DENTE', label: 'DENTE ESPECÍFICO', desc: 'LIBERA NÚMEROS' }, - { id: 'ARCO', label: 'ARCO COMPLETO', desc: 'LIBERA AI / AS' } + ...(!hideArco ? [{ id: 'ARCO', label: 'ARCO COMPLETO', desc: 'LIBERA AI / AS' }] : []) ].map((opt) => (
)} + + {isDentistica && ( +
+ + +
+ )} + + {isEndodontia && ( +
+ + +
+ )}