Merged PR 1151: updated naming convention meta and pdf fixes

updated naming convention meta and pdf fixes

Related work items: #11180
This commit is contained in:
Robert Bond
2024-05-20 11:43:39 +00:00
16 changed files with 254 additions and 143 deletions
+25 -1
View File
@@ -376,10 +376,22 @@ export const createRepPDFBlob = async (
const uploadBlobResponse = await blockBlobClient.uploadStream(content);
let whichLocation =
repName.indexOf("_IP_") > 0
? "Interested Party Representations"
: repName.indexOf("_Statement_") > 0
? "Main Party Statements"
: repName.indexOf("_Questionnaire_") > 0
? "Main Party Questionnaire"
: repName.indexOf("_Comments") > 0
? "Main Party Comments"
: "default";
const tags = {
containerid: containerName,
caseID: caseID,
blobType: "Appeal PDF",
blobType: "Representation PDF",
ishareLocation: whichLocation,
};
//console.log("the tags:", tags);
@@ -466,11 +478,23 @@ export const uploadFile = async (formContent, containerName, foldername) => {
"\n////////////////////////////"
);
let whichLocation =
files[prop][0].fieldName.indexOf("_IP_") > 0
? "Interested Party Representations"
: files[prop][0].fieldName.indexOf("_Statement_") > 0
? "Main Party Statements"
: files[prop][0].fieldName.indexOf("_Questionnaire_") > 0
? "Main Party Questionnaire"
: files[prop][0].fieldName.indexOf("_Comments_") > 0
? "Main Party Comments"
: "default";
const tags = {
containerid: containerName,
caseID: foldername.split("/")[0],
documentType: files[prop][0].fieldName.split(".")[1],
blobType: "RepresentationFile",
ishareLocation: whichLocation,
};
const withTags = await blockBlobClient.setTags(tags);
const withMeta = await blockBlobClient.setMetadata(tags);
+27 -6
View File
@@ -423,9 +423,12 @@ let MakeRepresentation = (props) => {
setRepresentationCapacity
}
setRepresentationSubmit={setRepresentationSubmit}
onHandleSubmit={onHandleSubmit}
currentView={currentView}
setSubmitBack={setSubmitBack}
props={props}
caseReference={caseReference}
setRepFileName={setRepFileName}
/>
);
}
@@ -495,9 +498,15 @@ let MakeRepresentation = (props) => {
Object.assign(values, {
"containerID": props.props.accountDetails.containerID,
"appealType": props.props.currentView.caseReference.appealType,
"incidentID": props.props.currentView.caseReference.incidentid,
"appealType":
props.props.currentView.caseReference.appealType ||
props.props.currentView.caseReference.repDetails.appealType,
"incidentID":
props.props.currentView.caseReference.incidentid ||
props.props.currentView.caseReference.repDetails.incidentid,
"caseRef": props.props.currentView.caseReference.currentReference,
"casereference":
props.props.currentView.caseReference.currentReference,
"pinswg_questionnaireduedate":
detailsObj.pinswg_questionnaireduedate,
"pinswg_statementduedate": detailsObj.pinswg_statementduedate,
@@ -550,8 +559,14 @@ let MakeRepresentation = (props) => {
"pinswg_name":
props.props.currentView.caseReference.currentReference,
"containerID": props.props.accountDetails.containerID,
"appealType": props.props.currentView.caseReference.appealType,
"incidentID": props.props.currentView.caseReference.incidentid,
"appealType":
props.props.currentView.caseReference.appealType ||
props.props.currentView.caseReference.repDetails.appealType,
"casereference":
props.props.currentView.caseReference.currentReference,
"incidentID":
props.props.currentView.caseReference.incidentid ||
props.props.currentView.caseReference.repDetails.incidentid,
"caseRef": props.props.currentView.caseReference.currentReference,
});
@@ -658,10 +673,16 @@ let MakeRepresentation = (props) => {
(Object.assign(values, formObj.representationForm.values),
Object.assign(values, {
"containerID": props.props.accountDetails.containerID,
"appealType": props.props.currentView.caseReference.appealType,
"incidentID": props.props.currentView.caseReference.incidentid,
"appealType":
props.props.currentView.caseReference.appealType ||
props.props.currentView.caseReference.repDetails.appealType,
"incidentID":
props.props.currentView.caseReference.incidentid ||
props.props.currentView.caseReference.repDetails.incidentid,
"caseRef":
props.props.currentView.caseReference.currentReference,
"casereference":
props.props.currentView.caseReference.currentReference,
"pinswg_questionnaireduedate":
detailsObj.pinswg_questionnaireduedate,
"pinswg_statementduedate": detailsObj.pinswg_statementduedate,
@@ -81,103 +81,120 @@ const RepAgent = (props) => {
)}
</div>
</div>
<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("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">
<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>
{(typeof props.representationType != "undefined" ||
typeof formObj.representationForm.values.representationType !=
"undefined") && (
<>
<div className="govuk-grid-row">
<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"}
label={t("myrepresentations:add-files-label")}
ticketnumber={props.props.caseReference}
hint={"sdsd"}
fileList={[]}
setFilesForRepresentation={[]}
containerID={
props.props.props.accountDetails.containerID
name="representationOnBehalfOf"
datafieldname="representationOnBehalfOf"
// label={t("myrepresentations:capacity-select-what-capacity-label")}
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?"
}
filenamePrefix={props}
/>
</div>
{props.currentView.caseReference.hasOwnProperty(
"repDetails"
) &&
props.currentView.caseReference.repDetails.filesList
.length > 0 ? (
<div className="govuk-form-group govuk-!-margin-bottom-9">
{props.currentView.caseReference.repDetails.filesList.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>
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{blob.name} (
{bytesToSize(blob.size)})
</span>
</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"}
label={t(
"myrepresentations:add-files-label"
)}
ticketnumber={props.props.caseReference}
hint={"sdsd"}
fileList={[]}
setFilesForRepresentation={[]}
containerID={
props.props.props.accountDetails
.containerID
}
filenamePrefix={props}
/>
</div>
{props.currentView.caseReference.hasOwnProperty(
"repDetails"
) &&
props.currentView.caseReference.repDetails
.filesList.length > 0 ? (
<div className="govuk-form-group govuk-!-margin-bottom-9">
{props.currentView.caseReference.repDetails.filesList.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>
) : (
""
)}
</div>
) : (
""
)}
</fieldset>
</div>{" "}
</div>
</fieldset>
</div>{" "}
</div>
</>
)}
<div className="govuk-grid-row">
<div className="govuk-button-group">
<button
@@ -1,4 +1,5 @@
import Link from "next/link";
import _ from "lodash";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { connect } from "react-redux";
@@ -225,9 +226,10 @@ let RepLPA = (props) => {
);
resultsObj = resultsObj[0];
props.formObj["representationForm"].values.hasOwnProperty(
"representationCapacity"
) &&
props.formObj["representationForm"].hasOwnProperty("values") &&
props.formObj["representationForm"].values.hasOwnProperty(
"representationCapacity"
) &&
props.formObj["representationForm"].values.hasOwnProperty(
"representationType"
) &&
@@ -237,7 +239,39 @@ let RepLPA = (props) => {
<>
<div className="govuk-grid-row">
<div className="govuk-form-group">
{typeof formObj.representationForm.values
{!_.has(
formObj["representationForm"],
["values", "representationType"] ||
typeof props.representationType != "undefined"
) ? (
<>
<label
className="govuk-label govuk-body-m"
htmlFor="representationType"
>
{t(
"myrepresentations:representation-from-an-lpa-heading"
)}
</label>
<Field
id="representationType"
name="representationType"
component={RenderPickList}
datafieldname="representationType"
optionsArr={appellantApplicantRepresentationArr}
/>
</>
) : (
<label className="govuk-label govuk-body-m">
Representation Type:{" "}
{
formObj.representationForm.values
.representationType
}{" "}
</label>
)}
{/* {!formObj["representationForm"].hasOwnProperty("values") ||
typeof formObj.representationForm.values
.representationType == "undefined" ? (
<>
<h2 className="govuk-heading-m ">
@@ -269,15 +303,13 @@ let RepLPA = (props) => {
currentView.caseReference.appealType
).value}
</h2>
<label
className="govuk-label govuk-body-m"
htmlFor="representationType"
>
{t(
"myrepresentations:representation-from-an-agent-heading"
"myrepresentations:representation-from-an-lpa-heading"
)}
?
</label>
<Field
id="representationType"
@@ -295,14 +327,16 @@ let RepLPA = (props) => {
.representationType
}{" "}
</label>
)}
)} */}
</div>
</div>
<div className="govuk-grid-row">
<div className="govuk-form-group">
{(typeof props.representationType != "undefined" ||
typeof formObj.representationForm.values
.representationType != "undefined") &&
{(_.has(formObj["representationForm"], [
"values",
"representationType",
]) ||
typeof props.representationType != "undefined") &&
(props.representationType != "Questionnaire" ? (
<>
<p className="govuk-body">
@@ -369,8 +403,7 @@ let RepLPA = (props) => {
<div className="govuk-grid-row">
<div className="govuk-button-group">
{(typeof props.representationType != "undefined" ||
typeof formObj.representationForm.values
.representationType != "undefined") &&
_.has(formObj, "values", "representationType")) &&
props.representationType == "Questionnaire" && (
<>
{showQuestionnaireSection}
@@ -423,8 +456,7 @@ let RepLPA = (props) => {
</>
)}{" "}
{(typeof props.representationType != "undefined" ||
typeof formObj.representationForm.values
.representationType != "undefined") &&
_.has(formObj, "values", "representationType")) &&
props.representationType != "Questionnaire" && (
<>
<button
@@ -486,6 +518,7 @@ const mapStateToProps = (state, props) => {
appealType: state.appealType,
currentView: state.currentView,
myRepresentations: state.myRepresentations,
watchedCases: state.watchedCases,
initialValues: initialValuesTemp,
};
};
@@ -48,7 +48,11 @@ let Enforcement_Questionnaire = (props) => {
let setCaseDetailsObj = router.query.hasOwnProperty("state")
? router.query.state == "edit"
? props.props.myRepresentations.myRepresentations
: currentView.caseReference.currentType == "watchedCases"
? props.props.watchedCases.watchedCasesDetails
: props.props.searchResultsObj.searchDetailsObj
: currentView.caseReference.currentType == "watchedCases"
? props.props.watchedCases.watchedCasesDetails
: props.props.searchResultsObj.searchDetailsObj;
var detailsObj = {};
@@ -63,7 +67,11 @@ let Enforcement_Questionnaire = (props) => {
let setCaseResultssObj = router.query.hasOwnProperty("state")
? router.query.state == "edit"
? props.props.myRepresentations.myRepresentations
: currentView.caseReference.currentType == "watchedCases"
? props.props.watchedCases.watchedCases
: props.props.searchResultsObj.searchResultsObj
: currentView.caseReference.currentType == "watchedCases"
? props.props.watchedCases.watchedCases
: props.props.searchResultsObj.searchResultsObj;
detailsObj = detailsObj[0];
@@ -51,7 +51,11 @@ let S78_Questionnaire = (props) => {
let setCaseDetailsObj = router.query.hasOwnProperty("state")
? router.query.state == "edit"
? props.props.myRepresentations.myRepresentations
: currentView.caseReference.currentType == "watchedCases"
? props.props.watchedCases.watchedCasesDetails
: props.props.searchResultsObj.searchDetailsObj
: currentView.caseReference.currentType == "watchedCases"
? props.props.watchedCases.watchedCasesDetails
: props.props.searchResultsObj.searchDetailsObj;
var detailsObj = {};
@@ -66,7 +70,11 @@ let S78_Questionnaire = (props) => {
let setCaseResultssObj = router.query.hasOwnProperty("state")
? router.query.state == "edit"
? props.props.myRepresentations.myRepresentations
: currentView.caseReference.currentType == "watchedCases"
? props.props.watchedCases.watchedCases
: props.props.searchResultsObj.searchResultsObj
: currentView.caseReference.currentType == "watchedCases"
? props.props.watchedCases.watchedCases
: props.props.searchResultsObj.searchResultsObj;
detailsObj = detailsObj[0];
@@ -102,9 +110,6 @@ let S78_Questionnaire = (props) => {
return (
<>
{props.representationTypeValue}
{props.procedureTypeValue}
{showQuestionnaireSection == 1 && (
<fieldset
className="govuk-fieldset"
+1 -1
View File
@@ -273,7 +273,7 @@ export const finalComments_pdf = ({ docProps }) => {
:
</Text>
<Text style={styles.questionAnswer}>
{appealTypeValue.value}
{appealTypeValue.value || ""}
</Text>
</View>
</View>
+18 -19
View File
@@ -208,7 +208,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
)}
</Text>
<Text style={styles.questionAnswer}>
{values.lpaRef}
{values.lpaRef || " "}
</Text>
</View>
<View
@@ -244,7 +244,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
)}
</Text>
<Text style={styles.questionAnswer}>
{appealTypeValue.value}
{appealTypeValue.value || ""}
</Text>
</View>
</View>
@@ -287,14 +287,14 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
)}
</Text>
<Text style={styles.questionAnswerMid}>
{values.procedureType}
{values.procedureType || ""}
</Text>
</View>
{values.procedureType !=
"Written representations" && (
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.procedureTypeEvidence}
{values.procedureTypeEvidence || ""}
</Html>
</View>
)}
@@ -314,7 +314,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
)}
</Text>
<Text style={styles.questionAnswerMid}>
{values.enterToView}
{values.enterToView || ""}
</Text>
</View>
@@ -340,7 +340,8 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
)}
</Text>
<Text style={styles.questionAnswerMid}>
{values.enterNeighbouringLandToViewSite}
{values.enterNeighbouringLandToViewSite ||
" "}
</Text>
</View>
@@ -348,9 +349,8 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
"Yes" && (
<View style={styles.questionAnswerWide}>
<Html style={{ fontSize: 12 }}>
{
values.enterNeighbouringLandToViewSiteEvidence
}
{values.enterNeighbouringLandToViewSiteEvidence ||
" "}
</Html>
</View>
)}
@@ -377,9 +377,8 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
)}
</Text>
<Text style={styles.questionAnswerMid}>
{
values.enterNeighbouringLandAccessRequired
}
{values.enterNeighbouringLandAccessRequired ||
" "}
</Text>
</View>
{values.enterNeighbouringLandAccessRequired !=
@@ -414,7 +413,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
)}
</Text>
<Text style={styles.questionAnswerMid}>
{values.healthAndSafetyIssues}
{values.healthAndSafetyIssues || ""}
</Text>
</View>
{values.healthAndSafetyIssues == "Yes" && (
@@ -451,13 +450,12 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
</View>
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.LPAcontactDetails}
{values.LPAcontactDetails || ""}
</Html>
</View>
</View>
</View>
</View>
<View>
<View
style={{
@@ -489,7 +487,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
</Text>
<View style={styles.questionAnswer}>
<Html style={styles.richArea}>
{values.LPAcaseFileAndReps}
{values.LPAcaseFileAndReps || ""}
</Html>
</View>
</View>
@@ -509,7 +507,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
</Text>
<View style={styles.questionAnswer}>
<Html style={styles.richArea}>
{values.LPAldpAndMap}
{values.LPAldpAndMap || ""}
</Html>
</View>
</View>
@@ -529,7 +527,7 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
</Text>
<View style={styles.questionAnswer}>
<Html style={styles.richArea}>
{values.LPAlocalGuidance}
{values.LPAlocalGuidance || ""}
</Html>
</View>
</View>
@@ -548,7 +546,8 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
)}
</Text>
<Text style={styles.questionAnswerMid}>
{values.LPAintentionToSubmitFullStatement}
{values.LPAintentionToSubmitFullStatement ||
""}
</Text>
</View>
</View>
+2
View File
@@ -11,6 +11,7 @@ import ReactPDF, {
import { createElement } from "react";
import Html from "react-pdf-html";
import { getFormCollectionByID } from "../../components/utils";
import useTranslation from "next-translate/useTranslation";
const styles = StyleSheet.create({
page: {
@@ -88,6 +89,7 @@ const styles = StyleSheet.create({
});
export const other_pdf = ({ docProps }) => {
let { t } = useTranslation();
//console.log("----", docProps);
function formatDates(dateObj) {
var dateObj = new Date(dateObj);
+2 -2
View File
@@ -270,7 +270,7 @@ export const statement_pdf = ({ docProps }) => {
:
</Text>
<Text style={styles.questionAnswer}>
{appealTypeValue.value}
{appealTypeValue.value || ""}
</Text>
</View>
</View>
@@ -315,7 +315,7 @@ export const statement_pdf = ({ docProps }) => {
</View>
<View style={styles.questionAnswerWide}>
<Html style={styles.richArea}>
{values.representationComments}
{values.representationComments || ""}
</Html>
</View>
</View>
@@ -201,7 +201,7 @@ export const writtenStatement_pdf = ({ docProps }) => {
Case Type:
</Text>
<Text style={styles.questionAnswer}>
{appealTypeValue.value}
{appealTypeValue.value || ""}
</Text>
</View>
</View>
+1
View File
@@ -6,6 +6,7 @@
"statements-due-label": "Datganiadau yn ddyledus",
"final-comments-due-label": "Sylwadau terfynol yn ddyledus",
"representation-from-an-agent-heading": "Cynrychiolaeth gan Asiant",
"representation-from-an-lpa-heading": "Cynrychiolaeth gan ACLl",
"representation-from-an-appellant-heading": "Cynrychiolaeth gan Apelydd",
"representation-from-an-interested-person-heading": "Cynrychiolaeth gan Barti/Person â Diddordeb",
"kind-of-rep-label": "Pa fath o gynrychiolaeth ydych chi'n ei wneud?",
+1
View File
@@ -6,6 +6,7 @@
"statements-due-label": "Statements due",
"final-comments-due-label": "Final comments due",
"representation-from-an-agent-heading": "Representation from an Agent",
"representation-from-an-lpa-heading": "Representation from an LPA",
"representation-from-an-appellant-heading": "Representation from an Appellant",
"representation-from-an-interested-person-heading": "Representation from an Interested Party/Person",
"kind-of-rep-label": "What kind of representation are you making?",
+2 -2
View File
@@ -41,7 +41,7 @@ export default async function ApiProxy(req, res) {
incidentID +
")?$select=ticketnumber,title,pinswg_appealcasetype";
//console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
return axios
.get(
@@ -56,7 +56,7 @@ export default async function ApiProxy(req, res) {
res.status(200).json(data);
})
.catch((err) => {
console.log(consoleLogger(err));
consoleLogger(err);
res.status(400).json(err);
});
}
+2 -2
View File
@@ -99,7 +99,7 @@ import { finalComments_pdf } from "../../../components/pdftemplates/finalComment
import { statement_pdf } from "../../../components/pdftemplates/statement_pdf";
import { writtenStatement_pdf } from "../../../components/pdftemplates/writtenStatement_pdf";
import { other_pdf } from "../../../components/pdftemplates/other_pdf";
import { consoleLogger } from "../../../actions";
// const ApiProxy = nextConnect();
// ApiProxy.use(middleware);
@@ -241,7 +241,7 @@ export default async function handler(req, res) {
});
})
.catch((err) => {
console.log(consoleLogger(err));
consoleLogger(err);
res.status(400).json(err);
});
}
+1 -1
View File
@@ -348,7 +348,7 @@ const getDetails = (resultsObj, detailsType) => {
caseID = data.ticketnumber;
break;
case "myRepresentations":
caseID = data.casereference;
caseID = data.ticketnumber;
break;
default:
caseID = data.pinswg_title;