mirror of
https://github.com/anna-sara/filament_inventory
synced 2025-10-26 20:17:14 +01:00
Compare commits
2 commits
79d7a915af
...
850ad93894
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
850ad93894 | ||
|
|
e5d02d5c72 |
10 changed files with 141 additions and 9 deletions
|
|
@ -19,7 +19,8 @@ class AdminWidget extends BaseWidget
|
|||
//Card::make(__('Total number of users'), User::count() ),
|
||||
Card::make(__('Total number of games'), Item::where('type', 'game')->count() ),
|
||||
Card::make(__('Total number of items'), Item::where('type', 'item')->count() ),
|
||||
Card::make(__('Reserved games and items'), Reserveditem::count() ),
|
||||
Card::make(__('Reservations at the moment'), Reserveditem::where('returned_date', null)->withTrashed()->count() ),
|
||||
Card::make(__('Reservations over time'), Reserveditem::withTrashed()->count() ),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
54
app/Filament/Widgets/ReservationsChart.php
Normal file
54
app/Filament/Widgets/ReservationsChart.php
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use Filament\Widgets\ChartWidget;
|
||||
use Flowframe\Trend\Trend;
|
||||
use Flowframe\Trend\TrendValue;
|
||||
use App\Models\Reserveditem;
|
||||
|
||||
class ReservationsChart extends ChartWidget
|
||||
{
|
||||
protected static ?string $heading = "Reservations by month";
|
||||
|
||||
|
||||
protected function getData(): array
|
||||
{
|
||||
|
||||
|
||||
$data = Trend::query( Reserveditem::query()->withTrashed())
|
||||
->dateColumn('reserved_date')
|
||||
->between(
|
||||
start: now()->startOfYear(),
|
||||
end: now()->endOfYear(),
|
||||
)
|
||||
->perMonth()
|
||||
->count();
|
||||
|
||||
return [
|
||||
'datasets' => [
|
||||
[
|
||||
'label' => __('Reservations'),
|
||||
'data' => $data->map(fn (TrendValue $value) => $value->aggregate),
|
||||
],
|
||||
],
|
||||
'labels' => $data->map(fn (TrendValue $value) => $value->date),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected function getType(): string
|
||||
{
|
||||
return 'line';
|
||||
}
|
||||
|
||||
public static function canView(): bool
|
||||
{
|
||||
if (auth()->user()->is_admin==true) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
"php": "^8.2",
|
||||
"bezhansalleh/filament-language-switch": "^3.1",
|
||||
"filament/filament": "^3.2",
|
||||
"flowframe/laravel-trend": "^0.4.0",
|
||||
"inertiajs/inertia-laravel": "^2.0",
|
||||
"laravel/framework": "^11.31",
|
||||
"laravel/pulse": "^1.4",
|
||||
|
|
|
|||
76
composer.lock
generated
76
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "879b4c253bc9b358fdf8beaa57e929cf",
|
||||
"content-hash": "7deae3e88555bf85dd431c5048c67408",
|
||||
"packages": [
|
||||
{
|
||||
"name": "anourvalar/eloquent-serialize",
|
||||
|
|
@ -1544,6 +1544,80 @@
|
|||
},
|
||||
"time": "2025-03-11T16:33:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "flowframe/laravel-trend",
|
||||
"version": "v0.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Flowframe/laravel-trend.git",
|
||||
"reference": "5ace11d3075932652dc48963faa732c043aeb14d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Flowframe/laravel-trend/zipball/5ace11d3075932652dc48963faa732c043aeb14d",
|
||||
"reference": "5ace11d3075932652dc48963faa732c043aeb14d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/contracts": "^8.37|^9|^10.0|^11.0|^12.0",
|
||||
"php": "^8.2",
|
||||
"spatie/laravel-package-tools": "^1.4.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"nunomaduro/collision": "^5.3|^6.1|^8.0",
|
||||
"orchestra/testbench": "^6.15|^7.0|^8.0|^9.0|^10.0",
|
||||
"pestphp/pest": "^1.18|^2.34|^3.7",
|
||||
"pestphp/pest-plugin-laravel": "^1.1|^2.3|^3.1",
|
||||
"spatie/laravel-ray": "^1.23",
|
||||
"vimeo/psalm": "^4.8|^5.6|^6.5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"aliases": {
|
||||
"Trend": "Flowframe\\Trend\\TrendFacade"
|
||||
},
|
||||
"providers": [
|
||||
"Flowframe\\Trend\\TrendServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Flowframe\\Trend\\": "src",
|
||||
"Flowframe\\Trend\\Database\\Factories\\": "database/factories"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Lars Klopstra",
|
||||
"email": "lars@flowframe.nl",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Easily generate model trends",
|
||||
"homepage": "https://github.com/flowframe/laravel-trend",
|
||||
"keywords": [
|
||||
"Flowframe",
|
||||
"laravel",
|
||||
"laravel-trend"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Flowframe/laravel-trend/issues",
|
||||
"source": "https://github.com/Flowframe/laravel-trend/tree/v0.4.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/larsklopstra",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2025-02-25T11:13:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "fruitcake/php-cors",
|
||||
"version": "v1.3.0",
|
||||
|
|
|
|||
6
lang/vendor/filament-panels/sv.json
vendored
6
lang/vendor/filament-panels/sv.json
vendored
|
|
@ -35,10 +35,12 @@
|
|||
"Email verified at": "Email verifierad den",
|
||||
"Total number of games": "Totalt antal spel i lager",
|
||||
"Total number of items": "Totalt antal saker i lager",
|
||||
"Reserved games and items": "Reserverade spel och saker",
|
||||
"Reservations at the moment": "Nuvarande reservationer",
|
||||
"Reservations over time": "Alla reservationer",
|
||||
"Phone": "Telefonnummer",
|
||||
"Literature": "Litteratur",
|
||||
"Category literature": "Kategori litteratur",
|
||||
"Category games": "Kategori spel",
|
||||
"Category items": "Kategori saker"
|
||||
"Category items": "Kategori saker",
|
||||
"Reservations by month": "Reservationer per månad"
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
<!-- Header -->
|
||||
<tr>
|
||||
<td class="header" style="background-color: #0080bb; padding: 20px; text-align: center; color: white; font-size: 18px;">
|
||||
<img style="height: 80px; width: auto"class=" w-auto h-full" src="/img/logo.png" alt="logo">
|
||||
<img style="height: 80px; width: auto"class=" w-auto h-full" src="https://boka.vbytes.se/img/logo.png" alt="logo">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<!-- Header -->
|
||||
<tr>
|
||||
<td class="header" style="background-color: #0080bb; padding: 20px; text-align: center; color: white; font-size: 18px;">
|
||||
<img style="height: 80px; width: auto"class=" w-auto h-full" src="/img/logo.png" alt="logo">
|
||||
<img style="height: 80px; width: auto"class=" w-auto h-full" src="https://boka.vbytes.se/img/logo.png" alt="logo">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<!-- Header -->
|
||||
<tr>
|
||||
<td class="header" style="background-color: #0080bb; padding: 20px; text-align: center; color: white; font-size: 18px;">
|
||||
<img style="height: 80px; width: auto"class=" w-auto h-full" src="/img/logo.png" alt="logo">
|
||||
<img style="height: 80px; width: auto"class=" w-auto h-full" src="https://boka.vbytes.se/img/logo.png" alt="logo">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<!-- Header -->
|
||||
<tr>
|
||||
<td class="header" style="background-color: #0080bb; padding: 20px; text-align: center; color: white; font-size: 18px;">
|
||||
<img style="height: 80px; width: auto"class=" w-auto h-full" src="/img/logo.png" alt="logo">
|
||||
<img style="height: 80px; width: auto"class=" w-auto h-full" src="https://boka.vbytes.se/img/logo.png" alt="logo">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<!-- Header -->
|
||||
<tr>
|
||||
<td class="header" style="background-color: #0080bb; padding: 20px; text-align: center; color: white; font-size: 18px;">
|
||||
<img style="height: 80px; width: auto"class=" w-auto h-full" src="/img/logo.png" alt="logo">
|
||||
<img style="height: 80px; width: auto"class=" w-auto h-full" src="https://boka.vbytes.se/img/logo.png" alt="logo">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
Loading…
Reference in a new issue