From a50d1c2e5b7d902f9fc5829d5d40b26beb1fc787 Mon Sep 17 00:00:00 2001 From: pavlosb Date: Fri, 26 Apr 2024 16:03:15 +0300 Subject: [PATCH] remove-checkpoints --- application/controllers/Inspection.php | 4 ++ application/views/inspectionform.php | 59 +++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 7 deletions(-) diff --git a/application/controllers/Inspection.php b/application/controllers/Inspection.php index aa177b6..c986fc5 100644 --- a/application/controllers/Inspection.php +++ b/application/controllers/Inspection.php @@ -475,6 +475,10 @@ public function inspection_save() $updata['s1score_inspection'] = $this->itindata_model->get_sectionscore($this->input->post('inspectionid_insres'), 1); $updata['s2score_inspection'] = $this->itindata_model->get_sectionscore($this->input->post('inspectionid_insres'), 12); $updata['s3score_inspection'] = $this->itindata_model->get_sectionscore($this->input->post('inspectionid_insres'), 16); +$updata['s1pen_inspection'] = $this->input->post('pensect1'); +$updata['s2pen_inspection'] = $this->input->post('pensect2'); +$updata['s3pen_inspection'] = $this->input->post('pensect3'); + $this->itindata_model->upd_inspection($this->input->post('inspectionid_insres'), $updata); redirect('inspection/inspections_list', 'refresh'); } else { diff --git a/application/views/inspectionform.php b/application/views/inspectionform.php index ef9e0ee..2659196 100644 --- a/application/views/inspectionform.php +++ b/application/views/inspectionform.php @@ -124,17 +124,18 @@
+
@@ -158,7 +159,9 @@ $scp = $cp['name_section']; endforeach ?>
- + + +
@@ -371,16 +374,28 @@ function uploadFile() { $('#closecamera').hide(); $('input:radio').change(function () { + var total1 = 0; var total2 = 0; var total3 = 0; + var pensect1 = 0; + var pensect2 = 0; + var pensect3 = 0; + $totscore1 = 112; + $totscore2 = 62; + $totscore2 = 16; + $newscore1 = 0; + $('input:radio:checked').each(function(){ + $cpid = $(this).data("cpid"); + $ptscp = isNaN(parseInt($(this).data("ptscp"))) ? 0 : parseInt($(this).data("ptscp")); + $('[name="points['+$cpid +']"]').val($ptscp); if (!$(this).hasClass('do-not-calc')) { if ($(this).data("sect") === 1) { total1 += isNaN(parseInt($(this).val())) ? 0 : parseInt($(this).val()); total1pc = 100 * (total1 / 112); - $("#score1").text(total1pc.toFixed(2) + '%'); + $("#score1").text(total1pc.toFixed(2) + '%'); $("#score4").text(total1pc.toFixed(2) + '%'); } if ($(this).data("sect") === 12) { @@ -396,7 +411,20 @@ function uploadFile() { $("#score6").text(total3pc.toFixed(2) + '%'); } } - }); + }); + + $("input[data-sectpen='1']").each(function(){ + pensect1 += parseInt($(this).val()); + }); + $("input[data-sectpen='12']").each(function(){ + pensect2 += parseInt($(this).val()); + }); + $("input[data-sectpen='16']").each(function(){ + pensect3 += parseInt($(this).val()); + }); + $('[name="pensect1"]').val(pensect1); + $('[name="pensect2"]').val(pensect2); + $('[name="pensect3"]').val(pensect3); gauge1.set(total1); AnimationUpdater.run(); @@ -516,11 +544,16 @@ function uploadFile() { gauge6.animationSpeed = 32; // set animation speed (32 is default value) gauge6.set(0); // set actual value - +var pensect1 = 0; + var pensect2 = 0; + var pensect3 = 0; var total1 = 0; var total2 = 0; var total3 = 0; $('input:radio:checked').each(function(){ + $cpid = $(this).data("cpid"); + $ptscp = isNaN(parseInt($(this).data("ptscp"))) ? 0 : parseInt($(this).data("ptscp")); + $('[name="points['+$cpid +']"]').val($ptscp); if (!$(this).hasClass('do-not-calc')) { if ($(this).data("sect") === 1) { total1 += isNaN(parseInt($(this).val())) ? 0 : parseInt($(this).val()); @@ -542,6 +575,18 @@ function uploadFile() { } } }); + $("input[data-sectpen='1']").each(function(){ + pensect1 += parseInt($(this).val()); + }); + $("input[data-sectpen='12']").each(function(){ + pensect2 += parseInt($(this).val()); + }); + $("input[data-sectpen='16']").each(function(){ + pensect3 += parseInt($(this).val()); + }); + $('[name="pensect1"]').val(pensect1); + $('[name="pensect2"]').val(pensect2); + $('[name="pensect3"]').val(pensect3); gauge1.set(total1); AnimationUpdater.run();