mirror of
https://github.com/grocy/grocy.git
synced 2026-04-03 19:36:16 +02:00
Show how much is in stock on dashboard
This commit is contained in:
parent
1d293741ba
commit
f2f18d260d
|
|
@ -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">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user