From fb27d72ed3831ecbb356a69a13517b06db5eeac4 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Thu, 23 Sep 2021 15:14:20 +0100 Subject: [PATCH] added spinner to advanced search --- actions/index.js | 114 +++++----- components/homepage/casecomment.js | 35 +-- components/homepage/casesearch.js | 99 +++++---- components/homepage/dns.js | 20 +- components/homepage/login.js | 3 +- components/homepage/loginSoon.js | 12 +- components/search/advancedsearch.js | 287 +++++++++++++------------ components/search/searchresults.js | 8 +- i18n.json | 1 + locales/cy/common.json | 8 +- locales/cy/home.json | 26 +-- locales/cy/search.json | 1 + locales/en/common.json | 4 +- locales/en/home.json | 28 +-- locales/en/search.json | 1 + package.json | 1 + pages/advancedsearch.js | 15 +- pages/advancedsearchresults.js | 18 +- pages/searchresults.js | 6 +- styles/sass/welshgov/_application.scss | 21 +- 20 files changed, 409 insertions(+), 299 deletions(-) diff --git a/actions/index.js b/actions/index.js index 9be1c68f..9d01abf4 100644 --- a/actions/index.js +++ b/actions/index.js @@ -62,17 +62,17 @@ export const getSASToken = () => { "&skn=" + m_SasKeyName; - console.log("///////////////////////"); - console.log( - "encodedURI:" + "https://" + m_ResourceURI + "/" + m_Path + "/" - ); - console.log("WEBAPI_URL: " + WEBAPI_URL); - console.log("m_ResourceURI: " + m_ResourceURI); - console.log("m_Path: " + m_Path); - console.log("m_SasKey: " + m_SasKey); - console.log("m_SasKeyName: " + m_SasKeyName); - console.log("token: " + token); - console.log("///////////////////////"); + // console.log("///////////////////////"); + // console.log( + // "encodedURI:" + "https://" + m_ResourceURI + "/" + m_Path + "/" + // ); + // console.log("WEBAPI_URL: " + WEBAPI_URL); + // console.log("m_ResourceURI: " + m_ResourceURI); + // console.log("m_Path: " + m_Path); + // console.log("m_SasKey: " + m_SasKey); + // console.log("m_SasKeyName: " + m_SasKeyName); + // console.log("token: " + token); + // console.log("///////////////////////"); return token; }; @@ -105,16 +105,16 @@ const crmHeadersReturn = { }; const azureHeaders = (SASToken) => { - console.log({ - headers: { - "OData-MaxVersion": "4.0", - "OData-Version": "4.0", - "Accept": "application/json", - "Prefer": 'odata.include-annotations="*",return=representation', - "Content-Type": "application/json", - "ServiceBusAuthorization": SASToken, - }, - }); + // console.log({ + // headers: { + // "OData-MaxVersion": "4.0", + // "OData-Version": "4.0", + // "Accept": "application/json", + // "Prefer": 'odata.include-annotations="*",return=representation', + // "Content-Type": "application/json", + // "ServiceBusAuthorization": SASToken, + // }, + // }); return { headers: { "OData-MaxVersion": "4.0", @@ -139,13 +139,13 @@ const azureHeaders = (SASToken) => { // }; export const getBasicSearch = (token, searchString) => { - console.log("\n\n", token, searchString); + //console.log("\n\n", token, searchString); return axios .get( WEBAPI_URL + "incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=contains(title, '" + searchString + - "') and pinswg_appealcasetype ne null &$count=true", + "') and pinswg_appealcasetype ne null &$orderby=createdon desc&$count=true&$top=201", azureHeaders(token) ) .then((res) => { @@ -165,7 +165,7 @@ export const getBasicDNSSearch = (token, searchString) => { return axios .get( WEBAPI_URL + - "incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011&$count=true", + "incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011&$orderby=createdon desc&$count=true", azureHeaders(token) ) .then((res) => res.data) @@ -174,8 +174,8 @@ export const getBasicDNSSearch = (token, searchString) => { }); }; -export const getAdvancedSearch = (searchString) => { - console.log(searchString.caseReference); +export const getAdvancedSearch = (token, searchString) => { + //console.log(searchString.caseReference); var queryString = ""; @@ -200,19 +200,19 @@ export const getAdvancedSearch = (searchString) => { searchString.apt : ""; - console.log( - "incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title&$filter=" + - queryString + - " &$count=true" - ); + // console.log( + // "incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title&$filter=" + + // queryString + + // " &$count=true" + // ); return axios .get( WEBAPI_URL + "incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title&$filter=" + queryString + - " &$count=true", + " and pinswg_appealcasetype ne null &$orderby=createdon desc&$count=true&$top=201", - azureHeaders + azureHeaders(token) ) .then((res) => res.data) .catch((error) => { @@ -251,7 +251,7 @@ export const getBasicDNSSearchDetails = (token, appealType, caseReference) => { }); }; -export const getFormData = (whichForm) => { +export const getFormData = (token, whichForm) => { //console.log("got to axios", whichForm); //console.log("api_root: ", BASE_URL); return axios @@ -259,8 +259,8 @@ export const getFormData = (whichForm) => { WEBAPI_URL + "systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode%20eq%20%27pinswg_" + whichForm + - "%27and%20type%20eq%202)&$count=true", - azureHeaders + "%27and%20type%20eq%202)&$count=true&$top=201", + azureHeaders(token) ) .then((res) => res.data) .catch((error) => { @@ -268,14 +268,14 @@ export const getFormData = (whichForm) => { }); }; -export const getMandatoryFields = (whichForm) => { +export const getMandatoryFields = (token, whichForm) => { return axios .get( WEBAPI_URL + "EntityDefinitions(LogicalName='pinswg_" + whichForm + "')/Attributes?$count=true&$select=LogicalName,RequiredLevel", - azureHeaders + azureHeaders(token) ) .then((res) => res.data) .catch((error) => { @@ -283,14 +283,14 @@ export const getMandatoryFields = (whichForm) => { }); }; -export const getPickLists = (whichForm) => { +export const getPickLists = (token, whichForm) => { return axios .get( WEBAPI_URL + "EntityDefinitions(LogicalName='pinswg_" + whichForm + "')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true", - azureHeaders + azureHeaders(token) ) .then((res) => res.data) .catch((error) => { @@ -298,12 +298,12 @@ export const getPickLists = (whichForm) => { }); }; -export const getAppealsTypes = () => { +export const getAppealsTypes = (token) => { return axios .get( WEBAPI_URL + "stringmaps?$filter=attributename%20eq%20%27pinswg_appealcasetype%27&$count=true&$select=value,stringmapid,organizationid,attributevalue", - azureHeaders + azureHeaders(token) ) .then((res) => res.data) .catch((error) => { @@ -413,10 +413,13 @@ export const getAppealTypeDetail = (caseReference, appealcasetype) => { }; //https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/pinswg_planningappeals78s?$filter=pinswg_name eq 'CAS-00015-L7J9H1' -export const getLPA = () => { +export const getLPA = (token) => { // console.log("api_root: ", BASE_URL); return axios - .get(WEBAPI_URL + "accounts?$count=true&$select=name", azureHeaders) + .get( + WEBAPI_URL + "accounts?$count=true&$select=name", + azureHeaders(token) + ) .then((res) => res.data) .catch((error) => { console.log("thi serror", error); @@ -439,6 +442,7 @@ export const getPersonalAccount = () => { }; export const getAppealID = ( + token, caseReference, updateFormCollection, primaryAttribute @@ -454,7 +458,7 @@ export const getAppealID = ( console.log("proxy url", weburl); return axios - .get(weburl, azureHeaders) + .get(weburl, azureHeaders(token)) .then((res) => { var appealID = res.data.value[0][primaryAttribute]; return appealID; @@ -540,14 +544,14 @@ export const updateCase = async ( }); }; -export const getMyCases = (loggedInUserId) => { +export const getMyCases = (token, loggedInUserId) => { return axios .get( WEBAPI_URL + "incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " + loggedInUserId + - " and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3", - azureHeaders + " and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3", + azureHeaders(token) ) .then((res) => res.data) .catch((error) => { @@ -555,7 +559,7 @@ export const getMyCases = (loggedInUserId) => { }); }; -export const getMyRepresentations = () => { +export const getMyRepresentations = (token) => { return ( axios // .get(BASE_URL + "/api/lookups/myRepresentations", { @@ -564,7 +568,7 @@ export const getMyRepresentations = () => { .get( WEBAPI_URL + "incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype ne null &$count=true&$top=3", - azureHeaders + azureHeaders(token) ) .then((res) => res.data) .catch((error) => { @@ -573,7 +577,7 @@ export const getMyRepresentations = () => { ); }; -export const getWatchedCases = () => { +export const getWatchedCases = (token) => { return ( axios @@ -583,7 +587,7 @@ export const getWatchedCases = () => { .get( WEBAPI_URL + "incidents?$select=_accountid_value,_customerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype ne null &$count=true&$top=3", - azureHeaders + azureHeaders(token) ) .then((res) => res.data) .catch((error) => { @@ -592,7 +596,7 @@ export const getWatchedCases = () => { ); }; -export const getAwaitingSubmission = () => { +export const getAwaitingSubmission = (token) => { return axios .get(BASE_URL + "/api/lookups/awaitingSubmission", { httpsAgent: new https.Agent({ rejectUnauthorized: false }), @@ -603,7 +607,7 @@ export const getAwaitingSubmission = () => { }); }; -export const getPortalModuelDetails = (appealType, caseReference) => { +export const getPortalModuelDetails = (token, appealType, caseReference) => { return axios .get( WEBAPI_URL + @@ -611,7 +615,7 @@ export const getPortalModuelDetails = (appealType, caseReference) => { "?$filter=pinswg_name eq '" + caseReference + "'&$count=true", - azureHeaders + azureHeaders(token) ) .then((res) => res.data) .catch((error) => { diff --git a/components/homepage/casecomment.js b/components/homepage/casecomment.js index 32101655..50e342c2 100644 --- a/components/homepage/casecomment.js +++ b/components/homepage/casecomment.js @@ -3,19 +3,26 @@ import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; export default function CaseComment() { - let { t } = useTranslation(); + let { t } = useTranslation(); - const router = useRouter(); - const { locale } = router; - return ( - - - - {t("home:casescomment-card-title")} - - {t("home:casescomment-card-paragraph-one")} - {t("home:casescomment-card-paragraph-two")} - - - ); + const router = useRouter(); + const { locale } = router; + return ( + + + + {t("home:casescomment-card-title")} + + + {t("home:casescomment-card-paragraph-one")}{" "} + + Casework.PEDW@gov.wales + + + + {t("home:casescomment-card-paragraph-two")} + + + + ); } diff --git a/components/homepage/casesearch.js b/components/homepage/casesearch.js index 6698d0c3..99f4c4b0 100644 --- a/components/homepage/casesearch.js +++ b/components/homepage/casesearch.js @@ -4,6 +4,7 @@ import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; import { connect } from "react-redux"; import { Field, reduxForm } from "redux-form"; +import LoadingOverlay from "react-loading-overlay"; const required = (errorMsg) => (value) => value || typeof value === "number" ? undefined : errorMsg; @@ -36,13 +37,11 @@ const RenderTextfield = ({ } > - {hint1} + {hint1} + - - {hint2} - {" "} - CAS-00009-W8N6W4 + {hint2} CAS-00009-W8N6W4 @@ -67,7 +66,16 @@ let CaseSearch = (props) => { const router = useRouter(); const { locale } = router; + const [showSpinnerState, setShowSpinnerState] = useState(false); + + let spinnerState = () => { + showSpinnerState == true + ? setShowSpinnerState(false) + : setShowSpinnerState(true); + }; + const onHandleSubmit = (values) => { + spinnerState(); router.replace({ pathname: "/searchresults", query: { q: values.basicSearch }, @@ -76,43 +84,56 @@ let CaseSearch = (props) => { }; return ( - - - - - {t("home:casesearch-card-title")} - + <> + + + + + {t("home:casesearch-card-title")} + - + - - - {t("home:casesearch-card-button")} - + + + {t("home:casesearch-card-button")} + + + + {t("home:casesearch-card-advanced-link")} + - - {t("home:casesearch-card-advanced-link")} - - - - + + + + > ); }; diff --git a/components/homepage/dns.js b/components/homepage/dns.js index cbbaf329..12b6504f 100644 --- a/components/homepage/dns.js +++ b/components/homepage/dns.js @@ -2,9 +2,17 @@ import Link from "next/link"; import { useState } from "react"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; +import LoadingOverlay from "react-loading-overlay"; export default function Dns() { let { t } = useTranslation(); + const [showSpinnerState, setShowSpinnerState] = useState(false); + + let spinnerState = () => { + showSpinnerState == true + ? setShowSpinnerState(false) + : setShowSpinnerState(true); + }; return ( @@ -18,12 +26,22 @@ export default function Dns() { - + { + spinnerState(); + }} + > {t("home:dns-card-button")} + ); } diff --git a/components/homepage/login.js b/components/homepage/login.js index b741d6c3..1f1311d8 100644 --- a/components/homepage/login.js +++ b/components/homepage/login.js @@ -75,9 +75,8 @@ export default function Login() {
{t("home:casescomment-card-paragraph-one")}
{t("home:casescomment-card-paragraph-two")}
+ {t("home:casescomment-card-paragraph-one")}{" "} + + Casework.PEDW@gov.wales + +
+ {t("home:casescomment-card-paragraph-two")} +
- {t("home:login-card-forgotten-label")}{" "} - {t("home:login-card-forgotten-link")} + {t("home:login-card-forgotten-label")}
- {t("home:login-comingsoon-temp-1")} + {t("home:login-comingsoon-temp-1")}{" "} + + Casework.PEDW@gov.wales +
{t("home:login-comingsoon-temp-2")}
- {t("search:searchresults-count-label", { - count: resultsArr.length, - })} + {resultsArr.length > 200 + ? t("search:searchresults-max-count-label") + : t("search:searchresults-count-label", { + count: resultsArr.length, + })} . {typeof searchString != "undefined" ? ( <> diff --git a/i18n.json b/i18n.json index 6e796bd4..ca56d3d8 100644 --- a/i18n.json +++ b/i18n.json @@ -9,6 +9,7 @@ "common" ], "/": [ + "common", "home" ], "/myportal": [ diff --git a/locales/cy/common.json b/locales/cy/common.json index 2aee7b1c..d32f97d1 100644 --- a/locales/cy/common.json +++ b/locales/cy/common.json @@ -20,8 +20,10 @@ "social-bar-share-link": "Rhannu’r dudalen hon", "social-bar-share-via-link": "Rhannu’r dudalen hon ar", "breadcrumb-search-results": "Canlyniadau chwilio", - "breadcrumb-advanced-search": "Advanced search", - "breadcrumb-advanced-search-results": "Advanced search results", + "breadcrumb-advanced-search": "Chwilio uwch", + "breadcrumb-advanced-search-results": "Canlyniadau chwilio uwch", "breadcrumb-my-portal": "Fy mhorth", - "breadcrumb-case-reference": "Cyfeirnod Achos" + "breadcrumb-case-reference": "Cyfeirnod Achos", + "spinner-loading": "Llwytho...", + "spinner-searching": "Chwilio..." } \ No newline at end of file diff --git a/locales/cy/home.json b/locales/cy/home.json index 82425f4e..1e9d4bbc 100644 --- a/locales/cy/home.json +++ b/locales/cy/home.json @@ -1,29 +1,29 @@ { - "login-card-title-temp": "W-Log in or Register soon", - "login-comingsoon-temp-1": "W-First paragraph says something about being able to create accounts", - "login-comingsoon-temp-2": "W-Second paragraph content to go here to explaine something else.", - "login-card-title": "Mewngofnodi neu cofrestru", + "login-card-title-temp": "Croeso", + "login-comingsoon-temp-1": "Mae'r wefan hon yn dal i gael ei datblygu, os ydych am gyflwyno apêl neu gais newydd, cyflwynwch hi, ynghyd ag unrhyw ddogfennaeth berthnasol, i ", + "login-comingsoon-temp-2": "Gellir gofyn am ffurflenni apelio a chais trwy e-bost neu eu lawrlwytho gan ddilyn y ddolen isod.", + "login-card-title": "Mewngofnodi i apelio yn erbyn penderfyniad cynllunio", "login-card-id-label": "Dynodydd Defnyddiwr (ID) Porth y Llywodraeth", "login-card-id-hint": "Gallai hyn fod hyd at 12 o gymeriadau.", "login-card-password-label": "Cyfrinair", "login-card-button": "Mewngofnodi", "login-card-register-label": "Cwsmer newydd wyf a hoffwn", "login-card-register-link": "Gofrestru", - "login-card-forgotten-label": "Wedi anghofio eich cyfrinair neu'ch enw defnyddiwr?", + "login-card-forgotten-label": "Rwyf wedi anghofio fy nghyfrinair", "login-card-forgotten-link": "Cliciwch yma", "casesearch-card-title": "Chwilio am achos", "casesearch-card-search-hint": "Chwiliwch drwy roi cyfeirnod 7 digid yr achos", - "casesearch-card-search-example-label": "Enghraifft", - "casesearch-card-button": "Cyflwyno Chwiliad", + "casesearch-card-search-example-label": "Enghraifft:", + "casesearch-card-button": "Cyflwyno chwiliad", "casesearch-card-advanced-link": "Fel arall, gallwch chwilio gan ddefnyddio ein meini prawf eraill gyda'n chwiliad uwch", "casesearch-search-validation-required": "Angenrheidiol", "casesearch-search-validation-minlength": "Rhaid bod yn 4 nod neu fwy", "casescomment-card-title": "Gwneud sylw ar achos", - "casescomment-card-paragraph-one": "Chwiliwch am eich achos a chliciwch y botwm 'Gwneud Sylw'. Y ffordd orau o roi sylwadau ar achos cyfredol yw trwy gofrestru gyda ni'n gyntaf gan fod hynny'n gwneud olrhain achosion a chyflwyno sylwadau yn haws.", - "casescomment-card-paragraph-two": "Yn achos apeliadau deiliaid tai ac apeliadau masnachol, nid yw partïon â buddiant yn gallu gwneud sylwadau yn y cam apelio. Caiff unrhyw sylwadau a wneir yn y cam ymgeisio eu darparu gan yr awdurdod cynllunio lleol ac fe'u hystyrir gan yr Arolygydd.", - "inspectorate-card-visit-label" : "Ymweld Yr Arolygiaeth Gynllunio", + "casescomment-card-paragraph-one": "Yn syml, chwiliwch am eich achos i weld y ddogfennaeth sy'n gysylltiedig â'r achos. Yna cyflwynwch eich cynrychiolaeth i ", + "casescomment-card-paragraph-two": "Ar gyfer apeliadau Deiliaid Tai a Masnachol, ni all partïon â diddordeb gyflwyno sylwadau yn ystod y cam apelio. Bydd unrhyw sylwadau a wneir yn ystod y cam ymgeisio yn cael eu darparu gan yr awdurdod cynllunio lleol a'u hystyried gan yr arolygydd.", + "inspectorate-card-visit-label": "Ymweld Yr Arolygiaeth Gynllunio", "inspectorate-card-visit-link": "Hafan", - "dns-card-title":"Datblygiadau o Arwyddocâd Cenedlaethol", - "dns-card-paragraph":"Mae Datblygiad o Arwyddocâd Cenedlaethol (DAC) yn fath o gais cynllunio ar gyfer prosiect seilwaith mawr sydd o bwysigrwydd cenedlaethol yng Nghymru. Yn y fan hon, gallwch gael gwybod am geisiadau DAC arfaethedig. Rheolir y safle hwn gan yr Arolygiaeth Gynllunio.", - "dns-card-button":"Gweld pob cais" + "dns-card-title": "Datblygiadau o Arwyddocâd Cenedlaethol", + "dns-card-paragraph": "Mae Datblygiad o Arwyddocâd Cenedlaethol (DAC) yn fath o gais cynllunio ar gyfer prosiect seilwaith mawr sydd o bwysigrwydd cenedlaethol yng Nghymru. Yn y fan hon, gallwch gael gwybod am geisiadau DAC arfaethedig. Rheolir y safle hwn gan yr Arolygiaeth Gynllunio.", + "dns-card-button": "Gweld pob cais" } \ No newline at end of file diff --git a/locales/cy/search.json b/locales/cy/search.json index d155c0fb..c6bc59a3 100644 --- a/locales/cy/search.json +++ b/locales/cy/search.json @@ -47,6 +47,7 @@ "clear-all-button-label": "Clirio Pob Un", "searchresults-title-label": "Crynodeb o’r Achos ar gyfer", "searchresults-count-label": "Cafodd eich chwiliad {{count}} o ganlyniadau", + "searchresults-max-count-label": "Dychwelodd eich chwiliad fwy na 200 o ganlyniadau. Mireiniwch eich chwiliad. Mae'r 200 achos diweddaraf yn cael eu harddangos", "searchresults-case-reference-label": "Cyfeirnod yr Achos", "searchresults-case-count-label": "Fe wnaethoch chi chwilio am", "searchresults-site-address-label": "Cyfeiriad y Safle", diff --git a/locales/en/common.json b/locales/en/common.json index f629f392..c351dc59 100644 --- a/locales/en/common.json +++ b/locales/en/common.json @@ -23,5 +23,7 @@ "breadcrumb-advanced-search": "Advanced search", "breadcrumb-advanced-search-results": "Advanced search results", "breadcrumb-my-portal": "My portal", - "breadcrumb-case-reference": "Case Reference" + "breadcrumb-case-reference": "Case Reference", + "spinner-loading": "Loading...", + "spinner-searching": "Searching..." } \ No newline at end of file diff --git a/locales/en/home.json b/locales/en/home.json index fad55c88..977abe48 100644 --- a/locales/en/home.json +++ b/locales/en/home.json @@ -1,29 +1,29 @@ { - "login-card-title-temp": "Log in or Register soon", - "login-comingsoon-temp-1": "First paragraph says something about being able to create accounts", - "login-comingsoon-temp-2": "Second paragraph content to go here to explaine something else.", - "login-card-title": "Log in or Register", + "login-card-title-temp": "Welcome", + "login-comingsoon-temp-1": "This website is still in development, if you wish to submit a new appeal or application please submit it, along with any relevant documentation, to ", + "login-comingsoon-temp-2": "Appeal and application forms can be requested by email or downloaded following the below link.", + "login-card-title": "Sign in to appeal a planning decision", "login-card-id-label": "Government Gateway user ID", "login-card-id-hint": "This could be up to 12 characters.", "login-card-password-label": "Password", "login-card-button": "Sign in", "login-card-register-label": "I am a new user and would like to", "login-card-register-link": "Register", - "login-card-forgotten-label": "Forgotten your password or username?", + "login-card-forgotten-label": "I have forgotten my password", "login-card-forgotten-link": "Click here", "casesearch-card-title": "Search for a case", "casesearch-card-search-hint": "Search by entering the 7 digit case reference number", - "casesearch-card-search-example-label": "Example", - "casesearch-card-button": "Submit Search", - "casesearch-card-advanced-link": "Advanced Search", + "casesearch-card-search-example-label": "Example:", + "casesearch-card-button": "Submit search", + "casesearch-card-advanced-link": "Advanced search", "casesearch-search-validation-required": "Required", "casesearch-search-validation-minlength": "Must be 4 characters or more", "casescomment-card-title": "Comment on a case", - "casescomment-card-paragraph-one": "Simply search for your case and click on the 'Make Representation' button. The best way to comment on an existing case is to register with us first as that makes it easier to track cases and submit comments.", - "casescomment-card-paragraph-two": "For Householder and Commercial appeals, interested parties are unable to make representations at appeal stage. Any representations made at application stage will be provided by the local planning authority and considered by the Inspector.", - "inspectorate-card-visit-label" : "Visit the Planning Inspectorate", + "casescomment-card-paragraph-one": "Simply search for your case to view the documentation associated to the case. Then submit your representation to ", + "casescomment-card-paragraph-two": "For Householder and Commercial appeals, interested parties are unable to make representations at appeal stage. Any representations made at application stage will be provided by the local planning authority and considered by the inspector.", + "inspectorate-card-visit-label": "Visit the Planning Inspectorate", "inspectorate-card-visit-link": "Home", - "dns-card-title":"Developments of National Significance", - "dns-card-paragraph":"A Development of National Significance (DNS) is a type of planning application for a large infrastructure project of national importance in Wales. Here you can find out about proposed DNS applications. This site is managed by the Planning Inspectorate.", - "dns-card-button":"View all applications" + "dns-card-title": "Developments of National Significance", + "dns-card-paragraph": "A Development of National Significance (DNS) is a type of planning application for a large infrastructure project of national importance in Wales. Here you can find out about proposed DNS applications. This site is managed by the Planning Inspectorate.", + "dns-card-button": "View all applications" } \ No newline at end of file diff --git a/locales/en/search.json b/locales/en/search.json index 4e314770..0558704b 100644 --- a/locales/en/search.json +++ b/locales/en/search.json @@ -47,6 +47,7 @@ "clear-all-button-label": "Clear all", "searchresults-title-label": "Search for a case", "searchresults-count-label": "Your search returned {{count}} results", + "searchresults-max-count-label": "Your searched returned more than 200 results. Please refine your search. The most recent 200 cases are displayed", "searchresults-case-reference-label": "Case reference", "searchresults-case-count-label": "You searched for", "searchresults-site-address-label": "Site address", diff --git a/package.json b/package.json index 278d7d7f..e9a8bc4f 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "react-datepicker": "^4.1.1", "react-dom": "17.0.2", "react-dropzone": "^11.3.4", + "react-loading-overlay": "^1.0.1", "react-redux": "^7.2.4", "react-xml-parser": "^1.1.8", "redux-devtools-extension": "^2.13.9", diff --git a/pages/advancedsearch.js b/pages/advancedsearch.js index a76cc9da..5a2f1178 100644 --- a/pages/advancedsearch.js +++ b/pages/advancedsearch.js @@ -1,4 +1,5 @@ import _ from "lodash"; +import { useState } from "react"; import Head from "next/head"; import Header from "../components/header"; import Banner from "../components/banner"; @@ -21,7 +22,13 @@ import { setAppealLPA, getAppealTypeObj, } from "../store/appealType/action"; -import { getAppealsTypes, getLPA, updateCase, createCase } from "../actions"; +import { + getAppealsTypes, + getLPA, + updateCase, + createCase, + getSASToken, +} from "../actions"; import { setLPA } from "../store/lpa/action"; const Home = (props) => { @@ -59,9 +66,11 @@ const Home = (props) => { export const getServerSideProps = wrapper.getServerSideProps( (store) => async ({ query, req, res }) => { + const token = await getSASToken(); + const [appealTypeData, lpaData, caseData] = await Promise.all([ - await getAppealsTypes(), - await getLPA(), + await getAppealsTypes(token), + await getLPA(token), ]); store.dispatch(setAppealType(appealTypeData)); diff --git a/pages/advancedsearchresults.js b/pages/advancedsearchresults.js index 682f4177..e8665cb7 100644 --- a/pages/advancedsearchresults.js +++ b/pages/advancedsearchresults.js @@ -22,7 +22,11 @@ import { setSearchDetails, getSearchResultsObj, } from "../store/searchOutput/action"; -import { getAdvancedSearch, getBasicSearchDetails } from "../actions"; +import { + getAdvancedSearch, + getBasicSearchDetails, + getSASToken, +} from "../actions"; const Home = (props) => { const { footerLinks, pages } = props; @@ -63,10 +67,13 @@ export const getServerSideProps = wrapper.getServerSideProps( console.log("query-", query); //console.log("search array:", Object.entries(query)); - let querystring; + const token = await getSASToken(); - const searchResultsObj = await getAdvancedSearch(query); - const searchDetailsObj = await getSearchDetails(searchResultsObj); + const searchResultsObj = await getAdvancedSearch(token, query); + const searchDetailsObj = await getSearchDetails( + token, + searchResultsObj + ); // console.log(searchDetailsObj); store.dispatch(setSearchResults(searchResultsObj)); store.dispatch(setSearchDetails(searchDetailsObj)); @@ -83,7 +90,7 @@ const getFormCollection = (formtype) => { return collectionName[0]; }; -const getSearchDetails = (searchResultsObj) => { +const getSearchDetails = (token, searchResultsObj) => { //console.log(searchResultsObj); let detailsArr = []; @@ -95,6 +102,7 @@ const getSearchDetails = (searchResultsObj) => { } else { detailsArr.push( getBasicSearchDetails( + token, getFormCollection( "pinswg_" + searchDetail[ diff --git a/pages/searchresults.js b/pages/searchresults.js index 6b7892ba..b2b3dd3c 100644 --- a/pages/searchresults.js +++ b/pages/searchresults.js @@ -65,13 +65,13 @@ export const getServerSideProps = wrapper.getServerSideProps( const searchResultsObj = await getBasicSearch(token, query.q); - console.log("sssss", searchResultsObj); + //console.log("sssss", searchResultsObj); const searchDetailsObj = await getSearchDetails( token, searchResultsObj ); - console.log(searchDetailsObj); + //console.log(searchDetailsObj); store.dispatch(setSearchResults(searchResultsObj)); store.dispatch(setSearchDetails(searchDetailsObj)); store.dispatch(setSearch(query.q)); @@ -88,7 +88,7 @@ const getFormCollection = (formtype) => { }; const getSearchDetails = (token, searchResultsObj) => { - console.log(searchResultsObj); + //console.log(searchResultsObj); let detailsArr = []; console.log("search results", searchResultsObj); diff --git a/styles/sass/welshgov/_application.scss b/styles/sass/welshgov/_application.scss index ce523103..b6d0652d 100644 --- a/styles/sass/welshgov/_application.scss +++ b/styles/sass/welshgov/_application.scss @@ -402,11 +402,11 @@ a.longLinkBreak { font-size: 19px; } -.at-nav h3 { -} +// .at-nav h3 { +// } -.at-nav__chapter { -} +// .at-nav__chapter { +// } .at-nav__section { cursor: pointer; @@ -1107,3 +1107,16 @@ ul#sharePageLinks.active { .react-autosuggest__suggestion--highlighted { background-color: #c3c3c3; } + +/// loading spinner + +._loading_overlay_wrapper { + &._loading_overlay_wrapper--active { + min-height: 100%; + width: 100%; + position: fixed; + top: 0; + left: 0; + z-index: 99; + } +}