From 30a99c23b1758b0970d00ddf88af7620b955a2a2 Mon Sep 17 00:00:00 2001 From: pavlosb Date: Mon, 11 Mar 2024 11:13:25 +0200 Subject: [PATCH] gauge percentage --- application/views/inspectionform.php | 25 +++++++++++++++---------- application/views/inspectionview.php | 6 +++--- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/application/views/inspectionform.php b/application/views/inspectionform.php index bddcdbc6..8fe62410 100644 --- a/application/views/inspectionform.php +++ b/application/views/inspectionform.php @@ -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 + '%'); } } }); @@ -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 + '%'); } } }); diff --git a/application/views/inspectionview.php b/application/views/inspectionview.php index 2588b35f..50b4d87d 100644 --- a/application/views/inspectionview.php +++ b/application/views/inspectionview.php @@ -45,17 +45,17 @@
lang->line('technology_check'); ?>
-
pts
+
%
lang->line('bodywork_check'); ?>
-
pts
+
%
lang->line('system_check'); ?>
-
pts
+
%