Merged PR 1168: logic to show reps button

logic to show reps button

Related work items: #6653
This commit is contained in:
Robert Bond
2024-05-29 15:24:17 +00:00
7 changed files with 81 additions and 44 deletions
+1 -1
View File
@@ -614,7 +614,7 @@ export const getLPA = () => {
return axios
.get(BASE_URL + "/api/endpoint/getlpa_api")
.then((res) => {
console.log(res.data);
//console.log(res.data);
return res.data;
})
.catch((error) => {
+17 -6
View File
@@ -205,9 +205,19 @@ let MakeRepresentation = (props) => {
const capacityOptionsArr = [
t("myrepresentations:capacity-options-arr-appellant"),
t("myrepresentations:capacity-options-arr-agent"),
t("myrepresentations:capacity-options-arr-interested"),
];
props.props.currentView.caseReference.appealType != 846040017
? capacityOptionsArr.push(
t("myrepresentations:capacity-options-arr-interested")
)
: props.props.currentView.caseReference.specialistProcess !=
846040000 &&
capacityOptionsArr.push(
t("myrepresentations:capacity-options-arr-interested")
);
console.log(props.props.currentView);
let setCaseDetailsObj = router.query.hasOwnProperty("state")
? router.query.state == "edit"
? props.props.myRepresentations.myRepresentations
@@ -290,7 +300,6 @@ let MakeRepresentation = (props) => {
isLPA &&
currentView.caseReference.appealType != 846040019 &&
currentView.caseReference.appealType != 846040011 &&
currentView.caseReference.appealType != 846040015 &&
todaysDate >= startDate &&
todaysDate <= questionnaireDate &&
buildArr.push("Questionnaire");
@@ -313,10 +322,12 @@ let MakeRepresentation = (props) => {
todaysDate <= statementDueDate &&
buildArr.push("Statement");
currentView.caseReference.appealType != 846040004 &&
todaysDate >= statementDueDate &&
todaysDate <= finalCommentsDate &&
buildArr.push("Final comments");
currentView.caseReference.appealType != 846040004 ||
(currentView.caseReference.appealType == 846040004 &&
currentView.caseReference.specialistProcess != 846040001 &&
todaysDate >= statementDueDate &&
todaysDate <= finalCommentsDate &&
buildArr.push("Final comments"));
return buildArr;
};
+45 -34
View File
@@ -436,41 +436,52 @@ const CaseSummary = (props) => {
.caseReference
.appealType
) ? (
<>
<Link
href={{
pathname:
"/myportal/representation",
query: {
case:
currentType ==
"searchResultsObj"
? detailsObj.pinswg_name
: currentType ==
"watchedCases"
? casesObj.pinswg_title
: casesObj.reference,
},
}}
className="govuk-button"
>
{t(
"case:summary-make-representation-label"
)}
</Link>
props.currentView
.caseReference
.appealType ==
846040018 &&
props.currentView
.caseReference
.specialistProcess ==
846040000 ? (
""
) : (
<>
<Link
href={{
pathname:
"/myportal/representation",
query: {
case:
currentType ==
"searchResultsObj"
? detailsObj.pinswg_name
: currentType ==
"watchedCases"
? casesObj.pinswg_title
: casesObj.reference,
},
}}
className="govuk-button"
>
{t(
"case:summary-make-representation-label"
)}
</Link>
<a
onClick={() => {
//spinnerState();
router.back();
}}
className="govuk-button govuk-button--secondary"
>
{t(
"case:summary-back-button-label"
)}
</a>
</>
<a
onClick={() => {
//spinnerState();
router.back();
}}
className="govuk-button govuk-button--secondary"
>
{t(
"case:summary-back-button-label"
)}
</a>
</>
)
) : !isLPA &&
props.currentView
.caseReference
+8
View File
@@ -312,6 +312,14 @@ const SearchResults = (props) => {
item.pinswg_appealcasetype,
"showLoginCheck":
props.showLoginCheck,
"specialistProcess":
detailsObj.pinswg_speacialistcaseprocess !=
null ||
detailsObj.pinswg_specialistcaseprocess !=
null
? detailsObj.pinswg_speacialistcaseprocess ||
detailsObj.pinswg_specialistcaseprocess
: "",
});
}}
>
@@ -45,7 +45,7 @@ export default async function ApiProxy(req, res) {
loggedInUserId +
"&$count=true&$orderby=createdon desc";
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
//console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
return axios
.get(
+1 -1
View File
@@ -45,7 +45,7 @@ export default async function ApiProxy(req, res) {
contactid +
")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode,pinswg_typeofinvolvement,pinswg_contact_associatedlpa,pinswg_preferredlanguage&$count=true";
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
// console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
var apiResponse =
contactid.length > 0
+8 -1
View File
@@ -7,6 +7,7 @@ import {
getPortalModuleDetails,
getWatchedCases,
getPersonalAccount,
getPortalLogin,
getIP,
} from "../../actions";
import Breadcrumbs from "../../components/breadcrumbs";
@@ -82,11 +83,12 @@ export const getServerSideProps = wrapper.getServerSideProps(
//console.log("search array:", Object.entries(query));
const { cookies } = req;
let loggedInUser = cookies.pinsUser;
const showLoginCheck = process.env.SHOWLOGIN || false;
let thisSession = await getSession(ctx);
let loggedInUser = await getPortalLogin(thisSession.user.email);
if (!thisSession) {
console.log("not has sesssion.......");
return {
@@ -99,6 +101,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
thisSession != false &&
store.dispatch(setContainerID(thisSession.user.id));
loggedInUser = await getPortalLogin(thisSession.user.email);
loggedInUser = loggedInUser.value[0].contactid;
const [accountDetails, searchResultsObj, watchedCases] =
await Promise.all([
await getPersonalAccount(loggedInUser),
@@ -123,6 +129,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
store.dispatch(setWatchedCases(watchedCases));
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
store.dispatch(setSearch(Object.entries(query)));
store.dispatch(setLoggedInUserId(loggedInUser));
}
return {
props: {