mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-11 03:40:20 +00:00
Remplace ouf of stock alert by Flash message
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
angular.module('Darkswarm').directive "ofnOnHand", (StockQuantity) ->
|
||||
angular.module('Darkswarm').directive "ofnOnHand", (StockQuantity, Messages) ->
|
||||
restrict: 'A'
|
||||
require: "ngModel"
|
||||
scope: true
|
||||
@@ -16,7 +16,7 @@ angular.module('Darkswarm').directive "ofnOnHand", (StockQuantity) ->
|
||||
ngModel.$parsers.push (viewValue) ->
|
||||
available_quantity = scope.available_quantity()
|
||||
if parseInt(viewValue) > available_quantity
|
||||
alert t("js.insufficient_stock", {on_hand: available_quantity})
|
||||
Messages.flash({error: t("js.insufficient_stock", {on_hand: available_quantity})})
|
||||
viewValue = available_quantity
|
||||
ngModel.$setViewValue viewValue
|
||||
ngModel.$render()
|
||||
|
||||
Reference in New Issue
Block a user