Merged PR 1273: added fixes to reduce error when calling module details and filtering of docs

added fixes to reduce error when calling module details and filtering of docs

Related work items: #12609, #12613
This commit is contained in:
Robert Bond
2024-11-06 17:38:55 +00:00
18 changed files with 1277 additions and 269 deletions
+47 -53
View File
@@ -4,47 +4,46 @@ GRANT_TYPE = "client_credentials"
HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c
//CNR oauth CNR
CLIENT_ID = 3125ac03-91ac-46a7-a166-0086f0ed90b3
CLIENT_SECRET = bFq8Q~9VX5Ra3lKnGGIXsB.G6-ZGMx7LqyqXjdr4
RELAY_ROOT = https://ar-ns-lz-pedw-cnr-uks-01.servicebus.windows.net/ar-hc-lz-pedw-cnr-uks-01/
RELAYURI = "ar-ns-lz-pedw-cnr-uks-01.servicebus.windows.net"
RELAYPATH = "ar-hc-lz-pedw-cnr-uks-01"
CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS"
# //CNR oauth CNR
# CLIENT_ID = 3125ac03-91ac-46a7-a166-0086f0ed90b3
# CLIENT_SECRET = bFq8Q~9VX5Ra3lKnGGIXsB.G6-ZGMx7LqyqXjdr4
# RELAY_ROOT = https://ar-ns-lz-pedw-cnr-uks-01.servicebus.windows.net/ar-hc-lz-pedw-cnr-uks-01/
# RELAYURI = "ar-ns-lz-pedw-cnr-uks-01.servicebus.windows.net"
# RELAYPATH = "ar-hc-lz-pedw-cnr-uks-01"
# CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS"
//New Dev oauth ESNR
CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a
CLIENT_SECRET = .Jf8Q~tKMObCJjhh_hy3J5AIctFrBalU4FS~tdxk
RELAY_ROOT = https://ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net/ar-hc-lz-pedw-dev-uks-01/
RELAYURI = "ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net"
RELAYPATH = "ar-hc-lz-pedw-dev-uks-01"
CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS"
# //New Dev oauth ESNR
# CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a
# CLIENT_SECRET = .Jf8Q~tKMObCJjhh_hy3J5AIctFrBalU4FS~tdxk
# RELAY_ROOT = https://ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net/ar-hc-lz-pedw-dev-uks-01/
# RELAYURI = "ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net"
# RELAYPATH = "ar-hc-lz-pedw-dev-uks-01"
# CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS"
//New Test
# CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1
# CLIENT_SECRET = 6hT8Q~glL~jloWpGmvXw3UY37QFwjUE0r._jobEM
# RELAY_ROOT = https://ar-ns-lz-pedw-test-uks-01.servicebus.windows.net/ar-hc-lz-pedw-test-uks-01/
# RELAYURI = "ar-ns-lz-pedw-test-uks-01.servicebus.windows.net"
# RELAYPATH = "ar-hc-lz-pedw-test-uks-01"
# CRMURL = "tscrm2016.llcdt.gov.wales/UATPINS"
# //New Test
CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1
CLIENT_SECRET = 6hT8Q~glL~jloWpGmvXw3UY37QFwjUE0r._jobEM
RELAY_ROOT = https://ar-ns-lz-pedw-test-uks-01.servicebus.windows.net/ar-hc-lz-pedw-test-uks-01/
RELAYURI = "ar-ns-lz-pedw-test-uks-01.servicebus.windows.net"
RELAYPATH = "ar-hc-lz-pedw-test-uks-01"
CRMURL = "tscrm2016.llcdt.gov.wales/UATPINS"
//Preprod Oauth WGO
//CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
////CLIENT_SECRET = Ioo7Q~RJfhWsE45wPsuHm1CzRk1SppnNN3lZF
//CLIENT_SECRET = V288Q~P1lFMvvX9Xnkx2pLixK~GOREH983Owqc1E
//RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/
//RELAYURI = "pp-pedw-ns.servicebus.windows.net"
//RELAYPATH = "pp-pedw-hc"
//CRMURL = "ppcrm2016.llc.gov.wales/PPPINSWales"
# //New PreProd
# CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
# CLIENT_SECRET = V288Q~P1lFMvvX9Xnkx2pLixK~GOREH983Owqc1E
# RELAY_ROOT = https://ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net/ar-hc-lz-pedw-ppe-ukw-01/
# RELAYURI = "ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net"
# RELAYPATH = "ar-hc-lz-pedw-ppe-ukw-01"
# CRMURL = "ppcrm2016.llcdt.gov.wales/UATPINS"
//Prod Oauth WGO
//CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc
////CLIENT_SECRET = mJN7Q~lFu.xFGa5KCc.zwIm_fJAWxajyQaFo~
//CLIENT_SECRET = tFk8Q~E.R-HFjROTu1sRKqwb_ONzy05uPYoF6awR
//RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/
//RELAYURI = "prod-pedw-ns.servicebus.windows.net"
//RELAYPATH = "prod-pedw-hc"
//CRMURL = "crm2016.llc.gov.wales/PEDW"
# //Prod Oauth WGO
# CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc
# CLIENT_SECRET = tFk8Q~E.R-HFjROTu1sRKqwb_ONzy05uPYoF6awR
# RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/
# RELAYURI = "prod-pedw-ns.servicebus.windows.net"
# RELAYPATH = "prod-pedw-hc"
# CRMURL = "crm2016.llc.gov.wales/PEDW"
//GOOGLE_TAG_MANAGER = GTM-T78CBC3
@@ -52,11 +51,12 @@ GOOGLE_TAG_MANAGER = G-GTWW3JT03Z
SHOWLOGIN = true
SHOWREPRESENTATIONS = true
SHOWFILEUPLOAD = "false"
SHOWMAPS = "false"
SHOWMAPS = true
API_ROOT = "http://localhost:3000"
CY_API_ROOT = "http://cymru.local:3000"
I18N_DOMAIN = "cymru.local"
DOCAPI_OFFLINE = "12:00:00,14:00:00"
SHOWFILTERDOCS = true
// Next Auth vars
@@ -65,22 +65,17 @@ NEXTAUTH_URL_INTERNAL = $API_ROOT
NEXTAUTH_SECRET = SuperSecret
// CNR sql server
DATABASE_URL = sqlserver://sql-srv-plt-pedw-cnr-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-cnr-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
// dev test sql server
//DATABASE_URL = sqlserver://pedw-dev-test-sql-svr.database.windows.net:1433;database=PEDWDev;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
# DATABASE_URL = sqlserver://pedw-dev-test-sql-svr.database.windows.net:1433;database=PEDWDev;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
DATABASE_URL = sqlserver://sql-srv-plt-pedw-dev-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
// Pre prod sql server
//DATABASE_URL = sqlserver://pp-pedw-sql.database.windows.net:1433;database=PEDWPreProd;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
////DATABASE_URL = sqlserver://pp-pedw-sql.database.windows.net:1433;database=PEDWPreProd;user=pp-pedw-ukw;password=jscw4+896w9YaiXruOA3mtpNkio1oUZxBZcFJ9Awdz4=;encrypt=true;trustservercertificate=false;hostnameincertificate=*.database.windows.net;logintimeout=30;authentication=SqlPassword
//DATABASE_URL = sqlserver://pp-pedw-sql.database.windows.net:1433;database=PEDWPreProd;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustservercertificate=false;hostnameincertificate=*.database.windows.net;logintimeout=30
//DATABASE_URL = sqlserver://pp-pedw-sql.privatelink.database.windows.net:1433;database=PEDWPreProd;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustservercertificate=false;hostnameincertificate=*.database.windows.net;logintimeout=30
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-ppe-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustservercertificate=true;hostnameincertificate=*.database.windows.net;logintimeout=30;authentication=SqlPassword
// Prod sql server
//DATABASE_URL = sqlserver://pp-pedw-sql.database.windows.net:1433;database=PEDWPreProd;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
# DATABASE_URL = sqlserver://pp-pedw-sql.database.windows.net:1433;database=PEDWPreProd;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
SECRET = SuperSecret
@@ -107,11 +102,10 @@ AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwdevuks.blob.core.windows.net
# AZURE_STORAGE_ACCOUNT_KEY = bqJAz5pYQVGee8dnVhlsqW+xHwinNTjgY2AmojNyB+d4uAotMR20WcO4Op13yB+9dFaXAkkjtIA4+AStHT/IYg==
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwtestuks.blob.core.windows.net
// preprod key
//AZURE_STORAGE_ACCOUNT_NAME = "pedwpp"
//AZURE_STORAGE_ACCOUNT_KEY = koZ46STRqapSa2Dod8MLL6aju1eYLhhyJ6DXpCLMTnFLJvbDT6CHUv/jwr5U/Ta8a60MWzwToHQy+AStADO7sg==
//AZURE_PEDW_STORAGE_ENDPOINT = https://pedwpp.blob.core.windows.net
// New preprod key
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwppeuks"
# AZURE_STORAGE_ACCOUNT_KEY = B4GRKr+cA9b9mNM/GHFivzhzflJIZltG8bMmooXlYvGYySPAspTTHistAT30sHipnR+hh6dqUc9q+ASttAjPRQ==
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwppeuks.blob.core.windows.net
// PROD key
+5 -3
View File
@@ -474,7 +474,7 @@ export const getAdvancedSearchPaged = (
});
};
export const getBasicSearchDetails = (
export const getBasicSearchDetails = async (
appealTypeName,
caseReference,
primaryIdAttribute,
@@ -528,7 +528,7 @@ export const getBasicPartSavedDetails = (
});
};
export const getBasicSearchDetailsPaged = (
export const getBasicSearchDetailsPaged = async (
appealTypeName,
caseReference,
primaryIdAttribute,
@@ -1015,7 +1015,7 @@ export const getAwaitingSubmissionFromBlobProxy = (containerName) => {
});
};
export const getPortalModuleDetails = (appealType, caseReference) => {
export const getPortalModuleDetails = async (appealType, caseReference) => {
//console.log(
// BASE_URL +
// "/api/endpoint/getportalmoduledetails_api?appealType=" +
@@ -1023,6 +1023,7 @@ export const getPortalModuleDetails = (appealType, caseReference) => {
// "&caseReference=" +
// encodeURI(caseReference)
// );
return axios
.get(
BASE_URL +
@@ -1033,6 +1034,7 @@ export const getPortalModuleDetails = (appealType, caseReference) => {
)
.then((res) => res.data)
.catch((error) => {
console.log("error case ref:", caseReference);
consoleLogger(error);
});
};
+47 -13
View File
@@ -748,6 +748,38 @@ const Breadcrumbs = (props) => {
</li>
</>
)}
{router.pathname ==
"/myportal/dns/[developmentName]" && (
<>
<li className="govuk-breadcrumbs__list-item">
<Link
href={
router.locale != "en"
? router.locale + "/fymhorth"
: "/myportal"
}
className="govuk-breadcrumbs__link"
>
{t("common:breadcrumb-my-portal")}
</Link>
</li>
<li className="govuk-breadcrumbs__list-item">
<Link
href={"/myportal/dnsapplications"}
className="govuk-breadcrumbs__link"
>
{t("dnsCommon:service-name")}
</Link>
</li>
<li className="govuk-breadcrumbs__list-item">
{t("common:breadcrumb-case-reference")}:{" "}
{
props.props.currentView.caseReference
.currentReference
}
</li>
</>
)}
{router.pathname == "/case" && (
<>
<li className="govuk-breadcrumbs__list-item">
@@ -909,14 +941,23 @@ const Breadcrumbs = (props) => {
</li>
</>
)}
{router.pathname == "/dns/[developmentName]" && (
{router.pathname == "/dnsapplications" && (
<>
<li className="govuk-breadcrumbs__list-item">
{t("dnsCommon:service-name")}
</li>
</>
)}
{router.pathname == "/dnsdetails" && (
<>
<li className="govuk-breadcrumbs__list-item">
<Link
href={
router.locale == "en"
? router.locale + "/../../dns"
: "/../../dns"
router.locale != "en"
? router.locale +
"/dnsapplications"
: "/dnsapplications"
}
className="govuk-breadcrumbs__link"
>
@@ -932,19 +973,12 @@ const Breadcrumbs = (props) => {
</li>
</>
)}
{router.pathname == "/dnsapplications" && (
<>
<li className="govuk-breadcrumbs__list-item">
{t("dnsCommon:service-name")}
</li>
</>
)}
{router.pathname == "/dnsdetails" && (
{router.pathname == "/dns/[developmentName]" && (
<>
<li className="govuk-breadcrumbs__list-item">
<Link
href={
router.locale == "en"
router.locale != "en"
? router.locale +
"/dnsapplications"
: "/dnsapplications"
+3 -8
View File
@@ -34,17 +34,12 @@ const Case = (props) => {
searchDetailsObj={props.searchDetailsObj}
searchString={props.searchString}
incidentid={props.incidentid}
showMap={props.showMap}
showMap={props.showMaps}
currentView={props.currentView}
messagesObj={props.messagesObj}
/>
<Documents
incidentid={props.incidentid}
caseReference={props.caseReference}
searchResultsObj={props.searchResultsObj}
searchDetailsObj={props.searchDetailsObj}
documentDetailsObj={props.documentDetailsObj}
docsOffline={props.props.docsOffline}
documentDetailsObj={props.documentDetailsObj}
showFilteredDocs={props.showFilteredDocs}
/>
{showRepresentations == true && (
<RepresentationList
+479 -23
View File
@@ -30,6 +30,7 @@ const DocumentDetails = (props) => {
setDocumentDetails,
setCurrentPage,
docsOffline,
showFilteredDocs,
} = props;
const router = useRouter();
@@ -40,6 +41,53 @@ const DocumentDetails = (props) => {
const [selectedOption, setSelectedOption] = useState(10);
const [documentTypes, setDocumentTypes] = useState([{}]);
const [selectedDocumentType, setSelectedDocumentType] = useState("all");
const [selectAll, setSelectAll] = useState(false);
const [checkedItems, setCheckedItems] = useState(
documentTypes.reduce((acc, item) => {
acc[item.pinswg_isharedocumentlocations] = false;
return acc;
}, {})
);
const handleCheckboxChange = (e) => {
const { name, checked } = e.target;
setCheckedItems((prev) => ({
...prev,
[name]: checked,
}));
setSelectAll(false);
};
const handleSelectAllChange = (e) => {
const { checked } = e.target;
setSelectAll(checked); // Set the 'Select All' state
if (checked) {
// If 'Select All' is checked, check all the other checkboxes
setCheckedItems(
documentTypes.reduce((acc, item) => {
acc[item.pinswg_isharedocumentlocations] = true;
return acc;
}, {})
);
} else {
clearCheckboxes();
}
};
const clearCheckboxes = () => {
setSelectAll(false);
setCheckedItems(
documentTypes.reduce((acc, item) => {
acc[item.pinswg_isharedocumentlocations] = false;
return acc;
}, {}),
setSelectedDocumentType("all"),
setCurrentPage(1)
);
};
let ShowDocLinks = false;
let checkShowDocLinks = docsOffline != false ? true : false;
@@ -107,7 +155,7 @@ const DocumentDetails = (props) => {
id="showDocumentType"
name="showDocumentType"
>
<option value="all">
<option value="all" key="00">
{router.locale == "cy"
? jsonpath(
'$..[?(@.value=="All")].value_cy',
@@ -411,6 +459,416 @@ const DocumentDetails = (props) => {
);
};
const FilteredDocumentView = (documentDetailsArr) => {
documentDetailsArr = documentDetailsArr.value;
return (
<>
{ShowDocLinks && (
<div className="govuk-warning-text ">
<span
className="govuk-warning-text__icon"
aria-hidden="true"
>
!
</span>
<strong className="govuk-warning-text__text govuk-!-margin-top-2">
<span className="govuk-visually-hidden">
Notice
</span>
{t("case:documents-not-available-label")}
</strong>
</div>
)}
<div className="docFilteringGroup">
<div className="govuk-!-width-one-third">
{" "}
<div className="govuk-form-group filterByGroup">
<p>
{documentDetailsObj["@odata.count"] > 1
? t("case:documents-count-label-1")
: t("case:documents-count-label-1a")}{" "}
{documentDetailsObj["@odata.count"]}{" "}
{documentDetailsObj["@odata.count"] > 1
? t("case:documents-count-label-2")
: t("case:documents-count-label-2a")}
</p>
<div>
<button onClick={clearCheckboxes}>
Clear filter
</button>
</div>
<div className="govuk-checkboxes govuk-checkboxes--small">
{" "}
<>
<div className="govuk-checkboxes__item">
<input
className="govuk-checkboxes__input"
type="checkbox"
id={"all_" + "_" + 0}
key={0}
name={"all_" + "_" + 0}
checked={selectAll}
value={"all"}
onChange={handleSelectAllChange}
/>
<label
className="govuk-label-s govuk-checkboxes__label"
htmlFor={"all" + "__" + 0}
>
All - (
{documentTypes.reduce(
(accumulator, currentItem) => {
return (
accumulator +
currentItem.count
);
},
0
)}
)
</label>
</div>
</>
{documentTypes.map((item, key) => {
return (
<div
className="govuk-checkboxes__item"
key={key}
>
<input
className="govuk-checkboxes__input"
type="checkbox"
id={
item.pinswg_isharedocumentlocations
}
key={key}
value={
item.pinswg_isharedocumentlocations
}
name={
item.pinswg_isharedocumentlocations
}
checked={
checkedItems[
item
.pinswg_isharedocumentlocations
]
}
onChange={handleCheckboxChange}
/>
<label
className="govuk-label-s govuk-checkboxes__label"
htmlFor={
item.pinswg_isharedocumentlocations
}
>
{router.locale == "cy"
? jsonpath(
'$..[?(@.value=="' +
item.pinswg_isharedocumentlocationsLabel +
'")].value_cy',
transLookup
)
: item.pinswg_isharedocumentlocationsLabel ||
t(
"case:summary-no-date-entered-label"
)}{" "}
- ({item.count})
</label>
</div>
);
})}
</div>{" "}
<div>
<button
className="govuk-button "
type="button"
onClick={(e) => {
const data = [
...document.querySelectorAll(
".govuk-checkboxes__input:checked"
),
].map((e) => e.value);
setSelectedDocumentType(data);
setCurrentPage(1);
}}
>
Filter documents
</button>
</div>
{documentDetailsObj["@odata.count"] > 5 && (
<div
id="recordCountSelect"
className="govuk-grid-row govuk-!-margin-left-0"
>
<div className="govuk-form-group">
<label
className="govuk-label-s "
htmlFor="showNumberOfRecords"
>
{t(
"search:searchresults-show-records-label-a"
)}
<select
onChange={(e) => {
setSelectedOption(
e.target.value
);
setCurrentPage(1);
}}
value={selectedOption}
className="govuk-select"
id="showNumberOfRecords"
name="showNumberOfRecords"
>
<option value="5">5</option>
<option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="50">50</option>
</select>{" "}
{t(
"search:searchresults-show-records-label-b"
)}
</label>
</div>
</div>
)}
</div>
</div>
<div className="govuk-!-width-two-thirds docResults">
{" "}
<dl className=" govuk-summary-list govuk-!-margin-bottom-9 results documentList">
<div className="govuk-summary-list__row results-headings">
<dd className="govuk-summary-list__key govuk-!-font-size-16 ">
<button
type="button"
onClick={() =>
sortDataBy("pinswg_name")
}
className={
orderByState == "pinswg_name"
? fieldSortState == "asc"
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
}
>
{t("case:documents-name-label")}
</button>
</dd>
<dd className="govuk-summary-list__key govuk-!-font-size-16">
{/* {t("case:documents-doc-type-label")} */}
<button
type="button"
onClick={() =>
sortDataBy(
"pinswg_isharedocumentlocations"
)
}
className={
orderByState ==
"pinswg_isharedocumentlocations"
? fieldSortState == "asc"
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
}
>
{t("case:documents-doc-type-label")}
</button>
</dd>
<dd className="govuk-summary-list__key govuk-!-font-size-16">
{/* {t("case:documents-date-published-label")} */}
<button
type="button"
onClick={() => sortDataBy("createdon")}
className={
orderByState == "createdon"
? fieldSortState == "asc"
? `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortAsc`
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16 sortDesc`
: `govuk-link govuk-link--no-underline govuk-!-font-weight-bold govuk-!-font-size-16`
}
>
{t(
"case:documents-date-published-label"
)}
</button>
</dd>
{/* <dd className="govuk-summary-list__key govuk-!-font-size-16">
{t("case:documents-size-label")}
</dd> */}
</div>
{showSpinnerState == true ? (
<div className="govuk-summary-list__row">
<div className="govuk-!-margin-top-4 govuk-!-margin-bottom-4 govuk-!-font-weight-bold govuk-!-font-size-20 ">
{t("common:spinner-fetching-data")}
<img
className="data-loading-icon"
src="/assets/images/loading.gif"
alt={
router.locale == "cy"
? "Nôl data"
: "Fetching data"
}
/>
</div>
</div>
) : (
documentDetailsArr.map((item, key) => {
let detailsObj = jsonpath(
"$..[?(@._pinswg_documentids_value=='" +
incidentid +
"')]",
item
);
detailsObj = item;
return (
<div
className="govuk-summary-list__row"
key={key}
>
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
{showDownloadingState ===
key && (
<div className="coverLoadingLink downloading">
{/* <img
className="data-loading-icon"
src="/assets/images/loading.gif"
alt={
router.locale ==
"cy"
? "Nôl data"
: "Fetching data"
}
/> */}
</div>
)}
{!ShowDocLinks ? (
<Link
scroll={false}
href={
detailsObj.pinswg_hashlink
}
key={key}
onClick={() => {
toggleDownLoadLink(
key
),
sendGAEvent(
"event",
"DownloadedFile",
{
caseReference:
props.caseReference,
filename:
detailsObj.pinswg_name,
}
);
}}
>
<span className="results-visually-hidden">
{t(
"case:documents-name-label"
)}
:
</span>
{_.has(
detailsObj,
"pinswg_name"
)
? detailsObj.pinswg_name
: ""}
</Link>
) : (
<>
<span className="results-visually-hidden">
{t(
"case:documents-name-label"
)}
:
</span>
{_.has(
detailsObj,
"pinswg_name"
)
? detailsObj.pinswg_name
: ""}
</>
)}
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">
{t(
"case:documents-doc-type-label"
)}
:
</span>
{router.locale == "cy"
? jsonpath(
'$..[?(@.value=="' +
detailsObj[
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy',
transLookup
)
: detailsObj[
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
] ||
t(
"case:summary-no-date-entered-label"
)}
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">
{t(
"case:documents-date-published-label"
)}
:
</span>
{_.has(
detailsObj,
"pinswg_latestpublisheddate"
)
? formatDates(
detailsObj.pinswg_latestpublisheddate
)
: ""}
</dd>
{/* <dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">
{t("case:documents-size-label")}:
</span>
92
</dd> */}
</div>
);
})
)}
</dl>
<PaginationControl
showNoOfRecords={selectedOption}
currentPage={currentPage}
searchResultsObj={documentDetailsObj}
spinnerState={spinnerState}
orderBy={orderByState}
fieldSort={fieldSortState}
getDocumentResults={getDocumentResults}
/>
</div>
</div>
</>
);
};
const getDocumentTypes = useCallback(() => {
getSearchDocumentTypes(props.incidentid).then((data) => {
setDocumentTypes(data);
@@ -563,30 +1021,28 @@ const DocumentDetails = (props) => {
getDocumentResults,
]);
return (
<>
<div>
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<h2>{t("case:documents-heading-label")}</h2>
{_.isEmpty(documentDetailsObj.value) ? (
<div className="govuk-grid-row">
<div className="govuk-grid-column-two-thirds">
<h3>
{showDocumentSearchState == false
? t("case:documents-checking-label")
: t(
"case:documents-non-available-label"
)}
</h3>
</div>
</div>
) : (
DocumentView(documentDetailsArr)
)}
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<h2 className="govuk-heading-m ">
{t("case:documents-heading-label")}
</h2>
{_.isEmpty(documentDetailsObj.value) ? (
<div className="govuk-grid-row">
<div className="govuk-grid-column-two-thirds">
<h3>
{showDocumentSearchState == false
? t("case:documents-checking-label")
: t("case:documents-non-available-label")}
</h3>
</div>
</div>
</div>
) : showFilteredDocs == "true" ? (
FilteredDocumentView(documentDetailsArr)
) : (
DocumentView(documentDetailsArr)
)}
</div>
</>
</div>
);
};
+74 -47
View File
@@ -6,6 +6,7 @@ import { useRouter } from "next/router";
import { useEffect } from "react";
import { connect } from "react-redux";
import transLookup from "../../data/lookuptranslations.json";
import Documents from "./documents";
import {
createWatchedCases,
@@ -80,6 +81,7 @@ const CaseSummary = (props) => {
showMap,
currentView,
messagesObj,
docsOffline,
} = props;
const showLoginCheck =
@@ -144,11 +146,11 @@ const CaseSummary = (props) => {
let setCaseQueryObj =
currentType == "directResultsObj"
? props.searchResultsObj.searchResultsObj
? props.searchResultsObj
: props[currentType];
let setCaseDetailsObj =
currentType == "directResultsObj"
? props.searchResultsObj.searchDetailsObj
? props.searchDetailsObj
: props[currentType + "Details"];
var casesObj = {};
@@ -212,7 +214,7 @@ const CaseSummary = (props) => {
let showDetailsBlock =
showDetails == true ? (
<div>
<>
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<h1 className="govuk-heading-xl govuk-!-margin-bottom-7">
@@ -620,49 +622,54 @@ const CaseSummary = (props) => {
))}
{!session && (
<button
className="govuk-link watchCase"
onClick={() => {
confirm(
"Trying to watch case " +
props.currentView
.caseReference
.currentReference +
"\n\nYou will now be prompted to sign in"
) &&
// signIn("email", {
// callbackUrl:
// "/myportal/case/" +
// props
// .currentView
// .caseReference
// .ticketnumber,
// });
<>
<button
className="govuk-link watchCase"
onClick={() => {
confirm(
"Trying to watch case " +
props
.currentView
.caseReference
.currentReference +
"\n\nYou will now be prompted to sign in"
) &&
// signIn("email", {
// callbackUrl:
// "/myportal/case/" +
// props
// .currentView
// .caseReference
// .ticketnumber,
// });
setCookie(
null,
"pedwWatchCase",
currentType ==
"searchResultsObj"
? detailsObj.pinswg_name
: currentType ==
"directResultsObj"
? casesObj.title
: casesObj.reference,
{
path: "/",
expires:
expDate,
}
),
signIn();
}}
title={t(
"case:watch-this-case-link"
)}
>
{t("case:watch-this-case-link")}
</button>
setCookie(
null,
"pedwWatchCase",
currentType ==
"searchResultsObj"
? detailsObj.pinswg_name
: currentType ==
"directResultsObj"
? casesObj.title
: casesObj.reference,
{
path: "/",
expires:
expDate,
}
),
signIn();
}}
title={t(
"case:watch-this-case-link"
)}
>
{t(
"case:watch-this-case-link"
)}
</button>
</>
)}
</div>
</div>
@@ -698,7 +705,16 @@ const CaseSummary = (props) => {
)}
{showSummary(casesObj, detailsObj)}
</div>
<Documents
incidentid={props.incidentid}
caseReference={props.caseReference}
searchResultsObj={props.searchResultsObj}
searchDetailsObj={props.searchDetailsObj}
documentDetailsObj={props.documentDetailsObj}
docsOffline={docsOffline}
showFilteredDocs={props.showFilteredDocs}
/>
</>
) : (
<>
<div>
@@ -1182,7 +1198,18 @@ const CaseSummary = (props) => {
const mapStateToProps = (state) => {
return {
...state,
accountDetails: state.accountDetails,
currentView: state.currentView,
search: state.search,
// searchResultsObj: state.searchResultsObj,
documentDetailsObj: state.searchResultsObj.documentDetailsObj,
formData: state.formData,
appealType: state.appealType,
form: state.form,
myCases: state.myCases,
watchedCases: state.watchedCases,
myRepresentations: state.myRepresentations,
awaitingSubmission: state.awaitingSubmission,
};
};
+8 -8
View File
@@ -310,14 +310,14 @@ const DNSSearchResults = (props) => {
<Link
href={
router.locale == "cy"
? (myportal == true
? "/fymhorth"
: "") +
"/manyliondns"
: (myportal == true
? "/myportal"
: "") +
"/dnsdetails"
? myportal == true
? "/fymhorth/dns"
: "/dns"
: myportal == true
? "/myportal/dns/" +
item.ticketnumber
: "/dns/" +
item.ticketnumber
}
className="govuk-link--no-underline"
onClick={() => {
+10 -7
View File
@@ -242,7 +242,8 @@ const SearchResults = (props) => {
'")]',
searchDetailsObj
);
detailsObj = detailsObj[0];
detailsObj = detailsObj[0] || {};
return (
<div
className="govuk-summary-list__row"
@@ -285,12 +286,14 @@ const SearchResults = (props) => {
"showLoginCheck":
props.showLoginCheck,
"specialistProcess":
detailsObj.pinswg_speacialistcaseprocess !=
null ||
detailsObj.pinswg_specialistcaseprocess !=
null
? detailsObj.pinswg_speacialistcaseprocess ||
detailsObj.pinswg_specialistcaseprocess
detailsObj.hasOwnProperty(
"pinswg_speacialistcaseprocess"
)
? detailsObj.pinswg_speacialistcaseprocess
: detailsObj.hasOwnProperty(
"pinswg_specialistcaseprocess"
)
? detailsObj.pinswg_specialistcaseprocess
: "",
});
}}
+2
View File
@@ -27,6 +27,8 @@ module.exports = {
"dnsCommon",
"dnsApplications",
],
"/myportal/dns/*": ["dnsCommon", "case", "common"],
"/myportal/dns/[developmentName]": ["dnsCommon", "case", "common"],
"/advancedsearch": ["search", "myportal"],
"/advancedsearchresults": ["search"],
"/searchresults": ["search", "case"],
+3 -3
View File
@@ -42,10 +42,10 @@ class MyDocument extends Document {
csp += `form-action 'self' ` + process.env.NEXTAUTH_URL + ` ;`;
csp += `object-src 'self' data:;`;
csp += `default-src 'self' https://www.google-analytics.com;`;
csp += `connect-src 'self' http://127.0.0.1 https://ukwest-0.in.applicationinsights.azure.com https://js.monitor.azure.com https://region1.google-analytics.com;`;
csp += `script-src 'self' 'unsafe-eval' 'unsafe-inline' https://ukwest-0.in.applicationinsights.azure.com https://region1.google-analytics.com https://www.google-analytics.com/ https://tagmanager.google.com/ https://www.googletagmanager.com/;`;
csp += `connect-src 'self' http://127.0.0.1 https://maps.googleapis.com https://ukwest-0.in.applicationinsights.azure.com https://js.monitor.azure.com https://region1.google-analytics.com;`;
csp += `script-src 'self' 'unsafe-eval' 'unsafe-inline' https://maps.googleapis.com https://ukwest-0.in.applicationinsights.azure.com https://region1.google-analytics.com https://www.google-analytics.com/ https://tagmanager.google.com/ https://www.googletagmanager.com/;`;
csp += `style-src 'self' 'unsafe-inline' https://pro.fontawesome.com/ https://www.google-analytics.com https://tagmanager.google.com/ https://www.googletagmanager.com/ https://fonts.googleapis.com/;`;
csp += `img-src 'self' 'unsafe-inline' https://www.gov.wales https://gov.wales https://fonts.gstatic.com https://www.googletagmanager.com https://www.google-analytics.com https://ssl.gstatic.com/ blob: data:;`;
csp += `img-src 'self' 'unsafe-inline' https://maps.gstatic.com https://maps.googleapis.com https://www.gov.wales https://gov.wales https://fonts.gstatic.com https://www.googletagmanager.com https://www.google-analytics.com https://ssl.gstatic.com/ blob: data:;`;
csp += `font-src 'self' 'unsafe-inline' https://pro.fontawesome.com/ https://fonts.gstatic.com/ data:;`;
return (
+11 -2
View File
@@ -25,9 +25,17 @@ export default async function ApiProxy(req, res) {
var token = await getToken();
var queryUrl =
"incidents?$select=_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,statuscode,ticketnumber,title &$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
"incidents?$select=pinswg_appealcasetype,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,statuscode,ticketnumber,title &$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
//console.log(queryUrl);
console.log(queryUrl);
function renameJsonKey(jsonObj, oldKey, newKey) {
if (jsonObj.hasOwnProperty(oldKey)) {
jsonObj[newKey] = jsonObj[oldKey]; // Add new key with the same value
delete jsonObj[oldKey]; // Delete old key
}
return jsonObj;
}
return axios
.get(
@@ -36,6 +44,7 @@ export default async function ApiProxy(req, res) {
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
@@ -38,27 +38,33 @@ const hashAPIPath = (queryPath) => {
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
const groupArray = (arr = []) => {
// create map
let map = new Map();
for (let i = 0; i < arr.length; i++) {
const s = JSON.stringify(arr[i]);
if (!map.has(s)) {
map.set(s, {
pinswg_isharedocumentlocations:
arr[i].pinswg_isharedocumentlocations,
pinswg_isharedocumentlocationsLabel:
arr[i][
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
],
// count: 1,
});
} else {
//map.get(s).count++;
}
}
const res = Array.from(map.values());
return res;
const groupArray = (arr) => {
const map = new Map();
// Count occurrences of each object
arr.forEach((obj) => {
const key = JSON.stringify(obj);
map.set(key, (map.get(key) || 0) + 1);
});
// Create a new array to store unique objects with count
const result = [];
map.forEach((count, key) => {
const obj = JSON.parse(key);
const transformedObj = {
pinswg_isharedocumentlocations: obj.pinswg_isharedocumentlocations, // Change 'id' to 'userId'
pinswg_isharedocumentlocationsLabel:
obj[
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
], // Change 'name' to 'userName'
count: count, // Add 'count' as 'occurrences'
};
result.push(transformedObj);
});
return result;
};
export default async function ApiProxy(req, res) {
@@ -92,6 +92,37 @@ export default async function ApiProxy(req, res) {
var showNumberOfRecords = req.query.showNumberOfRecords;
var documentType = req.query.documentType || "all";
// (documentType != "all"
// ? documentType.indexOf(",")<0?" and pinswg_isharedocumentlocations eq " + documentType :
// : "") +
var docTypeQueryString = "";
if (documentType != "all") {
if (documentType.indexOf(",") >= 0) {
const documentTypeArr = documentType.split(",");
docTypeQueryString = " and (";
documentTypeArr.forEach(function (item, index) {
console.log(item, index);
if (item != "all") {
docTypeQueryString +=
" pinswg_isharedocumentlocations eq " + item;
docTypeQueryString +=
index < documentTypeArr.length - 1 ? " or " : "";
}
});
docTypeQueryString += " )";
} else {
docTypeQueryString +=
" and pinswg_isharedocumentlocations eq " + documentType;
}
}
console.log(docTypeQueryString);
//console.log("has this passed docuemntType:", documentType);
//(documentType !="all" && " pinswg_pinswg_isharedocumentlocations eq " + )
@@ -99,9 +130,7 @@ export default async function ApiProxy(req, res) {
"pinswg_documents?$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
incidentID +
" and pinswg_latestpublishedversion ne null and pinswg_latestpublisheddate ne null" +
(documentType != "all"
? " and pinswg_isharedocumentlocations eq " + documentType
: "") +
docTypeQueryString +
"&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference,pinswg_name,pinswg_latestpublishedversion,pinswg_latestpublisheddate&$orderby=" +
orderby +
" " +
@@ -111,7 +140,7 @@ export default async function ApiProxy(req, res) {
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
: "");
//console.log("docu paged: ", queryUrl);
console.log("docu paged: ", queryUrl);
return axios
.get(
+4
View File
@@ -97,6 +97,8 @@ const CaseHome = (props) => {
}
showLoginCheck={true}
messagesObj={props.messagesObj}
showFilteredDocs={props.showFilteredDocs}
showMaps={props.showMaps}
/>
</div>
<Footer
@@ -218,6 +220,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
messagesObj: await getCaseMessage(
searchResultsObj.value[0].incidentid
),
showFilteredDocs: process.env.SHOWFILTERDOCS || false,
showMaps: process.env.SHOWMAPS,
},
};
}
+56 -6
View File
@@ -3,7 +3,13 @@ import useTranslation from "next-translate/useTranslation";
import Head from "next/head";
import { useRouter } from "next/router";
import { connect } from "react-redux";
import { getBasicDNSURLSearch, getIP } from "../../actions";
import {
getBasicDNSURLSearch,
getCaseMessage,
getIP,
getPersonalAccount,
getPortalLogin,
} from "../../actions";
import Breadcrumbs from "../../components/breadcrumbs";
import Case from "../../components/case";
import CookieBanner from "../../components/cookieBanner";
@@ -13,10 +19,20 @@ import { getSearchDetails } from "../../components/utils";
import { setAccountDetails } from "../../store/accountDetails/action";
import { setCurrentReference } from "../../store/currentView/action";
import { setSearch } from "../../store/search/action";
import {
setSearchDetails,
setSearchResults,
} from "../../store/searchOutput/action";
import { wrapper } from "../../store/store";
import ServiceBanner from "../../components/servicebanner";
const CaseHome = (props) => {
const { footerLinks, pages } = props;
const {
footerLinks,
pages,
setSearchResults,
setSearchDetails,
searchResultsObj,
} = props;
let { t, lang } = useTranslation();
const router = useRouter();
@@ -37,7 +53,7 @@ const CaseHome = (props) => {
<Header serviceName="Developments of National Significance" />
<div className="govuk-width-container">
<Breadcrumbs slug={developmentName} props={props} />
<ServiceBanner />
<Case
props={props}
myCases={props.myCases.myCases}
@@ -45,6 +61,9 @@ const CaseHome = (props) => {
directSearchResultsObj={
props.searchResultsObj.searchResultsObj
}
searchResultsObj={
props.searchResultsObj.searchResultsObj
}
searchDetailsObj={
props.searchResultsObj.searchDetailsObj
}
@@ -76,6 +95,9 @@ const CaseHome = (props) => {
props.searchResultsObj.representationsObj
}
showLoginCheck={true}
messagesObj={props.messagesObj}
showFilteredDocs={props.showFilteredDocs}
showMaps={props.showMaps}
/>
</div>
<Footer
@@ -167,6 +189,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
},
};
} else {
// store.dispatch(setSearchResults(searchResultsObj));
// store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(
setCurrentReference({
"ticketnumber": searchResultsObj.value[0].ticketnumber,
@@ -175,11 +199,27 @@ export const getServerSideProps = wrapper.getServerSideProps(
"incidentid": searchResultsObj.value[0].incidentid,
"appealType":
searchResultsObj.value[0].pinswg_appealcasetype,
"showLoginCheck": true,
"specialistProcess":
searchDetailsObj[0].value[0]
.pinswg_speacialistcaseprocess != null ||
searchDetailsObj[0].value[0]
.pinswg_specialistcaseprocess != null
? searchDetailsObj[0].value[0]
.pinswg_speacialistcaseprocess ||
searchDetailsObj[0].value[0]
.pinswg_specialistcaseprocess
: "",
})
);
}
}
//console.log(searchResultsObj);
let messagesObj = await getCaseMessage(
searchResultsObj.value[0].incidentid
);
console.log(messagesObj);
return {
props: {
searchResultsObj: {
@@ -187,6 +227,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
searchDetailsObj: searchDetailsObj,
},
currentType: "directResultsObj",
docsOffline: process.env.DOCAPI_OFFLINE || false,
messagesObj: messagesObj,
showFilteredDocs: process.env.SHOWFILTERDOCS || false,
showMaps: process.env.SHOWMAPS,
},
};
}
@@ -197,7 +241,7 @@ const mapStateToProps = (state) => {
accountDetails: state.accountDetails,
currentView: state.currentView,
search: state.search,
//searchResultsObj: state.searchResultsObj,
// searchResultsObj: state.searchResultsObj,
documentDetailsObj: state.searchResultsObj.documentDetailsObj,
formData: state.formData,
appealType: state.appealType,
@@ -214,6 +258,12 @@ const mapDispatchToProps = (dispatch) => {
setCurrentReference: (currentReference) => {
dispatch(setCurrentReference(refno));
},
setSearchResults: (searchResultsObj) => {
dispatch(setSearchResults(searchResultsObj));
},
setSearchDetails: (searchDetailsObj) => {
dispatch(setSearchDetails(searchDetailsObj));
},
};
};
+270
View File
@@ -0,0 +1,270 @@
import { getSession } from "next-auth/react";
import useTranslation from "next-translate/useTranslation";
import Head from "next/head";
import { useRouter } from "next/router";
import { connect } from "react-redux";
import {
getBasicDNSURLSearch,
getCaseMessage,
getIP,
getPersonalAccount,
getPortalLogin,
} from "../../../actions";
import Breadcrumbs from "../../../components/breadcrumbs";
import Case from "../../../components/case";
import CookieBanner from "../../../components/cookieBanner";
import Footer from "../../../components/footer";
import Header from "../../../components/header";
import { getSearchDetails } from "../../../components/utils";
import { setAccountDetails } from "../../../store/accountDetails/action";
import { setCurrentReference } from "../../../store/currentView/action";
import { setSearch } from "../../../store/search/action";
import {
setSearchDetails,
setSearchResults,
} from "../../../store/searchOutput/action";
import { wrapper } from "../../../store/store";
import ServiceBanner from "../../../components/servicebanner";
const CaseHome = (props) => {
const {
footerLinks,
pages,
setSearchResults,
setSearchDetails,
searchResultsObj,
} = props;
let { t, lang } = useTranslation();
const router = useRouter();
const { locale } = router;
const { developmentName } = router.query;
return (
<div>
<Head>
<title>
Reference:{" "}
{props.currentView.caseReference.currentReference}{" "}
Developments of National Significance
</title>
</Head>
<div id="page_wrapper">
<CookieBanner />
<Header serviceName="Developments of National Significance" />
<div className="govuk-width-container">
<Breadcrumbs slug={developmentName} props={props} />
<ServiceBanner />
<Case
props={props}
myCases={props.myCases.myCases}
myCasesDetails={props.myCases.myCasesDetails}
directSearchResultsObj={
props.searchResultsObj.searchResultsObj
}
searchResultsObj={
props.searchResultsObj.searchResultsObj
}
searchDetailsObj={
props.searchResultsObj.searchDetailsObj
}
documentDetailsObj={props.documentDetailsObj}
myRepresentations={
props.myRepresentations.myRepresentations
}
watchedCases={props.watchedCases.watchedCases}
watchedCasesDetails={
props.watchedCases.watchedCasesDetails
}
awaitingSubmission={
props.awaitingSubmission.awaitingSubmission
}
caseReference={
props.searchResultsObj.searchResultsObj.value[0]
.ticketnumber
}
currentType={props.currentType}
appealTypeID={
props.searchResultsObj.searchResultsObj.value[0]
.pinswg_appealcasetype
}
incidentid={
props.searchResultsObj.searchResultsObj.value[0]
.incidentid
}
representationsObj={
props.searchResultsObj.representationsObj
}
showLoginCheck={true}
messagesObj={props.messagesObj}
showFilteredDocs={props.showFilteredDocs}
showMaps={props.showMaps}
/>
</div>
<Footer
footerLinks={footerLinks}
props={props}
ticketnumber={
props.searchResultsObj.searchResultsObj.value[0]
.ticketnumber
}
/>
</div>
</div>
);
};
export const getServerSideProps = wrapper.getServerSideProps(
(store) => async (ctx) => {
const { query, req, res } = ctx;
getIP(req);
const { cookies } = req;
console.log(cookies);
console.log("the query", query.developmentName);
let thisSession = await getSession(ctx);
let loggedInUser = {};
if (thisSession) {
console.log(" has sesssion.......");
[loggedInUser] = await Promise.all([
await getPortalLogin(thisSession.user.email),
]);
loggedInUser = loggedInUser.value[0].contactid;
const accountDetails = await getPersonalAccount(loggedInUser);
store.dispatch(setAccountDetails(accountDetails));
} else {
console.log("not has sesssion.......");
}
let developmentQuery =
query.developmentName.indexOf("CAS-") == 0
? query.developmentName
: query.developmentName.split("-").join(" ");
console.log(developmentQuery);
const searchResultsObj = await getBasicDNSURLSearch(developmentQuery);
const searchDetailsObj = await getSearchDetails(searchResultsObj);
console.log(
"\n======================================\n",
searchResultsObj,
"\n======================================\n"
);
console.log(
"\n======================================\n",
searchDetailsObj[0],
"\n======================================\n"
);
store.dispatch(setSearch(developmentQuery));
//console.log({
// "currentReference": searchResultsObj.value[0].title,
// "currentType": "searchResultsObj",
// "incidentid": searchResultsObj.value[0].incidentid,
// "appealType": searchResultsObj.value[0].pinswg_appealcasetype,
// });
console.log(
searchResultsObj["@odata.count"] > 1 ||
searchResultsObj["@odata.count"] < 1
);
if (searchResultsObj["@odata.count"] < 1) {
return {
redirect: {
destination: "/404",
permanent: false,
},
};
} else {
if (searchResultsObj["@odata.count"] > 1) {
return {
redirect: {
//destination: "/dns-not-found",
destination: "/404",
permanent: false,
},
};
} else {
// store.dispatch(setSearchResults(searchResultsObj));
// store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(
setCurrentReference({
"ticketnumber": searchResultsObj.value[0].ticketnumber,
"currentReference": searchResultsObj.value[0].title,
"currentType": "searchResultsObj",
"incidentid": searchResultsObj.value[0].incidentid,
"appealType":
searchResultsObj.value[0].pinswg_appealcasetype,
"showLoginCheck": true,
"specialistProcess":
searchDetailsObj[0].value[0]
.pinswg_speacialistcaseprocess != null ||
searchDetailsObj[0].value[0]
.pinswg_specialistcaseprocess != null
? searchDetailsObj[0].value[0]
.pinswg_speacialistcaseprocess ||
searchDetailsObj[0].value[0]
.pinswg_specialistcaseprocess
: "",
})
);
}
}
let messagesObj = await getCaseMessage(
searchResultsObj.value[0].incidentid
);
console.log(messagesObj);
return {
props: {
searchResultsObj: {
searchResultsObj: searchResultsObj,
searchDetailsObj: searchDetailsObj,
},
currentType: "directResultsObj",
docsOffline: process.env.DOCAPI_OFFLINE || false,
messagesObj: messagesObj,
showFilteredDocs: process.env.SHOWFILTERDOCS || false,
showMaps: process.env.SHOWMAPS,
},
};
}
);
const mapStateToProps = (state) => {
return {
accountDetails: state.accountDetails,
currentView: state.currentView,
search: state.search,
// searchResultsObj: state.searchResultsObj,
documentDetailsObj: state.searchResultsObj.documentDetailsObj,
formData: state.formData,
appealType: state.appealType,
form: state.form,
myCases: state.myCases,
watchedCases: state.watchedCases,
myRepresentations: state.myRepresentations,
awaitingSubmission: state.awaitingSubmission,
};
};
const mapDispatchToProps = (dispatch) => {
return {
setCurrentReference: (currentReference) => {
dispatch(setCurrentReference(refno));
},
setSearchResults: (searchResultsObj) => {
dispatch(setSearchResults(searchResultsObj));
},
setSearchDetails: (searchDetailsObj) => {
dispatch(setSearchDetails(searchDetailsObj));
},
};
};
export default connect(mapStateToProps, mapDispatchToProps)(CaseHome);
+37 -37
View File
@@ -399,46 +399,46 @@ const getDetails = (resultsObj, detailsType) => {
});
}
const detailsObj = resultsObj.map((searchDetail, index) => {
let caseID = "";
// const detailsObj = resultsObj.map(async (searchDetail, index) => {
// let caseID = "";
switch (detailsType) {
case "myCases":
caseID = searchDetail.pinswg_title;
break;
case "myWatchedCases":
case "mySubmittedReps":
caseID =
searchDetail[
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
];
break;
case "awaitingSubmission":
caseID = searchDetail.ticketnumber;
break;
case "myRepresentations":
caseID = searchDetail.casereference;
break;
default:
caseID = searchDetail.pinswg_title;
}
// switch (detailsType) {
// case "myCases":
// caseID = searchDetail.pinswg_title;
// break;
// case "myWatchedCases":
// case "mySubmittedReps":
// caseID =
// searchDetail[
// "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
// ];
// break;
// case "awaitingSubmission":
// caseID = searchDetail.ticketnumber;
// break;
// case "myRepresentations":
// caseID = searchDetail.casereference;
// break;
// default:
// caseID = searchDetail.pinswg_title;
// }
//console.log(detailsType, " case id : ", caseID);
// console.log(detailsType, " case id : ", caseID);
searchDetail.pinswg_appealcasetype != null &&
detailsArr.push(
getPortalModuleDetails(
getFormCollectionByID(searchDetail.pinswg_appealcasetype)
.LogicalCollectionName,
caseID
// detailsType != "myWatchedCases"
// ? searchDetail.ticketnumber
// : searchDetail[
// "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
// ]
)
);
});
// searchDetail.pinswg_appealcasetype != null &&
// detailsArr.push(
// getPortalModuleDetails(
// getFormCollectionByID(searchDetail.pinswg_appealcasetype)
// .LogicalCollectionName,
// caseID
// // detailsType != "myWatchedCases"
// // ? searchDetail.ticketnumber
// // : searchDetail[
// // "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
// // ]
// )
// );
// });
let detArr = Promise.all(detailsArr);
console.log(detArr);
+161 -34
View File
@@ -1274,41 +1274,7 @@ textarea,
}
}
.documentList {
.govuk-summary-list__key:first-of-type {
width: 40%;
}
.govuk-summary-list__key:last-of-type {
width: 20%;
}
.govuk-summary-list__value {
position: relative;
}
.coverLoadingLink {
&.downloading {
background-color: transparent;
position: absolute;
/* display: block; */
width: 100%;
z-index: 200;
top: 0px;
left: 0px;
height: 100%;
opacity: 50%;
content: " ";
display: block;
}
.data-loading-icon {
left: calc(100% - 40px);
height: 20px;
top: calc(50% - 10px);
}
}
}
.progress-save {
@@ -1435,6 +1401,63 @@ textarea,
// width: 100%;
// }
.docResults {
@media screen and (min-width: 768px) {
padding-left: 20px
}
}
.documentList {
.govuk-summary-list__key:first-of-type {
width: 40%;
}
.govuk-summary-list__key:last-of-type {
width: 18%;
}
.govuk-summary-list__value {
position: relative;
@media screen and (min-width: 768px) {
&:last-of-type {
text-align: right;
}
}
}
.coverLoadingLink {
&.downloading {
background-color: transparent;
position: absolute;
/* display: block; */
width: 100%;
z-index: 200;
top: 0px;
left: 0px;
height: 100%;
opacity: 50%;
content: " ";
display: block;
}
.data-loading-icon {
left: calc(100% - 40px);
height: 20px;
top: calc(50% - 10px);
}
}
}
.appealModule {
width: 94%;
min-height: 20vh;
@@ -2777,4 +2800,108 @@ fade {
.ql-toolbar.ql-snow,
.ql-container.ql-snow {
background-color: $white;
}
.docFilteringGroup {
@media screen and (min-width: 768px) {
display: flex;
margin-left: -15px;
margin-right: -15px;
}
.filterByGroup {
background: $lightgrey_offwhite;
border: 1px solid $darkgrey;
color: $black;
font-size: 16px;
padding: 15px;
#recordCountSelect {
text-align: left;
select {
min-width: 10rem;
}
}
.govuk-checkboxes {
background: $white;
padding: 15px;
margin-bottom: 15px;
height: 240px;
overflow: auto;
border: 1px solid $darkgrey;
&::-webkit-scrollbar {
width: 30px;
}
&::-webkit-scrollbar-track {
background: $lightgrey_semi;
}
&::-webkit-scrollbar-thumb {
background: $darkgrey;
max-height: 50px;
border: 6px solid $lightgrey_semi;
}
.govuk-checkboxes__item {
border-bottom: 1px solid $lightgrey_semi
}
&.govuk-checkboxes--small .govuk-checkboxes__item:hover .govuk-checkboxes__input:not(:disabled)+.govuk-checkboxes__label::before {
box-shadow: none;
}
.govuk-label-s {
font-size: 14px;
}
}
.govuk-button {
background: $black;
color: $white;
font-size: 16px;
font-weight: bold;
padding: 10px 20px !important;
margin-bottom: 15px;
width: 100%;
}
}
button {
border: 1px solid $red;
background: $white;
color: $red;
font-size: 14px;
font-weight: bold;
padding: 5px 10px;
margin-bottom: 15px;
&:hover {
border: 1px solid $red;
background: $red;
color: $white;
font-size: 14px;
font-weight: bold;
padding: 5px 10px;
margin-bottom: 15px;
}
}
}