SHOW:
|
|
- or go back to the newest paste.
1 | - | handleLimit(elem) { |
1 | + | handleLimit(elem) { |
2 | - | const { product } = this.props; |
2 | + | const { product } = this.props; |
3 | - | const qtyOrdered = cartItem ? cartItem.qty_ordered : 0; |
3 | + | const qtyOrdered = cartItem ? cartItem.qty_ordered : 0; |
4 | - | // Checks the difference of the Inventory and Quantity Ordered |
4 | + | // Checks the difference of the Inventory and Quantity Ordered |
5 | - | const inventoryOrderDifference = product.quantity - qtyOrdered; |
5 | + | const inventoryOrderDifference = product.quantity - qtyOrdered; |
6 | - | const max_chars = inventoryOrderDifference.toString().length; |
6 | + | const max_chars = inventoryOrderDifference.toString().length; |
7 | - | |
7 | + | |
8 | - | if(this.state.qty.toString().length > max_chars) { |
8 | + | if(this.state.qty.toString().length > max_chars) { |
9 | - | elem = elem.value.substr(0, max_chars); |
9 | + | elem = elem.value.substr(0, max_chars); |
10 | - | } |
10 | + | } |
11 | } |