Commit c964d52dcb4411724427e6c987a1badb5377c794
1 parent
8b7a1c0e
Exists in
master
Permitido desfazer abandono matricula.
Showing
4 changed files
with
66 additions
and
7 deletions
Show diff stats
ieducar/intranet/educar_matricula_det.php
| @@ -33,6 +33,9 @@ require_once 'include/clsDetalhe.inc.php'; | @@ -33,6 +33,9 @@ require_once 'include/clsDetalhe.inc.php'; | ||
| 33 | require_once 'include/clsBanco.inc.php'; | 33 | require_once 'include/clsBanco.inc.php'; |
| 34 | require_once 'include/pmieducar/geral.inc.php'; | 34 | require_once 'include/pmieducar/geral.inc.php'; |
| 35 | 35 | ||
| 36 | +require_once 'App/Model/MatriculaSituacao.php'; | ||
| 37 | +require_once 'Portabilis/View/Helper/Application.php'; | ||
| 38 | + | ||
| 36 | /** | 39 | /** |
| 37 | * clsIndexBase class. | 40 | * clsIndexBase class. |
| 38 | * | 41 | * |
| @@ -80,6 +83,12 @@ class indice extends clsDetalhe | @@ -80,6 +83,12 @@ class indice extends clsDetalhe | ||
| 80 | 83 | ||
| 81 | function Gerar() | 84 | function Gerar() |
| 82 | { | 85 | { |
| 86 | + | ||
| 87 | + // carrega estilo para feedback messages, exibindo msgs da api. | ||
| 88 | + | ||
| 89 | + $style = "/modules/Portabilis/Assets/Stylesheets/Frontend.css"; | ||
| 90 | + Portabilis_View_Helper_Application::loadStylesheet($this, $style); | ||
| 91 | + | ||
| 83 | @session_start(); | 92 | @session_start(); |
| 84 | $this->pessoa_logada = $_SESSION['id_pessoa']; | 93 | $this->pessoa_logada = $_SESSION['id_pessoa']; |
| 85 | session_write_close(); | 94 | session_write_close(); |
| @@ -285,14 +294,25 @@ class indice extends clsDetalhe | @@ -285,14 +294,25 @@ class indice extends clsDetalhe | ||
| 285 | $this->array_botao_url_script[] = "go(\"educar_transferencia_solicitacao_cad.php?ref_cod_matricula={$registro['cod_matricula']}&ref_cod_aluno={$registro['ref_cod_aluno']}&cancela=true&reabrir_matricula=true\")"; | 294 | $this->array_botao_url_script[] = "go(\"educar_transferencia_solicitacao_cad.php?ref_cod_matricula={$registro['cod_matricula']}&ref_cod_aluno={$registro['ref_cod_aluno']}&cancela=true&reabrir_matricula=true\")"; |
| 286 | } | 295 | } |
| 287 | 296 | ||
| 288 | - if ($registro['aprovado'] == 4 || $det_transferencia) { | ||
| 289 | - $this->array_botao[] = 'Imprimir Atestado Frequência'; | ||
| 290 | - $this->array_botao_url_script[] = "showExpansivelImprimir(400, 200, \"educar_relatorio_atestado_frequencia.php?cod_matricula={$registro['cod_matricula']}\",[], \"Relatório Atestado de Freqüência\")"; | 297 | + if ($registro['aprovado'] == App_Model_MatriculaSituacao::ABANDONO) { |
| 298 | + $this->array_botao[] = "Desfazer abandono"; | ||
| 299 | + $this->array_botao_url_script[] = "deleteAbandono({$registro['cod_matricula']})"; | ||
| 291 | } | 300 | } |
| 292 | } | 301 | } |
| 293 | 302 | ||
| 294 | $this->url_cancelar = 'educar_aluno_det.php?cod_aluno=' . $registro['ref_cod_aluno']; | 303 | $this->url_cancelar = 'educar_aluno_det.php?cod_aluno=' . $registro['ref_cod_aluno']; |
| 295 | $this->largura = '100%'; | 304 | $this->largura = '100%'; |
| 305 | + | ||
| 306 | + // js | ||
| 307 | + Portabilis_View_Helper_Application::loadJQueryLib($this); | ||
| 308 | + | ||
| 309 | + $scripts = array( | ||
| 310 | + '/modules/Portabilis/Assets/Javascripts/Utils.js', | ||
| 311 | + '/modules/Portabilis/Assets/Javascripts/ClientApi.js', | ||
| 312 | + '/modules/Cadastro/Assets/Javascripts/MatriculaShow.js' | ||
| 313 | + ); | ||
| 314 | + | ||
| 315 | + Portabilis_View_Helper_Application::loadJavascript($this, $scripts); | ||
| 296 | } | 316 | } |
| 297 | 317 | ||
| 298 | 318 |
ieducar/modules/Api/Views/MatriculaController.php
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | -#error_reporting(E_ALL); | ||
| 4 | -#ini_set("display_errors", 1); | ||
| 5 | - | ||
| 6 | /** | 3 | /** |
| 7 | * i-Educar - Sistema de gestão escolar | 4 | * i-Educar - Sistema de gestão escolar |
| 8 | * | 5 | * |
| @@ -35,6 +32,7 @@ | @@ -35,6 +32,7 @@ | ||
| 35 | require_once 'lib/Portabilis/Controller/ApiCoreController.php'; | 32 | require_once 'lib/Portabilis/Controller/ApiCoreController.php'; |
| 36 | require_once 'lib/Portabilis/Array/Utils.php'; | 33 | require_once 'lib/Portabilis/Array/Utils.php'; |
| 37 | require_once 'lib/Portabilis/String/Utils.php'; | 34 | require_once 'lib/Portabilis/String/Utils.php'; |
| 35 | +require_once 'App/Model/MatriculaSituacao.php'; | ||
| 38 | 36 | ||
| 39 | class MatriculaController extends ApiCoreController | 37 | class MatriculaController extends ApiCoreController |
| 40 | { | 38 | { |
| @@ -44,6 +42,11 @@ class MatriculaController extends ApiCoreController | @@ -44,6 +42,11 @@ class MatriculaController extends ApiCoreController | ||
| 44 | $this->validatesId('aluno'); | 42 | $this->validatesId('aluno'); |
| 45 | } | 43 | } |
| 46 | 44 | ||
| 45 | + protected function canDeleteAbandono() { | ||
| 46 | + return $this->validatesPresenceOf('id') && | ||
| 47 | + $this->validatesExistenceOf('matricula', $this->getRequest()->id); | ||
| 48 | + } | ||
| 49 | + | ||
| 47 | // search options | 50 | // search options |
| 48 | 51 | ||
| 49 | protected function searchOptions() { | 52 | protected function searchOptions() { |
| @@ -189,6 +192,17 @@ class MatriculaController extends ApiCoreController | @@ -189,6 +192,17 @@ class MatriculaController extends ApiCoreController | ||
| 189 | } | 192 | } |
| 190 | } | 193 | } |
| 191 | 194 | ||
| 195 | + protected function deleteAbandono() { | ||
| 196 | + if ($this->canDeleteAbandono()) { | ||
| 197 | + $matriculaId = $this->getRequest()->id; | ||
| 198 | + $situacaoAndamento = App_Model_MatriculaSituacao::EM_ANDAMENTO; | ||
| 199 | + | ||
| 200 | + $sql = 'update pmieducar.matricula set aprovado = $1 where cod_matricula = $2'; | ||
| 201 | + $this->fetchPreparedQuery($sql, array($situacaoAndamento, $matriculaId)); | ||
| 202 | + | ||
| 203 | + $this->messenger->append('Abandono desfeito.', 'success'); | ||
| 204 | + } | ||
| 205 | + } | ||
| 192 | 206 | ||
| 193 | public function Gerar() { | 207 | public function Gerar() { |
| 194 | if ($this->isRequestFor('get', 'matricula')) | 208 | if ($this->isRequestFor('get', 'matricula')) |
| @@ -200,6 +214,9 @@ class MatriculaController extends ApiCoreController | @@ -200,6 +214,9 @@ class MatriculaController extends ApiCoreController | ||
| 200 | elseif ($this->isRequestFor('get', 'matricula-search')) | 214 | elseif ($this->isRequestFor('get', 'matricula-search')) |
| 201 | $this->appendResponse($this->search()); | 215 | $this->appendResponse($this->search()); |
| 202 | 216 | ||
| 217 | + elseif ($this->isRequestFor('delete', 'abandono')) | ||
| 218 | + $this->appendResponse($this->deleteAbandono()); | ||
| 219 | + | ||
| 203 | else | 220 | else |
| 204 | $this->notImplementedOperationError(); | 221 | $this->notImplementedOperationError(); |
| 205 | } | 222 | } |
ieducar/modules/Cadastro/Assets/Javascripts/MatriculaShow.js
0 → 100644
| @@ -0,0 +1,22 @@ | @@ -0,0 +1,22 @@ | ||
| 1 | +var apiUrlBase = '/module/Api/matricula'; | ||
| 2 | + | ||
| 3 | +var handleDeleteAbandono = function(dataResponse) { | ||
| 4 | + handleMessages(dataResponse.msgs); | ||
| 5 | + location.reload(); | ||
| 6 | +} | ||
| 7 | + | ||
| 8 | +function deleteAbandono(matriculaId) { | ||
| 9 | + if (! confirm(stringUtils.toUtf8('Deseja desfazer o abandono?'))) | ||
| 10 | + return false; | ||
| 11 | + | ||
| 12 | + var options = { | ||
| 13 | + url : deleteResourceUrlBuilder.buildUrl(apiUrlBase, 'abandono'), | ||
| 14 | + dataType : 'json', | ||
| 15 | + data : { | ||
| 16 | + id : matriculaId | ||
| 17 | + }, | ||
| 18 | + success : handleDeleteAbandono | ||
| 19 | + }; | ||
| 20 | + | ||
| 21 | + deleteResource(options); | ||
| 22 | +} | ||
| 0 | \ No newline at end of file | 23 | \ No newline at end of file |
ieducar/modules/Portabilis/Assets/Javascripts/Utils.js
| @@ -277,7 +277,7 @@ var handleMessages = messageUtils.handleMessages; | @@ -277,7 +277,7 @@ var handleMessages = messageUtils.handleMessages; | ||
| 277 | $(document).ready(function() { | 277 | $(document).ready(function() { |
| 278 | 278 | ||
| 279 | // add div for feedback messages | 279 | // add div for feedback messages |
| 280 | - $j('<div />').attr('id', 'feedback-messages').appendTo($j('form').last().parent()); | 280 | + $j('<div />').attr('id', 'feedback-messages').appendTo($j('#corpo')); |
| 281 | 281 | ||
| 282 | }); // ready | 282 | }); // ready |
| 283 | })(jQuery); | 283 | })(jQuery); |