partial synch with ph2 updates

This commit is contained in:
2025-11-28 08:45:13 +00:00
parent 8f1aede2e3
commit 3f4bd8d52e
54 changed files with 4395 additions and 488 deletions
+83 -91
View File
@@ -17,9 +17,11 @@ import {
import { setCurrentPage } from "../../store/currentView/action";
import { setDocumentDetails } from "../../store/searchOutput/action";
import DocumentLink from "../utils/downloads";
import { useDownloadQueue } from "../utils/downloadmanager";
const DocumentDetails = (props) => {
let { t } = useTranslation();
let { t, lang } = useTranslation();
const firstRender = useRef(false);
const {
incidentid,
@@ -37,7 +39,7 @@ const DocumentDetails = (props) => {
const { locale } = router;
var documentDetailsArr = documentDetailsObj || [];
const { startDownload, getStatus } = useDownloadQueue(3);
const [selectedOption, setSelectedOption] = useState(10);
const [documentTypes, setDocumentTypes] = useState([{}]);
const [selectedDocumentType, setSelectedDocumentType] = useState("all");
@@ -287,12 +289,9 @@ const DocumentDetails = (props) => {
{/* {t("case:documents-date-published-label")} */}
<button
type="button"
onClick={() =>
sortDataBy("pinswg_documentpublisheddate")
}
onClick={() => sortDataBy("createdon")}
className={
orderByState ==
"pinswg_documentpublisheddate"
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`
@@ -419,7 +418,7 @@ const DocumentDetails = (props) => {
] +
'")].value_cy',
json: transLookup,
sanbox: {},
eval: true,
})
: detailsObj[
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
@@ -507,7 +506,7 @@ const DocumentDetails = (props) => {
</p>
<div>
<button onClick={clearCheckboxes}>
{t("case:documents-clear-filter-label")}
{t("search:clear-filter-button-label")}
</button>
</div>
<div className="govuk-checkboxes govuk-checkboxes--small">
@@ -584,8 +583,8 @@ const DocumentDetails = (props) => {
'$..[?(@ && @.value=="' +
item.pinswg_isharedocumentlocationsLabel +
'")].value_cy',
jsonL: transLookup,
sanbox: {},
json: transLookup,
eval: true,
})
: item.pinswg_isharedocumentlocationsLabel ||
t(
@@ -611,7 +610,7 @@ const DocumentDetails = (props) => {
setCurrentPage(1);
}}
>
{t("case:documents-filter-button")}
{t("search:filter-documents-label")}
</button>
</div>
{documentDetailsObj["@odata.count"] > 5 && (
@@ -700,14 +699,9 @@ const DocumentDetails = (props) => {
{/* {t("case:documents-date-published-label")} */}
<button
type="button"
onClick={() =>
sortDataBy(
"pinswg_documentpublisheddate"
)
}
onClick={() => sortDataBy("createdon")}
className={
orderByState ==
"pinswg_documentpublisheddate"
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`
@@ -772,41 +766,63 @@ const DocumentDetails = (props) => {
)}
{!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>
<>
<DocumentLink
key={
detailsObj.pinswg_documentid
}
id={
detailsObj.pinswg_documentid
}
detailsObj={
detailsObj
}
caseReference={
caseReference
}
startDownload={
startDownload
}
getStatus={
getStatus
}
/>
{/* <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">
@@ -858,36 +874,14 @@ const DocumentDetails = (props) => {
:
</span>
{/* {
detailsObj.pinswg_documentpublisheddate
}
{
detailsObj.pinswg_latestpublisheddate
} */}
{detailsObj.pinswg_documentpublisheddate !=
null
? formatDates(
detailsObj.pinswg_documentpublisheddate
)
: formatDates(
detailsObj.pinswg_latestpublisheddate
)}
{/* {_.has(
{_.has(
detailsObj,
"pinswg_documentpublisheddate"
"pinswg_latestpublisheddate"
)
? formatDates(
detailsObj.pinswg_documentpublisheddate
)
: _.has(
detailsObj,
"pinswg_latestpublisheddate"
)
? formatDates(
detailsObj.pinswg_latestpublisheddate
)
: ""} */}
: ""}
</dd>
{/* <dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">
@@ -931,9 +925,8 @@ const DocumentDetails = (props) => {
selectedOption,
selectedDocumentType
)
// .then((data) => data)
.then((data) => data)
.then((data) => {
setDocumentSearchState(true);
setDocumentDetails(data);
setShowSpinnerState(false);
});
@@ -1003,10 +996,8 @@ const DocumentDetails = (props) => {
};
const [showDocumentSearchState, setDocumentSearchState] = useState(false);
const [orderByState, setOrderbyState] = useState(
"pinswg_documentpublisheddate"
);
const [fieldSortState, setfieldSortState] = useState("desc");
const [orderByState, setOrderbyState] = useState("createdon");
const [fieldSortState, setfieldSortState] = useState("asc");
let documentSearchState = () => {
showDocumentSearchState == true
@@ -1016,14 +1007,14 @@ const DocumentDetails = (props) => {
const sortDataBy = (whichField) => {
setOrderbyState(whichField);
setfieldSortState("desc");
setfieldSortState("asc");
getDocumentResults(1, whichField, fieldSortState);
whichField == orderByState
? fieldSortState == "asc"
? setfieldSortState("desc")
: setfieldSortState("asc")
: setfieldSortState("desc");
? fieldSortState == "desc"
? setfieldSortState("asc")
: setfieldSortState("desc")
: setfieldSortState("asc");
setCurrentPage(1);
setShowSpinnerState(true);
};
@@ -1058,7 +1049,7 @@ const DocumentDetails = (props) => {
return docObj;
};
//const searchDocumentResultsObj = docDetailsObj();
const searchDocumentResultsObj = docDetailsObj();
}, [
incidentid,
setDocumentDetails,
@@ -1068,6 +1059,7 @@ const DocumentDetails = (props) => {
orderByState,
getDocumentTypes,
getDocumentResults,
lang,
]);
return (
<div className="govuk-grid-row">
+87 -8
View File
@@ -57,6 +57,7 @@ const CaseSummary = (props) => {
const router = useRouter();
const { locale } = router;
const {
appealTypeID,
incidentid,
caseReference,
myCases,
@@ -76,9 +77,9 @@ const CaseSummary = (props) => {
currentView,
messagesObj,
docsOffline,
ticketnumber,
} = props;
let appealTypeID = props.appealTypeID || router.query.appealType;
const showLoginCheck =
currentType == "directResultsObj" ? "true" : currentView.showLogin;
const { data: session, status } = useSession();
@@ -233,13 +234,13 @@ const CaseSummary = (props) => {
currentType == "searchResultsObj"
? (casesObj = jsonpath({
path: '$..[?(@ && @.title=="' + caseReference + '")]',
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
json: searchResultsObj,
eval: true,
}))
: currentType == "watchedCases"
? (casesObj = jsonpath({
path: '$..[?(@ && @.pinswg_title=="' + caseReference + '")]',
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
json: setCaseQueryObj,
eval: true,
}))
@@ -251,7 +252,7 @@ const CaseSummary = (props) => {
}))
: currentType == "directResultsObj"
? (casesObj = jsonpath({
path: '$..[?(@ && @.ticketnumber=="' + caseReference + '")]',
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
json: setCaseQueryObj,
eval: true,
}))
@@ -481,14 +482,19 @@ const CaseSummary = (props) => {
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{getFormCollectionByID(
appealTypeID
appealTypeID ||
setCaseQueryObj.value[0]
.pinswg_appealcasetype
).PrimaryIdAttribute ==
"pinswg_dnsid"
? t(
"case:summary-applicantonly-label"
)
: getFormCollectionByID(
appealTypeID
appealTypeID ||
setCaseQueryObj
.value[0]
.pinswg_appealcasetype
).PrimaryIdAttribute ==
"pinswg_nonvalidationid"
? t(
@@ -541,7 +547,9 @@ const CaseSummary = (props) => {
</dt>
<dd className="govuk-summary-list__value">
{getFormCollectionByID(
appealTypeID
appealTypeID ||
setCaseQueryObj.value[0]
.pinswg_appealcasetype
).PrimaryIdAttribute ==
"pinswg_dnsid" ||
getFormCollectionByID(
@@ -1955,7 +1963,9 @@ const CaseSummary = (props) => {
useEffect(() => {
const linkCaseObj = async () => {
let docObj = await getLinkedCases(incidentid).then((data) => {
let docObj = await getLinkedCases(
incidentid || setCaseQueryObj.value[0].incidentid
).then((data) => {
//console.log(data);
setCurrentLinkedCases(data);
return data;
@@ -1972,6 +1982,67 @@ const CaseSummary = (props) => {
expDate.setDate(now.getDate() + 365);
function formatDates(dateObj, showTime) {
var dateObj = new Date(dateObj);
var dd = String(dateObj.getDate()).padStart(2, "0");
var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0!
var yyyy = dateObj.getFullYear();
var hh = dateObj.getHours();
hh = ("0" + hh).slice(-2);
var mins = dateObj.getMinutes();
mins = ("0" + mins).slice(-2);
const dateStr = showTime
? hh == 0 && mins == 0
? ""
: hh + ":" + mins
: dd + "/" + mm + "/" + yyyy + " ";
return dateStr;
}
function linkedCasesList(linkedCasesReference) {
//console.log(linkedCasesReference);
linkedCasesReference = linkedCasesReference.value || [];
return (
<>
<ul className="govuk-list govuk-!-font-size-16">
{linkedCasesReference.map((item, key) => {
return (
<li key={key}>
<Link
href={
router.locale == "cy"
? "/canlyniadauchwilio?q=" +
item.title +
"&lk=1"
: "/searchresults?q=" +
item.title +
"&lk=1"
}
className=""
>
{item.title}
</Link>
</li>
);
//console.log(item.incidentid, item.title);
})}
</ul>
</>
);
}
function showReps(startDate, endDate) {
let date = new Date();
date = new Date(date.toDateString());
const start = new Date(startDate);
const end = new Date(endDate);
return date >= start && date <= end ? true : false;
}
function showRepButton(appealType) {
switch (appealType) {
case 846040012:
@@ -2019,6 +2090,14 @@ const CaseSummary = (props) => {
}
}
function showRepsEnded(startDate, endDate) {
let date = new Date();
date = new Date(date.toDateString());
const start = new Date(startDate);
const end = new Date(endDate);
return date > start && date > end ? true : false;
}
if (status == "authenticated" && cookies.pedwWatchCase != null) {
selectWatchedCase(
props.accountDetails.accountDetails.contactid,