This commit is contained in:
2022-12-16 11:36:01 +00:00
parent f6d934d951
commit 98aefdd867
36 changed files with 1258 additions and 371 deletions
+3 -2
View File
@@ -45,9 +45,9 @@ RELAYPATH = "dev-pedw-hc"
GOOGLE_TAG_MANAGER = GTM-T78CBC3
SHOWLOGIN = "true"
SHOWREPRESENTATIONS = false
SHOWREPRESENTATIONS = "true"
SHOWFILEUPLOAD = "false"
SHOWMAPS = "true"
SHOWMAPS = "false"
//BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2
@@ -104,6 +104,7 @@ SECRET=SuperSecret
AZURE_CLIENT_ID = $CLIENT_ID
AZURE_TENANT_ID = $TENANT
AZURE_CLIENT_SECRET = $CLIENT_SECRET
AZURE_STORAGE_ACCOUNT_NAME= "pedwdev"
AZURE_PEDW_STORAGE_ENDPOINT = https://pedwdev.blob.core.windows.net
AZURE_PEDW_CONTAINER = "pedwapplications"
+39 -1
View File
@@ -255,6 +255,44 @@ export const createBlob = async (formContent, containerName, caseref) => {
return formContent.pinswg_name;
};
export const createRepBlob = async (formContent, containerName, caseref) => {
const containerToken = await createContainerSas(containerName);
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
const containerClient = new ContainerClient(sasUrl);
formContent = JSON.parse(formContent);
let caseID = "";
caseID = _.has(formContent, "pinswg_name")
? formContent.pinswg_name
: caseref;
const content = JSON.stringify(formContent);
console.log(content);
const blobName = caseref + "/" + caseID + "_rep.json";
console.log("blobName:", blobName);
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
const uploadBlobResponse = await blockBlobClient.upload(
content,
Buffer.byteLength(content)
);
const tags = {
containerid: containerName,
caseID: caseID,
blobType: "Representation",
};
console.log("the tags:", tags);
const withTags = await blockBlobClient.setTags(tags);
const withMeta = await blockBlobClient.setMetadata(tags);
return formContent.pinswg_name;
};
export const deleteBlob = async (containerName, blobName) => {
const creds = new DefaultAzureCredential();
@@ -545,7 +583,7 @@ export const getAllProgressBlobs = async (containerName) => {
let blobObj = [];
for await (const blob of containerClient.listBlobsFlat()) {
blob.name.split("/")[1].indexOf(".json") > 0 &&
blob.name.split("/")[1].indexOf("_appeal.json") > 0 &&
blob.name.split("/")[1].indexOf("undefined") < 0 &&
blobObj.push({
"name": blob.name.split("/")[1],
+44
View File
@@ -1253,6 +1253,50 @@ export const uploadFiles = async (
}
};
export const uploadRepFiles = async (
formValues,
filesObj,
containerID,
casefolderID
) => {
let files = filesObj;
//console.log(formValues);
var formData = new FormData();
formData.append("appealData", JSON.stringify(formValues));
formData.append("containerID", containerID);
formData.append("casefolderID", casefolderID);
formData.append("repOrAppeal", true);
// files.forEach((file) => formData.append("files", file));
for (let i = 0; i < files.length; i++) {
for (let j = 0; j < files[i].length; j++) {
console.log(files[i][j].name);
formData.append(files[i][j].name, files[i][j]);
}
}
//console.log(formData);
var queryUrl = "/api/file/upload";
const config = {
method: "post",
url: queryUrl,
data: formData,
headers: { "content-type": "multipart/form-data" },
};
//console.log(config);
try {
const res = await axios(config);
return res.data;
} catch (error) {
console.log("this serror", error);
}
};
export const getFilesFromBlob = (containerName, casefolderID) => {
return axios
.get(
+1 -1
View File
@@ -48,7 +48,7 @@ export const getSelectQuery = (appealTypeName) => {
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_sitepostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_starttimeofevent,pinswg_typeofevent";
break;
case "pinswg_planningappeals78s":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_casedecisiondate,pinswg_dicision,pinswg_dateeventrequested,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdatetimeiftheevent,pinswg_typeofevent";
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_casedecisiondate,pinswg_dicision,pinswg_dateeventrequested,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdatetimeiftheevent,pinswg_representation_period_end_date,pinswg_extend_representation_date,pinswg_typeofevent";
break;
case "pinswg_planningconditionss73s79s":
return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdateofevent,pinswg_typeofevent";
+21 -5
View File
@@ -84,17 +84,16 @@ const Breadcrumbs = (props) => {
{router.pathname == "/myportal/searchresults" ? (
<>
<li className="govuk-breadcrumbs__list-item">
<Link
<a
href={
router.locale != "en"
? router.locale + "/myportal"
: "/myportal"
}
className="govuk-breadcrumbs__link"
>
<a className="govuk-breadcrumbs__link">
{t("common:breadcrumb-my-portal")}
</a>
</Link>
{t("common:breadcrumb-my-portal")}
</a>
</li>
<li className="govuk-breadcrumbs__list-item">
{t("common:breadcrumb-search-results")}
@@ -531,6 +530,23 @@ const Breadcrumbs = (props) => {
</Link>
</li>
)}
<li className="govuk-breadcrumbs__list-item">
<Link
href={
router.locale != "en"
? router.locale + "/case"
: "/case"
}
>
<a className="govuk-breadcrumbs__link">
{
props.props.currentView
.caseReference
.currentReference
}
</a>
</Link>
</li>
<li className="govuk-breadcrumbs__list-item">
Make representation for:{" "}
{
+167 -20
View File
@@ -3,7 +3,7 @@ import { useState, useEffect } from "react";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import jsonpath from "jsonpath";
import _ from "lodash";
import _, { property } from "lodash";
import {
Field,
FieldArray,
@@ -28,6 +28,12 @@ import RepInterestedPartyPerson from "./representationInterestedPartyPerson";
import RepLandOwner from "./representationLandowner";
import RepCompleteSubmit from "./representationCompleteSubmit";
import { useSession, signIn, signOut } from "next-auth/react";
import {
updateCase,
patchCase,
uploadRepFiles,
sendEmail,
} from "../../../actions";
import {
RenderPickList,
@@ -76,6 +82,18 @@ let MakeRepresentation = (props) => {
casesObj = Object.assign({}, ...casesObj);
var detailsObj = {};
currentType == "searchResultsObj"
? (casesObj = jsonpath.query(
setCaseQueryObj,
'$..[?(@.title=="' + caseReference + '")]'
))
: (casesObj = jsonpath.query(
setCaseQueryObj,
'$..[?(@.reference=="' + caseReference + '")]'
));
const capacityOptionsArr = [
"Appellant",
"Agent",
@@ -129,6 +147,7 @@ let MakeRepresentation = (props) => {
currentView={currentView}
setSubmitBack={setSubmitBack}
props={props}
caseReference={caseReference}
/>
);
break;
@@ -214,31 +233,159 @@ let MakeRepresentation = (props) => {
}
};
const updateRepresentation = async (
values,
sendSavedEmail,
useSaveStatus
) => {
let incidentId = props.appealType.caseReference.incidentid;
let updateBody = values || {};
// "pinswg_name": "2022-11-29-IP-REP_BOND_1",
const repDate = new Date();
let day = repDate.getDate();
let month = repDate.getMonth() + 1;
let year = repDate.getFullYear();
const repType = "";
switch (values.representationCapacity) {
case "Appellant":
repType = "APPELLANT";
break;
case "Agent":
repType = "AGENT";
break;
case "Interested Party/Person":
repType = "IP";
break;
case "Land Owner":
repType = "LO";
break;
default:
// code block
}
Object.assign(updateBody, {
"pinswg_name":
year +
"-" +
month +
"-" +
day +
"-" +
repType +
"-REP" +
"_" +
props.props.accountDetails.accountDetails.lastname,
"containerID": props.props.accountDetails.containerID,
});
updateBody = JSON.stringify(updateBody);
updateBody = updateBody.replace(/:"Yes"/gm, `:true`);
updateBody = updateBody.replace(/:"No"/gm, `:false`);
updateBody = JSON.parse(updateBody);
Object.keys(updateBody).forEach((key) => {
if (updateBody[key] === null) {
delete updateBody[key];
}
if (key.indexOf("_") == 0) {
delete updateBody[key];
}
});
//console.log(updateBody);
window.alert(`form is :\n\n${JSON.stringify(updateBody, null, 2)}`);
const reference = "PEDW-PARTIAL-REP";
const templateId = "021b0a7b-df00-41f1-b94e-c269bee98c75";
const emailAddress = props.props.accountDetails.loggedinUserEmail;
const personalisation = {
"caseReference": props.caseReference,
"emailAddress": props.props.accountDetails.loggedinUserEmail,
"returnLink": "",
"linkExpiry": 10 * 60,
};
props.currentView.representationSubmit == "true" &&
(sendSavedEmail == true &&
sendEmail(templateId, emailAddress, personalisation, reference),
useSaveStatus &&
router.replace(
router.locale != "en"
? router.locale + "/myportal"
: "/myportal"
));
};
const onHandleSubmit = (values) => {
// console.log(
// values,
// values.representationCapacity,
// currentView.representationCapacity
// );
currentView.representationSubmit != true
? // console.log(
// values,
// values.representationCapacity,
// currentView.representationCapacity
// );
// console.log(_.isEmpty(currentView.representationCapacity));
// console.log(
// values.representationCapacity
// .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
// .toLowerCase() == currentView.representationCapacity
// );
// console.log(_.isEmpty(currentView.representationCapacity));
// console.log(
// values.representationCapacity
// .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
// .toLowerCase() == currentView.representationCapacity
// );
_.isEmpty(currentView.representationCapacity)
? setRepresentationCapacity(
values.representationCapacity
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase()
)
: setRepresentationSubmit("true");
_.isEmpty(currentView.representationCapacity)
? setRepresentationCapacity(
values.representationCapacity
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase()
)
: setRepresentationSubmit(true)
: currentView.representationSubmit == true &&
(console.log("capacity", currentView.representationCapacity),
console.log("has errors:", props.invalid),
props.invalid == false &&
updateRepresentation(values, false, false),
uploadRepresentationFiles(values),
setRepresentationSubmitConfirmation(true));
window.alert(`You submitted:\n\n${JSON.stringify(values, null, 2)}`);
};
const uploadRepresentationFiles = (values) => {
// get filelists from values object
let fileListObj = _.filter(values, function (v, key) {
return _.includes(key, "representationDocuments");
});
console.log(fileListObj);
console.log(
"\n////////////////////////\n upload files:",
values.containerID
);
var dataObj = values;
for (let key in dataObj) {
_.includes(key, "representationDocuments") == true &&
delete dataObj[key];
}
uploadRepFiles(
dataObj,
fileListObj,
values.containerID,
props.caseReference
).then((data) => {
//console.log("hello", data);
return data;
});
};
const repForm = props.props.form;
// console.log(
@@ -312,7 +459,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
setRepresentationCapacity: (representationCapacity) => {
dispatch(reset("representationForm"));
//dispatch(reset("representationForm"));
dispatch(setRepresentationCapacity(representationCapacity));
},
setRepresentationSubmit: (representationSubmit) => {
@@ -7,6 +7,7 @@ import {
RenderTextfield,
RenderRadioList,
RenderMultiline,
RenderCondtionalRadioList,
} from "./representationElements";
import {
setRepresentationCapacity,
@@ -32,12 +33,15 @@ const RepAgent = (props) => {
{file.path} - {file.size} bytes
</li>
));
const required = (value) => (value ? undefined : "Required");
return (
<div id="rep-appellant">
<div className="govuk-grid-column-full">
<div className="govuk-grid-row">
<h2 className="govuk-heading-m ">Representation - agent</h2>
<h2 className="govuk-heading-m ">
Representation from an Agent
</h2>
<div className="govuk-form-group">
<label
@@ -54,7 +58,7 @@ const RepAgent = (props) => {
/>
</div>
</div>
<div className="govuk-grid-row">
{/* <div className="govuk-grid-row">
<div className="govuk-form-group">
<Field
className="govuk-input govuk-!-width-three-quarters"
@@ -67,6 +71,24 @@ const RepAgent = (props) => {
label="Description of representation"
/>
</div>
</div> */}
<div className="govuk-grid-row">
<div className="govuk-form-group">
<Field
name="representationOnBehalfOf"
datafieldname="representationOnBehalfOf"
// label="In what capacity do you wish to make representations on this case?"
options={["Yes", "No"]}
id="representationOnBehalfOf"
className="govuk-radios__input"
errorMsg={t("newappeal:select-an-option-label")}
component={RenderCondtionalRadioList}
validate={[required]}
legend={
"Are you acting on behalf of a company, group or organisation?"
}
/>
</div>
</div>
<div className="govuk-grid-row">
<div className="govuk-form-group">
@@ -39,6 +39,9 @@ const RepAppellant = (props) => {
<div className="govuk-grid-column-full">
<div className="govuk-grid-row">
<div className="govuk-form-group">
<h2 className="govuk-heading-m ">
Representation for an Appellant
</h2>
<label
className="govuk-label govuk-body-m"
htmlFor="representationType"
@@ -53,7 +56,7 @@ const RepAppellant = (props) => {
/>
</div>
</div>
<div className="govuk-grid-row">
{/* <div className="govuk-grid-row">
<div className="govuk-form-group">
<Field
className="govuk-input govuk-!-width-three-quarters"
@@ -66,7 +69,7 @@ const RepAppellant = (props) => {
label="Description of representation"
/>
</div>
</div>
</div> */}
<div className="govuk-grid-row">
<div className="govuk-form-group">
<p className="govuk-body">
@@ -47,6 +47,8 @@ let RepCapacitySelection = (props) => {
formObj={formObj}
currentType={currentType}
casesObj={casesObj}
caseReference={props.props.caseReference}
searchResultsObj={props.props.searchResultsObj}
/>{" "}
<div id="rep-details" className="vo_hiddens">
<div className="govuk-grid-column-full">
@@ -16,6 +16,7 @@ import {
} from "../../../store/currentView/action";
import { useDropzone } from "react-dropzone";
import RepComplete from "./representationComplete";
import _ from "lodash";
const RepCompleteSubmit = (props) => {
let { t } = useTranslation();
@@ -38,6 +39,8 @@ const RepCompleteSubmit = (props) => {
</li>
));
const repFormData = formObj.representationForm.values;
return (
<>
{currentView.representationSubmitConfirmation == true ? (
@@ -47,6 +50,174 @@ const RepCompleteSubmit = (props) => {
<div className="govuk-grid-column-full">
<div className="govuk-grid-row govuk-body">
<h1 className="govuk-heading-m ">Submit</h1>
<dl className="govuk-summary-list ">
<h2 className="govuk-heading-m govuk-!-margin-top-9">
Your representation:
</h2>
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:representation-representation-type"
)}
</dt>
<dd className="govuk-summary-list__value">
{repFormData.representationType}
</dd>
<dd className="govuk-summary-list__actions">
<a
className="govuk-link"
href="#"
onClick={() => {
setSubmitBack();
}}
>
{t("newappeal:change-link-label")}
<span className="govuk-visually-hidden">
{" "}
{/* {FieldsTranslations(
rows[0].value
)} */}
</span>
</a>
</dd>
</div>
{_.has(
repFormData,
"representationOnBehalfOf"
) && (
<>
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:representation-onbehalfof"
)}
</dt>
<dd className="govuk-summary-list__value">
{
repFormData.representationOnBehalfOf
}
</dd>
<dd className="govuk-summary-list__actions">
<a
className="govuk-link"
href="#"
onClick={() => {
setSubmitBack();
}}
>
{t(
"newappeal:change-link-label"
)}
<span className="govuk-visually-hidden">
{" "}
{/* {FieldsTranslations(
rows[0].value
)} */}
</span>
</a>
</dd>
</div>
{repFormData.representationOnBehalfOf ==
"Yes" && (
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t(
"case:representation-onbehalfof-details"
)}
</dt>
<dd className="govuk-summary-list__value">
{
repFormData.representationOnBehalfOf_details
}
</dd>
<dd className="govuk-summary-list__actions">
<a
className="govuk-link"
href="#"
onClick={() => {
setSubmitBack();
}}
>
{t(
"newappeal:change-link-label"
)}
<span className="govuk-visually-hidden">
{" "}
{/* {FieldsTranslations(
rows[0].value
)} */}
</span>
</a>
</dd>
</div>
)}
</>
)}
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:representation-comments")}
</dt>
<dd className="govuk-summary-list__value">
<span
dangerouslySetInnerHTML={{
__html: repFormData.representationComments,
}}
/>
</dd>
<dd className="govuk-summary-list__actions">
<a
className="govuk-link"
href="#"
onClick={() => {
setSubmitBack();
}}
>
{t("newappeal:change-link-label")}
<span className="govuk-visually-hidden">
{" "}
{/* {FieldsTranslations(
rows[0].value
)} */}
</span>
</a>
</dd>
</div>
<div className="govuk-summary-list__row">
<dt className="govuk-summary-list__key">
{t("case:representation-files")}
</dt>
<dd className="govuk-summary-list__value">
files
</dd>
<dd className="govuk-summary-list__actions">
<a
className="govuk-link"
href="#"
onClick={() => {
setSubmitBack();
}}
>
{t("newappeal:change-link-label")}
<span className="govuk-visually-hidden">
{" "}
{/* {FieldsTranslations(
rows[0].value
)} */}
</span>
</a>
</dd>
</div>
</dl>
<p>
The gathering and subsequent processing of the
personal data supplied by you in this form, is
@@ -90,7 +261,8 @@ const RepCompleteSubmit = (props) => {
className="govuk-button"
data-module="govuk-button"
onClick={() =>
setRepresentationSubmitConfirmation()
//setRepresentationSubmitConfirmation()
setRepresentationSubmit(true)
}
>
Continue
@@ -3,6 +3,7 @@ import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { Field, reduxForm } from "redux-form";
import { RenderPickList, RenderTextfield } from "./representationElements";
import jsonpath from "jsonpath";
const RepDetails = (props) => {
let { t } = useTranslation();
@@ -10,7 +11,18 @@ const RepDetails = (props) => {
const router = useRouter();
const { locale } = router;
const { currentType, casesObj } = props;
const { currentType, casesObj, caseReference } = props;
let setCaseDetailsObj = props.searchResultsObj.searchDetailsObj;
var detailsObj = {};
detailsObj = jsonpath.query(
setCaseDetailsObj,
'$..[?(@.pinswg_name=="' + caseReference + '")]'
);
detailsObj = detailsObj[0];
return (
<>
@@ -24,6 +36,9 @@ const RepDetails = (props) => {
</dt>
<dd className="govuk-summary-list__value">
{casesObj.appellantApplicant || ""}
{detailsObj[
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
] || "not entered"}
</dd>
</div>
{/* <div className="govuk-summary-list__row">
@@ -39,12 +54,36 @@ const RepDetails = (props) => {
{t("case:summary-site-address-label")}
</dt>
<dd className="govuk-summary-list__value">
{casesObj.address1 || ""}
<br />
{casesObj.town || ""}
<br />
{casesObj.postcode || ""}
{_.has(detailsObj, "pinswg_siteaddressline1")
? detailsObj.pinswg_siteaddressline1
: ""}
{_.has(detailsObj, "pinswg_siteaddressline1") &&
detailsObj.pinswg_siteaddressline1 !=
null && <br />}
{_.has(detailsObj, "pinswg_siteaddressline2")
? detailsObj.pinswg_siteaddressline2
: ""}
{_.has(detailsObj, "pinswg_siteaddressline2") &&
detailsObj.pinswg_siteaddressline2 !=
null && <br />}
{_.has(detailsObj, "pinswg_siteaddresstown")
? detailsObj.pinswg_siteaddresstown
: ""}
{_.has(detailsObj, "pinswg_siteaddresstown") &&
detailsObj.pinswg_siteaddresstown !=
null && <br />}
{_.has(detailsObj, "pinswg_siteaddresscounty")
? detailsObj.pinswg_siteaddresscounty
: ""}
{_.has(
detailsObj,
"pinswg_siteaddresscounty"
) &&
detailsObj.pinswg_siteaddresscounty !=
null && <br />}
{_.has(detailsObj, "pinswg_siteaddresspostcode")
? detailsObj.pinswg_siteaddresspostcode
: ""}
</dd>
</div>
</dl>
@@ -84,29 +84,176 @@ export const RenderRadioList = ({
);
};
export const RenderCondtionalRadioList = ({
datafieldname,
legend,
name,
label,
id,
errorMsg,
options,
input: { onChange, value },
meta: { touched, error },
...custom
}) => {
const required = (value) => (value ? undefined : "Required");
return (
<>
<div
className={
touched && error
? "govuk-form-group govuk-form-group--error"
: "govuk-form-group "
}
>
<fieldset
className="govuk-fieldset"
aria-describedby={id + "-hint"}
>
<legend className="govuk-fieldset__legend govuk-fieldset__legend--s govuk-!-font-weight-regular">
<label
className="govuk-fieldset__heading govuk-body-m"
id={id + "_label"}
>
{label}
</label>
</legend>
{touched && error && (
<span
id={id + "-error"}
className="govuk-error-message"
>
<span className="govuk-visually-hidden">
Error:
</span>{" "}
{errorMsg}
</span>
)}
<legend className="govuk-fieldset__legend govuk-fieldset__legend--m">
<label
className="govuk-fieldset__heading govuk-body-m"
id="representationCapacity_label"
>
{legend}
</label>
</legend>
<div id={id + "-hint"} className="govuk-hint">
e.g. &lsquo;Owners of Numbers 1-5 High Street&lsquo;, or
&lsquo;Mr and Mrs Smith&lsquo; or &lsquo;The executors
of Mr Evans&lsquo; estate&lsquo;
</div>
<div className="govuk-radios">
{Object.keys(options).map((key, index) => (
<div key={key} className="govuk-!-margin-bottom-3">
<div
className="govuk-radios__item"
data-children-count={key}
key={key}
>
<Field
id={id + "_" + index}
name={id}
component="input"
type="radio"
className="govuk-radios__input"
value={options[key]}
validate={[required]}
/>
<label
className="govuk-label govuk-radios__label"
htmlFor={id + "_" + index}
>
{options[key]}
</label>
</div>
{value == "Yes" && options[key] == "Yes" && (
<div
className="govuk-radios__conditional "
id={"conditional-" + id}
>
<div
className="govuk-form-group"
key={"yes_group_" + key}
>
<label
className="govuk-label"
htmlFor={id + "_details"}
>
Enter the name of the
company/group/organisation *
</label>
<Field
className="govuk-input govuk-!-width-one-half"
id={id + "_details"}
name={id + "_details"}
component="input"
type="text"
/>
</div>
</div>
)}
</div>
))}
</div>
</fieldset>
</div>
</>
);
};
export const RenderPickList = ({
datafieldname,
name,
label,
input,
optionsArr,
meta: { touched, errorStr },
meta: { touched, error },
errorMsg,
}) => {
return (
<div>
<select {...input} className="govuk-select " id={name} name={name}>
<option>Select...</option>
{Object.keys(optionsArr).map((key, index) => {
return (
<option key={key} value={optionsArr[key]}>
{optionsArr[key]}
</option>
);
})}
</select>
<>
<div
className={
touched && error
? "govuk-form-group govuk-form-group--error"
: "govuk-form-group "
}
>
<label className="govuk-label" htmlFor="sort">
{label}
</label>
{touched && error && (
<span
id="passport-issued-error"
className="govuk-error-message"
>
<span className="govuk-visually-hidden">Error:</span>{" "}
{errorMsg}
</span>
)}
{touched && errorStr && <span>{errorStr}</span>}
</div>
<div>
<select
{...input}
className="govuk-select "
id={name}
name={name}
>
<option>Select...</option>
{Object.keys(optionsArr).map((key, index) => {
return (
<option key={key} value={optionsArr[key]}>
{optionsArr[key]}
</option>
);
})}
</select>
</div>
</div>
</>
);
};
@@ -123,6 +270,8 @@ export const RenderTextfield = ({
meta: { touched, error },
...custom
}) => {
const required = (value) => (value ? undefined : "Required");
return (
<>
<label className="govuk-label " htmlFor={id} id={id + "_label"}>
@@ -140,6 +289,7 @@ export const RenderTextfield = ({
name={name}
id={id}
type={type}
validate={[required]}
/>
</>
);
@@ -219,6 +369,7 @@ export function MultiLinefield(props) {
component={RenderMultiline}
type="text"
rows="5"
validate={[required]}
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
@@ -448,15 +599,9 @@ export const RenderFileUpload = (field) => {
onDrop={(filesToUpload, e) => {
const renamedAcceptedFiles = filesToUpload.map(
(file) =>
new File(
[file],
`${getDocumentType(field.documentTypeCode)}_${
file.name
}`,
{
type: file.type,
}
)
new File([file], `${file.name}`, {
type: file.type,
})
);
field.input.onChange(renamedAcceptedFiles);
}}
@@ -561,3 +706,25 @@ export const RenderFileUpload = (field) => {
</>
);
};
export function FileUploadField(props) {
return (
<>
<h2 className="govuk-heading-s">{props.label} </h2>
<Field
name={props.name}
id={props.name}
component={RenderFileUpload}
className="govuk-input govuk-input--width-20"
//validate={[required]}
label={props.label}
errorMsg="Is required"
ticketnumber={props.ticketnumber}
hint={props.hint}
fileList={props.fileList}
setFilesForAppeal={props.setFilesForAppeal}
containerID={props.containerID}
/>
</>
);
}
@@ -5,8 +5,9 @@ import { Field, reduxForm } from "redux-form";
import {
RenderPickList,
RenderTextfield,
RenderRadioList,
RenderCondtionalRadioList,
RenderMultiline,
FileUploadField,
} from "./representationElements";
import { useDropzone } from "react-dropzone";
@@ -21,6 +22,8 @@ const RepInterestedPartyPerson = (props) => {
setRepresentationCapacity,
setRepresentationSubmit,
} = props;
const required = (value) => (value ? undefined : "Required");
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const files = acceptedFiles.map((file) => (
<li key={file.path}>
@@ -32,7 +35,7 @@ const RepInterestedPartyPerson = (props) => {
<div className="govuk-grid-column-full">
<div className="govuk-grid-row">
<h2 className="govuk-heading-m ">
Representation - interested
Representation from an Interested Party/Person
</h2>
<div className="govuk-form-group">
@@ -46,262 +49,84 @@ const RepInterestedPartyPerson = (props) => {
name="representationType"
component={RenderPickList}
datafieldname="representationType"
validate={[required]}
optionsArr={interestedPersonRepresentationArr}
errorMsg={t("newappeal:select-an-option-label")}
/>
</div>
</div>
<div className="govuk-grid-row">
<div className="govuk-form-group">
<Field
className="govuk-input govuk-!-width-three-quarters"
id="representationDescription"
name="representationDescription"
value="email"
data-aria-controls="representationDescription"
type="text"
component={RenderTextfield}
label="Description of representation"
name="representationOnBehalfOf"
datafieldname="representationOnBehalfOf"
// label="In what capacity do you wish to make representations on this case?"
options={["Yes", "No"]}
id="representationOnBehalfOf"
className="govuk-radios__input"
errorMsg={t("newappeal:select-an-option-label")}
component={RenderCondtionalRadioList}
validate={[required]}
legend={
"Are you acting on behalf of a company, group or organisation?"
}
/>
</div>
<div className="govuk-grid-row">
<div className="govuk-form-group">
<fieldset
className="govuk-fieldset"
aria-describedby="contact-hint"
>
<legend className="govuk-fieldset__legend govuk-fieldset__legend--l">
<label
className="govuk-fieldset__heading govuk-body-m"
id="representationCapacity_label"
>
Are you acting on behalf of a company,
group or organisation?
</label>
</legend>
<div id="contact-hint" className="govuk-hint">
e.g. &lsquo;Owners of Numbers 1-5 High
Street&lsquo;, or &lsquo;Mr and Mrs
Smith&lsquo; or &lsquo;The executors of Mr
Evans&lsquo; estate&lsquo;
</div>
<div
className="govuk-radios govuk-radios--conditional"
data-module="govuk-radios"
>
<div className="govuk-radios__item">
<input
className="govuk-radios__input"
id="contact"
name="contact"
type="radio"
value="email"
data-aria-controls="conditional-contact"
/>
<label
className="govuk-label govuk-radios__label"
htmlFor="contact"
>
Yes
</label>
</div>
<div
className="govuk-radios__conditional govuk-radios__conditional--hidden"
id="conditional-contact"
>
<div className="govuk-form-group">
<label
className="govuk-label"
htmlFor="contact-by-email"
>
Enter the name of the
company/group/organisation *
</label>
<input
className="govuk-input govuk-!-width-one-third"
id="contact-by-email"
name="contact-by-email"
type="email"
spellCheck="false"
autoComplete="email"
/>
</div>
</div>
<div className="govuk-radios__item">
<input
className="govuk-radios__input"
id="contact-2"
name="contact"
type="radio"
value="phone"
data-aria-controls="conditional-contact-2"
/>
<label
className="govuk-label govuk-radios__label"
htmlFor="contact-2"
>
No
</label>
</div>
</div>
</fieldset>
</div>
</div>
<div className="govuk-grid-row">
<div className="govuk-form-group">
<p className="govuk-body">
You can enter your comments in the space
provided or attach a separate document.
</p>
<fieldset
className="govuk-fieldset"
aria-describedby="commentBox-hint"
>
<div
id="commentBox-hint"
className="govuk-hint"
>
My comments are set out in:*
</div>
<div
className="govuk-checkboxes"
data-module="govuk-checkboxes"
>
<div className="govuk-checkboxes__item">
<Field
className="govuk-checkboxes__input"
id="commentBox"
name="commentBox"
value="email"
data-aria-controls="commentBox"
type="checkbox"
component={RenderTextfield}
/>
<label
className="govuk-label govuk-checkboxes__label"
htmlFor="commentBox"
>
the box below{" "}
</label>
</div>
<div
className={
_.isEmpty(
formObj["representationForm"]
)
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden rr"
: _.isEmpty(
formObj[
"representationForm"
].values
)
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden q11 "
: _.isEmpty(
formObj[
"representationForm"
].values.commentBox
)
? formObj["representationForm"]
.values.commentBox ==
false
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden www"
: "govuk-checkboxes__conditional"
: "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden wwwaqqqq"
}
id="conditional-commentBox"
>
<div className="govuk-form-group">
<Field
name="representationComments"
id="representationComments"
component={RenderMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={
props.name + "-hint"
}
/>
</div>
</div>
<div className="govuk-checkboxes__item">
<Field
className="govuk-checkboxes__input"
id="documentBox"
name="documentBox"
value="email"
data-aria-controls="documentBox"
type="checkbox"
component={RenderTextfield}
/>
<label
className="govuk-label govuk-checkboxes__label"
htmlFor="documentBox"
>
separate documents
</label>
</div>
<div
className={
_.isEmpty(
formObj["representationForm"]
)
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden rr"
: _.isEmpty(
formObj[
"representationForm"
].values
)
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden www"
: _.isEmpty(
formObj[
"representationForm"
].values.documentBox
)
? formObj["representationForm"]
.values.documentBox ==
false
? "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden www"
: "govuk-checkboxes__conditional"
: "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden"
}
id="conditional-documentBox"
>
<div className="govuk-form-group">
<section className="container">
<div
{...getRootProps({
className: "dropzone",
})}
>
<input
{...getInputProps()}
/>
<p>
Drag and drop files here
or click to select files
</p>
</div>
<aside>
<h4>Files</h4>
<ul>{files}</ul>
</aside>
</section>
</div>
</div>
</div>
</fieldset>
</div>{" "}
</div>
<div className="govuk-grid-row">
<div className="govuk-button-group">
<button
type="submit"
className="govuk-button"
data-module="govuk-button"
>
Continue
</button>
{/* <Link href="/representation">
</div>
<div className="govuk-grid-row">
<div className="govuk-form-group">
<p className="govuk-body">
You can enter your comments in the space provided or
attach a separate document.
</p>
<fieldset
className="govuk-fieldset"
aria-describedby="commentBox-hint"
>
<div id="commentBox-hint" className="govuk-hint">
My comments are set out in:
</div>
<div className="govuk-form-group">
<Field
name="representationComments"
id="representationComments"
component={RenderMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
</div>
<div className="govuk-form-group govuk-!-margin-bottom-9">
<FileUploadField
name={"representationDocuments"}
label={"Add your files"}
ticketnumber={props.props.caseReference}
hint={"sdsd"}
fileList={[]}
setFilesForRepresentation={[]}
containerID={
props.props.props.accountDetails
.containerID
}
/>
</div>
</fieldset>
</div>{" "}
</div>
<div className="govuk-grid-row">
<div className="govuk-button-group">
{/* <button
type="submit"
className="govuk-button"
data-module="govuk-button"
>
Continue
</button> */}
{/* <Link href="/representation">
<a
onClick={() => {
setRepresentationSubmit(true);
@@ -311,15 +136,15 @@ const RepInterestedPartyPerson = (props) => {
Continue
</a>
</Link> */}
<a
onClick={() => {
setRepresentationCapacity();
}}
className="govuk-link"
>
Back
</a>
</div>
<a
onClick={() => {
setRepresentationCapacity();
//setRepresentationSubmit(true);
}}
className="govuk-link"
>
Back
</a>
</div>
</div>
</div>
@@ -37,7 +37,7 @@ const RepLandOwner = (props) => {
<div className="govuk-grid-column-full">
<div className="govuk-grid-row">
<h2 className="govuk-heading-m ">
Representation - landowner
Representation for a Land owner
</h2>
<div className="govuk-form-group">
@@ -55,7 +55,7 @@ const RepLandOwner = (props) => {
/>
</div>
</div>
<div className="govuk-grid-row">
{/* <div className="govuk-grid-row">
<div className="govuk-form-group">
<Field
className="govuk-input govuk-!-width-three-quarters"
@@ -68,7 +68,7 @@ const RepLandOwner = (props) => {
label="Description of representation"
/>
</div>
</div>
</div> */}
<div className="govuk-grid-row">
<div className="govuk-form-group">
<p className="govuk-body">
+93 -1
View File
@@ -113,6 +113,16 @@ const CaseSummary = (props) => {
let showDetails = typeof detailsObj != "undefined" ? true : false;
var timestamp = Date.parse(
detailsObj.pinswg_representation_period_end_date
);
if (isNaN(timestamp) == false) {
var d = new Date(timestamp);
}
let hasEndDate = typeof d != "undefined";
let showDetailsBlock =
showDetails == true ? (
<div>
@@ -139,7 +149,6 @@ const CaseSummary = (props) => {
] || "not entered"}
</dd>
</div>
{detailsObj.pinswg_agentcontactname != null &&
(_.has(
detailsObj,
@@ -279,6 +288,71 @@ const CaseSummary = (props) => {
</dl>
</div>
</div>
{props.currentView.showReps == "true" &&
_.has(detailsObj, "pinswg_startdate") &&
hasEndDate &&
showReps(
detailsObj.pinswg_startdate,
detailsObj.pinswg_representation_period_end_date
) && (
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<div className="govuk-button-group">
<Link
href={{
pathname:
"/myportal/representation",
query: {
case:
currentType ==
"searchResultsObj"
? detailsObj.pinswg_name
: casesObj.reference,
},
}}
>
<a className="govuk-button">
{t(
"case:summary-make-representation-label"
)}
</a>
</Link>
<a
onClick={() => {
//spinnerState();
router.back();
}}
className="govuk-button govuk-button--secondary"
>
{t("case:summary-back-button-label")}
</a>
</div>
</div>
</div>
)}
{props.currentView.showReps == "true" &&
_.has(detailsObj, "pinswg_startdate") &&
hasEndDate &&
showRepsEnded(
detailsObj.pinswg_startdate,
detailsObj.pinswg_representation_period_end_date
) && (
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<div className="govuk-button-group">
<div className="govuk-body">
Representation Period ended on{" "}
{formatDates(
detailsObj.pinswg_representation_period_end_date
)}
</div>
</div>
</div>
</div>
)}
{/* 1{" "}
{_.has(detailsObj, "pinswg_startdatetimeiftheevent") &&
detailsObj.pinswg_startdatetimeiftheevent}
@@ -725,6 +799,24 @@ const CaseSummary = (props) => {
);
}
function showReps(startDate, endDate) {
const date = new Date();
date = new Date(date.toDateString());
const start = new Date(startDate);
const end = new Date(endDate);
return date >= start && date <= end ? true : false;
}
function showRepsEnded(startDate, endDate) {
const date = new Date();
date = new Date(date.toDateString());
const start = new Date(startDate);
const end = new Date(endDate);
return date > start && date > end ? true : false;
}
return (
<>
{showDetailsBlock}
+2 -2
View File
@@ -1540,8 +1540,8 @@ const RenderFileUpload = (field) => {
width="50"
/>
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{file.name.slice(file.name.indexOf("_") + 1)} (
({bytesToSize(file.size)})
{/* {file.name.slice(file.name.indexOf("_") + 1)} ( */}{" "}
{file.name}( ({bytesToSize(file.size)})
</span>
</div>
))}
+1 -1
View File
@@ -1,7 +1,7 @@
import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import TopThree from "./topthree";
import TopThree from "./topthree_reps";
import { connect } from "react-redux";
import { setCurrentView } from "../../store/currentView/action";
+237
View File
@@ -0,0 +1,237 @@
import Link from "next/link";
import _ from "lodash";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { setCurrentReference } from "../../store/currentView/action";
import { connect } from "react-redux";
import { parseCookies } from "nookies";
import {
getWatchedCasesProxy,
getPortalModuleDetailsProxy,
deleteWatchedCases,
deleteAwaitingSubmissions,
getAwaitingSubmissionProxy,
} from "../../actions";
import jsonpath from "jsonpath";
import transLookup from "../../data/lookuptranslations.json";
import {
setWatchedCases,
setWatchedCasesDetails,
} from "../../store/watchedCases/action";
import {
setAwaitingSubmission,
setAwaitingSubmissionDetails,
} from "../../store/awaitingSubmission/action";
import { getFormCollectionByID } from "../utils";
const TopThree = (props) => {
let { t } = useTranslation();
const {
showTopThree,
showDetails,
setCurrentReference,
topThreeType,
setWatchedCases,
setWatchedCasesDetails,
setAwaitingSubmission,
setAwaitingSubmissionDetails,
} = props;
const router = useRouter();
const { locale } = router;
let topthreeRow = [];
let showTopThreeArr = showTopThree.value;
const deleteItem = (caseID, topThreeType) => {
let cookies = parseCookies();
//console.log("sssss", caseID, topThreeType);
topThreeType == "watchedCases" &&
deleteWatchedCases(caseID)
.then((data) => data)
.then(() => {
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
setWatchedCases(data),
getDetails(data, "myWatchedCases").then((data) => {
setWatchedCasesDetails(data);
});
});
});
topThreeType == "awaitingSubmission" &&
deleteAwaitingSubmissions(caseID)
.then((data) => {
return data;
})
.then(() => {
getAwaitingSubmissionProxy(cookies.pinsUser).then(
(data) => {
setAwaitingSubmission(data),
getDetails(data, "awaitingSubmission").then(
(data) => {
// console.log(
// "submission get details:",
// data
// );
setAwaitingSubmissionDetails(data);
}
);
}
);
});
};
const getDetails = (resultsObj, detailsType) => {
//console.log(resultsObj);
let detailsArr = [];
resultsObj = resultsObj.value;
const detailsObj = resultsObj.map((searchDetail, index) => {
if (searchDetail.pinswg_appealcasetype == null) {
console.log(
detailsType != "myWatchedCases"
? searchDetail.ticketnumber
: searchDetail[
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
]
);
} else {
detailsArr.push(
getPortalModuleDetailsProxy(
getFormCollectionByID(
searchDetail.pinswg_appealcasetype
).LogicalCollectionName,
detailsType != "myWatchedCases"
? searchDetail.ticketnumber
: searchDetail[
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
]
)
);
}
});
//console.log(detailsArr);
return Promise.all(detailsArr);
};
const getIncidentId = (topThreeType, objArr) => {
switch (topThreeType) {
case "myCases":
return objArr.incidentid;
break;
case "watchedCases":
return objArr._pinswg_watchedcase_value;
break;
case "myRepresentations":
return objArr.ticketnumber;
break;
case "awaitingSubmission":
return objArr.ticketnumber;
break;
default:
// code block
}
};
let topThreeOnlyArr = showTopThreeArr.slice(0, 3);
Object.keys(topThreeOnlyArr).map((key, index) => {
topthreeRow.push(
<div className="cardModuleItem" key={index}>
<div className="cardModuleDetails">
<div className="cardModuleReference">
<b>Representation ID:</b>
<Link href="#">
<a
className="govuk-link--no-underline"
data-id={index}
onClick={() => {
setCurrentReference({
"currentReference":
topThreeType != "watchedCases"
? topThreeType !=
"myRepresentations"
? showTopThreeArr[key]
.ticketnumber
: showTopThreeArr[key][
"_pinswg_case_value@OData.Community.Display.V1.FormattedValue"
]
: showTopThreeArr[key][
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
],
"currentType": topThreeType,
"incidentid": getIncidentId(
topThreeType,
showTopThreeArr[key]
),
"appealType":
showTopThreeArr[key]
.pinswg_appealcasetype,
});
}}
>
{showTopThreeArr[key].pinswg_name}
</a>
</Link>
</div>
<div className="cardModuleReference">
<b>{t("myportal:case-reference")}:</b>{" "}
{
showTopThreeArr[key][
"_pinswg_case_value@OData.Community.Display.V1.FormattedValue"
]
}
</div>
</div>
</div>
);
});
let noRecordsLabel = "";
switch (topThreeType) {
case "watchedCases":
noRecordsLabel = t("myportal:norecords-watched-cases");
break;
case "myRepresentations":
noRecordsLabel = t("myportal:norecords-representations");
break;
case "myCases":
noRecordsLabel = t("myportal:norecords-cases");
break;
case "awaitingSubmission":
noRecordsLabel = t("myportal:norecords-awaiting-submissions");
break;
}
return (
<>
{topthreeRow.length == 0 ? (
<div>{noRecordsLabel}</div>
) : (
topthreeRow
)}
</>
);
};
const mapDispatchToProps = (dispatch) => {
return {
setCurrentReference: (currentReference) => {
dispatch(setCurrentReference(currentReference));
},
setWatchedCases: (watchedCases) => {
dispatch(setWatchedCases(watchedCases));
},
setWatchedCasesDetails: (watchedCasesDetails) => {
dispatch(setWatchedCasesDetails(watchedCasesDetails));
},
setAwaitingSubmission: (awaitingSubmission) => {
dispatch(setAwaitingSubmission(awaitingSubmission));
},
setAwaitingSubmissionDetails: (awaitingSubmissionDetails) => {
dispatch(setAwaitingSubmissionDetails(awaitingSubmissionDetails));
},
};
};
export default connect(null, mapDispatchToProps)(TopThree);
+8 -5
View File
@@ -306,8 +306,6 @@ const SearchResults = (props) => {
item.incidentid,
"appealType":
item.pinswg_appealcasetype,
"showreps":
props.showLoginCheck,
});
}}
>
@@ -536,12 +534,17 @@ const SearchResults = (props) => {
)}
</dd>
)}
{showLoginCheck == "true" && !session && (
{/* {showLoginCheck == "true" && !session && (
<dd>
<span
className="govuk-summary-list__actionLink watchLink"
onClick={() => {
signIn("email");
// signIn("email");
signIn("email", {
callbackUrl:
"/myportal/searchresults?q=" +
searchString,
});
// selectWatchedCase(
// cookies.pinsUser,
// item.incidentid,
@@ -557,7 +560,7 @@ const SearchResults = (props) => {
<span className="eye"></span>
</span>
</dd>
)}
)} */}
</div>
);
})
+1 -1
View File
@@ -10,7 +10,7 @@ module.exports = {
],
"pages": {
"*": ["common", "newappeal", "search"],
"/": ["common", "home"],
"/": ["common", "home", "case"],
"/error": ["common", "home", "myportal"],
"/myportal": ["myportal", "common", "home"],
"/myportal/viewall": ["search", "myportal"],
+7 -2
View File
@@ -2,7 +2,7 @@
"page-title": "Cyfeirnod",
"case-card-title": "Reference: APP/B1415/W/20/3271702",
"summary-reference-label": "Cyfeirnod",
"summary-applicant-label": "Apelydd/Ymgeisydd",
"summary-applicant-label": "Apelydd",
"summary-applicantonly-label": "Ymgeisydd",
"summary-agent-label": "Asiant",
"summary-site-address-label": "Cyfeiriad y Safle",
@@ -78,5 +78,10 @@
"summary-case-website-label": "Gwefan",
"summary-case-recommendation-label": "Argymhelliad",
"summary-no-details-label": "Nid oes unrhyw fanylion ar gael ar hyn o bryd",
"summary-case-relevant-authoritylabel": "Awdurdod perthnasol"
"summary-case-relevant-authoritylabel": "Awdurdod perthnasol",
"representation-representation-type": "Pa fath o gynrychiolaeth ydych chi'n ei wneud?",
"representation-onbehalfof": "A ydych yn gweithredu ar ran cwmni, grŵp neu sefydliad",
"representation-onbehalfof-details": "Enw'r cwmni/grŵp/sefydliad",
"representation-comments": "Sylwadau",
"representation-files": "Ffeiliau perthnasol"
}
+7 -2
View File
@@ -2,7 +2,7 @@
"page-title": "Reference",
"case-card-title": "Reference: APP/B1415/W/20/3271702",
"summary-reference-label": "Reference",
"summary-applicant-label": "Appellant/Applicant",
"summary-applicant-label": "Appellant",
"summary-applicantonly-label": "Applicant",
"summary-agent-label": "Agent",
"summary-site-address-label": "Site Address",
@@ -78,5 +78,10 @@
"summary-case-website-label": "Website",
"summary-case-recommendation-label": "Recommendation",
"summary-no-details-label": "No details currently held",
"summary-case-relevant-authoritylabel": "Relevant authority"
"summary-case-relevant-authoritylabel": "Relevant authority",
"representation-representation-type": "What kind of representation are you making?",
"representation-onbehalfof": "Are you acting on behalf of a company, group or organisation",
"representation-onbehalfof-details": "Name of the company/group/organisation",
"representation-comments": "Comments",
"representation-files": "Relevant files"
}
+1 -1
View File
@@ -35,6 +35,7 @@ function Error({ statusCode }, props) {
{t("common:error-instruction-label")}
</p>
<a
href={session != null ? "#" : "/"}
className="govuk-link"
onClick={() => {
window.localStorage.clear(),
@@ -46,7 +47,6 @@ function Error({ statusCode }, props) {
: Router.push("/");
}}
>
{" "}
Go back home
</a>
</div>
+5
View File
@@ -14,6 +14,8 @@ import {
setSearchDetails,
setSearchResults,
} from "../store/searchOutput/action";
import { setShowReps } from "../store/currentView/action";
import { wrapper } from "../store/store";
const Home = (props) => {
@@ -118,6 +120,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
const searchResultsObj = await getAdvancedSearch(query);
const searchDetailsObj = await getSearchDetails(searchResultsObj);
const showReps = process.env.SHOWREPRESENTATIONS || false;
store.dispatch(setShowReps(showReps));
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(setSearch(Object.entries(query)));
+1 -1
View File
@@ -39,7 +39,7 @@ export default async function ApiProxy(req, res) {
var token = await getToken();
var queryUrl =
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
//"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'Developments of National Significance' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
//console.log(queryUrl);
@@ -34,7 +34,7 @@ export default async function ApiProxy(req, res) {
queryUrl = queryUrl + getSelectQuery(appealTypeName);
//console.log("///////////\nquery: ", queryUrl, "<<<<end query");
console.log("///////////\nquery: ", queryUrl, "<<<<end query");
return axios
.get(
@@ -26,7 +26,7 @@ export default async function ApiProxy(req, res) {
loggedInUserId +
"&$count=true&$orderby=createdon desc";
//console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
return axios
.get(
+11 -4
View File
@@ -3,6 +3,7 @@ import {
getContainers,
getBlobs,
createBlob,
createRepBlob,
uploadFile,
} from "../../../actions/azurestorage";
@@ -21,6 +22,7 @@ ApiProxy.post(async (req, res) => {
const appealData = req.body.appealData;
const containerID = req.body.containerID[0];
const casefolderID = req.body.casefolderID[0];
const repOrAppeal = req.body.repOrAppeal || false;
console.log("there are files:", Object.keys(req.files).length);
@@ -33,10 +35,15 @@ ApiProxy.post(async (req, res) => {
//createContainer(containerID).then((containerName) => {
console.log("does this get folder name:", containerID, casefolderID);
createBlob(appealData, containerID, casefolderID).then((data) => {
Object.keys(req.files).length > 0 &&
uploadFile(req.files, containerID, casefolderID);
});
repOrAppeal
? createRepBlob(appealData, containerID, casefolderID).then((data) => {
Object.keys(req.files).length > 0 &&
uploadFile(req.files, containerID, casefolderID);
})
: createBlob(appealData, containerID, casefolderID).then((data) => {
Object.keys(req.files).length > 0 &&
uploadFile(req.files, containerID, casefolderID);
});
//});
return res.status(200).json({ data: "success" });
+3
View File
@@ -88,6 +88,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
store.dispatch(setAppealType(appealTypeData));
store.dispatch(setLPA(lpaData));
store.dispatch(setLoggedInUserId(loggedInUser));
thisSession != false &&
store.dispatch(setContainerID(thisSession.user.id));
}
);
+35 -17
View File
@@ -6,6 +6,7 @@ import {
getAdvancedSearch,
getPortalModuleDetails,
getWatchedCases,
getPersonalAccount,
} from "../../actions";
import Breadcrumbs from "../../components/breadcrumbs";
import CookieBanner from "../../components/cookieBanner";
@@ -20,6 +21,12 @@ import {
setSearchDetails,
setSearchResults,
} from "../../store/searchOutput/action";
import {
setAccountDetails,
setContainerID,
setLoggedInUserId,
} from "../../store/accountDetails/action";
import { setSearch } from "../../store/search/action";
import { wrapper } from "../../store/store";
import {
@@ -27,6 +34,7 @@ import {
setWatchedCasesDetails,
} from "../../store/watchedCases/action";
import TimeOut from "../../components/timeout";
import { getSession, useSession, signIn, signOut } from "next-auth/react";
const Home = (props) => {
const { footerLinks, pages, watchedCases } = props;
@@ -64,30 +72,39 @@ const Home = (props) => {
};
export const getServerSideProps = wrapper.getServerSideProps(
(store) =>
async ({ query, req, res }) => {
console.log("query-", query);
//console.log("search array:", Object.entries(query));
const { cookies } = req;
(store) => async (ctx) => {
const { query, req, res } = ctx;
console.log("query-", query);
//console.log("search array:", Object.entries(query));
const { cookies } = req;
let loggedInUser = cookies.pinsUser;
let loggedInUser = cookies.pinsUser;
let thisSession = await getSession(ctx);
const [searchResultsObj, watchedCases] = await Promise.all([
thisSession != false &&
store.dispatch(setContainerID(thisSession.user.id));
const [accountDetails, searchResultsObj, watchedCases] =
await Promise.all([
await getPersonalAccount(loggedInUser),
await getAdvancedSearch(query),
await getWatchedCases(loggedInUser),
]);
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
await getSearchDetails(searchResultsObj),
await getDetails(watchedCases, "myWatchedCases"),
]);
console.log(accountDetails);
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(setWatchedCases(watchedCases));
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
store.dispatch(setSearch(Object.entries(query)));
}
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
await getSearchDetails(searchResultsObj),
await getDetails(watchedCases, "myWatchedCases"),
]);
store.dispatch(setAccountDetails(accountDetails));
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(setWatchedCases(watchedCases));
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
store.dispatch(setSearch(Object.entries(query)));
}
);
const getDetails = (resultsObj, detailsType) => {
@@ -123,6 +140,7 @@ const getDetails = (resultsObj, detailsType) => {
const mapStateToProps = (state) => {
return {
accountDetails: state.accountDetails,
currentView: state.currentView,
search: state.search,
searchResultsObj: state.searchResultsObj,
+7 -1
View File
@@ -14,6 +14,7 @@ import {
getWatchedCases,
consoleLogger,
getCase,
getPortalLogin,
} from "../../actions";
import { createContainer } from "../../actions/azurestorage";
import Breadcrumbs from "../../components/breadcrumbs";
@@ -158,10 +159,15 @@ export const getServerSideProps = wrapper.getServerSideProps(
const { cookies } = req;
let loggedInUser = cookies.pinsUser;
let loggedInUserCookie = cookies.pinsUser;
let thisSession = await getSession(ctx);
let [loggedInUser] = await Promise.all([
await getPortalLogin(thisSession.user.email),
]);
loggedInUser = loggedInUser.value[0].contactid;
console.log("nextAuth Session:", thisSession);
if (_.has(thisSession, "user") == false) {
+3
View File
@@ -99,6 +99,9 @@ const Home = (props) => {
searchResultsObj={
props.searchResultsObj.searchResultsObj
}
searchDetailsObj={
props.searchResultsObj.searchDetailsObj
}
myRepresentations={
props.myRepresentations.myRepresentations
}
+14 -3
View File
@@ -7,6 +7,8 @@ import {
getBasicSearch,
getPortalModuleDetails,
getWatchedCases,
consoleLogger,
getPortalLogin,
} from "../../actions";
import Breadcrumbs from "../../components/breadcrumbs";
import CookieBanner from "../../components/cookieBanner";
@@ -76,13 +78,13 @@ export const getServerSideProps = wrapper.getServerSideProps(
const { cookies } = req;
let loggedInUser = cookies.pinsUser;
let loggedInUserCookie = cookies.pinsUser;
let thisSession = await getSession(ctx);
let [searchResultsObj, watchedCases] = await Promise.all([
let [searchResultsObj, loggedInUser] = await Promise.all([
await getBasicSearch(query.q),
await getWatchedCases(loggedInUser),
await getPortalLogin(thisSession.user.email),
]);
searchResultsObj =
@@ -96,6 +98,12 @@ export const getServerSideProps = wrapper.getServerSideProps(
//console.log("sssss", searchResultsObj);
loggedInUser = loggedInUser.value[0].contactid;
const watchedCases = await getWatchedCases(loggedInUser);
//console.log("sssss", loggedInUser);
const [accountDetails, searchDetailsObj, watchedCasesDetails] =
await Promise.all([
await getPersonalAccount(loggedInUser),
@@ -109,6 +117,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
store.dispatch(setWatchedCases(watchedCases));
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
store.dispatch(setLoggedInUserId(loggedInUser));
thisSession != false &&
store.dispatch(setContainerID(thisSession.user.id));
}
);
+6 -3
View File
@@ -14,6 +14,7 @@ import {
setSearchDetails,
setSearchResults,
} from "../store/searchOutput/action";
import { setShowReps } from "../store/currentView/action";
import { wrapper } from "../store/store";
import _ from "lodash";
@@ -116,9 +117,9 @@ const Home = (props) => {
};
export const getServerSideProps = wrapper.getServerSideProps(
(store) =>
async ({ query, req, res }) => {
console.log("query-", query);
(store) => async (ctx) => {
const { query, req, res } = ctx;
console.log("query-", query);
let isLinked =
typeof query.lk != "undefined" && query.lk == "1"
@@ -127,6 +128,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
//console.log("is linked:", isLinked);
const showLoginCheck = process.env.SHOWLOGIN || false;
const showReps = process.env.SHOWREPRESENTATIONS || false;
store.dispatch(setShowReps(showReps));
let searchResultsObj = await getBasicSearch(query.q);
+8
View File
@@ -7,6 +7,7 @@ export const currentViewActionTypes = {
SETREPRESENTATIONSUBMITCONFIRMATION: "SETREPRESENTATIONSUBMITCONFIRMATION",
SETCURRENTLINKEDCASES: "SETCURRENTLINKEDCASES",
SETCURRENTPAGE: "SETCURRENTPAGE",
SETSHOWREPS: "SETSHOWREPS",
};
export const getCurrentViewObj = () => (dispatch) => {
@@ -72,3 +73,10 @@ export const setCurrentPage = (currentPage) => (dispatch) => {
currentPage: currentPage,
});
};
export const setShowReps = (showReps) => (dispatch) => {
return dispatch({
type: currentViewActionTypes.SETSHOWREPS,
showReps: showReps,
});
};
+5
View File
@@ -49,6 +49,11 @@ export default function reducer(state = currentViewInitialState, action) {
...state,
currentPage: action.currentPage,
};
case currentViewActionTypes.SETSHOWREPS:
return {
...state,
showReps: action.showReps,
};
default:
return state;
}