up
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Models\TransferenciaBodega;
|
||||
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
|
||||
use Filament\Widgets\StatsOverviewWidget\Stat;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class TransferenciasBodegaStatsWidget extends BaseWidget
|
||||
{
|
||||
protected function getStats(): array
|
||||
{
|
||||
$hoy = Carbon::today();
|
||||
$estaSemana = Carbon::now()->startOfWeek();
|
||||
$esteMes = Carbon::now()->startOfMonth();
|
||||
|
||||
$transferenciasHoy = TransferenciaBodega::whereDate('fecha_transferencia', $hoy)->count();
|
||||
$transferenciasEstaSemana = TransferenciaBodega::where('fecha_transferencia', '>=', $estaSemana)->count();
|
||||
$transferenciasEsteMes = TransferenciaBodega::where('fecha_transferencia', '>=', $esteMes)->count();
|
||||
|
||||
return [
|
||||
Stat::make('Transferencias Hoy', $transferenciasHoy)
|
||||
->description('Transferencias realizadas hoy')
|
||||
->descriptionIcon('heroicon-m-arrow-trending-up')
|
||||
->color('success'),
|
||||
|
||||
Stat::make('Esta Semana', $transferenciasEstaSemana)
|
||||
->description('Transferencias esta semana')
|
||||
->descriptionIcon('heroicon-m-calendar-days')
|
||||
->color('warning'),
|
||||
|
||||
Stat::make('Este Mes', $transferenciasEsteMes)
|
||||
->description('Transferencias este mes')
|
||||
->descriptionIcon('heroicon-m-chart-bar')
|
||||
->color('primary'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user