Merged PR 499: update translation labels for case details page

Related work items: #5877
This commit is contained in:
Robert Bond
2021-10-08 07:17:19 +00:00
7 changed files with 71 additions and 32 deletions
+17 -2
View File
@@ -314,7 +314,7 @@ export const getBasicDNSSearchDetails = (token, appealType, caseReference) => {
};
export const getLinkedCases = (parentIncidentid) => {
console.log(parentIncidentid);
//console.log(parentIncidentid);
var token = getSASToken();
return axios
@@ -324,7 +324,7 @@ export const getLinkedCases = (parentIncidentid) => {
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true &$select=title, incidentid,"
)
.then((res) => {
console.log(" linked date", res.data);
//console.log(" linked date", res.data);
return res.data;
})
.catch((error) => {
@@ -663,3 +663,18 @@ export const getPortalModuelDetails = (token, appealType, caseReference) => {
console.log("thiserror", error);
});
};
export const getFileFromCRM = (docRef) => {
const weburl = "/api/proxy/documents/download/" + docRef;
console.log("proxy url", weburl);
return axios
.get(weburl, { responseType: "arraybuffer" })
.then((res) => {
console.log(res);
return res;
})
.catch((error) => {
console.log("thi serror", error);
});
};
+10 -3
View File
@@ -95,7 +95,7 @@ const DocumentDetails = (props) => {
detailsObj.pinswg_isharedocumentreference
}
>
<a target="_blank">
<a>
<span className="results-visually-hidden">
{t(
"case:documents-name-label"
@@ -212,6 +212,11 @@ const DocumentDetails = (props) => {
};
const searchDocumentResultsObj = docDetailsObj();
const getFileFromCRM = (event, docRef) => {
console.log(e, docRef);
return alert(docRef);
};
}, [incidentid, setDocumentHistory, setDocumentDetails]);
function formatDates(dateObj) {
@@ -227,11 +232,13 @@ const DocumentDetails = (props) => {
<div>
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<h2>Documents</h2>
<h2>{t("case:documents-heading-label")}</h2>
{_.isEmpty(documentHistoryObj) ? (
<div className="govuk-grid-row">
<div className="govuk-grid-column-two-thirds">
<h3>There are no documents for this appeal</h3>
<h3>
{t("case:documents-non-available-label")}
</h3>
</div>
</div>
) : (
+2 -2
View File
@@ -607,7 +607,7 @@ const CaseSummary = (props) => {
useEffect(() => {
const linkCaseObj = async () => {
let docObj = await getLinkedCases(incidentid).then((data) => {
console.log(data);
//console.log(data);
setCurrentLinkedCases(data);
return data;
});
@@ -636,7 +636,7 @@ const CaseSummary = (props) => {
}
function linkedCasesList(linkedCasesReference) {
console.log(linkedCasesReference);
//console.log(linkedCasesReference);
linkedCasesReference = linkedCasesReference.value || [];
+1 -1
View File
@@ -27,7 +27,7 @@ export default function Footer(props) {
: setShowShareState(true);
};
console.log(router.asPath);
//console.log(router.asPath);
const shareBodyStr = t("common:gov-wales-link") + router.asPath;
const shareSubjectStr =
t("common:social-shared-from") +
+3 -1
View File
@@ -34,5 +34,7 @@
"documents-name-label": "Math y Ddogfen",
"documents-doc-type-label": "Math y Ddogfen",
"documents-date-published-label": "Dyddiad cyhoeddi",
"documents-size-label": "Maint y ffeil (kb)"
"documents-size-label": "Maint y ffeil (kb)",
"documents-non-available-label": "Nid oes unrhyw ddogfennau ar gyfer yr apêl hon",
"documents-heading-label": "Dogfennau"
}
+3 -1
View File
@@ -34,5 +34,7 @@
"documents-name-label": "Name",
"documents-doc-type-label": "Document type",
"documents-date-published-label": "Date published",
"documents-size-label": "Size (KB)"
"documents-size-label": "Size (KB)",
"documents-non-available-label": "There are no documents for this appeal",
"documents-heading-label": "Documents"
}
+35 -22
View File
@@ -1,6 +1,7 @@
import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { response } from "express";
const PROXY_RELAY_URL =
"https://" +
@@ -62,24 +63,9 @@ const getSASToken = () => {
export default async function ApiProxy(req, res) {
console.log(req.method);
var updateBody = {
"pinswg_areaofsiteinhectaresdec": 21,
"pinswg_developmentaffectsettingifalisted": false,
"pinswg_floorspaceinsquaremeters": "123123124",
"pinswg_incarelatestoca": false,
"pinswg_isfloodinganissue": true,
"pinswg_isthesitewithinanaonb": false,
"pinswg_landuse": "846040002",
"pinswg_sitewithinsssi": true,
"pinswg_sitewithinagreenbelt": false,
"pinswg_siteviewablefromroad": false,
"pinswg_typeofplanningapplication": "846040000",
};
var data = JSON.stringify(req.body);
const SASToken = getSASToken();
// console.log(SASToken);
var configNoData = {
method: req.method,
//url: PROXY_RELAY_URL + updateFormCollection + "(" + incidentId + ")",
@@ -109,17 +95,44 @@ export default async function ApiProxy(req, res) {
data: data,
};
console.log(req.url.split("/api/proxy/")[1]);
var configDocument = {
method: req.method,
url: PROXY_RELAY_URL + req.url.split("/api/proxy/")[1],
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": SASToken,
"Content-Type": "application/json",
},
responseType: "arraybuffer",
};
return new Promise((resolve, reject) => {
console.log(config);
axios(req.method == "GET" ? configNoData : config)
let apiPath = req.url.split("/api/proxy/")[1];
let hasDocument = apiPath.indexOf("/download") > 0 ? true : false;
axios(
req.method == "GET"
? hasDocument
? configDocument
: configNoData
: config
)
.then((response) => {
// console.log(response);
res.statusCode = 200;
res.setHeader("Content-Type", "application/json");
res.setHeader("Cache-Control", "max-age=1800000");
res.end(JSON.stringify(response.data));
console.log("response data", response.data);
if (hasDocument) {
res.setHeader("Content-Type", "text/plain");
res.end(response.data);
} else {
res.setHeader("Content-Type", "application/json");
res.setHeader("Cache-Control", "max-age=1800000");
res.end(JSON.stringify(response.data));
}
//console.log("response data", response.data);
resolve();
})
.catch((error) => {