mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Notify when stock limit reached on shopfront rather than silently capping
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user