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);
|
const containerClient = new ContainerClient(sasUrl);
|
||||||
|
|
||||||
formContent = JSON.parse(formContent);
|
formContent = JSON.parse(formContent);
|
||||||
let caseID = "";
|
|
||||||
|
|
||||||
caseID = _.has(formContent, "pinswg_name")
|
|
||||||
? formContent.pinswg_name
|
|
||||||
: caseref;
|
|
||||||
|
|
||||||
const content = JSON.stringify(formContent);
|
const content = JSON.stringify(formContent);
|
||||||
|
|
||||||
//console.log(content);
|
//console.log(content);
|
||||||
const blobName = caseref + "/" + caseID + "_rep.json";
|
const blobName = caseref + "/" + formContent.repfile_name + "_rep.json";
|
||||||
|
|
||||||
console.log("blobName:", blobName);
|
console.log("blobName:", blobName);
|
||||||
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
||||||
@@ -297,7 +292,7 @@ export const createRepBlob = async (formContent, containerName, caseref) => {
|
|||||||
|
|
||||||
const tags = {
|
const tags = {
|
||||||
containerid: containerName,
|
containerid: containerName,
|
||||||
caseID: caseID,
|
caseID: formContent.caseRef,
|
||||||
blobType: "Representation",
|
blobType: "Representation",
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -378,13 +373,18 @@ export const uploadFile = async (formContent, containerName, foldername) => {
|
|||||||
files[prop][0].path,
|
files[prop][0].path,
|
||||||
files[prop].size
|
files[prop].size
|
||||||
);
|
);
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"////////////////////////\nfile name:",
|
||||||
|
files[prop][0].fieldName,
|
||||||
|
"\n////////////////////////////"
|
||||||
|
);
|
||||||
|
|
||||||
const tags = {
|
const tags = {
|
||||||
containerid: containerName,
|
containerid: containerName,
|
||||||
caseID: foldername,
|
caseID: foldername.split("/")[0],
|
||||||
documentType: files[prop][0].fieldName.slice(
|
documentType: files[prop][0].fieldName.split(".")[1],
|
||||||
0,
|
blobType: "RepresentationFile",
|
||||||
files[prop][0].fieldName.indexOf("_")
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
const withTags = await blockBlobClient.setTags(tags);
|
const withTags = await blockBlobClient.setTags(tags);
|
||||||
const withMeta = await blockBlobClient.setMetadata(tags);
|
const withMeta = await blockBlobClient.setMetadata(tags);
|
||||||
@@ -410,21 +410,17 @@ export const uploadRepFiles = async (
|
|||||||
console.log(...formContent);
|
console.log(...formContent);
|
||||||
console.log("rep files...", files, Object.keys(files).length, foldername);
|
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];
|
||||||
const blobName = foldername + formContent.split("tmp/")[1];
|
|
||||||
|
|
||||||
console.log(blobName);
|
|
||||||
|
|
||||||
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
||||||
const uploadBlobResponse = await blockBlobClient.uploadFile(formContent);
|
const uploadBlobResponse = await blockBlobClient.uploadFile(formContent);
|
||||||
const tags = {
|
const tags = {
|
||||||
containerid: containerName,
|
containerid: containerName,
|
||||||
caseID: foldername,
|
caseID: formContent.split("tmp/")[0],
|
||||||
documentType: "rep content",
|
documentType: "Rep docs",
|
||||||
};
|
};
|
||||||
console.log(tags);
|
console.log(tags);
|
||||||
// const withTags = await blockBlobClient.setTags(tags);
|
const withTags = await blockBlobClient.setTags(tags);
|
||||||
// const withMeta = await blockBlobClient.setMetadata(tags);
|
const withMeta = await blockBlobClient.setMetadata(tags);
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`Uploaded block blob ${files} successfully`,
|
`Uploaded block blob ${files} successfully`,
|
||||||
@@ -432,11 +428,10 @@ export const uploadRepFiles = async (
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const uploadPDFRepFiles = async (
|
export const uploadPDFCaseFiles = async (
|
||||||
formContent,
|
formContent,
|
||||||
containerName,
|
containerName,
|
||||||
foldername,
|
foldername
|
||||||
repType
|
|
||||||
) => {
|
) => {
|
||||||
const containerToken = await createContainerSas(containerName);
|
const containerToken = await createContainerSas(containerName);
|
||||||
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
|
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
|
||||||
@@ -446,28 +441,20 @@ export const uploadPDFRepFiles = async (
|
|||||||
|
|
||||||
console.log(formContent, containerName, foldername);
|
console.log(formContent, containerName, foldername);
|
||||||
console.log(
|
console.log(
|
||||||
"rep pdf files...",
|
"case pdf files...",
|
||||||
files,
|
files,
|
||||||
Object.keys(files).length,
|
Object.keys(files).length,
|
||||||
foldername
|
foldername
|
||||||
);
|
);
|
||||||
|
|
||||||
// console.log(`files[${prop}] = ${files[prop][0].size}`);
|
const blobName = foldername + "/" + formContent.split("tmp/")[1];
|
||||||
console.log(foldername + "/files/" + formContent.split("tmp/")[1]);
|
|
||||||
|
|
||||||
const blobName = foldername + "/files/" + formContent.split("tmp/")[1];
|
|
||||||
|
|
||||||
console.log(blobName);
|
|
||||||
|
|
||||||
console.log(blobName);
|
|
||||||
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
||||||
const uploadBlobResponse = await blockBlobClient.uploadFile(formContent);
|
const uploadBlobResponse = await blockBlobClient.uploadFile(formContent);
|
||||||
|
|
||||||
const tags = {
|
const tags = {
|
||||||
containerid: containerName,
|
containerid: containerName,
|
||||||
caseID: foldername,
|
caseID: foldername.split("/")[0],
|
||||||
documentType: repType,
|
blobType: "AppealPDF",
|
||||||
blobType: "RepresentationPDF",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("the tags:", tags);
|
console.log("the tags:", tags);
|
||||||
@@ -481,7 +468,7 @@ export const uploadPDFRepFiles = async (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const downloadFile = async (containerName, blobName) => {
|
export const downloadFile = async (containerName, blobName) => {
|
||||||
//console.log.apply(containerName, blobName);
|
//console.log(containerName, blobName);
|
||||||
const containerToken = await createContainerSas(containerName);
|
const containerToken = await createContainerSas(containerName);
|
||||||
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
|
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
|
||||||
const containerClient = new ContainerClient(sasUrl);
|
const containerClient = new ContainerClient(sasUrl);
|
||||||
@@ -497,7 +484,7 @@ export const downloadProgressFile = async (
|
|||||||
blobName,
|
blobName,
|
||||||
casefolderID
|
casefolderID
|
||||||
) => {
|
) => {
|
||||||
//console.log.apply(containerName, blobName);
|
console.log(containerName, blobName);
|
||||||
|
|
||||||
const containerToken = await createContainerSas(containerName);
|
const containerToken = await createContainerSas(containerName);
|
||||||
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
|
const sasUrl = `${STORAGE_PATH}/${containerName}?${containerToken}`;
|
||||||
@@ -624,7 +611,7 @@ export const downloadAllRepsFiles = async (containerName, repsBlobObj) => {
|
|||||||
|
|
||||||
repBlobObj = JSON.parse(repBlobObj);
|
repBlobObj = JSON.parse(repBlobObj);
|
||||||
|
|
||||||
repBlobObj["casereference"] = repsBlobObj[prop].name.split("/")[0];
|
repBlobObj["casereference"] = repsBlobObj[prop].name.split("/")[1];
|
||||||
|
|
||||||
// repBlobObj = JSON.stringify(repBlobObj);
|
// repBlobObj = JSON.stringify(repBlobObj);
|
||||||
|
|
||||||
@@ -682,6 +669,17 @@ export const getCaseBlob = async (
|
|||||||
content,
|
content,
|
||||||
Buffer.byteLength(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;
|
return blobName;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -699,22 +697,22 @@ export const getProgressBlobs = async (containerName, caseReference) => {
|
|||||||
blobCount++;
|
blobCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log(
|
console.log(
|
||||||
// "this is the casefolder and blobcount:",
|
"this is the casefolder and blobcount:",
|
||||||
// caseReference,
|
caseReference,
|
||||||
// blobCount
|
blobCount
|
||||||
// );
|
);
|
||||||
|
|
||||||
let blobObj = [];
|
let blobObj = [];
|
||||||
for await (const blob of containerClient.listBlobsFlat({
|
for await (const blob of containerClient.listBlobsFlat({
|
||||||
prefix: caseReference + "/" + caseReference + "_appeal.json",
|
prefix: caseReference + "/" + caseReference + "_appeal.json",
|
||||||
})) {
|
})) {
|
||||||
//console.log("getProgressBlobs in here");
|
console.log("getProgressBlobs in here", blob.name.split("/"));
|
||||||
blobObj.push({
|
blobObj.push({
|
||||||
"name": blob.name.split("/")[1],
|
"name": blob.name.split("/")[1],
|
||||||
"path": blob.name,
|
"path": blob.name,
|
||||||
"versionId": blob.versionId,
|
"versionId": blob.versionId,
|
||||||
"caseObj": caseReference + "/" + caseReference + "_case.json",
|
"caseObj": caseReference + "/case/" + caseReference + "_case.json",
|
||||||
"isCurrentVersion": blob.isCurrentVersion,
|
"isCurrentVersion": blob.isCurrentVersion,
|
||||||
"contentLength": blob.properties.contentLength,
|
"contentLength": blob.properties.contentLength,
|
||||||
"contentType": blob.contentType,
|
"contentType": blob.contentType,
|
||||||
@@ -771,16 +769,16 @@ export const getAllProgressBlobs = async (containerName) => {
|
|||||||
blobObj.push({
|
blobObj.push({
|
||||||
"name": blob.name.split("/")[1],
|
"name": blob.name.split("/")[1],
|
||||||
"path": blob.name,
|
"path": blob.name,
|
||||||
"versionId": blob.versionId,
|
//"versionId": blob.versionId,
|
||||||
"caseObj":
|
"caseObj":
|
||||||
blob.name.split("/")[0] +
|
blob.name.split("/")[0] +
|
||||||
"/case/" +
|
"/case/" +
|
||||||
blob.name.split("/")[0] +
|
blob.name.split("/")[0] +
|
||||||
"_case.json",
|
"_case.json",
|
||||||
"isCurrentVersion": blob.isCurrentVersion,
|
// "isCurrentVersion": blob.isCurrentVersion,
|
||||||
"contentLength": blob.properties.contentLength,
|
// "contentLength": blob.properties.contentLength,
|
||||||
"contentType": blob.contentType,
|
// "contentType": blob.contentType,
|
||||||
"lastModified": blob.properties.lastModified,
|
// "lastModified": blob.properties.lastModified,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -810,16 +808,26 @@ export const getRepsBlobs = async (containerName) => {
|
|||||||
blobCount
|
blobCount
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const listOptions = {
|
||||||
|
includeMetadata: true,
|
||||||
|
includeSnapshots: false,
|
||||||
|
includeTags: true,
|
||||||
|
includeVersions: true,
|
||||||
|
};
|
||||||
|
|
||||||
let blobObj = [];
|
let blobObj = [];
|
||||||
for await (const blob of containerClient.findBlobsByTags(
|
for await (const blob of containerClient.findBlobsByTags(
|
||||||
"blobType='Representation'"
|
"blobType='Representation'",
|
||||||
|
listOptions
|
||||||
)) {
|
)) {
|
||||||
|
const blobClient = await containerClient.getBlobClient(blob.name);
|
||||||
console.log(blob);
|
console.log(blob);
|
||||||
blob.name.split("/")[1].indexOf("_rep.json") > 0 &&
|
blob.name.split("/")[2].indexOf("_rep.json") > 0 &&
|
||||||
blob.name.split("/")[1].indexOf("undefined") < 0 &&
|
blob.name.split("/")[2].indexOf("undefined") < 0 &&
|
||||||
blobObj.push({
|
blobObj.push({
|
||||||
"name": blob.name.split("/")[1],
|
"name": blob.name.split("/")[2],
|
||||||
"path": blob.name,
|
"path": blob.name,
|
||||||
|
"size": blobClient.getProperties().contentLength,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1497,6 +1497,20 @@ export const downloadBlob = (containerName, blobName) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getProgressFromBlob = async (containerName, casereference) => {
|
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 {
|
try {
|
||||||
const res = await axios.get(
|
const res = await axios.get(
|
||||||
BASE_URL +
|
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,
|
handleSubmit,
|
||||||
setRepresentationSubmitConfirmation,
|
setRepresentationSubmitConfirmation,
|
||||||
setRepresentationMessageSent,
|
setRepresentationMessageSent,
|
||||||
|
initialValues,
|
||||||
} = props;
|
} = props;
|
||||||
const formObj = props.props.form;
|
const formObj = props.props.form;
|
||||||
let setCaseQueryObj = props[currentType] || {};
|
let setCaseQueryObj = props[currentType] || {};
|
||||||
@@ -156,6 +157,7 @@ let MakeRepresentation = (props) => {
|
|||||||
currentView.representationCapacity,
|
currentView.representationCapacity,
|
||||||
_.isEmpty(currentView.representationCapacity)
|
_.isEmpty(currentView.representationCapacity)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isLPA && _.isEmpty(currentView.representationCapacity)) {
|
if (isLPA && _.isEmpty(currentView.representationCapacity)) {
|
||||||
return (
|
return (
|
||||||
<RepLPACapacitySelection
|
<RepLPACapacitySelection
|
||||||
@@ -246,7 +248,7 @@ let MakeRepresentation = (props) => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "interestedparty/person":
|
case "interestedparty":
|
||||||
// setRepresentationCapacity("interestedpartyperson");
|
// setRepresentationCapacity("interestedpartyperson");
|
||||||
return (
|
return (
|
||||||
<RepInterestedPartyPerson
|
<RepInterestedPartyPerson
|
||||||
@@ -335,7 +337,7 @@ let MakeRepresentation = (props) => {
|
|||||||
case "Land Owner":
|
case "Land Owner":
|
||||||
repType = "LO";
|
repType = "LO";
|
||||||
break;
|
break;
|
||||||
case "LPA":
|
case "lpa":
|
||||||
repType = "LPA";
|
repType = "LPA";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -344,19 +346,22 @@ let MakeRepresentation = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object.assign(updateBody, {
|
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":
|
"pinswg_name":
|
||||||
year +
|
props.props.currentView.caseReference.currentReference,
|
||||||
"-" +
|
|
||||||
month +
|
|
||||||
"-" +
|
|
||||||
day +
|
|
||||||
"-" +
|
|
||||||
time +
|
|
||||||
"-" +
|
|
||||||
repType +
|
|
||||||
"-REP" +
|
|
||||||
"_" +
|
|
||||||
props.props.accountDetails.accountDetails.lastname,
|
|
||||||
"containerID": props.props.accountDetails.containerID,
|
"containerID": props.props.accountDetails.containerID,
|
||||||
"appealType": props.props.currentView.caseReference.appealType,
|
"appealType": props.props.currentView.caseReference.appealType,
|
||||||
"incidentID": props.props.currentView.caseReference.incidentid,
|
"incidentID": props.props.currentView.caseReference.incidentid,
|
||||||
@@ -408,7 +413,15 @@ let MakeRepresentation = (props) => {
|
|||||||
|
|
||||||
console.log("attached docs: - ", buildFileArray);
|
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 = {};
|
var detailsObj = {};
|
||||||
|
|
||||||
@@ -438,6 +451,20 @@ let MakeRepresentation = (props) => {
|
|||||||
detailsObj.pinswg_siteaddresstown +
|
detailsObj.pinswg_siteaddresstown +
|
||||||
" " +
|
" " +
|
||||||
detailsObj.pinswg_siteaddresspostcode,
|
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);
|
console.log(values);
|
||||||
currentView.representationSubmit != true
|
currentView.representationSubmit != true
|
||||||
@@ -455,10 +482,14 @@ let MakeRepresentation = (props) => {
|
|||||||
console.log("has errors:", props.invalid),
|
console.log("has errors:", props.invalid),
|
||||||
props.invalid == false &&
|
props.invalid == false &&
|
||||||
updateRepresentation(values, false, false),
|
updateRepresentation(values, false, false),
|
||||||
values.representationDocuments.map((Blob) =>
|
values.hasOwnProperty("representationDocuments") &&
|
||||||
buildFileArray.push({ "name": Blob.name, "size": Blob.size })
|
(values.representationDocuments.map((Blob) =>
|
||||||
),
|
buildFileArray.push({
|
||||||
Object.assign(values, { "filesList": buildFileArray }),
|
"name": Blob.name,
|
||||||
|
"size": Blob.size,
|
||||||
|
})
|
||||||
|
),
|
||||||
|
Object.assign(values, { "filesList": buildFileArray })),
|
||||||
generateRepPDF(
|
generateRepPDF(
|
||||||
values,
|
values,
|
||||||
props.props.accountDetails.containerID,
|
props.props.accountDetails.containerID,
|
||||||
@@ -495,7 +526,7 @@ let MakeRepresentation = (props) => {
|
|||||||
dataObj,
|
dataObj,
|
||||||
fileListObj,
|
fileListObj,
|
||||||
values.containerID,
|
values.containerID,
|
||||||
props.caseReference
|
props.caseReference + "/" + dataObj.repfile_name
|
||||||
).then((data) => {
|
).then((data) => {
|
||||||
//console.log("hello", data);
|
//console.log("hello", data);
|
||||||
|
|
||||||
@@ -507,9 +538,21 @@ let MakeRepresentation = (props) => {
|
|||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
"what is representationSubmit state: " +
|
"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 (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||||
@@ -567,12 +610,16 @@ let MakeRepresentation = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
|
console.log("\\\\\\\\\\\\\\\\\\\\\\\\\\\\/nin map state", state);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
search: state.search,
|
search: state.search,
|
||||||
searchResultsObj: state.searchResultsObj,
|
searchResultsObj: state.searchResultsObj,
|
||||||
formData: state.formData,
|
formData: state.formData,
|
||||||
appealType: state.appealType,
|
appealType: state.appealType,
|
||||||
currentView: state.currentView,
|
currentView: state.currentView,
|
||||||
|
myRepresentations: state.myRepresentations,
|
||||||
|
initialValues: state.currentView.caseReference.repDetails,
|
||||||
//form: state.form,
|
//form: state.form,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -610,5 +657,6 @@ export default connect(
|
|||||||
reduxForm({
|
reduxForm({
|
||||||
form: "representationForm",
|
form: "representationForm",
|
||||||
destroyOnUnmount: false,
|
destroyOnUnmount: false,
|
||||||
|
enableReinitialize: true,
|
||||||
})(MakeRepresentation)
|
})(MakeRepresentation)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { connect } from "react-redux";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import useTranslation from "next-translate/useTranslation";
|
import useTranslation from "next-translate/useTranslation";
|
||||||
import { Field, reduxForm } from "redux-form";
|
import { Field, reduxForm } from "redux-form";
|
||||||
@@ -12,9 +13,11 @@ import {
|
|||||||
FileUploadField,
|
FileUploadField,
|
||||||
} from "./representationElements";
|
} from "./representationElements";
|
||||||
import {
|
import {
|
||||||
setRepresentationCapacity,
|
getFormCollectionByID,
|
||||||
setRepresentationSubmit,
|
getThumbnailIconByExtension,
|
||||||
} from "../../../store/currentView/action";
|
bytesToSize,
|
||||||
|
} from "../../utils";
|
||||||
|
|
||||||
import { useDropzone } from "react-dropzone";
|
import { useDropzone } from "react-dropzone";
|
||||||
|
|
||||||
const RepAgent = (props) => {
|
const RepAgent = (props) => {
|
||||||
@@ -117,7 +120,6 @@ const RepAgent = (props) => {
|
|||||||
aria-describedby={props.name + "-hint"}
|
aria-describedby={props.name + "-hint"}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-form-group govuk-!-margin-bottom-9">
|
<div className="govuk-form-group govuk-!-margin-bottom-9">
|
||||||
<FileUploadField
|
<FileUploadField
|
||||||
name={"representationDocuments"}
|
name={"representationDocuments"}
|
||||||
@@ -132,6 +134,37 @@ const RepAgent = (props) => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</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>
|
</fieldset>
|
||||||
</div>{" "}
|
</div>{" "}
|
||||||
</div>
|
</div>
|
||||||
@@ -146,13 +179,12 @@ const RepAgent = (props) => {
|
|||||||
</button>
|
</button>
|
||||||
{/* <a
|
{/* <a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRepresentationSubmit(false);
|
setRepresentationSubmit(true);
|
||||||
}}
|
}}
|
||||||
className="govuk-button"
|
className="govuk-button"
|
||||||
>
|
>
|
||||||
Continue
|
Continue ww
|
||||||
</a> */}
|
</a> */}
|
||||||
|
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setRepresentationCapacity();
|
setRepresentationCapacity();
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ import {
|
|||||||
RenderFileUpload,
|
RenderFileUpload,
|
||||||
FileUploadField,
|
FileUploadField,
|
||||||
} from "./representationElements";
|
} from "./representationElements";
|
||||||
|
import {
|
||||||
|
getFormCollectionByID,
|
||||||
|
getThumbnailIconByExtension,
|
||||||
|
bytesToSize,
|
||||||
|
} from "../../utils";
|
||||||
|
|
||||||
import { useDropzone } from "react-dropzone";
|
import { useDropzone } from "react-dropzone";
|
||||||
// import {
|
// import {
|
||||||
// setRepresentationCapacity,
|
// setRepresentationCapacity,
|
||||||
@@ -97,7 +103,6 @@ const RepAppellant = (props) => {
|
|||||||
aria-describedby={props.name + "-hint"}
|
aria-describedby={props.name + "-hint"}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="govuk-form-group govuk-!-margin-bottom-9">
|
<div className="govuk-form-group govuk-!-margin-bottom-9">
|
||||||
<FileUploadField
|
<FileUploadField
|
||||||
name={"representationDocuments"}
|
name={"representationDocuments"}
|
||||||
@@ -112,6 +117,37 @@ const RepAppellant = (props) => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</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>
|
</fieldset>
|
||||||
</div>{" "}
|
</div>{" "}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ let RepCapacitySelection = (props) => {
|
|||||||
casesObj={casesObj}
|
casesObj={casesObj}
|
||||||
caseReference={props.props.caseReference}
|
caseReference={props.props.caseReference}
|
||||||
searchResultsObj={props.props.searchResultsObj}
|
searchResultsObj={props.props.searchResultsObj}
|
||||||
|
myRepresentations={props.props.myRepresentations}
|
||||||
|
props={props}
|
||||||
/>{" "}
|
/>{" "}
|
||||||
<div id="rep-details" className="vo_hiddens">
|
<div id="rep-details" className="vo_hiddens">
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ import { useRouter } from "next/router";
|
|||||||
import { useDropzone } from "react-dropzone";
|
import { useDropzone } from "react-dropzone";
|
||||||
import RepComplete from "./representationComplete";
|
import RepComplete from "./representationComplete";
|
||||||
import RepLPAQuestionnaireCheck from "./representationLPAQuestionnaireCheck";
|
import RepLPAQuestionnaireCheck from "./representationLPAQuestionnaireCheck";
|
||||||
|
import {
|
||||||
|
getFormCollectionByID,
|
||||||
|
getThumbnailIconByExtension,
|
||||||
|
bytesToSize,
|
||||||
|
} from "../../utils";
|
||||||
|
|
||||||
const RepCompleteSubmit = (props) => {
|
const RepCompleteSubmit = (props) => {
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
@@ -30,54 +35,6 @@ const RepCompleteSubmit = (props) => {
|
|||||||
|
|
||||||
const repFormData = formObj.representationForm.values;
|
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);
|
console.log("///////// formObj:", formObj);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -240,7 +197,10 @@ const RepCompleteSubmit = (props) => {
|
|||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{formObj.representationForm.values
|
{formObj.representationForm.values.hasOwnProperty(
|
||||||
|
"representationDocuments"
|
||||||
|
) &&
|
||||||
|
formObj.representationForm.values
|
||||||
.representationDocuments.length > 0
|
.representationDocuments.length > 0
|
||||||
? formObj.representationForm.values.representationDocuments.map(
|
? formObj.representationForm.values.representationDocuments.map(
|
||||||
(blob, i) => (
|
(blob, i) => (
|
||||||
|
|||||||
@@ -11,12 +11,24 @@ const RepDetails = (props) => {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { locale } = router;
|
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 = {};
|
var detailsObj = {};
|
||||||
|
|
||||||
|
caseReference = router.query.hasOwnProperty("state")
|
||||||
|
? router.query.state == "edit"
|
||||||
|
? router.query.case
|
||||||
|
: caseReference
|
||||||
|
: caseReference;
|
||||||
|
|
||||||
detailsObj = jsonpath.query(
|
detailsObj = jsonpath.query(
|
||||||
setCaseDetailsObj,
|
setCaseDetailsObj,
|
||||||
'$..[?(@.pinswg_name=="' + caseReference + '")]'
|
'$..[?(@.pinswg_name=="' + caseReference + '")]'
|
||||||
@@ -38,9 +50,14 @@ const RepDetails = (props) => {
|
|||||||
</dt>
|
</dt>
|
||||||
<dd className="govuk-summary-list__value">
|
<dd className="govuk-summary-list__value">
|
||||||
{casesObj.appellantApplicant || ""}
|
{casesObj.appellantApplicant || ""}
|
||||||
{detailsObj.firstName +
|
{
|
||||||
|
detailsObj[
|
||||||
|
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
{/* {detailsObj.firstName +
|
||||||
" " +
|
" " +
|
||||||
detailsObj.lastName || "not entered"}
|
detailsObj.lastName || "not entered"} */}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
{/* <div className="govuk-summary-list__row">
|
{/* <div className="govuk-summary-list__row">
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ import {
|
|||||||
parseISO,
|
parseISO,
|
||||||
} from "date-fns";
|
} from "date-fns";
|
||||||
|
|
||||||
|
import {
|
||||||
|
getFormCollectionByID,
|
||||||
|
getThumbnailIconByExtension,
|
||||||
|
bytesToSize,
|
||||||
|
} from "../../utils";
|
||||||
|
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
|
||||||
export const RenderRadioList = ({
|
export const RenderRadioList = ({
|
||||||
@@ -740,13 +746,6 @@ export const RenderFileUpload = (field) => {
|
|||||||
</div>
|
</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) => {
|
const getThumbnailIcon = (fileObj, fileType) => {
|
||||||
switch (fileType) {
|
switch (fileType) {
|
||||||
case "text/html":
|
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) => {
|
const getDocumentType = (docCode) => {
|
||||||
switch (docCode) {
|
switch (docCode) {
|
||||||
case "000001":
|
case "000001":
|
||||||
|
|||||||
@@ -81,13 +81,8 @@ let RepLPA = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
</div> */}
|
</div> */}
|
||||||
|
|
||||||
{props.representationTypeValue}
|
|
||||||
{props.procedureTypeValue}
|
|
||||||
|
|
||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-form-group">
|
<div className="govuk-form-group">
|
||||||
{console.log(props)}
|
|
||||||
typeof props.representationTypeValue == "undefined"
|
|
||||||
{props.representationTypeValue != "Questionnaire" ? (
|
{props.representationTypeValue != "Questionnaire" ? (
|
||||||
<>
|
<>
|
||||||
<p className="govuk-body">
|
<p className="govuk-body">
|
||||||
@@ -924,24 +919,25 @@ let RepLPA = (props) => {
|
|||||||
const selector = formValueSelector("representationForm"); // <-- same as form name
|
const selector = formValueSelector("representationForm"); // <-- same as form name
|
||||||
|
|
||||||
RepLPA = connect((state) => {
|
RepLPA = connect((state) => {
|
||||||
const representationTypeValue = selector(state, "representationType");
|
const representationType = selector(state, "representationType");
|
||||||
const procedureTypeValue = selector(state, "procedureType");
|
const procedureType = selector(state, "procedureType");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
procedureTypeValue,
|
procedureType,
|
||||||
representationTypeValue,
|
representationType,
|
||||||
};
|
};
|
||||||
})(RepLPA);
|
})(RepLPA);
|
||||||
|
|
||||||
const mapStateToProps = (state, props) => {
|
const mapStateToProps = (state, props) => {
|
||||||
console.log();
|
console.log();
|
||||||
return {
|
return {
|
||||||
initialValues: {
|
search: state.search,
|
||||||
onBehalfOfLPA:
|
searchResultsObj: state.searchResultsObj,
|
||||||
props.props.props.accountDetails.accountDetails[
|
formData: state.formData,
|
||||||
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
|
appealType: state.appealType,
|
||||||
],
|
currentView: state.currentView,
|
||||||
},
|
myRepresentations: state.myRepresentations,
|
||||||
|
initialValues: state.currentView.caseReference.repDetails,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ let RepLPACapacitySelection = (props) => {
|
|||||||
casesObj={casesObj}
|
casesObj={casesObj}
|
||||||
caseReference={props.props.caseReference}
|
caseReference={props.props.caseReference}
|
||||||
searchResultsObj={props.props.searchResultsObj}
|
searchResultsObj={props.props.searchResultsObj}
|
||||||
|
props={props.props}
|
||||||
/>{" "}
|
/>{" "}
|
||||||
<div id="rep-details" className="vo_hiddens">
|
<div id="rep-details" className="vo_hiddens">
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
|
|||||||
@@ -60,12 +60,13 @@ RepLPAQuestionnaire = connect((state) => {
|
|||||||
const mapStateToProps = (state, props) => {
|
const mapStateToProps = (state, props) => {
|
||||||
console.log();
|
console.log();
|
||||||
return {
|
return {
|
||||||
initialValues: {
|
search: state.search,
|
||||||
onBehalfOfLPA:
|
searchResultsObj: state.searchResultsObj,
|
||||||
props.props.props.props.accountDetails.accountDetails[
|
formData: state.formData,
|
||||||
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
|
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;
|
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 = {};
|
var detailsObj = {};
|
||||||
|
|
||||||
|
|||||||
@@ -777,12 +777,13 @@ RepLPAQuestionnaire = connect((state) => {
|
|||||||
const mapStateToProps = (state, props) => {
|
const mapStateToProps = (state, props) => {
|
||||||
console.log();
|
console.log();
|
||||||
return {
|
return {
|
||||||
initialValues: {
|
search: state.search,
|
||||||
onBehalfOfLPA:
|
searchResultsObj: state.searchResultsObj,
|
||||||
props.props.props.props.accountDetails.accountDetails[
|
formData: state.formData,
|
||||||
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
|
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 { setFilesForAppeal } from "../../store/appealType/action";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
||||||
|
import {
|
||||||
|
getFormCollectionByID,
|
||||||
|
getThumbnailIconByExtension,
|
||||||
|
bytesToSize,
|
||||||
|
} from "../utils";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
addYears,
|
addYears,
|
||||||
addMonths,
|
addMonths,
|
||||||
@@ -1309,13 +1315,6 @@ const RenderFileUpload = (field) => {
|
|||||||
</div>
|
</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) => {
|
const getThumbnailIcon = (fileObj, fileType) => {
|
||||||
switch (fileType) {
|
switch (fileType) {
|
||||||
case "text/html":
|
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) => {
|
const getDocumentType = (docCode) => {
|
||||||
switch (docCode) {
|
switch (docCode) {
|
||||||
case "000001":
|
case "000001":
|
||||||
|
|||||||
+7
-11
@@ -155,17 +155,13 @@ const MyPortal = (props) => {
|
|||||||
watchedCases={props.watchedCases}
|
watchedCases={props.watchedCases}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{isLPA
|
{props.myRepresentations.myRepresentations[
|
||||||
? ""
|
"@odata.count"
|
||||||
: props.myRepresentations.myRepresentations[
|
] > 0 && (
|
||||||
"@odata.count"
|
<MyRepresentations
|
||||||
] > 0 && (
|
myRepresentations={props.myRepresentations}
|
||||||
<MyRepresentations
|
/>
|
||||||
myRepresentations={
|
)}
|
||||||
props.myRepresentations
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{isLPA ? "" : <Dns />}
|
{isLPA ? "" : <Dns />}
|
||||||
|
|
||||||
{/* <YourAccount /> */}
|
{/* <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);
|
let topThreeOnlyArr = showTopThreeArr; //.slice(0, 3);
|
||||||
Object.keys(topThreeOnlyArr).map((key, index) => {
|
Object.keys(topThreeOnlyArr).map((key, index) => {
|
||||||
topthreeRow.push(
|
topthreeRow.push(
|
||||||
@@ -138,13 +143,14 @@ const TopThree = (props) => {
|
|||||||
<div className="cardModuleReference">
|
<div className="cardModuleReference">
|
||||||
<b>Representation ID:</b>{" "}
|
<b>Representation ID:</b>{" "}
|
||||||
<Link
|
<Link
|
||||||
// href={{
|
href={{
|
||||||
// pathname: "/myportal/representation",
|
pathname: "/myportal/representation",
|
||||||
// query: {
|
query: {
|
||||||
// case: showTopThreeArr[key].casereference,
|
case: showTopThreeArr[key].caseRef,
|
||||||
// },
|
state: "edit",
|
||||||
// }}
|
},
|
||||||
href="#"
|
}}
|
||||||
|
// href="#"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
className="govuk-link--no-underline"
|
className="govuk-link--no-underline"
|
||||||
@@ -152,26 +158,13 @@ const TopThree = (props) => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setCurrentReference({
|
setCurrentReference({
|
||||||
"currentReference":
|
"currentReference":
|
||||||
topThreeType != "watchedCases"
|
showTopThreeArr[key].caseRef,
|
||||||
? topThreeType !=
|
|
||||||
"myRepresentations"
|
|
||||||
? showTopThreeArr[key]
|
|
||||||
.ticketnumber
|
|
||||||
: showTopThreeArr[key]
|
|
||||||
.casereference
|
|
||||||
: showTopThreeArr[key][
|
|
||||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
|
||||||
],
|
|
||||||
"currentType": topThreeType,
|
"currentType": topThreeType,
|
||||||
|
"incidentid":
|
||||||
"incidentid": getIncidentId(
|
showTopThreeArr[key].incidentID,
|
||||||
topThreeType,
|
|
||||||
showTopThreeArr[key]
|
|
||||||
),
|
|
||||||
|
|
||||||
"appealType":
|
"appealType":
|
||||||
showTopThreeArr[key]
|
showTopThreeArr[key].appealType,
|
||||||
.pinswg_appealcasetype,
|
"repDetails": showTopThreeArr[key],
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -189,6 +182,16 @@ const TopThree = (props) => {
|
|||||||
{" "}
|
{" "}
|
||||||
{showTopThreeArr[key].representationType}
|
{showTopThreeArr[key].representationType}
|
||||||
</div>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ import { connect } from "react-redux";
|
|||||||
import Dropzone, { useDropzone } from "react-dropzone";
|
import Dropzone, { useDropzone } from "react-dropzone";
|
||||||
import { uploadFiles } from "../../actions";
|
import { uploadFiles } from "../../actions";
|
||||||
import { getContainers } from "../../actions/azurestorage";
|
import { getContainers } from "../../actions/azurestorage";
|
||||||
|
import {
|
||||||
|
getFormCollectionByID,
|
||||||
|
getThumbnailIconByExtension,
|
||||||
|
bytesToSize,
|
||||||
|
} from "../utils";
|
||||||
|
|
||||||
const required = (errorMsg) => (value) =>
|
const required = (errorMsg) => (value) =>
|
||||||
value || typeof value === "number" ? undefined : errorMsg;
|
value || typeof value === "number" ? undefined : errorMsg;
|
||||||
@@ -119,13 +124,6 @@ const RenderFileUpload = (field) => {
|
|||||||
</div>
|
</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) => {
|
const getThumbnailIcon = (fileObj, fileType) => {
|
||||||
switch (fileType) {
|
switch (fileType) {
|
||||||
case "text/html":
|
case "text/html":
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ import {
|
|||||||
setFormComplete,
|
setFormComplete,
|
||||||
} from "../../store/appealType/action";
|
} from "../../store/appealType/action";
|
||||||
|
|
||||||
|
import {
|
||||||
|
getFormCollectionByID,
|
||||||
|
getThumbnailIconByExtension,
|
||||||
|
bytesToSize,
|
||||||
|
} from "../utils";
|
||||||
|
|
||||||
let BuildCheckSection = (props) => {
|
let BuildCheckSection = (props) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setFormComplete();
|
setFormComplete();
|
||||||
@@ -64,54 +70,6 @@ let BuildCheckSection = (props) => {
|
|||||||
alert(1);
|
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 (
|
return (
|
||||||
<div className="govuk-grid-row" key={1222}>
|
<div className="govuk-grid-row" key={1222}>
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
|
|||||||
@@ -271,24 +271,25 @@ export const finalComments_pdf = ({ docProps }) => {
|
|||||||
{ flexDirection: "column" },
|
{ flexDirection: "column" },
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{values.filesList.map(function (p) {
|
{values.hasOwnProperty("filesList") &&
|
||||||
return (
|
values.filesList.map(function (p) {
|
||||||
<View
|
return (
|
||||||
style={{
|
<View
|
||||||
flexDirection: "row",
|
style={{
|
||||||
marginBottom: 4,
|
flexDirection: "row",
|
||||||
}}
|
marginBottom: 4,
|
||||||
>
|
}}
|
||||||
<Text
|
|
||||||
styles={
|
|
||||||
styles.questionTextMid
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{p.name} - {p.size}
|
<Text
|
||||||
</Text>
|
styles={
|
||||||
</View>
|
styles.questionTextMid
|
||||||
);
|
}
|
||||||
})}
|
>
|
||||||
|
{p.name} - {p.size}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -1328,24 +1328,26 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
|
|||||||
{ flexDirection: "column" },
|
{ flexDirection: "column" },
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{values.filesList.map(function (p) {
|
{values.hasOwnProperty("filesList") &&
|
||||||
return (
|
values.filesList.map(function (p) {
|
||||||
<View
|
return (
|
||||||
style={{
|
<View
|
||||||
flexDirection: "row",
|
style={{
|
||||||
marginBottom: 4,
|
flexDirection:
|
||||||
}}
|
"row",
|
||||||
>
|
marginBottom: 4,
|
||||||
<Text
|
}}
|
||||||
styles={
|
|
||||||
styles.questionTextMid
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{p.name} - {p.size}
|
<Text
|
||||||
</Text>
|
styles={
|
||||||
</View>
|
styles.questionTextMid
|
||||||
);
|
}
|
||||||
})}
|
>
|
||||||
|
{p.name} - {p.size}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -271,24 +271,25 @@ export const other_pdf = ({ docProps }) => {
|
|||||||
{ flexDirection: "column" },
|
{ flexDirection: "column" },
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{values.filesList.map(function (p) {
|
{values.hasOwnProperty("filesList") &&
|
||||||
return (
|
values.filesList.map(function (p) {
|
||||||
<View
|
return (
|
||||||
style={{
|
<View
|
||||||
flexDirection: "row",
|
style={{
|
||||||
marginBottom: 4,
|
flexDirection: "row",
|
||||||
}}
|
marginBottom: 4,
|
||||||
>
|
}}
|
||||||
<Text
|
|
||||||
styles={
|
|
||||||
styles.questionTextMid
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{p.name} - {p.size}
|
<Text
|
||||||
</Text>
|
styles={
|
||||||
</View>
|
styles.questionTextMid
|
||||||
);
|
}
|
||||||
})}
|
>
|
||||||
|
{p.name} - {p.size}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -271,24 +271,25 @@ export const statement_pdf = ({ docProps }) => {
|
|||||||
{ flexDirection: "column" },
|
{ flexDirection: "column" },
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{values.filesList.map(function (p) {
|
{values.hasOwnProperty("filesList") &&
|
||||||
return (
|
values.filesList.map(function (p) {
|
||||||
<View
|
return (
|
||||||
style={{
|
<View
|
||||||
flexDirection: "row",
|
style={{
|
||||||
marginBottom: 4,
|
flexDirection: "row",
|
||||||
}}
|
marginBottom: 4,
|
||||||
>
|
}}
|
||||||
<Text
|
|
||||||
styles={
|
|
||||||
styles.questionTextMid
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{p.name} - {p.size}
|
<Text
|
||||||
</Text>
|
styles={
|
||||||
</View>
|
styles.questionTextMid
|
||||||
);
|
}
|
||||||
})}
|
>
|
||||||
|
{p.name} - {p.size}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -271,24 +271,25 @@ export const writtenStatement_pdf = ({ docProps }) => {
|
|||||||
{ flexDirection: "column" },
|
{ flexDirection: "column" },
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{values.filesList.map(function (p) {
|
{values.hasOwnProperty("filesList") &&
|
||||||
return (
|
values.filesList.map(function (p) {
|
||||||
<View
|
return (
|
||||||
style={{
|
<View
|
||||||
flexDirection: "row",
|
style={{
|
||||||
marginBottom: 4,
|
flexDirection: "row",
|
||||||
}}
|
marginBottom: 4,
|
||||||
>
|
}}
|
||||||
<Text
|
|
||||||
styles={
|
|
||||||
styles.questionTextMid
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{p.name} - {p.size}
|
<Text
|
||||||
</Text>
|
styles={
|
||||||
</View>
|
styles.questionTextMid
|
||||||
);
|
}
|
||||||
})}
|
>
|
||||||
|
{p.name} - {p.size}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -369,3 +369,51 @@ export const getTempCaseRef = () => {
|
|||||||
randomString(6).toUpperCase()
|
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,
|
// emailReplyToId: emailReplyToId,
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log("thisis the response", response);
|
//console.log("thisis the response", response);
|
||||||
return res.status(200).json(data);
|
return res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ export default function handler(req, res) {
|
|||||||
case "Land Owner":
|
case "Land Owner":
|
||||||
repCapacity = "LO";
|
repCapacity = "LO";
|
||||||
break;
|
break;
|
||||||
case "LPA":
|
case "lpa":
|
||||||
repCapacity = "LPA";
|
repCapacity = "LPA";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -207,20 +207,20 @@ export default function handler(req, res) {
|
|||||||
// code block
|
// code block
|
||||||
}
|
}
|
||||||
|
|
||||||
const repDate = new Date();
|
// const repDate = new Date();
|
||||||
|
|
||||||
let day = ("0" + repDate.getDate()).slice(-2);
|
// let day = ("0" + repDate.getDate()).slice(-2);
|
||||||
let month = ("0" + (repDate.getMonth() + 1)).slice(-2);
|
// let month = ("0" + (repDate.getMonth() + 1)).slice(-2);
|
||||||
let year = repDate.getFullYear();
|
// let year = repDate.getFullYear();
|
||||||
let time =
|
// let time =
|
||||||
("0" + repDate.getHours()).slice(-2) +
|
// ("0" + repDate.getHours()).slice(-2) +
|
||||||
"" +
|
// "" +
|
||||||
("0" + repDate.getMinutes()).slice(-2);
|
// ("0" + repDate.getMinutes()).slice(-2);
|
||||||
|
|
||||||
let repDateStamp = "";
|
// let repDateStamp = "";
|
||||||
repDateStamp = year + "" + month + day; //+ "-" + time;
|
// repDateStamp = year + "" + month + day; //+ "-" + time;
|
||||||
|
|
||||||
console.log(repDateStamp);
|
//console.log(reqBodyobj);
|
||||||
//if (hashAPIPath(checkquerypath) == "?hash=" + checkHash) {
|
//if (hashAPIPath(checkquerypath) == "?hash=" + checkHash) {
|
||||||
// //createContainer(containerID).then((containerName) => {
|
// //createContainer(containerID).then((containerName) => {
|
||||||
|
|
||||||
@@ -228,21 +228,21 @@ export default function handler(req, res) {
|
|||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
"///////////////////////////////////\n file created: \n" +
|
"///////////////////////////////////\n file created: \n" +
|
||||||
`tmp/${caseRef}_rep_${repDateStamp}_${repCapacity}_${repRaiser}_${repType}.pdf` +
|
`tmp/${reqBodyobj.repfile_name}.pdf` +
|
||||||
"\n/////////////////////////"
|
"\n/////////////////////////"
|
||||||
);
|
);
|
||||||
|
|
||||||
createRepBlob(req.body, containerID, caseRef);
|
// createRepBlob(req.body, containerID, caseRef);
|
||||||
|
|
||||||
ReactPDF.render(
|
ReactPDF.render(
|
||||||
<MyDocument docProps={reqBodyobj} />,
|
<MyDocument docProps={reqBodyobj} />,
|
||||||
`tmp/${caseRef}_rep_${repDateStamp}_${repCapacity}_${repRaiser}_${repType}.pdf`
|
`tmp/${reqBodyobj.repfile_name}.pdf`
|
||||||
);
|
);
|
||||||
|
|
||||||
uploadPDFRepFiles(
|
uploadPDFRepFiles(
|
||||||
`tmp/${caseRef}_rep_${repDateStamp}_${repCapacity}_${repRaiser}_${repType}.pdf`,
|
`tmp/${reqBodyobj.repfile_name}.pdf`,
|
||||||
containerID,
|
containerID,
|
||||||
caseRef,
|
caseRef + "/" + reqBodyobj.repfile_name,
|
||||||
repType
|
repType
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -250,11 +250,11 @@ export default function handler(req, res) {
|
|||||||
|
|
||||||
// then remove from local folder
|
// 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({
|
return res.status(200).json({
|
||||||
data: "success",
|
data: "success",
|
||||||
path: `tmp/${caseRef}_rep_${repDateStamp}_${repCapacity}_${repRaiser}_${repType}.pdf`,
|
path: `tmp/${reqBodyobj.repfile_name}.pdf`,
|
||||||
});
|
});
|
||||||
// } else {
|
// } else {
|
||||||
// return res.status(400).json();
|
// return res.status(400).json();
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ ApiProxy.get(async (req, res) => {
|
|||||||
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
|
||||||
const blobObj = await getRepsBlobs(containerName, casefolderID)
|
const blobObj = await getRepsBlobs(containerName, casefolderID)
|
||||||
.then(async (data) => {
|
.then(async (data) => {
|
||||||
// console.log("----------xxxxxx------", data);
|
console.log("----------xxxxxx------", data);
|
||||||
let result = await downloadAllRepsFiles(containerName, data);
|
let result = await downloadAllRepsFiles(containerName, data);
|
||||||
return res.status(200).json(result);
|
return res.status(200).json(result);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user