Merged PR 2295: resolved lint warnings
resolved lint warnings Related work items: #22873
This commit is contained in:
+1
-1
@@ -255,7 +255,7 @@ APPLICATIONINSIGHTS_CONNECTIONSTRING = InstrumentationKey=7a06e24a-793c-47bc-898
|
|||||||
|
|
||||||
|
|
||||||
// Test Connection string
|
// Test Connection string
|
||||||
# NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=cc60e8e7-5b30-4c2b-a176-8b96b21b12df;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=2a4094be-6fd1-46ab-a67d-5f241692b129
|
NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=cc60e8e7-5b30-4c2b-a176-8b96b21b12df;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=2a4094be-6fd1-46ab-a67d-5f241692b129
|
||||||
|
|
||||||
// Preprod Connection string
|
// Preprod Connection string
|
||||||
# NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=7370f0f9-834d-4c7a-b3c4-9951fcad5ad2;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=04362cb7-6dfc-469e-8274-12243e8be851
|
# NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=7370f0f9-834d-4c7a-b3c4-9951fcad5ad2;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=04362cb7-6dfc-469e-8274-12243e8be851
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ const PersonalDetailsComplete = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
doUpdate();
|
doUpdate();
|
||||||
}, [loggedinUserId, formValues, prefLang]);
|
}, [loggedinUserId, formValues, prefLang, userLang]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -28,9 +28,15 @@ function AppealsTab(props) {
|
|||||||
const [fieldSortState, setfieldSortState] = useState("desc");
|
const [fieldSortState, setfieldSortState] = useState("desc");
|
||||||
const [loginToWatch, setLoginToWatch] = useState("true");
|
const [loginToWatch, setLoginToWatch] = useState("true");
|
||||||
|
|
||||||
const searchDetailsObj = props.searchResultsObj.searchDetailsObj || {};
|
const {
|
||||||
const resultsArr = props.searchResultsObj.searchResultsObj.value || [];
|
searchResultsObj: searchResultsState,
|
||||||
const searchResultsObj = props.searchResultsObj.searchResultsObj;
|
setSearchResults,
|
||||||
|
setSearchDetails
|
||||||
|
} = props;
|
||||||
|
|
||||||
|
const searchDetailsObj = searchResultsState.searchDetailsObj || {};
|
||||||
|
const resultsArr = searchResultsState.searchResultsObj.value || [];
|
||||||
|
const searchResultsObj = searchResultsState.searchResultsObj;
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -75,20 +81,14 @@ function AppealsTab(props) {
|
|||||||
fieldSort,
|
fieldSort,
|
||||||
selectedOption
|
selectedOption
|
||||||
).then((data) => {
|
).then((data) => {
|
||||||
props.setSearchResults(data); // ✅ use props, not import
|
setSearchResults(data);
|
||||||
return getSearchDetailsPaged(data).then((details) => {
|
return getSearchDetailsPaged(data).then((details) => {
|
||||||
props.setSearchDetails(details); // ✅ use props, not import
|
setSearchDetails(details);
|
||||||
setShowSpinnerState(false);
|
setShowSpinnerState(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[
|
[selectedOption, setSearchDetails, setSearchResults]
|
||||||
advancedSearch,
|
|
||||||
searchString,
|
|
||||||
selectedOption,
|
|
||||||
props.setSearchDetails,
|
|
||||||
props.setSearchResults
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -936,17 +936,16 @@ const DocumentsTab = (props) => {
|
|||||||
)
|
)
|
||||||
.then((data) => data)
|
.then((data) => data)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
props.setDocumentDetails(data);
|
setDocumentDetails(data);
|
||||||
setShowSpinnerState(false);
|
setShowSpinnerState(false);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
props.incidentid,
|
|
||||||
selectedOption,
|
selectedOption,
|
||||||
selectedDocumentType,
|
selectedDocumentType,
|
||||||
selectedWeeks,
|
selectedWeeks,
|
||||||
selectedDocumentOrigin,
|
selectedDocumentOrigin,
|
||||||
props.setDocumentDetails
|
setDocumentDetails
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -957,7 +956,7 @@ const DocumentsTab = (props) => {
|
|||||||
orderBy,
|
orderBy,
|
||||||
fieldSort
|
fieldSort
|
||||||
).then((data) => {
|
).then((data) => {
|
||||||
props.setDocumentDetails(data);
|
setDocumentDetails(data);
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1060,7 +1059,7 @@ const DocumentsTab = (props) => {
|
|||||||
selectedDocumentType,
|
selectedDocumentType,
|
||||||
selectedWeeks
|
selectedWeeks
|
||||||
).then((data) => {
|
).then((data) => {
|
||||||
props.setDocumentDetails(data);
|
setDocumentDetails(data);
|
||||||
setDocumentSearchState(true);
|
setDocumentSearchState(true);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
@@ -1072,13 +1071,11 @@ const DocumentsTab = (props) => {
|
|||||||
//const searchDocumentResultsObj = docDetailsObj();
|
//const searchDocumentResultsObj = docDetailsObj();
|
||||||
}, [
|
}, [
|
||||||
incidentid,
|
incidentid,
|
||||||
props.setDocumentDetails,
|
setDocumentDetails,
|
||||||
selectedOption,
|
selectedOption,
|
||||||
selectedDocumentType,
|
selectedDocumentType,
|
||||||
fieldSortState,
|
fieldSortState,
|
||||||
orderByState,
|
orderByState,
|
||||||
getDocumentTypes,
|
|
||||||
getOrigin,
|
|
||||||
getDocumentResults,
|
getDocumentResults,
|
||||||
lang,
|
lang,
|
||||||
selectedWeeks
|
selectedWeeks
|
||||||
@@ -1134,7 +1131,7 @@ const DocumentsTab = (props) => {
|
|||||||
<select
|
<select
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setSelectedWeeks(e.target.value);
|
setSelectedWeeks(e.target.value);
|
||||||
props.setCurrentPage(1);
|
setCurrentPage(1);
|
||||||
}}
|
}}
|
||||||
value={selectedWeeks}
|
value={selectedWeeks}
|
||||||
className="govuk-select"
|
className="govuk-select"
|
||||||
|
|||||||
@@ -447,14 +447,14 @@ const MediaDetails = ({ mediaObj, whichTab, title, useNoCookie = true }) => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const mediaArr = mediaObj?.value || [];
|
const sourceMedia = mediaObj?.value;
|
||||||
const isActive = whichTab ? whichTab === "case-media" : true;
|
const isActive = whichTab ? whichTab === "case-media" : true;
|
||||||
|
|
||||||
// Build list of playable items (publishable only)
|
// Build list of playable items (publishable only)
|
||||||
const videoItems = useMemo(() => {
|
const videoItems = useMemo(() => {
|
||||||
const isWelsh = router.locale === "cy";
|
const isWelsh = router.locale === "cy";
|
||||||
|
|
||||||
return (mediaArr || [])
|
return (sourceMedia || [])
|
||||||
.filter((x) => x?.pinswg_publishtoweb)
|
.filter((x) => x?.pinswg_publishtoweb)
|
||||||
.map((item) => {
|
.map((item) => {
|
||||||
const link = isWelsh
|
const link = isWelsh
|
||||||
@@ -480,7 +480,7 @@ const MediaDetails = ({ mediaObj, whichTab, title, useNoCookie = true }) => {
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
}, [mediaArr, router.locale]);
|
}, [sourceMedia, router.locale]);
|
||||||
|
|
||||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,10 @@ const RenderRepresentationTypeRadioList = ({
|
|||||||
const hintId = `${optionId}-hint`;
|
const hintId = `${optionId}-hint`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="govuk-radios__item representation-type-option">
|
<div
|
||||||
|
key={option.value || optionId}
|
||||||
|
className="govuk-radios__item representation-type-option"
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
className="govuk-radios__input"
|
className="govuk-radios__input"
|
||||||
id={optionId}
|
id={optionId}
|
||||||
@@ -195,35 +198,6 @@ const RepresentationTypeSelectorBlock = ({
|
|||||||
</label>
|
</label>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<style jsx>{`
|
|
||||||
.representation-type-radio-item {
|
|
||||||
display: flex !important;
|
|
||||||
flex-direction: column !important;
|
|
||||||
align-items: flex-start;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.representation-type-radio-choice {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.representation-type-radio-hint {
|
|
||||||
display: block;
|
|
||||||
clear: both;
|
|
||||||
margin-left: 40px;
|
|
||||||
margin-top: 4px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
width: calc(100% - 40px);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
|
||||||
.representation-type-radio-hint {
|
|
||||||
margin-left: 34px;
|
|
||||||
margin-top: 2px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`}</style>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -874,15 +874,29 @@ let MakeRepresentation = (props) => {
|
|||||||
// Prepare data object for upload
|
// Prepare data object for upload
|
||||||
const dataObj = cleanedValues;
|
const dataObj = cleanedValues;
|
||||||
|
|
||||||
|
const caseFolderReference =
|
||||||
|
props.caseReference ||
|
||||||
|
dataObj.ticketnumber ||
|
||||||
|
currentView?.caseReference?.ticketnumber ||
|
||||||
|
currentView?.caseReference?.currentReference ||
|
||||||
|
dataObj.caseRef ||
|
||||||
|
"";
|
||||||
|
|
||||||
// Update links on values
|
// Update links on values
|
||||||
const updatedValues = updateLinks(cleanedValues);
|
const updatedValues = updateLinks(cleanedValues);
|
||||||
|
|
||||||
|
const resolvedContainerID =
|
||||||
|
updatedValues.containerID ||
|
||||||
|
dataObj.containerID ||
|
||||||
|
props?.props?.accountDetails?.containerID ||
|
||||||
|
props?.props?.accountDetails?.accountDetails?.containerID;
|
||||||
|
|
||||||
// Perform file upload and return the promise
|
// Perform file upload and return the promise
|
||||||
return uploadRepFiles(
|
return uploadRepFiles(
|
||||||
dataObj,
|
dataObj,
|
||||||
[{}],
|
[{}],
|
||||||
updatedValues.containerID,
|
resolvedContainerID,
|
||||||
`${props.caseReference}/${dataObj.repfile_name}`
|
`${caseFolderReference}/${dataObj.repfile_name}`
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2076,10 +2076,12 @@ const CaseSummary = (props) => {
|
|||||||
) : null;
|
) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const fallbackIncidentId = setCaseQueryObj?.value?.[0]?.incidentid;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const linkCaseObj = async () => {
|
const linkCaseObj = async () => {
|
||||||
let docObj = await getLinkedCases(
|
let docObj = await getLinkedCases(
|
||||||
incidentid || setCaseQueryObj.value[0].incidentid
|
incidentid || fallbackIncidentId
|
||||||
).then((data) => {
|
).then((data) => {
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
setCurrentLinkedCases(data);
|
setCurrentLinkedCases(data);
|
||||||
@@ -2090,7 +2092,7 @@ const CaseSummary = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const linkedCases = linkCaseObj();
|
const linkedCases = linkCaseObj();
|
||||||
}, [incidentid, setCurrentLinkedCases]);
|
}, [incidentid, fallbackIncidentId, setCurrentLinkedCases]);
|
||||||
|
|
||||||
let now = new Date();
|
let now = new Date();
|
||||||
let expDate = new Date(now);
|
let expDate = new Date(now);
|
||||||
|
|||||||
@@ -353,8 +353,8 @@ const AwaitingSubmissionFromBlob = (props) => {
|
|||||||
<h3 className="heading-small card-heading">
|
<h3 className="heading-small card-heading">
|
||||||
{t("myportal:awatitingsubmission-card-title")}
|
{t("myportal:awatitingsubmission-card-title")}
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<TopThreeRow />
|
<TopThreeRow />
|
||||||
|
|
||||||
{props.awaitingSubmissionFromBlob["@odata.count"] > 1 && (
|
{props.awaitingSubmissionFromBlob["@odata.count"] > 1 && (
|
||||||
<div className="cardVieAll">
|
<div className="cardVieAll">
|
||||||
<Link
|
<Link
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const MyRepresentations = (props) => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setCurrentView({
|
setCurrentView({
|
||||||
"viewName": "My Representations",
|
"viewName": "My Representations",
|
||||||
"viewKey": "myRepresentations",
|
"viewKey": "myRepresentations"
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -65,7 +65,7 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
return {
|
return {
|
||||||
setCurrentView: (currentView) => {
|
setCurrentView: (currentView) => {
|
||||||
dispatch(setCurrentView(currentView));
|
dispatch(setCurrentView(currentView));
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ const MyRepresentations = (props) => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setCurrentView({
|
setCurrentView({
|
||||||
"viewName": "My Representations",
|
"viewName": "My Representations",
|
||||||
"viewKey": "myRepresentations",
|
"viewKey": "myRepresentations"
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -64,7 +64,7 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
return {
|
return {
|
||||||
setCurrentView: (currentView) => {
|
setCurrentView: (currentView) => {
|
||||||
dispatch(setCurrentView(currentView));
|
dispatch(setCurrentView(currentView));
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -238,8 +238,12 @@ const TopThree = (props) => {
|
|||||||
? "/fymhorth/representation"
|
? "/fymhorth/representation"
|
||||||
: "/myportal/representation",
|
: "/myportal/representation",
|
||||||
query: {
|
query: {
|
||||||
case: showTopThreeArr[key]
|
case:
|
||||||
.ticketnumber,
|
showTopThreeArr[key]
|
||||||
|
.ticketnumber ||
|
||||||
|
showTopThreeArr[key].caseRef ||
|
||||||
|
showTopThreeArr[key]
|
||||||
|
.pinswg_name,
|
||||||
state: "edit",
|
state: "edit",
|
||||||
created:
|
created:
|
||||||
showTopThreeArr[key]
|
showTopThreeArr[key]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import useTranslation from "next-translate/useTranslation";
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { parseCookies } from "nookies";
|
import { parseCookies } from "nookies";
|
||||||
import { useCallback, useState } from "react";
|
import { useState } from "react";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import {
|
import {
|
||||||
deleteAwaitingSubmissionsFromBlob,
|
deleteAwaitingSubmissionsFromBlob,
|
||||||
@@ -98,7 +98,7 @@ const ViewAllResults = (props) => {
|
|||||||
const isWatchedCases = currentViewKey === "watchedCases";
|
const isWatchedCases = currentViewKey === "watchedCases";
|
||||||
const isMyCases = currentViewKey === "myCases";
|
const isMyCases = currentViewKey === "myCases";
|
||||||
|
|
||||||
var resultsArr = isAwaitingSubmissionDetails
|
const resultsArr = isAwaitingSubmissionDetails
|
||||||
? props["awaitingSubmission"].awaitingSubmissionDetails.case
|
? props["awaitingSubmission"].awaitingSubmissionDetails.case
|
||||||
: isMySubmittedReps
|
: isMySubmittedReps
|
||||||
? props[currentViewKey][currentViewKey]
|
? props[currentViewKey][currentViewKey]
|
||||||
@@ -286,7 +286,7 @@ const ViewAllResults = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setCurrentReference({
|
setCurrentReference({
|
||||||
"statuscode": item.statuscode,
|
"statuscode": item.statuscode ?? null,
|
||||||
ticketnumber: item.ticketnumber,
|
ticketnumber: item.ticketnumber,
|
||||||
currentReference: getCurrentReference(item),
|
currentReference: getCurrentReference(item),
|
||||||
currentType: currentViewKey,
|
currentType: currentViewKey,
|
||||||
@@ -452,10 +452,10 @@ const ViewAllResults = (props) => {
|
|||||||
const renderLineBreak = valueToDisplay && idx < 4; // Only insert <br> if it's not the last element
|
const renderLineBreak = valueToDisplay && idx < 4; // Only insert <br> if it's not the last element
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<span key={`${field}-${idx}`}>
|
||||||
{valueToDisplay}
|
{valueToDisplay}
|
||||||
{renderLineBreak && <br />}
|
{renderLineBreak && <br />}
|
||||||
</>
|
</span>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</dd>
|
</dd>
|
||||||
@@ -845,15 +845,12 @@ const ViewAllResults = (props) => {
|
|||||||
//setShowSpinnerState(true);
|
//setShowSpinnerState(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const getSearchPageResults = useCallback(
|
const getSearchPageResults = (pageNumber, orderBy, fieldSort) => {
|
||||||
(pageNumber, orderBy, fieldSort) => {
|
|
||||||
//console.log(advancedSearch, searchString, pageNumber);
|
//console.log(advancedSearch, searchString, pageNumber);
|
||||||
//console.log(pageNumber, orderBy, fieldSort);
|
//console.log(pageNumber, orderBy, fieldSort);
|
||||||
resultsArr.sort(dynamicSort(orderBy, fieldSort));
|
resultsArr.sort(dynamicSort(orderBy, fieldSort));
|
||||||
//console.log(resultsArr);
|
//console.log(resultsArr);
|
||||||
},
|
};
|
||||||
[selectedOption]
|
|
||||||
);
|
|
||||||
|
|
||||||
function dynamicSort(property, order) {
|
function dynamicSort(property, order) {
|
||||||
var sort_order = 1;
|
var sort_order = 1;
|
||||||
|
|||||||
@@ -619,7 +619,6 @@ let AboutYou = (props) => {
|
|||||||
component={RenderTextfield}
|
component={RenderTextfield}
|
||||||
type="text"
|
type="text"
|
||||||
className="govuk-input govuk-input--width-20"
|
className="govuk-input govuk-input--width-20"
|
||||||
validate={[required, emojicheck]}
|
|
||||||
label={t(
|
label={t(
|
||||||
"newappeal:about-you-agent-contact-details-companyname-label"
|
"newappeal:about-you-agent-contact-details-companyname-label"
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ let CompleteAppeal = (props) => {
|
|||||||
const legacyProps = props.props;
|
const legacyProps = props.props;
|
||||||
const legacyFormState = legacyProps.form;
|
const legacyFormState = legacyProps.form;
|
||||||
const legacyAccountDetails = legacyProps.accountDetails;
|
const legacyAccountDetails = legacyProps.accountDetails;
|
||||||
|
const router = useRouter();
|
||||||
|
const { locale } = router;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let incidentId = props.appealType.caseReference.incidentid;
|
let incidentId = props.appealType.caseReference.incidentid;
|
||||||
@@ -77,14 +79,12 @@ let CompleteAppeal = (props) => {
|
|||||||
legacyAccountDetails.loggedinUserId,
|
legacyAccountDetails.loggedinUserId,
|
||||||
props.appealType.appealTypeID,
|
props.appealType.appealTypeID,
|
||||||
legacyAccountDetails.loggedinUserEmail,
|
legacyAccountDetails.loggedinUserEmail,
|
||||||
legacyAccountDetails.containerID
|
legacyAccountDetails.containerID,
|
||||||
|
router.locale
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let { t } = useTranslation();
|
let { t } = useTranslation();
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const { locale } = router;
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
formXML,
|
formXML,
|
||||||
sectionCount,
|
sectionCount,
|
||||||
|
|||||||
@@ -897,20 +897,23 @@ const SearchResults = (props) => {
|
|||||||
|
|
||||||
setCurrentPage(pageNumber);
|
setCurrentPage(pageNumber);
|
||||||
|
|
||||||
resultsArr = _.sortBy(resultsArr, [
|
let sortedResults = [];
|
||||||
|
setResultsArr((previousResults) => {
|
||||||
|
sortedResults = _.sortBy(previousResults, [
|
||||||
function (o) {
|
function (o) {
|
||||||
return o[orderBy];
|
return o[orderBy];
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
fieldSort == "desc" && resultsArr.reverse();
|
fieldSort == "desc" && sortedResults.reverse();
|
||||||
|
return sortedResults;
|
||||||
|
});
|
||||||
|
|
||||||
setShowSpinnerState(false);
|
setShowSpinnerState(false);
|
||||||
setResultsArr(resultsArr);
|
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
"================================\n",
|
"================================\n",
|
||||||
resultsArr,
|
sortedResults,
|
||||||
"sort done",
|
"sort done",
|
||||||
"\n=================================\n"
|
"\n=================================\n"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -150,6 +150,11 @@ export const loadExistingRepresentation = async ({ store, ctx, bootstrap }) => {
|
|||||||
|
|
||||||
console.log("is lpa?:", isLPA);
|
console.log("is lpa?:", isLPA);
|
||||||
|
|
||||||
|
const searchResultsObj = await getBasicSearch(query.case);
|
||||||
|
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
||||||
|
|
||||||
|
store.dispatch(setSearchResults(searchResultsObj));
|
||||||
|
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||||
store.dispatch(setContainerID(thisSession.user.id));
|
store.dispatch(setContainerID(thisSession.user.id));
|
||||||
store.dispatch(setMyRepresentations(myRepresentations));
|
store.dispatch(setMyRepresentations(myRepresentations));
|
||||||
store.dispatch(setMyRepresentationsDetails(myRepresentationsDetails));
|
store.dispatch(setMyRepresentationsDetails(myRepresentationsDetails));
|
||||||
@@ -166,7 +171,6 @@ export const loadExistingRepresentation = async ({ store, ctx, bootstrap }) => {
|
|||||||
|
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
setCurrentReference({
|
setCurrentReference({
|
||||||
"statuscode": result.statuscode,
|
|
||||||
"ticketnumber":
|
"ticketnumber":
|
||||||
result.ticketnumber || result.caseRef || result.pinswg_name,
|
result.ticketnumber || result.caseRef || result.pinswg_name,
|
||||||
"currentReference": result.caseRef,
|
"currentReference": result.caseRef,
|
||||||
@@ -181,7 +185,7 @@ export const loadExistingRepresentation = async ({ store, ctx, bootstrap }) => {
|
|||||||
store.dispatch(setRepresentationCapacity(result.representationCapacity));
|
store.dispatch(setRepresentationCapacity(result.representationCapacity));
|
||||||
|
|
||||||
const repsFileListObj = await getRepsFilesBlobs(
|
const repsFileListObj = await getRepsFilesBlobs(
|
||||||
result.containerID,
|
result.containerID || thisSession.user.id,
|
||||||
result.ticketnumber || result.caseRef,
|
result.ticketnumber || result.caseRef,
|
||||||
result.repfile_name
|
result.repfile_name
|
||||||
);
|
);
|
||||||
@@ -224,8 +228,6 @@ export const loadNewRepresentation = async ({ store, ctx, bootstrap }) => {
|
|||||||
|
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
setCurrentReference({
|
setCurrentReference({
|
||||||
"statuscode": searchResultsObj.value[0].statuscode,
|
|
||||||
|
|
||||||
"isNRW":
|
"isNRW":
|
||||||
accountDetails.emailaddress1.includes(process.env.NRWDOMAIN) ||
|
accountDetails.emailaddress1.includes(process.env.NRWDOMAIN) ||
|
||||||
false,
|
false,
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ const ApiProxy = nextConnect();
|
|||||||
ApiProxy.use(middleware);
|
ApiProxy.use(middleware);
|
||||||
|
|
||||||
ApiProxy.post(async (req, res) => {
|
ApiProxy.post(async (req, res) => {
|
||||||
|
const getFieldValue = (field) => (Array.isArray(field) ? field[0] : field);
|
||||||
|
|
||||||
const checkHash = req.query.hash;
|
const checkHash = req.query.hash;
|
||||||
|
|
||||||
if (typeof checkHash === "undefined" || checkHash.length === 0) {
|
if (typeof checkHash === "undefined" || checkHash.length === 0) {
|
||||||
@@ -32,10 +34,14 @@ ApiProxy.post(async (req, res) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const appealData = req.body.appealData;
|
const appealData = getFieldValue(req.body?.appealData);
|
||||||
const containerID = req.body?.containerID?.[0];
|
const containerID = getFieldValue(req.body?.containerID);
|
||||||
const casefolderID = req.body?.casefolderID?.[0];
|
const casefolderID = getFieldValue(req.body?.casefolderID);
|
||||||
const repOrAppeal = req.body.repOrAppeal || false;
|
const repOrAppealRaw = getFieldValue(req.body?.repOrAppeal);
|
||||||
|
const repOrAppeal =
|
||||||
|
repOrAppealRaw === true ||
|
||||||
|
repOrAppealRaw === "true" ||
|
||||||
|
repOrAppealRaw === "1";
|
||||||
|
|
||||||
if (
|
if (
|
||||||
typeof containerID === "undefined" ||
|
typeof containerID === "undefined" ||
|
||||||
|
|||||||
+16
-13
@@ -7,7 +7,7 @@ import Footer from "../../components/footer";
|
|||||||
import Header from "../../components/header";
|
import Header from "../../components/header";
|
||||||
import ServiceBanner from "../../components/servicebanner";
|
import ServiceBanner from "../../components/servicebanner";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect, useCallback } from "react";
|
||||||
|
|
||||||
const SignIn = (props) => {
|
const SignIn = (props) => {
|
||||||
let { t, lang } = useTranslation();
|
let { t, lang } = useTranslation();
|
||||||
@@ -20,7 +20,7 @@ const SignIn = (props) => {
|
|||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
email: query.email || "",
|
email: query.email || "",
|
||||||
callbackUrl: "",
|
callbackUrl: "",
|
||||||
csrfToken: "",
|
csrfToken: ""
|
||||||
});
|
});
|
||||||
|
|
||||||
const [submitForm, setSubmitForm] = useState(false);
|
const [submitForm, setSubmitForm] = useState(false);
|
||||||
@@ -54,7 +54,8 @@ const SignIn = (props) => {
|
|||||||
// }, 500); // Short delay to ensure form is populated before submission
|
// }, 500); // Short delay to ensure form is populated before submission
|
||||||
// };
|
// };
|
||||||
|
|
||||||
const handleSubmit = async (event) => {
|
const handleSubmit = useCallback(
|
||||||
|
async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
setButtonDisabled(true); // Disable the submit button to avoid multiple submissions
|
setButtonDisabled(true); // Disable the submit button to avoid multiple submissions
|
||||||
|
|
||||||
@@ -62,7 +63,7 @@ const SignIn = (props) => {
|
|||||||
const res = await fetch("/api/auth/signin/emailAPI", {
|
const res = await fetch("/api/auth/signin/emailAPI", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify(formData),
|
body: JSON.stringify(formData)
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
@@ -70,7 +71,9 @@ const SignIn = (props) => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error submitting the form:", error);
|
console.error("Error submitting the form:", error);
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
|
[formData]
|
||||||
|
);
|
||||||
|
|
||||||
// Trigger form submission automatically when data is ready
|
// Trigger form submission automatically when data is ready
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -79,7 +82,7 @@ const SignIn = (props) => {
|
|||||||
setFormData((prevState) => ({
|
setFormData((prevState) => ({
|
||||||
...prevState,
|
...prevState,
|
||||||
csrfToken: csrfToken,
|
csrfToken: csrfToken,
|
||||||
callbackUrl: callbackUrl || prevState.callbackUrl, // Ensure callback URL is set
|
callbackUrl: callbackUrl || prevState.callbackUrl // Ensure callback URL is set
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}, [query.email, csrfToken, callbackUrl, response]);
|
}, [query.email, csrfToken, callbackUrl, response]);
|
||||||
@@ -89,7 +92,7 @@ const SignIn = (props) => {
|
|||||||
if (formData.email && formData.csrfToken && !response) {
|
if (formData.email && formData.csrfToken && !response) {
|
||||||
handleSubmit(new Event("submit"));
|
handleSubmit(new Event("submit"));
|
||||||
}
|
}
|
||||||
}, [formData, response]);
|
}, [formData, response, handleSubmit]);
|
||||||
|
|
||||||
// Handle redirection after form submission based on response
|
// Handle redirection after form submission based on response
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -231,8 +234,8 @@ export async function getServerSideProps(context) {
|
|||||||
return {
|
return {
|
||||||
redirect: {
|
redirect: {
|
||||||
destination: "/403", // custom "Access Denied" page
|
destination: "/403", // custom "Access Denied" page
|
||||||
permanent: false,
|
permanent: false
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,8 +243,8 @@ export async function getServerSideProps(context) {
|
|||||||
return {
|
return {
|
||||||
redirect: {
|
redirect: {
|
||||||
destination: "/status",
|
destination: "/status",
|
||||||
permanent: false,
|
permanent: false
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +253,7 @@ export async function getServerSideProps(context) {
|
|||||||
"\n//////////////////////\n",
|
"\n//////////////////////\n",
|
||||||
"Sign in callbackurl: " + context.req.headers.host,
|
"Sign in callbackurl: " + context.req.headers.host,
|
||||||
context.locale,
|
context.locale,
|
||||||
csrfToken + "\n//////////////////////\n",
|
csrfToken + "\n//////////////////////\n"
|
||||||
);
|
);
|
||||||
let formURL = context.req.headers.host;
|
let formURL = context.req.headers.host;
|
||||||
console.log("formUrl:", formURL);
|
console.log("formUrl:", formURL);
|
||||||
@@ -279,7 +282,7 @@ export async function getServerSideProps(context) {
|
|||||||
url.search = params.toString();
|
url.search = params.toString();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: { csrfToken: csrfToken, callbackUrl: url.toString() },
|
props: { csrfToken: csrfToken, callbackUrl: url.toString() }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user