reps pdf upload directory restructure
This commit is contained in:
@@ -81,6 +81,7 @@ let MakeRepresentation = (props) => {
|
||||
handleSubmit,
|
||||
setRepresentationSubmitConfirmation,
|
||||
setRepresentationMessageSent,
|
||||
initialValues,
|
||||
} = props;
|
||||
const formObj = props.props.form;
|
||||
let setCaseQueryObj = props[currentType] || {};
|
||||
@@ -156,6 +157,7 @@ let MakeRepresentation = (props) => {
|
||||
currentView.representationCapacity,
|
||||
_.isEmpty(currentView.representationCapacity)
|
||||
);
|
||||
|
||||
if (isLPA && _.isEmpty(currentView.representationCapacity)) {
|
||||
return (
|
||||
<RepLPACapacitySelection
|
||||
@@ -246,7 +248,7 @@ let MakeRepresentation = (props) => {
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "interestedparty/person":
|
||||
case "interestedparty":
|
||||
// setRepresentationCapacity("interestedpartyperson");
|
||||
return (
|
||||
<RepInterestedPartyPerson
|
||||
@@ -335,7 +337,7 @@ let MakeRepresentation = (props) => {
|
||||
case "Land Owner":
|
||||
repType = "LO";
|
||||
break;
|
||||
case "LPA":
|
||||
case "lpa":
|
||||
repType = "LPA";
|
||||
break;
|
||||
|
||||
@@ -344,19 +346,22 @@ let MakeRepresentation = (props) => {
|
||||
}
|
||||
|
||||
Object.assign(updateBody, {
|
||||
"repfile_name": updateBody.hasOwnProperty("repfile_name")
|
||||
? updateBody.repfile_name
|
||||
: year +
|
||||
"-" +
|
||||
month +
|
||||
"-" +
|
||||
day +
|
||||
"-" +
|
||||
time +
|
||||
"-" +
|
||||
repType +
|
||||
"-REP" +
|
||||
"_" +
|
||||
props.props.accountDetails.accountDetails.lastname,
|
||||
"pinswg_name":
|
||||
year +
|
||||
"-" +
|
||||
month +
|
||||
"-" +
|
||||
day +
|
||||
"-" +
|
||||
time +
|
||||
"-" +
|
||||
repType +
|
||||
"-REP" +
|
||||
"_" +
|
||||
props.props.accountDetails.accountDetails.lastname,
|
||||
props.props.currentView.caseReference.currentReference,
|
||||
"containerID": props.props.accountDetails.containerID,
|
||||
"appealType": props.props.currentView.caseReference.appealType,
|
||||
"incidentID": props.props.currentView.caseReference.incidentid,
|
||||
@@ -408,7 +413,15 @@ let MakeRepresentation = (props) => {
|
||||
|
||||
console.log("attached docs: - ", buildFileArray);
|
||||
|
||||
let setCaseDetailsObj = props.props.searchResultsObj.searchDetailsObj;
|
||||
let setCaseDetailsObj = router.query.hasOwnProperty("state")
|
||||
? router.query.state == "edit"
|
||||
? props.props.myRepresentations.myRepresentations
|
||||
: props.props.searchResultsObj.searchDetailsObj
|
||||
: props.props.searchResultsObj.searchDetailsObj;
|
||||
|
||||
router.query.hasOwnProperty("state") &&
|
||||
router.query.state == "edit" &&
|
||||
setRepresentationSubmit(true);
|
||||
|
||||
var detailsObj = {};
|
||||
|
||||
@@ -438,6 +451,20 @@ let MakeRepresentation = (props) => {
|
||||
detailsObj.pinswg_siteaddresstown +
|
||||
" " +
|
||||
detailsObj.pinswg_siteaddresspostcode,
|
||||
"pinswg_siteaddressline1": detailsObj.pinswg_siteaddressline1,
|
||||
"pinswg_siteaddressline2": detailsObj.pinswg_siteaddressline2,
|
||||
"pinswg_siteaddresstown": detailsObj.pinswg_siteaddresstown,
|
||||
"pinswg_siteaddresspostcode": detailsObj.pinswg_siteaddresspostcode,
|
||||
"_pinswg_appellant_value": detailsObj["_pinswg_appellant_value"],
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue":
|
||||
detailsObj[
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
"representationCapacity": router.query.hasOwnProperty("state")
|
||||
? router.query.state == "edit"
|
||||
? props.props.currentView.representationCapacity
|
||||
: values.representationCapacity
|
||||
: values.representationCapacity,
|
||||
});
|
||||
console.log(values);
|
||||
currentView.representationSubmit != true
|
||||
@@ -455,10 +482,14 @@ let MakeRepresentation = (props) => {
|
||||
console.log("has errors:", props.invalid),
|
||||
props.invalid == false &&
|
||||
updateRepresentation(values, false, false),
|
||||
values.representationDocuments.map((Blob) =>
|
||||
buildFileArray.push({ "name": Blob.name, "size": Blob.size })
|
||||
),
|
||||
Object.assign(values, { "filesList": buildFileArray }),
|
||||
values.hasOwnProperty("representationDocuments") &&
|
||||
(values.representationDocuments.map((Blob) =>
|
||||
buildFileArray.push({
|
||||
"name": Blob.name,
|
||||
"size": Blob.size,
|
||||
})
|
||||
),
|
||||
Object.assign(values, { "filesList": buildFileArray })),
|
||||
generateRepPDF(
|
||||
values,
|
||||
props.props.accountDetails.containerID,
|
||||
@@ -495,7 +526,7 @@ let MakeRepresentation = (props) => {
|
||||
dataObj,
|
||||
fileListObj,
|
||||
values.containerID,
|
||||
props.caseReference
|
||||
props.caseReference + "/" + dataObj.repfile_name
|
||||
).then((data) => {
|
||||
//console.log("hello", data);
|
||||
|
||||
@@ -507,9 +538,21 @@ let MakeRepresentation = (props) => {
|
||||
|
||||
console.log(
|
||||
"what is representationSubmit state: " +
|
||||
currentView.representationSubmit
|
||||
currentView.representationSubmit,
|
||||
props.initialValues
|
||||
);
|
||||
|
||||
try {
|
||||
let value = props.initialValues;
|
||||
console.log("has props"), value;
|
||||
setRepresentationCapacity(
|
||||
props.initialValues.representationCapacity.toLowerCase()
|
||||
);
|
||||
//setRepresentationSubmit(false);
|
||||
} catch {
|
||||
console.log("not has props");
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||
@@ -567,12 +610,16 @@ let MakeRepresentation = (props) => {
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
console.log("\\\\\\\\\\\\\\\\\\\\\\\\\\\\/nin map state", state);
|
||||
|
||||
return {
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
currentView: state.currentView,
|
||||
myRepresentations: state.myRepresentations,
|
||||
initialValues: state.currentView.caseReference.repDetails,
|
||||
//form: state.form,
|
||||
};
|
||||
};
|
||||
@@ -610,5 +657,6 @@ export default connect(
|
||||
reduxForm({
|
||||
form: "representationForm",
|
||||
destroyOnUnmount: false,
|
||||
enableReinitialize: true,
|
||||
})(MakeRepresentation)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user