Skip to content

Commit

Permalink
Adiciona campo de transporte rural ao cadastro do Aluno
Browse files Browse the repository at this point in the history
  • Loading branch information
edineivaldameri committed Apr 22, 2024
1 parent 7e6cd38 commit eb6de76
Show file tree
Hide file tree
Showing 8 changed files with 492 additions and 410 deletions.
832 changes: 425 additions & 407 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion config/assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
|
*/

'version' => '0.1.72',
'version' => '0.1.73',

/*
|--------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up(): void
{
Schema::table('pmieducar.aluno', function (Blueprint $table) {
$table->boolean('utiliza_transporte_rural')->default(false);
});
}

public function down(): void
{
Schema::table('pmieducar.aluno', function (Blueprint $table) {
$table->dropColumn('utiliza_transporte_rural');
});
}
};
2 changes: 2 additions & 0 deletions ieducar/intranet/educar_aluno_det.php
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ public function Gerar()
$this->addDetalhe(detalhe: ['Responsável transporte', $tipoTransporte]);
}

$this->addDetalhe(detalhe: ['Utiliza transporte rural', $registro['utiliza_transporte_rural'] ? 'Sim' : 'Não']);

if ($registro['nis_pis_pasep']) {
$this->addDetalhe(detalhe: ['NIS', $registro['nis_pis_pasep']]);
}
Expand Down
25 changes: 23 additions & 2 deletions ieducar/intranet/include/pmieducar/clsPmieducarAluno.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class clsPmieducarAluno extends Model

public $rota_transporte;

public $utiliza_transporte_rural;

/**
* Construtor.
*/
Expand Down Expand Up @@ -98,7 +100,8 @@ public function __construct(
$autorizado_cinco = null,
$parentesco_cinco = null,
$tipo_transporte = null,
$rota_transporte = null
$rota_transporte = null,
$utiliza_transporte_rural = null
) {
$db = new clsBanco();
$this->_schema = 'pmieducar.';
Expand All @@ -107,12 +110,14 @@ public function __construct(
$this->_campos_lista = $this->_todos_campos = 'a.cod_aluno, a.ref_cod_religiao, a.ref_usuario_exc,
a.ref_usuario_cad, a.ref_idpes, a.data_cadastro, a.data_exclusao, a.ativo, a.analfabeto, tipo_responsavel, a.aluno_estado_id, a.recursos_prova_inep, a.recebe_escolarizacao_em_outro_espaco,
a.justificativa_falta_documentacao, a.url_laudo_medico::text, a.codigo_sistema, a.veiculo_transporte_escolar, a.parentesco_um, a.autorizado_um, a.parentesco_dois, a.autorizado_dois,
a.parentesco_tres, a.autorizado_tres, a.parentesco_quatro, a.autorizado_quatro, a.parentesco_cinco, a.autorizado_cinco, a.url_documento::text, a.emancipado, a.tipo_transporte, a.rota_transporte';
a.parentesco_tres, a.autorizado_tres, a.parentesco_quatro, a.autorizado_quatro, a.parentesco_cinco, a.autorizado_cinco, a.url_documento::text, a.emancipado, a.tipo_transporte, a.rota_transporte, a.utiliza_transporte_rural';

if (is_string($rota_transporte)) {
$this->rota_transporte = $rota_transporte;
}

$this->utiliza_transporte_rural = $utiliza_transporte_rural ?? false;

if (is_numeric($tipo_transporte)) {
$this->tipo_transporte = $tipo_transporte;
}
Expand Down Expand Up @@ -228,6 +233,16 @@ public function cadastra()
$gruda = ', ';
}

if ($this->utiliza_transporte_rural) {
$campos .= "{$gruda}utiliza_transporte_rural";
$valores .= "{$gruda}'true";
$gruda = ', ';
} else {
$campos .= "{$gruda}utiliza_transporte_rural";
$valores .= "{$gruda}'false";
$gruda = ', ';
}

if (is_numeric($this->tipo_transporte)) {
$campos .= "{$gruda}tipo_transporte";
$valores .= "{$gruda}'{$this->tipo_transporte}'";
Expand Down Expand Up @@ -420,6 +435,12 @@ public function edita()
$gruda = ', ';
}

if (isset($this->utiliza_transporte_rural)) {
$condicaoBd = $this->utiliza_transporte_rural ? 'TRUE' : 'FALSE';
$set .= "{$gruda}utiliza_transporte_rural = {$condicaoBd}";
$gruda = ', ';
}

if (is_numeric($this->tipo_transporte)) {
$set .= "{$gruda}tipo_transporte = '{$this->tipo_transporte}'";
$gruda = ', ';
Expand Down
3 changes: 3 additions & 0 deletions ieducar/modules/Api/Views/AlunoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ protected function createOrUpdateAluno($id = null)

$aluno->tipo_transporte = (new TransportationProvider())->from($this->getRequest()->tipo_transporte);
$aluno->rota_transporte = $this->getRequest()->rota_transporte;
$aluno->utiliza_transporte_rural = (bool) $this->getRequest()->utiliza_transporte_rural;

if (is_null($id)) {
$id = $aluno->cadastra();
Expand Down Expand Up @@ -1159,6 +1160,7 @@ protected function get()
'emancipado',
'tipo_transporte',
'rota_transporte',
'utiliza_transporte_rural',
];

$aluno = Portabilis_Array_Utils::filter($alunoDetalhe, $attrs);
Expand All @@ -1168,6 +1170,7 @@ protected function get()
$aluno['tipo_responsavel'] = $this->tipoResponsavel($aluno);
$aluno['aluno_inep_id'] = $this->loadAlunoInepId($id);
$aluno['ativo'] = $aluno['ativo'] == 1;
$aluno['utiliza_transporte_rural'] = $aluno['utiliza_transporte_rural'] === true ? 1 : 0;

$aluno['veiculo_transporte_escolar'] = Portabilis_Utils_Database::pgArrayToArray($aluno['veiculo_transporte_escolar']);
$aluno['alfabetizado'] = $aluno['analfabeto'] == 0;
Expand Down
12 changes: 12 additions & 0 deletions ieducar/modules/Cadastro/Views/AlunoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,18 @@ public function Gerar()

$this->inputsHelper()->select('tipo_transporte', $options);

$options = [
'label' => 'Utiliza transporte rural',
'resources' => [
null => 'Selecione',
true => 'Sim',
false => 'Não',
],
'required' => false,
];

$this->inputsHelper()->select('utiliza_transporte_rural', $options);

$veiculos = VeiculoTransporteEscolar::getDescriptiveValues();
$helperOptions = ['objectName' => 'veiculo_transporte_escolar'];
$options = [
Expand Down
4 changes: 4 additions & 0 deletions public/vendor/legacy/Cadastro/Assets/Javascripts/Aluno.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ let camposTransporte = function() {
$j("#veiculo_transporte_escolar").makeUnrequired();
if (tipoTransporte.val() == "nenhum") {
document.getElementById("veiculo_transporte_escolar").disabled = true;
document.getElementById("utiliza_transporte_rural").disabled = true;
$j('#tr_rota_transporte').hide();
} else if (
tipoTransporte.val() == "municipal" ||
Expand All @@ -329,9 +330,11 @@ let camposTransporte = function() {
$j("#veiculo_transporte_escolar").makeRequired();
}
document.getElementById("veiculo_transporte_escolar").disabled = false;
document.getElementById("utiliza_transporte_rural").disabled = false;
$j('#tr_rota_transporte').show();
} else {
document.getElementById("veiculo_transporte_escolar").disabled = true;
document.getElementById("utiliza_transporte_rural").disabled = true;
$j('#tr_rota_transporte').hide();
}
$j("#veiculo_transporte_escolar").trigger("chosen:updated");
Expand Down Expand Up @@ -632,6 +635,7 @@ resourceOptions.handleGet = function (dataResponse) {
tipo_resp = dataResponse.tipo_responsavel;
$j("#religiao_id").val(dataResponse.religiao_id);
$j("#tipo_transporte").val(dataResponse.tipo_transporte);
$j("#utiliza_transporte_rural").val(dataResponse.utiliza_transporte_rural);
$j("#rota_transporte").val(dataResponse.rota_transporte);
$j("#alfabetizado").attr("checked", dataResponse.alfabetizado);
document.getElementById("emancipado").checked = dataResponse.emancipado;
Expand Down

0 comments on commit eb6de76

Please sign in to comment.