Commit 5cb69fa4a72d7709f1d602e4b6a0efc6cc2bc225

Authored by Caroline Salib
Committed by Caroline Salib
1 parent ade7316c
Exists in master

Corrigido bug ao salvar uma pessoa pai/mãe no cadastro detalhado;

* o campo certo não era atualizado e a modal não fechava;
portabilis/ieducar#155
ieducar/intranet/atendidos_cad.php
... ... @@ -932,7 +932,7 @@ class indice extends clsCadastro
932 932 if (parentType)
933 933 window.opener.afterChangePessoa(self, parentType, $id, \$j('#nm_pessoa').val());
934 934 else
935   - window.opener.afterChangePessoa(self, $id);
  935 + window.opener.afterChangePessoa(self, null, $id, \$j('#nm_pessoa').val());
936 936 }
937 937 else
938 938 document.location = 'atendidos_lst.php';
... ...
ieducar/modules/Cadastro/Assets/Javascripts/Aluno.js
... ... @@ -608,19 +608,41 @@ var simpleSearchPessoaOptions = {
608 608  
609 609 // children callbacks
610 610  
611   -function afterChangePessoa(targetWindow, pessoaId) {
  611 +function afterChangePessoa(targetWindow, parentType, parentId, parentName) {
612 612 if (targetWindow != null)
613 613 targetWindow.close();
614 614  
  615 + var $tempIdField;
  616 + var $tempNomeField;
  617 +
  618 + console.log(parentType);
  619 + console.log(parentId);
  620 + console.log(parentName);
  621 +
  622 + if(parentType){
  623 + $tempIdField = $j(buildId(parentType + '_id'));
  624 + $tempNomeField = $j(buildId(parentType + '_nome'));
  625 + }else{
  626 + $tempIdField = $j('pessoa_id');
  627 + $tempNomeField = $nomeField;
  628 + }
  629 +
  630 +
615 631 // timeout para usuario perceber mudança
616 632 window.setTimeout(function() {
617   - messageUtils.success('Pessoa alterada com sucesso', $nomeField);
  633 + messageUtils.success('Pessoa alterada com sucesso', $tempNomeField);
618 634  
619   - $j('#pessoa_id').val(pessoaId);
620   - getPersonDetails(pessoaId);
  635 + $tempIdField.val(parentId);
  636 + if(!parentType){
  637 + getPersonDetails(pessoaId);
  638 + }else{
  639 + $tempNomeField.val(parentId + ' - ' +parentName);
  640 + }
621 641  
622   - if ($nomeField.is(':active'))
623   - $nomeField.focus();
  642 + if ($tempNomeField.is(':active'))
  643 + $tempNomeField.focus();
  644 +
  645 + changeVisibilityOfLinksToPessoaParent(parentType);
624 646  
625 647 }, 500);
626 648 }
... ... @@ -975,6 +997,10 @@ function canShowParentsFields(){
975 997 $j( "#dialog-form-pessoa-aluno" ).dialog( "close" );
976 998 });
977 999  
  1000 + $j('#link_cadastro_detalhado_parent').click(function(){
  1001 + $j( "#dialog-form-pessoa-parent" ).dialog( "close" );
  1002 + });
  1003 +
978 1004 $j("#cadastrar-pessoa-link").click(function() {
979 1005  
980 1006 $j('#link_cadastro_detalhado').attr('href','/intranet/atendidos_cad.php');
... ...