-
Notifications
You must be signed in to change notification settings - Fork 2
Hdpi 4312 confirm eviction summary #1550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tvr-hmcts
wants to merge
35
commits into
master
Choose a base branch
from
HDPI-4312-confirm-eviction-summary
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
f85c09a
initial commit of Summary page changes
5e5a643
Added Summary tab markup. Also Changed confirm eviction details page …
2051b40
I've added date formatters. Also have a current issue where i cannot…
f6229ee
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius 464d212
[#4312] Update flyway version numbering.
tvr-solirius 102f9d6
We can now toggle on the summary page
bcd77ad
Merge remote-tracking branch 'refs/remotes/origin/HDPI-4312-confirm-e…
dd08a0f
Added logs to see if we get pcs case objective for show condition
3d56407
Refactor confirm eviction event and related logic: rename the event t…
tvr-solirius 5eb187a
Reverting local change
tvr-solirius 25648ea
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius 1d105e2
Move enforcement‑order handling into a dedicated mediator, removing t…
tvr-solirius 3e6165b
Cleanup ConfirmEviction event and helpers: drop unused start method a…
tvr-solirius afbd098
Merge branch 'master' into HDPI-4312-confirm-eviction-summary
srinijg e294cb0
Merge branch 'master' into HDPI-4312-confirm-eviction-summary
srinijg 2db4061
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius a5e7fb6
Flyway version update.
tvr-solirius 8595499
Change of version in the flyway to the correct script this time :)
tvr-solirius 3bcc795
Merge remote-tracking branch 'origin/master' into HDPI-4312-confirm-e…
tvr-solirius d68f6e1
flyway version update.
tvr-solirius 1d6f98f
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius 21df5f8
Refactor eviction summary formatting: extract date formatting to Date…
tvr-solirius cd9b42c
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius 4541fd4
Flyway version update and fix of test
tvr-solirius 1b81801
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius 38fec04
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius 31691ae
Version number update for flyway.
tvr-solirius d9573de
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius 311bf85
Remove DateUtil and inline date formatting in EnforcementOrderMediato…
tvr-solirius d21fc54
Merge remote-tracking branch 'refs/remotes/origin/master' into HDPI-4…
tvr-solirius 51fd801
Change EnforcementOrderRepository to return list; update mediator to …
tvr-solirius 84d7186
[#4312] Alteration based on PR comment of method hasBailiffDate which…
tvr-solirius f94dea1
[#4312] Method and local field rename
tvr-solirius 70162e4
[#4312] Repackaging.
tvr-solirius 6661d99
Update of the date displayed to align with the Figma design. Plus s…
tvr-solirius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/main/java/uk/gov/hmcts/reform/pcs/ccd/enforcementorder/EnforcementOrderMediator.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| package uk.gov.hmcts.reform.pcs.ccd.enforcementorder; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.springframework.stereotype.Component; | ||
| import uk.gov.hmcts.ccd.sdk.type.YesOrNo; | ||
| import uk.gov.hmcts.reform.pcs.ccd.domain.PCSCase; | ||
| import uk.gov.hmcts.reform.pcs.ccd.entity.ClaimEntity; | ||
| import uk.gov.hmcts.reform.pcs.ccd.entity.PcsCaseEntity; | ||
| import uk.gov.hmcts.reform.pcs.ccd.entity.enforcetheorder.EnforcementOrderEntity; | ||
| import uk.gov.hmcts.reform.pcs.ccd.repository.PcsCaseRepository; | ||
| import uk.gov.hmcts.reform.pcs.ccd.repository.enforcetheorder.EnforcementOrderRepository; | ||
| import uk.gov.hmcts.reform.pcs.exception.CaseNotFoundException; | ||
|
|
||
| import java.time.LocalDateTime; | ||
| import java.time.format.DateTimeFormatter; | ||
| import java.util.List; | ||
| import java.util.Locale; | ||
| import java.util.Optional; | ||
|
|
||
| import static uk.gov.hmcts.reform.pcs.ccd.page.enforcetheorder.confirmeviction.MarkupContent.CONFIRM_EVICTION_SUMMARY_NO_DATES; | ||
| import static uk.gov.hmcts.reform.pcs.ccd.page.enforcetheorder.confirmeviction.MarkupContent.CONFIRM_EVICTION_SUMMARY_WITH_DATES; | ||
|
|
||
| @Component | ||
| @Slf4j | ||
| @AllArgsConstructor | ||
| public class EnforcementOrderMediator { | ||
|
|
||
| private final PcsCaseRepository pcsCaseRepository; | ||
| private final EnforcementOrderRepository enforcementOrderRepository; | ||
|
|
||
| public void handleEnforcementRequirements(long caseReference, PCSCase pcsCase) { | ||
| if (caseReference > 0 && pcsCase != null) { | ||
| getEnforcementOrder(caseReference).ifPresent(enforcementOrderEntity -> | ||
| Optional.ofNullable(enforcementOrderEntity.getBailiffDate()) | ||
| .ifPresentOrElse( | ||
| date -> prepareEvictionWithDates(pcsCase, date), | ||
| () -> prepareEvictionWithNoDates(pcsCase) | ||
| )); | ||
| } | ||
| } | ||
|
|
||
| Optional<EnforcementOrderEntity> getEnforcementOrder(long caseReference) { | ||
| PcsCaseEntity pcsCaseEntity = pcsCaseRepository.findByCaseReference(caseReference) | ||
| .orElseThrow(() -> new CaseNotFoundException(caseReference)); | ||
| List<ClaimEntity> claims = pcsCaseEntity.getClaims(); | ||
| if (claims != null && !claims.isEmpty()) { | ||
| // At this point we do not know which Enforcement Order the Confirm Eviction is placed against. | ||
| // this to be confirmed beyond this ticket scope (HDPI-4312) | ||
| List<EnforcementOrderEntity> enforcementOrderEntities = enforcementOrderRepository | ||
| .findByClaimId(claims.getFirst().getId()); | ||
| if (!enforcementOrderEntities.isEmpty()) { | ||
| return Optional.of(enforcementOrderEntities.getFirst()); | ||
| } | ||
| } | ||
| return Optional.empty(); | ||
| } | ||
|
|
||
| private void prepareEvictionWithDates(PCSCase pcsCase, LocalDateTime localDateTime) { | ||
| pcsCase.setShowConfirmEvictionJourney(YesOrNo.YES); | ||
| pcsCase.setConfirmEvictionSummaryMarkup(String.format( | ||
| CONFIRM_EVICTION_SUMMARY_WITH_DATES, | ||
| formatDate(localDateTime), | ||
| getEvictionCancellationDeadline(localDateTime))); | ||
| } | ||
|
|
||
| private static void prepareEvictionWithNoDates(PCSCase pcsCase) { | ||
| pcsCase.setShowConfirmEvictionJourney(YesOrNo.NO); | ||
| pcsCase.setConfirmEvictionSummaryMarkup(CONFIRM_EVICTION_SUMMARY_NO_DATES); | ||
| } | ||
|
|
||
| public String formatDate(LocalDateTime localDateTime) { | ||
| DateTimeFormatter outputFormatter = DateTimeFormatter | ||
| .ofPattern("EEEE, d MMMM yyyy 'at' h:mm a", Locale.UK); | ||
| return localDateTime.format(outputFormatter); | ||
| } | ||
|
|
||
| public String getEvictionCancellationDeadline(LocalDateTime localDateTime) { | ||
| DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("d MMMM yyyy", Locale.UK); | ||
| return localDateTime.minusHours(72).format(outputFormatter); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/uk/gov/hmcts/reform/pcs/ccd/event/confirmeviction/ConfirmEviction.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package uk.gov.hmcts.reform.pcs.ccd.event.confirmeviction; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import org.springframework.stereotype.Component; | ||
| import uk.gov.hmcts.ccd.sdk.api.CCDConfig; | ||
| import uk.gov.hmcts.ccd.sdk.api.DecentralisedConfigBuilder; | ||
| import uk.gov.hmcts.ccd.sdk.api.Event; | ||
| import uk.gov.hmcts.ccd.sdk.api.EventPayload; | ||
| import uk.gov.hmcts.ccd.sdk.api.Permission; | ||
| import uk.gov.hmcts.ccd.sdk.api.callback.SubmitResponse; | ||
| import uk.gov.hmcts.reform.pcs.ccd.accesscontrol.UserRole; | ||
| import uk.gov.hmcts.reform.pcs.ccd.common.PageBuilder; | ||
| import uk.gov.hmcts.reform.pcs.ccd.domain.PCSCase; | ||
| import uk.gov.hmcts.reform.pcs.ccd.domain.State; | ||
| import uk.gov.hmcts.reform.pcs.ccd.page.enforcetheorder.confirmeviction.ConfirmEvictionConfigurer; | ||
|
|
||
| import static uk.gov.hmcts.reform.pcs.ccd.event.EventId.confirmEviction; | ||
|
|
||
| @Component | ||
| @AllArgsConstructor | ||
| public class ConfirmEviction implements CCDConfig<PCSCase, State, UserRole> { | ||
|
|
||
| private final ConfirmEvictionConfigurer confirmEvictionConfigurer; | ||
|
|
||
| @Override | ||
| public void configureDecentralised(DecentralisedConfigBuilder<PCSCase, State, UserRole> configBuilder) { | ||
| Event.EventBuilder<PCSCase, UserRole, State> eventBuilder = | ||
| configBuilder | ||
| .decentralisedEvent(confirmEviction.name(), this::submit) | ||
| .forAllStates() | ||
| .name("Confirm the eviction details") | ||
| .grant(Permission.CRUD, UserRole.PCS_SOLICITOR) | ||
| .showSummary(); | ||
| confirmEvictionConfigurer.configurePages(new PageBuilder(eventBuilder)); | ||
| } | ||
|
|
||
| private SubmitResponse<State> submit(EventPayload<PCSCase, State> eventPayload) { | ||
| return SubmitResponse.defaultResponse(); | ||
| } | ||
|
|
||
| } |
18 changes: 18 additions & 0 deletions
18
.../hmcts/reform/pcs/ccd/page/enforcetheorder/confirmeviction/ConfirmEvictionConfigurer.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package uk.gov.hmcts.reform.pcs.ccd.page.enforcetheorder.confirmeviction; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import org.springframework.stereotype.Component; | ||
| import uk.gov.hmcts.reform.pcs.ccd.common.PageBuilder; | ||
| import uk.gov.hmcts.reform.pcs.ccd.common.PageConfigurer; | ||
|
|
||
| @Component | ||
| @AllArgsConstructor | ||
| public class ConfirmEvictionConfigurer implements PageConfigurer { | ||
|
|
||
| @Override | ||
| public void configurePages(PageBuilder pageBuilder) { | ||
| pageBuilder | ||
| .add(new ConfirmEvictionDetailsPage()) | ||
| .add(new EvictionDatePage()); | ||
| } | ||
| } |
56 changes: 56 additions & 0 deletions
56
...hmcts/reform/pcs/ccd/page/enforcetheorder/confirmeviction/ConfirmEvictionDetailsPage.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| package uk.gov.hmcts.reform.pcs.ccd.page.enforcetheorder.confirmeviction; | ||
|
|
||
| import uk.gov.hmcts.reform.pcs.ccd.common.CcdPageConfiguration; | ||
| import uk.gov.hmcts.reform.pcs.ccd.common.PageBuilder; | ||
| import uk.gov.hmcts.reform.pcs.ccd.page.CcdPage; | ||
|
|
||
| public class ConfirmEvictionDetailsPage implements CcdPageConfiguration, CcdPage { | ||
|
|
||
| public static final String CONFIRM_EVICTION_DETAILS_CONTENT = """ | ||
| <p class="govuk-body"> | ||
| The bailiff has arranged a date for the eviction and they need you to confirm if you are | ||
| available. | ||
| </p> | ||
| <p class="govuk-body"> | ||
| They will also ask you to confirm if the person being evicted poses any risk. | ||
| </p> | ||
| <p class="govuk-body"> | ||
| The bailiff needs this information to carry out the eviction safely. If you do not provide it, | ||
| they may not be able to complete the eviction. | ||
| </p> | ||
| <p class="govuk-body govuk-!-font-weight-bold govuk-!-font-size-24">What you’ll need | ||
| </p> | ||
| <p class="govuk-body govuk-!-margin-bottom-0">You’ll need to know:</p> | ||
| <ul class="govuk-list govuk-list--bullet"> | ||
| <li class="govuk-!-font-size-19">who will attend the eviction (you, or someone else)</li> | ||
| <li class="govuk-!-font-size-19">if you (or they) can attend the eviction on the date suggested | ||
| by the bailiff</li> | ||
| </ul> | ||
| <p class="govuk-body govuk-!-margin-bottom-0">We will also ask you to:</p> | ||
| <ul class="govuk-list govuk-list--bullet"> | ||
| <li class="govuk-!-font-size-19">describe the person who will be evicted</li> | ||
| <li class="govuk-!-font-size-19">tell us how to access the property</li> | ||
| <li class="govuk-!-font-size-19">book a locksmith (this is to make sure that the person being | ||
| evicted cannot return to the property)</li> | ||
| </ul> | ||
| <p class="govuk-body"> | ||
| Once you have confirmed the eviction date, we’ll send you an email reminding you to book a | ||
| locksmith. | ||
| </p> | ||
| """; | ||
|
|
||
| @Override | ||
| public void addTo(PageBuilder pageBuilder) { | ||
| String pageKey = getPageKey(); | ||
| pageBuilder | ||
| .page(pageKey) | ||
| .pageLabel("Confirm the eviction details") | ||
| .label(pageKey + "-line-separator", "---") | ||
| .label(pageKey + "-content", CONFIRM_EVICTION_DETAILS_CONTENT); | ||
| } | ||
|
|
||
| @Override | ||
| public String getPageKey() { | ||
| return CcdPage.derivePageKey(this.getClass()); | ||
| } | ||
| } |
23 changes: 23 additions & 0 deletions
23
...va/uk/gov/hmcts/reform/pcs/ccd/page/enforcetheorder/confirmeviction/EvictionDatePage.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| package uk.gov.hmcts.reform.pcs.ccd.page.enforcetheorder.confirmeviction; | ||
|
|
||
| import uk.gov.hmcts.reform.pcs.ccd.common.CcdPageConfiguration; | ||
| import uk.gov.hmcts.reform.pcs.ccd.common.PageBuilder; | ||
| import uk.gov.hmcts.reform.pcs.ccd.page.CcdPage; | ||
|
|
||
| public class EvictionDatePage implements CcdPageConfiguration, CcdPage { | ||
|
|
||
| @Override | ||
| public void addTo(PageBuilder pageBuilder) { | ||
| String pageKey = getPageKey(); | ||
| pageBuilder | ||
| .page(pageKey) | ||
| .pageLabel("The eviction date") | ||
| .label(pageKey + "-line-separator", "---"); | ||
| } | ||
|
|
||
| @Override | ||
| public String getPageKey() { | ||
| return CcdPage.derivePageKey(this.getClass()); | ||
| } | ||
|
|
||
| } |
61 changes: 61 additions & 0 deletions
61
.../java/uk/gov/hmcts/reform/pcs/ccd/page/enforcetheorder/confirmeviction/MarkupContent.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| package uk.gov.hmcts.reform.pcs.ccd.page.enforcetheorder.confirmeviction; | ||
|
|
||
| import lombok.AccessLevel; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
| public class MarkupContent { | ||
|
|
||
| public static String CONFIRM_EVICTION_SUMMARY_WITH_DATES = | ||
| """ | ||
| <h2 class="govuk-heading-m govuk-!-padding-top-1">Confirm the eviction date</h2> | ||
| <p class="govuk-body govuk-!-padding-bottom-2"> | ||
| The bailiff has given you an eviction date of %s. | ||
| </p> | ||
| <p class="govuk-body govuk-!-padding-bottom-2"> | ||
| They need you to confirm if you are available on this date. | ||
| </p> | ||
| <p class="govuk-body govuk-!-padding-bottom-2"> | ||
| You must confirm the eviction details before %s. | ||
| If you try to confirm the eviction after this | ||
| date, the bailiff will cancel your eviction. | ||
| </p> | ||
| <p class="govuk-body govuk-!-padding-bottom-2"> | ||
| They will also ask you to confirm if the defendants | ||
| (the person or people being evicted) pose any risk to the | ||
| bailiff. | ||
| </p> | ||
| <p class="govuk-body govuk-!-padding-bottom-2"> | ||
| The bailiff needs this information to carry out the eviction | ||
| safely. | ||
| </p> | ||
| <p class="govuk-body"> | ||
| To confirm the eviction date, select ‘Confirm the eviction | ||
| date’ from the dropdown menu. | ||
| </p> | ||
| """; | ||
|
|
||
| public static String CONFIRM_EVICTION_SUMMARY_NO_DATES = | ||
| """ | ||
| <h2 class="govuk-heading-m govuk-!-padding-top-1">You cannot enforce the order at the moment</h2> | ||
| <p class="govuk-body govuk-!-padding-bottom-2"> | ||
| You cannot enforce the order at the moment (use a bailiff to evict someone). | ||
| </p> | ||
| <p class="govuk-body govuk-!-font-weight-bold govuk-!-padding-bottom-2"> How to find out why you cannot | ||
| enforce the order | ||
| </p> | ||
| <p class="govuk-body govuk-!-margin-bottom-0">To find out why you cannot enforce the order, you can:</p> | ||
| <ul class="govuk-list govuk-list--bullet"> | ||
| <li class="govuk-!-font-size-19">check the tab: ‘Case file view’ (you should see an order from the court, | ||
| explaining why you cannot enforce), or</li> | ||
| <li class="govuk-!-font-size-19"> | ||
| <a href="https://www.gov.uk/find-court-tribunal" | ||
| rel="noreferrer noopener" | ||
| target="_blank" class="govuk-link"> | ||
| contact your local court.</a> You will need to tell them your case number | ||
| (you can find this at the top of this page). If you do not know the name of your local court, select the | ||
| ‘Money’ category and then the ‘Housing’ category to find it.</li> | ||
| </ul> | ||
| """; | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/main/resources/db/migration/V075__add_bailiff_date_enf_case.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| ALTER TABLE enf_case | ||
| ADD COLUMN bailiff_date timestamp; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.