reps pdf upload directory restructure
This commit is contained in:
+63
-55
@@ -276,16 +276,11 @@ export const createRepBlob = async (formContent, containerName, caseref) => {
|
||||
const containerClient = new ContainerClient(sasUrl);
|
||||
|
||||
formContent = JSON.parse(formContent);
|
||||
let caseID = "";
|
||||
|
||||
caseID = _.has(formContent, "pinswg_name")
|
||||
? formContent.pinswg_name
|
||||
: caseref;
|
||||
|
||||
const content = JSON.stringify(formContent);
|
||||
|
||||
//console.log(content);
|
||||
const blobName = caseref + "/" + caseID + "_rep.json";
|
||||
const blobName = caseref + "/" + formContent.repfile_name + "_rep.json";
|
||||
|
||||
console.log("blobName:", blobName);
|
||||
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
||||
@@ -297,7 +292,7 @@ export const createRepBlob = async (formContent, containerName, caseref) => {
|
||||
|
||||
const tags = {
|
||||
containerid: containerName,
|
||||
caseID: caseID,
|
||||
caseID: formContent.caseRef,
|
||||
blobType: "Representation",
|
||||
};
|
||||
|
||||
@@ -378,13 +373,18 @@ export const uploadFile = async (formContent, containerName, foldername) => {
|
||||
files[prop][0].path,
|
||||
files[prop].size
|
||||
);
|
||||
|
||||
console.log(
|
||||
"////////////////////////\nfile name:",
|
||||
files[prop][0].fieldName,
|
||||
"\n////////////////////////////"
|
||||
);
|
||||
|
||||
const tags = {
|
||||
containerid: containerName,
|
||||
caseID: foldername,
|
||||
documentType: files[prop][0].fieldName.slice(
|
||||
0,
|
||||
files[prop][0].fieldName.indexOf("_")
|
||||
),
|
||||
caseID: foldername.split("/")[0],
|
||||
documentType: files[prop][0].fieldName.split(".")[1],
|
||||
blobType: "RepresentationFile",
|
||||
};
|
||||
const withTags = await blockBlobClient.setTags(tags);
|
||||
const withMeta = await blockBlobClient.setMetadata(tags);
|
||||
@@ -410,21 +410,17 @@ export const uploadRepFiles = async (
|
||||
console.log(...formContent);
|
||||
console.log("rep files...", files, Object.keys(files).length, foldername);
|
||||
|
||||
// console.log(`files[${prop}] = ${files[prop][0].size}`);
|
||||
const blobName = foldername + formContent.split("tmp/")[1];
|
||||
|
||||
console.log(blobName);
|
||||
|
||||
const blobName = foldername + "/" + formContent.split("tmp/")[1];
|
||||
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
||||
const uploadBlobResponse = await blockBlobClient.uploadFile(formContent);
|
||||
const tags = {
|
||||
containerid: containerName,
|
||||
caseID: foldername,
|
||||
documentType: "rep content",
|
||||
caseID: formContent.split("tmp/")[0],
|
||||
documentType: "Rep docs",
|
||||
};
|
||||
console.log(tags);
|
||||
// const withTags = await blockBlobClient.setTags(tags);
|
||||
// const withMeta = await blockBlobClient.setMetadata(tags);
|
||||
const withTags = await blockBlobClient.setTags(tags);
|
||||
const withMeta = await blockBlobClient.setMetadata(tags);
|
||||
|
||||
console.log(
|
||||
`Uploaded block blob ${files} successfully`,
|
||||
@@ -432,11 +428,10 @@ export const uploadRepFiles = async (
|
||||
);
|
||||
};
|
||||
|
||||
export const uploadPDFRepFiles = async (
|
||||
export const uploadPDFCaseFiles = async (
|
||||
formContent,
|
||||
containerName,
|
||||
foldername,
|
||||
repType
|
||||
foldername
|
||||
) => {
|
||||
const containerToken = await createContainerSas(containerName);
|
||||
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
|
||||
@@ -446,28 +441,20 @@ export const uploadPDFRepFiles = async (
|
||||
|
||||
console.log(formContent, containerName, foldername);
|
||||
console.log(
|
||||
"rep pdf files...",
|
||||
"case pdf files...",
|
||||
files,
|
||||
Object.keys(files).length,
|
||||
foldername
|
||||
);
|
||||
|
||||
// console.log(`files[${prop}] = ${files[prop][0].size}`);
|
||||
console.log(foldername + "/files/" + formContent.split("tmp/")[1]);
|
||||
|
||||
const blobName = foldername + "/files/" + formContent.split("tmp/")[1];
|
||||
|
||||
console.log(blobName);
|
||||
|
||||
console.log(blobName);
|
||||
const blobName = foldername + "/" + formContent.split("tmp/")[1];
|
||||
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
||||
const uploadBlobResponse = await blockBlobClient.uploadFile(formContent);
|
||||
|
||||
const tags = {
|
||||
containerid: containerName,
|
||||
caseID: foldername,
|
||||
documentType: repType,
|
||||
blobType: "RepresentationPDF",
|
||||
caseID: foldername.split("/")[0],
|
||||
blobType: "AppealPDF",
|
||||
};
|
||||
|
||||
console.log("the tags:", tags);
|
||||
@@ -481,7 +468,7 @@ export const uploadPDFRepFiles = async (
|
||||
};
|
||||
|
||||
export const downloadFile = async (containerName, blobName) => {
|
||||
//console.log.apply(containerName, blobName);
|
||||
//console.log(containerName, blobName);
|
||||
const containerToken = await createContainerSas(containerName);
|
||||
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
|
||||
const containerClient = new ContainerClient(sasUrl);
|
||||
@@ -497,7 +484,7 @@ export const downloadProgressFile = async (
|
||||
blobName,
|
||||
casefolderID
|
||||
) => {
|
||||
//console.log.apply(containerName, blobName);
|
||||
console.log(containerName, blobName);
|
||||
|
||||
const containerToken = await createContainerSas(containerName);
|
||||
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
|
||||
@@ -624,7 +611,7 @@ export const downloadAllRepsFiles = async (containerName, repsBlobObj) => {
|
||||
|
||||
repBlobObj = JSON.parse(repBlobObj);
|
||||
|
||||
repBlobObj["casereference"] = repsBlobObj[prop].name.split("/")[0];
|
||||
repBlobObj["casereference"] = repsBlobObj[prop].name.split("/")[1];
|
||||
|
||||
// repBlobObj = JSON.stringify(repBlobObj);
|
||||
|
||||
@@ -682,6 +669,17 @@ export const getCaseBlob = async (
|
||||
content,
|
||||
Buffer.byteLength(content)
|
||||
);
|
||||
|
||||
const tags = {
|
||||
containerid: containerName,
|
||||
caseID: caseReference,
|
||||
blobType: "Case",
|
||||
};
|
||||
|
||||
console.log("the tags:", tags);
|
||||
const withTags = await blockBlobClient.setTags(tags);
|
||||
const withMeta = await blockBlobClient.setMetadata(tags);
|
||||
|
||||
return blobName;
|
||||
};
|
||||
|
||||
@@ -699,22 +697,22 @@ export const getProgressBlobs = async (containerName, caseReference) => {
|
||||
blobCount++;
|
||||
}
|
||||
|
||||
// console.log(
|
||||
// "this is the casefolder and blobcount:",
|
||||
// caseReference,
|
||||
// blobCount
|
||||
// );
|
||||
console.log(
|
||||
"this is the casefolder and blobcount:",
|
||||
caseReference,
|
||||
blobCount
|
||||
);
|
||||
|
||||
let blobObj = [];
|
||||
for await (const blob of containerClient.listBlobsFlat({
|
||||
prefix: caseReference + "/" + caseReference + "_appeal.json",
|
||||
})) {
|
||||
//console.log("getProgressBlobs in here");
|
||||
console.log("getProgressBlobs in here", blob.name.split("/"));
|
||||
blobObj.push({
|
||||
"name": blob.name.split("/")[1],
|
||||
"path": blob.name,
|
||||
"versionId": blob.versionId,
|
||||
"caseObj": caseReference + "/" + caseReference + "_case.json",
|
||||
"caseObj": caseReference + "/case/" + caseReference + "_case.json",
|
||||
"isCurrentVersion": blob.isCurrentVersion,
|
||||
"contentLength": blob.properties.contentLength,
|
||||
"contentType": blob.contentType,
|
||||
@@ -771,16 +769,16 @@ export const getAllProgressBlobs = async (containerName) => {
|
||||
blobObj.push({
|
||||
"name": blob.name.split("/")[1],
|
||||
"path": blob.name,
|
||||
"versionId": blob.versionId,
|
||||
//"versionId": blob.versionId,
|
||||
"caseObj":
|
||||
blob.name.split("/")[0] +
|
||||
"/case/" +
|
||||
blob.name.split("/")[0] +
|
||||
"_case.json",
|
||||
"isCurrentVersion": blob.isCurrentVersion,
|
||||
"contentLength": blob.properties.contentLength,
|
||||
"contentType": blob.contentType,
|
||||
"lastModified": blob.properties.lastModified,
|
||||
// "isCurrentVersion": blob.isCurrentVersion,
|
||||
// "contentLength": blob.properties.contentLength,
|
||||
// "contentType": blob.contentType,
|
||||
// "lastModified": blob.properties.lastModified,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -810,16 +808,26 @@ export const getRepsBlobs = async (containerName) => {
|
||||
blobCount
|
||||
);
|
||||
|
||||
const listOptions = {
|
||||
includeMetadata: true,
|
||||
includeSnapshots: false,
|
||||
includeTags: true,
|
||||
includeVersions: true,
|
||||
};
|
||||
|
||||
let blobObj = [];
|
||||
for await (const blob of containerClient.findBlobsByTags(
|
||||
"blobType='Representation'"
|
||||
"blobType='Representation'",
|
||||
listOptions
|
||||
)) {
|
||||
const blobClient = await containerClient.getBlobClient(blob.name);
|
||||
console.log(blob);
|
||||
blob.name.split("/")[1].indexOf("_rep.json") > 0 &&
|
||||
blob.name.split("/")[1].indexOf("undefined") < 0 &&
|
||||
blob.name.split("/")[2].indexOf("_rep.json") > 0 &&
|
||||
blob.name.split("/")[2].indexOf("undefined") < 0 &&
|
||||
blobObj.push({
|
||||
"name": blob.name.split("/")[1],
|
||||
"name": blob.name.split("/")[2],
|
||||
"path": blob.name,
|
||||
"size": blobClient.getProperties().contentLength,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1497,6 +1497,20 @@ export const downloadBlob = (containerName, blobName) => {
|
||||
};
|
||||
|
||||
export const getProgressFromBlob = async (containerName, casereference) => {
|
||||
console.log(
|
||||
/////////////////\ngetProgressFromBlob",
|
||||
BASE_URL +
|
||||
"/api/file/getprogressobjblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casereference +
|
||||
hashAPIPath(
|
||||
"/api/file/getprogressobjblob?container=" +
|
||||
containerName +
|
||||
"&casefolderID=" +
|
||||
casereference
|
||||
)
|
||||
);
|
||||
try {
|
||||
const res = await axios.get(
|
||||
BASE_URL +
|
||||
|
||||
@@ -1,212 +0,0 @@
|
||||
import Link from "next/link";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import _ from "lodash";
|
||||
import { Field, FieldArray, reduxForm, formValueSelector } from "redux-form";
|
||||
import { connect } from "react-redux";
|
||||
import { useDropzone } from "react-dropzone";
|
||||
|
||||
import { setRepresentationCapacity } from "../../../store/currentView/action";
|
||||
import RepCapacitySelection from "./representationCapacitySelection";
|
||||
import RepDetails from "./representationDetails";
|
||||
import RepAppellant from "./representationAppellant";
|
||||
import RepAgent from "./representationAgent";
|
||||
import RepInterestedPartyPerson from "./representationInterestedPartyPerson";
|
||||
import RepLandOwner from "./representationLandowner";
|
||||
import {
|
||||
RenderPickList,
|
||||
RenderRadioList,
|
||||
RenderTextfield,
|
||||
} from "./representationElements";
|
||||
|
||||
let MakeRepresentation = (props) => {
|
||||
let { t } = useTranslation();
|
||||
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
|
||||
|
||||
const [clearRepForm, setClearRepForm] = useState(false);
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const {
|
||||
caseReference,
|
||||
myCases,
|
||||
myRepresentations,
|
||||
watchedCases,
|
||||
awaitingSubmission,
|
||||
searchResultsObj,
|
||||
currentType,
|
||||
currentView,
|
||||
setRepresentationCapacity,
|
||||
} = props;
|
||||
const formObj = props.props.form;
|
||||
let setCaseQueryObj = props[currentType];
|
||||
var casesObj = {};
|
||||
|
||||
currentType == "searchResultsObj"
|
||||
? (casesObj = jsonpath.query(
|
||||
setCaseQueryObj,
|
||||
'$..[?(@.title=="' + caseReference + '")]'
|
||||
))
|
||||
: (casesObj = jsonpath.query(
|
||||
setCaseQueryObj,
|
||||
'$..[?(@.reference=="' + caseReference + '")]'
|
||||
));
|
||||
|
||||
casesObj = Object.assign({}, ...casesObj);
|
||||
|
||||
const capacityOptionsArr = [
|
||||
"Appellant",
|
||||
"Agent",
|
||||
"Interested Party/Person",
|
||||
"Land Owner",
|
||||
];
|
||||
|
||||
const appellantApplicantRepresentationArr = [
|
||||
"Other",
|
||||
"Statement",
|
||||
"Statement of common ground",
|
||||
"Written statement of evidence",
|
||||
];
|
||||
|
||||
const interestedPersonRepresentationArr = [
|
||||
"Interested Party/Person correspondence",
|
||||
];
|
||||
|
||||
const landOwnerRepresentationArr = [
|
||||
"Other",
|
||||
"Statement",
|
||||
"Written statement of evidence",
|
||||
];
|
||||
|
||||
const repCapacityType = () => {
|
||||
currentView.representationCapacity == false
|
||||
? false
|
||||
: _.isEmpty(formObj["representationForm"])
|
||||
? false
|
||||
: _.isEmpty(formObj["representationForm"].values)
|
||||
? false
|
||||
: _.isEmpty(
|
||||
formObj["representationForm"].values.representationCapacity
|
||||
)
|
||||
? setRepresentationCapacity(false)
|
||||
: setRepresentationCapacity(
|
||||
formObj["representationForm"].values.representationCapacity
|
||||
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
|
||||
.toLowerCase()
|
||||
);
|
||||
|
||||
return currentView.representationCapacity;
|
||||
};
|
||||
|
||||
const whichControl = () => {
|
||||
repCapacityType();
|
||||
switch (currentView.representationCapacity) {
|
||||
case false:
|
||||
return (
|
||||
<RepCapacitySelection
|
||||
formObj={formObj}
|
||||
capacityOptionsArr={capacityOptionsArr}
|
||||
currentType={currentType}
|
||||
casesObj={casesObj}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "appellant":
|
||||
setRepresentationCapacity("appellant");
|
||||
return (
|
||||
<RepAppellant
|
||||
formObj={formObj}
|
||||
appellantApplicantRepresentationArr={
|
||||
appellantApplicantRepresentationArr
|
||||
}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "agent":
|
||||
setRepresentationCapacity("agent");
|
||||
return (
|
||||
<RepAgent
|
||||
formObj={formObj}
|
||||
appellantApplicantRepresentationArr={
|
||||
appellantApplicantRepresentationArr
|
||||
}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "interestedpartyperson":
|
||||
setRepresentationCapacity("interestedpartyperson");
|
||||
return (
|
||||
<RepInterestedPartyPerson
|
||||
formObj={formObj}
|
||||
interestedPersonRepresentationArr={
|
||||
interestedPersonRepresentationArr
|
||||
}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "landowner":
|
||||
setRepresentationCapacity("landowner");
|
||||
return (
|
||||
<RepLandOwner
|
||||
formObj={formObj}
|
||||
landOwnerRepresentationArr={landOwnerRepresentationArr}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
default:
|
||||
return (
|
||||
<RepCapacitySelection
|
||||
formObj={formObj}
|
||||
capacityOptionsArr={capacityOptionsArr}
|
||||
currentType={currentType}
|
||||
casesObj={casesObj}
|
||||
setRepresentationCapacity={setRepresentationCapacity}
|
||||
/>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
{whichControl()} - {props.firstValue}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
currentView: state.currentView,
|
||||
//form: state.form,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setRepresentationCapacity: (representationCapacity) => {
|
||||
dispatch(setRepresentationCapacity(representationCapacity));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const selector = formValueSelector("representationForm");
|
||||
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(
|
||||
reduxForm({
|
||||
form: "representationForm",
|
||||
destroyOnUnmount: false,
|
||||
})(MakeRepresentation)
|
||||
);
|
||||
@@ -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)
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Link from "next/link";
|
||||
import { connect } from "react-redux";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { Field, reduxForm } from "redux-form";
|
||||
@@ -12,9 +13,11 @@ import {
|
||||
FileUploadField,
|
||||
} from "./representationElements";
|
||||
import {
|
||||
setRepresentationCapacity,
|
||||
setRepresentationSubmit,
|
||||
} from "../../../store/currentView/action";
|
||||
getFormCollectionByID,
|
||||
getThumbnailIconByExtension,
|
||||
bytesToSize,
|
||||
} from "../../utils";
|
||||
|
||||
import { useDropzone } from "react-dropzone";
|
||||
|
||||
const RepAgent = (props) => {
|
||||
@@ -117,7 +120,6 @@ const RepAgent = (props) => {
|
||||
aria-describedby={props.name + "-hint"}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="govuk-form-group govuk-!-margin-bottom-9">
|
||||
<FileUploadField
|
||||
name={"representationDocuments"}
|
||||
@@ -132,6 +134,37 @@ const RepAgent = (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>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</fieldset>
|
||||
</div>{" "}
|
||||
</div>
|
||||
@@ -146,13 +179,12 @@ const RepAgent = (props) => {
|
||||
</button>
|
||||
{/* <a
|
||||
onClick={() => {
|
||||
setRepresentationSubmit(false);
|
||||
setRepresentationSubmit(true);
|
||||
}}
|
||||
className="govuk-button"
|
||||
>
|
||||
Continue
|
||||
Continue ww
|
||||
</a> */}
|
||||
|
||||
<a
|
||||
onClick={() => {
|
||||
setRepresentationCapacity();
|
||||
|
||||
@@ -14,6 +14,12 @@ import {
|
||||
RenderFileUpload,
|
||||
FileUploadField,
|
||||
} from "./representationElements";
|
||||
import {
|
||||
getFormCollectionByID,
|
||||
getThumbnailIconByExtension,
|
||||
bytesToSize,
|
||||
} from "../../utils";
|
||||
|
||||
import { useDropzone } from "react-dropzone";
|
||||
// import {
|
||||
// setRepresentationCapacity,
|
||||
@@ -97,7 +103,6 @@ const RepAppellant = (props) => {
|
||||
aria-describedby={props.name + "-hint"}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="govuk-form-group govuk-!-margin-bottom-9">
|
||||
<FileUploadField
|
||||
name={"representationDocuments"}
|
||||
@@ -112,6 +117,37 @@ const RepAppellant = (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>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</fieldset>
|
||||
</div>{" "}
|
||||
</div>
|
||||
|
||||
@@ -49,6 +49,8 @@ let RepCapacitySelection = (props) => {
|
||||
casesObj={casesObj}
|
||||
caseReference={props.props.caseReference}
|
||||
searchResultsObj={props.props.searchResultsObj}
|
||||
myRepresentations={props.props.myRepresentations}
|
||||
props={props}
|
||||
/>{" "}
|
||||
<div id="rep-details" className="vo_hiddens">
|
||||
<div className="govuk-grid-column-full">
|
||||
|
||||
@@ -4,6 +4,11 @@ import { useRouter } from "next/router";
|
||||
import { useDropzone } from "react-dropzone";
|
||||
import RepComplete from "./representationComplete";
|
||||
import RepLPAQuestionnaireCheck from "./representationLPAQuestionnaireCheck";
|
||||
import {
|
||||
getFormCollectionByID,
|
||||
getThumbnailIconByExtension,
|
||||
bytesToSize,
|
||||
} from "../../utils";
|
||||
|
||||
const RepCompleteSubmit = (props) => {
|
||||
let { t } = useTranslation();
|
||||
@@ -30,54 +35,6 @@ const RepCompleteSubmit = (props) => {
|
||||
|
||||
const repFormData = formObj.representationForm.values;
|
||||
|
||||
const getThumbnailIconByExtension = (blobName) => {
|
||||
let fileType = blobName.slice(blobName.lastIndexOf(".") + 1);
|
||||
|
||||
switch (fileType) {
|
||||
case "html":
|
||||
return "/assets/images/documenttypes/html.png";
|
||||
break;
|
||||
case "txt":
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
case "doc":
|
||||
return "/assets/images/documenttypes/doc.png";
|
||||
break;
|
||||
case "pdf":
|
||||
return "/assets/images/documenttypes/pdf.png";
|
||||
break;
|
||||
case "docx":
|
||||
return "/assets/images/documenttypes/docx.png";
|
||||
break;
|
||||
case "csv":
|
||||
return "/assets/images/documenttypes/csv.png";
|
||||
break;
|
||||
case "xlsx":
|
||||
return "/assets/images/documenttypes/xlsx.png";
|
||||
break;
|
||||
|
||||
case "zip":
|
||||
return "/assets/images/documenttypes/zip.png";
|
||||
break;
|
||||
case "jpeg":
|
||||
case "jpg":
|
||||
return "/assets/images/documenttypes/jpg.png";
|
||||
case "png":
|
||||
return "/assets/images/documenttypes/png.png";
|
||||
break;
|
||||
default:
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
function bytesToSize(bytes) {
|
||||
var sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||
if (bytes == 0) return "0 Byte";
|
||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||
}
|
||||
|
||||
console.log("///////// formObj:", formObj);
|
||||
|
||||
return (
|
||||
@@ -240,7 +197,10 @@ const RepCompleteSubmit = (props) => {
|
||||
</dt>
|
||||
|
||||
<dd className="govuk-summary-list__value">
|
||||
{formObj.representationForm.values
|
||||
{formObj.representationForm.values.hasOwnProperty(
|
||||
"representationDocuments"
|
||||
) &&
|
||||
formObj.representationForm.values
|
||||
.representationDocuments.length > 0
|
||||
? formObj.representationForm.values.representationDocuments.map(
|
||||
(blob, i) => (
|
||||
|
||||
@@ -11,12 +11,24 @@ const RepDetails = (props) => {
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
const { currentType, casesObj, caseReference } = props;
|
||||
const { currentType, casesObj } = props;
|
||||
|
||||
let setCaseDetailsObj = props.searchResultsObj.searchDetailsObj;
|
||||
let { caseReference } = props;
|
||||
|
||||
let setCaseDetailsObj = router.query.hasOwnProperty("state")
|
||||
? router.query.state == "edit"
|
||||
? props.myRepresentations.myRepresentations
|
||||
: props.searchResultsObj.searchDetailsObj
|
||||
: props.searchResultsObj.searchDetailsObj;
|
||||
|
||||
var detailsObj = {};
|
||||
|
||||
caseReference = router.query.hasOwnProperty("state")
|
||||
? router.query.state == "edit"
|
||||
? router.query.case
|
||||
: caseReference
|
||||
: caseReference;
|
||||
|
||||
detailsObj = jsonpath.query(
|
||||
setCaseDetailsObj,
|
||||
'$..[?(@.pinswg_name=="' + caseReference + '")]'
|
||||
@@ -38,9 +50,14 @@ const RepDetails = (props) => {
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{casesObj.appellantApplicant || ""}
|
||||
{detailsObj.firstName +
|
||||
{
|
||||
detailsObj[
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
}
|
||||
{/* {detailsObj.firstName +
|
||||
" " +
|
||||
detailsObj.lastName || "not entered"}
|
||||
detailsObj.lastName || "not entered"} */}
|
||||
</dd>
|
||||
</div>
|
||||
{/* <div className="govuk-summary-list__row">
|
||||
|
||||
@@ -21,6 +21,12 @@ import {
|
||||
parseISO,
|
||||
} from "date-fns";
|
||||
|
||||
import {
|
||||
getFormCollectionByID,
|
||||
getThumbnailIconByExtension,
|
||||
bytesToSize,
|
||||
} from "../../utils";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
|
||||
export const RenderRadioList = ({
|
||||
@@ -740,13 +746,6 @@ export const RenderFileUpload = (field) => {
|
||||
</div>
|
||||
));
|
||||
|
||||
function bytesToSize(bytes) {
|
||||
var sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||
if (bytes == 0) return "0 Byte";
|
||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||
}
|
||||
|
||||
const getThumbnailIcon = (fileObj, fileType) => {
|
||||
switch (fileType) {
|
||||
case "text/html":
|
||||
@@ -784,47 +783,6 @@ export const RenderFileUpload = (field) => {
|
||||
}
|
||||
};
|
||||
|
||||
const getThumbnailIconByExtension = (blobName) => {
|
||||
let fileType = blobName.slice(blobName.lastIndexOf(".") + 1);
|
||||
|
||||
switch (fileType) {
|
||||
case "html":
|
||||
return "/assets/images/documenttypes/html.png";
|
||||
break;
|
||||
case "txt":
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
case "doc":
|
||||
return "/assets/images/documenttypes/doc.png";
|
||||
break;
|
||||
case "pdf":
|
||||
return "/assets/images/documenttypes/pdf.png";
|
||||
break;
|
||||
case "docx":
|
||||
return "/assets/images/documenttypes/docx.png";
|
||||
break;
|
||||
case "csv":
|
||||
return "/assets/images/documenttypes/csv.png";
|
||||
break;
|
||||
case "xlsx":
|
||||
return "/assets/images/documenttypes/xlsx.png";
|
||||
break;
|
||||
|
||||
case "zip":
|
||||
return "/assets/images/documenttypes/zip.png";
|
||||
break;
|
||||
case "jpeg":
|
||||
case "jpg":
|
||||
return "/assets/images/documenttypes/jpg.png";
|
||||
case "png":
|
||||
return "/assets/images/documenttypes/png.png";
|
||||
break;
|
||||
default:
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
const getDocumentType = (docCode) => {
|
||||
switch (docCode) {
|
||||
case "000001":
|
||||
|
||||
@@ -81,13 +81,8 @@ let RepLPA = (props) => {
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
{props.representationTypeValue}
|
||||
{props.procedureTypeValue}
|
||||
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-form-group">
|
||||
{console.log(props)}
|
||||
typeof props.representationTypeValue == "undefined"
|
||||
{props.representationTypeValue != "Questionnaire" ? (
|
||||
<>
|
||||
<p className="govuk-body">
|
||||
@@ -924,24 +919,25 @@ let RepLPA = (props) => {
|
||||
const selector = formValueSelector("representationForm"); // <-- same as form name
|
||||
|
||||
RepLPA = connect((state) => {
|
||||
const representationTypeValue = selector(state, "representationType");
|
||||
const procedureTypeValue = selector(state, "procedureType");
|
||||
const representationType = selector(state, "representationType");
|
||||
const procedureType = selector(state, "procedureType");
|
||||
|
||||
return {
|
||||
procedureTypeValue,
|
||||
representationTypeValue,
|
||||
procedureType,
|
||||
representationType,
|
||||
};
|
||||
})(RepLPA);
|
||||
|
||||
const mapStateToProps = (state, props) => {
|
||||
console.log();
|
||||
return {
|
||||
initialValues: {
|
||||
onBehalfOfLPA:
|
||||
props.props.props.accountDetails.accountDetails[
|
||||
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
},
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
currentView: state.currentView,
|
||||
myRepresentations: state.myRepresentations,
|
||||
initialValues: state.currentView.caseReference.repDetails,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ let RepLPACapacitySelection = (props) => {
|
||||
casesObj={casesObj}
|
||||
caseReference={props.props.caseReference}
|
||||
searchResultsObj={props.props.searchResultsObj}
|
||||
props={props.props}
|
||||
/>{" "}
|
||||
<div id="rep-details" className="vo_hiddens">
|
||||
<div className="govuk-grid-column-full">
|
||||
|
||||
@@ -60,12 +60,13 @@ RepLPAQuestionnaire = connect((state) => {
|
||||
const mapStateToProps = (state, props) => {
|
||||
console.log();
|
||||
return {
|
||||
initialValues: {
|
||||
onBehalfOfLPA:
|
||||
props.props.props.props.accountDetails.accountDetails[
|
||||
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
},
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
currentView: state.currentView,
|
||||
myRepresentations: state.myRepresentations,
|
||||
initialValues: state.currentView.caseReference.repDetails,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -13,7 +13,11 @@ const RepLPADetails = (props) => {
|
||||
|
||||
const { currentType, casesObj, caseReference } = props;
|
||||
|
||||
let setCaseDetailsObj = 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;
|
||||
|
||||
var detailsObj = {};
|
||||
|
||||
|
||||
@@ -777,12 +777,13 @@ RepLPAQuestionnaire = connect((state) => {
|
||||
const mapStateToProps = (state, props) => {
|
||||
console.log();
|
||||
return {
|
||||
initialValues: {
|
||||
onBehalfOfLPA:
|
||||
props.props.props.props.accountDetails.accountDetails[
|
||||
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
},
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
currentView: state.currentView,
|
||||
myRepresentations: state.myRepresentations,
|
||||
initialValues: state.currentView.caseReference.repDetails,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ import {
|
||||
import { setFilesForAppeal } from "../../store/appealType/action";
|
||||
import Link from "next/link";
|
||||
|
||||
import {
|
||||
getFormCollectionByID,
|
||||
getThumbnailIconByExtension,
|
||||
bytesToSize,
|
||||
} from "../utils";
|
||||
|
||||
import {
|
||||
addYears,
|
||||
addMonths,
|
||||
@@ -1309,13 +1315,6 @@ const RenderFileUpload = (field) => {
|
||||
</div>
|
||||
));
|
||||
|
||||
function bytesToSize(bytes) {
|
||||
var sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||
if (bytes == 0) return "0 Byte";
|
||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||
}
|
||||
|
||||
const getThumbnailIcon = (fileObj, fileType) => {
|
||||
switch (fileType) {
|
||||
case "text/html":
|
||||
@@ -1353,47 +1352,6 @@ const RenderFileUpload = (field) => {
|
||||
}
|
||||
};
|
||||
|
||||
const getThumbnailIconByExtension = (blobName) => {
|
||||
let fileType = blobName.slice(blobName.lastIndexOf(".") + 1);
|
||||
|
||||
switch (fileType) {
|
||||
case "html":
|
||||
return "/assets/images/documenttypes/html.png";
|
||||
break;
|
||||
case "txt":
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
case "doc":
|
||||
return "/assets/images/documenttypes/doc.png";
|
||||
break;
|
||||
case "pdf":
|
||||
return "/assets/images/documenttypes/pdf.png";
|
||||
break;
|
||||
case "docx":
|
||||
return "/assets/images/documenttypes/docx.png";
|
||||
break;
|
||||
case "csv":
|
||||
return "/assets/images/documenttypes/csv.png";
|
||||
break;
|
||||
case "xlsx":
|
||||
return "/assets/images/documenttypes/xlsx.png";
|
||||
break;
|
||||
|
||||
case "zip":
|
||||
return "/assets/images/documenttypes/zip.png";
|
||||
break;
|
||||
case "jpeg":
|
||||
case "jpg":
|
||||
return "/assets/images/documenttypes/jpg.png";
|
||||
case "png":
|
||||
return "/assets/images/documenttypes/png.png";
|
||||
break;
|
||||
default:
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
const getDocumentType = (docCode) => {
|
||||
switch (docCode) {
|
||||
case "000001":
|
||||
|
||||
+7
-11
@@ -155,17 +155,13 @@ const MyPortal = (props) => {
|
||||
watchedCases={props.watchedCases}
|
||||
/>
|
||||
)}
|
||||
{isLPA
|
||||
? ""
|
||||
: props.myRepresentations.myRepresentations[
|
||||
"@odata.count"
|
||||
] > 0 && (
|
||||
<MyRepresentations
|
||||
myRepresentations={
|
||||
props.myRepresentations
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{props.myRepresentations.myRepresentations[
|
||||
"@odata.count"
|
||||
] > 0 && (
|
||||
<MyRepresentations
|
||||
myRepresentations={props.myRepresentations}
|
||||
/>
|
||||
)}
|
||||
{isLPA ? "" : <Dns />}
|
||||
|
||||
{/* <YourAccount /> */}
|
||||
|
||||
@@ -130,6 +130,11 @@ const TopThree = (props) => {
|
||||
}
|
||||
};
|
||||
|
||||
const repRaisedDate = (datePart) => {
|
||||
var dateObj = new Date(parseInt(datePart.split("-")[3]));
|
||||
return dateObj.toLocaleString();
|
||||
};
|
||||
|
||||
let topThreeOnlyArr = showTopThreeArr; //.slice(0, 3);
|
||||
Object.keys(topThreeOnlyArr).map((key, index) => {
|
||||
topthreeRow.push(
|
||||
@@ -138,13 +143,14 @@ const TopThree = (props) => {
|
||||
<div className="cardModuleReference">
|
||||
<b>Representation ID:</b>{" "}
|
||||
<Link
|
||||
// href={{
|
||||
// pathname: "/myportal/representation",
|
||||
// query: {
|
||||
// case: showTopThreeArr[key].casereference,
|
||||
// },
|
||||
// }}
|
||||
href="#"
|
||||
href={{
|
||||
pathname: "/myportal/representation",
|
||||
query: {
|
||||
case: showTopThreeArr[key].caseRef,
|
||||
state: "edit",
|
||||
},
|
||||
}}
|
||||
// href="#"
|
||||
>
|
||||
<a
|
||||
className="govuk-link--no-underline"
|
||||
@@ -152,26 +158,13 @@ const TopThree = (props) => {
|
||||
onClick={() => {
|
||||
setCurrentReference({
|
||||
"currentReference":
|
||||
topThreeType != "watchedCases"
|
||||
? topThreeType !=
|
||||
"myRepresentations"
|
||||
? showTopThreeArr[key]
|
||||
.ticketnumber
|
||||
: showTopThreeArr[key]
|
||||
.casereference
|
||||
: showTopThreeArr[key][
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
showTopThreeArr[key].caseRef,
|
||||
"currentType": topThreeType,
|
||||
|
||||
"incidentid": getIncidentId(
|
||||
topThreeType,
|
||||
showTopThreeArr[key]
|
||||
),
|
||||
|
||||
"incidentid":
|
||||
showTopThreeArr[key].incidentID,
|
||||
"appealType":
|
||||
showTopThreeArr[key]
|
||||
.pinswg_appealcasetype,
|
||||
showTopThreeArr[key].appealType,
|
||||
"repDetails": showTopThreeArr[key],
|
||||
});
|
||||
}}
|
||||
>
|
||||
@@ -189,6 +182,16 @@ const TopThree = (props) => {
|
||||
{" "}
|
||||
{showTopThreeArr[key].representationType}
|
||||
</div>
|
||||
<div className="cardModuleReference">
|
||||
<b>Capacity:</b>
|
||||
{" "}
|
||||
{showTopThreeArr[key].representationCapacity}
|
||||
</div>
|
||||
<div className="cardModuleReference">
|
||||
<b>Date raised:</b>
|
||||
{" "}
|
||||
{repRaisedDate(showTopThreeArr[key].repfile_name)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -9,6 +9,11 @@ import { connect } from "react-redux";
|
||||
import Dropzone, { useDropzone } from "react-dropzone";
|
||||
import { uploadFiles } from "../../actions";
|
||||
import { getContainers } from "../../actions/azurestorage";
|
||||
import {
|
||||
getFormCollectionByID,
|
||||
getThumbnailIconByExtension,
|
||||
bytesToSize,
|
||||
} from "../utils";
|
||||
|
||||
const required = (errorMsg) => (value) =>
|
||||
value || typeof value === "number" ? undefined : errorMsg;
|
||||
@@ -119,13 +124,6 @@ const RenderFileUpload = (field) => {
|
||||
</div>
|
||||
));
|
||||
|
||||
function bytesToSize(bytes) {
|
||||
var sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||
if (bytes == 0) return "0 Byte";
|
||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||
}
|
||||
|
||||
const getThumbnailIcon = (fileObj, fileType) => {
|
||||
switch (fileType) {
|
||||
case "text/html":
|
||||
|
||||
@@ -11,6 +11,12 @@ import {
|
||||
setFormComplete,
|
||||
} from "../../store/appealType/action";
|
||||
|
||||
import {
|
||||
getFormCollectionByID,
|
||||
getThumbnailIconByExtension,
|
||||
bytesToSize,
|
||||
} from "../utils";
|
||||
|
||||
let BuildCheckSection = (props) => {
|
||||
useEffect(() => {
|
||||
setFormComplete();
|
||||
@@ -64,54 +70,6 @@ let BuildCheckSection = (props) => {
|
||||
alert(1);
|
||||
};
|
||||
|
||||
function bytesToSize(bytes) {
|
||||
var sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||
if (bytes == 0) return "0 Byte";
|
||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||
}
|
||||
|
||||
const getThumbnailIconByExtension = (blobName) => {
|
||||
let fileType = blobName.slice(blobName.lastIndexOf(".") + 1);
|
||||
|
||||
switch (fileType) {
|
||||
case "html":
|
||||
return "/assets/images/documenttypes/html.png";
|
||||
break;
|
||||
case "txt":
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
case "doc":
|
||||
return "/assets/images/documenttypes/doc.png";
|
||||
break;
|
||||
case "pdf":
|
||||
return "/assets/images/documenttypes/pdf.png";
|
||||
break;
|
||||
case "docx":
|
||||
return "/assets/images/documenttypes/docx.png";
|
||||
break;
|
||||
case "csv":
|
||||
return "/assets/images/documenttypes/csv.png";
|
||||
break;
|
||||
case "xlsx":
|
||||
return "/assets/images/documenttypes/xlsx.png";
|
||||
break;
|
||||
|
||||
case "zip":
|
||||
return "/assets/images/documenttypes/zip.png";
|
||||
break;
|
||||
case "jpeg":
|
||||
case "jpg":
|
||||
return "/assets/images/documenttypes/jpg.png";
|
||||
case "png":
|
||||
return "/assets/images/documenttypes/png.png";
|
||||
break;
|
||||
default:
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="govuk-grid-row" key={1222}>
|
||||
<div className="govuk-grid-column-full">
|
||||
|
||||
@@ -271,24 +271,25 @@ export const finalComments_pdf = ({ docProps }) => {
|
||||
{ flexDirection: "column" },
|
||||
]}
|
||||
>
|
||||
{values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
{values.hasOwnProperty("filesList") &&
|
||||
values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -1328,24 +1328,26 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
|
||||
{ flexDirection: "column" },
|
||||
]}
|
||||
>
|
||||
{values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
{values.hasOwnProperty("filesList") &&
|
||||
values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection:
|
||||
"row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -271,24 +271,25 @@ export const other_pdf = ({ docProps }) => {
|
||||
{ flexDirection: "column" },
|
||||
]}
|
||||
>
|
||||
{values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
{values.hasOwnProperty("filesList") &&
|
||||
values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -271,24 +271,25 @@ export const statement_pdf = ({ docProps }) => {
|
||||
{ flexDirection: "column" },
|
||||
]}
|
||||
>
|
||||
{values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
{values.hasOwnProperty("filesList") &&
|
||||
values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -271,24 +271,25 @@ export const writtenStatement_pdf = ({ docProps }) => {
|
||||
{ flexDirection: "column" },
|
||||
]}
|
||||
>
|
||||
{values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
{values.hasOwnProperty("filesList") &&
|
||||
values.filesList.map(function (p) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
flexDirection: "row",
|
||||
marginBottom: 4,
|
||||
}}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
<Text
|
||||
styles={
|
||||
styles.questionTextMid
|
||||
}
|
||||
>
|
||||
{p.name} - {p.size}
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -369,3 +369,51 @@ export const getTempCaseRef = () => {
|
||||
randomString(6).toUpperCase()
|
||||
);
|
||||
};
|
||||
|
||||
export const getThumbnailIconByExtension = (blobName) => {
|
||||
let fileType = blobName.slice(blobName.lastIndexOf(".") + 1);
|
||||
|
||||
switch (fileType) {
|
||||
case "html":
|
||||
return "/assets/images/documenttypes/html.png";
|
||||
break;
|
||||
case "txt":
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
case "doc":
|
||||
return "/assets/images/documenttypes/doc.png";
|
||||
break;
|
||||
case "pdf":
|
||||
return "/assets/images/documenttypes/pdf.png";
|
||||
break;
|
||||
case "docx":
|
||||
return "/assets/images/documenttypes/docx.png";
|
||||
break;
|
||||
case "csv":
|
||||
return "/assets/images/documenttypes/csv.png";
|
||||
break;
|
||||
case "xlsx":
|
||||
return "/assets/images/documenttypes/xlsx.png";
|
||||
break;
|
||||
|
||||
case "zip":
|
||||
return "/assets/images/documenttypes/zip.png";
|
||||
break;
|
||||
case "jpeg":
|
||||
case "jpg":
|
||||
return "/assets/images/documenttypes/jpg.png";
|
||||
case "png":
|
||||
return "/assets/images/documenttypes/png.png";
|
||||
break;
|
||||
default:
|
||||
return "/assets/images/documenttypes/txt.png";
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
export const bytesToSize = (bytes) => {
|
||||
var sizes = ["Bytes", "KB", "MB", "GB", "TB"];
|
||||
if (bytes == 0) return "0 Byte";
|
||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
return Math.round(bytes / Math.pow(1024, i), 2) + " " + sizes[i];
|
||||
};
|
||||
|
||||
@@ -44,7 +44,7 @@ export default async function ApiProxy(req, res) {
|
||||
// emailReplyToId: emailReplyToId,
|
||||
})
|
||||
.then((response) => {
|
||||
console.log("thisis the response", response);
|
||||
//console.log("thisis the response", response);
|
||||
return res.status(200).json(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
|
||||
@@ -170,7 +170,7 @@ export default function handler(req, res) {
|
||||
case "Land Owner":
|
||||
repCapacity = "LO";
|
||||
break;
|
||||
case "LPA":
|
||||
case "lpa":
|
||||
repCapacity = "LPA";
|
||||
break;
|
||||
|
||||
@@ -207,20 +207,20 @@ export default function handler(req, res) {
|
||||
// code block
|
||||
}
|
||||
|
||||
const repDate = new Date();
|
||||
// const repDate = new Date();
|
||||
|
||||
let day = ("0" + repDate.getDate()).slice(-2);
|
||||
let month = ("0" + (repDate.getMonth() + 1)).slice(-2);
|
||||
let year = repDate.getFullYear();
|
||||
let time =
|
||||
("0" + repDate.getHours()).slice(-2) +
|
||||
"" +
|
||||
("0" + repDate.getMinutes()).slice(-2);
|
||||
// let day = ("0" + repDate.getDate()).slice(-2);
|
||||
// let month = ("0" + (repDate.getMonth() + 1)).slice(-2);
|
||||
// let year = repDate.getFullYear();
|
||||
// let time =
|
||||
// ("0" + repDate.getHours()).slice(-2) +
|
||||
// "" +
|
||||
// ("0" + repDate.getMinutes()).slice(-2);
|
||||
|
||||
let repDateStamp = "";
|
||||
repDateStamp = year + "" + month + day; //+ "-" + time;
|
||||
// let repDateStamp = "";
|
||||
// repDateStamp = year + "" + month + day; //+ "-" + time;
|
||||
|
||||
console.log(repDateStamp);
|
||||
//console.log(reqBodyobj);
|
||||
//if (hashAPIPath(checkquerypath) == "?hash=" + checkHash) {
|
||||
// //createContainer(containerID).then((containerName) => {
|
||||
|
||||
@@ -228,21 +228,21 @@ export default function handler(req, res) {
|
||||
|
||||
console.log(
|
||||
"///////////////////////////////////\n file created: \n" +
|
||||
`tmp/${caseRef}_rep_${repDateStamp}_${repCapacity}_${repRaiser}_${repType}.pdf` +
|
||||
`tmp/${reqBodyobj.repfile_name}.pdf` +
|
||||
"\n/////////////////////////"
|
||||
);
|
||||
|
||||
createRepBlob(req.body, containerID, caseRef);
|
||||
// createRepBlob(req.body, containerID, caseRef);
|
||||
|
||||
ReactPDF.render(
|
||||
<MyDocument docProps={reqBodyobj} />,
|
||||
`tmp/${caseRef}_rep_${repDateStamp}_${repCapacity}_${repRaiser}_${repType}.pdf`
|
||||
`tmp/${reqBodyobj.repfile_name}.pdf`
|
||||
);
|
||||
|
||||
uploadPDFRepFiles(
|
||||
`tmp/${caseRef}_rep_${repDateStamp}_${repCapacity}_${repRaiser}_${repType}.pdf`,
|
||||
`tmp/${reqBodyobj.repfile_name}.pdf`,
|
||||
containerID,
|
||||
caseRef,
|
||||
caseRef + "/" + reqBodyobj.repfile_name,
|
||||
repType
|
||||
);
|
||||
|
||||
@@ -250,11 +250,11 @@ export default function handler(req, res) {
|
||||
|
||||
// then remove from local folder
|
||||
|
||||
// fs.unlinkSync( `tmp/${caseRef}_rep_${repDateStamp}_${repCapacity}_${repRaiser}_${repType}.pdf`,);
|
||||
// fs.unlinkSync( `tmp/${reqBodyobj.repfile_name}.pdf`,);
|
||||
|
||||
return res.status(200).json({
|
||||
data: "success",
|
||||
path: `tmp/${caseRef}_rep_${repDateStamp}_${repCapacity}_${repRaiser}_${repType}.pdf`,
|
||||
path: `tmp/${reqBodyobj.repfile_name}.pdf`,
|
||||
});
|
||||
// } else {
|
||||
// return res.status(400).json();
|
||||
|
||||
@@ -58,7 +58,7 @@ ApiProxy.get(async (req, res) => {
|
||||
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||
const blobObj = await getRepsBlobs(containerName, casefolderID)
|
||||
.then(async (data) => {
|
||||
// console.log("----------xxxxxx------", data);
|
||||
console.log("----------xxxxxx------", data);
|
||||
let result = await downloadAllRepsFiles(containerName, data);
|
||||
return res.status(200).json(result);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user