added in options for uploadstream for rep pdfs

This commit is contained in:
2024-11-14 14:33:19 +00:00
parent 379f238552
commit 61e645c963
11 changed files with 66 additions and 41 deletions
+19 -2
View File
@@ -385,10 +385,18 @@ export const createAppealPDFBlob = async (
//console.log(content);
const blobName = caseID + "/files/" + pdfFileName + ".pdf";
const uploadOptions = {
blockSize: 4 * 1024 * 1024, // 4 MiB max block size
concurrency: 2, // maximum number of parallel transfer workers
maxSingleShotSize: 8 * 1024 * 1024, // 8 MiB initial transfer size
};
console.log("blobName:", blobName);
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
const uploadBlobResponse = await blockBlobClient.uploadStream(content);
const uploadBlobResponse = await blockBlobClient.uploadStream(
content,
uploadOptions
);
console.log(uploadBlobResponse);
@@ -426,10 +434,19 @@ export const createRepPDFBlob = async (
//console.log(content);
const blobName = caseID + "/" + repName + "/files/" + repName + ".pdf";
const uploadOptions = {
blockSize: 4 * 1024 * 1024, // 4 MiB max block size
concurrency: 2, // maximum number of parallel transfer workers
maxSingleShotSize: 8 * 1024 * 1024, // 8 MiB initial transfer size
};
console.log("blobName:", blobName);
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
const uploadBlobResponse = await blockBlobClient.uploadStream(content);
const uploadBlobResponse = await blockBlobClient.uploadStream(
content,
uploadOptions
);
let whichLocation =
repName.indexOf("_IP_") > 0
+1 -1
View File
@@ -1544,7 +1544,7 @@ export const uploadRepFiles = async (
export const generateRepPDF = async (formValues, containerID, casefolderID) => {
//let files = filesObj;
console.log("generateRepPDF function: " + formValues);
//console.log("generateRepPDF function: " + formValues);
// var formData = new FormData();
// formValues.append("appealData", JSON.stringify(formValues));
// formValues.append("containerID", containerID);
+15 -17
View File
@@ -223,7 +223,7 @@ let MakeRepresentation = (props) => {
const buildRepsArr = (detailsObj) => {
let buildArr = [];
console.log(currentView.caseReference.appealType, "");
// console.log(currentView.caseReference.appealType, "");
let todaysDate = new Date();
@@ -737,7 +737,6 @@ let MakeRepresentation = (props) => {
Object.assign(values, {
"filesList": buildFileArray,
})),
console.log("zxcvbnm"),
uploadRepresentationFiles(values),
generateRepPDF(
values,
@@ -750,11 +749,11 @@ let MakeRepresentation = (props) => {
window.scrollTo({ top: 0, behavior: "smooth" });
values = setRepFileName(values);
console.log("onHandleSubmit form values - ", JSON.stringify(values));
//console.log("onHandleSubmit form values - ", JSON.stringify(values));
const buildFileArray = [];
console.log("attached docs: - ", buildFileArray);
//console.log("attached docs: - ", buildFileArray);
let setCaseDetailsObj = router.query.hasOwnProperty("state")
? router.query.state == "edit"
@@ -777,11 +776,11 @@ let MakeRepresentation = (props) => {
detailsObj = detailsObj[0];
console.log(
"Has data from form:",
formObj.hasOwnProperty("representationForm") &&
formObj.representationForm.hasOwnProperty("values")
);
// console.log(
// "Has data from form:",
// formObj.hasOwnProperty("representationForm") &&
// formObj.representationForm.hasOwnProperty("values")
// );
formObj.hasOwnProperty("representationForm") &&
!router.query.hasOwnProperty("state") &&
@@ -871,7 +870,6 @@ let MakeRepresentation = (props) => {
Object.assign(values, { "locale": router.locale }),
props.invalid == false &&
updateRepresentation(values, false, false),
console.log("qwerty"),
// values.hasOwnProperty("representationDocuments") &&
// (values.representationDocuments.map((Blob) =>
// buildFileArray.push({
@@ -904,13 +902,13 @@ let MakeRepresentation = (props) => {
return _.includes(key, "representationDocuments");
});
console.log(
"\n////////////////////////\n upload files:",
values.containerID,
"\n////////////////////////\n fileListObj:",
fileListObj,
"\n////////////////////////\n"
);
// console.log(
// "\n////////////////////////\n upload files:",
// values.containerID,
// "\n////////////////////////\n fileListObj:",
// fileListObj,
// "\n////////////////////////\n"
// );
var dataObj = values;
@@ -361,7 +361,7 @@ export const RenderLPACondtionalRadioList = ({
}) => {
const required = (value) => (value ? undefined : "Required");
console.log(error);
//console.log(error);
return (
<>
@@ -463,7 +463,7 @@ export const RenderPickList = ({
errorMsg,
...custom
}) => {
console.log(custom.disabled);
// console.log(custom.disabled);
let { t } = useTranslation();
return (
@@ -391,10 +391,10 @@ let RepLPA = (props) => {
{showQuestionnaireSection > 1 && (
<a
onClick={() => {
window.scrollTo({
top: 0,
behavior: "smooth",
});
// window.scrollTo({
// top: 0,
// behavior: "smooth",
// });
setRepFileName(
props.formObj[
"representationForm"
@@ -89,7 +89,7 @@ let S78_Questionnaire = (props) => {
);
resultsObj = resultsObj[0];
console.log(resultsObj);
//console.log(resultsObj);
const onHandleSubmit = (values) => {
//if (currentSection == sectionCount) {
@@ -1065,7 +1065,6 @@ S78_Questionnaire = connect((state) => {
})(S78_Questionnaire);
const mapStateToProps = (state, props) => {
console.log();
return {
search: state.search,
searchResultsObj: state.searchResultsObj,
+15 -6
View File
@@ -14,6 +14,8 @@ import MyRepresentations from "./myportal/myrepresentations";
import SearchCases from "./myportal/searchcases";
import WatchedCases from "./myportal/watchedcases";
import ServiceBanner from "./myportal/servicebanner";
import { JSONPath as jsonpath } from "jsonpath-plus";
import transLookup from "../data/lookuptranslations.json";
const MyPortal = (props) => {
const { showFileUpload, showLoginCheck } = props;
@@ -100,12 +102,19 @@ const MyPortal = (props) => {
{isLPA && (
<div>
<h2 className="heading-small card-heading">
{
props.accountDetails.accountDetails[
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
]
}{" "}
LPA Portal
{router.locale == "cy"
? jsonpath(
'$..[?(@.value=="' +
props.accountDetails.accountDetails[
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy',
transLookup
)
: props.accountDetails.accountDetails[
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
]}{" "}
{t("myportal:lpa-portal-heading")}
</h2>
</div>
)}
+3 -3
View File
@@ -85,7 +85,7 @@ const styles = StyleSheet.create({
});
export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
console.log(docProps);
//console.log(docProps);
function formatDates(dateObj) {
var dateObj = new Date(dateObj);
var dd = String(dateObj.getDate()).padStart(2, "0");
@@ -96,9 +96,9 @@ export const EnforcementQuestionnaire_pdf = ({ docProps }) => {
}
let values = docProps;
let appealTypeValue = getFormCollectionByID(values.appealType);
console.log("//////////////////////\n docpropseeeee:".docProps);
//console.log("//////////////////////\n docpropseeeee:".docProps);
console.log("sdffhjdhjdjdgkj: ", values.procedureType);
//console.log("sdffhjdhjdjdgkj: ", values.procedureType);
return (
<Document>
<Page size="A4" style={styles.page} wrap>
@@ -4,7 +4,7 @@ import {
Page,
StyleSheet,
Text,
View
View,
} from "@react-pdf/renderer";
import Html from "react-pdf-html";
import { getFormCollectionByID } from "../../components/utils";
@@ -17,7 +17,7 @@ const getTrans = (locale, key) => {
let jsonObj = locale == "cy" ? transLookupCY : transLookupEN;
console.log(locale, jsonObj[key]);
//console.log(locale, jsonObj[key]);
return jsonObj[key];
};
@@ -107,10 +107,10 @@ export const lpaQuestionnaire_pdf = ({ docProps }) => {
return dd + "/" + mm + "/" + yyyy;
}
let values = docProps;
console.log("//////////////////////\n docprops:", docProps);
//console.log("//////////////////////\n docprops:", docProps);
let appealTypeValue = getFormCollectionByID(values.appealType);
console.log("sdffhjdhjdjdgkj: ", values.procedureType);
//console.log("sdffhjdhjdjdgkj: ", values.procedureType);
return (
<Document>
<Page size="A4" style={styles.page} wrap>
+1
View File
@@ -2,6 +2,7 @@
"viewall-link": "Gweld y cyfan",
"viewall-link-count": "Gweld pob un o'r {{count}} achos",
"page-title": "Fy mhorth",
"lpa-portal-heading": "Porth LPA",
"makenewappeal-card-title": "Gwneud apêl newydd",
"makenewappeal-card-paragraph-one": "Cyn cyflwyno apêl newydd, gwnewch yn siŵr eich bod wedi darllen y cyfan",
"makenewappeal-card-link": "berthnasol i'r math o apêl sydd gennych.",
+1
View File
@@ -2,6 +2,7 @@
"viewall-link": "View all",
"viewall-link-count": "View all {{count}} cases",
"page-title": "My Portal",
"lpa-portal-heading": "LPA Portal",
"makenewappeal-card-title": "Make a new appeal",
"makenewappeal-card-paragraph-one": "Before submitting a new appeal, please ensure you have read all of the",
"makenewappeal-card-link": "relevant to your appeal type.",