|
@@ -4,6 +4,7 @@ namespace App\Http\Livewire;
|
|
|
|
|
|
|
|
use Livewire\Component;
|
|
use Livewire\Component;
|
|
|
use Carbon\Carbon;
|
|
use Carbon\Carbon;
|
|
|
|
|
+use DateTimeZone;
|
|
|
use Illuminate\Support\Facades\Log;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
|
|
class Dashboard extends Component
|
|
class Dashboard extends Component
|
|
@@ -26,7 +27,7 @@ class Dashboard extends Component
|
|
|
public $expiredCertificatesChange = 0;
|
|
public $expiredCertificatesChange = 0;
|
|
|
public $suspendedSubscriptionsChange = 0;
|
|
public $suspendedSubscriptionsChange = 0;
|
|
|
|
|
|
|
|
- public $toReceive = 0;
|
|
|
|
|
|
|
+ public $received = 0;
|
|
|
public $toPay = 0;
|
|
public $toPay = 0;
|
|
|
|
|
|
|
|
public $courses = [];
|
|
public $courses = [];
|
|
@@ -200,7 +201,7 @@ class Dashboard extends Component
|
|
|
$currentMonth = now()->format('Y-m');
|
|
$currentMonth = now()->format('Y-m');
|
|
|
Log::info('Calculating financial stats for month', ['month' => $currentMonth]);
|
|
Log::info('Calculating financial stats for month', ['month' => $currentMonth]);
|
|
|
|
|
|
|
|
- $this->toReceive = \App\Models\Record::where('type', 'IN')
|
|
|
|
|
|
|
+ $this->received = \App\Models\Record::where('type', 'IN')
|
|
|
->whereRaw('DATE_FORMAT(date, "%Y-%m") = ?', [$currentMonth])
|
|
->whereRaw('DATE_FORMAT(date, "%Y-%m") = ?', [$currentMonth])
|
|
|
->where(function ($query) {
|
|
->where(function ($query) {
|
|
|
$query->where('deleted', false)->orWhere('deleted', null);
|
|
$query->where('deleted', false)->orWhere('deleted', null);
|
|
@@ -216,7 +217,7 @@ class Dashboard extends Component
|
|
|
|
|
|
|
|
$endTime = microtime(true);
|
|
$endTime = microtime(true);
|
|
|
Log::info('Financial stats loaded successfully', [
|
|
Log::info('Financial stats loaded successfully', [
|
|
|
- 'to_receive' => $this->toReceive,
|
|
|
|
|
|
|
+ 'received' => $this->received,
|
|
|
'to_pay' => $this->toPay,
|
|
'to_pay' => $this->toPay,
|
|
|
'execution_time_ms' => round(($endTime - $startTime) * 1000, 2)
|
|
'execution_time_ms' => round(($endTime - $startTime) * 1000, 2)
|
|
|
]);
|
|
]);
|
|
@@ -624,7 +625,7 @@ class Dashboard extends Component
|
|
|
$newNote = [
|
|
$newNote = [
|
|
|
'id' => uniqid(),
|
|
'id' => uniqid(),
|
|
|
'text' => trim($this->notes),
|
|
'text' => trim($this->notes),
|
|
|
- 'created_at' => now()->format('d/m/Y H:i'),
|
|
|
|
|
|
|
+ 'created_at' => now()->timezone('Europe/Rome')->format('d/m/Y H:i'),
|
|
|
'completed' => false
|
|
'completed' => false
|
|
|
];
|
|
];
|
|
|
|
|
|