mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-24 05:38:52 +00:00
On load, scale from base unit to chosen unit (eg. g to kg)
This commit is contained in:
@@ -190,7 +190,15 @@ productsApp.controller "AdminBulkProductsCtrl", [
|
||||
|
||||
if product.variants
|
||||
for variant in product.variants
|
||||
variant.unit_value_with_description = "#{variant.unit_value || ''} #{variant.unit_description || ''}".trim()
|
||||
unit_value = $scope.variantUnitValue product, variant
|
||||
variant.unit_value_with_description = "#{unit_value || ''} #{variant.unit_description || ''}".trim()
|
||||
|
||||
|
||||
$scope.variantUnitValue = (product, variant) ->
|
||||
if variant.unit_value
|
||||
variant.unit_value / product.variant_unit_scale
|
||||
else
|
||||
null
|
||||
|
||||
|
||||
$scope.updateOnHand = (product) ->
|
||||
|
||||
Reference in New Issue
Block a user