workarea-registries 1.0.2 → 1.0.3

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: 1a2b1c630436c15b55bccec35553877cb860feae
4
- data.tar.gz: 3be91d970c1eb612479c96fa2ce0e7e85a35889c
3
+ metadata.gz: 598e99cfdaf45678767ef50031e9b69bfdcc018e
4
+ data.tar.gz: 14736e4dae16179bb78179bfa546ee80e9b7ca13
5
5
  SHA512:
6
- metadata.gz: 0e8d2f32d635020829bcc72f30ddea226af4e2fe6c2fc53c0a14d02154e58f9c53811ff63295ec8910aa4ab895b3b4a367bde444663a27e8be6b95acd0b410e7
7
- data.tar.gz: 13538c3c791f92b0cd6fdf8831d6892119b56eb0ea5aafe22d40d2a3f23bf9f77979365c00a4a7d9ddb18ac46c4df7c71f527019dd3ddc8cb37fd6fa331780c0
6
+ metadata.gz: 3d913f8391d851f02109034c06a63a12c5ea8229b90b66b25d60fa7c2e00b91c30511da53a190b7ab9e02f256b6962d4c184688e29be35f9e417d913780b04b8
7
+ data.tar.gz: 618affe7ce5279dd4541eb4f7c11e72c2549b58b20e9b6557523ec759433c7adc3218e90afce88fa0180d91bfc56404b1876ec26c17c4e2e1aeec629ad5b41b5
@@ -61,6 +61,18 @@ module Workarea
61
61
  items.reject(&:purchased_by?).select(&:available?)
62
62
  end
63
63
 
64
+ def total_items
65
+ unpurchased_items.pluck('quantity').sum
66
+ end
67
+
68
+ def total_items_received
69
+ unpurchased_items.pluck('received').sum
70
+ end
71
+
72
+ def total_products
73
+ model.unpurchased_items.size
74
+ end
75
+
64
76
  def add_item(params)
65
77
  quantity = params.fetch(:quantity, 1).to_i
66
78
  existing_item = find_existing_item(sku: params[:sku])
@@ -56,13 +56,21 @@
56
56
 
57
57
  %h2= t('workarea.storefront.registries.items')
58
58
 
59
- .browsing-controls
60
- = form_tag users_registry_path, method: 'get', class: 'browsing-controls__form' do
61
- %p.browsing-controls__form-item.property
62
- = label_tag :state, nil, class: 'property__name' do
63
- %span.property__text= t('workarea.storefront.registries.filter')
64
- %span.value= select_tag :state, options_for_select(@registry.state_options, params[:state]), data: { form_submitting_control: '' }
65
- %p.browsing-controls__form-item.hidden-if-js-enabled= button_tag t('workarea.storefront.forms.go'), class: 'button'
59
+ .grid.grid--auto.grid--middle
60
+ - if @registry.purchased_items.any?
61
+ .grid__cell
62
+ .browsing-controls
63
+ = form_tag users_registry_path, method: 'get', class: 'browsing-controls__form' do
64
+ %p.browsing-controls__form-item.property
65
+ = label_tag :state, nil, class: 'property__name' do
66
+ %span.property__text= t('workarea.storefront.registries.filter')
67
+ %span.value= select_tag :state, options_for_select(@registry.state_options, params[:state]), data: { form_submitting_control: '' }
68
+ %p.browsing-controls__form-item.hidden-if-js-enabled= button_tag t('workarea.storefront.forms.go'), class: 'button'
69
+ - if @registry.unpurchased_items.any?
70
+ .grid__cell
71
+ = t('workarea.storefront.registries.total_products', count: @registry.total_products)
72
+ |
73
+ = t('workarea.storefront.registries.total_items_received', count: @registry.total_items_received)
66
74
 
67
75
  .grid
68
76
  .grid__cell
@@ -94,6 +94,15 @@ en:
94
94
  heading: Search Registries
95
95
  search_title: Registry Search
96
96
  title: Registries
97
+ total_items:
98
+ one: '%{count} Item'
99
+ other: '%{count} Items'
100
+ total_items_received:
101
+ one: '%{count} Item Purchased'
102
+ other: '%{count} Items Purchased'
103
+ total_products:
104
+ one: '%{count} Product'
105
+ other: '%{count} Products'
97
106
  quantity_purchased: '%{quantity} purchased'
98
107
  unpurchased_items: Unpurchased Items
99
108
  view: View
@@ -1,5 +1,5 @@
1
1
  module Workarea
2
2
  module Registries
3
- VERSION = '1.0.2'.freeze
3
+ VERSION = '1.0.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-registries
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jurgen Hahn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-28 00:00:00.000000000 Z
11
+ date: 2021-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: workarea