Filter reports by last 3 months by default

The values are not shown on the screen and the user doesn't know which
default dates are applied but the filtering works.
This commit is contained in:
Maikel Linke
2024-10-16 16:52:03 +11:00
parent 3227922c76
commit aa7fffa5a2
2 changed files with 26 additions and 3 deletions

View File

@@ -1,8 +1,8 @@
-# Field used for ransack search. This date range is mostly used for Spree::Order
-# so default field is 'completed_at'
- field ||= 'completed_at'
- start_date ||= params[:q].try(:[], :completed_at_gt)
- end_date ||= params[:q].try(:[], :completed_at_lt)
- start_date ||= params[:q].try(:[], :completed_at_gt) || 3.months.ago.beginning_of_day
- end_date ||= params[:q].try(:[], :completed_at_lt) || Time.zone.tomorrow.beginning_of_day
.row.date-range-filter
.alpha.two.columns= label_tag nil, t(:date_range)