spree_backend 2.0.7 → 2.0.8
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 +10 -9
- data/app/assets/javascripts/admin/line_items.js.coffee +61 -0
- data/app/assets/javascripts/admin/payments/edit.js.coffee +1 -1
- data/app/assets/javascripts/admin/product_picker.js +2 -1
- data/app/assets/javascripts/admin/shipments.js.erb +243 -0
- data/app/assets/javascripts/admin/variant_autocomplete.js.erb +0 -244
- data/app/assets/javascripts/admin/variant_management.js.coffee +10 -0
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +4 -0
- data/app/controllers/spree/admin/orders_controller.rb +3 -4
- data/app/controllers/spree/admin/payments_controller.rb +4 -0
- data/app/controllers/spree/admin/reports_controller.rb +20 -4
- data/app/controllers/spree/admin/resource_controller.rb +6 -3
- data/app/controllers/spree/admin/variants_including_master_controller.rb +15 -0
- data/app/helpers/spree/admin/base_helper.rb +1 -1
- data/app/helpers/spree/admin/navigation_helper.rb +5 -2
- data/app/helpers/spree/admin/stock_movements_helper.rb +5 -1
- data/app/views/spree/admin/mail_methods/_form.html.erb +2 -2
- data/app/views/spree/admin/orders/_form.html.erb +5 -1
- data/app/views/spree/admin/orders/_line_items.html.erb +46 -0
- data/app/views/spree/admin/orders/_shipment.html.erb +10 -2
- data/app/views/spree/admin/orders/customer_details/edit.html.erb +1 -1
- data/app/views/spree/admin/orders/index.html.erb +10 -4
- data/app/views/spree/admin/payment_methods/_form.html.erb +0 -2
- data/app/views/spree/admin/products/_form.html.erb +0 -1
- data/app/views/spree/admin/products/stock.html.erb +9 -0
- data/app/views/spree/admin/shared/_destroy.js.erb +5 -14
- data/app/views/spree/admin/shared/_order_tabs.html.erb +4 -4
- data/app/views/spree/admin/variants/update.js.erb +1 -0
- data/config/routes.rb +1 -0
- metadata +24 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3c7d240755279b9b1986b47039266db4ca6b87f
|
4
|
+
data.tar.gz: 1967d9b543c924495c3d8ec0155a56aa5b6e5822
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f775eddc2be3f07de1afc10dc055aca996de2a9e7414d49147d99016c9653a54a469f66b7943503cacaa89c34653556904fe088c43866bc5d16fa4f8772c3b2
|
7
|
+
data.tar.gz: 4d1a6db7a3b72b22d5438e1d9fbc5f63f2823387c4bad175827d57e963b328fd767b26f740436e6ec81f7aefde47a6d0745cfee135ed5562c1e44dc60171bb96
|
@@ -78,15 +78,16 @@ jQuery(function($) {
|
|
78
78
|
|
79
79
|
$.fn.visible = function(cond) { this[cond ? 'show' : 'hide' ]() };
|
80
80
|
|
81
|
-
|
82
|
-
var
|
83
|
-
if (
|
84
|
-
|
85
|
-
$('#wrapper').prepend(
|
81
|
+
show_flash = function(type, message) {
|
82
|
+
var flash_div = $('.flash.' + type);
|
83
|
+
if (flash_div.length == 0) {
|
84
|
+
flash_div = $('<div class="flash ' + type + '" />');
|
85
|
+
$('#wrapper').prepend(flash_div);
|
86
86
|
}
|
87
|
-
|
87
|
+
flash_div.html(message).show().delay(5000).fadeOut(500);
|
88
88
|
}
|
89
89
|
|
90
|
+
|
90
91
|
// Apply to individual radio button that makes another element visible when checked
|
91
92
|
$.fn.radioControlsVisibilityOfElement = function(dependentElementSelector){
|
92
93
|
if(!this.get(0)){ return }
|
@@ -169,12 +170,12 @@ $(document).ready(function(){
|
|
169
170
|
_method: 'delete',
|
170
171
|
authenticity_token: AUTH_TOKEN
|
171
172
|
},
|
172
|
-
dataType: '
|
173
|
+
dataType: 'script',
|
173
174
|
success: function(response) {
|
174
175
|
el.parents("tr").fadeOut('hide');
|
175
176
|
},
|
176
177
|
error: function(response, textStatus, errorThrown) {
|
177
|
-
|
178
|
+
show_flash('error', response.responseText);
|
178
179
|
}
|
179
180
|
});
|
180
181
|
}
|
@@ -199,7 +200,7 @@ $(document).ready(function(){
|
|
199
200
|
el.parents("tr").fadeOut('hide');
|
200
201
|
},
|
201
202
|
error: function(response, textStatus, errorThrown) {
|
202
|
-
|
203
|
+
show_flash('error', response.responseText);
|
203
204
|
}
|
204
205
|
|
205
206
|
})
|
@@ -0,0 +1,61 @@
|
|
1
|
+
$(document).ready ->
|
2
|
+
#handle edit click
|
3
|
+
$('a.edit-line-item').click toggleLineItemEdit
|
4
|
+
|
5
|
+
#handle cancel click
|
6
|
+
$('a.cancel-line-item').click toggleLineItemEdit
|
7
|
+
|
8
|
+
#handle save click
|
9
|
+
$('a.save-line-item').click ->
|
10
|
+
save = $ this
|
11
|
+
line_item_id = save.data('line-item-id')
|
12
|
+
quantity = parseInt(save.parents('tr').find('input.line_item_quantity').val())
|
13
|
+
|
14
|
+
toggleItemEdit()
|
15
|
+
adjustLineItem(line_item_id, quantity)
|
16
|
+
false
|
17
|
+
|
18
|
+
# handle delete click
|
19
|
+
$('a.delete-line-item').click ->
|
20
|
+
if confirm(Spree.translations.are_you_sure_delete)
|
21
|
+
del = $(this);
|
22
|
+
line_item_id = del.data('line-item-id');
|
23
|
+
|
24
|
+
toggleItemEdit()
|
25
|
+
deleteLineItem(line_item_id)
|
26
|
+
|
27
|
+
toggleLineItemEdit = ->
|
28
|
+
link = $(this);
|
29
|
+
link.parent().find('a.edit-line-item').toggle();
|
30
|
+
link.parent().find('a.cancel-line-item').toggle();
|
31
|
+
link.parent().find('a.save-line-item').toggle();
|
32
|
+
link.parent().find('a.delete-line-item').toggle();
|
33
|
+
link.parents('tr').find('td.line-item-qty-show').toggle();
|
34
|
+
link.parents('tr').find('td.line-item-qty-edit').toggle();
|
35
|
+
|
36
|
+
false
|
37
|
+
|
38
|
+
lineItemURL = (line_item_id) ->
|
39
|
+
url = Spree.routes.orders_api + "/" + order_number + "/line_items/" + line_item_id + ".json"
|
40
|
+
|
41
|
+
adjustLineItem = (line_item_id, quantity) ->
|
42
|
+
url = lineItemURL(line_item_id)
|
43
|
+
$.ajax(
|
44
|
+
type: "PUT",
|
45
|
+
url: Spree.url(url),
|
46
|
+
data:
|
47
|
+
line_item:
|
48
|
+
quantity: quantity
|
49
|
+
).done (msg) ->
|
50
|
+
advanceOrder()
|
51
|
+
|
52
|
+
deleteLineItem = (line_item_id) ->
|
53
|
+
url = lineItemURL(line_item_id)
|
54
|
+
$.ajax(
|
55
|
+
type: "DELETE"
|
56
|
+
url: Spree.url(url)
|
57
|
+
).done (msg) ->
|
58
|
+
$('#line-item-' + line_item_id).remove()
|
59
|
+
if $('.line-items tr.line-item').length == 0
|
60
|
+
$('.line-items').remove()
|
61
|
+
advanceOrder()
|
@@ -2,6 +2,62 @@
|
|
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
|
+
|
5
61
|
// handle ship click
|
6
62
|
$('[data-hook=admin_order_edit_form] a.ship').on('click', function () {
|
7
63
|
var link = $(this);
|
@@ -72,3 +128,190 @@ $(document).ready(function () {
|
|
72
128
|
});
|
73
129
|
|
74
130
|
});
|
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
|
+
}
|
@@ -6,253 +6,9 @@ $(document).ready(function() {
|
|
6
6
|
if ($('#variant_autocomplete_template').length > 0) {
|
7
7
|
window.variantTemplate = Handlebars.compile($('#variant_autocomplete_template').text());
|
8
8
|
window.variantStockTemplate = Handlebars.compile($('#variant_autocomplete_stock_template').text());
|
9
|
-
|
10
|
-
// handle variant selection, show stock level.
|
11
|
-
$('#add_variant_id').change(function(){
|
12
|
-
var variant_id = $(this).val();
|
13
|
-
|
14
|
-
var variant = _.find(window.variants, function(variant){
|
15
|
-
return variant.id == variant_id
|
16
|
-
})
|
17
|
-
$('#stock_details').html(variantStockTemplate({variant: variant}));
|
18
|
-
$('#stock_details').show();
|
19
|
-
|
20
|
-
$('button.add_variant').click(addVariantFromStockLocation);
|
21
|
-
|
22
|
-
// Add some tips
|
23
|
-
$('.with-tip').powerTip({
|
24
|
-
smartPlacement: true,
|
25
|
-
fadeInTime: 50,
|
26
|
-
fadeOutTime: 50,
|
27
|
-
intentPollInterval: 300
|
28
|
-
});
|
29
|
-
|
30
|
-
});
|
31
|
-
|
32
|
-
//handle edit click
|
33
|
-
$('a.edit-item').click(toggleItemEdit);
|
34
|
-
|
35
|
-
//handle cancel click
|
36
|
-
$('a.cancel-item').click(toggleItemEdit);
|
37
|
-
|
38
|
-
//handle split click
|
39
|
-
$('a.split-item').click(startItemSplit);
|
40
|
-
|
41
|
-
//handle save click
|
42
|
-
$('a.save-item').click(function(){
|
43
|
-
var save = $(this);
|
44
|
-
var shipment_number = save.data('shipment-number');
|
45
|
-
var variant_id = save.data('variant-id');
|
46
|
-
|
47
|
-
var quantity = parseInt(save.parents('tr').find('input.line_item_quantity').val());
|
48
|
-
|
49
|
-
toggleItemEdit();
|
50
|
-
|
51
|
-
adjustItems(shipment_number, variant_id, quantity);
|
52
|
-
return false;
|
53
|
-
});
|
54
|
-
|
55
|
-
//handle delete click
|
56
|
-
$('a.delete-item').click(function(){
|
57
|
-
if (confirm(Spree.translations.are_you_sure_delete)) {
|
58
|
-
var del = $(this);
|
59
|
-
var shipment_number = del.data('shipment-number');
|
60
|
-
var variant_id = del.data('variant-id');
|
61
|
-
|
62
|
-
toggleItemEdit();
|
63
|
-
|
64
|
-
adjustItems(shipment_number, variant_id, 0);
|
65
|
-
}
|
66
|
-
});
|
67
9
|
}
|
68
10
|
});
|
69
11
|
|
70
|
-
adjustItems = function(shipment_number, variant_id, quantity){
|
71
|
-
var shipment = _.findWhere(shipments, {number: shipment_number + ''});
|
72
|
-
var inventory_units = _.where(shipment.inventory_units, {variant_id: variant_id});
|
73
|
-
|
74
|
-
var url = Spree.routes.orders_api + "/" + order_number + "/shipments/" + shipment_number;
|
75
|
-
|
76
|
-
var new_quantity = 0;
|
77
|
-
if(inventory_units.length<quantity){
|
78
|
-
url += "/add"
|
79
|
-
new_quantity = (quantity - inventory_units.length);
|
80
|
-
}else if(inventory_units.length>quantity){
|
81
|
-
url += "/remove"
|
82
|
-
new_quantity = (inventory_units.length - quantity);
|
83
|
-
}
|
84
|
-
url += '.json';
|
85
|
-
|
86
|
-
if(new_quantity!=0){
|
87
|
-
$.ajax({
|
88
|
-
type: "PUT",
|
89
|
-
url: Spree.url(url),
|
90
|
-
data: { variant_id: variant_id, quantity: new_quantity }
|
91
|
-
}).done(function( msg ) {
|
92
|
-
advanceOrder();
|
93
|
-
});
|
94
|
-
}
|
95
|
-
}
|
96
|
-
|
97
|
-
toggleTrackingEdit = function(){
|
98
|
-
var link = $(this);
|
99
|
-
link.parents('tbody').find('tr.edit-tracking').toggle();
|
100
|
-
link.parents('tbody').find('tr.show-tracking').toggle();
|
101
|
-
}
|
102
|
-
|
103
|
-
toggleMethodEdit = function(){
|
104
|
-
var link = $(this);
|
105
|
-
link.parents('tbody').find('tr.edit-method').toggle();
|
106
|
-
link.parents('tbody').find('tr.show-method').toggle();
|
107
|
-
}
|
108
|
-
|
109
|
-
toggleItemEdit = function(){
|
110
|
-
var link = $(this);
|
111
|
-
link.parent().find('a.edit-item').toggle();
|
112
|
-
link.parent().find('a.cancel-item').toggle();
|
113
|
-
link.parent().find('a.split-item').toggle();
|
114
|
-
link.parent().find('a.save-item').toggle();
|
115
|
-
link.parent().find('a.delete-item').toggle();
|
116
|
-
link.parents('tr').find('td.item-qty-show').toggle();
|
117
|
-
link.parents('tr').find('td.item-qty-edit').toggle();
|
118
|
-
|
119
|
-
return false;
|
120
|
-
}
|
121
|
-
|
122
|
-
startItemSplit = function(event){
|
123
|
-
event.preventDefault();
|
124
|
-
var link = $(this);
|
125
|
-
link.parent().find('a.edit-item').toggle();
|
126
|
-
link.parent().find('a.split-item').toggle();
|
127
|
-
link.parent().find('a.delete-item').toggle();
|
128
|
-
var variant_id = link.data('variant-id');
|
129
|
-
|
130
|
-
var variant = {};
|
131
|
-
$.ajax({
|
132
|
-
type: "GET",
|
133
|
-
async: false,
|
134
|
-
url: Spree.url(Spree.routes.variants_api),
|
135
|
-
data: {
|
136
|
-
q: {
|
137
|
-
"id_eq": variant_id
|
138
|
-
}
|
139
|
-
}
|
140
|
-
}).success(function( data ) {
|
141
|
-
variant = data['variants'][0];
|
142
|
-
}).error(function( msg ) {
|
143
|
-
console.log(msg);
|
144
|
-
});
|
145
|
-
|
146
|
-
var max_quantity = link.closest('tr').data('item-quantity');
|
147
|
-
var split_item_template = Handlebars.compile($('#variant_split_template').text());
|
148
|
-
link.closest('tr').after(split_item_template({ variant: variant, shipments: shipments, max_quantity: max_quantity }));
|
149
|
-
$('a.cancel-split').click(cancelItemSplit);
|
150
|
-
$('a.save-split').click(completeItemSplit);
|
151
|
-
|
152
|
-
// Add some tips
|
153
|
-
$('.with-tip').powerTip({
|
154
|
-
smartPlacement: true,
|
155
|
-
fadeInTime: 50,
|
156
|
-
fadeOutTime: 50,
|
157
|
-
intentPollInterval: 300
|
158
|
-
});
|
159
|
-
$('#item_stock_location').select2({ width: 'resolve', placeholder: 'Choose Location' });
|
160
|
-
}
|
161
|
-
|
162
|
-
completeItemSplit = function(event) {
|
163
|
-
event.preventDefault();
|
164
|
-
var link = $(this);
|
165
|
-
var order_number = link.closest('tbody').data('order-number');
|
166
|
-
var stock_item_row = link.closest('tr');
|
167
|
-
var variant_id = stock_item_row.data('variant-id');
|
168
|
-
var quantity = stock_item_row.find('#item_quantity').val();
|
169
|
-
|
170
|
-
var stock_location_id = stock_item_row.find('#item_stock_location').val();
|
171
|
-
var original_shipment_number = link.closest('tbody').data('shipment-number');
|
172
|
-
|
173
|
-
var selected_shipment = stock_item_row.find($('#item_stock_location').select2('data').element);
|
174
|
-
var target_shipment_number = selected_shipment.data('shipment-number');
|
175
|
-
var new_shipment = selected_shipment.data('new-shipment');
|
176
|
-
|
177
|
-
if (stock_location_id != 'new_shipment') {
|
178
|
-
// first remove item(s) from original shipment
|
179
|
-
$.ajax({
|
180
|
-
type: "PUT",
|
181
|
-
async: false,
|
182
|
-
url: Spree.url(Spree.routes.orders_api + "/" + order_number + "/shipments/" + original_shipment_number + "/remove.json"),
|
183
|
-
data: { variant_id: variant_id, quantity: quantity }
|
184
|
-
});
|
185
|
-
|
186
|
-
if (new_shipment != undefined) {
|
187
|
-
$.ajax({
|
188
|
-
type: "POST",
|
189
|
-
async: false,
|
190
|
-
url: Spree.url(Spree.routes.orders_api + "/" + order_number + "/shipments.json"),
|
191
|
-
data: { variant_id: variant_id, quantity: quantity, stock_location_id: stock_location_id }
|
192
|
-
}).done(function(msg) {
|
193
|
-
advanceOrder();
|
194
|
-
});
|
195
|
-
} else {
|
196
|
-
$.ajax({
|
197
|
-
type: "PUT",
|
198
|
-
async: false,
|
199
|
-
url: Spree.url(Spree.routes.orders_api + "/" + order_number + "/shipments/" + target_shipment_number + "/add.json"),
|
200
|
-
data: { variant_id: variant_id, quantity: quantity }
|
201
|
-
}).done(function(msg) {
|
202
|
-
advanceOrder();
|
203
|
-
});
|
204
|
-
}
|
205
|
-
}
|
206
|
-
}
|
207
|
-
|
208
|
-
advanceOrder = function() {
|
209
|
-
$.ajax({
|
210
|
-
type: "PUT",
|
211
|
-
async: false,
|
212
|
-
url: Spree.url(Spree.routes.checkouts_api + "/" + order_number + "/advance")
|
213
|
-
}).done(function() {
|
214
|
-
window.location.reload();
|
215
|
-
});
|
216
|
-
}
|
217
|
-
|
218
|
-
cancelItemSplit = function(event) {
|
219
|
-
event.preventDefault();
|
220
|
-
var link = $(this);
|
221
|
-
var prev_row = link.closest('tr').prev();
|
222
|
-
link.closest('tr').remove();
|
223
|
-
prev_row.find('a.edit-item').toggle();
|
224
|
-
prev_row.find('a.split-item').toggle();
|
225
|
-
prev_row.find('a.delete-item').toggle();
|
226
|
-
}
|
227
|
-
|
228
|
-
addVariantFromStockLocation = function() {
|
229
|
-
$('#stock_details').hide();
|
230
|
-
|
231
|
-
var variant_id = $('input.variant_autocomplete').val();
|
232
|
-
var stock_location_id = $(this).data('stock-location-id');
|
233
|
-
var quantity = $("input.quantity[data-stock-location-id='" + stock_location_id + "']").val();
|
234
|
-
|
235
|
-
var shipment = _.find(shipments, function(shipment){
|
236
|
-
return shipment.stock_location_id == stock_location_id && (shipment.state == 'ready' || shipment.state == 'pending');
|
237
|
-
});
|
238
|
-
|
239
|
-
if(shipment==undefined){
|
240
|
-
$.ajax({
|
241
|
-
type: "POST",
|
242
|
-
url: Spree.url(Spree.routes.orders_api + "/" + order_number + "/shipments.json"),
|
243
|
-
data: { variant_id: variant_id, quantity: quantity, stock_location_id: stock_location_id }
|
244
|
-
}).done(function( msg ) {
|
245
|
-
advanceOrder();
|
246
|
-
}).error(function( msg ) {
|
247
|
-
console.log(msg);
|
248
|
-
});
|
249
|
-
}else{
|
250
|
-
//add to existing shipment
|
251
|
-
adjustItems(shipment.number, variant_id, quantity);
|
252
|
-
}
|
253
|
-
return 1
|
254
|
-
}
|
255
|
-
|
256
12
|
formatVariantResult = function(variant) {
|
257
13
|
if (variant["images"][0] != undefined && variant["images"][0].urls != undefined) {
|
258
14
|
variant.image = variant.images[0].urls.mini
|
@@ -0,0 +1,10 @@
|
|
1
|
+
jQuery ->
|
2
|
+
$('.track_inventory_checkbox').on 'click', ->
|
3
|
+
$(@).siblings('.variant_track_inventory').val($(@).is(':checked'))
|
4
|
+
$(@).parent('form').submit()
|
5
|
+
$('.toggle_variant_track_inventory').on 'submit', ->
|
6
|
+
$.ajax
|
7
|
+
type: @method
|
8
|
+
url: @action
|
9
|
+
data: $(@).serialize()
|
10
|
+
false
|
@@ -10,7 +10,7 @@ module Spree
|
|
10
10
|
def index
|
11
11
|
params[:q] ||= {}
|
12
12
|
params[:q][:completed_at_not_null] ||= '1' if Spree::Config[:show_only_complete_orders_by_default]
|
13
|
-
@show_only_completed = params[:q][:completed_at_not_null]
|
13
|
+
@show_only_completed = params[:q][:completed_at_not_null] == '1'
|
14
14
|
params[:q][:s] ||= @show_only_completed ? 'completed_at desc' : 'created_at desc'
|
15
15
|
|
16
16
|
# As date params are deleted if @show_only_completed, store
|
@@ -35,7 +35,7 @@ module Spree
|
|
35
35
|
end
|
36
36
|
|
37
37
|
@search = Order.accessible_by(current_ability, :index).ransack(params[:q])
|
38
|
-
@orders = @search.result.includes([:user, :shipments, :payments]).
|
38
|
+
@orders = @search.result(distinct: true).includes([:user, :shipments, :payments]).
|
39
39
|
page(params[:page]).
|
40
40
|
per(params[:per_page] || Spree::Config[:orders_per_page])
|
41
41
|
|
@@ -118,9 +118,8 @@ module Spree
|
|
118
118
|
end
|
119
119
|
|
120
120
|
private
|
121
|
-
|
122
121
|
def load_order
|
123
|
-
@order = Order.find_by_number!(params[:id]
|
122
|
+
@order = Order.includes(:adjustments).find_by_number!(params[:id])
|
124
123
|
authorize! action, @order
|
125
124
|
end
|
126
125
|
|
@@ -3,12 +3,26 @@ module Spree
|
|
3
3
|
class ReportsController < Spree::Admin::BaseController
|
4
4
|
respond_to :html
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
class << self
|
7
|
+
def available_reports
|
8
|
+
@@available_reports
|
9
|
+
end
|
10
|
+
|
11
|
+
def add_available_report!(report_key, report_description_key = nil)
|
12
|
+
if report_description_key.nil?
|
13
|
+
report_description_key = "#{report_key}_description"
|
14
|
+
end
|
15
|
+
@@available_reports[report_key] = {name: Spree.t(report_key), description: Spree.t(report_description_key)}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
super
|
21
|
+
ReportsController.add_available_report!(:sales_total)
|
22
|
+
end
|
9
23
|
|
10
24
|
def index
|
11
|
-
@reports =
|
25
|
+
@reports = ReportsController.available_reports
|
12
26
|
end
|
13
27
|
|
14
28
|
def sales_total
|
@@ -50,6 +64,8 @@ module Spree
|
|
50
64
|
Spree::Admin::ReportsController
|
51
65
|
end
|
52
66
|
|
67
|
+
@@available_reports = {}
|
68
|
+
|
53
69
|
end
|
54
70
|
end
|
55
71
|
end
|
@@ -6,20 +6,23 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
|
|
6
6
|
rescue_from ActiveRecord::RecordNotFound, :with => :resource_not_found
|
7
7
|
|
8
8
|
respond_to :html
|
9
|
-
respond_to :js, :except => [:show, :index]
|
10
9
|
|
11
10
|
def new
|
12
11
|
invoke_callbacks(:new_action, :before)
|
13
12
|
respond_with(@object) do |format|
|
14
13
|
format.html { render :layout => !request.xhr? }
|
15
|
-
|
14
|
+
if request.xhr?
|
15
|
+
format.js { render :layout => false }
|
16
|
+
end
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
19
20
|
def edit
|
20
21
|
respond_with(@object) do |format|
|
21
22
|
format.html { render :layout => !request.xhr? }
|
22
|
-
|
23
|
+
if request.xhr?
|
24
|
+
format.js { render :layout => false }
|
25
|
+
end
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
@@ -71,7 +71,7 @@ module Spree
|
|
71
71
|
when :integer
|
72
72
|
text_field_tag(name, value, preference_field_options(options))
|
73
73
|
when :boolean
|
74
|
-
hidden_field_tag(name, 0) +
|
74
|
+
hidden_field_tag(name, 0, id: "#{name}_hidden") +
|
75
75
|
check_box_tag(name, 1, value, preference_field_options(options))
|
76
76
|
when :string
|
77
77
|
text_field_tag(name, value, preference_field_options(options))
|
@@ -29,7 +29,9 @@ module Spree
|
|
29
29
|
link = link_to(titleized_label, destination_url)
|
30
30
|
end
|
31
31
|
|
32
|
-
selected = if options[:match_path]
|
32
|
+
selected = if options[:match_path].is_a? Regexp
|
33
|
+
request.fullpath =~ options[:match_path]
|
34
|
+
elsif options[:match_path]
|
33
35
|
request.fullpath.starts_with?("#{admin_path}#{options[:match_path]}")
|
34
36
|
else
|
35
37
|
args.include?(controller.controller_name.to_sym)
|
@@ -69,8 +71,9 @@ module Spree
|
|
69
71
|
end
|
70
72
|
|
71
73
|
def link_to_edit(resource, options={})
|
74
|
+
url = options[:url] || edit_object_url(resource)
|
72
75
|
options[:data] = {:action => 'edit'}
|
73
|
-
link_to_with_icon('icon-edit', Spree.t(:edit),
|
76
|
+
link_to_with_icon('icon-edit', Spree.t(:edit), url, options)
|
74
77
|
end
|
75
78
|
|
76
79
|
def link_to_edit_url(url, options={})
|
@@ -3,7 +3,11 @@ module Spree
|
|
3
3
|
module StockMovementsHelper
|
4
4
|
def pretty_originator(stock_movement)
|
5
5
|
if stock_movement.originator.respond_to?(:number)
|
6
|
-
stock_movement.originator.
|
6
|
+
if stock_movement.originator.respond_to?(:order)
|
7
|
+
link_to stock_movement.originator.number, [:edit, :admin, stock_movement.originator.order]
|
8
|
+
else
|
9
|
+
stock_movement.originator.number
|
10
|
+
end
|
7
11
|
else
|
8
12
|
""
|
9
13
|
end
|
@@ -64,11 +64,11 @@
|
|
64
64
|
</div>
|
65
65
|
<div class="field">
|
66
66
|
<%= label_tag :smtp_username, Spree.t(:smtp_username) %><br />
|
67
|
-
<%= text_field_tag :smtp_username, Spree::Config[:smtp_username], :class => 'fullwidth' %>
|
67
|
+
<%= text_field_tag :smtp_username, Spree::Config[:smtp_username], :class => 'fullwidth', :autocomplete => 'off' %>
|
68
68
|
</div>
|
69
69
|
<div class="field">
|
70
70
|
<%= label_tag :preferred_smtp_password, Spree.t(:smtp_password) %><br />
|
71
|
-
<%= password_field_tag :smtp_password, Spree::Config[:smtp_password], :class => 'fullwidth' %>
|
71
|
+
<%= password_field_tag :smtp_password, Spree::Config[:smtp_password], :class => 'fullwidth', :autocomplete => 'off' %>
|
72
72
|
</div>
|
73
73
|
</fieldset>
|
74
74
|
</div>
|
@@ -3,7 +3,11 @@
|
|
3
3
|
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @line_item } %>
|
4
4
|
<% end %>
|
5
5
|
|
6
|
-
|
6
|
+
<% if Spree::Order.checkout_step_names.include?(:delivery) %>
|
7
|
+
<%= render :partial => "spree/admin/orders/shipment", :collection => @order.shipments, :locals => { :order => order } %>
|
8
|
+
<% else %>
|
9
|
+
<%= render :partial => "spree/admin/orders/line_items", :locals => { :order => order } %>
|
10
|
+
<% end %>
|
7
11
|
<% if order.adjustments.eligible.exists? %>
|
8
12
|
<fieldset class="no-border-bottom">
|
9
13
|
<legend><%= Spree.t('adjustments') %></legend>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<% if order.line_items.exists? %>
|
2
|
+
<table class="line-items index" data-hook="line-items">
|
3
|
+
<colgroup>
|
4
|
+
<col style="width: 10%;" />
|
5
|
+
<col style="width: 20%;" />
|
6
|
+
<col style="width: 20%;" />
|
7
|
+
<col style="width: 15%;" />
|
8
|
+
</colgroup>
|
9
|
+
|
10
|
+
<thead>
|
11
|
+
<th colspan="2"><%= Spree.t(:name) %></th>
|
12
|
+
<th><%= Spree.t(:price) %></th>
|
13
|
+
<th><%= Spree.t(:quantity) %></th>
|
14
|
+
<th><%= Spree.t(:total_price) %></th>
|
15
|
+
<th class="orders-actions actions" data-hook="admin_order_form_line_items_header_actions"> </th>
|
16
|
+
</thead>
|
17
|
+
|
18
|
+
<tbody>
|
19
|
+
<% order.line_items.each do |item| %>
|
20
|
+
|
21
|
+
<tr class="line-item" id="line-item-<%= item.id %>">
|
22
|
+
<td class="line-item-image"><%= mini_image(item.variant) %></td>
|
23
|
+
<td class="line-item-name">
|
24
|
+
<%= item.variant.product.name %><br><%= "(" + variant_options(item.variant) + ")" unless item.variant.option_values.empty? %>
|
25
|
+
</td>
|
26
|
+
<td class="line-item-price align-center"><%= item.single_money.to_html %></td>
|
27
|
+
<td class="line-item-qty-show align-center">
|
28
|
+
<%= item.quantity %>
|
29
|
+
</td>
|
30
|
+
<td class="line-item-qty-edit hidden">
|
31
|
+
<%= number_field_tag :quantity, item.quantity, :min => 0, :class => "line_item_quantity", :size => 5 %>
|
32
|
+
</td>
|
33
|
+
<td class="line-item-total align-center"><%= line_item_shipment_price(item, item.quantity) %></td>
|
34
|
+
<td class="cart-line-item-delete actions" data-hook="cart_line_item_delete">
|
35
|
+
<% if can? :update, item %>
|
36
|
+
<%= link_to '', '#', :class => 'save-line-item icon_link icon-ok no-text with-tip', :data => { 'line-item-id' => item.id, :action => 'save'}, :title => Spree.t('actions.save'), :style => 'display: none' %>
|
37
|
+
<%= link_to '', '#', :class => 'cancel-line-item icon_link icon-cancel no-text with-tip', :data => {:action => 'cancel'}, :title => Spree.t('actions.cancel'), :style => 'display: none' %>
|
38
|
+
<%= link_to '', '#', :class => 'edit-line-item icon_link icon-edit no-text with-tip', :data => {:action => 'edit'}, :title => Spree.t('edit') %>
|
39
|
+
<%= link_to '', '#', :class => 'delete-line-item icon-trash no-text with-tip', :data => { 'line-item-id' => item.id, :action => 'remove'}, :title => Spree.t('delete') %>
|
40
|
+
<% end %>
|
41
|
+
</td>
|
42
|
+
</tr>
|
43
|
+
<% end %>
|
44
|
+
</tbody>
|
45
|
+
</table>
|
46
|
+
<% end %>
|
@@ -68,7 +68,7 @@
|
|
68
68
|
|
69
69
|
<tr class="show-method total">
|
70
70
|
<td colspan="4">
|
71
|
-
<% if shipment.adjustment.present? %>
|
71
|
+
<% if shipment.adjustment.present? && shipment.shipping_method.present? %>
|
72
72
|
<strong><%= shipment.adjustment.label %>: <%= shipment.shipping_method.name %></strong>
|
73
73
|
<% else %>
|
74
74
|
<%= Spree.t(:cannot_set_shipping_method_without_address) %>
|
@@ -101,6 +101,14 @@
|
|
101
101
|
</td>
|
102
102
|
</tr>
|
103
103
|
|
104
|
+
<% if @order.special_instructions.present? %>
|
105
|
+
<tr class='special_instructions'>
|
106
|
+
<td colspan="5">
|
107
|
+
<strong><%= Spree.t(:special_instructions) %>: </strong><%= @order.special_instructions %>
|
108
|
+
</td>
|
109
|
+
</tr>
|
110
|
+
<% end %>
|
111
|
+
|
104
112
|
<tr class="show-tracking total">
|
105
113
|
<td colspan="5">
|
106
114
|
<% if shipment.tracking.present? %>
|
@@ -117,4 +125,4 @@
|
|
117
125
|
</tr>
|
118
126
|
</tbody>
|
119
127
|
</table>
|
120
|
-
</div>
|
128
|
+
</div>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<li><%= button_link_to Spree.t(:back_to_orders_list), admin_orders_path, :icon => 'icon-arrow-left' %></li>
|
11
11
|
<% end %>
|
12
12
|
|
13
|
-
<% if @order.cart? %>
|
13
|
+
<% if @order.cart? || (@order.checkout_steps.include?("address") && @order.address?) %>
|
14
14
|
<div id="select-customer" data-hook>
|
15
15
|
<fieldset class="no-border-bottom">
|
16
16
|
<legend align="center"><%= Spree.t(:customer_search) %></legend>
|
@@ -60,7 +60,7 @@
|
|
60
60
|
<div class="omega four columns">
|
61
61
|
<div class="field checkbox">
|
62
62
|
<label>
|
63
|
-
<%= f.check_box :completed_at_not_null, {:checked => @show_only_completed}, '1', '' %>
|
63
|
+
<%= f.check_box :completed_at_not_null, {:checked => @show_only_completed}, '1', '0' %>
|
64
64
|
<%= Spree.t(:show_only_complete_orders) %>
|
65
65
|
</label>
|
66
66
|
</div>
|
@@ -87,7 +87,9 @@
|
|
87
87
|
<col style="width: 10%;">
|
88
88
|
<col style="width: 10%;">
|
89
89
|
<col style="width: 12%;">
|
90
|
-
|
90
|
+
<% if Spree::Order.checkout_step_names.include?(:delivery) %>
|
91
|
+
<col style="width: 12%;">
|
92
|
+
<% end %>
|
91
93
|
<col style="width: 25%;">
|
92
94
|
<col style="width: 10%;">
|
93
95
|
<col style="width: 8%;">
|
@@ -102,7 +104,9 @@
|
|
102
104
|
<th><%= sort_link @search, :number, I18n.t(:number, :scope => 'activerecord.attributes.spree/order') %></th>
|
103
105
|
<th><%= sort_link @search, :state, I18n.t(:state, :scope => 'activerecord.attributes.spree/order') %></th>
|
104
106
|
<th><%= sort_link @search, :payment_state, I18n.t(:payment_state, :scope => 'activerecord.attributes.spree/order') %></th>
|
105
|
-
|
107
|
+
<% if Spree::Order.checkout_step_names.include?(:delivery) %>
|
108
|
+
<th><%= sort_link @search, :shipment_state, I18n.t(:shipment_state, :scope => 'activerecord.attributes.spree/order') %></th>
|
109
|
+
<% end %>
|
106
110
|
<th><%= sort_link @search, :email, I18n.t(:email, :scope => 'activerecord.attributes.spree/order') %></th>
|
107
111
|
<th><%= sort_link @search, :total, I18n.t(:total, :scope => 'activerecord.attributes.spree/order') %></th>
|
108
112
|
<th data-hook="admin_orders_index_header_actions" class="actions"></th>
|
@@ -115,7 +119,9 @@
|
|
115
119
|
<td class="align-center"><%= link_to order.number, edit_admin_order_path(order) %></td>
|
116
120
|
<td class="align-center"><span class="state <%= order.state.downcase %>"><%= Spree.t("order_state.#{order.state.downcase}") %></span></td>
|
117
121
|
<td class="align-center"><span class="state <%= order.payment_state %>"><%= link_to Spree.t("payment_states.#{order.payment_state}"), admin_order_payments_path(order) if order.payment_state %></span></td>
|
118
|
-
|
122
|
+
<% if Spree::Order.checkout_step_names.include?(:delivery) %>
|
123
|
+
<td class="align-center"><span class="state <%= order.shipment_state %>"><%= Spree.t("shipment_states.#{order.shipment_state}") if order.shipment_state %></span></td>
|
124
|
+
<% end %>
|
119
125
|
<td><%= mail_to order.email %></td>
|
120
126
|
<td class="align-center"><%= order.display_total.to_html %></td>
|
121
127
|
<td class='actions align-center' data-hook="admin_orders_index_row_actions">
|
@@ -101,7 +101,6 @@
|
|
101
101
|
<% end %>
|
102
102
|
</div>
|
103
103
|
|
104
|
-
<!-- <h2><%= Spree.t(:metadata) %></h2> -->
|
105
104
|
<div data-hook="admin_product_form_meta" class="alpha omega twelve columns">
|
106
105
|
<%= f.field_container :meta_keywords do %>
|
107
106
|
<%= f.label :meta_keywords, Spree.t(:meta_keywords) %>
|
@@ -33,6 +33,15 @@
|
|
33
33
|
<% if variant.images.present? %>
|
34
34
|
<%= image_tag variant.images.first.attachment.url(:mini) %>
|
35
35
|
<% end %>
|
36
|
+
<br/>
|
37
|
+
<%= form_tag admin_product_variants_including_master_path(@product, variant, format: :js), method: :put, class: 'toggle_variant_track_inventory' do %>
|
38
|
+
<%= check_box_tag 'track_inventory', 1, variant.track_inventory?,
|
39
|
+
class: 'track_inventory_checkbox' %>
|
40
|
+
<%= Spree.t(:track_inventory) %>
|
41
|
+
<%= hidden_field_tag 'variant[track_inventory]', variant.track_inventory?,
|
42
|
+
class: 'variant_track_inventory',
|
43
|
+
id: "variant_track_inventory_#{variant.id}" %>
|
44
|
+
<% end %>
|
36
45
|
</td>
|
37
46
|
<td colspan="4" class="stock_location_info">
|
38
47
|
<table>
|
@@ -1,16 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
notice_div.show();
|
7
|
-
} else {
|
8
|
-
if ($("#content .toolbar").length > 0) {
|
9
|
-
$("#content .toolbar").before('<div class="flash notice"><%= notice %></div>');
|
10
|
-
} else {
|
11
|
-
$("#content h1").before('<div class="flash notice"><%= notice %></div>');
|
12
|
-
}
|
13
|
-
} <%
|
14
|
-
end %>
|
1
|
+
<% success = flash.discard(:success)
|
2
|
+
if success %>
|
3
|
+
console.log(show_flash)
|
4
|
+
show_flash('success', "<%= success %>")
|
5
|
+
<% end %>
|
15
6
|
|
16
7
|
<%= render :partial => '/spree/admin/shared/update_order_state' if @order %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% content_for :page_title do %>
|
2
|
-
<%= Spree.t(:order)
|
2
|
+
<%= link_to "#{Spree.t(:order)} ##{@order.number}", edit_admin_order_path(@order) %>
|
3
3
|
<% end %>
|
4
4
|
|
5
5
|
<% content_for :sidebar_title do %>
|
@@ -52,17 +52,17 @@
|
|
52
52
|
<%= link_to_with_icon 'icon-user', Spree.t(:customer_details), admin_order_customer_url(@order) %>
|
53
53
|
</li>
|
54
54
|
<% end %>
|
55
|
-
<% if can? :index,
|
55
|
+
<% if can? :index, Spree::Adjustment %>
|
56
56
|
<li<%== ' class="active"' if current == 'Adjustments' %>>
|
57
57
|
<%= link_to_with_icon 'icon-cogs', Spree.t(:adjustments), admin_order_adjustments_url(@order) %>
|
58
58
|
</li>
|
59
59
|
<% end %>
|
60
|
-
<% if can? :index,
|
60
|
+
<% if can? :index, Spree::Payment && @payment_required %>
|
61
61
|
<li<%== ' class="active"' if current == 'Payments' %>>
|
62
62
|
<%= link_to_with_icon 'icon-credit-card', Spree.t(:payments), admin_order_payments_url(@order) %>
|
63
63
|
</li>
|
64
64
|
<% end %>
|
65
|
-
<% if can? :index,
|
65
|
+
<% if can? :index, Spree::ReturnAuthorization %>
|
66
66
|
<% if @order.completed? %>
|
67
67
|
<li<%== ' class="active"' if current == 'Return Authorizations' %>>
|
68
68
|
<%= link_to_with_icon 'icon-share-alt', Spree.t(:return_authorizations), admin_order_return_authorizations_url(@order) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= @object.as_json %>
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_backend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree_core
|
@@ -16,82 +16,82 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.0.
|
19
|
+
version: 2.0.8
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.0.
|
26
|
+
version: 2.0.8
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: spree_api
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.0.
|
33
|
+
version: 2.0.8
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.0.
|
40
|
+
version: 2.0.8
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: jquery-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 3.0.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 3.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: jquery-ui-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 4.0.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 4.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: select2-rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 3.4.7
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 3.4.7
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: email_spec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 1.2.1
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 1.2.1
|
97
97
|
description: Required dependency for Spree
|
@@ -100,11 +100,11 @@ executables: []
|
|
100
100
|
extensions: []
|
101
101
|
extra_rdoc_files: []
|
102
102
|
files:
|
103
|
+
- app/assets/fonts/FontAwesome.otf
|
103
104
|
- app/assets/fonts/fontawesome-webfont.eot
|
104
105
|
- app/assets/fonts/fontawesome-webfont.svg
|
105
106
|
- app/assets/fonts/fontawesome-webfont.ttf
|
106
107
|
- app/assets/fonts/fontawesome-webfont.woff
|
107
|
-
- app/assets/fonts/FontAwesome.otf
|
108
108
|
- app/assets/images/admin/payment_banner.png
|
109
109
|
- app/assets/images/admin/progress.gif
|
110
110
|
- app/assets/images/credit_cards/credit_card.gif
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- app/assets/javascripts/admin/image_settings.js.erb
|
117
117
|
- app/assets/javascripts/admin/images/index.js.coffee
|
118
118
|
- app/assets/javascripts/admin/images/new.js.coffee
|
119
|
+
- app/assets/javascripts/admin/line_items.js.coffee
|
119
120
|
- app/assets/javascripts/admin/nested-attribute.js
|
120
121
|
- app/assets/javascripts/admin/option_type_autocomplete.js.erb
|
121
122
|
- app/assets/javascripts/admin/orders/edit.js
|
@@ -138,6 +139,7 @@ files:
|
|
138
139
|
- app/assets/javascripts/admin/underscore-min.js
|
139
140
|
- app/assets/javascripts/admin/user_picker.js
|
140
141
|
- app/assets/javascripts/admin/variant_autocomplete.js.erb
|
142
|
+
- app/assets/javascripts/admin/variant_management.js.coffee
|
141
143
|
- app/assets/javascripts/admin/zone.js.coffee
|
142
144
|
- app/assets/javascripts/store/backend.js
|
143
145
|
- app/assets/stylesheets/admin/components/_actions.scss
|
@@ -220,6 +222,7 @@ files:
|
|
220
222
|
- app/controllers/spree/admin/taxons_controller.rb
|
221
223
|
- app/controllers/spree/admin/trackers_controller.rb
|
222
224
|
- app/controllers/spree/admin/variants_controller.rb
|
225
|
+
- app/controllers/spree/admin/variants_including_master_controller.rb
|
223
226
|
- app/controllers/spree/admin/zones_controller.rb
|
224
227
|
- app/helpers/spree/admin/base_helper.rb
|
225
228
|
- app/helpers/spree/admin/general_settings_helper.rb
|
@@ -263,6 +266,7 @@ files:
|
|
263
266
|
- app/views/spree/admin/orders/_add_product.html.erb
|
264
267
|
- app/views/spree/admin/orders/_form.html.erb
|
265
268
|
- app/views/spree/admin/orders/_line_item.html.erb
|
269
|
+
- app/views/spree/admin/orders/_line_items.html.erb
|
266
270
|
- app/views/spree/admin/orders/_shipment.html.erb
|
267
271
|
- app/views/spree/admin/orders/_shipment_manifest.html.erb
|
268
272
|
- app/views/spree/admin/orders/customer_details/_form.html.erb
|
@@ -417,6 +421,7 @@ files:
|
|
417
421
|
- app/views/spree/admin/variants/index.html.erb
|
418
422
|
- app/views/spree/admin/variants/new.html.erb
|
419
423
|
- app/views/spree/admin/variants/new.js.erb
|
424
|
+
- app/views/spree/admin/variants/update.js.erb
|
420
425
|
- app/views/spree/admin/zones/_country_members.html.erb
|
421
426
|
- app/views/spree/admin/zones/_form.html.erb
|
422
427
|
- app/views/spree/admin/zones/_state_members.html.erb
|
@@ -427,9 +432,9 @@ files:
|
|
427
432
|
- app/views/spree/test_mailer/test_email.text.erb
|
428
433
|
- config/initializers/form_builder.rb
|
429
434
|
- config/routes.rb
|
435
|
+
- lib/spree/backend.rb
|
430
436
|
- lib/spree/backend/action_callbacks.rb
|
431
437
|
- lib/spree/backend/engine.rb
|
432
|
-
- lib/spree/backend.rb
|
433
438
|
- lib/spree_backend.rb
|
434
439
|
- vendor/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png
|
435
440
|
- vendor/assets/images/jquery-ui/ui-bg_flat_0_eeeeee_40x100.png
|
@@ -481,18 +486,18 @@ require_paths:
|
|
481
486
|
- lib
|
482
487
|
required_ruby_version: !ruby/object:Gem::Requirement
|
483
488
|
requirements:
|
484
|
-
- -
|
489
|
+
- - ">="
|
485
490
|
- !ruby/object:Gem::Version
|
486
491
|
version: 1.9.3
|
487
492
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
488
493
|
requirements:
|
489
|
-
- -
|
494
|
+
- - ">="
|
490
495
|
- !ruby/object:Gem::Version
|
491
496
|
version: '0'
|
492
497
|
requirements:
|
493
498
|
- none
|
494
499
|
rubyforge_project: spree_backend
|
495
|
-
rubygems_version: 2.
|
500
|
+
rubygems_version: 2.2.0
|
496
501
|
signing_key:
|
497
502
|
specification_version: 4
|
498
503
|
summary: backend e-commerce functionality for the Spree project.
|