app/assets/javascripts/admin/variant_autocomplete.js.erb in spree_backend-2.0.4 vs app/assets/javascripts/admin/variant_autocomplete.js.erb in spree_backend-2.0.5
- old
+ new
@@ -86,11 +86,11 @@
$.ajax({
type: "PUT",
url: Spree.url(url),
data: { variant_id: variant_id, quantity: new_quantity }
}).done(function( msg ) {
- window.location.reload();
+ advanceOrder();
});
}
}
toggleTrackingEdit = function(){
@@ -178,32 +178,44 @@
$.ajax({
type: "PUT",
async: false,
url: Spree.url(Spree.routes.orders_api + "/" + order_number + "/shipments/" + original_shipment_number + "/remove.json"),
data: { variant_id: variant_id, quantity: quantity }
- }).done(function(msg) {
- window.location.reload();
});
if (new_shipment != undefined) {
$.ajax({
type: "POST",
async: false,
url: Spree.url(Spree.routes.orders_api + "/" + order_number + "/shipments.json"),
data: { variant_id: variant_id, quantity: quantity, stock_location_id: stock_location_id }
+ }).done(function(msg) {
+ advanceOrder();
});
} else {
$.ajax({
type: "PUT",
async: false,
url: Spree.url(Spree.routes.orders_api + "/" + order_number + "/shipments/" + target_shipment_number + "/add.json"),
data: { variant_id: variant_id, quantity: quantity }
+ }).done(function(msg) {
+ advanceOrder();
});
}
}
}
+advanceOrder = function() {
+ $.ajax({
+ type: "PUT",
+ async: false,
+ url: Spree.url(Spree.routes.checkouts_api + "/" + order_number + "/advance")
+ }).done(function() {
+ window.location.reload();
+ });
+}
+
cancelItemSplit = function(event) {
event.preventDefault();
var link = $(this);
var prev_row = link.closest('tr').prev();
link.closest('tr').remove();
@@ -227,10 +239,10 @@
$.ajax({
type: "POST",
url: Spree.url(Spree.routes.orders_api + "/" + order_number + "/shipments.json"),
data: { variant_id: variant_id, quantity: quantity, stock_location_id: stock_location_id }
}).done(function( msg ) {
- window.location.reload();
+ advanceOrder();
}).error(function( msg ) {
console.log(msg);
});
}else{
//add to existing shipment