solidus_marketplace 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +11 -0
  5. data/Gemfile +8 -0
  6. data/LICENSE +26 -0
  7. data/README.md +123 -0
  8. data/Rakefile +15 -0
  9. data/Versionfile +6 -0
  10. data/app/assets/javascripts/spree/backend/solidus_marketplace.js +5 -0
  11. data/app/assets/javascripts/spree/backend/solidus_marketplace_routes.js +1 -0
  12. data/app/assets/javascripts/spree/backend/suppliers_autocomplete.js +55 -0
  13. data/app/assets/javascripts/spree/frontend/solidus_marketplace.js +1 -0
  14. data/app/assets/stylesheets/spree/backend/solidus_marketplace.scss +22 -0
  15. data/app/assets/stylesheets/spree/frontend/solidus_marketplace.css +3 -0
  16. data/app/controllers/ckeditor/attachment_files_controller_decorator.rb +20 -0
  17. data/app/controllers/ckeditor/pictures_controller_decorator.rb +17 -0
  18. data/app/controllers/spree/admin/marketplace_settings_controller.rb +19 -0
  19. data/app/controllers/spree/admin/products_controller_decorator.rb +79 -0
  20. data/app/controllers/spree/admin/reports_controller_decorator.rb +68 -0
  21. data/app/controllers/spree/admin/shipments_controller.rb +47 -0
  22. data/app/controllers/spree/admin/stock_items_controller_decorator.rb +10 -0
  23. data/app/controllers/spree/admin/stock_locations_controller_decorator.rb +23 -0
  24. data/app/controllers/spree/admin/suppliers_controller.rb +54 -0
  25. data/app/controllers/spree/admin/users_controller_decorator.rb +34 -0
  26. data/app/controllers/spree/api/suppliers_controller.rb +16 -0
  27. data/app/controllers/spree/api/v1/stock_locations_controller_decorator.rb +18 -0
  28. data/app/controllers/spree/base_controller_decorator.rb +13 -0
  29. data/app/helpers/spree/api/api_helpers_decorator.rb +22 -0
  30. data/app/mailers/spree/marketplace_order_mailer.rb +13 -0
  31. data/app/mailers/spree/supplier_mailer.rb +12 -0
  32. data/app/models/ckeditor/asset_decorator.rb +5 -0
  33. data/app/models/spree.rb +5 -0
  34. data/app/models/spree/marketplace_configuration.rb +14 -0
  35. data/app/models/spree/order_decorator.rb +44 -0
  36. data/app/models/spree/payment_decorator.rb +7 -0
  37. data/app/models/spree/product_decorator.rb +52 -0
  38. data/app/models/spree/shipment_decorator.rb +40 -0
  39. data/app/models/spree/stock/splitter/marketplace.rb +47 -0
  40. data/app/models/spree/stock_location_decorator.rb +23 -0
  41. data/app/models/spree/supplier.rb +120 -0
  42. data/app/models/spree/supplier_ability.rb +35 -0
  43. data/app/models/spree/supplier_variant.rb +6 -0
  44. data/app/models/spree/user_decorator.rb +23 -0
  45. data/app/models/spree/variant_decorator.rb +24 -0
  46. data/app/overrides/spree/admin/menus.rb +15 -0
  47. data/app/overrides/spree/admin/products/_form/converted_admin_product_form_right.html.erb.deface +5 -0
  48. data/app/overrides/spree/admin/products/edit/override_rows.html.erb.deface +22 -0
  49. data/app/overrides/spree/admin/stock_locations/_form/add_supplier.html.erb.deface +12 -0
  50. data/app/views/spree/admin/marketplace_settings/edit.html.erb +21 -0
  51. data/app/views/spree/admin/orders/index.html.erb +187 -0
  52. data/app/views/spree/admin/products/_form.html.erb +198 -0
  53. data/app/views/spree/admin/reports/earnings.html.erb +34 -0
  54. data/app/views/spree/admin/shared/_marketplace_settings.html.erb +1 -0
  55. data/app/views/spree/admin/shared/_marketplace_tabs.html.erb +4 -0
  56. data/app/views/spree/admin/shipments/edit.html.erb +24 -0
  57. data/app/views/spree/admin/shipments/index.html.erb +93 -0
  58. data/app/views/spree/admin/suppliers/_form.html.erb +75 -0
  59. data/app/views/spree/admin/suppliers/edit.html.erb +22 -0
  60. data/app/views/spree/admin/suppliers/index.html.erb +68 -0
  61. data/app/views/spree/admin/suppliers/new.html.erb +17 -0
  62. data/app/views/spree/api/shared/_pagination.json.jbuilder +5 -0
  63. data/app/views/spree/api/suppliers/_supplier.json.jbuilder +1 -0
  64. data/app/views/spree/api/suppliers/index.json.jbuilder +4 -0
  65. data/app/views/spree/marketplace_order_mailer/supplier_order.html.erb +119 -0
  66. data/app/views/spree/shared/unauthorized.erb +1 -0
  67. data/app/views/spree/supplier_mailer/welcome.html.erb +53 -0
  68. data/config/locales/en.yml +107 -0
  69. data/config/locales/es.yml +133 -0
  70. data/config/routes.rb +24 -0
  71. data/db/default/spree/marketplace_roles.rb +14 -0
  72. data/db/migrate/20121006073854_create_suppliers.rb +20 -0
  73. data/db/migrate/20130216070944_product_belongs_to_supplier.rb +6 -0
  74. data/db/migrate/20130405005502_stock_locations_belongs_to_supplier.rb +6 -0
  75. data/db/migrate/20130405011127_user_belongs_to_supplier.rb +6 -0
  76. data/db/migrate/20130428063053_add_balanced_token_to_suppliers.rb +7 -0
  77. data/db/migrate/20130510181443_add_supplier_id_to_ckeditor_assets.rb +8 -0
  78. data/db/migrate/20130606220913_add_permalink_to_suppliers.rb +6 -0
  79. data/db/migrate/20140323170638_add_supplier_commission_to_shipments.rb +5 -0
  80. data/db/migrate/20140416184616_migrate_payment_and_commission.rb +7 -0
  81. data/db/migrate/20140529041325_create_spree_supplier_variants.rb +15 -0
  82. data/db/migrate/20171027180043_add_paypal_email_to_suppliers.rb +5 -0
  83. data/db/seeds.rb +8 -0
  84. data/lib/generators/solidus_marketplace/install/install_generator.rb +36 -0
  85. data/lib/solidus_marketplace.rb +6 -0
  86. data/lib/solidus_marketplace/engine.rb +53 -0
  87. data/lib/solidus_marketplace/factories.rb +107 -0
  88. data/lib/solidus_marketplace/version.rb +3 -0
  89. data/lib/spree/permitted_attributes_decorator.rb +18 -0
  90. data/lib/tasks/spree_sample.rake +72 -0
  91. data/log/awesome.log +1 -0
  92. data/script/rails +7 -0
  93. data/solidus_marketplace.gemspec +46 -0
  94. data/spec/features/admin/orders_spec.rb +11 -0
  95. data/spec/features/admin/products_spec.rb +25 -0
  96. data/spec/features/admin/return_authorizations_spec.rb +7 -0
  97. data/spec/features/admin/settings_spec.rb +33 -0
  98. data/spec/features/admin/shipments_spec.rb +80 -0
  99. data/spec/features/admin/stock_management_spec.rb +156 -0
  100. data/spec/features/admin/stock_spec.rb +98 -0
  101. data/spec/features/admin/suppliers_spec.rb +130 -0
  102. data/spec/models/spree/order_decorator_spec.rb +80 -0
  103. data/spec/models/spree/payment_decorator_spec.rb +7 -0
  104. data/spec/models/spree/product_decorator_spec.rb +56 -0
  105. data/spec/models/spree/shipment_decorator_spec.rb +48 -0
  106. data/spec/models/spree/stock/splitter/marketplace_spec.rb +62 -0
  107. data/spec/models/spree/stock_location_decorator_spec.rb +33 -0
  108. data/spec/models/spree/supplier_ability_spec.rb +182 -0
  109. data/spec/models/spree/supplier_spec.rb +123 -0
  110. data/spec/models/spree/supplier_variant_spec.rb +5 -0
  111. data/spec/models/spree/user_decorator_spec.rb +57 -0
  112. data/spec/models/spree/variant_decorator_spec.rb +7 -0
  113. data/spec/spec_helper.rb +91 -0
  114. data/spec/support/ability_helpers.rb +11 -0
  115. data/spec/support/integration_helpers.rb +15 -0
  116. metadata +473 -0
@@ -0,0 +1,198 @@
1
+ <div data-hook="admin_product_form_fields">
2
+
3
+ <div class="row">
4
+
5
+ <div class="left col-9" data-hook="admin_product_form_left">
6
+ <div data-hook="admin_product_form_name">
7
+ <%= f.field_container :name do %>
8
+ <%= f.label :name, class: 'required' %>
9
+ <%= f.text_field :name, class: 'fullwidth title', required: true %>
10
+ <%= f.error_message_on :name %>
11
+ <% end %>
12
+ </div>
13
+
14
+ <div data-hook="admin_product_form_slug">
15
+ <%= f.field_container :slug do %>
16
+ <%= f.label :slug, class: 'required' %>
17
+ <%= f.text_field :slug, class: 'fullwidth title', required: true %>
18
+ <%= f.error_message_on :slug %>
19
+ <% end %>
20
+ </div>
21
+
22
+ <div data-hook="admin_product_form_description">
23
+ <%= f.field_container :description do %>
24
+ <%= f.label :description %>
25
+ <%= f.text_area :description, {rows: "#{unless @product.has_variants? then '22' else '15' end}", class: 'fullwidth'} %>
26
+ <%= f.error_message_on :description %>
27
+ <% end %>
28
+ </div>
29
+ </div>
30
+
31
+ <div class="right col-3" data-hook="admin_product_form_right">
32
+ <div data-hook="admin_product_form_price">
33
+ <%= f.field_container :price do %>
34
+ <%= f.label :price, class: 'required' %>
35
+ <%= render "spree/admin/shared/number_with_currency", f: f, amount_attr: :price,
36
+ currency: Spree::Config.default_pricing_options.currency %>
37
+ <%= f.error_message_on :price %>
38
+ <% end %>
39
+ </div>
40
+
41
+ <% if show_rebuild_vat_checkbox? %>
42
+ <%= render "spree/admin/shared/rebuild_vat_prices_checkbox", form: f, model_name: "product" %>
43
+ <div class="clearfix"></div>
44
+ <% end %>
45
+
46
+ <div class="row">
47
+
48
+ <div data-hook="admin_product_form_cost_price" class="col-12">
49
+ <%= f.field_container :cost_price do %>
50
+ <%= f.label :cost_price %>
51
+
52
+ <%= render "spree/admin/shared/number_with_currency", f: f, amount_attr: :cost_price, currency_attr: :cost_currency %>
53
+
54
+ <%= f.error_message_on :cost_price %>
55
+ <%= f.error_message_on :cost_currency %>
56
+ <% end %>
57
+ </div>
58
+ </div>
59
+
60
+ <div class="clear"></div>
61
+
62
+ <div data-hook="admin_product_form_available_on">
63
+ <%= f.field_container :available_on do %>
64
+ <%= f.label :available_on %>
65
+ <%= f.error_message_on :available_on %>
66
+ <%= f.text_field :available_on, value: datepicker_field_value(@product.available_on), class: 'datepicker' %>
67
+ <% end %>
68
+ </div>
69
+
70
+ <div data-hook="admin_product_form_promotionable">
71
+ <%= f.field_container :promotionable do %>
72
+ <%= f.label :promotionable do %>
73
+ <%= f.check_box :promotionable %> <%= Spree::Product.human_attribute_name(:promotionable) %>
74
+ <% end %>
75
+ <%= f.field_hint :promotionable %>
76
+ <% end %>
77
+ </div>
78
+
79
+ <% if @product.has_variants? %>
80
+ <div data-hook="admin_product_form_multiple_variants">
81
+ <%= f.label :skus, Spree.t(:skus) %>
82
+ <span class="info">
83
+ <%= Spree.t(:info_product_has_multiple_skus, count: @product.variants.count) %>
84
+ <ul class="text_list">
85
+ <% @product.variants.first(5).each do |variant| %>
86
+ <li><%= link_to variant.sku, spree.edit_admin_product_variant_path(@product, variant) %></li>
87
+ <% end %>
88
+ </ul>
89
+ <% if @product.variants.count > 5 %>
90
+ <%= Spree.t(:info_number_of_skus_not_shown, count: @product.variants.count - 5) %>
91
+ <% end %>
92
+ </span>
93
+ <div class="info-actions">
94
+ <% if can?(:admin, Spree::Variant) %>
95
+ <%= link_to_with_icon 'th-large', Spree.t(:manage_variants), admin_product_variants_url(@product) %>
96
+ <% end %>
97
+ </div>
98
+ </div>
99
+ <% else %>
100
+ <div data-hook="admin_product_form_sku">
101
+ <%= f.field_container :sku do %>
102
+ <%= f.label :sku, Spree::Variant.human_attribute_name(:sku) %>
103
+ <%= f.text_field :sku, size: 16 %>
104
+ <% end %>
105
+ </div>
106
+
107
+ <div id="shipping_specs" class="row">
108
+ <% [:height, :width, :depth, :weight].each_with_index do |field, index| %>
109
+ <div id="shipping_specs_<%= field %>_field" class="col-6">
110
+ <div class="field">
111
+ <%= f.label field %>
112
+ <%= f.text_field field, value: number_with_precision(@product.send(field), precision: 2) %>
113
+ </div>
114
+ </div>
115
+ <% end %>
116
+ </div>
117
+
118
+ <% end %>
119
+
120
+ <div data-hook="admin_product_form_shipping_categories">
121
+ <%= f.field_container :shipping_categories do %>
122
+ <%= f.label :shipping_category_id, Spree::ShippingCategory.model_name.human %>
123
+ <%= f.field_hint :shipping_category %>
124
+ <%= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'custom-select' }) %>
125
+ <%= f.error_message_on :shipping_category %>
126
+ <% end %>
127
+ </div>
128
+
129
+ <div data-hook="admin_product_form_tax_category">
130
+ <%= f.field_container :tax_category do %>
131
+ <%= f.label :tax_category_id, Spree::TaxCategory.model_name.human %>
132
+ <%= f.field_hint :tax_category %>
133
+ <%= f.collection_select(:tax_category_id, @tax_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'custom-select' }) %>
134
+ <%= f.error_message_on :tax_category %>
135
+ <% end %>
136
+ </div>
137
+ </div>
138
+
139
+ </div>
140
+
141
+ <div class="row">
142
+
143
+ <div class="col-9">
144
+ <% if try_spree_current_user.market_maker? %>
145
+ <div data-hook="admin_product_form_suppliers">
146
+ <%= f.field_container :suppliers do %>
147
+ <%= f.label :supplier_ids, plural_resource_name(Spree::Supplier) %><br />
148
+ <%= f.hidden_field :supplier_ids, value: @product.supplier_ids.join(',') %>
149
+ <% end %>
150
+ </div>
151
+ <% end %>
152
+
153
+ <div data-hook="admin_product_form_taxons">
154
+ <%= f.field_container :taxons do %>
155
+ <%= f.label :taxon_ids, plural_resource_name(Spree::Taxon) %><br />
156
+ <%= f.hidden_field :taxon_ids, value: @product.taxon_ids.join(',') %>
157
+ <% end %>
158
+ </div>
159
+
160
+ <div data-hook="admin_product_form_option_types">
161
+ <%= f.field_container :option_types do %>
162
+ <%= f.label :option_type_ids, plural_resource_name(Spree::OptionType) %>
163
+ <%= f.hidden_field :option_type_ids, value: @product.option_type_ids.join(',') %>
164
+ <% end %>
165
+ </div>
166
+
167
+ <div data-hook="admin_product_form_meta">
168
+ <div data-hook="admin_product_form_meta_title">
169
+ <%= f.field_container :meta_title do %>
170
+ <%= f.label :meta_title %>
171
+ <%= f.text_field :meta_title, class: 'fullwidth' %>
172
+ <% end %>
173
+ </div>
174
+
175
+ <div data-hook="admin_product_form_meta_keywords">
176
+ <%= f.field_container :meta_keywords do %>
177
+ <%= f.label :meta_keywords %>
178
+ <%= f.text_field :meta_keywords, class: 'fullwidth' %>
179
+ <% end %>
180
+ </div>
181
+
182
+ <div data-hook="admin_product_form_meta_description">
183
+ <%= f.field_container :meta_description do %>
184
+ <%= f.label :meta_description %>
185
+ <%= f.text_field :meta_description, class: 'fullwidth' %>
186
+ <% end %>
187
+ </div>
188
+ </div>
189
+ </div>
190
+
191
+ </div>
192
+
193
+ <div class="clear"></div>
194
+
195
+ <div data-hook="admin_product_form_additional_fields"></div>
196
+
197
+ <div class="clear"></div>
198
+ </div>
@@ -0,0 +1,34 @@
1
+ <% admin_breadcrumb(link_to t('spree.reports'), spree.admin_reports_path) %>
2
+ <% admin_breadcrumb(t('spree.earnings')) %>
3
+
4
+ <% content_for :page_actions do %>
5
+ <% end %>
6
+
7
+ <% content_for :table_filter_title do %>
8
+ <%= t('spree.date_range') %>
9
+ <% end %>
10
+
11
+ <% content_for :table_filter do %>
12
+ <%= render partial: 'spree/admin/shared/report_order_criteria', locals: { action: :earnings } %>
13
+ <% end %>
14
+
15
+ <table class="admin-report" data-hook="earnings">
16
+ <thead>
17
+ <tr>
18
+ <th><%= t('spree.supplier') %></th>
19
+ <th><%= t('spree.supplier_paypal_email') %></th>
20
+ <th><%= t('spree.supplier_earnings') %></th>
21
+ </tr>
22
+ </thead>
23
+ <tbody>
24
+ <% @supplier_earnings.each do |supplier_earnings| %>
25
+ <tr>
26
+ <td><%= supplier_earnings[:name] %></td>
27
+ <td><%= supplier_earnings[:paypal_email] %></td>
28
+ <td><%= supplier_earnings[:earnings].to_html %></td>
29
+ </tr>
30
+ <% end %>
31
+ </tbody>
32
+ </table>
33
+
34
+ <%= link_to "Export Earnings CSV", earnings_admin_reports_url(format: "csv") %>
@@ -0,0 +1 @@
1
+ <%= configurations_sidebar_menu_item Spree.t(:marketplace_settings), spree.edit_admin_marketplace_settings_path %>
@@ -0,0 +1,4 @@
1
+ <% if try_spree_current_user && try_spree_current_user.supplier? %>
2
+ <%= tab :profile, url: spree.edit_admin_supplier_url(spree_current_user.supplier_id), match_path: '/suppliers', icon: 'user' %>
3
+ <% end %>
4
+
@@ -0,0 +1,24 @@
1
+ <% content_for :page_actions do %>
2
+ <%= button_link_to Spree.t(:back_to_shipments_list), spree.admin_shipments_path, icon: 'arrow-left' %>
3
+ <% end %>
4
+
5
+ <% if spree_current_user.admin? && @shipment.supplier.present? %>
6
+ <div data-hook="admin_shipment_supplier" class="row">
7
+ <fieldset class="col-md-12 no-border-bottom">
8
+ <legend align="center"><%= Spree.t(:supplier_information) %></legend>
9
+ <div>
10
+ <b><%= Spree::Supplier.human_attribute_name(:name) %>:</b> <%= @shipment.supplier.name %><br/>
11
+ <b><%= Spree::Supplier.human_attribute_name(:email) %>:</b> <%= @shipment.supplier.email %><br/>
12
+ <b><%= Spree::Supplier.human_attribute_name(:url) %>:</b> <%= link_to @shipment.supplier.url, @shipment.supplier.url if @shipment.supplier.url.present? %><br/>
13
+ </div>
14
+ <div>
15
+ <b><%= Spree.t('contact_information') %>:</b>
16
+ </div>
17
+ <%= render partial: 'spree/shared/address', locals: { address: @shipment.supplier.address } %>
18
+ </fieldset>
19
+ </div>
20
+ <% end %>
21
+
22
+ <div data-hook="admin_shipment_form_fields">
23
+ <%= render partial: "spree/admin/orders/shipment", locals: { order: @shipment.order, shipment: @shipment } %>
24
+ </div>
@@ -0,0 +1,93 @@
1
+ <% admin_breadcrumb(plural_resource_name(Spree::Shipment)) %>
2
+
3
+ <% content_for :table_filter_title do %>
4
+ <%= Spree.t(:search) %>
5
+ <% end %>
6
+
7
+ <%# Update search form with new markup %>
8
+ <% content_for :table_filter do %>
9
+ <div data-hook="admin_shipments_index_search">
10
+ <%= search_form_for [:admin, @search] do |f| %>
11
+ <div class="row">
12
+ <div class="date-range-filter col-md-6">
13
+ <div class="form-group">
14
+ <%= label_tag :q_created_at_gt, Spree.t(:date_range) %>
15
+ <div class="row">
16
+ <div class="col-md-6">
17
+ <%= f.text_field :created_at_gt, :class => 'datepicker datepicker-from form-control', :value => params[:q][:created_at_gt], :placeholder => Spree.t(:start) %>
18
+ </div>
19
+ <div class="col-md-6">
20
+ <%= f.text_field :created_at_lt, :class => 'datepicker datepicker-to form-control', :value => params[:q][:created_at_lt], :placeholder => Spree.t(:stop) %>
21
+ </div>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ <div class="row">
27
+ <div class="col-md-4">
28
+ <div class="form-group">
29
+ <%= label_tag nil, Spree.t(:shipment_number) %>
30
+ <%= f.text_field :number_cont , class: 'form-control js-quick-search-target'%>
31
+ </div>
32
+ </div>
33
+
34
+ <div class="col-md-4">
35
+ <div class="form-group">
36
+ <%= label_tag nil, Spree.t(:status) %><br/>
37
+ <%= f.select :state_eq, Spree::Shipment.state_machines[:state].states.collect {|s| [Spree.t("shipment_state.#{s.name}"), s.value]}, {:include_blank => true}, :class => 'select2' %>
38
+ </div>
39
+ </div>
40
+ </div>
41
+
42
+ <div data-hook="admin_shipments_index_search_buttons" class="form-actions">
43
+ <%= button Spree.t(:filter_results), 'search' %>
44
+ </div>
45
+ <% end %>
46
+ </div>
47
+ <% end %>
48
+
49
+ <%# This is a new paginate! %>
50
+ <%= paginate @shipments, theme: "solidus_admin" %>
51
+
52
+ <% unless @shipments.empty? %>
53
+ <table class="table" id="listing_shipments" data-hook>
54
+ <thead>
55
+ <tr data-hook="admin_orders_index_headers">
56
+ <th><%= sort_link @search, :created_at, Spree::Shipment.human_attribute_name(:created_at) %></th>
57
+ <th><%= sort_link @search, :number, Spree::Shipment.human_attribute_name(:number) %></th>
58
+ <th><%= sort_link @search, :state, Spree::Shipment.human_attribute_name(:state) %></th>
59
+ <th><%= sort_link @search, :item_cost, Spree::Shipment.human_attribute_name(:item_cost) %></th>
60
+ <th><%= sort_link @search, :shipping_total, Spree::Shipment.human_attribute_name(:cost) %></th>
61
+ <th><%= sort_link @search, :tax_total, Spree::Shipment.human_attribute_name(:tax_total) %></th>
62
+ <th><%= sort_link @search, :total, Spree::Shipment.human_attribute_name(:final_price) %></th>
63
+ <th><%= sort_link @search, :supplier_commission, Spree::Shipment.human_attribute_name(:supplier_commission) %></th>
64
+ <th data-hook="admin_shipments_index_header_actions" class="actions"></th>
65
+ </tr>
66
+ </thead>
67
+ <tbody>
68
+ <% @shipments.each do |shipment| %>
69
+ <tr data-hook="admin_shipments_index_rows" class="state-<%= shipment.state.downcase %> <%= cycle('odd', 'even') %>">
70
+ <td><%= l shipment.created_at.to_date %></td>
71
+ <td><%= link_to shipment.number, spree.edit_admin_shipment_path(shipment) %></td>
72
+ <td><span class="state <%= shipment.state.downcase %>"><%= Spree.t("shipment_state.#{shipment.state.downcase}") %></span></td>
73
+ <td> <%= shipment.display_item_cost.to_html %></td>
74
+ <td ><%= shipment.display_cost.to_html %></td>
75
+ <td><%= Spree::Money.new(shipment.tax_total, currency: shipment.currency).to_html %></td>
76
+ <td><%= Spree::Money.new(shipment.final_price_with_items, currency: shipment.currency).to_html %></td>
77
+ <td><%= Spree::Money.new(shipment.supplier_commission, currency: shipment.currency).to_html %></td>
78
+ <td data-hook="admin_shipments_index_row_actions">
79
+ <%= link_to_edit_url spree.edit_admin_shipment_path(shipment), :title => "admin_edit_#{dom_id(shipment)}", :no_text => true %>
80
+ </td>
81
+ </tr>
82
+ <% end %>
83
+ </tbody>
84
+ </table>
85
+ <% else %>
86
+ <%# New alert 'Not Found' with i18n %>
87
+ <div class="alert alert-info no-objects-found">
88
+ <%= Spree.t(:no_resource_found, resource: Spree::Shipment.model_name.human(count: :many)) %>,
89
+ </div>
90
+ <% end %>
91
+
92
+ <%# This is a new paginate! %>
93
+ <%= paginate @shipments, theme: "solidus_admin" %>
@@ -0,0 +1,75 @@
1
+ <div data-hook="supplier_address_wrapper" class="col-md-6">
2
+ <fieldset class="no-border-bottom">
3
+ <legend align="center"><%= Spree.t('contact_address') %></legend>
4
+ <%= form.fields_for :address do |contact_form| %>
5
+ <%= render :partial => 'spree/admin/shared/address_form', :locals => { :f => contact_form, :name => Spree.t(:contact_address), :type => "shipping" } %>
6
+ <% end %>
7
+ </fieldset>
8
+ </div>
9
+
10
+ <%# added bootstrap classes for 'field_container' and '' %>
11
+ <div data-hook="supplier_details_wrapper" class="col-md-6">
12
+ <fieldset class="no-border-bottom">
13
+ <legend align="center" ><%= Spree.t('supplier_details') %></legend>
14
+ <%= form.field_container :name, class: ['form-group'] do %>
15
+ <%= form.label :name, Spree::Supplier.human_attribute_name(:name) %>:<br />
16
+ <%= form.text_field :name, :class => 'form-control' %>
17
+ <% end %>
18
+ <%= form.field_container :email, class: ['form-group'] do %>
19
+ <%= form.label :email, Spree::Supplier.human_attribute_name(:email) %>:<br />
20
+ <%= form.email_field :email, :class => 'form-control' %>
21
+ <%# email validation %>
22
+ <%= error_message_on :user, :email %>
23
+ <% end %>
24
+ <%= form.field_container :paypal_email, class: ['form-group'] do %>
25
+ <%= form.label :paypal_email, Spree::Supplier.human_attribute_name(:paypal_email) %>:<br />
26
+ <%= form.email_field :paypal_email, :class => 'form-control' %>
27
+ <%# email validation %>
28
+ <%= error_message_on :user, :paypal_email %>
29
+ <% end %>
30
+ <%= form.field_container :url, class: ['form-group'] do %>
31
+ <%= form.label :url, Spree::Supplier.human_attribute_name(:url) %>:<br />
32
+ <%= form.text_field :url, :class => 'form-control' %>
33
+ <% end %>
34
+ <%= form.field_container :tax_id, class: ['form-group'] do %>
35
+ <%= form.label :tax_id, Spree::Supplier.human_attribute_name(:tax_id) %>:<br />
36
+ <%= form.text_field :tax_id, :class => 'form-control' %>
37
+ <% end %>
38
+ <% if spree_current_user.admin? %>
39
+ <%= form.field_container :commission_flat_rate, class: ['form-group'] do %>
40
+ <%= form.label :commission_flat_rate, Spree::Supplier.human_attribute_name(:commission_flat_rate) %>:<br />
41
+ <%= form.text_field :commission_flat_rate, :class => 'form-control' %>
42
+ <% end %>
43
+ <%= form.field_container :commission_percentage , class: ['form-group'] do %>
44
+ <%= form.label :commission_percentage, Spree::Supplier.human_attribute_name(:commission_percentage) %>:<br />
45
+ <%= form.text_field :commission_percentage, :class => 'form-control' %>
46
+ <% end %>
47
+ <%= form.field_container :users, class: ['form-group'] do %>
48
+ <%= form.label :users %><br/>
49
+ <%= hidden_field_tag 'supplier[user_ids_string]', form.object.user_ids.join(','), class: 'user_picker fullwidth' %>
50
+ <% end %>
51
+ <%= form.field_container :active, class: ['form-group'] do %>
52
+ <div class="checkbox">
53
+ <%= label_tag :active do %>
54
+ <%= form.check_box :active %>
55
+ <%= Spree::Supplier.human_attribute_name(:active) %>
56
+ <% end %>
57
+ </div>
58
+ <% end %>
59
+ <% end %>
60
+ <%# This moved to _edit(new)_resource_links.html.erb %>
61
+ <!--<div class='center'>-->
62
+ <%# if form.object.new_record? %>
63
+ <%#= button Spree.t('create') %>
64
+ <%# else %>
65
+ <%#= button Spree.t('update') %>
66
+ <%# end %>
67
+ <%#= Spree.t('or') %>
68
+ <%# if can? :index, Spree::Supplier %>
69
+ <%#= link_to Spree.t('cancel'), collection_url %>
70
+ <%# else %>
71
+ <%#= link_to Spree.t('cancel'), spree.account_path %>
72
+ <%# end %>
73
+ <!--</div>-->
74
+ </fieldset>
75
+ </div>
@@ -0,0 +1,22 @@
1
+ <% if can? :index, Spree::Supplier %>
2
+ <% content_for :page_actions do %>
3
+ <%= button_link_to Spree.t('back_to_suppliers'), spree.admin_suppliers_path, icon: 'arrow-left' %>
4
+ <% end %>
5
+ <% end %>
6
+
7
+ <% content_for :page_title do %>
8
+ <%== Spree.t(:editing_supplier) + " &ldquo;#{@object.name}&rdquo;".html_safe %>
9
+ <% end %>
10
+
11
+ <%= render 'spree/shared/error_messages', target: @object %>
12
+
13
+ <%= form_for [:admin, @object] do |f| %>
14
+ <%= render "form", form: f %>
15
+ <div data-hook="supplier_right_column_wrapper" class="col-md-4"></div>
16
+ <%# render 'update' and 'cancel' buttons %>
17
+ <div class="col-md-8">
18
+ <%= render :partial => 'spree/admin/shared/edit_resource_links' %>
19
+ </div>
20
+ <% end %>
21
+
22
+