spree_price 3.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +83 -0
- data/app/assets/javascripts/spree/backend/price.js.coffee +13 -0
- data/app/assets/javascripts/spree/backend/price_book.js.coffee +104 -0
- data/app/assets/javascripts/spree/backend/spree_price.js +2 -0
- data/app/assets/javascripts/spree/frontend/spree_price.js +2 -0
- data/app/assets/stylesheets/spree/backend/spree_price.css +4 -0
- data/app/assets/stylesheets/spree/frontend/spree_price.css +4 -0
- data/app/controllers/spree/admin/currency_rates_controller.rb +11 -0
- data/app/controllers/spree/admin/price_books_controller.rb +41 -0
- data/app/controllers/spree/admin/price_types_controller.rb +6 -0
- data/app/controllers/spree/admin/prices_controller_decorator.rb +54 -0
- data/app/controllers/spree/admin/stores_controller_decorator.rb +16 -0
- data/app/helpers/spree/base_helper_decorator.rb +32 -0
- data/app/models/spree/currency_rate.rb +56 -0
- data/app/models/spree/line_item_decorator.rb +79 -0
- data/app/models/spree/line_item_price.rb +4 -0
- data/app/models/spree/order/currency_updater_decorator.rb +9 -0
- data/app/models/spree/order_decorator.rb +15 -0
- data/app/models/spree/order_price.rb +4 -0
- data/app/models/spree/order_updater_decorator.rb +30 -0
- data/app/models/spree/price_book.rb +88 -0
- data/app/models/spree/price_decorator.rb +39 -0
- data/app/models/spree/price_type.rb +15 -0
- data/app/models/spree/role_decorator.rb +15 -0
- data/app/models/spree/role_price_book.rb +5 -0
- data/app/models/spree/store_decorator.rb +4 -0
- data/app/models/spree/store_price_book.rb +7 -0
- data/app/models/spree/variant_decorator.rb +43 -0
- data/app/overrides/spree/admin/roles/_form/add_default_checkout_to_role.html.erb.deface +9 -0
- data/app/overrides/spree/admin/shared/sub_menu/_configuration/current_rates_link.html.erb.deface +6 -0
- data/app/overrides/spree/admin/shared/sub_menu/_product/add_price_books_tab.html.erb.deface +4 -0
- data/app/overrides/spree/admin/stores/_form/add_price_book_to_store.html.erb.deface +49 -0
- data/app/views/spree/admin/currency_rates/_form.html.erb +29 -0
- data/app/views/spree/admin/currency_rates/edit.html.erb +19 -0
- data/app/views/spree/admin/currency_rates/index.html.erb +50 -0
- data/app/views/spree/admin/currency_rates/new.html.erb +21 -0
- data/app/views/spree/admin/price_books/_add_price.html.erb +82 -0
- data/app/views/spree/admin/price_books/_form.html.erb +81 -0
- data/app/views/spree/admin/price_books/_price.html.erb +12 -0
- data/app/views/spree/admin/price_books/_price_book.html.erb +16 -0
- data/app/views/spree/admin/price_books/_price_list.html.erb +37 -0
- data/app/views/spree/admin/price_books/edit.html.erb +21 -0
- data/app/views/spree/admin/price_books/index.html.erb +65 -0
- data/app/views/spree/admin/price_books/new.html.erb +14 -0
- data/app/views/spree/admin/price_books/show.html.erb +39 -0
- data/app/views/spree/admin/price_types/_form.html.erb +25 -0
- data/app/views/spree/admin/price_types/edit.html.erb +18 -0
- data/app/views/spree/admin/price_types/index.html.erb +51 -0
- data/app/views/spree/admin/price_types/new.html.erb +14 -0
- data/app/views/spree/admin/prices/_variant_prices.html.erb +57 -0
- data/app/views/spree/admin/prices/index.html.erb +39 -0
- data/config/locales/en.yml +34 -0
- data/config/locales/validates_timeliness.en.yml +16 -0
- data/config/routes.rb +33 -0
- data/db/migrate/20180828044728_add_spree_price_book.rb +52 -0
- data/db/migrate/20180830053207_add_price_to_order_and_line_item.rb +19 -0
- data/db/migrate/20180830055224_add_default_for_role.rb +7 -0
- data/lib/generators/spree_price/install/install_generator.rb +31 -0
- data/lib/spree_price.rb +7 -0
- data/lib/spree_price/engine.rb +20 -0
- data/lib/spree_price/factories.rb +5 -0
- data/lib/spree_price/factories/currency_rate_factory.rb +15 -0
- data/lib/spree_price/factories/price_book_factory.rb +34 -0
- data/lib/spree_price/factories/price_type_factory.rb +21 -0
- data/lib/spree_price/version.rb +17 -0
- data/lib/tasks/price.rake +58 -0
- metadata +362 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
<div class='row'>
|
2
|
+
<div data-hook="admin_currency_rate_form_fields">
|
3
|
+
<div class="col-xs-12">
|
4
|
+
<fieldset data-hook="currency_rates">
|
5
|
+
<div class="col-xs-6">
|
6
|
+
<div data-hook="base_currency" class="field">
|
7
|
+
<%= f.label :base_currency %>
|
8
|
+
<%= f.text_field :base_currency, class: 'form-control' %>
|
9
|
+
</div>
|
10
|
+
<div data-hook="currency" class="field">
|
11
|
+
<%= f.label :currency, Spree.t(:currency) %>
|
12
|
+
<%= f.text_field :currency, class: 'form-control' %>
|
13
|
+
</div>
|
14
|
+
<div data-hook="exchange_rate" class="field">
|
15
|
+
<%= f.label :exchange_rate %>
|
16
|
+
<%= f.text_field :exchange_rate, :class => 'form-control' %>
|
17
|
+
<br/>
|
18
|
+
</div>
|
19
|
+
<% if f.object.default? || Spree::CurrencyRate.default.new_record? %>
|
20
|
+
<div data-hook="default_rate" class="field">
|
21
|
+
<%= f.check_box :default %>
|
22
|
+
<%= f.label :default, Spree.t(:default) %>
|
23
|
+
</div>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
26
|
+
</fieldset>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
<% content_for :page_title do %>
|
3
|
+
<%= Spree.t(:editing_currency_rate) %>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<% content_for :page_actions do %>
|
7
|
+
<%= button_link_to Spree.t(:back_to_currency_rates_list), spree.admin_currency_rates_path, icon: 'arrow-left' %>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<div data-hook="admin_currency_rate_edit_form_header">
|
11
|
+
<%= render partial: 'spree/shared/error_messages', locals: { target: @currency_rate } %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<%= form_for [:admin, @currency_rate] do |f| %>
|
15
|
+
<fieldset class="no-border-top">
|
16
|
+
<%= render partial: 'form', locals: { f: f } %>
|
17
|
+
<%= render partial: 'spree/admin/shared/edit_resource_links' %>
|
18
|
+
</fieldset>
|
19
|
+
<% end %>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<% content_for :page_title do %>
|
2
|
+
<%= Spree::CurrencyRate.model_name.human(:count => 2) %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<% content_for :page_actions do %>
|
6
|
+
<% if can? :create, Spree::CurrencyRate %>
|
7
|
+
<%= button_link_to Spree.t(:new_currency_rate), new_object_url, icon: 'plus' %>
|
8
|
+
<%= button_link_to Spree.t(:fetch_currency_rate), fetch_admin_currency_rates_url, icon: 'refresh' %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<% if @currency_rates.any? %>
|
13
|
+
<table class="table">
|
14
|
+
<colgroup>
|
15
|
+
<col style="width: 25%">
|
16
|
+
<col style="width: 25%">
|
17
|
+
<col style="width: 25%">
|
18
|
+
<col style="width: 10%">
|
19
|
+
<col style="width: 15%">
|
20
|
+
</colgroup>
|
21
|
+
<thead>
|
22
|
+
<tr data-hook="rate_header">
|
23
|
+
<th><%= Spree::CurrencyRate.human_attribute_name(:base_currency) %></th>
|
24
|
+
<th><%= Spree::CurrencyRate.human_attribute_name(:exchange_rate) %></th>
|
25
|
+
<th><%= Spree::CurrencyRate.human_attribute_name(:currency) %></th>
|
26
|
+
<th><%= Spree::CurrencyRate.human_attribute_name(:default) %></th>
|
27
|
+
<th class="actions"></th>
|
28
|
+
</tr>
|
29
|
+
</thead>
|
30
|
+
<tbody>
|
31
|
+
<% @currency_rates.each do |currency_rate|%>
|
32
|
+
<tr id="<%= spree_dom_id currency_rate %>" data-hook="rate_row" class="<%= cycle('odd', 'even')%>">
|
33
|
+
<td class="align-center"><%= currency_rate.base_currency %></td>
|
34
|
+
<td class="align-center"><%= currency_rate.exchange_rate || Spree.t(:not_available) %></td>
|
35
|
+
<td class="align-center"><%= currency_rate.currency %></td>
|
36
|
+
<td class="align-center"><%= currency_rate.default %></td>
|
37
|
+
<td class="actions">
|
38
|
+
<%= link_to_edit currency_rate, no_text: true %>
|
39
|
+
<%= link_to_delete currency_rate, no_text: true %>
|
40
|
+
</td>
|
41
|
+
</tr>
|
42
|
+
<% end %>
|
43
|
+
</tbody>
|
44
|
+
</table>
|
45
|
+
<% else %>
|
46
|
+
<div class="col-xs-12">
|
47
|
+
<%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/currency_rate')) %>,
|
48
|
+
<%= link_to Spree.t(:add_one), spree.new_admin_currency_rate_path %>!
|
49
|
+
</div>
|
50
|
+
<% end %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
<% content_for :page_title do %>
|
3
|
+
<%= Spree.t(:new_currency_rate) %>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<% content_for :page_actions do %>
|
7
|
+
<%= button_link_to(
|
8
|
+
Spree.t(:back_to_currency_rates_list),
|
9
|
+
spree.admin_currency_rates_path,
|
10
|
+
icon: 'arrow-left')
|
11
|
+
%>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%= render partial: 'spree/shared/error_messages', locals: { target: @currency_rate } %>
|
15
|
+
|
16
|
+
<%= form_for [:admin, @currency_rate] do |f| %>
|
17
|
+
<fieldset class="no-border-top">
|
18
|
+
<%= render partial: 'form', locals: { f: f } %>
|
19
|
+
<%= render partial: 'spree/admin/shared/new_resource_links' %>
|
20
|
+
</fieldset>
|
21
|
+
<% end %>
|
@@ -0,0 +1,82 @@
|
|
1
|
+
<script type='text/template' id='price_book_variant_template'>
|
2
|
+
{{#each variants}}
|
3
|
+
<tr>
|
4
|
+
<td>{{name}}</td>
|
5
|
+
<td class='text-center'>{{price}}</td>
|
6
|
+
<td class='actions actions-1 text-center'>
|
7
|
+
<button
|
8
|
+
class='icon_link btn btn-danger btn-sm price_book_remove_variant'
|
9
|
+
data-variant-id='{{id}}'
|
10
|
+
>
|
11
|
+
<span class='icon icon-delete' data-variant-id='{{id}}'></span>
|
12
|
+
</button>
|
13
|
+
<input
|
14
|
+
type='hidden'
|
15
|
+
id='price_book[prices_attributes][][variant_id]'
|
16
|
+
name='price_book[prices_attributes][][variant_id]'
|
17
|
+
value='{{id}}'
|
18
|
+
/>
|
19
|
+
<input
|
20
|
+
type='hidden'
|
21
|
+
id='price_book[prices_attributes][][amount]'
|
22
|
+
name='price_book[prices_attributes][][amount]'
|
23
|
+
value='{{price}}'
|
24
|
+
/>
|
25
|
+
</td>
|
26
|
+
</tr>
|
27
|
+
{{/each}}
|
28
|
+
</script>
|
29
|
+
|
30
|
+
<%= form_for [:admin, price_book], url: { action: 'add_price' } do |f| %>
|
31
|
+
<div class="panel panel-default" id="add-variant-to-price-book">
|
32
|
+
<div class="panel-heading">
|
33
|
+
<h1 class="panel-title">
|
34
|
+
<%= Spree.t(:add_variant) %>
|
35
|
+
</h1>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div class="panel-body">
|
39
|
+
<div class="row">
|
40
|
+
<div class="col-md-8">
|
41
|
+
<div class="form-group" id="price_book_variant_id_field">
|
42
|
+
<%= label_tag 'variant_id', Spree.t(:variant) %>
|
43
|
+
<%= hidden_field_tag 'price_book_variant', {}, { class: 'fullwidth-input' } %>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div class="col-md-4">
|
48
|
+
<div class="form-group" id="price_book_variant_price_field">
|
49
|
+
<%= label_tag :price_book_variant_price, Spree.t(:price) %>
|
50
|
+
<div class="input-group">
|
51
|
+
<%= number_field_tag :price_book_variant_price, nil, min: 0, step: 0.01, class: 'form-control' %>
|
52
|
+
<span class="input-group-btn">
|
53
|
+
<%= button Spree.t(:add), 'plus', 'submit', class: "price_book_add_variant" %>
|
54
|
+
</span>
|
55
|
+
</div>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
</div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div class="alert alert-info no-objects-found">
|
63
|
+
<%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/variant')) %>.
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<div id="price_book-variants-table" style="display:none">
|
67
|
+
<table class="table table-bordered sortable">
|
68
|
+
<thead data-hook="price_book_variants_header">
|
69
|
+
<th><%= Spree.t(:name) %></th>
|
70
|
+
<th class="text-center"><%= Spree.t(:price) %></th>
|
71
|
+
<th class="actions"></th>
|
72
|
+
</thead>
|
73
|
+
<tbody id="price_book_variants_tbody">
|
74
|
+
|
75
|
+
</tbody>
|
76
|
+
</table>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div class="form-actions" data-hook="buttons">
|
80
|
+
<%= button Spree.t(:push_update), 'cloud-upload price_book_new_push' %>
|
81
|
+
</div>
|
82
|
+
<% end %>
|
@@ -0,0 +1,81 @@
|
|
1
|
+
<div data-hook="admin_price_book_form_fields">
|
2
|
+
<div class="row">
|
3
|
+
<div class="col-md-6">
|
4
|
+
<%= f.field_container :name do %>
|
5
|
+
<%= f.label :name %> <span class="required">*</span><br />
|
6
|
+
<%= f.text_field :name, class: "form-control" %>
|
7
|
+
<%= f.error_message_on :name %>
|
8
|
+
<% end %>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="row">
|
13
|
+
<div class="col-md-6">
|
14
|
+
<%= f.label :currency, Spree.t(:choose_currency) %> <span class="required">*</span><br />
|
15
|
+
<%= f.select(:currency, supported_currencies_options,
|
16
|
+
{ include_blank: false, selected: f.object.currency || Spree::Config[:currency] },
|
17
|
+
{ multiple: false, class: 'select2' })
|
18
|
+
%>
|
19
|
+
<%= f.error_message_on :currency %>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="row">
|
24
|
+
<div class="col-md-6">
|
25
|
+
<%= f.label :price_type, Spree.t(:price_type) %> <span class="required">*</span><br />
|
26
|
+
<%= f.select(:price_type_id, price_types_options,
|
27
|
+
{ include_blank: true, selected: f.object.price_type_id },
|
28
|
+
{ multiple: false, class: 'select2' })
|
29
|
+
%>
|
30
|
+
<%= f.error_message_on :price_type_id %>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<div class="row">
|
35
|
+
<div class="col-md-6">
|
36
|
+
<%= f.field_container :active_from do %>
|
37
|
+
<%= f.label :active_from %> <span class="required">*</span><br />
|
38
|
+
<%= f.text_field :active_from, class: 'form-control datepicker datepicker-from' %>
|
39
|
+
<%= f.error_message_on :active_from %>
|
40
|
+
<% end %>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div class="col-md-6">
|
44
|
+
<%= f.field_container :active_to do %>
|
45
|
+
<%= f.label :active_to %> <span class="required">*</span><br />
|
46
|
+
<%= f.text_field :active_to, class: 'form-control datepicker datepicker-to' %>
|
47
|
+
<%= f.error_message_on :active_to %>
|
48
|
+
<% end %>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div class="col-md-6">
|
52
|
+
<%= f.field_container :roles do %>
|
53
|
+
<%= f.label :roles %><br />
|
54
|
+
<%= f.select(:role_ids, Spree::Role.all.map do |role|
|
55
|
+
[role.name, role.id]
|
56
|
+
end, { include_blank: true }, { multiple: true, class: 'select2' }) %>
|
57
|
+
<%= f.hidden_field :"role_ids[]", value: "" %>
|
58
|
+
<%= f.error_message_on :role_ids %>
|
59
|
+
<% end %>
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
|
63
|
+
<div class="row">
|
64
|
+
<div class="col-md-12">
|
65
|
+
<%= f.field_container :parent do %>
|
66
|
+
<%= f.label :parent %> <span class="required">*</span><br />
|
67
|
+
<%= f.select(:parent_id, Spree::PriceBook.all.map do |price_book|
|
68
|
+
[price_book.name, price_book.id]
|
69
|
+
end, { include_blank: true }, { multiple: false, class: 'select2' }) %>
|
70
|
+
<%= f.error_message_on :parent %>
|
71
|
+
<% end %>
|
72
|
+
</div>
|
73
|
+
<div class="col-md-12">
|
74
|
+
<%= f.field_container :price_adjustment_factor do %>
|
75
|
+
<%= f.label :price_adjustment_factor %> <span class="required">*</span><br />
|
76
|
+
<%= f.text_field :price_adjustment_factor, class: 'form-control' %>
|
77
|
+
<%= f.error_message_on :price_adjustment_factor %>
|
78
|
+
<% end %>
|
79
|
+
</div>
|
80
|
+
</div>
|
81
|
+
</div>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<tr>
|
2
|
+
<td class="align-center">
|
3
|
+
<%= link_to price.variant.try(:name), admin_product_variants_url(price.variant.product) %>
|
4
|
+
</td>
|
5
|
+
<td><%= price.variant.try(:sku_and_options_text) %></td>
|
6
|
+
<td>
|
7
|
+
<%= f.text_field(:amount, value: price.amount,
|
8
|
+
class: 'form-control', index: price.id) %>
|
9
|
+
<%= f.hidden_field(:id, value: price.id,
|
10
|
+
class: 'form-control', index: price.id) %>
|
11
|
+
</td>
|
12
|
+
</tr>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<table class="col-xs-12 table table-striped" id="listing_price_book_attributes">
|
2
|
+
<colgroup>
|
3
|
+
<col style="width: 25%">
|
4
|
+
<col style="width: 75%">
|
5
|
+
</colgroup>
|
6
|
+
<tbody>
|
7
|
+
<tr><td><%= Spree.t(:currency) %></td><td><%= price_book.currency %></td></tr>
|
8
|
+
<tr><td><%= Spree.t(:active_from) %></td><td><%= I18n.l price_book.active_from %></td></tr>
|
9
|
+
<tr><td><%= Spree.t(:active_to) %></td><td><%= I18n.l price_book.active_to %></td></tr>
|
10
|
+
<tr><td><%= Spree.t(:price_adjustment_factor) %></td><td><%= price_book.price_adjustment_factor %></td></tr>
|
11
|
+
<tr><td><%= Spree.t(:parent) %></td><td><%= price_book.parent.try(:name) || '--' %></td></tr>
|
12
|
+
<tr><td><%= Spree.t(:price_type) %></td><td><%= price_book.price_type.try(:name) %></td></tr>
|
13
|
+
<tr><td><%= Spree.t(:created_at) %></td><td><%= I18n.l price_book.created_at %></td></tr>
|
14
|
+
<tr><td><%= Spree.t(:updated_at) %></td><td><%= I18n.l price_book.updated_at %></td></tr>
|
15
|
+
</tbody>
|
16
|
+
</table>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<% unless prices.empty? %>
|
2
|
+
<%= form_for [:admin, @price_book], url: { action: 'update_price' } do |f| %>
|
3
|
+
<div class='row'>
|
4
|
+
<table class="col-xs-12 table table-striped" id="listing_price_book_products">
|
5
|
+
<colgroup>
|
6
|
+
<col style="width: 25%">
|
7
|
+
<col style="width: 50%">
|
8
|
+
<col style="width: 25%">
|
9
|
+
</colgroup>
|
10
|
+
<thead>
|
11
|
+
<th><%= Spree.t(:name) %></th>
|
12
|
+
<th><%= Spree.t(:sku) %></th>
|
13
|
+
<th><%= Spree.t(:price) %></th>
|
14
|
+
</thead>
|
15
|
+
<tbody>
|
16
|
+
<% prices.each do |price| %>
|
17
|
+
<%= f.fields_for :prices_attributes do |price_form| %>
|
18
|
+
<% render 'price', f: price_form, price: price %>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
21
|
+
</tbody>
|
22
|
+
</table>
|
23
|
+
</div>
|
24
|
+
<div class="row">
|
25
|
+
<div class="col-xs-12 col-md-6"><%= paginate prices %></div>
|
26
|
+
<div class="col-xs-12 col-md-6 text-right">
|
27
|
+
<span class="input-group-btn">
|
28
|
+
<%= button Spree.t(:update), 'update', 'submit', class: "price_book_prices_update" %>
|
29
|
+
</span>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
33
|
+
<% else %>
|
34
|
+
<div class="alert alert-info no-objects-found">
|
35
|
+
<%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/variant')) %>.
|
36
|
+
</div>
|
37
|
+
<% end %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<% content_for :page_title do %>
|
2
|
+
<%= Spree.t(:editing_price_book) %> <span class="green">"<%= @price_book.name %>"</span>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<% content_for :page_actions do %>
|
6
|
+
<%= button_link_to Spree.t(:back_to_price_books_list),
|
7
|
+
spree.admin_price_books_path,
|
8
|
+
:icon => 'arrow-left'
|
9
|
+
%>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @price_book } %>
|
13
|
+
|
14
|
+
<div id="price_book_form_wrapper">
|
15
|
+
<%= form_for [:admin, @price_book] do |f| %>
|
16
|
+
<fieldset>
|
17
|
+
<%= render :partial => 'form', :locals => { :f => f } %>
|
18
|
+
<%= render :partial => 'spree/admin/shared/edit_resource_links' %>
|
19
|
+
</fieldset>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
@@ -0,0 +1,65 @@
|
|
1
|
+
<% content_for :page_title do %>
|
2
|
+
<%= Spree::PriceBook.model_name.human(:count => 2) %>
|
3
|
+
<% end %>
|
4
|
+
|
5
|
+
<% content_for :page_actions do %>
|
6
|
+
<%= link_to_with_icon(
|
7
|
+
'add',
|
8
|
+
Spree.t(:new_price_book),
|
9
|
+
new_admin_price_book_url,
|
10
|
+
{ class: 'btn btn-success', id: 'new_price_book_link' }
|
11
|
+
)%>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<% if @price_books.any? %>
|
15
|
+
<table
|
16
|
+
class="table sortable"
|
17
|
+
id="listing_price_books"
|
18
|
+
data-hook
|
19
|
+
data-sortable-link="<%= update_positions_admin_option_types_url %>"
|
20
|
+
>
|
21
|
+
<colgroup>
|
22
|
+
<col style="width: 20%">
|
23
|
+
<col style="width: 10%">
|
24
|
+
<col style="width: 10%">
|
25
|
+
<col style="width: 20%">
|
26
|
+
<col style="width: 10%">
|
27
|
+
<col style="width: 10%">
|
28
|
+
<col style="width: 10%">
|
29
|
+
</colgroup>
|
30
|
+
<thead>
|
31
|
+
<tr data-hook="option_header">
|
32
|
+
<th><%= Spree::PriceBook.human_attribute_name(:name) %></th>
|
33
|
+
<th><%= Spree::PriceBook.human_attribute_name(:active) %></th>
|
34
|
+
<th><%= Spree::PriceBook.human_attribute_name(:currency) %></th>
|
35
|
+
<th><%= Spree::PriceBook.human_attribute_name(:parent) %></th>
|
36
|
+
<th><%= Spree::PriceBook.human_attribute_name(:price_type) %></th>
|
37
|
+
<th><%= Spree::PriceBook.human_attribute_name(:roles) %></th>
|
38
|
+
<th><%= Spree::PriceBook.human_attribute_name(:price_adjustment_factor) %></th>
|
39
|
+
<th class="actions"></th>
|
40
|
+
</tr>
|
41
|
+
</thead>
|
42
|
+
<tbody>
|
43
|
+
<% @price_books.each do |price_book| %>
|
44
|
+
<tr class="spree_price_book">
|
45
|
+
<td class="align-center"><%= link_to price_book.name, admin_price_book_url(price_book) %></td>
|
46
|
+
<td class="align-center"><%= price_book.active? %></td>
|
47
|
+
<td class="align-center"><%= price_book.currency %></td>
|
48
|
+
<td class="align-center"><%= price_book.parent.try(:name) %></td>
|
49
|
+
<td class="align-center"><%= price_book.price_type.try(:name) %></td>
|
50
|
+
<td class="align-center"><%= roles_to_s(price_book.roles) %></td>
|
51
|
+
<td class="align-center"><%= price_book.price_adjustment_factor %></td>
|
52
|
+
<td class="actions">
|
53
|
+
<%= link_to_edit(price_book, :class => 'admin_edit_price_book', :no_text => true) %>
|
54
|
+
<%= link_to_delete(price_book, :no_text => true) %>
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<% end %>
|
58
|
+
</tbody>
|
59
|
+
</table>
|
60
|
+
<% else %>
|
61
|
+
<div class="col-md-12">
|
62
|
+
<%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/price_book')) %>,
|
63
|
+
<%= link_to Spree.t(:add_one), spree.new_admin_price_book_path %>!
|
64
|
+
</div>
|
65
|
+
<% end %>
|