Commit e0a5ec11ddd876c77825d173c99d964026cc4aa6
1 parent
cbb98f99
Exists in
2.8
and in
2 other branches
Validação para não permitir código do INEP começando com número zero
Showing
1 changed file
with
13 additions
and
3 deletions
Show diff stats
ieducar/modules/Cadastro/Assets/Javascripts/Aluno.js
1 | 1 | var url = window.location.href; |
2 | 2 | var modoCadastro = url.indexOf("id=") == -1; |
3 | 3 | |
4 | +const aluno_inep_id = $j("#aluno_inep_id"); | |
5 | + | |
4 | 6 | if (modoCadastro) { |
5 | 7 | $j("[name^=tr_historico_altura_peso]").remove(); |
6 | 8 | } |
... | ... | @@ -153,8 +155,8 @@ function montaUrlLaudoMedico() { |
153 | 155 | } |
154 | 156 | |
155 | 157 | function codigoInepInvalido() { |
156 | - $j('#aluno_inep_id').addClass('error'); | |
157 | - messageUtils.error('O código INEP do aluno deve conter 12 dígitos'); | |
158 | + aluno_inep_id.addClass('error'); | |
159 | + messageUtils.error('O código INEP do aluno deve conter 12 dígitos, não iniciado com 0 (zero).'); | |
158 | 160 | } |
159 | 161 | |
160 | 162 | function certidaoNascimentoInvalida() { |
... | ... | @@ -533,7 +535,7 @@ resourceOptions.handleGet = function (dataResponse) { |
533 | 535 | $j('#projeto_turno\\[' + i + '\\]').val(object.projeto_turno); |
534 | 536 | }); |
535 | 537 | |
536 | - $j('#aluno_inep_id').val(dataResponse.aluno_inep_id); | |
538 | + aluno_inep_id.val(dataResponse.aluno_inep_id); | |
537 | 539 | $j('#aluno_estado_id').val(dataResponse.aluno_estado_id); |
538 | 540 | $j('#codigo_sistema').val(dataResponse.codigo_sistema); |
539 | 541 | tipo_resp = dataResponse.tipo_responsavel; |
... | ... | @@ -2610,3 +2612,11 @@ if ($j('#transporte_rota').length > 0) { |
2610 | 2612 | |
2611 | 2613 | $j('#rg').on('change', verificaObrigatoriedadeRg); |
2612 | 2614 | } |
2615 | + | |
2616 | +aluno_inep_id.on('keyup change', function () { | |
2617 | + const value = $j(this).val().split(''); | |
2618 | + if(value[0] === '0'){ | |
2619 | + messageUtils.error('O código INEP não pode começar com o número 0 (zero).'); | |
2620 | + $j(this).val(''); | |
2621 | + } | |
2622 | +}); | ... | ... |