removed references to doc history
This commit is contained in:
@@ -365,36 +365,6 @@ export const getSearchDocumentDetailsPaged = (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSearchDocumentHistory = (documentID) => {
|
|
||||||
return axios
|
|
||||||
.get(
|
|
||||||
"/api/endpoint/getsearchdocumenthistory_api?documentid=" +
|
|
||||||
documentID
|
|
||||||
)
|
|
||||||
.then((res) => {
|
|
||||||
return res.data;
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.log("API call error", error);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getSearchDocumentHistoryPaged = (documentID, pageNumber) => {
|
|
||||||
return axios
|
|
||||||
.get(
|
|
||||||
"/api/endpoint/getsearchdocumenthistorypaged_api?documentid=" +
|
|
||||||
documentID +
|
|
||||||
"&pageNumber=" +
|
|
||||||
pageNumber
|
|
||||||
)
|
|
||||||
.then((res) => {
|
|
||||||
return res.data;
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.log("API call error", error);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getLinkedCases = (parentIncidentid) => {
|
export const getLinkedCases = (parentIncidentid) => {
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ const Case = (props) => {
|
|||||||
searchResultsObj={props.searchResultsObj}
|
searchResultsObj={props.searchResultsObj}
|
||||||
searchDetailsObj={props.searchDetailsObj}
|
searchDetailsObj={props.searchDetailsObj}
|
||||||
documentDetailsObj={props.documentDetailsObj}
|
documentDetailsObj={props.documentDetailsObj}
|
||||||
documentHistoryObj={props.documentHistoryObj}
|
|
||||||
/>
|
/>
|
||||||
{showRepresentations == "true" && (
|
{showRepresentations == "true" && (
|
||||||
<RepresentationList
|
<RepresentationList
|
||||||
@@ -50,7 +49,6 @@ const Case = (props) => {
|
|||||||
caseReference={props.caseReference}
|
caseReference={props.caseReference}
|
||||||
representationsObj={props.representationsObj}
|
representationsObj={props.representationsObj}
|
||||||
documentDetailsObj={props.documentDetailsObj}
|
documentDetailsObj={props.documentDetailsObj}
|
||||||
documentHistoryObj={props.documentHistoryObj}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+89
-187
@@ -14,8 +14,6 @@ import {
|
|||||||
getBasicSearch,
|
getBasicSearch,
|
||||||
getBasicSearchDetails,
|
getBasicSearchDetails,
|
||||||
getSearchDocumentDetails,
|
getSearchDocumentDetails,
|
||||||
getSearchDocumentHistory,
|
|
||||||
getSearchDocumentHistoryPaged,
|
|
||||||
getSearchDocumentDetailsPaged,
|
getSearchDocumentDetailsPaged,
|
||||||
} from "../../actions";
|
} from "../../actions";
|
||||||
|
|
||||||
@@ -23,7 +21,6 @@ import {
|
|||||||
setSearchResults,
|
setSearchResults,
|
||||||
setSearchDetails,
|
setSearchDetails,
|
||||||
setDocumentDetails,
|
setDocumentDetails,
|
||||||
setDocumentHistory,
|
|
||||||
getSearchResultsObj,
|
getSearchResultsObj,
|
||||||
} from "../../store/searchOutput/action";
|
} from "../../store/searchOutput/action";
|
||||||
|
|
||||||
@@ -36,9 +33,7 @@ const DocumentDetails = (props) => {
|
|||||||
searchResultsObj,
|
searchResultsObj,
|
||||||
searchDetailsObj,
|
searchDetailsObj,
|
||||||
documentDetailsObj,
|
documentDetailsObj,
|
||||||
documentHistoryObj,
|
|
||||||
setDocumentDetails,
|
setDocumentDetails,
|
||||||
setDocumentHistory,
|
|
||||||
setCurrentPage,
|
setCurrentPage,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
@@ -150,7 +145,7 @@ const DocumentDetails = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
documentDetailsArr.map((item) => {
|
documentDetailsArr.map((item, key) => {
|
||||||
let detailsObj = jsonpath.query(
|
let detailsObj = jsonpath.query(
|
||||||
item,
|
item,
|
||||||
"$..[?(@._pinswg_documentids_value=='" +
|
"$..[?(@._pinswg_documentids_value=='" +
|
||||||
@@ -158,30 +153,15 @@ const DocumentDetails = (props) => {
|
|||||||
"')]"
|
"')]"
|
||||||
);
|
);
|
||||||
detailsObj = item;
|
detailsObj = item;
|
||||||
|
return (
|
||||||
if (typeof detailsObj != "undefined") {
|
<div
|
||||||
var documentHistoryArr =
|
className="govuk-summary-list__row"
|
||||||
documentHistoryObj || [];
|
key={key}
|
||||||
return documentHistoryArr.map(
|
>
|
||||||
(historyItem, key) => {
|
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||||
let historyObj = jsonpath.query(
|
{showDownloadingState === key && (
|
||||||
documentHistoryObj[key],
|
<div className="coverLoadingLink downloading">
|
||||||
"$..value[?(@._pinswg_documentid_value=='" +
|
{/* <img
|
||||||
detailsObj.pinswg_documentid +
|
|
||||||
"')]"
|
|
||||||
);
|
|
||||||
|
|
||||||
historyObj = historyObj[0];
|
|
||||||
return !_.isEmpty(historyObj) ? (
|
|
||||||
<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"
|
className="data-loading-icon"
|
||||||
src="/assets/images/loading.gif"
|
src="/assets/images/loading.gif"
|
||||||
alt={
|
alt={
|
||||||
@@ -191,92 +171,81 @@ const DocumentDetails = (props) => {
|
|||||||
: "Fetching data"
|
: "Fetching data"
|
||||||
}
|
}
|
||||||
/> */}
|
/> */}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Link
|
||||||
|
scroll={false}
|
||||||
|
href={detailsObj.pinswg_hashlink}
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
key={key}
|
||||||
|
onClick={() => {
|
||||||
|
toggleDownLoadLink(key);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span className="results-visually-hidden">
|
||||||
|
{t(
|
||||||
|
"case:documents-name-label"
|
||||||
)}
|
)}
|
||||||
|
:
|
||||||
|
</span>
|
||||||
|
{_.has(
|
||||||
|
detailsObj,
|
||||||
|
"pinswg_name"
|
||||||
|
)
|
||||||
|
? detailsObj.pinswg_name
|
||||||
|
: ""}
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
</dd>
|
||||||
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
|
<span className="results-visually-hidden">
|
||||||
|
{t("case:documents-doc-type-label")}
|
||||||
|
:
|
||||||
|
</span>
|
||||||
|
|
||||||
<Link
|
{router.locale == "cy"
|
||||||
scroll={false}
|
? jsonpath.query(
|
||||||
href={
|
transLookup,
|
||||||
detailsObj.pinswg_hashlink
|
'$..[?(@.value=="' +
|
||||||
}
|
detailsObj[
|
||||||
>
|
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
|
||||||
<a
|
] +
|
||||||
key={key}
|
'")].value_cy'
|
||||||
onClick={() => {
|
)
|
||||||
toggleDownLoadLink(
|
: detailsObj[
|
||||||
key
|
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
|
||||||
);
|
] ||
|
||||||
}}
|
t(
|
||||||
>
|
"case:summary-no-date-entered-label"
|
||||||
<span className="results-visually-hidden">
|
)}
|
||||||
{t(
|
</dd>
|
||||||
"case:documents-name-label"
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
)}
|
<span className="results-visually-hidden">
|
||||||
:
|
{t(
|
||||||
</span>
|
"case:documents-date-published-label"
|
||||||
{_.has(historyObj, [
|
)}
|
||||||
"_pinswg_documentid_value@OData.Community.Display.V1.FormattedValue",
|
:
|
||||||
])
|
</span>
|
||||||
? historyObj[
|
|
||||||
"_pinswg_documentid_value@OData.Community.Display.V1.FormattedValue"
|
|
||||||
]
|
|
||||||
: ""}
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</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"
|
{_.has(
|
||||||
? jsonpath.query(
|
detailsObj,
|
||||||
transLookup,
|
"pinswg_latestpublisheddate"
|
||||||
'$..[?(@.value=="' +
|
)
|
||||||
detailsObj[
|
? formatDates(
|
||||||
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
|
detailsObj.pinswg_latestpublisheddate
|
||||||
] +
|
)
|
||||||
'")].value_cy'
|
: ""}
|
||||||
)
|
</dd>
|
||||||
: detailsObj[
|
{/* <dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
"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(historyObj, [
|
|
||||||
"pinswg_publisheddate@OData.Community.Display.V1.FormattedValue",
|
|
||||||
])
|
|
||||||
? formatDates(
|
|
||||||
historyObj.pinswg_publisheddate
|
|
||||||
)
|
|
||||||
: ""}
|
|
||||||
</dd>
|
|
||||||
{/* <dd className="govuk-summary-list__value govuk-!-font-size-16">
|
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">
|
||||||
{t("case:documents-size-label")}:
|
{t("case:documents-size-label")}:
|
||||||
</span>
|
</span>
|
||||||
92
|
92
|
||||||
</dd> */}
|
</dd> */}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
);
|
||||||
""
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
)}
|
)}
|
||||||
</dl>
|
</dl>
|
||||||
@@ -300,50 +269,22 @@ const DocumentDetails = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const docDetailsObj = async () => {
|
const docDetailsObj = async () => {
|
||||||
let docObj = await getSearchDocumentDetails(incidentid)
|
let docObj = await getSearchDocumentDetails(incidentid).then(
|
||||||
.then((data) => {
|
(data) => {
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
setDocumentDetails(data);
|
setDocumentDetails(data);
|
||||||
return data;
|
setDocumentSearchState(true);
|
||||||
})
|
|
||||||
.then((data) => {
|
|
||||||
let historyObj = getDocumentHistory(data.value).then(
|
|
||||||
(result) => {
|
|
||||||
setDocumentHistory(result);
|
|
||||||
setDocumentSearchState(true);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
return docObj;
|
return docObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDocumentHistory = async (searchDocumentDetailsObj) => {
|
|
||||||
let historyArr = [];
|
|
||||||
searchDocumentDetailsObj = searchDocumentDetailsObj || [];
|
|
||||||
|
|
||||||
const detailsObj = searchDocumentDetailsObj.map(
|
|
||||||
(historyDetail, index) => {
|
|
||||||
if (historyDetail.pinswg_publishtoweb != true) {
|
|
||||||
console.log(historyDetail.pinswg_documentid);
|
|
||||||
} else {
|
|
||||||
historyArr.push(
|
|
||||||
getSearchDocumentHistory(
|
|
||||||
historyDetail.pinswg_documentid
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return Promise.all(historyArr);
|
|
||||||
};
|
|
||||||
const searchDocumentResultsObj = docDetailsObj();
|
const searchDocumentResultsObj = docDetailsObj();
|
||||||
}, [
|
}, [
|
||||||
incidentid,
|
incidentid,
|
||||||
setDocumentHistory,
|
|
||||||
setDocumentDetails,
|
setDocumentDetails,
|
||||||
selectedOption,
|
selectedOption,
|
||||||
fieldSortState,
|
fieldSortState,
|
||||||
@@ -362,10 +303,7 @@ const DocumentDetails = (props) => {
|
|||||||
.then((data) => {
|
.then((data) => {
|
||||||
//console.log("getting details", data);
|
//console.log("getting details", data);
|
||||||
setDocumentDetails(data);
|
setDocumentDetails(data);
|
||||||
return getDocumentHistory(data.value).then((data) => {
|
setShowSpinnerState(false);
|
||||||
setDocumentHistory(data);
|
|
||||||
setShowSpinnerState(false);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -375,48 +313,15 @@ const DocumentDetails = (props) => {
|
|||||||
pageNumber,
|
pageNumber,
|
||||||
orderBy,
|
orderBy,
|
||||||
fieldSort
|
fieldSort
|
||||||
)
|
).then((data) => {
|
||||||
.then((data) => {
|
//console.log(data);
|
||||||
//console.log(data);
|
setDocumentDetails(data);
|
||||||
setDocumentDetails(data);
|
return data;
|
||||||
return data;
|
});
|
||||||
})
|
|
||||||
.then((data) => {
|
|
||||||
let historyObj = getDocumentHistory(
|
|
||||||
data.value,
|
|
||||||
pageNumber
|
|
||||||
).then((result) => {
|
|
||||||
setDocumentHistory(result);
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
|
|
||||||
return data;
|
|
||||||
});
|
|
||||||
|
|
||||||
return docObj;
|
return docObj;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDocumentHistory = async (searchDocumentDetailsObj, pageNumber) => {
|
|
||||||
let historyArr = [];
|
|
||||||
searchDocumentDetailsObj = searchDocumentDetailsObj || [];
|
|
||||||
|
|
||||||
const detailsObj = searchDocumentDetailsObj.map(
|
|
||||||
(historyDetail, index) => {
|
|
||||||
if (historyDetail.pinswg_publishtoweb != true) {
|
|
||||||
console.log(historyDetail.pinswg_documentid);
|
|
||||||
} else {
|
|
||||||
historyArr.push(
|
|
||||||
getSearchDocumentHistoryPaged(
|
|
||||||
historyDetail.pinswg_documentid,
|
|
||||||
pageNumber
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return Promise.all(historyArr);
|
|
||||||
};
|
|
||||||
|
|
||||||
function formatDates(dateObj) {
|
function formatDates(dateObj) {
|
||||||
var dateObj = new Date(dateObj);
|
var dateObj = new Date(dateObj);
|
||||||
var dd = String(dateObj.getDate()).padStart(2, "0");
|
var dd = String(dateObj.getDate()).padStart(2, "0");
|
||||||
@@ -498,7 +403,7 @@ const DocumentDetails = (props) => {
|
|||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
<h2>{t("case:documents-heading-label")}</h2>
|
<h2>{t("case:documents-heading-label")}</h2>
|
||||||
{_.isEmpty(documentHistoryObj) ? (
|
{_.isEmpty(documentDetailsObj) ? (
|
||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-grid-column-two-thirds">
|
<div className="govuk-grid-column-two-thirds">
|
||||||
<h3>
|
<h3>
|
||||||
@@ -536,9 +441,6 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
setDocumentDetails: (detailsObj) => {
|
setDocumentDetails: (detailsObj) => {
|
||||||
dispatch(setDocumentDetails(detailsObj));
|
dispatch(setDocumentDetails(detailsObj));
|
||||||
},
|
},
|
||||||
setDocumentHistory: (historyObj) => {
|
|
||||||
dispatch(setDocumentHistory(historyObj));
|
|
||||||
},
|
|
||||||
setCurrentPage: (currentPage) => {
|
setCurrentPage: (currentPage) => {
|
||||||
dispatch(setCurrentPage(currentPage));
|
dispatch(setCurrentPage(currentPage));
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -43,9 +43,6 @@ const Home = (props) => {
|
|||||||
documentDetailsObj={
|
documentDetailsObj={
|
||||||
props.searchResultsObj.documentDetailsObj
|
props.searchResultsObj.documentDetailsObj
|
||||||
}
|
}
|
||||||
documentHistoryObj={
|
|
||||||
props.searchResultsObj.documentHistoryObj
|
|
||||||
}
|
|
||||||
myRepresentations={
|
myRepresentations={
|
||||||
props.myRepresentations.myRepresentations
|
props.myRepresentations.myRepresentations
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,9 +53,6 @@ const CaseHome = (props) => {
|
|||||||
documentDetailsObj={
|
documentDetailsObj={
|
||||||
props.searchResultsObj.documentDetailsObj
|
props.searchResultsObj.documentDetailsObj
|
||||||
}
|
}
|
||||||
documentHistoryObj={
|
|
||||||
props.searchResultsObj.documentHistoryObj
|
|
||||||
}
|
|
||||||
myRepresentations={
|
myRepresentations={
|
||||||
props.myRepresentations.myRepresentations
|
props.myRepresentations.myRepresentations
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,9 +44,6 @@ const Home = (props) => {
|
|||||||
documentDetailsObj={
|
documentDetailsObj={
|
||||||
props.searchResultsObj.documentDetailsObj
|
props.searchResultsObj.documentDetailsObj
|
||||||
}
|
}
|
||||||
documentHistoryObj={
|
|
||||||
props.searchResultsObj.documentHistoryObj
|
|
||||||
}
|
|
||||||
myRepresentations={
|
myRepresentations={
|
||||||
props.myRepresentations.myRepresentations
|
props.myRepresentations.myRepresentations
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ const searchResultsInitialState = {
|
|||||||
searchResultsObj: {},
|
searchResultsObj: {},
|
||||||
searchDetailsObj: {},
|
searchDetailsObj: {},
|
||||||
documentDetailsObj: {},
|
documentDetailsObj: {},
|
||||||
documentHistoryObj: {},
|
|
||||||
representationsObj: {},
|
representationsObj: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -25,11 +24,7 @@ export default function reducer(state = searchResultsInitialState, action) {
|
|||||||
...state,
|
...state,
|
||||||
documentDetailsObj: action.documentDetailsObj,
|
documentDetailsObj: action.documentDetailsObj,
|
||||||
};
|
};
|
||||||
case searchResultsActionTypes.SETDOCUMENTHISTORY:
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
documentHistoryObj: action.documentHistoryObj,
|
|
||||||
};
|
|
||||||
case searchResultsActionTypes.SETREPRESENTATIONS:
|
case searchResultsActionTypes.SETREPRESENTATIONS:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
|||||||
Reference in New Issue
Block a user