Skip to content
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

Case contact details ux improvements 5896 #5909

Closed
wants to merge 5 commits into from

Conversation

josephmsmith
Copy link
Collaborator

@josephmsmith josephmsmith commented Jul 14, 2024

What github issue is this PR for, if any?

Resolves #5896

What changed, and why?

3 main changes were made to the UX around creating contact details in order to improve UX and create a better experience for recorder.

  • Marked "Was contact made?" and "How was contact made?" as required by adding asterisks instead of marking "Record Contact Details" as mandatory. This ensures User knows what specific fields needed to be added to complete submission.
  • Add server side validation NOT client side (required JavaScript) to the fields. Currently if there is an error it reloads the page and you must scroll all the way down. The scrolling feature was not modified.
  • Contact Type Selection: Sort the options in the dropdown by recency where contact types that were never used remain at the bottom of the options.

How is this tested? (please write tests!) 💖💪

added rspec testing to case_contact_decorator spec to test new method

Screenshots please :)

Screenshot 2024-07-16 at 9 33 21 PM

Screenshot 2024-07-14 at 4 34 52 PM

Screenshot 2024-07-14 at 4 34 23 PM

Removed asterisk from record contact details heading
Added asterisks to subheadings to help users
understand what needs to be filled out.
(better user experience)
when user selects contact type on new contact page

- modified '_contact_types.html.erb' to sort by last_contact_time
- updated ContactTypeDecorator with last_contact_timestamp method
to obtain last contact or default to a time in past if no contacts

Change was made in order to ensure that 'ContactType' options are
displayed for users in a way that allows them to quickly access
recently used contact types vs scrolling through all options.
@github-actions github-actions bot added ruby Pull requests that update Ruby code Tests! 🎉💖👏 erb labels Jul 14, 2024
@josephmsmith josephmsmith linked an issue Jul 14, 2024 that may be closed by this pull request
3 tasks
@josephmsmith josephmsmith self-assigned this Jul 15, 2024
Added server side validation to the contact model
in order to ensure that "Contact Type" is filled
out as required field when user submits a new case
contact details form
@@ -3,7 +3,7 @@
<%= render(Form::MultipleSelectComponent.new(
form: form,
name: :contact_type_ids,
options: options.decorate.map { |ct| ct.hash_for_multi_select_with_cases(casa_cases&.pluck(:id)) },
options: options.decorate.sort_by { |ct| ct.last_contact_timestamp(casa_cases.pluck(:id)) }.reverse.map { |ct| ct.hash_for_multi_select_with_cases(casa_cases.pluck(:id)) },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the ordering can be done in

@contact_types.order(name: :asc)

Copy link
Collaborator Author

@josephmsmith josephmsmith Jul 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to do this originally in the controller but couldn't get it to work. Any suggestions?

The decorator wasn't working correctly specifically if I remember right so the extra sorting logic there was added as a fix

Copy link

This PR has been open for a long time without any pushes or comments! What's up?

@josephmsmith
Copy link
Collaborator Author

Hi @FireLemons apologies for the delay here. Let's chat about this tomorrow during office hours and I can get this restarted!

Copy link

This PR has been open for a long time without any pushes or comments! What's up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
erb no-pr-activity ruby Pull requests that update Ruby code Tests! 🎉💖👏
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Case Contact Details UX Improvements
2 participants