From fff00c05c4e06b8f4ffc43ef6b68888f0b4d848a Mon Sep 17 00:00:00 2001 From: nnpvaan Date: Tue, 2 Jun 2026 17:48:05 +1000 Subject: [PATCH 1/2] Allow manual volume entry for bottles widget --- ....css => bes.lims.55845b52992a0a82b4bb.css} | 0 .../bundles/bes.lims.55845b52992a0a82b4bb.js | 1 + .../bundles/bes.lims.a435ec7c6ea1d88e080c.js | 1 - src/bes/lims/browser/static/resources.pt | 2 +- .../components/sampletype_container.coffee | 26 ++++++++++++++++--- 5 files changed, 25 insertions(+), 5 deletions(-) rename src/bes/lims/browser/static/bundles/{bes.lims.a435ec7c6ea1d88e080c.css => bes.lims.55845b52992a0a82b4bb.css} (100%) create mode 100644 src/bes/lims/browser/static/bundles/bes.lims.55845b52992a0a82b4bb.js delete mode 100644 src/bes/lims/browser/static/bundles/bes.lims.a435ec7c6ea1d88e080c.js diff --git a/src/bes/lims/browser/static/bundles/bes.lims.a435ec7c6ea1d88e080c.css b/src/bes/lims/browser/static/bundles/bes.lims.55845b52992a0a82b4bb.css similarity index 100% rename from src/bes/lims/browser/static/bundles/bes.lims.a435ec7c6ea1d88e080c.css rename to src/bes/lims/browser/static/bundles/bes.lims.55845b52992a0a82b4bb.css diff --git a/src/bes/lims/browser/static/bundles/bes.lims.55845b52992a0a82b4bb.js b/src/bes/lims/browser/static/bundles/bes.lims.55845b52992a0a82b4bb.js new file mode 100644 index 0000000..a46ee4c --- /dev/null +++ b/src/bes/lims/browser/static/bundles/bes.lims.55845b52992a0a82b4bb.js @@ -0,0 +1 @@ +(()=>{"use strict";var t={669(t){t.exports=jQuery}},e={};function i(n){var o=e[n];if(void 0!==o)return o.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,i),r.exports}(()=>{var t=i(669);function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t,e){for(var i=0;i=0)for(n=0,o=(a=document.querySelectorAll(this.sample_type_selector)).length;n1&&void 0!==arguments[1]?arguments[1]:0;return e=parseFloat(t.value),isNaN(e)&&(e=parseFloat(i)),e}},{key:"round",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return Number(Math.round(t+"e"+e)+"e-"+e)}},{key:"set_visible",value:function(e,i,n){var o,r;return this.debug("set_visible:field_name=".concat(e,",sample_index=").concat(i,",visible=").concat(n)),r="div[data-fieldname='".concat(e,"']"),i&&(r="div[data-fieldname='".concat(e,"-").concat(i,"']")),"0"===i&&"1"===document.querySelector("#ar_count").value&&(r="tr[fieldname=".concat(e,"]")),o=document.querySelector(r),n?t(o).show():t(o).hide()}},{key:"fetch",value:function(e,i){var n,o;return this.debug("fetch:uid=".concat(e,",field_names=").concat(i)),n=t.Deferred(),o={url:this.get_portal_url()+"/@@API/read",data:{catalog_name:"senaite_catalog_setup",UID:e,include_fields:i,page_size:1}},this.ajax_submit(o).done(function(t){var e;return e={},t.objects&&(e=t.objects[0]),n.resolveWith(this,[e])}),n.promise()}},{key:"ajax_submit",value:function(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.debug("ajax_submit"),null==i.type&&(i.type="POST"),null==i.url&&(i.url=this.get_portal_url()),null==i.context&&(i.context=this),null==i.dataType&&(i.dataType="json"),null==i.data&&(i.data={}),null==i._authenticator&&(i._authenticator=t("input[name='_authenticator']").val()),this.debug(">>> ajax_submit::options=",i),t(this).trigger("ajax:submit:start"),e=function(){return t(this).trigger("ajax:submit:end")},t.ajax(i).done(e)}},{key:"get_portal_url",value:function(){return t("input[name=portal_url]").val()||window.portal_url}},{key:"debug",value:function(t){}},{key:"get_add_controller",value:function(){return window.bika.lims.AnalysisRequestAdd}}],i&&n(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,i}();var l=i(669);function s(t){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s(t)}function u(t,e){for(var i=0;i{"use strict";var e={669:e=>{e.exports=jQuery}},t={};function i(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,i),r.exports}(()=>{var e=i(669);function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function n(e,t){for(var i=0;i=0)for(n=0,o=(a=document.querySelectorAll(this.sample_type_selector)).length;n1&&void 0!==arguments[1]?arguments[1]:0;return t=parseFloat(e.value),isNaN(t)&&(t=parseFloat(i)),t}},{key:"round",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return Number(Math.round(e+"e"+t)+"e-"+t)}},{key:"set_visible",value:function(t,i,n){var o,r;return this.debug("set_visible:field_name=".concat(t,",sample_index=").concat(i,",visible=").concat(n)),r="div[data-fieldname='".concat(t,"']"),i&&(r="div[data-fieldname='".concat(t,"-").concat(i,"']")),"0"===i&&"1"===document.querySelector("#ar_count").value&&(r="tr[fieldname=".concat(t,"]")),o=document.querySelector(r),n?e(o).show():e(o).hide()}},{key:"fetch",value:function(t,i){var n,o;return this.debug("fetch:uid=".concat(t,",field_names=").concat(i)),n=e.Deferred(),o={url:this.get_portal_url()+"/@@API/read",data:{catalog_name:"senaite_catalog_setup",UID:t,include_fields:i,page_size:1}},this.ajax_submit(o).done((function(e){var t;return t={},e.objects&&(t=e.objects[0]),n.resolveWith(this,[t])})),n.promise()}},{key:"ajax_submit",value:function(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.debug("ajax_submit"),null==i.type&&(i.type="POST"),null==i.url&&(i.url=this.get_portal_url()),null==i.context&&(i.context=this),null==i.dataType&&(i.dataType="json"),null==i.data&&(i.data={}),null==i._authenticator&&(i._authenticator=e("input[name='_authenticator']").val()),this.debug(">>> ajax_submit::options=",i),e(this).trigger("ajax:submit:start"),t=function(){return e(this).trigger("ajax:submit:end")},e.ajax(i).done(t)}},{key:"get_portal_url",value:function(){return e("input[name=portal_url]").val()||window.portal_url}},{key:"debug",value:function(e){}},{key:"get_add_controller",value:function(){return window.bika.lims.AnalysisRequestAdd}}],i&&n(t.prototype,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,i}();var l=i(669);function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function u(e,t){for(var i=0;i \ No newline at end of file + \ No newline at end of file diff --git a/webpack/app/components/sampletype_container.coffee b/webpack/app/components/sampletype_container.coffee index 1b99ee6..211a7ba 100644 --- a/webpack/app/components/sampletype_container.coffee +++ b/webpack/app/components/sampletype_container.coffee @@ -38,7 +38,10 @@ class SampleTypeContainerController bottles = document.querySelector("div[data-fieldname='Bottles']") if bottles el = document.querySelector "input[id='Volume']" - el.setAttribute("readonly", "readonly") + if el and @uses_automatic_bottle_volume() + el.setAttribute("readonly", "readonly") + else if el + el.removeAttribute "readonly" return @ @@ -116,6 +119,8 @@ class SampleTypeContainerController # Get the index of the column (each column represents a Sample) sample_idx = @get_sample_index el + return unless @uses_automatic_bottle_volume sample_idx + # Recalculate the volume of the bottles and sample @calculate_volume sample_idx @@ -131,6 +136,8 @@ class SampleTypeContainerController # Get the index of the column (each column represents a Sample) sample_idx = @get_sample_index el + return unless @uses_automatic_bottle_volume sample_idx + # Recalculate the volume of the bottles and sample @calculate_volume sample_idx @@ -187,9 +194,10 @@ class SampleTypeContainerController @toggle_container_visibility sample_index, show_container # Enable/Disable Volume depending on the visibility of Container - @set_volume_readonly sample_index, not show_container + automatic_volume = not show_container and @uses_automatic_bottle_volume sample_index + @set_volume_readonly sample_index, automatic_volume - if not show_container + if automatic_volume # Volume field is calculated automatically @calculate_volume sample_index @@ -204,6 +212,17 @@ class SampleTypeContainerController @set_visible "Bottles", sample_index, not show_container + ### + Returns whether bottle volume is auto-calculated for the current sample + ### + uses_automatic_bottle_volume: (sample_index) => + selector = "#Bottles-Volume-0" + if sample_index + selector = "#Bottles-#{ sample_index }-Volume-0" + el = document.querySelector selector + return false unless el + return el.hasAttribute "readonly" + ### Sets the readonly mode of the Volume field ### @@ -224,6 +243,7 @@ class SampleTypeContainerController ### calculate_volume: (sample_index) => @debug "calculate_volume:sample_index=#{ sample_index }" + return unless @uses_automatic_bottle_volume sample_index total_volume = 0 # Walk-through all record rows from Bottles Widget From c76b29e4dd3a3a04ac40f394031759990eda5581 Mon Sep 17 00:00:00 2001 From: nnpvaan Date: Tue, 2 Jun 2026 18:27:38 +1000 Subject: [PATCH 2/2] Changelog --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index f2176e1..ad57afe 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,7 @@ Changelog 1.0.0 ----- +- #151 Allow manual volume entry for bottles widget - #136 Add ProfileAnalyses column to Analysis Profiles listing - #148 Only send verified or published analyses to Tamanu - #142 Replace Tamanu tasks queue PersistentList with OOBTree