solidus_backend 2.7.4 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_backend might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +12 -8
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/javascripts/spree/backend.js +0 -2
- data/app/assets/javascripts/spree/backend/adjustments.js +1 -1
- data/app/assets/javascripts/spree/backend/components/tooltips.js +21 -17
- data/app/assets/javascripts/spree/backend/option_type_autocomplete.js +1 -1
- data/app/assets/javascripts/spree/backend/product_picker.js +1 -1
- data/app/assets/javascripts/spree/backend/shipments.js +6 -1
- data/app/assets/javascripts/spree/backend/stock_management.js +9 -0
- data/app/assets/javascripts/spree/backend/store_credits.js +18 -2
- data/app/assets/javascripts/spree/backend/taxons.js +1 -1
- data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +24 -25
- data/app/assets/javascripts/spree/backend/user_picker.js +1 -1
- data/app/assets/javascripts/spree/backend/variant_autocomplete.js +1 -1
- data/app/assets/javascripts/spree/backend/views/order/customer_select.js +1 -1
- data/app/assets/javascripts/spree/backend/views/order/summary.js +2 -2
- data/app/assets/javascripts/spree/backend/views/stock/add_stock_item.js +15 -4
- data/app/assets/javascripts/spree/backend/views/stock/edit_stock_item_row.js +30 -10
- data/app/assets/stylesheets/spree/backend/globals/_functions.scss +1 -2
- data/app/assets/stylesheets/spree/backend/sections/_orders.scss +8 -0
- data/app/assets/stylesheets/spree/backend/sections/_stock_management.scss +77 -2
- data/app/assets/stylesheets/spree/backend/spree_admin.scss +0 -1
- data/app/controllers/spree/admin/cancellations_controller.rb +2 -2
- data/app/controllers/spree/admin/locale_controller.rb +1 -1
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +8 -1
- data/app/controllers/spree/admin/orders_controller.rb +1 -11
- data/app/controllers/spree/admin/products_controller.rb +10 -6
- data/app/controllers/spree/admin/promotion_codes_controller.rb +19 -1
- data/app/controllers/spree/admin/promotions_controller.rb +1 -1
- data/app/controllers/spree/admin/reimbursements_controller.rb +7 -2
- data/app/controllers/spree/admin/resource_controller.rb +1 -0
- data/app/controllers/spree/admin/store_credit_reasons_controller.rb +8 -0
- data/app/controllers/spree/admin/store_credits_controller.rb +11 -11
- data/app/helpers/spree/admin/navigation_helper.rb +1 -1
- data/app/models/spree/backend_configuration.rb +38 -21
- data/app/views/spree/admin/cancellations/index.html.erb +3 -1
- data/app/views/spree/admin/images/_image_row.html.erb +1 -1
- data/app/views/spree/admin/images/edit.html.erb +3 -3
- data/app/views/spree/admin/images/index.html.erb +2 -2
- data/app/views/spree/admin/log_entries/index.html.erb +2 -2
- data/app/views/spree/admin/orders/_carton_manifest.html.erb +3 -1
- data/app/views/spree/admin/orders/_shipment_manifest.html.erb +3 -1
- data/app/views/spree/admin/orders/confirm/_line_items.html.erb +3 -2
- data/app/views/spree/admin/orders/confirm/_shipment_manifest.html.erb +3 -1
- data/app/views/spree/admin/orders/index.html.erb +1 -1
- data/app/views/spree/admin/products/_form.html.erb +7 -7
- data/app/views/spree/admin/products/edit.html.erb +5 -0
- data/app/views/spree/admin/products/index.html.erb +3 -1
- data/app/views/spree/admin/promotion_categories/index.html.erb +1 -1
- data/app/views/spree/admin/promotion_code_batches/index.html.erb +1 -1
- data/app/views/spree/admin/promotion_codes/index.html.erb +5 -1
- data/app/views/spree/admin/promotion_codes/new.html.erb +31 -0
- data/app/views/spree/admin/promotions/_actions.html.erb +1 -1
- data/app/views/spree/admin/promotions/_activations_edit.html.erb +1 -1
- data/app/views/spree/admin/promotions/_form.html.erb +4 -3
- data/app/views/spree/admin/promotions/_rules.html.erb +1 -1
- data/app/views/spree/admin/promotions/edit.html.erb +3 -1
- data/app/views/spree/admin/refunds/new.html.erb +1 -1
- data/app/views/spree/admin/shared/_address_form.html.erb +10 -3
- data/app/views/spree/admin/shared/_edit_resource_links.html.erb +1 -1
- data/app/views/spree/admin/shared/_head.html.erb +1 -0
- data/app/views/spree/admin/shared/_image.html.erb +2 -2
- data/app/views/spree/admin/shared/_product_sub_menu.html.erb +1 -1
- data/app/views/spree/admin/shared/_settings_checkout_tabs.html.erb +4 -0
- data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +3 -3
- data/app/views/spree/admin/shared/_tabs.html.erb +3 -2
- data/app/views/spree/admin/shared/_variant_search.html.erb +1 -1
- data/app/views/spree/admin/stock_items/_stock_management.html.erb +56 -38
- data/app/views/spree/admin/stock_locations/_form.html.erb +133 -121
- data/app/views/spree/admin/stock_locations/edit.html.erb +4 -2
- data/app/views/spree/admin/store_credit_reasons/edit.html.erb +15 -0
- data/app/views/spree/admin/store_credit_reasons/index.html.erb +56 -0
- data/app/views/spree/admin/store_credit_reasons/new.html.erb +18 -0
- data/app/views/spree/admin/store_credit_reasons/shared/_form.html.erb +15 -0
- data/app/views/spree/admin/store_credits/_store_credit_reason_field.html.erb +7 -0
- data/app/views/spree/admin/store_credits/edit_amount.html.erb +1 -1
- data/app/views/spree/admin/store_credits/edit_validity.html.erb +1 -1
- data/app/views/spree/admin/store_credits/show.html.erb +2 -2
- data/app/views/spree/admin/users/items.html.erb +3 -1
- data/app/views/spree/admin/users/orders.html.erb +1 -1
- data/config/routes.rb +2 -8
- data/lib/spree/backend.rb +1 -1
- data/solidus_backend.gemspec +3 -4
- data/spec/controllers/spree/admin/base_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/cancellations_controller_spec.rb +7 -3
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +50 -2
- data/spec/controllers/spree/admin/orders_controller_spec.rb +23 -11
- data/spec/controllers/spree/admin/payments_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/products_controller_spec.rb +72 -0
- data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +13 -1
- data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +11 -0
- data/spec/controllers/spree/admin/resource_controller_spec.rb +22 -0
- data/spec/controllers/spree/admin/stock_items_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/store_credits_controller_spec.rb +7 -7
- data/spec/features/admin/configuration/payment_methods_spec.rb +2 -2
- data/spec/features/admin/configuration/shipping_methods_spec.rb +2 -2
- data/spec/features/admin/homepage_spec.rb +1 -6
- data/spec/features/admin/orders/listing_spec.rb +1 -1
- data/spec/features/admin/orders/new_order_spec.rb +117 -0
- data/spec/features/admin/orders/new_refund_spec.rb +35 -0
- data/spec/features/admin/orders/order_details_spec.rb +2 -2
- data/spec/features/admin/orders/payments_spec.rb +2 -2
- data/spec/features/admin/orders/return_payment_state_spec.rb +3 -0
- data/spec/features/admin/orders/shipments_spec.rb +28 -0
- data/spec/features/admin/products/products_spec.rb +1 -1
- data/spec/features/admin/products/stock_management_spec.rb +10 -13
- data/spec/features/admin/promotion_adjustments_spec.rb +12 -12
- data/spec/features/admin/promotions/option_value_rule_spec.rb +2 -2
- data/spec/features/admin/promotions/product_rule_spec.rb +1 -1
- data/spec/features/admin/promotions/tiered_calculator_spec.rb +1 -1
- data/spec/features/admin/promotions/user_rule_spec.rb +2 -2
- data/spec/features/admin/reimbursements_spec.rb +1 -1
- data/spec/features/admin/store_credits_spec.rb +51 -2
- data/spec/features/admin/taxons_spec.rb +35 -0
- data/spec/features/admin/users_spec.rb +22 -11
- data/spec/helpers/admin/navigation_helper_spec.rb +4 -2
- data/spec/helpers/admin/store_credit_events_helper_spec.rb +2 -2
- data/spec/javascripts/spec_helper.js +2 -0
- data/spec/models/spree/backend_configuration/menu_item_spec.rb +17 -0
- data/spec/models/spree/backend_configuration_spec.rb +22 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/feature/order_feature_helper.rb +1 -1
- data/spec/views/spree/admin/shared/navigation_footer_spec.rb +1 -1
- data/vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_en-US.js +10 -0
- metadata +26 -34
- data/app/controllers/spree/admin/reports_controller.rb +0 -82
- data/app/views/spree/admin/reports/index.html.erb +0 -19
- data/app/views/spree/admin/reports/sales_total.html.erb +0 -35
- data/app/views/spree/admin/shared/_report_order_criteria.html.erb +0 -19
- data/app/views/spree/admin/store_credits/_update_reason_field.html.erb +0 -7
- data/spec/controllers/spree/admin/reports_controller_spec.rb +0 -133
- data/spec/features/admin/reports_spec.rb +0 -63
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solidus_backend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Solidus Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: solidus_api
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.8.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.8.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: solidus_core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.8.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: 2.8.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: coffee-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '2.
|
75
|
+
version: '2.8'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '2.
|
82
|
+
version: '2.8'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: jquery-rails
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1.1'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: sassc-rails
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
@@ -123,33 +123,19 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: autoprefixer-rails
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: autoprefixer-rails
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - "~>"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '7.1'
|
146
|
-
type: :runtime
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - "~>"
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '7.1'
|
138
|
+
version: '0'
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: handlebars_assets
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,6 +160,7 @@ files:
|
|
174
160
|
- README.md
|
175
161
|
- Rakefile
|
176
162
|
- app/assets/config/solidus_backend_manifest.js
|
163
|
+
- app/assets/images/favicon.ico
|
177
164
|
- app/assets/images/solidus-style-guide-logo.png
|
178
165
|
- app/assets/javascripts/spree/backend.js
|
179
166
|
- app/assets/javascripts/spree/backend/addresses.js
|
@@ -365,7 +352,6 @@ files:
|
|
365
352
|
- app/controllers/spree/admin/refunds_controller.rb
|
366
353
|
- app/controllers/spree/admin/reimbursement_types_controller.rb
|
367
354
|
- app/controllers/spree/admin/reimbursements_controller.rb
|
368
|
-
- app/controllers/spree/admin/reports_controller.rb
|
369
355
|
- app/controllers/spree/admin/resource_controller.rb
|
370
356
|
- app/controllers/spree/admin/return_authorizations_controller.rb
|
371
357
|
- app/controllers/spree/admin/return_items_controller.rb
|
@@ -377,6 +363,7 @@ files:
|
|
377
363
|
- app/controllers/spree/admin/stock_items_controller.rb
|
378
364
|
- app/controllers/spree/admin/stock_locations_controller.rb
|
379
365
|
- app/controllers/spree/admin/stock_movements_controller.rb
|
366
|
+
- app/controllers/spree/admin/store_credit_reasons_controller.rb
|
380
367
|
- app/controllers/spree/admin/store_credits_controller.rb
|
381
368
|
- app/controllers/spree/admin/stores_controller.rb
|
382
369
|
- app/controllers/spree/admin/style_guide_controller.rb
|
@@ -505,6 +492,7 @@ files:
|
|
505
492
|
- app/views/spree/admin/promotion_code_batches/new.html.erb
|
506
493
|
- app/views/spree/admin/promotion_codes/index.csv.ruby
|
507
494
|
- app/views/spree/admin/promotion_codes/index.html.erb
|
495
|
+
- app/views/spree/admin/promotion_codes/new.html.erb
|
508
496
|
- app/views/spree/admin/promotion_rules/create.js.erb
|
509
497
|
- app/views/spree/admin/promotion_rules/destroy.js.erb
|
510
498
|
- app/views/spree/admin/promotions/_actions.html.erb
|
@@ -555,8 +543,6 @@ files:
|
|
555
543
|
- app/views/spree/admin/reimbursements/edit.html.erb
|
556
544
|
- app/views/spree/admin/reimbursements/index.html.erb
|
557
545
|
- app/views/spree/admin/reimbursements/show.html.erb
|
558
|
-
- app/views/spree/admin/reports/index.html.erb
|
559
|
-
- app/views/spree/admin/reports/sales_total.html.erb
|
560
546
|
- app/views/spree/admin/return_authorizations/_form.html.erb
|
561
547
|
- app/views/spree/admin/return_authorizations/edit.html.erb
|
562
548
|
- app/views/spree/admin/return_authorizations/index.html.erb
|
@@ -597,7 +583,6 @@ files:
|
|
597
583
|
- app/views/spree/admin/shared/_promotion_sub_menu.html.erb
|
598
584
|
- app/views/spree/admin/shared/_rebuild_vat_prices_checkbox.html.erb
|
599
585
|
- app/views/spree/admin/shared/_refunds.html.erb
|
600
|
-
- app/views/spree/admin/shared/_report_order_criteria.html.erb
|
601
586
|
- app/views/spree/admin/shared/_settings_checkout_tabs.html.erb
|
602
587
|
- app/views/spree/admin/shared/_settings_sub_menu.html.erb
|
603
588
|
- app/views/spree/admin/shared/_shipping_tabs.html.erb
|
@@ -633,8 +618,12 @@ files:
|
|
633
618
|
- app/views/spree/admin/stock_locations/index.html.erb
|
634
619
|
- app/views/spree/admin/stock_locations/new.html.erb
|
635
620
|
- app/views/spree/admin/stock_movements/index.html.erb
|
621
|
+
- app/views/spree/admin/store_credit_reasons/edit.html.erb
|
622
|
+
- app/views/spree/admin/store_credit_reasons/index.html.erb
|
623
|
+
- app/views/spree/admin/store_credit_reasons/new.html.erb
|
624
|
+
- app/views/spree/admin/store_credit_reasons/shared/_form.html.erb
|
636
625
|
- app/views/spree/admin/store_credits/_form.html.erb
|
637
|
-
- app/views/spree/admin/store_credits/
|
626
|
+
- app/views/spree/admin/store_credits/_store_credit_reason_field.html.erb
|
638
627
|
- app/views/spree/admin/store_credits/edit_amount.html.erb
|
639
628
|
- app/views/spree/admin/store_credits/edit_validity.html.erb
|
640
629
|
- app/views/spree/admin/store_credits/index.html.erb
|
@@ -740,7 +729,6 @@ files:
|
|
740
729
|
- spec/controllers/spree/admin/promotions_controller_spec.rb
|
741
730
|
- spec/controllers/spree/admin/refunds_controller_spec.rb
|
742
731
|
- spec/controllers/spree/admin/reimbursements_controller_spec.rb
|
743
|
-
- spec/controllers/spree/admin/reports_controller_spec.rb
|
744
732
|
- spec/controllers/spree/admin/resource_controller_spec.rb
|
745
733
|
- spec/controllers/spree/admin/return_authorizations_controller_spec.rb
|
746
734
|
- spec/controllers/spree/admin/return_items_controller_spec.rb
|
@@ -772,6 +760,7 @@ files:
|
|
772
760
|
- spec/features/admin/orders/listing_spec.rb
|
773
761
|
- spec/features/admin/orders/log_entries_spec.rb
|
774
762
|
- spec/features/admin/orders/new_order_spec.rb
|
763
|
+
- spec/features/admin/orders/new_refund_spec.rb
|
775
764
|
- spec/features/admin/orders/order_details_spec.rb
|
776
765
|
- spec/features/admin/orders/payments_spec.rb
|
777
766
|
- spec/features/admin/orders/return_authorizations_spec.rb
|
@@ -796,7 +785,6 @@ files:
|
|
796
785
|
- spec/features/admin/promotions/tiered_calculator_spec.rb
|
797
786
|
- spec/features/admin/promotions/user_rule_spec.rb
|
798
787
|
- spec/features/admin/reimbursements_spec.rb
|
799
|
-
- spec/features/admin/reports_spec.rb
|
800
788
|
- spec/features/admin/store_credits_spec.rb
|
801
789
|
- spec/features/admin/stores_spec.rb
|
802
790
|
- spec/features/admin/style_guide_spec.rb
|
@@ -816,6 +804,8 @@ files:
|
|
816
804
|
- spec/javascripts/support/with_translations.js
|
817
805
|
- spec/javascripts/translation_spec.js
|
818
806
|
- spec/javascripts/views/number_with_currency_spec.js
|
807
|
+
- spec/models/spree/backend_configuration/menu_item_spec.rb
|
808
|
+
- spec/models/spree/backend_configuration_spec.rb
|
819
809
|
- spec/spec_helper.rb
|
820
810
|
- spec/support/appear_before_matcher.rb
|
821
811
|
- spec/support/feature/base_feature_helper.rb
|
@@ -848,6 +838,7 @@ files:
|
|
848
838
|
- vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_da.js
|
849
839
|
- vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_de.js
|
850
840
|
- vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_el.js
|
841
|
+
- vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_en-US.js
|
851
842
|
- vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_es-MX.js
|
852
843
|
- vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_es.js
|
853
844
|
- vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_et.js
|
@@ -993,7 +984,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
993
984
|
version: 1.8.23
|
994
985
|
requirements:
|
995
986
|
- none
|
996
|
-
|
987
|
+
rubyforge_project:
|
988
|
+
rubygems_version: 2.7.3
|
997
989
|
signing_key:
|
998
990
|
specification_version: 4
|
999
991
|
summary: Admin interface for the Solidus e-commerce framework.
|
@@ -1,82 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Spree
|
4
|
-
module Admin
|
5
|
-
class ReportsController < Spree::Admin::BaseController
|
6
|
-
respond_to :html
|
7
|
-
|
8
|
-
class << self
|
9
|
-
def available_reports
|
10
|
-
@@available_reports
|
11
|
-
end
|
12
|
-
|
13
|
-
def add_available_report!(report_key, report_description_key = nil)
|
14
|
-
if report_description_key.nil?
|
15
|
-
report_description_key = "#{report_key}_description"
|
16
|
-
end
|
17
|
-
|
18
|
-
@@available_reports[report_key] = {
|
19
|
-
name: report_key,
|
20
|
-
description: report_description_key,
|
21
|
-
}
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def initialize
|
26
|
-
super
|
27
|
-
ReportsController.add_available_report!(:sales_total)
|
28
|
-
end
|
29
|
-
|
30
|
-
def index
|
31
|
-
@reports = ReportsController.available_reports
|
32
|
-
end
|
33
|
-
|
34
|
-
def sales_total
|
35
|
-
params[:q] = search_params
|
36
|
-
|
37
|
-
@search = Order.complete.not_canceled.ransack(params[:q])
|
38
|
-
@orders = @search.result
|
39
|
-
|
40
|
-
@totals = {}
|
41
|
-
@orders.each do |order|
|
42
|
-
unless @totals[order.currency]
|
43
|
-
@totals[order.currency] = {
|
44
|
-
item_total: ::Money.new(0, order.currency),
|
45
|
-
adjustment_total: ::Money.new(0, order.currency),
|
46
|
-
sales_total: ::Money.new(0, order.currency)
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
@totals[order.currency][:item_total] += order.display_item_total.money
|
51
|
-
@totals[order.currency][:adjustment_total] += order.display_adjustment_total.money
|
52
|
-
@totals[order.currency][:sales_total] += order.display_total.money
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
@@available_reports = {}
|
57
|
-
|
58
|
-
private
|
59
|
-
|
60
|
-
def search_params
|
61
|
-
params.fetch(:q, {}).tap do |q|
|
62
|
-
q[:completed_at_gt] = adjust_start_date q[:completed_at_gt]
|
63
|
-
q[:completed_at_lt] = adjust_end_date(q[:completed_at_lt]) if q[:completed_at_lt].present?
|
64
|
-
q[:s] ||= 'completed_at desc'
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def adjust_start_date(string_date = nil)
|
69
|
-
return Time.current.beginning_of_month if string_date.blank?
|
70
|
-
Time.zone.parse(string_date).beginning_of_day
|
71
|
-
rescue ArgumentError
|
72
|
-
Time.current.beginning_of_month
|
73
|
-
end
|
74
|
-
|
75
|
-
def adjust_end_date(string_date)
|
76
|
-
Time.zone.parse(string_date).end_of_day
|
77
|
-
rescue ArgumentError
|
78
|
-
""
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<% admin_breadcrumb(t('spree.reports')) %>
|
2
|
-
|
3
|
-
|
4
|
-
<table class="index">
|
5
|
-
<thead>
|
6
|
-
<tr data-hook="reports_header">
|
7
|
-
<th><%= t('spree.name') %></th>
|
8
|
-
<th><%= t('spree.description') %></th>
|
9
|
-
</tr>
|
10
|
-
</thead>
|
11
|
-
<tbody>
|
12
|
-
<% @reports.each do |key, value| %>
|
13
|
-
<tr data-hook="reports_row">
|
14
|
-
<td><%= link_to t(value[:name], scope: 'spree'), send("#{key}_admin_reports_url".to_sym) %></td>
|
15
|
-
<td><%= t(value[:description], scope: 'spree') %></td>
|
16
|
-
</tr>
|
17
|
-
<% end %>
|
18
|
-
</tbody>
|
19
|
-
</table>
|
@@ -1,35 +0,0 @@
|
|
1
|
-
<% admin_breadcrumb(link_to t('spree.reports'), spree.admin_reports_path) %>
|
2
|
-
<% admin_breadcrumb(t('spree.sales_total')) %>
|
3
|
-
|
4
|
-
<% content_for :page_actions do %>
|
5
|
-
<% end %>
|
6
|
-
|
7
|
-
|
8
|
-
<% content_for :table_filter_title do %>
|
9
|
-
<%= t('spree.date_range') %>
|
10
|
-
<% end %>
|
11
|
-
|
12
|
-
<% content_for :table_filter do %>
|
13
|
-
<%= render partial: 'spree/admin/shared/report_order_criteria', locals: { action: :sales_total } %>
|
14
|
-
<% end %>
|
15
|
-
|
16
|
-
<table class="admin-report" data-hook="sales_total">
|
17
|
-
<thead>
|
18
|
-
<tr>
|
19
|
-
<th><%= t('spree.currency') %></th>
|
20
|
-
<th><%= t('spree.item_total') %></th>
|
21
|
-
<th><%= t('spree.adjustment_total') %></th>
|
22
|
-
<th><%= t('spree.sales_total') %></th>
|
23
|
-
</tr>
|
24
|
-
</thead>
|
25
|
-
<tbody>
|
26
|
-
<% @totals.each do |key, row| %>
|
27
|
-
<tr>
|
28
|
-
<td><%= key %></td>
|
29
|
-
<td><%= row[:item_total].format %></td>
|
30
|
-
<td><%= row[:adjustment_total].format %></td>
|
31
|
-
<td><%= row[:sales_total].format %></td>
|
32
|
-
</tr>
|
33
|
-
<% end %>
|
34
|
-
</tbody>
|
35
|
-
</table>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<%= search_form_for @search, url: spree.url_for(controller: 'admin/reports', action: action) do |s| %>
|
2
|
-
<div class="date-range-filter field">
|
3
|
-
<div class="date-range-fields input-group">
|
4
|
-
<%= s.text_field :completed_at_gt, class: 'datepicker datepicker-from form-control', value: datepicker_field_value(params[:q][:completed_at_gt]), placeholder: t('spree.start') %>
|
5
|
-
|
6
|
-
<div class="input-group-prepend input-group-append">
|
7
|
-
<span class="input-group-text range-divider">
|
8
|
-
<i class="fa fa-arrow-right"></i>
|
9
|
-
</span>
|
10
|
-
</div>
|
11
|
-
|
12
|
-
<%= s.text_field :completed_at_lt, class: 'datepicker datepicker-to form-control', value: datepicker_field_value(params[:q][:completed_at_lt]), placeholder: t('spree.end') %>
|
13
|
-
</div>
|
14
|
-
</div>
|
15
|
-
|
16
|
-
<div class="actions filter-actions">
|
17
|
-
<%= button_tag t('spree.search'), class: 'btn btn-primary' %>
|
18
|
-
</div>
|
19
|
-
<% end %>
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<%= f.field_container :reason do %>
|
2
|
-
<%= f.label :reason, t('spree.reason'), class: 'required' %>
|
3
|
-
<%= select_tag :update_reason_id, options_from_collection_for_select(@update_reasons, :id, :name),
|
4
|
-
include_blank: t('spree.choose_reason'), class: 'custom-select fullwidth',
|
5
|
-
placeholder: t('spree.admin.store_credits.select_amount_update_reason') %>
|
6
|
-
<%= f.error_message_on :reason %>
|
7
|
-
<% end %>
|
@@ -1,133 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Spree::Admin::ReportsController, type: :controller do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
describe 'ReportsController.available_reports' do
|
9
|
-
it 'should contain sales_total' do
|
10
|
-
expect(Spree::Admin::ReportsController.available_reports.keys.include?(:sales_total)).to be true
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe 'ReportsController.add_available_report!' do
|
15
|
-
context 'when adding the report name' do
|
16
|
-
it 'should contain the report' do
|
17
|
-
Spree::Admin::ReportsController.add_available_report!(:some_report)
|
18
|
-
expect(Spree::Admin::ReportsController.available_reports.keys.include?(:some_report)).to be true
|
19
|
-
expect(Spree::Admin::ReportsController.available_reports[:some_report]).to eq(
|
20
|
-
name: :some_report,
|
21
|
-
description: 'some_report_description'
|
22
|
-
)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
describe 'GET sales_total' do
|
28
|
-
let!(:order_complete_start_of_month) { create(:completed_order_with_totals) }
|
29
|
-
let!(:order_complete_mid_month) { create(:completed_order_with_totals) }
|
30
|
-
let!(:order_non_complete) { create(:order, completed_at: nil) }
|
31
|
-
|
32
|
-
before do
|
33
|
-
# can't set completed_at during factory creation
|
34
|
-
order_complete_start_of_month.completed_at = Time.current.beginning_of_month + 1.minute
|
35
|
-
order_complete_start_of_month.save!
|
36
|
-
|
37
|
-
order_complete_mid_month.completed_at = Time.current.beginning_of_month + 15.days
|
38
|
-
order_complete_mid_month.save!
|
39
|
-
end
|
40
|
-
|
41
|
-
subject { get :sales_total, params: params }
|
42
|
-
|
43
|
-
shared_examples 'sales total report' do
|
44
|
-
it 'should respond with success' do
|
45
|
-
expect(response).to be_successful
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'should set search to be a ransack search' do
|
49
|
-
subject
|
50
|
-
expect(assigns(:search)).to be_a Ransack::Search
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'should set orders correctly for date parameters' do
|
54
|
-
subject
|
55
|
-
expect(assigns(:orders)).to eq expected_returned_orders
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'does not include non-complete orders' do
|
59
|
-
subject
|
60
|
-
expect(assigns(:orders)).to_not include(order_non_complete)
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'should correctly set the totals hash' do
|
64
|
-
subject
|
65
|
-
expect(assigns(:totals)).to eq expected_totals
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
context 'when no dates are specified' do
|
70
|
-
let(:params) { {} }
|
71
|
-
|
72
|
-
it_behaves_like 'sales total report' do
|
73
|
-
let(:expected_returned_orders) { [order_complete_mid_month, order_complete_start_of_month] }
|
74
|
-
let(:expected_totals) {
|
75
|
-
{
|
76
|
-
'USD' => {
|
77
|
-
item_total: Money.new(2000, 'USD'),
|
78
|
-
adjustment_total: Money.new(0, 'USD'),
|
79
|
-
sales_total: Money.new(22_000, 'USD')
|
80
|
-
}
|
81
|
-
}
|
82
|
-
}
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
context 'when params has a completed_at_gt' do
|
87
|
-
let(:params) { { q: { completed_at_gt: Time.current.beginning_of_month + 1.day } } }
|
88
|
-
|
89
|
-
it_behaves_like 'sales total report' do
|
90
|
-
let(:expected_returned_orders) { [order_complete_mid_month] }
|
91
|
-
let(:expected_totals) {
|
92
|
-
{
|
93
|
-
'USD' => {
|
94
|
-
item_total: Money.new(1000, 'USD'),
|
95
|
-
adjustment_total: Money.new(0, 'USD'),
|
96
|
-
sales_total: Money.new(11_000, 'USD')
|
97
|
-
}
|
98
|
-
}
|
99
|
-
}
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
context 'when params has a compeleted_at_lt' do
|
104
|
-
let(:params) { { q: { completed_at_lt: Time.current.beginning_of_month } } }
|
105
|
-
|
106
|
-
it_behaves_like 'sales total report' do
|
107
|
-
let(:expected_returned_orders) { [order_complete_start_of_month] }
|
108
|
-
let(:expected_totals) {
|
109
|
-
{
|
110
|
-
'USD' => {
|
111
|
-
item_total: Money.new(1000, 'USD'),
|
112
|
-
adjustment_total: Money.new(0, 'USD'),
|
113
|
-
sales_total: Money.new(11_000, 'USD')
|
114
|
-
}
|
115
|
-
}
|
116
|
-
}
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
describe 'GET index' do
|
122
|
-
it 'should be ok' do
|
123
|
-
get :index
|
124
|
-
expect(response).to be_ok
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
after(:each) do
|
129
|
-
Spree::Admin::ReportsController.available_reports.delete_if do |key, _value|
|
130
|
-
key != :sales_total
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|