diff --git a/app/forms/input_form.py b/app/forms/input_form.py index cb43306..d7f577f 100644 --- a/app/forms/input_form.py +++ b/app/forms/input_form.py @@ -27,8 +27,8 @@ class InputForm(FlaskForm): countries = SelectField("Country", choices=['Choose...','England', 'Northern Ireland', 'Scotland', 'Wales'], validators=[ DataRequired(), AnyOf(['England', 'Northern Ireland', 'Scotland', 'Wales'], message="Please select a country")]) - services = SelectField("Services", choices=['Choose...','Adult (17+)', 'Youth (≤16)'], validators=[ - DataRequired(), AnyOf(['Adult (17+)', 'Youth (≤16)'], message="Please select adult or youth services")]) + services = SelectField("Services", choices=['Choose...','Adult (17+)'], validators=[ + DataRequired(), AnyOf(['Adult (17+)'], message="Please select adult services")]) # 'Youth (≤16)' removed self_med = BooleanField("I am self medicating") self_med_likely = BooleanField("I am likely to start self medicating") no_self_med = BooleanField("I am not currently or likely to start self medicating") diff --git a/app/static/js/transinformed.js b/app/static/js/transinformed.js index a2ec661..92e777e 100644 --- a/app/static/js/transinformed.js +++ b/app/static/js/transinformed.js @@ -2,7 +2,7 @@ window.addEventListener('load', function () { infoButtons(document.getElementById("gicLabelBtn"), document.getElementById("gicInfoLabel")); infoButtons(document.getElementById("sharedCareLabelBtn"), document.getElementById("sharedCareInfoLabel")); infoButtons(document.getElementById("bridgingDesiredLabelBtn"), document.getElementById("bridgingDesiredInfoLabel")); - infoButtons(document.getElementById("under16LabelBtn"), document.getElementById("under16InfoLabel")); + // infoButtons(document.getElementById("under16LabelBtn"), document.getElementById("under16InfoLabel")); infoButtons(document.getElementById("fixedAddressLabelBtn"), document.getElementById("fixedAddressInfoLabel")); infoButtons(document.getElementById("noIdProofLabelBtn"), document.getElementById("noIdProofInfoLabel")); infoButtons(document.getElementById("immLetterLabelBtn"), document.getElementById("immLetterInfoLabel")); @@ -37,7 +37,7 @@ window.addEventListener('load', function () { document.getElementById('immigrationCheck').addEventListener('click', revealContentImmigration); //Age checkbox - document.getElementById('under16Check').addEventListener('click', checkAgeStatus); + // document.getElementById('under16Check').addEventListener('click', checkAgeStatus); document.getElementById("docx").addEventListener('click', submitActionsDocx); document.getElementById("pdf").addEventListener('click', submitActionsPdf); @@ -157,14 +157,14 @@ function serviceFilters() { $("#privateProviderList option[value='Other (Non-UK Based)']").hide(); } - else if (!under16Check.checked) { - $('#grcCheckContainer').show(); - $('#bridgingDesiredContainer').show(); - $('#medStatusSection').show(); - $('#bloodTestsContainer').show(); - $("#privateProviderList option[value='GenderGP']").show(); - $("#privateProviderList option[value='Other (Non-UK Based)']").show(); - } + // else if (!under16Check.checked) { + // $('#grcCheckContainer').show(); + // $('#bridgingDesiredContainer').show(); + // $('#medStatusSection').show(); + // $('#bloodTestsContainer').show(); + // $("#privateProviderList option[value='GenderGP']").show(); + // $("#privateProviderList option[value='Other (Non-UK Based)']").show(); + // } } diff --git a/app/static/js/transinformed.min.js b/app/static/js/transinformed.min.js index 06c9d0b..c8318ca 100644 --- a/app/static/js/transinformed.min.js +++ b/app/static/js/transinformed.min.js @@ -1 +1 @@ -function checkDocStatus(){diagnosisCheck.checked||hrtCheck.checked?noDocCheck.disabled=!0:noDocCheck.disabled=!1,noDocCheck.checked?(diagnosisCheck.disabled=!0,hrtCheck.disabled=!0):(diagnosisCheck.disabled=!1,hrtCheck.disabled=!1),bridgingCheck()}function checkAgeStatus(){under16Check.checked?($("#sharedCareCheckContainer").hide(),sharedCareCheck.checked=!1,privateSelector.hidden=!0,privateProviderList.value="I haven't chosen a provider yet",$("#bridgingDesiredContainer").hide(),bridgingDesired.checked=!1,$("#bloodTestsContainer").hide(),bloodTests.checked=!1,$("#grcCheckContainer").hide(),grcCheck.checked=!1,$("#medStatusSection").hide(),$("#medStatusSection").find("input:checked[type=checkbox]").prop("checked",!1),checkMedStatus(),$("#services option[value='Adult (17+)']").hide(),"Adult (17+)"===services.value&&(services.value="Choose..."),serviceFilters()):($("#sharedCareCheckContainer").show(),$("#bridgingDesiredContainer").show(),$("#bloodTestsContainer").show(),$("#grcCheckContainer").show(),$("#medStatusSection").show(),checkMedStatus(),$("#services option[value='Adult (17+)']").show(),serviceFilters())}function bridgingCheck(){noMedCheck.checked&&(bridgingDesired.disabled=!0),!selfMedCheck.checked&&!likelyMedCheck.checked||hrtCheck.checked||noMedCheck.checked?(bridgingDesired.disabled=!0,bridgingDesired.checked=!1,bridgingDesiredLabel.innerHTML="I need a bridging prescription (invalid medication status for bridging)"):(bridgingDesired.disabled=!1,bridgingDesiredLabel.innerHTML="I need a bridging prescription"),hrtCheck.checked&&(bridgingDesired.disabled=!0,bridgingDesired.checked=!1,bridgingDesiredLabel.innerHTML="I need a bridging prescription (invalid document status for bridging)"),0!==$(".med-status-check:checked").length||hrtCheck.checked||(bridgingDesired.disabled=!0,bridgingDesired.checked=!1,bridgingDesiredLabel.innerHTML="I need a bridging prescription (select medication status)")}function checkMedStatus(){noMedCheck.checked&&(bridgingDesired.disabled=!0),selfMedCheck.checked?(likelyMedCheck.disabled=!0,noMedCheck.disabled=!0):likelyMedCheck.checked?(selfMedCheck.disabled=!0,noMedCheck.disabled=!0):noMedCheck.checked?(selfMedCheck.disabled=!0,likelyMedCheck.disabled=!0):(selfMedCheck.disabled=!1,likelyMedCheck.disabled=!1,noMedCheck.disabled=!1),bridgingCheck()}function serviceFilters(){countryServiceFilters(),"Youth (≤16)"==services.value?($("#grcCheckContainer").hide(),$("#bridgingDesiredContainer").hide(),bridgingDesired.checked=!1,grcCheck.checked=!1,$("#bloodTestsContainer").hide(),bloodTests.checked=!1,$("#medStatusSection").hide(),$("#medStatusSection").find("input:checked[type=checkbox]").prop("checked",!1),$("#privateProviderList option[value='GenderGP']").hide(),$("#privateProviderList option[value='Other (Non-UK Based)']").hide()):under16Check.checked||($("#grcCheckContainer").show(),$("#bridgingDesiredContainer").show(),$("#medStatusSection").show(),$("#bloodTestsContainer").show(),$("#privateProviderList option[value='GenderGP']").show(),$("#privateProviderList option[value='Other (Non-UK Based)']").show())}function countryServiceFilters(){var e=countries.value,t=services.value;if(disableButtonsLogic(),"Youth (≤16)"==t)var i={"Y-England":["Y-England"],"Y-Northern Ireland":["Y-Northern Ireland"],"Y-Scotland":["Y-Scotland"],"Y-Wales":["Y-Wales"]};else i={England:["England"],"Northern Ireland":["Northern Ireland"],Scotland:["Scotland"],Wales:["Wales"]};$("#gics option[value='Y-England'], #gics option[value='Y-Northern Ireland'], #gics option[value='Y-Scotland'], #gics option[value='Y-Wales']").hide(),$("#gics option[value='England'], #gics option[value='Northern Ireland'], #gics option[value='Scotland'], #gics option[value='Wales']").hide(),i[e]&&"Choose..."!==t?(i[e].forEach((e=>{$("#gics option[value='"+e+"']").show()})),$("#gics").val(1).change(),$("#gics option[value='0']").hide(),$("#gics option[value='1']").show()):i["Y-"+e]&&"Choose..."!==t?(i["Y-"+e].forEach((e=>{$("#gics option[value='"+e+"']").show()})),$("#gics").val(1).change(),$("#gics option[value='0']").hide(),$("#gics option[value='1']").show()):($("#gics option[value='0']").show(),$("#gics option[value='1']").hide())}function revealContentReferral(){referralCheck.checked?gicSelector.hidden=!1:(gicSelector.hidden=!0,countryServiceFilters())}function revealContentSharedCare(){sharedCareCheck.checked?privateSelector.hidden=!1:(privateSelector.hidden=!0,privateProviderList.value="I haven't chosen a provider yet",$("#privateProviderList").removeClass("is-valid"),$("#privateProviderList").removeClass("is-invalid"))}function revealContentImmigration(){immigrationCheck.checked?$("#immigrationOption").show():($("#immigrationOption").hide(),immigrationLetterCheck.checked=!1),"opened"!==document.getElementById("immLetterLabelBtn").getAttribute("data-state")||immigrationCheck.checked||$("#immLetterLabelBtn").trigger("click")}function privateProviderConditions(){var e=document.getElementById("notUK"),t=document.getElementById("preferred");"GenderGP"===privateProviderList.value?(privateProviderList.classList.remove("is-valid"),privateProviderList.classList.add("is-invalid"),e.innerText="This provider is not based in the UK, which deters some GPs from agreeing to shared care.",t.innerText=""):privateProviderList.value.includes("Other")||privateProviderList.value.includes("haven't chosen")?(privateProviderList.classList.remove("is-invalid"),privateProviderList.classList.remove("is-valid"),t.innerText="",e.innerText=""):(privateProviderList.classList.remove("is-invalid"),privateProviderList.classList.add("is-valid"),t.innerText="This provider offers GMC registered and UK based specialists.",e.innerText="")}function disableButtonsLogic(){let e=document.getElementById("docx"),t=document.getElementById("pdf");"Choose..."!==countries.value&&"Choose..."!==services.value?(e.disabled=!1,"PDF Unavailable"!==t.innerText&&(t.disabled=!1)):(e.disabled=!0,t.disabled=!0)}function submitActionsDocx(){$(this).append(' '),$("#generationForm").removeProp("target"),submitActions()}function submitActionsPdf(){$(this).append(' '),$("#generationForm").prop({target:"_blank"}),submitActions()}function submitActions(){"0"!==gics.value&&"1"!==gics.value&&$("#gics :selected").val($("#gics :selected").text()),document.getElementById("generationForm").submit();const e=document.getElementById("alertPlaceholder"),t=document.createElement("div");t.innerHTML=['"].join(""),e.append(t),document.getElementById("close-alert-thanks").addEventListener("click",(()=>{e.innerHTML=""}))}function infoButtons(e,t){e.addEventListener("click",(()=>{const i=e.getAttribute("data-state");i&&"closed"!==i?(e.setAttribute("data-state","closed"),e.setAttribute("aria-expanded","false"),t.setAttribute("aria-expanded","false")):(e.setAttribute("data-state","opened"),e.setAttribute("aria-expanded","true"),t.setAttribute("aria-expanded","true"))}))}window.addEventListener("load",(function(){infoButtons(document.getElementById("gicLabelBtn"),document.getElementById("gicInfoLabel")),infoButtons(document.getElementById("sharedCareLabelBtn"),document.getElementById("sharedCareInfoLabel")),infoButtons(document.getElementById("bridgingDesiredLabelBtn"),document.getElementById("bridgingDesiredInfoLabel")),infoButtons(document.getElementById("under16LabelBtn"),document.getElementById("under16InfoLabel")),infoButtons(document.getElementById("fixedAddressLabelBtn"),document.getElementById("fixedAddressInfoLabel")),infoButtons(document.getElementById("noIdProofLabelBtn"),document.getElementById("noIdProofInfoLabel")),infoButtons(document.getElementById("immLetterLabelBtn"),document.getElementById("immLetterInfoLabel")),infoButtons(document.getElementById("aboutLabelBtn"),document.getElementById("aboutInfoLabel")),revealContentReferral(),revealContentSharedCare(),revealContentImmigration(),privateProviderConditions(),countryServiceFilters(),serviceFilters(),document.getElementById("countries").addEventListener("change",countryServiceFilters),document.getElementById("services").addEventListener("change",serviceFilters),document.getElementById("selfMedCheck").addEventListener("click",checkMedStatus),document.getElementById("likelyMedCheck").addEventListener("click",checkMedStatus),document.getElementById("noMedCheck").addEventListener("click",checkMedStatus),document.getElementById("diagnosisCheck").addEventListener("click",checkDocStatus),document.getElementById("hrtCheck").addEventListener("click",checkDocStatus),document.getElementById("noDocCheck").addEventListener("click",checkDocStatus),document.getElementById("referralCheck").addEventListener("click",revealContentReferral),document.getElementById("sharedCareCheck").addEventListener("click",revealContentSharedCare),document.getElementById("privateProviderList").addEventListener("change",privateProviderConditions),document.getElementById("immigrationCheck").addEventListener("click",revealContentImmigration),document.getElementById("under16Check").addEventListener("click",checkAgeStatus),document.getElementById("docx").addEventListener("click",submitActionsDocx),document.getElementById("pdf").addEventListener("click",submitActionsPdf)})); \ No newline at end of file +function checkDocStatus(){diagnosisCheck.checked||hrtCheck.checked?noDocCheck.disabled=!0:noDocCheck.disabled=!1,noDocCheck.checked?(diagnosisCheck.disabled=!0,hrtCheck.disabled=!0):(diagnosisCheck.disabled=!1,hrtCheck.disabled=!1),bridgingCheck()}function checkAgeStatus(){under16Check.checked?($("#sharedCareCheckContainer").hide(),sharedCareCheck.checked=!1,privateSelector.hidden=!0,privateProviderList.value="I haven't chosen a provider yet",$("#bridgingDesiredContainer").hide(),bridgingDesired.checked=!1,$("#bloodTestsContainer").hide(),bloodTests.checked=!1,$("#grcCheckContainer").hide(),grcCheck.checked=!1,$("#medStatusSection").hide(),$("#medStatusSection").find("input:checked[type=checkbox]").prop("checked",!1),checkMedStatus(),$("#services option[value='Adult (17+)']").hide(),"Adult (17+)"===services.value&&(services.value="Choose..."),serviceFilters()):($("#sharedCareCheckContainer").show(),$("#bridgingDesiredContainer").show(),$("#bloodTestsContainer").show(),$("#grcCheckContainer").show(),$("#medStatusSection").show(),checkMedStatus(),$("#services option[value='Adult (17+)']").show(),serviceFilters())}function bridgingCheck(){noMedCheck.checked&&(bridgingDesired.disabled=!0),!selfMedCheck.checked&&!likelyMedCheck.checked||hrtCheck.checked||noMedCheck.checked?(bridgingDesired.disabled=!0,bridgingDesired.checked=!1,bridgingDesiredLabel.innerHTML="I need a bridging prescription (invalid medication status for bridging)"):(bridgingDesired.disabled=!1,bridgingDesiredLabel.innerHTML="I need a bridging prescription"),hrtCheck.checked&&(bridgingDesired.disabled=!0,bridgingDesired.checked=!1,bridgingDesiredLabel.innerHTML="I need a bridging prescription (invalid document status for bridging)"),0!==$(".med-status-check:checked").length||hrtCheck.checked||(bridgingDesired.disabled=!0,bridgingDesired.checked=!1,bridgingDesiredLabel.innerHTML="I need a bridging prescription (select medication status)")}function checkMedStatus(){noMedCheck.checked&&(bridgingDesired.disabled=!0),selfMedCheck.checked?(likelyMedCheck.disabled=!0,noMedCheck.disabled=!0):likelyMedCheck.checked?(selfMedCheck.disabled=!0,noMedCheck.disabled=!0):noMedCheck.checked?(selfMedCheck.disabled=!0,likelyMedCheck.disabled=!0):(selfMedCheck.disabled=!1,likelyMedCheck.disabled=!1,noMedCheck.disabled=!1),bridgingCheck()}function serviceFilters(){countryServiceFilters(),"Youth (≤16)"==services.value&&($("#grcCheckContainer").hide(),$("#bridgingDesiredContainer").hide(),bridgingDesired.checked=!1,grcCheck.checked=!1,$("#bloodTestsContainer").hide(),bloodTests.checked=!1,$("#medStatusSection").hide(),$("#medStatusSection").find("input:checked[type=checkbox]").prop("checked",!1),$("#privateProviderList option[value='GenderGP']").hide(),$("#privateProviderList option[value='Other (Non-UK Based)']").hide())}function countryServiceFilters(){var e=countries.value,t=services.value;if(disableButtonsLogic(),"Youth (≤16)"==t)var i={"Y-England":["Y-England"],"Y-Northern Ireland":["Y-Northern Ireland"],"Y-Scotland":["Y-Scotland"],"Y-Wales":["Y-Wales"]};else i={England:["England"],"Northern Ireland":["Northern Ireland"],Scotland:["Scotland"],Wales:["Wales"]};$("#gics option[value='Y-England'], #gics option[value='Y-Northern Ireland'], #gics option[value='Y-Scotland'], #gics option[value='Y-Wales']").hide(),$("#gics option[value='England'], #gics option[value='Northern Ireland'], #gics option[value='Scotland'], #gics option[value='Wales']").hide(),i[e]&&"Choose..."!==t?(i[e].forEach((e=>{$("#gics option[value='"+e+"']").show()})),$("#gics").val(1).change(),$("#gics option[value='0']").hide(),$("#gics option[value='1']").show()):i["Y-"+e]&&"Choose..."!==t?(i["Y-"+e].forEach((e=>{$("#gics option[value='"+e+"']").show()})),$("#gics").val(1).change(),$("#gics option[value='0']").hide(),$("#gics option[value='1']").show()):($("#gics option[value='0']").show(),$("#gics option[value='1']").hide())}function revealContentReferral(){referralCheck.checked?gicSelector.hidden=!1:(gicSelector.hidden=!0,countryServiceFilters())}function revealContentSharedCare(){sharedCareCheck.checked?privateSelector.hidden=!1:(privateSelector.hidden=!0,privateProviderList.value="I haven't chosen a provider yet",$("#privateProviderList").removeClass("is-valid"),$("#privateProviderList").removeClass("is-invalid"))}function revealContentImmigration(){immigrationCheck.checked?$("#immigrationOption").show():($("#immigrationOption").hide(),immigrationLetterCheck.checked=!1),"opened"!==document.getElementById("immLetterLabelBtn").getAttribute("data-state")||immigrationCheck.checked||$("#immLetterLabelBtn").trigger("click")}function privateProviderConditions(){var e=document.getElementById("notUK"),t=document.getElementById("preferred");"GenderGP"===privateProviderList.value?(privateProviderList.classList.remove("is-valid"),privateProviderList.classList.add("is-invalid"),e.innerText="This provider is not based in the UK, which deters some GPs from agreeing to shared care.",t.innerText=""):privateProviderList.value.includes("Other")||privateProviderList.value.includes("haven't chosen")?(privateProviderList.classList.remove("is-invalid"),privateProviderList.classList.remove("is-valid"),t.innerText="",e.innerText=""):(privateProviderList.classList.remove("is-invalid"),privateProviderList.classList.add("is-valid"),t.innerText="This provider offers GMC registered and UK based specialists.",e.innerText="")}function disableButtonsLogic(){let e=document.getElementById("docx"),t=document.getElementById("pdf");"Choose..."!==countries.value&&"Choose..."!==services.value?(e.disabled=!1,"PDF Unavailable"!==t.innerText&&(t.disabled=!1)):(e.disabled=!0,t.disabled=!0)}function submitActionsDocx(){$(this).append(' '),$("#generationForm").removeProp("target"),submitActions()}function submitActionsPdf(){$(this).append(' '),$("#generationForm").prop({target:"_blank"}),submitActions()}function submitActions(){"0"!==gics.value&&"1"!==gics.value&&$("#gics :selected").val($("#gics :selected").text()),document.getElementById("generationForm").submit();const e=document.getElementById("alertPlaceholder"),t=document.createElement("div");t.innerHTML=['"].join(""),e.append(t),document.getElementById("close-alert-thanks").addEventListener("click",(()=>{e.innerHTML=""}))}function infoButtons(e,t){e.addEventListener("click",(()=>{const i=e.getAttribute("data-state");i&&"closed"!==i?(e.setAttribute("data-state","closed"),e.setAttribute("aria-expanded","false"),t.setAttribute("aria-expanded","false")):(e.setAttribute("data-state","opened"),e.setAttribute("aria-expanded","true"),t.setAttribute("aria-expanded","true"))}))}window.addEventListener("load",(function(){infoButtons(document.getElementById("gicLabelBtn"),document.getElementById("gicInfoLabel")),infoButtons(document.getElementById("sharedCareLabelBtn"),document.getElementById("sharedCareInfoLabel")),infoButtons(document.getElementById("bridgingDesiredLabelBtn"),document.getElementById("bridgingDesiredInfoLabel")),infoButtons(document.getElementById("fixedAddressLabelBtn"),document.getElementById("fixedAddressInfoLabel")),infoButtons(document.getElementById("noIdProofLabelBtn"),document.getElementById("noIdProofInfoLabel")),infoButtons(document.getElementById("immLetterLabelBtn"),document.getElementById("immLetterInfoLabel")),infoButtons(document.getElementById("aboutLabelBtn"),document.getElementById("aboutInfoLabel")),revealContentReferral(),revealContentSharedCare(),revealContentImmigration(),privateProviderConditions(),countryServiceFilters(),serviceFilters(),document.getElementById("countries").addEventListener("change",countryServiceFilters),document.getElementById("services").addEventListener("change",serviceFilters),document.getElementById("selfMedCheck").addEventListener("click",checkMedStatus),document.getElementById("likelyMedCheck").addEventListener("click",checkMedStatus),document.getElementById("noMedCheck").addEventListener("click",checkMedStatus),document.getElementById("diagnosisCheck").addEventListener("click",checkDocStatus),document.getElementById("hrtCheck").addEventListener("click",checkDocStatus),document.getElementById("noDocCheck").addEventListener("click",checkDocStatus),document.getElementById("referralCheck").addEventListener("click",revealContentReferral),document.getElementById("sharedCareCheck").addEventListener("click",revealContentSharedCare),document.getElementById("privateProviderList").addEventListener("change",privateProviderConditions),document.getElementById("immigrationCheck").addEventListener("click",revealContentImmigration),document.getElementById("docx").addEventListener("click",submitActionsDocx),document.getElementById("pdf").addEventListener("click",submitActionsPdf)})); \ No newline at end of file diff --git a/app/templates/index.html b/app/templates/index.html index 6fb49c8..fdb2d6c 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -123,7 +123,7 @@

Documents held

My current status

-
+
{{form.no_fixed_address(class='check-box', type='checkbox', role='checkbox', id='fixedAddressCheck')}}