From bcc1f7ed1807d488111f1e09477c4d3264947704 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Wed, 19 Jun 2024 16:20:21 -0700 Subject: [PATCH 1/2] adjusted modal for consult to account for include redlines feature --- web/src/components/FOI/Home/Redlining.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/web/src/components/FOI/Home/Redlining.js b/web/src/components/FOI/Home/Redlining.js index 914489e66..6fba96220 100644 --- a/web/src/components/FOI/Home/Redlining.js +++ b/web/src/components/FOI/Home/Redlining.js @@ -353,6 +353,7 @@ const Redlining = React.forwardRef( const [selectedPublicBodyIDs, setSelectedPublicBodyIDs] = useState([]); const [documentPublicBodies, setDocumentPublicBodies] = useState([]); const [consultApplyRedactions, setConsultApplyRedactions] = useState(false); + const [consultApplyRedlines, setConsultApplyRedlines] = useState(false); const [filteredComments, setFilteredComments] = useState({}); const [pagesRemoved, setPagesRemoved] = useState([]); @@ -3585,6 +3586,7 @@ const Redlining = React.forwardRef( setRedlineModalOpen(false); setSelectedPublicBodyIDs([]); setConsultApplyRedactions(false); + setConsultApplyRedlines(false); } }; @@ -4637,6 +4639,9 @@ const Redlining = React.forwardRef( const handleApplyRedactions = (e) => { setConsultApplyRedactions(e.target.checked); } + const handleApplyRedlines = (e) => { + setConsultApplyRedlines(e.target.checked); + } const handleSelectedPublicBodies = (e) => { const publicBodyId = parseInt(e.target.value); @@ -4869,6 +4874,16 @@ const Redlining = React.forwardRef( />
+ + +
- + } From 1954a44648799f9cf3aed04fe68c2e90dbdd1aef Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Wed, 3 Jul 2024 15:43:54 -0700 Subject: [PATCH 2/2] Consult Changes: 1. redline.js adjusted to fix redline package creation bug for single div packages (copied bug fix in dev/test) 2. Adjusted valid redline divison dl function for consults 3. Added new biz features (verbage changes, ability to exclude or incl. redlines) --- web/src/components/FOI/Home/ConsultModal.tsx | 4 +- web/src/components/FOI/Home/Redlining.js | 59 ++++++++++++++------ 2 files changed, 44 insertions(+), 19 deletions(-) diff --git a/web/src/components/FOI/Home/ConsultModal.tsx b/web/src/components/FOI/Home/ConsultModal.tsx index 0695226b9..9f1206104 100644 --- a/web/src/components/FOI/Home/ConsultModal.tsx +++ b/web/src/components/FOI/Home/ConsultModal.tsx @@ -100,7 +100,7 @@ const ConsultModal = ({ -
Select one or more Ministry you with the send the selected page(s) to for consult.
+
Select one or more public bodies you wish to consult with on the selected page(s).
{programAreaList.programareas?.map((programArea: any, index: number) => (
-
If you do not see the name of the Ministry you would like to send for consult above please type it below.
+
If you do not see the name of the public body you wish to consult with, please type it below.
flagId === pageFlagTypes["Duplicate"])) || (!includeNRPages && pageFlagsOnPage.some((flagId) => flagId === pageFlagTypes["Not Responsive"]))) { + isvalid = false; + } else { + isvalid = true; + } + } } } } @@ -484,11 +498,11 @@ const Redlining = React.forwardRef( setIncludeDuplicatePages(true); setIncludeNRPages(true); setModalMessage([ - "Are you sure want to create a consult? A PDF will be created for each public body selected and your web browser page will automatically refresh", + "Are you sure you want to create a consult package? A PDF will be created for each public body selected, and your web browser will automatically refresh after package creation.",
,
, - Select one or more Ministry you wish to send the selected page(s) to for consult* + Select one or more public bodies you wish to create a consult package for: , ]); setModalButtonLabel("Create Consult"); @@ -2850,7 +2864,7 @@ const Redlining = React.forwardRef( } // sort based on sortorder as the sortorder added based on the LastModified prepareRedlinePageMappingByRequest(sortBySortOrder(reqdocuments)); - } else if (modalFor == 'consult') { + } else if (modalFor == "consult") { prepareRedlinePageMappingByConsult(divisionDocuments); } else { prepareRedlinePageMappingByDivision(divisionDocuments); @@ -3041,7 +3055,7 @@ const Redlining = React.forwardRef( if (flagInfo.flagid !== pageFlagTypes["Consult"]) { pageIndex ++; } - } + } } //End of pageMappingsByDivisions totalPageCount += Object.keys( @@ -3052,7 +3066,7 @@ const Redlining = React.forwardRef( } //} } - + } divPageMappings[divObj.divisionid] = pageMappings; removepages[divObj.divisionid] = pagesToRemove; @@ -3829,7 +3843,7 @@ const Redlining = React.forwardRef( redactionlayerid: currentLayer.redactionlayerid }); - if(res.issingleredlinepackage == 'Y' || divisions.length == 1){ + if(res.issingleredlinepackage == 'Y'){ stitchSingleDivisionRedlineExport( _instance, divisionDocuments, @@ -3931,7 +3945,8 @@ const Redlining = React.forwardRef( await _instance.Core.createDocument(doc.s3path_load, { loadAsPDF: true, useDownloader: false, // Added to fix BLANK page issue - }).then(async (docObj) => { + }).then(async (docObj) => { + applyRotations(docObj, doc.attributes.rotatedpages) //if (isIgnoredDocument(doc, docObj.getPageCount(), divisionDocuments) == false) { docCountCopy++; docCount++; @@ -4055,13 +4070,11 @@ const Redlining = React.forwardRef( }).then(async (newDoc) => { applyRotations(newDoc, filerow.attributes.rotatedpages) docCount++; - setredlineDocCount(docCount); - if (isIgnoredDocument(filerow, newDoc, divisionDocuments) === false) { + // if (isIgnoredDocument(filerow, newDoc, divisionDocuments) === false) { if (filerow.stitchIndex === 1) { // Delete pages from the first document const deletedPages = getDeletedPagesBeforeStitching(filerow?.documentid); if (deletedPages.length > 0) { - setSkipDeletePages(true); await newDoc.removePages(deletedPages); } stitchedDocObj = newDoc; @@ -4080,7 +4093,7 @@ const Redlining = React.forwardRef( } ]) } - } + // } }); } catch (error) { console.error("An error occurred during create document:", error); @@ -4266,14 +4279,22 @@ const Redlining = React.forwardRef( } //OIPC - Special Block : End - //Consults - Redactions Block (Redact S.NR) : Start + //Consults - Redlines + Redactions (Redact S.NR) Block : Start if(modalFor == "consult") { + if (!consultApplyRedlines) { + const publicbodyAnnotList = xmlObj.getElementsByTagName('annots')[0]['children']; + const filteredPublicbodyAnnotList = publicbodyAnnotList.filter((annot) => { + return annot.name !== "freetext" && annot.name !== 'redact' + }); + xmlObj.getElementsByTagName('annots')[0].children = filteredPublicbodyAnnotList; + xfdfString = parser.toString(xmlObj); + } if (consultApplyRedactions) { let nr_sectionStamps = await annotationSectionsMapping(xfdfString, formattedAnnotationXML); await applyRedactionsToRedlinesBySection(nr_sectionStamps, PDFNet, stitchObject); } } - //Consults - Redactions Block (Redact S.NR) : End + //Consults - Redlines + Redactions (Redact S.NR) Block : End stitchObject .getFileData({ @@ -4294,7 +4315,7 @@ const Redlining = React.forwardRef( (_res) => { // ######### call another process for zipping and generate download here ########## toast.update(toastId.current, { - render: `Redline PDF saved to Object Storage`, + render: `${modalFor == "consult" ? "Consult" : "Redline"} PDF saved to Object Storage`, type: "success", className: "file-upload-toast", isLoading: false, @@ -4641,6 +4662,9 @@ const Redlining = React.forwardRef( } const handleApplyRedlines = (e) => { setConsultApplyRedlines(e.target.checked); + if (consultApplyRedactions) { + setConsultApplyRedactions(false); + } } const handleSelectedPublicBodies = (e) => { @@ -4891,6 +4915,7 @@ const Redlining = React.forwardRef( id="redaction-checkbox" checked={consultApplyRedactions} onChange={handleApplyRedactions} + disabled={!consultApplyRedlines} />