diff --git a/components/case/representation/index.js b/components/case/representation/index.js index 99671b52..e5dc32f7 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -14,7 +14,7 @@ import { setRepresentationMessageSent, setRepresentationReset, setRepresentationSubmit, - setRepresentationSubmitConfirmation, + setRepresentationSubmitConfirmation } from "../../../store/currentView/action"; import ConsultationAgent from "./consultationAgent"; import ConsultationAppellant from "./consultationAppellant"; @@ -66,7 +66,7 @@ let MakeRepresentation = (props) => { initialValues, setCurrentReference, ticketnumber, - docsOffline, + docsOffline } = props; const formObj = props.props.form; let setCaseQueryObj = props[currentType] || {}; @@ -88,7 +88,7 @@ let MakeRepresentation = (props) => { 846040008: 7, 846040005: 9, 846040006: 9, - 846040007: 9, + 846040007: 9 }; return countMap[appealType] || 7; @@ -120,7 +120,7 @@ let MakeRepresentation = (props) => { "Land Owner": "LO", lpa: "LPA", LPA: "LPA", - NRW: "NRW", + NRW: "NRW" }; const repTypeMap = { @@ -133,16 +133,16 @@ let MakeRepresentation = (props) => { "Consultation Response": "Consultation_Response", "Local Impact Report": "Local_Impact_Report", "Marine Impact Report": "Marine_Impact_Report", - Other: "OTHER", + Other: "OTHER" }; const now = new Date(); const pad = (num) => String(num).padStart(2, "0"); const dateStr = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad( - now.getDate(), + now.getDate() )}-${pad(now.getHours())}:${pad(now.getMinutes())}:${pad( - now.getSeconds(), + now.getSeconds() )}`; const repCap = repCapMap[values.representationCapacity] || ""; @@ -154,7 +154,7 @@ let MakeRepresentation = (props) => { const namePart = isLPA ? sanitize(values.onBehalfOfLPA || "") : `${sanitize(values.lastname || "")}_${sanitize( - values.firstname || "", + values.firstname || "" )}`; values.repfile_name = @@ -171,17 +171,17 @@ let MakeRepresentation = (props) => { case "searchResultsObj": return { path: `$..[?(@ && @.title=="${caseReference}")]`, - json: setCaseQueryObj, + json: setCaseQueryObj }; case "watchedCases": return { path: `$..[?(@ && @.ticketnumber=="${caseReference}")]`, - json: watchedCases, + json: watchedCases }; default: return { path: `$..[?(@ && @.reference=="${caseReference}")]`, - json: setCaseQueryObj, + json: setCaseQueryObj }; } }; @@ -194,7 +194,7 @@ let MakeRepresentation = (props) => { const capacityOptionsArr = [ t("myrepresentations:capacity-options-arr-appellant"), - t("myrepresentations:capacity-options-arr-agent"), + t("myrepresentations:capacity-options-arr-agent") ]; const shouldIncludeInterested = @@ -203,7 +203,7 @@ let MakeRepresentation = (props) => { if (shouldIncludeInterested) { capacityOptionsArr.push( - t("myrepresentations:capacity-options-arr-interested"), + t("myrepresentations:capacity-options-arr-interested") ); } @@ -238,7 +238,7 @@ let MakeRepresentation = (props) => { let resultsObj = jsonpath({ path: `$..[?(@ && @.ticketnumber=="${currentView.caseReference.currentReference}")]`, json: setCaseResultsObj, - eval: true, + eval: true })[0]; // let detailsObj; @@ -247,13 +247,13 @@ let MakeRepresentation = (props) => { detailsObj = jsonpath({ path: `$..[?(@ && @.repfile_name=="${router.query.created}")]`, json: setCaseDetailsObj, - eval: true, + eval: true })[0]; } else { detailsObj = jsonpath({ - path: `$..[?(@ && @.pinswg_name=="${currentView.caseReference.currentReference}")]`, + path: `$..[?(@ && @.ticketnumber=="${currentView.caseReference.ticketnumber}")]`, json: setCaseDetailsObj, - eval: true, + eval: true })[0]; } @@ -269,20 +269,20 @@ let MakeRepresentation = (props) => { const startDate = new Date( isDNS ? detailsObj.pinswg_applicationacceptedasvalid - : detailsObj.pinswg_startdate || detailsObj.pinswg_startdates, + : detailsObj.pinswg_startdate || detailsObj.pinswg_startdates ); const questionnaireDate = new Date( isDNS ? detailsObj.pinswg_endofrepresentationperiod - : detailsObj.pinswg_questionnaireduedate, + : detailsObj.pinswg_questionnaireduedate ); questionnaireDate.setHours(23, 59, 59, 999); const finalCommentsDate = new Date( isDNS ? detailsObj.pinswg_endofrepresentationperiod - : detailsObj.pinswg_finalcommentsduedate, + : detailsObj.pinswg_finalcommentsduedate ); finalCommentsDate.setHours(23, 59, 59, 999); @@ -290,7 +290,7 @@ let MakeRepresentation = (props) => { isDNS ? detailsObj.pinswg_endofrepresentationperiod : detailsObj.pinswg_statementduedate || - detailsObj.pinswg_statementsduedate, + detailsObj.pinswg_statementsduedate ); statementDueDate.setHours(23, 59, 59, 999); @@ -407,7 +407,7 @@ let MakeRepresentation = (props) => { updateRepresentation, setSavingStatus, savingStatus, - setCurrentReference, + setCurrentReference }; const getNormalizedCapacity = () => { @@ -447,7 +447,7 @@ let MakeRepresentation = (props) => { case "apelydd": case "apelydd": case t( - "myrepresentations:capacity-options-arr-appellant", + "myrepresentations:capacity-options-arr-appellant" ).toLowerCase(): { const Component = appealType === 846040002 @@ -457,7 +457,7 @@ let MakeRepresentation = (props) => { ); @@ -469,7 +469,7 @@ let MakeRepresentation = (props) => { { case "asiant": case "asiant": case t( - "myrepresentations:capacity-options-arr-agent", + "myrepresentations:capacity-options-arr-agent" ).toLowerCase(): { const Component = appealType === 846040002 ? ConsultationAgent : RepAgent; @@ -492,7 +492,7 @@ let MakeRepresentation = (props) => { ); @@ -500,7 +500,7 @@ let MakeRepresentation = (props) => { case "interestedparty": case t( - "myrepresentations:capacity-options-arr-interested", + "myrepresentations:capacity-options-arr-interested" ).toLowerCase(): { const Component = appealType === 846040002 @@ -510,7 +510,7 @@ let MakeRepresentation = (props) => { ); @@ -545,12 +545,12 @@ let MakeRepresentation = (props) => { currentView, showQuestionnaireSection, setShowQuestionnaireSection, - questionnaireCount, + questionnaireCount }; const s78AppealTypes = [ 846040000, 846040001, 846040025, 846040004, 846040018, 846040003, - 846040009, 846040008, 846040017, + 846040009, 846040008, 846040017 ]; const enforcementAppealTypes = [846040005, 846040006, 846040007]; @@ -613,7 +613,7 @@ let MakeRepresentation = (props) => { detailsObj?.pinswg_siteaddresspostcode || detailsObj?.pinswg_postcode, detailsObj?.pinswg_siteaddresscounty || - detailsObj?.pinswg_addresscounty, + detailsObj?.pinswg_addresscounty ] .filter((v) => !!v && v.trim()) // remove empty/whitespace-only values .map((v) => toTitleCase(v.trim())) // title-case each segment @@ -622,13 +622,13 @@ let MakeRepresentation = (props) => { const updateRepresentation = async ( values, sendSavedEmail, - useSaveStatus, + useSaveStatus ) => { const { appealType: appealTypeProp, currentView, accountDetails, - loggedinUserEmail, + loggedinUserEmail } = props.props; const incidentID = props.appealType.caseReference.incidentid; const currentRef = caseReferenceObj.currentReference; @@ -641,13 +641,13 @@ let MakeRepresentation = (props) => { pinswg_siteaddressline1, pinswg_siteaddressline2, pinswg_siteaddresstown, - pinswg_siteaddresspostcode, + pinswg_siteaddresspostcode } = detailsObj; return [ pinswg_siteaddressline1, pinswg_siteaddressline2, pinswg_siteaddresstown, - pinswg_siteaddresspostcode, + pinswg_siteaddresspostcode ] .filter(Boolean) .join(" "); @@ -692,7 +692,7 @@ let MakeRepresentation = (props) => { pinswg_siteaddresspostcode: detailsObj.pinswg_siteaddresspostcode, pinswg_lpareference: resultsObj?.pinswg_lpareference, representationCapacity: getRepresentationCapacity(), - locale: router.locale, + locale: router.locale }; const formattedValues = { @@ -712,7 +712,7 @@ let MakeRepresentation = (props) => { ] || detailsObj[ "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" - ], + ] }; let updateBody = setRepFileName(formattedValues); @@ -725,7 +725,7 @@ let MakeRepresentation = (props) => { } return acc; }, - {}, + {} ); // Normalize "Yes"/"No" to booleans @@ -742,13 +742,13 @@ let MakeRepresentation = (props) => { caseReference: props.caseReference, emailAddress: loggedinUserEmail, returnLink: "", - linkExpiry: 600, // 10 minutes + linkExpiry: 600 // 10 minutes }; sendEmail( templateId, loggedinUserEmail, personalisation, - reference, + reference ); } }; @@ -764,7 +764,7 @@ let MakeRepresentation = (props) => { const handleFileUpload = () => { const filesWithLinks = updateLinks({ ...values, - filesList: currentView.fileList, + filesList: currentView.fileList }); uploadRepresentationFiles(filesWithLinks); }; @@ -803,7 +803,7 @@ let MakeRepresentation = (props) => { let detailsObj = jsonpath({ path: `$..[?(@ && @.pinswg_name=="${caseReference}")]`, json: setCaseDetailsObj, - eval: true, + eval: true })[0]; // Cancel submit status if editing @@ -823,13 +823,13 @@ let MakeRepresentation = (props) => { pinswg_siteaddressline1, pinswg_siteaddressline2, pinswg_siteaddresstown, - pinswg_siteaddresspostcode, + pinswg_siteaddresspostcode } = detailsObj; return [ pinswg_siteaddressline1, pinswg_siteaddressline2, pinswg_siteaddresstown, - pinswg_siteaddresspostcode, + pinswg_siteaddresspostcode ] .filter(Boolean) .join(" "); @@ -889,7 +889,7 @@ let MakeRepresentation = (props) => { "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" ], representationCapacity, - locale: router.locale, + locale: router.locale }); } @@ -916,7 +916,7 @@ let MakeRepresentation = (props) => { showQuestionnaireSection < questionnaireCount ) { setShowQuestionnaireSection( - showQuestionnaireSection + 1, + showQuestionnaireSection + 1 ); updateRepresentation(values, false, false); } else { @@ -937,7 +937,7 @@ let MakeRepresentation = (props) => { Object.assign(values, { locale: router.locale, - repComplete: currentView.caseReference.currentReference, + repComplete: currentView.caseReference.currentReference }); if (props.invalid === false) { @@ -949,7 +949,7 @@ let MakeRepresentation = (props) => { generateRepPDF( values, props.props.accountDetails.containerID, - currentView.caseReference.currentReference, + currentView.caseReference.currentReference ).then((data) => { if (data.status === "success") { values = updateLinks(values); @@ -968,13 +968,13 @@ let MakeRepresentation = (props) => { (file) => file && typeof file === "object" && - Object.keys(file).length > 0, + Object.keys(file).length > 0 ) .filter((file) => file.name !== undefined); return { ...blobList, - filesList: cleanedFiles, + filesList: cleanedFiles }; }; @@ -1003,7 +1003,7 @@ let MakeRepresentation = (props) => { dataObj, [{}], updatedValues.containerID, - `${props.caseReference}/${dataObj.repfile_name}`, + `${props.caseReference}/${dataObj.repfile_name}` ); }; @@ -1027,7 +1027,7 @@ let MakeRepresentation = (props) => { return formatDates( detailsObj.pinswg_questionnaireduedate || detailsObj.pinswg_endofrepresentationperiod || - detailsObj.pinswg_consultationclose, + detailsObj.pinswg_consultationclose ); } return "N/A"; @@ -1040,7 +1040,7 @@ let MakeRepresentation = (props) => { {formatDates( detailsObj.pinswg_statementduedate || detailsObj.pinswg_statementsduedate || - detailsObj.pinswg_endofrepresentationperiod, + detailsObj.pinswg_endofrepresentationperiod )} @@ -1114,10 +1114,10 @@ let MakeRepresentation = (props) => {

{appealIsConsultation ? t( - "myrepresentations:make-a-consultation-on-label", + "myrepresentations:make-a-consultation-on-label" ) : t( - "myrepresentations:make-a-representation-on-label", + "myrepresentations:make-a-representation-on-label" )}{" "} {currentView.caseReference.currentReference}{" "}

@@ -1131,17 +1131,17 @@ let MakeRepresentation = (props) => {

{t( - "myrepresentations:timetable-title", + "myrepresentations:timetable-title" )}

{appealIsLocalImpact ? t( - "myrepresentations:local-impact-report", + "myrepresentations:local-impact-report" ) : t( - "myrepresentations:questionnaire-due-label", + "myrepresentations:questionnaire-due-label" )} :{" "} @@ -1179,7 +1179,7 @@ const mapStateToProps = (state) => { appealType: state.appealType, currentView: state.currentView, myRepresentations: state.myRepresentations, - initialValues: state.currentView.caseReference.repDetails, + initialValues: state.currentView.caseReference.repDetails //form: state.form, }; }; @@ -1203,7 +1203,7 @@ const mapDispatchToProps = (dispatch) => { }, setRepresentationReset: () => { dispatch(setRepresentationReset()); - }, + } }; }; @@ -1211,11 +1211,11 @@ const selector = formValueSelector("representationForm"); export default connect( mapStateToProps, - mapDispatchToProps, + mapDispatchToProps )( reduxForm({ form: "representationForm", destroyOnUnmount: false, - enableReinitialize: true, - })(MakeRepresentation), + enableReinitialize: true + })(MakeRepresentation) );