spree_reports 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6500106e38d28eb5485eb9b6c178925ce9dc38ef
4
- data.tar.gz: e67b9c9a9f0a956c69d282a214463a7d6abfb2c9
3
+ metadata.gz: 2d031c22ad008c1f4c061859c96379ae9d5c4d6f
4
+ data.tar.gz: 5208bf9eb2c99a58a6f230caf5371fffc7a740ee
5
5
  SHA512:
6
- metadata.gz: 9db51ba8cf0813443f00119188dc75b3fc0f9aa7ccc7f9c4d9efa01ebba795f869c2acc0f8b55baadba496c2bd349fece14c1f134d6719b21deaca5e2f179763
7
- data.tar.gz: cd4285331e0964650058ffbe8e92fba5156ff8bf55c7e0ff4bc7e1ac5196142b3e8e2769757e1cd586e3380af59927271f784368518b46938e698e3cb5ca946f
6
+ metadata.gz: e3d169f0a2500c56c4f00d4a1041a55244433ae4f6e046200995271b655e51145a47f6cd1284e33e44b04415889583c8e59727ef260db19b014ec9cce508dd6f
7
+ data.tar.gz: 1b7df621ac1f57c4739bfa196282fd11b567a5922be7baa8e5544a799c10a0fcd93aa1cd888198f8eec53f9c335967b32998ef522b08f2981a3f917c68d0da10
@@ -37,6 +37,10 @@
37
37
  th.help {
38
38
  cursor:help;
39
39
  }
40
+
41
+ td a.red {
42
+ color: red;
43
+ }
40
44
  }
41
45
 
42
46
  div.permalink {
@@ -39,16 +39,18 @@
39
39
 
40
40
  <table class="data" border="1">
41
41
  <tr>
42
+ <th>Pos</th>
42
43
  <th>Variant ID</th>
43
44
  <th>Product Variant Name</th>
44
45
  <th>Quantity</th>
45
46
  </tr>
46
47
 
47
- <% @report.data.each do |item| %>
48
+ <% @report.data.each_with_index do |item, index| %>
48
49
  <tr>
50
+ <td><%= index+1 %></td>
49
51
  <td><%= item[:variant_id] %></td>
50
52
  <td>
51
- <%= link_to item[:variant_name], product_path(item[:variant_slug]) %>
53
+ <%= link_to item[:variant_name], product_path(item[:variant_slug]), class: item[:variant_available_on] > Time.now ? "red" : "" %>
52
54
  <%= link_to "edit", admin_product_path(item[:variant_slug]) %>
53
55
  </td>
54
56
  <td><%= number_with_delimiter(item[:quantity]) %></td>
@@ -36,9 +36,17 @@ module SpreeReports
36
36
  variant_ids_and_quantity = line_items.group(:variant_id).sum(:quantity).sort_by { |k,v| v }.reverse
37
37
 
38
38
  variants = Spree::Variant.all
39
- variant_names = variants.all.map { |v| [v.id, [variant_name_with_option_values(v), v.slug] ] }.to_h
39
+ variant_names = variants.all.map { |v| [v.id, [variant_name_with_option_values(v), v.slug, v.available_on] ] }.to_h
40
40
 
41
- @data_tmp = variant_ids_and_quantity.map { |id, quantity| [id, quantity, variant_names[id][0], variant_names[id][1]] }
41
+ @data_tmp = variant_ids_and_quantity.map do |id, quantity|
42
+ [
43
+ id,
44
+ quantity,
45
+ variant_names[id][0],
46
+ variant_names[id][1],
47
+ variant_names[id][2]
48
+ ]
49
+ end
42
50
  end
43
51
 
44
52
  def build_response
@@ -47,6 +55,7 @@ module SpreeReports
47
55
  variant_id: item[0],
48
56
  variant_name: item[2],
49
57
  variant_slug: item[3],
58
+ variant_available_on: item[4],
50
59
  quantity: item[1]
51
60
  }
52
61
  end
@@ -1,3 +1,3 @@
1
1
  module SpreeReports
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_reports
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Lieser