handled display errors
This commit is contained in:
parent
4ab95fcfaa
commit
65afb91b61
2 changed files with 17 additions and 8 deletions
|
|
@ -336,10 +336,15 @@ function update_booster_warning() {
|
|||
function update_booster_dropdown(url) {
|
||||
let primary_vaccine_option = $("#vaccine_type").find(":selected").val();
|
||||
$($("#vaccine_booster_type > option").get().reverse()).each(function() {
|
||||
if ($(this).attr('data-primary-vaccine') != primary_vaccine_option && $(this).val() != "Other") $(this).hide();
|
||||
else $(this).show().prop('selected', true);
|
||||
if ($(this).attr('data-primary-vaccine') != primary_vaccine_option && $(this).attr('data-primary-vaccine') != "Other") $(this).hide();
|
||||
else {
|
||||
$(this).show();
|
||||
if (url.searchParams.has('vaccine_type')) {
|
||||
if (url.searchParams.get('vaccine_type') != primary_vaccine_option) $(this).prop('selected', true); // Select first of the list if not from the URL
|
||||
}
|
||||
else $(this).prop('selected', true);
|
||||
}
|
||||
});
|
||||
if (url.searchParams.has('vaccine_booster_type')) $("#vaccine_booster_type").val(url.searchParams.get('vaccine_booster_type'));
|
||||
update_booster_warning();
|
||||
}
|
||||
|
||||
|
|
@ -891,8 +896,8 @@ $(document).ready(function () {
|
|||
$("#sr_interactions").text(index - 1);
|
||||
}
|
||||
|
||||
else if (name == 'sensor_in_use') {
|
||||
// TODO - Validate if sensor exists
|
||||
else if (name == 'sensor_in_use' || name == 'vaccine_booster_type') {
|
||||
// Validation after
|
||||
}
|
||||
|
||||
//Ignore 0 (default) values from server side
|
||||
|
|
@ -903,6 +908,10 @@ $(document).ready(function () {
|
|||
}
|
||||
});
|
||||
|
||||
let primary_vaccine = url.searchParams.has('vaccine_type') ? url.searchParams.get('vaccine_type') : null;
|
||||
let booster_vaccine = url.searchParams.has('vaccine_booster_type') ? url.searchParams.get('vaccine_booster_type') : null;
|
||||
$(`#vaccine_booster_type > option[data-primary-vaccine="${primary_vaccine}"][value="${booster_vaccine}"]`).attr('selected', true);
|
||||
|
||||
// Handle default URL values if they are not explicitly defined.
|
||||
if (Array.from(url.searchParams).length > 0) {
|
||||
if (!url.searchParams.has('location_name')) {
|
||||
|
|
|
|||
|
|
@ -408,8 +408,8 @@
|
|||
<select id="vaccine_booster_type" name="vaccine_booster_type" class="form-control form-control-sm">
|
||||
<option value="AZD1222_(AstraZeneca)" data-primary-vaccine="AZD1222_(AstraZeneca)">AZD1222 (AstraZeneca)</option>
|
||||
<option value="BNT162b2_(Pfizer)" data-primary-vaccine="AZD1222_(AstraZeneca)">BNT162b2 (Pfizer)</option>
|
||||
<option value="BNT162b2_(Pfizer)_and_mRNA-1273_(Moderna)" data-primary-vaccine="AZD1222_(AstraZeneca)">BNT162b2 (Pfizer) and mRNA-1273 (Moderna)</option
|
||||
><option value="BNT162b2_(Pfizer)_or_mRNA-1273_(Moderna)" data-primary-vaccine="AZD1222_(AstraZeneca)">BNT162b2 (Pfizer) or mRNA-1273 (Moderna)</option>
|
||||
<option value="BNT162b2_(Pfizer)_and_mRNA-1273_(Moderna)" data-primary-vaccine="AZD1222_(AstraZeneca)">BNT162b2 (Pfizer) and mRNA-1273 (Moderna)</option>
|
||||
<option value="BNT162b2_(Pfizer)_or_mRNA-1273_(Moderna)" data-primary-vaccine="AZD1222_(AstraZeneca)">BNT162b2 (Pfizer) or mRNA-1273 (Moderna)</option>
|
||||
<option value="Sinopharm" data-primary-vaccine="AZD1222_(AstraZeneca)">Sinopharm</option>
|
||||
<option value="mRNA-1273_(Moderna)" data-primary-vaccine="AZD1222_(AstraZeneca)">mRNA-1273 (Moderna)</option>
|
||||
<option value="Ad26.COV2.S_(Janssen)" data-primary-vaccine="Ad26.COV2.S_(Janssen)">Ad26.COV2.S (Janssen)</option>
|
||||
|
|
@ -448,7 +448,7 @@
|
|||
<option value="Sinopharm" data-primary-vaccine="mRNA-1273_(Moderna)">Sinopharm</option>
|
||||
<option value="mRNA-1273_(Moderna)" data-primary-vaccine="mRNA-1273_(Moderna)">mRNA-1273 (Moderna)</option>
|
||||
<option value="mRNA-1273_(Moderna)_(4th_dose)" data-primary-vaccine="mRNA-1273_(Moderna)_(3 doses)">mRNA-1273 (Moderna) (4th dose)</option>
|
||||
<option value="Other">Other</option>
|
||||
<option value="Other" data-primary-vaccine="Other">Other</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue