refactor phase 3a components chunk 1 targeted actions imports
This commit is contained in:
@@ -9,7 +9,10 @@ import transLookup from "../../data/lookuptranslations.json";
|
||||
import PaginationControl from "./pagination";
|
||||
import RepsOnResults from "./repsonresults";
|
||||
|
||||
import { getBasicDNSSearchPaged, getDNSCoords } from "../../actions";
|
||||
import {
|
||||
getBasicDNSSearchPaged,
|
||||
getDNSCoords
|
||||
} from "../../actions/services/searchService";
|
||||
|
||||
import GoogleMapReact from "google-map-react";
|
||||
import { parseCookies } from "nookies";
|
||||
@@ -17,19 +20,19 @@ import OSPoint from "ospoint";
|
||||
import {
|
||||
createWatchedCases,
|
||||
deleteWatchedCases,
|
||||
getWatchedCasesProxy,
|
||||
} from "../../actions";
|
||||
getWatchedCasesProxy
|
||||
} from "../../actions/services/portalService";
|
||||
import {
|
||||
setCurrentPage,
|
||||
setCurrentReference,
|
||||
setCurrentReference
|
||||
} from "../../store/currentView/action";
|
||||
import {
|
||||
setSearchDetails,
|
||||
setSearchResults,
|
||||
setSearchResults
|
||||
} from "../../store/searchOutput/action";
|
||||
import {
|
||||
setWatchedCases,
|
||||
setWatchedCasesDetails,
|
||||
setWatchedCasesDetails
|
||||
} from "../../store/watchedCases/action";
|
||||
import { getDetailsProxy, getSearchDetailsPaged } from "../utils";
|
||||
import { signIn, useSession } from "next-auth/react";
|
||||
@@ -49,7 +52,7 @@ const DNSSearchResults = (props) => {
|
||||
setWatchedCases,
|
||||
setWatchedCasesDetails,
|
||||
showMap,
|
||||
showLoginCheck,
|
||||
showLoginCheck
|
||||
} = props;
|
||||
let { t } = useTranslation();
|
||||
|
||||
@@ -159,17 +162,17 @@ const DNSSearchResults = (props) => {
|
||||
let updateBody = {
|
||||
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
|
||||
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
|
||||
"pinswg_appealcasetype": +appealType,
|
||||
"pinswg_appealcasetype": +appealType
|
||||
};
|
||||
|
||||
createWatchedCases(updateBody)
|
||||
.then((data) => data)
|
||||
.then(() => {
|
||||
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
|
||||
setWatchedCases(data),
|
||||
(setWatchedCases(data),
|
||||
getDetailsProxy(data, "myWatchedCases").then((data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
});
|
||||
}));
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -184,7 +187,7 @@ const DNSSearchResults = (props) => {
|
||||
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
|
||||
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
|
||||
"pinswg_appealcasetype": +appealType,
|
||||
"pinswg_emailnotifications": true,
|
||||
"pinswg_emailnotifications": true
|
||||
};
|
||||
|
||||
console.log("Email signed up");
|
||||
@@ -193,12 +196,12 @@ const DNSSearchResults = (props) => {
|
||||
.then(() => {
|
||||
getWatchedCasesProxy(props.accountDetails.loggedinUserId).then(
|
||||
(data) => {
|
||||
setWatchedCases(data),
|
||||
(setWatchedCases(data),
|
||||
getDetailsProxy(data, "myWatchedCases").then(
|
||||
(data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
}
|
||||
);
|
||||
));
|
||||
}
|
||||
);
|
||||
});
|
||||
@@ -211,7 +214,7 @@ const DNSSearchResults = (props) => {
|
||||
whichIncident +
|
||||
"')]",
|
||||
json: watchedCases,
|
||||
eval: true,
|
||||
eval: true
|
||||
});
|
||||
|
||||
return isWatched;
|
||||
@@ -225,7 +228,7 @@ const DNSSearchResults = (props) => {
|
||||
"' && @.pinswg_emailnotifications==true)]",
|
||||
|
||||
json: watchedCases,
|
||||
eval: true,
|
||||
eval: true
|
||||
});
|
||||
return isEmail;
|
||||
};
|
||||
@@ -247,7 +250,7 @@ const DNSSearchResults = (props) => {
|
||||
let newObj = {};
|
||||
return Object.assign(newObj, {
|
||||
"@odata.count": required.length,
|
||||
"value": required,
|
||||
"value": required
|
||||
});
|
||||
};
|
||||
|
||||
@@ -258,12 +261,12 @@ const DNSSearchResults = (props) => {
|
||||
var dateB = new Date(b.createdon);
|
||||
return dateB - dateA;
|
||||
});
|
||||
setWatchedCases(data),
|
||||
(setWatchedCases(data),
|
||||
getDetailsProxy(data, "myWatchedCases").then(
|
||||
(data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
}
|
||||
);
|
||||
));
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -385,7 +388,7 @@ const DNSSearchResults = (props) => {
|
||||
item.ticketnumber +
|
||||
'")]',
|
||||
json: searchDetailsObj,
|
||||
eval: true,
|
||||
eval: true
|
||||
});
|
||||
detailsObj = detailsObj[0];
|
||||
|
||||
@@ -399,7 +402,7 @@ const DNSSearchResults = (props) => {
|
||||
] +
|
||||
'")].value_cy',
|
||||
json: transLookup,
|
||||
eval: true,
|
||||
eval: true
|
||||
})
|
||||
: item[
|
||||
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||
@@ -427,10 +430,10 @@ const DNSSearchResults = (props) => {
|
||||
: "/dns/" +
|
||||
item.ticketnumber
|
||||
: myportal == true
|
||||
? "/myportal/dns/" +
|
||||
item.ticketnumber
|
||||
: "/dns/" +
|
||||
item.ticketnumber
|
||||
? "/myportal/dns/" +
|
||||
item.ticketnumber
|
||||
: "/dns/" +
|
||||
item.ticketnumber
|
||||
}
|
||||
className="govuk-link--no-underline"
|
||||
onClick={() => {
|
||||
@@ -447,7 +450,7 @@ const DNSSearchResults = (props) => {
|
||||
item.pinswg_appealcasetype,
|
||||
"showMap": showMap,
|
||||
"showLoginCheck":
|
||||
props.showLoginCheck,
|
||||
props.showLoginCheck
|
||||
});
|
||||
}}
|
||||
>
|
||||
@@ -484,32 +487,33 @@ const DNSSearchResults = (props) => {
|
||||
) < 0
|
||||
? detailsObj.pinswg_projectlocation
|
||||
: router.locale == "cy"
|
||||
? detailsObj.pinswg_projectlocation.split(
|
||||
";"
|
||||
)[1]
|
||||
: detailsObj.pinswg_projectlocation.split(
|
||||
";"
|
||||
)[0]
|
||||
? detailsObj.pinswg_projectlocation.split(
|
||||
";"
|
||||
)[1]
|
||||
: detailsObj.pinswg_projectlocation.split(
|
||||
";"
|
||||
)[0]
|
||||
: ""
|
||||
: hasValidKey(
|
||||
item,
|
||||
"pinswg_caseaddress"
|
||||
)
|
||||
? item.pinswg_caseaddress !=
|
||||
null
|
||||
? item.pinswg_caseaddress.indexOf(
|
||||
";"
|
||||
) < 0
|
||||
? item.pinswg_caseaddress
|
||||
: router.locale == "cy"
|
||||
? item.pinswg_caseaddress.split(
|
||||
";"
|
||||
)[1]
|
||||
: item.pinswg_caseaddress.split(
|
||||
";"
|
||||
)[0]
|
||||
: ""
|
||||
: ""}
|
||||
item,
|
||||
"pinswg_caseaddress"
|
||||
)
|
||||
? item.pinswg_caseaddress !=
|
||||
null
|
||||
? item.pinswg_caseaddress.indexOf(
|
||||
";"
|
||||
) < 0
|
||||
? item.pinswg_caseaddress
|
||||
: router.locale ==
|
||||
"cy"
|
||||
? item.pinswg_caseaddress.split(
|
||||
";"
|
||||
)[1]
|
||||
: item.pinswg_caseaddress.split(
|
||||
";"
|
||||
)[0]
|
||||
: ""
|
||||
: ""}
|
||||
|
||||
{_.has(
|
||||
detailsObj,
|
||||
@@ -574,7 +578,7 @@ const DNSSearchResults = (props) => {
|
||||
:
|
||||
</span>
|
||||
{_.has(detailsObj, [
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||
])
|
||||
? detailsObj[
|
||||
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
|
||||
@@ -589,7 +593,7 @@ const DNSSearchResults = (props) => {
|
||||
:
|
||||
</span>
|
||||
{_.has(detailsObj, [
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
])
|
||||
? router.locale == "cy"
|
||||
? jsonpath({
|
||||
@@ -600,7 +604,7 @@ const DNSSearchResults = (props) => {
|
||||
] +
|
||||
'")].value_cy',
|
||||
json: transLookup,
|
||||
eval: true,
|
||||
eval: true
|
||||
})
|
||||
: detailsObj[
|
||||
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
|
||||
@@ -623,7 +627,7 @@ const DNSSearchResults = (props) => {
|
||||
] +
|
||||
'")].value_cy',
|
||||
json: transLookup,
|
||||
eval: true,
|
||||
eval: true
|
||||
})
|
||||
: item[
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
@@ -782,7 +786,7 @@ const DNSSearchResults = (props) => {
|
||||
"&toWatch=" +
|
||||
item.incidentid +
|
||||
"_" +
|
||||
item.pinswg_appealcasetype,
|
||||
item.pinswg_appealcasetype
|
||||
}
|
||||
);
|
||||
}}
|
||||
@@ -886,7 +890,7 @@ const DNSSearchResults = (props) => {
|
||||
fieldSortState,
|
||||
orderByState,
|
||||
searchLoaded,
|
||||
getSearchPageResults,
|
||||
getSearchPageResults
|
||||
]);
|
||||
return (
|
||||
<>
|
||||
@@ -1058,14 +1062,14 @@ const mapDispatchToProps = (dispatch) => {
|
||||
},
|
||||
setCurrentPage: (currentPage) => {
|
||||
dispatch(setCurrentPage(currentPage));
|
||||
},
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
// currentView: state.currentView,
|
||||
accountDetails: state.accountDetails,
|
||||
accountDetails: state.accountDetails
|
||||
// search: state.search,
|
||||
// searchResultsObj: state.searchResultsObj,
|
||||
};
|
||||
|
||||
@@ -5,7 +5,10 @@ import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import { useCallback, useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { getAdvancedSearchPaged, getBasicSearchPaged } from "../../actions";
|
||||
import {
|
||||
getAdvancedSearchPaged,
|
||||
getBasicSearchPaged
|
||||
} from "../../actions/services/searchService";
|
||||
import transLookup from "../../data/lookuptranslations.json";
|
||||
import {
|
||||
setCurrentPage,
|
||||
@@ -32,7 +35,7 @@ import {
|
||||
createWatchedCases,
|
||||
deleteWatchedCases,
|
||||
getWatchedCasesProxy
|
||||
} from "../../actions";
|
||||
} from "../../actions/services/portalService";
|
||||
|
||||
import { sendGAEvent } from "@next/third-parties/google";
|
||||
import RepsOnResults from "./repsonresults";
|
||||
|
||||
Reference in New Issue
Block a user