added additional current refs ticketnumber variants + reps on results
This commit is contained in:
+1
-1
@@ -59,7 +59,7 @@ API_ROOT = "http://localhost:3000"
|
|||||||
CY_API_ROOT = "http://cymru.local:3000"
|
CY_API_ROOT = "http://cymru.local:3000"
|
||||||
I18N_DOMAIN = "cymru.local"
|
I18N_DOMAIN = "cymru.local"
|
||||||
DOCAPI_OFFLINE = "12:00:00,14:00:00"
|
DOCAPI_OFFLINE = "12:00:00,14:00:00"
|
||||||
SHOWFILTERDOCS = true
|
SHOWFILTERDOCS = false
|
||||||
|
|
||||||
|
|
||||||
// Next Auth vars
|
// Next Auth vars
|
||||||
|
|||||||
@@ -486,7 +486,7 @@ let RepLPA = (props) => {
|
|||||||
className="govuk-button"
|
className="govuk-button"
|
||||||
data-module="govuk-button"
|
data-module="govuk-button"
|
||||||
>
|
>
|
||||||
wwwww {t("common:continue-button")}
|
{t("common:continue-button")}
|
||||||
</button>
|
</button>
|
||||||
{/* {router.query.state != "edit" && (
|
{/* {router.query.state != "edit" && (
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -155,6 +155,9 @@ const ViewAllResults = (props) => {
|
|||||||
query: {
|
query: {
|
||||||
case: resultsArr[key].caseRef,
|
case: resultsArr[key].caseRef,
|
||||||
state: "edit",
|
state: "edit",
|
||||||
|
created:
|
||||||
|
resultsArr[key]
|
||||||
|
.repfile_name,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
: currentView.viewKey ==
|
: currentView.viewKey ==
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import {
|
|||||||
deleteWatchedCases,
|
deleteWatchedCases,
|
||||||
getWatchedCasesProxy,
|
getWatchedCasesProxy,
|
||||||
} from "../../actions";
|
} from "../../actions";
|
||||||
|
import RepsOnResults from "./repsonresults";
|
||||||
|
|
||||||
const SearchResults = (props) => {
|
const SearchResults = (props) => {
|
||||||
const {
|
const {
|
||||||
@@ -291,6 +292,9 @@ const SearchResults = (props) => {
|
|||||||
</span>
|
</span>
|
||||||
{item.pinswg_name}
|
{item.pinswg_name}
|
||||||
</Link>
|
</Link>
|
||||||
|
<RepsOnResults
|
||||||
|
detailsObj={detailsObj}
|
||||||
|
/>
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">
|
||||||
|
|||||||
@@ -0,0 +1,196 @@
|
|||||||
|
import useTranslation from "next-translate/useTranslation";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
import _ from "lodash";
|
||||||
|
|
||||||
|
const RepsOnResults = (props) => {
|
||||||
|
let { t } = useTranslation();
|
||||||
|
|
||||||
|
const detailsObj = props.detailsObj;
|
||||||
|
|
||||||
|
function showReps(startDate, endDate) {
|
||||||
|
let date = new Date();
|
||||||
|
date = new Date(date.toDateString());
|
||||||
|
const start = new Date(startDate);
|
||||||
|
const end = new Date(endDate);
|
||||||
|
|
||||||
|
return date >= start && date <= end ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function showRepButton(appealType) {
|
||||||
|
switch (appealType) {
|
||||||
|
case 846040012:
|
||||||
|
case 846040013:
|
||||||
|
case 846040014:
|
||||||
|
//for ROW case 846040015:
|
||||||
|
case 846040020:
|
||||||
|
case 846040021:
|
||||||
|
case 846040023:
|
||||||
|
case 846040024:
|
||||||
|
return false;
|
||||||
|
case 846040004:
|
||||||
|
return isLPA ? true : false;
|
||||||
|
|
||||||
|
case 846040015:
|
||||||
|
return props.searchDetailsObj[0].value[0]
|
||||||
|
.pinswg_specialistcaseprocess == 846040001
|
||||||
|
? showReps(
|
||||||
|
props.searchDetailsObj[0].value[0].pinswg_startdate,
|
||||||
|
props.searchDetailsObj[0].value[0]
|
||||||
|
.pinswg_finalcommentsduedate
|
||||||
|
)
|
||||||
|
: true;
|
||||||
|
|
||||||
|
case 846040018:
|
||||||
|
let shouldShow =
|
||||||
|
props.searchDetailsObj[0].value[0]
|
||||||
|
.pinswg_speacialistcaseprocess == 846040000 && isLPA
|
||||||
|
? true
|
||||||
|
: props.searchDetailsObj[0].value[0]
|
||||||
|
.pinswg_speacialistcaseprocess == 846040001
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
|
|
||||||
|
return shouldShow;
|
||||||
|
|
||||||
|
case 846040019:
|
||||||
|
return showReps(
|
||||||
|
props.searchDetailsObj[0].value[0].pinswg_startdate,
|
||||||
|
props.searchDetailsObj[0].value[0].pinswg_statementduedate
|
||||||
|
);
|
||||||
|
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showRepsEnded(startDate, endDate) {
|
||||||
|
let date = new Date();
|
||||||
|
date = new Date(date.toDateString());
|
||||||
|
const start = new Date(startDate);
|
||||||
|
const end = new Date(endDate);
|
||||||
|
return date > start && date > end ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatDates(dateObj, showTime) {
|
||||||
|
var dateObj = new Date(dateObj);
|
||||||
|
var dd = String(dateObj.getDate()).padStart(2, "0");
|
||||||
|
var mm = String(dateObj.getMonth() + 1).padStart(2, "0"); //January is 0!
|
||||||
|
var yyyy = dateObj.getFullYear();
|
||||||
|
var hh = dateObj.getHours();
|
||||||
|
hh = ("0" + hh).slice(-2);
|
||||||
|
var mins = dateObj.getMinutes();
|
||||||
|
mins = ("0" + mins).slice(-2);
|
||||||
|
|
||||||
|
const dateStr = showTime
|
||||||
|
? hh == 0 && mins == 0
|
||||||
|
? ""
|
||||||
|
: hh + ":" + mins
|
||||||
|
: dd + "/" + mm + "/" + yyyy + " ";
|
||||||
|
return dateStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
{(_.has(detailsObj, "pinswg_startdate") ||
|
||||||
|
_.has(detailsObj, "pinswg_applicationacceptedasvalid")) &&
|
||||||
|
showReps(
|
||||||
|
detailsObj.pinswg_startdate ||
|
||||||
|
detailsObj.pinswg_applicationacceptedasvalid,
|
||||||
|
detailsObj.pinswg_finalcommentsduedate ||
|
||||||
|
detailsObj.pinswg_endofrepresentationperiod
|
||||||
|
) && (
|
||||||
|
<>
|
||||||
|
{showRepButton(detailsObj.appealType) ? (
|
||||||
|
<>
|
||||||
|
{/* <Link
|
||||||
|
href={{
|
||||||
|
pathname:
|
||||||
|
"/myportal/representation",
|
||||||
|
query: {
|
||||||
|
case: detailsObj.pinswg_name,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
className="govuk-button"
|
||||||
|
>
|
||||||
|
{t(
|
||||||
|
"case:summary-make-representation-label"
|
||||||
|
)}
|
||||||
|
</Link> */}
|
||||||
|
<div className="govuk-body govuk-!-font-size-14">
|
||||||
|
{t(
|
||||||
|
"case:summary-representation-open-label"
|
||||||
|
)}{" "}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
) : !isLPA &&
|
||||||
|
props.currentView.caseReference.appealType ==
|
||||||
|
846040004 ? (
|
||||||
|
""
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<div className="govuk-grid-column-full govuk-!-padding-left-0">
|
||||||
|
<div className="govuk-button-group">
|
||||||
|
<p className="govuk-body">
|
||||||
|
{t(
|
||||||
|
"case:representation-date-passed-label",
|
||||||
|
{
|
||||||
|
startDate: formatDates(
|
||||||
|
detailsObj.pinswg_startdate
|
||||||
|
),
|
||||||
|
endDate:
|
||||||
|
props.currentView
|
||||||
|
.caseReference
|
||||||
|
.appealType ==
|
||||||
|
846040019
|
||||||
|
? formatDates(
|
||||||
|
detailsObj.pinswg_statementduedate
|
||||||
|
)
|
||||||
|
: formatDates(
|
||||||
|
detailsObj.pinswg_finalcommentsduedate
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)}
|
||||||
|
<br />{" "}
|
||||||
|
{t(
|
||||||
|
"case:representation-date-passed-additional-label"
|
||||||
|
)}{" "}
|
||||||
|
<Link
|
||||||
|
href={
|
||||||
|
"mailto:" +
|
||||||
|
t(
|
||||||
|
"home:login-contact-email"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{t("home:login-contact-email")}
|
||||||
|
</Link>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}{" "}
|
||||||
|
{_.has(detailsObj, "pinswg_startdate") &&
|
||||||
|
(detailsObj.pinswg_startdate != null ||
|
||||||
|
detailsObj.pinswg_finalcommentsduedate != null) &&
|
||||||
|
showRepsEnded(
|
||||||
|
detailsObj.pinswg_startdate,
|
||||||
|
detailsObj.pinswg_finalcommentsduedate
|
||||||
|
) && (
|
||||||
|
<div className="govuk-body govuk-!-font-size-14">
|
||||||
|
{t("case:representation-period-ended-on-label")}
|
||||||
|
{detailsObj.appealType == 846040019
|
||||||
|
? formatDates(detailsObj.pinswg_statementduedate)
|
||||||
|
: formatDates(
|
||||||
|
detailsObj.pinswg_finalcommentsduedate
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default RepsOnResults;
|
||||||
@@ -35,6 +35,7 @@ import {
|
|||||||
} from "../../actions";
|
} from "../../actions";
|
||||||
|
|
||||||
import { sendGAEvent } from "@next/third-parties/google";
|
import { sendGAEvent } from "@next/third-parties/google";
|
||||||
|
import RepsOnResults from "./repsonresults";
|
||||||
|
|
||||||
const SearchResults = (props) => {
|
const SearchResults = (props) => {
|
||||||
const {
|
const {
|
||||||
@@ -250,6 +251,7 @@ const SearchResults = (props) => {
|
|||||||
key={key}
|
key={key}
|
||||||
>
|
>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||||
|
<div></div>
|
||||||
<Link
|
<Link
|
||||||
href={
|
href={
|
||||||
router.locale == "cy"
|
router.locale == "cy"
|
||||||
@@ -306,6 +308,9 @@ const SearchResults = (props) => {
|
|||||||
</span>
|
</span>
|
||||||
{item.title}
|
{item.title}
|
||||||
</Link>
|
</Link>
|
||||||
|
<RepsOnResults
|
||||||
|
detailsObj={detailsObj}
|
||||||
|
/>
|
||||||
</dd>
|
</dd>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16">
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
"summary-case-stage-label": "Cyfnod Achos",
|
"summary-case-stage-label": "Cyfnod Achos",
|
||||||
"summary-last-modified-label": "Addaswyd ddiwethaf",
|
"summary-last-modified-label": "Addaswyd ddiwethaf",
|
||||||
"summary-make-representation-label": "Cyflwyno cynrychiolaeth",
|
"summary-make-representation-label": "Cyflwyno cynrychiolaeth",
|
||||||
|
"summary-representation-open-label": "Cynrychioliadau yn agor",
|
||||||
"summary-back-button-label": "Ewch yn ôl",
|
"summary-back-button-label": "Ewch yn ôl",
|
||||||
"summary-case-details-label": "Manylion yr Achos",
|
"summary-case-details-label": "Manylion yr Achos",
|
||||||
"summary-project-details-label": "Manylion y Prosiect",
|
"summary-project-details-label": "Manylion y Prosiect",
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
"summary-case-stage-label": "Case Stage",
|
"summary-case-stage-label": "Case Stage",
|
||||||
"summary-last-modified-label": "Last modified",
|
"summary-last-modified-label": "Last modified",
|
||||||
"summary-make-representation-label": "Make representation",
|
"summary-make-representation-label": "Make representation",
|
||||||
|
"summary-representation-open-label": "Representations open",
|
||||||
"summary-back-button-label": "Go back",
|
"summary-back-button-label": "Go back",
|
||||||
"summary-case-details-label": "Case Details",
|
"summary-case-details-label": "Case Details",
|
||||||
"summary-project-details-label": "Project Details",
|
"summary-project-details-label": "Project Details",
|
||||||
|
|||||||
@@ -413,6 +413,47 @@ export default async function ApiProxy(req, res) {
|
|||||||
"')) "
|
"')) "
|
||||||
: "") +
|
: "") +
|
||||||
"&$orderby=createdon desc&$select=modifiedon,_pinswg_appellant_value,pinswg_name," +
|
"&$orderby=createdon desc&$select=modifiedon,_pinswg_appellant_value,pinswg_name," +
|
||||||
|
(item.LogicalCollectionName == "pinswg_planningappeals78s" ||
|
||||||
|
item.LogicalCollectionName ==
|
||||||
|
"pinswg_lawfuldevelopmentcertificates" ||
|
||||||
|
item.LogicalCollectionName == "pinswg_householderappealhases" ||
|
||||||
|
item.LogicalCollectionName == "pinswg_advertses" ||
|
||||||
|
item.LogicalCollectionName == "pinswg_callinss77s" ||
|
||||||
|
item.LogicalCollectionName == "pinswg_commonlands" ||
|
||||||
|
item.LogicalCollectionName ==
|
||||||
|
"pinswg_communityinfrastructurelevys117118119s" ||
|
||||||
|
item.LogicalCollectionName ==
|
||||||
|
"pinswg_compulsorypurchaseorderses" ||
|
||||||
|
item.LogicalCollectionName ==
|
||||||
|
"pinswg_enforcementnoticeappeals174s" ||
|
||||||
|
item.LogicalCollectionName ==
|
||||||
|
"pinswg_environmentalpermittings" ||
|
||||||
|
item.LogicalCollectionName ==
|
||||||
|
"pinswg_hedgeshedgerowstreepreservationreplacems" ||
|
||||||
|
item.LogicalCollectionName ==
|
||||||
|
"pinswg_lawfuldevelopmentcertificates" ||
|
||||||
|
item.LogicalCollectionName == "pinswg_miscellaneouscaseworks" ||
|
||||||
|
item.LogicalCollectionName ==
|
||||||
|
"pinswg_planningconditionss73s79s" ||
|
||||||
|
item.LogicalCollectionName ==
|
||||||
|
"pinswg_planningobligationappeals106s" ||
|
||||||
|
item.LogicalCollectionName == "pinswg_rows" ||
|
||||||
|
item.LogicalCollectionName == "pinswg_wayleaves"
|
||||||
|
? "pinswg_startdate,pinswg_finalcommentsduedate,"
|
||||||
|
: "") +
|
||||||
|
(item.LogicalCollectionName ==
|
||||||
|
"pinswg_enforcementlistedbuildingconservationaps" ||
|
||||||
|
item.LogicalCollectionName == "pinswg_maintenanceoflands217s"
|
||||||
|
? "pinswg_startdates,pinswg_finalcommentsduedate,"
|
||||||
|
: "") +
|
||||||
|
(item.LogicalCollectionName == "pinswg_nonvalidations"
|
||||||
|
? "pinswg_validdate,"
|
||||||
|
: "") +
|
||||||
|
(item.LogicalCollectionName == "pinswg_electricityacts" ||
|
||||||
|
item.LogicalCollectionName == "pinswg_dnses" ||
|
||||||
|
item.LogicalCollectionName == "pinswg_transportandworkacts"
|
||||||
|
? "pinswg_applicationacceptedasvalid,pinswg_endofrepresentationperiod,"
|
||||||
|
: "") +
|
||||||
(item.LogicalCollectionName == "pinswg_ldps" ||
|
(item.LogicalCollectionName == "pinswg_ldps" ||
|
||||||
item.LogicalCollectionName == "pinswg_harbourrevisionorders"
|
item.LogicalCollectionName == "pinswg_harbourrevisionorders"
|
||||||
? "pinswg_addresstown,pinswg_addressline1,pinswg_addresscounty,pinswg_addressline2,pinswg_addresspostcode"
|
? "pinswg_addresstown,pinswg_addressline1,pinswg_addresscounty,pinswg_addressline2,pinswg_addresspostcode"
|
||||||
|
|||||||
@@ -274,7 +274,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
setCurrentReference({
|
setCurrentReference({
|
||||||
"ticketnumber": result.ticketnumber,
|
"ticketnumber":
|
||||||
|
result.ticketnumber ||
|
||||||
|
result.caseRef ||
|
||||||
|
result.pinswg_name,
|
||||||
"currentReference": result.caseRef,
|
"currentReference": result.caseRef,
|
||||||
"currentType": "myRepresentations",
|
"currentType": "myRepresentations",
|
||||||
"incidentid": result.incidentID,
|
"incidentid": result.incidentID,
|
||||||
|
|||||||
Reference in New Issue
Block a user