49 lines
2.3 KiB
PHP
49 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\System\DashboardService;
|
|
use Carbon\Carbon;
|
|
use Inertia\Inertia;
|
|
use Inertia\Response;
|
|
|
|
class DashboardController extends Controller
|
|
{
|
|
public function __construct(
|
|
private readonly DashboardService $dashboardService,
|
|
) {}
|
|
|
|
public function index(): Response
|
|
{
|
|
$now = Carbon::now();
|
|
$startOfMonth = $now->copy()->startOfMonth();
|
|
$endOfMonth = $now->copy()->endOfMonth();
|
|
|
|
$startOfDay = Carbon::today()->startOfDay();
|
|
$endOfDay = Carbon::today()->endOfDay();
|
|
|
|
return Inertia::render('admin/Dashboard', [
|
|
'topSuppliers' => $this->dashboardService->getTopSuppliers(),
|
|
'topCustomers' => $this->dashboardService->getTopCustomers(),
|
|
'topProducts' => $this->dashboardService->getTopProducts(),
|
|
'purchaseSummary' => $this->dashboardService->getPurchaseSummary($startOfDay, $endOfDay),
|
|
'cuttingSummary' => $this->dashboardService->getCuttingSummary(),
|
|
'cuttingByStatus' => $this->dashboardService->getCuttingByStatus(),
|
|
'orderStats' => $this->dashboardService->getOrderStats(),
|
|
'revenueSummary' => $this->dashboardService->getRevenueSummary($startOfDay, $endOfDay),
|
|
'marketplaceSummary' => $this->dashboardService->getMarketplaceSummary(),
|
|
'cashAccounts' => $this->dashboardService->getCashAccounts(),
|
|
'cashSummary' => $this->dashboardService->getCashSummary($startOfDay, $endOfDay),
|
|
'monthlyCashFlow' => $this->dashboardService->getMonthlyCashFlow(),
|
|
'monthlyExpenses' => $this->dashboardService->getMonthlyExpenses($startOfDay, $endOfDay),
|
|
'kasbonSummary' => $this->dashboardService->getKasbonSummary($startOfDay, $endOfDay),
|
|
'payrollSummary' => $this->dashboardService->getPayrollSummary($startOfMonth, $endOfMonth),
|
|
'employeeSummary' => $this->dashboardService->getEmployeeSummary(),
|
|
'attendanceToday' => $this->dashboardService->getAttendanceToday($startOfDay, $endOfDay),
|
|
'monthlyRevenueTrend' => $this->dashboardService->getMonthlyRevenueTrend(),
|
|
'monthlyPurchaseTrend' => $this->dashboardService->getMonthlyPurchaseTrend(),
|
|
]);
|
|
}
|
|
}
|