added in capacity details to pdf

This commit is contained in:
2023-11-29 10:21:29 +00:00
parent b0e740ba8c
commit 33df7e25d7
8 changed files with 1065 additions and 883 deletions
+740 -767
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -204,6 +204,7 @@ let MakeRepresentation = (props) => {
caseReference={caseReference} caseReference={caseReference}
/>; />;
break; break;
case "appellant":
case t( case t(
"myrepresentations:capacity-options-arr-appellant" "myrepresentations:capacity-options-arr-appellant"
).toLocaleLowerCase(): ).toLocaleLowerCase():
@@ -248,6 +249,7 @@ let MakeRepresentation = (props) => {
/> />
); );
break; break;
case "agent":
case t( case t(
"myrepresentations:capacity-options-arr-agent" "myrepresentations:capacity-options-arr-agent"
).toLowerCase(): ).toLowerCase():
@@ -519,6 +521,11 @@ let MakeRepresentation = (props) => {
"incidentID": props.props.currentView.caseReference.incidentid, "incidentID": props.props.currentView.caseReference.incidentid,
"caseRef": "caseRef":
props.props.currentView.caseReference.currentReference, props.props.currentView.caseReference.currentReference,
"pinswg_questionnaireduedate":
detailsObj.pinswg_questionnaireduedate,
"pinswg_statementduedate": detailsObj.pinswg_statementduedate,
"pinswg_finalcommentsduedate":
detailsObj.pinswg_finalcommentsduedate,
"pinswg_name": "pinswg_name":
props.props.currentView.caseReference.currentReference, props.props.currentView.caseReference.currentReference,
"firstname": "firstname":
@@ -13,6 +13,7 @@ import {
RenderPickList, RenderPickList,
RenderTextfield, RenderTextfield,
RenderRadioList, RenderRadioList,
RenderRadioListWithText,
RenderMultiline, RenderMultiline,
} from "./representationElements"; } from "./representationElements";
import { useDropzone } from "react-dropzone"; import { useDropzone } from "react-dropzone";
@@ -52,8 +53,8 @@ let RepCapacitySelection = (props) => {
myRepresentations={props.props.myRepresentations} myRepresentations={props.props.myRepresentations}
props={props} props={props}
/>{" "} />{" "}
<div id="rep-details" className="vo_hiddens"> <div id="rep-details" className="">
<div className="govuk-grid-column-three-quarters"> <div className="govuk-grid-column-full">
<div className="govuk-grid-row"> <div className="govuk-grid-row">
<h2 className="govuk-heading-m "> <h2 className="govuk-heading-m ">
{t( {t(
@@ -71,7 +72,7 @@ let RepCapacitySelection = (props) => {
id="representationCapacity" id="representationCapacity"
className="govuk-radios__input" className="govuk-radios__input"
errorMsg={t("newappeal:select-an-option-label")} errorMsg={t("newappeal:select-an-option-label")}
component={RenderRadioList} component={RenderRadioListWithText}
validate={[required]} validate={[required]}
/> />
</div> </div>
@@ -110,6 +110,127 @@ export const RenderRadioList = ({
); );
}; };
export const RenderRadioListWithText = ({
datafieldname,
name,
label,
id,
errorMsg,
options,
input: { onChange, value },
meta: { touched, error },
...custom
}) => {
const required = (value) => (value ? undefined : "Required");
return (
<>
<div
className={
touched && error
? "govuk-form-group govuk-form-group--error"
: "govuk-form-group "
}
>
<fieldset
className="govuk-fieldset"
aria-describedby={name + "-hint"}
>
<legend className="govuk-fieldset__legend govuk-fieldset__legend--s govuk-!-font-weight-regular">
<label
className="govuk-fieldset__heading govuk-body-m"
id={id + "_label"}
>
{label}
</label>
</legend>
{touched && error && (
<span
id={id + "-error"}
className="govuk-error-message"
>
<span className="govuk-visually-hidden">
Error:
</span>{" "}
{errorMsg}
</span>
)}
<div
className={
custom.inline == true
? "govuk-radios govuk-radios--inline govuk-radios--small "
: "govuk-radios govuk-radios--small govuk-grid-column-full"
}
>
{Object.keys(options).map((key, index) => (
<div
className="govuk-radios__item govuk-grid-column-full"
data-children-count={key}
key={key}
>
<Field
id={id + "_" + index}
name={id}
component="input"
type="radio"
className="govuk-radios__input"
value={options[key]}
/>
<label
className="govuk-label govuk-radios__label"
htmlFor={id + "_" + index}
>
{options[key]}
</label>
{value === options[key] && (
<div
className="govuk-radios__conditional "
id={"conditional_" + id + "_" + index}
>
<div className="govuk-form-group">
<label
className="govuk-label"
htmlFor={
"conditional_" +
id +
"_Comments"
}
>
Please give further details for
your this selection
</label>
<Field
name={
"conditional_" +
id +
"_Comments"
}
id={
"conditional_" +
id +
"_Comments"
}
component={RenderRichMultiline}
type="text"
rows="5"
className="govuk-textarea govuk-input--width-30"
aria-describedby={
id + "_" + index + "-hint"
}
/>
</div>
</div>
)}
</div>
))}
</div>
</fieldset>
</div>
</>
);
};
export const RenderCondtionalRadioList = ({ export const RenderCondtionalRadioList = ({
datafieldname, datafieldname,
legend, legend,
@@ -871,116 +992,118 @@ export const RenderFileUpload = (field) => {
}); });
}; };
return <> return (
<Dropzone <>
accept="application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,image/tiff,image/jpeg,application/zip" <Dropzone
onDrop={(filesToUpload, e) => { accept="application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,image/tiff,image/jpeg,application/zip"
const renamedAcceptedFiles = filesToUpload.map( onDrop={(filesToUpload, e) => {
(file) => const renamedAcceptedFiles = filesToUpload.map(
new File([file], `${file.name}`, { (file) =>
type: file.type, new File([file], `${file.name}`, {
}) type: file.type,
); })
field.input.onChange(renamedAcceptedFiles); );
}} field.input.onChange(renamedAcceptedFiles);
> }}
{({ getRootProps, getInputProps }) => ( >
<> {({ getRootProps, getInputProps }) => (
{/* {field.hint != false && ( <>
{/* {field.hint != false && (
<div className="govuk-hint">ss{t(field.hint)}</div> <div className="govuk-hint">ss{t(field.hint)}</div>
)} )}
<div className="govuk-form-group"></div> */} <div className="govuk-form-group"></div> */}
<section className="container"> <section className="container">
<div {...getRootProps({ style })}> <div {...getRootProps({ style })}>
{" "} {" "}
<input id={field.id} {...getInputProps()} /> <input id={field.id} {...getInputProps()} />
<div> <div>
{t( {t(
"newappeal:new-appeal-fileupload-drop-label" "newappeal:new-appeal-fileupload-drop-label"
)} )}
</div>
<em>
(
{t(
"newappeal:new-appeal-fileupload-file-list-label"
)}
)
</em>
</div> </div>
<em> <aside>{thumbs}</aside>
( </section>
{t( </>
"newappeal:new-appeal-fileupload-file-list-label" )}
)} </Dropzone>
) {field.meta.touched && field.meta.error && (
</em> <span className="error">{field.meta.error}</span>
</div>
<aside>{thumbs}</aside>
</section>
</>
)} )}
</Dropzone> {files && Array.isArray(files) && (
{field.meta.touched && field.meta.error && ( <ul>
<span className="error">{field.meta.error}</span> {files.map((file, i) => (
)} <div
{files && Array.isArray(files) && ( key={file.name}
<ul> className="govuk-!-margin-bottom-5 fileThumb"
{files.map((file, i) => ( >
<div <img
key={file.name} src={getThumbnailIcon(file, file.type)}
className="govuk-!-margin-bottom-5 fileThumb" alt={file.name}
> width="50"
<img />
src={getThumbnailIcon(file, file.type)} <span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
alt={file.name} {file.name} ({bytesToSize(file.size)})
width="50" </span>
/> </div>
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5"> ))}
{file.name} ({bytesToSize(file.size)}) </ul>
)}
{blobList.map((blob, i) => (
<div
key={blob.name + "_" + i}
className="govuk-!-margin-bottom-5 fileThumb govuk-!-margin-top-5"
>
<div className="">
<span
className="govuk-summary-list__actionLink watched_link govuk-!-margin-right-5 govuk-!-text-align-left"
onClick={() => {
deleteThisBlob(
field.containerID,
blob.name,
blob.hasheddeletepath,
blob.hashgetblobs,
field.ticketnumber
);
}}
title="Remove this file"
>
&minus;
</span> </span>
</div> </div>
))} <img
</ul> src={getThumbnailIconByExtension(blob.name)}
)} alt={blob.name}
{blobList.map((blob, i) => ( width="50"
<div />
key={blob.name + "_" + i}
className="govuk-!-margin-bottom-5 fileThumb govuk-!-margin-top-5" <Link
> key={i}
<div className=""> scroll={false}
<span href={
className="govuk-summary-list__actionLink watched_link govuk-!-margin-right-5 govuk-!-text-align-left" "/api/file/downloadblob?container=" +
onClick={() => { field.containerID +
deleteThisBlob( "&casefolderID=" +
field.containerID, field.ticketnumber +
blob.name, "&blobname=" +
blob.hasheddeletepath, blob.name +
blob.hashgetblobs, blob.hashedfilepath
field.ticketnumber }
); className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link"
}}
title="Remove this file"
> >
&minus; {blob.name}({bytesToSize(blob.contentLength)})
</span> </Link>
</div> </div>
<img ))}{" "}
src={getThumbnailIconByExtension(blob.name)} </>
alt={blob.name} );
width="50"
/>
<Link
key={i}
scroll={false}
href={
"/api/file/downloadblob?container=" +
field.containerID +
"&casefolderID=" +
field.ticketnumber +
"&blobname=" +
blob.name +
blob.hashedfilepath
}
className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5 govuk-link">
{blob.name}({bytesToSize(blob.contentLength)})
</Link>
</div>
))}{" "}
</>;
}; };
export function FileUploadField(props) { export function FileUploadField(props) {
+18 -5
View File
@@ -20,6 +20,8 @@ import {
setWatchedCasesDetails, setWatchedCasesDetails,
} from "../../store/watchedCases/action"; } from "../../store/watchedCases/action";
import { getFormCollectionByID } from "../utils"; import { getFormCollectionByID } from "../utils";
import jsonpath from "jsonpath";
import transLookup from "../../data/lookuptranslations.json";
const TopThree = (props) => { const TopThree = (props) => {
let { t } = useTranslation(); let { t } = useTranslation();
@@ -177,10 +179,9 @@ const TopThree = (props) => {
showTopThreeArr[key].appealType, showTopThreeArr[key].appealType,
"repDetails": showTopThreeArr[key], "repDetails": showTopThreeArr[key],
}); });
}}> }}
>
{showTopThreeArr[key].pinswg_name} {showTopThreeArr[key].pinswg_name}
</Link> </Link>
</div> </div>
<div className="cardModuleReference"> <div className="cardModuleReference">
@@ -199,9 +200,21 @@ const TopThree = (props) => {
{repRaisedDate(showTopThreeArr[key].repfile_name)} {repRaisedDate(showTopThreeArr[key].repfile_name)}
</div>{" "} </div>{" "}
<div className="cardModuleReference"> <div className="cardModuleReference">
<b>lpa:</b> <b>LPA:</b>
{" "} {" "}
{repRaisedDate(showTopThreeArr[key].repfile_name)}
{router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
showTopThreeArr[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy'
)
: showTopThreeArr[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] || ""}
</div> </div>
</div> </div>
</div> </div>
+37 -6
View File
@@ -101,7 +101,7 @@ export const finalComments_pdf = ({ docProps }) => {
} }
let values = docProps; let values = docProps;
let datestr = values.pinswg_name.split("-"); let datestr = values.repfile_name.split("-");
let signedDate = datestr[2] + "/" + datestr[1] + "/" + datestr[0]; let signedDate = datestr[2] + "/" + datestr[1] + "/" + datestr[0];
let appealTypeValue = getFormCollectionByID(values.appealType); let appealTypeValue = getFormCollectionByID(values.appealType);
@@ -158,17 +158,48 @@ export const finalComments_pdf = ({ docProps }) => {
marginBottom: 10, marginBottom: 10,
}} }}
> >
<Text style={styles.questionBullet}>1.</Text> <Text style={styles.questionBullet}>1a.</Text>
<Text style={styles.questionText}> <Text style={styles.questionText}>
{t( Case reference :
"myrepresentations:s78-section-question-1"
)}
:
</Text> </Text>
<Text style={styles.questionAnswer}> <Text style={styles.questionAnswer}>
{values.caseRef} {values.caseRef}
</Text> </Text>
</View> </View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}></Text>
<Text style={styles.questionText}>
Representation capacity:
</Text>
<Text style={styles.questionAnswer}>
{values.representationCapacity}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}></Text>
<Text style={styles.questionText}>
Representation capacity{"\n"} details:
</Text>
<Text style={styles.questionAnswer}>
<Html style={styles.richArea}>
{
values.conditional_representationCapacity_Comments
}
</Html>
</Text>
</View>
<View <View
wrap={false} wrap={false}
style={{ style={{
+34
View File
@@ -169,6 +169,40 @@ export const statement_pdf = ({ docProps }) => {
{values.caseRef} {values.caseRef}
</Text> </Text>
</View> </View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>1a.</Text>
<Text style={styles.questionText}>
Representation capacity:
</Text>
<Text style={styles.questionAnswer}>
{values.representationCapacity}
</Text>
</View>
<View
wrap={false}
style={{
flexDirection: "row",
marginBottom: 10,
}}
>
<Text style={styles.questionBullet}>1c.</Text>
<Text style={styles.questionText}>
Representation capacity details:
</Text>
<Text style={styles.questionAnswer}>
<Html style={styles.richArea}>
{
values.conditional_representationCapacity_Comments
}
</Html>
</Text>
</View>
<View <View
wrap={false} wrap={false}
style={{ style={{
+1 -1
View File
@@ -106,7 +106,7 @@ import { other_pdf } from "../../../components/pdftemplates/other_pdf";
export default function handler(req, res) { export default function handler(req, res) {
var checkHash = req.query.hash; var checkHash = req.query.hash;
let reqBodyobj = req.body; //JSON.parse(req.body); let reqBodyobj = JSON.parse(req.body);
console.log( console.log(
"//////////////////////\nreqBodyobj" + "//////////////////////\nreqBodyobj" +