Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/TCDA-809 #904

Merged
merged 4 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@

## [Versão 3.94.210]
- Permitido que se adicione casa decimal na carga horária na matriz curricular. o Valor da hora-aula é definida nas configurações gerais do município.
-
## [Versão 3.93.210]
- Ordem das etapas ajustada no relatório de Matrículas Anuais

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `curricular_matrix`
CHANGE `workload` `workload` float NOT NULL AFTER `discipline_fk`;
2 changes: 1 addition & 1 deletion app/modules/curricularmatrix/messages/pt_br/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"Stages" => "Etapas",
"Disciplines" => "Componentes curriculares/eixos",
"Workload" => "Carga Horária",
"Credits" => "Horas Semanais",
"Credits" => "Horários Semanais",
"Add" => "Adicionar"
];
7 changes: 4 additions & 3 deletions app/modules/curricularmatrix/models/CurricularMatrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @property integer $id
* @property integer $stage_fk
* @property integer $discipline_fk
* @property integer $workload
* @property double $workload
* @property integer $credits
* @property integer $school_year
*
Expand Down Expand Up @@ -46,8 +46,9 @@ public function rules()
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return [
['stage_fk, discipline_fk, workload, credits, school_year', 'required'],
['stage_fk, discipline_fk, workload, credits, school_year', 'numerical', 'integerOnly' => true],
['stage_fk, discipline_fk, credits, school_year', 'required'],
['stage_fk, discipline_fk, credits, school_year', 'numerical', 'integerOnly' => true],
['workload', 'numerical'],
['id, stage_fk, discipline_fk, workload, credits, school_year', 'safe', 'on' => 'search'],
];
}
Expand Down
4 changes: 4 additions & 0 deletions app/modules/curricularmatrix/resources/common/css/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,8 @@ form{

.alert-container {
display: none;
}

#workload {
width: 100%;
}
22 changes: 15 additions & 7 deletions app/modules/timesheet/controllers/TimesheetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ public function actionGetTimesheet($classroomId = NULL)
$response["softUnavailableDays"] = $this->getUnavailableDays($classroomId, false, "soft");

$response["schedules"] = [];
$vha = (object)\InstanceConfig::model()->findByAttributes(array('parameter_key' => 'VHA'));
$hours = $vha["value"] / 60;
foreach ($schedules as $schedule) {
// if (!isset($response["schedules"][$schedule->month])) {
// $response["schedules"][$schedule->month] = [];
Expand All @@ -135,7 +137,7 @@ public function actionGetTimesheet($classroomId = NULL)

if (!$schedule->unavailable) {
$cmKey = array_search($schedule["discipline_fk"], array_column($response["disciplines"], 'disciplineId'));
$response["disciplines"][$cmKey]["workloadUsed"]++;
$response["disciplines"][$cmKey]["workloadUsed"] += $hours;
}

$response["schedules"][$schedule->year][$schedule->month][$schedule->schedule][$schedule->day] = [
Expand Down Expand Up @@ -482,7 +484,9 @@ public function actionChangeUnavailableSchedule()
$schedule->save();

$disciplines = [];
array_push($disciplines, ["disciplineId" => $schedule->discipline_fk, "workloadUsed" => $schedule->unavailable ? -1 : 1]);
$vha = (object)\InstanceConfig::model()->findByAttributes(array('parameter_key' => 'VHA'));
$hours = $vha["value"] / 60;
array_push($disciplines, ["disciplineId" => $schedule->discipline_fk, "workloadUsed" => $schedule->unavailable ? -$hours : $hours]);
echo json_encode(["unavailable" => $schedule->unavailable, "disciplines" => $disciplines]);
}

Expand Down Expand Up @@ -595,7 +599,7 @@ public function actionChangeSchedules()
" select " .
" edcenso_discipline.id as disciplineId, " .
" edcenso_discipline.name as disciplineName, " .
" (select count(schedule.id) from schedule where classroom_fk = " . $_POST["classroomId"] . " and schedule.unavailable = 0 and schedule.discipline_fk = disciplineId) as workloadUsed, " .
" (select (count(schedule.id) * (select value from instance_config where parameter_key = 'VHA') / 60) from schedule where classroom_fk = " . $_POST["classroomId"] . " and schedule.unavailable = 0 and schedule.discipline_fk = disciplineId) as workloadUsed, " .
" curricular_matrix.workload as workloadTotal, " .
" (select ii.name from teaching_matrixes tm join instructor_teaching_data itd on itd.id = tm.teaching_data_fk join instructor_identification ii on itd.instructor_fk = ii.id where itd.classroom_id_fk = " . $_POST["classroomId"] . " and tm.curricular_matrix_fk = curricular_matrix.id) as instructorName " .
" from curricular_matrix " .
Expand Down Expand Up @@ -625,16 +629,18 @@ public function actionRemoveSchedule()
if ($_POST["schedule"]["hardUnavailableDaySelected"] || !$_POST["replicate"]) {
$finalDate = new Datetime($_POST["schedule"]["year"] . "-" . str_pad($_POST["schedule"]["month"], 2, "0", STR_PAD_LEFT) . "-" . $_POST["schedule"]["day"]);
}
$vha = (object)\InstanceConfig::model()->findByAttributes(array('parameter_key' => 'VHA'));
$hours = $vha["value"] / 60;
for ($date = $selectedDate; $date <= $finalDate; $date->modify("+7 days")) {
$schedule = Schedule::model()->findByAttributes(array('classroom_fk' => $_POST["classroomId"], 'year' => $date->format("Y"), 'month' => $date->format("n"), 'day' => $date->format("j"), 'schedule' => $_POST["schedule"]["schedule"]));
if ($schedule != null) {
array_push($removes, ["day" => $schedule->day, "month" => $schedule->month, "year" => $schedule->year, "schedule" => $schedule->schedule]);
if (!$schedule->unavailable) {
$key = array_search($schedule->discipline_fk, array_column($disciplines, 'disciplineId'));
if ($key === false) {
array_push($disciplines, ["disciplineId" => $schedule->discipline_fk, "workloadUsed" => -1]);
array_push($disciplines, ["disciplineId" => $schedule->discipline_fk, "workloadUsed" => -$hours]);
} else {
$disciplines[$key]["workloadUsed"]--;
$disciplines[$key]["workloadUsed"] -= $hours;
}
}

Expand Down Expand Up @@ -698,6 +704,8 @@ public function actionAddSchedule()
if ($_POST["hardUnavailableDaySelected"] || !$_POST["replicate"]) {
$finalDate = new Datetime($_POST["schedule"]["year"] . "-" . str_pad($_POST["schedule"]["month"], 2, "0", STR_PAD_LEFT) . "-" . $_POST["schedule"]["day"]);
}
$vha = (object)\InstanceConfig::model()->findByAttributes(array('parameter_key' => 'VHA'));
$hours = $vha["value"] / 60;
for ($date = $selectedDate; $date <= $finalDate; $date->modify("+7 days")) {
if (!in_array($date->format("Y-m-d"), $hardUnavailableDays) || $_POST["hardUnavailableDaySelected"]) {
$schedule = Schedule::model()->findByAttributes(array('classroom_fk' => $_POST["classroomId"], 'year' => $date->format("Y"), 'month' => $date->format("n"), 'day' => $date->format("j"), 'schedule' => $_POST["schedule"]["schedule"]));
Expand All @@ -718,9 +726,9 @@ public function actionAddSchedule()
$schedule->unavailable = 0;
$key = array_search($_POST["disciplineId"], array_column($disciplines, 'disciplineId'));
if ($key === false) {
array_push($disciplines, ["disciplineId" => $_POST["disciplineId"], "workloadUsed" => 1]);
array_push($disciplines, ["disciplineId" => $_POST["disciplineId"], "workloadUsed" => $hours]);
} else {
$disciplines[$key]["workloadUsed"]++;
$disciplines[$key]["workloadUsed"] += $hours;
}
}
$schedule->turn = $classroom->turn;
Expand Down
6 changes: 4 additions & 2 deletions app/modules/timesheet/resources/common/css/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,18 @@ table.table-timesheet td {

.workload-discipline {
display: inline-block;
width: 80%;
width: 70%;
font-weight: bold;
vertical-align: middle;
font-size: 12px;
}

.workload-numbers {
display: inline-block;
width: 20%;
width: 30%;
font-style: italic;
text-align: right;
font-size: 12px;
}

.workload-red {
Expand Down
4 changes: 2 additions & 2 deletions app/modules/timesheet/resources/common/js/timesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ function calculateWorkload(disciplines, increment) {
hasOverflow = workloadUsed > workloadTotal;
}
var workloadColor = workloadUsed > workloadTotal ? "workload-red" : (workloadUsed === workloadTotal ? "workload-green" : "");
html += "<div class='workload " + workloadColor + "' discipline-id='" + this.disciplineId + "'><div class='workload-discipline'>" + this.disciplineName + "</div><div class='workload-numbers'><span class='workload-used'>" + workloadUsed + "</span>/<span class='workload-total'>" + workloadTotal + "</span></div><div class='workload-instructor'>" + (this.instructorName === null ? "SEM PROFESSOR" : this.instructorName) + "</div></div>";
html += "<div class='workload " + workloadColor + "' discipline-id='" + this.disciplineId + "'><div class='workload-discipline'>" + this.disciplineName + "</div><div class='workload-numbers'><span class='workload-used'>" + workloadUsed.toFixed(2).replace(/\.00$/, '') + "</span>/<span class='workload-total'>" + workloadTotal + "</span></div><div class='workload-instructor'>" + (this.instructorName === null ? "SEM PROFESSOR" : this.instructorName) + "</div></div>";
});
$(".workloads").find(".workload").remove();
$(".workloads").append(html);
Expand All @@ -245,7 +245,7 @@ function calculateWorkload(disciplines, increment) {
workloadUsed > workloadTotal
? workload.addClass("workload-red").removeClass("workload-green")
: (workloadUsed === workloadTotal ? workload.addClass("workload-green").removeClass("workload-red") : workload.removeClass("workload-red").removeClass("workload-green"));
workload.find(".workload-used").text(workloadUsed);
workload.find(".workload-used").text(workloadUsed.toFixed(2).replace(/\.00$/, ''));
});
hasOverflow = $(".workloads").find(".workload.workload-red").length;
}
Expand Down
2 changes: 1 addition & 1 deletion config.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
defined('YII_DEBUG') or define('YII_DEBUG', $debug);
defined("SESSION_MAX_LIFETIME") or define('SESSION_MAX_LIFETIME', 3600);

define("TAG_VERSION", '3.93.210');
define("TAG_VERSION", '3.94.210');

define("YII_VERSION", Yii::getVersion());
define("BOARD_MSG", '<div class="alert alert-success">Novas atualizações no TAG. Confira clicando <a class="changelog-link" href="?r=admin/changelog">aqui</a>.</div>');
Expand Down
20 changes: 10 additions & 10 deletions themes/default/views/curricularmatrix/curricularmatrix/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
?>




<div class="main">
<div class="row-fluid">
<div class="span12">
Expand Down Expand Up @@ -53,8 +51,8 @@
<div class="row clear-margin--left">
<div class="column">
<div class="t-field-number">
<?= CHtml::label(Yii::t('curricularMatrixModule.index', 'Workload'), 'workload', ['class' => "t-field-number__label control-label"]) ?>
<?= CHtml::numberField("workload", "0", ["min" => "0", "max" => "9999", 'style' => 'border: 1px solid #aaa;box-sizing:border-box;height: 43px']) ?>
<?= CHtml::label(Yii::t('curricularMatrixModule.index', 'Workload'), 'workload', ['class' => "t-field-text__label control-label"]) ?>
<?= CHtml::textField("workload", "0", ['style' => 'border: 1px solid #aaa;box-sizing:border-box;height: 43px', 'onkeypress' => 'return event.charCode == 46 || (event.charCode >= 48 && event.charCode <= 57)']) ?>
</div>
</div>
<div class="column">
Expand Down Expand Up @@ -152,31 +150,33 @@
</div>
<div class="reuse">
<a class="matrix-reuse"
href="javascript:;"><?php echo 'Reaproveitamento da Matriz Curricular de ' . (Yii::app()->user->year - 1) ?></a>
href="javascript:;"><?php echo 'Reaproveitamento da Matriz Curricular de ' . (Yii::app()->user->year - 1) ?></a>
</div>
</div>
</div>
<div class="modal fade modal-content" id="matrix-reuse-modal" tabindex="-1" role="dialog"
aria-labelledby="Reaproveitamento de Matriz Curricular">
aria-labelledby="Reaproveitamento de Matriz Curricular">
<div class="modal-dialog" role="document">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="position:static;">
<img src="<?php echo Yii::app()->theme->baseUrl; ?>/img/Close.svg" alt=""
style="vertical-align: -webkit-baseline-middle">
style="vertical-align: -webkit-baseline-middle">
</button>
<h4 class="modal-title" id="myModalLabel">Reaproveitamento de Matriz Curricular</h4>
</div>
<form method="post">
<div class="modal-body">
<div class="row-fluid">
<b>Tem certeza</b> que deseja reaproveitar a matriz curricular de
<?php echo (Yii::app()->user->year - 1) ?>?</b>
<?php echo(Yii::app()->user->year - 1) ?>?</b>
</div>
<div class="modal-footer">
<button type="button" class="tag-button-light btn btn-default"
data-dismiss="modal">Cancelar</button>
data-dismiss="modal">Cancelar
</button>
<button type="button" class="btn btn-primary confirm-matrix-reuse"
data-dismiss="modal">Confirmar</button>
data-dismiss="modal">Confirmar
</button>
</div>
</div>
</form>
Expand Down
Loading