From 8e868a6109ed892892158f428bf3e5449f440286 Mon Sep 17 00:00:00 2001 From: Cassidy Symons Date: Thu, 12 Jan 2023 12:31:05 -0800 Subject: [PATCH 01/85] Initial commit for testing --- microsetta_interface/templates/kits.jinja2 | 1 + 1 file changed, 1 insertion(+) diff --git a/microsetta_interface/templates/kits.jinja2 b/microsetta_interface/templates/kits.jinja2 index e114077e..52274de7 100644 --- a/microsetta_interface/templates/kits.jinja2 +++ b/microsetta_interface/templates/kits.jinja2 @@ -173,4 +173,5 @@ + {% endblock %} From a47ac23d232014c3f095f35d7b593e518182779b Mon Sep 17 00:00:00 2001 From: Cassidy Symons Date: Tue, 17 Jan 2023 11:22:34 -0800 Subject: [PATCH 02/85] Survey & consent adjustments --- microsetta_interface/implementation.py | 56 +-- .../static/css/minimal_interface.css | 110 +++++- .../static/img/survey_allergies.svg | 4 + .../static/img/survey_at_home.svg | 5 + .../static/img/survey_basic_information.svg | 9 + .../static/img/survey_covid_19.svg | 14 + .../static/img/survey_detailed_diet.svg | 11 + .../static/img/survey_diet.svg | 6 + .../static/img/survey_external.svg | 5 + .../static/img/survey_external_taken.svg | 5 + .../static/img/survey_general_health.svg | 4 + .../static/img/survey_gut.svg | 3 + .../static/img/survey_health_diagnosis.svg | 4 + .../static/img/survey_lifestyle.svg | 4 + .../static/img/survey_other.svg | 6 + .../static/vue_survey_form.js | 136 ++++--- .../templates/account_details.jinja2 | 26 +- .../templates/account_overview.jinja2 | 2 +- .../templates/new_participant.jinja2 | 337 ++++++++---------- microsetta_interface/templates/source.jinja2 | 101 ++++-- microsetta_interface/templates/survey.jinja2 | 47 ++- 21 files changed, 573 insertions(+), 322 deletions(-) create mode 100644 microsetta_interface/static/img/survey_allergies.svg create mode 100644 microsetta_interface/static/img/survey_at_home.svg create mode 100644 microsetta_interface/static/img/survey_basic_information.svg create mode 100644 microsetta_interface/static/img/survey_covid_19.svg create mode 100644 microsetta_interface/static/img/survey_detailed_diet.svg create mode 100644 microsetta_interface/static/img/survey_diet.svg create mode 100644 microsetta_interface/static/img/survey_external.svg create mode 100644 microsetta_interface/static/img/survey_external_taken.svg create mode 100644 microsetta_interface/static/img/survey_general_health.svg create mode 100644 microsetta_interface/static/img/survey_gut.svg create mode 100644 microsetta_interface/static/img/survey_health_diagnosis.svg create mode 100644 microsetta_interface/static/img/survey_lifestyle.svg create mode 100644 microsetta_interface/static/img/survey_other.svg diff --git a/microsetta_interface/implementation.py b/microsetta_interface/implementation.py index d231f65f..c8da33f2 100644 --- a/microsetta_interface/implementation.py +++ b/microsetta_interface/implementation.py @@ -120,102 +120,102 @@ class Source: BASIC_INFO_ID: { 'description': '', 'est_minutes': '2', - 'icon': 'survey_basic_information.png' + 'icon': 'survey_basic_information.svg' }, AT_HOME_ID: { 'description': '', 'est_minutes': '2', - 'icon': 'survey_at_home.png' + 'icon': 'survey_at_home.svg' }, LIFESTYLE_ID: { 'description': '', 'est_minutes': '8', - 'icon': 'survey_lifestyle.png' + 'icon': 'survey_lifestyle.svg' }, GUT_ID: { 'description': '', 'est_minutes': '4', - 'icon': 'survey_gut.png' + 'icon': 'survey_gut.svg' }, GENERAL_HEALTH_ID: { 'description': '', 'est_minutes': '5', - 'icon': 'survey_general_health.png' + 'icon': 'survey_general_health.svg' }, HEALTH_DIAG_ID: { 'description': '', 'est_minutes': '8', - 'icon': 'survey_health_diagnosis.png' + 'icon': 'survey_health_diagnosis.svg' }, ALLERGIES_ID: { 'description': '', 'est_minutes': '2', - 'icon': 'survey_allergies.png' + 'icon': 'survey_allergies.svg' }, DIET_ID: { 'description': '', 'est_minutes': '5', - 'icon': 'survey_diet.png' + 'icon': 'survey_diet.svg' }, DETAILED_DIET_ID: { 'description': '', 'est_minutes': '18', - 'icon': 'survey_detailed_diet.png' + 'icon': 'survey_detailed_diet.svg' }, MIGRAINE_ID: { 'description': '', 'est_minutes': '', - 'icon': 'survey_external.png' + 'icon': 'survey_external.svg' }, SURFERS_ID: { 'description': '', 'est_minutes': '', - 'icon': 'survey_external.png' + 'icon': 'survey_external.svg' }, COVID19_ID: { 'description': '', 'est_minutes': '8', - 'icon': 'survey_covid_19.png' + 'icon': 'survey_covid_19.svg' }, OTHER_ID: { 'description': '', 'est_minutes': '2', - 'icon': 'survey_other.png' + 'icon': 'survey_other.svg' }, 1: { 'description': 'The general questionnaire for Microsetta', 'est_minutes': '10', - 'icon': 'survey_external.png' + 'icon': 'survey_external.svg' }, 3: { 'description': 'A fermented foods specific questionnaire', 'est_minutes': '4', - 'icon': 'survey_external.png' + 'icon': 'survey_external.svg' }, 4: { 'description': 'Questions on surfing behavior', 'est_minutes': '5', - 'icon': 'survey_external.png' + 'icon': 'survey_external.svg' }, 5: { 'description': 'Questions about your interest in the microbiome', 'est_minutes': '3', - 'icon': 'survey_external.png' + 'icon': 'survey_external.svg' }, 6: { 'description': 'Questions specific to COVID19', 'est_minutes': '2', - 'icon': 'survey_external.png' + 'icon': 'survey_external.svg' }, 7: { 'description': 'Questions related to cooking oils and oxalate-rich foods', 'est_minutes': '5', - 'icon': 'survey_external.png' + 'icon': 'survey_external.svg' }, VIOSCREEN_ID: { 'description': 'Our standard food frequency questionnaire', 'est_minutes': '30', - 'icon': 'survey_external.png' + 'icon': 'survey_external.svg' }, MYFOODREPO_ID: { 'description': 'Only for US Participants:
' @@ -235,7 +235,7 @@ class Source: 'to use it immediately. You will have two weeks' ' to use the app before your access expires.', 'est_minutes': 'N/A', - 'icon': 'survey_external.png' + 'icon': 'survey_external.svg' }, POLYPHENOL_FFQ_ID: { 'description': 'Polyphenols are chemical compounds naturally found in ' @@ -245,8 +245,8 @@ class Source: ' benefits by interacting with the microbes in your ' 'gut. This survey will allow us to better quantify ' 'your consumption of polyphenols through your diet.', - 'est_minutes': '20', - 'icon': 'survey_external.png' + 'est_minutes': '30', + 'icon': 'survey_external.svg' }, SPAIN_FFQ_ID: { 'description': 'Only for participants in Spain:
' @@ -255,7 +255,7 @@ class Source: 'beverages. The questionnaire consists of 28 questions, and ' 'will allow us to find out what your usual diet is like.', 'est_minutes': '30', - 'icon': 'survey_external.png' + 'icon': 'survey_external.svg' }, } LOCAL_SURVEY_SEQUENCE = [ @@ -1133,6 +1133,13 @@ def get_fill_source_survey(*, else: next_survey = None + # Add "skip" link to the field labels + for group in survey_output['survey_template_text']['groups']: + for field in group['fields']: + field['label'] = '' + gettext('SKIP')\ + + '' + field['label'] + return _render_with_defaults("survey.jinja2", account_id=account_id, source_id=source_id, @@ -1406,6 +1413,7 @@ def get_source(*, account_id=None, source_id=None): if has_error: return survey_output + template['date_last_taken'] = survey_output['date_last_taken'] if survey_output['percentage_completed'] == 0.0: template['answered'] = 2 else: diff --git a/microsetta_interface/static/css/minimal_interface.css b/microsetta_interface/static/css/minimal_interface.css index ed4b764f..c832ad18 100644 --- a/microsetta_interface/static/css/minimal_interface.css +++ b/microsetta_interface/static/css/minimal_interface.css @@ -37,6 +37,15 @@ html * { padding: 0px; } +body { + position: relative; + min-height: 100vh; +} + +div.content { + padding-bottom: 56px; +} + a { color: #00f; } @@ -62,6 +71,9 @@ label.tmi-content { .tmi-footer { background-color: var(--tmi-dark-blue); width: 100%; + position: absolute; + bottom: 0; + height: 56px; } .tmi-footer a { @@ -128,6 +140,15 @@ a.breadcrumb-item-profile { color: #ffffff; } +.btn-blue-gradient[disabled] { + background: var(--tmi-gray-80); + border-radius: 50px; + font-weight: 700; + font-size: 14px; + line-height: 22px; + color: #ffffff; +} + .btn-blue-gradient:hover { color: #e7e7e7; } @@ -307,6 +328,11 @@ p.tmi-content { background-color: white; } +.card-survey-external { + height: 214px; + background-color: white; +} + .card-profile-icon { background-color: #ffffff; border-radius: 50%; @@ -333,6 +359,26 @@ p.tmi-content { margin: 35px 35px; } +.card-survey-icon-external { + background-color: #ffffff; + width: 90px; + margin: auto; +} + +.card-survey-new { + color: var(--tmi-orange); + font-size: 14px; + line-height: 24px; + font-weight: 900; +} + +.card-survey-completed { + color: var(--tmi-blue); + font-size: 14px; + line-height: 24px; + font-weight: 900; +} + .breadcrumb { padding-left: 30px; } @@ -397,10 +443,51 @@ h1.profile-h1 { color: var(--tmi-blue); } +.survey-title-taken { + font-weight: 700; + font-size: 18px; + line-height: 24px; + text-decoration: none; + color: var(--tmi-gray-80); +} + .survey-info { color: var(--tmi-gray-80); } +.modal-header { + justify-content: flex-start !important; + border-bottom: 0px !important; + padding-bottom: 0px !important; +} + +span.survey-title { + margin-left: 8px; +} + +.survey-description { + font-size: 16px; + line-height: 26px; + color: var(--tmi-gray-90); + margin-left: 12px; + margin-right: 12px; +} + +.survey-warning { + font-size: 16px; + line-height: 26px; + color: var(--tmi-orange); + font-style: italic; + font-weight: 700; + margin-left: 12px; + margin-right: 12px; +} + +.modal-footer { + padding-top: 0px !important; + border-top: 0px !important; +} + .plus-button-wrapper { height: 52px; width: fit-content; @@ -445,6 +532,8 @@ h1.profile-h1 { } p.tmi-tooltip { + font-size: 16px; + line-height: 26px; color: var(--tmi-gray-80); } @@ -499,9 +588,14 @@ li.active-profile { line-height: 20px !important; } +.tmi-survey-radio-vertical > .field-wrap > .radio-list > label { + padding-top: 8px; +} + .tmi-survey-radio-horizontal > .field-wrap > .radio-list > label { display: inline !important; - padding-right: 15px; + padding-right: 16px; + padding-top: 8px; } .tmi-survey-radio-switch > .field-wrap { @@ -611,6 +705,10 @@ li.active-profile { padding: 0px; } +.tmi-survey-checkbox > .field-wrap > .wrapper > .form-control > .list-row { + padding-top: 8px; +} + .tmi-survey-radio-buttons > .field-wrap { padding-top: 5px; } @@ -668,4 +766,12 @@ li.active-profile { .tmi-survey-text-small > .field-wrap > .wrapper > input { width: 50px; -} \ No newline at end of file +} + +select.form-control { + appearance: menulist !important; +} + +.form-group > label > span { + display: block !important; +} diff --git a/microsetta_interface/static/img/survey_allergies.svg b/microsetta_interface/static/img/survey_allergies.svg new file mode 100644 index 00000000..cf7a7646 --- /dev/null +++ b/microsetta_interface/static/img/survey_allergies.svg @@ -0,0 +1,4 @@ + + + + diff --git a/microsetta_interface/static/img/survey_at_home.svg b/microsetta_interface/static/img/survey_at_home.svg new file mode 100644 index 00000000..de5282dd --- /dev/null +++ b/microsetta_interface/static/img/survey_at_home.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/microsetta_interface/static/img/survey_basic_information.svg b/microsetta_interface/static/img/survey_basic_information.svg new file mode 100644 index 00000000..64e12fca --- /dev/null +++ b/microsetta_interface/static/img/survey_basic_information.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/microsetta_interface/static/img/survey_covid_19.svg b/microsetta_interface/static/img/survey_covid_19.svg new file mode 100644 index 00000000..e1af11ca --- /dev/null +++ b/microsetta_interface/static/img/survey_covid_19.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/microsetta_interface/static/img/survey_detailed_diet.svg b/microsetta_interface/static/img/survey_detailed_diet.svg new file mode 100644 index 00000000..12ba1369 --- /dev/null +++ b/microsetta_interface/static/img/survey_detailed_diet.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/microsetta_interface/static/img/survey_diet.svg b/microsetta_interface/static/img/survey_diet.svg new file mode 100644 index 00000000..26856981 --- /dev/null +++ b/microsetta_interface/static/img/survey_diet.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/microsetta_interface/static/img/survey_external.svg b/microsetta_interface/static/img/survey_external.svg new file mode 100644 index 00000000..5bc13720 --- /dev/null +++ b/microsetta_interface/static/img/survey_external.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/microsetta_interface/static/img/survey_external_taken.svg b/microsetta_interface/static/img/survey_external_taken.svg new file mode 100644 index 00000000..8eddd7b6 --- /dev/null +++ b/microsetta_interface/static/img/survey_external_taken.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/microsetta_interface/static/img/survey_general_health.svg b/microsetta_interface/static/img/survey_general_health.svg new file mode 100644 index 00000000..cd61503d --- /dev/null +++ b/microsetta_interface/static/img/survey_general_health.svg @@ -0,0 +1,4 @@ + + + + diff --git a/microsetta_interface/static/img/survey_gut.svg b/microsetta_interface/static/img/survey_gut.svg new file mode 100644 index 00000000..07ed8566 --- /dev/null +++ b/microsetta_interface/static/img/survey_gut.svg @@ -0,0 +1,3 @@ + + + diff --git a/microsetta_interface/static/img/survey_health_diagnosis.svg b/microsetta_interface/static/img/survey_health_diagnosis.svg new file mode 100644 index 00000000..bd0a85f1 --- /dev/null +++ b/microsetta_interface/static/img/survey_health_diagnosis.svg @@ -0,0 +1,4 @@ + + + + diff --git a/microsetta_interface/static/img/survey_lifestyle.svg b/microsetta_interface/static/img/survey_lifestyle.svg new file mode 100644 index 00000000..db27b357 --- /dev/null +++ b/microsetta_interface/static/img/survey_lifestyle.svg @@ -0,0 +1,4 @@ + + + + diff --git a/microsetta_interface/static/img/survey_other.svg b/microsetta_interface/static/img/survey_other.svg new file mode 100644 index 00000000..b62b7adc --- /dev/null +++ b/microsetta_interface/static/img/survey_other.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/microsetta_interface/static/vue_survey_form.js b/microsetta_interface/static/vue_survey_form.js index e6c4863b..44997a46 100644 --- a/microsetta_interface/static/vue_survey_form.js +++ b/microsetta_interface/static/vue_survey_form.js @@ -53,27 +53,35 @@ var vm = new Vue({ mounted() { addSkipLinks(); }, - updated() { - //console.log("Update!") - //const fieldArray = this.$el.querySelectorAll('.vue-form-generator .form-group'); - //fieldArray.forEach(addSkipLink); - } }); -function skipQuestion(ele) { +function skipQuestion(ele, skipType="user-input") { // TODO: On skip, make sure triggered questions switch to Unspecified/skipped + + var group; + var labelElement; let newState = ''; - if(ele.innerHTML == 'SKIP') { - newState = 'skip'; - ele.innerHTML = 'DISPLAY'; + if(skipType == "user-input") { + if(ele.innerHTML == 'SKIP') { + newState = 'skip'; + ele.innerHTML = 'DISPLAY'; + } else { + newState = 'display'; + ele.innerHTML = 'SKIP'; + } + + const spanElement = ele.parentElement; + labelElement = spanElement.parentElement; + group = labelElement.parentElement; } else { - newState = 'display'; - ele.innerHTML = 'SKIP'; + labelElement = ele; + const spanElement = ele.children[0]; + const skipSpanElement = spanElement.children[0]; + skipSpanElement.innerHTML = 'DISPLAY'; + group = ele.parentElement; + newState = 'skip'; } - - const labelElement = ele.parentElement; - const group = labelElement.parentElement; if(group.classList.contains("field-radios")) { for (let i = 0; i < group.childNodes.length; i++) { let theNode = group.childNodes[i]; @@ -114,7 +122,6 @@ function skipQuestion(ele) { for(let j = 0; j < listbox.children.length; j++) { let listRow = listbox.children[j]; let checkboxLabelElement = listRow.children[0]; - console.log(checkboxLabelElement); if(checkboxLabelElement.innerText == "Unspecified") { for(let k = 0; k < checkboxLabelElement.children.length; k++) { if(checkboxLabelElement.children[k].nodeName == "INPUT") { @@ -141,35 +148,64 @@ function skipQuestion(ele) { } } } - } else { + } else if(group.classList.contains("field-input") ) { for (let i = 0; i < group.childNodes.length; i++) { let theNode = group.childNodes[i]; if (theNode.nodeName == "DIV" && theNode.classList.contains("field-wrap")) { - theNode.classList.toggle("hide"); - // TODO - ADD OTHER FIELD TYPES + let wrapper = theNode.children[0]; + let inputElement = wrapper.children[0]; - // When we hide a question, we also set the response to Unspecified - let radioList = theNode.children[0]; - for(let j = 0; j < radioList.children.length; j++) { - if(radioList.children[j].innerText == "Unspecified") { - let unspecifiedElement = radioList.children[j]; - for(let k = 0; k < unspecifiedElement.children.length; k++) { - if(unspecifiedElement.children[k].nodeName == "INPUT") { - if(unspecifiedElement.children[k].checked) { - unspecifiedElement.children[k].checked = false; - vm.methodToUpdate(unspecifiedElement.children[k].name, false, false) - } else { - unspecifiedElement.children[k].checked = true; - vm.methodToUpdate(unspecifiedElement.children[k].name, true, false) - } - unspecifiedElement.classList.toggle("is-checked"); - } - } - } + console.log("skipping text field"); + + if(newState == "display") { + theNode.style.display = ""; + inputElement.value = ""; + vm.methodToUpdate(inputElement.name, false, false); + } else { + theNode.style.display = "none"; + inputElement.value = "Unspecified"; + vm.methodToUpdate(inputElement.name, true, false); + } + } + } + } else if(group.classList.contains("field-textArea")) { + for (let i = 0; i < group.childNodes.length; i++) { + let theNode = group.childNodes[i]; + if (theNode.nodeName == "DIV" && theNode.classList.contains("field-wrap")) { + console.log(theNode); + let inputElement = theNode.children[0]; + + if(newState == "display") { + inputElement.innerText = ""; + vm.methodToUpdate(inputElement.name, false, false); + } else { + theNode.style.display = "none"; + inputElement.innerText = "Unspecified"; + vm.methodToUpdate(inputElement.name, true, false); } + } + } + } else if(group.classList.contains("field-select")) { + for(let i = 0; i < group.childNodes.length; i++) { + let theNode = group.childNodes[i]; + if (theNode.nodeName == "DIV" && theNode.classList.contains("field-wrap")) { + console.log(theNode); + let inputElement = theNode.children[0]; + if(newState == "display") { + theNode.style.display = ""; + inputElement.selectedIndex = -1; + vm.methodToUpdate(inputElement.name, false, false); + } else { + theNode.style.display = "none"; + inputElement.selectedIndex = 0; + console.log(inputElement.options[inputElement.selectedIndex].value); + vm.methodToUpdate(inputElement.name, true, false); + } } } + } else { + // Why am I here? } } @@ -191,20 +227,6 @@ function addSkipLinks() { } function addSkipLink(element) { - // TODO: Figure out why it's only sometimes adding to the triggered questions - - // We don't want to provide the option of skipping the submit button - if(!element.classList.contains("field-submit")) { - for(let i = 0; i < element.children.length; i++) { - if(element.children[i].nodeName == "LABEL") { - let labelElement = element.children[i]; - if(!labelElement.innerHTML.includes("survey-skip")) { - labelElement.innerHTML = 'SKIP' + labelElement.innerHTML; - } - } - } - } - // We're going to hide "Unspecified" from view for all radio button groups if(element.classList.contains("field-radios")) { for(let i = 0; i < element.children.length; i++) { @@ -243,6 +265,20 @@ function addSkipLink(element) { } } } + + if(element.classList.contains("field-select")) { + for(let i = 0; i < element.children.length; i++) { + if(element.children[i].classList.contains("field-wrap")) { + let fieldWrap = element.children[i]; + let selectElement = fieldWrap.children[0]; + for(let j = 0; j < selectElement.children.length; j++) { + if(selectElement.children[j].value == "Unspecified") { + selectElement.children[j].hidden = "true"; + } + } + } + } + } } // This CANNOT be done in $(document).ready() on the page containing the vue form because diff --git a/microsetta_interface/templates/account_details.jinja2 b/microsetta_interface/templates/account_details.jinja2 index f4f9d724..cd505a62 100644 --- a/microsetta_interface/templates/account_details.jinja2 +++ b/microsetta_interface/templates/account_details.jinja2 @@ -13,7 +13,6 @@ let form_name = 'acct_form'; preventImplicitSubmission(form_name); - // Initialize form validation on the registration form. // It has the name attribute "registration" $("form[name='" + form_name + "']").validate({ @@ -40,9 +39,28 @@ }, messages: { consent_privacy_terms: "{{ _('Please agree to the Privacy Statement and Terms and Conditions') }}", + }, + }); + + /* + UNCOMMENT TO DISABLE SUBMIT BUTTON UNTIL FORM IS VALID + var $form = $("#acct_form"); + var $submit_button = $("#submit_button"); + $form.on("blur keyup change", "input", () => { + if ($form.valid()) { + $submit_button.removeAttr("disabled"); + } else { + $submit_button.attr("disabled", "disabled"); } }); + ADD TO above validate() to hide errors when submit button is disabled until valid + showErrors: function(errorMap, errorList) { + // do nothing + }, + + */ + // Link Handlers // In our test databases, state sometimes has line breaks, so // more complex parsing becomes necessary @@ -103,8 +121,6 @@ } },cc); }); - - {% endblock %} {% block breadcrumb %} @@ -384,9 +400,9 @@ {% endif %}
{% if CREATE_ACCT %} - + {% else %} - + {% endif %}
diff --git a/microsetta_interface/templates/account_overview.jinja2 b/microsetta_interface/templates/account_overview.jinja2 index cae1d302..f82f8fa3 100644 --- a/microsetta_interface/templates/account_overview.jinja2 +++ b/microsetta_interface/templates/account_overview.jinja2 @@ -51,7 +51,7 @@
{% for source in sources %} -
+

{{ source.source_name|e}}

diff --git a/microsetta_interface/templates/new_participant.jinja2 b/microsetta_interface/templates/new_participant.jinja2 index a8f11f18..133b17b2 100644 --- a/microsetta_interface/templates/new_participant.jinja2 +++ b/microsetta_interface/templates/new_participant.jinja2 @@ -7,89 +7,6 @@ @@ -194,13 +189,6 @@ {% block content%} -{# - NOTE on 2022-08-30 - We're intentionally hiding the under-18 consent options from all non-English users for the time being. - The only Spanish-speaking users who should be using this system are THDMI Spain participants, which is only open to adults. - As such, a conscious decision was made to not use the resources to translate and implement the under-18 consent/assent documents. -#} -
@@ -209,14 +197,12 @@
- {% if language_tag == "en_US" %} - {% endif %}
@@ -250,7 +236,8 @@
@@ -261,6 +248,7 @@
+
@@ -271,26 +259,7 @@
-
-
-
-
- -
-
- -
-
-
-
- -
-
- +
@@ -328,7 +297,8 @@
@@ -339,6 +309,7 @@
+
@@ -348,7 +319,8 @@
@@ -359,6 +331,7 @@
+
@@ -380,7 +353,8 @@
@@ -391,26 +365,7 @@
-
-
-
-
- -
-
- -
-
-
-
- -
-
- +
@@ -425,7 +380,7 @@
-
+ @@ -482,7 +439,8 @@
@@ -493,26 +451,7 @@
-
-
-
-
- -
-
- -
-
-
-
- -
-
- +
@@ -528,8 +467,8 @@
+
- +
diff --git a/microsetta_interface/templates/source.jinja2 b/microsetta_interface/templates/source.jinja2 index 77e49ba1..5ffb990f 100644 --- a/microsetta_interface/templates/source.jinja2 +++ b/microsetta_interface/templates/source.jinja2 @@ -16,6 +16,24 @@ } + {% endblock %} {% block breadcrumb %} @@ -25,10 +43,10 @@ {% block content %}

-

+

The Microsetta Initiative aims to generate quality data that can help you better understand your microbiome, help scientists design better studies, and improve the world's understanding of the human microbiome.

-

+

Answering our surveys can help us do just that. To get started, build out your profile by answering the surveys below. We will alert you when new surveys become available.

@@ -36,8 +54,12 @@
-
Last modified Jun 4, 2022
-
{{ detail.est_minutes }} min
+ {% if detail.date_last_taken != None %} +
{{ _('Last modified') }} {{ detail.date_last_taken }}
+ {% else %} +
{{ _('NEW') }}
+ {% endif %} +
{{ detail.est_minutes }} {{ _('minutes') }}
{% if detail.answered < 360 %}
@@ -66,41 +88,66 @@
{% endfor %}
-
+

+ Below are surveys hosted by partner organizations. You will be directed to an external site in a new browser tab to complete the survey(s) you select. Once you complete them, you may close the tab and return to this page. +

+
{% for detail in remote_surveys %}
-
+
-
Last modified Jun 4, 2022
-
2 min
+ {% if detail.answered %} +
{{ _('COMPLETED') }}
+ {% else %} +
{{ _('NEW') }}
+ {% endif %} +
{{ detail.est_minutes }} {{ _('min') }}
- {% if detail.answered %} -
- - {% else %} -
- {% endif %} -
- {% if detail.answered == False %} - - {% endif %} - - {% if detail.answered == False %} - - {% endif %} -
+
+ {% if detail.answered == False %} + + + + {% else %} + + {% endif %} + {% if detail.answered == False %} + + {% endif %}
+
{% if detail.answered == False %} - - {% endif %} - {{ detail.survey_template_title|e }} - {% if detail.answered == False %} + + {{ detail.survey_template_title|e }} + {% else %} + {{ detail.survey_template_title|e }} {% endif %} +
{% endfor %}
+ + + {% endblock %} diff --git a/microsetta_interface/templates/survey.jinja2 b/microsetta_interface/templates/survey.jinja2 index 19ca0b35..d8b1704c 100644 --- a/microsetta_interface/templates/survey.jinja2 +++ b/microsetta_interface/templates/survey.jinja2 @@ -110,8 +110,18 @@ background-color: #e7e7e7 !important; } +.tmi-survey-button-white-noborder > .field-wrap > input { + background: #ffffff !important; + border-radius: 50px !important; + border: 0px !important; + font-weight: 700 !important; + font-size: 14px !important; + line-height: 22px !important; + color: var(--tmi-blue) !important; +} + .tmi-survey-centered > .field-wrap > input { - margin: auto !important; + margin-left: auto !important; } {% endblock %} {% block breadcrumb %} @@ -208,7 +209,7 @@
- +
@@ -234,6 +235,7 @@ {% endblock %} From ad62ec357a9579752be194b5cf4b7d61ba2a3e40 Mon Sep 17 00:00:00 2001 From: Cassidy Symons Date: Tue, 17 Jan 2023 11:55:39 -0800 Subject: [PATCH 03/85] Survey fix --- microsetta_interface/static/vue_survey_form.js | 1 + 1 file changed, 1 insertion(+) diff --git a/microsetta_interface/static/vue_survey_form.js b/microsetta_interface/static/vue_survey_form.js index 44997a46..492bebc1 100644 --- a/microsetta_interface/static/vue_survey_form.js +++ b/microsetta_interface/static/vue_survey_form.js @@ -176,6 +176,7 @@ function skipQuestion(ele, skipType="user-input") { let inputElement = theNode.children[0]; if(newState == "display") { + theNode.style.display = ""; inputElement.innerText = ""; vm.methodToUpdate(inputElement.name, false, false); } else { From 02b64385d55d6a709ca3b6bbf9a735f1ba2c67d0 Mon Sep 17 00:00:00 2001 From: Cassidy Symons Date: Tue, 17 Jan 2023 17:43:39 -0800 Subject: [PATCH 04/85] Survey question numbering --- microsetta_interface/implementation.py | 14 ++++++++++++-- .../templates/account_details.jinja2 | 19 ------------------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/microsetta_interface/implementation.py b/microsetta_interface/implementation.py index c8da33f2..81bd1223 100644 --- a/microsetta_interface/implementation.py +++ b/microsetta_interface/implementation.py @@ -13,6 +13,7 @@ from datetime import datetime import base64 import functools +from string import ascii_lowercase from microsetta_interface.model_i18n import translate_source, \ translate_sample, translate_survey_template, EN_US_KEY, LANGUAGES, \ ES_MX_KEY, ES_ES_KEY, JA_JP_KEY @@ -1091,8 +1092,6 @@ def get_fill_source_survey(*, # this is remote, so go to an external url, not our jinja2 template return redirect(survey_output['survey_template_text']['url']) else: - survey_question_count = \ - len(survey_output['survey_template_text']['groups'][0]['fields']) survey_icon = SURVEY_INFO.get(survey_template_id)['icon'] survey_est_minutes = SURVEY_INFO.get(survey_template_id)['est_minutes'] @@ -1133,9 +1132,20 @@ def get_fill_source_survey(*, else: next_survey = None + survey_question_count = 0 # Add "skip" link to the field labels for group in survey_output['survey_template_text']['groups']: + ctr = 0 for field in group['fields']: + if "triggered_by" in field: + field['label'] = str(ctr) + ascii_lowercase[trig_ctr]\ + + ". " + field['label'] + trig_ctr += 1 + else: + trig_ctr = 0 + ctr += 1 + survey_question_count += 1 + field['label'] = str(ctr) + ". " + field['label'] field['label'] = '' + gettext('SKIP')\ + '' + field['label'] diff --git a/microsetta_interface/templates/account_details.jinja2 b/microsetta_interface/templates/account_details.jinja2 index cd505a62..8b2263fe 100644 --- a/microsetta_interface/templates/account_details.jinja2 +++ b/microsetta_interface/templates/account_details.jinja2 @@ -42,25 +42,6 @@ }, }); - /* - UNCOMMENT TO DISABLE SUBMIT BUTTON UNTIL FORM IS VALID - var $form = $("#acct_form"); - var $submit_button = $("#submit_button"); - $form.on("blur keyup change", "input", () => { - if ($form.valid()) { - $submit_button.removeAttr("disabled"); - } else { - $submit_button.attr("disabled", "disabled"); - } - }); - - ADD TO above validate() to hide errors when submit button is disabled until valid - showErrors: function(errorMap, errorList) { - // do nothing - }, - - */ - // Link Handlers // In our test databases, state sometimes has line breaks, so // more complex parsing becomes necessary From cd768c106cee31f3f4befba219c4447df07ceace Mon Sep 17 00:00:00 2001 From: Cassidy Symons Date: Thu, 19 Jan 2023 15:09:13 -0800 Subject: [PATCH 05/85] Initial kit testing --- microsetta_interface/implementation.py | 128 ++++++++------- microsetta_interface/routes.yaml | 9 +- .../static/css/minimal_interface.css | 111 +++++++++++++ microsetta_interface/static/img/edit.svg | 3 + .../static/img/question_mark.svg | 10 ++ microsetta_interface/static/img/tube_icon.svg | 4 + microsetta_interface/templates/kits.jinja2 | 120 +++++++++++--- .../templates/new_participant.jinja2 | 27 +++- microsetta_interface/templates/sample.jinja2 | 151 +++++++++--------- 9 files changed, 404 insertions(+), 159 deletions(-) create mode 100644 microsetta_interface/static/img/edit.svg create mode 100644 microsetta_interface/static/img/question_mark.svg create mode 100644 microsetta_interface/static/img/tube_icon.svg diff --git a/microsetta_interface/implementation.py b/microsetta_interface/implementation.py index 81bd1223..ef52d7ad 100644 --- a/microsetta_interface/implementation.py +++ b/microsetta_interface/implementation.py @@ -608,8 +608,9 @@ def _refresh_state_and_route_to_sink(account_id=None, source_id=None): def _get_kit(kit_name): unable_to_validate_msg = gettext( - "Unable to validate the kit name; please " - "reload the page.") + "Your KitID is not in our system or has already been used, please "\ + "try again!" + ) error_msg = None response = None @@ -627,8 +628,8 @@ def _get_kit(kit_name): if response.status_code == 404: error_msg = \ gettext( - "The provided kit id is not valid or has " - "already been used; please re-check your entry." + "Your KitID is not in our system or has already been "\ + "used, please try again!" ) elif response.status_code > 200: error_msg = unable_to_validate_msg @@ -984,7 +985,10 @@ def get_consent_page(*, account_id=None): form_type=form_type, reconsent=reconsent, language_tag=session_locale(), - account_id=account_id) + account_id=account_id, + participant_name = None, + age_range = None + ) @prerequisite([ACCT_PREREQS_MET]) @@ -1039,7 +1043,6 @@ def post_create_human_source(*, account_id=None, body=None): return _refresh_state_and_route_to_sink(account_id, new_source_id) else: - source_id = session['source_id'] consent_type = "biospecimen" @@ -1051,7 +1054,11 @@ def post_create_human_source(*, account_id=None, body=None): return consent_output session.pop("source_id") - return _refresh_state_and_route_to_sink(account_id, source_id) + return post_claim_samples( + account_id=account_id, + source_id=source_id, + sample_ids=body['sample_ids'] + ) @prerequisite([ACCT_PREREQS_MET]) @@ -1297,15 +1304,20 @@ def top_food_report_pdf(*, return response -def render_consent_page(account_id, form_type): +def render_consent_page(account_id, source_id, form_type, sample_ids=None): endpoint = SERVER_CONFIG["endpoint"] + relative_post_url = _make_acct_path(account_id, suffix="create_human_source") + post_url = endpoint + relative_post_url + duplicate_source_check = endpoint + "/accounts/{0}/" \ "check_duplicate_source" \ .format(account_id) + home_url = endpoint + "/accounts/{}".format(account_id) + has_error, consent_output, _ = ApiRequest.get( "/accounts/{0}/consent".format(account_id), params={"consent_post_url": post_url}) @@ -1313,6 +1325,12 @@ def render_consent_page(account_id, form_type): if has_error: return consent_output + has_error, source_output, _ = ApiRequest.get( + '/accounts/%s/sources/%s' % + (account_id, source_id)) + if has_error: + return source_output + # Setting the flag variable to ensure that # that duplicate source is not checked by jquery # as this form is used either for recosent or @@ -1327,7 +1345,11 @@ def render_consent_page(account_id, form_type): home_url=home_url, form_type=form_type, reconsent=reconsent, - language_tag=session_locale()) + language_tag=session_locale(), + sample_ids=sample_ids, + participant_name=source_output['source_name'], + age_range=source_output['consent']['age_range'] + ) @prerequisite([SOURCE_PREREQS_MET]) @@ -1348,14 +1370,7 @@ def get_source(*, account_id=None, source_id=None): return consent_required if consent_required["result"]: - return render_consent_page(account_id, "source") - - # Check if there are any unclaimed samples in the kit - original_kit, _, kit_status = _get_kit(account_output['kit_name']) - if kit_status == 404: - claim_kit_name_hint = None - else: - claim_kit_name_hint = account_output['kit_name'] + return render_consent_page(account_id, source_id, "source") # Retrieve the source has_error, source_output, _ = ApiRequest.get( @@ -1480,23 +1495,6 @@ def get_kits(*, account_id=None, source_id=None): claim_kit_name_hint = None - # Identify answered surveys for the samples - for sample in samples_output: - sample['ffq'] = None - sample['ffq_status'] = None - sample_id = sample['sample_id'] - # TODO: This is a really awkward and slow way to get this information - has_error, per_sample_answers, _ = ApiRequest.get( - '/accounts/%s/sources/%s/samples/%s/surveys' % - (account_id, source_id, sample_id)) - if has_error: - return per_sample_answers - - for answer in per_sample_answers: - if answer['survey_template_id'] == VIOSCREEN_ID: - sample['ffq'] = answer['survey_id'] - sample['ffq_status'] = answer['survey_status'] - # prettify datetime needs_assignment = False for sample in samples_output: @@ -1517,6 +1515,15 @@ def get_kits(*, account_id=None, source_id=None): samples_output = [translate_sample(s) for s in samples_output] + kits = {} + for s in samples_output: + if s['kit_id'] in kits: + kits[s['kit_id']].append(s) + else: + kits[s['kit_id']] = [s] + + samples_output = kits + return _render_with_defaults('kits.jinja2', account_id=account_id, source_id=source_id, @@ -1823,11 +1830,11 @@ def get_sample_results_experimental_authenticated(*, account_id=None, ) -# Note: ideally this would be represented as a DELETE, not as a POST -# However, it is used as a form submission action, and HTML forms do not -# support delete as an action +# Note: ideally this would be represented as a DELETE, not as a GET +# However, it is used as a redirect from a link, which does not support +# the DELETE action @prerequisite([SOURCE_PREREQS_MET]) -def post_remove_sample_from_source(*, +def get_remove_sample_from_source(*, account_id=None, source_id=None, sample_id=None): @@ -1838,7 +1845,10 @@ def post_remove_sample_from_source(*, if has_error: return delete_output - return _refresh_state_and_route_to_sink(account_id, source_id) + return redirect( + "/accounts/%s/sources/%s/kits" % + (account_id, source_id) + ) def admin_emperor_playground(): @@ -1948,13 +1958,31 @@ def get_ajax_check_activation_code(code, email): # surveys added to this source AFTER these samples are claimed will NOT be # associated with these samples. This behavior is by design. @prerequisite([SOURCE_PREREQS_MET]) -def post_claim_samples(*, account_id=None, source_id=None, body=None): +def post_claim_samples(*, account_id=None, source_id=None, body=None, sample_ids=None): + + if sample_ids is not None: + sample_ids_to_claim = sample_ids.split(",") + else: + sample_ids_to_claim = body.get('sample_id') - sample_ids_to_claim = body.get('sample_id') if sample_ids_to_claim is None: # User claimed no samples ... shrug return _refresh_state_and_route_to_sink(account_id, source_id) + # Test if biospecimen consent is required! If Required, + # route user to biospecimen consent + has_error, consent_required, _ = ApiRequest.get( + '/accounts/%s/source/%s/consent/%s' % + (account_id, source_id, 'biospecimen')) + + if has_error: + return consent_required + + if consent_required["result"]: + session["source_id"] = source_id + sample_ids = ",".join(sample_ids_to_claim) + return render_consent_page(account_id, source_id, "Biospecimen", sample_ids=sample_ids) + has_error, survey_output, _ = ApiRequest.get( '/accounts/{0}/sources/{1}/surveys'.format(account_id, source_id)) if has_error: @@ -1989,20 +2017,10 @@ def post_claim_samples(*, account_id=None, source_id=None, body=None): if sample_survey_output is not None: return sample_survey_output - # Test if biospecimen consent is required! If Required, - # route user to biospecimen consent - has_error, consent_required, _ = ApiRequest.get( - '/accounts/%s/source/%s/consent/%s' % - (account_id, source_id, 'biospecimen')) - - if has_error: - return consent_required - - if consent_required["result"]: - session["source_id"] = source_id - return render_consent_page(account_id, "Biospecimen") - - return _refresh_state_and_route_to_sink(account_id, source_id) + return redirect( + "/accounts/%s/sources/%s/kits" % + (account_id, source_id) + ) # Administrator Mode Functionality diff --git a/microsetta_interface/routes.yaml b/microsetta_interface/routes.yaml index a0c9995c..70fe8006 100644 --- a/microsetta_interface/routes.yaml +++ b/microsetta_interface/routes.yaml @@ -601,12 +601,11 @@ paths: schema: type: string - # Note: ideally this would be represented as a DELETE, not as a POST - # However, it is used as a form submission action, and HTML forms do not support - # delete as an action + # Note: ideally this would be represented as a DELETE, not as a GET + # However, it is used as a redirect from a link, which does not support DELETE actions '/accounts/{account_id}/sources/{source_id}/samples/{sample_id}/remove': - post: - operationId: microsetta_interface.implementation.post_remove_sample_from_source + get: + operationId: microsetta_interface.implementation.get_remove_sample_from_source tags: - Sample parameters: diff --git a/microsetta_interface/static/css/minimal_interface.css b/microsetta_interface/static/css/minimal_interface.css index c832ad18..50ed4d96 100644 --- a/microsetta_interface/static/css/minimal_interface.css +++ b/microsetta_interface/static/css/minimal_interface.css @@ -164,6 +164,17 @@ a.breadcrumb-item-profile { color: linear-gradient(86.3deg, #00C6D7 -100.33%, #006A96 93.93%); } +.btn-white-red-border { + background: #ffffff; + border-radius: 50px; + border-color: var(--tmi-red); + border-width: 2px; + font-weight: 700; + font-size: 14px; + line-height: 22px; + color: var(--tmi-red); +} + .card-header { background-color: #ffffff; color: #222222; @@ -562,6 +573,13 @@ li.active-profile { border: 1px dashed var(--tmi-blue); } +.sample-card { + background: var(--tmi-blue-bg); + box-shadow: none; + border: 0px; + padding: 12px 16px; +} + .kit-header { height: 56px; background: var(--tmi-blue-bg); @@ -775,3 +793,96 @@ select.form-control { .form-group > label > span { display: block !important; } + +.kit-validation-error { + font-size: 12px; + line-height: 20px; + color: var(--tmi-red) !important; +} + +.new_kit_prompt { + font-weight: 700; + font-size: 18px; + line-height: 24px; + color: var(--tmi-gray-90); + padding-left: 0; +} + +.barcode-checkbox { + position: absolute; + visibility: hidden; + opacity: 0; +} + +input.barcode-checkbox[type=checkbox]+label { + padding: 6px 16px 6px 8px; + height: 38px; + background: var(--tmi-blue-bg); + border: 2px solid var(--tmi-blue-bg); + border-radius: 8px; + color: var(--tmi-gray-90); + font-size: 16px; + line-height: 26px; + width: fit-content; + height: fit-content; +} + +input.barcode-checkbox[type=checkbox]:checked+label { + border: 2px solid var(--tmi-blue); + color: var(--tmi-blue); +} + +.new_kit_sample_container { + display: flex; + flex-direction: row; + align-items: center; + padding: 0px; + gap: 16px; +} + +.barcode-row { + display: flex; + flex-direction: row; + height: 48px; + padding: 8px; +} + +.barcode-col { + width: fit-content; +} + +.barcode-col-end { + margin-left: auto; +} + +.barcode-text { + color: var(--tmi-blue); + font-weight: 700; + font-size: 16px; + line-height: 26px; +} + +.add-kit-link { + color: var(--tmi-blue); + font-weight: 700; + text-decoration: none; +} + +.sample-label { + color: var(--tmi-gray-80); + font-size: 16px; + line-height: 26px; +} + +.biospecimen-alert { + font-size: 14px; + line-height: 24px; + font-weight: 700; + color: var(--tmi-blue); +} + +.barcode-info { + font-size: 14px; + font-weight: 400; + line-height: 24px; +} diff --git a/microsetta_interface/static/img/edit.svg b/microsetta_interface/static/img/edit.svg new file mode 100644 index 00000000..ff627d95 --- /dev/null +++ b/microsetta_interface/static/img/edit.svg @@ -0,0 +1,3 @@ + + + diff --git a/microsetta_interface/static/img/question_mark.svg b/microsetta_interface/static/img/question_mark.svg new file mode 100644 index 00000000..c30cd5ec --- /dev/null +++ b/microsetta_interface/static/img/question_mark.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/microsetta_interface/static/img/tube_icon.svg b/microsetta_interface/static/img/tube_icon.svg new file mode 100644 index 00000000..fc289bf1 --- /dev/null +++ b/microsetta_interface/static/img/tube_icon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/microsetta_interface/templates/kits.jinja2 b/microsetta_interface/templates/kits.jinja2 index 52274de7..f1a0693c 100644 --- a/microsetta_interface/templates/kits.jinja2 +++ b/microsetta_interface/templates/kits.jinja2 @@ -45,16 +45,23 @@ } let kitSubmitHandler = function(form, evt){ - let samples_selector = '#samples'; + let samples_selector = '#new_kit_sample_container'; let error_txt = ""; let successful = false; $(form).ajaxSubmit({ success: function (samples, textStatus, jqXHR) { + document.getElementById('new_kit_container').style.display = ''; + document.getElementById('new_kit_header').innerText += ' ' + $("#kit_name").prop('value'); $(samples_selector).empty(); for (let i = 0; i < samples.length; i++) { let bc = samples[i].sample_barcode; let sample_id = samples[i].sample_id; - let item = $('
' + + let item = $('
' + + '' + + '' + + '
'); + console.log(item); + /*let item = $('
' + '
' + '
' + '' + @@ -62,7 +69,7 @@ '
' + '' + '
' + - '
'); + '
');*/ $(samples_selector).append(item); } let div = $('#choose_sample_div'); @@ -85,19 +92,6 @@ }); }; - function verifyDissociateSample(sampleId){ - let confirmMsg = "{{ _('Do you really want to remove this sample from this source?') }} " + - "{{ _('Doing so will remove any collection info saved for this sample and will') }} " + - "{{ _('unlink it from all surveys.') }}"; - return window.confirm(confirmMsg); - } - - function verifyDeleteSource(sourceName){ - let confirmMsg = "{{ _('You are deleting source') }} " + sourceName + " {{ _('and all surveys associated with it!') }} " + - "{{ _('This operation cannot be undone. Are you sure you want to delete this source?') }} "; - return window.confirm(confirmMsg); - } - function renderButton(sampleId) { var buttonDiv = document.getElementById("btn-view-" + sampleId); var button = document.createElement("a"); @@ -127,10 +121,6 @@ return true; } - function enableTooltips(){ - $('.tooltipper').tooltip({position: "bottom"}); - } - // Wait for the DOM to be ready $(document).ready(function(){ let form_name = 'list_kit_form'; @@ -143,16 +133,32 @@ addButtonIfData("{{ sample.sample_id }}", "{{ sample.sample_barcode }}") {% endfor %} - enableTooltips() + var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) + var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { + return new bootstrap.Tooltip(tooltipTriggerEl) + }) }); + function formSubmitControl() { + if ($("#pick_samples_form input:checkbox:checked").length > 0) { + document.getElementById("sample_claim_button").disabled = false; + } else { + document.getElementById("sample_claim_button").disabled = true; + } + } + function updateButtonState(kit_id_value) { - if(kit_id_value !== "") { + if(kit_id_value != "") { document.getElementById("kit_id_button").disabled = false; } else { document.getElementById("kit_id_button").disabled = true; } } + + function openKitPanel() { + document.getElementById('add_kit_container').style.display = ''; + document.getElementById('kit_name').focus(); + } {% endblock %} {% block breadcrumb %} @@ -169,9 +175,77 @@

My Kits

+
+
+ + +
+
+
+ {% if samples|length > 0 %} + {% for kit_id, kit_samples in samples.items() %} +
+
+
KitID: {{ kit_id }}
+
+ {% for sample in kit_samples %} +
+
+ +
+
+ {{ sample.sample_barcode }} +
+
+ +
+
+ {% endfor %} +
+ {% endfor %} + {% endif %} +
0 %}style="display: none;"{% endif %}> +
+
+
+
+
+
+ + +
+
+
+ +
+
+
+
+
- {% endblock %} diff --git a/microsetta_interface/templates/new_participant.jinja2 b/microsetta_interface/templates/new_participant.jinja2 index 133b17b2..dfeda75a 100644 --- a/microsetta_interface/templates/new_participant.jinja2 +++ b/microsetta_interface/templates/new_participant.jinja2 @@ -25,6 +25,10 @@ $("#13-17-div").hide(); $("#18-plus-div").hide(); + {% if age_range != None %} + $("#{{ age_range }}-div").show(); + {% endif %} + disableInputOnSubmit("#0-6-form", "#0-6-submit_button", "{{ _('Saving...') }}"); disableInputOnSubmit("#7-12-form", "#7-12-submit_button", "{{ _('Saving...') }}"); disableInputOnSubmit("#13-17-form", "#13-17-submit_button", "{{ _('Saving...') }}"); @@ -166,6 +170,8 @@ console.log(error); } }); + } else { + $("#"+$form_id)[0].submit(); } } else { $submit_button.attr("value", "I Accept") @@ -184,12 +190,24 @@ {% block breadcrumb %} - + {% if form_type == "Biospecimen" %} + + {% else %} + + {% endif %} {% endblock %} {% block content%}
+ {% if age_range != None %} + +
+
+ Signature and agreement of this consent form is required to process your sample(s). +
+
+ {% else %}
{{ _('Select age range of participant') }} @@ -207,12 +225,14 @@
+ {% endif %} {% if language_tag == "en_US" %}
+