Merged PR 1150: typo fix portal crash abd appeal file name update

Related work items: #11105, #11107, #11166
This commit is contained in:
Robert Bond
2024-05-16 11:42:48 +00:00
5 changed files with 56 additions and 13 deletions
+9 -1
View File
@@ -319,8 +319,16 @@ export const createAppealPDFBlob = async (
const content = formContent;
const repDate = new Date();
let day = repDate.getDate();
let month = repDate.getMonth() + 1;
let year = repDate.getFullYear();
const pdfFileName = year + "-" + month + "-" + day + "_-_Appeal_Form";
//console.log(content);
const blobName = caseID + "/files/" + caseID + ".pdf";
const blobName = caseID + "/files/" + pdfFileName + ".pdf";
console.log("blobName:", blobName);
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
+6
View File
@@ -178,6 +178,11 @@ let MakeRepresentation = (props) => {
'$..[?(@.title=="' + caseReference + '")]',
setCaseQueryObj
))
: currentType == "watchedCases"
? (casesObj = jsonpath(
'$..[?(@.ticketnumber=="' + caseReference + '")]',
watchedCases
))
: (casesObj = jsonpath(
'$..[?(@.reference=="' + caseReference + '")]',
setCaseQueryObj
@@ -271,6 +276,7 @@ let MakeRepresentation = (props) => {
setSubmitBack={setSubmitBack}
props={props}
caseReference={caseReference}
setRepFileName={setRepFileName}
/>
);
} else {
@@ -48,6 +48,7 @@ let RepLPA = (props) => {
showQuestionnaireSection,
questionnaireCount,
setQuestionnaireCount,
setRepFileName,
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const files = acceptedFiles.map((file) => (
@@ -224,18 +225,26 @@ let RepLPA = (props) => {
);
resultsObj = resultsObj[0];
props.formObj["representationForm"].values.hasOwnProperty(
"representationCapacity"
) &&
props.formObj["representationForm"].values.hasOwnProperty(
"representationType"
) &&
setRepFileName(props.formObj["representationForm"].values);
return (
<>
<div className="govuk-grid-row">
<div className="govuk-form-group">
{!(
"values" in formObj.representationForm &&
"representationType" in
formObj.representationForm.values
) ? (
{typeof formObj.representationForm.values
.representationType == "undefined" ? (
<>
<h2 className="govuk-heading-m ">
{typeof props.representationType != "undefined"
{typeof props.representationType !=
"undefined" ||
typeof formObj.representationForm.values
.representationType != "undefined"
? props.representationType ==
"Questionnaire"
? locale == "cy"
@@ -291,7 +300,9 @@ let RepLPA = (props) => {
</div>
<div className="govuk-grid-row">
<div className="govuk-form-group">
{typeof props.representationType != "undefined" &&
{(typeof props.representationType != "undefined" ||
typeof formObj.representationForm.values
.representationType != "undefined") &&
(props.representationType != "Questionnaire" ? (
<>
<p className="govuk-body">
@@ -345,6 +356,7 @@ let RepLPA = (props) => {
props.props.props.accountDetails
.containerID
}
filenamePrefix={props}
/>
</div>
</fieldset>
@@ -356,7 +368,9 @@ let RepLPA = (props) => {
</div>
<div className="govuk-grid-row">
<div className="govuk-button-group">
{typeof props.representationType != "undefined" &&
{(typeof props.representationType != "undefined" ||
typeof formObj.representationForm.values
.representationType != "undefined") &&
props.representationType == "Questionnaire" && (
<>
{showQuestionnaireSection}
@@ -408,7 +422,9 @@ let RepLPA = (props) => {
)}
</>
)}{" "}
{typeof props.representationType != "undefined" &&
{(typeof props.representationType != "undefined" ||
typeof formObj.representationForm.values
.representationType != "undefined") &&
props.representationType != "Questionnaire" && (
<>
<button
@@ -452,10 +468,15 @@ const mapStateToProps = (state, props) => {
? state.currentView.caseReference.repDetails
: state.currentView.caseReference,
{
"representationCapacity": "lpa",
"onBehalfOfLPA":
props.props.props.accountDetails.accountDetails[
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
],
"firstname":
props.props.props.accountDetails.accountDetails.firstname,
"lastname":
props.props.props.accountDetails.accountDetails.lastname,
}
);
return {
+1 -1
View File
@@ -46,7 +46,7 @@
<labels>
<label description="Has the description of the development changed since the application was submitted?" />
</labels>
<control validation="[required]" id="pinswg_developmentdescriptionchanged" classid="{67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}" datafieldname="pinswg_developmentdescriptionchanged" disabled="false" requiredDocumentValue="Yes" requiredDocumentLabel="Development of description change" />
<control validation="[required]" id="pinswg_developmentdescriptionchanged" classid="{67FAC785-CD58-4f9f-ABB3-4B7DDC6ED5ED}" datafieldname="pinswg_developmentdescriptionchanged" disabled="false" requiredDocumentValue="Yes" requiredDocumentLabel="Description of development change confirmation" />
</row>
<row>
<labels>
+10 -2
View File
@@ -180,6 +180,14 @@ export default async function handler(req, res) {
<MyDocument docProps={blobProgress} pickListData={pickListData} />
);
const repDate = new Date();
let day = repDate.getDate();
let month = repDate.getMonth() + 1;
let year = repDate.getFullYear();
const pdfFileName = year + "-" + month + "-" + day + "_-_Appeal_Form";
await createAppealPDFBlob(
renderedPDF,
containerID,
@@ -187,13 +195,13 @@ export default async function handler(req, res) {
).then((data) => {
console.log(
"///////////////////////////////////\nfile created: " +
`/files/${blobProgress.pinswg_name}.pdf`,
`/files/${pdfFileName}.pdf`,
"\n/////////////////////////"
);
return res.status(200).json({
status: "success",
data: data,
path: `/files/${blobProgress.pinswg_name}.pdf`,
path: `/files/${pdfFileName}.pdf`,
});
});
}