diff --git a/src/app/common/directives/oc-quantity-input.js b/src/app/common/directives/oc-quantity-input.js
index 29d425f5..56945795 100644
--- a/src/app/common/directives/oc-quantity-input.js
+++ b/src/app/common/directives/oc-quantity-input.js
@@ -9,7 +9,8 @@ function OCQuantityInput(toastr, OrderCloud, $rootScope) {
product: '=',
lineitem: '=',
label: '@',
- order: '='
+ order: '=',
+ onUpdate: '&'
},
templateUrl: 'common/templates/quantityInput.tpl.html',
replace: true,
@@ -22,13 +23,15 @@ function OCQuantityInput(toastr, OrderCloud, $rootScope) {
scope.item = scope.lineitem;
scope.content = "lineitem";
scope.updateQuantity = function() {
- console.log('hit');
if (scope.item.Quantity > 0) {
OrderCloud.LineItems.Patch(scope.order.ID, scope.item.ID, {Quantity: scope.item.Quantity})
- .then(function () {
+ .then(function (data) {
+ data.Product = scope.lineitem.Product;
+ scope.item = data;
+ scope.lineitem = data;
+ if (typeof scope.onUpdate === "function") scope.onUpdate(scope.lineitem);
toastr.success('Quantity Updated');
$rootScope.$broadcast('OC:UpdateOrder', scope.order.ID, 'Calculating Order Total');
-
});
}
}
diff --git a/src/app/common/templates/quantityInput.tpl.html b/src/app/common/templates/quantityInput.tpl.html
index ee6d1228..e6cefd8d 100644
--- a/src/app/common/templates/quantityInput.tpl.html
+++ b/src/app/common/templates/quantityInput.tpl.html
@@ -33,7 +33,7 @@
ng-min="{{item.Product.StandardPriceSchedule.MinQuantity}}"
ng-max="{{item.Product.StandardPriceSchedule.MaxQuantity}}"
ng-model="item.Quantity"
- ng-model-options="{ debounce: 1500 }"
+ ng-model-options="{ debounce: 1000 }"
ng-change="updateQuantity()"
placeholder="Quantity">