diff --git a/components/case/summary/utils/caseStagesByAppealType.js b/components/case/summary/utils/caseStagesByAppealType.js index ee8f084d..820a1684 100644 --- a/components/case/summary/utils/caseStagesByAppealType.js +++ b/components/case/summary/utils/caseStagesByAppealType.js @@ -692,7 +692,7 @@ export const stagesByCaseType = { descriptionKey: "report-to-ministers-desc-cpo" }, { - stageId: 846040013, + stageId: 846040060, titleKey: "case-closed", descriptionKey: "case-closed-desc-order" } diff --git a/components/search/advancedsearch.js b/components/search/advancedsearch.js index 2222e3ed..d37f694f 100644 --- a/components/search/advancedsearch.js +++ b/components/search/advancedsearch.js @@ -5,6 +5,7 @@ import { connect } from "react-redux"; import { Field, formValueSelector, reduxForm } from "redux-form"; import transLookup from "../../data/lookuptranslations.json"; +import { statusValues } from "../utils/caseStagesObj"; const required = (errorMsg) => (value) => value || typeof value === "number" ? undefined : errorMsg; @@ -120,7 +121,7 @@ const RenderCaseStatusList = ({ optionsObj, meta: { touched, error }, label, - errormsg, + errormsg }) => { let { t } = useTranslation(); const router = useRouter(); @@ -170,23 +171,25 @@ const RenderCaseStatusList = ({ {_.isEmpty(optionsObj[key]) ? "" : _.isEmpty(optionsObj[key]) - ? "" - : _.isEmpty(optionsObj[key].value) - ? "" - : router.locale == "cy" - ? jsonpath({ - path: - '$..[?(@ && @.statuscode=="' + - optionsObj[key] - .statuscode + - '")].value_cy', - json: optionsObj, - eval: true, - }) - : optionsObj[key].value || - t( - "case:summary-no-date-entered-label" - )} + ? "" + : _.isEmpty( + optionsObj[key].value + ) + ? "" + : router.locale == "cy" + ? jsonpath({ + path: + '$..[?(@ && @.statuscode=="' + + optionsObj[key] + .statuscode + + '")].value_cy', + json: optionsObj, + eval: true + }) + : optionsObj[key].value || + t( + "case:summary-no-date-entered-label" + )} ); })} @@ -211,7 +214,7 @@ let AdvancedSearch = (props) => { error, pristine, reset, - submitting, + submitting } = props; const appealOptionsObj = @@ -236,7 +239,7 @@ let AdvancedSearch = (props) => { optionsObj, meta: { touched, error }, label, - errormsg, + errormsg }) => { return ( <> @@ -291,7 +294,7 @@ let AdvancedSearch = (props) => { .name + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : optionsObj[key].name || t( @@ -314,7 +317,7 @@ let AdvancedSearch = (props) => { optionsObj, meta: { touched, error }, label, - errormsg, + errormsg }) => { return ( <> @@ -361,47 +364,52 @@ let AdvancedSearch = (props) => { _.isEmpty(optionsObj[key]) ? "" : _.isEmpty( - optionsObj[key] - ) - ? "" - : _.isEmpty( - optionsObj[key] - .value - ) - ? "" - : optionsObj[key] - .attributevalue + - "," + - optionsObj[key].value - .replace( - /(\band|[\s\-\+\(\)\,\&])/g, - "" + optionsObj[key] + ) + ? "" + : _.isEmpty( + optionsObj[key] + .value ) - .toLowerCase() + ? "" + : optionsObj[key] + .attributevalue + + "," + + optionsObj[ + key + ].value + .replace( + /(\band|[\s\-\+\(\)\,\&])/g, + "" + ) + .toLowerCase() } > {_.isEmpty(optionsObj[key]) ? "" : _.isEmpty(optionsObj[key]) - ? "" - : _.isEmpty( - optionsObj[key].value - ) - ? "" - : router.locale == "cy" - ? jsonpath({ - path: - '$..[?(@ && @.value=="' + + ? "" + : _.isEmpty( optionsObj[key] - .value + - '")].value_cy', - json: transLookup, - eval: true, - }) - : optionsObj[key].value || - t( - "case:summary-no-date-entered-label" - )} + .value + ) + ? "" + : router.locale == "cy" + ? jsonpath({ + path: + '$..[?(@ && @.value=="' + + optionsObj[ + key + ].value + + '")].value_cy', + json: transLookup, + eval: true + }) + : optionsObj[key] + .value || + t( + "case:summary-no-date-entered-label" + )} ); })} @@ -418,7 +426,7 @@ let AdvancedSearch = (props) => { optionsObj, meta: { touched, error }, label, - errormsg, + errormsg }) => { return ( <> @@ -465,49 +473,51 @@ let AdvancedSearch = (props) => { _.isEmpty(optionsObj[key]) ? "" : _.isEmpty( - optionsObj[key] - ) - ? "" - : _.isEmpty( - optionsObj[key] - .pinswg_sipsprojecttypeid - ) - ? "" - : optionsObj[key] - .pinswg_sipsprojecttypeid + - "," + - optionsObj[ - key - ].pinswg_name - .replace( - /(\band|[\s\-\+\(\)\,\&])/g, - "" + optionsObj[key] + ) + ? "" + : _.isEmpty( + optionsObj[key] + .pinswg_sipsprojecttypeid ) - .toLowerCase() + ? "" + : optionsObj[key] + .pinswg_sipsprojecttypeid + + "," + + optionsObj[ + key + ].pinswg_name + .replace( + /(\band|[\s\-\+\(\)\,\&])/g, + "" + ) + .toLowerCase() } > {_.isEmpty(optionsObj[key]) ? "" : _.isEmpty(optionsObj[key]) - ? "" - : _.isEmpty( - optionsObj[key] - .pinswg_name - ) - ? "" - : router.locale == "cy" - ? jsonpath( - '$..[?(@.value=="' + + ? "" + : _.isEmpty( optionsObj[key] - .pinswg_name + - '")].value_cy', - transLookup - ) - : optionsObj[key] - .pinswg_name || - t( - "case:summary-no-date-entered-label" - )} + .pinswg_name + ) + ? "" + : router.locale == "cy" + ? jsonpath( + '$..[?(@.value=="' + + optionsObj[ + key + ] + .pinswg_name + + '")].value_cy', + transLookup + ) + : optionsObj[key] + .pinswg_name || + t( + "case:summary-no-date-entered-label" + )} ); })} @@ -550,7 +560,7 @@ let AdvancedSearch = (props) => { searchString += values.statusCode != null - ? "statuscode=" + values.projecttype + "&" + ? "statuscode=" + values.statusCode + "&" : ""; searchString += @@ -594,7 +604,7 @@ let AdvancedSearch = (props) => { t( "myportal:searchcases-validation-minlength" ) - ), + ) ]} className="govuk-input govuk-!-width-two-thirds" component={RenderTextfield} @@ -619,7 +629,7 @@ let AdvancedSearch = (props) => { t( "myportal:searchcases-validation-minlength" ) - ), + ) ]} className="govuk-input govuk-!-width-two-thirds" component={RenderLPATextfield} @@ -681,40 +691,7 @@ let AdvancedSearch = (props) => { name="statusCode" id="statusCode" component={RenderCaseStatusList} - optionsObj={[ - { - "value": "In Progress", - "value_cy": "Ar y gweill", - "statuscode": 1, - }, - { - "value": "On Hold", - "value_cy": "Ar Dal", - "statuscode": 2, - }, - { - "value": - "Waiting for details", - "value_cy": - "Aros am fanylion", - "statuscode": 3, - }, - { - "value": "Researching", - "value_cy": "Ymchwilio", - "statuscode": 4, - }, - { - "value": "Case Closed", - "value_cy": "Achos ar Gau", - "statuscode": 5, - }, - { - "value": "Cancelled", - "value_cy": "Wedi'i ganslo", - "statuscode": 6, - }, - ]} + optionsObj={statusValues} //validate={[required]} label={t( "search:case-status-label" @@ -835,7 +812,7 @@ const mapStateToProps = (state) => { myCases: state.myCases, watchedCases: state.watchedCases, myRepresentations: state.myRepresentations, - awaitingSubmission: state.awaitingSubmission, + awaitingSubmission: state.awaitingSubmission }; }; @@ -849,7 +826,7 @@ AdvancedSearch = connect((state) => { const appealTypesValue = selector(state, "appealTypes"); return { - appealTypesValue, + appealTypesValue }; })(AdvancedSearch); @@ -859,6 +836,6 @@ export default connect( )( reduxForm({ form: "advancedSearchForm", - destroyOnUnmount: false, + destroyOnUnmount: false })(AdvancedSearch) ); diff --git a/components/utils/caseStagesObj.js b/components/utils/caseStagesObj.js new file mode 100644 index 00000000..42fe1ca6 --- /dev/null +++ b/components/utils/caseStagesObj.js @@ -0,0 +1,287 @@ +export const statusValues = [ + { + "value": "Acceptance Checking", + "value_cy": "Gwirio derbyn", + "statuscode": 846040004 + }, + { + "value": "Appeal Registered", + "value_cy": "Apêl wedi’i chofrestru", + "statuscode": 846040015 + }, + { + "value": "Appeal Submitted", + "value_cy": "Apêl wedi’i chyflwyno", + "statuscode": 846040014 + }, + { + "value": "Appeal Validated", + "value_cy": "Apêl wedi’i dilysu", + "statuscode": 846040016 + }, + { + "value": "Applicants Final Comment", + "value_cy": "Sylw terfynol yr ymgeisydd", + "statuscode": 846040027 + }, + { + "value": "Application Called-In", + "value_cy": "Cais wedi’i alw i mewn", + "statuscode": 846040023 + }, + { + "value": "Application Validated", + "value_cy": "Cais wedi’i ddilysu", + "statuscode": 846040024 + }, + { + "value": "Case in Progress", + "value_cy": "Achos ar y gweill", + "statuscode": 1 + }, + { + "value": "Consultation", + "value_cy": "Ymgynghoriad", + "statuscode": 846040006 + }, + { + "value": "Environmental Impact Assessment Scoping", + "value_cy": "Cwmpasu Asesiad o’r Effaith Amgylcheddol", + "statuscode": 846040002 + }, + { + "value": "Inspector(s) Decision", + "value_cy": "Penderfyniad yr arolygydd/arolygwyr", + "statuscode": 846040009 + }, + { + "value": "Invalid Submission", + "value_cy": "Cyflwyniad annilys", + "statuscode": 846040005 + }, + { + "value": "Notification", + "value_cy": "Hysbysiad", + "statuscode": 846040003 + }, + { "value": "On Hold", "value_cy": "Ar Dal", "statuscode": 2 }, + { + "value": "Pre-Application", + "value_cy": "Cyn gwneud cais", + "statuscode": 846040001 + }, + { + "value": "Questionnaire / LPA to Notify", + "value_cy": "Holiadur / ACLl i hysbysu", + "statuscode": 846040017 + }, + { + "value": "Re-Consultation", + "value_cy": "Ail-ymgynghoriad", + "statuscode": 846040007 + }, + { "value": "Researching", "value_cy": "Ymchwilio", "statuscode": 4 }, + { + "value": "Report to Ministers", + "value_cy": "Adroddiad i Weinidogion", + "statuscode": 846040011 + }, + { + "value": "Statements", + "value_cy": "Datganiadau", + "statuscode": 846040010 + }, + { "value": "Reporting", "value_cy": "Adrodd", "statuscode": 846040008 }, + { + "value": "Waiting for Details", + "value_cy": "Aros am fanylion", + "statuscode": 3 + }, + { + "value": "Minister's Decision", + "value_cy": "Penderfyniad y Gweinidog", + "statuscode": 846040012 + }, + { + "value": "Representations Period", + "value_cy": "Cyfnod sylwadau", + "statuscode": 846040018 + }, + { + "value": "Final Comments", + "value_cy": "Sylwadau terfynol", + "statuscode": 846040019 + }, + { "value": "Event", "value_cy": "Digwyddiad", "statuscode": 846040020 }, + { + "value": "Site Visit", + "value_cy": "Ymweliad safle", + "statuscode": 846040021 + }, + { + "value": "Decision Issued", + "value_cy": "Penderfyniad wedi’i gyhoeddi", + "statuscode": 846040022 + }, + { + "value": "LPA to Notify", + "value_cy": "ACLl i hysbysu", + "statuscode": 846040025 + }, + { + "value": "Report Issued to Welsh Ministers", + "value_cy": "Adroddiad wedi’i gyhoeddi i Weinidogion Cymru", + "statuscode": 846040028 + }, + { + "value": "Fee Due", + "value_cy": "Ffi yn ddyledus", + "statuscode": 846040029 + }, + { + "value": "Validated", + "value_cy": "Wedi’i ddilysu", + "statuscode": 846040030 + }, + { + "value": "Appeal Start / Case in Progress", + "value_cy": "Apêl wedi dechrau / achos ar y gweill", + "statuscode": 846040031 + }, + { + "value": "Statements/Representations Period", + "value_cy": "Cyfnod datganiadau/sylwadau", + "statuscode": 846040032 + }, + { + "value": "Order Submitted", + "value_cy": "Gorchymyn wedi’i gyflwyno", + "statuscode": 846040033 + }, + { + "value": "Order Submission Registered", + "value_cy": "Cyflwyniad gorchymyn wedi’i gofrestru", + "statuscode": 846040034 + }, + { + "value": "Order Submission Validated", + "value_cy": "Cyflwyniad gorchymyn wedi’i ddilysu", + "statuscode": 846040035 + }, + { + "value": "Case started/Case in Progress", + "value_cy": "Achos wedi dechrau / achos ar y gweill", + "statuscode": 846040036 + }, + { + "value": "Event/Site Visit", + "value_cy": "Digwyddiad/ymweliad safle", + "statuscode": 846040037 + }, + { + "value": "Applicant Statement on Representations", + "value_cy": "Datganiad yr ymgeisydd ar sylwadau", + "statuscode": 846040038 + }, + { + "value": "Representatives Comment", + "value_cy": "Sylw’r cynrychiolwyr", + "statuscode": 846040039 + }, + { + "value": "Order Registered", + "value_cy": "Gorchymyn wedi’i gofrestru", + "statuscode": 846040040 + }, + { + "value": "Order Validated", + "value_cy": "Gorchymyn wedi’i ddilysu", + "statuscode": 846040041 + }, + { + "value": "Representations Period", + "value_cy": "Cyfnod sylwadau", + "statuscode": 846040047 + }, + { + "value": "Application Submitted", + "value_cy": "Cais wedi’i gyflwyno", + "statuscode": 846040042 + }, + { + "value": "Application Registered", + "value_cy": "Cais wedi’i gofrestru", + "statuscode": 846040043 + }, + { + "value": "Report to DESNZ", + "value_cy": "Adroddiad i DESNZ", + "statuscode": 846040044 + }, + { + "value": "Case in Progress / Assessment", + "value_cy": "Achos ar y gweill / asesiad", + "statuscode": 846040045 + }, + { + "value": "Decision / Outcome", + "value_cy": "Penderfyniad / canlyniad", + "statuscode": 846040046 + }, + { + "value": "Final Comments", + "value_cy": "Sylwadau terfynol", + "statuscode": 846040048 + }, + { "value": "Event", "value_cy": "Digwyddiad", "statuscode": 846040049 }, + { + "value": "Minister's Decision", + "value_cy": "Penderfyniad y Gweinidog", + "statuscode": 846040050 + }, + { + "value": "Case started/Case in Progress", + "value_cy": "Achos wedi dechrau / achos ar y gweill", + "statuscode": 846040051 + }, + { + "value": "Statements", + "value_cy": "Datganiadau", + "statuscode": 846040052 + }, + { + "value": "Application Validated", + "value_cy": "Cais wedi’i ddilysu", + "statuscode": 846040053 + }, + { + "value": "Appliation Start / Case in Progress", + "value_cy": "Cais wedi dechrau / achos ar y gweill", + "statuscode": 846040054 + }, + { + "value": "Final Comments", + "value_cy": "Sylwadau terfynol", + "statuscode": 846040055 + }, + { + "value": "Report to Ministers", + "value_cy": "Adroddiad i Weinidogion", + "statuscode": 846040056 + }, + { + "value": "Application Validated", + "value_cy": "Cais wedi’i ddilysu", + "statuscode": 846040057 + }, + { + "value": "Case in Progress", + "value_cy": "Achos ar y gweill", + "statuscode": 846040058 + }, + { + "value": "Case Submitted", + "value_cy": "Achos wedi’i gyflwyno", + "statuscode": 846040061 + } +];