Skip to content

Commit

Permalink
gauge percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlosb committed Mar 11, 2024
1 parent bb7c078 commit 30a99c2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
25 changes: 15 additions & 10 deletions application/views/inspectionform.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,18 +348,21 @@ function uploadFile() {
if (!$(this).hasClass('do-not-calc')) {
if ($(this).data("sect") === 1) {
total1 += isNaN(parseInt($(this).val())) ? 0 : parseInt($(this).val());
$("#score1").text(total1);
$("#score4").text(total1);
total1pc = 100 * (total1 / 112);
$("#score1").text(total1pc + '%');
$("#score4").text(total1pc + '%');
}
if ($(this).data("sect") === 12) {
total2 += isNaN(parseInt($(this).val())) ? 0 : parseInt($(this).val());
$("#score2").text(total2);
$("#score5").text(total2);
total2pc = 100 * (total2 / 62);
$("#score2").text(total2pc + '%');
$("#score5").text(total2pc + '%');
}
if ($(this).data("sect") === 16) {
total3 += isNaN(parseInt($(this).val())) ? 0 : parseInt($(this).val());
$("#score3").text(total3);
$("#score6").text(total3);
total3pc = 100 * (total3 / 16);
$("#score3").text(total3pc + '%');
$("#score6").text(total3pc + '%');
}
}
});
Expand Down Expand Up @@ -496,13 +499,15 @@ function uploadFile() {
}
if ($(this).data("sect") === 12) {
total2 += isNaN(parseInt($(this).val())) ? 0 : parseInt($(this).val());
$("#score2").text(total2);
$("#score5").text(total2);
total2pc = 100 * (total2 / 62);
$("#score2").text(total2pc + '%');
$("#score5").text(total2pc + '%');
}
if ($(this).data("sect") === 16) {
total3 += isNaN(parseInt($(this).val())) ? 0 : parseInt($(this).val());
$("#score3").text(total3);
$("#score6").text(total3);
total3pc = 100 * (total3 / 16);
$("#score3").text(total3pc + '%');
$("#score6").text(total3pc + '%');
}
}
});
Expand Down
6 changes: 3 additions & 3 deletions application/views/inspectionview.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@
<div class="col-sm-4 text-center">
<canvas id="cnvgauge5" ></canvas>
<div style="width:100%" class="text-center small"><?= $this->lang->line('technology_check'); ?></div>
<div id="score4" style="width:100%" class="text-center mb-2"><?= $sec1score ?><small>pts</small></div>
<div id="score4" style="width:100%" class="text-center mb-2"><?= 100 * ($sec1score / 112) ?><small>%</small></div>
</div>
<div class="col-sm-4 text-center">
<canvas id="cnvgauge6"></canvas>
<div style="width:100%" class="text-center small"><?= $this->lang->line('bodywork_check'); ?></div>
<div id="score5" style="width:100%" class="text-center mb-2"><?= $sec2score ?><small>pts</small></div>
<div id="score5" style="width:100%" class="text-center mb-2"><?= 100 * ($sec2score / 62) ?><small>%</small></div>
</div>
<div class="col-sm-4 text-center">
<canvas id="cnvgauge7"></canvas>
<div style="width:100%" class="text-center small"><?= $this->lang->line('system_check'); ?></div>
<div id="score6" style="width:100%" class="text-center mb-2"><?= $sec3score ?><small>pts</small></div>
<div id="score6" style="width:100%" class="text-center mb-2"><?= 100 * ($sec3score / 16) ?><small>%</small></div>
</div>
</div>
</div>
Expand Down

0 comments on commit 30a99c2

Please sign in to comment.