diff --git a/GenderPayGap.WebUI/Models/Search/SearchApiResult.cs b/GenderPayGap.WebUI/Models/Search/SearchApiResult.cs index 03d95fe4a..721f8387f 100644 --- a/GenderPayGap.WebUI/Models/Search/SearchApiResult.cs +++ b/GenderPayGap.WebUI/Models/Search/SearchApiResult.cs @@ -5,7 +5,7 @@ namespace GenderPayGap.WebUI.Models.Search public class SearchApiResult { - public Dictionary Sectors { get; set; } = new Dictionary {{"A", "Hello"}}; + public Dictionary Sectors { get; set; } public SearchPageViewModel SearchParameters { get; set; } public List Employers { get; set; } diff --git a/GenderPayGap.WebUI/Search/ViewingSearchServiceNew.cs b/GenderPayGap.WebUI/Search/ViewingSearchServiceNew.cs index 4a34042c3..c3cb3ef23 100644 --- a/GenderPayGap.WebUI/Search/ViewingSearchServiceNew.cs +++ b/GenderPayGap.WebUI/Search/ViewingSearchServiceNew.cs @@ -67,6 +67,7 @@ public SearchApiResult Search(SearchPageViewModel searchParams) return new SearchApiResult { + Sectors = sectorsDictionary, SearchParameters = searchParams, Employers = rankedOrganisations.Select(ConvertRankedOrgsToSearchApiResultEmployer).ToList() }; diff --git a/GenderPayGap.WebUI/Views/Search/SearchPage.cshtml b/GenderPayGap.WebUI/Views/Search/SearchPage.cshtml index 0ab4cf852..1eeb4585f 100644 --- a/GenderPayGap.WebUI/Views/Search/SearchPage.cshtml +++ b/GenderPayGap.WebUI/Views/Search/SearchPage.cshtml @@ -246,12 +246,41 @@ +
+

+ Try searching again. Check: +

+
    +
  • + your spelling +
  • +
  • + the employer name (sometimes the commonly known employer name is different to their registered name) +
  • +
+

+ You may not find the data you are looking for because: +

+
    +
  • + only employers with a headcount of 250 or more on their snapshot date are required to submit their gender pay gap information +
  • +
  • + the employer may have reported their gender pay gap information under a different registered name +
  • +
  • + the employer may not have submitted their gender pay gap information yet. + Most public authority employers have a reporting deadline of 30 March, and + private, voluntary and all other public authority employers have a reporting deadline of 4 April. +
  • +
+
@@ -372,8 +401,8 @@ try { const response = await fetch(`${searchApiPath}${urlQuery}`); if (response.ok) { + const json = await response.json(); if (searchResultsIdGenerator.isCurrentId(searchResultsId)) { - const json = await response.json(); displaySearchResults(json); } } @@ -387,11 +416,13 @@ function displaySearchResults(json) { document.getElementById('gpg-search-page--results--number-of-results').innerText = json.Employers.length.toLocaleString(); + document.getElementById('gpg-search-page--results--employer-employers').innerText = json.Employers.length === 1 ? 'employer' : 'employers'; document.getElementById('gpg-search-page--results--containing-search-term').innerText = json.SearchParameters.EmployerName; document.getElementById('gpg-search-page--results--containing').style.display = json.SearchParameters.EmployerName ? 'inline' : 'none'; document.getElementById('gpg-search-page--results-info').style.display = 'block'; + document.getElementById('gpg-search-page--results-info--no-results').style.display = json.Employers.length > 0 ? 'none' : 'block'; document.getElementById('gpg-search-page--results').innerHTML = ''; @@ -429,13 +460,13 @@ link.innerText = employerName; th.appendChild(link); } - function createTdWithTextAndAddToTr(tr, td_text) { + function createTdWithTextAndAddToTr(tr, td_text, textIfEmpty) { const td = document.createElement('td'); if (td_text) { td.innerText = td_text; } else { - td.innerText = 'No previous name'; + td.innerText = textIfEmpty; td.classList.add('gpg-search-results--empty-cell') } tr.appendChild(td); @@ -489,10 +520,10 @@ employersInThisBlock.forEach((employer) => { const results_new_tbody_tr = document.createElement('tr'); createThWithLinkToEmployerAndAddToTr(results_new_tbody_tr, employer.Id, employer.Name); - createTdWithTextAndAddToTr(results_new_tbody_tr, employer.PreviousName); - createTdWithTextAndAddToTr(results_new_tbody_tr, employer.Address); + createTdWithTextAndAddToTr(results_new_tbody_tr, employer.PreviousName, 'No previous name'); + createTdWithTextAndAddToTr(results_new_tbody_tr, employer.Address, 'No address'); const sectorsNames = employer.Sectors.map(sectorId => json.Sectors[sectorId]).join('; ').replaceAll('\n','').replaceAll('\r',''); - createTdWithTextAndAddToTr(results_new_tbody_tr, sectorsNames); + createTdWithTextAndAddToTr(results_new_tbody_tr, sectorsNames, 'No sector'); createTdWithCompareButton(results_new_tbody_tr, employer.EncId, employer.Name); results_new_tbody.appendChild(results_new_tbody_tr); }); diff --git a/GenderPayGap.WebUI/wwwroot/styles/pages/_search-page.scss b/GenderPayGap.WebUI/wwwroot/styles/pages/_search-page.scss index ee71dd91a..c4cb78f49 100644 --- a/GenderPayGap.WebUI/wwwroot/styles/pages/_search-page.scss +++ b/GenderPayGap.WebUI/wwwroot/styles/pages/_search-page.scss @@ -81,6 +81,10 @@ td:nth-of-type(3) /* Sectors */ { @extend .govuk-body-s; margin-bottom: 5px; + + &.gpg-search-results--empty-cell { + @extend .govuk-visually-hidden; + } } td:nth-of-type(4) /* The "Action2 column which contains the Add/Remove button */ {