Compare commits

..

No commits in common. "aaa4980619041c6c44ed4872f8cfaa8427d37a5a" and "3076fae039969f67c095172da67629a1ff45228a" have entirely different histories.

3 changed files with 3 additions and 4 deletions

View file

@ -25,13 +25,13 @@ class EditReserveditem extends EditRecord
protected function mutateFormDataBeforeSave(array $data): array protected function mutateFormDataBeforeSave(array $data): array
{ {
if ($data['delivered'] && !$data['returned']) if ($data['delivered'])
{ {
$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'] && $data['delivered']) if ($data['returned'])
{ {
$data['returned_date'] = Carbon::now(); $data['returned_date'] = Carbon::now();
} }

View file

@ -35,7 +35,6 @@ 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),

View file

@ -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')->sortByDesc('item.category_id'); })->get()->groupBy('item.category_id')->sortBy('item.category_id');
$itemCategoriesCount = []; $itemCategoriesCount = [];