effective_orders 3.1.4 → 3.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95a8ee70cdfec1d0abf23bd3a3d983f9ac6d853a6e795464bcd77bae043799d4
4
- data.tar.gz: 4465d2da717814cdb4de4ca1efc6d606c57e41e034dfe8299aedf9ea93ca1ed3
3
+ metadata.gz: 829b63c36f8fc5cff852f4d6c20c71b0e4da56dab9b48da0781342b34157ccf5
4
+ data.tar.gz: 987977d07b8add975f0b834354b3f21dc087efcc69e4cac6f011da6e7327521a
5
5
  SHA512:
6
- metadata.gz: 738feb98567d85fc601d721e79ba2c06d223d69252287623cca17c4540c362b514bb535000980c3421f30e9c792b40514550eeee5c53a486efb8f02bc8c8054e
7
- data.tar.gz: cca56bc31234719b1ddb3f61721e98ce2ceca177e48eeb812305b270222f8b9f4e5fbc54ac1c24b0fec7166b81b7f12371ee563ab2e36a804330cb933b17d9d6
6
+ metadata.gz: ae49e925c7282e59af58d78b034a9a720726df52b878b9ad6ac85d4f1dc8b7e627cf75b36b5fa9efbdc23591fbe1f71dbeca3ce1ab665d2d50eae6b21bd9e656
7
+ data.tar.gz: 3d0a6819d97f0f85432e4bec5627cb0fa8e46cfabc5458a78cdb0ea29d12aee6c938f5b7c3af5a5d1a53810e26be939a393678bcefaa5542109d4bc1f12aef72
@@ -15,6 +15,13 @@ class EffectiveOrdersDatatable < Effective::Datatable
15
15
  )
16
16
  end
17
17
 
18
+ filters do
19
+ if admin_namespace?
20
+ filter :start_date, nil, as: :effective_date_picker
21
+ filter :end_date, nil, as: :effective_date_picker
22
+ end
23
+ end
24
+
18
25
  datatable do
19
26
  order :created_at, :desc
20
27
 
@@ -94,6 +101,14 @@ class EffectiveOrdersDatatable < Effective::Datatable
94
101
  scope = EffectiveOrders.orders_collection_scope.call(scope)
95
102
  end
96
103
 
104
+ if filters[:start_date].present?
105
+ scope = scope.where('created_at > ?', Time.zone.parse(filters[:start_date]).beginning_of_day)
106
+ end
107
+
108
+ if filters[:end_date].present?
109
+ scope = scope.where('created_at < ?', Time.zone.parse(filters[:end_date]).end_of_day)
110
+ end
111
+
97
112
  attributes[:user_id].present? ? scope.where(user_id: attributes[:user_id]) : scope
98
113
  end
99
114
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '3.1.4'.freeze
2
+ VERSION = '3.1.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.4
4
+ version: 3.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-23 00:00:00.000000000 Z
11
+ date: 2019-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails