solidus_auction 0.0.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.
Files changed (122) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +26 -0
  3. data/README.md +57 -0
  4. data/Rakefile +30 -0
  5. data/app/assets/javascripts/auctions.js +2 -0
  6. data/app/assets/javascripts/countdown.js +20 -0
  7. data/app/assets/javascripts/local-time.js +1 -0
  8. data/app/assets/javascripts/spree/backend/product_autocomplete.js +50 -0
  9. data/app/assets/javascripts/spree/backend/solidus_auction.js +7 -0
  10. data/app/assets/javascripts/spree/ends_in.js +31 -0
  11. data/app/assets/javascripts/spree/frontend/solidus_auction.js +8 -0
  12. data/app/assets/javascripts/spree/frontend/starts_in.js +32 -0
  13. data/app/assets/javascripts/spree/frontend/votes.js +83 -0
  14. data/app/assets/stylesheets/spree/backend/solidus_auction.css +16 -0
  15. data/app/assets/stylesheets/spree/frontend/solidus_auction.css +24 -0
  16. data/app/controllers/spree/admin/auction_settings_controller.rb +16 -0
  17. data/app/controllers/spree/admin/auctions_controller.rb +46 -0
  18. data/app/controllers/spree/admin/bids_controller.rb +2 -0
  19. data/app/controllers/spree/admin/resource_controller_decorator.rb +9 -0
  20. data/app/controllers/spree/auctions_controller.rb +52 -0
  21. data/app/controllers/spree/bids_controller.rb +48 -0
  22. data/app/controllers/spree/helpers/local_time_helper.rb +77 -0
  23. data/app/controllers/spree/users_controller_decorator.rb +5 -0
  24. data/app/controllers/spree/votes_controller.rb +5 -0
  25. data/app/helpers/spree/strong_params_decorator.rb +8 -0
  26. data/app/models/spree/auction.rb +291 -0
  27. data/app/models/spree/auction_ability.rb +13 -0
  28. data/app/models/spree/bid.rb +19 -0
  29. data/app/models/spree/product_decorator.rb +3 -0
  30. data/app/models/spree/user_decorator.rb +5 -0
  31. data/app/models/spree/variant_decorator.rb +3 -0
  32. data/app/overrides/add_auction_links_to_order_info.rb +6 -0
  33. data/app/overrides/add_auction_settings_tab.rb +8 -0
  34. data/app/overrides/add_auctions_tab_to_admin.rb +8 -0
  35. data/app/overrides/add_auctions_table_to_user_show.rb +6 -0
  36. data/app/overrides/add_auctions_to_main_nav.rb +6 -0
  37. data/app/overrides/add_timezone_to_admin.rb +8 -0
  38. data/app/overrides/change_line_item_delete_button.rb +6 -0
  39. data/app/overrides/change_line_item_link_to.rb +6 -0
  40. data/app/overrides/change_line_item_number_field_disabled.rb +6 -0
  41. data/app/overrides/change_order_item_description.rb +6 -0
  42. data/app/overrides/change_stock_item_name.rb +6 -0
  43. data/app/overrides/change_variant_row_show.rb +6 -0
  44. data/app/overrides/change_variant_stock_item_show.rb +6 -0
  45. data/app/validators/in_future_validator.rb +10 -0
  46. data/app/views/spree/admin/active_shipping_settings/edit.html.erb +108 -0
  47. data/app/views/spree/admin/auction_settings/edit.html.erb +45 -0
  48. data/app/views/spree/admin/auctions/_form.html.erb +189 -0
  49. data/app/views/spree/admin/auctions/edit.html.erb +18 -0
  50. data/app/views/spree/admin/auctions/index.html.erb +89 -0
  51. data/app/views/spree/admin/auctions/new.html.erb +14 -0
  52. data/app/views/spree/admin/shared/_auction_links_to_order_info.html.erb +18 -0
  53. data/app/views/spree/admin/shared/_auction_settings_button.html.erb +3 -0
  54. data/app/views/spree/admin/shared/_auctions_tab.html.erb +3 -0
  55. data/app/views/spree/admin/shared/_time_zone_field.html.erb +5 -0
  56. data/app/views/spree/auctions/_bid_form.html.erb +81 -0
  57. data/app/views/spree/auctions/_bids.html.erb +52 -0
  58. data/app/views/spree/auctions/_image.html.erb +5 -0
  59. data/app/views/spree/auctions/_promotions.html.erb +19 -0
  60. data/app/views/spree/auctions/_properties.html.erb +15 -0
  61. data/app/views/spree/auctions/_taxons.html.erb +14 -0
  62. data/app/views/spree/auctions/_thumbnails.html.erb +19 -0
  63. data/app/views/spree/auctions/index.html.erb +3 -0
  64. data/app/views/spree/auctions/show.html.erb +58 -0
  65. data/app/views/spree/bids/index.html.erb +0 -0
  66. data/app/views/spree/bids/new.html.erb +0 -0
  67. data/app/views/spree/products/_cart_form.html.erb +65 -0
  68. data/app/views/spree/products/_promotions.html.erb +19 -0
  69. data/app/views/spree/products/_properties.html.erb +15 -0
  70. data/app/views/spree/products/_taxons.html.erb +14 -0
  71. data/app/views/spree/products/_thumbnails.html.erb +19 -0
  72. data/app/views/spree/products/index.html.erb +15 -0
  73. data/app/views/spree/products/show.html.erb +51 -0
  74. data/app/views/spree/shared/_auction_order_link.html.erb +9 -0
  75. data/app/views/spree/shared/_auctions.html.erb +39 -0
  76. data/app/views/spree/shared/_auctions_link.html.erb +7 -0
  77. data/app/views/spree/shared/_auctions_table_show.html.erb +93 -0
  78. data/app/views/spree/shared/_ends_in.html.erb +14 -0
  79. data/app/views/spree/shared/_image.html.erb +12 -0
  80. data/app/views/spree/shared/_line_item_delete.html.erb +5 -0
  81. data/app/views/spree/shared/_line_item_link_to.erb +22 -0
  82. data/app/views/spree/shared/_line_item_number_field_disabled.erb +9 -0
  83. data/app/views/spree/shared/_order_item_description.html.erb +15 -0
  84. data/app/views/spree/shared/_starts_in.html.erb +14 -0
  85. data/app/views/spree/shared/_stock_item_name.html.erb +5 -0
  86. data/app/views/spree/shared/_time_in_words_display.html.erb +11 -0
  87. data/app/views/spree/shared/_variant_row_disable.html.erb +21 -0
  88. data/app/views/spree/shared/_variant_stock_item_disable.html.erb +62 -0
  89. data/app/views/spree/shared/_votes.html.erb +12 -0
  90. data/app/views/spree/votes/index.html.erb +13 -0
  91. data/config/locales/en.yml +76 -0
  92. data/config/routes.rb +17 -0
  93. data/db/migrate/20180225234309_create_auctions.rb +25 -0
  94. data/db/migrate/20180225235226_create_bids.rb +13 -0
  95. data/db/migrate/20180316051158_add_deleted_to_spree_auction.rb +5 -0
  96. data/db/migrate/20180320010358_change_auction_reserve_price_column_to_big_decimal.rb +8 -0
  97. data/db/migrate/20180321203019_add_time_zone_to_spree_user.rb +5 -0
  98. data/db/migrate/20180322014713_add_default_to_datetimes.rb +7 -0
  99. data/db/migrate/20180328233438_add_variant_id_to_auction.rb +5 -0
  100. data/db/migrate/20180410025053_acts_as_votable_migration.rb +22 -0
  101. data/db/migrate/20180410031333_add_cached_votes_to_spree_auctions.rb +13 -0
  102. data/lib/assets/javascripts/src/local-time/calendar_date.coffee +37 -0
  103. data/lib/assets/javascripts/src/local-time/config/i18n.coffee +74 -0
  104. data/lib/assets/javascripts/src/local-time/config/locale.coffee +2 -0
  105. data/lib/assets/javascripts/src/local-time/config/timer.coffee +1 -0
  106. data/lib/assets/javascripts/src/local-time/controller.coffee +59 -0
  107. data/lib/assets/javascripts/src/local-time/helpers/date_parse.coffee +15 -0
  108. data/lib/assets/javascripts/src/local-time/helpers/dom.coffee +11 -0
  109. data/lib/assets/javascripts/src/local-time/helpers/i18n.coffee +24 -0
  110. data/lib/assets/javascripts/src/local-time/helpers/strftime.coffee +55 -0
  111. data/lib/assets/javascripts/src/local-time/index.coffee +20 -0
  112. data/lib/assets/javascripts/src/local-time/page_observer.coffee +43 -0
  113. data/lib/assets/javascripts/src/local-time/relative_time.coffee +72 -0
  114. data/lib/assets/javascripts/src/local-time/start.coffee +25 -0
  115. data/lib/generators/solidus_auction/install/install_generator.rb +30 -0
  116. data/lib/local_time.rb +0 -0
  117. data/lib/solidus_auction.rb +3 -0
  118. data/lib/solidus_auction/configuration.rb +8 -0
  119. data/lib/solidus_auction/engine.rb +29 -0
  120. data/lib/solidus_auction/factories.rb +19 -0
  121. data/lib/solidus_auction/version.rb +3 -0
  122. metadata +388 -0
@@ -0,0 +1,13 @@
1
+ class Spree::AuctionAbility
2
+ include CanCan::Ability
3
+
4
+ def initialize(user)
5
+ can :create, Spree::Auction do
6
+ user.admin?
7
+ end
8
+
9
+ can %i{edit update destroy delete clone}, Spree::Auction do |auction|
10
+ auction.creator_id == user.id
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ class Spree::Bid < Spree::Base
2
+ belongs_to :auction, class_name: 'Spree::Auction'
3
+ belongs_to :bidder, class_name: 'Spree::User'
4
+
5
+ validates :auction_id, presence: true
6
+ validates :bidder_id, presence: true
7
+ validates :amount, presence: true
8
+
9
+ extend Spree::DisplayMoney
10
+ money_methods :amount
11
+
12
+ def is_autobid?
13
+ !visible && accepted
14
+ end
15
+
16
+ def bidder_display_name
17
+ bidder.email
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ Spree::Product.class_eval do
2
+ has_many :auctions, class_name: 'Spree::Auction'
3
+ end
@@ -0,0 +1,5 @@
1
+ Spree::User.class_eval do
2
+ has_many :bids, class_name: 'Spree::Bid', foreign_key: "bidder_id"
3
+ has_many :auctions, class_name: 'Spree::Auction', through: :bids
4
+ acts_as_voter
5
+ end
@@ -0,0 +1,3 @@
1
+ Spree::Variant.class_eval do
2
+ has_one :auction, class_name: 'Spree::Auction'
3
+ end
@@ -0,0 +1,6 @@
1
+ Deface::Override.new(
2
+ virtual_path: 'spree/admin/shared/_order_summary',
3
+ name: :auction_links_to_order_info,
4
+ insert_bottom: "[data-hook='admin_settings_sub_tabs']",
5
+ partial: 'spree/admin/shared/auction_links_to_order_info'
6
+ )
@@ -0,0 +1,8 @@
1
+ if Spree::Backend::Config.respond_to?(:menu_items)
2
+ Deface::Override.new(
3
+ virtual_path: 'spree/admin/shared/_settings_sub_menu',
4
+ name: :auction_settings,
5
+ insert_bottom: "[data-hook='admin_settings_sub_tabs']",
6
+ partial: 'spree/admin/shared/auction_settings_button'
7
+ )
8
+ end
@@ -0,0 +1,8 @@
1
+ if Spree::Backend::Config.respond_to?(:menu_items)
2
+ Deface::Override.new(
3
+ virtual_path: 'spree/admin/shared/_menu',
4
+ name: :auctions,
5
+ insert_top: "[data-hook='admin_tabs']",
6
+ partial: 'spree/admin/shared/auctions_tab'
7
+ )
8
+ end
@@ -0,0 +1,6 @@
1
+ Deface::Override.new(
2
+ virtual_path: 'spree/users/show',
3
+ name: :auctions_table_show,
4
+ insert_after: "[data-hook='account_summary']",
5
+ partial: 'spree/shared/auctions_table_show'
6
+ )
@@ -0,0 +1,6 @@
1
+ Deface::Override.new(
2
+ virtual_path: 'spree/shared/_main_nav_bar',
3
+ name: :auctions_menu_link,
4
+ insert_after: "#home-link",
5
+ partial: 'spree/shared/auctions_link'
6
+ )
@@ -0,0 +1,8 @@
1
+ if Spree::Backend::Config.respond_to?(:menu_items)
2
+ Deface::Override.new(
3
+ virtual_path: 'spree/admin/users/_form',
4
+ name: :users,
5
+ insert_bottom: "[data-hook='admin_user_form_roles']",
6
+ partial: 'spree/admin/shared/time_zone_field'
7
+ )
8
+ end
@@ -0,0 +1,6 @@
1
+ Deface::Override.new(
2
+ virtual_path: 'spree/orders/_line_item',
3
+ name: :line_item_delete,
4
+ replace: "[data-hook='cart_item_delete']",
5
+ partial: 'spree/shared/line_item_delete'
6
+ )
@@ -0,0 +1,6 @@
1
+ Deface::Override.new(
2
+ virtual_path: 'spree/orders/_line_item',
3
+ name: :line_item_link_to,
4
+ replace: "[data-hook='cart_item_description']",
5
+ partial: 'spree/shared/line_item_link_to'
6
+ )
@@ -0,0 +1,6 @@
1
+ Deface::Override.new(
2
+ virtual_path: 'spree/orders/_line_item',
3
+ name: :line_item_disable,
4
+ replace: "[data-hook='cart_item_quantity']",
5
+ partial: 'spree/shared/line_item_number_field_disabled'
6
+ )
@@ -0,0 +1,6 @@
1
+ Deface::Override.new(
2
+ virtual_path: 'spree/shared/_order_details',
3
+ name: :order_item_description,
4
+ replace: "[data-hook='order_item_description']",
5
+ partial: 'spree/shared/order_item_description'
6
+ )
@@ -0,0 +1,6 @@
1
+ Deface::Override.new(
2
+ virtual_path: 'spree/checkout/_delivery',
3
+ name: :stock_item_name,
4
+ replace: ".item-name",
5
+ partial: 'spree/shared/stock_item_name'
6
+ )
@@ -0,0 +1,6 @@
1
+ Deface::Override.new(
2
+ virtual_path: 'spree/admin/variants/_table',
3
+ name: :variant_disable,
4
+ replace: "[data-hook='variants_row']",
5
+ partial: 'spree/shared/variant_row_disable'
6
+ )
@@ -0,0 +1,6 @@
1
+ Deface::Override.new(
2
+ virtual_path: 'spree/admin/stock_items/_stock_management',
3
+ name: :variant_stock_item_disable,
4
+ replace: "[class='variant-stock-items']",
5
+ partial: 'spree/shared/variant_stock_item_disable'
6
+ )
@@ -0,0 +1,10 @@
1
+ class InFutureValidator < ActiveModel::EachValidator
2
+ def validate_each(record, attribute, value)
3
+ if value.blank?
4
+ record.errors.add attribute, (options[:message] || "can't be blank")
5
+ elsif value <= Time.zone.today
6
+ record.errors.add attribute,
7
+ (options[:message] || "can't be in the past")
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,108 @@
1
+ <%= render partial: 'spree/admin/shared/configuration_menu' %>
2
+
3
+ <% content_for :page_title do %>
4
+ <%= Spree.t(:active_shipping_settings) %>
5
+ <% end %>
6
+
7
+ <%= form_tag admin_active_shipping_settings_path, method: :put do |form| %>
8
+ <div id="preferences" data-hook>
9
+ <fieldset class="general no-border-top">
10
+ <div class="row">
11
+ <div class="col-5">
12
+ <fieldset class="currency no-border-bottom">
13
+ <legend align="center"><%= Spree.t(:fedex_settings)%></legend>
14
+
15
+ <% @preferences_UPS.each do |name| %>
16
+ <div class="field">
17
+ <%= render "spree/admin/shared/preference_fields/#{@config.preference_type(name)}",
18
+ name: name.to_s,
19
+ value: @config[name],
20
+ label: t(name.to_s, scope: 'spree', default: name.to_s.humanize) %>
21
+ </div>
22
+ <% end %>
23
+ </fieldset>
24
+ </div>
25
+
26
+ <div class="col-5">
27
+ <fieldset class="currency no-border-bottom">
28
+ <legend align="center"><%= Spree.t(:fedex_settings)%></legend>
29
+
30
+ <% @preferences_FedEx.each do |name| %>
31
+ <div class="field">
32
+ <%= render "spree/admin/shared/preference_fields/#{@config.preference_type(name)}",
33
+ name: name.to_s,
34
+ value: @config[name],
35
+ label: t(name.to_s, scope: 'spree', default: name.to_s.humanize) %>
36
+ </div>
37
+ <% end %>
38
+ </fieldset>
39
+ </div>
40
+
41
+ <div class="col-5">
42
+ <fieldset class="security no-border-bottom">
43
+ <legend align="center"><%= Spree.t(:usps_settings)%></legend>
44
+
45
+ <% @preferences_USPS.each do |name| %>
46
+ <div class="field">
47
+ <%= render "spree/admin/shared/preference_fields/#{@config.preference_type(name)}",
48
+ name: name.to_s,
49
+ value: @config[name],
50
+ label: t(name.to_s, scope: 'spree', default: name.to_s.humanize) %>
51
+ </div>
52
+ <% end %>
53
+ </fieldset>
54
+ </div>
55
+
56
+ <div class="col-5">
57
+ <fieldset class="currency no-border-bottom">
58
+ <legend align="center"><%= Spree.t(:canada_post_settings)%></legend>
59
+
60
+ <% @preferences_CanadaPost.each do |name| %>
61
+ <div class="field">
62
+ <%= render "spree/admin/shared/preference_fields/#{@config.preference_type(name)}",
63
+ name: name.to_s,
64
+ value: @config[name],
65
+ label: t(name.to_s, scope: 'spree', default: name.to_s.humanize) %>
66
+ </div>
67
+ <% end %>
68
+ </fieldset>
69
+ </div>
70
+
71
+ <div class="col-5">
72
+ <fieldset class="currency no-border-bottom">
73
+ <legend align="center"><%= Spree.t(:canada_post_pws_settings)%></legend>
74
+
75
+ <% @preferences_CanadaPostPws.each do |name| %>
76
+ <div class="field">
77
+ <%= render "spree/admin/shared/preference_fields/#{@config.preference_type(name)}",
78
+ name: name.to_s,
79
+ value: @config[name],
80
+ label: t(name.to_s, scope: 'spree', default: name.to_s.humanize) %>
81
+ </div>
82
+ <% end %>
83
+ </fieldset>
84
+ </div>
85
+
86
+ <div class="col-5">
87
+ <fieldset class="currency no-border-bottom">
88
+ <legend align="center"><%= Spree.t(:general_settings)%></legend>
89
+
90
+ <% @preferences_GeneralSettings.each do |name| %>
91
+ <div class="field">
92
+ <%= render "spree/admin/shared/preference_fields/#{@config.preference_type(name)}",
93
+ name: name.to_s,
94
+ value: @config[name],
95
+ label: t(name.to_s, scope: 'spree', default: name.to_s.humanize) %>
96
+ </div>
97
+ <% end %>
98
+ </fieldset>
99
+ </div>
100
+ </div>
101
+
102
+ <div class="form-buttons filter-actions actions" data-hook="buttons">
103
+ <%= button Spree.t(:update) %>
104
+ <%= button_link_to Spree.t(:cancel), edit_admin_active_shipping_settings_url %>
105
+ </div>
106
+ </fieldset>
107
+ </div>
108
+ <% end %>
@@ -0,0 +1,45 @@
1
+ <%= render partial: 'spree/admin/shared/configuration_menu' %>
2
+
3
+ <% content_for :page_title do %>
4
+ <%= Spree.t(:auction_settings) %>
5
+ <% end %>
6
+
7
+ <%= form_tag admin_auction_settings_path, method: :put do |form| %>
8
+ <div id="preferences" data-hook>
9
+ <fieldset class="general no-border-top">
10
+ <div class="row">
11
+ <div class="col-5">
12
+ <%= label_tag Spree.t('starting_soon_hours') %>
13
+ <%= number_field_tag 'starting_soon_hours', @config[:starting_soon_hours], min: 1, step: 1 %>
14
+ </div>
15
+ </div>
16
+
17
+ <div class="row">
18
+ <div class="col-5">
19
+ <%= label_tag Spree.t('ending_soon_hours') %>
20
+ <%= number_field_tag 'ending_soon_hours', @config[:ending_soon_hours], min: 1, step: 1 %>
21
+ </div>
22
+ </div>
23
+
24
+ <div class="row">
25
+ <div class="col-5">
26
+ <%= label_tag Spree.t('recently_completed_hours') %>
27
+ <%= number_field_tag 'recently_completed_hours', @config[:recently_completed_hours], min: 1, step: 1 %>
28
+ </div>
29
+ </div>
30
+
31
+ <div class="row">
32
+ <div class="col-5">
33
+ <%= label_tag Spree.t('number_of_bids_to_show') %>
34
+ <%= number_field_tag 'number_of_bids_to_show', @config[:number_of_bids_to_show], min: 1, step: 1 %>
35
+ </div>
36
+ </div>
37
+
38
+
39
+ <div class="form-buttons filter-actions actions" data-hook="buttons">
40
+ <%= button Spree.t(:update) %>
41
+ <%= button_link_to Spree.t(:cancel), edit_admin_auction_settings_url %>
42
+ </div>
43
+ </fieldset>
44
+ </div>
45
+ <% end %>
@@ -0,0 +1,189 @@
1
+ <% auction_started = auction.started? %>
2
+ <% auction_complete = auction.complete %>
3
+ <div data-hook="admin_auction_form_fields">
4
+
5
+ <div class="row">
6
+
7
+ <div class="left col-9" data-hook="admin_auction_form_left">
8
+
9
+ <div data-hook="admin_auction_form_name">
10
+ <%= f.field_container :title do %>
11
+ <%= f.label :title, class: 'required' %>
12
+ <%= f.field_hint :title %>
13
+ <%= f.text_field :title, disable_on_complete(auction_complete, {class: 'fullwidth title', required: true}) %>
14
+ <%= f.error_message_on :title %>
15
+ <% end %>
16
+ </div>
17
+
18
+ <div data-hook="admin_auction_form_description">
19
+ <%= f.field_container :description do %>
20
+ <%= f.label :description, class: 'required' %>
21
+ <%= f.text_area :description, disable_on_complete(auction_complete, {class: 'fullwidth'}) %>
22
+ <%= f.error_message_on :description %>
23
+ <% end %>
24
+ </div>
25
+
26
+ <div class="row">
27
+ <div data-hook="admin_auction_form_price" class="left col-6">
28
+ <%= f.field_container :starting_price do %>
29
+ <%= f.label :starting_price, class: 'required' %>
30
+ <%= f.number_field :starting_price, disable_on_start(auction_started, { step: 0.01, min: 0 }) %>
31
+ <%= f.error_message_on :starting_price %>
32
+ <% end %>
33
+ </div>
34
+
35
+ <div data-hook="admin_auction_form_price" class="right col-6">
36
+ <%= f.field_container :reserve_price do %>
37
+ <%= f.label :reserve_price %>
38
+ <%= f.field_hint :reserve_price %>
39
+ <%= f.number_field :reserve_price, disable_on_start(auction_started, { step: 0.01, min: 0 }) %>
40
+ <%= f.error_message_on :reserve_price %>
41
+ <% end %>
42
+ </div>
43
+ </div>
44
+ <div class="row">
45
+ <div data-hook="admin_auction_form_option_types" class="left col-6">
46
+ <%= f.field_container :product_id do %>
47
+ <%= f.label :product_id, class: 'required' %>
48
+ <%= f.hidden_field :product_id, disable_on_complete(auction_complete, {}) %>
49
+ <% end %>
50
+ </div>
51
+
52
+ <div data-hook="admin_auction_form_price" class="left col-6">
53
+ <%= f.field_container :bid_increment do %>
54
+ <%= f.label :bid_increment %>
55
+ <%= f.field_hint :bid_increment %>
56
+ <%= f.number_field :bid_increment, disable_on_start(auction_started, { step: 0.01, min: 0 }) %>
57
+ <%= f.error_message_on :bid_increment %>
58
+ <% end %>
59
+ </div>
60
+ </div>
61
+
62
+ <div class="row">
63
+ <div data-hook="admin_auction_form_available_on" class="left col-6">
64
+ <%= f.field_container :starting_datetime do %>
65
+ <%= f.label :starting_datetime, Spree.t("starting_datetime") %>
66
+ <%= f.field_hint :start %>
67
+ <div class="datetime-container">
68
+ <%= f.datetime_select :starting_datetime, { default: 1.days.from_now, ampm: true, minute_step: 5}, disable_on_complete(auction_complete, { class: "custom-select" }) %>
69
+ <%= f.error_message_on :starting_datetime %>
70
+ </div>
71
+ <% end %>
72
+ </div>
73
+
74
+ <div data-hook="admin_auction_form_available_on" class="right col-6">
75
+ <%= f.field_container :planned_end_datetime do %>
76
+ <%= f.label :planned_end_datetime, Spree.t("planned_end_datetime") %>
77
+ <div class="datetime-container">
78
+ <%= f.datetime_select :planned_end_datetime, disable_on_complete(auction_complete,{ default: 7.days.from_now, ampm: true, minute_step: 5}), { class: "custom-select"} %>
79
+ <%= f.error_message_on :planned_end_datetime %>
80
+ </div>
81
+ <% end %>
82
+ </div>
83
+ </div>
84
+
85
+ <div class="row">
86
+ <% seconds_limit = 0..3600 %>
87
+ <div data-hook="admin_auction_form_price" class="right col-6">
88
+ <%= f.field_container :countdown do %>
89
+ <%= f.label :countdown, Spree.t("countdown_seconds") %>
90
+ <%= f.field_hint :countdown %>
91
+ <%= f.number_field :countdown, disable_on_complete(auction_complete, {in: seconds_limit}) %>
92
+ <%= f.error_message_on :countdown %>
93
+ <% end %>
94
+ </div>
95
+
96
+ <div data-hook="admin_auction_form_price" class="left col-6">
97
+ <%= f.field_container :time_increment do %>
98
+ <%= f.label :time_increment %>
99
+ <%= f.field_hint :time_increment %>
100
+ <%= f.number_field :time_increment, disable_on_complete(auction_complete, {in: seconds_limit}) %>
101
+ <%= f.error_message_on :time_increment %>
102
+ <% end %>
103
+ </div>
104
+ </div>
105
+ </div>
106
+
107
+ <div class="clear"></div>
108
+
109
+ <div class="right col-3" data-hook="admin_auction_form_right">
110
+
111
+ <div data-hook="admin_auction_form_price">
112
+ <%= f.field_container :current_price do %>
113
+ <%= f.label :current_price %>
114
+ <%= f.text_field :current_price, { readonly: true, disabled: true } %>
115
+ <%= f.error_message_on :current_price %>
116
+ <% end %>
117
+ </div>
118
+
119
+ <div class="clear"></div>
120
+
121
+ <% if !@auction.complete && auction.started? %>
122
+ <div data-hook="admin_auction_form_time_remaining">
123
+ <%= f.field_container :current_end_datetime do %>
124
+ <label for="current_end_datetime"><%= Spree.t("ends_in") %></label>
125
+ <p class="fullwidth title">
126
+ <%= render partial: 'spree/shared/ends_in', locals: { auction: @auction } %>
127
+ </p>
128
+ <% end %>
129
+ </div>
130
+ <% end %>
131
+
132
+ <div class="clear"></div>
133
+ <% if @auction.current_end_datetime %>
134
+ <div data-hook="admin_auction_form_available_on">
135
+ <%= f.field_container :current_end_datetime do %>
136
+ <label for="current_end_datetime"><%= Spree.t("current_end_datetime") %></label>
137
+ <%= f.field_hint :end %>
138
+ <p class="fullwidth title">
139
+ <%= local_time @auction.current_end_datetime %>
140
+ </p>
141
+ <% end %>
142
+ </div>
143
+ <% end %>
144
+
145
+ <div class="clear"></div>
146
+
147
+ <% if highest_bidder = auction.highest_bidder %>
148
+ <div data-hook="admin_auction_form_available_on">
149
+ <div class="field" id="auction_current_end_datetime_field">
150
+ <label for="highest_bidder"><%= Spree.t("highest_bidder") %></label>
151
+
152
+ <input value="<%=highest_bidder.email %>" readonly="readonly" disabled="disabled" id="highest_bidder" type="text">
153
+ </div>
154
+ </div>
155
+ <div class="clear"></div>
156
+ <% end %>
157
+
158
+ <% if @auction.title %>
159
+ <div data-hook="admin_auction_link">
160
+ <%= f.field_container :current_end_datetime do %>
161
+ <label for="auction_link"><%= Spree.t("auction_link") %></label>
162
+ <p class="fullwidth title">
163
+ <%= link_to polymorphic_url(@auction), @auction, target: "_blank" %>
164
+ </p>
165
+ <% end %>
166
+ </div>
167
+ <% end %>
168
+
169
+ <div class="clear"></div>
170
+
171
+ <% if @auction.won?%>
172
+ <div data-hook="admin_auction_order">
173
+ <%= f.field_container :current_end_datetime do %>
174
+ <label for="auction_order_link"><%= Spree.t("associated_order") %></label>
175
+ <p class="fullwidth title">
176
+ <% order = auction.order %>
177
+ <%= link_to order.number, edit_admin_order_path(order) %>
178
+ </p>
179
+ <% end %>
180
+ </div>
181
+ <% end %>
182
+
183
+ <div class="clear"></div>
184
+
185
+
186
+ </div>
187
+
188
+ </div>
189
+ </div>