From 9f3f1c996cb3e995b2c8a868d3a1e2502d83d490 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Wed, 15 May 2024 10:40:59 +0100 Subject: [PATCH] uopdates to naming convention and date handling --- components/case/representation/index.js | 14 +++---- .../representation/representationElements.js | 2 +- components/myportal/topthree_reps.js | 10 ++++- components/myportal/viewall.js | 17 +++++++- components/search/viewall.js | 41 ------------------- 5 files changed, 31 insertions(+), 53 deletions(-) diff --git a/components/case/representation/index.js b/components/case/representation/index.js index 2b9fadf8..b866c828 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -98,7 +98,7 @@ let MakeRepresentation = (props) => { repCap = "APP"; break; case t("myrepresentations:capacity-options-arr-agent"): - repCap = "AGENT"; + repCap = "APP"; //set as App even tho agent as is from an appeallant by proxy break; case t("myrepresentations:capacity-options-arr-interested"): repCap = "IP"; @@ -149,14 +149,14 @@ let MakeRepresentation = (props) => { "-" + day + "-" + - repDate.getHours() + - repDate.getMinutes() + - repDate.getSeconds() + - "_" + + ("0" + repDate.getHours()).slice(-2) + + ("0" + repDate.getMinutes()).slice(-2) + + ("0" + repDate.getSeconds()).slice(-2) + + "_-_" + repCap + - "_" + + "_-_" + repType + - "_" + + "_-_" + values.lastname + "_" + values.firstname, diff --git a/components/case/representation/representationElements.js b/components/case/representation/representationElements.js index 35f3a49b..1909c718 100644 --- a/components/case/representation/representationElements.js +++ b/components/case/representation/representationElements.js @@ -985,7 +985,7 @@ export const RenderFileUpload = (field) => { (file) => new File( [file], - `${field.filenamePrefix}_${file.name}`, + `${field.filenamePrefix}_-_Attachment_-_${file.name}`, { type: file.type, } diff --git a/components/myportal/topthree_reps.js b/components/myportal/topthree_reps.js index da2ae340..5795eeb1 100644 --- a/components/myportal/topthree_reps.js +++ b/components/myportal/topthree_reps.js @@ -150,10 +150,16 @@ const TopThree = (props) => { "-" + datePart.split("-")[1] + "-" + - datePart.split("-")[2] + datePart.split("-")[2] + + " " + + datePart.split("-")[3].split("_")[0].slice(0, 2) + + ":" + + datePart.split("-")[3].split("_")[0].slice(2, 4) + + ":" + + datePart.split("-")[3].split("_")[0].slice(4, 6) ); - return dateObj.toLocaleDateString(); + return dateObj.toLocaleString(); }; let topThreeOnlyArr = showTopThreeArr.slice(0, 3); diff --git a/components/myportal/viewall.js b/components/myportal/viewall.js index ddc73ff0..15eeffa8 100644 --- a/components/myportal/viewall.js +++ b/components/myportal/viewall.js @@ -27,7 +27,20 @@ const ViewAllResults = (props) => { const router = useRouter(); const { locale } = router; const repRaisedDate = (datePart) => { - var dateObj = new Date(datePart); + var dateObj = new Date( + datePart.split("-")[0] + + "-" + + datePart.split("-")[1] + + "-" + + datePart.split("-")[2] + + " " + + datePart.split("-")[3].split("_")[0].slice(0, 2) + + ":" + + datePart.split("-")[3].split("_")[0].slice(2, 4) + + ":" + + datePart.split("-")[3].split("_")[0].slice(4, 6) + ); + return dateObj.toLocaleString(); }; var resultsArr = @@ -493,7 +506,7 @@ const ViewAllResults = (props) => { transLookup ) || "N/A" : currentView.viewKey == "myRepresentations" - ? repRaisedDate(item.createdDate) // ? router.locale == "cy" + ? repRaisedDate(item.repfile_name) // ? router.locale == "cy" : // ? jsonpath( // // '$..[?(@.value=="' + diff --git a/components/search/viewall.js b/components/search/viewall.js index 26fc2264..5e624b5c 100644 --- a/components/search/viewall.js +++ b/components/search/viewall.js @@ -10,45 +10,6 @@ export default function ViewAllResults(props) { const { locale } = router; var resultsArr = props.searchResultsObj.searchResultsObj.value || [{}]; - const resultRow = Object.keys(resultsArr).map((key, index) => { -
-
- - - - Case Reference: - - {resultsArr[key].title} - - -
-
- Site Address: - 23 Martineau Lane -
HASTINGS -
- TN35 5DS -
-
- - Appellant/Applicant: - - Mr J Pocknell -
-
- Authority: - Hastings Borough Council{" "} -
-
- Case Type: - Planning (W){" "} -
-
- Status: - In Progress -
-
; - }); return (
@@ -90,12 +51,10 @@ export default function ViewAllResults(props) { : "/case" } > - Case Reference: {item.title} -