logic to show reps button

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