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