Notify when stock limit reached on shopfront rather than silently capping

This commit is contained in:
Rohan Mitchell
2016-04-27 15:05:44 +10:00
parent f691636c75
commit 1220ff8a06
4 changed files with 22 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
Darkswarm.directive "ofnOnHand", ->
restrict: 'A'
link: (scope, elem, attr) ->
on_hand = parseInt(attr.ofnOnHand)
elem.bind 'change', (e) ->
if parseInt(elem.val()) > on_hand
scope.$apply ->
alert t('insufficient_stock', {on_hand: on_hand})
elem.val(on_hand)