mirror of
https://github.com/anna-sara/filament_inventory
synced 2025-12-24 04:57:13 +01:00
Fixed widgets on admin view
This commit is contained in:
parent
b4f2e658ad
commit
2da3264dd1
2 changed files with 10 additions and 10 deletions
|
|
@ -22,17 +22,15 @@ class AdminWidget extends BaseWidget
|
|||
})->get()->groupBy('item_id');
|
||||
|
||||
$itemName = "";
|
||||
$itemCount = 0;
|
||||
|
||||
foreach ($items as $item){
|
||||
$itemCount = 0;
|
||||
|
||||
if($item->count() > $itemCount) {
|
||||
if(count($item) > $itemCount) {
|
||||
$itemName = $item[0]->item->desc;
|
||||
$itemCount = $item->count();
|
||||
}
|
||||
|
||||
|
||||
$itemCount = count($item);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
//Card::make(__('Total number of users'), User::count() ),
|
||||
Stat::make(__('Total amount of games'), Item::where('type', 'game')->count() ),
|
||||
|
|
|
|||
|
|
@ -25,7 +25,9 @@ class PopularCategoryChart extends ChartWidget
|
|||
|
||||
protected function getData(): array
|
||||
{
|
||||
$categories = Category::where('type', 'game')->get()->sortBy('id')->sortDesc();
|
||||
$categories = Category::where('type', 'game')->get()->sortBy('id');
|
||||
|
||||
//dd($categories);
|
||||
$categoryNames = [];
|
||||
|
||||
foreach ($categories as $obj){
|
||||
|
|
@ -34,13 +36,13 @@ class PopularCategoryChart extends ChartWidget
|
|||
|
||||
$items = Reserveditem::withTrashed()->with('item')->whereHas('item', function($query){
|
||||
return $query->where('type', 'game');
|
||||
})->get()->groupBy('item.category_id')->sortBy('item.category_id')->sortDesc();
|
||||
})->get()->groupBy('item.category_id')->sortBy('item.category_id');
|
||||
|
||||
|
||||
$itemCategoriesCount = [];
|
||||
|
||||
foreach ($items as $item){
|
||||
$itemCategoriesCount[] = $item->count();
|
||||
$itemCategoriesCount[] = count($item);
|
||||
}
|
||||
|
||||
return [
|
||||
|
|
|
|||
Loading…
Reference in a new issue