solidus_backend 1.0.7 → 1.1.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_backend might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/backend.js +3 -0
- data/app/assets/javascripts/spree/backend/admin.js.erb +17 -24
- data/app/assets/javascripts/spree/backend/checkouts/edit.js +3 -5
- data/app/assets/javascripts/spree/backend/flash.coffee +17 -0
- data/app/assets/javascripts/spree/backend/handlebars_extensions.coffee +9 -0
- data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +6 -6
- data/app/assets/javascripts/spree/backend/option_value_picker.js +43 -0
- data/app/assets/javascripts/spree/backend/product_picker.js +10 -8
- data/app/assets/javascripts/spree/backend/promotions.js.coffee +101 -0
- data/app/assets/javascripts/spree/backend/routes.js +2 -1
- data/app/assets/javascripts/spree/backend/shipments.js.erb +1 -1
- data/app/assets/javascripts/spree/backend/stock_management/index_add_forms.coffee +1 -1
- data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +2 -2
- data/app/assets/javascripts/spree/backend/stock_transfers/variant_form.coffee +1 -1
- data/app/assets/javascripts/spree/backend/taxon_autocomplete.js.erb +6 -6
- data/app/assets/javascripts/spree/backend/taxons.js.coffee +6 -7
- data/app/assets/javascripts/spree/backend/templates/orders/customer_details/autocomplete.hbs +17 -0
- data/app/assets/javascripts/spree/backend/templates/products/sortable.hbs +5 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_flat_rate.hbs +17 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_percent.hbs +17 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values.hbs +10 -0
- data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values_select.hbs +1 -0
- data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +19 -0
- data/app/assets/javascripts/spree/backend/templates/stock_transfers/transfer_item.hbs.erb +52 -0
- data/app/assets/javascripts/spree/backend/templates/variants/autocomplete.hbs.erb +23 -0
- data/app/assets/javascripts/spree/backend/templates/variants/autocomplete_stock.hbs +51 -0
- data/app/assets/javascripts/spree/backend/templates/variants/line_items_autocomplete_stock.hbs +67 -0
- data/app/assets/javascripts/spree/backend/templates/variants/split.hbs +27 -0
- data/app/assets/javascripts/spree/backend/user_picker.js +8 -8
- data/app/assets/javascripts/spree/backend/variant_autocomplete.js.coffee.erb +6 -8
- data/app/assets/stylesheets/spree/backend/components/_messages.scss +6 -3
- data/app/assets/stylesheets/spree/backend/sections/_promotions.scss +16 -0
- data/app/controllers/spree/admin/base_controller.rb +1 -1
- data/app/controllers/spree/admin/option_types_controller.rb +1 -3
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +1 -1
- data/app/controllers/spree/admin/orders_controller.rb +6 -11
- data/app/controllers/spree/admin/product_properties_controller.rb +9 -0
- data/app/controllers/spree/admin/products_controller.rb +20 -5
- data/app/controllers/spree/admin/promotions_controller.rb +2 -1
- data/app/controllers/spree/admin/reimbursements_controller.rb +20 -0
- data/app/controllers/spree/admin/resource_controller.rb +1 -1
- data/app/controllers/spree/admin/return_authorizations_controller.rb +5 -0
- data/app/controllers/spree/admin/root_controller.rb +1 -1
- data/app/controllers/spree/admin/search_controller.rb +2 -4
- data/app/controllers/spree/admin/states_controller.rb +1 -1
- data/app/controllers/spree/admin/stock_items_controller.rb +1 -1
- data/app/controllers/spree/admin/stock_transfers_controller.rb +3 -14
- data/app/controllers/spree/admin/users_controller.rb +2 -3
- data/app/controllers/spree/admin/variant_property_rule_values_controller.rb +7 -0
- data/app/controllers/spree/admin/variants_controller.rb +1 -1
- data/app/controllers/spree/admin/zones_controller.rb +1 -1
- data/app/helpers/spree/admin/adjustments_helper.rb +4 -9
- data/app/helpers/spree/admin/base_helper.rb +7 -6
- data/app/helpers/spree/admin/navigation_helper.rb +8 -2
- data/app/helpers/spree/admin/orders_helper.rb +1 -1
- data/app/helpers/spree/admin/products_helper.rb +2 -4
- data/app/helpers/spree/admin/stock_movements_helper.rb +3 -3
- data/app/views/spree/admin/adjustments/_adjustment.html.erb +1 -1
- data/app/views/spree/admin/orders/_add_line_item.html.erb +0 -5
- data/app/views/spree/admin/orders/_add_product.html.erb +0 -3
- data/app/views/spree/admin/orders/_carton.html.erb +0 -1
- data/app/views/spree/admin/orders/_shipment.html.erb +0 -1
- data/app/views/spree/admin/orders/confirm/_shipment.html.erb +0 -1
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
- data/app/views/spree/admin/orders/customer_details/edit.html.erb +0 -1
- data/app/views/spree/admin/orders/index.html.erb +1 -2
- data/app/views/spree/admin/payment_methods/_form.html.erb +0 -4
- data/app/views/spree/admin/payment_methods/index.html.erb +0 -2
- data/app/views/spree/admin/payments/source_views/_gateway.html.erb +3 -0
- data/app/views/spree/admin/product_properties/index.html.erb +52 -2
- data/app/views/spree/admin/promotions/_actions.html.erb +14 -10
- data/app/views/spree/admin/promotions/_promotion_action.html.erb +5 -3
- data/app/views/spree/admin/promotions/_promotion_rule.html.erb +5 -3
- data/app/views/spree/admin/promotions/_rules.html.erb +18 -14
- data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +5 -28
- data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +5 -27
- data/app/views/spree/admin/promotions/edit.html.erb +6 -4
- data/app/views/spree/admin/promotions/index.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_option_value.html.erb +13 -0
- data/app/views/spree/admin/refund_reasons/index.html.erb +2 -2
- data/app/views/spree/admin/reimbursements/edit.html.erb +1 -1
- data/app/views/spree/admin/return_authorizations/_form.html.erb +2 -2
- data/app/views/spree/admin/search/users.rabl +1 -1
- data/app/views/spree/admin/shared/_order_summary.html.erb +6 -0
- data/app/views/spree/admin/shared/_tabs.html.erb +2 -2
- data/app/views/spree/admin/shared/_translations.html.erb +16 -46
- data/app/views/spree/admin/shared/named_types/_index.html.erb +2 -2
- data/app/views/spree/admin/stock_items/_stock_management.html.erb +0 -2
- data/app/views/spree/admin/stock_movements/_form.html.erb +0 -2
- data/app/views/spree/admin/stock_transfers/edit.html.erb +0 -3
- data/app/views/spree/admin/stock_transfers/receive.html.erb +0 -2
- data/app/views/spree/admin/stock_transfers/show.html.erb +1 -1
- data/app/views/spree/admin/taxons/index.html.erb +0 -1
- data/app/views/spree/admin/users/_addresses_form.html.erb +4 -4
- data/app/views/spree/layouts/admin.html.erb +11 -9
- data/config/routes.rb +5 -0
- data/lib/spree/backend.rb +1 -2
- metadata +41 -139
- data/CHANGELOG.md +0 -1
- data/Gemfile +0 -6
- data/Rakefile +0 -15
- data/app/assets/javascripts/spree/backend/handlebar_extensions.js +0 -9
- data/app/assets/javascripts/spree/backend/promotions.js +0 -73
- data/app/assets/javascripts/spree/backend/stock_transfer.js.coffee +0 -196
- data/app/views/spree/admin/products/_autocomplete.js.erb +0 -14
- data/app/views/spree/admin/products/_sortable.html +0 -7
- data/app/views/spree/admin/stock_items/_stock_location_stock_item_template.html.erb +0 -21
- data/app/views/spree/admin/stock_transfers/_transfer_item_template.html.erb +0 -54
- data/app/views/spree/admin/variants/_autocomplete.js.erb +0 -25
- data/app/views/spree/admin/variants/_autocomplete_line_items_stock.js.erb +0 -69
- data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +0 -53
- data/app/views/spree/admin/variants/_split.js.erb +0 -29
- data/script/rails +0 -9
- data/solidus_backend.gemspec +0 -30
- data/spec/controllers/spree/admin/base_controller_spec.rb +0 -24
- data/spec/controllers/spree/admin/cancellations_controller_spec.rb +0 -77
- data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -234
- data/spec/controllers/spree/admin/general_settings_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -80
- data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -472
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -49
- data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -175
- data/spec/controllers/spree/admin/products_controller_spec.rb +0 -45
- data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -21
- data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +0 -18
- data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -21
- data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -122
- data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -32
- data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -75
- data/spec/controllers/spree/admin/reports_controller_spec.rb +0 -134
- data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -166
- data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -226
- data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -27
- data/spec/controllers/spree/admin/root_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/search_controller_spec.rb +0 -104
- data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -14
- data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -50
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -41
- data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +0 -331
- data/spec/controllers/spree/admin/store_credits_controller_spec.rb +0 -309
- data/spec/controllers/spree/admin/users_controller_spec.rb +0 -236
- data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -32
- data/spec/features/admin/configuration/analytics_tracker_spec.rb +0 -54
- data/spec/features/admin/configuration/countries_spec.rb +0 -22
- data/spec/features/admin/configuration/general_settings_spec.rb +0 -45
- data/spec/features/admin/configuration/payment_methods_spec.rb +0 -125
- data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -64
- data/spec/features/admin/configuration/states_spec.rb +0 -64
- data/spec/features/admin/configuration/stock_locations_spec.rb +0 -50
- data/spec/features/admin/configuration/tax_categories_spec.rb +0 -56
- data/spec/features/admin/configuration/tax_rates_spec.rb +0 -30
- data/spec/features/admin/configuration/taxonomies_spec.rb +0 -52
- data/spec/features/admin/configuration/zones_spec.rb +0 -39
- data/spec/features/admin/homepage_spec.rb +0 -78
- data/spec/features/admin/locale_spec.rb +0 -30
- data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -53
- data/spec/features/admin/orders/adjustments_spec.rb +0 -126
- data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -48
- data/spec/features/admin/orders/cancelling_inventory_spec.rb +0 -48
- data/spec/features/admin/orders/customer_details_spec.rb +0 -163
- data/spec/features/admin/orders/line_items_spec.rb +0 -50
- data/spec/features/admin/orders/listing_spec.rb +0 -130
- data/spec/features/admin/orders/log_entries_spec.rb +0 -55
- data/spec/features/admin/orders/new_order_spec.rb +0 -197
- data/spec/features/admin/orders/order_details_spec.rb +0 -533
- data/spec/features/admin/orders/payments_spec.rb +0 -228
- data/spec/features/admin/orders/risk_analysis_spec.rb +0 -47
- data/spec/features/admin/orders/shipments_spec.rb +0 -65
- data/spec/features/admin/payments/store_credits_spec.rb +0 -21
- data/spec/features/admin/products/edit/images_spec.rb +0 -87
- data/spec/features/admin/products/edit/products_spec.rb +0 -66
- data/spec/features/admin/products/edit/taxons_spec.rb +0 -56
- data/spec/features/admin/products/edit/variants_spec.rb +0 -61
- data/spec/features/admin/products/option_types_spec.rb +0 -114
- data/spec/features/admin/products/products_spec.rb +0 -392
- data/spec/features/admin/products/properties_spec.rb +0 -139
- data/spec/features/admin/products/prototypes_spec.rb +0 -110
- data/spec/features/admin/products/stock_management_spec.rb +0 -82
- data/spec/features/admin/products/variant_spec.rb +0 -51
- data/spec/features/admin/promotion_adjustments_spec.rb +0 -220
- data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -69
- data/spec/features/admin/promotions/user_rule_spec.rb +0 -25
- data/spec/features/admin/reports_spec.rb +0 -61
- data/spec/features/admin/stock_transfer_spec.rb +0 -86
- data/spec/features/admin/store_credits_spec.rb +0 -82
- data/spec/features/admin/taxons_spec.rb +0 -31
- data/spec/features/admin/users_spec.rb +0 -270
- data/spec/helpers/admin/base_helper_spec.rb +0 -24
- data/spec/helpers/admin/navigation_helper_spec.rb +0 -73
- data/spec/helpers/admin/reimbursements_helper_spec.rb +0 -34
- data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -29
- data/spec/helpers/admin/store_credit_events_helper_spec.rb +0 -95
- data/spec/helpers/promotion_rules_helper_spec.rb +0 -12
- data/spec/spec_helper.rb +0 -108
- data/spec/support/appear_before_matcher.rb +0 -8
- data/spec/support/ror_ringer.jpeg +0 -0
- data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
- data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
- data/vendor/assets/javascripts/handlebars.js +0 -2746
data/CHANGELOG.md
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
## Spree 2.4.0 (unreleased) ##
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
require 'rake/testtask'
|
4
|
-
require 'rspec/core/rake_task'
|
5
|
-
require 'spree/testing_support/common_rake'
|
6
|
-
|
7
|
-
RSpec::Core::RakeTask.new
|
8
|
-
|
9
|
-
task :default => :spec
|
10
|
-
|
11
|
-
desc "Generates a dummy app for testing"
|
12
|
-
task :test_app do
|
13
|
-
ENV['LIB_NAME'] = 'spree/backend'
|
14
|
-
Rake::Task['common:test_app'].invoke
|
15
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
//= require handlebars
|
2
|
-
Handlebars.registerHelper("t", function(key) {
|
3
|
-
if (Spree.translations[key]) {
|
4
|
-
return Spree.translations[key]
|
5
|
-
} else {
|
6
|
-
console.error("No translation found for " + key + ". Does it exist within spree/admin/shared/_translations.html.erb?")
|
7
|
-
}
|
8
|
-
});
|
9
|
-
|
@@ -1,73 +0,0 @@
|
|
1
|
-
var initProductActions = function () {
|
2
|
-
'use strict';
|
3
|
-
|
4
|
-
// Add classes on promotion items for design
|
5
|
-
$(document).on('mouseover mouseout', 'a.delete', function (event) {
|
6
|
-
if (event.type === 'mouseover') {
|
7
|
-
$(this).parent().addClass('action-remove');
|
8
|
-
} else {
|
9
|
-
$(this).parent().removeClass('action-remove');
|
10
|
-
}
|
11
|
-
});
|
12
|
-
|
13
|
-
$('#promotion-filters').find('.variant_autocomplete').variantAutocomplete();
|
14
|
-
|
15
|
-
$('.calculator-fields').each(function () {
|
16
|
-
var $fields_container = $(this);
|
17
|
-
var $type_select = $fields_container.find('.type-select');
|
18
|
-
var $settings = $fields_container.find('.settings');
|
19
|
-
var $warning = $fields_container.find('.warning');
|
20
|
-
var originalType = $type_select.val();
|
21
|
-
|
22
|
-
$warning.hide();
|
23
|
-
$type_select.change(function () {
|
24
|
-
if ($(this).val() === originalType) {
|
25
|
-
$warning.hide();
|
26
|
-
$settings.show();
|
27
|
-
$settings.find('input').removeProp('disabled');
|
28
|
-
} else {
|
29
|
-
$warning.show();
|
30
|
-
$settings.hide();
|
31
|
-
$settings.find('input').prop('disabled', 'disabled');
|
32
|
-
}
|
33
|
-
});
|
34
|
-
});
|
35
|
-
|
36
|
-
//
|
37
|
-
// Tiered Calculator
|
38
|
-
//
|
39
|
-
if ($('#tier-fields-template').length && $('#tier-input-name').length) {
|
40
|
-
var tierFieldsTemplate = Handlebars.compile($('#tier-fields-template').html());
|
41
|
-
var tierInputNameTemplate = Handlebars.compile($('#tier-input-name').html());
|
42
|
-
|
43
|
-
var originalTiers = $('.js-original-tiers').data('original-tiers');
|
44
|
-
$.each(originalTiers, function(base, value) {
|
45
|
-
var fieldName = tierInputNameTemplate({base: base}).trim();
|
46
|
-
$('.js-tiers').append(tierFieldsTemplate({
|
47
|
-
baseField: {value: base},
|
48
|
-
valueField: {name: fieldName, value: value}
|
49
|
-
}));
|
50
|
-
});
|
51
|
-
|
52
|
-
$(document).on('click', '.js-add-tier', function(event) {
|
53
|
-
event.preventDefault();
|
54
|
-
$('.js-tiers').append(tierFieldsTemplate({valueField: {name: null}}));
|
55
|
-
});
|
56
|
-
|
57
|
-
$(document).on('click', '.js-remove-tier', function(event) {
|
58
|
-
$(this).parents('.tier').remove();
|
59
|
-
});
|
60
|
-
|
61
|
-
$(document).on('change', '.js-base-input', function(event) {
|
62
|
-
var valueInput = $(this).parents('.tier').find('.js-value-input');
|
63
|
-
valueInput.attr('name', tierInputNameTemplate({base: $(this).val()}).trim());
|
64
|
-
});
|
65
|
-
}
|
66
|
-
|
67
|
-
};
|
68
|
-
|
69
|
-
$(document).ready(function () {
|
70
|
-
|
71
|
-
initProductActions();
|
72
|
-
|
73
|
-
});
|
@@ -1,196 +0,0 @@
|
|
1
|
-
$ ->
|
2
|
-
# Base Model for transfer line items
|
3
|
-
class TransferVariant
|
4
|
-
constructor: (@variant) ->
|
5
|
-
@id = @variant.id
|
6
|
-
@name = "#{@variant.name} - #{@variant.sku}"
|
7
|
-
@quantity = 0
|
8
|
-
|
9
|
-
add: (quantity) ->
|
10
|
-
@quantity += quantity
|
11
|
-
|
12
|
-
# Model for stock items which validate quantity with count on hand
|
13
|
-
class TransferStockItem extends TransferVariant
|
14
|
-
constructor: (@stock_item) ->
|
15
|
-
super(@stock_item.variant)
|
16
|
-
@count_on_hand = @stock_item.count_on_hand
|
17
|
-
@name = "#{@variant.name} - #{@variant.sku} (#{@count_on_hand})"
|
18
|
-
|
19
|
-
add: (quantity) ->
|
20
|
-
@quantity += quantity
|
21
|
-
@quantity = @count_on_hand if @quantity > @count_on_hand
|
22
|
-
|
23
|
-
# Manages source and destination selections
|
24
|
-
class TransferLocations
|
25
|
-
constructor: ->
|
26
|
-
@source = $('#transfer_source_location_id')
|
27
|
-
@destination = $('#transfer_destination_location_id')
|
28
|
-
|
29
|
-
@source.change => @populate_destination()
|
30
|
-
|
31
|
-
$('#transfer_receive_stock').change (event) => @receive_stock_change(event)
|
32
|
-
|
33
|
-
Spree.getJSON Spree.routes.stock_locations_api, (data) =>
|
34
|
-
@locations = (location for location in data.stock_locations)
|
35
|
-
@force_receive_stock() if @locations.length < 2
|
36
|
-
|
37
|
-
@populate_source()
|
38
|
-
@populate_destination()
|
39
|
-
|
40
|
-
force_receive_stock: ->
|
41
|
-
$('#receive_stock_field').hide()
|
42
|
-
$('#transfer_receive_stock').prop('checked', true)
|
43
|
-
@toggle_source_location true
|
44
|
-
|
45
|
-
is_source_location_hidden: ->
|
46
|
-
$('#transfer_source_location_id_field').css('visibility') == 'hidden'
|
47
|
-
|
48
|
-
toggle_source_location: (hide=false) ->
|
49
|
-
@source.trigger('change')
|
50
|
-
if @is_source_location_hidden() and not hide
|
51
|
-
$('#transfer_source_location_id_field').css('visibility', 'visible')
|
52
|
-
else
|
53
|
-
$('#transfer_source_location_id_field').css('visibility', 'hidden')
|
54
|
-
|
55
|
-
receive_stock_change: (event) ->
|
56
|
-
@toggle_source_location event.target.checked
|
57
|
-
@populate_destination(!event.target.checked)
|
58
|
-
|
59
|
-
populate_source: ->
|
60
|
-
@populate_select @source
|
61
|
-
@source.trigger('change')
|
62
|
-
|
63
|
-
populate_destination: (except_source=true) ->
|
64
|
-
if @is_source_location_hidden()
|
65
|
-
@populate_select @destination
|
66
|
-
else
|
67
|
-
@populate_select @destination, parseInt(@source.val())
|
68
|
-
|
69
|
-
populate_select: (select, except=0) ->
|
70
|
-
select.children('option').remove()
|
71
|
-
for location in @locations when location.id isnt except
|
72
|
-
select.append $('<option></option>').text(location.name).attr('value', location.id)
|
73
|
-
select.select2()
|
74
|
-
|
75
|
-
# Populates variants drop down
|
76
|
-
class TransferVariants
|
77
|
-
constructor: ->
|
78
|
-
$('#transfer_source_location_id').change => @refresh_variants()
|
79
|
-
|
80
|
-
receiving_stock: ->
|
81
|
-
$( "#transfer_receive_stock:checked" ).length > 0
|
82
|
-
|
83
|
-
refresh_variants: ->
|
84
|
-
if @receiving_stock()
|
85
|
-
@_search_transfer_variants()
|
86
|
-
else
|
87
|
-
@_search_transfer_stock_items()
|
88
|
-
|
89
|
-
_search_transfer_variants: ->
|
90
|
-
@build_select(Spree.url(Spree.routes.variants_api), 'product_name_or_sku_cont')
|
91
|
-
|
92
|
-
_search_transfer_stock_items: ->
|
93
|
-
stock_location_id = $('#transfer_source_location_id').val()
|
94
|
-
@build_select(Spree.url(Spree.routes.stock_locations_api + "/#{stock_location_id}/stock_items"),
|
95
|
-
'variant_product_name_or_variant_sku_cont')
|
96
|
-
|
97
|
-
format_variant_result: (result) ->
|
98
|
-
"#{result.name} - #{result.sku}"
|
99
|
-
|
100
|
-
build_select: (url, query) ->
|
101
|
-
$('#transfer_variant').select2
|
102
|
-
minimumInputLength: 3
|
103
|
-
ajax:
|
104
|
-
url: url
|
105
|
-
datatype: "json"
|
106
|
-
data: (term, page) ->
|
107
|
-
query_object = {}
|
108
|
-
query_object[query] = term
|
109
|
-
q: query_object
|
110
|
-
token: Spree.api_key
|
111
|
-
|
112
|
-
results: (data, page) ->
|
113
|
-
result = data["variants"] || data["stock_items"]
|
114
|
-
# Format stock items as variants
|
115
|
-
if data["stock_items"]?
|
116
|
-
result = _(result).map (variant) ->
|
117
|
-
variant.variant
|
118
|
-
window.variants = result
|
119
|
-
results: result
|
120
|
-
|
121
|
-
formatResult: @format_variant_result
|
122
|
-
formatSelection: (variant) ->
|
123
|
-
if !!variant.options_text
|
124
|
-
variant.name + " (#{variant.options_text})" + " - #{variant.sku}"
|
125
|
-
else
|
126
|
-
variant.name + " - #{variant.sku}"
|
127
|
-
|
128
|
-
|
129
|
-
# Add/Remove variant line items
|
130
|
-
class TransferAddVariants
|
131
|
-
constructor: ->
|
132
|
-
@variants = []
|
133
|
-
@template = Handlebars.compile $('#transfer_variant_template').html()
|
134
|
-
|
135
|
-
$('#transfer_source_location_id').change (event) => @clear_variants()
|
136
|
-
|
137
|
-
$('button.transfer_add_variant').click (event) =>
|
138
|
-
event.preventDefault()
|
139
|
-
if $('#transfer_variant').select2('data')?
|
140
|
-
@add_variant()
|
141
|
-
else
|
142
|
-
alert('Please select a variant first')
|
143
|
-
|
144
|
-
$('#transfer-variants-table').on 'click', '.transfer_remove_variant', (event) =>
|
145
|
-
event.preventDefault()
|
146
|
-
@remove_variant $(event.target)
|
147
|
-
|
148
|
-
$('button.transfer_transfer').click =>
|
149
|
-
unless @variants.length > 0
|
150
|
-
alert('no variants to transfer')
|
151
|
-
false
|
152
|
-
|
153
|
-
add_variant: ->
|
154
|
-
variant = $('#transfer_variant').select2('data')
|
155
|
-
quantity = parseInt $('#transfer_variant_quantity').val()
|
156
|
-
|
157
|
-
variant = @find_or_add(variant)
|
158
|
-
variant.add(quantity)
|
159
|
-
@render()
|
160
|
-
|
161
|
-
find_or_add: (variant) ->
|
162
|
-
if existing = _.find(@variants, (v) -> v.id == variant.id)
|
163
|
-
return existing
|
164
|
-
else
|
165
|
-
variant = new TransferVariant($.extend({}, variant))
|
166
|
-
@variants.push variant
|
167
|
-
return variant
|
168
|
-
|
169
|
-
remove_variant: (target) ->
|
170
|
-
variant_id = parseInt(target.data('variantId'))
|
171
|
-
@variants = (v for v in @variants when v.id isnt variant_id)
|
172
|
-
@render()
|
173
|
-
|
174
|
-
clear_variants: ->
|
175
|
-
@variants = []
|
176
|
-
@render()
|
177
|
-
|
178
|
-
contains: (id) ->
|
179
|
-
_.contains(_.pluck(@variants, 'id'), id)
|
180
|
-
|
181
|
-
render: ->
|
182
|
-
if @variants.length is 0
|
183
|
-
$('#transfer-variants-table').hide()
|
184
|
-
$('.no-objects-found').show()
|
185
|
-
else
|
186
|
-
$('#transfer-variants-table').show()
|
187
|
-
$('.no-objects-found').hide()
|
188
|
-
|
189
|
-
rendered = @template { variants: @variants }
|
190
|
-
$('#transfer_variants_tbody').html(rendered)
|
191
|
-
|
192
|
-
# Main
|
193
|
-
if $('#transfer_source_location_id').length > 0
|
194
|
-
transfer_locations = new TransferLocations
|
195
|
-
transfer_variants = new TransferVariants
|
196
|
-
transfer_add_variants = new TransferAddVariants
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<script type='text/template' id='product_template'>
|
2
|
-
<li id="product_{{ product.id }}" data-product-id="{{product.id }}" class="columns three alpha small_product">
|
3
|
-
<div class="product-image">
|
4
|
-
{{#if product.image }}
|
5
|
-
<img src='{{product.image}}' alt='{{ product.name }}' />
|
6
|
-
{{ else }}
|
7
|
-
<img src='<%= image_path("noimage/small.png") %>' alt='{{product.name }}' />
|
8
|
-
{{/if}}
|
9
|
-
</div>
|
10
|
-
<a class="name">{{ product.name }}</a><br>
|
11
|
-
<span class="price">{{ product.display_price }}</span>
|
12
|
-
</li>
|
13
|
-
</script>
|
14
|
-
|
@@ -1,7 +0,0 @@
|
|
1
|
-
<script type='text/template' id='product_template_sortable'>
|
2
|
-
<a href="#" id="product_{{ id }}" data-product-id="{{ id }}" class="sort_item list-group-item">
|
3
|
-
<i class="fa fa-sort"></i>
|
4
|
-
<span class="product_name">{{ name }}</span>
|
5
|
-
<span class="right">{{ display_price }}</span>
|
6
|
-
</a>
|
7
|
-
</script>
|
@@ -1,21 +0,0 @@
|
|
1
|
-
<script type="text/x-handlebars-template" id="stock-item-count-for-location-template">
|
2
|
-
<tr data-variant-id="{{variantId}}">
|
3
|
-
<td class="align-center location-name-cell">{{stockLocationName}}</td>
|
4
|
-
<td class="align-center">
|
5
|
-
{{#if backorderable}}
|
6
|
-
<input id="backorderable-{{id}}" name="backorderable" type="checkbox" value="backorderable" disabled="disabled" checked="checked">
|
7
|
-
{{else}}
|
8
|
-
<input id="backorderable-{{id}}" name="backorderable" type="checkbox" value="backorderable" disabled="disabled">
|
9
|
-
{{/if}}
|
10
|
-
</td>
|
11
|
-
<td class="align-center" id="number-update-{{id}}">
|
12
|
-
<span class="js-number-update-text">{{countOnHand}}</span>
|
13
|
-
<input class="fullwidth js-number-update-input" name="count_on_hand" type="number" value="">
|
14
|
-
</td>
|
15
|
-
<td class="actions">
|
16
|
-
<a class="fa fa-edit icon_link with-tip no-text" data-action="edit" data-id="{{id}}" href="#"></a>
|
17
|
-
<a class="fa fa-check icon_link with-tip no-text" data-action="green" data-id="{{id}}" data-location-id="{{stockLocationId}}" href="#"></a>
|
18
|
-
<a class="fa fa-void icon_link with-tip no-text" data-action="red" data-id="{{id}}" href="#"></a>
|
19
|
-
</td>
|
20
|
-
</tr>
|
21
|
-
</script>
|
@@ -1,54 +0,0 @@
|
|
1
|
-
<script type="text/x-handlebars-template" id="transfer-item-template">
|
2
|
-
<tr class='new-row' data-transfer-item-id="{{id}}">
|
3
|
-
<td class="align-center no-padding">
|
4
|
-
<div class='variant-container' data-variant-id="{{variantId}}">
|
5
|
-
<div class='variant-image'>
|
6
|
-
{{#if variantImageURL }}
|
7
|
-
<img alt="{{variantName}}" src="{{variantImageURL}}">
|
8
|
-
{{ else }}
|
9
|
-
<img alt='{{variant.name}}' src='<%= image_path("noimage/small.png") %>' />
|
10
|
-
{{/if}}
|
11
|
-
</div>
|
12
|
-
<div class='variant-details'>
|
13
|
-
<table class='stock-variant-field-table'>
|
14
|
-
<tbody>
|
15
|
-
{{#each variantDisplayAttributes}}
|
16
|
-
<tr>
|
17
|
-
<td>{{this.label}}</td>
|
18
|
-
<td class="fullwidth">{{this.value}}</td>
|
19
|
-
</tr>
|
20
|
-
{{/each}}
|
21
|
-
</tbody>
|
22
|
-
</table>
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
</td>
|
26
|
-
<td class="align-center">
|
27
|
-
<table class='stock-variant-field-table'>
|
28
|
-
{{#each variantOptions}}
|
29
|
-
<tr>
|
30
|
-
<td>{{this.option_type}}</td>
|
31
|
-
<td>{{this.option_value}}</td>
|
32
|
-
</tr>
|
33
|
-
{{/each}}
|
34
|
-
</table>
|
35
|
-
</td>
|
36
|
-
<td class='align-center' id="number-update-{{id}}">
|
37
|
-
{{#if isReceiving }}
|
38
|
-
<span class='js-number-update-text'>{{receivedQuantity}}</span>
|
39
|
-
<input class="fullwidth js-number-update-input" name="received_quantity" type="number" value="">
|
40
|
-
{{ else }}
|
41
|
-
<span class='js-number-update-text'>{{expectedQuantity}}</span>
|
42
|
-
<input class="fullwidth js-number-update-input" name="expected_quantity" type="number" value="">
|
43
|
-
{{/if}}
|
44
|
-
</td>
|
45
|
-
<td class="actions">
|
46
|
-
<a class="fa fa-edit icon_link with-tip no-text" data-action="edit" data-id="{{id}}" href="#"></a>
|
47
|
-
<a class="fa fa-check icon_link with-tip no-text" data-action="green" data-id="{{id}}" href="#"></a>
|
48
|
-
<a class="fa fa-void icon_link with-tip no-text" data-action="red" data-id="{{id}}" href="#"></a>
|
49
|
-
{{#unless isReceiving }}
|
50
|
-
<a class="fa fa-trash icon_link with-tip no-text" data-action="remove" data-id="{{id}}" href="#"></a>
|
51
|
-
{{/unless}}
|
52
|
-
</td>
|
53
|
-
</tr>
|
54
|
-
</script>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<script type='text/template' id='variant_autocomplete_template'>
|
2
|
-
<div class="variant-autocomplete-item media">
|
3
|
-
<div class="media-left">
|
4
|
-
{{#if variant.image }}
|
5
|
-
<img class="media-object" src='{{variant.image}}' />
|
6
|
-
{{ else }}
|
7
|
-
<img class="media-object" src='<%= image_path("noimage/mini.png") %>' />
|
8
|
-
{{/if}}
|
9
|
-
</div>
|
10
|
-
|
11
|
-
<div class="media-body">
|
12
|
-
<h6 class="media-heading">{{variant.name}}</h6>
|
13
|
-
<dl class="dl-collapse">
|
14
|
-
{{#if variant.option_values}}
|
15
|
-
{{#each variant.option_values}}
|
16
|
-
<dt>{{this.option_type_presentation}}:</dt>
|
17
|
-
<dd>{{this.presentation}}</dd>
|
18
|
-
{{/each}}
|
19
|
-
{{/if}}
|
20
|
-
<dt><%= Spree.t(:sku) %></dt>
|
21
|
-
<dd>{{variant.sku}}</dd>
|
22
|
-
</dl>
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
</script>
|
@@ -1,69 +0,0 @@
|
|
1
|
-
<script type='text/template' id='variant_line_items_autocomplete_stock_template'>
|
2
|
-
<fieldset>
|
3
|
-
<legend align="center"><%= Spree.t(:select_stock) %></legend>
|
4
|
-
{{#if variant.track_inventory}}
|
5
|
-
<table class="stock-levels" data-hook="stock-levels">
|
6
|
-
<colgroup>
|
7
|
-
<col style="width: 30%;" />
|
8
|
-
<col style="width: 40%;" />
|
9
|
-
<col style="width: 30%;" />
|
10
|
-
</colgroup>
|
11
|
-
<thead>
|
12
|
-
<th><%= Spree.t(:name) %></th>
|
13
|
-
<th><%= Spree.t(:location) %></th>
|
14
|
-
<th><%= Spree.t(:count_on_hand) %></th>
|
15
|
-
<th><%= Spree.t(:quantity) %></th>
|
16
|
-
</thead>
|
17
|
-
<tbody>
|
18
|
-
{{#each variant.stock_items}}
|
19
|
-
<tr>
|
20
|
-
<td>{{#unless @index}}{{../../variant.name}}{{/unless}}</td>
|
21
|
-
<td>
|
22
|
-
{{stock_location_name}}
|
23
|
-
</td>
|
24
|
-
<td>
|
25
|
-
{{count_on_hand}}
|
26
|
-
</td>
|
27
|
-
<td>
|
28
|
-
<input class="quantity variant_quantity" id="quantity_{{@index}}" data-variant-id="{{../variant.id}}" data-stock-location-id="{{stock_location_id}}" type="number" min="0" value="0">
|
29
|
-
</td>
|
30
|
-
</tr>
|
31
|
-
{{/each}}
|
32
|
-
</tbody>
|
33
|
-
</table>
|
34
|
-
{{else}}
|
35
|
-
<table class="stock-levels untracked-inventory" data-hook="stock-levels">
|
36
|
-
<colgroup>
|
37
|
-
<col style="width: 30%;" />
|
38
|
-
<col style="width: 40%;" />
|
39
|
-
<col style="width: 30%;" />
|
40
|
-
</colgroup>
|
41
|
-
<thead>
|
42
|
-
<th><%= Spree.t(:name) %></th>
|
43
|
-
<th><%= Spree.t(:count_on_hand) %></th>
|
44
|
-
<th><%= Spree.t(:quantity) %></th>
|
45
|
-
</thead>
|
46
|
-
<tbody>
|
47
|
-
<tr>
|
48
|
-
<td>
|
49
|
-
{{variant.name}}
|
50
|
-
</td>
|
51
|
-
<td>
|
52
|
-
No inventory necessary
|
53
|
-
</td>
|
54
|
-
<td>
|
55
|
-
<input class="quantity" id="variant_quantity" data-variant-id="{{variant.id}}" type="number" min="0" value="0">
|
56
|
-
</td>
|
57
|
-
</tr>
|
58
|
-
</tbody>
|
59
|
-
</table>
|
60
|
-
{{/if}}
|
61
|
-
|
62
|
-
|
63
|
-
<fieldset class="no-border-bottom">
|
64
|
-
<legend align="center" class="stock-location">
|
65
|
-
<button class="add_variant no-text fa fa-plus icon_link" title="<%= Spree.t(:add) %>" data-action="add"><%= Spree.t(:add) %></button>
|
66
|
-
</legend>
|
67
|
-
</fieldset>
|
68
|
-
</fieldset>
|
69
|
-
</script>
|