From dd909f23f9e712f6cc735ec212487bebf65cba93 Mon Sep 17 00:00:00 2001 From: Paulo Date: Sun, 22 Dec 2024 21:37:25 -0300 Subject: [PATCH 1/2] =?UTF-8?q?-=20Permitido=20que=20se=20adicione=20casa?= =?UTF-8?q?=20decimal=20na=20carga=20hor=C3=A1ria=20na=20matriz=20curricul?= =?UTF-8?q?ar.=20o=20Valor=20da=20hora-aula=20=C3=A9=20definida=20nas=20co?= =?UTF-8?q?nfigura=C3=A7=C3=B5es=20gerais=20do=20munic=C3=ADpio.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ .../sql | 2 ++ .../curricularmatrix/messages/pt_br/index.php | 2 +- .../models/CurricularMatrix.php | 7 ++++--- .../resources/common/css/layout.css | 4 ++++ .../controllers/TimesheetController.php | 20 +++++++++++++------ .../timesheet/resources/common/css/layout.css | 6 ++++-- .../resources/common/js/timesheet.js | 4 ++-- config.php | 2 +- .../curricularmatrix/index.php | 20 +++++++++---------- 10 files changed, 44 insertions(+), 25 deletions(-) create mode 100644 app/migrations/2024-12-22_curricularmatrix_decimalworkload/sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fbea8bc5..a3910547b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## [Versão 3.94.209] +- 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.209] - Trocado "Série" por "Etapa" na Ficha de Matrícula diff --git a/app/migrations/2024-12-22_curricularmatrix_decimalworkload/sql b/app/migrations/2024-12-22_curricularmatrix_decimalworkload/sql new file mode 100644 index 000000000..f23226efd --- /dev/null +++ b/app/migrations/2024-12-22_curricularmatrix_decimalworkload/sql @@ -0,0 +1,2 @@ +ALTER TABLE `curricular_matrix` +CHANGE `workload` `workload` float NOT NULL AFTER `discipline_fk`; \ No newline at end of file diff --git a/app/modules/curricularmatrix/messages/pt_br/index.php b/app/modules/curricularmatrix/messages/pt_br/index.php index 579a6bca1..11760d506 100755 --- a/app/modules/curricularmatrix/messages/pt_br/index.php +++ b/app/modules/curricularmatrix/messages/pt_br/index.php @@ -8,6 +8,6 @@ "Stages" => "Etapas", "Disciplines" => "Componentes curriculares/eixos", "Workload" => "Carga Horária", - "Credits" => "Horas Semanais", + "Credits" => "Horários Semanais", "Add" => "Adicionar" ]; diff --git a/app/modules/curricularmatrix/models/CurricularMatrix.php b/app/modules/curricularmatrix/models/CurricularMatrix.php index ecadcef43..8e2c8444b 100755 --- a/app/modules/curricularmatrix/models/CurricularMatrix.php +++ b/app/modules/curricularmatrix/models/CurricularMatrix.php @@ -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 * @@ -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'], ]; } diff --git a/app/modules/curricularmatrix/resources/common/css/layout.css b/app/modules/curricularmatrix/resources/common/css/layout.css index b58f9a09b..d327d8a46 100755 --- a/app/modules/curricularmatrix/resources/common/css/layout.css +++ b/app/modules/curricularmatrix/resources/common/css/layout.css @@ -66,4 +66,8 @@ form{ .alert-container { display: none; +} + +#workload { + width: 100%; } \ No newline at end of file diff --git a/app/modules/timesheet/controllers/TimesheetController.php b/app/modules/timesheet/controllers/TimesheetController.php index a86b5b045..8cfecb906 100755 --- a/app/modules/timesheet/controllers/TimesheetController.php +++ b/app/modules/timesheet/controllers/TimesheetController.php @@ -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] = []; @@ -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] = [ @@ -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]); } @@ -625,6 +629,8 @@ 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) { @@ -632,9 +638,9 @@ public function actionRemoveSchedule() 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; } } @@ -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"])); @@ -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; diff --git a/app/modules/timesheet/resources/common/css/layout.css b/app/modules/timesheet/resources/common/css/layout.css index 247bfeef7..c1e099329 100755 --- a/app/modules/timesheet/resources/common/css/layout.css +++ b/app/modules/timesheet/resources/common/css/layout.css @@ -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 { diff --git a/app/modules/timesheet/resources/common/js/timesheet.js b/app/modules/timesheet/resources/common/js/timesheet.js index 60f45b554..dab99596b 100755 --- a/app/modules/timesheet/resources/common/js/timesheet.js +++ b/app/modules/timesheet/resources/common/js/timesheet.js @@ -233,7 +233,7 @@ function calculateWorkload(disciplines, increment) { hasOverflow = workloadUsed > workloadTotal; } var workloadColor = workloadUsed > workloadTotal ? "workload-red" : (workloadUsed === workloadTotal ? "workload-green" : ""); - html += "
" + this.disciplineName + "
" + workloadUsed + "/" + workloadTotal + "
" + (this.instructorName === null ? "SEM PROFESSOR" : this.instructorName) + "
"; + html += "
" + this.disciplineName + "
" + workloadUsed.toFixed(2).replace(/\.00$/, '') + "/" + workloadTotal + "
" + (this.instructorName === null ? "SEM PROFESSOR" : this.instructorName) + "
"; }); $(".workloads").find(".workload").remove(); $(".workloads").append(html); @@ -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; } diff --git a/config.php b/config.php index 777597621..3e97c0b0a 100644 --- a/config.php +++ b/config.php @@ -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.209'); +define("TAG_VERSION", '3.94.209'); define("YII_VERSION", Yii::getVersion()); define("BOARD_MSG", '
Novas atualizações no TAG. Confira clicando aqui.
'); diff --git a/themes/default/views/curricularmatrix/curricularmatrix/index.php b/themes/default/views/curricularmatrix/curricularmatrix/index.php index 975e200ae..dd6047d0f 100755 --- a/themes/default/views/curricularmatrix/curricularmatrix/index.php +++ b/themes/default/views/curricularmatrix/curricularmatrix/index.php @@ -17,8 +17,6 @@ ?> - -
@@ -53,8 +51,8 @@
- "t-field-number__label control-label"]) ?> - "0", "max" => "9999", 'style' => 'border: 1px solid #aaa;box-sizing:border-box;height: 43px']) ?> + "t-field-text__label control-label"]) ?> + 'border: 1px solid #aaa;box-sizing:border-box;height: 43px', 'onkeypress' => 'return event.charCode == 46 || (event.charCode >= 48 && event.charCode <= 57)']) ?>
@@ -152,17 +150,17 @@
user->year - 1) ?> + href="javascript:;">user->year - 1) ?>