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

Afform - Support date range filters for search displays #19632

Merged
merged 1 commit into from
Feb 24, 2021

Conversation

colemanw
Copy link
Member

Overview

This allows afform date fields to be changed to type "Select" to choose a relative date range.

Before

Date fields could only be dates.

After

Date fields can be select list of relative date ranges.

@civibot
Copy link

civibot bot commented Feb 19, 2021

(Standard links)

@civibot civibot bot added the master label Feb 19, 2021
@seamuslee001 seamuslee001 self-assigned this Feb 19, 2021
@seamuslee001
Copy link
Contributor

seamuslee001 commented Feb 19, 2021

@colemanw I tested this on my local and confirmed it works as you seem to have intended but a couple of thoughts

  1. Should this ability be limited to search afforms? E.g. if your building an afform of a standard kind which is for updating / creating entities it feels like having this as an option to change the field to seems problematic to me / impractical.
  2. With all other search forms and also with the current CiviReports one of the options is to choose your own date range. Are you looking to add this in? And if so should it be part of this PR or as a separate PR?

@colemanw
Copy link
Member Author

So I have a not-totally-formed idea about this, which is that

  1. Yes fields should work a little differently for search forms
  2. Every field on a search form (for numeric or date records) ought to support a range option where the 1 field splits into 2 fields for low & high.
  3. Somehow (not sure how) date search fields should be able to morph between select list of relative dates into a split low/high range.

@seamuslee001
Copy link
Contributor

I agree with all of that and I suppose that can be more future work but I guess my more immediate question is this one:

"Should this ability be limited to search afforms e.g. if your building an afform of a standard kind which is for updating / creating entities it feels like having this an option to change the field to seems problematic to me / impractical"

I would appreciate some other opinions here @eileenmcnaughton @totten @JoeMurray but I am also comfortable with just merging this as is but it would feel odd if you have a more input oriented form and you can make the date field a select range but I suppose it can work

@seamuslee001
Copy link
Contributor

So this basically allows someone to change a date field which by default is added like this

aff-date-range-1

To be a select list rather than a date or number enter

aff-date-range-2

Which means that you then get all the relative date options but no choose your own range option

aff-date-range-3

On a search display makes sense to me

aff-date-range-4

But on an ordinary afform it feels a bit odd

aff-date-range-5

@colemanw
Copy link
Member Author

Well, how else are you going to input "This Individual was born Yesterday!" ;)

@JoeMurray
Copy link
Contributor

I bet an issue like this led to adding things like mode that we later came to regret.

I'm not sure what the best implementation pattern is, but from a UX perspective the person specifying an Afform should be prevented from using the regular CiviCRM date range options if only a single value is to be saved.

Tangentially related but might help think about pattern: we also have a need for range between low and high on some money values, so the pattern for deciding on form widgets for specifying that for search versus entering a value (maybe with a select) is pretty similar.

@seamuslee001
Copy link
Contributor

As per discussion in Matter Most https://chat.civicrm.org/civicrm/pl/6dhzoj8b6tbxudcsa7snm1oikc I am going to merge this and work on following up to limit this to just search displays

@seamuslee001 seamuslee001 merged commit bf1b141 into civicrm:master Feb 24, 2021
@seamuslee001 seamuslee001 deleted the afformDateRange branch February 24, 2021 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants