Merged PR 1553: 15643 Document list showing document publish date
15643 Document list showing document publish date Related work items: #15643
This commit is contained in:
@@ -284,9 +284,12 @@ const DocumentDetails = (props) => {
|
|||||||
{/* {t("case:documents-date-published-label")} */}
|
{/* {t("case:documents-date-published-label")} */}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => sortDataBy("createdon")}
|
onClick={() =>
|
||||||
|
sortDataBy("pinswg_documentpublisheddate")
|
||||||
|
}
|
||||||
className={
|
className={
|
||||||
orderByState == "createdon"
|
orderByState ==
|
||||||
|
"pinswg_documentpublisheddate"
|
||||||
? fieldSortState == "asc"
|
? 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 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 sortDesc`
|
||||||
@@ -688,9 +691,14 @@ const DocumentDetails = (props) => {
|
|||||||
{/* {t("case:documents-date-published-label")} */}
|
{/* {t("case:documents-date-published-label")} */}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => sortDataBy("createdon")}
|
onClick={() =>
|
||||||
|
sortDataBy(
|
||||||
|
"pinswg_documentpublisheddate"
|
||||||
|
)
|
||||||
|
}
|
||||||
className={
|
className={
|
||||||
orderByState == "createdon"
|
orderByState ==
|
||||||
|
"pinswg_documentpublisheddate"
|
||||||
? fieldSortState == "asc"
|
? 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 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 sortDesc`
|
||||||
@@ -837,14 +845,36 @@ const DocumentDetails = (props) => {
|
|||||||
:
|
:
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{_.has(
|
{/* {
|
||||||
|
detailsObj.pinswg_documentpublisheddate
|
||||||
|
}
|
||||||
|
{
|
||||||
|
detailsObj.pinswg_latestpublisheddate
|
||||||
|
} */}
|
||||||
|
|
||||||
|
{detailsObj.pinswg_documentpublisheddate !=
|
||||||
|
null
|
||||||
|
? formatDates(
|
||||||
|
detailsObj.pinswg_documentpublisheddate
|
||||||
|
)
|
||||||
|
: formatDates(
|
||||||
|
detailsObj.pinswg_latestpublisheddate
|
||||||
|
)}
|
||||||
|
{/* {_.has(
|
||||||
detailsObj,
|
detailsObj,
|
||||||
"pinswg_latestpublisheddate"
|
"pinswg_documentpublisheddate"
|
||||||
)
|
)
|
||||||
|
? formatDates(
|
||||||
|
detailsObj.pinswg_documentpublisheddate
|
||||||
|
)
|
||||||
|
: _.has(
|
||||||
|
detailsObj,
|
||||||
|
"pinswg_latestpublisheddate"
|
||||||
|
)
|
||||||
? formatDates(
|
? formatDates(
|
||||||
detailsObj.pinswg_latestpublisheddate
|
detailsObj.pinswg_latestpublisheddate
|
||||||
)
|
)
|
||||||
: ""}
|
: ""} */}
|
||||||
</dd>
|
</dd>
|
||||||
{/* <dd className="govuk-summary-list__value govuk-!-font-size-16">
|
{/* <dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">
|
||||||
@@ -960,8 +990,10 @@ const DocumentDetails = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const [showDocumentSearchState, setDocumentSearchState] = useState(false);
|
const [showDocumentSearchState, setDocumentSearchState] = useState(false);
|
||||||
const [orderByState, setOrderbyState] = useState("createdon");
|
const [orderByState, setOrderbyState] = useState(
|
||||||
const [fieldSortState, setfieldSortState] = useState("asc");
|
"pinswg_documentpublisheddate"
|
||||||
|
);
|
||||||
|
const [fieldSortState, setfieldSortState] = useState("desc");
|
||||||
|
|
||||||
let documentSearchState = () => {
|
let documentSearchState = () => {
|
||||||
showDocumentSearchState == true
|
showDocumentSearchState == true
|
||||||
@@ -971,14 +1003,14 @@ const DocumentDetails = (props) => {
|
|||||||
|
|
||||||
const sortDataBy = (whichField) => {
|
const sortDataBy = (whichField) => {
|
||||||
setOrderbyState(whichField);
|
setOrderbyState(whichField);
|
||||||
setfieldSortState("asc");
|
setfieldSortState("desc");
|
||||||
|
|
||||||
getDocumentResults(1, whichField, fieldSortState);
|
getDocumentResults(1, whichField, fieldSortState);
|
||||||
whichField == orderByState
|
whichField == orderByState
|
||||||
? fieldSortState == "desc"
|
? fieldSortState == "asc"
|
||||||
? setfieldSortState("asc")
|
? setfieldSortState("desc")
|
||||||
: setfieldSortState("desc")
|
: setfieldSortState("asc")
|
||||||
: setfieldSortState("asc");
|
: setfieldSortState("desc");
|
||||||
setCurrentPage(1);
|
setCurrentPage(1);
|
||||||
setShowSpinnerState(true);
|
setShowSpinnerState(true);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export default async function ApiProxy(req, res) {
|
|||||||
var queryUrl =
|
var queryUrl =
|
||||||
"pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
"pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
||||||
incidentID +
|
incidentID +
|
||||||
" and pinswg_latestpublishedversion ne null and pinswg_latestpublisheddate ne null&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference,pinswg_name,pinswg_latestpublishedversion,pinswg_latestpublisheddate";
|
" and pinswg_latestpublishedversion ne null and pinswg_latestpublisheddate ne null&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference,pinswg_name,pinswg_latestpublishedversion,pinswg_latestpublisheddate,pinswg_documentpublisheddate";
|
||||||
|
|
||||||
//console.log("docu: ", WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
//console.log("docu: ", WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
||||||
|
|
||||||
@@ -70,6 +70,12 @@ export default async function ApiProxy(req, res) {
|
|||||||
)
|
)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
data.value.forEach(function (element) {
|
data.value.forEach(function (element) {
|
||||||
|
Object.assign(element, {
|
||||||
|
"pinswg_documentpublisheddate":
|
||||||
|
element.pinswg_documentpublisheddate != null
|
||||||
|
? element.pinswg_documentpublisheddate
|
||||||
|
: element.pinswg_latestpublisheddate,
|
||||||
|
});
|
||||||
element.pinswg_hashlink = encryptDocReference(
|
element.pinswg_hashlink = encryptDocReference(
|
||||||
element.pinswg_isharedocumentreference
|
element.pinswg_isharedocumentreference
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ export default async function ApiProxy(req, res) {
|
|||||||
incidentID +
|
incidentID +
|
||||||
" and pinswg_latestpublishedversion ne null and pinswg_latestpublisheddate ne null" +
|
" and pinswg_latestpublishedversion ne null and pinswg_latestpublisheddate ne null" +
|
||||||
docTypeQueryString +
|
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=" +
|
"&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference,pinswg_name,pinswg_latestpublishedversion,pinswg_latestpublisheddate,pinswg_documentpublisheddate&$orderby=" +
|
||||||
orderby +
|
orderby +
|
||||||
" " +
|
" " +
|
||||||
fieldSort +
|
fieldSort +
|
||||||
@@ -145,7 +145,7 @@ export default async function ApiProxy(req, res) {
|
|||||||
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
|
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
|
||||||
: "");
|
: "");
|
||||||
|
|
||||||
//console.log("docu paged 1: ", queryUrl);
|
console.log("docu paged 1: ", queryUrl);
|
||||||
|
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
@@ -154,6 +154,12 @@ export default async function ApiProxy(req, res) {
|
|||||||
)
|
)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
data.value.forEach(function (element) {
|
data.value.forEach(function (element) {
|
||||||
|
Object.assign(element, {
|
||||||
|
"pinswg_documentpublisheddate":
|
||||||
|
element.pinswg_documentpublisheddate != null
|
||||||
|
? element.pinswg_documentpublisheddate
|
||||||
|
: element.pinswg_latestpublisheddate,
|
||||||
|
});
|
||||||
element.pinswg_hashlink = encryptDocReference(
|
element.pinswg_hashlink = encryptDocReference(
|
||||||
element.pinswg_isharedocumentreference
|
element.pinswg_isharedocumentreference
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -182,7 +182,13 @@ export async function getServerSideProps(context) {
|
|||||||
return toUrlObj.toString(); // Return the full new URL as a string
|
return toUrlObj.toString(); // Return the full new URL as a string
|
||||||
};
|
};
|
||||||
|
|
||||||
formURL = appendParamsAndPathToNewUrl(context.query.callbackUrl, formURL);
|
typeof context.query.callbackUrl != "undefined" &&
|
||||||
|
(formURL = appendParamsAndPathToNewUrl(
|
||||||
|
context.query.callbackUrl,
|
||||||
|
formURL
|
||||||
|
));
|
||||||
|
|
||||||
|
//formURL = appendParamsAndPathToNewUrl(context.query.callbackUrl, formURL);
|
||||||
|
|
||||||
const url = new URL(formURL); // base URL
|
const url = new URL(formURL); // base URL
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user