From bug 29478 comment 5: > I thought of an issue when testing my follow-up: Should the shortcut controls reflect the date limitations of the flatpickr instance? For instance, if selection is limited to a date before today, should the "today" and "tomorrow" controls be disabled? Currently clicking a shortcut for a date which is disallowed will empty the date field. I decided we should go with what we have for this coming release, but we should really implement the above asap after release.
Created attachment 127954 [details] [review] Bug 29552: Flatpickr - Disable shortcut buttons if inactive If one of the buttons is not relevant we should disable it and mark is as such on the interface.
I was curious to know how easy/hard it would be to implement so I gave it a try. It seems quite easy actually, here is my version.
Created attachment 128221 [details] [review] Bug 29552: Flatpickr - Disable shortcut buttons if inactive If one of the buttons is not relevant we should disable it and mark is as such on the interface. Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 128222 [details] [review] Bug 29552: (follow-up) Use CSS to set disabled class
I had a go at testing but came across some issues (or I don't understand how to test this...). Testing notes using koha-testing-docker: 1. Update the CSS (yarn install, yarn build, yarn build --view opac, flush_memcached, restart_all) 2. Examples of where yesterday, today and tomorrow should not be active: . Place a hold for: for 'Hold expires on date:' yesterday and today should not be active [see potential issue [1]] . Circulation > Overdue report: in the filter make the from date in the future, Yesterday, Today and Tomorrow should all be not active, but are active even though they don't work . Struggled to find examples of when Tomorrow should not be selectable Potential issues noted - mainly with Yesterday, Today and Tomorrow not showing as inactive when they should be: 1. When placing a hold you can't enter today's date but 'Today' is still active 2. Same for Circulation > Renew 3. Administration > Patron categories > New category - Yesterday and Today are still active, even though you can't enter a date 4. Reports > Patrons: the "Date of birth" fields are linked so that to cannot be before from dates, if you add a date in the from taht is a few days in the future tehy should all be inactive, but aren't
Created attachment 128510 [details] [review] Bug 29552: Flatpickr - Disable shortcut buttons if inactive If one of the buttons is not relevant we should disable it and mark is as such on the interface. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 128511 [details] [review] Bug 29552: (follow-up) Use CSS to set disabled class Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 128512 [details] [review] Bug 29552: (follow-up) Reverse SCSS declaration order I'm not sure why, but the order matters in this SCSS declaration. If the &:hover is placed below the &:disabled, as it was, then it appears to negate the effect of the &:disabled rule entirely. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This works well once I applied my follow-up. Test plan I followed: 1. Update CSS (This is a staff client patch.. so yarn build [no --view=opac]) 2. Follow Davids test plan, but for staff client pages only.
I still see some glitches here: 1) Place a hold in staff and set the expiration date - Yesterday is inactive - OK - Today doesn't jump to today when clicked, but is still active (not OK) 2) Set a date of birth for a patron - You can set a date of birth into the future. All options are active an and work. (possibly not related to this patch?) 3) Administration > Edit or add a patron category > Set the "Until date" - Dates in the past are greyed out, Yesterday and Today are active, but won't select a date (not OK)
Created attachment 128729 [details] [review] Bug 29552: Disable today for dates in the future
(In reply to Katrin Fischer from comment #10) > I still see some glitches here: > > 1) Place a hold in staff and set the expiration date > - Yesterday is inactive - OK > - Today doesn't jump to today when clicked, but is still active (not OK) Done > 2) Set a date of birth for a patron > - You can set a date of birth into the future. All options are active an and > work. (possibly not related to this patch?) That does not seem directly related. > 3) Administration > Edit or add a patron category > Set the "Until date" > - Dates in the past are greyed out, Yesterday and Today are active, but > won't select a date (not OK) Opened bug 29735.
(In reply to Martin Renvoize from comment #9) > This works well once I applied my follow-up. > > Test plan I followed: > 1. Update CSS (This is a staff client patch.. so yarn build [no --view=opac]) > 2. Follow Davids test plan, but for staff client pages only. It's working without your patch but the cache is hard to clear (?) I had to open a private window to make it work (so with Owen's patch only, not yours).
Created attachment 128806 [details] [review] Bug 29552: Flatpickr - Disable shortcut buttons if inactive If one of the buttons is not relevant we should disable it and mark is as such on the interface. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 128807 [details] [review] Bug 29552: (follow-up) Use CSS to set disabled class Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 128808 [details] [review] Bug 29552: Disable today for dates in the future
Tested on top of bug 29735.
Created attachment 128809 [details] [review] Bug 29552: Flatpickr - Disable shortcut buttons if inactive If one of the buttons is not relevant we should disable it and mark is as such on the interface. Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 128810 [details] [review] Bug 29552: (follow-up) Use CSS to set disabled class Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 128811 [details] [review] Bug 29552: Disable today for dates in the future Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed to master for 22.05, thanks to everybody involved [U+1F984]
Pushed to 21.11.x for 21.11.02
Missing dependency, not backported to 21.05