questionnaire defect 60.55,59,57

This commit is contained in:
2025-01-15 11:30:58 +00:00
parent 49418becf2
commit 33ab93643d
9 changed files with 154 additions and 245 deletions
+14 -132
View File
@@ -865,50 +865,23 @@ let MakeRepresentation = (props) => {
? (Object.assign(values, { ? (Object.assign(values, {
"filesList": props.currentView.fileList, "filesList": props.currentView.fileList,
}), }),
// commented out as dont need to create pdf on save
// generateRepPDF(
// values,
// props.props.accountDetails.containerID,
// currentView.caseReference.currentReference
// ),
uploadRepresentationFiles(values), uploadRepresentationFiles(values),
router.replace( router.replace(
router.locale != "en" router.locale != "en"
? router.locale + "/myportal" ? router.locale + "/myportal"
: "/myportal" : "/myportal"
)) ))
: //values.hasOwnProperty("representationDocuments") && : Object.assign(values, {
// sortFileObj() "filesList": props.currentView.fileList,
// (values.representationDocuments.map((Blob) => }),
// buildFileArray.push({ console.log("Rep Updated - props.caseReference"),
// "name": Blob.name,
// "size": Blob.size,
// })
// ),
// Object.assign(values, {
// "filesList": buildFileArray,
// })),
console.log("updated");
uploadRepresentationFiles(values); uploadRepresentationFiles(values);
// generateRepPDF(
// values,
// props.props.accountDetails.containerID,
// currentView.caseReference.currentReference
// );
}; };
const onHandleSubmit = (values) => { const onHandleSubmit = (values) => {
window.scrollTo({ top: 0, behavior: "smooth" }); window.scrollTo({ top: 0, behavior: "smooth" });
values = setRepFileName(values); values = setRepFileName(values);
// values.representationType == "Questionnaire" &&
// !values.hasOwnProperty("pinswg_lpareference") &&
// Object.assign(values, {
// "pinswg_lpareference":
// searchResultsObj?.searchResultsObj?.value[0]
// ?.pinswg_lpareference,
// });
//console.log("onHandleSubmit form values - ", JSON.stringify(values)); //console.log("onHandleSubmit form values - ", JSON.stringify(values));
const buildFileArray = []; const buildFileArray = [];
@@ -1074,55 +1047,9 @@ let MakeRepresentation = (props) => {
setRepresentationSubmit(true); setRepresentationSubmit(true);
setRepresentationSubmitConfirmation(true); setRepresentationSubmitConfirmation(true);
} else { } else {
console.log("nit updated"); console.log("not updated");
} }
} }
// currentView.representationSubmit != true
// ? _.isEmpty(currentView.representationCapacity)
// ? isLPA
// ? setRepresentationCapacity("LPA")
// : setRepresentationCapacity(
// values.representationCapacity
// .replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
// .toLowerCase()
// )
// : questionnaireCount != 0 &&
// showQuestionnaireSection < questionnaireCount
// ? (setShowQuestionnaireSection(showQuestionnaireSection + 1),
// updateRepresentation(values, false, false))
// : (updateRepresentation(values, false, false),
// setRepresentationSubmit(true))
// : currentView.representationSubmit == true
// ? (console.log("capacity", currentView.representationCapacity),
// console.log("has errors:", props.invalid),
// Object.assign(values, { "locale": router.locale }),
// props.invalid == false &&
// updateRepresentation(values, false, false),
// // values.hasOwnProperty("representationDocuments") &&
// // (values.representationDocuments.map((Blob) =>
// // buildFileArray.push({
// // "name": Blob.name,
// // "size": Blob.size,
// // })
// // ),
// // Object.assign(values, {
// // "filesList": buildFileArray,
// // })),
// console.log(
// "====================== rep lpa payload:\n",
// JSON.stringify(values)
// ),
// generateRepPDF(
// values,
// props.props.accountDetails.containerID,
// currentView.caseReference.currentReference
// ),
// uploadRepresentationFiles(values),
// setRepresentationSubmitConfirmation(true))
// : console.log("nit updated");
//window.alert(`You submitted:\n\n${JSON.stringify(values, null, 2)}`);
}; };
const cleanFilesList = (blobList) => { const cleanFilesList = (blobList) => {
@@ -1184,22 +1111,14 @@ let MakeRepresentation = (props) => {
var dataObj = values; var dataObj = values;
// for (let key in dataObj) { uploadRepFiles(
// _.includes(key, "representationDocuments") == true && dataObj,
// delete dataObj[key]; [{}],
// } values.containerID,
props.caseReference + "/" + dataObj.repfile_name
// may need to delete ).then((data) => {
// No sure if this is needed anymore,...... return data;
});
// uploadRepFiles(
// dataObj,
// [{}],
// values.containerID,
// props.caseReference + "/" + dataObj.repfile_name
// ).then((data) => {
// return data;
// });
}; };
const repForm = props.props.form; const repForm = props.props.form;
@@ -1231,40 +1150,6 @@ let MakeRepresentation = (props) => {
questionnaireCount={questionnaireCount} questionnaireCount={questionnaireCount}
/> />
) : ( ) : (
<>
{/* {!session ? (
<>
<div>
<p className="govuk-body">
{t(
"myrepresentations:sign-in-to-raise-rep-label"
)}{" "}
<a
href={
"mailto:" +
t(
"myrepresentations:login-contact-email"
)
}
className="govuk-link--no-underline"
>
{t(
"myrepresentations:login-contact-email"
)}
</a>
</p>
</div>
<button
className="govuk-button withChevron govuk-button-cta"
type="button"
onClick={() => signIn()}
>
{t(
"myrepresentations:sign-in-to-raise-rep-button"
)}
</button>
</>
) : ( */}
<> <>
<h1 className="govuk-heading-l"> <h1 className="govuk-heading-l">
{t( {t(
@@ -1327,8 +1212,7 @@ let MakeRepresentation = (props) => {
</span> </span>
</div> </div>
{currentView.caseReference {currentView.caseReference
.appealType != .appealType != 846040011 && (
846040011 && (
<div className="govuk-body-s"> <div className="govuk-body-s">
{t( {t(
"myrepresentations:final-comments-due-label" "myrepresentations:final-comments-due-label"
@@ -1365,8 +1249,6 @@ let MakeRepresentation = (props) => {
</div> </div>
</div> </div>
</> </>
{/* )} */}
</>
)} )}
</form> </form>
</div> </div>
+4 -1
View File
@@ -158,7 +158,10 @@ export const AppealRow_pdf = (props) => {
function CleanHTML(htmlStr) { function CleanHTML(htmlStr) {
let cleanStr = let cleanStr =
typeof htmlStr === "string" typeof htmlStr === "string"
? htmlStr.replace(/<p><br><\/p>/g, "") ? htmlStr.replace(
/<p><br><\/p>|<p class=\"ql-align-justify\"><br><\/p>/g,
""
)
: ""; : "";
return cleanStr; return cleanStr;
+4 -1
View File
@@ -104,7 +104,10 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
function CleanHTML(htmlStr) { function CleanHTML(htmlStr) {
let cleanStr = let cleanStr =
typeof htmlStr === "string" typeof htmlStr === "string"
? htmlStr.replace(/<p><br><\/p>/g, "") ? htmlStr.replace(
/<p><br><\/p>|<p class=\"ql-align-justify\"><br><\/p>/g,
""
)
: ""; : "";
return cleanStr; return cleanStr;
+10 -5
View File
@@ -21,7 +21,7 @@ const getTrans = (locale, key) => {
let jsonObj = locale == "cy" ? transLookupCY : transLookupEN; let jsonObj = locale == "cy" ? transLookupCY : transLookupEN;
console.log(locale, jsonObj[key]); //console.log(locale, jsonObj[key]);
return jsonObj[key]; return jsonObj[key];
}; };
@@ -68,9 +68,8 @@ const styles = StyleSheet.create({
}, },
questionAnswerWide: { questionAnswerWide: {
color: "#757575", color: "#757575",
width: "95%", width: "100%",
fontSize: 12, fontSize: 12,
marginLeft: "5%",
border: 1, border: 1,
borderColor: "#eee", borderColor: "#eee",
backgroundColor: "white", backgroundColor: "white",
@@ -125,7 +124,10 @@ export const finalComments_pdf = ({ docProps }) => {
function CleanHTML(htmlStr) { function CleanHTML(htmlStr) {
let cleanStr = let cleanStr =
typeof htmlStr === "string" typeof htmlStr === "string"
? htmlStr.replace(/<p><br><\/p>/g, "") ? htmlStr.replace(
/<p><br><\/p>|<p class=\"ql-align-justify\"><br><\/p>/g,
""
)
: ""; : "";
return cleanStr; return cleanStr;
@@ -398,7 +400,10 @@ export const finalComments_pdf = ({ docProps }) => {
} }
> >
{p.name} -{" "} {p.name} -{" "}
{bytesToSize(p.size)}{" "} {bytesToSize(
p.size ||
p.contentLength
)}{" "}
{"\n"} {"\n"}
</Text> </Text>
</View> </View>
@@ -87,9 +87,8 @@ const styles = StyleSheet.create({
}, },
questionAnswerWide: { questionAnswerWide: {
color: "#757575", color: "#757575",
width: "95%", width: "100%",
fontSize: 12, fontSize: 12,
marginLeft: "5%",
border: 1, border: 1,
borderColor: "#eee", borderColor: "#eee",
backgroundColor: "white", backgroundColor: "white",
@@ -149,7 +148,10 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
function CleanHTML(htmlStr) { function CleanHTML(htmlStr) {
let cleanStr = let cleanStr =
typeof htmlStr === "string" typeof htmlStr === "string"
? htmlStr.replace(/<p><br><\/p>/g, "") ? htmlStr.replace(
/<p><br><\/p>|<p class=\"ql-align-justify\"><br><\/p>/g,
""
)
: ""; : "";
return cleanStr; return cleanStr;
@@ -558,7 +560,6 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
wrap={false} wrap={false}
> >
<View <View
wrap={false}
style={{ style={{
flexDirection: "row", flexDirection: "row",
marginBottom: 10, marginBottom: 10,
@@ -585,10 +586,8 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
flexDirection: "column", flexDirection: "column",
marginBottom: 10, marginBottom: 10,
}} }}
wrap={false}
> >
<View <View
wrap={false}
style={{ style={{
flexDirection: "row", flexDirection: "row",
marginBottom: 10, marginBottom: 10,
+5 -2
View File
@@ -21,7 +21,7 @@ const getTrans = (locale, key) => {
let jsonObj = locale == "cy" ? transLookupCY : transLookupEN; let jsonObj = locale == "cy" ? transLookupCY : transLookupEN;
console.log(locale, jsonObj[key]); //console.log(locale, jsonObj[key]);
return jsonObj[key]; return jsonObj[key];
}; };
@@ -129,7 +129,10 @@ export const other_pdf = ({ docProps }) => {
function CleanHTML(htmlStr) { function CleanHTML(htmlStr) {
let cleanStr = let cleanStr =
typeof htmlStr === "string" typeof htmlStr === "string"
? htmlStr.replace(/<p><br><\/p>/g, "") ? htmlStr.replace(
/<p><br><\/p>|<p class=\"ql-align-justify\"><br><\/p>/g,
""
)
: ""; : "";
return cleanStr; return cleanStr;
+11 -6
View File
@@ -18,7 +18,7 @@ const getTrans = (locale, key) => {
let jsonObj = locale == "cy" ? transLookupCY : transLookupEN; let jsonObj = locale == "cy" ? transLookupCY : transLookupEN;
console.log(locale, jsonObj[key]); //console.log(locale, jsonObj[key]);
return jsonObj[key]; return jsonObj[key];
}; };
@@ -65,9 +65,8 @@ const styles = StyleSheet.create({
}, },
questionAnswerWide: { questionAnswerWide: {
color: "#757575", color: "#757575",
width: "95%", width: "100%",
fontSize: 12, fontSize: 12,
marginLeft: "5%",
border: 1, border: 1,
borderColor: "#eee", borderColor: "#eee",
backgroundColor: "white", backgroundColor: "white",
@@ -97,7 +96,7 @@ const styles = StyleSheet.create({
}); });
export const statement_pdf = ({ docProps }) => { export const statement_pdf = ({ docProps }) => {
console.log("----", docProps); //console.log("----", docProps);
function formatDates(dateObj) { function formatDates(dateObj) {
var dateObj = new Date(dateObj); var dateObj = new Date(dateObj);
var dd = String(dateObj.getDate()).padStart(2, "0"); var dd = String(dateObj.getDate()).padStart(2, "0");
@@ -122,7 +121,10 @@ export const statement_pdf = ({ docProps }) => {
function CleanHTML(htmlStr) { function CleanHTML(htmlStr) {
let cleanStr = let cleanStr =
typeof htmlStr === "string" typeof htmlStr === "string"
? htmlStr.replace(/<p><br><\/p>/g, "") ? htmlStr.replace(
/<p><br><\/p>|<p class=\"ql-align-justify\"><br><\/p>/g,
""
)
: ""; : "";
return cleanStr; return cleanStr;
@@ -395,7 +397,10 @@ export const statement_pdf = ({ docProps }) => {
} }
> >
{p.name} -{" "} {p.name} -{" "}
{bytesToSize(p.size)}{" "} {bytesToSize(
p.size ||
p.contentLength
)}{" "}
{"\n"} {"\n"}
</Text> </Text>
</View> </View>
@@ -110,7 +110,10 @@ export const writtenStatement_pdf = ({ docProps }) => {
function CleanHTML(htmlStr) { function CleanHTML(htmlStr) {
let cleanStr = let cleanStr =
typeof htmlStr === "string" typeof htmlStr === "string"
? htmlStr.replace(/<p><br><\/p>/g, "") ? htmlStr.replace(
/<p><br><\/p>|<p class=\"ql-align-justify\"><br><\/p>/g,
""
)
: ""; : "";
return cleanStr; return cleanStr;
+16 -10
View File
@@ -35,20 +35,26 @@ ApiProxy.post(async (req, res) => {
repOrAppeal repOrAppeal
? createRepBlob(appealData, containerID, casefolderID).then((data) => { ? createRepBlob(appealData, containerID, casefolderID).then((data) => {
Object.keys(req.files).length > 0 && // Object.keys(req.files).length > 0 &&
uploadFile(req.files, containerID, casefolderID).then( // uploadFile(req.files, containerID, casefolderID).then(
(data) => { // (data) => {
// return res.status(200).json({ data });
// }
// );
console.log("================================\nRepfile updated");
return res.status(200).json({ data }); return res.status(200).json({ data });
}
);
}) })
: createBlob(appealData, containerID, casefolderID).then((data) => { : createBlob(appealData, containerID, casefolderID).then((data) => {
Object.keys(req.files).length > 0 && // Object.keys(req.files).length > 0 &&
uploadFile(req.files, containerID, casefolderID).then( // uploadFile(req.files, containerID, casefolderID).then(
(data) => { // (data) => {
return res.status(200).json({ data }); // return res.status(200).json({ data });
} // }
// );
console.log(
"================================\nAppeal file updated"
); );
return res.status(200).json({ data });
}); });
//}); //});