Merged PR 1329: fix for new appeal and reps updates

fix for new appeal and reps updates

Related work items: #12884, #12885, #12887, #12930
This commit is contained in:
Robert Bond
2024-12-04 20:02:14 +00:00
15 changed files with 951 additions and 854 deletions
+1 -40
View File
@@ -1,8 +1,8 @@
import { DefaultAzureCredential } from "@azure/identity";
import _ from "lodash";
import { hashAPIPath, consoleLogger } from ".";
import { getDocumentTypeFromFilename } from "../components/utils";
import { da } from "date-fns/locale";
const {
ContainerClient,
BlockBlobClient,
@@ -178,45 +178,6 @@ export const getContainers = async () => {
}
};
const getDocumentTypeFromFilename = (filename) => {
var doctypeCode = "000000";
if (filename.indexOf("_-_Statement_of_Case") > 0) doctypeCode = "000000";
else if (filename.indexOf("_-_Application_Form") > 0)
doctypeCode = "000001";
else if (filename.indexOf("_-_Site_Ownership_Certificate") > 0)
doctypeCode = "000002";
else if (filename.indexOf("_-_Decision_Notice") > 0) doctypeCode = "000003";
else if (filename.indexOf("_-_Site_Location_Plan") > 0)
doctypeCode = "000004";
else if (filename.indexOf("_-_Plans_Drawing_Documents") > 0)
doctypeCode = "000005";
else if (filename.indexOf("_-_Additional_Plans_Drawings_Documents") > 0)
doctypeCode = "000006";
else if (filename.indexOf("_-_Design_and_Access_Statement") > 0)
doctypeCode = "000007";
else if (filename.indexOf("_-_NSB_LPA_Additional_Documents") > 0)
doctypeCode = "000008";
else if (filename.indexOf("_-_LPA_Correspondence") > 0)
doctypeCode = "000009";
else if (filename.indexOf("_-_LPA_Original_Permission") > 0)
doctypeCode = "000010";
else if (filename.indexOf("_-_LPA's_Registration_Letter") > 0)
doctypeCode = "000011";
else if (filename.indexOf(+"_-_Environmental_Statement") > 0)
doctypeCode = "000012";
else if (filename.indexOf("_-_Cost_of_Application") > 0)
doctypeCode = "000013";
else if (filename.indexOf("_-_Other_Relevant_Material") > 0)
doctypeCode = "000014";
else if (
filename.indexOf("_-_S106_Agreement_or_Unilateral_Undertaking") > 0
)
doctypeCode = "000015";
return doctypeCode;
};
export const getBlobs = async (containerName, casefolderID) => {
const containerToken = await createContainerSas(containerName);
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
+2 -8
View File
@@ -1847,18 +1847,12 @@ export const createContainerProxy = (containerName) => {
});
};
export const sendCaseCompleteMessage = async (
containerID,
caseReference,
typeofinvolvement
) => {
export const sendCaseCompleteMessage = async (containerID, caseReference) => {
var queryUrl =
"/api/file/createappealcompletemessage_api?container=" +
containerID +
"&tempcaseref=" +
caseReference +
"&inv=" +
typeofinvolvement;
caseReference;
var config = {
method: "get",
+8 -2
View File
@@ -91,6 +91,7 @@ let MakeRepresentation = (props) => {
};
let questionnaireCount = updateQuestionnaireCount();
const setRepFileName = (values) => {
//console.log("---------------\n", values);
if (
@@ -408,8 +409,13 @@ let MakeRepresentation = (props) => {
);
} else {
switch (
currentView.representationCapacity ||
currentView.caseReference.repDetails.representationCapacity
(
currentView.representationCapacity ||
(currentView.caseReference.hasOwnProperty("repDetails") &&
currentView.caseReference.repDetails
.representationCapacity) ||
"false"
).toLowerCase()
) {
case false:
<RepCapacitySelection
@@ -32,210 +32,227 @@ const RepAgent = (props) => {
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
setRepFileName(formObj.representationForm.values);
if (JSON.stringify(formObj) != "{}") {
setRepFileName(formObj.representationForm.values);
let filterFilesList = props.currentView.caseReference.hasOwnProperty(
"repDetails"
)
? props.currentView.caseReference.repDetails.hasOwnProperty("filesList")
? props.currentView.caseReference.repDetails.filesList.filter(
function (el) {
return el != null;
}
let filterFilesList = props.currentView.caseReference.hasOwnProperty(
"repDetails"
)
? props.currentView.caseReference.repDetails.hasOwnProperty(
"filesList"
)
: []
: [];
? props.currentView.caseReference.repDetails.filesList.filter(
function (el) {
return el != null;
}
)
: []
: [];
const files = acceptedFiles.map((file) => (
<li key={file.path}>
{file.path} - {file.size} bytes
</li>
));
const required = (value) => (value ? undefined : "Required");
const files = acceptedFiles.map((file) => (
<li key={file.path}>
{file.path} - {file.size} bytes
</li>
));
const required = (value) => (value ? undefined : "Required");
return (
<>
<div className="govuk-grid-row">
<div className="govuk-form-group">
{typeof formObj.representationForm.values
.representationType == "undefined" &&
props.representationType != "Select..." ? (
<>
<h2 className="govuk-heading-m ">
{t(
"myrepresentations:representation-from-an-agent-heading"
)}
</h2>
<label
className="govuk-label govuk-body-m"
htmlFor="representationType"
>
{t("myrepresentations:kind-of-rep-label")}
</label>
<Field
name="representationType"
component={RenderPickList}
datafieldname="representationType"
optionsArr={appellantApplicantRepresentationArr}
/>
</>
) : (
<label className="govuk-label govuk-body-m">
{t("myrepresentations:representation-type")}:{" "}
{router.locale == "cy"
? formObj.representationForm.values
.representationType == "Questionnaire"
? "Holiadur"
: formObj.representationForm.values
.representationType == "Statement"
? "Datganiad"
: formObj.representationForm.values
.representationType ==
"Final comments"
? "Sylwadau terfynol"
: formObj.representationForm.values
.representationType
: formObj.representationForm.values
.representationType}
</label>
)}
</div>
</div>
{(typeof props.representationType != "undefined" ||
typeof formObj.representationForm.values.representationType !=
"undefined") && (
<>
<div className="govuk-grid-row">
<div className="govuk-form-group">
<Field
name="representationOnBehalfOf"
datafieldname="representationOnBehalfOf"
// label={t("myrepresentations:capacity-select-what-capacity-label")}
options={["Yes", "No"]}
id="representationOnBehalfOf"
className="govuk-radios__input"
errorMsg={t(
"myrepresentations: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">
<p className="govuk-body">
{t("myrepresentations:enter-comment-label")}
</p>
<fieldset
className="govuk-fieldset"
aria-describedby="commentBox-hint"
>
<div
id="commentBox-hint"
className="govuk-hint"
>
return (
<>
<div className="govuk-grid-row">
<div className="govuk-form-group">
{typeof formObj.representationForm.values
.representationType == "undefined" &&
props.representationType != "Select..." ? (
<>
<h2 className="govuk-heading-m ">
{t(
"myrepresentations:comments-set-out-label"
"myrepresentations:representation-from-an-agent-heading"
)}
:
</div>
<div className="govuk-form-group">
<Field
name="representationComments"
id="representationComments"
component={RenderRichMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
<p className="govuk-hint govuk-!-font-size-14 govuk-!-margin-top-5">
{t(
"myrepresentations:publish-policy-label"
)}
<a href="https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html">
https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html
</a>
</p>
</div>
<div className="govuk-form-group govuk-!-margin-bottom-9">
<FileUploadField
name={"representationDocuments"}
id={"representationDocuments"}
label={t(
"myrepresentations:add-files-label"
)}
ticketnumber={props.props.caseReference}
hint={"sdsd"}
fileList={[]}
setFilesForRepresentation={[]}
containerID={
props.props.props.accountDetails
.containerID
}
filenamePrefix={props.formObj}
/>
</div>
{props.currentView.caseReference.hasOwnProperty(
"repDetails"
) ? (
props.currentView.caseReference.repDetails.hasOwnProperty(
"filesList"
) &&
props.currentView.caseReference.repDetails
.filesList.length > 0 ? (
<div className="govuk-form-group govuk-!-margin-bottom-9">
{filterFilesList.map((blob, i) => (
<div
key={blob.name + "_" + i}
className="govuk-!-margin-bottom-5 fileThumb "
>
<img
src={getThumbnailIconByExtension(
blob.name
)}
alt={blob.name}
width="50"
/>
</h2>
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{blob.name} (
{bytesToSize(blob.size)}
)
</span>
</div>
))}
</div>
<label
className="govuk-label govuk-body-m"
htmlFor="representationType"
>
{t("myrepresentations:kind-of-rep-label")}
</label>
<Field
name="representationType"
component={RenderPickList}
datafieldname="representationType"
optionsArr={
appellantApplicantRepresentationArr
}
/>
</>
) : (
<label className="govuk-label govuk-body-m">
{t("myrepresentations:representation-type")}:{" "}
{router.locale == "cy"
? formObj.representationForm.values
.representationType == "Questionnaire"
? "Holiadur"
: formObj.representationForm.values
.representationType == "Statement"
? "Datganiad"
: formObj.representationForm.values
.representationType ==
"Final comments"
? "Sylwadau terfynol"
: formObj.representationForm.values
.representationType
: formObj.representationForm.values
.representationType}
</label>
)}
</div>
</div>
{(typeof props.representationType != "undefined" ||
typeof formObj.representationForm.values
.representationType != "undefined") && (
<>
<div className="govuk-grid-row">
<div className="govuk-form-group">
<Field
name="representationOnBehalfOf"
datafieldname="representationOnBehalfOf"
// label={t("myrepresentations:capacity-select-what-capacity-label")}
options={["Yes", "No"]}
id="representationOnBehalfOf"
className="govuk-radios__input"
errorMsg={t(
"myrepresentations: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">
<p className="govuk-body">
{t("myrepresentations:enter-comment-label")}
</p>
<fieldset
className="govuk-fieldset"
aria-describedby="commentBox-hint"
>
<div
id="commentBox-hint"
className="govuk-hint"
>
{t(
"myrepresentations:comments-set-out-label"
)}
:
</div>
<div className="govuk-form-group">
<Field
name="representationComments"
id="representationComments"
component={RenderRichMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={
props.name + "-hint"
}
/>
<p className="govuk-hint govuk-!-font-size-14 govuk-!-margin-top-5">
{t(
"myrepresentations:publish-policy-label"
)}
<a href="https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html">
https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html
</a>
</p>
</div>
<div className="govuk-form-group govuk-!-margin-bottom-9">
<FileUploadField
name={"representationDocuments"}
id={"representationDocuments"}
label={t(
"myrepresentations:add-files-label"
)}
ticketnumber={
props.props.caseReference
}
hint={"sdsd"}
fileList={[]}
setFilesForRepresentation={[]}
containerID={
props.props.props.accountDetails
.containerID
}
filenamePrefix={props.formObj}
/>
</div>
{props.currentView.caseReference.hasOwnProperty(
"repDetails"
) ? (
props.currentView.caseReference.repDetails.hasOwnProperty(
"filesList"
) &&
props.currentView.caseReference
.repDetails.filesList.length > 0 ? (
<div className="govuk-form-group govuk-!-margin-bottom-9">
{filterFilesList.map(
(blob, i) => (
<div
key={
blob.name +
"_" +
i
}
className="govuk-!-margin-bottom-5 fileThumb "
>
<img
src={getThumbnailIconByExtension(
blob.name
)}
alt={blob.name}
width="50"
/>
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{blob.name} (
{bytesToSize(
blob.size
)}
)
</span>
</div>
)
)}
</div>
) : (
""
)
) : (
""
)
) : (
""
)}
</fieldset>
</div>{" "}
</div>
</>
)}
{typeof formObj.representationForm.values.representationType !=
"undefined" && (
<div className="govuk-grid-row">
<div className="govuk-button-group">
<button
type="submit"
className="govuk-button"
data-module="govuk-button"
>
{t("common:continue-button")}
</button>
{/* {router.query.state != "edit" && (
)}
</fieldset>
</div>{" "}
</div>
</>
)}
{typeof formObj.representationForm.values.representationType !=
"undefined" && (
<div className="govuk-grid-row">
<div className="govuk-button-group">
<button
type="submit"
className="govuk-button"
data-module="govuk-button"
>
{t("common:continue-button")}
</button>
{/* {router.query.state != "edit" && (
<a
onClick={() => {
setRepresentationCapacity();
@@ -250,49 +267,52 @@ const RepAgent = (props) => {
{t("common:back-link")}
</a>
)} */}
{savingStatus ? (
<span className=" progress-save-active">
{router.locale == "cy"
? "Nôl data"
: "Saving data"}
<img
className="data-loading-icon"
src="/assets/images/loading.gif"
alt={
router.locale == "cy"
? "Nôl data"
: "Saving data"
}
/>
</span>
) : (
<button
className="govuk-button progress-save "
onClick={() => {
let valuesObj =
props.props.props.form[props.form]
.values || {};
{savingStatus ? (
<span className=" progress-save-active">
{router.locale == "cy"
? "Nôl data"
: "Saving data"}
<img
className="data-loading-icon"
src="/assets/images/loading.gif"
alt={
router.locale == "cy"
? "Nôl data"
: "Saving data"
}
/>
</span>
) : (
<button
className="govuk-button progress-save "
onClick={() => {
let valuesObj =
props.props.props.form[props.form]
.values || {};
console.log("valuesobj:", valuesObj);
console.log("valuesobj:", valuesObj);
delete valuesObj["_pinswg_appellant_value"];
delete valuesObj[
"_pinswg_appellant_value"
];
console.log("on save:", valuesObj);
updateRepresentation(
valuesObj,
false,
true
);
}}
>
{t("common:save-exit-button")}
</button>
)}
console.log("on save:", valuesObj);
updateRepresentation(
valuesObj,
false,
true
);
}}
>
{t("common:save-exit-button")}
</button>
)}
</div>
</div>
</div>
)}
</>
);
)}
</>
);
}
};
const mapDispatchToProps = (dispatch) => ({
@@ -35,183 +35,202 @@ const RepAppellant = (props) => {
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
setRepFileName(formObj.representationForm.values);
console.log(JSON.stringify(formObj) == "{}" ? "empty" : "value");
let filterFilesList = props.currentView.caseReference.hasOwnProperty(
"repDetails"
)
? props.currentView.caseReference.repDetails.hasOwnProperty("filesList")
? props.currentView.caseReference.repDetails.filesList.filter(
function (el) {
return el != null;
}
if (JSON.stringify(formObj) != "{}") {
setRepFileName(formObj.representationForm.values);
let filterFilesList = props.currentView.caseReference.hasOwnProperty(
"repDetails"
)
? props.currentView.caseReference.repDetails.hasOwnProperty(
"filesList"
)
: []
: [];
? props.currentView.caseReference.repDetails.filesList.filter(
function (el) {
return el != null;
}
)
: []
: [];
return (
<>
<div className="govuk-grid-row">
<div className="govuk-form-group">
{typeof formObj.representationForm.values
.representationType == "undefined" &&
props.representationType != "Select..." ? (
<>
<h2 className="govuk-heading-m ">
{t(
"myrepresentations:representation-from-an-appellant-heading"
)}
</h2>
<label
className="govuk-label govuk-body-m"
htmlFor="representationType"
>
{t("myrepresentations:kind-of-rep-label")}
</label>
<Field
name="representationType"
component={RenderPickList}
datafieldname="representationType"
optionsArr={appellantApplicantRepresentationArr}
/>
</>
) : (
<label className="govuk-label govuk-body-m">
{t("myrepresentations:representation-type")}:{" "}
{router.locale == "cy"
? formObj.representationForm.values
.representationType == "Questionnaire"
? "Holiadur"
: formObj.representationForm.values
.representationType == "Statement"
? "Datganiad"
: formObj.representationForm.values
.representationType ==
"Final comments"
? "Sylwadau terfynol"
: formObj.representationForm.values
.representationType
: formObj.representationForm.values
.representationType}
</label>
)}
</div>
</div>
{(typeof props.representationType != "undefined" ||
typeof formObj.representationForm.values.representationType !=
"undefined") && (
filterFilesList = filterFilesList.filter(
(value, index, self) =>
index === self.findIndex((t) => t.name === value.name)
);
return (
<>
<div className="govuk-grid-row">
<div className="govuk-form-group">
<p className="govuk-body">
{t("myrepresentations:enter-comment-label")}
</p>
<fieldset
className="govuk-fieldset"
aria-describedby="commentBox-hint"
>
<div id="commentBox-hint" className="govuk-hint">
{t("myrepresentations:comments-set-out-label")}:
</div>
<div className="govuk-form-group">
<Field
name="representationComments"
id="representationComments"
component={RenderRichMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
{formObj.representationForm.values.appealType ==
"846040004" ? (
<p className="govuk-hint govuk-!-font-size-14 govuk-!-margin-top-5">
{t(
"myrepresentations:questionnaire-publish-policy-label"
)}{" "}
<a href="https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html">
https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html
</a>
</p>
) : (
<p className="govuk-hint govuk-!-font-size-14 govuk-!-margin-top-5">
{t(
"myrepresentations:publish-policy-label"
)}{" "}
<a href="https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html">
https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html
</a>
</p>
)}
</div>
<div className="govuk-form-group govuk-!-margin-bottom-9">
<FileUploadField
name={"representationDocuments"}
id={"representationDocuments"}
label={t(
"myrepresentations:add-files-label"
{typeof formObj.representationForm.values
.representationType == "undefined" &&
props.representationType != "Select..." ? (
<>
<h2 className="govuk-heading-m ">
{t(
"myrepresentations:representation-from-an-appellant-heading"
)}
ticketnumber={props.props.caseReference}
hint={"sdsd"}
fileList={[]}
setFilesForRepresentation={[]}
containerID={
props.props.props.accountDetails
.containerID
</h2>
<label
className="govuk-label govuk-body-m"
htmlFor="representationType"
>
{t("myrepresentations:kind-of-rep-label")}
</label>
<Field
name="representationType"
component={RenderPickList}
datafieldname="representationType"
optionsArr={
appellantApplicantRepresentationArr
}
filenamePrefix={props.formObj}
/>
</div>
{props.currentView.caseReference.hasOwnProperty(
"repDetails"
) ? (
props.currentView.caseReference.repDetails.hasOwnProperty(
"filesList"
) &&
props.currentView.caseReference.repDetails
.filesList.length > 0 ? (
<div className="govuk-form-group govuk-!-margin-bottom-9">
{filterFilesList.map((blob, i) => (
<div
key={blob.name + "_" + i}
className="govuk-!-margin-bottom-5 fileThumb "
>
<img
src={getThumbnailIconByExtension(
blob.name
)}
alt={blob.name}
width="50"
/>
</>
) : (
<label className="govuk-label govuk-body-m">
{t("myrepresentations:representation-type")}:{" "}
{router.locale == "cy"
? formObj.representationForm.values
.representationType == "Questionnaire"
? "Holiadur"
: formObj.representationForm.values
.representationType == "Statement"
? "Datganiad"
: formObj.representationForm.values
.representationType ==
"Final comments"
? "Sylwadau terfynol"
: formObj.representationForm.values
.representationType
: formObj.representationForm.values
.representationType}
</label>
)}
</div>
</div>
{(typeof props.representationType != "undefined" ||
typeof formObj.representationForm.values
.representationType != "undefined") && (
<div className="govuk-grid-row">
<div className="govuk-form-group">
<p className="govuk-body">
{t("myrepresentations:enter-comment-label")}
</p>
<fieldset
className="govuk-fieldset"
aria-describedby="commentBox-hint"
>
<div
id="commentBox-hint"
className="govuk-hint"
>
{t(
"myrepresentations:comments-set-out-label"
)}
:
</div>
<div className="govuk-form-group">
<Field
name="representationComments"
id="representationComments"
component={RenderRichMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
{formObj.representationForm.values
.appealType == "846040004" ? (
<p className="govuk-hint govuk-!-font-size-14 govuk-!-margin-top-5">
{t(
"myrepresentations:questionnaire-publish-policy-label"
)}{" "}
<a href="https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html">
https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html
</a>
</p>
) : (
<p className="govuk-hint govuk-!-font-size-14 govuk-!-margin-top-5">
{t(
"myrepresentations:publish-policy-label"
)}{" "}
<a href="https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html">
https://gov.wales/planning-and-environment-decisions-wales-publishing-policy-html
</a>
</p>
)}
</div>
<div className="govuk-form-group govuk-!-margin-bottom-9">
<FileUploadField
name={"representationDocuments"}
id={"representationDocuments"}
label={t(
"myrepresentations:add-files-label"
)}
ticketnumber={props.props.caseReference}
hint={"sdsd"}
fileList={[]}
setFilesForRepresentation={[]}
containerID={
props.props.props.accountDetails
.containerID
}
filenamePrefix={props.formObj}
/>
</div>
{props.currentView.caseReference.hasOwnProperty(
"repDetails"
) ? (
props.currentView.caseReference.repDetails.hasOwnProperty(
"filesList"
) &&
props.currentView.caseReference.repDetails
.filesList.length > 0 ? (
<div className="govuk-form-group govuk-!-margin-bottom-9">
{filterFilesList.map((blob, i) => (
<div
key={blob.name + "_" + i}
className="govuk-!-margin-bottom-5 fileThumb "
>
<img
src={getThumbnailIconByExtension(
blob.name
)}
alt={blob.name}
width="50"
/>
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{blob.name} (
{bytesToSize(blob.size)})
</span>
</div>
))}
</div>
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{blob.name} (
{bytesToSize(blob.size)}
)
</span>
</div>
))}
</div>
) : (
""
)
) : (
""
)
) : (
""
)}
</fieldset>
</div>{" "}
</div>
)}
{typeof formObj.representationForm.values.representationType !=
"undefined" && (
<div className="govuk-grid-row">
<div className="govuk-button-group">
<button
type="submit"
className="govuk-button"
data-module="govuk-button"
>
{t("common:continue-button")}
</button>
{/* {router.query.state != "edit" && (
)}
</fieldset>
</div>{" "}
</div>
)}
{typeof formObj.representationForm.values.representationType !=
"undefined" && (
<div className="govuk-grid-row">
<div className="govuk-button-group">
<button
type="submit"
className="govuk-button"
data-module="govuk-button"
>
{t("common:continue-button")}
</button>
{/* {router.query.state != "edit" && (
<a
onClick={() => {
setRepresentationCapacity();
@@ -227,49 +246,52 @@ const RepAppellant = (props) => {
</a>
)} */}
{savingStatus ? (
<span className=" progress-save-active">
{router.locale == "cy"
? "Nôl data"
: "Saving data"}
<img
className="data-loading-icon"
src="/assets/images/loading.gif"
alt={
router.locale == "cy"
? "Nôl data"
: "Saving data"
}
/>
</span>
) : (
<button
className="govuk-button progress-save "
onClick={() => {
let valuesObj =
props.props.props.form[props.form]
.values || {};
{savingStatus ? (
<span className=" progress-save-active">
{router.locale == "cy"
? "Nôl data"
: "Saving data"}
<img
className="data-loading-icon"
src="/assets/images/loading.gif"
alt={
router.locale == "cy"
? "Nôl data"
: "Saving data"
}
/>
</span>
) : (
<button
className="govuk-button progress-save "
onClick={() => {
let valuesObj =
props.props.props.form[props.form]
.values || {};
console.log("valuesobj:", valuesObj);
console.log("valuesobj:", valuesObj);
delete valuesObj["_pinswg_appellant_value"];
delete valuesObj[
"_pinswg_appellant_value"
];
console.log("on save:", valuesObj);
updateRepresentation(
valuesObj,
false,
true
);
}}
>
{t("common:save-exit-button")}
</button>
)}
console.log("on save:", valuesObj);
updateRepresentation(
valuesObj,
false,
true
);
}}
>
{t("common:save-exit-button")}
</button>
)}
</div>
</div>
</div>
)}
</>
);
)}
</>
);
}
};
//const mapStateToProps = (state, props) => {};
@@ -157,11 +157,11 @@ const RepCompleteSubmit = (props) => {
formObj.representationForm.values.filesList
);
buildAppealFilesArray = formObj.representationForm.values.hasOwnProperty(
"filesList"
)
? formObj.representationForm.values.filesList
: [];
// buildAppealFilesArray = formObj.representationForm.values.hasOwnProperty(
// "filesList"
// )
// ? formObj.representationForm.values.filesList
// : [];
console.log(buildAppealFilesArray);
@@ -33,205 +33,222 @@ const RepInterestedPartyPerson = (props) => {
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
setRepFileName(formObj.representationForm.values);
if (JSON.stringify(formObj) != "{}") {
setRepFileName(formObj.representationForm.values);
let filterFilesList = props.currentView.caseReference.hasOwnProperty(
"repDetails"
)
? props.currentView.caseReference.repDetails.hasOwnProperty("filesList")
? props.currentView.caseReference.repDetails.filesList.filter(
function (el) {
return el != null;
}
let filterFilesList = props.currentView.caseReference.hasOwnProperty(
"repDetails"
)
? props.currentView.caseReference.repDetails.hasOwnProperty(
"filesList"
)
: []
: [];
? props.currentView.caseReference.repDetails.filesList.filter(
function (el) {
return el != null;
}
)
: []
: [];
const files = acceptedFiles.map((file) => (
<li key={file.path}>
{file.path} - {file.size} bytes
</li>
));
return (
<>
<div className="govuk-grid-row">
<div className="govuk-form-group">
{typeof formObj.representationForm.values
.representationType == "undefined" &&
props.representationType != "Select..." ? (
<>
<h2 className="govuk-heading-m ">
{t(
"myrepresentations:representation-from-an-interested-person-heading"
)}
</h2>
<label
className="govuk-label govuk-body-m"
htmlFor="representationType"
>
{t("myrepresentations:kind-of-rep-label")}
</label>
<Field
name="representationType"
component={RenderPickList}
datafieldname="representationType"
validate={[required]}
optionsArr={interestedPersonRepresentationArr}
errorMsg={t(
"myrepresentations:select-an-option-label"
)}
/>
</>
) : (
<label className="govuk-label govuk-body-m">
{t("myrepresentations:representation-type")}:{" "}
{router.locale == "cy"
? formObj.representationForm.values
.representationType == "Questionnaire"
? "Holiadur"
: formObj.representationForm.values
.representationType == "Statement"
? "Datganiad"
: formObj.representationForm.values
.representationType ==
"Final comments"
? "Sylwadau terfynol"
: formObj.representationForm.values
.representationType
: formObj.representationForm.values
.representationType}
</label>
)}
</div>
</div>
{(typeof props.representationType != "undefined" ||
typeof formObj.representationForm.values.representationType !=
"undefined") && (
<>
<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(
"myrepresentations: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">
<p className="govuk-body">
{t("myrepresentations:enter-comment-label")}
</p>
<fieldset
className="govuk-fieldset"
aria-describedby="commentBox-hint"
>
<div
id="commentBox-hint"
className="govuk-hint"
>
const files = acceptedFiles.map((file) => (
<li key={file.path}>
{file.path} - {file.size} bytes
</li>
));
return (
<>
<div className="govuk-grid-row">
<div className="govuk-form-group">
{typeof formObj.representationForm.values
.representationType == "undefined" &&
props.representationType != "Select..." ? (
<>
<h2 className="govuk-heading-m ">
{t(
"myrepresentations:comments-set-out-label"
"myrepresentations:representation-from-an-interested-person-heading"
)}
:
</div>
<div className="govuk-form-group">
<Field
name="representationComments"
id="representationComments"
component={RenderRichMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={props.name + "-hint"}
/>
</div>
</h2>
<div className="govuk-form-group govuk-!-margin-bottom-9">
<FileUploadField
name={"representationDocuments"}
id={"representationDocuments"}
label={t(
"myrepresentations:add-files-label"
<label
className="govuk-label govuk-body-m"
htmlFor="representationType"
>
{t("myrepresentations:kind-of-rep-label")}
</label>
<Field
name="representationType"
component={RenderPickList}
datafieldname="representationType"
validate={[required]}
optionsArr={
interestedPersonRepresentationArr
}
errorMsg={t(
"myrepresentations:select-an-option-label"
)}
/>
</>
) : (
<label className="govuk-label govuk-body-m">
{t("myrepresentations:representation-type")}:{" "}
{router.locale == "cy"
? formObj.representationForm.values
.representationType == "Questionnaire"
? "Holiadur"
: formObj.representationForm.values
.representationType == "Statement"
? "Datganiad"
: formObj.representationForm.values
.representationType ==
"Final comments"
? "Sylwadau terfynol"
: formObj.representationForm.values
.representationType
: formObj.representationForm.values
.representationType}
</label>
)}
</div>
</div>
{(typeof props.representationType != "undefined" ||
typeof formObj.representationForm.values
.representationType != "undefined") && (
<>
<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(
"myrepresentations: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">
<p className="govuk-body">
{t("myrepresentations:enter-comment-label")}
</p>
<fieldset
className="govuk-fieldset"
aria-describedby="commentBox-hint"
>
<div
id="commentBox-hint"
className="govuk-hint"
>
{t(
"myrepresentations:comments-set-out-label"
)}
ticketnumber={props.props.caseReference}
hint={"sdsd"}
fileList={[]}
setFilesForRepresentation={[]}
containerID={
props.props.props.accountDetails
.containerID
}
filenamePrefix={props.formObj}
/>
</div>
{props.currentView.caseReference.hasOwnProperty(
"repDetails"
) ? (
props.currentView.caseReference.repDetails.hasOwnProperty(
"filesList"
) &&
props.currentView.caseReference.repDetails
.filesList.length > 0 ? (
<div className="govuk-form-group govuk-!-margin-bottom-9">
{filterFilesList.map((blob, i) => (
<div
key={blob.name + "_" + i}
className="govuk-!-margin-bottom-5 fileThumb "
>
<img
src={getThumbnailIconByExtension(
blob.name
)}
alt={blob.name}
width="50"
/>
:
</div>
<div className="govuk-form-group">
<Field
name="representationComments"
id="representationComments"
component={RenderRichMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={
props.name + "-hint"
}
/>
</div>
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{blob.name} (
{bytesToSize(blob.size)}
)
</span>
</div>
))}
</div>
<div className="govuk-form-group govuk-!-margin-bottom-9">
<FileUploadField
name={"representationDocuments"}
id={"representationDocuments"}
label={t(
"myrepresentations:add-files-label"
)}
ticketnumber={
props.props.caseReference
}
hint={"sdsd"}
fileList={[]}
setFilesForRepresentation={[]}
containerID={
props.props.props.accountDetails
.containerID
}
filenamePrefix={props.formObj}
/>
</div>
{props.currentView.caseReference.hasOwnProperty(
"repDetails"
) ? (
props.currentView.caseReference.repDetails.hasOwnProperty(
"filesList"
) &&
props.currentView.caseReference
.repDetails.filesList.length > 0 ? (
<div className="govuk-form-group govuk-!-margin-bottom-9">
{filterFilesList.map(
(blob, i) => (
<div
key={
blob.name +
"_" +
i
}
className="govuk-!-margin-bottom-5 fileThumb "
>
<img
src={getThumbnailIconByExtension(
blob.name
)}
alt={blob.name}
width="50"
/>
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{blob.name} (
{bytesToSize(
blob.size
)}
)
</span>
</div>
)
)}
</div>
) : (
""
)
) : (
""
)
) : (
""
)}
</fieldset>
</div>{" "}
</div>
</>
)}
{typeof formObj.representationForm.values.representationType !=
"undefined" && (
<div className="govuk-grid-row">
<div className="govuk-button-group">
<button
type="submit"
className="govuk-button"
data-module="govuk-button"
>
{t("common:continue-button")}
</button>
{/*
)}
</fieldset>
</div>{" "}
</div>
</>
)}
{typeof formObj.representationForm.values.representationType !=
"undefined" && (
<div className="govuk-grid-row">
<div className="govuk-button-group">
<button
type="submit"
className="govuk-button"
data-module="govuk-button"
>
{t("common:continue-button")}
</button>
{/*
<a
onClick={() => {
setRepresentationCapacity();
@@ -250,49 +267,52 @@ const RepInterestedPartyPerson = (props) => {
>
{t("case:summary-back-button-label")}
</a> */}
{savingStatus ? (
<span className=" progress-save-active">
{router.locale == "cy"
? "Nôl data"
: "Saving data"}
<img
className="data-loading-icon"
src="/assets/images/loading.gif"
alt={
router.locale == "cy"
? "Nôl data"
: "Saving data"
}
/>
</span>
) : (
<button
className="govuk-button progress-save "
onClick={() => {
let valuesObj =
props.props.props.form[props.form]
.values || {};
{savingStatus ? (
<span className=" progress-save-active">
{router.locale == "cy"
? "Nôl data"
: "Saving data"}
<img
className="data-loading-icon"
src="/assets/images/loading.gif"
alt={
router.locale == "cy"
? "Nôl data"
: "Saving data"
}
/>
</span>
) : (
<button
className="govuk-button progress-save "
onClick={() => {
let valuesObj =
props.props.props.form[props.form]
.values || {};
console.log("valuesobj:", valuesObj);
console.log("valuesobj:", valuesObj);
delete valuesObj["_pinswg_appellant_value"];
delete valuesObj[
"_pinswg_appellant_value"
];
console.log("on save:", valuesObj);
updateRepresentation(
valuesObj,
false,
true
);
}}
>
{t("common:save-exit-button")}
</button>
)}
console.log("on save:", valuesObj);
updateRepresentation(
valuesObj,
false,
true
);
}}
>
{t("common:save-exit-button")}
</button>
)}
</div>
</div>
</div>
)}
</>
);
)}
</>
);
}
};
//const mapStateToProps = (state, props) => {};
+14 -7
View File
@@ -1675,9 +1675,11 @@ export const FieldsTranslations = (label) => {
let labelTrans =
router.locale == "cy"
? jsonpath('$..[?(@.value=="' + label + '")].value_cy', formObj)
? jsonpath('$..[?(@.value=="' + label + '")].value_cy', formObj)[0]
: label;
//labelTrans = labelTrans.length > 1 ? labelTrans[0] : labelTrans;
return labelTrans;
};
@@ -1749,7 +1751,7 @@ const rejectStyle = {
};
const RenderFileUpload = (field) => {
const files = field.input.value;
let files = field.input.value;
let { t } = useTranslation();
const style = useMemo(
@@ -1912,6 +1914,10 @@ const RenderFileUpload = (field) => {
field.input.onChange(newFilesArr);
};
function removeEmptyObjects(arr) {
return arr.filter((obj) => Object.keys(obj).length > 0);
}
return (
<>
<Dropzone
@@ -1971,10 +1977,11 @@ const RenderFileUpload = (field) => {
{field.meta.touched && field.meta.error && (
<span className="error">{field.meta.error}</span>
)}
{}
{files && Array.isArray(files) && (
<>
{files.length > 0 && <h4>New files</h4>}
{/* {(files = removeEmptyObjects(files))} */}
<br />
{files.map(
(file, i) =>
typeof file.name != "undefined" && (
@@ -2096,7 +2103,7 @@ const RenderSubFields = ({ fields, meta: { touched, error }, ...custom }) => {
{fields.map((member, index) => (
<div key={index}>
<h4>
{subTitle == "owners" ? "Owners" : "Tenant"} #
{subTitle == "owners" ? "Owner" : "Tenant"} #
{index + 1}
</h4>
@@ -2109,7 +2116,7 @@ const RenderSubFields = ({ fields, meta: { touched, error }, ...custom }) => {
validate={[checkValue]}
label={
subTitle == "owners"
? "Owners name"
? "Owner name"
: "Tenant name"
}
className="govuk-input govuk-input--width-10"
@@ -2145,7 +2152,7 @@ const RenderSubFields = ({ fields, meta: { touched, error }, ...custom }) => {
onClick={() => fields.push({})}
>
{subTitle == "owners"
? "Add Owners"
? "Add Owner"
: t("newappeal:new-appeal-add-tenant-label")}
</button>
)}
+10 -62
View File
@@ -178,22 +178,7 @@ const RenderRadio = ({
...custom
}) => {
let { t } = useTranslation();
const required = (value) => {
// Check for the required field
if (!value) {
errors = "This field is required";
}
// Check for emojis using a regular expression
const emojiRegex =
/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F700}-\u{1F77F}\u{1F780}-\u{1F7FF}\u{1F800}-\u{1F8FF}\u{1F900}-\u{1F9FF}\u{1FA00}-\u{1FA6F}\u{1FA70}-\u{1FAFF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{2300}-\u{23FF}\u{2B50}\u{1F004}-\u{1F0CF}\u{1F0A0}-\u{1F0A5}\u{1F170}-\u{1F251}]/gu;
if (emojiRegex.test(value)) {
errors = "Emojis are not allowed";
}
return errors;
};
const required = (value) => (value ? undefined : "Required");
return (
<>
<div
@@ -316,24 +301,7 @@ function Radiofield(props) {
} = props;
const router = useRouter();
const required = (value) => {
let errors = {};
// Check for the required field
if (!value) {
errors = "This field is required";
}
// Check for emojis using a regular expression
const emojiRegex =
/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F700}-\u{1F77F}\u{1F780}-\u{1F7FF}\u{1F800}-\u{1F8FF}\u{1F900}-\u{1F9FF}\u{1FA00}-\u{1FA6F}\u{1FA70}-\u{1FAFF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{2300}-\u{23FF}\u{2B50}\u{1F004}-\u{1F0CF}\u{1F0A0}-\u{1F0A5}\u{1F170}-\u{1F251}]/gu;
if (emojiRegex.test(value)) {
errors = "Emojis are not allowed";
}
return errors;
};
const required = (value) => (value ? undefined : "Required");
//console.log(props.options);
const fieldOptions = props.options
@@ -417,24 +385,7 @@ const RenderCheckBox = ({
...custom
}) => {
let { t } = useTranslation();
const required = (value) => {
let errors = {};
// Check for the required field
if (!value) {
errors = "This field is required";
}
// Check for emojis using a regular expression
const emojiRegex =
/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F700}-\u{1F77F}\u{1F780}-\u{1F7FF}\u{1F800}-\u{1F8FF}\u{1F900}-\u{1F9FF}\u{1FA00}-\u{1FA6F}\u{1FA70}-\u{1FAFF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{2300}-\u{23FF}\u{2B50}\u{1F004}-\u{1F0CF}\u{1F0A0}-\u{1F0A5}\u{1F170}-\u{1F251}]/gu;
if (emojiRegex.test(value)) {
errors = "Emojis are not allowed";
}
return errors;
};
const required = (value) => (value ? undefined : "Required");
return (
<>
@@ -504,13 +455,10 @@ let AboutYou = (props) => {
const contactPref =
router.locale == "cy" ? ["Ebost", "Post"] : ["Email", "Post"];
const required = (value) => {
let errors = {};
const required = (value) => (value ? undefined : "Is required");
// Check for the required field
if (!value) {
errors = "This field is required";
}
const emojicheck = (value) => {
let errors;
// Check for emojis using a regular expression
const emojiRegex =
@@ -592,7 +540,7 @@ let AboutYou = (props) => {
component={RenderTextfield}
type="text"
className="govuk-input govuk-input--width-20"
validate={[required]}
validate={[required, emojicheck]}
label={t("newappeal:about-you-on-behalf-label")}
maxFieldLength="200"
/>
@@ -630,7 +578,7 @@ let AboutYou = (props) => {
component={RenderTextfield}
type="text"
className="govuk-input govuk-input--width-20"
validate={[required]}
validate={[required, emojicheck]}
label={t(
"newappeal:about-you-appellant-contact-details-firstname-label"
)}
@@ -642,7 +590,7 @@ let AboutYou = (props) => {
component={RenderTextfield}
type="text"
className="govuk-input govuk-input--width-20"
validate={[required]}
validate={[required, emojicheck]}
label={t(
"newappeal:about-you-appellant-contact-details-lastname-label"
)}
@@ -654,7 +602,7 @@ let AboutYou = (props) => {
component={RenderMultiline}
type="textarea"
className="govuk-textarea govuk-input--width-20"
validate={[required]}
validate={[required, emojicheck]}
label={t(
"newappeal:about-you-appellant-contact-details-address-label"
)}
+127 -18
View File
@@ -3,7 +3,13 @@ import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router";
import { connect } from "react-redux";
import xpath from "xpath";
import { getPickListLabel, getRadioLabel } from "../../components/utils";
import {
getPickListLabel,
getRadioLabel,
bytesToSize,
getDocumentTypeFromFilename,
getThumbnailIconByExtension,
} from "../../components/utils";
import fieldLookup from "../../data/crmfieldlookuptranslations.json";
import {
@@ -66,6 +72,14 @@ let BuildCheckRow = (props) => {
return labelTrans;
};
function isObjectAndNotEmpty(value) {
return (
value !== null &&
typeof value === "object" &&
Object.keys(value).length > 0
);
}
return (
<>
{Object.keys(rowXML).map((key, index) => {
@@ -86,6 +100,11 @@ let BuildCheckRow = (props) => {
mandatoryFieldsData
);
var documentTypeCode = xpath.select(
"//@ishareDocumentCode",
doc
);
// if (datafieldname[0].value.indexOf("fileUpload") > 0) {
// isRequiredField.push({
// "LogicalName": datafieldname[0].value,
@@ -113,10 +132,6 @@ let BuildCheckRow = (props) => {
datafieldname[0].value
] != "undefined"
) {
// if (typeof isRequiredField[0] != "undefined") {
// if (
// isRequiredField[0].RequiredLevel.Value != "None"
// ) {
return (
<div className="govuk-summary-list__row" key={key}>
<dt className="govuk-summary-list__key">
@@ -174,10 +189,112 @@ let BuildCheckRow = (props) => {
)
) : fieldtype[0].value ==
"{16D63FD6-119B-4353-BDCA-18358721C3FE}" ? (
console.log(
props.props.form["appealForm"]
.values[datafieldname[0].value]
)
<>
{props.filesArray.map((blob, i) => (
<div key={i}>
{getDocumentTypeFromFilename(
blob.name
) ===
documentTypeCode[0]
.value && (
<div
style={{
display: "flex",
alignItems:
"flex-start",
}}
className="govuk-!-margin-bottom-2"
>
<img
style={{
minWidth:
"50",
width: "50",
}}
src={getThumbnailIconByExtension(
blob.name
)}
alt={blob.name}
width="50"
/>
<span
style={{
maxWidth:
"85%",
}}
className="govuk-body govuk-!-font-size-14 govuk-!-margin-left-2"
>
{blob.name} -{" "}
{bytesToSize(
blob.size
)}{" "}
</span>
</div>
)}
</div>
))}
<br />
{props.props.form[
"appealForm"
].values[
datafieldname[0].value
].map(
(blob, i) =>
isObjectAndNotEmpty(
blob
) && (
<div key={i}>
{getDocumentTypeFromFilename(
blob.name
) ===
documentTypeCode[0]
.value && (
<div
style={{
display:
"flex",
alignItems:
"flex-start",
}}
className="govuk-!-margin-bottom-2"
>
<img
style={{
minWidth:
"50",
width: "50",
}}
src={getThumbnailIconByExtension(
blob.name
)}
alt={
blob.name
}
width="50"
/>
<span
style={{
maxWidth:
"85%",
}}
className="govuk-body govuk-!-font-size-14 govuk-!-margin-left-2"
>
{
blob.name
}{" "}
-{" "}
{bytesToSize(
blob.size
)}{" "}
</span>
</div>
)}
</div>
)
)}
</>
) : fieldtype[0].value ==
"{0273EDBD-AC1D-40d3-9FB2-095C621B552D}" ? (
props.props.form["appealForm"].values[
@@ -211,7 +328,7 @@ let BuildCheckRow = (props) => {
</dd>
<dd className="govuk-summary-list__actions">
{rows[0].value != "Case reference" && (
{rows[0].value != "Temporary reference" && (
<a
className="govuk-link"
href="#"
@@ -232,14 +349,6 @@ let BuildCheckRow = (props) => {
</dd>
</div>
);
// } else {
// return null;
// }
// } else {
// return null;
// }
// } else {
// return null;
}
}
})}
+3 -2
View File
@@ -178,11 +178,12 @@ let BuildCheckSection = (props) => {
props={props}
key={key}
mandatoryFieldsData={mandatoryFieldsData}
filesArray={buildAppealFilesArray}
/>
</div>
))}
</dl>
<dl className="govuk-summary-list govuk-!-margin-bottom-9 at-summary-list">
{/* <dl className="govuk-summary-list govuk-!-margin-bottom-9 at-summary-list">
{buildAppealFilesArray.length > 0
? buildAppealFilesArray.map((blob, i) => {
return (
@@ -233,7 +234,7 @@ let BuildCheckSection = (props) => {
);
})
: ""}
</dl>
</dl> */}
</div>
{finaliseAppealProcess ? (
<div className="">
+5 -42
View File
@@ -1,7 +1,11 @@
import { JSONPath as jsonpath } from "jsonpath-plus";
import useTranslation from "next-translate/useTranslation";
import xpath from "xpath";
import { bytesToSize, getPickListLabel } from "../../components/utils";
import {
bytesToSize,
getPickListLabel,
getDocumentTypeFromFilename,
} from "../../components/utils";
import fieldLookup from "../../data/crmfieldlookuptranslations.json";
import { StyleSheet, Text, View } from "@react-pdf/renderer";
@@ -150,47 +154,6 @@ export const AppealRow_pdf = (props) => {
return labelTrans;
};
const getDocumentTypeFromFilename = (filename) => {
var doctypeCode = "000000";
if (filename.indexOf("_-_Statement_of_Case") > 0)
doctypeCode = "000000";
else if (filename.indexOf("_-_Application_Form") > 0)
doctypeCode = "000001";
else if (filename.indexOf("_-_Site_Ownership_Certificate") > 0)
doctypeCode = "000002";
else if (filename.indexOf("_-_Decision_Notice") > 0)
doctypeCode = "000003";
else if (filename.indexOf("_-_Site_Location_Plan") > 0)
doctypeCode = "000004";
else if (filename.indexOf("_-_Plans_Drawing_Documents") > 0)
doctypeCode = "000005";
else if (filename.indexOf("_-_Additional_Plans_Drawings_Documents") > 0)
doctypeCode = "000006";
else if (filename.indexOf("_-_Design_and_Access_Statement") > 0)
doctypeCode = "000007";
else if (filename.indexOf("_-_NSB_LPA_Additional_Documents") > 0)
doctypeCode = "000008";
else if (filename.indexOf("_-_LPA_Correspondence") > 0)
doctypeCode = "000009";
else if (filename.indexOf("_-_LPA_Original_Permission") > 0)
doctypeCode = "000010";
else if (filename.indexOf("_-_LPA's_Registration_Letter") > 0)
doctypeCode = "000010";
else if (filename.indexOf(+"_-_Environmental_Statement") > 0)
doctypeCode = "000012";
else if (filename.indexOf("_-_Cost_of_Application") > 0)
doctypeCode = "000013";
else if (filename.indexOf("_-_Other_Relevant_Material") > 0)
doctypeCode = "000014";
else if (
filename.indexOf("_-_S106_Agreement_or_Unilateral_Undertaking") > 0
)
doctypeCode = "000015";
return doctypeCode;
};
return (
<>
{Object.keys(rowXML).map((key, index) => {
+44
View File
@@ -503,3 +503,47 @@ export const getDetailsProxy = (resultsObj, detailsType) => {
});
return Promise.all(detailsArr);
};
export const getDocumentTypeFromFilename = (filename) => {
var doctypeCode = "000000";
console.log(filename);
if (typeof filename != "undefined") {
if (filename.indexOf("_-_Statement_of_Case") > 0)
doctypeCode = "000000";
else if (filename.indexOf("_-_Application_Form") > 0)
doctypeCode = "000001";
else if (filename.indexOf("_-_Site_Ownership_Certificate") > 0)
doctypeCode = "000002";
else if (filename.indexOf("_-_Decision_Notice") > 0)
doctypeCode = "000003";
else if (filename.indexOf("_-_Site_Location_Plan") > 0)
doctypeCode = "000004";
else if (filename.indexOf("_-_Plans_Drawing_Documents") > 0)
doctypeCode = "000005";
else if (filename.indexOf("_-_Additional_Plans_Drawings_Documents") > 0)
doctypeCode = "000006";
else if (filename.indexOf("_-_Design_and_Access_Statement") > 0)
doctypeCode = "000007";
else if (filename.indexOf("_-_NSB_LPA_Additional_Documents") > 0)
doctypeCode = "000008";
else if (filename.indexOf("_-_LPA_Correspondence") > 0)
doctypeCode = "000009";
else if (filename.indexOf("_-_LPA_Original_Permission") > 0)
doctypeCode = "000010";
else if (filename.indexOf("_-_LPA's_Registration_Letter") > 0)
doctypeCode = "000010";
else if (filename.indexOf(+"_-_Environmental_Statement") > 0)
doctypeCode = "000012";
else if (filename.indexOf("_-_Cost_of_Application") > 0)
doctypeCode = "000013";
else if (filename.indexOf("_-_Other_Relevant_Material") > 0)
doctypeCode = "000014";
else if (
filename.indexOf("_-_S106_Agreement_or_Unilateral_Undertaking") > 0
)
doctypeCode = "000015";
}
return doctypeCode;
};
+1
View File
@@ -16,6 +16,7 @@
"appeal-confirmation-label": "Cadarnhaf fy mod yn gwneud apêl yn erbyn penderfyniad i wrthod caniatâd cynllunio neu fethiant i benderfynu ar gais cynllunio o fewn 8 wythnos.",
"select-to-confirm-label": "Cadarnhewch i barhau",
"is-required-label": "Yn ofynnol",
"emojis-not-allowed-label": "Ni chaniateir emojis",
"invalid-postcode-label": "Cod post annilys",
"hascas-confirmation-label": "Cadarnhewch fod angen apêl HAS/CAS",
"hascas-confirmation-hint": "Mae'r llwybr apelio hwn yn berthnasol dim ond os yw'ch cais yn ymwneud â gwrthod caniatâd cynllunio, neu wrthod cais i amrywio neu ddileu amod sydd ynghlwm wrth ganiatâd blaenorol. Bydd pob cais arall yn cael ei gyflwyno trwy Apêl Gynllunio Adran 78",
+2 -1
View File
@@ -15,6 +15,7 @@
"appeal-confirmation-label": "I confirm that I am making an appeal against a refusal of planning permission or failure to determine a planning application within 8 weeks.",
"select-to-confirm-label": "Confirm to continue",
"is-required-label": "Is required",
"emojis-not-allowed-label": "Emojis are not allowed",
"invalid-postcode-label": "Invalid postcode",
"hascas-confirmation-label": "Confirm HAS/CAS appeal is required",
"hascas-confirmation-hint": "This appeal route is only applicable if your application relates the refusal of planning permission, or the refusal of an application to vary or remove a condition attached to a previous permision. All other applications will be submitted via a Section 78 Planning Appeal",
@@ -80,7 +81,7 @@
"s78-appeals-only-bullet-one": "a refusal of planning permission",
"s78-appeals-only-bullet-two": "failure to determine a planning application within 8 weeks",
"s78-appeals-only-label-a": "All other appeals must be submitted by email or post.",
"new-appeal-inspector-onsite-paragraph": "NOTE: The inspector will visit the site unaccompanied by either party unless the relevant part of the site cannot be seen from a road or other public land, or is it essential for the Inspector to enter the site to check measurements or relevant facts.",
"new-appeal-inspector-onsite-paragraph": "NOTE: The inspector will visit the site unaccompanied by either party unless the relevant part of the site cannot be seen from a road or other public land, or it is essential for the Inspector to enter the site to check measurements or relevant facts.",
"new-appeal-submission-of-case-hint": "This is your only opportunity to make your case in connection with the reason for the appeal. Therefore please provide your FULL statement of case. To do this, you need to go through the reasons for the decision (if provided), and explain why you disagree. Only the reasons within the LPA's decision and the reasons put forward by you at application stage should be included in your Statement of Case. You should not introduce any new reasons for the appeal. Please refer to our Procedural Guide for further information.",
"new-appeal-what-procedure-hint": "Appeals dealt with under Part 4 of The Town and Country Planning (Referred Applications and Appeals Procedure) (Wales) Regulations 2017 can be considered on the basis of written representation, a hearing, an inquiry or combined proceedings. In accordance with the Town and Country Planning (Determination of Procedure) (Wales) Order 2017, the Planning and Environment Decisions Wales will make a determination as to the most appropriate procedure and will review it throughout the process.",
"new-appeal-cost-application-hint": "You must submit a statement below that clearly explains why you think unreasonable behaviour has occurred and how this has caused unnecessary or wasted expense.",