mirror of
https://github.com/anna-sara/filament_inventory
synced 2025-12-24 04:57:13 +01:00
Compare commits
3 commits
3076fae039
...
aaa4980619
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aaa4980619 | ||
|
|
5a63911fe1 | ||
|
|
d987b621c3 |
3 changed files with 4 additions and 3 deletions
|
|
@ -25,13 +25,13 @@ class EditReserveditem extends EditRecord
|
||||||
protected function mutateFormDataBeforeSave(array $data): array
|
protected function mutateFormDataBeforeSave(array $data): array
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($data['delivered'])
|
if ($data['delivered'] && !$data['returned'])
|
||||||
{
|
{
|
||||||
$data['delivered_date'] = Carbon::now();
|
$data['delivered_date'] = Carbon::now();
|
||||||
$data['return_date'] = Carbon::now()->addMonths(1);
|
$data['return_date'] = Carbon::now()->addMonths(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($data['returned'])
|
if ($data['returned'] && $data['delivered'])
|
||||||
{
|
{
|
||||||
$data['returned_date'] = Carbon::now();
|
$data['returned_date'] = Carbon::now();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ class AdminWidget extends BaseWidget
|
||||||
//Card::make(__('Total number of users'), User::count() ),
|
//Card::make(__('Total number of users'), User::count() ),
|
||||||
Stat::make(__('Total amount of games'), Item::where('type', 'game')->count() ),
|
Stat::make(__('Total amount of games'), Item::where('type', 'game')->count() ),
|
||||||
Stat::make(__('Total amount of items'), Item::where('type', 'item')->count() ),
|
Stat::make(__('Total amount of items'), Item::where('type', 'item')->count() ),
|
||||||
|
Stat::make(__('Total amount of literature'), Item::where('type', 'literature')->count() ),
|
||||||
Stat::make(__('Reservations at the moment'), Reserveditem::where('returned_date', null)->count() ),
|
Stat::make(__('Reservations at the moment'), Reserveditem::where('returned_date', null)->count() ),
|
||||||
Stat::make(__('Reservations over time'), Reserveditem::withTrashed()->count() ),
|
Stat::make(__('Reservations over time'), Reserveditem::withTrashed()->count() ),
|
||||||
Stat::make(__('Most reserved game'), $itemName),
|
Stat::make(__('Most reserved game'), $itemName),
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class PopularCategoryChart extends ChartWidget
|
||||||
|
|
||||||
$items = Reserveditem::withTrashed()->with('item')->whereHas('item', function($query){
|
$items = Reserveditem::withTrashed()->with('item')->whereHas('item', function($query){
|
||||||
return $query->where('type', 'game');
|
return $query->where('type', 'game');
|
||||||
})->get()->groupBy('item.category_id')->sortBy('item.category_id');
|
})->get()->groupBy('item.category_id')->sortByDesc('item.category_id');
|
||||||
|
|
||||||
|
|
||||||
$itemCategoriesCount = [];
|
$itemCategoriesCount = [];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue