Merged PR 491: updated translations for lpas
updated translations for lpas Related work items: #6270
This commit is contained in:
+11
-5
@@ -388,6 +388,7 @@ export const getAppealsTypes = (token) => {
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
let ErrResponse = {
|
||||
value: [],
|
||||
errorCode: error.response.status,
|
||||
@@ -445,10 +446,14 @@ export const getLPA = (token) => {
|
||||
// console.log("api_root: ", BASE_URL);
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + "accounts?$count=true&$select=name",
|
||||
WEBAPI_URL +
|
||||
"accounts?$count=true&$filter=pinswg_isalocalplanningauthorityaccount eq 846040000&$select=name",
|
||||
azureHeaders(token)
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.then((res) => {
|
||||
// console.log(res.data);
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
let ErrResponse = {
|
||||
value: [],
|
||||
@@ -502,7 +507,7 @@ export const getAppealID = (
|
||||
});
|
||||
};
|
||||
|
||||
export const createCase = (appealTypeId) => {
|
||||
export const createCase = (token, appealTypeId) => {
|
||||
appealTypeId = parseInt(appealTypeId);
|
||||
var data = JSON.stringify({
|
||||
"title": "insertion test case",
|
||||
@@ -521,7 +526,7 @@ export const createCase = (appealTypeId) => {
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"ServiceBusAuthorization": SASToken,
|
||||
"ServiceBusAuthorization": token,
|
||||
},
|
||||
data: data,
|
||||
};
|
||||
@@ -537,6 +542,7 @@ export const createCase = (appealTypeId) => {
|
||||
};
|
||||
|
||||
export const updateCase = async (
|
||||
token,
|
||||
incidentId,
|
||||
updateBody,
|
||||
updateFormCollection,
|
||||
@@ -563,7 +569,7 @@ export const updateCase = async (
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"ServiceBusAuthorization": SASToken,
|
||||
"ServiceBusAuthorization": token,
|
||||
},
|
||||
data: data,
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@ import BuildRow from "./buildrow";
|
||||
import { reduxForm, formValueSelector, Field } from "redux-form";
|
||||
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
|
||||
import jsonpath from "jsonpath";
|
||||
import transLookup from "../../data/lookuptranslations.json";
|
||||
|
||||
import data from "../../data/collections.json";
|
||||
import {
|
||||
@@ -90,7 +91,7 @@ let CreateCase = (props) => {
|
||||
//onChange={(e) => props.onChangeSelectLPA(e)}
|
||||
>
|
||||
<option value="" disabled defaultValue>
|
||||
Select...
|
||||
{t("common:drop-down-select")}
|
||||
</option>
|
||||
{_.isEmpty(optionsObj)
|
||||
? ""
|
||||
@@ -100,7 +101,15 @@ let CreateCase = (props) => {
|
||||
key={key}
|
||||
value={optionsObj[key].accountid}
|
||||
>
|
||||
{optionsObj[key].name}
|
||||
{router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
optionsObj[key]
|
||||
.name +
|
||||
'")].value_cy'
|
||||
)
|
||||
: optionsObj[key].name}
|
||||
</option>
|
||||
);
|
||||
})}
|
||||
@@ -151,7 +160,7 @@ let CreateCase = (props) => {
|
||||
//onChange={(e) => props.onChangeSelectAppealType(e)}
|
||||
>
|
||||
<option value="" disabled defaultValue>
|
||||
Select...
|
||||
{t("common:drop-down-select")}
|
||||
</option>
|
||||
{_.isEmpty(optionsObj)
|
||||
? ""
|
||||
@@ -190,6 +199,14 @@ let CreateCase = (props) => {
|
||||
optionsObj[key].value
|
||||
)
|
||||
? ""
|
||||
: router.locale == "cy"
|
||||
? jsonpath.query(
|
||||
transLookup,
|
||||
'$..[?(@.value=="' +
|
||||
optionsObj[key]
|
||||
.value +
|
||||
'")].value_cy'
|
||||
)
|
||||
: optionsObj[key].value}
|
||||
</option>
|
||||
);
|
||||
@@ -248,8 +265,8 @@ let CreateCase = (props) => {
|
||||
component={RenderLPAList}
|
||||
optionsObj={lpaOptionsObj}
|
||||
validate={[required]}
|
||||
label="Select your local planning authority"
|
||||
errorMsg="Local authority is required"
|
||||
label={t("newappeal:select-lpa-label")}
|
||||
errorMsg={t("newappeal:select-lpa-label-error-msg")}
|
||||
/>
|
||||
|
||||
<Field
|
||||
@@ -257,8 +274,8 @@ let CreateCase = (props) => {
|
||||
component={RenderAppealTypeList}
|
||||
optionsObj={appealOptionsObj}
|
||||
validate={[required]}
|
||||
label="Select an appeal type"
|
||||
errorMsg="Appeal type is required"
|
||||
label={t("newappeal:select-appeal-type-label")}
|
||||
errorMsg={t("newappeal:select-appeal-type-label-error-msg")}
|
||||
/>
|
||||
|
||||
<button
|
||||
@@ -266,7 +283,7 @@ let CreateCase = (props) => {
|
||||
className="govuk-button"
|
||||
data-module="govuk-button"
|
||||
>
|
||||
Continue
|
||||
{t("common:continue-button")}
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
"pinswg_lpa": 0
|
||||
},
|
||||
{
|
||||
"value": "Cardiff Council",
|
||||
"value": "Cardiff County Council",
|
||||
"value_cy": "Cyngor Caerdydd",
|
||||
"pinswg_lpa": 0
|
||||
},
|
||||
@@ -322,19 +322,24 @@
|
||||
"pinswg_lpa": 0
|
||||
},
|
||||
{
|
||||
"value": "Brecon Beacons National Park",
|
||||
"value": "Brecon Beacons National Park Authority",
|
||||
"value_cy": "Parc Cenedlaethol Bannau Brycheiniog",
|
||||
"pinswg_lpa": 0
|
||||
},
|
||||
{
|
||||
"value": "Pembrokeshire Coast National Park",
|
||||
"value": "Pembrokeshire Coast National Park Authority",
|
||||
"value_cy": "Parc Cenedlaethol Arfordir Penfro",
|
||||
"pinswg_lpa": 0
|
||||
},
|
||||
{
|
||||
"value": "Snowdonia National Park",
|
||||
"value": "Snowdonia National Park Authority",
|
||||
"value_cy": "Parc Cenedlaethol Eryri",
|
||||
"pinswg_lpa": 0
|
||||
},
|
||||
{
|
||||
"value": "Developments of National Significance",
|
||||
"value_cy": "Datblygiadau o Arwyddocâd Cenedlaethol",
|
||||
"pinswg_lpa": 0
|
||||
}
|
||||
],
|
||||
"pinswg_procedure": [
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
{
|
||||
"viewall-link": "View all",
|
||||
"parent-page-title": "My portal",
|
||||
"page-title": "New appeal"
|
||||
"parent-page-title": "Fy Mhorth",
|
||||
"page-title": "Apêl newydd",
|
||||
"select-lpa-label": "Dewiswch eich awdurdod cynllunio lleol",
|
||||
"select-lpa-label-error-msg": "Mae angen awdurdod lleol",
|
||||
"select-appeal-type-label": "Dewiswch fath o apêl",
|
||||
"select-appeal-type-label-error-msg": "Mae angen math o apêl"
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
{
|
||||
"viewall-link": "View all",
|
||||
"parent-page-title": "My portal",
|
||||
"page-title": "New appeal"
|
||||
"page-title": "New appeal",
|
||||
"select-lpa-label": "Select your local planning authority",
|
||||
"select-lpa-label-error-msg": "Local authority is required",
|
||||
"select-appeal-type-label": "Select an appeal type",
|
||||
"select-appeal-type-label-error-msg": "Appeal type is required"
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
} from "../../store/appealType/action";
|
||||
import { setForm, getFormObj } from "../../store/formData/action";
|
||||
import {
|
||||
getSASToken,
|
||||
getFormData,
|
||||
getAppealsTypes,
|
||||
getMandatoryFields,
|
||||
@@ -170,7 +171,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
console.log("the query", query);
|
||||
|
||||
const token = await getSASToken();
|
||||
const [
|
||||
caseReferenceData,
|
||||
appealTypeData,
|
||||
@@ -178,11 +179,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
pickListData,
|
||||
formdata,
|
||||
] = await Promise.all([
|
||||
await createCase(query.apt),
|
||||
await getAppealsTypes(),
|
||||
await getMandatoryFields(query.appealtypes),
|
||||
await getPickLists(query.appealtypes),
|
||||
await getFormData(query.appealtypes),
|
||||
await createCase(token, query.apt),
|
||||
await getAppealsTypes(token),
|
||||
await getMandatoryFields(token, query.appealtypes),
|
||||
await getPickLists(token, query.appealtypes),
|
||||
await getFormData(token, query.appealtypes),
|
||||
]);
|
||||
|
||||
// let updateCaseReferenceData = await updateCase(
|
||||
|
||||
@@ -26,7 +26,13 @@ import {
|
||||
setAppealLPA,
|
||||
getAppealTypeObj,
|
||||
} from "../../store/appealType/action";
|
||||
import { getAppealsTypes, getLPA, updateCase, createCase } from "../../actions";
|
||||
import {
|
||||
getAppealsTypes,
|
||||
getLPA,
|
||||
updateCase,
|
||||
createCase,
|
||||
getSASToken,
|
||||
} from "../../actions";
|
||||
import { setLPA } from "../../store/lpa/action";
|
||||
|
||||
const Home = (props) => {
|
||||
@@ -80,9 +86,11 @@ const Home = (props) => {
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
const token = await getSASToken();
|
||||
|
||||
const [appealTypeData, lpaData, caseData] = await Promise.all([
|
||||
await getAppealsTypes(),
|
||||
await getLPA(),
|
||||
await getAppealsTypes(token),
|
||||
await getLPA(token),
|
||||
]);
|
||||
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
|
||||
Reference in New Issue
Block a user