spree_backend 2.0.13 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/admin/admin.js.erb +27 -23
- data/app/assets/javascripts/admin/checkouts/edit.js +12 -0
- data/app/assets/javascripts/admin/image_settings.js.erb +2 -1
- data/app/assets/javascripts/admin/option_type_autocomplete.js.erb +1 -4
- data/app/assets/javascripts/admin/product_picker.js +1 -2
- data/app/assets/javascripts/admin/progress.coffee +4 -4
- data/app/assets/javascripts/admin/shipments.js.erb +0 -243
- data/app/assets/javascripts/admin/spree_backend.js +3 -1
- data/app/assets/javascripts/admin/stock_transfer.js.coffee +8 -4
- data/app/assets/javascripts/admin/taxonomy.js.coffee +2 -2
- data/app/assets/javascripts/admin/variant_autocomplete.js.erb +243 -0
- data/app/assets/stylesheets/admin/components/_navigation.scss +2 -8
- data/app/assets/stylesheets/admin/hacks/_ie.scss +2 -1
- data/app/assets/stylesheets/admin/hacks/_mozilla.scss +1 -2
- data/app/assets/stylesheets/admin/plugins/_select2.scss +8 -11
- data/app/assets/stylesheets/admin/sections/_tax_zones.scss +15 -0
- data/app/assets/stylesheets/admin/shared/_forms.scss +0 -1
- data/app/assets/stylesheets/admin/shared/_icons.scss +1 -0
- data/app/assets/stylesheets/admin/shared/_layout.scss +0 -1
- data/app/assets/stylesheets/admin/shared/_tables.scss +1 -1
- data/app/assets/stylesheets/admin/spree_admin.scss +1 -0
- data/app/assets/stylesheets/admin/spree_backend.css +1 -0
- data/app/controllers/spree/admin/base_controller.rb +1 -1
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +10 -6
- data/app/controllers/spree/admin/orders_controller.rb +5 -4
- data/app/controllers/spree/admin/overview_controller.rb +0 -2
- data/app/controllers/spree/admin/payment_methods_controller.rb +7 -3
- data/app/controllers/spree/admin/payments_controller.rb +5 -13
- data/app/controllers/spree/admin/products_controller.rb +8 -0
- data/app/controllers/spree/admin/reports_controller.rb +16 -26
- data/app/controllers/spree/admin/resource_controller.rb +12 -8
- data/app/controllers/spree/admin/stock_items_controller.rb +5 -1
- data/app/controllers/spree/admin/stock_movements_controller.rb +5 -1
- data/app/controllers/spree/admin/stock_transfers_controller.rb +1 -1
- data/app/controllers/spree/admin/taxons_controller.rb +42 -16
- data/app/helpers/spree/admin/base_helper.rb +2 -2
- data/app/helpers/spree/admin/navigation_helper.rb +3 -6
- data/app/helpers/spree/admin/stock_movements_helper.rb +1 -12
- data/app/views/spree/admin/mail_methods/_form.html.erb +2 -2
- data/app/views/spree/admin/orders/_add_product.html.erb +0 -1
- data/app/views/spree/admin/orders/_form.html.erb +1 -5
- data/app/views/spree/admin/orders/_shipment.html.erb +2 -10
- data/app/views/spree/admin/orders/_shipment_manifest.html.erb +1 -1
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +2 -2
- data/app/views/spree/admin/orders/customer_details/edit.html.erb +1 -1
- data/app/views/spree/admin/orders/index.html.erb +4 -10
- data/app/views/spree/admin/payment_methods/_form.html.erb +2 -0
- data/app/views/spree/admin/payments/_form.html.erb +2 -2
- data/app/views/spree/admin/payments/_list.html.erb +2 -2
- data/app/views/spree/admin/payments/show.html.erb +2 -2
- data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +2 -3
- data/app/views/spree/admin/payments/source_views/_gateway.html.erb +15 -5
- data/app/views/spree/admin/products/_form.html.erb +59 -82
- data/app/views/spree/admin/products/index.html.erb +1 -1
- data/app/views/spree/admin/products/new.html.erb +6 -6
- data/app/views/spree/admin/products/stock.html.erb +4 -12
- data/app/views/spree/admin/promotion_rules/create.js.erb +0 -1
- data/app/views/spree/admin/promotions/_form.html.erb +5 -3
- data/app/views/spree/admin/prototypes/_form.html.erb +2 -2
- data/app/views/spree/admin/prototypes/show.html.erb +1 -1
- data/app/views/spree/admin/reports/sales_total.html.erb +1 -1
- data/app/views/spree/admin/return_authorizations/_form.html.erb +2 -2
- data/app/views/spree/admin/shared/_content_header.html.erb +23 -0
- data/app/views/spree/admin/shared/_destroy.js.erb +14 -5
- data/app/views/spree/admin/shared/_header.html.erb +9 -0
- data/app/views/spree/admin/shared/_menu.html.erb +9 -0
- data/app/views/spree/admin/shared/_order_tabs.html.erb +5 -5
- data/app/views/spree/admin/shared/_report_criteria.html.erb +2 -2
- data/app/views/spree/admin/shared/_routes.html.erb +1 -2
- data/app/views/spree/admin/shared/_sidebar.html.erb +10 -0
- data/app/views/spree/admin/shared/_sub_menu.html.erb +9 -0
- data/app/views/spree/admin/shared/_table_filter.html.erb +8 -0
- data/app/views/spree/admin/shared/_translations.html.erb +3 -6
- data/app/views/spree/admin/shipping_methods/_form.html.erb +5 -6
- data/app/views/spree/admin/shipping_methods/index.html.erb +1 -1
- data/app/views/spree/admin/stock_movements/_form.html.erb +4 -5
- data/app/views/spree/admin/stock_movements/index.html.erb +2 -4
- data/app/views/spree/admin/stock_transfers/show.html.erb +1 -1
- data/app/views/spree/admin/taxons/edit.html.erb +1 -1
- data/app/views/spree/admin/variants/_autocomplete.js.erb +51 -6
- data/app/views/spree/layouts/admin.html.erb +11 -81
- data/config/routes.rb +2 -4
- data/lib/spree/backend/engine.rb +0 -1
- data/vendor/assets/javascripts/css_browser_selector_dev.js +114 -141
- metadata +42 -31
- data/app/assets/javascripts/admin/line_items.js.coffee +0 -61
- data/app/assets/javascripts/admin/payments/edit.js.coffee +0 -148
- data/app/assets/javascripts/admin/stock_movement.js.coffee +0 -17
- data/app/assets/javascripts/admin/variant_management.js.coffee +0 -10
- data/app/assets/javascripts/spree/backend/select_payments.js.coffee +0 -7
- data/app/controllers/spree/admin/variants_including_master_controller.rb +0 -15
- data/app/views/spree/admin/orders/_line_items.html.erb +0 -46
- data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +0 -41
- data/app/views/spree/admin/variants/update.js.erb +0 -1
- data/vendor/assets/stylesheets/AdminLTE.css +0 -3535
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2447314964800e64a9f982e1b26653c897e06d0f
|
4
|
+
data.tar.gz: 983a63d82e29052149b7515d8670c6f7d0d60e95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8d4a40b8931039d01b1c069456f0d9222204c914cec92638b90694290e527c8d9fa9f5eeb737e2b38148b2eaacdcf73f6c99808b165acf141487894c0dc85a2
|
7
|
+
data.tar.gz: eec67f8663b064ba7b429391793cfe54417857bd30c27aa162927188221c5f6eb7e3e55adeb7ea296af67cbda28c7a1a352e167d68776c8d434d2134ec77be18
|
@@ -31,16 +31,18 @@ jQuery(function($) {
|
|
31
31
|
smartPlacement: true,
|
32
32
|
fadeInTime: 50,
|
33
33
|
fadeOutTime: 50,
|
34
|
+
intentPollInterval: 300
|
34
35
|
});
|
35
36
|
|
36
|
-
$('
|
37
|
-
|
38
|
-
$('#powerTip').addClass($(this).data
|
39
|
-
$('#powerTip').addClass($(this).data
|
40
|
-
}
|
41
|
-
|
42
|
-
$('#powerTip').removeClass($(this).data
|
43
|
-
}
|
37
|
+
$('.with-tip').on({
|
38
|
+
powerTipPreRender: function(){
|
39
|
+
$('#powerTip').addClass($(this).attr("data-action"));
|
40
|
+
$('#powerTip').addClass($(this).attr("data-tip-color"));
|
41
|
+
},
|
42
|
+
powerTipClose: function(){
|
43
|
+
$('#powerTip').removeClass($(this).attr("data-action"))
|
44
|
+
}
|
45
|
+
});
|
44
46
|
|
45
47
|
// Make flash messages dissapear
|
46
48
|
setTimeout('$(".flash").fadeOut()', 5000);
|
@@ -78,16 +80,20 @@ jQuery(function($) {
|
|
78
80
|
|
79
81
|
$.fn.visible = function(cond) { this[cond ? 'show' : 'hide' ]() };
|
80
82
|
|
81
|
-
|
82
|
-
|
83
|
-
if (
|
84
|
-
|
85
|
-
|
83
|
+
show_flash_error = function(message) {
|
84
|
+
error_div = $('.flash.error');
|
85
|
+
if (error_div.length > 0) {
|
86
|
+
error_div.html(message);
|
87
|
+
error_div.show();
|
88
|
+
} else {
|
89
|
+
if ($("#content .toolbar").length > 0) {
|
90
|
+
$("#content .toolbar").before('<div class="flash error">' + message + '</div>');
|
91
|
+
} else {
|
92
|
+
$("#content h1").before('<div class="flash error">' + message + '</div>');
|
93
|
+
}
|
86
94
|
}
|
87
|
-
flash_div.html(message).show().delay(5000).fadeOut(500);
|
88
95
|
}
|
89
96
|
|
90
|
-
|
91
97
|
// Apply to individual radio button that makes another element visible when checked
|
92
98
|
$.fn.radioControlsVisibilityOfElement = function(dependentElementSelector){
|
93
99
|
if(!this.get(0)){ return }
|
@@ -147,8 +153,8 @@ $(document).ready(function(){
|
|
147
153
|
new_table_row.find("input, select").each(function () {
|
148
154
|
var el = $(this);
|
149
155
|
el.val("");
|
150
|
-
|
151
|
-
|
156
|
+
el.attr("id", el.attr("id").replace(/\d+/, new_id))
|
157
|
+
el.attr("name", el.attr("name").replace(/\d+/, new_id))
|
152
158
|
})
|
153
159
|
// When cloning a new row, set the href of all icons to be an empty "#"
|
154
160
|
// This is so that clicking on them does not perform the actions for the
|
@@ -170,14 +176,12 @@ $(document).ready(function(){
|
|
170
176
|
_method: 'delete',
|
171
177
|
authenticity_token: AUTH_TOKEN
|
172
178
|
},
|
173
|
-
dataType: '
|
179
|
+
dataType: 'html',
|
174
180
|
success: function(response) {
|
175
|
-
el.parents("tr").fadeOut('hide'
|
176
|
-
$(this).remove();
|
177
|
-
});
|
181
|
+
el.parents("tr").fadeOut('hide');
|
178
182
|
},
|
179
183
|
error: function(response, textStatus, errorThrown) {
|
180
|
-
|
184
|
+
show_flash_error(response.responseText);
|
181
185
|
}
|
182
186
|
});
|
183
187
|
}
|
@@ -202,7 +206,7 @@ $(document).ready(function(){
|
|
202
206
|
el.parents("tr").fadeOut('hide');
|
203
207
|
},
|
204
208
|
error: function(response, textStatus, errorThrown) {
|
205
|
-
|
209
|
+
show_flash_error(response.responseText);
|
206
210
|
}
|
207
211
|
|
208
212
|
})
|
@@ -1,8 +1,20 @@
|
|
1
|
+
//= require_self
|
2
|
+
//= require jquery.payment
|
1
3
|
$(document).ready(function() {
|
2
4
|
if ($('#customer_autocomplete_template').length > 0) {
|
3
5
|
window.customerTemplate = Handlebars.compile($('#customer_autocomplete_template').text());
|
4
6
|
}
|
5
7
|
|
8
|
+
if ($("#card_number").is("*")) {
|
9
|
+
$("#card_number").payment('formatCardNumber')
|
10
|
+
$("#card_expiry").payment('formatCardExpiry')
|
11
|
+
$("#card_code").payment('formatCardCVC')
|
12
|
+
|
13
|
+
$("#card_number").change(function() {
|
14
|
+
$("#cc_type").val($.payment.cardType(this.value))
|
15
|
+
})
|
16
|
+
}
|
17
|
+
|
6
18
|
formatCustomerResult = function(customer) {
|
7
19
|
return customerTemplate({
|
8
20
|
customer: customer,
|
@@ -25,9 +25,10 @@ $(document).ready(function() {
|
|
25
25
|
});
|
26
26
|
|
27
27
|
// Handle adding new styles
|
28
|
+
var styles_hash_index = 1;
|
28
29
|
$(document).on('click', '.add_new_style', function(e) {
|
29
30
|
e.preventDefault();
|
30
|
-
$('#new-styles').append(generate_html_for_hash("new_attachment_styles",
|
31
|
+
$('#new-styles').append(generate_html_for_hash("new_attachment_styles", styles_hash_index));
|
31
32
|
});
|
32
33
|
|
33
34
|
// Handle adding new headers
|
@@ -6,10 +6,7 @@ $(document).ready(function () {
|
|
6
6
|
placeholder: Spree.translations.option_type_placeholder,
|
7
7
|
multiple: true,
|
8
8
|
initSelection: function (element, callback) {
|
9
|
-
|
10
|
-
ids: element.val()
|
11
|
-
});
|
12
|
-
return $.getJSON(url, null, function (data) {
|
9
|
+
return $.getJSON(Spree.routes.option_type_search + '?ids=' + (element.val()), null, function (data) {
|
13
10
|
return callback(data);
|
14
11
|
});
|
15
12
|
},
|
@@ -16,12 +16,12 @@ $(document).ready ->
|
|
16
16
|
top: 'auto'
|
17
17
|
left: 'auto'
|
18
18
|
|
19
|
-
target = document.getElementById("spinner")
|
19
|
+
target = document.getElementById("spinner")
|
20
20
|
|
21
21
|
$(document).ajaxStart ->
|
22
|
-
$("#progress").
|
23
|
-
spinner = new Spinner(opts).spin(target)
|
22
|
+
$("#progress").fadeIn()
|
23
|
+
spinner = new Spinner(opts).spin(target)
|
24
24
|
|
25
25
|
$(document).ajaxStop ->
|
26
|
-
$("#progress").fadeOut()
|
26
|
+
$("#progress").fadeOut()
|
27
27
|
|
@@ -2,62 +2,6 @@
|
|
2
2
|
$(document).ready(function () {
|
3
3
|
'use strict';
|
4
4
|
|
5
|
-
// handle variant selection, show stock level.
|
6
|
-
$('#add_variant_id').change(function(){
|
7
|
-
var variant_id = $(this).val();
|
8
|
-
|
9
|
-
var variant = _.find(window.variants, function(variant){
|
10
|
-
return variant.id == variant_id
|
11
|
-
})
|
12
|
-
$('#stock_details').html(variantStockTemplate({variant: variant}));
|
13
|
-
$('#stock_details').show();
|
14
|
-
|
15
|
-
$('button.add_variant').click(addVariantFromStockLocation);
|
16
|
-
|
17
|
-
// Add some tips
|
18
|
-
$('.with-tip').powerTip({
|
19
|
-
smartPlacement: true,
|
20
|
-
fadeInTime: 50,
|
21
|
-
fadeOutTime: 50,
|
22
|
-
intentPollInterval: 300
|
23
|
-
});
|
24
|
-
|
25
|
-
});
|
26
|
-
|
27
|
-
//handle edit click
|
28
|
-
$('a.edit-item').click(toggleItemEdit);
|
29
|
-
|
30
|
-
//handle cancel click
|
31
|
-
$('a.cancel-item').click(toggleItemEdit);
|
32
|
-
|
33
|
-
//handle split click
|
34
|
-
$('a.split-item').click(startItemSplit);
|
35
|
-
|
36
|
-
//handle save click
|
37
|
-
$('a.save-item').click(function(){
|
38
|
-
var save = $(this);
|
39
|
-
var shipment_number = save.data('shipment-number');
|
40
|
-
var variant_id = save.data('variant-id');
|
41
|
-
|
42
|
-
var quantity = parseInt(save.parents('tr').find('input.line_item_quantity').val());
|
43
|
-
|
44
|
-
toggleItemEdit();
|
45
|
-
adjustShipmentItems(shipment_number, variant_id, quantity);
|
46
|
-
return false;
|
47
|
-
});
|
48
|
-
|
49
|
-
//handle delete click
|
50
|
-
$('a.delete-item').click(function(){
|
51
|
-
if (confirm(Spree.translations.are_you_sure_delete)) {
|
52
|
-
var del = $(this);
|
53
|
-
var shipment_number = del.data('shipment-number');
|
54
|
-
var variant_id = del.data('variant-id');
|
55
|
-
|
56
|
-
toggleItemEdit();
|
57
|
-
adjustShipmentItems(shipment_number, variant_id, 0);
|
58
|
-
}
|
59
|
-
});
|
60
|
-
|
61
5
|
// handle ship click
|
62
6
|
$('[data-hook=admin_order_edit_form] a.ship').on('click', function () {
|
63
7
|
var link = $(this);
|
@@ -128,190 +72,3 @@ $(document).ready(function () {
|
|
128
72
|
});
|
129
73
|
|
130
74
|
});
|
131
|
-
|
132
|
-
|
133
|
-
adjustShipmentItems = function(shipment_number, variant_id, quantity){
|
134
|
-
var shipment = _.findWhere(shipments, {number: shipment_number + ''});
|
135
|
-
var inventory_units = _.where(shipment.inventory_units, {variant_id: variant_id});
|
136
|
-
|
137
|
-
var url = Spree.routes.orders_api + "/" + order_number + "/shipments/" + shipment_number;
|
138
|
-
|
139
|
-
var new_quantity = 0;
|
140
|
-
if(inventory_units.length<quantity){
|
141
|
-
url += "/add"
|
142
|
-
new_quantity = (quantity - inventory_units.length);
|
143
|
-
}else if(inventory_units.length>quantity){
|
144
|
-
url += "/remove"
|
145
|
-
new_quantity = (inventory_units.length - quantity);
|
146
|
-
}
|
147
|
-
url += '.json';
|
148
|
-
|
149
|
-
if(new_quantity!=0){
|
150
|
-
$.ajax({
|
151
|
-
type: "PUT",
|
152
|
-
url: Spree.url(url),
|
153
|
-
data: { variant_id: variant_id, quantity: new_quantity }
|
154
|
-
}).done(function( msg ) {
|
155
|
-
advanceOrder();
|
156
|
-
});
|
157
|
-
}
|
158
|
-
}
|
159
|
-
|
160
|
-
toggleTrackingEdit = function(){
|
161
|
-
var link = $(this);
|
162
|
-
link.parents('tbody').find('tr.edit-tracking').toggle();
|
163
|
-
link.parents('tbody').find('tr.show-tracking').toggle();
|
164
|
-
}
|
165
|
-
|
166
|
-
toggleMethodEdit = function(){
|
167
|
-
var link = $(this);
|
168
|
-
link.parents('tbody').find('tr.edit-method').toggle();
|
169
|
-
link.parents('tbody').find('tr.show-method').toggle();
|
170
|
-
}
|
171
|
-
|
172
|
-
toggleItemEdit = function(){
|
173
|
-
var link = $(this);
|
174
|
-
link.parent().find('a.edit-item').toggle();
|
175
|
-
link.parent().find('a.cancel-item').toggle();
|
176
|
-
link.parent().find('a.split-item').toggle();
|
177
|
-
link.parent().find('a.save-item').toggle();
|
178
|
-
link.parent().find('a.delete-item').toggle();
|
179
|
-
link.parents('tr').find('td.item-qty-show').toggle();
|
180
|
-
link.parents('tr').find('td.item-qty-edit').toggle();
|
181
|
-
|
182
|
-
return false;
|
183
|
-
}
|
184
|
-
|
185
|
-
startItemSplit = function(event){
|
186
|
-
event.preventDefault();
|
187
|
-
var link = $(this);
|
188
|
-
link.parent().find('a.edit-item').toggle();
|
189
|
-
link.parent().find('a.split-item').toggle();
|
190
|
-
link.parent().find('a.delete-item').toggle();
|
191
|
-
var variant_id = link.data('variant-id');
|
192
|
-
|
193
|
-
var variant = {};
|
194
|
-
$.ajax({
|
195
|
-
type: "GET",
|
196
|
-
async: false,
|
197
|
-
url: Spree.url(Spree.routes.variants_api),
|
198
|
-
data: {
|
199
|
-
q: {
|
200
|
-
"id_eq": variant_id
|
201
|
-
}
|
202
|
-
}
|
203
|
-
}).success(function( data ) {
|
204
|
-
variant = data['variants'][0];
|
205
|
-
}).error(function( msg ) {
|
206
|
-
console.log(msg);
|
207
|
-
});
|
208
|
-
|
209
|
-
var max_quantity = link.closest('tr').data('item-quantity');
|
210
|
-
var split_item_template = Handlebars.compile($('#variant_split_template').text());
|
211
|
-
link.closest('tr').after(split_item_template({ variant: variant, shipments: shipments, max_quantity: max_quantity }));
|
212
|
-
$('a.cancel-split').click(cancelItemSplit);
|
213
|
-
$('a.save-split').click(completeItemSplit);
|
214
|
-
|
215
|
-
// Add some tips
|
216
|
-
$('.with-tip').powerTip({
|
217
|
-
smartPlacement: true,
|
218
|
-
fadeInTime: 50,
|
219
|
-
fadeOutTime: 50,
|
220
|
-
intentPollInterval: 300
|
221
|
-
});
|
222
|
-
$('#item_stock_location').select2({ width: 'resolve', placeholder: 'Choose Location' });
|
223
|
-
}
|
224
|
-
|
225
|
-
completeItemSplit = function(event) {
|
226
|
-
event.preventDefault();
|
227
|
-
var link = $(this);
|
228
|
-
var order_number = link.closest('tbody').data('order-number');
|
229
|
-
var stock_item_row = link.closest('tr');
|
230
|
-
var variant_id = stock_item_row.data('variant-id');
|
231
|
-
var quantity = stock_item_row.find('#item_quantity').val();
|
232
|
-
|
233
|
-
var stock_location_id = stock_item_row.find('#item_stock_location').val();
|
234
|
-
var original_shipment_number = link.closest('tbody').data('shipment-number');
|
235
|
-
|
236
|
-
var selected_shipment = stock_item_row.find($('#item_stock_location').select2('data').element);
|
237
|
-
var target_shipment_number = selected_shipment.data('shipment-number');
|
238
|
-
var new_shipment = selected_shipment.data('new-shipment');
|
239
|
-
|
240
|
-
if (stock_location_id != 'new_shipment') {
|
241
|
-
// first remove item(s) from original shipment
|
242
|
-
$.ajax({
|
243
|
-
type: "PUT",
|
244
|
-
async: false,
|
245
|
-
url: Spree.url(Spree.routes.orders_api + "/" + order_number + "/shipments/" + original_shipment_number + "/remove.json"),
|
246
|
-
data: { variant_id: variant_id, quantity: quantity }
|
247
|
-
});
|
248
|
-
|
249
|
-
if (new_shipment != undefined) {
|
250
|
-
$.ajax({
|
251
|
-
type: "POST",
|
252
|
-
async: false,
|
253
|
-
url: Spree.url(Spree.routes.orders_api + "/" + order_number + "/shipments.json"),
|
254
|
-
data: { variant_id: variant_id, quantity: quantity, stock_location_id: stock_location_id }
|
255
|
-
}).done(function(msg) {
|
256
|
-
advanceOrder();
|
257
|
-
});
|
258
|
-
} else {
|
259
|
-
$.ajax({
|
260
|
-
type: "PUT",
|
261
|
-
async: false,
|
262
|
-
url: Spree.url(Spree.routes.orders_api + "/" + order_number + "/shipments/" + target_shipment_number + "/add.json"),
|
263
|
-
data: { variant_id: variant_id, quantity: quantity }
|
264
|
-
}).done(function(msg) {
|
265
|
-
advanceOrder();
|
266
|
-
});
|
267
|
-
}
|
268
|
-
}
|
269
|
-
}
|
270
|
-
|
271
|
-
advanceOrder = function() {
|
272
|
-
$.ajax({
|
273
|
-
type: "PUT",
|
274
|
-
async: false,
|
275
|
-
url: Spree.url(Spree.routes.checkouts_api + "/" + order_number + "/advance")
|
276
|
-
}).done(function() {
|
277
|
-
window.location.reload();
|
278
|
-
});
|
279
|
-
}
|
280
|
-
|
281
|
-
cancelItemSplit = function(event) {
|
282
|
-
event.preventDefault();
|
283
|
-
var link = $(this);
|
284
|
-
var prev_row = link.closest('tr').prev();
|
285
|
-
link.closest('tr').remove();
|
286
|
-
prev_row.find('a.edit-item').toggle();
|
287
|
-
prev_row.find('a.split-item').toggle();
|
288
|
-
prev_row.find('a.delete-item').toggle();
|
289
|
-
}
|
290
|
-
|
291
|
-
addVariantFromStockLocation = function() {
|
292
|
-
$('#stock_details').hide();
|
293
|
-
|
294
|
-
var variant_id = $('input.variant_autocomplete').val();
|
295
|
-
var stock_location_id = $(this).data('stock-location-id');
|
296
|
-
var quantity = $("input.quantity[data-stock-location-id='" + stock_location_id + "']").val();
|
297
|
-
|
298
|
-
var shipment = _.find(shipments, function(shipment){
|
299
|
-
return shipment.stock_location_id == stock_location_id && (shipment.state == 'ready' || shipment.state == 'pending');
|
300
|
-
});
|
301
|
-
|
302
|
-
if(shipment==undefined){
|
303
|
-
$.ajax({
|
304
|
-
type: "POST",
|
305
|
-
url: Spree.url(Spree.routes.orders_api + "/" + order_number + "/shipments.json"),
|
306
|
-
data: { variant_id: variant_id, quantity: quantity, stock_location_id: stock_location_id }
|
307
|
-
}).done(function( msg ) {
|
308
|
-
advanceOrder();
|
309
|
-
}).error(function( msg ) {
|
310
|
-
console.log(msg);
|
311
|
-
});
|
312
|
-
}else{
|
313
|
-
//add to existing shipment
|
314
|
-
adjustShipmentItems(shipment.number, variant_id, quantity);
|
315
|
-
}
|
316
|
-
return 1
|
317
|
-
}
|
@@ -30,7 +30,7 @@ $ ->
|
|
30
30
|
|
31
31
|
$('#transfer_receive_stock').change (event) => @receive_stock_change(event)
|
32
32
|
|
33
|
-
$.getJSON Spree.
|
33
|
+
$.getJSON Spree.routes.stock_locations_api, (data) =>
|
34
34
|
@locations = (location for location in data.stock_locations)
|
35
35
|
@force_receive_stock() if @locations.length < 2
|
36
36
|
|
@@ -69,7 +69,9 @@ $ ->
|
|
69
69
|
populate_select: (select, except=0) ->
|
70
70
|
select.children('option').remove()
|
71
71
|
for location in @locations when location.id isnt except
|
72
|
-
select.append $('<option></option>')
|
72
|
+
select.append $('<option></option>')
|
73
|
+
.text(location.name)
|
74
|
+
.attr('value', location.id)
|
73
75
|
select.select2()
|
74
76
|
|
75
77
|
# Populates variants drop down
|
@@ -90,13 +92,13 @@ $ ->
|
|
90
92
|
if @cached_variants?
|
91
93
|
@populate_select @cached_variants
|
92
94
|
else
|
93
|
-
$.getJSON Spree.
|
95
|
+
$.getJSON Spree.routes.variants_api, (data) =>
|
94
96
|
@cached_variants = _.map(data.variants, (variant) -> new TransferVariant(variant))
|
95
97
|
@populate_select @cached_variants
|
96
98
|
|
97
99
|
_refresh_transfer_stock_items: ->
|
98
100
|
stock_location_id = $('#transfer_source_location_id').val()
|
99
|
-
$.getJSON Spree.
|
101
|
+
$.getJSON Spree.routes.stock_locations_api + "/#{stock_location_id}/stock_items", (data) =>
|
100
102
|
@populate_select _.map(data.stock_items, (stock_item) -> new TransferStockItem(stock_item))
|
101
103
|
|
102
104
|
populate_select: (variants) ->
|
@@ -175,3 +177,5 @@ $ ->
|
|
175
177
|
transfer_locations = new TransferLocations
|
176
178
|
transfer_variants = new TransferVariants
|
177
179
|
transfer_add_variants = new TransferAddVariants
|
180
|
+
|
181
|
+
|
@@ -14,7 +14,7 @@ handle_move = (e, data) ->
|
|
14
14
|
type: "POST",
|
15
15
|
dataType: "json",
|
16
16
|
url: url.toString(),
|
17
|
-
data: ({_method: "put", "taxon[parent_id]": new_parent.attr("id"), "taxon[
|
17
|
+
data: ({_method: "put", "taxon[parent_id]": new_parent.attr("id"), "taxon[position]": position }),
|
18
18
|
error: handle_ajax_error
|
19
19
|
|
20
20
|
true
|
@@ -30,7 +30,7 @@ handle_create = (e, data) ->
|
|
30
30
|
type: "POST",
|
31
31
|
dataType: "json",
|
32
32
|
url: base_url.toString(),
|
33
|
-
data: ({"taxon[name]": name, "taxon[parent_id]": new_parent.attr("id")}),
|
33
|
+
data: ({"taxon[name]": name, "taxon[parent_id]": new_parent.attr("id"), "taxon[position]": position }),
|
34
34
|
error: handle_ajax_error,
|
35
35
|
success: (data,result) ->
|
36
36
|
node.attr('id', data.id)
|