mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 20:26:42 +00:00
Show how much is in stock on dashboard
This commit is contained in:
@@ -46,4 +46,15 @@ class GrocyPhpHelper
|
|||||||
|
|
||||||
return $returnArray;
|
return $returnArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function SumArrayValue($array, $propertyName)
|
||||||
|
{
|
||||||
|
$sum = 0;
|
||||||
|
foreach($array as $object)
|
||||||
|
{
|
||||||
|
$sum += $object->{$propertyName};
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sum;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<h1 class="page-header">Dashboard</h1>
|
<h1 class="page-header">Dashboard</h1>
|
||||||
|
|
||||||
<h3>Stock overview</h3>
|
<h3>Stock overview <span class="text-muded small"><strong><?php echo count($currentStock) ?></strong> products with <strong><?php echo GrocyPhpHelper::SumArrayValue($currentStock, 'amount'); ?></strong> units in stock</span></h3>
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
Reference in New Issue
Block a user