Skip to content

Commit

Permalink
updated routing for covid eq
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbarnes9 committed Jul 23, 2020
1 parent 3b852c8 commit 33161c9
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 46 deletions.
9 changes: 7 additions & 2 deletions _prototypes/end-to-end-covid/confirm-rh-address.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ <h1 class="question__title u-fs-xl">
var addressLine4 = addressLines[3];
var unitName = (sessionStorage.getItem('unit-name') || '');
var fulfilmentJourney = (currentJourney === 'new-hh-uac' || currentJourney === 'new-ir-uac' || currentJourney === 'new-hh-paper');

var WLHBookmark = sessionStorage.getItem("wlh_bookmark");
console.log(WLHBookmark);
$('.qa-btn-submit').on('click', function (e) {
e.preventDefault();

Expand Down Expand Up @@ -128,7 +129,11 @@ <h1 class="question__title u-fs-xl">
var url = '../address-in-ni';
}
} else {
var url = '../section-intro';
if (WLHBookmark != null) {
var url = WLHBookmark;
} else {
var url = '../section-intro-covid';
}
}

sessionStorage.setItem('address-line-1', addressLine1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<main role="main" id="main" class="page__main">
<form id="form" name="trav" class="form qa-questionnaire-form"
role="form" autocomplete="new-password"
action="../individual-details-employment-seven-days-ago">
action="../individual-details-employment-seven-days-ago-covid">
<input autocomplete="new-password" type="hidden" name="person_id" id="person"
value="#"/>
<input autocomplete="new-password" type="hidden" name="survey" id="survey-type"
Expand Down Expand Up @@ -138,7 +138,7 @@ <h3 class="collapsible__title js-collapsible-title icon--collapsible-simple u-fs
question = question.trim();

storageAPI.addUpdateArmedForces(personId, val, question, url);
storageAPI.storePageData('/end-to-end-covid/individual-details-employment-seven-days-ago/', window.location.pathname);
storageAPI.storePageData('/end-to-end-covid/individual-details-employment-seven-days-ago-covid/', window.location.pathname);

if(isEditing) {
e.preventDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h1 class="u-fs-xl">Main job</h1>

<p class="js-text">The next set of questions is about your main job. Your main job is the job in which you usually work the most hours. </p>
<h2>Coronavirus (COVID-19)</h2>
<p>Your circumstances may have changed
<p class="js-piping">Your circumstances may have changed
during the coronavirus pandemic. Answer all questions based on your situation
as it is now.</p>
</section>
Expand All @@ -51,6 +51,7 @@ <h2>Coronavirus (COVID-19)</h2>
person = storageAPI.getHouseholdMemberByPersonId(personId)['@person'],
surveyType = urlParams.get('survey'),
personDetails = storageAPI.getHouseholdMemberByPersonId(personId);
var pipingDestinations = Array.from(document.querySelectorAll('.js-piping'));

$('.qa-btn-submit').on('click',
storageAPI.personalQuestionSubmitDecorator.bind(null, personId, function (e) {
Expand All @@ -74,8 +75,13 @@ <h2>Coronavirus (COVID-19)</h2>

function updatePara() {
if(storageAPI.getProxyFor(personId)) {
$('.js-text').html('The next set of questions is about ' + '<strong>' + person.firstLastName +
window.ONS.utils.trailingNameS(person.firstLastName) + '</strong>' + ' main job. Their main job is the job in which they usually work the most hours.');
$('.js-text').html('The next set of questions is about ' + '<strong>' + person.firstLastName +
window.ONS.utils.trailingNameS(person.firstLastName) + '</strong>' + ' main job. Their main job is the job in which they usually work the most hours.');

pipingDestinations.forEach(function(pipingDestination) {
pipingDestination.innerHTML = pipingDestination.innerHTML.replace('your', 'their');
pipingDestination.innerHTML = pipingDestination.innerHTML.replace('Your', 'Their');
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
val.push($(el).val());
});

let url = '../individual-details-employment-seven-days-ago/?person_id=' + personId + '&edit=true';
let url = '../individual-details-employment-seven-days-ago-covid/?person_id=' + personId + '&edit=true';
question = question.trim();

storageAPI.addUpdateLastSevenDays(personId, val, question, url);
Expand All @@ -213,8 +213,8 @@
storageAPI.storePageData('/end-to-end-covid/individual-details-employment-seven-days-ago-description/', window.location.pathname);
} else {
e.preventDefault();
window.location.href = '../individual-details-employment-main-job/?person_id=' + personId;
storageAPI.storePageData('/end-to-end-covid/individual-details-employment-main-job/', window.location.pathname);
window.location.href = '../individual-details-employment-main-job-covid/?person_id=' + personId;
storageAPI.storePageData('/end-to-end-covid/individual-details-employment-main-job-covid/', window.location.pathname);
}
}
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,7 @@
<div class="block">
<section class="section">
<h1 class="u-fs-xl">Coronavirus (COVID-19)</h1>
<p><span class="js-person-name"></span> circumstances may have changed
during the coronavirus pandemic. Answer all questions based on <span class="js-person-name"></span> situation
as it is now.</p>


<div class="collapsible collapsible--simple js-collapsible js-collapsible-simple u-mt-m u-vh">
<div class="js-collapsible-content">
<h2 class="collapsible__title js-collapsible-title icon--collapsible-simple u-fs-r--b" data-ga="click" data-ga-category="definition" data-ga-action="Open panel" data-ga-label="If you can’t answer questions for this person">
If you can’t answer questions for this person
</h2>
<div class="collapsible__body js-collapsible-body">
<p>You can <strong>share your household access code</strong> with the people you live with so they can complete their own sections.</p>
<p>If this is not possible, there are <a class="js-link-ir" href="#">other ways each person can complete their own census</a>.</p>
<button class="btn btn--secondary btn--small js-collapsible-close u-no-js-hide" data-ga="click" data-ga-category="definition" data-ga-action="Close panel" data-ga-label="Can’t answer someone else’s questions?">Hide this</button>
</div>
</div>
</div>
<p class="js-piping">The circumstances for <span class="js-person-name"></span> may have changed during the coronavirus pandemic. Answer all questions based on the situation as it is now.</p>
</section>
</div>
</div>
Expand All @@ -57,11 +41,13 @@ <h2 class="collapsible__title js-collapsible-title icon--collapsible-simple u-fs
<script src='/js/compiled/end-to-end-covid/bundle.js'></script>

<script>
var storageAPI = window.ONS.storage,
urlParams = new URLSearchParams(window.location.search),
personId = urlParams.get('person_id'),
surveyType = urlParams.get('survey');
personDetails = storageAPI.getHouseholdMemberByPersonId(personId);
var storageAPI = window.ONS.storage,
urlParams = new URLSearchParams(window.location.search),
personId = urlParams.get('person_id'),
surveyType = urlParams.get('survey');
personDetails = storageAPI.getHouseholdMemberByPersonId(personId),
person = personDetails['@person'];
var pipingDestinations = Array.from(document.querySelectorAll('.js-piping'));

$('.btn-submit').click(function(e) {
e.preventDefault();
Expand All @@ -83,8 +69,14 @@ <h2 class="collapsible__title js-collapsible-title icon--collapsible-simple u-fs
});

function updateName() {
$('.js-person-name').html(person.firstLastName +
window.ONS.utils.trailingNameS(person.firstLastName));
$('.js-person-name').html('<strong>' + person.firstLastName + '</strong>');

if(storageAPI.getProxyFor(personId) || isVisitor) {
pipingDestinations.forEach(function(pipingDestination) {
pipingDestination.innerHTML = pipingDestination.innerHTML.replace('your', 'their');
});
}

}

function showIrDetails() {
Expand Down
7 changes: 1 addition & 6 deletions _prototypes/end-to-end-covid/individual-intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,7 @@ <h2 class="collapsible__title js-collapsible-title icon--collapsible-simple u-fs

$('.btn-submit').click(function(e) {
e.preventDefault();

if (personDetails.type === 'visitor'){
var url = 'individual-details-dob/';
} else {
var url = 'individual-decision/';
}
var url = 'individual-intro-covid/';
window.location = '../' + url + '?person_id=' + personId;
storageAPI.storePageData('/end-to-end-covid/' + url, window.location.pathname);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
<section class="section">

<h1 class="u-fs-xl">Coronavirus (COVID-19) and Census 2021</h1>
<p>Your circumstances may have changed
during the coronavirus pandemic. Answer all questions based on your situation
<p>Circumstances may have changed
during the coronavirus pandemic. Answer all questions based on the situation
as it is now.</p>
</section>
</div>
Expand Down
10 changes: 7 additions & 3 deletions _prototypes/end-to-end-covid/uac-entry.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ <h3 class="collapsible__title js-collapsible-title icon--collapsible-simple u-fs
var currentJourney = 'new-hh-uac';
var pathArray = window.location.pathname.split('/');
var currentPage = pathArray.slice(-2)[0];
var wlhBoomark = sessionStorage.getItem("wlh_bookmark");
var transientUser = (uacInput.value === 'tran sien tuse ruac' || sessionStorage.getItem('address') === null);

var $input = $('input#uac');
$input.keyup(function(e) {
Expand All @@ -124,12 +126,14 @@ <h3 class="collapsible__title js-collapsible-title icon--collapsible-simple u-fs
if (hasErrors) {
hasErrors = false;
return false;
} else if (uacInput.value === 'expi reda cces scod') {
window.location = '../expired-uac/?previous=uac-entry';
} else if (wlhBoomark && !transientUser) {
window.location = '../confirm-rh-address/?previous=uac-entry';
} else {
if (uacInput.value == 'unl1 nk3d acc3 55c0' || uacInput.value == 'unli nked addr ess') {
window.location = '../uac-request-address/?previous=uac-entry&current-journey=unlinked-uac';
} else if (uacInput.value === 'expi reda cces scod') {
window.location = '../expired-uac/?previous=uac-entry';
} else if (uacInput.value === 'tran sien tuse ruac' || sessionStorage.getItem('address') === null){
} else if (transientUser){
window.location = '../uac-request-address/?previous=uac-entry&current-journey=transient';
} else {
window.location = '../confirm-rh-address/?previous=uac-entry';
Expand Down
5 changes: 4 additions & 1 deletion _prototypes/end-to-end/confirm-rh-address.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ <h1 class="question__title u-fs-xl">
var url = '../address-in-ni';
}
} else {
var url = '../section-intro';
if (sessionStorage.getItem("wlh_bookmark")) {
var url = sessionStorage.getItem("wlh_bookmark");
} else {
var url = '../section-intro';
}

sessionStorage.setItem('address-line-1', addressLine1);
Expand Down

0 comments on commit 33161c9

Please sign in to comment.